@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/solidjs.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/solidjs.ts
8
8
  var verifySignatureSolidjs = (handler, config) => {
9
9
  const currentSigningKey = config?.currentSigningKey ?? process.env.QSTASH_CURRENT_SIGNING_KEY;
10
- if (!currentSigningKey) {
11
- throw new Error("currentSigningKey is required, either in the config or from the env");
12
- }
13
10
  const nextSigningKey = config?.nextSigningKey ?? process.env.QSTASH_NEXT_SIGNING_KEY;
14
- if (!nextSigningKey) {
15
- throw new Error("nextSigningKey is required, either in the config or from the env");
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 verifySignatureSolidjs = (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/svelte.d.mts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
2
- import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-DKNfczbM.mjs';
2
+ import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-BVG9vt90.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
6
- currentSigningKey: string;
7
- nextSigningKey: string;
6
+ currentSigningKey?: string;
7
+ nextSigningKey?: string;
8
8
  clockTolerance?: number;
9
9
  };
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>;
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
11
  /**
12
12
  * Serve method to serve a Upstash Workflow in a Nextjs project
13
13
  *
package/svelte.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
2
- import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-DKNfczbM.js';
2
+ import { a9 as RouteFunction, aa as WorkflowServeOptions } from './client-BVG9vt90.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
6
- currentSigningKey: string;
7
- nextSigningKey: string;
6
+ currentSigningKey?: string;
7
+ nextSigningKey?: string;
8
8
  clockTolerance?: number;
9
9
  };
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>;
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
11
  /**
12
12
  * Serve method to serve a Upstash Workflow in a Nextjs project
13
13
  *