Skip to content

Commit df03e6b

Browse files
authored
Add durable-functions@4.0.0 — Azure Functions Durable provider on the gRPC core (+ core host helpers, E2E CI, and release pipeline) (#282)
1 parent f3f0303 commit df03e6b

59 files changed

Lines changed: 4939 additions & 522 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/functions-e2e-tests.yaml

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,31 @@ name: 🧪 Functions Host E2E Tests
44
# test/e2e-functions/test-app (backed by Azurite / AzureStorage) and drives the
55
# app over HTTP, porting the extension repo's `BasicNode` app + xUnit tests.
66
#
7-
# The test-app depends on the PUBLISHED `durable-functions` + `@azure/functions`
8-
# packages, so it installs and runs without any in-repo package build. The suite
9-
# self-gates: each spec SKIPS cleanly when the Azure Functions Core Tools (`func`)
10-
# or the Azurite storage emulator are unavailable, and RUNS when both are present.
11-
# In CI below we install and start both, so the suite runs for real; the self-skip
12-
# is the safety net that keeps the job green if a prerequisite fails to come up.
7+
# The test-app consumes the IN-REPO `durable-functions` (compat) package and core
8+
# `@microsoft/durabletask-js` via `file:` links, so those packages must be BUILT
9+
# before the test-app install (see the build step below). The suite self-gates:
10+
# each spec SKIPS cleanly when the Azure Functions Core Tools (`func`) or the
11+
# Azurite storage emulator are unavailable, and RUNS when both are present. In CI
12+
# below we install and start both, so the suite runs for real; the self-skip is
13+
# the safety net that keeps the job green if a prerequisite fails to come up.
1314
#
14-
# Triggering: this suite is run ad hoc (manual dispatch) for now while it beds in,
15-
# so it does not gate day-to-day PRs. Start it from the Actions tab via "Run
16-
# workflow" (workflow_dispatch). To re-enable automatic runs on pull requests
17-
# later, add a `pull_request` trigger scoped to `test/e2e-functions/**` and this
18-
# workflow file. NOTE: workflow_dispatch only appears in the Actions UI once this
19-
# file exists on the repository's default branch.
15+
# Triggering: this suite runs automatically on pull requests that touch the
16+
# Functions surface (`test/e2e-functions/**`, `packages/azure-functions-durable/**`,
17+
# or this workflow file), and can also be started ad hoc from the Actions tab via
18+
# "Run workflow" (workflow_dispatch). It is intentionally scoped to the Functions
19+
# surface and does NOT gate core-only PRs, which have their own suites. A small set
20+
# of terminal/invalid-state control-plane specs are skipped pending a server-side
21+
# gRPC status-detail fix (tracked separately); everything else runs for real. NOTE:
22+
# workflow_dispatch only appears in the Actions UI once this file exists on the
23+
# repository's default branch.
2024

2125
on:
2226
workflow_dispatch:
27+
pull_request:
28+
paths:
29+
- "test/e2e-functions/**"
30+
- "packages/azure-functions-durable/**"
31+
- ".github/workflows/functions-e2e-tests.yaml"
2332

2433
permissions:
2534
contents: read
@@ -43,19 +52,28 @@ jobs:
4352
node-version: ${{ matrix.node-version }}
4453
registry-url: "https://registry.npmjs.org"
4554

46-
# Root install provides jest + ts-jest used to run the spec files. The specs
47-
# do not depend on the core durabletask-js packages, so no workspace build is
48-
# required here.
55+
# Root install provides jest + ts-jest used to run the spec files, and lets
56+
# the workspace build below resolve the in-repo packages the test-app links
57+
# via `file:` refs.
4958
- name: ⚙️ Install dependencies
5059
run: npm ci
5160

61+
# Build the in-repo compat package (`durable-functions`); its build script
62+
# runs `build:core` first, so this also builds `packages/durabletask-js` into
63+
# dist/. Both must exist before the test-app's `file:`-linked install below.
64+
- name: "🏗️ Build in-repo durable-functions (+ core) for file: linking"
65+
run: npm run build -w durable-functions
66+
5267
- name: 🔧 Install Azurite and Azure Functions Core Tools
5368
run: npm install -g azurite azure-functions-core-tools@4
5469

70+
# --skipApiVersionCheck: the preview extension bundle's Azure Storage SDK
71+
# targets a newer REST API version than current Azurite accepts; without the
72+
# flag Azurite rejects the calls and every orchestration times out.
5573
- name: 🗄️ Start Azurite
5674
run: |
5775
mkdir -p /tmp/azurite
58-
azurite --silent --location /tmp/azurite \
76+
azurite --silent --skipApiVersionCheck --location /tmp/azurite \
5977
--blobPort 10000 --queuePort 10001 --tablePort 10002 &
6078
echo "Waiting for Azurite blob endpoint..."
6179
for i in $(seq 1 30); do
@@ -66,8 +84,9 @@ jobs:
6684
sleep 1
6785
done
6886
69-
# Installs the PUBLISHED durable-functions / @azure/functions packages and
70-
# compiles the ported BasicNode app to dist/ (consumed by `func start`).
87+
# Installs the in-repo `durable-functions` (+ core `@microsoft/durabletask-js`)
88+
# packages via the test-app's `file:` refs and compiles the ported BasicNode
89+
# app to dist/ (consumed by `func start`).
7190
- name: 📦 Install + build test-app
7291
working-directory: test/e2e-functions/test-app
7392
run: |

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,23 @@
55

66
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.
77

8-
> 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).
8+
> Note that the core `@microsoft/durabletask-js` package 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 — it exposes low-level TaskHubSidecarService gRPC/protobuf helpers that host integrations can reuse (Node.js 22+). For the Azure Durable Functions programming model on the gRPC core, this repository also contains the **`durable-functions`** provider package under [`packages/azure-functions-durable`](./packages/azure-functions-durable). The classic v3 (extension-HTTP) predecessor lives at [azure-functions-durable-js](https://github.com/Azure/azure-functions-durable-js).
9+
10+
## Low-level host integration APIs
11+
12+
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:
13+
14+
```typescript
15+
const worker = new TaskHubGrpcWorker();
16+
worker.addOrchestrator(myOrchestrator);
17+
worker.addActivity(myActivity);
18+
worker.addEntity(myEntity);
19+
20+
const orchestrationResponseBytes = await worker.processOrchestratorRequest(orchestrationRequestBytes);
21+
const entityResponseBytes = await worker.processEntityBatchRequest(entityBatchRequestBytes);
22+
```
23+
24+
`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`.
925

1026
## npm packages
1127

eng/ci/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,34 @@ extends:
8484
serviceendpointurl: 'https://api.esrp.microsoft.com'
8585
mainpublisher: 'durabletask-java'
8686
domaintenantid: '33e01921-4d64-4f8c-a055-5bdaffd5e33d'
87+
88+
- job: durable_functions
89+
displayName: 'Release durable-functions'
90+
templateContext:
91+
type: releaseJob
92+
isProduction: true
93+
inputs:
94+
- input: pipelineArtifact
95+
pipeline: DurableTaskJSBuildPipeline
96+
artifactName: drop
97+
targetPath: $(System.DefaultWorkingDirectory)/drop
98+
99+
steps:
100+
- task: SFP.release-tasks.custom-build-release-task.EsrpRelease@9
101+
displayName: 'ESRP Release durable-functions'
102+
inputs:
103+
connectedservicename: 'dtfx-internal-esrp-prod'
104+
usemanagedidentity: true
105+
keyvaultname: 'durable-esrp-akv'
106+
signcertname: 'dts-esrp-cert'
107+
clientid: '0b3ed1a4-0727-4a50-b82a-02c2bd9dec89'
108+
intent: 'PackageDistribution'
109+
contenttype: 'npm'
110+
contentsource: 'Folder'
111+
folderlocation: '$(System.DefaultWorkingDirectory)/drop/buildoutputs/azure-functions-durable'
112+
waitforreleasecompletion: true
113+
owners: 'wangbill@microsoft.com'
114+
approvers: 'kaibocai@microsoft.com'
115+
serviceendpointurl: 'https://api.esrp.microsoft.com'
116+
mainpublisher: 'durabletask-java'
117+
domaintenantid: '33e01921-4d64-4f8c-a055-5bdaffd5e33d'

eng/templates/build.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
npm pack
4545
displayName: "pack @microsoft/durabletask-js-azuremanaged"
4646
47+
# Pack durable-functions
48+
- script: |
49+
cd packages/azure-functions-durable
50+
npm pack
51+
displayName: "pack durable-functions"
52+
4753
# Copy each package to its own staging subfolder
4854
- task: CopyFiles@2
4955
displayName: "Copy durabletask-js to staging"
@@ -56,4 +62,10 @@ jobs:
5662
inputs:
5763
SourceFolder: $(System.DefaultWorkingDirectory)/packages/durabletask-js-azuremanaged
5864
Contents: "*.tgz"
59-
TargetFolder: $(Build.ArtifactStagingDirectory)/buildoutputs/durabletask-js-azuremanaged
65+
TargetFolder: $(Build.ArtifactStagingDirectory)/buildoutputs/durabletask-js-azuremanaged
66+
- task: CopyFiles@2
67+
displayName: "Copy azure-functions-durable to staging"
68+
inputs:
69+
SourceFolder: $(System.DefaultWorkingDirectory)/packages/azure-functions-durable
70+
Contents: "*.tgz"
71+
TargetFolder: $(Build.ArtifactStagingDirectory)/buildoutputs/azure-functions-durable

package-lock.json

Lines changed: 73 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## TBD
4+
5+
- Details to be finalized at release time.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Microsoft Corporation.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)