@lunora/queue 1.0.0-alpha.115 → 1.0.0-alpha.116

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
@@ -97,8 +97,8 @@ interface QueueRunContext {
97
97
  /** The worker `env` (bindings + vars). */
98
98
  readonly env: Record<string, unknown>;
99
99
  /**
100
- * `ctx.live.publish` — push an event to the SSE subscribers of a
101
- * `defineLiveStream` on the shard the publish names. Present only when the
100
+ * `ctx.live.publish(ref, payload)` — push an event to the SSE subscribers of the
101
+ * `defineLiveStream` that declares `ref`'s topic, on the shard the publish names. Present only when the
102
102
  * runtime hands the consumer a publisher (an app that declares a live stream on
103
103
  * a target that serves one); absent otherwise. A consumer runs in the Worker, so
104
104
  * the publish is forwarded to the shard rather than made in-process.
@@ -120,11 +120,20 @@ interface QueueRunContext {
120
120
  * builds it without importing this package. See {@link QueueRunContext.live}.
121
121
  */
122
122
  interface QueueLivePublisher {
123
- publish: (topic: string, payload: unknown, options: {
123
+ publish: <Payload>(topic: QueueLiveTopicRef<Payload>, payload: NoInfer<Payload>, options?: {
124
124
  shardKey?: string;
125
- stream: string;
126
125
  }) => Promise<void>;
127
126
  }
127
+ /**
128
+ * A reference to one declared live topic, as `_generated/live.ts` hands it out.
129
+ * Structural, so this package needs neither the server nor the client: the phantom
130
+ * `Payload` is what types the event.
131
+ */
132
+ interface QueueLiveTopicRef<Payload = unknown> {
133
+ readonly __lunoraLive: string;
134
+ readonly __payload?: Payload;
135
+ readonly topic: string;
136
+ }
128
137
  /**
129
138
  * One delivered message as the push handler sees it: the Cloudflare `Message`
130
139
  * plus `run` — a {@link QueueRunContext.run} pinned to THIS message.
package/dist/index.d.ts CHANGED
@@ -97,8 +97,8 @@ interface QueueRunContext {
97
97
  /** The worker `env` (bindings + vars). */
98
98
  readonly env: Record<string, unknown>;
99
99
  /**
100
- * `ctx.live.publish` — push an event to the SSE subscribers of a
101
- * `defineLiveStream` on the shard the publish names. Present only when the
100
+ * `ctx.live.publish(ref, payload)` — push an event to the SSE subscribers of the
101
+ * `defineLiveStream` that declares `ref`'s topic, on the shard the publish names. Present only when the
102
102
  * runtime hands the consumer a publisher (an app that declares a live stream on
103
103
  * a target that serves one); absent otherwise. A consumer runs in the Worker, so
104
104
  * the publish is forwarded to the shard rather than made in-process.
@@ -120,11 +120,20 @@ interface QueueRunContext {
120
120
  * builds it without importing this package. See {@link QueueRunContext.live}.
121
121
  */
122
122
  interface QueueLivePublisher {
123
- publish: (topic: string, payload: unknown, options: {
123
+ publish: <Payload>(topic: QueueLiveTopicRef<Payload>, payload: NoInfer<Payload>, options?: {
124
124
  shardKey?: string;
125
- stream: string;
126
125
  }) => Promise<void>;
127
126
  }
127
+ /**
128
+ * A reference to one declared live topic, as `_generated/live.ts` hands it out.
129
+ * Structural, so this package needs neither the server nor the client: the phantom
130
+ * `Payload` is what types the event.
131
+ */
132
+ interface QueueLiveTopicRef<Payload = unknown> {
133
+ readonly __lunoraLive: string;
134
+ readonly __payload?: Payload;
135
+ readonly topic: string;
136
+ }
128
137
  /**
129
138
  * One delivered message as the push handler sees it: the Cloudflare `Message`
130
139
  * plus `run` — a {@link QueueRunContext.run} pinned to THIS message.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/queue",
3
- "version": "1.0.0-alpha.115",
3
+ "version": "1.0.0-alpha.116",
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",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
48
- "@lunora/platform": "1.0.0-alpha.69",
48
+ "@lunora/platform": "1.0.0-alpha.70",
49
49
  "@lunora/wire": "1.0.0-alpha.1"
50
50
  },
51
51
  "engines": {