Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Azure/azure-functions-nodejs-library
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.6.1
Choose a base ref
...
head repository: Azure/azure-functions-nodejs-library
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.7.0
Choose a head ref
  • 3 commits
  • 16 files changed
  • 3 contributors

Commits on Mar 5, 2025

  1. [Webpubsub] Add types for input/output/trigger (#311)

    * Init: input/output/trigger
    
    * App trigger
    phanthaiduong22 authored Mar 5, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    thg2k Giovanni Giacobbi
    Copy the full SHA
    9259cfc View commit details
  2. MySql Changes for JS (#319)

    * mysql changes
    
    * fix indentation
    
    * fix indentation
    
    * fix indentation
    
    * fix indentation
    
    * Fix comment formatting in InvocationContext.d.ts
    
    * Update link to MySQL trigger documentation
    
    ---------
    
    Co-authored-by: hallvictoria <59299039+hallvictoria@users.noreply.github.com>
    guptaheena and hallvictoria authored Mar 5, 2025
    Copy the full SHA
    bf10422 View commit details

Commits on Mar 6, 2025

  1. update to 4.7.0 (#334)

    hallvictoria authored Mar 6, 2025
    Copy the full SHA
    138c021 View commit details
Showing with 364 additions and 4 deletions.
  1. +2 −2 package-lock.json
  2. +1 −1 package.json
  3. +10 −0 src/app.ts
  4. +1 −1 src/constants.ts
  5. +4 −0 src/index.ts
  6. +27 −0 src/input.ts
  7. +18 −0 src/output.ts
  8. +18 −0 src/trigger.ts
  9. +22 −0 types/InvocationContext.d.ts
  10. +16 −0 types/app.d.ts
  11. +2 −0 types/index.d.ts
  12. +22 −0 types/input.d.ts
  13. +73 −0 types/mySql.d.ts
  14. +12 −0 types/output.d.ts
  15. +12 −0 types/trigger.d.ts
  16. +124 −0 types/webpubsub.d.ts
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/functions",
"version": "4.6.1",
"version": "4.7.0",
"description": "Microsoft Azure Functions NodeJS Framework",
"keywords": [
"azure",
10 changes: 10 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -11,13 +11,15 @@ import {
HttpHandler,
HttpMethod,
HttpMethodFunctionOptions,
MySqlFunctionOptions,
ServiceBusQueueFunctionOptions,
ServiceBusTopicFunctionOptions,
SqlFunctionOptions,
StorageBlobFunctionOptions,
StorageQueueFunctionOptions,
TimerFunctionOptions,
WarmupFunctionOptions,
WebPubSubFunctionOptions,
} from '@azure/functions';
import { FunctionCallback } from '@azure/functions-core';
import { toCoreFunctionMetadata } from './converters/toCoreFunctionMetadata';
@@ -135,6 +137,14 @@ export function sql(name: string, options: SqlFunctionOptions): void {
generic(name, convertToGenericOptions(options, trigger.sql));
}

export function mySql(name: string, options: MySqlFunctionOptions): void {
generic(name, convertToGenericOptions(options, trigger.mySql));
}

export function webPubSub(name: string, options: WebPubSubFunctionOptions): void {
generic(name, convertToGenericOptions(options, trigger.webPubSub));
}

export function generic(name: string, options: GenericFunctionOptions): void {
if (!hasSetModel) {
setProgrammingModel();
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.

export const version = '4.6.1';
export const version = '4.7.0';

export const returnBindingKey = '$return';
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -22,3 +22,7 @@ export enum SqlChangeOperation {
Update = 1,
Delete = 2,
}

export enum MySqlChangeOperation {
Update = 0,
}
27 changes: 27 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
@@ -6,12 +6,18 @@ import {
CosmosDBInputOptions,
FunctionInput,
GenericInputOptions,
MySqlInput,
MySqlInputOptions,
SqlInput,
SqlInputOptions,
StorageBlobInput,
StorageBlobInputOptions,
TableInput,
TableInputOptions,
WebPubSubConnectionInput,
WebPubSubConnectionInputOptions,
WebPubSubContextInput,
WebPubSubContextInputOptions,
} from '@azure/functions';
import { addBindingName } from './addBindingName';

@@ -43,6 +49,27 @@ export function sql(options: SqlInputOptions): SqlInput {
});
}

export function mySql(options: MySqlInputOptions): MySqlInput {
return addInputBindingName({
...options,
type: 'mysql',
});
}

export function webPubSubConnection(options: WebPubSubConnectionInputOptions): WebPubSubConnectionInput {
return addInputBindingName({
...options,
type: 'webPubSubConnection',
});
}

export function webPubSubContext(options: WebPubSubContextInputOptions): WebPubSubContextInput {
return addInputBindingName({
...options,
type: 'webPubSubContext',
});
}

export function generic(options: GenericInputOptions): FunctionInput {
return addInputBindingName(options);
}
18 changes: 18 additions & 0 deletions src/output.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ import {
GenericOutputOptions,
HttpOutput,
HttpOutputOptions,
MySqlOutput,
MySqlOutputOptions,
ServiceBusQueueOutput,
ServiceBusQueueOutputOptions,
ServiceBusTopicOutput,
@@ -24,6 +26,8 @@ import {
StorageQueueOutputOptions,
TableOutput,
TableOutputOptions,
WebPubSubOutput,
WebPubSubOutputOptions,
} from '@azure/functions';
import { addBindingName } from './addBindingName';

@@ -97,6 +101,20 @@ export function sql(options: SqlOutputOptions): SqlOutput {
});
}

export function mySql(options: MySqlOutputOptions): MySqlOutput {
return addOutputBindingName({
...options,
type: 'mysql',
});
}

export function webPubSub(options: WebPubSubOutputOptions): WebPubSubOutput {
return addOutputBindingName({
...options,
type: 'webPubSub',
});
}

export function generic(options: GenericOutputOptions): FunctionOutput {
return addOutputBindingName(options);
}
18 changes: 18 additions & 0 deletions src/trigger.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ import {
GenericTriggerOptions,
HttpTrigger,
HttpTriggerOptions,
MySqlTrigger,
MySqlTriggerOptions,
ServiceBusQueueTrigger,
ServiceBusQueueTriggerOptions,
ServiceBusTopicTrigger,
@@ -26,6 +28,8 @@ import {
TimerTriggerOptions,
WarmupTrigger,
WarmupTriggerOptions,
WebPubSubTrigger,
WebPubSubTriggerOptions,
} from '@azure/functions';
import { addBindingName } from './addBindingName';

@@ -108,6 +112,20 @@ export function sql(options: SqlTriggerOptions): SqlTrigger {
});
}

export function mySql(options: MySqlTriggerOptions): MySqlTrigger {
return addTriggerBindingName({
...options,
type: 'mysqlTrigger',
});
}

export function webPubSub(options: WebPubSubTriggerOptions): WebPubSubTrigger {
return addTriggerBindingName({
...options,
type: 'webPubSubTrigger',
});
}

export function generic(options: GenericTriggerOptions): FunctionTrigger {
return addTriggerBindingName(options);
}
22 changes: 22 additions & 0 deletions types/InvocationContext.d.ts
Original file line number Diff line number Diff line change
@@ -6,10 +6,12 @@ import { EventGridOutput, EventGridPartialEvent } from './eventGrid';
import { EventHubOutput } from './eventHub';
import { HttpOutput, HttpResponse } from './http';
import { FunctionInput, FunctionOutput, FunctionTrigger, LogLevel } from './index';
import { MySqlInput, MySqlOutput } from './mySql';
import { ServiceBusQueueOutput, ServiceBusTopicOutput } from './serviceBus';
import { SqlInput, SqlOutput } from './sql';
import { StorageBlobInput, StorageBlobOutput, StorageQueueOutput } from './storage';
import { TableInput, TableOutput } from './table';
import { WebPubSubOutput } from './webpubsub';

/**
* Contains metadata and helper methods specific to this invocation
@@ -127,6 +129,12 @@ export interface InvocationContextExtraInputs {
* @input the configuration object for this SQL input
*/
get(input: SqlInput): unknown;

/**
* Get a secondary MySql items input for this invocation
* @input the configuration object for this MySql input
*/
get(input: MySqlInput): unknown;

/**
* Get a secondary generic input for this invocation
@@ -215,6 +223,20 @@ export interface InvocationContextExtraOutputs {
* @message the output event(s) value
*/
set(output: EventGridOutput, events: EventGridPartialEvent | EventGridPartialEvent[]): void;

/**
* Set a secondary MySql items output for this invocation
* @output the configuration object for this MySql output
* @documents the output item(s) value
*/
set(output: MySqlOutput, items: unknown): void;

/**
* Set a secondary Web PubSub output for this invocation
* @output the configuration object for this Web PubSub output
* @message the output message(s) value
*/
set(output: WebPubSubOutput, messages: unknown): void;

/**
* Set a secondary generic output for this invocation
16 changes: 16 additions & 0 deletions types/app.d.ts
Original file line number Diff line number Diff line change
@@ -6,12 +6,14 @@ import { EventGridFunctionOptions } from './eventGrid';
import { EventHubFunctionOptions } from './eventHub';
import { GenericFunctionOptions } from './generic';
import { HttpFunctionOptions, HttpHandler, HttpMethodFunctionOptions } from './http';
import { MySqlFunctionOptions } from './mySql';
import { ServiceBusQueueFunctionOptions, ServiceBusTopicFunctionOptions } from './serviceBus';
import { SetupOptions } from './setup';
import { SqlFunctionOptions } from './sql';
import { StorageBlobFunctionOptions, StorageQueueFunctionOptions } from './storage';
import { TimerFunctionOptions } from './timer';
import { WarmupFunctionOptions } from './warmup';
import { WebPubSubFunctionOptions } from './webpubsub';

/**
* Optional method to configure the behavior of your app.
@@ -172,6 +174,13 @@ export function warmup(name: string, options: WarmupFunctionOptions): void;
*/
export function sql(name: string, options: SqlFunctionOptions): void;

/**
* Registers a MySql function in your app that will be triggered when a row is created or updated
* @param name The name of the function. The name must be unique within your app and will mostly be used for your own tracking purposes
* @param options Configuration options describing the inputs, outputs, and handler for this function
*/
export function mySql(name: string, options: MySqlFunctionOptions): void;

/**
* Registers a generic function in your app that will be triggered based on the type specified in `options.trigger.type`
* Use this method if your desired trigger type does not already have its own method
@@ -180,4 +189,11 @@ export function sql(name: string, options: SqlFunctionOptions): void;
*/
export function generic(name: string, options: GenericFunctionOptions): void;

/**
* Registers a WebPubSub function in your app that will be triggered by WebPubSub events
* @param name The name of the function. The name must be unique within your app and will mostly be used for your own tracking purposes
* @param options Configuration options describing the inputs, outputs, and handler for this function
*/
export function webPubSub(name: string, options: WebPubSubFunctionOptions): void;

export * as hook from './hooks/registerHook';
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ export * from './hooks/logHooks';
export * from './http';
export * as input from './input';
export * from './InvocationContext';
export * from './mySql';
export * as output from './output';
export * from './serviceBus';
export * from './setup';
@@ -26,6 +27,7 @@ export * from './table';
export * from './timer';
export * as trigger from './trigger';
export * from './warmup';
export * from './webpubsub';

/**
* Void if no `return` output is registered
22 changes: 22 additions & 0 deletions types/input.d.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,13 @@ import { FunctionInput } from './index';
import { SqlInput, SqlInputOptions } from './sql';
import { StorageBlobInput, StorageBlobInputOptions } from './storage';
import { TableInput, TableInputOptions } from './table';
import { MySqlInput, MySqlInputOptions } from './mySql';
import {
WebPubSubConnectionInput,
WebPubSubConnectionInputOptions,
WebPubSubContextInput,
WebPubSubContextInputOptions,
} from './webpubsub';

/**
* [Link to docs and examples](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob-input?pivots=programming-language-javascript)
@@ -28,6 +35,21 @@ export function cosmosDB(options: CosmosDBInputOptions): CosmosDBInput;
*/
export function sql(options: SqlInputOptions): SqlInput;

/**
* [Link to docs and examples](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-azure-mysql-input?pivots=programming-language-javascript)
*/
export function mySql(options: MySqlInputOptions): MySqlInput;

/**
* [Link to docs and examples](https://docs.microsoft.com/azure/azure-functions/functions-bindings-web-pubsub-input?pivots=programming-language-javascript)
*/
export function webPubSubConnection(options: WebPubSubConnectionInputOptions): WebPubSubConnectionInput;

/**
* [Link to docs and examples](https://docs.microsoft.com/azure/azure-functions/functions-bindings-web-pubsub-input?pivots=programming-language-javascript)
*/
export function webPubSubContext(options: WebPubSubContextInputOptions): WebPubSubContextInput;

/**
* A generic option that can be used for any input type
* Use this method if your desired input type does not already have its own method
Loading