@vite-hub/queue 0.4.1 → 0.5.0
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-DYE_ZV8c.js} +5 -6
- package/dist/{cloudflare-client-CoISDpIx.js → cloudflare-client-BasaJ68s.js} +4 -5
- package/dist/{cloudflare-resource-name-BIfBglC2.js → cloudflare-resource-name-BUNNqgkg.js} +1 -1
- package/dist/{config-B2eaXaT5.js → config-YEuaeQVq.js} +1 -3
- package/dist/definition-BL_3WHNu.js +27 -0
- package/dist/{duration-tujyhAKt.js → duration-CshzgSSx.js} +11 -3
- package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-C0KyI408.js} +5 -1
- package/dist/{error-diagnostics-mJXBjmQx.js → error-diagnostics-DukggGP6.js} +8 -4
- package/dist/{handler-response-B6lz9nCn.js → handler-response-ChtAjPNo.js} +8 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -22
- package/dist/internal/runtime/cloudflare-client.d.ts +1 -1
- package/dist/internal/runtime/cloudflare-client.js +1 -1
- package/dist/internal/runtime/cloudflare-vite.d.ts +1 -1
- package/dist/internal/runtime/cloudflare-vite.js +8 -7
- package/dist/internal/runtime/local-client.d.ts +3 -3
- package/dist/internal/runtime/local-client.js +4 -4
- package/dist/internal/runtime/postgres-client.d.ts +5 -4
- package/dist/internal/runtime/postgres-client.js +16 -9
- package/dist/internal/runtime/state.d.ts +2 -2
- package/dist/internal/runtime/state.js +1 -1
- package/dist/internal/runtime/vercel-client.d.ts +1 -1
- package/dist/internal/runtime/vercel-client.js +3 -4
- package/dist/internal/runtime/worker-client.d.ts +2 -2
- package/dist/internal/runtime/worker-client.js +1 -1
- package/dist/{local-Di0FrVUw.js → local-CnBd5jdm.js} +26 -20
- package/dist/{local-CUaWoRUx.d.ts → local-DAL5ZgDg.d.ts} +1 -1
- package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CI2PJGqu.d.ts} +8 -2
- package/dist/{operations-BVV-9Q0N.js → operations-BL0b9pte.js} +5 -11
- package/dist/operations.d.ts +3 -3
- package/dist/operations.js +3 -3
- package/dist/runtime/hosted.d.ts +1 -1
- package/dist/runtime/hosted.js +3 -3
- package/dist/scan-module-BbqyaLl6.js +311 -0
- package/dist/{state-DLqTqF6V.js → state-ER1YdCBF.js} +1 -1
- package/dist/{types-Dsbb_Pvp.d.ts → types-D6hDNcMY.d.ts} +1 -2
- package/dist/{types-CiuSIPR0.d.ts → types-klaR79hV.d.ts} +8 -2
- package/dist/{vercel-region-B95MAMXN.js → vercel-region-DOciq2kx.js} +1 -1
- package/dist/vite.d.ts +8 -4
- package/dist/vite.js +123 -94
- package/package.json +3 -3
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,8 +1,8 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { a as normalizePublicQueueIdentifier, c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, r as isQueueError, t as readQueueTimes } from "./duration-
|
|
3
|
-
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-
|
|
4
|
-
import { n as normalizeQueueOptions } from "./config-
|
|
5
|
-
import { t as resolveVercelQueueRegion } from "./vercel-region-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { a as normalizePublicQueueIdentifier, c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, r as isQueueError, t as readQueueTimes } from "./duration-CshzgSSx.js";
|
|
3
|
+
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-ER1YdCBF.js";
|
|
4
|
+
import { n as normalizeQueueOptions } from "./config-YEuaeQVq.js";
|
|
5
|
+
import { t as resolveVercelQueueRegion } from "./vercel-region-DOciq2kx.js";
|
|
6
6
|
import { t as getCloudflareQueueBindingName } from "./cloudflare-GosJefIK.js";
|
|
7
7
|
import { t as getVercelQueueTopicName } from "./vercel-C_4vqxcl.js";
|
|
8
8
|
import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
|
|
@@ -11,7 +11,6 @@ import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
|
|
|
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);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, s as queueProviderResult, t as readQueueTimes } from "./duration-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { a as normalizePublicQueueIdentifier, c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, s as queueProviderResult, t as readQueueTimes } from "./duration-CshzgSSx.js";
|
|
3
3
|
import { n as getCloudflareQueueDefinitionName } from "./cloudflare-GosJefIK.js";
|
|
4
|
-
import { i as reportQueueDeliveryError, r as isNonRetryableQueueError, t as checkQueueHandlerResponse } from "./handler-response-
|
|
4
|
+
import { i as reportQueueDeliveryError, r as isNonRetryableQueueError, t as checkQueueHandlerResponse } from "./handler-response-ChtAjPNo.js";
|
|
5
5
|
import { parseDuration } from "@vite-hub/runtime";
|
|
6
6
|
//#region src/providers/cloudflare.ts
|
|
7
7
|
const cloudflareBindingName = /^[A-Z_]\w{0,127}$/i;
|
|
@@ -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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-DukggGP6.js";
|
|
2
2
|
import { r as encodeNameHex } from "./cloudflare-GosJefIK.js";
|
|
3
3
|
//#region src/internal/cloudflare-resource-name.ts
|
|
4
4
|
const cloudflareQueueNamePrefix = "queue--";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as isRecord } from "./object-D8pRdprI.js";
|
|
2
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-DukggGP6.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) {
|
|
@@ -55,14 +55,12 @@ const knownDrivers = /* @__PURE__ */ new Set([
|
|
|
55
55
|
const postgresQueueUrlVariable = "QUEUE_POSTGRES_URL";
|
|
56
56
|
/** Default directory of the local driver, next to the KV `fs-lite` store in `.vitehub/data/kv`. */
|
|
57
57
|
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
58
|
function isLocalHosting(hosting) {
|
|
60
59
|
return hosting === "local" || hostFromNitroPreset(hosting) === "node";
|
|
61
60
|
}
|
|
62
61
|
function readOwnOption(options, key) {
|
|
63
62
|
return Object.hasOwn(options, key) ? options[key] : void 0;
|
|
64
63
|
}
|
|
65
|
-
/** The driver without `queue.driver`: the host's Queue, or on Node `postgres` with a Postgres Database, else `local`. */
|
|
66
64
|
function inferDriver(hosting, postgresDatabase) {
|
|
67
65
|
if (hosting.includes("cloudflare")) return "cloudflare";
|
|
68
66
|
if (hosting === "postgres") return "postgres";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { n as isRecord } from "./object-D8pRdprI.js";
|
|
2
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-DukggGP6.js";
|
|
3
|
+
//#region 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
|
+
//#endregion
|
|
27
|
+
export { isQueueMaxBatchSize as n, defineQueue as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { parseDuration,
|
|
1
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { parseDuration, toResultError } from "@vite-hub/runtime";
|
|
3
|
+
import { runtimeErrorDiagnostics } from "@vite-hub/runtime/internal/error-diagnostics";
|
|
3
4
|
//#region src/enqueue.ts
|
|
4
5
|
let fallbackCounter = 0;
|
|
5
6
|
function createQueueMessageId(prefix = "queue") {
|
|
@@ -88,6 +89,13 @@ async function queueProviderResult(provider, operation, run) {
|
|
|
88
89
|
}
|
|
89
90
|
//#endregion
|
|
90
91
|
//#region src/duration.ts
|
|
92
|
+
function readRetentionSeconds(seconds, round) {
|
|
93
|
+
if (!Number.isFinite(seconds) || seconds < 0) throw runtimeErrorDiagnostics.RUNTIME_DURATION_INVALID({
|
|
94
|
+
option: "retention",
|
|
95
|
+
value: String(seconds)
|
|
96
|
+
});
|
|
97
|
+
return round === "ceil" ? Math.ceil(seconds) : seconds;
|
|
98
|
+
}
|
|
91
99
|
/**
|
|
92
100
|
* Reads `delay` and `retention` of a send. `delay` is a duration such as `"1m"`. `retention` is a duration or a number
|
|
93
101
|
* of seconds. A value that is not a duration returns `RUNTIME_DURATION_INVALID`. Pass `"ceil"` for a provider that
|
|
@@ -97,7 +105,7 @@ function readQueueTimes(options, round) {
|
|
|
97
105
|
const seconds = (milliseconds) => round === "ceil" ? Math.ceil(milliseconds / 1e3) : milliseconds / 1e3;
|
|
98
106
|
try {
|
|
99
107
|
const delaySeconds = options.delay === void 0 ? void 0 : seconds(parseDuration(options.delay, "delay", void 0, "s"));
|
|
100
|
-
const retentionSeconds = typeof options.retention === "number" ?
|
|
108
|
+
const retentionSeconds = typeof options.retention === "number" ? readRetentionSeconds(options.retention, round) : options.retention === void 0 ? void 0 : seconds(parseDuration(options.retention, "retention"));
|
|
101
109
|
return [void 0, {
|
|
102
110
|
...delaySeconds === void 0 ? {} : { delaySeconds },
|
|
103
111
|
...retentionSeconds === void 0 ? {} : { retentionSeconds }
|
|
@@ -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\")`."
|
|
@@ -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`."
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as normalizePublicQueueIdentifier, r as isQueueError } from "./duration-
|
|
2
|
-
import { getViteHubErrorShape
|
|
1
|
+
import { a as normalizePublicQueueIdentifier, r as isQueueError } from "./duration-CshzgSSx.js";
|
|
2
|
+
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
3
|
+
import { toResponse } from "@vite-hub/runtime/internal/response";
|
|
3
4
|
//#region src/internal/delivery-error.ts
|
|
4
5
|
const retryableQueueCodes = /* @__PURE__ */ new Set(["QUEUE_PROVIDER_FAILED", "QUEUE_PROVIDER_INVALID_RESPONSE"]);
|
|
5
6
|
function isNonRetryableQueueError(error) {
|
|
@@ -50,12 +51,16 @@ function reportQueueDeliveryError(error, context) {
|
|
|
50
51
|
/** Queue deliveries use the handler's status and discard its response body. */
|
|
51
52
|
function checkQueueHandlerResponse(value) {
|
|
52
53
|
const response = toResponse(value);
|
|
53
|
-
response.body
|
|
54
|
+
discardUnreadBody(response.body);
|
|
54
55
|
if (!response.ok) {
|
|
55
56
|
const error = /* @__PURE__ */ new Error(`Queue handler returned HTTP ${response.status}`);
|
|
56
57
|
Object.assign(error, { status: response.status });
|
|
57
58
|
throw error;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
function discardUnreadBody(body) {
|
|
62
|
+
if (!body || body.locked) return;
|
|
63
|
+
body.cancel().catch(() => console.debug("[vitehub:queue] The Queue handler response body could not be cancelled."));
|
|
64
|
+
}
|
|
60
65
|
//#endregion
|
|
61
66
|
export { reportQueueDeliveryError as i, createQueueDeliveryErrorReport as n, isNonRetryableQueueError as r, checkQueueHandlerResponse as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-klaR79hV.js";
|
|
2
2
|
import { Result } from "@vite-hub/runtime";
|
|
3
3
|
//#region src/definition.d.ts
|
|
4
4
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { u as createQueueMessageId } from "./duration-
|
|
4
|
-
import { i as useQueue, n as dynamicQueue, r as sendQueue, t as deferQueue } from "./client-
|
|
5
|
-
//#region src/definition.ts
|
|
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
|
|
1
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { t as defineQueue } from "./definition-BL_3WHNu.js";
|
|
3
|
+
import { u as createQueueMessageId } from "./duration-CshzgSSx.js";
|
|
4
|
+
import { i as useQueue, n as dynamicQueue, r as sendQueue, t as deferQueue } from "./client-DYE_ZV8c.js";
|
|
23
5
|
//#region src/runtime/create-client.ts
|
|
24
6
|
async function createQueueClient(options) {
|
|
25
7
|
if (options.driver === void 0 && Object.hasOwn(options, "provider")) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as QueueDriverOptions, b as QueueClient } from "../../types-
|
|
1
|
+
import { T as QueueDriverOptions, b as QueueClient } from "../../types-klaR79hV.js";
|
|
2
2
|
//#region src/internal/runtime/cloudflare-client.d.ts
|
|
3
3
|
export declare function createCloudflareQueueRuntimeClient(options: QueueDriverOptions): Promise<QueueClient>;
|
|
4
4
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createCloudflareQueueRuntimeClient } from "../../cloudflare-client-
|
|
1
|
+
import { t as createCloudflareQueueRuntimeClient } from "../../cloudflare-client-BasaJ68s.js";
|
|
2
2
|
export { createCloudflareQueueRuntimeClient };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as QueueDefinitionRegistry, R as ResolvedQueueOptions, a as CloudflareQueueMessageBatch } from "../../types-
|
|
1
|
+
import { C as QueueDefinitionRegistry, R as ResolvedQueueOptions, a as CloudflareQueueMessageBatch } from "../../types-klaR79hV.js";
|
|
2
2
|
//#region ../internal/src/runtime/cloudflare-env-lookup.d.ts
|
|
3
3
|
type CloudflareWorkerEnv = Record<string, unknown>;
|
|
4
4
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "../../error-diagnostics-
|
|
2
|
-
import { _ as runWithActiveCloudflareEnv, c as loadQueueDefinition, d as setQueueRuntimeConfig, h as createCloudflareRuntimeEvent, m as setQueueRuntimeRegistry, u as runWithQueueRuntimeEvent } from "../../state-
|
|
3
|
-
import { t as internalErrorDiagnostics } from "../../error-diagnostics-
|
|
4
|
-
import { n as normalizeQueueOptions } from "../../config-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "../../error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { _ as runWithActiveCloudflareEnv, c as loadQueueDefinition, d as setQueueRuntimeConfig, h as createCloudflareRuntimeEvent, m as setQueueRuntimeRegistry, u as runWithQueueRuntimeEvent } from "../../state-ER1YdCBF.js";
|
|
3
|
+
import { t as internalErrorDiagnostics } from "../../error-diagnostics-C0KyI408.js";
|
|
4
|
+
import { n as normalizeQueueOptions } from "../../config-YEuaeQVq.js";
|
|
5
5
|
import { n as getCloudflareQueueDefinitionName } from "../../cloudflare-GosJefIK.js";
|
|
6
|
-
import { t as getCloudflareQueueName } from "../../cloudflare-resource-name-
|
|
7
|
-
import { n as createCloudflareQueueBatchHandler, t as createCloudflareQueueRuntimeClient } from "../../cloudflare-client-
|
|
6
|
+
import { t as getCloudflareQueueName } from "../../cloudflare-resource-name-BUNNqgkg.js";
|
|
7
|
+
import { n as createCloudflareQueueBatchHandler, t as createCloudflareQueueRuntimeClient } from "../../cloudflare-client-BasaJ68s.js";
|
|
8
8
|
import { runInRunScopes } from "@vite-hub/runtime/internal/run-scope";
|
|
9
9
|
//#region ../internal/src/runtime/app.ts
|
|
10
10
|
function resolveAppFetch(label, app) {
|
|
@@ -102,7 +102,8 @@ function createQueueCloudflareWorker(options = {}) {
|
|
|
102
102
|
await runWithQueueRuntimeEvent(runtimeEvent, async () => {
|
|
103
103
|
await runInRunScopes(() => definition.handler(createQueueJob(message, currentBatch)));
|
|
104
104
|
});
|
|
105
|
-
}
|
|
105
|
+
},
|
|
106
|
+
queue: definitionName
|
|
106
107
|
})(batch);
|
|
107
108
|
});
|
|
108
109
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as QueueClient, h as LocalQueueStatus } from "../../types-
|
|
2
|
-
import { t as LocalQueueEngine } from "../../local-
|
|
3
|
-
import { n as QueueRuntimeOptions, t as QueueRuntimeDriverOptions } from "../../types-
|
|
1
|
+
import { b as QueueClient, h as LocalQueueStatus } from "../../types-klaR79hV.js";
|
|
2
|
+
import { t as LocalQueueEngine } from "../../local-DAL5ZgDg.js";
|
|
3
|
+
import { n as QueueRuntimeOptions, t as QueueRuntimeDriverOptions } from "../../types-D6hDNcMY.js";
|
|
4
4
|
//#region src/internal/runtime/local-client.d.ts
|
|
5
5
|
export declare function createLocalQueueRuntimeClient(options: QueueRuntimeDriverOptions): Promise<QueueClient>;
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "../../error-diagnostics-
|
|
2
|
-
import { c as loadQueueDefinition, l as missingQueueDefinitionError } from "../../state-
|
|
3
|
-
import { t as defaultLocalQueueBase } from "../../config-
|
|
4
|
-
import { i as localQueueDeliveryRules, n as createLocalQueueEngine, t as createLocalQueueClient } from "../../local-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "../../error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { c as loadQueueDefinition, l as missingQueueDefinitionError } from "../../state-ER1YdCBF.js";
|
|
3
|
+
import { t as defaultLocalQueueBase } from "../../config-YEuaeQVq.js";
|
|
4
|
+
import { i as localQueueDeliveryRules, n as createLocalQueueEngine, t as createLocalQueueClient } from "../../local-CnBd5jdm.js";
|
|
5
5
|
import { resolve } from "pathe";
|
|
6
6
|
//#region src/internal/runtime/local-client.ts
|
|
7
7
|
const engines = /* @__PURE__ */ new Map();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as QueueClient } from "../../types-
|
|
2
|
-
import "../../local-
|
|
3
|
-
import { n as QueueRuntimeOptions, t as QueueRuntimeDriverOptions } from "../../types-
|
|
1
|
+
import { b as QueueClient } from "../../types-klaR79hV.js";
|
|
2
|
+
import "../../local-DAL5ZgDg.js";
|
|
3
|
+
import { n as QueueRuntimeOptions, t as QueueRuntimeDriverOptions } from "../../types-D6hDNcMY.js";
|
|
4
4
|
import postgres from "postgres";
|
|
5
5
|
//#region src/providers/postgres.d.ts
|
|
6
6
|
/** A postgres.js client. */
|
|
@@ -24,12 +24,13 @@ export type PostgresQueueDatabases = Readonly<Record<string, {
|
|
|
24
24
|
export type PostgresQueueDatabasesLoader = () => Promise<PostgresQueueDatabases>;
|
|
25
25
|
interface ResolvedConnection {
|
|
26
26
|
connection: PostgresQueueConnection;
|
|
27
|
-
/** The URL, or the client of the Database. A Database can replace its client when its environment changes. */
|
|
28
27
|
key: object | string;
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* The connection of the jobs: `QUEUE_POSTGRES_URL` when it is set, else the postgres.js client of the Database that the
|
|
32
31
|
* build found on Postgres. The jobs then use the connection that the Database resolves, whatever variable it reads.
|
|
32
|
+
* Another driver, such as a node-postgres Pool, cannot run the jobs, so they get a postgres.js client on the connection
|
|
33
|
+
* URL of the Database.
|
|
33
34
|
*/
|
|
34
35
|
export declare function resolvePostgresQueueConnection(config: {
|
|
35
36
|
database?: string;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "../../error-diagnostics-
|
|
2
|
-
import { c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, s as queueProviderResult, t as readQueueTimes, u as createQueueMessageId } from "../../duration-
|
|
3
|
-
import { c as loadQueueDefinition, l as missingQueueDefinitionError, p as setQueueRuntimeJobStore, s as listQueueDefinitionNames } from "../../state-
|
|
4
|
-
import { r as postgresQueueUrlVariable } from "../../config-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "../../error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, s as queueProviderResult, t as readQueueTimes, u as createQueueMessageId } from "../../duration-CshzgSSx.js";
|
|
3
|
+
import { c as loadQueueDefinition, l as missingQueueDefinitionError, p as setQueueRuntimeJobStore, s as listQueueDefinitionNames } from "../../state-ER1YdCBF.js";
|
|
4
|
+
import { r as postgresQueueUrlVariable } from "../../config-YEuaeQVq.js";
|
|
5
5
|
import { t as invariant } from "../../invariant-D8_xBqmZ.js";
|
|
6
|
-
import { i as reportQueueDeliveryError, n as createQueueDeliveryErrorReport, r as isNonRetryableQueueError, t as checkQueueHandlerResponse } from "../../handler-response-
|
|
7
|
-
import { i as localQueueDeliveryRules, r as delayMs } from "../../local-
|
|
6
|
+
import { i as reportQueueDeliveryError, n as createQueueDeliveryErrorReport, r as isNonRetryableQueueError, t as checkQueueHandlerResponse } from "../../handler-response-ChtAjPNo.js";
|
|
7
|
+
import { i as localQueueDeliveryRules, r as delayMs } from "../../local-CnBd5jdm.js";
|
|
8
8
|
import { hostname } from "node:os";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
import { runInRunScopes } from "@vite-hub/runtime/internal/run-scope";
|
|
11
11
|
import postgres from "postgres";
|
|
12
|
-
/** Jobs that `jobs()` lists at most. */
|
|
13
12
|
const listLimit = 1e3;
|
|
14
13
|
const identifier = /^[a-z_][a-z\d_]{0,62}$/;
|
|
15
14
|
/** Returns `true` for a postgres.js client, such as the `$client` of a Postgres Database. */
|
|
@@ -65,7 +64,6 @@ function createPostgresQueueEngine(options) {
|
|
|
65
64
|
let pumping;
|
|
66
65
|
let pumpAgain = false;
|
|
67
66
|
let closed = false;
|
|
68
|
-
/** Creates the table once per process. Concurrent cold starts wait for one transaction lock, so they do not race. */
|
|
69
67
|
function ensureTable() {
|
|
70
68
|
ready ??= (async () => {
|
|
71
69
|
try {
|
|
@@ -125,7 +123,6 @@ function createPostgresQueueEngine(options) {
|
|
|
125
123
|
concurrency.set(queue, value);
|
|
126
124
|
return value;
|
|
127
125
|
}
|
|
128
|
-
/** Takes due jobs while a Queue Definition has a free slot, and starts them. */
|
|
129
126
|
async function pump() {
|
|
130
127
|
let wait = pollIntervalMs;
|
|
131
128
|
try {
|
|
@@ -442,6 +439,8 @@ function createPostgresQueueClient(engine, queue, resolveEngine) {
|
|
|
442
439
|
//#endregion
|
|
443
440
|
//#region src/internal/runtime/postgres-client.ts
|
|
444
441
|
const postgresUrl = /^postgres(?:ql)?:\/\//i;
|
|
442
|
+
/** A Postgres Database answers this key with a function that returns its connection URL. `@vite-hub/database` sets it. */
|
|
443
|
+
const databaseConnectionUrl = Symbol.for("vitehub.database.postgres.connection-url");
|
|
445
444
|
let loadDatabases;
|
|
446
445
|
let closing;
|
|
447
446
|
const engines = /* @__PURE__ */ new Map();
|
|
@@ -469,6 +468,8 @@ function startWorkers(state, engine) {
|
|
|
469
468
|
/**
|
|
470
469
|
* The connection of the jobs: `QUEUE_POSTGRES_URL` when it is set, else the postgres.js client of the Database that the
|
|
471
470
|
* build found on Postgres. The jobs then use the connection that the Database resolves, whatever variable it reads.
|
|
471
|
+
* Another driver, such as a node-postgres Pool, cannot run the jobs, so they get a postgres.js client on the connection
|
|
472
|
+
* URL of the Database.
|
|
472
473
|
*/
|
|
473
474
|
async function resolvePostgresQueueConnection(config, databases = loadDatabases, env = process.env) {
|
|
474
475
|
const url = env[postgresQueueUrlVariable]?.trim();
|
|
@@ -486,6 +487,12 @@ async function resolvePostgresQueueConnection(config, databases = loadDatabases,
|
|
|
486
487
|
connection: { client },
|
|
487
488
|
key: client
|
|
488
489
|
};
|
|
490
|
+
const readUrl = entry ? Reflect.get(entry.db, databaseConnectionUrl) : void 0;
|
|
491
|
+
const databaseUrl = typeof readUrl === "function" ? readUrl() : void 0;
|
|
492
|
+
if (typeof databaseUrl === "string") return {
|
|
493
|
+
connection: { url: databaseUrl },
|
|
494
|
+
key: databaseUrl
|
|
495
|
+
};
|
|
489
496
|
}
|
|
490
497
|
throw queueErrorDiagnostics.QUEUE_POSTGRES_MISSING_CONNECTION({ database: config.database });
|
|
491
498
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as QueueJobStore, C as QueueDefinitionRegistry, b as QueueClient, x as QueueDefinition } from "../../types-
|
|
2
|
-
import { n as QueueRuntimeOptions, t as QueueRuntimeDriverOptions } from "../../types-
|
|
1
|
+
import { A as QueueJobStore, C as QueueDefinitionRegistry, b as QueueClient, x as QueueDefinition } from "../../types-klaR79hV.js";
|
|
2
|
+
import { n as QueueRuntimeOptions, t as QueueRuntimeDriverOptions } from "../../types-D6hDNcMY.js";
|
|
3
3
|
//#region src/internal/runtime/state.d.ts
|
|
4
4
|
export type QueueRuntimeClientFactory = (options: QueueRuntimeDriverOptions) => QueueClient | Promise<QueueClient>;
|
|
5
5
|
export declare function missingQueueDefinitionError(queue: string): Error;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getQueueRuntimeEvent, c as loadQueueDefinition, d as setQueueRuntimeConfig, f as setQueueRuntimeEventDefaults, i as getQueueRuntimeConfig, l as missingQueueDefinitionError, m as setQueueRuntimeRegistry, n as getOrCreateQueueClient, o as getQueueRuntimeJobStore, p as setQueueRuntimeJobStore, r as getQueueRuntimeClientFactory, s as listQueueDefinitionNames, t as enterQueueRuntimeEvent, u as runWithQueueRuntimeEvent } from "../../state-
|
|
1
|
+
import { a as getQueueRuntimeEvent, c as loadQueueDefinition, d as setQueueRuntimeConfig, f as setQueueRuntimeEventDefaults, i as getQueueRuntimeConfig, l as missingQueueDefinitionError, m as setQueueRuntimeRegistry, n as getOrCreateQueueClient, o as getQueueRuntimeJobStore, p as setQueueRuntimeJobStore, r as getQueueRuntimeClientFactory, s as listQueueDefinitionNames, t as enterQueueRuntimeEvent, u as runWithQueueRuntimeEvent } from "../../state-ER1YdCBF.js";
|
|
2
2
|
export { enterQueueRuntimeEvent, getOrCreateQueueClient, getQueueRuntimeClientFactory, getQueueRuntimeConfig, getQueueRuntimeEvent, getQueueRuntimeJobStore, listQueueDefinitionNames, loadQueueDefinition, missingQueueDefinitionError, runWithQueueRuntimeEvent, setQueueRuntimeConfig, setQueueRuntimeEventDefaults, setQueueRuntimeJobStore, setQueueRuntimeRegistry };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as QueueDriverOptions, b as QueueClient } from "../../types-
|
|
1
|
+
import { T as QueueDriverOptions, b as QueueClient } from "../../types-klaR79hV.js";
|
|
2
2
|
//#region src/internal/runtime/vercel-client.d.ts
|
|
3
3
|
export declare function createVercelQueueRuntimeClient(options: QueueDriverOptions): Promise<QueueClient>;
|
|
4
4
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "../../error-diagnostics-
|
|
2
|
-
import { c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, s as queueProviderResult, t as readQueueTimes, u as createQueueMessageId } from "../../duration-
|
|
3
|
-
import { t as resolveVercelQueueRegion } from "../../vercel-region-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "../../error-diagnostics-DukggGP6.js";
|
|
2
|
+
import { c as queueRemovedOptionsError, d as normalizeQueueEnqueueInput, l as queueUnsupportedOptionsError, s as queueProviderResult, t as readQueueTimes, u as createQueueMessageId } from "../../duration-CshzgSSx.js";
|
|
3
|
+
import { t as resolveVercelQueueRegion } from "../../vercel-region-DOciq2kx.js";
|
|
4
4
|
//#region src/providers/vercel.ts
|
|
5
5
|
function invalidVercelSendResponse(cause) {
|
|
6
6
|
return [queueErrorDiagnostics.QUEUE_PROVIDER_INVALID_RESPONSE({ cause }), void 0];
|
|
@@ -48,7 +48,6 @@ function isVercelQueueSDK(value) {
|
|
|
48
48
|
};
|
|
49
49
|
return hasCallableMethod("send") && hasCallableMethod("handleCallback");
|
|
50
50
|
}
|
|
51
|
-
/** The cause of `QUEUE_PROVIDER_FAILED` when Vercel rejects jobs of a batch. `results` has each job's result in input order. */
|
|
52
51
|
function batchRejected(results) {
|
|
53
52
|
const failed = results.filter((result) => result.status === "failed").length;
|
|
54
53
|
return Object.assign(queueErrorDiagnostics.QUEUE_VERCEL_BATCH_REJECTED({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as QueueClient } from "../../types-
|
|
2
|
-
import { t as QueueRuntimeDriverOptions } from "../../types-
|
|
1
|
+
import { b as QueueClient } from "../../types-klaR79hV.js";
|
|
2
|
+
import { t as QueueRuntimeDriverOptions } from "../../types-D6hDNcMY.js";
|
|
3
3
|
//#region src/internal/runtime/worker-client.d.ts
|
|
4
4
|
/** Worker package conditions keep the Node driver and its optional peer outside the build graph. */
|
|
5
5
|
export declare function createPostgresQueueRuntimeClient(options: QueueRuntimeDriverOptions): Promise<QueueClient>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "../../error-diagnostics-
|
|
1
|
+
import { t as queueErrorDiagnostics } from "../../error-diagnostics-DukggGP6.js";
|
|
2
2
|
//#region src/internal/runtime/worker-client.ts
|
|
3
3
|
/** Worker package conditions keep the Node driver and its optional peer outside the build graph. */
|
|
4
4
|
async function createPostgresQueueRuntimeClient(options) {
|