@upstash/workflow 0.2.3 → 0.2.4

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/nextjs.js CHANGED
@@ -78,6 +78,23 @@ var getSteps = async (requester, workflowRunId, messageId, debug) => {
78
78
  }
79
79
  };
80
80
 
81
+ // src/constants.ts
82
+ var WORKFLOW_ID_HEADER = "Upstash-Workflow-RunId";
83
+ var WORKFLOW_INIT_HEADER = "Upstash-Workflow-Init";
84
+ var WORKFLOW_URL_HEADER = "Upstash-Workflow-Url";
85
+ var WORKFLOW_FAILURE_HEADER = "Upstash-Workflow-Is-Failure";
86
+ var WORKFLOW_FEATURE_HEADER = "Upstash-Feature-Set";
87
+ var WORKFLOW_PROTOCOL_VERSION = "1";
88
+ var WORKFLOW_PROTOCOL_VERSION_HEADER = "Upstash-Workflow-Sdk-Version";
89
+ var DEFAULT_CONTENT_TYPE = "application/json";
90
+ var NO_CONCURRENCY = 1;
91
+ var DEFAULT_RETRIES = 3;
92
+ var VERSION = "v0.2.3";
93
+ var SDK_TELEMETRY = `@upstash/workflow@${VERSION}`;
94
+ var TELEMETRY_HEADER_SDK = "Upstash-Telemetry-Sdk";
95
+ var TELEMETRY_HEADER_FRAMEWORK = "Upstash-Telemetry-Framework";
96
+ var TELEMETRY_HEADER_RUNTIME = "Upstash-Telemetry-Runtime";
97
+
81
98
  // src/error.ts
82
99
  var import_qstash2 = require("@upstash/qstash");
