@upstash/workflow 0.2.13 → 0.2.14

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
@@ -94,7 +94,7 @@ var WORKFLOW_PROTOCOL_VERSION_HEADER = "Upstash-Workflow-Sdk-Version";
94
94
  var DEFAULT_CONTENT_TYPE = "application/json";
95
95
  var NO_CONCURRENCY = 1;
96
96
  var DEFAULT_RETRIES = 3;
97
- var VERSION = "v0.2.13";
97
+ var VERSION = "v0.2.14";
98
98
  var SDK_TELEMETRY = `@upstash/workflow@${VERSION}`;
99
99
  var TELEMETRY_HEADER_SDK = "Upstash-Telemetry-Sdk";
100
100
  var TELEMETRY_HEADER_FRAMEWORK = "Upstash-Telemetry-Framework";
@@ -602,59 +602,72 @@ var StepTypes = [
602
602
 
603
603
  // src/workflow-requests.ts
604
604
  var import_qstash3 = require("@upstash/qstash");
605
- var triggerFirstInvocation = async ({
606
- workflowContext,
607
- useJSONContent,
608
- telemetry,
609
- debug,
610
- invokeCount,
611
- delay
612
- }) => {
613
- const { headers } = getHeaders({
614
- initHeaderValue: "true",
615
- workflowConfig: {
616
- workflowRunId: workflowContext.workflowRunId,
617
- workflowUrl: workflowContext.url,
618
- failureUrl: workflowContext.failureUrl,
619
- retries: workflowContext.retries,
620
- telemetry,
621
- flowControl: workflowContext.flowControl,
622
- useJSONContent: useJSONContent ?? false
623
- },
624
- invokeCount: invokeCount ?? 0,
625
- userHeaders: workflowContext.headers
626
- });
627
- if (workflowContext.headers.get("content-type")) {
628
- headers["content-type"] = workflowContext.headers.get("content-type");
629
- }
630
- if (useJSONContent) {
631
- headers["content-type"] = "application/json";
632
- }
633
- try {
634
- const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
635
- const result = await workflowContext.qstashClient.publish({
636
- headers,
637
- method: "POST",
638
- body,
639
- url: workflowContext.url,
640
- delay
641
- });
642
- if (result.deduplicated) {
643
- await debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
644
- message: `Workflow run ${workflowContext.workflowRunId} already exists. A new one isn't created.`,
605
+ var triggerFirstInvocation = async (params) => {
606
+ const firstInvocationParams = Array.isArray(params) ? params : [params];
607
+ const workflowContextClient = firstInvocationParams[0].workflowContext.qstashClient;
608
+ const invocationBatch = firstInvocationParams.map(
609
+ ({ workflowContext, useJSONContent, telemetry, invokeCount, delay }) => {
610
+ const { headers } = getHeaders({
611
+ initHeaderValue: "true",
612
+ workflowConfig: {
613
+ workflowRunId: workflowContext.workflowRunId,
614
+ workflowUrl: workflowContext.url,
615
+ failureUrl: workflowContext.failureUrl,
616
+ retries: workflowContext.retries,
617
+ telemetry,
618
+ flowControl: workflowContext.flowControl,
619
+ useJSONContent: useJSONContent ?? false
620
+ },
621
+ invokeCount: invokeCount ?? 0,
622
+ userHeaders: workflowContext.headers
623
+ });
624
+ if (workflowContext.headers.get("content-type")) {
625
+ headers["content-type"] = workflowContext.headers.get("content-type");
626
+ }
627
+ if (useJSONContent) {
628
+ headers["content-type"] = "application/json";
629
+ }
630
+ const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
631
+ return {
645
632
  headers,
646
- requestPayload: workflowContext.requestPayload,
633
+ method: "POST",
634
+ body,
647
635
  url: workflowContext.url,
648
- messageId: result.messageId
649
- });
636
+ delay
637
+ };
638
+ }
639
+ );
640
+ try {
641
+ const results = await workflowContextClient.batch(invocationBatch);
642
+ const invocationStatuses = [];
643
+ for (let i = 0; i < results.length; i++) {
644
+ const result = results[i];
645
+ const invocationParams = firstInvocationParams[i];
646
+ if (result.deduplicated) {
647
+ await invocationParams.debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
648
+ message: `Workflow run ${invocationParams.workflowContext.workflowRunId} already exists. A new one isn't created.`,
649
+ headers: invocationBatch[i].headers,
650
+ requestPayload: invocationParams.workflowContext.requestPayload,
651
+ url: invocationParams.workflowContext.url,
652
+ messageId: result.messageId
653
+ });
654
+ invocationStatuses.push("workflow-run-already-exists");
655
+ } else {
656
+ await invocationParams.debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
657
+ headers: invocationBatch[i].headers,
658
+ requestPayload: invocationParams.workflowContext.requestPayload,
659
+ url: invocationParams.workflowContext.url,
660
+ messageId: result.messageId
661
+ });
662
+ invocationStatuses.push("success");
663
+ }
664
+ }
665
+ const hasAnyDeduplicated = invocationStatuses.some(
666
+ (status) => status === "workflow-run-already-exists"
667
+ );
668
+ if (hasAnyDeduplicated) {
650
669
  return ok("workflow-run-already-exists");
651
670
  } else {
652
- await debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
653
- headers,
654
- requestPayload: workflowContext.requestPayload,
655
- url: workflowContext.url,
656
- messageId: result.messageId
657
- });
658
671
  return ok("success");
