@workflow/world-vercel 4.1.0-beta.33 → 4.1.0-beta.34
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/dist/encryption.d.ts +58 -0
- package/dist/encryption.d.ts.map +1 -0
- package/dist/encryption.js +137 -0
- package/dist/encryption.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/steps.d.ts +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel-specific key management for workflow encryption.
|
|
3
|
+
*
|
|
4
|
+
* This module handles:
|
|
5
|
+
* - HKDF key derivation (deployment key + projectId + runId → per-run key)
|
|
6
|
+
* - Cross-deployment key retrieval via the Vercel API
|
|
7
|
+
*
|
|
8
|
+
* The actual AES-GCM encrypt/decrypt operations are in @workflow/core/encryption
|
|
9
|
+
* which is browser-compatible. This module is Node.js only (uses node:crypto
|
|
10
|
+
* for HKDF and the Vercel API for key retrieval).
|
|
11
|
+
*/
|
|
12
|
+
import type { World } from '@workflow/world';
|
|
13
|
+
/**
|
|
14
|
+
* Derive a per-run AES-256 encryption key using HKDF-SHA256.
|
|
15
|
+
*
|
|
16
|
+
* The derivation uses `projectId|runId` as the HKDF info parameter,
|
|
17
|
+
* ensuring that each run has a unique encryption key even when sharing
|
|
18
|
+
* the same deployment key.
|
|
19
|
+
*
|
|
20
|
+
* @param deploymentKey - Raw 32-byte deployment key
|
|
21
|
+
* @param projectId - Vercel project ID for context isolation
|
|
22
|
+
* @param runId - Workflow run ID for per-run key isolation
|
|
23
|
+
* @returns Raw 32-byte AES-256 key
|
|
24
|
+
*/
|
|
25
|
+
export declare function deriveRunKey(deploymentKey: Uint8Array, projectId: string, runId: string): Promise<Uint8Array>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch the per-run encryption key from the Vercel API.
|
|
28
|
+
*
|
|
29
|
+
* The API performs HKDF-SHA256 derivation server-side, so the raw
|
|
30
|
+
* deployment key never leaves the API boundary. The returned key
|
|
31
|
+
* is ready-to-use for AES-GCM encrypt/decrypt operations.
|
|
32
|
+
*
|
|
33
|
+
* Uses OIDC token authentication (for cross-deployment runtime calls like
|
|
34
|
+
* resumeHook) or falls back to VERCEL_TOKEN (for external tooling like o11y).
|
|
35
|
+
*
|
|
36
|
+
* @param deploymentId - The deployment ID that holds the base key material
|
|
37
|
+
* @param projectId - The project ID for HKDF context isolation
|
|
38
|
+
* @param runId - The workflow run ID for per-run key derivation
|
|
39
|
+
* @param options.token - Auth token (from config). Falls back to OIDC or VERCEL_TOKEN.
|
|
40
|
+
* @returns Derived 32-byte per-run AES-256 key
|
|
41
|
+
*/
|
|
42
|
+
export declare function fetchRunKey(deploymentId: string, projectId: string, runId: string, options?: {
|
|
43
|
+
/** Auth token (from config). Falls back to OIDC or VERCEL_TOKEN. */
|
|
44
|
+
token?: string;
|
|
45
|
+
}): Promise<Uint8Array>;
|
|
46
|
+
/**
|
|
47
|
+
* Create the `getEncryptionKeyForRun` implementation for a Vercel World.
|
|
48
|
+
*
|
|
49
|
+
* Resolves the per-run AES-256 key by either:
|
|
50
|
+
* - Deriving it locally via HKDF when the run belongs to the current deployment
|
|
51
|
+
* - Fetching it from the Vercel API when the run belongs to a different deployment
|
|
52
|
+
*
|
|
53
|
+
* @param projectId - Vercel project ID for HKDF context isolation
|
|
54
|
+
* @param token - Optional auth token from config
|
|
55
|
+
* @returns The `getEncryptionKeyForRun` function, or `undefined` if no projectId
|
|
56
|
+
*/
|
|
57
|
+
export declare function createGetEncryptionKeyForRun(projectId: string | undefined, token?: string): World['getEncryptionKeyForRun'];
|
|
58
|
+
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../src/encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAe,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAK1D;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAChC,aAAa,EAAE,UAAU,EACzB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,UAAU,CAAC,CAmCrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,WAAW,CAC/B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IACR,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAAC,UAAU,CAAC,CAiCrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,CAAC,EAAE,MAAM,GACb,KAAK,CAAC,wBAAwB,CAAC,CAyCjC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel-specific key management for workflow encryption.
|
|
3
|
+
*
|
|
4
|
+
* This module handles:
|
|
5
|
+
* - HKDF key derivation (deployment key + projectId + runId → per-run key)
|
|
6
|
+
* - Cross-deployment key retrieval via the Vercel API
|
|
7
|
+
*
|
|
8
|
+
* The actual AES-GCM encrypt/decrypt operations are in @workflow/core/encryption
|
|
9
|
+
* which is browser-compatible. This module is Node.js only (uses node:crypto
|
|
10
|
+
* for HKDF and the Vercel API for key retrieval).
|
|
11
|
+
*/
|
|
12
|
+
import { webcrypto } from 'node:crypto';
|
|
13
|
+
import { getVercelOidcToken } from '@vercel/oidc';
|
|
14
|
+
import * as z from 'zod';
|
|
15
|
+
const KEY_BYTES = 32; // 256 bits = 32 bytes (AES-256)
|
|
16
|
+
/**
|
|
17
|
+
* Derive a per-run AES-256 encryption key using HKDF-SHA256.
|
|
18
|
+
*
|
|
19
|
+
* The derivation uses `projectId|runId` as the HKDF info parameter,
|
|
20
|
+
* ensuring that each run has a unique encryption key even when sharing
|
|
21
|
+
* the same deployment key.
|
|
22
|
+
*
|
|
23
|
+
* @param deploymentKey - Raw 32-byte deployment key
|
|
24
|
+
* @param projectId - Vercel project ID for context isolation
|
|
25
|
+
* @param runId - Workflow run ID for per-run key isolation
|
|
26
|
+
* @returns Raw 32-byte AES-256 key
|
|
27
|
+
*/
|
|
28
|
+
export async function deriveRunKey(deploymentKey, projectId, runId) {
|
|
29
|
+
if (deploymentKey.length !== KEY_BYTES) {
|
|
30
|
+
throw new Error(`Invalid deployment key length: expected ${KEY_BYTES} bytes for AES-256, got ${deploymentKey.length} bytes`);
|
|
31
|
+
}
|
|
32
|
+
if (!projectId || typeof projectId !== 'string') {
|
|
33
|
+
throw new Error('projectId must be a non-empty string');
|
|
34
|
+
}
|
|
35
|
+
const baseKey = await webcrypto.subtle.importKey('raw', deploymentKey, 'HKDF', false, ['deriveBits']);
|
|
36
|
+
const info = new TextEncoder().encode(`${projectId}|${runId}`);
|
|
37
|
+
// Zero salt is acceptable per RFC 5869 Section 3.1 when the input key
|
|
38
|
+
// material has high entropy (as is the case with our random deployment key).
|
|
39
|
+
// The `info` parameter provides per-run context separation.
|
|
40
|
+
const derivedBits = await webcrypto.subtle.deriveBits({
|
|
41
|
+
name: 'HKDF',
|
|
42
|
+
hash: 'SHA-256',
|
|
43
|
+
salt: new Uint8Array(32),
|
|
44
|
+
info,
|
|
45
|
+
}, baseKey, KEY_BYTES * 8 // bits
|
|
46
|
+
);
|
|
47
|
+
return new Uint8Array(derivedBits);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fetch the per-run encryption key from the Vercel API.
|
|
51
|
+
*
|
|
52
|
+
* The API performs HKDF-SHA256 derivation server-side, so the raw
|
|
53
|
+
* deployment key never leaves the API boundary. The returned key
|
|
54
|
+
* is ready-to-use for AES-GCM encrypt/decrypt operations.
|
|
55
|
+
*
|
|
56
|
+
* Uses OIDC token authentication (for cross-deployment runtime calls like
|
|
57
|
+
* resumeHook) or falls back to VERCEL_TOKEN (for external tooling like o11y).
|
|
58
|
+
*
|
|
59
|
+
* @param deploymentId - The deployment ID that holds the base key material
|
|
60
|
+
* @param projectId - The project ID for HKDF context isolation
|
|
61
|
+
* @param runId - The workflow run ID for per-run key derivation
|
|
62
|
+
* @param options.token - Auth token (from config). Falls back to OIDC or VERCEL_TOKEN.
|
|
63
|
+
* @returns Derived 32-byte per-run AES-256 key
|
|
64
|
+
*/
|
|
65
|
+
export async function fetchRunKey(deploymentId, projectId, runId, options) {
|
|
66
|
+
// Authenticate via provided token (CLI/config), OIDC token (runtime),
|
|
67
|
+
// or VERCEL_TOKEN env var (external tooling)
|
|
68
|
+
const oidcToken = await getVercelOidcToken().catch(() => null);
|
|
69
|
+
const token = options?.token ?? oidcToken ?? process.env.VERCEL_TOKEN;
|
|
70
|
+
if (!token) {
|
|
71
|
+
throw new Error('Cannot fetch run key: no OIDC token or VERCEL_TOKEN available');
|
|
72
|
+
}
|
|
73
|
+
const params = new URLSearchParams({ projectId, runId });
|
|
74
|
+
const response = await fetch(`https://api.vercel.com/v1/workflow/run-key/${deploymentId}?${params}`, {
|
|
75
|
+
headers: {
|
|
76
|
+
Authorization: `Bearer ${token}`,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
throw new Error(`Failed to fetch run key for ${runId} (deployment ${deploymentId}): HTTP ${response.status}`);
|
|
81
|
+
}
|
|
82
|
+
const data = await response.json();
|
|
83
|
+
const result = z.object({ key: z.string() }).safeParse(data);
|
|
84
|
+
if (!result.success) {
|
|
85
|
+
throw new Error('Invalid response from Vercel API, missing "key" field');
|
|
86
|
+
}
|
|
87
|
+
return Buffer.from(result.data.key, 'base64');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create the `getEncryptionKeyForRun` implementation for a Vercel World.
|
|
91
|
+
*
|
|
92
|
+
* Resolves the per-run AES-256 key by either:
|
|
93
|
+
* - Deriving it locally via HKDF when the run belongs to the current deployment
|
|
94
|
+
* - Fetching it from the Vercel API when the run belongs to a different deployment
|
|
95
|
+
*
|
|
96
|
+
* @param projectId - Vercel project ID for HKDF context isolation
|
|
97
|
+
* @param token - Optional auth token from config
|
|
98
|
+
* @returns The `getEncryptionKeyForRun` function, or `undefined` if no projectId
|
|
99
|
+
*/
|
|
100
|
+
export function createGetEncryptionKeyForRun(projectId, token) {
|
|
101
|
+
if (!projectId)
|
|
102
|
+
return undefined;
|
|
103
|
+
const currentDeploymentId = process.env.VERCEL_DEPLOYMENT_ID;
|
|
104
|
+
// Parse the local deployment key from env (lazy, only when encryption is used)
|
|
105
|
+
let localDeploymentKey;
|
|
106
|
+
function getLocalDeploymentKey() {
|
|
107
|
+
if (localDeploymentKey)
|
|
108
|
+
return localDeploymentKey;
|
|
109
|
+
const deploymentKeyBase64 = process.env.VERCEL_DEPLOYMENT_KEY;
|
|
110
|
+
if (!deploymentKeyBase64)
|
|
111
|
+
return undefined;
|
|
112
|
+
localDeploymentKey = Buffer.from(deploymentKeyBase64, 'base64');
|
|
113
|
+
return localDeploymentKey;
|
|
114
|
+
}
|
|
115
|
+
return async function getEncryptionKeyForRun(run, context) {
|
|
116
|
+
const runId = typeof run === 'string' ? run : run.runId;
|
|
117
|
+
const deploymentId = typeof run === 'string'
|
|
118
|
+
? context?.deploymentId
|
|
119
|
+
: run.deploymentId;
|
|
120
|
+
// Same deployment, or no deploymentId provided (e.g., start() on
|
|
121
|
+
// current deployment, or step-handler during same-deployment execution)
|
|
122
|
+
// → use local deployment key + local HKDF derivation
|
|
123
|
+
if (!deploymentId || deploymentId === currentDeploymentId) {
|
|
124
|
+
const localKey = getLocalDeploymentKey();
|
|
125
|
+
if (!localKey)
|
|
126
|
+
return undefined;
|
|
127
|
+
return deriveRunKey(localKey, projectId, runId);
|
|
128
|
+
}
|
|
129
|
+
// Different deployment — fetch the derived per-run key from the
|
|
130
|
+
// Vercel API. The API performs HKDF derivation server-side so the
|
|
131
|
+
// raw deployment key never leaves the API boundary.
|
|
132
|
+
// Covers cross-deployment resumeHook() (OIDC auth) and o11y
|
|
133
|
+
// tooling reading data from other deployments (VERCEL_TOKEN).
|
|
134
|
+
return fetchRunKey(deploymentId, projectId, runId, { token });
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=encryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.js","sourceRoot":"","sources":["../src/encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,gCAAgC;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,aAAyB,EACzB,SAAiB,EACjB,KAAa;IAEb,IAAI,aAAa,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,2CAA2C,SAAS,2BAA2B,aAAa,CAAC,MAAM,QAAQ,CAC5G,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,SAAS,CAC9C,KAAK,EACL,aAAa,EACb,MAAM,EACN,KAAK,EACL,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC;IAE/D,sEAAsE;IACtE,6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IAAI,CAAC,YAAY,IAAI,YAAY,KAAK,mBAAmB,EAAE,CAAC;YAC1D,MAAM,QAAQ,GAAG,qBAAqB,EAAE,CAAC;YACzC,IAAI,CAAC,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAChC,OAAO,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;QAED,gEAAgE;QAChE,kEAAkE;QAClE,oDAAoD;QACpD,4DAA4D;QAC5D,8DAA8D;QAC9D,OAAO,WAAW,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { World } from '@workflow/world';
|
|
2
2
|
import type { APIConfig } from './utils.js';
|
|
3
|
+
export { createGetEncryptionKeyForRun, deriveRunKey, fetchRunKey, } from './encryption.js';
|
|
3
4
|
export { createQueue } from './queue.js';
|
|
4
5
|
export { createStorage } from './storage.js';
|
|
5
6
|
export { createStreamer } from './streamer.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAK7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EACL,4BAA4B,EAC5B,YAAY,EACZ,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,KAAK,CAe3D"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import { createGetEncryptionKeyForRun } from './encryption.js';
|
|
1
2
|
import { createQueue } from './queue.js';
|
|
2
3
|
import { createStorage } from './storage.js';
|
|
3
4
|
import { createStreamer } from './streamer.js';
|
|
5
|
+
export { createGetEncryptionKeyForRun, deriveRunKey, fetchRunKey, } from './encryption.js';
|
|
4
6
|
export { createQueue } from './queue.js';
|
|
5
7
|
export { createStorage } from './storage.js';
|
|
6
8
|
export { createStreamer } from './streamer.js';
|
|
7
9
|
export function createVercelWorld(config) {
|
|
10
|
+
// Project ID for HKDF key derivation context.
|
|
11
|
+
// Use config value first (set correctly by CLI/web), fall back to env var (runtime).
|
|
12
|
+
const projectId = config?.projectConfig?.projectId || process.env.VERCEL_PROJECT_ID;
|
|
8
13
|
return {
|
|
9
14
|
...createQueue(config),
|
|
10
15
|
...createStorage(config),
|
|
11
16
|
...createStreamer(config),
|
|
17
|
+
getEncryptionKeyForRun: createGetEncryptionKeyForRun(projectId, config?.token),
|
|
12
18
|
};
|
|
13
19
|
}
|
|
14
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,UAAU,iBAAiB,CAAC,MAAkB;IAClD,OAAO;QACL,GAAG,WAAW,CAAC,MAAM,CAAC;QACtB,GAAG,aAAa,CAAC,MAAM,CAAC;QACxB,GAAG,cAAc,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EACL,4BAA4B,EAC5B,YAAY,EACZ,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,UAAU,iBAAiB,CAAC,MAAkB;IAClD,8CAA8C;IAC9C,qFAAqF;IACrF,MAAM,SAAS,GACb,MAAM,EAAE,aAAa,EAAE,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAEpE,OAAO;QACL,GAAG,WAAW,CAAC,MAAM,CAAC;QACtB,GAAG,aAAa,CAAC,MAAM,CAAC;QACxB,GAAG,cAAc,CAAC,MAAM,CAAC;QACzB,sBAAsB,EAAE,4BAA4B,CAClD,SAAS,EACT,MAAM,EAAE,KAAK,CACd;KACF,CAAC;AACJ,CAAC"}
|
package/dist/steps.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { APIConfig } from './utils.js';
|
|
|
8
8
|
export declare const StepWireSchema: z.ZodObject<{
|
|
9
9
|
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
10
10
|
input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
|
|
11
|
+
runId: z.ZodString;
|
|
11
12
|
status: z.ZodEnum<{
|
|
12
13
|
pending: "pending";
|
|
13
14
|
running: "running";
|
|
@@ -15,13 +16,12 @@ export declare const StepWireSchema: z.ZodObject<{
|
|
|
15
16
|
failed: "failed";
|
|
16
17
|
cancelled: "cancelled";
|
|
17
18
|
}>;
|
|
18
|
-
retryAfter: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
19
|
-
runId: z.ZodString;
|
|
20
19
|
specVersion: z.ZodOptional<z.ZodNumber>;
|
|
21
20
|
startedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
22
|
-
completedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
23
21
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
24
22
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
23
|
+
completedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
24
|
+
retryAfter: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
25
25
|
stepId: z.ZodString;
|
|
26
26
|
stepName: z.ZodString;
|
|
27
27
|
attempt: z.ZodNumber;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "4.1.0-beta.
|
|
1
|
+
export declare const version = "4.1.0-beta.34";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/world-vercel",
|
|
3
|
-
"version": "4.1.0-beta.
|
|
3
|
+
"version": "4.1.0-beta.34",
|
|
4
4
|
"description": "Vercel platform World implementation for Workflow DevKit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"cbor-x": "1.6.0",
|
|
29
29
|
"zod": "4.1.11",
|
|
30
30
|
"@workflow/errors": "4.1.0-beta.16",
|
|
31
|
-
"@workflow/world": "4.1.0-beta.
|
|
31
|
+
"@workflow/world": "4.1.0-beta.6"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@opentelemetry/api": "1"
|