1
1
// Copyright (c) .NET Foundation. All rights reserved.
2
2
// Licensed under the MIT License.
3
3
4
- import {
5
- ExponentialBackoffRetryOptions ,
6
- FixedDelayRetryOptions ,
7
- GenericFunctionOptions ,
8
- SupportedDeferredBindingTypes ,
9
- } from '@azure/functions' ;
4
+ import { ExponentialBackoffRetryOptions , FixedDelayRetryOptions , GenericFunctionOptions } from '@azure/functions' ;
10
5
import * as coreTypes from '@azure/functions-core' ;
11
6
import { returnBindingKey } from '../constants' ;
12
7
import { AzFuncSystemError } from '../errors' ;
@@ -24,7 +19,7 @@ export function toCoreFunctionMetadata(name: string, options: GenericFunctionOpt
24
19
...trigger ,
25
20
direction : 'in' ,
26
21
type : isTrigger ( trigger . type ) ? trigger . type : trigger . type + 'Trigger' ,
27
- properties : addDeferredBindingsFlag ( options . trigger . type , options . trigger . deferredBindingType ) ,
22
+ properties : addDeferredBindingsFlag ( options . trigger ?. deferredBinding ) ,
28
23
} ;
29
24
bindingNames . push ( trigger . name ) ;
30
25
@@ -33,7 +28,7 @@ export function toCoreFunctionMetadata(name: string, options: GenericFunctionOpt
33
28
bindings [ input . name ] = {
34
29
...input ,
35
30
direction : 'in' ,
36
- // properties: addDeferredBindingsFlag(input.type ),
31
+ properties : addDeferredBindingsFlag ( input ?. deferredBinding ) ,
37
32
} ;
38
33
bindingNames . push ( input . name ) ;
39
34
}
@@ -84,25 +79,11 @@ export function toCoreFunctionMetadata(name: string, options: GenericFunctionOpt
84
79
return { name, bindings, retryOptions } ;
85
80
}
86
81
87
- function addDeferredBindingsFlag (
88
- triggerType : string ,
89
- deferredBindingType ?: SupportedDeferredBindingTypes | unknown
90
- ) : { [ key : string ] : string } {
82
+ function addDeferredBindingsFlag ( deferredBindingType ?: boolean | unknown ) : { [ key : string ] : string } {
91
83
//Ensure that trigger type that is passed is valid and supported, to avoid customer misconfiguration.
92
- console . log ( 'Adding deferred binding flag: ' , deferredBindingType ) ;
93
- //TODO there is inherent issue with converting the enum to string, look for fix in the when other SDK biniding will be supported.
94
- const deferredBindingTypesSet = new Set < string > ( [
95
- 'blobTrigger' ,
96
- //TODO: enum memeber conversion is running into error, issue is with the typescript.
97
- //SupportedDeferredBindingTypes.BLOBTRIGGER,
98
- ] ) ;
99
-
100
- if (
101
- deferredBindingType !== undefined &&
102
- deferredBindingType === triggerType &&
103
- deferredBindingTypesSet . has ( triggerType )
104
- ) {
105
- console . log ( 'Adding deferred binding flag to trigger type:' , triggerType ) ;
84
+ console . log ( 'Deferred binding flag value is: ' , deferredBindingType ) ;
85
+ if ( deferredBindingType !== undefined && deferredBindingType === true ) {
86
+ console . log ( 'Adding deferred binding propertyu to trigger type:' , deferredBindingType ) ;
106
87
return { supportsDeferredBinding : 'true' } ;
107
88
}
108
89
0 commit comments