Skip to content

Commit 053e295

Browse files
swapnil-nagarSwapnil Nagar
andauthored
Revert "Adding the SDK Binding Support for Storage Blob (#341)" (#348)
* Revert "Adding the SDK Binding Support for Storage Blob (#341)" This reverts commit 4845f8c. * Updating Undici version * Fix tests --------- Co-authored-by: Swapnil Nagar <[email protected]>
1 parent be97808 commit 053e295

15 files changed

+21
-661
lines changed

.vscode/launch.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@
1414
"request": "launch",
1515
"skipFiles": ["<node_internals>/**"],
1616
"type": "pwa-node"
17-
},
18-
{
19-
"name": "Current TS Tests File",
20-
"type": "node",
21-
"request": "launch",
22-
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
23-
"args": ["-r", "ts-node/register", "${relativeFile}"],
24-
"cwd": "${workspaceRoot}",
25-
"protocol": "inspector"
2617
}
2718
]
2819
}

package-lock.json

Lines changed: 4 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure/functions",
3-
"version": "4.7.1-preview",
3+
"version": "4.7.0",
44
"description": "Microsoft Azure Functions NodeJS Framework",
55
"keywords": [
66
"azure",
@@ -41,10 +41,9 @@
4141
"watch": "webpack --watch --mode development"
4242
},
4343
"dependencies": {
44-
"@azure/functions-extensions-base": "0.1.0-preview",
4544
"cookie": "^0.7.0",
4645
"long": "^4.0.0",
47-
"undici": "^5.13.0"
46+
"undici": "^5.29.0"
4847
},
4948
"devDependencies": {
5049
"@types/chai": "^4.2.22",
@@ -56,7 +55,6 @@
5655
"@types/mocha": "^9.1.1",
5756
"@types/node": "^18.0.0",
5857
"@types/semver": "^7.3.9",
59-
"@types/sinon": "^17.0.4",
6058
"@typescript-eslint/eslint-plugin": "^5.12.1",
6159
"@typescript-eslint/parser": "^5.12.1",
6260
"chai": "^4.2.0",
@@ -67,8 +65,8 @@
6765
"eslint-plugin-header": "^3.1.1",
6866
"eslint-plugin-import": "^2.29.0",
6967
"eslint-plugin-prettier": "^4.0.0",
70-
"eslint-plugin-simple-import-sort": "^10.0.0",
7168
"eslint-webpack-plugin": "^3.2.0",
69+
"eslint-plugin-simple-import-sort": "^10.0.0",
7270
"fork-ts-checker-webpack-plugin": "^7.2.13",
7371
"fs-extra": "^10.0.1",
7472
"globby": "^11.0.0",
@@ -78,10 +76,9 @@
7876
"mocha-multi-reporters": "^1.5.1",
7977
"prettier": "^2.4.1",
8078
"semver": "^7.3.5",
81-
"sinon": "^20.0.0",
8279
"ts-loader": "^9.3.1",
8380
"ts-node": "^3.3.0",
84-
"typescript": "^4.9.5",
81+
"typescript": "^4.5.5",
8582
"typescript4": "npm:typescript@~4.0.0",
8683
"webpack": "^5.74.0",
8784
"webpack-cli": "^4.10.0"

src/InvocationModel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ export class InvocationModel implements coreTypes.InvocationModel {
8282
} else {
8383
input = fromRpcTypedData(binding.data);
8484
}
85+
8586
if (isTimerTrigger(bindingType)) {
8687
input = toCamelCaseValue(input);
8788
}
89+
8890
if (isTrigger(bindingType)) {
8991
inputs.push(input);
9092
} else {

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
export const version = '4.7.1-preview';
4+
export const version = '4.7.0';
55

66
export const returnBindingKey = '$return';

src/converters/fromRpcTypedData.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
import { RpcTypedData } from '@azure/functions-core';
5-
import { ResourceFactoryResolver } from '@azure/functions-extensions-base';
65
import { HttpRequest } from '../http/HttpRequest';
76
import { isDefined } from '../utils/nonNull';
87

@@ -31,18 +30,8 @@ export function fromRpcTypedData(data: RpcTypedData | null | undefined): unknown
3130
return data.collectionDouble.double;
3231
} else if (data.collectionSint64 && isDefined(data.collectionSint64.sint64)) {
3332
return data.collectionSint64.sint64;
34-
} else if (data.modelBindingData && isDefined(data.modelBindingData.content)) {
35-
try {
36-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
37-
const resourceFactoryResolver: ResourceFactoryResolver = ResourceFactoryResolver.getInstance();
38-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
39-
return resourceFactoryResolver.createClient(data.modelBindingData.source, data.modelBindingData);
40-
} catch (exception) {
41-
throw new Error(
42-
'Unable to create client. Please register the extensions library with your function app. ' +
43-
`Error: ${exception instanceof Error ? exception.message : String(exception)}`
44-
);
45-
}
33+
} else {
34+
return undefined;
4635
}
4736
}
4837

src/converters/toCoreFunctionMetadata.ts

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@ import * as coreTypes from '@azure/functions-core';
66
import { returnBindingKey } from '../constants';
77
import { AzFuncSystemError } from '../errors';
88
import { isTrigger } from '../utils/isTrigger';
9-
import { workerSystemLog } from '../utils/workerSystemLog';
109
import { toRpcDuration } from './toRpcDuration';
1110

1211
export 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-
}

src/trigger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
HttpTrigger,
1414
HttpTriggerOptions,
1515
MySqlTrigger,
16-
MySqlTriggerOptions,
16+
MySqlTriggerOptions,
1717
ServiceBusQueueTrigger,
1818
ServiceBusQueueTriggerOptions,
1919
ServiceBusTopicTrigger,

0 commit comments

Comments
 (0)