-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add support for SDK types #203
Conversation
} | ||
|
||
export interface ConnectionInfoContent { | ||
Connection: string; |
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 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)
version?: string | null; | ||
} | ||
|
||
export interface ConnectionInfoContent { |
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.
I would expect this to be in types/storage.d.ts
and have more storage/blob-specific naming
// 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 comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to expose ModelBindingData
/ConnectionInfo
outside this package necessarily. These seem more like internal properties that we should handle, not the user. Even in your example, the user's code is only using info.content
instead of any properties directly on info
.
For example, we might want to check info.version
internally and throw an error if the major version doesn't match what we expect. I believe that version
property is a schema version for the content
property, so If the major version is different the ConnectionInfoContent
type we're providing to the user probably won't be right and an error would be appropriate IMO
@@ -78,6 +78,14 @@ function convertToGenericOptions<T extends Omit<FunctionOptions, 'trigger'> & Pa | |||
}; | |||
} | |||
|
|||
function addDeferredBindingsFlag(triggerType: string): { [key: string]: string } { | |||
if (triggerType === 'blobTrigger') { | |||
return { supportsDeferredBinding: 'true' }; |
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
sint64?: (number | Long)[] | null; | ||
} | ||
|
||
interface 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.
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 npm run build
in the worker repo the rpc types are output to dist/azure-functions-language-worker-protobuf/src/rpc.d.ts
. For the core api, we copy the minimal types we need and clean it up a tiny bit (remove unnecessary comments, usually rename it from IModelBindingData
to RpcModelBindingData
, etc.)
This PR adds deferred binding support for blob triggers. This allows customers to use the
CollectionInfo
object to create SDK clients (note: connection strings will still need to be resolved by customers).For example: