@lunora/queue 1.0.0-alpha.11 → 1.0.0-alpha.12

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 CHANGED
@@ -1,3 +1,5 @@
1
+ import { QueueBindingLike, MessageBatchLike, QueueSendOptions, MessageSendRequestLike, QueueSendBatchOptions } from '@lunora/platform';
2
+ export type { MessageBatchLike, MessageLike, MessageSendRequestLike, QueueBindingLike, QueueContentType, QueueRetryOptions, QueueSendBatchOptions, QueueSendOptions } from '@lunora/platform';
1
3
  /**
2
4
  * Shared types for dispatching a Lunora function back into the worker from a
3
5
  * server-initiated context (a workflow body, a queue handler, a scheduled job).
@@ -24,60 +26,6 @@ interface DispatchLogger {
24
26
  info: (message: unknown, ...rest: unknown[]) => void;
25
27
  warn: (message: unknown, ...rest: unknown[]) => void;
26
28
  }
27
- /** How a queue message body is serialized on the wire (Cloudflare default `"json"`). */
28
- type QueueContentType = "bytes" | "json" | "text" | "v8";
29
- /** Options for a single `producer.send(body, options?)`. */
30
- interface QueueSendOptions {
31
- /** Wire serialization for this message (defaults to the queue's content type). */
32
- contentType?: QueueContentType;
33
- /** Per-message delivery delay in seconds (0–43200, i.e. up to 12 hours). */
34
- delaySeconds?: number;
35
- }
36
- /** Options for a `producer.sendBatch(messages, options?)`. */
37
- interface QueueSendBatchOptions {
38
- /** Delivery delay applied to the whole batch, in seconds. */
39
- delaySeconds?: number;
40
- }
41
- /** One entry in a `sendBatch` call — a body plus optional per-message overrides. */
42
- interface MessageSendRequestLike<Body = unknown> {
43
- body: Body;
44
- contentType?: QueueContentType;
45
- delaySeconds?: number;
46
- }
47
- /**
48
- * Minimal structural projection of workers-types' `Queue&lt;Body>` (the producer
49
- * binding). The real binding's `send`/`sendBatch` resolve to a metadata object;
50
- * we widen the return to `Promise&lt;unknown>` so a plain-object fake satisfies it.
51
- */
52
- interface QueueBindingLike<Body = unknown> {
53
- send: (message: Body, options?: QueueSendOptions) => Promise<unknown>;
54
- sendBatch: (messages: Iterable<MessageSendRequestLike<Body>>, options?: QueueSendBatchOptions) => Promise<unknown>;
55
- }
56
- /** Options for retrying a message / batch (`message.retry({ delaySeconds })`). */
57
- interface QueueRetryOptions {
58
- delaySeconds?: number;
59
- }
60
- /** Structural mirror of workers-types' `Message&lt;Body>` (one delivered message). */
61
- interface MessageLike<Body = unknown> {
62
- /** Acknowledge this message so it is not redelivered. */
63
- ack: () => void;
64
- readonly attempts: number;
65
- readonly body: Body;
66
- readonly id: string;
67
- /** Explicitly retry this message (optionally after a delay). */
68
- retry: (options?: QueueRetryOptions) => void;
69
- readonly timestamp: Date;
70
- }
71
- /** Structural mirror of workers-types' `MessageBatch&lt;Body>` handed to a consumer. */
72
- interface MessageBatchLike<Body = unknown> {
73
- /** Acknowledge every message in the batch. */
74
- ackAll: () => void;
75
- readonly messages: ReadonlyArray<MessageLike<Body>>;
76
- /** The queue name this batch was delivered from (`batch.queue`), used to route. */
77
- readonly queue: string;
78
- /** Retry every message in the batch (optionally after a delay). */
79
- retryAll: (options?: QueueRetryOptions) => void;
80
- }
81
29
  /**
82
30
  * The typed producer bound to `ctx.queues.&lt;name>`. Sending is a side effect, so
83
31
  * the generated context exposes this only on `MutationCtx` / `ActionCtx` (never
@@ -334,4 +282,4 @@ interface RunContextOptions {
334
282
  }
335
283
  /** Assemble the {@link QueueRunContext} passed to a `defineQueue` handler. */
