@vite-hub/queue 0.4.1 → 0.5.1
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/README.md +2 -2
- package/dist/{client-B53_G4ky.js → client-CwoCdKct.js} +9 -12
- package/dist/{cloudflare-GosJefIK.js → cloudflare-BMc35cBD.js} +2 -4
- package/dist/{cloudflare-client-CoISDpIx.js → cloudflare-client-xWteD-su.js} +7 -10
- package/dist/{cloudflare-resource-name-BIfBglC2.js → cloudflare-resource-name-Bv8Z7nDU.js} +3 -4
- package/dist/{config-B2eaXaT5.js → config-Bzp1xmdh.js} +4 -9
- package/dist/definition-CIiFfst2.js +26 -0
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{duration-tujyhAKt.js → duration-C5w_-Rf4.js} +14 -9
- package/dist/{error-diagnostics-mJXBjmQx.js → error-diagnostics-Dv6nKZQW.js} +9 -6
- package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-kKXseq8d.js} +10 -3
- package/dist/{handler-response-B6lz9nCn.js → handler-response-CchTXVjm.js} +10 -7
- package/dist/index.d.ts +1 -9
- package/dist/index.js +5 -24
- package/dist/{inspect-PeuckaC3.js → inspect-CwdWUhPj.js} +1 -2
- package/dist/internal/runtime/cloudflare-client.d.ts +2 -4
- package/dist/internal/runtime/cloudflare-client.js +1 -2
- package/dist/internal/runtime/cloudflare-vite.d.ts +2 -9
- package/dist/internal/runtime/cloudflare-vite.js +13 -16
- package/dist/internal/runtime/local-client.d.ts +4 -6
- package/dist/internal/runtime/local-client.js +5 -6
- package/dist/internal/runtime/postgres-client.d.ts +6 -8
- package/dist/internal/runtime/postgres-client.js +18 -13
- package/dist/internal/runtime/state.d.ts +3 -5
- package/dist/internal/runtime/state.js +1 -2
- package/dist/internal/runtime/vercel-client.d.ts +2 -4
- package/dist/internal/runtime/vercel-client.js +5 -8
- package/dist/internal/runtime/worker-client.d.ts +3 -5
- package/dist/internal/runtime/worker-client.js +2 -3
- package/dist/{invariant-D8_xBqmZ.js → invariant-CmdvZ3vp.js} +1 -2
- package/dist/{local-CUaWoRUx.d.ts → local-B72WRWkS.d.ts} +1 -3
- package/dist/{local-Di0FrVUw.js → local-RX10a_Sq.js} +26 -21
- package/dist/{object-D8pRdprI.js → object-DRSmpe04.js} +1 -2
- package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
- package/dist/{operations-BVV-9Q0N.js → operations-CoEXxfUW.js} +7 -14
- package/dist/operations.d.ts +3 -7
- package/dist/operations.js +10 -16
- package/dist/runtime/hosted.d.ts +2 -4
- package/dist/runtime/hosted.js +4 -5
- package/dist/scan-module-BaqBao0J.js +309 -0
- package/dist/{state-DLqTqF6V.js → state-DqxeV11k.js} +5 -8
- package/dist/{types-Dsbb_Pvp.d.ts → types-BevEYrUV.d.ts} +1 -4
- package/dist/{types-CiuSIPR0.d.ts → types-BzPGPV9z.d.ts} +8 -4
- package/dist/{vercel-region-B95MAMXN.js → vercel-region-DEsR1YJQ.js} +2 -3
- package/dist/{vercel-C_4vqxcl.js → vercel-sUJOxFBB.js} +2 -3
- package/dist/vite.d.ts +8 -30
- package/dist/vite.js +148 -139
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ The server logs the directory and this durability once when it starts. `vitehub
|
|
|
131
131
|
|
|
132
132
|
## Run jobs on several Node servers
|
|
133
133
|
|
|
134
|
-
The postgres driver keeps the jobs in the `vitehub_queue_jobs` table, and every server process of the app takes due jobs from it. Install `postgres` (postgres.js). The jobs use the postgres.js client of the Default Database, so they connect as the Database does, whatever variable or URL its Definition reads. `QUEUE_POSTGRES_URL` on the server overrides it. An explicit `driver: "postgres"` without a Postgres Default Database needs `QUEUE_POSTGRES_URL`.
|
|
134
|
+
The postgres driver keeps the jobs in the `vitehub_queue_jobs` table, and every server process of the app takes due jobs from it. Install `postgres` (postgres.js). The jobs use the postgres.js client of the Default Database, so they connect as the Database does, whatever variable or URL its Definition reads. When the Database sets `driver: "node-postgres"`, the jobs open their own postgres.js client on the connection URL of the Database. A node-postgres Database that reads only the PG* variables needs `QUEUE_POSTGRES_URL`. `QUEUE_POSTGRES_URL` on the server overrides it. An explicit `driver: "postgres"` without a Postgres Default Database needs `QUEUE_POSTGRES_URL`.
|
|
135
135
|
|
|
136
136
|
```ts
|
|
137
137
|
// vite.config.ts
|
|
@@ -183,7 +183,7 @@ List, inspect, run again, and remove the stored jobs with the CLI. The commands
|
|
|
183
183
|
|
|
184
184
|
```sh
|
|
185
185
|
pnpm vitehub queue jobs list --state dead
|
|
186
|
-
pnpm vitehub queue jobs
|
|
186
|
+
pnpm vitehub queue jobs get <message-id>
|
|
187
187
|
pnpm vitehub queue jobs retry <message-id>
|
|
188
188
|
pnpm vitehub queue jobs clear --state dead --yes
|
|
189
189
|
```
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
1
|
+
import { a as getQueueRuntimeEvent, c as loadQueueDefinition, g as resolveWaitUntil, i as getQueueRuntimeConfig, n as getOrCreateQueueClient, r as getQueueRuntimeClientFactory, u as runWithQueueRuntimeEvent, v as getCloudflareEnv } from "./state-DqxeV11k.js";
|
|
2
|
+
import { n as normalizeQueueOptions } from "./config-Bzp1xmdh.js";
|
|
3
|
+
import { a as normalizePublicQueueIdentifier, c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, r as isQueueError, t as readQueueTimes } from "./duration-C5w_-Rf4.js";
|
|
4
|
+
import { t as resolveVercelQueueRegion } from "./vercel-region-DEsR1YJQ.js";
|
|
5
|
+
import { t as getCloudflareQueueBindingName } from "./cloudflare-BMc35cBD.js";
|
|
6
|
+
import { t as getVercelQueueTopicName } from "./vercel-sUJOxFBB.js";
|
|
7
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
8
8
|
import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
|
|
9
|
-
|
|
9
|
+
// src/runtime/test-client.ts
|
|
10
10
|
/** The sent jobs of the current test. `vite-hub/test` reads the same list. */
|
|
11
11
|
function queueTestMessages(test) {
|
|
12
12
|
return test.backend("queue", () => []);
|
|
13
13
|
}
|
|
14
|
-
/** Records the job and does not run it, so a test asserts what the app sent. */
|
|
15
14
|
function recordQueueTestMessage(test, queue, input) {
|
|
16
15
|
const messages = queueTestMessages(test);
|
|
17
16
|
const duplicate = input.options.idempotencyKey === void 0 ? void 0 : messages.find((message) => message.queue === queue && message.options.idempotencyKey === input.options.idempotencyKey);
|
|
@@ -57,8 +56,7 @@ function createTestQueueClient(test, queue, provider) {
|
|
|
57
56
|
}
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
|
-
|
|
61
|
-
//#region src/runtime/client.ts
|
|
59
|
+
// src/runtime/client.ts
|
|
62
60
|
async function loadNamedQueueDefinition(name) {
|
|
63
61
|
try {
|
|
64
62
|
return await loadQueueDefinition(name);
|
|
@@ -178,5 +176,4 @@ function sendQueue(name, payload, options) {
|
|
|
178
176
|
function deferQueue(name, payload, options) {
|
|
179
177
|
deferDynamicQueue(name, payload, options);
|
|
180
178
|
}
|
|
181
|
-
//#endregion
|
|
182
179
|
export { useQueue as i, dynamicQueue as n, sendQueue as r, deferQueue as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/integrations/hex.ts
|
|
2
2
|
const textEncoder = new TextEncoder();
|
|
3
3
|
const textDecoder = new TextDecoder();
|
|
4
4
|
function encodeNameHex(name) {
|
|
@@ -9,8 +9,7 @@ function decodeNameHex(hex) {
|
|
|
9
9
|
if (!bytes.length || bytes.some((byte) => !Number.isFinite(byte))) return;
|
|
10
10
|
return textDecoder.decode(new Uint8Array(bytes));
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
//#region src/integrations/cloudflare.ts
|
|
12
|
+
// src/integrations/cloudflare.ts
|
|
14
13
|
const defaultCloudflareQueueBindingPrefix = "QUEUE";
|
|
15
14
|
const encodedCloudflareQueueNamePattern = /^queue--([0-9a-f]{2})+$/i;
|
|
16
15
|
function getCloudflareQueueBindingName(name) {
|
|
@@ -22,5 +21,4 @@ function getCloudflareQueueDefinitionName(name, namePrefix = "") {
|
|
|
22
21
|
if (!encodedCloudflareQueueNamePattern.test(encodedName)) return encodedName;
|
|
23
22
|
return decodeNameHex(encodedName.slice(7)) || name;
|
|
24
23
|
}
|
|
25
|
-
//#endregion
|
|
26
24
|
export { getCloudflareQueueDefinitionName as n, encodeNameHex as r, getCloudflareQueueBindingName as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { n as getCloudflareQueueDefinitionName } from "./cloudflare-
|
|
4
|
-
import { i as reportQueueDeliveryError, r as isNonRetryableQueueError, t as checkQueueHandlerResponse } from "./handler-response-
|
|
1
|
+
import { a as normalizePublicQueueIdentifier, c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, s as queueProviderResult, t as readQueueTimes } from "./duration-C5w_-Rf4.js";
|
|
2
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
3
|
+
import { n as getCloudflareQueueDefinitionName } from "./cloudflare-BMc35cBD.js";
|
|
4
|
+
import { i as reportQueueDeliveryError, r as isNonRetryableQueueError, t as checkQueueHandlerResponse } from "./handler-response-CchTXVjm.js";
|
|
5
5
|
import { parseDuration } from "@vite-hub/runtime";
|
|
6
|
-
|
|
6
|
+
// src/providers/cloudflare.ts
|
|
7
7
|
const cloudflareBindingName = /^[A-Z_]\w{0,127}$/i;
|
|
8
8
|
function isCloudflareQueueBinding(binding) {
|
|
9
9
|
if (binding === null || typeof binding !== "object" || Array.isArray(binding)) return false;
|
|
@@ -48,7 +48,6 @@ function toSendOptions(options = {}) {
|
|
|
48
48
|
delaySeconds: times.delaySeconds
|
|
49
49
|
}];
|
|
50
50
|
}
|
|
51
|
-
/** Runs the action that `onError` returned. A `delay` that is not a duration throws, and the caller retries at once. */
|
|
52
51
|
function resolveAction(action, message, fallback) {
|
|
53
52
|
if (action && typeof action === "object" && !Array.isArray(action) && Object.hasOwn(action, "retry")) {
|
|
54
53
|
const removed = queueRemovedOptionsError("cloudflare", action.retry);
|
|
@@ -78,7 +77,7 @@ function createCloudflareQueueBatchHandler(options) {
|
|
|
78
77
|
attempts: message.attempts,
|
|
79
78
|
id: message.id,
|
|
80
79
|
provider: "cloudflare",
|
|
81
|
-
queue: getCloudflareQueueDefinitionName(batch.queue)
|
|
80
|
+
queue: normalizePublicQueueIdentifier(options.queue) ?? normalizePublicQueueIdentifier(getCloudflareQueueDefinitionName(batch.queue)) ?? batch.queue
|
|
82
81
|
};
|
|
83
82
|
reportQueueDeliveryError(error, reportContext);
|
|
84
83
|
let action = void 0;
|
|
@@ -141,8 +140,7 @@ function createCloudflareQueueClient(provider) {
|
|
|
141
140
|
createBatchHandler: createCloudflareQueueBatchHandler
|
|
142
141
|
};
|
|
143
142
|
}
|
|
144
|
-
|
|
145
|
-
//#region src/internal/runtime/cloudflare-client.ts
|
|
143
|
+
// src/internal/runtime/cloudflare-client.ts
|
|
146
144
|
async function createCloudflareQueueRuntimeClient(options) {
|
|
147
145
|
if (options.driver !== "cloudflare") throw queueErrorDiagnostics.QUEUE_DRIVER_MISMATCH({
|
|
148
146
|
driver: options.driver,
|
|
@@ -150,5 +148,4 @@ async function createCloudflareQueueRuntimeClient(options) {
|
|
|
150
148
|
});
|
|
151
149
|
return createCloudflareQueueClient(options);
|
|
152
150
|
}
|
|
153
|
-
//#endregion
|
|
154
151
|
export { createCloudflareQueueBatchHandler as n, createCloudflareQueueRuntimeClient as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { r as encodeNameHex } from "./cloudflare-BMc35cBD.js";
|
|
2
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
3
|
+
// src/internal/cloudflare-resource-name.ts
|
|
4
4
|
const cloudflareQueueNamePrefix = "queue--";
|
|
5
5
|
const cloudflareQueueNamePattern = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
|
|
6
6
|
const cloudflareLegacyQueueDefinitionNamePattern = /^[a-z0-9]+-[a-z0-9]+$/;
|
|
@@ -31,5 +31,4 @@ function getCloudflareQueueName(name, namePrefix = "") {
|
|
|
31
31
|
if (!cloudflareQueueNamePattern.test(queueName)) throw queueErrorDiagnostics.QUEUE_INVALID_NAME({ name: queueName });
|
|
32
32
|
return queueName.length <= maxCloudflareQueueNameLength ? queueName : createBoundedCloudflareQueueName(name, namePrefix);
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { getCloudflareQueueName as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as isRecord } from "./object-
|
|
2
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { n as isRecord } from "./object-DRSmpe04.js";
|
|
2
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
/** Maps a host name or a Nitro preset name, such as `cloudflare-module` or `node-server`, to its ViteHub host. */
|
|
5
5
|
function hostFromNitroPreset(value) {
|
|
@@ -11,8 +11,7 @@ function hostFromNitroPreset(value) {
|
|
|
11
11
|
if (normalized === "node" || normalized.startsWith("node-")) return "node";
|
|
12
12
|
if (normalized.startsWith("vercel")) return "vercel";
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
//#region ../internal/src/hosting.ts
|
|
14
|
+
// ../internal/src/hosting.ts
|
|
16
15
|
/**
|
|
17
16
|
* Returns the Nitro preset name that this build targets, as the developer wrote it.
|
|
18
17
|
* The order is `nitro.preset`, `hosting`, `NITRO_PRESET`, `SERVER_PRESET`, then `VITEHUB_HOST`.
|
|
@@ -43,8 +42,7 @@ function getHostingProvider(hosting) {
|
|
|
43
42
|
const host = hostFromNitroPreset(hosting);
|
|
44
43
|
if (host === "cloudflare" || host === "netlify" || host === "vercel") return host;
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
//#region src/config.ts
|
|
45
|
+
// src/config.ts
|
|
48
46
|
const knownDrivers = /* @__PURE__ */ new Set([
|
|
49
47
|
"cloudflare",
|
|
50
48
|
"local",
|
|
@@ -55,14 +53,12 @@ const knownDrivers = /* @__PURE__ */ new Set([
|
|
|
55
53
|
const postgresQueueUrlVariable = "QUEUE_POSTGRES_URL";
|
|
56
54
|
/** Default directory of the local driver, next to the KV `fs-lite` store in `.vitehub/data/kv`. */
|
|
57
55
|
const defaultLocalQueueBase = ".vitehub/data/queue";
|
|
58
|
-
/** A self-hosted Node server has no hosted Queue, so it runs Queue Definitions in its own process. */
|
|
59
56
|
function isLocalHosting(hosting) {
|
|
60
57
|
return hosting === "local" || hostFromNitroPreset(hosting) === "node";
|
|
61
58
|
}
|
|
62
59
|
function readOwnOption(options, key) {
|
|
63
60
|
return Object.hasOwn(options, key) ? options[key] : void 0;
|
|
64
61
|
}
|
|
65
|
-
/** The driver without `queue.driver`: the host's Queue, or on Node `postgres` with a Postgres Database, else `local`. */
|
|
66
62
|
function inferDriver(hosting, postgresDatabase) {
|
|
67
63
|
if (hosting.includes("cloudflare")) return "cloudflare";
|
|
68
64
|
if (hosting === "postgres") return "postgres";
|
|
@@ -101,5 +97,4 @@ function normalizeQueueOptions(options, input = {}) {
|
|
|
101
97
|
if (typeof options !== "undefined" && !isRecord(options)) throw queueErrorDiagnostics.QUEUE_INVALID_CONFIG();
|
|
102
98
|
return resolveDriver(options || {}, normalizeHosting(input.hosting), input.postgresDatabase === true);
|
|
103
99
|
}
|
|
104
|
-
//#endregion
|
|
105
100
|
export { resolveHost as a, getHostingProvider as i, normalizeQueueOptions as n, resolveHostPreset as o, postgresQueueUrlVariable as r, defaultLocalQueueBase as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as isRecord } from "./object-DRSmpe04.js";
|
|
2
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
3
|
+
// src/definition.ts
|
|
4
|
+
/** Cloudflare accepts a `max_batch_size` from 1 to 100. */
|
|
5
|
+
function isQueueMaxBatchSize(value) {
|
|
6
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 100;
|
|
7
|
+
}
|
|
8
|
+
const queueDefinitionKeys = /* @__PURE__ */ new Set([
|
|
9
|
+
"cache",
|
|
10
|
+
"callbackOptions",
|
|
11
|
+
"concurrency",
|
|
12
|
+
"handler",
|
|
13
|
+
"maxBatchSize",
|
|
14
|
+
"onDispatchError",
|
|
15
|
+
"onError"
|
|
16
|
+
]);
|
|
17
|
+
function defineQueue(definition, ...removed) {
|
|
18
|
+
if (typeof definition === "function" || removed.length) throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: "`defineQueue(handler, options)` was removed." });
|
|
19
|
+
if (!isRecord(definition)) throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: "`defineQueue()` expects one object with `handler`." });
|
|
20
|
+
const unknownKey = Object.keys(definition).find((key) => !queueDefinitionKeys.has(key));
|
|
21
|
+
if (unknownKey) throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: `\`defineQueue()\` does not support the "${unknownKey}" option.` });
|
|
22
|
+
if (!Object.hasOwn(definition, "handler") || typeof definition.handler !== "function") throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: "`defineQueue()` needs a `handler` function." });
|
|
23
|
+
if (definition.maxBatchSize !== void 0 && !isQueueMaxBatchSize(definition.maxBatchSize)) throw queueErrorDiagnostics.QUEUE_MAX_BATCH_SIZE_INVALID({ where: "defineQueue()" });
|
|
24
|
+
return definition;
|
|
25
|
+
}
|
|
26
|
+
export { isQueueMaxBatchSize as n, defineQueue as t };
|
package/dist/durability.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
|
|
2
|
-
//#region src/durability.d.ts
|
|
3
2
|
/** What the build passes to `queueDurability()`. */
|
|
4
3
|
export interface QueueDurabilityInput {
|
|
5
4
|
/** The folder of the `local` driver. */
|
|
@@ -9,5 +8,4 @@ export interface QueueDurabilityInput {
|
|
|
9
8
|
driver: string;
|
|
10
9
|
}
|
|
11
10
|
/** The durability of Queue jobs, from the driver. */
|
|
12
|
-
export declare function queueDurability(input: QueueDurabilityInput, context: DurabilityContext): Durability[];
|
|
13
|
-
//#endregion
|
|
11
|
+
export declare function queueDurability(input: QueueDurabilityInput, context: DurabilityContext): Durability[];
|
package/dist/durability.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/durability.ts
|
|
2
2
|
const hostedDrivers = {
|
|
3
3
|
cloudflare: "Cloudflare Queues deliver each job once.",
|
|
4
4
|
vercel: "Vercel Queues deliver each job once."
|
|
@@ -43,5 +43,4 @@ function queueDurability(input, context) {
|
|
|
43
43
|
fix: "Use the `postgres` driver with a Postgres Default Database."
|
|
44
44
|
}];
|
|
45
45
|
}
|
|
46
|
-
//#endregion
|
|
47
46
|
export { queueDurability };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { parseDuration,
|
|
3
|
-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
2
|
+
import { parseDuration, toResultError } from "@vite-hub/runtime";
|
|
3
|
+
import { runtimeErrorDiagnostics } from "@vite-hub/runtime/internal/error-diagnostics";
|
|
4
|
+
// src/enqueue.ts
|
|
4
5
|
let fallbackCounter = 0;
|
|
5
6
|
function createQueueMessageId(prefix = "queue") {
|
|
6
7
|
const uuid = globalThis.crypto?.randomUUID?.();
|
|
@@ -16,8 +17,7 @@ function normalizeQueueEnqueueInput(payload, options = {}) {
|
|
|
16
17
|
payload
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
//#region src/errors.ts
|
|
20
|
+
// src/errors.ts
|
|
21
21
|
const cloudflareUnsupportedEnqueueOptions = [
|
|
22
22
|
"idempotencyKey",
|
|
23
23
|
"region",
|
|
@@ -86,8 +86,14 @@ async function queueProviderResult(provider, operation, run) {
|
|
|
86
86
|
}), void 0];
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
// src/duration.ts
|
|
90
|
+
function readRetentionSeconds(seconds, round) {
|
|
91
|
+
if (!Number.isFinite(seconds) || seconds < 0) throw runtimeErrorDiagnostics.RUNTIME_DURATION_INVALID({
|
|
92
|
+
option: "retention",
|
|
93
|
+
value: String(seconds)
|
|
94
|
+
});
|
|
95
|
+
return round === "ceil" ? Math.ceil(seconds) : seconds;
|
|
96
|
+
}
|
|
91
97
|
/**
|
|
92
98
|
* Reads `delay` and `retention` of a send. `delay` is a duration such as `"1m"`. `retention` is a duration or a number
|
|
93
99
|
* of seconds. A value that is not a duration returns `RUNTIME_DURATION_INVALID`. Pass `"ceil"` for a provider that
|
|
@@ -97,7 +103,7 @@ function readQueueTimes(options, round) {
|
|
|
97
103
|
const seconds = (milliseconds) => round === "ceil" ? Math.ceil(milliseconds / 1e3) : milliseconds / 1e3;
|
|
98
104
|
try {
|
|
99
105
|
const delaySeconds = options.delay === void 0 ? void 0 : seconds(parseDuration(options.delay, "delay", void 0, "s"));
|
|
100
|
-
const retentionSeconds = typeof options.retention === "number" ?
|
|
106
|
+
const retentionSeconds = typeof options.retention === "number" ? readRetentionSeconds(options.retention, round) : options.retention === void 0 ? void 0 : seconds(parseDuration(options.retention, "retention"));
|
|
101
107
|
return [void 0, {
|
|
102
108
|
...delaySeconds === void 0 ? {} : { delaySeconds },
|
|
103
109
|
...retentionSeconds === void 0 ? {} : { retentionSeconds }
|
|
@@ -107,5 +113,4 @@ function readQueueTimes(options, round) {
|
|
|
107
113
|
throw error;
|
|
108
114
|
}
|
|
109
115
|
}
|
|
110
|
-
//#endregion
|
|
111
116
|
export { normalizePublicQueueIdentifier as a, queueRemovedOptionsError as c, normalizeQueueEnqueueInput as d, localUnsupportedEnqueueOptions as i, queueUnsupportedOptionsError as l, cloudflareUnsupportedEnqueueOptions as n, postgresUnsupportedEnqueueOptions as o, isQueueError as r, queueProviderResult as s, readQueueTimes as t, createQueueMessageId as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineErrors } from "@vite-hub/runtime";
|
|
2
|
-
|
|
2
|
+
// src/error-diagnostics.ts
|
|
3
3
|
const queueErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
4
4
|
docs: "https://vitehub.dev/docs/queue/diagnostics",
|
|
5
5
|
codes: {
|
|
@@ -53,7 +53,7 @@ const queueErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
53
53
|
},
|
|
54
54
|
QUEUE_JOB_RUNNING: {
|
|
55
55
|
why: "The job is running now.",
|
|
56
|
-
fix: "Wait for the attempt to end, then run `vitehub queue jobs
|
|
56
|
+
fix: "Wait for the attempt to end, then run `vitehub queue jobs get` for its state."
|
|
57
57
|
},
|
|
58
58
|
QUEUE_BINDING_NOT_FOUND: {
|
|
59
59
|
why: ({ binding }) => binding ? `The Cloudflare queue binding "${binding}" is not in the Worker env.` : "The Cloudflare queue client has no binding.",
|
|
@@ -104,8 +104,8 @@ const queueErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
104
104
|
fix: "Set `QUEUE_POSTGRES_URL` to the Postgres URL of the jobs, or remove it to use the connection of the Default Database."
|
|
105
105
|
},
|
|
106
106
|
QUEUE_POSTGRES_MISSING_CONNECTION: {
|
|
107
|
-
why: ({ database }) => database ? `The postgres queue provider uses the connection of the Database "${database}", and that Database has no
|
|
108
|
-
fix: "Add a Default Database with `dialect: 'postgresql'` and build again, or set `QUEUE_POSTGRES_URL` on the server to the Postgres URL of the jobs."
|
|
107
|
+
why: ({ database }) => database ? `The postgres queue provider uses the connection of the Database "${database}", and that Database has no postgres.js client and no connection URL in this runtime.` : "The postgres queue provider has no connection: the build found no Postgres Default Database, and `QUEUE_POSTGRES_URL` is not set.",
|
|
108
|
+
fix: ({ database }) => database ? `Set \`connection.url\` on the Database "${database}", or set \`QUEUE_POSTGRES_URL\` on the server to the Postgres URL of the jobs.` : "Add a Default Database with `dialect: 'postgresql'` and build again, or set `QUEUE_POSTGRES_URL` on the server to the Postgres URL of the jobs."
|
|
109
109
|
},
|
|
110
110
|
QUEUE_RUNTIME_NOT_INSTALLED: {
|
|
111
111
|
why: "The Queue runtime has no client factory. The generated server output installs it.",
|
|
@@ -145,7 +145,7 @@ const queueErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
145
145
|
},
|
|
146
146
|
QUEUE_INVALID_DEFINITION: {
|
|
147
147
|
why: ({ reason }) => reason,
|
|
148
|
-
fix: "Pass one object with a `handler` function and the options next to it, for example `defineQueue({ handler: async ({ payload }) => { ... }, concurrency: 2 })`. Run `npx
|
|
148
|
+
fix: "Pass one object with a `handler` function and the options next to it, for example `defineQueue({ handler: async ({ payload }) => { ... }, concurrency: 2 })`. Run `npx @vite-hub/codemods define-forms` to move the former `defineQueue(handler, options)` form."
|
|
149
149
|
},
|
|
150
150
|
QUEUE_INVALID_DRIVER: {
|
|
151
151
|
why: ({ driver }) => `\`queue.driver\` "${driver}" is not a Queue driver.`,
|
|
@@ -155,6 +155,10 @@ const queueErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
155
155
|
why: ({ name }) => `The Cloudflare queue name "${name}" can contain only letters, numbers, and dashes, and must start and end with a letter or number.`,
|
|
156
156
|
fix: "Change `queue.namePrefix` so that it contains only letters, numbers, and dashes."
|
|
157
157
|
},
|
|
158
|
+
QUEUE_MAX_BATCH_SIZE_INVALID: {
|
|
159
|
+
why: ({ where }) => `${where}: \`maxBatchSize\` must be a whole number from 1 to 100, written as a number in \`export default defineQueue({ ... })\`. The build reads the options from the file to configure the Cloudflare consumer, so they cannot use a spread or a computed key.`,
|
|
160
|
+
fix: "Write each option, such as `maxBatchSize: 5` (a whole number from 1 to 100), directly in the object of `export default defineQueue({ ... })`, without a variable, a spread, or a computed key."
|
|
161
|
+
},
|
|
158
162
|
QUEUE_MISSING_DRIVER: {
|
|
159
163
|
why: ({ hosting }) => `ViteHub cannot select a Queue driver for ${hosting} hosting.`,
|
|
160
164
|
fix: "Set `queue.driver`, select the Cloudflare, Vercel, or Node deployment preset, or set `queue: false`."
|
|
@@ -177,5 +181,4 @@ const queueErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
183
|
});
|
|
180
|
-
//#endregion
|
|
181
184
|
export { queueErrorDiagnostics as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/error-diagnostics.ts
|
|
3
3
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
4
|
const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
5
5
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
@@ -25,7 +25,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
25
25
|
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
26
26
|
},
|
|
27
27
|
INTERNAL_R0022: {
|
|
28
|
-
fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields.",
|
|
28
|
+
fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields, and the list_operations tool of the ViteHub MCP gives the input schema of each operation.",
|
|
29
29
|
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
30
30
|
},
|
|
31
31
|
INTERNAL_R0024: {
|
|
@@ -244,6 +244,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
244
244
|
why: ({ owner }) => `[vitehub] ${owner} extends tuple requires [preset, options] with an options object.`,
|
|
245
245
|
fix: "Set `extends` to a preset, or to a two-item tuple `[preset, { ...options }]` whose second item is a plain object."
|
|
246
246
|
},
|
|
247
|
+
INTERNAL_RUNTIME_PACKAGE_VERSION_CONFLICT: {
|
|
248
|
+
why: ({ first, name, second }) => `[vitehub] One server function needs ${name} from two installations: ${first} and ${second}.`,
|
|
249
|
+
fix: "Install one version of the package that the message names, for example with `pnpm dedupe` or an `overrides` entry in `package.json`, then build again."
|
|
250
|
+
},
|
|
247
251
|
INTERNAL_SECRET_PURPOSE_MISSING: {
|
|
248
252
|
why: "[vitehub] A derived secret requires a purpose.",
|
|
249
253
|
fix: "Pass a non-empty purpose to `deriveSecret()`, such as `deriveSecret(\"my-module:session\")`."
|
|
@@ -252,6 +256,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
252
256
|
why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
|
|
253
257
|
fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
|
|
254
258
|
},
|
|
259
|
+
INTERNAL_SITE_TOKEN_TOO_LONG: {
|
|
260
|
+
why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
|
|
261
|
+
fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
|
|
262
|
+
},
|
|
255
263
|
INTERNAL_SQLITE_ARGUMENT_INVALID: {
|
|
256
264
|
why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
|
|
257
265
|
fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
|
|
@@ -266,5 +274,4 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
266
274
|
}
|
|
267
275
|
}
|
|
268
276
|
});
|
|
269
|
-
//#endregion
|
|
270
277
|
export { internalErrorDiagnostics as t };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { a as normalizePublicQueueIdentifier, r as isQueueError } from "./duration-
|
|
2
|
-
import { getViteHubErrorShape
|
|
3
|
-
|
|
1
|
+
import { a as normalizePublicQueueIdentifier, r as isQueueError } from "./duration-C5w_-Rf4.js";
|
|
2
|
+
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
3
|
+
import { toResponse } from "@vite-hub/runtime/internal/response";
|
|
4
|
+
// src/internal/delivery-error.ts
|
|
4
5
|
const retryableQueueCodes = /* @__PURE__ */ new Set(["QUEUE_PROVIDER_FAILED", "QUEUE_PROVIDER_INVALID_RESPONSE"]);
|
|
5
6
|
function isNonRetryableQueueError(error) {
|
|
6
7
|
return isQueueError(error) && !retryableQueueCodes.has(error.code);
|
|
@@ -45,17 +46,19 @@ function createQueueDeliveryErrorReport(error, context) {
|
|
|
45
46
|
function reportQueueDeliveryError(error, context) {
|
|
46
47
|
console.error("[vitehub:queue] Queue Delivery failed.", createQueueDeliveryErrorReport(error, context));
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
//#region src/internal/handler-response.ts
|
|
49
|
+
// src/internal/handler-response.ts
|
|
50
50
|
/** Queue deliveries use the handler's status and discard its response body. */
|
|
51
51
|
function checkQueueHandlerResponse(value) {
|
|
52
52
|
const response = toResponse(value);
|
|
53
|
-
response.body
|
|
53
|
+
discardUnreadBody(response.body);
|
|
54
54
|
if (!response.ok) {
|
|
55
55
|
const error = /* @__PURE__ */ new Error(`Queue handler returned HTTP ${response.status}`);
|
|
56
56
|
Object.assign(error, { status: response.status });
|
|
57
57
|
throw error;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
function discardUnreadBody(body) {
|
|
61
|
+
if (!body || body.locked) return;
|
|
62
|
+
body.cancel().catch(() => console.debug("[vitehub:queue] The Queue handler response body could not be cancelled."));
|
|
63
|
+
}
|
|
61
64
|
export { reportQueueDeliveryError as i, createQueueDeliveryErrorReport as n, isNonRetryableQueueError as r, checkQueueHandlerResponse as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { A as QueueJobStore, B as VercelQueueCallbackOptions, C as QueueDefinitionRegistry, D as QueueErrorCode, E as QueueEnqueueOptions, F as QueueRegistry, G as VercelQueueSendBatchMessage, H as VercelQueueErrorCode, I as QueueSendResult, K as VercelQueueSendBatchOptions, L as ResolvedLocalQueueOptions, M as QueueName, N as QueueOptions, O as QueueHandler, P as QueuePayload, R as ResolvedQueueOptions, S as QueueDefinitionOptions, T as QueueDriverOptions, U as VercelQueueRetryDirective, V as VercelQueueClient, W as VercelQueueRetryHandler, _ as PostgresQueueClient, a as CloudflareQueueMessageBatch, b as QueueClient, c as LocalQueueClient, g as NodeQueueDriver, i as CloudflareQueueMessage, j as QueueModuleDriverOptions, k as QueueJob, l as LocalQueueDriverOptions, m as LocalQueueSendBatchMessage, n as CloudflareQueueClient, o as CloudflareQueueSendBatchItem, p as LocalQueueRules, q as VercelQueueSendResult, r as CloudflareQueueErrorCode, s as DiscoveredQueueDefinition, t as CloudflareQueueBatchHandlerOptions, u as LocalQueueErrorCode, v as PostgresQueueDriverOptions, w as QueueDriver, x as QueueDefinition, y as PostgresQueueErrorCode, z as VercelQueueBatchSendResult } from "./types-
|
|
1
|
+
import { A as QueueJobStore, B as VercelQueueCallbackOptions, C as QueueDefinitionRegistry, D as QueueErrorCode, E as QueueEnqueueOptions, F as QueueRegistry, G as VercelQueueSendBatchMessage, H as VercelQueueErrorCode, I as QueueSendResult, K as VercelQueueSendBatchOptions, L as ResolvedLocalQueueOptions, M as QueueName, N as QueueOptions, O as QueueHandler, P as QueuePayload, R as ResolvedQueueOptions, S as QueueDefinitionOptions, T as QueueDriverOptions, U as VercelQueueRetryDirective, V as VercelQueueClient, W as VercelQueueRetryHandler, _ as PostgresQueueClient, a as CloudflareQueueMessageBatch, b as QueueClient, c as LocalQueueClient, g as NodeQueueDriver, i as CloudflareQueueMessage, j as QueueModuleDriverOptions, k as QueueJob, l as LocalQueueDriverOptions, m as LocalQueueSendBatchMessage, n as CloudflareQueueClient, o as CloudflareQueueSendBatchItem, p as LocalQueueRules, q as VercelQueueSendResult, r as CloudflareQueueErrorCode, s as DiscoveredQueueDefinition, t as CloudflareQueueBatchHandlerOptions, u as LocalQueueErrorCode, v as PostgresQueueDriverOptions, w as QueueDriver, x as QueueDefinition, y as PostgresQueueErrorCode, z as VercelQueueBatchSendResult } from "./types-BzPGPV9z.js";
|
|
2
2
|
import { Result } from "@vite-hub/runtime";
|
|
3
|
-
//#region src/definition.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Defines a Queue from one object: `defineQueue({ handler, concurrency })`. The handler receives one object,
|
|
6
5
|
* `{ payload, id, attempts, metadata }`. The payload type of `handler` types `sendQueue()` for this Queue.
|
|
7
6
|
*/
|
|
8
7
|
export declare function defineQueue<TPayload = unknown, TResult = unknown>(definition: QueueDefinition<TPayload, TResult>): QueueDefinition<TPayload, TResult>;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/enqueue.d.ts
|
|
11
8
|
export declare function createQueueMessageId(prefix?: string): string;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/runtime/client.d.ts
|
|
14
9
|
declare function useDynamicQueue(name: string): Promise<QueueClient>;
|
|
15
10
|
declare function sendDynamicQueue(name: string, payload: unknown, options?: QueueEnqueueOptions): Promise<Result<QueueSendResult, QueueErrorCode>>;
|
|
16
11
|
declare function deferDynamicQueue(name: string, payload: unknown, options?: QueueEnqueueOptions): void;
|
|
@@ -34,8 +29,5 @@ export declare function sendQueue<TName extends QueueName>(name: TName, payload:
|
|
|
34
29
|
* `onDispatchError` option of the Queue Definition. Call `sendQueue()` when the caller needs the message ID.
|
|
35
30
|
*/
|
|
36
31
|
export declare function deferQueue<TName extends QueueName>(name: TName, payload: NoInfer<QueuePayload<TName>>, options?: QueueEnqueueOptions): void;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/runtime/create-client.d.ts
|
|
39
32
|
export declare function createQueueClient(options: QueueDriverOptions): Promise<QueueClient>;
|
|
40
|
-
//#endregion
|
|
41
33
|
export type { CloudflareQueueBatchHandlerOptions, CloudflareQueueClient, CloudflareQueueErrorCode, CloudflareQueueMessage, CloudflareQueueMessageBatch, CloudflareQueueSendBatchItem, DiscoveredQueueDefinition, LocalQueueClient, LocalQueueDriverOptions, LocalQueueErrorCode, LocalQueueRules, LocalQueueSendBatchMessage, NodeQueueDriver, PostgresQueueClient, PostgresQueueDriverOptions, PostgresQueueErrorCode, QueueClient, QueueDefinition, QueueDefinitionOptions, QueueDefinitionRegistry, QueueDriver, QueueDriverOptions, QueueEnqueueOptions, QueueErrorCode, QueueHandler, QueueJob, QueueJobStore, QueueModuleDriverOptions, QueueName, QueueOptions, QueuePayload, QueueRegistry, QueueSendResult, ResolvedLocalQueueOptions, ResolvedQueueOptions, VercelQueueBatchSendResult, VercelQueueCallbackOptions, VercelQueueClient, VercelQueueErrorCode, VercelQueueRetryDirective, VercelQueueRetryHandler, VercelQueueSendBatchMessage, VercelQueueSendBatchOptions, VercelQueueSendResult };
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const queueDefinitionKeys = /* @__PURE__ */ new Set([
|
|
7
|
-
"cache",
|
|
8
|
-
"callbackOptions",
|
|
9
|
-
"concurrency",
|
|
10
|
-
"handler",
|
|
11
|
-
"onDispatchError",
|
|
12
|
-
"onError"
|
|
13
|
-
]);
|
|
14
|
-
function defineQueue(definition, ...removed) {
|
|
15
|
-
if (typeof definition === "function" || removed.length) throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: "`defineQueue(handler, options)` was removed." });
|
|
16
|
-
if (!isRecord(definition)) throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: "`defineQueue()` expects one object with `handler`." });
|
|
17
|
-
const unknownKey = Object.keys(definition).find((key) => !queueDefinitionKeys.has(key));
|
|
18
|
-
if (unknownKey) throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: `\`defineQueue()\` does not support the "${unknownKey}" option.` });
|
|
19
|
-
if (!Object.hasOwn(definition, "handler") || typeof definition.handler !== "function") throw queueErrorDiagnostics.QUEUE_INVALID_DEFINITION({ reason: "`defineQueue()` needs a `handler` function." });
|
|
20
|
-
return definition;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/runtime/create-client.ts
|
|
1
|
+
import { t as defineQueue } from "./definition-CIiFfst2.js";
|
|
2
|
+
import { u as createQueueMessageId } from "./duration-C5w_-Rf4.js";
|
|
3
|
+
import { i as useQueue, n as dynamicQueue, r as sendQueue, t as deferQueue } from "./client-CwoCdKct.js";
|
|
4
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
5
|
+
// src/runtime/create-client.ts
|
|
24
6
|
async function createQueueClient(options) {
|
|
25
7
|
if (options.driver === void 0 && Object.hasOwn(options, "provider")) {
|
|
26
8
|
const provider = options.provider;
|
|
@@ -47,5 +29,4 @@ async function createQueueClient(options) {
|
|
|
47
29
|
const { createVercelQueueRuntimeClient } = await import("./internal/runtime/vercel-client.js");
|
|
48
30
|
return await createVercelQueueRuntimeClient(options);
|
|
49
31
|
}
|
|
50
|
-
//#endregion
|
|
51
32
|
export { createQueueClient, createQueueMessageId, deferQueue, defineQueue, dynamicQueue, sendQueue, useQueue };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { relative } from "pathe";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/inspect.ts
|
|
3
3
|
function relativeDefinitionFile(projectRoot, file) {
|
|
4
4
|
return relative(projectRoot, file).replaceAll("\\", "/");
|
|
5
5
|
}
|
|
@@ -26,5 +26,4 @@ const embeddedSecretAssignmentPattern = new RegExp(String.raw`\b([\w-]*(?:${secr
|
|
|
26
26
|
function redactInspectionText(value) {
|
|
27
27
|
return value.replace(embeddedUrlCredentialPattern, `$1${redactedInspectionValue}@`).replace(embeddedAuthorizationPattern, `$1${redactedInspectionValue}`).replace(embeddedCookiePattern, `$1${redactedInspectionValue}`).replace(embeddedBearerPattern, `Bearer ${redactedInspectionValue}`).replace(embeddedSecretAssignmentPattern, `$1${redactedInspectionValue}`);
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { summarizeDefinitions as n, redactInspectionText as t };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { T as QueueDriverOptions, b as QueueClient } from "../../types-
|
|
2
|
-
|
|
3
|
-
export declare function createCloudflareQueueRuntimeClient(options: QueueDriverOptions): Promise<QueueClient>;
|
|
4
|
-
//#endregion
|
|
1
|
+
import { T as QueueDriverOptions, b as QueueClient } from "../../types-BzPGPV9z.js";
|
|
2
|
+
export declare function createCloudflareQueueRuntimeClient(options: QueueDriverOptions): Promise<QueueClient>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createCloudflareQueueRuntimeClient };
|
|
1
|
+
export { t as createCloudflareQueueRuntimeClient } from "../../cloudflare-client-xWteD-su.js";
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { C as QueueDefinitionRegistry, R as ResolvedQueueOptions, a as CloudflareQueueMessageBatch } from "../../types-
|
|
2
|
-
//#region ../internal/src/runtime/cloudflare-env-lookup.d.ts
|
|
1
|
+
import { C as QueueDefinitionRegistry, R as ResolvedQueueOptions, a as CloudflareQueueMessageBatch } from "../../types-BzPGPV9z.js";
|
|
3
2
|
type CloudflareWorkerEnv = Record<string, unknown>;
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region ../internal/src/runtime/cloudflare-env.d.ts
|
|
6
3
|
interface CloudflareWorkerExecutionContext {
|
|
7
4
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
8
5
|
}
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region ../internal/src/runtime/app.d.ts
|
|
11
6
|
type AppHandler = (request: Request, context?: Record<string, unknown>) => Response | Promise<Response>;
|
|
12
7
|
type VitehubApp = AppHandler | {
|
|
13
8
|
fetch?: AppHandler;
|
|
14
9
|
request?: (request: Request, options?: RequestInit, context?: Record<string, unknown>) => Response | Promise<Response>;
|
|
15
10
|
};
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/internal/runtime/cloudflare-vite.d.ts
|
|
18
11
|
export type CloudflareWorkerApp = VitehubApp;
|
|
19
12
|
export interface QueueCloudflareWorkerOptions {
|
|
20
13
|
app?: CloudflareWorkerApp;
|
|
@@ -27,4 +20,4 @@ export interface QueueCloudflareWorker {
|
|
|
27
20
|
queue: (batch: CloudflareQueueMessageBatch, env: CloudflareWorkerEnv, context: CloudflareWorkerExecutionContext) => Promise<void>;
|
|
28
21
|
}
|
|
29
22
|
export declare function createQueueCloudflareWorker(options?: QueueCloudflareWorkerOptions): QueueCloudflareWorker;
|
|
30
|
-
|
|
23
|
+
export {};
|