@notionhq/apps 0.0.40 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/dist/cli/build.d.ts.map +1 -1
- package/dist/cli/build.js +26 -2
- package/dist/error.d.ts +11 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +20 -1
- package/dist/workflow.d.ts +41 -1
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +232 -12
- package/package.json +1 -1
- package/skills/workflow/SKILL.md +46 -0
- package/src/cli/build.test.ts +37 -0
- package/src/cli/build.ts +30 -2
- package/src/error.ts +25 -0
- package/src/workflow.test.ts +425 -3
- package/src/workflow.ts +398 -15
package/README.md
CHANGED
|
@@ -107,6 +107,60 @@ export default workflow({
|
|
|
107
107
|
|
|
108
108
|
The property name is the connection key. Access its typed client with `context.connections.calendar`; use separate keys for separate connections to the same provider.
|
|
109
109
|
|
|
110
|
+
## Workflow reliability
|
|
111
|
+
|
|
112
|
+
A workflow's `retry` policy is the default for every step. A step's own `retry`
|
|
113
|
+
replaces it; the two never stack. A run is only retried for failures outside a
|
|
114
|
+
step, such as an error thrown directly in the handler. When a step fails after
|
|
115
|
+
using its retries, the run fails without being retried.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { FatalError, RetryableError } from "@notionhq/apps/workflow";
|
|
119
|
+
|
|
120
|
+
export default workflow({
|
|
121
|
+
name: "Charge customer",
|
|
122
|
+
description: "Charges a customer when an invoice is created",
|
|
123
|
+
triggers: [events.notionPageCreated()],
|
|
124
|
+
deadline: { afterMs: 7 * 24 * 60 * 60 * 1000 },
|
|
125
|
+
retry: { maxAttempts: 3, retryOn: PaymentGatewayError },
|
|
126
|
+
handler: async (_event, context) => {
|
|
127
|
+
await context.step(
|
|
128
|
+
"Charge customer",
|
|
129
|
+
{ timeoutMs: 30_000, retry: { maxAttempts: 2 } },
|
|
130
|
+
chargeCustomer,
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`maxAttempts` includes the initial attempt. Throw `RetryableError` to explicitly
|
|
137
|
+
permit another attempt, optionally with `retryAfterMs`. Throw `FatalError` to
|
|
138
|
+
skip remaining retries. Set `retryOn` to an error class, a predicate, or an
|
|
139
|
+
array of them to retry only matching errors; `RetryableError` is always retried
|
|
140
|
+
and `FatalError` never is.
|
|
141
|
+
|
|
142
|
+
| Setting | Default | Limit |
|
|
143
|
+
| ------------------------- | ------------------------------- | ---------- |
|
|
144
|
+
| `retry.maxAttempts` | 3 | 1 to 3 |
|
|
145
|
+
| `retry.initialDelayMs` | 1 second | 7 days |
|
|
146
|
+
| `retry.backoffMultiplier` | 2 | at least 1 |
|
|
147
|
+
| `retry.maxDelayMs` | 5 minutes | 7 days |
|
|
148
|
+
| `retry.retryOn` | every error except `FatalError` | — |
|
|
149
|
+
| `deadline.afterMs` | none | 7 days |
|
|
150
|
+
| step `timeoutMs` | none | — |
|
|
151
|
+
|
|
152
|
+
A workflow invocation runs for at most 5 minutes, and step retries wait inside
|
|
153
|
+
it. A step's longest possible retry delays plus `timeoutMs` for every attempt
|
|
154
|
+
must fit in 5 minutes, and so must the workflow `retry` policy because steps
|
|
155
|
+
use it by default. Policies that don't fit are rejected. Time already spent in
|
|
156
|
+
the invocation counts too: if the next retry would run past 5 minutes from the
|
|
157
|
+
handler's start, the step stops retrying and the run is retried instead.
|
|
158
|
+
Use `context.wait.until()` for longer waits.
|
|
159
|
+
|
|
160
|
+
Step retry delays use jittered exponential backoff. A delay from
|
|
161
|
+
`RetryableError` (`retryAfterMs`) or `RateLimitError` (`retryAfter`, in seconds)
|
|
162
|
+
replaces the computed backoff.
|
|
163
|
+
|
|
110
164
|
## Manual workflows
|
|
111
165
|
|
|
112
166
|
Use `events.manual({ inputSchema })` to declare user-supplied inputs. The SDK
|
package/dist/cli/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAalD,MAAM,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA2CxE"}
|
package/dist/cli/build.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { rolldown } from "rolldown";
|
|
4
|
+
import { APPS_WORKSPACE_RESOURCE_ID } from "../notion-as-code/intents.js";
|
|
4
5
|
import {
|
|
5
6
|
createProvisioningArtifact
|
|
6
7
|
} from "../notion-as-code/provisioning.js";
|
|
@@ -8,6 +9,7 @@ import { clearRegisteredPacers } from "../pacer.js";
|
|
|
8
9
|
import { generateEntry, generateMetadataEntry, generateBlocksEntry } from "./codegen.js";
|
|
9
10
|
import { discoverCapabilities } from "./discover.js";
|
|
10
11
|
import { extractManifest, extractProvisioning, extractBlockConfigs } from "./emit-manifest.js";
|
|
12
|
+
const APP_MD_RESOURCE_ID = "__notion_apps_app_md__";
|
|
11
13
|
async function buildApp(projectRoot) {
|
|
12
14
|
const capabilities = await discoverCapabilities(projectRoot);
|
|
13
15
|
if (capabilities.length === 0) {
|
|
@@ -45,14 +47,36 @@ async function buildApp(projectRoot) {
|
|
|
45
47
|
}
|
|
46
48
|
async function emitProvisioningArtifact(projectRoot, entityProvisioning) {
|
|
47
49
|
const provisioningPath = path.join(projectRoot, "dist", "provisioning.json");
|
|
48
|
-
|
|
50
|
+
const appPage = await readAppPage(projectRoot);
|
|
51
|
+
if (entityProvisioning.intents.length === 0 && !appPage) {
|
|
49
52
|
await fs.promises.rm(provisioningPath, { force: true });
|
|
50
53
|
return;
|
|
51
54
|
}
|
|
52
|
-
const artifact = createProvisioningArtifact(
|
|
55
|
+
const artifact = createProvisioningArtifact([
|
|
56
|
+
...entityProvisioning.intents,
|
|
57
|
+
...appPage ? [appPage] : []
|
|
58
|
+
]);
|
|
53
59
|
await fs.promises.writeFile(provisioningPath, `${JSON.stringify(artifact, null, " ")}
|
|
54
60
|
`);
|
|
55
61
|
}
|
|
62
|
+
async function readAppPage(projectRoot) {
|
|
63
|
+
let content;
|
|
64
|
+
try {
|
|
65
|
+
content = await fs.promises.readFile(path.join(projectRoot, "APP.md"), "utf8");
|
|
66
|
+
} catch (error) {
|
|
67
|
+
if (error.code === "ENOENT") {
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
type: "page",
|
|
74
|
+
resourceId: APP_MD_RESOURCE_ID,
|
|
75
|
+
parent: { type: "resourceId", resourceId: APPS_WORKSPACE_RESOURCE_ID },
|
|
76
|
+
properties: { title: [["APP.md"]] },
|
|
77
|
+
content
|
|
78
|
+
};
|
|
79
|
+
}
|
|
56
80
|
async function buildMetadata(projectRoot, capabilities) {
|
|
57
81
|
const metadataEntryPath = path.join(projectRoot, ".notion", "metadata-entry.ts");
|
|
58
82
|
const metadataBundlePath = path.join(projectRoot, ".notion", "metadata.js");
|
package/dist/error.d.ts
CHANGED
|
@@ -5,6 +5,17 @@ export declare class ExecutionError extends Error {
|
|
|
5
5
|
readonly cause: unknown;
|
|
6
6
|
constructor(cause: unknown);
|
|
7
7
|
}
|
|
8
|
+
/** Explicitly permit another workflow or step attempt. */
|
|
9
|
+
export declare class RetryableError extends Error {
|
|
10
|
+
readonly retryAfterMs: number | undefined;
|
|
11
|
+
constructor(message: string, options?: {
|
|
12
|
+
retryAfterMs?: number;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Skip remaining workflow or step attempts. */
|
|
16
|
+
export declare class FatalError extends Error {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
8
19
|
/** Tell the platform that an external service asked the sync to slow down. */
|
|
9
20
|
export declare class RateLimitError extends ExecutionError {
|
|
10
21
|
readonly retryAfter: number | undefined;
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACxC,SAAkB,KAAK,EAAE,OAAO,CAAC;gBAErB,KAAK,EAAE,OAAO;CAK1B;AAED,8EAA8E;AAC9E,qBAAa,cAAe,SAAQ,cAAc;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE5B,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CAK7C"}
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACxC,SAAkB,KAAK,EAAE,OAAO,CAAC;gBAErB,KAAK,EAAE,OAAO;CAK1B;AAED,0DAA0D;AAC1D,qBAAa,cAAe,SAAQ,KAAK;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;CAWhE;AAED,gDAAgD;AAChD,qBAAa,UAAW,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI3B;AAED,8EAA8E;AAC9E,qBAAa,cAAe,SAAQ,cAAc;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE5B,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CAK7C"}
|
package/dist/error.js
CHANGED
|
@@ -6,6 +6,23 @@ class ExecutionError extends Error {
|
|
|
6
6
|
this.cause = cause;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
class RetryableError extends Error {
|
|
10
|
+
retryAfterMs;
|
|
11
|
+
constructor(message, options) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "RetryableError";
|
|
14
|
+
if (options?.retryAfterMs !== void 0 && (!Number.isFinite(options.retryAfterMs) || options.retryAfterMs < 0)) {
|
|
15
|
+
throw new Error("RetryableError retryAfterMs must be zero or greater.");
|
|
16
|
+
}
|
|
17
|
+
this.retryAfterMs = options?.retryAfterMs;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class FatalError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "FatalError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
9
26
|
class RateLimitError extends ExecutionError {
|
|
10
27
|
retryAfter;
|
|
11
28
|
constructor(options) {
|
|
@@ -16,5 +33,7 @@ class RateLimitError extends ExecutionError {
|
|
|
16
33
|
}
|
|
17
34
|
export {
|
|
18
35
|
ExecutionError,
|
|
19
|
-
|
|
36
|
+
FatalError,
|
|
37
|
+
RateLimitError,
|
|
38
|
+
RetryableError
|
|
20
39
|
};
|
package/dist/workflow.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ type WorkflowWaitResult = WorkflowWaitUntilResult | WorkflowWaitForInputResult;
|
|
|
92
92
|
type WorkflowHandlerResult = {
|
|
93
93
|
status: "success";
|
|
94
94
|
} | WorkflowWaitResult;
|
|
95
|
+
export { FatalError, RetryableError } from "./error.js";
|
|
95
96
|
export type { WorkflowAccess, WorkflowAccessAgentLevel, WorkflowAccessBindings, WorkflowAccessDeclaration, WorkflowAccessDeclarations, WorkflowAccessLevel, WorkflowAccessLevelFor, WorkflowAccessResource, ResourceAccessLevel, WorkflowAccessResourceType, WorkflowAccessRequirement, WorkflowAccessRequirements, WorkflowAccessValue, } from "./workflow-access.js";
|
|
96
97
|
export { access } from "./workflow-access.js";
|
|
97
98
|
export type WorkflowEvent = WorkflowEventMap[keyof WorkflowEventMap];
|
|
@@ -103,6 +104,32 @@ export type WorkflowEventForTrigger<T extends WorkflowTrigger> = T extends Manua
|
|
|
103
104
|
} ? WorkflowEventMap[T["type"]] : never;
|
|
104
105
|
export type WorkflowEventForTriggers<T extends readonly WorkflowTrigger[]> = WorkflowEventForTrigger<T[number]>;
|
|
105
106
|
export { connections, type WorkflowConnection, type WorkflowConnectionDeclarations, type WorkflowConnectionRequirement, type WorkflowConnections, type OAuthConfiguration, type OAuthConnection, } from "./connections.js";
|
|
107
|
+
export type WorkflowDeadline = {
|
|
108
|
+
/** Maximum wall-clock lifetime of one logical workflow run. */
|
|
109
|
+
afterMs: number;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* An error class, or a predicate, that marks an error as retryable.
|
|
113
|
+
* Classes match with `instanceof`; any other function is called with the error.
|
|
114
|
+
*/
|
|
115
|
+
export type WorkflowRetryableErrorMatcher = (abstract new (...args: never[]) => Error) | ((error: unknown) => boolean);
|
|
116
|
+
export type WorkflowRetryPolicy = {
|
|
117
|
+
/** Total attempts, including the initial attempt. At most 4. */
|
|
118
|
+
maxAttempts: number;
|
|
119
|
+
/** Delay before the first retry. Defaults to 1 second. */
|
|
120
|
+
initialDelayMs?: number;
|
|
121
|
+
/** Maximum delay between attempts. Defaults to 5 minutes. */
|
|
122
|
+
maxDelayMs?: number;
|
|
123
|
+
/** Exponential backoff multiplier. Defaults to 2. */
|
|
124
|
+
backoffMultiplier?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Errors that may be retried, as one matcher or an array of matchers. When
|
|
127
|
+
* set, only matching errors and `RetryableError` are retried; every other
|
|
128
|
+
* error fails immediately. When omitted, every error except `FatalError` is
|
|
129
|
+
* retried.
|
|
130
|
+
*/
|
|
131
|
+
retryOn?: WorkflowRetryableErrorMatcher | readonly WorkflowRetryableErrorMatcher[];
|
|
132
|
+
};
|
|
106
133
|
/**
|
|
107
134
|
* The inbound HTTP request passed to a webhook verify handler.
|
|
108
135
|
*/
|
|
@@ -192,6 +219,13 @@ export type WorkflowConfiguration<TTriggers extends readonly [WorkflowTrigger, .
|
|
|
192
219
|
* Connections that must be set up before this workflow can run.
|
|
193
220
|
*/
|
|
194
221
|
connections?: TConnections;
|
|
222
|
+
/** Maximum wall-clock lifetime of one logical workflow run. */
|
|
223
|
+
deadline?: WorkflowDeadline;
|
|
224
|
+
/**
|
|
225
|
+
* Default retry policy for every step, and the retry policy for failures
|
|
226
|
+
* that happen outside a step. A step's own `retry` replaces it.
|
|
227
|
+
*/
|
|
228
|
+
retry?: WorkflowRetryPolicy;
|
|
195
229
|
/**
|
|
196
230
|
* Optional synchronous verification handler, run at Notion's webhook
|
|
197
231
|
* ingress before the HTTP response is sent. Use it for providers that
|
|
@@ -250,6 +284,8 @@ export type Workflow<TTriggers extends readonly [WorkflowTrigger, ...WorkflowTri
|
|
|
250
284
|
triggers: WorkflowManifestTrigger[];
|
|
251
285
|
connections?: readonly WorkflowConnectionRequirement[];
|
|
252
286
|
access?: WorkflowAccessRequirements;
|
|
287
|
+
deadline?: WorkflowDeadline;
|
|
288
|
+
retry?: WorkflowRetryPolicy;
|
|
253
289
|
};
|
|
254
290
|
handler: (input: WorkflowEventForTriggers<TTriggers> | WebhookVerifyInvocation, options?: HandlerOptions) => Promise<WorkflowHandlerResult | WebhookVerifyResponse | undefined>;
|
|
255
291
|
};
|
|
@@ -307,7 +343,11 @@ export type WorkflowStepOptions = {
|
|
|
307
343
|
* Pass a string for a single key segment or an array of strings for a composite
|
|
308
344
|
* key. Defaults to the step name. Changing the key creates a new logical step.
|
|
309
345
|
*/
|
|
310
|
-
key
|
|
346
|
+
key?: string | string[];
|
|
347
|
+
/** Maximum duration of one invocation of the step callback. */
|
|
348
|
+
timeoutMs?: number;
|
|
349
|
+
/** Retry policy for failures from this step callback. */
|
|
350
|
+
retry?: WorkflowRetryPolicy;
|
|
311
351
|
};
|
|
312
352
|
type WorkflowStep = {
|
|
313
353
|
<T>(name: string, fn: (context: StepContext) => T | Promise<T>): Promise<WorkflowStepResult<T>>;
|
package/dist/workflow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,KAAK,EACX,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,6BAA6B,EAC7B,MAAM,uBAAuB,CAAC;AAE/B,KAAK,cAAc,GAAG;IACrB,yEAAyE;IACzE,cAAc,CAAC,EAAE,IAAI,CAAC;CACtB,CAAC;AAKF,KAAK,0BAA0B,GAAG;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CACf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AC,CAAC,CAAC;CAC3C,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,eAAe,CAC1B,YAAY,SAAS,8BAA8B,GAAG,8BAA8B,EACpF,OAAO,SAAS,0BAA0B,GAAG,0BAA0B,IACpE,iBAAiB,GAAG;IACvB,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,WAAW,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC/C,GAAG,WAAW,GAAG;IAChB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB,iEAAiE;IACjE,IAAI,EAAE,YAAY,CAAC;CACnB,CAAC"}
|
package/dist/workflow.js
CHANGED
|
@@ -11,7 +11,7 @@ import { createHash } from "node:crypto";
|
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
12
12
|
import { join } from "node:path";
|
|
13
13
|
import { createCapabilityContext } from "./context.js";
|
|
14
|
-
import { ExecutionError } from "./error.js";
|
|
14
|
+
import { ExecutionError, FatalError, RateLimitError, RetryableError } from "./error.js";
|
|
15
15
|
import { writeOutput } from "./output.js";
|
|
16
16
|
import { resolveRuntimeInput } from "./runtime-input.js";
|
|
17
17
|
import { readRunMetadata } from "./runtime-metadata.js";
|
|
@@ -47,16 +47,33 @@ const input = {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
const MAX_WORKFLOW_WAIT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
50
|
+
import { FatalError as FatalError2, RetryableError as RetryableError2 } from "./error.js";
|
|
50
51
|
import { access } from "./workflow-access.js";
|
|
51
52
|
import {
|
|
52
53
|
connections
|
|
53
54
|
} from "./connections.js";
|
|
55
|
+
const MAX_WORKFLOW_RETRY_ATTEMPTS = 3;
|
|
56
|
+
const MAX_WORKFLOW_DURATION_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
57
|
+
const WORKFLOW_STEP_RETRY_BUDGET_MS = 5 * 60 * 1e3;
|
|
58
|
+
const DEFAULT_WORKFLOW_RETRY_POLICY = {
|
|
59
|
+
maxAttempts: 3,
|
|
60
|
+
initialDelayMs: 1e3,
|
|
61
|
+
maxDelayMs: 5 * 60 * 1e3,
|
|
62
|
+
backoffMultiplier: 2
|
|
63
|
+
};
|
|
54
64
|
function workflow(configuration) {
|
|
55
65
|
const requirements = normalizeConnectionRequirements(configuration.connections ?? {});
|
|
56
66
|
const accessRequirements = normalizeWorkflowAccess(configuration.access);
|
|
57
67
|
const connectionDeclarations = configuration.connections === void 0 ? void 0 : structuredClone(configuration.connections);
|
|
58
68
|
const triggers = typeof configuration.triggers === "function" ? configuration.triggers({ events: createWorkflowEvents() }) : configuration.triggers;
|
|
59
69
|
validateTriggerConnections(triggers, requirements);
|
|
70
|
+
validateWorkflowDeadline(configuration.deadline);
|
|
71
|
+
validateWorkflowRetryPolicy(configuration.retry, "Workflow retry policy");
|
|
72
|
+
if (configuration.retry !== void 0) {
|
|
73
|
+
validateStepRetryBudget(configuration.retry, void 0, "Workflow retry policy");
|
|
74
|
+
}
|
|
75
|
+
const deadline = configuration.deadline === void 0 ? void 0 : structuredClone(configuration.deadline);
|
|
76
|
+
const retry = configuration.retry === void 0 ? void 0 : manifestRetryPolicy(configuration.retry);
|
|
60
77
|
const manualTriggers = triggers.filter(
|
|
61
78
|
(trigger) => trigger.type === "workflow.manual"
|
|
62
79
|
);
|
|
@@ -75,9 +92,13 @@ function workflow(configuration) {
|
|
|
75
92
|
description: configuration.description,
|
|
76
93
|
triggers: manifestTriggers(triggers, configuration.verify !== void 0),
|
|
77
94
|
...configuration.connections === void 0 ? {} : { connections: requirements },
|
|
78
|
-
...configuration.access === void 0 ? {} : { access: accessRequirements }
|
|
95
|
+
...configuration.access === void 0 ? {} : { access: accessRequirements },
|
|
96
|
+
...deadline === void 0 ? {} : { deadline },
|
|
97
|
+
...retry === void 0 ? {} : { retry }
|
|
79
98
|
},
|
|
80
99
|
async handler(input2, options) {
|
|
100
|
+
const invocationStartedAt = Date.now();
|
|
101
|
+
const exhaustedStepErrors = /* @__PURE__ */ new WeakSet();
|
|
81
102
|
try {
|
|
82
103
|
input2 = await resolveRuntimeInput(input2);
|
|
83
104
|
if (isVerifyInvocation(input2)) {
|
|
@@ -99,7 +120,11 @@ function workflow(configuration) {
|
|
|
99
120
|
const event = input2;
|
|
100
121
|
const runMetadata = readRunMetadata();
|
|
101
122
|
const baseContext = createCapabilityContext();
|
|
102
|
-
const step = createStep(runMetadata
|
|
123
|
+
const step = createStep(runMetadata, {
|
|
124
|
+
defaultRetry: configuration.retry,
|
|
125
|
+
exhaustedErrors: exhaustedStepErrors,
|
|
126
|
+
invocationStartedAt
|
|
127
|
+
});
|
|
103
128
|
const capabilityContext = {
|
|
104
129
|
...baseContext,
|
|
105
130
|
access: hydrateWorkflowAccess(accessRequirements),
|
|
@@ -137,10 +162,27 @@ function workflow(configuration) {
|
|
|
137
162
|
return;
|
|
138
163
|
}
|
|
139
164
|
const error = new ExecutionError(err);
|
|
165
|
+
const terminal = err instanceof FatalError || isObject(err) && exhaustedStepErrors.has(err) || !(err instanceof RetryableError) && !isRetryableError(err, configuration.retry);
|
|
140
166
|
if (!options?.concreteOutput) {
|
|
141
167
|
writeOutput({
|
|
142
168
|
_tag: "error",
|
|
143
|
-
error: {
|
|
169
|
+
error: !terminal && err instanceof RateLimitError ? {
|
|
170
|
+
_tag: "rate_limit",
|
|
171
|
+
name: err.name,
|
|
172
|
+
message: err.message,
|
|
173
|
+
...err.retryAfter === void 0 ? {} : { retryAfter: err.retryAfter }
|
|
174
|
+
} : !terminal && err instanceof RetryableError ? {
|
|
175
|
+
_tag: "retryable",
|
|
176
|
+
name: err.name,
|
|
177
|
+
message: err.message,
|
|
178
|
+
trace: err.stack,
|
|
179
|
+
...err.retryAfterMs === void 0 ? {} : { retryAfterMs: err.retryAfterMs }
|
|
180
|
+
} : terminal ? {
|
|
181
|
+
_tag: "terminal",
|
|
182
|
+
name: err instanceof Error ? err.name : error.name,
|
|
183
|
+
message: err instanceof Error ? err.message : error.message,
|
|
184
|
+
trace: err instanceof Error ? err.stack : error.stack
|
|
185
|
+
} : {
|
|
144
186
|
name: error.name,
|
|
145
187
|
message: error.message,
|
|
146
188
|
trace: error.stack
|
|
@@ -177,16 +219,20 @@ function writeStepEvent(event, value, startedAt, emittedAt = performance.now())
|
|
|
177
219
|
`
|
|
178
220
|
);
|
|
179
221
|
}
|
|
180
|
-
function createStep(metadata) {
|
|
222
|
+
function createStep(metadata, options) {
|
|
181
223
|
const { runGroupId } = metadata;
|
|
224
|
+
const { defaultRetry, exhaustedErrors, invocationStartedAt } = options;
|
|
182
225
|
const stepNameByKey = /* @__PURE__ */ new Map();
|
|
183
226
|
async function step(name, optionsOrFn, maybeFn) {
|
|
184
|
-
const
|
|
227
|
+
const stepOptions = typeof optionsOrFn === "function" ? void 0 : optionsOrFn;
|
|
185
228
|
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
186
229
|
if (!fn) {
|
|
187
230
|
throw new Error(`Workflow step "${name}" is missing its callback.`);
|
|
188
231
|
}
|
|
189
|
-
|
|
232
|
+
validateWorkflowStepOptions(stepOptions);
|
|
233
|
+
const retry = stepOptions?.retry ?? defaultRetry ?? DEFAULT_WORKFLOW_RETRY_POLICY;
|
|
234
|
+
validateStepRetryBudget(retry, stepOptions?.timeoutMs, `Workflow step "${name}"`);
|
|
235
|
+
const keyInput = stepOptions?.key ?? name;
|
|
190
236
|
const key = createWorkflowStepKey(typeof keyInput === "string" ? [keyInput] : keyInput);
|
|
191
237
|
const existingStepName = stepNameByKey.get(key);
|
|
192
238
|
if (existingStepName !== void 0) {
|
|
@@ -196,9 +242,7 @@ function createStep(metadata) {
|
|
|
196
242
|
}
|
|
197
243
|
stepNameByKey.set(key, name);
|
|
198
244
|
const id = `${runGroupId}:${key}`;
|
|
199
|
-
const
|
|
200
|
-
const context = { id, state: stepState.state };
|
|
201
|
-
const event = { id: context.id, name, key };
|
|
245
|
+
const event = { id, name, key };
|
|
202
246
|
const startedAt = performance.now();
|
|
203
247
|
writeStepEvent("started", event, startedAt, startedAt);
|
|
204
248
|
try {
|
|
@@ -223,7 +267,16 @@ function createStep(metadata) {
|
|
|
223
267
|
);
|
|
224
268
|
return checkpoint.value;
|
|
225
269
|
}
|
|
226
|
-
const value = normalizeWorkflowStepResult(
|
|
270
|
+
const value = normalizeWorkflowStepResult(
|
|
271
|
+
await runWorkflowStepCallback({
|
|
272
|
+
metadata,
|
|
273
|
+
id,
|
|
274
|
+
fn,
|
|
275
|
+
timeoutMs: stepOptions?.timeoutMs,
|
|
276
|
+
retry,
|
|
277
|
+
invocationStartedAt
|
|
278
|
+
})
|
|
279
|
+
);
|
|
227
280
|
writeStepEvent("success", { ...event, value }, startedAt);
|
|
228
281
|
writeStepEvent(
|
|
229
282
|
"completed",
|
|
@@ -234,7 +287,9 @@ function createStep(metadata) {
|
|
|
234
287
|
startedAt
|
|
235
288
|
);
|
|
236
289
|
return value;
|
|
237
|
-
} catch (
|
|
290
|
+
} catch (caught) {
|
|
291
|
+
const deferred = caught instanceof DeferredStepRetry;
|
|
292
|
+
const err = deferred ? caught.error : caught;
|
|
238
293
|
const error = new ExecutionError(err);
|
|
239
294
|
writeStepEvent(
|
|
240
295
|
"failure",
|
|
@@ -256,11 +311,20 @@ function createStep(metadata) {
|
|
|
256
311
|
},
|
|
257
312
|
startedAt
|
|
258
313
|
);
|
|
314
|
+
if (!deferred && isObject(err)) {
|
|
315
|
+
exhaustedErrors?.add(err);
|
|
316
|
+
}
|
|
259
317
|
throw err;
|
|
260
318
|
}
|
|
261
319
|
}
|
|
262
320
|
return step;
|
|
263
321
|
}
|
|
322
|
+
class DeferredStepRetry {
|
|
323
|
+
constructor(error) {
|
|
324
|
+
this.error = error;
|
|
325
|
+
}
|
|
326
|
+
error;
|
|
327
|
+
}
|
|
264
328
|
class WorkflowWaitInterrupt extends Error {
|
|
265
329
|
constructor(result) {
|
|
266
330
|
super(workflowWaitMessage(result));
|
|
@@ -430,6 +494,160 @@ function waitDurationUnitMultiplier(unit) {
|
|
|
430
494
|
throw new Error(`Unsupported workflow wait duration unit: ${unit}`);
|
|
431
495
|
}
|
|
432
496
|
}
|
|
497
|
+
async function runWorkflowStepCallback(args) {
|
|
498
|
+
let attempt = 1;
|
|
499
|
+
while (true) {
|
|
500
|
+
const stepState = createWorkflowStepState(args.metadata, args.id);
|
|
501
|
+
const context = { id: args.id, state: stepState.state };
|
|
502
|
+
try {
|
|
503
|
+
return await stepState.run(() => runWithTimeout(args.fn(context), args.timeoutMs));
|
|
504
|
+
} catch (error) {
|
|
505
|
+
if (attempt >= args.retry.maxAttempts || !isRetryableError(error, args.retry)) {
|
|
506
|
+
throw error;
|
|
507
|
+
}
|
|
508
|
+
const delayMs = explicitRetryDelay(error) ?? calculateRetryDelay(args.retry, attempt - 1);
|
|
509
|
+
const nextAttemptBudgetMs = delayMs + (args.timeoutMs ?? 0);
|
|
510
|
+
if (Date.now() - args.invocationStartedAt + nextAttemptBudgetMs > WORKFLOW_STEP_RETRY_BUDGET_MS) {
|
|
511
|
+
throw new DeferredStepRetry(error);
|
|
512
|
+
}
|
|
513
|
+
if (delayMs > 0) {
|
|
514
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
515
|
+
}
|
|
516
|
+
attempt += 1;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function isRetryableError(error, policy) {
|
|
521
|
+
if (error instanceof FatalError) {
|
|
522
|
+
return false;
|
|
523
|
+
}
|
|
524
|
+
if (error instanceof RetryableError || policy?.retryOn === void 0) {
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
const matchers = typeof policy.retryOn === "function" ? [policy.retryOn] : policy.retryOn;
|
|
528
|
+
return matchers.some(
|
|
529
|
+
(matcher) => isErrorClass(matcher) ? error instanceof matcher : matcher(error)
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
function isErrorClass(matcher) {
|
|
533
|
+
return matcher === Error || matcher.prototype instanceof Error;
|
|
534
|
+
}
|
|
535
|
+
function explicitRetryDelay(error) {
|
|
536
|
+
if (error instanceof RetryableError) {
|
|
537
|
+
return error.retryAfterMs;
|
|
538
|
+
}
|
|
539
|
+
if (error instanceof RateLimitError && error.retryAfter !== void 0) {
|
|
540
|
+
return error.retryAfter * 1e3;
|
|
541
|
+
}
|
|
542
|
+
return void 0;
|
|
543
|
+
}
|
|
544
|
+
async function runWithTimeout(value, timeoutMs) {
|
|
545
|
+
if (timeoutMs === void 0) {
|
|
546
|
+
return await value;
|
|
547
|
+
}
|
|
548
|
+
let timer;
|
|
549
|
+
try {
|
|
550
|
+
return await Promise.race([
|
|
551
|
+
value,
|
|
552
|
+
new Promise((_resolve, reject) => {
|
|
553
|
+
timer = setTimeout(() => {
|
|
554
|
+
const error = new Error(`Workflow step timed out after ${timeoutMs}ms.`);
|
|
555
|
+
error.name = "StepTimeoutError";
|
|
556
|
+
reject(error);
|
|
557
|
+
}, timeoutMs);
|
|
558
|
+
})
|
|
559
|
+
]);
|
|
560
|
+
} finally {
|
|
561
|
+
if (timer !== void 0) {
|
|
562
|
+
clearTimeout(timer);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function calculateRetryDelay(policy, retryIndex) {
|
|
567
|
+
const delayMs = maxRetryDelay(policy, retryIndex);
|
|
568
|
+
return delayMs / 2 + Math.random() * (delayMs / 2);
|
|
569
|
+
}
|
|
570
|
+
function maxRetryDelay(policy, retryIndex) {
|
|
571
|
+
const initialDelayMs = policy.initialDelayMs ?? DEFAULT_WORKFLOW_RETRY_POLICY.initialDelayMs;
|
|
572
|
+
const maxDelayMs = policy.maxDelayMs ?? DEFAULT_WORKFLOW_RETRY_POLICY.maxDelayMs;
|
|
573
|
+
const backoffMultiplier = policy.backoffMultiplier ?? DEFAULT_WORKFLOW_RETRY_POLICY.backoffMultiplier;
|
|
574
|
+
return Math.min(initialDelayMs * backoffMultiplier ** retryIndex, maxDelayMs);
|
|
575
|
+
}
|
|
576
|
+
function validateStepRetryBudget(policy, timeoutMs, label) {
|
|
577
|
+
let worstCaseMs = (timeoutMs ?? 0) * policy.maxAttempts;
|
|
578
|
+
for (let retryIndex = 0; retryIndex < policy.maxAttempts - 1; retryIndex++) {
|
|
579
|
+
worstCaseMs += maxRetryDelay(policy, retryIndex);
|
|
580
|
+
}
|
|
581
|
+
if (worstCaseMs > WORKFLOW_STEP_RETRY_BUDGET_MS) {
|
|
582
|
+
throw new Error(
|
|
583
|
+
`${label} can spend up to ${worstCaseMs}ms on retry delays and timeouts, which exceeds the ${WORKFLOW_STEP_RETRY_BUDGET_MS}ms limit for one workflow invocation. Lower maxAttempts, the retry delays, or timeoutMs, or use context.wait.until() for longer waits.`
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
function manifestRetryPolicy(policy) {
|
|
588
|
+
const { retryOn: _retryOn, ...rest } = policy;
|
|
589
|
+
return structuredClone(rest);
|
|
590
|
+
}
|
|
591
|
+
function validateWorkflowDeadline(deadline) {
|
|
592
|
+
if (deadline === void 0) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
assertPositiveFiniteNumber(deadline.afterMs, "Workflow deadline afterMs");
|
|
596
|
+
assertAtMost(deadline.afterMs, MAX_WORKFLOW_DURATION_MS, "Workflow deadline afterMs");
|
|
597
|
+
}
|
|
598
|
+
function validateWorkflowRetryPolicy(policy, label) {
|
|
599
|
+
if (policy === void 0) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (!Number.isInteger(policy.maxAttempts) || policy.maxAttempts < 1 || policy.maxAttempts > MAX_WORKFLOW_RETRY_ATTEMPTS) {
|
|
603
|
+
throw new Error(
|
|
604
|
+
`${label} maxAttempts must be an integer between 1 and ${MAX_WORKFLOW_RETRY_ATTEMPTS}.`
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
if (policy.initialDelayMs !== void 0) {
|
|
608
|
+
assertNonNegativeFiniteNumber(policy.initialDelayMs, `${label} initialDelayMs`);
|
|
609
|
+
assertAtMost(policy.initialDelayMs, MAX_WORKFLOW_DURATION_MS, `${label} initialDelayMs`);
|
|
610
|
+
}
|
|
611
|
+
if (policy.maxDelayMs !== void 0) {
|
|
612
|
+
assertNonNegativeFiniteNumber(policy.maxDelayMs, `${label} maxDelayMs`);
|
|
613
|
+
assertAtMost(policy.maxDelayMs, MAX_WORKFLOW_DURATION_MS, `${label} maxDelayMs`);
|
|
614
|
+
}
|
|
615
|
+
if (policy.retryOn !== void 0 && typeof policy.retryOn !== "function" && (!Array.isArray(policy.retryOn) || policy.retryOn.some((matcher) => typeof matcher !== "function"))) {
|
|
616
|
+
throw new Error(
|
|
617
|
+
`${label} retryOn must be an error class, a predicate, or an array of them.`
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
if (policy.initialDelayMs !== void 0 && policy.maxDelayMs !== void 0 && policy.maxDelayMs < policy.initialDelayMs) {
|
|
621
|
+
throw new Error(`${label} maxDelayMs must be at least initialDelayMs.`);
|
|
622
|
+
}
|
|
623
|
+
if (policy.backoffMultiplier !== void 0 && (!Number.isFinite(policy.backoffMultiplier) || policy.backoffMultiplier < 1)) {
|
|
624
|
+
throw new Error(`${label} backoffMultiplier must be at least one.`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
function validateWorkflowStepOptions(options) {
|
|
628
|
+
if (options?.timeoutMs !== void 0) {
|
|
629
|
+
assertPositiveFiniteNumber(options.timeoutMs, "Workflow step timeoutMs");
|
|
630
|
+
}
|
|
631
|
+
validateWorkflowRetryPolicy(options?.retry, "Workflow step retry policy");
|
|
632
|
+
}
|
|
633
|
+
function assertAtMost(value, max, label) {
|
|
634
|
+
if (value > max) {
|
|
635
|
+
throw new Error(`${label} must be at most ${max}.`);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function isObject(value) {
|
|
639
|
+
return typeof value === "object" && value !== null || typeof value === "function";
|
|
640
|
+
}
|
|
641
|
+
function assertPositiveFiniteNumber(value, label) {
|
|
642
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
643
|
+
throw new Error(`${label} must be greater than zero.`);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
function assertNonNegativeFiniteNumber(value, label) {
|
|
647
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
648
|
+
throw new Error(`${label} must be zero or greater.`);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
433
651
|
function createWorkflowStepKey(segments) {
|
|
434
652
|
if (segments.length === 0) {
|
|
435
653
|
throw new Error("Workflow step keys must contain at least one segment.");
|
|
@@ -495,6 +713,8 @@ function isNodeError(error) {
|
|
|
495
713
|
return error instanceof Error && "code" in error;
|
|
496
714
|
}
|
|
497
715
|
export {
|
|
716
|
+
FatalError2 as FatalError,
|
|
717
|
+
RetryableError2 as RetryableError,
|
|
498
718
|
access,
|
|
499
719
|
connections,
|
|
500
720
|
input,
|