@upstash/qstash 2.7.10 → 2.8.0-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-HIWMJGFU.mjs → dist/chunk-KWSSCN6R.mjs} +39 -20
- package/{chunk-O2RN672L.mjs → dist/chunk-XLCNEVA2.mjs} +1 -1
- package/{client-orcgOcAm.d.mts → dist/client-DkrYCqaq.d.mts} +26 -17
- package/{client-orcgOcAm.d.ts → dist/client-DkrYCqaq.d.ts} +26 -17
- package/{cloudflare.d.mts → dist/cloudflare.d.mts} +1 -1
- package/{cloudflare.d.ts → dist/cloudflare.d.ts} +1 -1
- package/{chunk-KZOQ64Z6.js → dist/cloudflare.js} +265 -255
- package/{cloudflare.mjs → dist/cloudflare.mjs} +1 -1
- package/{h3.d.mts → dist/h3.d.mts} +1 -1
- package/{h3.d.ts → dist/h3.d.ts} +1 -1
- package/dist/h3.js +3338 -0
- package/{h3.mjs → dist/h3.mjs} +2 -2
- package/{hono.d.mts → dist/hono.d.mts} +1 -1
- package/{hono.d.ts → dist/hono.d.ts} +1 -1
- package/dist/hono.js +2958 -0
- package/{hono.mjs → dist/hono.mjs} +1 -1
- package/{index.d.mts → dist/index.d.mts} +2 -2
- package/{index.d.ts → dist/index.d.ts} +2 -2
- package/dist/index.js +1639 -0
- package/{index.mjs → dist/index.mjs} +1 -1
- package/{nextjs.d.mts → dist/nextjs.d.mts} +1 -1
- package/{nextjs.d.ts → dist/nextjs.d.ts} +1 -1
- package/dist/nextjs.js +4742 -0
- package/dist/nextjs.mjs +1802 -0
- package/dist/nuxt.js +832 -0
- package/{nuxt.mjs → dist/nuxt.mjs} +2 -2
- package/{solidjs.d.mts → dist/solidjs.d.mts} +1 -1
- package/{solidjs.d.ts → dist/solidjs.d.ts} +1 -1
- package/dist/solidjs.js +2991 -0
- package/{solidjs.mjs → dist/solidjs.mjs} +1 -1
- package/{svelte.d.mts → dist/svelte.d.mts} +1 -1
- package/{svelte.d.ts → dist/svelte.d.ts} +1 -1
- package/dist/svelte.js +2988 -0
- package/{svelte.mjs → dist/svelte.mjs} +1 -1
- package/{workflow.d.mts → dist/workflow.d.mts} +1 -1
- package/{workflow.d.ts → dist/workflow.d.ts} +1 -1
- package/dist/workflow.js +2954 -0
- package/{workflow.mjs → dist/workflow.mjs} +1 -1
- package/package.json +1 -1
- package/chunk-Q6JW7JKT.js +0 -403
- package/chunk-VN7YQ2UN.js +0 -1
- package/cloudflare.js +0 -37
- package/h3.js +0 -10
- package/hono.js +0 -22
- package/index.js +0 -43
- package/nextjs.js +0 -178
- package/nextjs.mjs +0 -178
- package/nuxt.js +0 -11
- package/solidjs.js +0 -56
- package/svelte.js +0 -53
- package/workflow.js +0 -18
- /package/{chunk-CIVGPRQN.mjs → dist/chunk-CIVGPRQN.mjs} +0 -0
- /package/{nuxt.d.mts → dist/nuxt.d.mts} +0 -0
- /package/{nuxt.d.ts → dist/nuxt.d.ts} +0 -0
package/nextjs.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkKZOQ64Z6js = require('./chunk-KZOQ64Z6.js');
|
|
5
|
-
|
|
6
|
-
// platforms/nextjs.ts
|
|
7
|
-
var _server = require('next/server');
|
|
8
|
-
var BAD_REQUEST = 400;
|
|
9
|
-
function verifySignature(handler, config) {
|
|
10
|
-
const currentSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.currentSigningKey]), () => ( process.env.QSTASH_CURRENT_SIGNING_KEY));
|
|
11
|
-
if (!currentSigningKey) {
|
|
12
|
-
throw new Error(
|
|
13
|
-
"currentSigningKey is required, either in the config or as env variable QSTASH_CURRENT_SIGNING_KEY"
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
const nextSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _2 => _2.nextSigningKey]), () => ( process.env.QSTASH_NEXT_SIGNING_KEY));
|
|
17
|
-
if (!nextSigningKey) {
|
|
18
|
-
throw new Error(
|
|
19
|
-
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
const receiver = new (0, _chunkKZOQ64Z6js.Receiver)({
|
|
23
|
-
currentSigningKey,
|
|
24
|
-
nextSigningKey
|
|
25
|
-
});
|
|
26
|
-
return async (request, response) => {
|
|
27
|
-
const signature = request.headers["upstash-signature"];
|
|
28
|
-
if (!signature) {
|
|
29
|
-
response.status(BAD_REQUEST);
|
|
30
|
-
response.send("`Upstash-Signature` header is missing");
|
|
31
|
-
response.end();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (typeof signature !== "string") {
|
|
35
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
36
|
-
}
|
|
37
|
-
const chunks = [];
|
|
38
|
-
for await (const chunk of request) {
|
|
39
|
-
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
40
|
-
}
|
|
41
|
-
const body = Buffer.concat(chunks).toString("utf8");
|
|
42
|
-
const isValid = await receiver.verify({
|
|
43
|
-
signature,
|
|
44
|
-
body,
|
|
45
|
-
clockTolerance: _optionalChain([config, 'optionalAccess', _3 => _3.clockTolerance])
|
|
46
|
-
});
|
|
47
|
-
if (!isValid) {
|
|
48
|
-
response.status(BAD_REQUEST);
|
|
49
|
-
response.send("Invalid signature");
|
|
50
|
-
response.end();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
request.body = request.headers["content-type"] === "application/json" ? JSON.parse(body) : body;
|
|
55
|
-
} catch (e) {
|
|
56
|
-
request.body = body;
|
|
57
|
-
}
|
|
58
|
-
return handler(request, response);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function verifySignatureEdge(handler, config) {
|
|
62
|
-
const currentSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _4 => _4.currentSigningKey]), () => ( process.env.QSTASH_CURRENT_SIGNING_KEY));
|
|
63
|
-
if (!currentSigningKey) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
"currentSigningKey is required, either in the config or as env variable QSTASH_CURRENT_SIGNING_KEY"
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
const nextSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _5 => _5.nextSigningKey]), () => ( process.env.QSTASH_NEXT_SIGNING_KEY));
|
|
69
|
-
if (!nextSigningKey) {
|
|
70
|
-
throw new Error(
|
|
71
|
-
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
const receiver = new (0, _chunkKZOQ64Z6js.Receiver)({
|
|
75
|
-
currentSigningKey,
|
|
76
|
-
nextSigningKey
|
|
77
|
-
});
|
|
78
|
-
return async (request, nfe) => {
|
|
79
|
-
const requestClone = request.clone();
|
|
80
|
-
const signature = request.headers.get("upstash-signature");
|
|
81
|
-
if (!signature) {
|
|
82
|
-
return new (0, _server.NextResponse)(new TextEncoder().encode("`Upstash-Signature` header is missing"), {
|
|
83
|
-
status: 403
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (typeof signature !== "string") {
|
|
87
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
88
|
-
}
|
|
89
|
-
const body = await requestClone.text();
|
|
90
|
-
const isValid = await receiver.verify({
|
|
91
|
-
signature,
|
|
92
|
-
body,
|
|
93
|
-
clockTolerance: _optionalChain([config, 'optionalAccess', _6 => _6.clockTolerance])
|
|
94
|
-
});
|
|
95
|
-
if (!isValid) {
|
|
96
|
-
return new (0, _server.NextResponse)(new TextEncoder().encode("invalid signature"), { status: 403 });
|
|
97
|
-
}
|
|
98
|
-
return handler(request, nfe);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function verifySignatureAppRouter(handler, config) {
|
|
102
|
-
const currentSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _7 => _7.currentSigningKey]), () => ( process.env.QSTASH_CURRENT_SIGNING_KEY));
|
|
103
|
-
if (!currentSigningKey) {
|
|
104
|
-
throw new Error(
|
|
105
|
-
"currentSigningKey is required, either in the config or as env variable QSTASH_CURRENT_SIGNING_KEY"
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
const nextSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _8 => _8.nextSigningKey]), () => ( process.env.QSTASH_NEXT_SIGNING_KEY));
|
|
109
|
-
if (!nextSigningKey) {
|
|
110
|
-
throw new Error(
|
|
111
|
-
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
const receiver = new (0, _chunkKZOQ64Z6js.Receiver)({
|
|
115
|
-
currentSigningKey,
|
|
116
|
-
nextSigningKey
|
|
117
|
-
});
|
|
118
|
-
return async (request, params) => {
|
|
119
|
-
const requestClone = request.clone();
|
|
120
|
-
const signature = request.headers.get("upstash-signature");
|
|
121
|
-
if (!signature) {
|
|
122
|
-
return new (0, _server.NextResponse)(new TextEncoder().encode("`Upstash-Signature` header is missing"), {
|
|
123
|
-
status: 403
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
if (typeof signature !== "string") {
|
|
127
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
128
|
-
}
|
|
129
|
-
const body = await requestClone.text();
|
|
130
|
-
const isValid = await receiver.verify({
|
|
131
|
-
signature,
|
|
132
|
-
body,
|
|
133
|
-
clockTolerance: _optionalChain([config, 'optionalAccess', _9 => _9.clockTolerance])
|
|
134
|
-
});
|
|
135
|
-
if (!isValid) {
|
|
136
|
-
return new (0, _server.NextResponse)(new TextEncoder().encode("invalid signature"), { status: 403 });
|
|
137
|
-
}
|
|
138
|
-
return handler(request, params);
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
var serve2 = (routeFunction, options) => {
|
|
142
|
-
const handler = _chunkKZOQ64Z6js.serve.call(void 0, routeFunction, {
|
|
143
|
-
onStepFinish: (workflowRunId) => new (0, _server.NextResponse)(JSON.stringify({ workflowRunId }), { status: 200 }),
|
|
144
|
-
...options
|
|
145
|
-
});
|
|
146
|
-
return async (request) => {
|
|
147
|
-
return await handler(request);
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
var servePagesRouter = (routeFunction, options) => {
|
|
151
|
-
const handler = _chunkKZOQ64Z6js.serve.call(void 0, routeFunction, options);
|
|
152
|
-
return async (req, res) => {
|
|
153
|
-
if (_optionalChain([req, 'access', _10 => _10.method, 'optionalAccess', _11 => _11.toUpperCase, 'call', _12 => _12()]) !== "POST") {
|
|
154
|
-
res.status(405).json("Only POST requests are allowed in worklfows");
|
|
155
|
-
return;
|
|
156
|
-
} else if (!req.url) {
|
|
157
|
-
res.status(400).json("url not found in the request");
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const protocol = req.headers["x-forwarded-proto"];
|
|
161
|
-
const baseUrl = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _13 => _13.baseUrl]), () => ( `${protocol}://${req.headers.host}`));
|
|
162
|
-
const request = new Request(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _14 => _14.url]), () => ( `${baseUrl}${req.url}`)), {
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
164
|
-
body: _nullishCoalesce(JSON.stringify(req.body), () => ( "")),
|
|
165
|
-
headers: new Headers(req.headersDistinct),
|
|
166
|
-
method: "POST"
|
|
167
|
-
});
|
|
168
|
-
const response = await handler(request);
|
|
169
|
-
res.status(response.status).json(await response.json());
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
exports.serve = serve2; exports.servePagesRouter = servePagesRouter; exports.verifySignature = verifySignature; exports.verifySignatureAppRouter = verifySignatureAppRouter; exports.verifySignatureEdge = verifySignatureEdge;
|
package/nextjs.mjs
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Receiver,
|
|
3
|
-
serve
|
|
4
|
-
} from "./chunk-HIWMJGFU.mjs";
|
|
5
|
-
|
|
6
|
-
// platforms/nextjs.ts
|
|
7
|
-
import { NextResponse } from "next/server";
|
|
8
|
-
var BAD_REQUEST = 400;
|
|
9
|
-
function verifySignature(handler, config) {
|
|
10
|
-
const currentSigningKey = config?.currentSigningKey ?? process.env.QSTASH_CURRENT_SIGNING_KEY;
|
|
11
|
-
if (!currentSigningKey) {
|
|
12
|
-
throw new Error(
|
|
13
|
-
"currentSigningKey is required, either in the config or as env variable QSTASH_CURRENT_SIGNING_KEY"
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
const nextSigningKey = config?.nextSigningKey ?? process.env.QSTASH_NEXT_SIGNING_KEY;
|
|
17
|
-
if (!nextSigningKey) {
|
|
18
|
-
throw new Error(
|
|
19
|
-
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
const receiver = new Receiver({
|
|
23
|
-
currentSigningKey,
|
|
24
|
-
nextSigningKey
|
|
25
|
-
});
|
|
26
|
-
return async (request, response) => {
|
|
27
|
-
const signature = request.headers["upstash-signature"];
|
|
28
|
-
if (!signature) {
|
|
29
|
-
response.status(BAD_REQUEST);
|
|
30
|
-
response.send("`Upstash-Signature` header is missing");
|
|
31
|
-
response.end();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (typeof signature !== "string") {
|
|
35
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
36
|
-
}
|
|
37
|
-
const chunks = [];
|
|
38
|
-
for await (const chunk of request) {
|
|
39
|
-
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
40
|
-
}
|
|
41
|
-
const body = Buffer.concat(chunks).toString("utf8");
|
|
42
|
-
const isValid = await receiver.verify({
|
|
43
|
-
signature,
|
|
44
|
-
body,
|
|
45
|
-
clockTolerance: config?.clockTolerance
|
|
46
|
-
});
|
|
47
|
-
if (!isValid) {
|
|
48
|
-
response.status(BAD_REQUEST);
|
|
49
|
-
response.send("Invalid signature");
|
|
50
|
-
response.end();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
request.body = request.headers["content-type"] === "application/json" ? JSON.parse(body) : body;
|
|
55
|
-
} catch {
|
|
56
|
-
request.body = body;
|
|
57
|
-
}
|
|
58
|
-
return handler(request, response);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function verifySignatureEdge(handler, config) {
|
|
62
|
-
const currentSigningKey = config?.currentSigningKey ?? process.env.QSTASH_CURRENT_SIGNING_KEY;
|
|
63
|
-
if (!currentSigningKey) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
"currentSigningKey is required, either in the config or as env variable QSTASH_CURRENT_SIGNING_KEY"
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
const nextSigningKey = config?.nextSigningKey ?? process.env.QSTASH_NEXT_SIGNING_KEY;
|
|
69
|
-
if (!nextSigningKey) {
|
|
70
|
-
throw new Error(
|
|
71
|
-
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
const receiver = new Receiver({
|
|
75
|
-
currentSigningKey,
|
|
76
|
-
nextSigningKey
|
|
77
|
-
});
|
|
78
|
-
return async (request, nfe) => {
|
|
79
|
-
const requestClone = request.clone();
|
|
80
|
-
const signature = request.headers.get("upstash-signature");
|
|
81
|
-
if (!signature) {
|
|
82
|
-
return new NextResponse(new TextEncoder().encode("`Upstash-Signature` header is missing"), {
|
|
83
|
-
status: 403
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (typeof signature !== "string") {
|
|
87
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
88
|
-
}
|
|
89
|
-
const body = await requestClone.text();
|
|
90
|
-
const isValid = await receiver.verify({
|
|
91
|
-
signature,
|
|
92
|
-
body,
|
|
93
|
-
clockTolerance: config?.clockTolerance
|
|
94
|
-
});
|
|
95
|
-
if (!isValid) {
|
|
96
|
-
return new NextResponse(new TextEncoder().encode("invalid signature"), { status: 403 });
|
|
97
|
-
}
|
|
98
|
-
return handler(request, nfe);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function verifySignatureAppRouter(handler, config) {
|
|
102
|
-
const currentSigningKey = config?.currentSigningKey ?? process.env.QSTASH_CURRENT_SIGNING_KEY;
|
|
103
|
-
if (!currentSigningKey) {
|
|
104
|
-
throw new Error(
|
|
105
|
-
"currentSigningKey is required, either in the config or as env variable QSTASH_CURRENT_SIGNING_KEY"
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
const nextSigningKey = config?.nextSigningKey ?? process.env.QSTASH_NEXT_SIGNING_KEY;
|
|
109
|
-
if (!nextSigningKey) {
|
|
110
|
-
throw new Error(
|
|
111
|
-
"nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
const receiver = new Receiver({
|
|
115
|
-
currentSigningKey,
|
|
116
|
-
nextSigningKey
|
|
117
|
-
});
|
|
118
|
-
return async (request, params) => {
|
|
119
|
-
const requestClone = request.clone();
|
|
120
|
-
const signature = request.headers.get("upstash-signature");
|
|
121
|
-
if (!signature) {
|
|
122
|
-
return new NextResponse(new TextEncoder().encode("`Upstash-Signature` header is missing"), {
|
|
123
|
-
status: 403
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
if (typeof signature !== "string") {
|
|
127
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
128
|
-
}
|
|
129
|
-
const body = await requestClone.text();
|
|
130
|
-
const isValid = await receiver.verify({
|
|
131
|
-
signature,
|
|
132
|
-
body,
|
|
133
|
-
clockTolerance: config?.clockTolerance
|
|
134
|
-
});
|
|
135
|
-
if (!isValid) {
|
|
136
|
-
return new NextResponse(new TextEncoder().encode("invalid signature"), { status: 403 });
|
|
137
|
-
}
|
|
138
|
-
return handler(request, params);
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
var serve2 = (routeFunction, options) => {
|
|
142
|
-
const handler = serve(routeFunction, {
|
|
143
|
-
onStepFinish: (workflowRunId) => new NextResponse(JSON.stringify({ workflowRunId }), { status: 200 }),
|
|
144
|
-
...options
|
|
145
|
-
});
|
|
146
|
-
return async (request) => {
|
|
147
|
-
return await handler(request);
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
var servePagesRouter = (routeFunction, options) => {
|
|
151
|
-
const handler = serve(routeFunction, options);
|
|
152
|
-
return async (req, res) => {
|
|
153
|
-
if (req.method?.toUpperCase() !== "POST") {
|
|
154
|
-
res.status(405).json("Only POST requests are allowed in worklfows");
|
|
155
|
-
return;
|
|
156
|
-
} else if (!req.url) {
|
|
157
|
-
res.status(400).json("url not found in the request");
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const protocol = req.headers["x-forwarded-proto"];
|
|
161
|
-
const baseUrl = options?.baseUrl ?? `${protocol}://${req.headers.host}`;
|
|
162
|
-
const request = new Request(options?.url ?? `${baseUrl}${req.url}`, {
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
164
|
-
body: JSON.stringify(req.body) ?? "",
|
|
165
|
-
headers: new Headers(req.headersDistinct),
|
|
166
|
-
method: "POST"
|
|
167
|
-
});
|
|
168
|
-
const response = await handler(request);
|
|
169
|
-
res.status(response.status).json(await response.json());
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
export {
|
|
173
|
-
serve2 as serve,
|
|
174
|
-
servePagesRouter,
|
|
175
|
-
verifySignature,
|
|
176
|
-
verifySignatureAppRouter,
|
|
177
|
-
verifySignatureEdge
|
|
178
|
-
};
|
package/nuxt.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkQ6JW7JKTjs = require('./chunk-Q6JW7JKT.js');
|
|
4
|
-
require('./chunk-VN7YQ2UN.js');
|
|
5
|
-
require('./chunk-KZOQ64Z6.js');
|
|
6
|
-
|
|
7
|
-
// platforms/nuxt.ts
|
|
8
|
-
var verifySignatureNuxt = _chunkQ6JW7JKTjs.verifySignatureH3;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.verifySignatureNuxt = verifySignatureNuxt;
|
package/solidjs.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-VN7YQ2UN.js');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkKZOQ64Z6js = require('./chunk-KZOQ64Z6.js');
|
|
6
|
-
|
|
7
|
-
// platforms/solidjs.ts
|
|
8
|
-
var verifySignatureSolidjs = (handler, config) => {
|
|
9
|
-
const currentSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.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
|
-
const nextSigningKey = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _2 => _2.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");
|
|
16
|
-
}
|
|
17
|
-
const receiver = new (0, _chunkKZOQ64Z6js.Receiver)({
|
|
18
|
-
currentSigningKey,
|
|
19
|
-
nextSigningKey
|
|
20
|
-
});
|
|
21
|
-
return async (event) => {
|
|
22
|
-
const signature = event.request.headers.get("upstash-signature");
|
|
23
|
-
if (!signature) {
|
|
24
|
-
return new Response("`Upstash-Signature` header is missing", { status: 403 });
|
|
25
|
-
}
|
|
26
|
-
if (typeof signature !== "string") {
|
|
27
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
28
|
-
}
|
|
29
|
-
const cloneRequest = event.request.clone();
|
|
30
|
-
const body = await cloneRequest.text();
|
|
31
|
-
const isValid = await receiver.verify({
|
|
32
|
-
signature,
|
|
33
|
-
body,
|
|
34
|
-
clockTolerance: _optionalChain([config, 'optionalAccess', _3 => _3.clockTolerance])
|
|
35
|
-
});
|
|
36
|
-
if (!isValid) {
|
|
37
|
-
return new Response("invalid signature", { status: 403 });
|
|
38
|
-
}
|
|
39
|
-
return handler(event);
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
var serve2 = (routeFunction, options) => {
|
|
43
|
-
const handler = async (event) => {
|
|
44
|
-
const method = event.request.method;
|
|
45
|
-
if (method.toUpperCase() !== "POST") {
|
|
46
|
-
return new Response("Only POST requests are allowed in worklfows", { status: 405 });
|
|
47
|
-
}
|
|
48
|
-
const serveHandler = _chunkKZOQ64Z6js.serve.call(void 0, routeFunction, options);
|
|
49
|
-
return await serveHandler(event.request);
|
|
50
|
-
};
|
|
51
|
-
return handler;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
exports.serve = serve2; exports.verifySignatureSolidjs = verifySignatureSolidjs;
|
package/svelte.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-VN7YQ2UN.js');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkKZOQ64Z6js = require('./chunk-KZOQ64Z6.js');
|
|
6
|
-
|
|
7
|
-
// platforms/svelte.ts
|
|
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");
|
|
16
|
-
}
|
|
17
|
-
const receiver = new (0, _chunkKZOQ64Z6js.Receiver)({
|
|
18
|
-
currentSigningKey,
|
|
19
|
-
nextSigningKey
|
|
20
|
-
});
|
|
21
|
-
const wrappedHandler = async (event) => {
|
|
22
|
-
const signature = event.request.headers.get("upstash-signature");
|
|
23
|
-
if (!signature) {
|
|
24
|
-
return new Response("`Upstash-Signature` header is missing", { status: 403 });
|
|
25
|
-
}
|
|
26
|
-
if (typeof signature !== "string") {
|
|
27
|
-
throw new TypeError("`Upstash-Signature` header is not a string");
|
|
28
|
-
}
|
|
29
|
-
const cloneRequest = event.request.clone();
|
|
30
|
-
const body = await cloneRequest.text();
|
|
31
|
-
const isValid = await receiver.verify({
|
|
32
|
-
signature,
|
|
33
|
-
body,
|
|
34
|
-
clockTolerance: config.clockTolerance
|
|
35
|
-
});
|
|
36
|
-
if (!isValid) {
|
|
37
|
-
return new Response("invalid signature", { status: 403 });
|
|
38
|
-
}
|
|
39
|
-
return handler(event);
|
|
40
|
-
};
|
|
41
|
-
return wrappedHandler;
|
|
42
|
-
};
|
|
43
|
-
var serve2 = (routeFunction, options) => {
|
|
44
|
-
const handler = async ({ request }) => {
|
|
45
|
-
const serveMethod = _chunkKZOQ64Z6js.serve.call(void 0, routeFunction, options);
|
|
46
|
-
return await serveMethod(request);
|
|
47
|
-
};
|
|
48
|
-
return handler;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
exports.serve = serve2; exports.verifySignatureSvelte = verifySignatureSvelte;
|
package/workflow.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkKZOQ64Z6js = require('./chunk-KZOQ64Z6.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.DisabledWorkflowContext = _chunkKZOQ64Z6js.DisabledWorkflowContext; exports.StepTypes = _chunkKZOQ64Z6js.StepTypes; exports.Workflow = _chunkKZOQ64Z6js.Workflow; exports.WorkflowContext = _chunkKZOQ64Z6js.WorkflowContext; exports.WorkflowLogger = _chunkKZOQ64Z6js.WorkflowLogger; exports.processOptions = _chunkKZOQ64Z6js.processOptions; exports.serve = _chunkKZOQ64Z6js.serve;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|