@upstash/workflow 1.1.0 → 1.1.1

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.
Files changed (50) hide show
  1. package/astro.d.mts +2 -2
  2. package/astro.d.ts +2 -2
  3. package/astro.js +28 -2
  4. package/astro.mjs +1 -1
  5. package/{chunk-C5HFGF7Q.mjs → chunk-QRCGBBFJ.mjs} +28 -2
  6. package/cloudflare.d.mts +2 -2
  7. package/cloudflare.d.ts +2 -2
  8. package/cloudflare.js +28 -2
  9. package/cloudflare.mjs +1 -1
  10. package/express.d.mts +2 -2
  11. package/express.d.ts +2 -2
  12. package/express.js +28 -2
  13. package/express.mjs +1 -1
  14. package/h3.d.mts +2 -2
  15. package/h3.d.ts +2 -2
  16. package/h3.js +32 -6
  17. package/h3.mjs +5 -5
  18. package/hono.d.mts +2 -2
  19. package/hono.d.ts +2 -2
  20. package/hono.js +28 -2
  21. package/hono.mjs +1 -1
  22. package/index.d.mts +3 -3
  23. package/index.d.ts +3 -3
  24. package/index.js +31 -3
  25. package/index.mjs +4 -2
  26. package/nextjs.d.mts +2 -2
  27. package/nextjs.d.ts +2 -2
  28. package/nextjs.js +28 -2
  29. package/nextjs.mjs +1 -1
  30. package/package.json +1 -1
  31. package/react-router.d.mts +38 -0
  32. package/react-router.d.ts +38 -0
  33. package/react-router.js +3861 -0
  34. package/react-router.mjs +45 -0
  35. package/{serve-many-qnfynN1x.d.ts → serve-many-BP-8Ytbc.d.ts} +1 -1
  36. package/{serve-many-DhB8-zPD.d.mts → serve-many-BsycEL_d.d.mts} +1 -1
  37. package/solidjs.d.mts +1 -1
  38. package/solidjs.d.ts +1 -1
  39. package/solidjs.js +28 -2
  40. package/solidjs.mjs +1 -1
  41. package/svelte.d.mts +2 -2
  42. package/svelte.d.ts +2 -2
  43. package/svelte.js +28 -2
  44. package/svelte.mjs +1 -1
  45. package/tanstack.d.mts +2 -2
  46. package/tanstack.d.ts +2 -2
  47. package/tanstack.js +28 -2
  48. package/tanstack.mjs +1 -1
  49. package/{types-pEje3VEB.d.ts → types-B90SJYZV.d.mts} +9 -2
  50. package/{types-pEje3VEB.d.mts → types-B90SJYZV.d.ts} +9 -2
