From c668c46377df383e39ad3934f2411a5b74b85122 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Wed, 22 Nov 2023 09:26:03 -0800 Subject: [PATCH 01/13] Set SupportsDeferredBindings flag --- src/app.ts | 3 +++ types-core/index.d.ts | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/app.ts b/src/app.ts index 4473f1a..8cb8cf0 100644 --- a/src/app.ts +++ b/src/app.ts @@ -152,6 +152,9 @@ export function generic(name: string, options: GenericFunctionOptions): void { ...trigger, direction: 'in', type: isTrigger(trigger.type) ? trigger.type : trigger.type + 'Trigger', + properties: { + supportsDeferredBinding: true, + }, }; if (options.extraInputs) { diff --git a/types-core/index.d.ts b/types-core/index.d.ts index 20d118b..8956c68 100644 --- a/types-core/index.d.ts +++ b/types-core/index.d.ts @@ -353,12 +353,18 @@ declare module '@azure/functions-core' { direction?: RpcBindingDirection | null; dataType?: RpcBindingDataType | null; + + properties?: RpcBindingProperties | null; } type RpcBindingDirection = 'in' | 'out' | 'inout'; type RpcBindingDataType = 'undefined' | 'string' | 'binary' | 'stream'; + interface RpcBindingProperties { + supportsDeferredBinding?: boolean | null; + } + interface RpcRetryOptions { maxRetryCount?: number | null; From a73e9f65355d46a3e11d3721d9c257c8246df414 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Tue, 28 Nov 2023 11:52:53 -0800 Subject: [PATCH 02/13] ModelBindingData added --- src/app.ts | 3 --- src/converters/fromRpcTypedData.ts | 2 ++ types-core/index.d.ts | 26 ++++++++++++++++++++------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/app.ts b/src/app.ts index 8cb8cf0..4473f1a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -152,9 +152,6 @@ export function generic(name: string, options: GenericFunctionOptions): void { ...trigger, direction: 'in', type: isTrigger(trigger.type) ? trigger.type : trigger.type + 'Trigger', - properties: { - supportsDeferredBinding: true, - }, }; if (options.extraInputs) { diff --git a/src/converters/fromRpcTypedData.ts b/src/converters/fromRpcTypedData.ts index a8ed963..c2c2b3c 100644 --- a/src/converters/fromRpcTypedData.ts +++ b/src/converters/fromRpcTypedData.ts @@ -30,6 +30,8 @@ export function fromRpcTypedData(data: RpcTypedData | null | undefined): unknown return data.collectionDouble.double; } else if (data.collectionSint64 && isDefined(data.collectionSint64.sint64)) { return data.collectionSint64.sint64; + } else if (data.modelBindingData && isDefined(data.modelBindingData.content)) { + return data.modelBindingData; } else { return undefined; } diff --git a/types-core/index.d.ts b/types-core/index.d.ts index 8956c68..b8591e7 100644 --- a/types-core/index.d.ts +++ b/types-core/index.d.ts @@ -401,24 +401,38 @@ declare module '@azure/functions-core' { collectionDouble?: RpcCollectionDouble | null; collectionSint64?: RpcCollectionSInt64 | null; + + modelBindingData?: ModelBindingData | null; } - interface RpcCollectionSInt64 { - sint64?: (number | Long)[] | null; + interface RpcCollectionBytes { + bytes?: Uint8Array[] | null; } interface RpcCollectionString { string?: string[] | null; } - interface RpcCollectionBytes { - bytes?: Uint8Array[] | null; - } - interface RpcCollectionDouble { double?: number[] | null; } + interface RpcCollectionSInt64 { + sint64?: (number | Long)[] | null; + } + + interface ModelBindingData { + content?: ModelBindingDataContent | null; + } + + interface ModelBindingDataContent { + connection: string | null; + + containerName: string | null; + + blobName: string | null; + } + interface RpcInvocationRequest { invocationId?: string | null; From f685ec9237b54f7199e9dd25cc189038b5493904 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Tue, 5 Dec 2023 10:59:15 -0800 Subject: [PATCH 03/13] Fix ESLint issue --- src/converters/fromRpcTypedData.ts | 2 +- types-core/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/converters/fromRpcTypedData.ts b/src/converters/fromRpcTypedData.ts index c2c2b3c..510b674 100644 --- a/src/converters/fromRpcTypedData.ts +++ b/src/converters/fromRpcTypedData.ts @@ -30,7 +30,7 @@ export function fromRpcTypedData(data: RpcTypedData | null | undefined): unknown return data.collectionDouble.double; } else if (data.collectionSint64 && isDefined(data.collectionSint64.sint64)) { return data.collectionSint64.sint64; - } else if (data.modelBindingData && isDefined(data.modelBindingData.content)) { + } else if (data.modelBindingData && isDefined(data.modelBindingData.data)) { return data.modelBindingData; } else { return undefined; diff --git a/types-core/index.d.ts b/types-core/index.d.ts index b8591e7..f436b2d 100644 --- a/types-core/index.d.ts +++ b/types-core/index.d.ts @@ -422,7 +422,7 @@ declare module '@azure/functions-core' { } interface ModelBindingData { - content?: ModelBindingDataContent | null; + data?: ModelBindingDataContent | null; } interface ModelBindingDataContent { From 8200216bb454f46743f378ac269cd7bbad1d5f29 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Tue, 5 Dec 2023 14:55:08 -0800 Subject: [PATCH 04/13] Add modelBindingData to toRpcTypedData --- src/converters/toRpcTypedData.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/converters/toRpcTypedData.ts b/src/converters/toRpcTypedData.ts index bd4f83f..651adfe 100644 --- a/src/converters/toRpcTypedData.ts +++ b/src/converters/toRpcTypedData.ts @@ -22,6 +22,10 @@ export function toRpcTypedData(data: unknown): RpcTypedData | null | undefined { } else { return { double: data }; } + } else if (typeof data === 'object') { + if ('data' in data) { + return { modelBindingData: data } as RpcTypedData; + } } else { return { json: JSON.stringify(data) }; } From c8dc6748965c5c58daec8d8153d20d3c316ce152 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Thu, 7 Dec 2023 15:30:19 -0800 Subject: [PATCH 05/13] Refactoring toRpcTypedData --- src/converters/toRpcTypedData.ts | 38 ++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/converters/toRpcTypedData.ts b/src/converters/toRpcTypedData.ts index 651adfe..21be391 100644 --- a/src/converters/toRpcTypedData.ts +++ b/src/converters/toRpcTypedData.ts @@ -6,27 +6,33 @@ import { RpcTypedData } from '@azure/functions-core'; export function toRpcTypedData(data: unknown): RpcTypedData | null | undefined { if (data === null || data === undefined) { return data; - } else if (typeof data === 'string') { + } + + if (typeof data === 'string') { return { string: data }; - } else if (Buffer.isBuffer(data)) { + } + + if (Buffer.isBuffer(data)) { return { bytes: data }; - } else if (ArrayBuffer.isView(data)) { + } + + if (ArrayBuffer.isView(data)) { const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength); return { bytes: bytes }; - } else if (data instanceof ArrayBuffer) { + } + + if (data instanceof ArrayBuffer) { const bytes = new Uint8Array(data); return { bytes: bytes }; - } else if (typeof data === 'number') { - if (Number.isInteger(data)) { - return { int: data }; - } else { - return { double: data }; - } - } else if (typeof data === 'object') { - if ('data' in data) { - return { modelBindingData: data } as RpcTypedData; - } - } else { - return { json: JSON.stringify(data) }; } + + if (typeof data === 'number') { + return Number.isInteger(data) ? { int: data } : { double: data }; + } + + if (typeof data === 'object' && 'data' in data) { + return { modelBindingData: data } as RpcTypedData; + } + + return { json: JSON.stringify(data) }; } From 2cf21f7c9ba19e1c4646f64447fe412fdb811233 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Tue, 12 Dec 2023 14:36:07 -0800 Subject: [PATCH 06/13] Add back properties field --- src/app.ts | 1 + src/converters/fromRpcTriggerMetadata.ts | 13 +++++++------ src/converters/toCamelCase.ts | 17 ++++++++++------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/app.ts b/src/app.ts index 4473f1a..e4e76a6 100644 --- a/src/app.ts +++ b/src/app.ts @@ -152,6 +152,7 @@ export function generic(name: string, options: GenericFunctionOptions): void { ...trigger, direction: 'in', type: isTrigger(trigger.type) ? trigger.type : trigger.type + 'Trigger', + properties: { supportsDeferredBinding: true }, }; if (options.extraInputs) { diff --git a/src/converters/fromRpcTriggerMetadata.ts b/src/converters/fromRpcTriggerMetadata.ts index 4e5efd1..4807591 100644 --- a/src/converters/fromRpcTriggerMetadata.ts +++ b/src/converters/fromRpcTriggerMetadata.ts @@ -17,11 +17,12 @@ export function fromRpcTriggerMetadata( // 3. We can represent that information on the request & timer objects instead if (!triggerMetadata || isHttpTrigger(triggerType) || isTimerTrigger(triggerType)) { return undefined; - } else { - const result: TriggerMetadata = {}; - for (const [key, value] of Object.entries(triggerMetadata)) { - result[toCamelCaseKey(key)] = toCamelCaseValue(fromRpcTypedData(value)); - } - return result; } + + const result: TriggerMetadata = {}; + for (const [key, value] of Object.entries(triggerMetadata)) { + result[toCamelCaseKey(key)] = toCamelCaseValue(fromRpcTypedData(value)); + } + + return result; } diff --git a/src/converters/toCamelCase.ts b/src/converters/toCamelCase.ts index fc1c867..2ec02a3 100644 --- a/src/converters/toCamelCase.ts +++ b/src/converters/toCamelCase.ts @@ -4,15 +4,18 @@ export function toCamelCaseValue(data: unknown): unknown { if (typeof data !== 'object' || data === null) { return data; - } else if (Array.isArray(data)) { + } + + if (Array.isArray(data)) { return data.map(toCamelCaseValue); - } else { - const result = {}; - for (const [key, value] of Object.entries(data)) { - result[toCamelCaseKey(key)] = toCamelCaseValue(value); - } - return result; } + + const result = {}; + for (const [key, value] of Object.entries(data)) { + result[toCamelCaseKey(key)] = toCamelCaseValue(value); + } + + return result; } export function toCamelCaseKey(key: string): string { From 3eb1adf1fc7c390793d0849e9ff402dd72a86ca8 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Wed, 20 Dec 2023 12:35:17 -0800 Subject: [PATCH 07/13] Roll back style changes --- src/converters/fromRpcTriggerMetadata.ts | 13 +++++------ src/converters/toCamelCase.ts | 17 ++++++-------- src/converters/toRpcTypedData.ts | 28 +++++++----------------- 3 files changed, 21 insertions(+), 37 deletions(-) diff --git a/src/converters/fromRpcTriggerMetadata.ts b/src/converters/fromRpcTriggerMetadata.ts index 4807591..4e5efd1 100644 --- a/src/converters/fromRpcTriggerMetadata.ts +++ b/src/converters/fromRpcTriggerMetadata.ts @@ -17,12 +17,11 @@ export function fromRpcTriggerMetadata( // 3. We can represent that information on the request & timer objects instead if (!triggerMetadata || isHttpTrigger(triggerType) || isTimerTrigger(triggerType)) { return undefined; + } else { + const result: TriggerMetadata = {}; + for (const [key, value] of Object.entries(triggerMetadata)) { + result[toCamelCaseKey(key)] = toCamelCaseValue(fromRpcTypedData(value)); + } + return result; } - - const result: TriggerMetadata = {}; - for (const [key, value] of Object.entries(triggerMetadata)) { - result[toCamelCaseKey(key)] = toCamelCaseValue(fromRpcTypedData(value)); - } - - return result; } diff --git a/src/converters/toCamelCase.ts b/src/converters/toCamelCase.ts index 2ec02a3..fc1c867 100644 --- a/src/converters/toCamelCase.ts +++ b/src/converters/toCamelCase.ts @@ -4,18 +4,15 @@ export function toCamelCaseValue(data: unknown): unknown { if (typeof data !== 'object' || data === null) { return data; - } - - if (Array.isArray(data)) { + } else if (Array.isArray(data)) { return data.map(toCamelCaseValue); + } else { + const result = {}; + for (const [key, value] of Object.entries(data)) { + result[toCamelCaseKey(key)] = toCamelCaseValue(value); + } + return result; } - - const result = {}; - for (const [key, value] of Object.entries(data)) { - result[toCamelCaseKey(key)] = toCamelCaseValue(value); - } - - return result; } export function toCamelCaseKey(key: string): string { diff --git a/src/converters/toRpcTypedData.ts b/src/converters/toRpcTypedData.ts index 21be391..5dea6d6 100644 --- a/src/converters/toRpcTypedData.ts +++ b/src/converters/toRpcTypedData.ts @@ -6,33 +6,21 @@ import { RpcTypedData } from '@azure/functions-core'; export function toRpcTypedData(data: unknown): RpcTypedData | null | undefined { if (data === null || data === undefined) { return data; - } - - if (typeof data === 'string') { + } else if (typeof data === 'string') { return { string: data }; - } - - if (Buffer.isBuffer(data)) { + } else if (Buffer.isBuffer(data)) { return { bytes: data }; - } - - if (ArrayBuffer.isView(data)) { + } else if (ArrayBuffer.isView(data)) { const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength); return { bytes: bytes }; - } - - if (data instanceof ArrayBuffer) { + } else if (data instanceof ArrayBuffer) { const bytes = new Uint8Array(data); return { bytes: bytes }; - } - - if (typeof data === 'number') { + } else if (typeof data === 'number') { return Number.isInteger(data) ? { int: data } : { double: data }; - } - - if (typeof data === 'object' && 'data' in data) { + } else if (typeof data === 'object') { return { modelBindingData: data } as RpcTypedData; + } else { + return { json: JSON.stringify(data) }; } - - return { json: JSON.stringify(data) }; } From 13729645e497d73521b757624fb50fec7715303e Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Wed, 20 Dec 2023 15:24:04 -0800 Subject: [PATCH 08/13] Refactoring modelBindingData --- src/converters/fromRpcTypedData.ts | 4 ++-- types-core/index.d.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/converters/fromRpcTypedData.ts b/src/converters/fromRpcTypedData.ts index 510b674..ece0ce9 100644 --- a/src/converters/fromRpcTypedData.ts +++ b/src/converters/fromRpcTypedData.ts @@ -30,8 +30,8 @@ export function fromRpcTypedData(data: RpcTypedData | null | undefined): unknown return data.collectionDouble.double; } else if (data.collectionSint64 && isDefined(data.collectionSint64.sint64)) { return data.collectionSint64.sint64; - } else if (data.modelBindingData && isDefined(data.modelBindingData.data)) { - return data.modelBindingData; + } else if (data.modelBindingData && isDefined(data.modelBindingData.content)) { + return data.modelBindingData.content; } else { return undefined; } diff --git a/types-core/index.d.ts b/types-core/index.d.ts index f436b2d..449e1e7 100644 --- a/types-core/index.d.ts +++ b/types-core/index.d.ts @@ -362,7 +362,7 @@ declare module '@azure/functions-core' { type RpcBindingDataType = 'undefined' | 'string' | 'binary' | 'stream'; interface RpcBindingProperties { - supportsDeferredBinding?: boolean | null; + supportsDeferredBinding?: 'true' | 'false' | null; } interface RpcRetryOptions { @@ -422,15 +422,15 @@ declare module '@azure/functions-core' { } interface ModelBindingData { - data?: ModelBindingDataContent | null; + content?: ModelBindingDataContent | null; + contentType?: string | null; + source?: string | null; + version?: string | null; } interface ModelBindingDataContent { - connection: string | null; - - containerName: string | null; - - blobName: string | null; + data?: Uint8Array | null; + type?: string | null; } interface RpcInvocationRequest { From c87d33448a423217a668d979ec08a94a8ab5e13e Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Wed, 10 Jan 2024 16:06:38 -0800 Subject: [PATCH 09/13] Working prototype --- src/converters/fromRpcTypedData.ts | 3 ++- src/index.ts | 1 + src/utils/ConnectionInfo.ts | 26 ++++++++++++++++++++++++++ types-core/index.d.ts | 7 +------ types/connectionInfo.d.ts | 24 ++++++++++++++++++++++++ types/index.d.ts | 1 + 6 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 src/utils/ConnectionInfo.ts create mode 100644 types/connectionInfo.d.ts diff --git a/src/converters/fromRpcTypedData.ts b/src/converters/fromRpcTypedData.ts index ece0ce9..16c21b4 100644 --- a/src/converters/fromRpcTypedData.ts +++ b/src/converters/fromRpcTypedData.ts @@ -3,6 +3,7 @@ import { RpcTypedData } from '@azure/functions-core'; import { HttpRequest } from '../http/HttpRequest'; +import { ConnectionInfo } from '../utils/ConnectionInfo'; import { isDefined } from '../utils/nonNull'; export function fromRpcTypedData(data: RpcTypedData | null | undefined): unknown { @@ -31,7 +32,7 @@ export function fromRpcTypedData(data: RpcTypedData | null | undefined): unknown } else if (data.collectionSint64 && isDefined(data.collectionSint64.sint64)) { return data.collectionSint64.sint64; } else if (data.modelBindingData && isDefined(data.modelBindingData.content)) { - return data.modelBindingData.content; + return new ConnectionInfo(data.modelBindingData); } else { return undefined; } diff --git a/src/index.ts b/src/index.ts index 761f676..df1efe2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,4 +14,5 @@ export * as input from './input'; export { InvocationContext } from './InvocationContext'; export * as output from './output'; export * as trigger from './trigger'; +export { ConnectionInfo } from './utils/ConnectionInfo'; export { Disposable } from './utils/Disposable'; diff --git a/src/utils/ConnectionInfo.ts b/src/utils/ConnectionInfo.ts new file mode 100644 index 0000000..f6bbdb1 --- /dev/null +++ b/src/utils/ConnectionInfo.ts @@ -0,0 +1,26 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + +import { ModelBindingData } from '@azure/functions-core'; + +export interface ConnectionInfoContent { + Connection: string; + ContainerName: string; + BlobName: string; +} + +export class ConnectionInfo { + version: string; + source: string; + contentType: string; + content: ConnectionInfoContent | undefined; + + constructor(modelBindingData: ModelBindingData) { + this.version = modelBindingData.version as string; + this.source = modelBindingData.source as string; + this.contentType = modelBindingData.contentType as string; + this.content = modelBindingData.content + ? (JSON.parse(modelBindingData.content.toString()) as ConnectionInfoContent) + : undefined; + } +} diff --git a/types-core/index.d.ts b/types-core/index.d.ts index 449e1e7..10b8fa8 100644 --- a/types-core/index.d.ts +++ b/types-core/index.d.ts @@ -422,17 +422,12 @@ declare module '@azure/functions-core' { } interface ModelBindingData { - content?: ModelBindingDataContent | null; + content?: Buffer | null; contentType?: string | null; source?: string | null; version?: string | null; } - interface ModelBindingDataContent { - data?: Uint8Array | null; - type?: string | null; - } - interface RpcInvocationRequest { invocationId?: string | null; diff --git a/types/connectionInfo.d.ts b/types/connectionInfo.d.ts new file mode 100644 index 0000000..76be7d8 --- /dev/null +++ b/types/connectionInfo.d.ts @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT License. + +export interface ModelBindingData { + content?: Buffer | null; + contentType?: string | null; + source?: string | null; + version?: string | null; +} + +export interface ConnectionInfoContent { + Connection: string; + ContainerName: string; + BlobName: string; +} + +export declare class ConnectionInfo { + version: string; + source: string; + contentType: string; + content: ConnectionInfoContent | undefined; + + constructor(modelBindingData: ModelBindingData); +} diff --git a/types/index.d.ts b/types/index.d.ts index 2fc5406..2f1e740 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -4,6 +4,7 @@ import { InvocationContext } from './InvocationContext'; export * as app from './app'; +export * from './connectionInfo'; export * from './cosmosDB'; export * from './cosmosDB.v3'; export * from './cosmosDB.v4'; From 8d929d30c64dead4fbdfb6796d081067e54f861d Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Thu, 11 Jan 2024 16:21:27 -0800 Subject: [PATCH 10/13] Check trigger type --- src/app.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index e4e76a6..9b91a4d 100644 --- a/src/app.ts +++ b/src/app.ts @@ -78,6 +78,14 @@ function convertToGenericOptions & Pa }; } +function addDeferredBindingsFlag(triggerType: string): { [key: string]: string } | undefined { + if (triggerType === 'blobTrigger') { + return { supportsDeferredBinding: 'true' }; + } + + return undefined; +} + export function get(name: string, optionsOrHandler: HttpMethodFunctionOptions | HttpHandler): void { http(name, convertToHttpOptions(optionsOrHandler, 'GET')); } @@ -152,7 +160,7 @@ export function generic(name: string, options: GenericFunctionOptions): void { ...trigger, direction: 'in', type: isTrigger(trigger.type) ? trigger.type : trigger.type + 'Trigger', - properties: { supportsDeferredBinding: true }, + properties: addDeferredBindingsFlag(options.trigger.type), }; if (options.extraInputs) { From 93d1f3a8ed778031e95ee1a22f147edc74689a23 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Fri, 12 Jan 2024 13:33:09 -0800 Subject: [PATCH 11/13] Fix tests --- src/converters/toRpcTypedData.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/converters/toRpcTypedData.ts b/src/converters/toRpcTypedData.ts index 5dea6d6..9565e5f 100644 --- a/src/converters/toRpcTypedData.ts +++ b/src/converters/toRpcTypedData.ts @@ -18,8 +18,6 @@ export function toRpcTypedData(data: unknown): RpcTypedData | null | undefined { return { bytes: bytes }; } else if (typeof data === 'number') { return Number.isInteger(data) ? { int: data } : { double: data }; - } else if (typeof data === 'object') { - return { modelBindingData: data } as RpcTypedData; } else { return { json: JSON.stringify(data) }; } From f63851a32a7680ad7dc21c0d24eca7ce7148fc08 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Fri, 12 Jan 2024 13:40:38 -0800 Subject: [PATCH 12/13] Remove style changes --- src/converters/toRpcTypedData.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/converters/toRpcTypedData.ts b/src/converters/toRpcTypedData.ts index 9565e5f..bd4f83f 100644 --- a/src/converters/toRpcTypedData.ts +++ b/src/converters/toRpcTypedData.ts @@ -17,7 +17,11 @@ export function toRpcTypedData(data: unknown): RpcTypedData | null | undefined { const bytes = new Uint8Array(data); return { bytes: bytes }; } else if (typeof data === 'number') { - return Number.isInteger(data) ? { int: data } : { double: data }; + if (Number.isInteger(data)) { + return { int: data }; + } else { + return { double: data }; + } } else { return { json: JSON.stringify(data) }; } From 4fabf4f6a117356a7eecca418aba5a7fcf8900d6 Mon Sep 17 00:00:00 2001 From: Daniel Castro Date: Fri, 12 Jan 2024 13:45:16 -0800 Subject: [PATCH 13/13] Remove undefined return type --- src/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index 9b91a4d..602d6ea 100644 --- a/src/app.ts +++ b/src/app.ts @@ -78,12 +78,12 @@ function convertToGenericOptions & Pa }; } -function addDeferredBindingsFlag(triggerType: string): { [key: string]: string } | undefined { +function addDeferredBindingsFlag(triggerType: string): { [key: string]: string } { if (triggerType === 'blobTrigger') { return { supportsDeferredBinding: 'true' }; } - return undefined; + return { supportsDeferredBinding: 'false' }; } export function get(name: string, optionsOrHandler: HttpMethodFunctionOptions | HttpHandler): void {