83
100
  var WorkflowError = class extends import_qstash2.QstashError {
@@ -715,18 +732,6 @@ var Err = class {
715
732
  };
716
733
  var fromThrowable = Result.fromThrowable;
717
734
 
718
- // src/constants.ts
719
- var WORKFLOW_ID_HEADER = "Upstash-Workflow-RunId";
720
- var WORKFLOW_INIT_HEADER = "Upstash-Workflow-Init";
721
- var WORKFLOW_URL_HEADER = "Upstash-Workflow-Url";
722
- var WORKFLOW_FAILURE_HEADER = "Upstash-Workflow-Is-Failure";
723
- var WORKFLOW_FEATURE_HEADER = "Upstash-Feature-Set";
724
- var WORKFLOW_PROTOCOL_VERSION = "1";
725
- var WORKFLOW_PROTOCOL_VERSION_HEADER = "Upstash-Workflow-Sdk-Version";
726
- var DEFAULT_CONTENT_TYPE = "application/json";
727
- var NO_CONCURRENCY = 1;
728
- var DEFAULT_RETRIES = 3;
729
-
730
735
  // src/types.ts
731
736
  var StepTypes = [
732
737
  "Initial",
@@ -740,16 +745,21 @@ var StepTypes = [
740
745
 
741
746
  // src/workflow-requests.ts
742
747
  var import_qstash3 = require("@upstash/qstash");
743
- var triggerFirstInvocation = async (workflowContext, retries, useJSONContent, debug) => {
744
- const { headers } = getHeaders(
745
- "true",
746
- workflowContext.workflowRunId,
747
- workflowContext.url,
748
- workflowContext.headers,
749
- void 0,
750
- workflowContext.failureUrl,
751
- retries
752
- );
748
+ var triggerFirstInvocation = async ({
749
+ workflowContext,
750
+ useJSONContent,
751
+ telemetry,
752
+ debug
753
+ }) => {
754
+ const { headers } = getHeaders({
755
+ initHeaderValue: "true",
756
+ workflowRunId: workflowContext.workflowRunId,
757
+ workflowUrl: workflowContext.url,
758
+ userHeaders: workflowContext.headers,
759
+ failureUrl: workflowContext.failureUrl,
760
+ retries: workflowContext.retries,
761
+ telemetry
762
+ });
753
763
  if (useJSONContent) {
754
764
  headers["content-type"] = "application/json";
755
765
  }
@@ -855,7 +865,16 @@ var recreateUserHeaders = (headers) => {
855
865
  }
856
866
  return filteredHeaders;
857
867
  };
858
- var handleThirdPartyCallResult = async (request, requestPayload, client, workflowUrl, failureUrl, retries, debug) => {
868
+ var handleThirdPartyCallResult = async ({
869
+ request,
870
+ requestPayload,
871
+ client,
872
+ workflowUrl,
873
+ failureUrl,
874
+ retries,
875
+ telemetry,
876
+ debug
877
+ }) => {
859
878
  try {
860
879
  if (request.headers.get("Upstash-Workflow-Callback")) {
861
880
  let callbackPayload;
@@ -914,15 +933,15 @@ ${atob(callbackMessage.body ?? "")}`
914
933
  );
915
934
  }
916
935
  const userHeaders = recreateUserHeaders(request.headers);
917
- const { headers: requestHeaders } = getHeaders(
918
- "false",
936
+ const { headers: requestHeaders } = getHeaders({
937
+ initHeaderValue: "false",
919
938
  workflowRunId,
920
939
  workflowUrl,
921
940
  userHeaders,
922
- void 0,
923
941
  failureUrl,
924
- retries
925
- );
942
+ retries,
943
+ telemetry
944
+ });
926
945
  const callResponse = {
927
946
  status: callbackMessage.status,
928
947
  body: atob(callbackMessage.body ?? ""),
@@ -960,12 +979,31 @@ ${atob(callbackMessage.body ?? "")}`
960
979
  );
961
980
  }
962
981
  };
963
- var getHeaders = (initHeaderValue, workflowRunId, workflowUrl, userHeaders, step, failureUrl, retries, callRetries, callTimeout) => {
982
+ var getTelemetryHeaders = (telemetry) => {
983
+ return {
984
+ [TELEMETRY_HEADER_SDK]: telemetry.sdk,
985
+ [TELEMETRY_HEADER_FRAMEWORK]: telemetry.framework,
986
+ [TELEMETRY_HEADER_RUNTIME]: telemetry.runtime ?? "unknown"
987
+ };
988
+ };
989
+ var getHeaders = ({
990
+ initHeaderValue,
991
+ workflowRunId,
992
+ workflowUrl,
993
+ userHeaders,
994
+ failureUrl,
995
+ retries,
996
+ step,
997
+ callRetries,
998
+ callTimeout,
999
+ telemetry
1000
+ }) => {
964
1001
  const baseHeaders = {
965
1002
  [WORKFLOW_INIT_HEADER]: initHeaderValue,
966
1003
  [WORKFLOW_ID_HEADER]: workflowRunId,
967
1004
  [WORKFLOW_URL_HEADER]: workflowUrl,
968
- [WORKFLOW_FEATURE_HEADER]: "LazyFetch,InitialBody"
1005
+ [WORKFLOW_FEATURE_HEADER]: "LazyFetch,InitialBody",
1006
+ ...telemetry ? getTelemetryHeaders(telemetry) : {}
969
1007
  };
970
1008
  if (!step?.callUrl) {
971
1009
  baseHeaders[`Upstash-Forward-${WORKFLOW_PROTOCOL_VERSION_HEADER}`] = WORKFLOW_PROTOCOL_VERSION;
@@ -1039,6 +1077,13 @@ var getHeaders = (initHeaderValue, workflowRunId, workflowUrl, userHeaders, step
1039
1077
  ...Object.fromEntries(
1040
1078
  Object.entries(baseHeaders).map(([header, value]) => [header, [value]])
1041
1079
  ),
1080
+ // to include telemetry headers:
1081
+ ...telemetry ? Object.fromEntries(
1082
+ Object.entries(getTelemetryHeaders(telemetry)).map(([header, value]) => [
1083
+ header,
1084
+ [value]
1085
+ ])
1086
+ ) : {},
1042
1087
  // note: using WORKFLOW_ID_HEADER doesn't work, because Runid -> RunId:
1043
1088
  "Upstash-Workflow-Runid": [workflowRunId],
1044
1089
  [WORKFLOW_INIT_HEADER]: ["false"],
@@ -1077,6 +1122,7 @@ If you want to disable QStash Verification, you should clear env variables QSTAS
1077
1122
  };
1078
1123
 
1079
1124
  // src/context/auto-executor.ts
1125
+ var import_qstash4 = require("@upstash/qstash");
1080
1126
  var AutoExecutor = class _AutoExecutor {
1081
1127
  context;
1082
1128
  promises = /* @__PURE__ */ new WeakMap();
@@ -1085,13 +1131,15 @@ var AutoExecutor = class _AutoExecutor {
1085
1131
  nonPlanStepCount;
1086
1132
  steps;
1087
1133
  indexInCurrentList = 0;
1134
+ telemetry;
1088
1135
  stepCount = 0;
1089
1136
  planStepCount = 0;
1090
1137
  executingStep = false;
1091
- constructor(context, steps, debug) {
1138
+ constructor(context, steps, telemetry, debug) {
1092
1139
  this.context = context;
1093
- this.debug = debug;
1094
1140
  this.steps = steps;
1141
+ this.telemetry = telemetry;
1142
+ this.debug = debug;
1095
1143
  this.nonPlanStepCount = this.steps.filter((step) => !step.targetStep).length;
1096
1144
  }
1097
1145
  /**
@@ -1234,7 +1282,7 @@ var AutoExecutor = class _AutoExecutor {
1234
1282
  );
1235
1283
  await this.submitStepsToQStash([resultStep], [parallelStep]);
1236
1284
  } catch (error) {
1237
- if (error instanceof WorkflowAbort) {
1285
+ if (error instanceof WorkflowAbort || error instanceof import_qstash4.QstashError && error.status === 400) {
1238
1286
  throw error;
1239
1287
  }
1240
1288
  throw new WorkflowError(
@@ -1305,15 +1353,16 @@ var AutoExecutor = class _AutoExecutor {
1305
1353
  });
1306
1354
  if (steps[0].waitEventId && steps.length === 1) {
1307
1355
  const waitStep = steps[0];
1308
- const { headers, timeoutHeaders } = getHeaders(
1309
- "false",
1310
- this.context.workflowRunId,
1311
- this.context.url,
1312
- this.context.headers,
1313
- waitStep,
1314
- this.context.failureUrl,
1315
- this.context.retries
1316
- );
1356
+ const { headers, timeoutHeaders } = getHeaders({
1357
+ initHeaderValue: "false",
1358
+ workflowRunId: this.context.workflowRunId,
1359
+ workflowUrl: this.context.url,
1360
+ userHeaders: this.context.headers,
1361
+ step: waitStep,
1362
+ failureUrl: this.context.failureUrl,
1363
+ retries: this.context.retries,
1364
+ telemetry: this.telemetry
1365
+ });
1317
1366
  const waitBody = {
1318
1367
  url: this.context.url,
1319
1368
  timeout: waitStep.timeout,
@@ -1340,17 +1389,18 @@ var AutoExecutor = class _AutoExecutor {
1340
1389
  const result = await this.context.qstashClient.batchJSON(
1341
1390
  steps.map((singleStep, index) => {
1342
1391
  const lazyStep = lazySteps[index];
1343
- const { headers } = getHeaders(
1344
- "false",
1345
- this.context.workflowRunId,
1346
- this.context.url,
1347
- this.context.headers,
1348
- singleStep,
1349
- this.context.failureUrl,
1350
- this.context.retries,
1351
- lazyStep instanceof LazyCallStep ? lazyStep.retries : void 0,
1352
- lazyStep instanceof LazyCallStep ? lazyStep.timeout : void 0
1353
- );
1392
+ const { headers } = getHeaders({
1393
+ initHeaderValue: "false",
1394
+ workflowRunId: this.context.workflowRunId,
1395
+ workflowUrl: this.context.url,
1396
+ userHeaders: this.context.headers,
1397
+ step: singleStep,
1398
+ failureUrl: this.context.failureUrl,
1399
+ retries: this.context.retries,
1400
+ callRetries: lazyStep instanceof LazyCallStep ? lazyStep.retries : void 0,
1401
+ callTimeout: lazyStep instanceof LazyCallStep ? lazyStep.timeout : void 0,
1402
+ telemetry: this.telemetry
1403
+ });
1354
1404
  const willWait = singleStep.concurrent === NO_CONCURRENCY || singleStep.stepId === 0;
1355
1405
  singleStep.out = JSON.stringify(singleStep.out);
1356
1406
  return singleStep.callUrl ? (
@@ -1463,7 +1513,7 @@ var sortSteps = (steps) => {
1463
1513
  };
1464
1514
 
1465
1515
  // src/context/api/anthropic.ts
1466
- var import_qstash4 = require("@upstash/qstash");
1516
+ var import_qstash5 = require("@upstash/qstash");
1467
1517
 
1468
1518
  // src/context/provider.ts
1469
1519
  var getProviderInfo = (api) => {
@@ -1527,7 +1577,7 @@ var AnthropicAPI = class extends BaseWorkflowApi {
1527
1577
  return await this.callApi(stepName, {
1528
1578
  api: {
1529
1579
  name: "llm",
1530
- provider: (0, import_qstash4.anthropic)({ token })
1580
+ provider: (0, import_qstash5.anthropic)({ token })
1531
1581
  },
1532
1582
  ...parameters
1533
1583
  });
@@ -1535,14 +1585,14 @@ var AnthropicAPI = class extends BaseWorkflowApi {
1535
1585
  };
1536
1586
 
1537
1587
  // src/context/api/openai.ts
1538
- var import_qstash5 = require("@upstash/qstash");
1588
+ var import_qstash6 = require("@upstash/qstash");
1539
1589
  var OpenAIAPI = class extends BaseWorkflowApi {
1540
1590
  async call(stepName, settings) {
1541
1591
  const { token, organization, operation, ...parameters } = settings;
1542
1592
  return await this.callApi(stepName, {
1543
1593
  api: {
1544
1594
  name: "llm",
1545
- provider: (0, import_qstash5.openai)({ token, organization })
1595
+ provider: (0, import_qstash6.openai)({ token, organization })
1546
1596
  },
1547
1597
  ...parameters
1548
1598
  });
@@ -1550,14 +1600,14 @@ var OpenAIAPI = class extends BaseWorkflowApi {
1550
1600
  };
1551
1601
 
1552
1602
  // src/context/api/resend.ts
1553
- var import_qstash6 = require("@upstash/qstash");
1603
+ var import_qstash7 = require("@upstash/qstash");
1554
1604
  var ResendAPI = class extends BaseWorkflowApi {
1555
1605
  async call(stepName, settings) {
1556
1606
  const { token, batch = false, ...parameters } = settings;
1557
1607
  return await this.callApi(stepName, {
1558
1608
  api: {
1559
1609
  name: "email",
1560
- provider: (0, import_qstash6.resend)({ token, batch })
1610
+ provider: (0, import_qstash7.resend)({ token, batch })
1561
1611
  },
1562
1612
  ...parameters
1563
1613
  });
@@ -1715,7 +1765,8 @@ var WorkflowContext = class {
1715
1765
  debug,
1716
1766
  initialPayload,
1717
1767
  env,
1718
- retries
1768
+ retries,
1769
+ telemetry
1719
1770
  }) {
1720
1771
  this.qstashClient = qstashClient;
1721
1772
  this.workflowRunId = workflowRunId;
@@ -1726,7 +1777,7 @@ var WorkflowContext = class {
1726
1777
  this.requestPayload = initialPayload;
1727
1778
  this.env = env ?? {};
1728
1779
  this.retries = retries ?? DEFAULT_RETRIES;
1729
- this.executor = new AutoExecutor(this, this.steps, debug);
1780
+ this.executor = new AutoExecutor(this, this.steps, telemetry, debug);
1730
1781
  }
1731
1782
  /**
1732
1783
  * Executes a workflow step
@@ -2044,7 +2095,7 @@ function decodeBase64(base64) {
2044
2095
  }
2045
2096
 
2046
2097
  // src/serve/authorization.ts
2047
- var import_qstash7 = require("@upstash/qstash");
2098
+ var import_qstash8 = require("@upstash/qstash");
2048
2099
  var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
2049
2100
  static disabledMessage = "disabled-qstash-worklfow-run";
2050
2101
  /**
@@ -2075,7 +2126,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
2075
2126
  */
2076
2127
  static async tryAuthentication(routeFunction, context) {
2077
2128
  const disabledContext = new _DisabledWorkflowContext({
2078
- qstashClient: new import_qstash7.Client({
2129
+ qstashClient: new import_qstash8.Client({
2079
2130
  baseUrl: "disabled-client",
2080
2131
  token: "disabled-client"
2081
2132
  }),
@@ -2239,7 +2290,7 @@ var parseRequest = async (requestPayload, isFirstInvocation, workflowRunId, requ
2239
2290
  };
2240
2291
  }
2241
2292
  };
2242
- var handleFailure = async (request, requestPayload, qstashClient, initialPayloadParser, routeFunction, failureFunction, debug) => {
2293
+ var handleFailure = async (request, requestPayload, qstashClient, initialPayloadParser, routeFunction, failureFunction, env, retries, debug) => {
2243
2294
  if (request.headers.get(WORKFLOW_FAILURE_HEADER) !== "true") {
2244
2295
  return ok("not-failure-callback");
2245
2296
  }
@@ -2264,7 +2315,11 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
2264
2315
  steps: [],
2265
2316
  url,
2266
2317
  failureUrl: url,
2267
- debug
2318
+ debug,
2319
+ env,
2320
+ retries,
2321
+ telemetry: void 0
2322
+ // not going to make requests in authentication check
2268
2323
  });
2269
2324
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
2270
2325
  routeFunction,
@@ -2289,15 +2344,15 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
2289
2344
  };
2290
2345
 
2291
2346
  // src/serve/options.ts
2292
- var import_qstash8 = require("@upstash/qstash");
2293
2347
  var import_qstash9 = require("@upstash/qstash");
2348
+ var import_qstash10 = require("@upstash/qstash");
2294
2349
  var processOptions = (options) => {
2295
2350
  const environment = options?.env ?? (typeof process === "undefined" ? {} : process.env);
2296
2351
  const receiverEnvironmentVariablesSet = Boolean(
2297
2352
  environment.QSTASH_CURRENT_SIGNING_KEY && environment.QSTASH_NEXT_SIGNING_KEY
2298
2353
  );
2299
2354
  return {
2300
- qstashClient: new import_qstash9.Client({
2355
+ qstashClient: new import_qstash10.Client({
2301
2356
  baseUrl: environment.QSTASH_URL,
2302
2357
  token: environment.QSTASH_TOKEN
2303
2358
  }),
@@ -2331,7 +2386,7 @@ var processOptions = (options) => {
2331
2386
  throw error;
2332
2387
  }
2333
2388
  },
2334
- receiver: receiverEnvironmentVariablesSet ? new import_qstash8.Receiver({
2389
+ receiver: receiverEnvironmentVariablesSet ? new import_qstash9.Receiver({
2335
2390
  currentSigningKey: environment.QSTASH_CURRENT_SIGNING_KEY,
2336
2391
  nextSigningKey: environment.QSTASH_NEXT_SIGNING_KEY
2337
2392
  }) : void 0,
@@ -2339,6 +2394,7 @@ var processOptions = (options) => {
2339
2394
  env: environment,
2340
2395
  retries: DEFAULT_RETRIES,
2341
2396
  useJSONContent: false,
2397
+ disableTelemetry: false,
2342
2398
  ...options
2343
2399
  };
2344
2400
  };
@@ -2373,7 +2429,7 @@ var determineUrls = async (request, url, baseUrl, failureFunction, failureUrl, d
2373
2429
  var AUTH_FAIL_MESSAGE = `Failed to authenticate Workflow request. If this is unexpected, see the caveat https://upstash.com/docs/workflow/basics/caveats#avoid-non-deterministic-code-outside-context-run`;
2374
2430
 
2375
2431
  // src/serve/index.ts
2376
- var serveBase = (routeFunction, options) => {
2432
+ var serveBase = (routeFunction, telemetry, options) => {
2377
2433
  const {
2378
2434
  qstashClient,
2379
2435
  onStepFinish,
@@ -2386,8 +2442,10 @@ var serveBase = (routeFunction, options) => {
2386
2442
  baseUrl,
2387
2443
  env,
2388
2444
  retries,
2389
- useJSONContent
2445
+ useJSONContent,
2446
+ disableTelemetry
2390
2447
  } = processOptions(options);
2448
+ telemetry = disableTelemetry ? void 0 : telemetry;
2391
2449
  const debug = WorkflowLogger.getLogger(verbose);
2392
2450
  const handler = async (request) => {
2393
2451
  await debug?.log("INFO", "ENDPOINT_START");
@@ -2423,7 +2481,10 @@ var serveBase = (routeFunction, options) => {
2423
2481
  qstashClient,
2424
2482
  initialPayloadParser,
2425
2483
  routeFunction,
2426
- failureFunction
2484
+ failureFunction,
2485
+ env,
2486
+ retries,
2487
+ debug
2427
2488
  );
2428
2489
  if (failureCheck.isErr()) {
2429
2490
  throw failureCheck.error;
@@ -2441,7 +2502,8 @@ var serveBase = (routeFunction, options) => {
2441
2502
  failureUrl: workflowFailureUrl,
2442
2503
  debug,
2443
2504
  env,
2444
- retries
2505
+ retries,
2506
+ telemetry
2445
2507
  });
2446
2508
  const authCheck = await DisabledWorkflowContext.tryAuthentication(
2447
2509
  routeFunction,
@@ -2457,22 +2519,23 @@ var serveBase = (routeFunction, options) => {
2457
2519
  "auth-fail"
2458
2520
  );
2459
2521
  }
2460
- const callReturnCheck = await handleThirdPartyCallResult(
2522
+ const callReturnCheck = await handleThirdPartyCallResult({
2461
2523
  request,
2462
- rawInitialPayload,
2463
- qstashClient,
2524
+ requestPayload: rawInitialPayload,
2525
+ client: qstashClient,
2464
2526
  workflowUrl,
2465
- workflowFailureUrl,
2527
+ failureUrl: workflowFailureUrl,
2466
2528
  retries,
2529
+ telemetry,
2467
2530
  debug
2468
- );
2531
+ });
2469
2532
  if (callReturnCheck.isErr()) {
2470
2533
  await debug?.log("ERROR", "SUBMIT_THIRD_PARTY_RESULT", {
2471
2534
  error: callReturnCheck.error.message
2472
2535
  });
2473
2536
  throw callReturnCheck.error;
2474
2537
  } else if (callReturnCheck.value === "continue-workflow") {
2475
- const result = isFirstInvocation ? await triggerFirstInvocation(workflowContext, retries, useJSONContent, debug) : await triggerRouteFunction({
2538
+ const result = isFirstInvocation ? await triggerFirstInvocation({ workflowContext, useJSONContent, telemetry, debug }) : await triggerRouteFunction({
2476
2539
  onStep: async () => routeFunction(workflowContext),
2477
2540
  onCleanup: async () => {
2478
2541
  await triggerWorkflowDelete(workflowContext, debug);
@@ -2511,6 +2574,11 @@ var serveBase = (routeFunction, options) => {
2511
2574
  var serve = (routeFunction, options) => {
2512
2575
  const { handler: serveHandler } = serveBase(
2513
2576
  routeFunction,
2577
+ {
2578
+ sdk: SDK_TELEMETRY,
2579
+ framework: "nextjs",
2580
+ runtime: `node@${process.version}`
2581
+ },
2514
2582
  options
2515
2583
  );
2516
2584
  return {
@@ -2520,7 +2588,15 @@ var serve = (routeFunction, options) => {
2520
2588
  };
2521
2589
  };
2522
2590
  var servePagesRouter = (routeFunction, options) => {
2523
- const { handler: serveHandler } = serveBase(routeFunction, options);
2591
+ const { handler: serveHandler } = serveBase(
2592
+ routeFunction,
2593
+ {
2594
+ sdk: SDK_TELEMETRY,
2595
+ framework: "nextjs-pages",
2596
+ runtime: process.versions.bun ? `bun@${process.versions.bun}/node@${process.version}` : `node@${process.version}`
2597
+ },
2598
+ options
2599
+ );
2524
2600
  const handler = async (request_, res) => {
2525
2601
  if (request_.method?.toUpperCase() !== "POST") {
2526
2602
  res.status(405).json("Only POST requests are allowed in worklfows");
package/nextjs.mjs CHANGED
@@ -1,11 +1,17 @@
1
1
  import {
2
+ SDK_TELEMETRY,
2
3
  serveBase
3
- } from "./chunk-QBJ3LQIO.mjs";
4
+ } from "./chunk-ETDFMXER.mjs";
4
5
 
5
6
  // platforms/nextjs.ts
6
7
  var serve = (routeFunction, options) => {
7
8
  const { handler: serveHandler } = serveBase(
8
9
  routeFunction,
10
+ {
11
+ sdk: SDK_TELEMETRY,
12
+ framework: "nextjs",
13
+ runtime: `node@${process.version}`
14
+ },
9
15
  options
10
16
  );
11
17
  return {
@@ -15,7 +21,15 @@ var serve = (routeFunction, options) => {
15
21
  };
16
22
  };
17
23
  var servePagesRouter = (routeFunction, options) => {
18
- const { handler: serveHandler } = serveBase(routeFunction, options);
24
+ const { handler: serveHandler } = serveBase(
25
+ routeFunction,
26
+ {
27
+ sdk: SDK_TELEMETRY,
28
+ framework: "nextjs-pages",
29
+ runtime: process.versions.bun ? `bun@${process.versions.bun}/node@${process.version}` : `node@${process.version}`
30
+ },
31
+ options
32
+ );
19
33
  const handler = async (request_, res) => {
20
34
  if (request_.method?.toUpperCase() !== "POST") {
21
35
  res.status(405).json("Only POST requests are allowed in worklfows");
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/workflow","version":"v0.2.3","description":"Durable, Reliable and Performant Serverless Functions","main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./*"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./dist/nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./h3":{"import":"./h3.mjs","require":"./h3.js"},"./svelte":{"import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"import":"./workflow.mjs","require":"./workflow.js"},"./hono":{"import":"./hono.mjs","require":"./hono.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./astro":{"import":"./astro.mjs","require":"./astro.js"},"./express":{"import":"./express.mjs","require":"./express.js"}},"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test src","fmt":"prettier --write .","lint":"tsc && eslint \"{src,platforms}/**/*.{js,ts,tsx}\" --quiet --fix","check-exports":"bun run build && cd dist && attw -P"},"repository":{"type":"git","url":"git+https://github.com/upstash/workflow-ts.git"},"keywords":["upstash","qstash","workflow","serverless"],"author":"Cahid Arda Oz","license":"MIT","bugs":{"url":"https://github.com/upstash/workflow-ts/issues"},"homepage":"https://github.com/upstash/workflow-ts#readme","devDependencies":{"@commitlint/cli":"^19.5.0","@commitlint/config-conventional":"^19.5.0","@eslint/js":"^9.11.1","@solidjs/start":"^1.0.8","@sveltejs/kit":"^2.6.1","@types/bun":"^1.1.10","@types/express":"^5.0.0","astro":"^4.16.7","eslint":"^9.11.1","eslint-plugin-unicorn":"^55.0.0","express":"^4.21.1","globals":"^15.10.0","h3":"^1.12.0","hono":"^4.6.3","husky":"^9.1.6","next":"^14.2.14","prettier":"3.3.3","tsup":"^8.3.0","typescript":"^5.7.2","typescript-eslint":"^8.18.0"},"dependencies":{"@upstash/qstash":"^2.7.20"},"directories":{"example":"examples"}}
1
+ {"name":"@upstash/workflow","version":"v0.2.4","description":"Durable, Reliable and Performant Serverless Functions","main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./*"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./dist/nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./nextjs":{"import":"./nextjs.mjs","require":"./nextjs.js"},"./h3":{"import":"./h3.mjs","require":"./h3.js"},"./svelte":{"import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"import":"./workflow.mjs","require":"./workflow.js"},"./hono":{"import":"./hono.mjs","require":"./hono.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./astro":{"import":"./astro.mjs","require":"./astro.js"},"./express":{"import":"./express.mjs","require":"./express.js"}},"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test src","fmt":"prettier --write .","lint":"tsc && eslint \"{src,platforms}/**/*.{js,ts,tsx}\" --quiet --fix","check-exports":"bun run build && cd dist && attw -P"},"repository":{"type":"git","url":"git+https://github.com/upstash/workflow-ts.git"},"keywords":["upstash","qstash","workflow","serverless"],"author":"Cahid Arda Oz","license":"MIT","bugs":{"url":"https://github.com/upstash/workflow-ts/issues"},"homepage":"https://github.com/upstash/workflow-ts#readme","devDependencies":{"@commitlint/cli":"^19.5.0","@commitlint/config-conventional":"^19.5.0","@eslint/js":"^9.11.1","@solidjs/start":"^1.0.8","@sveltejs/kit":"^2.6.1","@types/bun":"^1.1.10","@types/express":"^5.0.0","astro":"^4.16.7","eslint":"^9.11.1","eslint-plugin-unicorn":"^55.0.0","express":"^4.21.1","globals":"^15.10.0","h3":"^1.12.0","hono":"^4.6.3","husky":"^9.1.6","next":"^14.2.14","prettier":"3.3.3","tsup":"^8.3.0","typescript":"^5.7.2","typescript-eslint":"^8.18.0"},"dependencies":{"@upstash/qstash":"^2.7.20"},"directories":{"example":"examples"}}
package/solidjs.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { APIEvent } from '@solidjs/start/server';
2
- import { R as RouteFunction, j as PublicServeOptions } from './types-R9q4MUwl.mjs';
2
+ import { R as RouteFunction, j as PublicServeOptions } from './types-Bt4-paRy.mjs';
3
3
  import '@upstash/qstash';
4
4
 
5
5
  /**
package/solidjs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { APIEvent } from '@solidjs/start/server';
2
- import { R as RouteFunction, j as PublicServeOptions } from './types-R9q4MUwl.js';
2
+ import { R as RouteFunction, j as PublicServeOptions } from './types-Bt4-paRy.js';
3
3
  import '@upstash/qstash';
4
4
 
5
5
  /**