Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
57b48be
Add Functions gRPC core helpers
YunchuWang Jun 29, 2026
c272a55
Add raw Functions gRPC worker processors
YunchuWang Jun 29, 2026
fb3a55b
Remove extra client task hub shortcut
YunchuWang Jun 29, 2026
fe7c594
Align Functions gRPC support with Python and drop extra surface
YunchuWang Jun 30, 2026
f54138d
Add Azure Functions Durable workspace package
YunchuWang Jul 1, 2026
93f5122
Rename Azure Functions Durable package folder
YunchuWang Jul 1, 2026
9ca4fce
Remove unused requiredQueryStringParameters param from metadata gener…
YunchuWang Jul 1, 2026
ff3ab8f
Add trigger registration with durableRequiresGrpc opt-in and getClien…
YunchuWang Jul 7, 2026
4d26c6b
Add classic (v3) backward-compat layer, v3 client query APIs, and rel…
YunchuWang Jul 7, 2026
91ba76b
Simplify azure-functions-durable tsconfig.build.json
YunchuWang Jul 7, 2026
11a042d
Enhance createHttpManagementPayload to support classic v3 single-argu…
YunchuWang Jul 8, 2026
b98583a
Add classic (v3) lifecycle aliases and purgeInstanceHistoryBy method …
YunchuWang Jul 8, 2026
4ca9a62
Merge branch 'yunchuwang/functions-grpc-support' of https://github.co…
YunchuWang Jul 8, 2026
8d863de
Add classic (v3) entity support and custom status handling in Durable…
YunchuWang Jul 8, 2026
708a950
Add deprecated alias getClientResponseLinks for createHttpManagementP…
YunchuWang Jul 8, 2026
00d705e
Simplify Azure Functions Durable CHANGELOG and README per review
YunchuWang Jul 8, 2026
073bf25
Export v3-compatible ActivityHandler/OrchestrationHandler/Orchestrati…
YunchuWang Jul 8, 2026
cd2b6ff
Fix wrapOrchestrator to drive classic v3 orchestrators via async gene…
YunchuWang Jul 9, 2026
bfc4e3b
Add EntityContext/EntityHandler/DurableClient aliases and replay-safe…
YunchuWang Jul 9, 2026
701cd13
Fix purgeInstanceHistoryBy to accept an OrchestrationFilter object (v…
YunchuWang Jul 9, 2026
834d347
Extract named OrchestrationFilter type and reuse in getStatusBy/purge…
YunchuWang Jul 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@

This repo contains a JavaScript/TypeScript SDK for use with the [Azure Durable Task Scheduler](https://github.com/Azure/Durable-Task-Scheduler). With this SDK, you can define, schedule, and manage durable orchestrations using ordinary TypeScript/JavaScript code.

> Note that this SDK is **not** currently compatible with [Azure Durable Functions](https://learn.microsoft.com/azure/azure-functions/durable/durable-functions-overview). If you are looking for a JavaScript SDK for Azure Durable Functions, please see [this repo](https://github.com/Azure/azure-functions-durable-js).
> Note that this SDK does **not** provide the [Azure Durable Functions](https://learn.microsoft.com/azure/azure-functions/durable/durable-functions-overview) programming model, decorators, or worker-indexing metadata. If you are looking for a JavaScript SDK for Azure Durable Functions, please see [this repo](https://github.com/Azure/azure-functions-durable-js). This package exposes low-level TaskHubSidecarService gRPC/protobuf helpers that host integrations can reuse; those helpers follow this package's Node.js 22+ requirement.

## Low-level host integration APIs

Host integrations that already own trigger metadata and transport encoding can depend on the `@microsoft/durabletask-js` package directly. `TaskHubGrpcWorker` registers orchestrators, activities, and entities, and can process raw TaskHubSidecarService protobuf payloads without starting the long-running gRPC worker loop:

```typescript
const worker = new TaskHubGrpcWorker();
worker.addOrchestrator(myOrchestrator);
worker.addActivity(myActivity);
worker.addEntity(myEntity);

const orchestrationResponseBytes = await worker.processOrchestratorRequest(orchestrationRequestBytes);
const entityResponseBytes = await worker.processEntityBatchRequest(entityBatchRequestBytes);
```

`TaskHubGrpcClient` already exposes orchestration start/query/event/terminate/suspend/resume/purge APIs and entity signal/read/query/clean APIs through its existing `hostAddress` and `metadataGenerator` options. Host integrations that need task-hub routing metadata should provide it through `metadataGenerator`, keeping host-specific metadata policy outside the core client. Azure-managed scheduler connection strings remain in `@microsoft/durabletask-js-azuremanaged`.

## npm packages

Expand Down
31 changes: 31 additions & 0 deletions eng/ci/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,34 @@ extends:
serviceendpointurl: 'https://api.esrp.microsoft.com'
mainpublisher: 'durabletask-java'
domaintenantid: '33e01921-4d64-4f8c-a055-5bdaffd5e33d'

- job: durable_functions
displayName: 'Release durable-functions'
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
pipeline: DurableTaskJSBuildPipeline
artifactName: drop
targetPath: $(System.DefaultWorkingDirectory)/drop

steps:
- task: SFP.release-tasks.custom-build-release-task.EsrpRelease@9
displayName: 'ESRP Release durable-functions'
inputs:
connectedservicename: 'dtfx-internal-esrp-prod'
usemanagedidentity: true
keyvaultname: 'durable-esrp-akv'
signcertname: 'dts-esrp-cert'
clientid: '0b3ed1a4-0727-4a50-b82a-02c2bd9dec89'
intent: 'PackageDistribution'
contenttype: 'npm'
contentsource: 'Folder'
folderlocation: '$(System.DefaultWorkingDirectory)/drop/buildoutputs/azure-functions-durable'
waitforreleasecompletion: true
owners: 'wangbill@microsoft.com'
approvers: 'kaibocai@microsoft.com'
serviceendpointurl: 'https://api.esrp.microsoft.com'
mainpublisher: 'durabletask-java'
domaintenantid: '33e01921-4d64-4f8c-a055-5bdaffd5e33d'
14 changes: 13 additions & 1 deletion eng/templates/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ jobs:
npm pack
displayName: "pack @microsoft/durabletask-js-azuremanaged"

# Pack durable-functions
- script: |
cd packages/azure-functions-durable
npm pack
displayName: "pack durable-functions"

# Copy each package to its own staging subfolder
- task: CopyFiles@2
displayName: "Copy durabletask-js to staging"
Expand All @@ -56,4 +62,10 @@ jobs:
inputs:
SourceFolder: $(System.DefaultWorkingDirectory)/packages/durabletask-js-azuremanaged
Contents: "*.tgz"
TargetFolder: $(Build.ArtifactStagingDirectory)/buildoutputs/durabletask-js-azuremanaged
TargetFolder: $(Build.ArtifactStagingDirectory)/buildoutputs/durabletask-js-azuremanaged
- task: CopyFiles@2
displayName: "Copy azure-functions-durable to staging"
inputs:
SourceFolder: $(System.DefaultWorkingDirectory)/packages/azure-functions-durable
Contents: "*.tgz"
TargetFolder: $(Build.ArtifactStagingDirectory)/buildoutputs/azure-functions-durable
72 changes: 72 additions & 0 deletions package-lock.json

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

5 changes: 5 additions & 0 deletions packages/azure-functions-durable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 4.0.0-alpha.0

- Added the initial gRPC-consolidated Azure Functions Durable provider package.
Comment thread
YunchuWang marked this conversation as resolved.
21 changes: 21 additions & 0 deletions packages/azure-functions-durable/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
50 changes: 50 additions & 0 deletions packages/azure-functions-durable/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# durable-functions
Comment thread
YunchuWang marked this conversation as resolved.

Write [Azure Durable Functions](https://learn.microsoft.com/azure/azure-functions/durable/) orchestrations, activities, and entities in JavaScript and TypeScript, running on the [Durable Task JavaScript SDK](https://github.com/microsoft/durabletask-js).

## What this package is

`durable-functions` is the Azure Functions Durable provider for JavaScript, built on `@microsoft/durabletask-js`. You author Durable Functions apps with the familiar `app.orchestration` / `app.activity` / `app.entity` model, and the provider talks to the Durable Task backend over the Functions host's gRPC channel.

This is a new major version that supersedes the legacy [`durable-functions`](https://github.com/Azure/azure-functions-durable-js) package. New and existing (classic v3) orchestration, activity, and entity code all run on the same gRPC engine.

## Why it is needed

- **One gRPC protocol.** Durable work items flow between the Functions host and your app over a single gRPC channel instead of the legacy out-of-proc HTTP protocol, keeping the JavaScript provider aligned with the .NET, Python, and Java Durable providers.
- **Shared core engine.** Orchestration replay, activities, entities, retries, and instance-management APIs all come from `@microsoft/durabletask-js`, so behavior matches the other Durable Task SDKs.
- **Backward compatible.** Existing v3 Durable Functions orchestrators and entities keep working through a compatibility layer, so you can move to this provider without rewriting your functions.

## What it supports

- **Authoring** — `app.orchestration`, `app.activity`, and `app.entity` register durable functions (each trigger opts into the host's gRPC protocol automatically).
- **Client** — `getClient(context)` returns a `DurableFunctionsClient` for scheduling, querying, signaling, and managing instances, plus HTTP management-payload helpers (`createCheckStatusResponse`, `createHttpManagementPayload`) for durable HTTP starters.
- **Classic (v3) compatibility** — orchestrators and entities written in the legacy `context.df.*` style, `RetryOptions`, `EntityId`, and the deprecated client aliases are adapted onto the core engine.

## Getting started

```typescript
import * as df from "durable-functions";
import { app, HttpRequest, HttpResponseInit, InvocationContext } from "@azure/functions";

df.app.orchestration("helloOrchestrator", async function* (ctx, input) {
return yield ctx.callActivity("sayHello", input);
});

df.app.activity("sayHello", {
handler: (name: string) => `Hello, ${name}!`,
});

app.http("startHello", {
route: "orchestrators/helloOrchestrator",
extraInputs: [df.input.durableClient()],
handler: async (request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> => {
const client = df.getClient(context);
const instanceId = await client.scheduleNewOrchestration("helloOrchestrator", "Durable");
return client.createCheckStatusResponse(request, instanceId);
},
});
```

## Status

This package is an early preview (`4.0.0-alpha.0`); APIs may change before the stable release.
12 changes: 12 additions & 0 deletions packages/azure-functions-durable/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/test/**/*.spec.ts"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
transform: {
"^.+\\.ts$": "ts-jest",
},
moduleNameMapper: {
"^@microsoft/durabletask-js$": "<rootDir>/../durabletask-js/src/index.ts",
},
};
63 changes: 63 additions & 0 deletions packages/azure-functions-durable/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "durable-functions",
"version": "4.0.0-alpha.0",
"description": "Azure Functions Durable provider for the Durable Task JavaScript SDK",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.js"
}
},
"files": [
"dist",
"LICENSE",
"README.md",
"CHANGELOG.md"
],
"scripts": {
"clean": "node -e \"require('fs').rmSync('dist', {recursive:true, force:true})\"",
"prebuild": "node -p \"'// Auto-generated by prebuild\\nexport const SDK_VERSION = ' + JSON.stringify(require('./package.json').version) + ';\\nexport const SDK_PACKAGE_NAME = ' + JSON.stringify(require('./package.json').name) + ';'\" > src/version.ts",
"build:core": "npm run build -w @microsoft/durabletask-js",
"build": "npm run prebuild && npm run clean && npm run build:core && tsc -p tsconfig.build.json",
"test": "jest --runInBand --detectOpenHandles",
"test:unit": "jest test/unit --runInBand --detectOpenHandles",
"prepublishOnly": "npm run build && npm run test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/durabletask-js.git",
"directory": "packages/azure-functions-durable"
},
"keywords": [
"azure-functions",
"durable-functions",
"durabletask",
"orchestration",
"workflow",
"grpc"
],
"author": "Microsoft",
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/durabletask-js/issues"
},
"homepage": "https://github.com/microsoft/durabletask-js/tree/main/packages/azure-functions-durable#readme",
"engines": {
"node": ">=22.0.0"
},
"dependencies": {
"@azure/functions": "^4.16.1",
"@grpc/grpc-js": "^1.14.4",
"@microsoft/durabletask-js": "0.3.0"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remember to bump this to 0.4.0, and we need to release @microsoft/durabletask-js first

also confirm whether @azure/functions 4.16.1 has the extension changes required,

},
"devDependencies": {
"@types/jest": "^29.5.1",
"@types/node": "^18.16.1",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
}
Loading
Loading