package/astro.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { APIContext, APIRoute } from 'astro';
2
- import { j as WorkflowContext, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.mjs';
3
- import { s as serveManyBase } from './serve-many-DhB8-zPD.mjs';
2
+ import { u as WorkflowContext, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.mjs';
3
+ import { s as serveManyBase } from './serve-many-BsycEL_d.mjs';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
6
 
package/astro.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { APIContext, APIRoute } from 'astro';
2
- import { j as WorkflowContext, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.js';
3
- import { s as serveManyBase } from './serve-many-qnfynN1x.js';
2
+ import { u as WorkflowContext, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.js';
3
+ import { s as serveManyBase } from './serve-many-BP-8Ytbc.js';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
6
 
package/astro.js CHANGED
@@ -186,6 +186,7 @@ var getSteps = async (requester, workflowRunId, messageId, dispatchDebug) => {
186
186
  var WORKFLOW_ID_HEADER = "Upstash-Workflow-RunId";
187
187
  var WORKFLOW_INIT_HEADER = "Upstash-Workflow-Init";
188
188
  var WORKFLOW_URL_HEADER = "Upstash-Workflow-Url";
189
+ var WORKFLOW_CREATED_AT_HEADER = "Upstash-Workflow-CreatedAt";
189
190
  var WORKFLOW_FAILURE_HEADER = "Upstash-Workflow-Is-Failure";
190
191
  var WORKFLOW_FAILURE_CALLBACK_HEADER = "Upstash-Workflow-Failure-Callback";
191
192
  var WORKFLOW_FEATURE_HEADER = "Upstash-Feature-Set";
@@ -1516,13 +1517,22 @@ var LazyInvokeStep = class extends BaseLazyStep {
1516
1517
  Object.entries(invokerHeaders).map((pairs) => [pairs[0], [pairs[1]]])
1517
1518
  ),
1518
1519
  workflowRunId: context.workflowRunId,
1520
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
1519
1521
  workflowUrl: context.url,
1520
1522
  step
1521
1523
  };
1522
1524
  return JSON.stringify(request);
1523
1525
  }
1524
1526
  getHeaders({ context, telemetry: telemetry2, invokeCount }) {
1525
- const { workflow, headers = {}, workflowRunId, retries, retryDelay, flowControl } = this.params;
1527
+ const {
1528
+ workflow,
1529
+ headers = {},
1530
+ workflowRunId,
1531
+ retries,
1532
+ retryDelay,
1533
+ flowControl,
1534
+ label
1535
+ } = this.params;
1526
1536
  const newUrl = context.url.replace(/[^/]+$/, this.workflowId);
1527
1537
  const { headers: triggerHeaders, contentType } = getHeaders({
1528
1538
  initHeaderValue: "true",
@@ -1540,6 +1550,10 @@ var LazyInvokeStep = class extends BaseLazyStep {
1540
1550
  userHeaders: new Headers(headers)
1541
1551
  });
1542
1552
  triggerHeaders["Upstash-Workflow-Invoke"] = "true";
1553
+ if (label) {
1554
+ triggerHeaders[WORKFLOW_LABEL_HEADER] = label;
1555
+ triggerHeaders[`upstash-forward-${WORKFLOW_LABEL_HEADER}`] = label;
1556
+ }
1543
1557
  return { headers: triggerHeaders, contentType };
1544
1558
  }
1545
1559
  async submitStep({ context, body, headers }) {
@@ -2597,6 +2611,10 @@ var WorkflowContext = class {
2597
2611
  * Run id of the workflow
2598
2612
  */
2599
2613
  workflowRunId;
2614
+ /**
2615
+ * Creation time of the workflow run
2616
+ */
2617
+ workflowRunCreatedAt;
2600
2618
  /**
2601
2619
  * URL of the workflow
2602
2620
  *
@@ -2688,6 +2706,7 @@ var WorkflowContext = class {
2688
2706
  constructor({
2689
2707
  qstashClient,
2690
2708
  workflowRunId,
2709
+ workflowRunCreatedAt,
2691
2710
  headers,
2692
2711
  steps,
2693
2712
  url,
@@ -2700,6 +2719,7 @@ var WorkflowContext = class {
2700
2719
  }) {
2701
2720
  this.qstashClient = qstashClient;
2702
2721
  this.workflowRunId = workflowRunId;
2722
+ this.workflowRunCreatedAt = workflowRunCreatedAt;
2703
2723
  this.steps = steps;
2704
2724
  this.url = url;
2705
2725
  this.headers = headers;
@@ -2956,6 +2976,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
2956
2976
  token: "disabled-client"
2957
2977
  }),
2958
2978
  workflowRunId: context.workflowRunId,
2979
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
2959
2980
  headers: context.headers,
2960
2981
  steps: [],
2961
2982
  url: context.url,
@@ -3157,7 +3178,9 @@ var handleFailure = async ({
3157
3178
  return ok({ result: "failure-function-undefined" });
3158
3179
  }
3159
3180
  try {
3160
- const { status, header, body, url, sourceBody, workflowRunId } = JSON.parse(requestPayload);
3181
+ const { status, header, body, url, sourceBody, workflowRunId, workflowCreatedAt } = JSON.parse(
3182
+ requestPayload
3183
+ );
3161
3184
  const decodedBody = body ? decodeBase64(body) : "{}";
3162
3185
  let errorMessage = "";
3163
3186
  let failStack = "";
@@ -3186,6 +3209,7 @@ var handleFailure = async ({
3186
3209
  telemetry: void 0,
3187
3210
  // not going to make requests in authentication check
3188
3211
  label: userHeaders.get(WORKFLOW_LABEL_HEADER) ?? void 0,
3212
+ workflowRunCreatedAt: workflowCreatedAt,
3189
3213
  middlewareManager: void 0
3190
3214
  });
3191
3215
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
@@ -3663,6 +3687,7 @@ var serveBase = (routeFunction, telemetry2, options, internalOptions) => {
3663
3687
  }
3664
3688
  const invokeCount = Number(request.headers.get(WORKFLOW_INVOKE_COUNT_HEADER) ?? "0");
3665
3689
  const label = request.headers.get(WORKFLOW_LABEL_HEADER) ?? void 0;
3690
+ const workflowRunCreatedAt = request.headers.get(WORKFLOW_CREATED_AT_HEADER);
3666
3691
  const workflowContext = new WorkflowContext({
3667
3692
  qstashClient: regionalClient,
3668
3693
  workflowRunId,
@@ -3674,6 +3699,7 @@ var serveBase = (routeFunction, telemetry2, options, internalOptions) => {
3674
3699
  telemetry: telemetry2,
3675
3700
  invokeCount,
3676
3701
  label,
3702
+ workflowRunCreatedAt: Number(workflowRunCreatedAt),
3677
3703
  middlewareManager
3678
3704
  });
3679
3705
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
package/astro.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-C5HFGF7Q.mjs";
5
+ } from "./chunk-QRCGBBFJ.mjs";
6
6
 
7
7
  // platforms/astro.ts
8
8
  var telemetry = {
@@ -98,6 +98,7 @@ function isInstanceOf(v, ctor) {
98
98
  var WORKFLOW_ID_HEADER = "Upstash-Workflow-RunId";
99
99
  var WORKFLOW_INIT_HEADER = "Upstash-Workflow-Init";
100
100
  var WORKFLOW_URL_HEADER = "Upstash-Workflow-Url";
101
+ var WORKFLOW_CREATED_AT_HEADER = "Upstash-Workflow-CreatedAt";
101
102
  var WORKFLOW_FAILURE_HEADER = "Upstash-Workflow-Is-Failure";
102
103
  var WORKFLOW_FAILURE_CALLBACK_HEADER = "Upstash-Workflow-Failure-Callback";
103
104
  var WORKFLOW_FEATURE_HEADER = "Upstash-Feature-Set";
@@ -1568,13 +1569,22 @@ var LazyInvokeStep = class extends BaseLazyStep {
1568
1569
  Object.entries(invokerHeaders).map((pairs) => [pairs[0], [pairs[1]]])
1569
1570
  ),
1570
1571
  workflowRunId: context.workflowRunId,
1572
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
1571
1573
  workflowUrl: context.url,
1572
1574
  step
1573
1575
  };
1574
1576
  return JSON.stringify(request);
1575
1577
  }
1576
1578
  getHeaders({ context, telemetry, invokeCount }) {
1577
- const { workflow, headers = {}, workflowRunId, retries, retryDelay, flowControl } = this.params;
1579
+ const {
1580
+ workflow,
1581
+ headers = {},
1582
+ workflowRunId,
1583
+ retries,
1584
+ retryDelay,
1585
+ flowControl,
1586
+ label
1587
+ } = this.params;
1578
1588
  const newUrl = context.url.replace(/[^/]+$/, this.workflowId);
1579
1589
  const { headers: triggerHeaders, contentType } = getHeaders({
1580
1590
  initHeaderValue: "true",
@@ -1592,6 +1602,10 @@ var LazyInvokeStep = class extends BaseLazyStep {
1592
1602
  userHeaders: new Headers(headers)
1593
1603
  });
1594
1604
  triggerHeaders["Upstash-Workflow-Invoke"] = "true";
1605
+ if (label) {
1606
+ triggerHeaders[WORKFLOW_LABEL_HEADER] = label;
1607
+ triggerHeaders[`upstash-forward-${WORKFLOW_LABEL_HEADER}`] = label;
1608
+ }
1595
1609
  return { headers: triggerHeaders, contentType };
1596
1610
  }
1597
1611
  async submitStep({ context, body, headers }) {
@@ -2574,6 +2588,10 @@ var WorkflowContext = class {
2574
2588
  * Run id of the workflow
2575
2589
  */
2576
2590
  workflowRunId;
2591
+ /**
2592
+ * Creation time of the workflow run
2593
+ */
2594
+ workflowRunCreatedAt;
2577
2595
  /**
2578
2596
  * URL of the workflow
2579
2597
  *
@@ -2665,6 +2683,7 @@ var WorkflowContext = class {
2665
2683
  constructor({
2666
2684
  qstashClient,
2667
2685
  workflowRunId,
2686
+ workflowRunCreatedAt,
2668
2687
  headers,
2669
2688
  steps,
2670
2689
  url,
@@ -2677,6 +2696,7 @@ var WorkflowContext = class {
2677
2696
  }) {
2678
2697
  this.qstashClient = qstashClient;
2679
2698
  this.workflowRunId = workflowRunId;
2699
+ this.workflowRunCreatedAt = workflowRunCreatedAt;
2680
2700
  this.steps = steps;
2681
2701
  this.url = url;
2682
2702
  this.headers = headers;
@@ -3007,6 +3027,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
3007
3027
  token: "disabled-client"
3008
3028
  }),
3009
3029
  workflowRunId: context.workflowRunId,
3030
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
3010
3031
  headers: context.headers,
3011
3032
  steps: [],
3012
3033
  url: context.url,
@@ -3208,7 +3229,9 @@ var handleFailure = async ({
3208
3229
  return ok({ result: "failure-function-undefined" });
3209
3230
  }
3210
3231
  try {
3211
- const { status, header, body, url, sourceBody, workflowRunId } = JSON.parse(requestPayload);
3232
+ const { status, header, body, url, sourceBody, workflowRunId, workflowCreatedAt } = JSON.parse(
3233
+ requestPayload
3234
+ );
3212
3235
  const decodedBody = body ? decodeBase64(body) : "{}";
3213
3236
  let errorMessage = "";
3214
3237
  let failStack = "";
@@ -3237,6 +3260,7 @@ var handleFailure = async ({
3237
3260
  telemetry: void 0,
3238
3261
  // not going to make requests in authentication check
3239
3262
  label: userHeaders.get(WORKFLOW_LABEL_HEADER) ?? void 0,
3263
+ workflowRunCreatedAt: workflowCreatedAt,
3240
3264
  middlewareManager: void 0
3241
3265
  });
3242
3266
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
@@ -3640,6 +3664,7 @@ var serveBase = (routeFunction, telemetry, options, internalOptions) => {
3640
3664
  }
3641
3665
  const invokeCount = Number(request.headers.get(WORKFLOW_INVOKE_COUNT_HEADER) ?? "0");
3642
3666
  const label = request.headers.get(WORKFLOW_LABEL_HEADER) ?? void 0;
3667
+ const workflowRunCreatedAt = request.headers.get(WORKFLOW_CREATED_AT_HEADER);
3643
3668
  const workflowContext = new WorkflowContext({
3644
3669
  qstashClient: regionalClient,
3645
3670
  workflowRunId,
@@ -3651,6 +3676,7 @@ var serveBase = (routeFunction, telemetry, options, internalOptions) => {
3651
3676
  telemetry,
3652
3677
  invokeCount,
3653
3678
  label,
3679
+ workflowRunCreatedAt: Number(workflowRunCreatedAt),
3654
3680
  middlewareManager
3655
3681
  });
3656
3682
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
package/cloudflare.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as RouteFunction, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.mjs';
2
- import { s as serveManyBase } from './serve-many-DhB8-zPD.mjs';
1
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.mjs';
2
+ import { s as serveManyBase } from './serve-many-BsycEL_d.mjs';
3
3
  import '@upstash/qstash';
4
4
  import 'zod';
5
5
 
package/cloudflare.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as RouteFunction, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.js';
2
- import { s as serveManyBase } from './serve-many-qnfynN1x.js';
1
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.js';
2
+ import { s as serveManyBase } from './serve-many-BP-8Ytbc.js';
3
3
  import '@upstash/qstash';
4
4
  import 'zod';
5
5
 
package/cloudflare.js CHANGED
@@ -30,6 +30,7 @@ module.exports = __toCommonJS(cloudflare_exports);
30
30
  var WORKFLOW_ID_HEADER = "Upstash-Workflow-RunId";
31
31
  var WORKFLOW_INIT_HEADER = "Upstash-Workflow-Init";
32
32
  var WORKFLOW_URL_HEADER = "Upstash-Workflow-Url";
33
+ var WORKFLOW_CREATED_AT_HEADER = "Upstash-Workflow-CreatedAt";
33
34
  var WORKFLOW_FAILURE_HEADER = "Upstash-Workflow-Is-Failure";
34
35
  var WORKFLOW_FAILURE_CALLBACK_HEADER = "Upstash-Workflow-Failure-Callback";
35
36
  var WORKFLOW_FEATURE_HEADER = "Upstash-Feature-Set";
@@ -1516,13 +1517,22 @@ var LazyInvokeStep = class extends BaseLazyStep {
1516
1517
  Object.entries(invokerHeaders).map((pairs) => [pairs[0], [pairs[1]]])
1517
1518
  ),
1518
1519
  workflowRunId: context.workflowRunId,
1520
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
1519
1521
  workflowUrl: context.url,
1520
1522
  step
1521
1523
  };
1522
1524
  return JSON.stringify(request);
1523
1525
  }
1524
1526
  getHeaders({ context, telemetry: telemetry2, invokeCount }) {
1525
- const { workflow, headers = {}, workflowRunId, retries, retryDelay, flowControl } = this.params;
1527
+ const {
1528
+ workflow,
1529
+ headers = {},
1530
+ workflowRunId,
1531
+ retries,
1532
+ retryDelay,
1533
+ flowControl,
1534
+ label
1535
+ } = this.params;
1526
1536
  const newUrl = context.url.replace(/[^/]+$/, this.workflowId);
1527
1537
  const { headers: triggerHeaders, contentType } = getHeaders({
1528
1538
  initHeaderValue: "true",
@@ -1540,6 +1550,10 @@ var LazyInvokeStep = class extends BaseLazyStep {
1540
1550
  userHeaders: new Headers(headers)
1541
1551
  });
1542
1552
  triggerHeaders["Upstash-Workflow-Invoke"] = "true";
1553
+ if (label) {
1554
+ triggerHeaders[WORKFLOW_LABEL_HEADER] = label;
1555
+ triggerHeaders[`upstash-forward-${WORKFLOW_LABEL_HEADER}`] = label;
1556
+ }
1543
1557
  return { headers: triggerHeaders, contentType };
1544
1558
  }
1545
1559
  async submitStep({ context, body, headers }) {
@@ -2597,6 +2611,10 @@ var WorkflowContext = class {
2597
2611
  * Run id of the workflow
2598
2612
  */
2599
2613
  workflowRunId;
2614
+ /**
2615
+ * Creation time of the workflow run
2616
+ */
2617
+ workflowRunCreatedAt;
2600
2618
  /**
2601
2619
  * URL of the workflow
2602
2620
  *
@@ -2688,6 +2706,7 @@ var WorkflowContext = class {
2688
2706
  constructor({
2689
2707
  qstashClient,
2690
2708
  workflowRunId,
2709
+ workflowRunCreatedAt,
2691
2710
  headers,
2692
2711
  steps,
2693
2712
  url,
@@ -2700,6 +2719,7 @@ var WorkflowContext = class {
2700
2719
  }) {
2701
2720
  this.qstashClient = qstashClient;
2702
2721
  this.workflowRunId = workflowRunId;
2722
+ this.workflowRunCreatedAt = workflowRunCreatedAt;
2703
2723
  this.steps = steps;
2704
2724
  this.url = url;
2705
2725
  this.headers = headers;
@@ -2956,6 +2976,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
2956
2976
  token: "disabled-client"
2957
2977
  }),
2958
2978
  workflowRunId: context.workflowRunId,
2979
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
2959
2980
  headers: context.headers,
2960
2981
  steps: [],
2961
2982
  url: context.url,
@@ -3157,7 +3178,9 @@ var handleFailure = async ({
3157
3178
  return ok({ result: "failure-function-undefined" });
3158
3179
  }
3159
3180
  try {
3160
- const { status, header, body, url, sourceBody, workflowRunId } = JSON.parse(requestPayload);
3181
+ const { status, header, body, url, sourceBody, workflowRunId, workflowCreatedAt } = JSON.parse(
3182
+ requestPayload
3183
+ );
3161
3184
  const decodedBody = body ? decodeBase64(body) : "{}";
3162
3185
  let errorMessage = "";
3163
3186
  let failStack = "";
@@ -3186,6 +3209,7 @@ var handleFailure = async ({
3186
3209
  telemetry: void 0,
3187
3210
  // not going to make requests in authentication check
3188
3211
  label: userHeaders.get(WORKFLOW_LABEL_HEADER) ?? void 0,
3212
+ workflowRunCreatedAt: workflowCreatedAt,
3189
3213
  middlewareManager: void 0
3190
3214
  });
3191
3215
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
@@ -3663,6 +3687,7 @@ var serveBase = (routeFunction, telemetry2, options, internalOptions) => {
3663
3687
  }
3664
3688
  const invokeCount = Number(request.headers.get(WORKFLOW_INVOKE_COUNT_HEADER) ?? "0");
3665
3689
  const label = request.headers.get(WORKFLOW_LABEL_HEADER) ?? void 0;
3690
+ const workflowRunCreatedAt = request.headers.get(WORKFLOW_CREATED_AT_HEADER);
3666
3691
  const workflowContext = new WorkflowContext({
3667
3692
  qstashClient: regionalClient,
3668
3693
  workflowRunId,
@@ -3674,6 +3699,7 @@ var serveBase = (routeFunction, telemetry2, options, internalOptions) => {
3674
3699
  telemetry: telemetry2,
3675
3700
  invokeCount,
3676
3701
  label,
3702
+ workflowRunCreatedAt: Number(workflowRunCreatedAt),
3677
3703
  middlewareManager
3678
3704
  });
3679
3705
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
package/cloudflare.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-C5HFGF7Q.mjs";
5
+ } from "./chunk-QRCGBBFJ.mjs";
6
6
 
7
7
  // platforms/cloudflare.ts
8
8
  var getArgs = (args) => {
package/express.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as express_serve_static_core from 'express-serve-static-core';
2
- import { c as RouteFunction, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.mjs';
2
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.mjs';
3
3
  import { Router } from 'express';
4
- import { s as serveManyBase } from './serve-many-DhB8-zPD.mjs';
4
+ import { s as serveManyBase } from './serve-many-BsycEL_d.mjs';
5
5
  import '@upstash/qstash';
6
6
  import 'zod';
7
7
 
package/express.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as express_serve_static_core from 'express-serve-static-core';
2
- import { c as RouteFunction, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.js';
2
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.js';
3
3
  import { Router } from 'express';
4
- import { s as serveManyBase } from './serve-many-qnfynN1x.js';
4
+ import { s as serveManyBase } from './serve-many-BP-8Ytbc.js';
5
5
  import '@upstash/qstash';
6
6
  import 'zod';
7
7
 
package/express.js CHANGED
@@ -30,6 +30,7 @@ module.exports = __toCommonJS(express_exports);
30
30
  var WORKFLOW_ID_HEADER = "Upstash-Workflow-RunId";
31
31
  var WORKFLOW_INIT_HEADER = "Upstash-Workflow-Init";
32
32
  var WORKFLOW_URL_HEADER = "Upstash-Workflow-Url";
33
+ var WORKFLOW_CREATED_AT_HEADER = "Upstash-Workflow-CreatedAt";
33
34
  var WORKFLOW_FAILURE_HEADER = "Upstash-Workflow-Is-Failure";
34
35
  var WORKFLOW_FAILURE_CALLBACK_HEADER = "Upstash-Workflow-Failure-Callback";
35
36
  var WORKFLOW_FEATURE_HEADER = "Upstash-Feature-Set";
@@ -1516,13 +1517,22 @@ var LazyInvokeStep = class extends BaseLazyStep {
1516
1517
  Object.entries(invokerHeaders).map((pairs) => [pairs[0], [pairs[1]]])
1517
1518
  ),
1518
1519
  workflowRunId: context.workflowRunId,
1520
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
1519
1521
  workflowUrl: context.url,
1520
1522
  step
1521
1523
  };
1522
1524
  return JSON.stringify(request);
1523
1525
  }
1524
1526
  getHeaders({ context, telemetry: telemetry2, invokeCount }) {
1525
- const { workflow, headers = {}, workflowRunId, retries, retryDelay, flowControl } = this.params;
1527
+ const {
1528
+ workflow,
1529
+ headers = {},
1530
+ workflowRunId,
1531
+ retries,
1532
+ retryDelay,
1533
+ flowControl,
1534
+ label
1535
+ } = this.params;
1526
1536
  const newUrl = context.url.replace(/[^/]+$/, this.workflowId);
1527
1537
  const { headers: triggerHeaders, contentType } = getHeaders({
1528
1538
  initHeaderValue: "true",
@@ -1540,6 +1550,10 @@ var LazyInvokeStep = class extends BaseLazyStep {
1540
1550
  userHeaders: new Headers(headers)
1541
1551
  });
1542
1552
  triggerHeaders["Upstash-Workflow-Invoke"] = "true";
1553
+ if (label) {
1554
+ triggerHeaders[WORKFLOW_LABEL_HEADER] = label;
1555
+ triggerHeaders[`upstash-forward-${WORKFLOW_LABEL_HEADER}`] = label;
1556
+ }
1543
1557
  return { headers: triggerHeaders, contentType };
1544
1558
  }
1545
1559
  async submitStep({ context, body, headers }) {
@@ -2597,6 +2611,10 @@ var WorkflowContext = class {
2597
2611
  * Run id of the workflow
2598
2612
  */
2599
2613
  workflowRunId;
2614
+ /**
2615
+ * Creation time of the workflow run
2616
+ */
2617
+ workflowRunCreatedAt;
2600
2618
  /**
2601
2619
  * URL of the workflow
2602
2620
  *
@@ -2688,6 +2706,7 @@ var WorkflowContext = class {
2688
2706
  constructor({
2689
2707
  qstashClient,
2690
2708
  workflowRunId,
2709
+ workflowRunCreatedAt,
2691
2710
  headers,
2692
2711
  steps,
2693
2712
  url,
@@ -2700,6 +2719,7 @@ var WorkflowContext = class {
2700
2719
  }) {
2701
2720
  this.qstashClient = qstashClient;
2702
2721
  this.workflowRunId = workflowRunId;
2722
+ this.workflowRunCreatedAt = workflowRunCreatedAt;
2703
2723
  this.steps = steps;
2704
2724
  this.url = url;
2705
2725
  this.headers = headers;
@@ -2956,6 +2976,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
2956
2976
  token: "disabled-client"
2957
2977
  }),
2958
2978
  workflowRunId: context.workflowRunId,
2979
+ workflowRunCreatedAt: context.workflowRunCreatedAt,
2959
2980
  headers: context.headers,
2960
2981
  steps: [],
2961
2982
  url: context.url,
@@ -3157,7 +3178,9 @@ var handleFailure = async ({
3157
3178
  return ok({ result: "failure-function-undefined" });
3158
3179
  }
3159
3180
  try {
3160
- const { status, header, body, url, sourceBody, workflowRunId } = JSON.parse(requestPayload);
3181
+ const { status, header, body, url, sourceBody, workflowRunId, workflowCreatedAt } = JSON.parse(
3182
+ requestPayload
3183
+ );
3161
3184
  const decodedBody = body ? decodeBase64(body) : "{}";
3162
3185
  let errorMessage = "";
3163
3186
  let failStack = "";
@@ -3186,6 +3209,7 @@ var handleFailure = async ({
3186
3209
  telemetry: void 0,
3187
3210
  // not going to make requests in authentication check
3188
3211
  label: userHeaders.get(WORKFLOW_LABEL_HEADER) ?? void 0,
3212
+ workflowRunCreatedAt: workflowCreatedAt,
3189
3213
  middlewareManager: void 0
3190
3214
  });
3191
3215
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
@@ -3663,6 +3687,7 @@ var serveBase = (routeFunction, telemetry2, options, internalOptions) => {
3663
3687
  }
3664
3688
  const invokeCount = Number(request.headers.get(WORKFLOW_INVOKE_COUNT_HEADER) ?? "0");
3665
3689
  const label = request.headers.get(WORKFLOW_LABEL_HEADER) ?? void 0;
3690
+ const workflowRunCreatedAt = request.headers.get(WORKFLOW_CREATED_AT_HEADER);
3666
3691
  const workflowContext = new WorkflowContext({
3667
3692
  qstashClient: regionalClient,
3668
3693
  workflowRunId,
@@ -3674,6 +3699,7 @@ var serveBase = (routeFunction, telemetry2, options, internalOptions) => {
3674
3699
  telemetry: telemetry2,
3675
3700
  invokeCount,
3676
3701
  label,
3702
+ workflowRunCreatedAt: Number(workflowRunCreatedAt),
3677
3703
  middlewareManager
3678
3704
  });
3679
3705
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
package/express.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-C5HFGF7Q.mjs";
5
+ } from "./chunk-QRCGBBFJ.mjs";
6
6
 
7
7
  // platforms/express.ts
8
8
  import {
package/h3.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as h3 from 'h3';
2
- import { c as RouteFunction, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.mjs';
3
- import { s as serveManyBase } from './serve-many-DhB8-zPD.mjs';
2
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.mjs';
3
+ import { s as serveManyBase } from './serve-many-BsycEL_d.mjs';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
6
 
package/h3.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as h3 from 'h3';
2
- import { c as RouteFunction, d as WorkflowServeOptions, x as InvokableWorkflow } from './types-pEje3VEB.js';
3
- import { s as serveManyBase } from './serve-many-qnfynN1x.js';
2
+ import { c as RouteFunction, d as WorkflowServeOptions, I as InvokableWorkflow } from './types-B90SJYZV.js';
3
+ import { s as serveManyBase } from './serve-many-BP-8Ytbc.js';
4
4
  import '@upstash/qstash';
5
5
  import 'zod';
6
6