336
284
  declare const createQueueRunContext: (options: RunContextOptions) => QueueRunContext;
337
- export { type ArgsOf, type CapturedQueueMessage, type FunctionReference, type LunoraQueuesOptions, type MessageBatchLike, type MessageLike, type MessageSendRequestLike, type QueueBindingLike, type QueueBindingSpec, type QueueCaptureOptions, type QueueCaptureSink, type QueueConfig, type QueueConsumerMode, type QueueConsumerTuning, type QueueContentType, type QueueDefinition, type QueueEnv, type QueueHandler, type DispatchLogger as QueueLogger, type QueueProducer, type QueueRegistry, type QueueRegistryEntry, type QueueRetryOptions, type QueueRunContext, type DispatchRunFunction as QueueRunFunction, type QueueSendBatchOptions, type QueueSendOptions, type Queues, type RunFunctionOptions, createQueueCaptureSink, createQueueContext, createQueueRunContext, createQueues, defineQueue, dispatchQueueBatch, isQueueDefinition, queueBindingName, queueDefaultName, shouldCaptureQueue };
285
+ export { type ArgsOf, type CapturedQueueMessage, type FunctionReference, type LunoraQueuesOptions, type QueueBindingSpec, type QueueCaptureOptions, type QueueCaptureSink, type QueueConfig, type QueueConsumerMode, type QueueConsumerTuning, type QueueDefinition, type QueueEnv, type QueueHandler, type DispatchLogger as QueueLogger, type QueueProducer, type QueueRegistry, type QueueRegistryEntry, type QueueRunContext, type DispatchRunFunction as QueueRunFunction, type Queues, type RunFunctionOptions, createQueueCaptureSink, createQueueContext, createQueueRunContext, createQueues, defineQueue, dispatchQueueBatch, isQueueDefinition, queueBindingName, queueDefaultName, shouldCaptureQueue };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { QueueBindingLike, MessageBatchLike, QueueSendOptions, MessageSendRequestLike, QueueSendBatchOptions } from '@lunora/platform';
2
+ export type { MessageBatchLike, MessageLike, MessageSendRequestLike, QueueBindingLike, QueueContentType, QueueRetryOptions, QueueSendBatchOptions, QueueSendOptions } from '@lunora/platform';
1
3
  /**
2
4
  * Shared types for dispatching a Lunora function back into the worker from a
3
5
  * server-initiated context (a workflow body, a queue handler, a scheduled job).
@@ -24,60 +26,6 @@ interface DispatchLogger {
24
26
  info: (message: unknown, ...rest: unknown[]) => void;
25
27
  warn: (message: unknown, ...rest: unknown[]) => void;
26
28
  }
27
- /** How a queue message body is serialized on the wire (Cloudflare default `"json"`). */
28
- type QueueContentType = "bytes" | "json" | "text" | "v8";
29
- /** Options for a single `producer.send(body, options?)`. */
30
- interface QueueSendOptions {
31
- /** Wire serialization for this message (defaults to the queue's content type). */
32
- contentType?: QueueContentType;
33
- /** Per-message delivery delay in seconds (0–43200, i.e. up to 12 hours). */
34
- delaySeconds?: number;
35
- }
36
- /** Options for a `producer.sendBatch(messages, options?)`. */
37
- interface QueueSendBatchOptions {
38
- /** Delivery delay applied to the whole batch, in seconds. */
39
- delaySeconds?: number;
40
- }
41
- /** One entry in a `sendBatch` call — a body plus optional per-message overrides. */
42
- interface MessageSendRequestLike<Body = unknown> {
43
- body: Body;
44
- contentType?: QueueContentType;
45
- delaySeconds?: number;
46
- }
47
- /**
48
- * Minimal structural projection of workers-types' `Queue&lt;Body>` (the producer
49
- * binding). The real binding's `send`/`sendBatch` resolve to a metadata object;
50
- * we widen the return to `Promise&lt;unknown>` so a plain-object fake satisfies it.
51
- */
52
- interface QueueBindingLike<Body = unknown> {
53
- send: (message: Body, options?: QueueSendOptions) => Promise<unknown>;
54
- sendBatch: (messages: Iterable<MessageSendRequestLike<Body>>, options?: QueueSendBatchOptions) => Promise<unknown>;
55
- }
56
- /** Options for retrying a message / batch (`message.retry({ delaySeconds })`). */
57
- interface QueueRetryOptions {
58
- delaySeconds?: number;
59
- }
60
- /** Structural mirror of workers-types' `Message&lt;Body>` (one delivered message). */
61
- interface MessageLike<Body = unknown> {
62
- /** Acknowledge this message so it is not redelivered. */
63
- ack: () => void;
64
- readonly attempts: number;
65
- readonly body: Body;
66
- readonly id: string;
67
- /** Explicitly retry this message (optionally after a delay). */
68
- retry: (options?: QueueRetryOptions) => void;
69
- readonly timestamp: Date;
70
- }
71
- /** Structural mirror of workers-types' `MessageBatch&lt;Body>` handed to a consumer. */
72
- interface MessageBatchLike<Body = unknown> {
73
- /** Acknowledge every message in the batch. */
74
- ackAll: () => void;
75
- readonly messages: ReadonlyArray<MessageLike<Body>>;
76
- /** The queue name this batch was delivered from (`batch.queue`), used to route. */
77
- readonly queue: string;
78
- /** Retry every message in the batch (optionally after a delay). */
79
- retryAll: (options?: QueueRetryOptions) => void;
80
- }
81
29
  /**
82
30
  * The typed producer bound to `ctx.queues.&lt;name>`. Sending is a side effect, so
83
31
  * the generated context exposes this only on `MutationCtx` / `ActionCtx` (never
@@ -334,4 +282,4 @@ interface RunContextOptions {
334
282
  }
335
283
  /** Assemble the {@link QueueRunContext} passed to a `defineQueue` handler. */
