@upstash/workflow 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro.d.mts +2 -2
- package/astro.d.ts +2 -2
- package/astro.js +121 -75
- package/astro.mjs +5 -5
- package/{chunk-ADOBNR4O.mjs → chunk-Z7WS5XIR.mjs} +96 -221
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +121 -75
- package/cloudflare.mjs +5 -5
- package/express.d.mts +1 -1
- package/express.d.ts +1 -1
- package/express.js +133 -80
- package/express.mjs +17 -10
- package/h3.d.mts +2 -2
- package/h3.d.ts +2 -2
- package/h3.js +121 -75
- package/h3.mjs +5 -5
- package/hono.d.mts +4 -2
- package/hono.d.ts +4 -2
- package/hono.js +121 -75
- package/hono.mjs +5 -5
- package/index.d.mts +3 -3
- package/index.d.ts +3 -3
- package/index.js +125 -73
- package/index.mjs +189 -3
- package/nextjs.d.mts +3 -3
- package/nextjs.d.ts +3 -3
- package/nextjs.js +122 -76
- package/nextjs.mjs +6 -6
- package/package.json +1 -1
- package/solidjs.d.mts +2 -2
- package/solidjs.d.ts +2 -2
- package/solidjs.js +121 -75
- package/solidjs.mjs +5 -5
- package/svelte.d.mts +3 -3
- package/svelte.d.ts +3 -3
- package/svelte.js +124 -75
- package/svelte.mjs +8 -5
- package/{types-Be4hC1mu.d.mts → types-APRap-aV.d.mts} +10 -2
- package/{types-Be4hC1mu.d.ts → types-APRap-aV.d.ts} +10 -2
package/cloudflare.js
CHANGED
|
@@ -20,52 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// platforms/cloudflare.ts
|
|
21
21
|
var cloudflare_exports = {};
|
|
22
22
|
__export(cloudflare_exports, {
|
|
23
|
-
serve: () =>
|
|
23
|
+
serve: () => serve
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(cloudflare_exports);
|
|
26
26
|
|
|
27
|
-
// src/error.ts
|
|
28
|
-
var import_qstash = require("@upstash/qstash");
|
|
29
|
-
var WorkflowError = class extends import_qstash.QstashError {
|
|
30
|
-
constructor(message) {
|
|
31
|
-
super(message);
|
|
32
|
-
this.name = "WorkflowError";
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var WorkflowAbort = class extends Error {
|
|
36
|
-
stepInfo;
|
|
37
|
-
stepName;
|
|
38
|
-
/**
|
|
39
|
-
* whether workflow is to be canceled on abort
|
|
40
|
-
*/
|
|
41
|
-
cancelWorkflow;
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param stepName name of the aborting step
|
|
45
|
-
* @param stepInfo step information
|
|
46
|
-
* @param cancelWorkflow
|
|
47
|
-
*/
|
|
48
|
-
constructor(stepName, stepInfo, cancelWorkflow = false) {
|
|
49
|
-
super(
|
|
50
|
-
`This is an Upstash Workflow error thrown after a step executes. It is expected to be raised. Make sure that you await for each step. Also, if you are using try/catch blocks, you should not wrap context.run/sleep/sleepUntil/call methods with try/catch. Aborting workflow after executing step '${stepName}'.`
|
|
51
|
-
);
|
|
52
|
-
this.name = "WorkflowAbort";
|
|
53
|
-
this.stepName = stepName;
|
|
54
|
-
this.stepInfo = stepInfo;
|
|
55
|
-
this.cancelWorkflow = cancelWorkflow;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var formatWorkflowError = (error) => {
|
|
59
|
-
return error instanceof Error ? {
|
|
60
|
-
error: error.name,
|
|
61
|
-
message: error.message
|
|
62
|
-
} : {
|
|
63
|
-
error: "Error",
|
|
64
|
-
message: "An error occured while executing workflow."
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
|
|
68
27
|
// src/client/utils.ts
|
|
28
|
+
var import_qstash = require("@upstash/qstash");
|
|
69
29
|
var makeNotifyRequest = async (requester, eventId, eventData) => {
|
|
70
30
|
const result = await requester.request({
|
|
71
31
|
path: ["v2", "notify", eventId],
|
|
@@ -92,26 +52,71 @@ var getSteps = async (requester, workflowRunId, messageId, debug) => {
|
|
|
92
52
|
await debug?.log("INFO", "ENDPOINT_START", {
|
|
93
53
|
message: `Pulled ${steps.length} steps from QStashand returned them without filtering with messageId.`
|
|
94
54
|
});
|
|
95
|
-
return steps;
|
|
55
|
+
return { steps, workflowRunEnded: false };
|
|
96
56
|
} else {
|
|
97
57
|
const index = steps.findIndex((item) => item.messageId === messageId);
|
|
98
58
|
if (index === -1) {
|
|
99
|
-
return [];
|
|
59
|
+
return { steps: [], workflowRunEnded: false };
|
|
100
60
|
}
|
|
101
61
|
const filteredSteps = steps.slice(0, index + 1);
|
|
102
62
|
await debug?.log("INFO", "ENDPOINT_START", {
|
|
103
63
|
message: `Pulled ${steps.length} steps from QStash and filtered them to ${filteredSteps.length} using messageId.`
|
|
104
64
|
});
|
|
105
|
-
return filteredSteps;
|
|
65
|
+
return { steps: filteredSteps, workflowRunEnded: false };
|
|
106
66
|
}
|
|
107
67
|
} catch (error) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
68
|
+
if (error instanceof import_qstash.QstashError && error.status === 404) {
|
|
69
|
+
await debug?.log("WARN", "ENDPOINT_START", {
|
|
70
|
+
message: "Couldn't fetch workflow run steps. This can happen if the workflow run succesfully ends before some callback is executed.",
|
|
71
|
+
error
|
|
72
|
+
});
|
|
73
|
+
return { steps: void 0, workflowRunEnded: true };
|
|
74
|
+
} else {
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/error.ts
|
|
81
|
+
var import_qstash2 = require("@upstash/qstash");
|
|
82
|
+
var WorkflowError = class extends import_qstash2.QstashError {
|
|
83
|
+
constructor(message) {
|
|
84
|
+
super(message);
|
|
85
|
+
this.name = "WorkflowError";
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var WorkflowAbort = class extends Error {
|
|
89
|
+
stepInfo;
|
|
90
|
+
stepName;
|
|
91
|
+
/**
|
|
92
|
+
* whether workflow is to be canceled on abort
|
|
93
|
+
*/
|
|
94
|
+
cancelWorkflow;
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @param stepName name of the aborting step
|
|
98
|
+
* @param stepInfo step information
|
|
99
|
+
* @param cancelWorkflow
|
|
100
|
+
*/
|
|
101
|
+
constructor(stepName, stepInfo, cancelWorkflow = false) {
|
|
102
|
+
super(
|
|
103
|
+
`This is an Upstash Workflow error thrown after a step executes. It is expected to be raised. Make sure that you await for each step. Also, if you are using try/catch blocks, you should not wrap context.run/sleep/sleepUntil/call methods with try/catch. Aborting workflow after executing step '${stepName}'.`
|
|
104
|
+
);
|
|
105
|
+
this.name = "WorkflowAbort";
|
|
106
|
+
this.stepName = stepName;
|
|
107
|
+
this.stepInfo = stepInfo;
|
|
108
|
+
this.cancelWorkflow = cancelWorkflow;
|
|
113
109
|
}
|
|
114
110
|
};
|
|
111
|
+
var formatWorkflowError = (error) => {
|
|
112
|
+
return error instanceof Error ? {
|
|
113
|
+
error: error.name,
|
|
114
|
+
message: error.message
|
|
115
|
+
} : {
|
|
116
|
+
error: "Error",
|
|
117
|
+
message: "An error occured while executing workflow."
|
|
118
|
+
};
|
|
119
|
+
};
|
|
115
120
|
|
|
116
121
|
// src/context/steps.ts
|
|
117
122
|
var BaseLazyStep = class {
|
|
@@ -733,8 +738,8 @@ var StepTypes = [
|
|
|
733
738
|
];
|
|
734
739
|
|
|
735
740
|
// src/workflow-requests.ts
|
|
736
|
-
var
|
|
737
|
-
var triggerFirstInvocation = async (workflowContext, retries, debug) => {
|
|
741
|
+
var import_qstash3 = require("@upstash/qstash");
|
|
742
|
+
var triggerFirstInvocation = async (workflowContext, retries, useJSONContent, debug) => {
|
|
738
743
|
const { headers } = getHeaders(
|
|
739
744
|
"true",
|
|
740
745
|
workflowContext.workflowRunId,
|
|
@@ -744,6 +749,9 @@ var triggerFirstInvocation = async (workflowContext, retries, debug) => {
|
|
|
744
749
|
workflowContext.failureUrl,
|
|
745
750
|
retries
|
|
746
751
|
);
|
|
752
|
+
if (useJSONContent) {
|
|
753
|
+
headers["content-type"] = "application/json";
|
|
754
|
+
}
|
|
747
755
|
try {
|
|
748
756
|
const body = typeof workflowContext.requestPayload === "string" ? workflowContext.requestPayload : JSON.stringify(workflowContext.requestPayload);
|
|
749
757
|
const result = await workflowContext.qstashClient.publish({
|
|
@@ -787,7 +795,7 @@ var triggerRouteFunction = async ({
|
|
|
787
795
|
return ok("workflow-finished");
|
|
788
796
|
} catch (error) {
|
|
789
797
|
const error_ = error;
|
|
790
|
-
if (error instanceof
|
|
798
|
+
if (error instanceof import_qstash3.QstashError && error.status === 400) {
|
|
791
799
|
await debug?.log("WARN", "RESPONSE_WORKFLOW", {
|
|
792
800
|
message: `tried to append to a cancelled workflow. exiting without publishing.`,
|
|
793
801
|
name: error.name,
|
|
@@ -821,7 +829,7 @@ var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
|
|
|
821
829
|
);
|
|
822
830
|
return { deleted: true };
|
|
823
831
|
} catch (error) {
|
|
824
|
-
if (error instanceof
|
|
832
|
+
if (error instanceof import_qstash3.QstashError && error.status === 404) {
|
|
825
833
|
await debug?.log("WARN", "SUBMIT_CLEANUP", {
|
|
826
834
|
message: `Failed to remove workflow run ${workflowContext.workflowRunId} as it doesn't exist.`,
|
|
827
835
|
name: error.name,
|
|
@@ -858,11 +866,19 @@ var handleThirdPartyCallResult = async (request, requestPayload, client, workflo
|
|
|
858
866
|
if (!workflowRunId2)
|
|
859
867
|
throw new WorkflowError("workflow run id missing in context.call lazy fetch.");
|
|
860
868
|
if (!messageId) throw new WorkflowError("message id missing in context.call lazy fetch.");
|
|
861
|
-
const steps = await getSteps(
|
|
869
|
+
const { steps, workflowRunEnded } = await getSteps(
|
|
870
|
+
client.http,
|
|
871
|
+
workflowRunId2,
|
|
872
|
+
messageId,
|
|
873
|
+
debug
|
|
874
|
+
);
|
|
875
|
+
if (workflowRunEnded) {
|
|
876
|
+
return ok("workflow-ended");
|
|
877
|
+
}
|
|
862
878
|
const failingStep = steps.find((step) => step.messageId === messageId);
|
|
863
879
|
if (!failingStep)
|
|
864
880
|
throw new WorkflowError(
|
|
865
|
-
"Failed to submit the context.call." + (steps.length === 0 ? "No steps found." : `No step was found with matching messageId ${messageId} out of ${steps.length} steps.`)
|
|
881
|
+
"Failed to submit the context.call. " + (steps.length === 0 ? "No steps found." : `No step was found with matching messageId ${messageId} out of ${steps.length} steps.`)
|
|
866
882
|
);
|
|
867
883
|
callbackPayload = atob(failingStep.body);
|
|
868
884
|
}
|
|
@@ -1901,7 +1917,7 @@ function decodeBase64(base64) {
|
|
|
1901
1917
|
}
|
|
1902
1918
|
|
|
1903
1919
|
// src/serve/authorization.ts
|
|
1904
|
-
var
|
|
1920
|
+
var import_qstash4 = require("@upstash/qstash");
|
|
1905
1921
|
var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
|
|
1906
1922
|
static disabledMessage = "disabled-qstash-worklfow-run";
|
|
1907
1923
|
/**
|
|
@@ -1932,7 +1948,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
|
|
|
1932
1948
|
*/
|
|
1933
1949
|
static async tryAuthentication(routeFunction, context) {
|
|
1934
1950
|
const disabledContext = new _DisabledWorkflowContext({
|
|
1935
|
-
qstashClient: new
|
|
1951
|
+
qstashClient: new import_qstash4.Client({
|
|
1936
1952
|
baseUrl: "disabled-client",
|
|
1937
1953
|
token: "disabled-client"
|
|
1938
1954
|
}),
|
|
@@ -2056,7 +2072,8 @@ var parseRequest = async (requestPayload, isFirstInvocation, workflowRunId, requ
|
|
|
2056
2072
|
return {
|
|
2057
2073
|
rawInitialPayload: requestPayload ?? "",
|
|
2058
2074
|
steps: [],
|
|
2059
|
-
isLastDuplicate: false
|
|
2075
|
+
isLastDuplicate: false,
|
|
2076
|
+
workflowRunEnded: false
|
|
2060
2077
|
};
|
|
2061
2078
|
} else {
|
|
2062
2079
|
let rawSteps;
|
|
@@ -2066,7 +2083,21 @@ var parseRequest = async (requestPayload, isFirstInvocation, workflowRunId, requ
|
|
|
2066
2083
|
"ENDPOINT_START",
|
|
2067
2084
|
"request payload is empty, steps will be fetched from QStash."
|
|
2068
2085
|
);
|
|
2069
|
-
|
|
2086
|
+
const { steps: fetchedSteps, workflowRunEnded } = await getSteps(
|
|
2087
|
+
requester,
|
|
2088
|
+
workflowRunId,
|
|
2089
|
+
messageId,
|
|
2090
|
+
debug
|
|
2091
|
+
);
|
|
2092
|
+
if (workflowRunEnded) {
|
|
2093
|
+
return {
|
|
2094
|
+
rawInitialPayload: void 0,
|
|
2095
|
+
steps: void 0,
|
|
2096
|
+
isLastDuplicate: void 0,
|
|
2097
|
+
workflowRunEnded: true
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
rawSteps = fetchedSteps;
|
|
2070
2101
|
} else {
|
|
2071
2102
|
rawSteps = JSON.parse(requestPayload);
|
|
2072
2103
|
}
|
|
@@ -2076,7 +2107,8 @@ var parseRequest = async (requestPayload, isFirstInvocation, workflowRunId, requ
|
|
|
2076
2107
|
return {
|
|
2077
2108
|
rawInitialPayload,
|
|
2078
2109
|
steps: deduplicatedSteps,
|
|
2079
|
-
isLastDuplicate
|
|
2110
|
+
isLastDuplicate,
|
|
2111
|
+
workflowRunEnded: false
|
|
2080
2112
|
};
|
|
2081
2113
|
}
|
|
2082
2114
|
};
|
|
@@ -2130,15 +2162,15 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
|
|
|
2130
2162
|
};
|
|
2131
2163
|
|
|
2132
2164
|
// src/serve/options.ts
|
|
2133
|
-
var import_qstash4 = require("@upstash/qstash");
|
|
2134
2165
|
var import_qstash5 = require("@upstash/qstash");
|
|
2166
|
+
var import_qstash6 = require("@upstash/qstash");
|
|
2135
2167
|
var processOptions = (options) => {
|
|
2136
2168
|
const environment = options?.env ?? (typeof process === "undefined" ? {} : process.env);
|
|
2137
2169
|
const receiverEnvironmentVariablesSet = Boolean(
|
|
2138
2170
|
environment.QSTASH_CURRENT_SIGNING_KEY && environment.QSTASH_NEXT_SIGNING_KEY
|
|
2139
2171
|
);
|
|
2140
2172
|
return {
|
|
2141
|
-
qstashClient: new
|
|
2173
|
+
qstashClient: new import_qstash6.Client({
|
|
2142
2174
|
baseUrl: environment.QSTASH_URL,
|
|
2143
2175
|
token: environment.QSTASH_TOKEN
|
|
2144
2176
|
}),
|
|
@@ -2172,13 +2204,14 @@ var processOptions = (options) => {
|
|
|
2172
2204
|
throw error;
|
|
2173
2205
|
}
|
|
2174
2206
|
},
|
|
2175
|
-
receiver: receiverEnvironmentVariablesSet ? new
|
|
2207
|
+
receiver: receiverEnvironmentVariablesSet ? new import_qstash5.Receiver({
|
|
2176
2208
|
currentSigningKey: environment.QSTASH_CURRENT_SIGNING_KEY,
|
|
2177
2209
|
nextSigningKey: environment.QSTASH_NEXT_SIGNING_KEY
|
|
2178
2210
|
}) : void 0,
|
|
2179
2211
|
baseUrl: environment.UPSTASH_WORKFLOW_URL,
|
|
2180
2212
|
env: environment,
|
|
2181
2213
|
retries: DEFAULT_RETRIES,
|
|
2214
|
+
useJSONContent: false,
|
|
2182
2215
|
...options
|
|
2183
2216
|
};
|
|
2184
2217
|
};
|
|
@@ -2195,6 +2228,16 @@ var determineUrls = async (request, url, baseUrl, failureFunction, failureUrl, d
|
|
|
2195
2228
|
});
|
|
2196
2229
|
}
|
|
2197
2230
|
const workflowFailureUrl = failureFunction ? workflowUrl : failureUrl;
|
|
2231
|
+
if (workflowUrl.includes("localhost")) {
|
|
2232
|
+
await debug?.log("WARN", "ENDPOINT_START", {
|
|
2233
|
+
message: `Workflow URL contains localhost. This can happen in local development, but shouldn't happen in production unless you have a route which contains localhost. Received: ${workflowUrl}`
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
if (!(workflowUrl.startsWith("http://") || workflowUrl.startsWith("https://"))) {
|
|
2237
|
+
throw new WorkflowError(
|
|
2238
|
+
`Workflow URL should start with 'http://' or 'https://'. Recevied is '${workflowUrl}'`
|
|
2239
|
+
);
|
|
2240
|
+
}
|
|
2198
2241
|
return {
|
|
2199
2242
|
workflowUrl,
|
|
2200
2243
|
workflowFailureUrl
|
|
@@ -2203,7 +2246,7 @@ var determineUrls = async (request, url, baseUrl, failureFunction, failureUrl, d
|
|
|
2203
2246
|
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`;
|
|
2204
2247
|
|
|
2205
2248
|
// src/serve/index.ts
|
|
2206
|
-
var
|
|
2249
|
+
var serveBase = (routeFunction, options) => {
|
|
2207
2250
|
const {
|
|
2208
2251
|
qstashClient,
|
|
2209
2252
|
onStepFinish,
|
|
@@ -2215,7 +2258,8 @@ var serve = (routeFunction, options) => {
|
|
|
2215
2258
|
failureFunction,
|
|
2216
2259
|
baseUrl,
|
|
2217
2260
|
env,
|
|
2218
|
-
retries
|
|
2261
|
+
retries,
|
|
2262
|
+
useJSONContent
|
|
2219
2263
|
} = processOptions(options);
|
|
2220
2264
|
const debug = WorkflowLogger.getLogger(verbose);
|
|
2221
2265
|
const handler = async (request) => {
|
|
@@ -2232,7 +2276,7 @@ var serve = (routeFunction, options) => {
|
|
|
2232
2276
|
await verifyRequest(requestPayload, request.headers.get("upstash-signature"), receiver);
|
|
2233
2277
|
const { isFirstInvocation, workflowRunId } = validateRequest(request);
|
|
2234
2278
|
debug?.setWorkflowRunId(workflowRunId);
|
|
2235
|
-
const { rawInitialPayload, steps, isLastDuplicate } = await parseRequest(
|
|
2279
|
+
const { rawInitialPayload, steps, isLastDuplicate, workflowRunEnded } = await parseRequest(
|
|
2236
2280
|
requestPayload,
|
|
2237
2281
|
isFirstInvocation,
|
|
2238
2282
|
workflowRunId,
|
|
@@ -2240,8 +2284,11 @@ var serve = (routeFunction, options) => {
|
|
|
2240
2284
|
request.headers.get("upstash-message-id"),
|
|
2241
2285
|
debug
|
|
2242
2286
|
);
|
|
2287
|
+
if (workflowRunEnded) {
|
|
2288
|
+
return onStepFinish(workflowRunId, "workflow-already-ended");
|
|
2289
|
+
}
|
|
2243
2290
|
if (isLastDuplicate) {
|
|
2244
|
-
return onStepFinish(
|
|
2291
|
+
return onStepFinish(workflowRunId, "duplicate-step");
|
|
2245
2292
|
}
|
|
2246
2293
|
const failureCheck = await handleFailure(
|
|
2247
2294
|
request,
|
|
@@ -2255,7 +2302,7 @@ var serve = (routeFunction, options) => {
|
|
|
2255
2302
|
throw failureCheck.error;
|
|
2256
2303
|
} else if (failureCheck.value === "is-failure-callback") {
|
|
2257
2304
|
await debug?.log("WARN", "RESPONSE_DEFAULT", "failureFunction executed");
|
|
2258
|
-
return onStepFinish(
|
|
2305
|
+
return onStepFinish(workflowRunId, "failure-callback");
|
|
2259
2306
|
}
|
|
2260
2307
|
const workflowContext = new WorkflowContext({
|
|
2261
2308
|
qstashClient,
|
|
@@ -2298,7 +2345,7 @@ var serve = (routeFunction, options) => {
|
|
|
2298
2345
|
});
|
|
2299
2346
|
throw callReturnCheck.error;
|
|
2300
2347
|
} else if (callReturnCheck.value === "continue-workflow") {
|
|
2301
|
-
const result = isFirstInvocation ? await triggerFirstInvocation(workflowContext, retries, debug) : await triggerRouteFunction({
|
|
2348
|
+
const result = isFirstInvocation ? await triggerFirstInvocation(workflowContext, retries, useJSONContent, debug) : await triggerRouteFunction({
|
|
2302
2349
|
onStep: async () => routeFunction(workflowContext),
|
|
2303
2350
|
onCleanup: async () => {
|
|
2304
2351
|
await triggerWorkflowDelete(workflowContext, debug);
|
|
@@ -2314,6 +2361,8 @@ var serve = (routeFunction, options) => {
|
|
|
2314
2361
|
}
|
|
2315
2362
|
await debug?.log("INFO", "RESPONSE_WORKFLOW");
|
|
2316
2363
|
return onStepFinish(workflowContext.workflowRunId, "success");
|
|
2364
|
+
} else if (callReturnCheck.value === "workflow-ended") {
|
|
2365
|
+
return onStepFinish(workflowContext.workflowRunId, "workflow-already-ended");
|
|
2317
2366
|
}
|
|
2318
2367
|
await debug?.log("INFO", "RESPONSE_DEFAULT");
|
|
2319
2368
|
return onStepFinish("no-workflow-id", "fromCallback");
|
|
@@ -2331,9 +2380,6 @@ var serve = (routeFunction, options) => {
|
|
|
2331
2380
|
return { handler: safeHandler };
|
|
2332
2381
|
};
|
|
2333
2382
|
|
|
2334
|
-
// src/client/index.ts
|
|
2335
|
-
var import_qstash6 = require("@upstash/qstash");
|
|
2336
|
-
|
|
2337
2383
|
// platforms/cloudflare.ts
|
|
2338
2384
|
var getArgs = (args) => {
|
|
2339
2385
|
if (!Array.isArray(args) || args.length === 0) {
|
|
@@ -2353,10 +2399,10 @@ var getArgs = (args) => {
|
|
|
2353
2399
|
}
|
|
2354
2400
|
throw new Error("Could not derive handler arguments from input. Please check how serve is used.");
|
|
2355
2401
|
};
|
|
2356
|
-
var
|
|
2402
|
+
var serve = (routeFunction, options) => {
|
|
2357
2403
|
const fetch = async (...args) => {
|
|
2358
2404
|
const { request, env } = getArgs(args);
|
|
2359
|
-
const { handler: serveHandler } =
|
|
2405
|
+
const { handler: serveHandler } = serveBase(routeFunction, {
|
|
2360
2406
|
env,
|
|
2361
2407
|
...options
|
|
2362
2408
|
});
|
package/cloudflare.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
serveBase
|
|
3
|
+
} from "./chunk-Z7WS5XIR.mjs";
|
|
4
4
|
|
|
5
5
|
// platforms/cloudflare.ts
|
|
6
6
|
var getArgs = (args) => {
|
|
@@ -21,10 +21,10 @@ var getArgs = (args) => {
|
|
|
21
21
|
}
|
|
22
22
|
throw new Error("Could not derive handler arguments from input. Please check how serve is used.");
|
|
23
23
|
};
|
|
24
|
-
var
|
|
24
|
+
var serve = (routeFunction, options) => {
|
|
25
25
|
const fetch = async (...args) => {
|
|
26
26
|
const { request, env } = getArgs(args);
|
|
27
|
-
const { handler: serveHandler } =
|
|
27
|
+
const { handler: serveHandler } = serveBase(routeFunction, {
|
|
28
28
|
env,
|
|
29
29
|
...options
|
|
30
30
|
});
|
|
@@ -33,5 +33,5 @@ var serve2 = (routeFunction, options) => {
|
|
|
33
33
|
return { fetch };
|
|
34
34
|
};
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
serve
|
|
37
37
|
};
|
package/express.d.mts
CHANGED
package/express.d.ts
CHANGED