@upstash/qstash 2.6.4-workflow-alpha.4 → 2.6.5-workflow-url-canary
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/{chunk-YN3OQUF3.mjs → chunk-DH2LYTLA.mjs} +46 -22
- package/{chunk-5DADTJQL.js → chunk-MFQHGR5V.js} +52 -28
- package/{client-Dgh4hlfZ.d.mts → client-CzkJKX67.d.mts} +18 -18
- package/{client-Dgh4hlfZ.d.ts → client-CzkJKX67.d.ts} +18 -18
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/index.mjs +1 -1
- package/nextjs.d.mts +2 -2
- package/nextjs.d.ts +2 -2
- package/nextjs.js +10 -15
- package/nextjs.mjs +6 -11
- package/nuxt.d.mts +2 -2
- package/nuxt.d.ts +2 -2
- package/nuxt.js +6 -11
- package/nuxt.mjs +4 -9
- package/package.json +1 -1
- package/solidjs.d.mts +2 -2
- package/solidjs.d.ts +2 -2
- package/solidjs.js +6 -11
- package/solidjs.mjs +4 -9
- package/svelte.d.mts +2 -2
- package/svelte.d.ts +2 -2
- package/svelte.js +8 -16
- package/svelte.mjs +6 -14
- package/workflow.d.mts +1 -1
- package/workflow.d.ts +1 -1
- package/workflow.js +2 -2
- package/workflow.mjs +1 -1
|
@@ -168,7 +168,9 @@ var QstashWorkflowAbort = class extends Error {
|
|
|
168
168
|
stepInfo;
|
|
169
169
|
stepName;
|
|
170
170
|
constructor(stepName, stepInfo) {
|
|
171
|
-
super(
|
|
171
|
+
super(
|
|
172
|
+
`This is an QStash Workflow error thrown after a step executes. It is expected to be raised. 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}'.`
|
|
173
|
+
);
|
|
172
174
|
this.name = "QstashWorkflowAbort";
|
|
173
175
|
this.stepName = stepName;
|
|
174
176
|
this.stepInfo = stepInfo;
|
|
@@ -177,8 +179,7 @@ var QstashWorkflowAbort = class extends Error {
|
|
|
177
179
|
var formatWorkflowError = (error) => {
|
|
178
180
|
return error instanceof Error ? {
|
|
179
181
|
error: error.name,
|
|
180
|
-
message: error.message
|
|
181
|
-
stack: error.stack
|
|
182
|
+
message: error.message
|
|
182
183
|
} : {
|
|
183
184
|
error: "Error",
|
|
184
185
|
message: "An error occured while executing workflow."
|
|
@@ -1462,7 +1463,7 @@ var recreateUserHeaders = (headers) => {
|
|
|
1462
1463
|
const pairs = headers.entries();
|
|
1463
1464
|
for (const [header, value] of pairs) {
|
|
1464
1465
|
const headerLowerCase = header.toLowerCase();
|
|
1465
|
-
if (!headerLowerCase.startsWith("upstash-workflow-") && !headerLowerCase.startsWith("x-vercel-")) {
|
|
1466
|
+
if (!headerLowerCase.startsWith("upstash-workflow-") && !headerLowerCase.startsWith("x-vercel-") && !headerLowerCase.startsWith("x-forwarded-")) {
|
|
1466
1467
|
filteredHeaders.append(header, value);
|
|
1467
1468
|
}
|
|
1468
1469
|
}
|
|
@@ -1587,15 +1588,25 @@ var verifyRequest = async (body, signature, verifier) => {
|
|
|
1587
1588
|
if (!verifier) {
|
|
1588
1589
|
return;
|
|
1589
1590
|
}
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1591
|
+
try {
|
|
1592
|
+
if (!signature) {
|
|
1593
|
+
throw new Error("`Upstash-Signature` header is not passed.");
|
|
1594
|
+
}
|
|
1595
|
+
const isValid = await verifier.verify({
|
|
1596
|
+
body,
|
|
1597
|
+
signature
|
|
1598
|
+
});
|
|
1599
|
+
if (!isValid) {
|
|
1600
|
+
throw new Error("Signature in `Upstash-Signature` header is not valid");
|
|
1601
|
+
}
|
|
1602
|
+
} catch (error) {
|
|
1603
|
+
throw new QstashWorkflowError(
|
|
1604
|
+
`Failed to verify that the Workflow request comes from QStash: ${error}
|
|
1605
|
+
|
|
1606
|
+
Trigger the workflow endpoint by publishing your request to QStash instead of calling it directly.
|
|
1607
|
+
|
|
1608
|
+
If you want to disable QStash Verification, you should clear env variables QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY`
|
|
1609
|
+
);
|
|
1599
1610
|
}
|
|
1600
1611
|
};
|
|
1601
1612
|
|
|
@@ -2229,6 +2240,7 @@ var LOG_LEVELS = ["DEBUG", "INFO", "SUBMIT", "WARN", "ERROR"];
|
|
|
2229
2240
|
var WorkflowLogger = class _WorkflowLogger {
|
|
2230
2241
|
logs = [];
|
|
2231
2242
|
options;
|
|
2243
|
+
workflowRunId = void 0;
|
|
2232
2244
|
constructor(options) {
|
|
2233
2245
|
this.options = options;
|
|
2234
2246
|
}
|
|
@@ -2237,6 +2249,7 @@ var WorkflowLogger = class _WorkflowLogger {
|
|
|
2237
2249
|
const timestamp = Date.now();
|
|
2238
2250
|
const logEntry = {
|
|
2239
2251
|
timestamp,
|
|
2252
|
+
workflowRunId: this.workflowRunId ?? "",
|
|
2240
2253
|
logLevel: level,
|
|
2241
2254
|
eventType,
|
|
2242
2255
|
details
|
|
@@ -2248,6 +2261,9 @@ var WorkflowLogger = class _WorkflowLogger {
|
|
|
2248
2261
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
2249
2262
|
}
|
|
2250
2263
|
}
|
|
2264
|
+
setWorkflowRunId(workflowRunId) {
|
|
2265
|
+
this.workflowRunId = workflowRunId;
|
|
2266
|
+
}
|
|
2251
2267
|
writeToConsole(logEntry) {
|
|
2252
2268
|
const JSON_SPACING = 2;
|
|
2253
2269
|
console.log(JSON.stringify(logEntry, void 0, JSON_SPACING));
|
|
@@ -2457,13 +2473,11 @@ var processOptions = (options) => {
|
|
|
2457
2473
|
currentSigningKey: process.env.QSTASH_CURRENT_SIGNING_KEY,
|
|
2458
2474
|
nextSigningKey: process.env.QSTASH_NEXT_SIGNING_KEY
|
|
2459
2475
|
}) : void 0,
|
|
2476
|
+
baseUrl: process.env.UPSTASH_WORKFLOW_URL,
|
|
2460
2477
|
...options
|
|
2461
2478
|
};
|
|
2462
2479
|
};
|
|
2463
|
-
var serve = ({
|
|
2464
|
-
routeFunction,
|
|
2465
|
-
options
|
|
2466
|
-
}) => {
|
|
2480
|
+
var serve = (routeFunction, options) => {
|
|
2467
2481
|
const {
|
|
2468
2482
|
qstashClient,
|
|
2469
2483
|
onStepFinish,
|
|
@@ -2472,11 +2486,22 @@ var serve = ({
|
|
|
2472
2486
|
verbose,
|
|
2473
2487
|
receiver,
|
|
2474
2488
|
failureUrl,
|
|
2475
|
-
failureFunction
|
|
2489
|
+
failureFunction,
|
|
2490
|
+
baseUrl
|
|
2476
2491
|
} = processOptions(options);
|
|
2477
2492
|
const debug = WorkflowLogger.getLogger(verbose);
|
|
2478
2493
|
return async (request) => {
|
|
2479
|
-
const
|
|
2494
|
+
const initialWorkflowUrl = url ?? request.url;
|
|
2495
|
+
const workflowUrl = baseUrl ? initialWorkflowUrl.replace(/^(https?:\/\/[^/]+)(\/.*)?$/, (_, matchedBaseUrl, path) => {
|
|
2496
|
+
return baseUrl + (path || "");
|
|
2497
|
+
}) : initialWorkflowUrl;
|
|
2498
|
+
if (workflowUrl !== initialWorkflowUrl) {
|
|
2499
|
+
await debug?.log("WARN", "ENDPOINT_START", {
|
|
2500
|
+
warning: `QStash Workflow: replacing the base of the url with "${baseUrl}" and using it as workflow endpoint.`,
|
|
2501
|
+
originalURL: initialWorkflowUrl,
|
|
2502
|
+
updatedURL: workflowUrl
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2480
2505
|
const workflowFailureUrl = failureFunction ? workflowUrl : failureUrl;
|
|
2481
2506
|
await debug?.log("INFO", "ENDPOINT_START");
|
|
2482
2507
|
const failureCheck = await handleFailure(request, failureFunction);
|
|
@@ -2486,6 +2511,7 @@ var serve = ({
|
|
|
2486
2511
|
return onStepFinish("no-workflow-id", "failure-callback");
|
|
2487
2512
|
}
|
|
2488
2513
|
const { isFirstInvocation, workflowRunId } = validateRequest(request);
|
|
2514
|
+
debug?.setWorkflowRunId(workflowRunId);
|
|
2489
2515
|
const { rawInitialPayload, steps, isLastDuplicate } = await parseRequest(
|
|
2490
2516
|
request,
|
|
2491
2517
|
isFirstInvocation,
|
|
@@ -2540,9 +2566,7 @@ var serve = ({
|
|
|
2540
2566
|
await debug?.log("ERROR", "ERROR", { error: result.error.message });
|
|
2541
2567
|
throw result.error;
|
|
2542
2568
|
}
|
|
2543
|
-
await debug?.log("INFO", "RESPONSE_WORKFLOW"
|
|
2544
|
-
workflowRunId: workflowContext.workflowRunId
|
|
2545
|
-
});
|
|
2569
|
+
await debug?.log("INFO", "RESPONSE_WORKFLOW");
|
|
2546
2570
|
return onStepFinish(workflowContext.workflowRunId, "success");
|
|
2547
2571
|
}
|
|
2548
2572
|
await debug?.log("INFO", "RESPONSE_DEFAULT");
|
|
@@ -168,7 +168,9 @@ var QstashWorkflowAbort = class extends Error {
|
|
|
168
168
|
|
|
169
169
|
|
|
170
170
|
constructor(stepName, stepInfo) {
|
|
171
|
-
super(
|
|
171
|
+
super(
|
|
172
|
+
`This is an QStash Workflow error thrown after a step executes. It is expected to be raised. 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}'.`
|
|
173
|
+
);
|
|
172
174
|
this.name = "QstashWorkflowAbort";
|
|
173
175
|
this.stepName = stepName;
|
|
174
176
|
this.stepInfo = stepInfo;
|
|
@@ -177,8 +179,7 @@ var QstashWorkflowAbort = class extends Error {
|
|
|
177
179
|
var formatWorkflowError = (error) => {
|
|
178
180
|
return error instanceof Error ? {
|
|
179
181
|
error: error.name,
|
|
180
|
-
message: error.message
|
|
181
|
-
stack: error.stack
|
|
182
|
+
message: error.message
|
|
182
183
|
} : {
|
|
183
184
|
error: "Error",
|
|
184
185
|
message: "An error occured while executing workflow."
|
|
@@ -1462,7 +1463,7 @@ var recreateUserHeaders = (headers) => {
|
|
|
1462
1463
|
const pairs = headers.entries();
|
|
1463
1464
|
for (const [header, value] of pairs) {
|
|
1464
1465
|
const headerLowerCase = header.toLowerCase();
|
|
1465
|
-
if (!headerLowerCase.startsWith("upstash-workflow-") && !headerLowerCase.startsWith("x-vercel-")) {
|
|
1466
|
+
if (!headerLowerCase.startsWith("upstash-workflow-") && !headerLowerCase.startsWith("x-vercel-") && !headerLowerCase.startsWith("x-forwarded-")) {
|
|
1466
1467
|
filteredHeaders.append(header, value);
|
|
1467
1468
|
}
|
|
1468
1469
|
}
|
|
@@ -1587,15 +1588,25 @@ var verifyRequest = async (body, signature, verifier) => {
|
|
|
1587
1588
|
if (!verifier) {
|
|
1588
1589
|
return;
|
|
1589
1590
|
}
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1591
|
+
try {
|
|
1592
|
+
if (!signature) {
|
|
1593
|
+
throw new Error("`Upstash-Signature` header is not passed.");
|
|
1594
|
+
}
|
|
1595
|
+
const isValid = await verifier.verify({
|
|
1596
|
+
body,
|
|
1597
|
+
signature
|
|
1598
|
+
});
|
|
1599
|
+
if (!isValid) {
|
|
1600
|
+
throw new Error("Signature in `Upstash-Signature` header is not valid");
|
|
1601
|
+
}
|
|
1602
|
+
} catch (error) {
|
|
1603
|
+
throw new QstashWorkflowError(
|
|
1604
|
+
`Failed to verify that the Workflow request comes from QStash: ${error}
|
|
1605
|
+
|
|
1606
|
+
Trigger the workflow endpoint by publishing your request to QStash instead of calling it directly.
|
|
1607
|
+
|
|
1608
|
+
If you want to disable QStash Verification, you should clear env variables QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY`
|
|
1609
|
+
);
|
|
1599
1610
|
}
|
|
1600
1611
|
};
|
|
1601
1612
|
|
|
@@ -2229,7 +2240,8 @@ var LOG_LEVELS = ["DEBUG", "INFO", "SUBMIT", "WARN", "ERROR"];
|
|
|
2229
2240
|
var WorkflowLogger = (_class9 = class _WorkflowLogger {
|
|
2230
2241
|
__init15() {this.logs = []}
|
|
2231
2242
|
|
|
2232
|
-
|
|
2243
|
+
__init16() {this.workflowRunId = void 0}
|
|
2244
|
+
constructor(options) {;_class9.prototype.__init15.call(this);_class9.prototype.__init16.call(this);
|
|
2233
2245
|
this.options = options;
|
|
2234
2246
|
}
|
|
2235
2247
|
async log(level, eventType, details) {
|
|
@@ -2237,6 +2249,7 @@ var WorkflowLogger = (_class9 = class _WorkflowLogger {
|
|
|
2237
2249
|
const timestamp = Date.now();
|
|
2238
2250
|
const logEntry = {
|
|
2239
2251
|
timestamp,
|
|
2252
|
+
workflowRunId: _nullishCoalesce(this.workflowRunId, () => ( "")),
|
|
2240
2253
|
logLevel: level,
|
|
2241
2254
|
eventType,
|
|
2242
2255
|
details
|
|
@@ -2248,6 +2261,9 @@ var WorkflowLogger = (_class9 = class _WorkflowLogger {
|
|
|
2248
2261
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
2249
2262
|
}
|
|
2250
2263
|
}
|
|
2264
|
+
setWorkflowRunId(workflowRunId) {
|
|
2265
|
+
this.workflowRunId = workflowRunId;
|
|
2266
|
+
}
|
|
2251
2267
|
writeToConsole(logEntry) {
|
|
2252
2268
|
const JSON_SPACING = 2;
|
|
2253
2269
|
console.log(JSON.stringify(logEntry, void 0, JSON_SPACING));
|
|
@@ -2457,13 +2473,11 @@ var processOptions = (options) => {
|
|
|
2457
2473
|
currentSigningKey: process.env.QSTASH_CURRENT_SIGNING_KEY,
|
|
2458
2474
|
nextSigningKey: process.env.QSTASH_NEXT_SIGNING_KEY
|
|
2459
2475
|
}) : void 0,
|
|
2476
|
+
baseUrl: process.env.UPSTASH_WORKFLOW_URL,
|
|
2460
2477
|
...options
|
|
2461
2478
|
};
|
|
2462
2479
|
};
|
|
2463
|
-
var serve = ({
|
|
2464
|
-
routeFunction,
|
|
2465
|
-
options
|
|
2466
|
-
}) => {
|
|
2480
|
+
var serve = (routeFunction, options) => {
|
|
2467
2481
|
const {
|
|
2468
2482
|
qstashClient,
|
|
2469
2483
|
onStepFinish,
|
|
@@ -2472,13 +2486,24 @@ var serve = ({
|
|
|
2472
2486
|
verbose,
|
|
2473
2487
|
receiver,
|
|
2474
2488
|
failureUrl,
|
|
2475
|
-
failureFunction
|
|
2489
|
+
failureFunction,
|
|
2490
|
+
baseUrl
|
|
2476
2491
|
} = processOptions(options);
|
|
2477
2492
|
const debug = WorkflowLogger.getLogger(verbose);
|
|
2478
2493
|
return async (request) => {
|
|
2479
|
-
const
|
|
2494
|
+
const initialWorkflowUrl = _nullishCoalesce(url, () => ( request.url));
|
|
2495
|
+
const workflowUrl = baseUrl ? initialWorkflowUrl.replace(/^(https?:\/\/[^/]+)(\/.*)?$/, (_, matchedBaseUrl, path) => {
|
|
2496
|
+
return baseUrl + (path || "");
|
|
2497
|
+
}) : initialWorkflowUrl;
|
|
2498
|
+
if (workflowUrl !== initialWorkflowUrl) {
|
|
2499
|
+
await _optionalChain([debug, 'optionalAccess', _58 => _58.log, 'call', _59 => _59("WARN", "ENDPOINT_START", {
|
|
2500
|
+
warning: `QStash Workflow: replacing the base of the url with "${baseUrl}" and using it as workflow endpoint.`,
|
|
2501
|
+
originalURL: initialWorkflowUrl,
|
|
2502
|
+
updatedURL: workflowUrl
|
|
2503
|
+
})]);
|
|
2504
|
+
}
|
|
2480
2505
|
const workflowFailureUrl = failureFunction ? workflowUrl : failureUrl;
|
|
2481
|
-
await _optionalChain([debug, 'optionalAccess',
|
|
2506
|
+
await _optionalChain([debug, 'optionalAccess', _60 => _60.log, 'call', _61 => _61("INFO", "ENDPOINT_START")]);
|
|
2482
2507
|
const failureCheck = await handleFailure(request, failureFunction);
|
|
2483
2508
|
if (failureCheck.isErr()) {
|
|
2484
2509
|
throw failureCheck.error;
|
|
@@ -2486,6 +2511,7 @@ var serve = ({
|
|
|
2486
2511
|
return onStepFinish("no-workflow-id", "failure-callback");
|
|
2487
2512
|
}
|
|
2488
2513
|
const { isFirstInvocation, workflowRunId } = validateRequest(request);
|
|
2514
|
+
_optionalChain([debug, 'optionalAccess', _62 => _62.setWorkflowRunId, 'call', _63 => _63(workflowRunId)]);
|
|
2489
2515
|
const { rawInitialPayload, steps, isLastDuplicate } = await parseRequest(
|
|
2490
2516
|
request,
|
|
2491
2517
|
isFirstInvocation,
|
|
@@ -2511,7 +2537,7 @@ var serve = ({
|
|
|
2511
2537
|
workflowContext
|
|
2512
2538
|
);
|
|
2513
2539
|
if (authCheck.isErr()) {
|
|
2514
|
-
await _optionalChain([debug, 'optionalAccess',
|
|
2540
|
+
await _optionalChain([debug, 'optionalAccess', _64 => _64.log, 'call', _65 => _65("ERROR", "ERROR", { error: authCheck.error.message })]);
|
|
2515
2541
|
throw authCheck.error;
|
|
2516
2542
|
} else if (authCheck.value === "run-ended") {
|
|
2517
2543
|
return onStepFinish("no-workflow-id", "auth-fail");
|
|
@@ -2525,7 +2551,7 @@ var serve = ({
|
|
|
2525
2551
|
debug
|
|
2526
2552
|
);
|
|
2527
2553
|
if (callReturnCheck.isErr()) {
|
|
2528
|
-
await _optionalChain([debug, 'optionalAccess',
|
|
2554
|
+
await _optionalChain([debug, 'optionalAccess', _66 => _66.log, 'call', _67 => _67("ERROR", "SUBMIT_THIRD_PARTY_RESULT", {
|
|
2529
2555
|
error: callReturnCheck.error.message
|
|
2530
2556
|
})]);
|
|
2531
2557
|
throw callReturnCheck.error;
|
|
@@ -2537,15 +2563,13 @@ var serve = ({
|
|
|
2537
2563
|
}
|
|
2538
2564
|
});
|
|
2539
2565
|
if (result.isErr()) {
|
|
2540
|
-
await _optionalChain([debug, 'optionalAccess',
|
|
2566
|
+
await _optionalChain([debug, 'optionalAccess', _68 => _68.log, 'call', _69 => _69("ERROR", "ERROR", { error: result.error.message })]);
|
|
2541
2567
|
throw result.error;
|
|
2542
2568
|
}
|
|
2543
|
-
await _optionalChain([debug, 'optionalAccess',
|
|
2544
|
-
workflowRunId: workflowContext.workflowRunId
|
|
2545
|
-
})]);
|
|
2569
|
+
await _optionalChain([debug, 'optionalAccess', _70 => _70.log, 'call', _71 => _71("INFO", "RESPONSE_WORKFLOW")]);
|
|
2546
2570
|
return onStepFinish(workflowContext.workflowRunId, "success");
|
|
2547
2571
|
}
|
|
2548
|
-
await _optionalChain([debug, 'optionalAccess',
|
|
2572
|
+
await _optionalChain([debug, 'optionalAccess', _72 => _72.log, 'call', _73 => _73("INFO", "RESPONSE_DEFAULT")]);
|
|
2549
2573
|
return onStepFinish("no-workflow-id", "fromCallback");
|
|
2550
2574
|
};
|
|
2551
2575
|
};
|
|
@@ -816,6 +816,7 @@ declare const LOG_LEVELS: readonly ["DEBUG", "INFO", "SUBMIT", "WARN", "ERROR"];
|
|
|
816
816
|
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
817
817
|
type ChatLogEntry = {
|
|
818
818
|
timestamp: number;
|
|
819
|
+
workflowRunId: string;
|
|
819
820
|
logLevel: LogLevel;
|
|
820
821
|
eventType: "ENDPOINT_START" | "SUBMIT_THIRD_PARTY_RESULT" | "CREATE_CONTEXT" | "SUBMIT_FIRST_INVOCATION" | "RUN_SINGLE" | "RUN_PARALLEL" | "SUBMIT_STEP" | "SUBMIT_CLEANUP" | "RESPONSE_WORKFLOW" | "RESPONSE_DEFAULT" | "ERROR";
|
|
821
822
|
details: unknown;
|
|
@@ -827,8 +828,10 @@ type WorkflowLoggerOptions = {
|
|
|
827
828
|
declare class WorkflowLogger {
|
|
828
829
|
private logs;
|
|
829
830
|
private options;
|
|
831
|
+
private workflowRunId?;
|
|
830
832
|
constructor(options: WorkflowLoggerOptions);
|
|
831
833
|
log(level: LogLevel, eventType: ChatLogEntry["eventType"], details?: unknown): Promise<void>;
|
|
834
|
+
setWorkflowRunId(workflowRunId: string): void;
|
|
832
835
|
private writeToConsole;
|
|
833
836
|
private shouldLog;
|
|
834
837
|
static getLogger(verbose?: boolean | WorkflowLogger): WorkflowLogger | undefined;
|
|
@@ -1133,21 +1136,6 @@ type AsyncStepFunction<TResult> = () => Promise<TResult>;
|
|
|
1133
1136
|
type StepFunction<TResult> = AsyncStepFunction<TResult> | SyncStepFunction<TResult>;
|
|
1134
1137
|
type ParallelCallState = "first" | "partial" | "discard" | "last";
|
|
1135
1138
|
type RouteFunction<TInitialPayload> = (context: WorkflowContext<TInitialPayload>) => Promise<void>;
|
|
1136
|
-
type WorkflowServeParameters<TInitialPayload, TResponse extends Response = Response, TExcludeFromOptions extends keyof WorkflowServeOptions = never> = {
|
|
1137
|
-
routeFunction: RouteFunction<TInitialPayload>;
|
|
1138
|
-
options?: Omit<WorkflowServeOptions<TResponse, TInitialPayload>, TExcludeFromOptions>;
|
|
1139
|
-
};
|
|
1140
|
-
/**
|
|
1141
|
-
* Not all frameworks use env variables like nextjs does. In this case, we need
|
|
1142
|
-
* to be able to get the qstashClient and receiver explicitly.
|
|
1143
|
-
*
|
|
1144
|
-
* In this case, we extend the WorkflowServeParameters by requiring an explicit
|
|
1145
|
-
* qstashClient & receiever parameters and removing qstashClient & receiever from options.
|
|
1146
|
-
*/
|
|
1147
|
-
type WorkflowServeParametersExtended<TInitialPayload = unknown, TResponse extends Response = Response, TExcludeFromOptions extends keyof WorkflowServeOptions = never> = WorkflowServeParameters<TInitialPayload, TResponse, "qstashClient" | "receiver" | TExcludeFromOptions> & {
|
|
1148
|
-
qstashClient: Client;
|
|
1149
|
-
receiver: WorkflowServeOptions["receiver"];
|
|
1150
|
-
};
|
|
1151
1139
|
type FinishCondition = "success" | "duplicate-step" | "fromCallback" | "auth-fail" | "failure-callback";
|
|
1152
1140
|
type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload = unknown> = {
|
|
1153
1141
|
/**
|
|
@@ -1201,6 +1189,19 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1201
1189
|
* @returns void
|
|
1202
1190
|
*/
|
|
1203
1191
|
failureFunction?: (status: number, header: Record<string, string>, body: FailureFunctionPayload, workflowRunId: string) => Promise<void>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Base Url of the workflow endpoint
|
|
1194
|
+
*
|
|
1195
|
+
* Can be used to set if there is a local tunnel or a proxy between
|
|
1196
|
+
* QStash and the workflow endpoint.
|
|
1197
|
+
*
|
|
1198
|
+
* Will be set to the env variable UPSTASH_WORKFLOW_URL if not passed.
|
|
1199
|
+
* If the env variable is not set, the url will be infered as usual from
|
|
1200
|
+
* the `request.url` or the `url` parameter in `serve` options.
|
|
1201
|
+
*
|
|
1202
|
+
* @default undefined
|
|
1203
|
+
*/
|
|
1204
|
+
baseUrl?: string;
|
|
1204
1205
|
};
|
|
1205
1206
|
/**
|
|
1206
1207
|
* Payload passed as body in failureFunction
|
|
@@ -1214,7 +1215,6 @@ type FailureFunctionPayload = {
|
|
|
1214
1215
|
* error message
|
|
1215
1216
|
*/
|
|
1216
1217
|
message: string;
|
|
1217
|
-
stack?: string;
|
|
1218
1218
|
};
|
|
1219
1219
|
/**
|
|
1220
1220
|
* Makes all fields except the ones selected required
|
|
@@ -1229,7 +1229,7 @@ type RequiredExceptFields<T, K extends keyof T> = Omit<Required<T>, K> & Partial
|
|
|
1229
1229
|
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
1230
1230
|
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
1231
1231
|
*/
|
|
1232
|
-
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(
|
|
1232
|
+
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(routeFunction: RouteFunction<TInitialPayload>, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => ((request: TRequest) => Promise<TResponse>);
|
|
1233
1233
|
|
|
1234
1234
|
declare class Workflow {
|
|
1235
1235
|
private readonly http;
|
|
@@ -1566,4 +1566,4 @@ type PublishResponse<TRequest> = TRequest extends {
|
|
|
1566
1566
|
urlGroup: string;
|
|
1567
1567
|
} ? PublishToUrlGroupsResponse : PublishToApiResponse;
|
|
1568
1568
|
|
|
1569
|
-
export { type
|
|
1569
|
+
export { type RouteFunction as $, type AddEndpointsRequest as A, type BodyInit as B, type ChatRateLimit as C, type ChatCompletion as D, type EventsRequest as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type ChatCompletionChunk as I, type StreamEnabled as J, type StreamDisabled as K, type StreamParameter as L, type Message as M, type PromptChatRequest as N, type OpenAIChatModel as O, type PublishBatchRequest as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type ChatRequest as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, custom as X, openai as Y, upstash as Z, type ProviderReturnType as _, type ReceiverConfig as a, type WorkflowServeOptions as a0, Workflow as a1, serve as a2, WorkflowContext as a3, DisabledWorkflowContext as a4, StepTypes as a5, type StepType as a6, type RawStep as a7, type SyncStepFunction as a8, type AsyncStepFunction as a9, type StepFunction as aa, type ParallelCallState as ab, type FinishCondition as ac, type RequiredExceptFields as ad, type LogLevel as ae, type WorkflowLoggerOptions as af, WorkflowLogger as ag, SignatureError as b, Receiver as c, type PublishRequest as d, type PublishJsonRequest as e, Client as f, type PublishToApiResponse as g, type PublishToUrlResponse as h, type PublishToUrlGroupsResponse as i, type PublishResponse as j, type MessagePayload as k, Messages as l, type Schedule as m, type CreateScheduleRequest as n, Schedules as o, type Endpoint as p, type RemoveEndpointsRequest as q, UrlGroups as r, type State as s, type Event as t, type EventPayload as u, type GetEventsPayload as v, type HeadersInit as w, type RequestOptions as x, Chat as y, type ChatCompletionMessage as z };
|
|
@@ -816,6 +816,7 @@ declare const LOG_LEVELS: readonly ["DEBUG", "INFO", "SUBMIT", "WARN", "ERROR"];
|
|
|
816
816
|
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
817
817
|
type ChatLogEntry = {
|
|
818
818
|
timestamp: number;
|
|
819
|
+
workflowRunId: string;
|
|
819
820
|
logLevel: LogLevel;
|
|
820
821
|
eventType: "ENDPOINT_START" | "SUBMIT_THIRD_PARTY_RESULT" | "CREATE_CONTEXT" | "SUBMIT_FIRST_INVOCATION" | "RUN_SINGLE" | "RUN_PARALLEL" | "SUBMIT_STEP" | "SUBMIT_CLEANUP" | "RESPONSE_WORKFLOW" | "RESPONSE_DEFAULT" | "ERROR";
|
|
821
822
|
details: unknown;
|
|
@@ -827,8 +828,10 @@ type WorkflowLoggerOptions = {
|
|
|
827
828
|
declare class WorkflowLogger {
|
|
828
829
|
private logs;
|
|
829
830
|
private options;
|
|
831
|
+
private workflowRunId?;
|
|
830
832
|
constructor(options: WorkflowLoggerOptions);
|
|
831
833
|
log(level: LogLevel, eventType: ChatLogEntry["eventType"], details?: unknown): Promise<void>;
|
|
834
|
+
setWorkflowRunId(workflowRunId: string): void;
|
|
832
835
|
private writeToConsole;
|
|
833
836
|
private shouldLog;
|
|
834
837
|
static getLogger(verbose?: boolean | WorkflowLogger): WorkflowLogger | undefined;
|
|
@@ -1133,21 +1136,6 @@ type AsyncStepFunction<TResult> = () => Promise<TResult>;
|
|
|
1133
1136
|
type StepFunction<TResult> = AsyncStepFunction<TResult> | SyncStepFunction<TResult>;
|
|
1134
1137
|
type ParallelCallState = "first" | "partial" | "discard" | "last";
|
|
1135
1138
|
type RouteFunction<TInitialPayload> = (context: WorkflowContext<TInitialPayload>) => Promise<void>;
|
|
1136
|
-
type WorkflowServeParameters<TInitialPayload, TResponse extends Response = Response, TExcludeFromOptions extends keyof WorkflowServeOptions = never> = {
|
|
1137
|
-
routeFunction: RouteFunction<TInitialPayload>;
|
|
1138
|
-
options?: Omit<WorkflowServeOptions<TResponse, TInitialPayload>, TExcludeFromOptions>;
|
|
1139
|
-
};
|
|
1140
|
-
/**
|
|
1141
|
-
* Not all frameworks use env variables like nextjs does. In this case, we need
|
|
1142
|
-
* to be able to get the qstashClient and receiver explicitly.
|
|
1143
|
-
*
|
|
1144
|
-
* In this case, we extend the WorkflowServeParameters by requiring an explicit
|
|
1145
|
-
* qstashClient & receiever parameters and removing qstashClient & receiever from options.
|
|
1146
|
-
*/
|
|
1147
|
-
type WorkflowServeParametersExtended<TInitialPayload = unknown, TResponse extends Response = Response, TExcludeFromOptions extends keyof WorkflowServeOptions = never> = WorkflowServeParameters<TInitialPayload, TResponse, "qstashClient" | "receiver" | TExcludeFromOptions> & {
|
|
1148
|
-
qstashClient: Client;
|
|
1149
|
-
receiver: WorkflowServeOptions["receiver"];
|
|
1150
|
-
};
|
|
1151
1139
|
type FinishCondition = "success" | "duplicate-step" | "fromCallback" | "auth-fail" | "failure-callback";
|
|
1152
1140
|
type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload = unknown> = {
|
|
1153
1141
|
/**
|
|
@@ -1201,6 +1189,19 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
|
|
|
1201
1189
|
* @returns void
|
|
1202
1190
|
*/
|
|
1203
1191
|
failureFunction?: (status: number, header: Record<string, string>, body: FailureFunctionPayload, workflowRunId: string) => Promise<void>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Base Url of the workflow endpoint
|
|
1194
|
+
*
|
|
1195
|
+
* Can be used to set if there is a local tunnel or a proxy between
|
|
1196
|
+
* QStash and the workflow endpoint.
|
|
1197
|
+
*
|
|
1198
|
+
* Will be set to the env variable UPSTASH_WORKFLOW_URL if not passed.
|
|
1199
|
+
* If the env variable is not set, the url will be infered as usual from
|
|
1200
|
+
* the `request.url` or the `url` parameter in `serve` options.
|
|
1201
|
+
*
|
|
1202
|
+
* @default undefined
|
|
1203
|
+
*/
|
|
1204
|
+
baseUrl?: string;
|
|
1204
1205
|
};
|
|
1205
1206
|
/**
|
|
1206
1207
|
* Payload passed as body in failureFunction
|
|
@@ -1214,7 +1215,6 @@ type FailureFunctionPayload = {
|
|
|
1214
1215
|
* error message
|
|
1215
1216
|
*/
|
|
1216
1217
|
message: string;
|
|
1217
|
-
stack?: string;
|
|
1218
1218
|
};
|
|
1219
1219
|
/**
|
|
1220
1220
|
* Makes all fields except the ones selected required
|
|
@@ -1229,7 +1229,7 @@ type RequiredExceptFields<T, K extends keyof T> = Omit<Required<T>, K> & Partial
|
|
|
1229
1229
|
* @param options - Options including the client, onFinish callback, and initialPayloadParser.
|
|
1230
1230
|
* @returns An async method that consumes incoming requests and runs the workflow.
|
|
1231
1231
|
*/
|
|
1232
|
-
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(
|
|
1232
|
+
declare const serve: <TInitialPayload = unknown, TRequest extends Request = Request, TResponse extends Response = Response>(routeFunction: RouteFunction<TInitialPayload>, options?: WorkflowServeOptions<TResponse, TInitialPayload>) => ((request: TRequest) => Promise<TResponse>);
|
|
1233
1233
|
|
|
1234
1234
|
declare class Workflow {
|
|
1235
1235
|
private readonly http;
|
|
@@ -1566,4 +1566,4 @@ type PublishResponse<TRequest> = TRequest extends {
|
|
|
1566
1566
|
urlGroup: string;
|
|
1567
1567
|
} ? PublishToUrlGroupsResponse : PublishToApiResponse;
|
|
1568
1568
|
|
|
1569
|
-
export { type
|
|
1569
|
+
export { type RouteFunction as $, type AddEndpointsRequest as A, type BodyInit as B, type ChatRateLimit as C, type ChatCompletion as D, type EventsRequest as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type ChatCompletionChunk as I, type StreamEnabled as J, type StreamDisabled as K, type StreamParameter as L, type Message as M, type PromptChatRequest as N, type OpenAIChatModel as O, type PublishBatchRequest as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type ChatRequest as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, custom as X, openai as Y, upstash as Z, type ProviderReturnType as _, type ReceiverConfig as a, type WorkflowServeOptions as a0, Workflow as a1, serve as a2, WorkflowContext as a3, DisabledWorkflowContext as a4, StepTypes as a5, type StepType as a6, type RawStep as a7, type SyncStepFunction as a8, type AsyncStepFunction as a9, type StepFunction as aa, type ParallelCallState as ab, type FinishCondition as ac, type RequiredExceptFields as ad, type LogLevel as ae, type WorkflowLoggerOptions as af, WorkflowLogger as ag, SignatureError as b, Receiver as c, type PublishRequest as d, type PublishJsonRequest as e, Client as f, type PublishToApiResponse as g, type PublishToUrlResponse as h, type PublishToUrlGroupsResponse as i, type PublishResponse as j, type MessagePayload as k, Messages as l, type Schedule as m, type CreateScheduleRequest as n, Schedules as o, type Endpoint as p, type RemoveEndpointsRequest as q, UrlGroups as r, type State as s, type Event as t, type EventPayload as u, type GetEventsPayload as v, type HeadersInit as w, type RequestOptions as x, Chat as y, type ChatCompletionMessage as z };
|
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-
|
|
2
|
-
export { A as AddEndpointsRequest, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, Z as upstash } from './client-
|
|
1
|
+
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-CzkJKX67.mjs';
|
|
2
|
+
export { A as AddEndpointsRequest, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, Z as upstash } from './client-CzkJKX67.mjs';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
/**
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-
|
|
2
|
-
export { A as AddEndpointsRequest, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, Z as upstash } from './client-
|
|
1
|
+
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-CzkJKX67.js';
|
|
2
|
+
export { A as AddEndpointsRequest, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, Z as upstash } from './client-CzkJKX67.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
/**
|
package/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var _chunkF6QRAN74js = require('./chunk-F6QRAN74.js');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkMFQHGR5Vjs = require('./chunk-MFQHGR5V.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -37,4 +37,4 @@ var _chunk5DADTJQLjs = require('./chunk-5DADTJQL.js');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
exports.Chat =
|
|
40
|
+
exports.Chat = _chunkMFQHGR5Vjs.Chat; exports.Client = _chunkMFQHGR5Vjs.Client; exports.Messages = _chunkMFQHGR5Vjs.Messages; exports.QstashChatRatelimitError = _chunkMFQHGR5Vjs.QstashChatRatelimitError; exports.QstashDailyRatelimitError = _chunkMFQHGR5Vjs.QstashDailyRatelimitError; exports.QstashError = _chunkMFQHGR5Vjs.QstashError; exports.QstashRatelimitError = _chunkMFQHGR5Vjs.QstashRatelimitError; exports.QstashWorkflowAbort = _chunkMFQHGR5Vjs.QstashWorkflowAbort; exports.QstashWorkflowError = _chunkMFQHGR5Vjs.QstashWorkflowError; exports.Receiver = _chunkMFQHGR5Vjs.Receiver; exports.Schedules = _chunkMFQHGR5Vjs.Schedules; exports.SignatureError = _chunkMFQHGR5Vjs.SignatureError; exports.UrlGroups = _chunkMFQHGR5Vjs.UrlGroups; exports.custom = _chunkF6QRAN74js.custom; exports.formatWorkflowError = _chunkMFQHGR5Vjs.formatWorkflowError; exports.openai = _chunkF6QRAN74js.openai; exports.upstash = _chunkF6QRAN74js.upstash;
|
package/index.mjs
CHANGED
package/nextjs.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler } from 'next';
|
|
2
2
|
import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.mjs';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
|
@@ -23,6 +23,6 @@ declare function verifySignature(handler: NextApiHandler, config?: VerifySignatu
|
|
|
23
23
|
declare function verifySignatureEdge(handler: (request: NextRequest, nfe?: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignatureConfig): (request: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>;
|
|
24
24
|
type VerifySignatureAppRouterResponse = NextResponse | Promise<NextResponse> | Response | Promise<Response>;
|
|
25
25
|
declare function verifySignatureAppRouter(handler: ((request: Request) => VerifySignatureAppRouterResponse) | ((request: NextRequest) => VerifySignatureAppRouterResponse), config?: VerifySignatureConfig): (request: NextRequest | Request) => Promise<Response>;
|
|
26
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
26
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<NextResponse, TInitialPayload>, "onStepFinish">) => ((request: NextRequest) => Promise<NextResponse>);
|
|
27
27
|
|
|
28
28
|
export { type VerifySignatureConfig, serve, verifySignature, verifySignatureAppRouter, verifySignatureEdge };
|
package/nextjs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiHandler } from 'next';
|
|
2
2
|
import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
|
@@ -23,6 +23,6 @@ declare function verifySignature(handler: NextApiHandler, config?: VerifySignatu
|
|
|
23
23
|
declare function verifySignatureEdge(handler: (request: NextRequest, nfe?: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignatureConfig): (request: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>;
|
|
24
24
|
type VerifySignatureAppRouterResponse = NextResponse | Promise<NextResponse> | Response | Promise<Response>;
|
|
25
25
|
declare function verifySignatureAppRouter(handler: ((request: Request) => VerifySignatureAppRouterResponse) | ((request: NextRequest) => VerifySignatureAppRouterResponse), config?: VerifySignatureConfig): (request: NextRequest | Request) => Promise<Response>;
|
|
26
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
26
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<NextResponse, TInitialPayload>, "onStepFinish">) => ((request: NextRequest) => Promise<NextResponse>);
|
|
27
27
|
|
|
28
28
|
export { type VerifySignatureConfig, serve, verifySignature, verifySignatureAppRouter, verifySignatureEdge };
|
package/nextjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkMFQHGR5Vjs = require('./chunk-MFQHGR5V.js');
|
|
6
6
|
|
|
7
7
|
// platforms/nextjs.ts
|
|
8
8
|
var _server = require('next/server');
|
|
@@ -20,7 +20,7 @@ function verifySignature(handler, config) {
|
|
|
20
20
|
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
const receiver = new (0,
|
|
23
|
+
const receiver = new (0, _chunkMFQHGR5Vjs.Receiver)({
|
|
24
24
|
currentSigningKey,
|
|
25
25
|
nextSigningKey
|
|
26
26
|
});
|
|
@@ -72,7 +72,7 @@ function verifySignatureEdge(handler, config) {
|
|
|
72
72
|
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
|
-
const receiver = new (0,
|
|
75
|
+
const receiver = new (0, _chunkMFQHGR5Vjs.Receiver)({
|
|
76
76
|
currentSigningKey,
|
|
77
77
|
nextSigningKey
|
|
78
78
|
});
|
|
@@ -112,7 +112,7 @@ function verifySignatureAppRouter(handler, config) {
|
|
|
112
112
|
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
const receiver = new (0,
|
|
115
|
+
const receiver = new (0, _chunkMFQHGR5Vjs.Receiver)({
|
|
116
116
|
currentSigningKey,
|
|
117
117
|
nextSigningKey
|
|
118
118
|
});
|
|
@@ -139,22 +139,17 @@ function verifySignatureAppRouter(handler, config) {
|
|
|
139
139
|
return handler(request);
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
var serve2 = ({
|
|
143
|
-
routeFunction,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const handler = _chunk5DADTJQLjs.serve.call(void 0, {
|
|
147
|
-
routeFunction,
|
|
148
|
-
options: {
|
|
149
|
-
onStepFinish: (workflowRunId) => new (0, _server.NextResponse)(JSON.stringify({ workflowRunId }), { status: 200 }),
|
|
150
|
-
...options
|
|
151
|
-
}
|
|
142
|
+
var serve2 = (routeFunction, options) => {
|
|
143
|
+
const handler = _chunkMFQHGR5Vjs.serve.call(void 0, routeFunction, {
|
|
144
|
+
onStepFinish: (workflowRunId) => new (0, _server.NextResponse)(JSON.stringify({ workflowRunId }), { status: 200 }),
|
|
145
|
+
...options
|
|
152
146
|
});
|
|
153
147
|
return async (request) => {
|
|
154
148
|
try {
|
|
155
149
|
return await handler(request);
|
|
156
150
|
} catch (error) {
|
|
157
|
-
|
|
151
|
+
console.error(error);
|
|
152
|
+
return new (0, _server.NextResponse)(JSON.stringify(_chunkMFQHGR5Vjs.formatWorkflowError.call(void 0, error)), {
|
|
158
153
|
status: 500
|
|
159
154
|
});
|
|
160
155
|
}
|
package/nextjs.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Receiver,
|
|
3
3
|
formatWorkflowError,
|
|
4
4
|
serve
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DH2LYTLA.mjs";
|
|
6
6
|
|
|
7
7
|
// platforms/nextjs.ts
|
|
8
8
|
import { NextResponse } from "next/server";
|
|
@@ -139,21 +139,16 @@ function verifySignatureAppRouter(handler, config) {
|
|
|
139
139
|
return handler(request);
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
var serve2 = ({
|
|
143
|
-
routeFunction,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const handler = serve({
|
|
147
|
-
routeFunction,
|
|
148
|
-
options: {
|
|
149
|
-
onStepFinish: (workflowRunId) => new NextResponse(JSON.stringify({ workflowRunId }), { status: 200 }),
|
|
150
|
-
...options
|
|
151
|
-
}
|
|
142
|
+
var serve2 = (routeFunction, options) => {
|
|
143
|
+
const handler = serve(routeFunction, {
|
|
144
|
+
onStepFinish: (workflowRunId) => new NextResponse(JSON.stringify({ workflowRunId }), { status: 200 }),
|
|
145
|
+
...options
|
|
152
146
|
});
|
|
153
147
|
return async (request) => {
|
|
154
148
|
try {
|
|
155
149
|
return await handler(request);
|
|
156
150
|
} catch (error) {
|
|
151
|
+
console.error(error);
|
|
157
152
|
return new NextResponse(JSON.stringify(formatWorkflowError(error)), {
|
|
158
153
|
status: 500
|
|
159
154
|
});
|
package/nuxt.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.mjs';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
|
@@ -9,7 +9,7 @@ type VerifySignatureConfig = {
|
|
|
9
9
|
clockTolerance?: number;
|
|
10
10
|
};
|
|
11
11
|
declare const verifySignatureNuxt: (handler: (event: H3Event) => Promise<unknown>, config?: VerifySignatureConfig) => h3.EventHandler<h3.EventHandlerRequest, Promise<unknown>>;
|
|
12
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
12
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
|
|
13
13
|
status: number;
|
|
14
14
|
body: string;
|
|
15
15
|
}>>;
|
package/nuxt.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.js';
|
|
4
4
|
import 'neverthrow';
|
|
5
5
|
|
|
6
6
|
type VerifySignatureConfig = {
|
|
@@ -9,7 +9,7 @@ type VerifySignatureConfig = {
|
|
|
9
9
|
clockTolerance?: number;
|
|
10
10
|
};
|
|
11
11
|
declare const verifySignatureNuxt: (handler: (event: H3Event) => Promise<unknown>, config?: VerifySignatureConfig) => h3.EventHandler<h3.EventHandlerRequest, Promise<unknown>>;
|
|
12
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
12
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
|
|
13
13
|
status: number;
|
|
14
14
|
body: string;
|
|
15
15
|
}>>;
|
package/nuxt.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkMFQHGR5Vjs = require('./chunk-MFQHGR5V.js');
|
|
7
7
|
|
|
8
8
|
// platforms/nuxt.ts
|
|
9
9
|
var _h3 = require('h3');
|
|
@@ -20,7 +20,7 @@ var verifySignatureNuxt = (handler, config) => {
|
|
|
20
20
|
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
const receiver = new (0,
|
|
23
|
+
const receiver = new (0, _chunkMFQHGR5Vjs.Receiver)({
|
|
24
24
|
currentSigningKey,
|
|
25
25
|
nextSigningKey
|
|
26
26
|
});
|
|
@@ -52,10 +52,7 @@ function transformHeaders(headers) {
|
|
|
52
52
|
]);
|
|
53
53
|
return formattedHeaders;
|
|
54
54
|
}
|
|
55
|
-
var serve2 = ({
|
|
56
|
-
routeFunction,
|
|
57
|
-
options
|
|
58
|
-
}) => {
|
|
55
|
+
var serve2 = (routeFunction, options) => {
|
|
59
56
|
const handler = _h3.defineEventHandler.call(void 0, async (event) => {
|
|
60
57
|
const method = event.node.req.method;
|
|
61
58
|
if (_optionalChain([method, 'optionalAccess', _4 => _4.toUpperCase, 'call', _5 => _5()]) !== "POST") {
|
|
@@ -74,14 +71,12 @@ var serve2 = ({
|
|
|
74
71
|
body: await _h3.readRawBody.call(void 0, event),
|
|
75
72
|
method: "POST"
|
|
76
73
|
});
|
|
77
|
-
const serveHandler =
|
|
78
|
-
routeFunction,
|
|
79
|
-
options
|
|
80
|
-
});
|
|
74
|
+
const serveHandler = _chunkMFQHGR5Vjs.serve.call(void 0, routeFunction, options);
|
|
81
75
|
try {
|
|
82
76
|
return await serveHandler(request);
|
|
83
77
|
} catch (error) {
|
|
84
|
-
|
|
78
|
+
console.error(error);
|
|
79
|
+
return new Response(JSON.stringify(_chunkMFQHGR5Vjs.formatWorkflowError.call(void 0, error)), { status: 500 });
|
|
85
80
|
}
|
|
86
81
|
});
|
|
87
82
|
return handler;
|
package/nuxt.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Receiver,
|
|
4
4
|
formatWorkflowError,
|
|
5
5
|
serve
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DH2LYTLA.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/nuxt.ts
|
|
9
9
|
import { defineEventHandler, getHeader, readRawBody } from "h3";
|
|
@@ -52,10 +52,7 @@ function transformHeaders(headers) {
|
|
|
52
52
|
]);
|
|
53
53
|
return formattedHeaders;
|
|
54
54
|
}
|
|
55
|
-
var serve2 = ({
|
|
56
|
-
routeFunction,
|
|
57
|
-
options
|
|
58
|
-
}) => {
|
|
55
|
+
var serve2 = (routeFunction, options) => {
|
|
59
56
|
const handler = defineEventHandler(async (event) => {
|
|
60
57
|
const method = event.node.req.method;
|
|
61
58
|
if (method?.toUpperCase() !== "POST") {
|
|
@@ -74,13 +71,11 @@ var serve2 = ({
|
|
|
74
71
|
body: await readRawBody(event),
|
|
75
72
|
method: "POST"
|
|
76
73
|
});
|
|
77
|
-
const serveHandler = serve(
|
|
78
|
-
routeFunction,
|
|
79
|
-
options
|
|
80
|
-
});
|
|
74
|
+
const serveHandler = serve(routeFunction, options);
|
|
81
75
|
try {
|
|
82
76
|
return await serveHandler(request);
|
|
83
77
|
} catch (error) {
|
|
78
|
+
console.error(error);
|
|
84
79
|
return new Response(JSON.stringify(formatWorkflowError(error)), { status: 500 });
|
|
85
80
|
}
|
|
86
81
|
});
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"v2.6.
|
|
1
|
+
{"version":"v2.6.5-workflow-url-canary","name":"@upstash/qstash","description":"Official Typescript client for QStash","author":"Andreas Thomas <dev@chronark.com>","license":"MIT","homepage":"https://github.com/upstash/sdk-qstash-ts#readme","repository":{"type":"git","url":"git+https://github.com/upstash/sdk-qstash-ts.git"},"bugs":{"url":"https://github.com/upstash/sdk-qstash-ts/issues"},"main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./**"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./nextjs":{"types":"./nextjs.d.ts","import":"./nextjs.mjs","require":"./nextjs.js"},"./dist/nextjs":{"types":"./nextjs.d.ts","import":"./nextjs.mjs","require":"./nextjs.js"},"./nuxt":{"types":"./nuxt.d.ts","import":"./nuxt.mjs","require":"./nuxt.js"},"./svelte":{"types":"./svelte.d.ts","import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"types":"./solidjs.d.ts","import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"types":"./workflow.d.ts","import":"./workflow.mjs","require":"./workflow.js"}},"typesVersions":{"*":{"nextjs":["./nextjs.d.ts"]}},"keywords":["qstash","queue","events","serverless","upstash"],"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test","fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix"},"devDependencies":{"@commitlint/cli":"^19.2.2","@commitlint/config-conventional":"^19.2.2","@types/bun":"^1.1.1","@types/crypto-js":"^4.2.0","@typescript-eslint/eslint-plugin":"^7.0.1","@typescript-eslint/parser":"^7.0.1","ai":"^3.1.28","bun-types":"^1.1.7","eslint":"^8","eslint-plugin-unicorn":"^51.0.1","husky":"^9.0.10","neverthrow":"^7.0.0","next":"^14.0.2","prettier":"^3.2.5","tsup":"latest","typescript":"^5.4.5","undici-types":"^6.16.0","vitest":"latest"},"dependencies":{"@solidjs/start":"^1.0.6","@sveltejs/kit":"^2.5.18","crypto-js":">=4.2.0","h3":"^1.12.0","jose":"^ 5.2.3"}}
|
package/solidjs.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIHandler, APIEvent } from '@solidjs/start/server';
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.mjs';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -8,6 +8,6 @@ type VerifySignatureConfig = {
|
|
|
8
8
|
clockTolerance?: number;
|
|
9
9
|
};
|
|
10
10
|
declare const verifySignatureSolidjs: (handler: APIHandler, config?: VerifySignatureConfig) => APIHandler;
|
|
11
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
11
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => (event: APIEvent) => Promise<Response>;
|
|
12
12
|
|
|
13
13
|
export { serve, verifySignatureSolidjs };
|
package/solidjs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIHandler, APIEvent } from '@solidjs/start/server';
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -8,6 +8,6 @@ type VerifySignatureConfig = {
|
|
|
8
8
|
clockTolerance?: number;
|
|
9
9
|
};
|
|
10
10
|
declare const verifySignatureSolidjs: (handler: APIHandler, config?: VerifySignatureConfig) => APIHandler;
|
|
11
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
11
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => (event: APIEvent) => Promise<Response>;
|
|
12
12
|
|
|
13
13
|
export { serve, verifySignatureSolidjs };
|
package/solidjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkMFQHGR5Vjs = require('./chunk-MFQHGR5V.js');
|
|
7
7
|
|
|
8
8
|
// platforms/solidjs.ts
|
|
9
9
|
var verifySignatureSolidjs = (handler, config) => {
|
|
@@ -15,7 +15,7 @@ var verifySignatureSolidjs = (handler, config) => {
|
|
|
15
15
|
if (!nextSigningKey) {
|
|
16
16
|
throw new Error("nextSigningKey is required, either in the config or from the env");
|
|
17
17
|
}
|
|
18
|
-
const receiver = new (0,
|
|
18
|
+
const receiver = new (0, _chunkMFQHGR5Vjs.Receiver)({
|
|
19
19
|
currentSigningKey,
|
|
20
20
|
nextSigningKey
|
|
21
21
|
});
|
|
@@ -40,24 +40,19 @@ var verifySignatureSolidjs = (handler, config) => {
|
|
|
40
40
|
return handler(event);
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
var serve2 = ({
|
|
44
|
-
routeFunction,
|
|
45
|
-
options
|
|
46
|
-
}) => {
|
|
43
|
+
var serve2 = (routeFunction, options) => {
|
|
47
44
|
const handler = async (event) => {
|
|
48
45
|
const method = event.request.method;
|
|
49
46
|
if (method.toUpperCase() !== "POST") {
|
|
50
47
|
return new Response("Only POST requests are allowed in worklfows", { status: 405 });
|
|
51
48
|
}
|
|
52
|
-
const serveHandler =
|
|
53
|
-
routeFunction,
|
|
54
|
-
options
|
|
55
|
-
});
|
|
49
|
+
const serveHandler = _chunkMFQHGR5Vjs.serve.call(void 0, routeFunction, options);
|
|
56
50
|
try {
|
|
57
51
|
const result = await serveHandler(event.request);
|
|
58
52
|
return result;
|
|
59
53
|
} catch (error) {
|
|
60
|
-
|
|
54
|
+
console.error(error);
|
|
55
|
+
return new Response(JSON.stringify(_chunkMFQHGR5Vjs.formatWorkflowError.call(void 0, error)), { status: 500 });
|
|
61
56
|
}
|
|
62
57
|
};
|
|
63
58
|
return handler;
|
package/solidjs.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Receiver,
|
|
4
4
|
formatWorkflowError,
|
|
5
5
|
serve
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DH2LYTLA.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/solidjs.ts
|
|
9
9
|
var verifySignatureSolidjs = (handler, config) => {
|
|
@@ -40,23 +40,18 @@ var verifySignatureSolidjs = (handler, config) => {
|
|
|
40
40
|
return handler(event);
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
var serve2 = ({
|
|
44
|
-
routeFunction,
|
|
45
|
-
options
|
|
46
|
-
}) => {
|
|
43
|
+
var serve2 = (routeFunction, options) => {
|
|
47
44
|
const handler = async (event) => {
|
|
48
45
|
const method = event.request.method;
|
|
49
46
|
if (method.toUpperCase() !== "POST") {
|
|
50
47
|
return new Response("Only POST requests are allowed in worklfows", { status: 405 });
|
|
51
48
|
}
|
|
52
|
-
const serveHandler = serve(
|
|
53
|
-
routeFunction,
|
|
54
|
-
options
|
|
55
|
-
});
|
|
49
|
+
const serveHandler = serve(routeFunction, options);
|
|
56
50
|
try {
|
|
57
51
|
const result = await serveHandler(event.request);
|
|
58
52
|
return result;
|
|
59
53
|
} catch (error) {
|
|
54
|
+
console.error(error);
|
|
60
55
|
return new Response(JSON.stringify(formatWorkflowError(error)), { status: 500 });
|
|
61
56
|
}
|
|
62
57
|
};
|
package/svelte.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from '@sveltejs/kit';
|
|
2
|
-
import { a0 as
|
|
2
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.mjs';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -8,6 +8,6 @@ type VerifySignatureConfig = {
|
|
|
8
8
|
clockTolerance?: number;
|
|
9
9
|
};
|
|
10
10
|
declare const verifySignatureSvelte: <Parameters extends Partial<Record<string, string>> = Partial<Record<string, string>>, RouteId extends string | null = string | null>(handler: RequestHandler<Parameters, RouteId>, config: VerifySignatureConfig) => RequestHandler<Parameters, RouteId>;
|
|
11
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
11
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, qstashClient: WorkflowServeOptions["qstashClient"], options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish" | "qstashClient">) => RequestHandler;
|
|
12
12
|
|
|
13
13
|
export { serve, verifySignatureSvelte };
|
package/svelte.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestHandler } from '@sveltejs/kit';
|
|
2
|
-
import { a0 as
|
|
2
|
+
import { $ as RouteFunction, a0 as WorkflowServeOptions } from './client-CzkJKX67.js';
|
|
3
3
|
import 'neverthrow';
|
|
4
4
|
|
|
5
5
|
type VerifySignatureConfig = {
|
|
@@ -8,6 +8,6 @@ type VerifySignatureConfig = {
|
|
|
8
8
|
clockTolerance?: number;
|
|
9
9
|
};
|
|
10
10
|
declare const verifySignatureSvelte: <Parameters extends Partial<Record<string, string>> = Partial<Record<string, string>>, RouteId extends string | null = string | null>(handler: RequestHandler<Parameters, RouteId>, config: VerifySignatureConfig) => RequestHandler<Parameters, RouteId>;
|
|
11
|
-
declare const serve: <TInitialPayload = unknown>(
|
|
11
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, qstashClient: WorkflowServeOptions["qstashClient"], options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish" | "qstashClient">) => RequestHandler;
|
|
12
12
|
|
|
13
13
|
export { serve, verifySignatureSvelte };
|
package/svelte.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkMFQHGR5Vjs = require('./chunk-MFQHGR5V.js');
|
|
7
7
|
|
|
8
8
|
// platforms/svelte.ts
|
|
9
9
|
var verifySignatureSvelte = (handler, config) => {
|
|
@@ -15,7 +15,7 @@ var verifySignatureSvelte = (handler, config) => {
|
|
|
15
15
|
if (!nextSigningKey) {
|
|
16
16
|
throw new Error("nextSigningKey is required, either in the config or from the env");
|
|
17
17
|
}
|
|
18
|
-
const receiver = new (0,
|
|
18
|
+
const receiver = new (0, _chunkMFQHGR5Vjs.Receiver)({
|
|
19
19
|
currentSigningKey,
|
|
20
20
|
nextSigningKey
|
|
21
21
|
});
|
|
@@ -41,25 +41,17 @@ var verifySignatureSvelte = (handler, config) => {
|
|
|
41
41
|
};
|
|
42
42
|
return wrappedHandler;
|
|
43
43
|
};
|
|
44
|
-
var serve2 = ({
|
|
45
|
-
routeFunction,
|
|
46
|
-
options,
|
|
47
|
-
receiver,
|
|
48
|
-
qstashClient
|
|
49
|
-
}) => {
|
|
44
|
+
var serve2 = (routeFunction, qstashClient, options) => {
|
|
50
45
|
const handler = async ({ request }) => {
|
|
51
|
-
const serveMethod =
|
|
52
|
-
|
|
53
|
-
options
|
|
54
|
-
qstashClient,
|
|
55
|
-
receiver,
|
|
56
|
-
...options
|
|
57
|
-
}
|
|
46
|
+
const serveMethod = _chunkMFQHGR5Vjs.serve.call(void 0, routeFunction, {
|
|
47
|
+
qstashClient,
|
|
48
|
+
...options
|
|
58
49
|
});
|
|
59
50
|
try {
|
|
60
51
|
return await serveMethod(request);
|
|
61
52
|
} catch (error) {
|
|
62
|
-
|
|
53
|
+
console.error(error);
|
|
54
|
+
return new Response(JSON.stringify(_chunkMFQHGR5Vjs.formatWorkflowError.call(void 0, error)), { status: 500 });
|
|
63
55
|
}
|
|
64
56
|
};
|
|
65
57
|
return handler;
|
package/svelte.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Receiver,
|
|
4
4
|
formatWorkflowError,
|
|
5
5
|
serve
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DH2LYTLA.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/svelte.ts
|
|
9
9
|
var verifySignatureSvelte = (handler, config) => {
|
|
@@ -41,24 +41,16 @@ var verifySignatureSvelte = (handler, config) => {
|
|
|
41
41
|
};
|
|
42
42
|
return wrappedHandler;
|
|
43
43
|
};
|
|
44
|
-
var serve2 = ({
|
|
45
|
-
routeFunction,
|
|
46
|
-
options,
|
|
47
|
-
receiver,
|
|
48
|
-
qstashClient
|
|
49
|
-
}) => {
|
|
44
|
+
var serve2 = (routeFunction, qstashClient, options) => {
|
|
50
45
|
const handler = async ({ request }) => {
|
|
51
|
-
const serveMethod = serve({
|
|
52
|
-
|
|
53
|
-
options
|
|
54
|
-
qstashClient,
|
|
55
|
-
receiver,
|
|
56
|
-
...options
|
|
57
|
-
}
|
|
46
|
+
const serveMethod = serve(routeFunction, {
|
|
47
|
+
qstashClient,
|
|
48
|
+
...options
|
|
58
49
|
});
|
|
59
50
|
try {
|
|
60
51
|
return await serveMethod(request);
|
|
61
52
|
} catch (error) {
|
|
53
|
+
console.error(error);
|
|
62
54
|
return new Response(JSON.stringify(formatWorkflowError(error)), { status: 500 });
|
|
63
55
|
}
|
|
64
56
|
};
|
package/workflow.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { a9 as AsyncStepFunction, a4 as DisabledWorkflowContext, F as FailureFunctionPayload,
|
|
1
|
+
export { a9 as AsyncStepFunction, a4 as DisabledWorkflowContext, F as FailureFunctionPayload, ac as FinishCondition, ae as LogLevel, ab as ParallelCallState, a7 as RawStep, ad as RequiredExceptFields, $ as RouteFunction, S as Step, aa as StepFunction, a6 as StepType, a5 as StepTypes, a8 as SyncStepFunction, a1 as Workflow, a3 as WorkflowContext, ag as WorkflowLogger, af as WorkflowLoggerOptions, a0 as WorkflowServeOptions, a2 as serve } from './client-CzkJKX67.mjs';
|
|
2
2
|
import 'neverthrow';
|
package/workflow.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { a9 as AsyncStepFunction, a4 as DisabledWorkflowContext, F as FailureFunctionPayload,
|
|
1
|
+
export { a9 as AsyncStepFunction, a4 as DisabledWorkflowContext, F as FailureFunctionPayload, ac as FinishCondition, ae as LogLevel, ab as ParallelCallState, a7 as RawStep, ad as RequiredExceptFields, $ as RouteFunction, S as Step, aa as StepFunction, a6 as StepType, a5 as StepTypes, a8 as SyncStepFunction, a1 as Workflow, a3 as WorkflowContext, ag as WorkflowLogger, af as WorkflowLoggerOptions, a0 as WorkflowServeOptions, a2 as serve } from './client-CzkJKX67.js';
|
|
2
2
|
import 'neverthrow';
|
package/workflow.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkMFQHGR5Vjs = require('./chunk-MFQHGR5V.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,4 +13,4 @@ var _chunk5DADTJQLjs = require('./chunk-5DADTJQL.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.DisabledWorkflowContext =
|
|
16
|
+
exports.DisabledWorkflowContext = _chunkMFQHGR5Vjs.DisabledWorkflowContext; exports.StepTypes = _chunkMFQHGR5Vjs.StepTypes; exports.Workflow = _chunkMFQHGR5Vjs.Workflow; exports.WorkflowContext = _chunkMFQHGR5Vjs.WorkflowContext; exports.WorkflowLogger = _chunkMFQHGR5Vjs.WorkflowLogger; exports.serve = _chunkMFQHGR5Vjs.serve;
|