@reventlessdev/reventless-aws 3.0.0-alpha.339 → 3.0.0-alpha.341

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.
@@ -4,6 +4,7 @@ import * as Sury from "sury";
4
4
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
5
  import * as Effect from "effect/Effect";
6
6
  import * as Stream from "effect/Stream";
7
+ import * as Lifecycle$Reventless from "@reventlessdev/reventless-spec/src/types/Lifecycle.res.mjs";
7
8
  import * as StateViewSliceEntryPoint_Ops$ReventlessAws from "../src/adapter/Runtime/StateViewSliceEntryPoint_Ops.res.mjs";
8
9
 
9
10
  function str(prim) {
@@ -14,6 +15,16 @@ function obj(pairs) {
14
15
  return Object.fromEntries(pairs);
15
16
  }
16
17
 
18
+ let trailedLifecycleSchema = Sury.union([
19
+ Sury.literal("Placed"),
20
+ Sury.literal("Shipped")
21
+ ]);
22
+
23
+ let trailedStateSchema = Sury.$schema(s => ({
24
+ lifecycle: s.m(trailedLifecycleSchema),
25
+ trail: s.m(Lifecycle$Reventless.Trail.schema(trailedLifecycleSchema))
26
+ }));
27
+
17
28
  globalThis.describe("StateViewSliceEntryPoint_Ops.parseHandlerConfig", () => {
18
29
  globalThis.test("empty raw config yields no handlers", () => {
19
30
  globalThis.expect(StateViewSliceEntryPoint_Ops$ReventlessAws.parseHandlerConfig("").length).toBe(0);
@@ -249,7 +260,7 @@ globalThis.describe("StateViewSliceEntryPoint_Ops.makeJsonEventsHandler", () =>
249
260
  }];
250
261
  globalThis.test("decodes envelopes, projects, and runs actions against the ops", async () => {
251
262
  let saved = [];
252
- let handler = StateViewSliceEntryPoint_Ops$ReventlessAws.makeJsonEventsHandler("TestSlice", Sury.string, project, makeStub(saved), undefined);
263
+ let handler = StateViewSliceEntryPoint_Ops$ReventlessAws.makeJsonEventsHandler("TestSlice", Sury.string, project, makeStub(saved), undefined, undefined);
253
264
  let envelope = Object.fromEntries([
254
265
  [
255
266
  "event",
@@ -277,7 +288,7 @@ globalThis.describe("StateViewSliceEntryPoint_Ops.makeJsonEventsHandler", () =>
277
288
  });
278
289
  globalThis.test("a decode failure yields no actions and does not wedge the batch", async () => {
279
290
  let saved = [];
280
- let handler = StateViewSliceEntryPoint_Ops$ReventlessAws.makeJsonEventsHandler("TestSlice", Sury.string, project, makeStub(saved), undefined);
291
+ let handler = StateViewSliceEntryPoint_Ops$ReventlessAws.makeJsonEventsHandler("TestSlice", Sury.string, project, makeStub(saved), undefined, undefined);
281
292
  await Effect.runPromise(handler(Stream.fromIterable([
282
293
  42,
283
294
  "row-after"
@@ -287,10 +298,98 @@ globalThis.describe("StateViewSliceEntryPoint_Ops.makeJsonEventsHandler", () =>
287
298
  ""
288
299
  ]]);
289
300
  });
301
+ globalThis.test("appends a trail entry from the envelope's producer time", async () => {
302
+ let saved = [];
303
+ let handler = StateViewSliceEntryPoint_Ops$ReventlessAws.makeJsonEventsHandler("TrailSlice", Sury.string, param => [{
304
+ TAG: "Set",
305
+ _0: param.event,
306
+ _1: Object.fromEntries([
307
+ [
308
+ "lifecycle",
309
+ "Placed"
310
+ ],
311
+ [
312
+ "trail",
313
+ []
314
+ ]
315
+ ])
316
+ }], makeStub(saved), undefined, trailedStateSchema);
317
+ await Effect.runPromise(handler(Stream.fromIterable([Object.fromEntries([
318
+ [
319
+ "event",
320
+ "row-1"
321
+ ],
322
+ [
323
+ "meta",
324
+ Object.fromEntries([[
325
+ "time",
326
+ "2026-03-02T09:00:00Z"
327
+ ]])
328
+ ]
329
+ ])])));
330
+ globalThis.expect(saved).toEqual([[
331
+ "row-1",
332
+ Object.fromEntries([
333
+ [
334
+ "lifecycle",
335
+ "Placed"
336
+ ],
337
+ [
338
+ "trail",
339
+ [Object.fromEntries([
340
+ [
341
+ "state",
342
+ "Placed"
343
+ ],
344
+ [
345
+ "at",
346
+ "2026-03-02T09:00:00Z"
347
+ ]
348
+ ])]
349
+ ]
350
+ ])
351
+ ]]);
352
+ });
353
+ globalThis.test("appends nothing when the envelope carries no producer time", async () => {
354
+ let saved = [];
355
+ let handler = StateViewSliceEntryPoint_Ops$ReventlessAws.makeJsonEventsHandler("TrailSlice", Sury.string, param => [{
356
+ TAG: "Set",
357
+ _0: param.event,
358
+ _1: Object.fromEntries([
359
+ [
360
+ "lifecycle",
361
+ "Placed"
362
+ ],
363
+ [
364
+ "trail",
365
+ []
366
+ ]
367
+ ])
368
+ }], makeStub(saved), undefined, trailedStateSchema);
369
+ await Effect.runPromise(handler(Stream.fromIterable([Object.fromEntries([[
370
+ "event",
371
+ "row-1"
372
+ ]])])));
373
+ globalThis.expect(saved).toEqual([[
374
+ "row-1",
375
+ Object.fromEntries([
376
+ [
377
+ "lifecycle",
378
+ "Placed"
379
+ ],
380
+ [
381
+ "trail",
382
+ []
383
+ ]
384
+ ])
385
+ ]]);
386
+ });
290
387
  });
291
388
 
292
389
  export {
293
390
  str,
294
391
  obj,
392
+ trailedLifecycleSchema,
393
+ trailedStateSchema,
295
394
  }
296
- /* Not a pure module */
395
+ /* trailedLifecycleSchema Not a pure module */