659
672
  }
660
673
  } catch (error) {
@@ -1144,7 +1157,7 @@ var LazyCallStep = class _LazyCallStep extends BaseLazyStep {
1144
1157
  return { header, status, body };
1145
1158
  }
1146
1159
  }
1147
- static applicationHeaders = /* @__PURE__ */ new Set([
1160
+ static applicationContentTypes = [
1148
1161
  "application/json",
1149
1162
  "application/xml",
1150
1163
  "application/javascript",
@@ -1153,12 +1166,12 @@ var LazyCallStep = class _LazyCallStep extends BaseLazyStep {
1153
1166
  "application/ld+json",
1154
1167
  "application/rss+xml",
1155
1168
  "application/atom+xml"
1156
- ]);
1169
+ ];
1157
1170
  static isText = (contentTypeHeader) => {
1158
1171
  if (!contentTypeHeader) {
1159
1172
  return false;
1160
1173
  }
1161
- if (_LazyCallStep.applicationHeaders.has(contentTypeHeader)) {
1174
+ if (_LazyCallStep.applicationContentTypes.some((type) => contentTypeHeader.includes(type))) {
1162
1175
  return true;
1163
1176
  }
1164
1177
  if (contentTypeHeader.startsWith("text/")) {
package/nextjs.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-XVNSBBDC.mjs";
5
+ } from "./chunk-RMS2NQ3K.mjs";
6
6
 
7
7
  // platforms/nextjs.ts
8
8
  var appTelemetry = {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/workflow","version":"v0.2.13","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":{"@ai-sdk/anthropic":"^1.1.15","@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.1","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.20","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":{"@ai-sdk/openai":"^1.2.1","@upstash/qstash":"^2.8.1","ai":"^4.1.54","zod":"^3.24.1"},"directories":{"example":"examples"}}
1
+ {"name":"@upstash/workflow","version":"v0.2.14","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":{"@ai-sdk/anthropic":"^1.1.15","@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.1","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.20","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":{"@ai-sdk/openai":"^1.2.1","@upstash/qstash":"^2.8.1","ai":"^4.1.54","zod":"^3.24.1"},"directories":{"example":"examples"}}
package/solidjs.js CHANGED
@@ -89,7 +89,7 @@ var WORKFLOW_PROTOCOL_VERSION_HEADER = "Upstash-Workflow-Sdk-Version";
89
89
  var DEFAULT_CONTENT_TYPE = "application/json";
90
90
  var NO_CONCURRENCY = 1;
91
91
  var DEFAULT_RETRIES = 3;
92
- var VERSION = "v0.2.13";
92
+ var VERSION = "v0.2.14";
93
93
  var SDK_TELEMETRY = `@upstash/workflow@${VERSION}`;
94
94
  var TELEMETRY_HEADER_SDK = "Upstash-Telemetry-Sdk";
95
95
  var TELEMETRY_HEADER_FRAMEWORK = "Upstash-Telemetry-Framework";
@@ -597,59 +597,72 @@ var StepTypes = [
597
597
 
598
598
  // src/workflow-requests.ts
599
599
  var import_qstash3 = require("@upstash/qstash");
600
- var triggerFirstInvocation = async ({
601
- workflowContext,
602
- useJSONContent,
603
- telemetry,
604
- debug,
605
- invokeCount,
606
- delay
607
- }) => {
608
- const { headers } = getHeaders({
609
- initHeaderValue: "true",
610
- workflowConfig: {
611
- workflowRunId: workflowContext.workflowRunId,
612
- workflowUrl: workflowContext.url,
613
- failureUrl: workflowContext.failureUrl,
614
- retries: workflowContext.retries,
615
- telemetry,
616
- flowControl: workflowContext.flowControl,
617
- useJSONContent: useJSONContent ?? false
618
- },
619
- invokeCount: invokeCount ?? 0,
620
- userHeaders: workflowContext.headers
621
- });
622
- if (workflowContext.headers.get("content-type")) {
623
- headers["content-type"] = workflowContext.headers.get("content-type");
624
- }
625
- if (useJSONContent) {
626
- headers["content-type"] = "application/json";
627
- }
628
- try {
629
- const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
630
- const result = await workflowContext.qstashClient.publish({
631
- headers,
632
- method: "POST",
633
- body,
634
- url: workflowContext.url,
635
- delay
636
- });
637
- if (result.deduplicated) {
638
- await debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
639
- message: `Workflow run ${workflowContext.workflowRunId} already exists. A new one isn't created.`,
600
+ var triggerFirstInvocation = async (params) => {
601
+ const firstInvocationParams = Array.isArray(params) ? params : [params];
602
+ const workflowContextClient = firstInvocationParams[0].workflowContext.qstashClient;
603
+ const invocationBatch = firstInvocationParams.map(
604
+ ({ workflowContext, useJSONContent, telemetry, invokeCount, delay }) => {
605
+ const { headers } = getHeaders({
606
+ initHeaderValue: "true",
607
+ workflowConfig: {
608
+ workflowRunId: workflowContext.workflowRunId,
609
+ workflowUrl: workflowContext.url,
610
+ failureUrl: workflowContext.failureUrl,
611
+ retries: workflowContext.retries,
612
+ telemetry,
613
+ flowControl: workflowContext.flowControl,
614
+ useJSONContent: useJSONContent ?? false
615
+ },
616
+ invokeCount: invokeCount ?? 0,
617
+ userHeaders: workflowContext.headers
618
+ });
619
+ if (workflowContext.headers.get("content-type")) {
620
+ headers["content-type"] = workflowContext.headers.get("content-type");
621
+ }
622
+ if (useJSONContent) {
623
+ headers["content-type"] = "application/json";
624
+ }
625
+ const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
626
+ return {
640
627
  headers,
641
- requestPayload: workflowContext.requestPayload,
628
+ method: "POST",
629
+ body,
642
630
  url: workflowContext.url,
643
- messageId: result.messageId
644
- });
631
+ delay
632
+ };
633
+ }
634
+ );
635
+ try {
636
+ const results = await workflowContextClient.batch(invocationBatch);
637
+ const invocationStatuses = [];
638
+ for (let i = 0; i < results.length; i++) {
639
+ const result = results[i];
640
+ const invocationParams = firstInvocationParams[i];
641
+ if (result.deduplicated) {
642
+ await invocationParams.debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
643
+ message: `Workflow run ${invocationParams.workflowContext.workflowRunId} already exists. A new one isn't created.`,
644
+ headers: invocationBatch[i].headers,
645
+ requestPayload: invocationParams.workflowContext.requestPayload,
646
+ url: invocationParams.workflowContext.url,
647
+ messageId: result.messageId
648
+ });
649
+ invocationStatuses.push("workflow-run-already-exists");
650
+ } else {
651
+ await invocationParams.debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
652
+ headers: invocationBatch[i].headers,
653
+ requestPayload: invocationParams.workflowContext.requestPayload,
654
+ url: invocationParams.workflowContext.url,
655
+ messageId: result.messageId
656
+ });
657
+ invocationStatuses.push("success");
658
+ }
659
+ }
660
+ const hasAnyDeduplicated = invocationStatuses.some(
661
+ (status) => status === "workflow-run-already-exists"
662
+ );
663
+ if (hasAnyDeduplicated) {
645
664
  return ok("workflow-run-already-exists");
646
665
  } else {
647
- await debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
648
- headers,
649
- requestPayload: workflowContext.requestPayload,
650
- url: workflowContext.url,
651
- messageId: result.messageId
652
- });
653
666
  return ok("success");
654
667
  }
655
668
  } catch (error) {
@@ -1139,7 +1152,7 @@ var LazyCallStep = class _LazyCallStep extends BaseLazyStep {
1139
1152
  return { header, status, body };
1140
1153
  }
1141
1154
  }
1142
- static applicationHeaders = /* @__PURE__ */ new Set([
1155
+ static applicationContentTypes = [
1143
1156
  "application/json",
1144
1157
  "application/xml",
1145
1158
  "application/javascript",
@@ -1148,12 +1161,12 @@ var LazyCallStep = class _LazyCallStep extends BaseLazyStep {
1148
1161
  "application/ld+json",
1149
1162
  "application/rss+xml",
1150
1163
  "application/atom+xml"
1151
- ]);
1164
+ ];
1152
1165
  static isText = (contentTypeHeader) => {
1153
1166
  if (!contentTypeHeader) {
1154
1167
  return false;
1155
1168
  }
1156
- if (_LazyCallStep.applicationHeaders.has(contentTypeHeader)) {
1169
+ if (_LazyCallStep.applicationContentTypes.some((type) => contentTypeHeader.includes(type))) {
1157
1170
  return true;
1158
1171
  }
1159
1172
  if (contentTypeHeader.startsWith("text/")) {
package/solidjs.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase
4
- } from "./chunk-XVNSBBDC.mjs";
4
+ } from "./chunk-RMS2NQ3K.mjs";
5
5
 
6
6
  // platforms/solidjs.ts
7
7
  var serve = (routeFunction, options) => {
package/svelte.js CHANGED
@@ -91,7 +91,7 @@ var WORKFLOW_PROTOCOL_VERSION_HEADER = "Upstash-Workflow-Sdk-Version";
91
91
  var DEFAULT_CONTENT_TYPE = "application/json";
92
92
  var NO_CONCURRENCY = 1;
93
93
  var DEFAULT_RETRIES = 3;
94
- var VERSION = "v0.2.13";
94
+ var VERSION = "v0.2.14";
95
95
  var SDK_TELEMETRY = `@upstash/workflow@${VERSION}`;
96
96
  var TELEMETRY_HEADER_SDK = "Upstash-Telemetry-Sdk";
97
97
  var TELEMETRY_HEADER_FRAMEWORK = "Upstash-Telemetry-Framework";
@@ -599,59 +599,72 @@ var StepTypes = [
599
599
 
600
600
  // src/workflow-requests.ts
601
601
  var import_qstash3 = require("@upstash/qstash");
602
- var triggerFirstInvocation = async ({
603
- workflowContext,
604
- useJSONContent,
605
- telemetry: telemetry2,
606
- debug,
607
- invokeCount,
608
- delay
609
- }) => {
610
- const { headers } = getHeaders({
611
- initHeaderValue: "true",
612
- workflowConfig: {
613
- workflowRunId: workflowContext.workflowRunId,
614
- workflowUrl: workflowContext.url,
615
- failureUrl: workflowContext.failureUrl,
616
- retries: workflowContext.retries,
617
- telemetry: telemetry2,
618
- flowControl: workflowContext.flowControl,
619
- useJSONContent: useJSONContent ?? false
620
- },
621
- invokeCount: invokeCount ?? 0,
622
- userHeaders: workflowContext.headers
623
- });
624
- if (workflowContext.headers.get("content-type")) {
625
- headers["content-type"] = workflowContext.headers.get("content-type");
626
- }
627
- if (useJSONContent) {
628
- headers["content-type"] = "application/json";
629
- }
630
- try {
631
- const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
632
- const result = await workflowContext.qstashClient.publish({
633
- headers,
634
- method: "POST",
635
- body,
636
- url: workflowContext.url,
637
- delay
638
- });
639
- if (result.deduplicated) {
640
- await debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
641
- message: `Workflow run ${workflowContext.workflowRunId} already exists. A new one isn't created.`,
602
+ var triggerFirstInvocation = async (params) => {
603
+ const firstInvocationParams = Array.isArray(params) ? params : [params];
604
+ const workflowContextClient = firstInvocationParams[0].workflowContext.qstashClient;
605
+ const invocationBatch = firstInvocationParams.map(
606
+ ({ workflowContext, useJSONContent, telemetry: telemetry2, invokeCount, delay }) => {
607
+ const { headers } = getHeaders({
608
+ initHeaderValue: "true",
609
+ workflowConfig: {
610
+ workflowRunId: workflowContext.workflowRunId,
611
+ workflowUrl: workflowContext.url,
612
+ failureUrl: workflowContext.failureUrl,
613
+ retries: workflowContext.retries,
614
+ telemetry: telemetry2,
615
+ flowControl: workflowContext.flowControl,
616
+ useJSONContent: useJSONContent ?? false
617
+ },
618
+ invokeCount: invokeCount ?? 0,
619
+ userHeaders: workflowContext.headers
620
+ });
621
+ if (workflowContext.headers.get("content-type")) {
622
+ headers["content-type"] = workflowContext.headers.get("content-type");
623
+ }
624
+ if (useJSONContent) {
625
+ headers["content-type"] = "application/json";
626
+ }
627
+ const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
628
+ return {
642
629
  headers,
643
- requestPayload: workflowContext.requestPayload,
630
+ method: "POST",
631
+ body,
644
632
  url: workflowContext.url,
645
- messageId: result.messageId
646
- });
633
+ delay
634
+ };
635
+ }
636
+ );
637
+ try {
638
+ const results = await workflowContextClient.batch(invocationBatch);
639
+ const invocationStatuses = [];
640
+ for (let i = 0; i < results.length; i++) {
641
+ const result = results[i];
642
+ const invocationParams = firstInvocationParams[i];
643
+ if (result.deduplicated) {
644
+ await invocationParams.debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
645
+ message: `Workflow run ${invocationParams.workflowContext.workflowRunId} already exists. A new one isn't created.`,
646
+ headers: invocationBatch[i].headers,
647
+ requestPayload: invocationParams.workflowContext.requestPayload,
648
+ url: invocationParams.workflowContext.url,
649
+ messageId: result.messageId
650
+ });
651
+ invocationStatuses.push("workflow-run-already-exists");
652
+ } else {
653
+ await invocationParams.debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
654
+ headers: invocationBatch[i].headers,
655
+ requestPayload: invocationParams.workflowContext.requestPayload,
656
+ url: invocationParams.workflowContext.url,
657
+ messageId: result.messageId
658
+ });
659
+ invocationStatuses.push("success");
660
+ }
661
+ }
662
+ const hasAnyDeduplicated = invocationStatuses.some(
663
+ (status) => status === "workflow-run-already-exists"
664
+ );
665
+ if (hasAnyDeduplicated) {
647
666
  return ok("workflow-run-already-exists");
648
667
  } else {
649
- await debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
650
- headers,
651
- requestPayload: workflowContext.requestPayload,
652
- url: workflowContext.url,
653
- messageId: result.messageId
654
- });
655
668
  return ok("success");
656
669
  }
657
670
  } catch (error) {
@@ -1141,7 +1154,7 @@ var LazyCallStep = class _LazyCallStep extends BaseLazyStep {
1141
1154
  return { header, status, body };
1142
1155
  }
1143
1156
  }
1144
- static applicationHeaders = /* @__PURE__ */ new Set([
1157
+ static applicationContentTypes = [
1145
1158
  "application/json",
1146
1159
  "application/xml",
1147
1160
  "application/javascript",
@@ -1150,12 +1163,12 @@ var LazyCallStep = class _LazyCallStep extends BaseLazyStep {
1150
1163
  "application/ld+json",
1151
1164
  "application/rss+xml",
1152
1165
  "application/atom+xml"
1153
- ]);
1166
+ ];
1154
1167
  static isText = (contentTypeHeader) => {
1155
1168
  if (!contentTypeHeader) {
1156
1169
  return false;
1157
1170
  }
1158
- if (_LazyCallStep.applicationHeaders.has(contentTypeHeader)) {
1171
+ if (_LazyCallStep.applicationContentTypes.some((type) => contentTypeHeader.includes(type))) {
1159
1172
  return true;
1160
1173
  }
1161
1174
  if (contentTypeHeader.startsWith("text/")) {
package/svelte.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-XVNSBBDC.mjs";
5
+ } from "./chunk-RMS2NQ3K.mjs";
6
6
 
7
7
  // platforms/svelte.ts
8
8
  var telemetry = {