336
284
  declare const createQueueRunContext: (options: RunContextOptions) => QueueRunContext;
337
- export { type ArgsOf, type CapturedQueueMessage, type FunctionReference, type LunoraQueuesOptions, type MessageBatchLike, type MessageLike, type MessageSendRequestLike, type QueueBindingLike, type QueueBindingSpec, type QueueCaptureOptions, type QueueCaptureSink, type QueueConfig, type QueueConsumerMode, type QueueConsumerTuning, type QueueContentType, type QueueDefinition, type QueueEnv, type QueueHandler, type DispatchLogger as QueueLogger, type QueueProducer, type QueueRegistry, type QueueRegistryEntry, type QueueRetryOptions, type QueueRunContext, type DispatchRunFunction as QueueRunFunction, type QueueSendBatchOptions, type QueueSendOptions, type Queues, type RunFunctionOptions, createQueueCaptureSink, createQueueContext, createQueueRunContext, createQueues, defineQueue, dispatchQueueBatch, isQueueDefinition, queueBindingName, queueDefaultName, shouldCaptureQueue };
285
+ export { type ArgsOf, type CapturedQueueMessage, type FunctionReference, type LunoraQueuesOptions, type QueueBindingSpec, type QueueCaptureOptions, type QueueCaptureSink, type QueueConfig, type QueueConsumerMode, type QueueConsumerTuning, type QueueDefinition, type QueueEnv, type QueueHandler, type DispatchLogger as QueueLogger, type QueueProducer, type QueueRegistry, type QueueRegistryEntry, type QueueRunContext, type DispatchRunFunction as QueueRunFunction, type Queues, type RunFunctionOptions, createQueueCaptureSink, createQueueContext, createQueueRunContext, createQueues, defineQueue, dispatchQueueBatch, isQueueDefinition, queueBindingName, queueDefaultName, shouldCaptureQueue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/queue",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.12",
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,7 +44,8 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@lunora/errors": "1.0.0-alpha.9"
47
+ "@lunora/errors": "1.0.0-alpha.9",
48
+ "@lunora/platform": "1.0.0-alpha.1"
48
49
  },
49
50
  "engines": {
50
51
  "node": "^22.15.0 || >=24.11.0"