-
Notifications
You must be signed in to change notification settings - Fork 19
Add support for SDK types #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c668c46
a73e9f6
f685ec9
8200216
c8dc674
2cf21f7
3eb1adf
1372964
c87d334
8d929d3
93d1f3a
f63851a
4fabf4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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?: 'true' | 'false' | null; | ||
} | ||
|
||
interface RpcRetryOptions { | ||
maxRetryCount?: number | null; | ||
|
||
|
@@ -395,24 +401,33 @@ 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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure you sync these changes to the worker repo's core types, which is the source of truth: https://github.com/Azure/azure-functions-nodejs-worker/blob/v3.x/types-core/index.d.ts Also, not sure if you were aware, but most of the "Rpc" types are auto-generated in the worker repo based on the protobuf api contract. When you run |
||
content?: Buffer | null; | ||
contentType?: string | null; | ||
source?: string | null; | ||
version?: string | null; | ||
} | ||
|
||
interface RpcInvocationRequest { | ||
invocationId?: string | null; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
export interface ModelBindingData { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we want to expose For example, we might want to check |
||
content?: Buffer | null; | ||
contentType?: string | null; | ||
source?: string | null; | ||
version?: string | null; | ||
} | ||
|
||
export interface ConnectionInfoContent { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect this to be in |
||
Connection: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We typically convert .NET casing to more standard Node.js camel casing (for example https://github.com/Azure/azure-functions-nodejs-library/blob/v4.x/src/converters/toCamelCase.ts) |
||
ContainerName: string; | ||
BlobName: string; | ||
} | ||
|
||
export declare class ConnectionInfo { | ||
version: string; | ||
source: string; | ||
contentType: string; | ||
content: ConnectionInfoContent | undefined; | ||
|
||
constructor(modelBindingData: ModelBindingData); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should provide a convenient way for users to turn this off and on instead of hard-coding a value like this. For example in my http stream work, I added an
app.setup
method where they can enable it. Yours might look different though because I think sdk type bindings can be turned on/off for each individual function whereas for http streams I had to do all-or-nothing for the whole app