@upstash/workflow 0.1.2-canary-astro → 0.1.2-omit-errors
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 +1 -1
- package/astro.d.ts +1 -1
- package/astro.js +76 -44
- package/astro.mjs +1 -1
- package/{chunk-EKVRVBHL.mjs → chunk-ZPVH5ACW.mjs} +70 -38
- package/cloudflare.d.mts +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +76 -44
- package/cloudflare.mjs +1 -1
- package/h3.d.mts +1 -1
- package/h3.d.ts +1 -1
- package/h3.js +76 -44
- package/h3.mjs +1 -1
- package/hono.d.mts +1 -1
- package/hono.d.ts +1 -1
- package/hono.js +76 -44
- package/hono.mjs +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +77 -45
- package/index.mjs +1 -1
- package/nextjs.d.mts +1 -1
- package/nextjs.d.ts +1 -1
- package/nextjs.js +76 -44
- package/nextjs.mjs +1 -1
- package/package.json +1 -1
- package/solidjs.d.mts +1 -1
- package/solidjs.d.ts +1 -1
- package/solidjs.js +76 -44
- package/solidjs.mjs +1 -1
- package/svelte.d.mts +1 -1
- package/svelte.d.ts +1 -1
- package/svelte.js +76 -44
- package/svelte.mjs +1 -1
- package/{types-p7sxktVE.d.mts → types-CI-2skYU.d.mts} +5 -4
- package/{types-p7sxktVE.d.ts → types-CI-2skYU.d.ts} +5 -4
package/cloudflare.js
CHANGED
|
@@ -493,6 +493,7 @@ var StepTypes = [
|
|
|
493
493
|
];
|
|
494
494
|
|
|
495
495
|
// src/workflow-requests.ts
|
|
496
|
+
var import_qstash2 = require("@upstash/qstash");
|
|
496
497
|
var triggerFirstInvocation = async (workflowContext, retries, debug) => {
|
|
497
498
|
const { headers } = getHeaders(
|
|
498
499
|
"true",
|
|
@@ -503,27 +504,37 @@ var triggerFirstInvocation = async (workflowContext, retries, debug) => {
|
|
|
503
504
|
workflowContext.failureUrl,
|
|
504
505
|
retries
|
|
505
506
|
);
|
|
506
|
-
await debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
|
|
507
|
-
headers,
|
|
508
|
-
requestPayload: workflowContext.requestPayload,
|
|
509
|
-
url: workflowContext.url
|
|
510
|
-
});
|
|
511
507
|
try {
|
|
512
|
-
await workflowContext.qstashClient.publishJSON({
|
|
508
|
+
const result = await workflowContext.qstashClient.publishJSON({
|
|
513
509
|
headers,
|
|
514
510
|
method: "POST",
|
|
515
511
|
body: workflowContext.requestPayload,
|
|
516
512
|
url: workflowContext.url
|
|
517
513
|
});
|
|
514
|
+
await debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
|
|
515
|
+
headers,
|
|
516
|
+
requestPayload: workflowContext.requestPayload,
|
|
517
|
+
url: workflowContext.url,
|
|
518
|
+
messageId: result.messageId
|
|
519
|
+
});
|
|
518
520
|
return ok("success");
|
|
519
521
|
} catch (error) {
|
|
520
522
|
const error_ = error;
|
|
523
|
+
if (error instanceof import_qstash2.QstashError && error.message.includes("a workflow already exists, can not initialize a new one with same id")) {
|
|
524
|
+
await debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
|
|
525
|
+
message: `Workflow run ${workflowContext.workflowRunId} already exists.`,
|
|
526
|
+
name: error.name,
|
|
527
|
+
originalMessage: error.message
|
|
528
|
+
});
|
|
529
|
+
return ok("workflow-run-already-exists");
|
|
530
|
+
}
|
|
521
531
|
return err(error_);
|
|
522
532
|
}
|
|
523
533
|
};
|
|
524
534
|
var triggerRouteFunction = async ({
|
|
525
535
|
onCleanup,
|
|
526
|
-
onStep
|
|
536
|
+
onStep,
|
|
537
|
+
debug
|
|
527
538
|
}) => {
|
|
528
539
|
try {
|
|
529
540
|
await onStep();
|
|
@@ -531,6 +542,14 @@ var triggerRouteFunction = async ({
|
|
|
531
542
|
return ok("workflow-finished");
|
|
532
543
|
} catch (error) {
|
|
533
544
|
const error_ = error;
|
|
545
|
+
if (error instanceof import_qstash2.QstashError && error.message.includes("can not append to a a cancelled workflow")) {
|
|
546
|
+
await debug?.log("WARN", "RESPONSE_WORKFLOW", {
|
|
547
|
+
message: `tried to append to a cancelled workflow. exiting without publishing.`,
|
|
548
|
+
name: error.name,
|
|
549
|
+
originalMessage: error.message
|
|
550
|
+
});
|
|
551
|
+
return ok("workflow-was-finished");
|
|
552
|
+
}
|
|
534
553
|
return error_ instanceof QStashWorkflowAbort ? ok("step-finished") : err(error_);
|
|
535
554
|
}
|
|
536
555
|
};
|
|
@@ -538,12 +557,29 @@ var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
|
|
|
538
557
|
await debug?.log("SUBMIT", "SUBMIT_CLEANUP", {
|
|
539
558
|
deletedWorkflowRunId: workflowContext.workflowRunId
|
|
540
559
|
});
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
560
|
+
try {
|
|
561
|
+
await workflowContext.qstashClient.http.request({
|
|
562
|
+
path: ["v2", "workflows", "runs", `${workflowContext.workflowRunId}?cancel=${cancel}`],
|
|
563
|
+
method: "DELETE",
|
|
564
|
+
parseResponseAsJson: false
|
|
565
|
+
});
|
|
566
|
+
await debug?.log(
|
|
567
|
+
"SUBMIT",
|
|
568
|
+
"SUBMIT_CLEANUP",
|
|
569
|
+
`workflow run ${workflowContext.workflowRunId} deleted.`
|
|
570
|
+
);
|
|
571
|
+
return { deleted: true };
|
|
572
|
+
} catch (error) {
|
|
573
|
+
if (error instanceof import_qstash2.QstashError && error.message.includes(`workflowRun ${workflowContext.workflowRunId} not found`)) {
|
|
574
|
+
await debug?.log("WARN", "SUBMIT_CLEANUP", {
|
|
575
|
+
message: `Failed to remove workflow run ${workflowContext.workflowRunId} as it doesn't exist.`,
|
|
576
|
+
name: error.name,
|
|
577
|
+
originalMessage: error.message
|
|
578
|
+
});
|
|
579
|
+
return { deleted: false };
|
|
580
|
+
}
|
|
581
|
+
throw error;
|
|
582
|
+
}
|
|
547
583
|
};
|
|
548
584
|
var recreateUserHeaders = (headers) => {
|
|
549
585
|
const filteredHeaders = new Headers();
|
|
@@ -1681,7 +1717,8 @@ var WorkflowLogger = class _WorkflowLogger {
|
|
|
1681
1717
|
}
|
|
1682
1718
|
writeToConsole(logEntry) {
|
|
1683
1719
|
const JSON_SPACING = 2;
|
|
1684
|
-
console.
|
|
1720
|
+
const logMethod = logEntry.logLevel === "ERROR" ? console.error : logEntry.logLevel === "WARN" ? console.warn : console.log;
|
|
1721
|
+
logMethod(JSON.stringify(logEntry, void 0, JSON_SPACING));
|
|
1685
1722
|
}
|
|
1686
1723
|
shouldLog(level) {
|
|
1687
1724
|
return LOG_LEVELS.indexOf(level) >= LOG_LEVELS.indexOf(this.options.logLevel);
|
|
@@ -1725,7 +1762,7 @@ var getPayload = async (request) => {
|
|
|
1725
1762
|
return;
|
|
1726
1763
|
}
|
|
1727
1764
|
};
|
|
1728
|
-
var parsePayload =
|
|
1765
|
+
var parsePayload = (rawPayload) => {
|
|
1729
1766
|
const [encodedInitialPayload, ...encodedSteps] = JSON.parse(rawPayload);
|
|
1730
1767
|
const rawInitialPayload = decodeBase64(encodedInitialPayload.body);
|
|
1731
1768
|
const initialStep = {
|
|
@@ -1736,27 +1773,21 @@ var parsePayload = async (rawPayload, debug) => {
|
|
|
1736
1773
|
concurrent: NO_CONCURRENCY
|
|
1737
1774
|
};
|
|
1738
1775
|
const stepsToDecode = encodedSteps.filter((step) => step.callType === "step");
|
|
1739
|
-
const otherSteps =
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
};
|
|
1755
|
-
step.out = newOut;
|
|
1756
|
-
}
|
|
1757
|
-
return step;
|
|
1758
|
-
})
|
|
1759
|
-
);
|
|
1776
|
+
const otherSteps = stepsToDecode.map((rawStep) => {
|
|
1777
|
+
const step = JSON.parse(decodeBase64(rawStep.body));
|
|
1778
|
+
try {
|
|
1779
|
+
step.out = JSON.parse(step.out);
|
|
1780
|
+
} catch {
|
|
1781
|
+
}
|
|
1782
|
+
if (step.waitEventId) {
|
|
1783
|
+
const newOut = {
|
|
1784
|
+
eventData: step.out ? decodeBase64(step.out) : void 0,
|
|
1785
|
+
timeout: step.waitTimeout ?? false
|
|
1786
|
+
};
|
|
1787
|
+
step.out = newOut;
|
|
1788
|
+
}
|
|
1789
|
+
return step;
|
|
1790
|
+
});
|
|
1760
1791
|
const steps = [initialStep, ...otherSteps];
|
|
1761
1792
|
return {
|
|
1762
1793
|
rawInitialPayload,
|
|
@@ -1828,7 +1859,7 @@ var parseRequest = async (requestPayload, isFirstInvocation, debug) => {
|
|
|
1828
1859
|
if (!requestPayload) {
|
|
1829
1860
|
throw new QStashWorkflowError("Only first call can have an empty body");
|
|
1830
1861
|
}
|
|
1831
|
-
const { rawInitialPayload, steps } =
|
|
1862
|
+
const { rawInitialPayload, steps } = parsePayload(requestPayload);
|
|
1832
1863
|
const isLastDuplicate = await checkIfLastOneIsDuplicate(steps, debug);
|
|
1833
1864
|
const deduplicatedSteps = deduplicateSteps(steps);
|
|
1834
1865
|
return {
|
|
@@ -1880,7 +1911,7 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
|
|
|
1880
1911
|
};
|
|
1881
1912
|
|
|
1882
1913
|
// src/serve/authorization.ts
|
|
1883
|
-
var
|
|
1914
|
+
var import_qstash3 = require("@upstash/qstash");
|
|
1884
1915
|
var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
|
|
1885
1916
|
static disabledMessage = "disabled-qstash-worklfow-run";
|
|
1886
1917
|
/**
|
|
@@ -1905,7 +1936,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
|
|
|
1905
1936
|
*/
|
|
1906
1937
|
static async tryAuthentication(routeFunction, context) {
|
|
1907
1938
|
const disabledContext = new _DisabledWorkflowContext({
|
|
1908
|
-
qstashClient: new
|
|
1939
|
+
qstashClient: new import_qstash3.Client({
|
|
1909
1940
|
baseUrl: "disabled-client",
|
|
1910
1941
|
token: "disabled-client"
|
|
1911
1942
|
}),
|
|
@@ -1932,15 +1963,15 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
|
|
|
1932
1963
|
};
|
|
1933
1964
|
|
|
1934
1965
|
// src/serve/options.ts
|
|
1935
|
-
var import_qstash3 = require("@upstash/qstash");
|
|
1936
1966
|
var import_qstash4 = require("@upstash/qstash");
|
|
1967
|
+
var import_qstash5 = require("@upstash/qstash");
|
|
1937
1968
|
var processOptions = (options) => {
|
|
1938
1969
|
const environment = options?.env ?? (typeof process === "undefined" ? {} : process.env);
|
|
1939
1970
|
const receiverEnvironmentVariablesSet = Boolean(
|
|
1940
1971
|
environment.QSTASH_CURRENT_SIGNING_KEY && environment.QSTASH_NEXT_SIGNING_KEY
|
|
1941
1972
|
);
|
|
1942
1973
|
return {
|
|
1943
|
-
qstashClient: new
|
|
1974
|
+
qstashClient: new import_qstash5.Client({
|
|
1944
1975
|
baseUrl: environment.QSTASH_URL,
|
|
1945
1976
|
token: environment.QSTASH_TOKEN
|
|
1946
1977
|
}),
|
|
@@ -1961,7 +1992,7 @@ var processOptions = (options) => {
|
|
|
1961
1992
|
throw error;
|
|
1962
1993
|
}
|
|
1963
1994
|
},
|
|
1964
|
-
receiver: receiverEnvironmentVariablesSet ? new
|
|
1995
|
+
receiver: receiverEnvironmentVariablesSet ? new import_qstash4.Receiver({
|
|
1965
1996
|
currentSigningKey: environment.QSTASH_CURRENT_SIGNING_KEY,
|
|
1966
1997
|
nextSigningKey: environment.QSTASH_NEXT_SIGNING_KEY
|
|
1967
1998
|
}) : void 0,
|
|
@@ -2083,7 +2114,8 @@ var serve = (routeFunction, options) => {
|
|
|
2083
2114
|
onStep: async () => routeFunction(workflowContext),
|
|
2084
2115
|
onCleanup: async () => {
|
|
2085
2116
|
await triggerWorkflowDelete(workflowContext, debug);
|
|
2086
|
-
}
|
|
2117
|
+
},
|
|
2118
|
+
debug
|
|
2087
2119
|
});
|
|
2088
2120
|
if (result.isErr()) {
|
|
2089
2121
|
await debug?.log("ERROR", "ERROR", { error: result.error.message });
|
|
@@ -2109,7 +2141,7 @@ var serve = (routeFunction, options) => {
|
|
|
2109
2141
|
};
|
|
2110
2142
|
|
|
2111
2143
|
// src/client/index.ts
|
|
2112
|
-
var
|
|
2144
|
+
var import_qstash6 = require("@upstash/qstash");
|
|
2113
2145
|
|
|
2114
2146
|
// platforms/cloudflare.ts
|
|
2115
2147
|
var getArgs = (args) => {
|
package/cloudflare.mjs
CHANGED
package/h3.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
|
-
import { R as RouteFunction, W as WorkflowServeOptions } from './types-
|
|
2
|
+
import { R as RouteFunction, W as WorkflowServeOptions } from './types-CI-2skYU.mjs';
|
|
3
3
|
import '@upstash/qstash';
|
|
4
4
|
|
|
5
5
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => {
|
package/h3.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
|
-
import { R as RouteFunction, W as WorkflowServeOptions } from './types-
|
|
2
|
+
import { R as RouteFunction, W as WorkflowServeOptions } from './types-CI-2skYU.js';
|
|
3
3
|
import '@upstash/qstash';
|
|
4
4
|
|
|
5
5
|
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => {
|
package/h3.js
CHANGED
|
@@ -805,6 +805,7 @@ var StepTypes = [
|
|
|
805
805
|
];
|
|
806
806
|
|
|
807
807
|
// src/workflow-requests.ts
|
|
808
|
+
var import_qstash2 = require("@upstash/qstash");
|
|
808
809
|
var triggerFirstInvocation = async (workflowContext, retries, debug) => {
|
|
809
810
|
const { headers } = getHeaders(
|
|
810
811
|
"true",
|
|
@@ -815,27 +816,37 @@ var triggerFirstInvocation = async (workflowContext, retries, debug) => {
|
|
|
815
816
|
workflowContext.failureUrl,
|
|
816
817
|
retries
|
|
817
818
|
);
|
|
818
|
-
await debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
|
|
819
|
-
headers,
|
|
820
|
-
requestPayload: workflowContext.requestPayload,
|
|
821
|
-
url: workflowContext.url
|
|
822
|
-
});
|
|
823
819
|
try {
|
|
824
|
-
await workflowContext.qstashClient.publishJSON({
|
|
820
|
+
const result = await workflowContext.qstashClient.publishJSON({
|
|
825
821
|
headers,
|
|
826
822
|
method: "POST",
|
|
827
823
|
body: workflowContext.requestPayload,
|
|
828
824
|
url: workflowContext.url
|
|
829
825
|
});
|
|
826
|
+
await debug?.log("SUBMIT", "SUBMIT_FIRST_INVOCATION", {
|
|
827
|
+
headers,
|
|
828
|
+
requestPayload: workflowContext.requestPayload,
|
|
829
|
+
url: workflowContext.url,
|
|
830
|
+
messageId: result.messageId
|
|
831
|
+
});
|
|
830
832
|
return ok("success");
|
|
831
833
|
} catch (error) {
|
|
832
834
|
const error_ = error;
|
|
835
|
+
if (error instanceof import_qstash2.QstashError && error.message.includes("a workflow already exists, can not initialize a new one with same id")) {
|
|
836
|
+
await debug?.log("WARN", "SUBMIT_FIRST_INVOCATION", {
|
|
837
|
+
message: `Workflow run ${workflowContext.workflowRunId} already exists.`,
|
|
838
|
+
name: error.name,
|
|
839
|
+
originalMessage: error.message
|
|
840
|
+
});
|
|
841
|
+
return ok("workflow-run-already-exists");
|
|
842
|
+
}
|
|
833
843
|
return err(error_);
|
|
834
844
|
}
|
|
835
845
|
};
|
|
836
846
|
var triggerRouteFunction = async ({
|
|
837
847
|
onCleanup,
|
|
838
|
-
onStep
|
|
848
|
+
onStep,
|
|
849
|
+
debug
|
|
839
850
|
}) => {
|
|
840
851
|
try {
|
|
841
852
|
await onStep();
|
|
@@ -843,6 +854,14 @@ var triggerRouteFunction = async ({
|
|
|
843
854
|
return ok("workflow-finished");
|
|
844
855
|
} catch (error) {
|
|
845
856
|
const error_ = error;
|
|
857
|
+
if (error instanceof import_qstash2.QstashError && error.message.includes("can not append to a a cancelled workflow")) {
|
|
858
|
+
await debug?.log("WARN", "RESPONSE_WORKFLOW", {
|
|
859
|
+
message: `tried to append to a cancelled workflow. exiting without publishing.`,
|
|
860
|
+
name: error.name,
|
|
861
|
+
originalMessage: error.message
|
|
862
|
+
});
|
|
863
|
+
return ok("workflow-was-finished");
|
|
864
|
+
}
|
|
846
865
|
return error_ instanceof QStashWorkflowAbort ? ok("step-finished") : err(error_);
|
|
847
866
|
}
|
|
848
867
|
};
|
|
@@ -850,12 +869,29 @@ var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
|
|
|
850
869
|
await debug?.log("SUBMIT", "SUBMIT_CLEANUP", {
|
|
851
870
|
deletedWorkflowRunId: workflowContext.workflowRunId
|
|
852
871
|
});
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
872
|
+
try {
|
|
873
|
+
await workflowContext.qstashClient.http.request({
|
|
874
|
+
path: ["v2", "workflows", "runs", `${workflowContext.workflowRunId}?cancel=${cancel}`],
|
|
875
|
+
method: "DELETE",
|
|
876
|
+
parseResponseAsJson: false
|
|
877
|
+
});
|
|
878
|
+
await debug?.log(
|
|
879
|
+
"SUBMIT",
|
|
880
|
+
"SUBMIT_CLEANUP",
|
|
881
|
+
`workflow run ${workflowContext.workflowRunId} deleted.`
|
|
882
|
+
);
|
|
883
|
+
return { deleted: true };
|
|
884
|
+
} catch (error) {
|
|
885
|
+
if (error instanceof import_qstash2.QstashError && error.message.includes(`workflowRun ${workflowContext.workflowRunId} not found`)) {
|
|
886
|
+
await debug?.log("WARN", "SUBMIT_CLEANUP", {
|
|
887
|
+
message: `Failed to remove workflow run ${workflowContext.workflowRunId} as it doesn't exist.`,
|
|
888
|
+
name: error.name,
|
|
889
|
+
originalMessage: error.message
|
|
890
|
+
});
|
|
891
|
+
return { deleted: false };
|
|
892
|
+
}
|
|
893
|
+
throw error;
|
|
894
|
+
}
|
|
859
895
|
};
|
|
860
896
|
var recreateUserHeaders = (headers) => {
|
|
861
897
|
const filteredHeaders = new Headers();
|
|
@@ -1993,7 +2029,8 @@ var WorkflowLogger = class _WorkflowLogger {
|
|
|
1993
2029
|
}
|
|
1994
2030
|
writeToConsole(logEntry) {
|
|
1995
2031
|
const JSON_SPACING = 2;
|
|
1996
|
-
console.
|
|
2032
|
+
const logMethod = logEntry.logLevel === "ERROR" ? console.error : logEntry.logLevel === "WARN" ? console.warn : console.log;
|
|
2033
|
+
logMethod(JSON.stringify(logEntry, void 0, JSON_SPACING));
|
|
1997
2034
|
}
|
|
1998
2035
|
shouldLog(level) {
|
|
1999
2036
|
return LOG_LEVELS.indexOf(level) >= LOG_LEVELS.indexOf(this.options.logLevel);
|
|
@@ -2037,7 +2074,7 @@ var getPayload = async (request) => {
|
|
|
2037
2074
|
return;
|
|
2038
2075
|
}
|
|
2039
2076
|
};
|
|
2040
|
-
var parsePayload =
|
|
2077
|
+
var parsePayload = (rawPayload) => {
|
|
2041
2078
|
const [encodedInitialPayload, ...encodedSteps] = JSON.parse(rawPayload);
|
|
2042
2079
|
const rawInitialPayload = decodeBase64(encodedInitialPayload.body);
|
|
2043
2080
|
const initialStep = {
|
|
@@ -2048,27 +2085,21 @@ var parsePayload = async (rawPayload, debug) => {
|
|
|
2048
2085
|
concurrent: NO_CONCURRENCY
|
|
2049
2086
|
};
|
|
2050
2087
|
const stepsToDecode = encodedSteps.filter((step) => step.callType === "step");
|
|
2051
|
-
const otherSteps =
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
};
|
|
2067
|
-
step.out = newOut;
|
|
2068
|
-
}
|
|
2069
|
-
return step;
|
|
2070
|
-
})
|
|
2071
|
-
);
|
|
2088
|
+
const otherSteps = stepsToDecode.map((rawStep) => {
|
|
2089
|
+
const step = JSON.parse(decodeBase64(rawStep.body));
|
|
2090
|
+
try {
|
|
2091
|
+
step.out = JSON.parse(step.out);
|
|
2092
|
+
} catch {
|
|
2093
|
+
}
|
|
2094
|
+
if (step.waitEventId) {
|
|
2095
|
+
const newOut = {
|
|
2096
|
+
eventData: step.out ? decodeBase64(step.out) : void 0,
|
|
2097
|
+
timeout: step.waitTimeout ?? false
|
|
2098
|
+
};
|
|
2099
|
+
step.out = newOut;
|
|
2100
|
+
}
|
|
2101
|
+
return step;
|
|
2102
|
+
});
|
|
2072
2103
|
const steps = [initialStep, ...otherSteps];
|
|
2073
2104
|
return {
|
|
2074
2105
|
rawInitialPayload,
|
|
@@ -2140,7 +2171,7 @@ var parseRequest = async (requestPayload, isFirstInvocation, debug) => {
|
|
|
2140
2171
|
if (!requestPayload) {
|
|
2141
2172
|
throw new QStashWorkflowError("Only first call can have an empty body");
|
|
2142
2173
|
}
|
|
2143
|
-
const { rawInitialPayload, steps } =
|
|
2174
|
+
const { rawInitialPayload, steps } = parsePayload(requestPayload);
|
|
2144
2175
|
const isLastDuplicate = await checkIfLastOneIsDuplicate(steps, debug);
|
|
2145
2176
|
const deduplicatedSteps = deduplicateSteps(steps);
|
|
2146
2177
|
return {
|
|
@@ -2192,7 +2223,7 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
|
|
|
2192
2223
|
};
|
|
2193
2224
|
|
|
2194
2225
|
// src/serve/authorization.ts
|
|
2195
|
-
var
|
|
2226
|
+
var import_qstash3 = require("@upstash/qstash");
|
|
2196
2227
|
var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
|
|
2197
2228
|
static disabledMessage = "disabled-qstash-worklfow-run";
|
|
2198
2229
|
/**
|
|
@@ -2217,7 +2248,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
|
|
|
2217
2248
|
*/
|
|
2218
2249
|
static async tryAuthentication(routeFunction, context) {
|
|
2219
2250
|
const disabledContext = new _DisabledWorkflowContext({
|
|
2220
|
-
qstashClient: new
|
|
2251
|
+
qstashClient: new import_qstash3.Client({
|
|
2221
2252
|
baseUrl: "disabled-client",
|
|
2222
2253
|
token: "disabled-client"
|
|
2223
2254
|
}),
|
|
@@ -2244,15 +2275,15 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
|
|
|
2244
2275
|
};
|
|
2245
2276
|
|
|
2246
2277
|
// src/serve/options.ts
|
|
2247
|
-
var import_qstash3 = require("@upstash/qstash");
|
|
2248
2278
|
var import_qstash4 = require("@upstash/qstash");
|
|
2279
|
+
var import_qstash5 = require("@upstash/qstash");
|
|
2249
2280
|
var processOptions = (options) => {
|
|
2250
2281
|
const environment = options?.env ?? (typeof process === "undefined" ? {} : process.env);
|
|
2251
2282
|
const receiverEnvironmentVariablesSet = Boolean(
|
|
2252
2283
|
environment.QSTASH_CURRENT_SIGNING_KEY && environment.QSTASH_NEXT_SIGNING_KEY
|
|
2253
2284
|
);
|
|
2254
2285
|
return {
|
|
2255
|
-
qstashClient: new
|
|
2286
|
+
qstashClient: new import_qstash5.Client({
|
|
2256
2287
|
baseUrl: environment.QSTASH_URL,
|
|
2257
2288
|
token: environment.QSTASH_TOKEN
|
|
2258
2289
|
}),
|
|
@@ -2273,7 +2304,7 @@ var processOptions = (options) => {
|
|
|
2273
2304
|
throw error;
|
|
2274
2305
|
}
|
|
2275
2306
|
},
|
|
2276
|
-
receiver: receiverEnvironmentVariablesSet ? new
|
|
2307
|
+
receiver: receiverEnvironmentVariablesSet ? new import_qstash4.Receiver({
|
|
2277
2308
|
currentSigningKey: environment.QSTASH_CURRENT_SIGNING_KEY,
|
|
2278
2309
|
nextSigningKey: environment.QSTASH_NEXT_SIGNING_KEY
|
|
2279
2310
|
}) : void 0,
|
|
@@ -2395,7 +2426,8 @@ var serve = (routeFunction, options) => {
|
|
|
2395
2426
|
onStep: async () => routeFunction(workflowContext),
|
|
2396
2427
|
onCleanup: async () => {
|
|
2397
2428
|
await triggerWorkflowDelete(workflowContext, debug);
|
|
2398
|
-
}
|
|
2429
|
+
},
|
|
2430
|
+
debug
|
|
2399
2431
|
});
|
|
2400
2432
|
if (result.isErr()) {
|
|
2401
2433
|
await debug?.log("ERROR", "ERROR", { error: result.error.message });
|
|
@@ -2421,7 +2453,7 @@ var serve = (routeFunction, options) => {
|
|
|
2421
2453
|
};
|
|
2422
2454
|
|
|
2423
2455
|
// src/client/index.ts
|
|
2424
|
-
var
|
|
2456
|
+
var import_qstash6 = require("@upstash/qstash");
|
|
2425
2457
|
|
|
2426
2458
|
// platforms/h3.ts
|
|
2427
2459
|
function transformHeaders(headers) {
|
package/h3.mjs
CHANGED
package/hono.d.mts
CHANGED
package/hono.d.ts
CHANGED