@@ -6,19 +6,17 @@ import * as coreTypes from '@azure/functions-core';
66import { returnBindingKey } from '../constants' ;
77import { AzFuncSystemError } from '../errors' ;
88import { isTrigger } from '../utils/isTrigger' ;
9- import { workerSystemLog } from '../utils/workerSystemLog' ;
109import { toRpcDuration } from './toRpcDuration' ;
1110
1211export function toCoreFunctionMetadata ( name : string , options : GenericFunctionOptions ) : coreTypes . FunctionMetadata {
1312 const bindings : Record < string , coreTypes . RpcBindingInfo > = { } ;
1413 const bindingNames : string [ ] = [ ] ;
15- const trigger = options . trigger ;
1614
15+ const trigger = options . trigger ;
1716 bindings [ trigger . name ] = {
1817 ...trigger ,
1918 direction : 'in' ,
2019 type : isTrigger ( trigger . type ) ? trigger . type : trigger . type + 'Trigger' ,
21- properties : addSdkBindingsFlag ( options . trigger ?. sdkBinding , name , trigger . type , trigger . name , false ) ,
2220 } ;
2321 bindingNames . push ( trigger . name ) ;
2422
@@ -27,7 +25,6 @@ export function toCoreFunctionMetadata(name: string, options: GenericFunctionOpt
2725 bindings [ input . name ] = {
2826 ...input ,
2927 direction : 'in' ,
30- properties : addSdkBindingsFlag ( input ?. sdkBinding , name , input . type , input . name , true ) ,
3128 } ;
3229 bindingNames . push ( input . name ) ;
3330 }
@@ -77,45 +74,3 @@ export function toCoreFunctionMetadata(name: string, options: GenericFunctionOpt
7774
7875 return { name, bindings, retryOptions } ;
7976}
80-
81- /**
82- * Adds the deferred binding flags to function bindings based on the binding configuration
83- * @param sdkBindingType Boolean indicating if this is an SDK binding
84- * @param functionName The name of the function for logging purposes
85- * @param triggerType The type of the trigger or binding
86- * @param bindingOrTriggerName The name of the trigger or binding
87- * @param isBinding Boolean indicating if this is a binding (vs a trigger)
88- * @returns Object with supportsDeferredBinding property set to 'true' or 'false'
89- */
90- export function addSdkBindingsFlag (
91- sdkBindingType ?: boolean | unknown ,
92- functionName ?: string ,
93- triggerType ?: string ,
94- bindingOrTriggerName ?: string ,
95- isBinding ?: boolean
96- ) : { [ key : string ] : string } {
97- // Ensure that trigger type is valid and supported
98- if ( sdkBindingType !== undefined && sdkBindingType === true ) {
99- const entityType = isBinding ? 'binding' : 'trigger' ;
100-
101- // Create structured JSON log entry
102- const logData = {
103- operation : 'EnableDeferredBinding' ,
104- properties : {
105- functionName : functionName || 'unknown' ,
106- entityType : entityType ,
107- triggerType : triggerType || 'unknown' ,
108- bindingOrTriggerName : bindingOrTriggerName || 'unknown' ,
109- supportsDeferredBinding : true ,
110- } ,
111- message : `Enabled Deferred Binding of type '${ triggerType || 'unknown' } ' for function '${
112- functionName || 'unknown'
113- } '`,
114- } ;
115- // Log both the structured data
116- workerSystemLog ( 'information' , JSON . stringify ( logData ) ) ;
117- return { supportsDeferredBinding : 'true' } ;
118- }
119-
120- return { supportsDeferredBinding : 'false' } ;
121- }
0 commit comments