@upstash/workflow 0.2.19 → 0.2.21
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/astro.d.mts +2 -2
- package/astro.d.ts +2 -2
- package/astro.js +65 -16
- package/astro.mjs +2 -2
- package/{chunk-37XOXDLZ.mjs → chunk-NQDNC5P4.mjs} +64 -15
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +64 -15
- package/cloudflare.mjs +1 -1
- package/express.d.mts +2 -2
- package/express.d.ts +2 -2
- package/express.js +64 -15
- package/express.mjs +1 -1
- package/h3.d.mts +2 -2
- package/h3.d.ts +2 -2
- package/h3.js +64 -15
- package/h3.mjs +1 -1
- package/hono.d.mts +2 -2
- package/hono.d.ts +2 -2
- package/hono.js +64 -15
- package/hono.mjs +1 -1
- package/index.d.mts +9 -2
- package/index.d.ts +9 -2
- package/index.js +66 -16
- package/index.mjs +3 -2
- package/nextjs.d.mts +2 -2
- package/nextjs.d.ts +2 -2
- package/nextjs.js +64 -15
- package/nextjs.mjs +1 -1
- package/package.json +1 -1
- package/{serve-many-CEUYWQvV.d.mts → serve-many-BNusWYgt.d.mts} +1 -1
- package/{serve-many-BObe3pdI.d.ts → serve-many-CXqQP3RI.d.ts} +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +64 -15
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +2 -2
- package/svelte.d.ts +2 -2
- package/svelte.js +64 -15
- package/svelte.mjs +1 -1
- package/tanstack.d.mts +36 -0
- package/tanstack.d.ts +36 -0
- package/tanstack.js +3737 -0
- package/tanstack.mjs +48 -0
- package/{types-B7_5AkKQ.d.ts → types-Q3dM0UlR.d.mts} +21 -2
- package/{types-B7_5AkKQ.d.mts → types-Q3dM0UlR.d.ts} +21 -2
package/tanstack.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SDK_TELEMETRY,
|
|
3
|
+
serveBase,
|
|
4
|
+
serveManyBase
|
|
5
|
+
} from "./chunk-NQDNC5P4.mjs";
|
|
6
|
+
|
|
7
|
+
// platforms/tanstack.ts
|
|
8
|
+
var telemetry = {
|
|
9
|
+
sdk: SDK_TELEMETRY,
|
|
10
|
+
framework: "tanstack",
|
|
11
|
+
runtime: `node@${process.version}`
|
|
12
|
+
};
|
|
13
|
+
function serve(routeFunction, options) {
|
|
14
|
+
const POST = (tanstackContext) => {
|
|
15
|
+
const { handler } = serveBase(
|
|
16
|
+
routeFunction,
|
|
17
|
+
telemetry,
|
|
18
|
+
options
|
|
19
|
+
);
|
|
20
|
+
return handler(tanstackContext.request);
|
|
21
|
+
};
|
|
22
|
+
return { POST };
|
|
23
|
+
}
|
|
24
|
+
var createWorkflow = (...params) => {
|
|
25
|
+
const [routeFunction, options = {}] = params;
|
|
26
|
+
return {
|
|
27
|
+
options,
|
|
28
|
+
workflowId: void 0,
|
|
29
|
+
routeFunction
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
var serveMany = (workflows, options) => {
|
|
33
|
+
return {
|
|
34
|
+
POST: serveManyBase({
|
|
35
|
+
workflows,
|
|
36
|
+
getUrl(context) {
|
|
37
|
+
return context.request.url;
|
|
38
|
+
},
|
|
39
|
+
serveMethod: (...params) => serve(...params).POST,
|
|
40
|
+
options
|
|
41
|
+
}).handler
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
createWorkflow,
|
|
46
|
+
serve,
|
|
47
|
+
serveMany
|
|
48
|
+
};
|
|
@@ -1286,6 +1286,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1286
1286
|
failStatus: number;
|
|
1287
1287
|
failResponse: string;
|
|
1288
1288
|
failHeaders: Record<string, string[]>;
|
|
1289
|
+
failStack: string;
|
|
1289
1290
|
}) => Promise<void | string> | void | string;
|
|
1290
1291
|
/**
|
|
1291
1292
|
* Base Url of the workflow endpoint
|
|
@@ -1403,6 +1404,10 @@ type FailureFunctionPayload = {
|
|
|
1403
1404
|
* error message
|
|
1404
1405
|
*/
|
|
1405
1406
|
message: string;
|
|
1407
|
+
/**
|
|
1408
|
+
* error stack trace if available
|
|
1409
|
+
*/
|
|
1410
|
+
stack?: string;
|
|
1406
1411
|
};
|
|
1407
1412
|
/**
|
|
1408
1413
|
* Makes all fields except the ones selected required
|
|
@@ -1476,15 +1481,29 @@ interface WaitEventOptions {
|
|
|
1476
1481
|
*/
|
|
1477
1482
|
timeout?: number | Duration;
|
|
1478
1483
|
}
|
|
1484
|
+
type StringifyBody<TBody = unknown> = TBody extends string ? boolean : true;
|
|
1479
1485
|
type CallSettings<TBody = unknown> = {
|
|
1480
1486
|
url: string;
|
|
1481
1487
|
method?: HTTPMethods$1;
|
|
1488
|
+
/**
|
|
1489
|
+
* Request body.
|
|
1490
|
+
*
|
|
1491
|
+
* By default, the body is stringified with `JSON.stringify`. If you want
|
|
1492
|
+
* to send a string body without stringifying it, you need to set
|
|
1493
|
+
* `stringifyBody` to false.
|
|
1494
|
+
*/
|
|
1482
1495
|
body?: TBody;
|
|
1483
1496
|
headers?: Record<string, string>;
|
|
1484
1497
|
retries?: number;
|
|
1485
1498
|
retryDelay?: string;
|
|
1486
1499
|
timeout?: Duration | number;
|
|
1487
1500
|
flowControl?: FlowControl;
|
|
1501
|
+
/**
|
|
1502
|
+
* Whether the body field should be stringified when making the request.
|
|
1503
|
+
*
|
|
1504
|
+
* @default true
|
|
1505
|
+
*/
|
|
1506
|
+
stringifyBody?: StringifyBody<TBody>;
|
|
1488
1507
|
};
|
|
1489
1508
|
type HeaderParams = {
|
|
1490
1509
|
/**
|
|
@@ -1597,7 +1616,7 @@ type LazyInvokeStepParams<TInitiaPayload, TResult> = {
|
|
|
1597
1616
|
workflow: Pick<InvokableWorkflow<TInitiaPayload, TResult>, "routeFunction" | "workflowId" | "options">;
|
|
1598
1617
|
body: TInitiaPayload;
|
|
1599
1618
|
workflowRunId?: string;
|
|
1600
|
-
} & Pick<CallSettings
|
|
1619
|
+
} & Pick<CallSettings<TInitiaPayload>, "retries" | "headers" | "flowControl" | "retryDelay" | "stringifyBody">;
|
|
1601
1620
|
type InvokeStepResponse<TBody> = {
|
|
1602
1621
|
body: TBody;
|
|
1603
1622
|
isCanceled?: boolean;
|
|
@@ -1609,4 +1628,4 @@ type InvokableWorkflow<TInitialPayload, TResult> = {
|
|
|
1609
1628
|
workflowId?: string;
|
|
1610
1629
|
};
|
|
1611
1630
|
|
|
1612
|
-
export { type AsyncStepFunction as A,
|
|
1631
|
+
export { type AsyncStepFunction as A, type WorkflowLoggerOptions as B, type CallResponse as C, type DetailedFinishCondition as D, type ExclusiveValidationOptions as E, type FinishCondition as F, WorkflowLogger as G, type HeaderParams as H, type InvokeWorkflowRequest as I, type LazyInvokeStepParams as L, type NotifyResponse as N, type ParallelCallState as P, type RouteFunction as R, type StepType as S, type Telemetry as T, type WorkflowServeOptions as W, type RawStep as a, type Waiter as b, WorkflowError as c, WorkflowAbort as d, WorkflowNonRetryableError as e, WorkflowTool as f, WorkflowContext as g, type WorkflowClient as h, type WorkflowReceiver as i, StepTypes as j, type Step as k, type SyncStepFunction as l, type StepFunction as m, type PublicServeOptions as n, type FailureFunctionPayload as o, type RequiredExceptFields as p, type WaitRequest as q, type WaitStepResponse as r, type NotifyStepResponse as s, type Duration as t, type WaitEventOptions as u, type StringifyBody as v, type CallSettings as w, type InvokeStepResponse as x, type InvokableWorkflow as y, type LogLevel as z };
|
|
@@ -1286,6 +1286,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1286
1286
|
failStatus: number;
|
|
1287
1287
|
failResponse: string;
|
|
1288
1288
|
failHeaders: Record<string, string[]>;
|
|
1289
|
+
failStack: string;
|
|
1289
1290
|
}) => Promise<void | string> | void | string;
|
|
1290
1291
|
/**
|
|
1291
1292
|
* Base Url of the workflow endpoint
|
|
@@ -1403,6 +1404,10 @@ type FailureFunctionPayload = {
|
|
|
1403
1404
|
* error message
|
|
1404
1405
|
*/
|
|
1405
1406
|
message: string;
|
|
1407
|
+
/**
|
|
1408
|
+
* error stack trace if available
|
|
1409
|
+
*/
|
|
1410
|
+
stack?: string;
|
|
1406
1411
|
};
|
|
1407
1412
|
/**
|
|
1408
1413
|
* Makes all fields except the ones selected required
|
|
@@ -1476,15 +1481,29 @@ interface WaitEventOptions {
|
|
|
1476
1481
|
*/
|
|
1477
1482
|
timeout?: number | Duration;
|
|
1478
1483
|
}
|
|
1484
|
+
type StringifyBody<TBody = unknown> = TBody extends string ? boolean : true;
|
|
1479
1485
|
type CallSettings<TBody = unknown> = {
|
|
1480
1486
|
url: string;
|
|
1481
1487
|
method?: HTTPMethods$1;
|
|
1488
|
+
/**
|
|
1489
|
+
* Request body.
|
|
1490
|
+
*
|
|
1491
|
+
* By default, the body is stringified with `JSON.stringify`. If you want
|
|
1492
|
+
* to send a string body without stringifying it, you need to set
|
|
1493
|
+
* `stringifyBody` to false.
|
|
1494
|
+
*/
|
|
1482
1495
|
body?: TBody;
|
|
1483
1496
|
headers?: Record<string, string>;
|
|
1484
1497
|
retries?: number;
|
|
1485
1498
|
retryDelay?: string;
|
|
1486
1499
|
timeout?: Duration | number;
|
|
1487
1500
|
flowControl?: FlowControl;
|
|
1501
|
+
/**
|
|
1502
|
+
* Whether the body field should be stringified when making the request.
|
|
1503
|
+
*
|
|
1504
|
+
* @default true
|
|
1505
|
+
*/
|
|
1506
|
+
stringifyBody?: StringifyBody<TBody>;
|
|
1488
1507
|
};
|
|
1489
1508
|
type HeaderParams = {
|
|
1490
1509
|
/**
|
|
@@ -1597,7 +1616,7 @@ type LazyInvokeStepParams<TInitiaPayload, TResult> = {
|
|
|
1597
1616
|
workflow: Pick<InvokableWorkflow<TInitiaPayload, TResult>, "routeFunction" | "workflowId" | "options">;
|
|
1598
1617
|
body: TInitiaPayload;
|
|
1599
1618
|
workflowRunId?: string;
|
|
1600
|
-
} & Pick<CallSettings
|
|
1619
|
+
} & Pick<CallSettings<TInitiaPayload>, "retries" | "headers" | "flowControl" | "retryDelay" | "stringifyBody">;
|
|
1601
1620
|
type InvokeStepResponse<TBody> = {
|
|
1602
1621
|
body: TBody;
|
|
1603
1622
|
isCanceled?: boolean;
|
|
@@ -1609,4 +1628,4 @@ type InvokableWorkflow<TInitialPayload, TResult> = {
|
|
|
1609
1628
|
workflowId?: string;
|
|
1610
1629
|
};
|
|
1611
1630
|
|
|
1612
|
-
export { type AsyncStepFunction as A,
|
|
1631
|
+
export { type AsyncStepFunction as A, type WorkflowLoggerOptions as B, type CallResponse as C, type DetailedFinishCondition as D, type ExclusiveValidationOptions as E, type FinishCondition as F, WorkflowLogger as G, type HeaderParams as H, type InvokeWorkflowRequest as I, type LazyInvokeStepParams as L, type NotifyResponse as N, type ParallelCallState as P, type RouteFunction as R, type StepType as S, type Telemetry as T, type WorkflowServeOptions as W, type RawStep as a, type Waiter as b, WorkflowError as c, WorkflowAbort as d, WorkflowNonRetryableError as e, WorkflowTool as f, WorkflowContext as g, type WorkflowClient as h, type WorkflowReceiver as i, StepTypes as j, type Step as k, type SyncStepFunction as l, type StepFunction as m, type PublicServeOptions as n, type FailureFunctionPayload as o, type RequiredExceptFields as p, type WaitRequest as q, type WaitStepResponse as r, type NotifyStepResponse as s, type Duration as t, type WaitEventOptions as u, type StringifyBody as v, type CallSettings as w, type InvokeStepResponse as x, type InvokableWorkflow as y, type LogLevel as z };
|