@upstash/qstash 2.8.4 → 2.9.0-rc

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/svelte.mjs CHANGED
@@ -1,18 +1,17 @@
1
- import "./chunk-5PQP3YLP.mjs";
1
+ import "./chunk-NU64UBMT.mjs";
2
2
  import {
3
3
  Receiver,
4
4
  serve
5
- } from "./chunk-RQPZUJXG.mjs";
5
+ } from "./chunk-WOMVRJIB.mjs";
6
6
 
7
7
  // platforms/svelte.ts
8
8
  var verifySignatureSvelte = (handler, config) => {
9
- const currentSigningKey = config.currentSigningKey;
10
- if (!currentSigningKey) {
11
- throw new Error("currentSigningKey is required, either in the config or from the env");
12
- }
13
- const nextSigningKey = config.nextSigningKey;
14
- if (!nextSigningKey) {
15
- throw new Error("nextSigningKey is required, either in the config or from the env");
9
+ const currentSigningKey = config?.currentSigningKey ?? process.env.QSTASH_CURRENT_SIGNING_KEY;
10
+ const nextSigningKey = config?.nextSigningKey ?? process.env.QSTASH_NEXT_SIGNING_KEY;
11
+ if (!currentSigningKey && !nextSigningKey && !process.env.QSTASH_REGION) {
12
+ throw new Error(
13
+ "currentSigningKey and nextSigningKey are required, either in the config or as env variables (QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY)"
14
+ );
16
15
  }
17
16
  const receiver = new Receiver({
18
17
  currentSigningKey,
@@ -26,12 +25,14 @@ var verifySignatureSvelte = (handler, config) => {
26
25
  if (typeof signature !== "string") {
27
26
  throw new TypeError("`Upstash-Signature` header is not a string");
28
27
  }
28
+ const upstashRegion = event.request.headers.get("upstash-region");
29
29
  const cloneRequest = event.request.clone();
30
30
  const body = await cloneRequest.text();
31
31
  const isValid = await receiver.verify({
32
32
  signature,
33
33
  body,
34
- clockTolerance: config.clockTolerance
34
+ clockTolerance: config?.clockTolerance,
35
+ upstashRegion: upstashRegion ?? void 0
35
36
  });
36
37
  if (!isValid) {
37
38
  return new Response("invalid signature", { status: 403 });
package/workflow.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export { am as AsyncStepFunction, af as DisabledWorkflowContext, F as FailureFunctionPayload, ap as FinishCondition, ar as LogLevel, ao as ParallelCallState, ak as RawStep, aq as RequiredExceptFields, a9 as RouteFunction, S as Step, an as StepFunction, aj as StepType, ai as StepTypes, al as SyncStepFunction, ab as Workflow, ag as WorkflowClient, ae as WorkflowContext, at as WorkflowLogger, as as WorkflowLoggerOptions, ah as WorkflowReceiver, aa as WorkflowServeOptions, ac as processOptions, ad as serve } from './client-DKNfczbM.mjs';
1
+ export { am as AsyncStepFunction, af as DisabledWorkflowContext, F as FailureFunctionPayload, ap as FinishCondition, ar as LogLevel, ao as ParallelCallState, ak as RawStep, aq as RequiredExceptFields, a9 as RouteFunction, S as Step, an as StepFunction, aj as StepType, ai as StepTypes, al as SyncStepFunction, ab as Workflow, ag as WorkflowClient, ae as WorkflowContext, at as WorkflowLogger, as as WorkflowLoggerOptions, ah as WorkflowReceiver, aa as WorkflowServeOptions, ac as processOptions, ad as serve } from './client-BVG9vt90.mjs';
2
2
  import 'neverthrow';
package/workflow.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { am as AsyncStepFunction, af as DisabledWorkflowContext, F as FailureFunctionPayload, ap as FinishCondition, ar as LogLevel, ao as ParallelCallState, ak as RawStep, aq as RequiredExceptFields, a9 as RouteFunction, S as Step, an as StepFunction, aj as StepType, ai as StepTypes, al as SyncStepFunction, ab as Workflow, ag as WorkflowClient, ae as WorkflowContext, at as WorkflowLogger, as as WorkflowLoggerOptions, ah as WorkflowReceiver, aa as WorkflowServeOptions, ac as processOptions, ad as serve } from './client-DKNfczbM.js';
1
+ export { am as AsyncStepFunction, af as DisabledWorkflowContext, F as FailureFunctionPayload, ap as FinishCondition, ar as LogLevel, ao as ParallelCallState, ak as RawStep, aq as RequiredExceptFields, a9 as RouteFunction, S as Step, an as StepFunction, aj as StepType, ai as StepTypes, al as SyncStepFunction, ab as Workflow, ag as WorkflowClient, ae as WorkflowContext, at as WorkflowLogger, as as WorkflowLoggerOptions, ah as WorkflowReceiver, aa as WorkflowServeOptions, ac as processOptions, ad as serve } from './client-BVG9vt90.js';
2
2
  import 'neverthrow';