@lunora/queue 1.0.0-alpha.17 → 1.0.0-alpha.18
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/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ interface DispatchLogger {
|
|
|
27
27
|
warn: (message: unknown, ...rest: unknown[]) => void;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* The typed producer bound to `ctx.queues
|
|
30
|
+
* The typed producer bound to `ctx.queues.<name>`. Sending is a side effect, so
|
|
31
31
|
* the generated context exposes this only on `MutationCtx` / `ActionCtx` (never
|
|
32
32
|
* the deterministic `QueryCtx`), mirroring `ctx.scheduler` / `ctx.workflows`.
|
|
33
33
|
*/
|
|
@@ -100,8 +100,8 @@ interface QueueConfig<Body = unknown> extends QueueConsumerTuning {
|
|
|
100
100
|
interface QueueDefinition<Body = unknown> extends QueueConfig<Body> {
|
|
101
101
|
/**
|
|
102
102
|
* Phantom carrier for the message body type, so codegen can type the
|
|
103
|
-
* generated `ctx.queues
|
|
104
|
-
* `typeof
|
|
103
|
+
* generated `ctx.queues.<name>` producer as `QueueProducer<Body>` from
|
|
104
|
+
* `typeof <export>`. Never assigned at runtime (type-only).
|
|
105
105
|
*/
|
|
106
106
|
readonly __lunoraBody?: Body;
|
|
107
107
|
/** Runtime brand identifying a `defineQueue` result. */
|
|
@@ -122,7 +122,7 @@ interface QueueRegistryEntry {
|
|
|
122
122
|
* The `defineQueue` result (carries the push handler). The body type is
|
|
123
123
|
* erased to `any` here because the registry is heterogeneous — different
|
|
124
124
|
* queues carry different message bodies, and the handler param is
|
|
125
|
-
* contravariant, so a precise `QueueDefinition
|
|
125
|
+
* contravariant, so a precise `QueueDefinition<Body>` would not be assignable
|
|
126
126
|
* to a shared `unknown`-bodied slot. Runtime dispatch passes the delivered
|
|
127
127
|
* batch straight through, so the erasure is type-only.
|
|
128
128
|
*/
|
|
@@ -216,7 +216,7 @@ declare const createQueueCaptureSink: (env: QueueEnv, options?: QueueCaptureOpti
|
|
|
216
216
|
* Build the `ctx.queues` map for a request: resolve every spec's `env[binding]`
|
|
217
217
|
* into the `exportName → Queue binding` map and wrap it in {@link createQueues}.
|
|
218
218
|
* A spec whose binding is absent from `env` is skipped here — the helpful "no
|
|
219
|
-
* queue named …" error is raised lazily by `ctx.queues
|
|
219
|
+
* queue named …" error is raised lazily by `ctx.queues.<name>.send(...)` when
|
|
220
220
|
* the missing queue is actually used.
|
|
221
221
|
*/
|
|
222
222
|
declare const createQueueContext: (env: Record<string, unknown>, specs: ReadonlyArray<QueueBindingSpec>) => Queues;
|
|
@@ -242,7 +242,7 @@ declare const queueBindingName: (exportName: string) => string;
|
|
|
242
242
|
declare const queueDefaultName: (exportName: string) => string;
|
|
243
243
|
/**
|
|
244
244
|
* Declare a Cloudflare Queue deployed alongside the app. Pure validation +
|
|
245
|
-
* branding: codegen discovers the export, emits the typed `ctx.queues
|
|
245
|
+
* branding: codegen discovers the export, emits the typed `ctx.queues.<name>`
|
|
246
246
|
* producer and (for push consumers) the worker `queue()` dispatch; the config
|
|
247
247
|
* layer reconciles the wrangler `queues.producers[]` / `queues.consumers[]`
|
|
248
248
|
* entries from the same definition.
|
|
@@ -252,7 +252,7 @@ declare const queueDefaultName: (exportName: string) => string;
|
|
|
252
252
|
* import { defineQueue } from "@lunora/queue";
|
|
253
253
|
* import { api } from "./_generated/api";
|
|
254
254
|
*
|
|
255
|
-
* export const emailQueue = defineQueue
|
|
255
|
+
* export const emailQueue = defineQueue<{ to: string }>({
|
|
256
256
|
* handler: async (ctx, batch) => {
|
|
257
257
|
* for (const message of batch.messages) {
|
|
258
258
|
* await ctx.run(api.email.send, { to: message.body.to });
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface DispatchLogger {
|
|
|
27
27
|
warn: (message: unknown, ...rest: unknown[]) => void;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* The typed producer bound to `ctx.queues
|
|
30
|
+
* The typed producer bound to `ctx.queues.<name>`. Sending is a side effect, so
|
|
31
31
|
* the generated context exposes this only on `MutationCtx` / `ActionCtx` (never
|
|
32
32
|
* the deterministic `QueryCtx`), mirroring `ctx.scheduler` / `ctx.workflows`.
|
|
33
33
|
*/
|
|
@@ -100,8 +100,8 @@ interface QueueConfig<Body = unknown> extends QueueConsumerTuning {
|
|
|
100
100
|
interface QueueDefinition<Body = unknown> extends QueueConfig<Body> {
|
|
101
101
|
/**
|
|
102
102
|
* Phantom carrier for the message body type, so codegen can type the
|
|
103
|
-
* generated `ctx.queues
|
|
104
|
-
* `typeof
|
|
103
|
+
* generated `ctx.queues.<name>` producer as `QueueProducer<Body>` from
|
|
104
|
+
* `typeof <export>`. Never assigned at runtime (type-only).
|
|
105
105
|
*/
|
|
106
106
|
readonly __lunoraBody?: Body;
|
|
107
107
|
/** Runtime brand identifying a `defineQueue` result. */
|
|
@@ -122,7 +122,7 @@ interface QueueRegistryEntry {
|
|
|
122
122
|
* The `defineQueue` result (carries the push handler). The body type is
|
|
123
123
|
* erased to `any` here because the registry is heterogeneous — different
|
|
124
124
|
* queues carry different message bodies, and the handler param is
|
|
125
|
-
* contravariant, so a precise `QueueDefinition
|
|
125
|
+
* contravariant, so a precise `QueueDefinition<Body>` would not be assignable
|
|
126
126
|
* to a shared `unknown`-bodied slot. Runtime dispatch passes the delivered
|
|
127
127
|
* batch straight through, so the erasure is type-only.
|
|
128
128
|
*/
|
|
@@ -216,7 +216,7 @@ declare const createQueueCaptureSink: (env: QueueEnv, options?: QueueCaptureOpti
|
|
|
216
216
|
* Build the `ctx.queues` map for a request: resolve every spec's `env[binding]`
|
|
217
217
|
* into the `exportName → Queue binding` map and wrap it in {@link createQueues}.
|
|
218
218
|
* A spec whose binding is absent from `env` is skipped here — the helpful "no
|
|
219
|
-
* queue named …" error is raised lazily by `ctx.queues
|
|
219
|
+
* queue named …" error is raised lazily by `ctx.queues.<name>.send(...)` when
|
|
220
220
|
* the missing queue is actually used.
|
|
221
221
|
*/
|
|
222
222
|
declare const createQueueContext: (env: Record<string, unknown>, specs: ReadonlyArray<QueueBindingSpec>) => Queues;
|
|
@@ -242,7 +242,7 @@ declare const queueBindingName: (exportName: string) => string;
|
|
|
242
242
|
declare const queueDefaultName: (exportName: string) => string;
|
|
243
243
|
/**
|
|
244
244
|
* Declare a Cloudflare Queue deployed alongside the app. Pure validation +
|
|
245
|
-
* branding: codegen discovers the export, emits the typed `ctx.queues
|
|
245
|
+
* branding: codegen discovers the export, emits the typed `ctx.queues.<name>`
|
|
246
246
|
* producer and (for push consumers) the worker `queue()` dispatch; the config
|
|
247
247
|
* layer reconciles the wrangler `queues.producers[]` / `queues.consumers[]`
|
|
248
248
|
* entries from the same definition.
|
|
@@ -252,7 +252,7 @@ declare const queueDefaultName: (exportName: string) => string;
|
|
|
252
252
|
* import { defineQueue } from "@lunora/queue";
|
|
253
253
|
* import { api } from "./_generated/api";
|
|
254
254
|
*
|
|
255
|
-
* export const emailQueue = defineQueue
|
|
255
|
+
* export const emailQueue = defineQueue<{ to: string }>({
|
|
256
256
|
* handler: async (ctx, batch) => {
|
|
257
257
|
* for (const message of batch.messages) {
|
|
258
258
|
* await ctx.run(api.email.send, { to: message.body.to });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/queue",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.18",
|
|
4
4
|
"description": "Cloudflare Queues for Lunora: defineQueue producers + consumers, the ctx.queues surface, and the generated queue() worker handler",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"background-jobs",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
48
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
47
|
+
"@lunora/errors": "1.0.0-alpha.14",
|
|
48
|
+
"@lunora/platform": "1.0.0-alpha.6"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": "^22.15.0 || >=24.11.0"
|