@superdurable/dex 0.2.8 → 0.2.9

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.
@@ -2,6 +2,13 @@ import type { Codec } from "./codec.js";
2
2
  import type { Context } from "./context.js";
3
3
  import type { Flow } from "./flow.js";
4
4
  import type { SubFlowOptions } from "./subflow.js";
5
+ /** Selects one ChannelMap instance's pending messages for an RPC snapshot. */
6
+ export interface ChannelMapLoad {
7
+ /** Exact ChannelMap definition registered with the Flow. */
8
+ readonly channelMap: ChannelMap<unknown>;
9
+ /** One slash-free logical instance key. */
10
+ readonly instance: string;
11
+ }
5
12
  /** Describes one durable Timer, Channel, or SubFlow readiness condition. */
6
13
  export interface Condition {
7
14
  /** Condition family interpreted by Dex. */
@@ -12,7 +19,7 @@ export interface Condition {
12
19
  readonly durationMs?: number;
13
20
  /** Physical Channel name for a Channel condition. */
14
21
  readonly channelName?: string;
15
- /** ChannelMap instance for a map condition. */
22
+ /** The ChannelMap instance for a map condition. Slash is prohibited because it is a reserved character. */
16
23
  readonly instance?: string;
17
24
  /** Inclusive lower queued-value bound. */
18
25
  readonly atLeast?: number;
@@ -90,6 +97,20 @@ export declare class Channel<T> {
90
97
  * @returns Non-negative queued value count.
91
98
  */
92
99
  size(context: Context): number;
100
+ /**
101
+ * Returns the loaded pending-message snapshot in FIFO order.
102
+ * @param context - Current RPC Context.
103
+ * @returns Immutable pending message IDs and decoded values.
104
+ * @throws {@link StateNotLoadedError} when the RPC did not load this Channel.
105
+ */
106
+ pendingMessages(context: Context): readonly ChannelMessage<T>[];
107
+ /**
108
+ * Finds one message in the loaded pending snapshot.
109
+ * @param context - Current RPC Context.
110
+ * @param messageId - Server-assigned message ID.
111
+ * @returns The matching message, or `undefined` when absent from the snapshot.
112
+ */
113
+ findPendingMessage(context: Context, messageId: string): ChannelMessage<T> | undefined;
93
114
  /**
94
115
  * Returns values selected by this Step's satisfied condition.
95
116
  * @param context - Current Step Context.
@@ -117,7 +138,8 @@ export declare class Channel<T> {
117
138
  */
118
139
  atLeast(count: number, conditionId?: string): Condition;
119
140
  /**
120
- * Creates a condition consuming at most `count` available values.
141
+ * Creates a non-blocking condition consuming up to `count` queued values.
142
+ * When its surrounding Wait completes, it consumes values queued then; an empty queue yields none.
121
143
  * @param count - Inclusive non-negative upper bound.
122
144
  * @param conditionId - Optional stable condition identifier.
123
145
  * @returns A condition without a positive lower bound.
@@ -125,6 +147,8 @@ export declare class Channel<T> {
125
147
  atMost(count: number, conditionId?: string): Condition;
126
148
  /**
127
149
  * Creates a bounded condition for queued Channel values.
150
+ * Dex waits only for `atLeast`, then consumes currently queued values up to `atMost`.
151
+ * Omitting `atLeast` makes the condition complete immediately.
128
152
  * @param atLeast - Optional inclusive lower bound.
129
153
  * @param atMost - Optional inclusive upper bound.
130
154
  * @param conditionId - Optional stable condition identifier.
@@ -134,6 +158,7 @@ export declare class Channel<T> {
134
158
  }
135
159
  /**
136
160
  * Defines keyed Channel instances that share one typed schema.
161
+ * Instance keys must be non-empty and must not contain `/`.
137
162
  * @typeParam T - Type of every published value.
138
163
  */
139
164
  export declare class ChannelMap<T> {
@@ -148,24 +173,46 @@ export declare class ChannelMap<T> {
148
173
  /**
149
174
  * Stages one value for a ChannelMap instance.
150
175
  * @param context - Current Step or RPC Context.
151
- * @param instance - Non-empty logical map key.
176
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
152
177
  * @param value - Typed value to append.
153
178
  */
154
179
  publish(context: Context, instance: string, value: T): void;
155
180
  /**
156
181
  * Stages deletion of one pending message from a ChannelMap instance in an RPC.
157
182
  * @param context - Current RPC Context.
158
- * @param instance - Non-empty ChannelMap instance.
183
+ * @param instance - The ChannelMap instance. Slash is prohibited because it is a reserved character.
159
184
  * @param messageId - Non-empty server-assigned message ID.
160
185
  */
161
186
  delete(context: Context, instance: string, messageId: string): void;
162
187
  /**
163
188
  * Returns one instance's queued value count.
164
189
  * @param context - Current Step or RPC Context.
165
- * @param instance - Non-empty logical map key.
190
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
166
191
  * @returns Non-negative queued value count.
167
192
  */
168
193
  size(context: Context, instance: string): number;
194
+ /**
195
+ * Selects one instance's pending messages for an RPC snapshot.
196
+ * @param instance - Non-empty logical instance key. The SDK escapes it for the protocol.
197
+ * @returns An exact instance load for {@link RPCOptions.loadChannelMapInstances}.
198
+ */
199
+ loadMessages(instance: string): ChannelMapLoad;
200
+ /**
201
+ * Returns one loaded instance snapshot in FIFO order.
202
+ * @param context - Current RPC Context.
203
+ * @param instance - Logical ChannelMap instance.
204
+ * @returns Immutable pending message IDs and decoded values.
205
+ * @throws {@link StateNotLoadedError} when the RPC did not load this instance or map.
206
+ */
207
+ pendingMessages(context: Context, instance: string): readonly ChannelMessage<T>[];
208
+ /**
209
+ * Finds one instance message in the loaded pending snapshot.
210
+ * @param context - Current RPC Context.
211
+ * @param instance - Logical ChannelMap instance.
212
+ * @param messageId - Server-assigned message ID.
213
+ * @returns The matching message, or `undefined` when absent from the snapshot.
214
+ */
215
+ findPendingMessage(context: Context, instance: string, messageId: string): ChannelMessage<T> | undefined;
169
216
  /**
170
217
  * Returns the number of non-empty instances visible to the current RPC.
171
218
  * @param context - Current RPC Context.
@@ -181,20 +228,20 @@ export declare class ChannelMap<T> {
181
228
  /**
182
229
  * Returns values selected for one instance by the satisfied condition.
183
230
  * @param context - Current Step Context.
184
- * @param instance - Non-empty logical map key.
231
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
185
232
  * @returns Ordered values for this Step execution.
186
233
  */
187
234
  results(context: Context, instance: string): readonly T[];
188
235
  /**
189
236
  * Creates an instance condition consuming exactly one value.
190
- * @param instance - Non-empty logical map key.
237
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
191
238
  * @param conditionId - Optional stable condition identifier.
192
239
  * @returns An exact-one instance condition.
193
240
  */
194
241
  forOne(instance: string, conditionId?: string): Condition;
195
242
  /**
196
243
  * Creates an instance condition consuming exactly `count` values.
197
- * @param instance - Non-empty logical map key.
244
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
198
245
  * @param count - Required non-negative count.
199
246
  * @param conditionId - Optional stable condition identifier.
200
247
  * @returns A condition with equal bounds.
@@ -202,15 +249,16 @@ export declare class ChannelMap<T> {
202
249
  forN(instance: string, count: number, conditionId?: string): Condition;
203
250
  /**
204
251
  * Creates an instance condition requiring at least `count` values.
205
- * @param instance - Non-empty logical map key.
252
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
206
253
  * @param count - Inclusive non-negative lower bound.
207
254
  * @param conditionId - Optional stable condition identifier.
208
255
  * @returns A condition without an upper bound.
209
256
  */
210
257
  atLeast(instance: string, count: number, conditionId?: string): Condition;
211
258
  /**
212
- * Creates an instance condition consuming at most `count` values.
213
- * @param instance - Non-empty logical map key.
259
+ * Creates a non-blocking instance condition consuming up to `count` queued values.
260
+ * When its surrounding Wait completes, it consumes values queued then; an empty queue yields none.
261
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
214
262
  * @param count - Inclusive non-negative upper bound.
215
263
  * @param conditionId - Optional stable condition identifier.
216
264
  * @returns A condition without a positive lower bound.
@@ -218,7 +266,9 @@ export declare class ChannelMap<T> {
218
266
  atMost(instance: string, count: number, conditionId?: string): Condition;
219
267
  /**
220
268
  * Creates a bounded condition for one ChannelMap instance.
221
- * @param instance - Non-empty logical map key.
269
+ * Dex waits only for `atLeast`, then consumes currently queued values up to `atMost`.
270
+ * Omitting `atLeast` makes the condition complete immediately.
271
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
222
272
  * @param atLeast - Optional inclusive lower bound.
223
273
  * @param atMost - Optional inclusive upper bound.
224
274
  * @param conditionId - Optional stable condition identifier.
@@ -233,8 +283,8 @@ export declare class ChannelMap<T> {
233
283
  * ```ts
234
284
  * const approvals = new Channel("approvals", stringCodec);
235
285
  * const wait = Wait.anyOf(
236
- * approvals.forOne("approved"),
237
- * Timer.byDuration(5 * 60_000, "timeout"),
286
+ * approvals.forOne(),
287
+ * Timer.byDuration(5 * 60_000),
238
288
  * );
239
289
  * ```
240
290
  */
@@ -255,24 +305,34 @@ export declare const Wait: Readonly<{
255
305
  skipImmediately(): Wait;
256
306
  /**
257
307
  * Creates a Wait for one condition.
308
+ * The Condition does not need a condition ID.
258
309
  * @param condition - The only readiness condition.
259
310
  * @returns An all-of Wait with the condition.
260
311
  */
261
312
  until(condition: Condition): Wait;
262
313
  /**
263
314
  * Creates a Wait requiring every condition.
315
+ * This combinator does not require condition IDs. Every Condition in
316
+ * `anyCombinationOf` does require one.
264
317
  * @param conditions - Conditions evaluated as one all-of group.
265
318
  * @returns An all-of Wait.
266
319
  */
267
320
  allOf(...conditions: readonly Condition[]): Wait;
268
321
  /**
269
322
  * Creates a Wait that continues when any condition is ready.
323
+ * Conditions do not need condition IDs. Read Channel results from the Channel
324
+ * definition and inspect Timer outcomes through `Context`.
325
+ *
326
+ * Channel consumption is not greedy across alternatives: only the selected condition consumes.
327
+ * Other ready Channel conditions consume nothing.
270
328
  * @param conditions - Alternative readiness conditions.
271
329
  * @returns An any-of Wait.
272
330
  */
273
331
  anyOf(...conditions: readonly Condition[]): Wait;
274
332
  /**
275
333
  * Creates a Wait accepting any complete condition combination.
334
+ * Channel consumption is limited to conditions in the selected combination.
335
+ * Conditions belonging only to other ready combinations consume nothing.
276
336
  * Every Condition requires a non-empty user ID; the same instance may be reused.
277
337
  * @param combinations - Alternative all-of condition groups.
278
338
  * @returns An any-combination Wait.
package/dist/src/wait.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // See the LICENSE file in the repository root.
6
6
  //
7
7
  // SPDX-License-Identifier: LicenseRef-Super-Durable-1.0
8
- import { requireConditionId, requirePersistenceDefinitionName, validateChannelBounds, } from "./validation.js";
8
+ import { requireConditionId, requireMapInstance, requireName, requirePersistenceDefinitionName, validateChannelBounds, } from "./validation.js";
9
9
  /** Creates all-of Condition groups for `Wait.anyCombinationOf`. */
10
10
  export const ConditionCombination = Object.freeze({
11
11
  /**
@@ -78,6 +78,25 @@ export class Channel {
78
78
  size(context) {
79
79
  return context.channelSize(this);
80
80
  }
81
+ /**
82
+ * Returns the loaded pending-message snapshot in FIFO order.
83
+ * @param context - Current RPC Context.
84
+ * @returns Immutable pending message IDs and decoded values.
85
+ * @throws {@link StateNotLoadedError} when the RPC did not load this Channel.
86
+ */
87
+ pendingMessages(context) {
88
+ return context.pendingChannelMessages(this);
89
+ }
90
+ /**
91
+ * Finds one message in the loaded pending snapshot.
92
+ * @param context - Current RPC Context.
93
+ * @param messageId - Server-assigned message ID.
94
+ * @returns The matching message, or `undefined` when absent from the snapshot.
95
+ */
96
+ findPendingMessage(context, messageId) {
97
+ const requiredId = requireName(messageId);
98
+ return this.pendingMessages(context).find((message) => message.messageId === requiredId);
99
+ }
81
100
  /**
82
101
  * Returns values selected by this Step's satisfied condition.
83
102
  * @param context - Current Step Context.
@@ -113,7 +132,8 @@ export class Channel {
113
132
  return this.range(count, undefined, conditionId);
114
133
  }
115
134
  /**
116
- * Creates a condition consuming at most `count` available values.
135
+ * Creates a non-blocking condition consuming up to `count` queued values.
136
+ * When its surrounding Wait completes, it consumes values queued then; an empty queue yields none.
117
137
  * @param count - Inclusive non-negative upper bound.
118
138
  * @param conditionId - Optional stable condition identifier.
119
139
  * @returns A condition without a positive lower bound.
@@ -123,6 +143,8 @@ export class Channel {
123
143
  }
124
144
  /**
125
145
  * Creates a bounded condition for queued Channel values.
146
+ * Dex waits only for `atLeast`, then consumes currently queued values up to `atMost`.
147
+ * Omitting `atLeast` makes the condition complete immediately.
126
148
  * @param atLeast - Optional inclusive lower bound.
127
149
  * @param atMost - Optional inclusive upper bound.
128
150
  * @param conditionId - Optional stable condition identifier.
@@ -142,6 +164,7 @@ export class Channel {
142
164
  }
143
165
  /**
144
166
  * Defines keyed Channel instances that share one typed schema.
167
+ * Instance keys must be non-empty and must not contain `/`.
145
168
  * @typeParam T - Type of every published value.
146
169
  */
147
170
  export class ChannelMap {
@@ -160,7 +183,7 @@ export class ChannelMap {
160
183
  /**
161
184
  * Stages one value for a ChannelMap instance.
162
185
  * @param context - Current Step or RPC Context.
163
- * @param instance - Non-empty logical map key.
186
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
164
187
  * @param value - Typed value to append.
165
188
  */
166
189
  publish(context, instance, value) {
@@ -169,7 +192,7 @@ export class ChannelMap {
169
192
  /**
170
193
  * Stages deletion of one pending message from a ChannelMap instance in an RPC.
171
194
  * @param context - Current RPC Context.
172
- * @param instance - Non-empty ChannelMap instance.
195
+ * @param instance - The ChannelMap instance. Slash is prohibited because it is a reserved character.
173
196
  * @param messageId - Non-empty server-assigned message ID.
174
197
  */
175
198
  delete(context, instance, messageId) {
@@ -178,12 +201,42 @@ export class ChannelMap {
178
201
  /**
179
202
  * Returns one instance's queued value count.
180
203
  * @param context - Current Step or RPC Context.
181
- * @param instance - Non-empty logical map key.
204
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
182
205
  * @returns Non-negative queued value count.
183
206
  */
184
207
  size(context, instance) {
185
208
  return context.channelSize(this, instance);
186
209
  }
210
+ /**
211
+ * Selects one instance's pending messages for an RPC snapshot.
212
+ * @param instance - Non-empty logical instance key. The SDK escapes it for the protocol.
213
+ * @returns An exact instance load for {@link RPCOptions.loadChannelMapInstances}.
214
+ */
215
+ loadMessages(instance) {
216
+ requireMapInstance(instance);
217
+ return { channelMap: this, instance };
218
+ }
219
+ /**
220
+ * Returns one loaded instance snapshot in FIFO order.
221
+ * @param context - Current RPC Context.
222
+ * @param instance - Logical ChannelMap instance.
223
+ * @returns Immutable pending message IDs and decoded values.
224
+ * @throws {@link StateNotLoadedError} when the RPC did not load this instance or map.
225
+ */
226
+ pendingMessages(context, instance) {
227
+ return context.pendingChannelMessages(this, instance);
228
+ }
229
+ /**
230
+ * Finds one instance message in the loaded pending snapshot.
231
+ * @param context - Current RPC Context.
232
+ * @param instance - Logical ChannelMap instance.
233
+ * @param messageId - Server-assigned message ID.
234
+ * @returns The matching message, or `undefined` when absent from the snapshot.
235
+ */
236
+ findPendingMessage(context, instance, messageId) {
237
+ const requiredId = requireName(messageId);
238
+ return this.pendingMessages(context, instance).find((message) => message.messageId === requiredId);
239
+ }
187
240
  /**
188
241
  * Returns the number of non-empty instances visible to the current RPC.
189
242
  * @param context - Current RPC Context.
@@ -203,7 +256,7 @@ export class ChannelMap {
203
256
  /**
204
257
  * Returns values selected for one instance by the satisfied condition.
205
258
  * @param context - Current Step Context.
206
- * @param instance - Non-empty logical map key.
259
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
207
260
  * @returns Ordered values for this Step execution.
208
261
  */
209
262
  results(context, instance) {
@@ -211,7 +264,7 @@ export class ChannelMap {
211
264
  }
212
265
  /**
213
266
  * Creates an instance condition consuming exactly one value.
214
- * @param instance - Non-empty logical map key.
267
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
215
268
  * @param conditionId - Optional stable condition identifier.
216
269
  * @returns An exact-one instance condition.
217
270
  */
@@ -220,7 +273,7 @@ export class ChannelMap {
220
273
  }
221
274
  /**
222
275
  * Creates an instance condition consuming exactly `count` values.
223
- * @param instance - Non-empty logical map key.
276
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
224
277
  * @param count - Required non-negative count.
225
278
  * @param conditionId - Optional stable condition identifier.
226
279
  * @returns A condition with equal bounds.
@@ -230,7 +283,7 @@ export class ChannelMap {
230
283
  }
231
284
  /**
232
285
  * Creates an instance condition requiring at least `count` values.
233
- * @param instance - Non-empty logical map key.
286
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
234
287
  * @param count - Inclusive non-negative lower bound.
235
288
  * @param conditionId - Optional stable condition identifier.
236
289
  * @returns A condition without an upper bound.
@@ -239,8 +292,9 @@ export class ChannelMap {
239
292
  return this.range(instance, count, undefined, conditionId);
240
293
  }
241
294
  /**
242
- * Creates an instance condition consuming at most `count` values.
243
- * @param instance - Non-empty logical map key.
295
+ * Creates a non-blocking instance condition consuming up to `count` queued values.
296
+ * When its surrounding Wait completes, it consumes values queued then; an empty queue yields none.
297
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
244
298
  * @param count - Inclusive non-negative upper bound.
245
299
  * @param conditionId - Optional stable condition identifier.
246
300
  * @returns A condition without a positive lower bound.
@@ -250,7 +304,9 @@ export class ChannelMap {
250
304
  }
251
305
  /**
252
306
  * Creates a bounded condition for one ChannelMap instance.
253
- * @param instance - Non-empty logical map key.
307
+ * Dex waits only for `atLeast`, then consumes currently queued values up to `atMost`.
308
+ * Omitting `atLeast` makes the condition complete immediately.
309
+ * @param instance - The map instance. Slash is prohibited because it is a reserved character.
254
310
  * @param atLeast - Optional inclusive lower bound.
255
311
  * @param atMost - Optional inclusive upper bound.
256
312
  * @param conditionId - Optional stable condition identifier.
@@ -259,6 +315,7 @@ export class ChannelMap {
259
315
  range(instance, atLeast, atMost, conditionId) {
260
316
  validateChannelBounds(atLeast, atMost);
261
317
  requireConditionId(conditionId);
318
+ requireMapInstance(instance);
262
319
  return {
263
320
  kind: "channel",
264
321
  channelName: this.name,
@@ -280,6 +337,7 @@ export const Wait = Object.freeze({
280
337
  },
281
338
  /**
282
339
  * Creates a Wait for one condition.
340
+ * The Condition does not need a condition ID.
283
341
  * @param condition - The only readiness condition.
284
342
  * @returns An all-of Wait with the condition.
285
343
  */
@@ -288,6 +346,8 @@ export const Wait = Object.freeze({
288
346
  },
289
347
  /**
290
348
  * Creates a Wait requiring every condition.
349
+ * This combinator does not require condition IDs. Every Condition in
350
+ * `anyCombinationOf` does require one.
291
351
  * @param conditions - Conditions evaluated as one all-of group.
292
352
  * @returns An all-of Wait.
293
353
  */
@@ -296,6 +356,11 @@ export const Wait = Object.freeze({
296
356
  },
297
357
  /**
298
358
  * Creates a Wait that continues when any condition is ready.
359
+ * Conditions do not need condition IDs. Read Channel results from the Channel
360
+ * definition and inspect Timer outcomes through `Context`.
361
+ *
362
+ * Channel consumption is not greedy across alternatives: only the selected condition consumes.
363
+ * Other ready Channel conditions consume nothing.
299
364
  * @param conditions - Alternative readiness conditions.
300
365
  * @returns An any-of Wait.
301
366
  */
@@ -304,6 +369,8 @@ export const Wait = Object.freeze({
304
369
  },
305
370
  /**
306
371
  * Creates a Wait accepting any complete condition combination.
372
+ * Channel consumption is limited to conditions in the selected combination.
373
+ * Conditions belonging only to other ready combinations consume nothing.
307
374
  * Every Condition requires a non-empty user ID; the same instance may be reused.
308
375
  * @param combinations - Alternative all-of condition groups.
309
376
  * @returns An any-combination Wait.
@@ -1 +1 @@
1
- {"version":3,"file":"wait.js","sourceRoot":"","sources":["../../src/wait.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,uDAAuD;AACvD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,wDAAwD;AAMxD,OAAO,EACL,kBAAkB,EAElB,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAgCzB,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD;;;;OAIG;IACH,EAAE,CAAC,GAAG,UAAgC;QACpC,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;CACF,CAAC,CAAC;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC;;;;;OAKG;IACH,UAAU,CAAC,UAAkB,EAAE,WAAoB;QACjD,IAAI,UAAU,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,UAAU,CAAC,qCAAqC,CAAC,CAAC;QAC9D,CAAC;QACD,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,OAAO;YACb,UAAU;YACV,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;SACtD,CAAC;IACJ,CA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;IACD;;;;;OAKG;IACH,KAAK,CAAC,SAAoB;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IACD;;;;;;OAMG;IACH,KAAK,CAAC,GAAG,UAAgC;QACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IACzD,CAAC;IACD;;;;;;;;;OASG;IACH,KAAK,CAAC,GAAG,UAAgC;QACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IACzD,CAAC;IACD;;;;;;;OAOG;IACH,gBAAgB,CAAC,GAAG,YAA6C;QAC/D,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC;IACpE,CAAC;CACF,CAAC,CAAC"}
@@ -15,6 +15,7 @@ import { ActiveStepSearchMode, FlowTimeoutPolicy } from "./options.js";
15
15
  import { SubFlowReusePolicy } from "./subflow.js";
16
16
  import { codecOrJson, decodeValue, encodeUnknown, encodeValue, } from "./value-mapper.js";
17
17
  import { Channel, ChannelMap } from "./wait.js";
18
+ import { requireMapInstance } from "./validation.js";
18
19
  const timeoutHandlerStepType = "sys:timeout_handler";
19
20
  export class WorkerDispatcher {
20
21
  registry;
@@ -120,7 +121,7 @@ export class WorkerDispatcher {
120
121
  cancellationSignal.throwIfAborted();
121
122
  const flow = registeredFlowByName(this.registry, request.flowType);
122
123
  const rpc = registeredRPCByName(flow, request.rpcName);
123
- const context = new InvocationContext("rpc", flow, request.context, request.attributes, [], undefined, request.channelInfos, cancellationSignal);
124
+ const context = new InvocationContext("rpc", flow, request.context, request.attributes, [], undefined, request.channelInfos, cancellationSignal, undefined, request.loadedChannelMessages, request.loadedAttributeMapInstances, request.loadedChannelNames, request.loadedChannelMapInstances);
124
125
  const returned = await invokeRPC(flow, rpc, context, request.input);
125
126
  try {
126
127
  const result = rpcResult(rpc, returned);
@@ -189,14 +190,29 @@ export class WorkerDispatcher {
189
190
  }
190
191
  async hydrateRPC(request) {
191
192
  const hasInput = request.input !== undefined;
193
+ const channelMessages = Object.values(request.loadedChannelMessages)
194
+ .flatMap((values) => values.messages);
192
195
  const values = await this.hydrator.hydrateAll([
193
196
  ...(hasInput ? [request.input] : []),
194
197
  ...request.attributes.map((entry) => entry.value),
198
+ ...channelMessages.map((message) => message.value),
195
199
  ]);
200
+ let offset = hasInput ? 1 : 0;
201
+ const attributes = replaceEntryValues(request.attributes, values.slice(offset, (offset += request.attributes.length)));
202
+ const loadedChannelMessages = Object.fromEntries(Object.entries(request.loadedChannelMessages).map(([name, channelValues]) => [
203
+ name,
204
+ {
205
+ messages: channelValues.messages.map((message) => ({
206
+ ...message,
207
+ value: values[offset++],
208
+ })),
209
+ },
210
+ ]));
196
211
  return {
197
212
  ...request,
198
213
  input: hasInput ? values[0] : undefined,
199
- attributes: replaceEntryValues(request.attributes, values.slice(hasInput ? 1 : 0)),
214
+ attributes,
215
+ loadedChannelMessages,
200
216
  };
201
217
  }
202
218
  }
@@ -639,9 +655,10 @@ function requireValue(value, kind) {
639
655
  return value;
640
656
  }
641
657
  function physicalName(name, instance) {
642
- if (instance === undefined || instance === "") {
658
+ if (instance === undefined) {
643
659
  throw new TypeError(`map definition ${name} requires an instance`);
644
660
  }
661
+ requireMapInstance(instance);
645
662
  return `${name}/${encodeURIComponent(instance).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)}`;
646
663
  }
647
664
  function seconds(milliseconds) {