@reventlessdev/reventless-local 3.0.0-alpha.310 → 3.0.0-alpha.312

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/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.312 (2026-10-30)
7
+
8
+ ### Features
9
+
10
+ * **outbound:** a work item with personal data is stored like an event ([5588bbe](https://github.com/ReventlessDev/reventless-core/commit/5588bbeaccc5032800d02871243c70147c669ebd))
11
+
12
+
13
+ # 3.0.0-alpha.311 (2026-10-30)
14
+
15
+ **Note:** Version bump only for package @reventlessdev/reventless-local
16
+
17
+
18
+
19
+
20
+
6
21
  # 3.0.0-alpha.310 (2026-10-30)
7
22
 
8
23
  **Note:** Version bump only for package @reventlessdev/reventless-local
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-local",
3
- "version": "3.0.0-alpha.310",
3
+ "version": "3.0.0-alpha.312",
4
4
  "description": "Local platform for Reventless (in-memory or SQLite backend, for development and testing without AWS)",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -34,19 +34,19 @@
34
34
  "graphql-yoga": "^5.21.0",
35
35
  "sury": "11.0.0",
36
36
  "ws": "^8.18.0",
37
- "@reventlessdev/rescript-graphql-yoga": "1.0.0-alpha.29",
38
- "@reventlessdev/rescript-jest": "1.0.0-alpha.13",
39
37
  "@reventlessdev/rescript-effect": "1.0.0-alpha.1",
38
+ "@reventlessdev/rescript-jest": "1.0.0-alpha.13",
39
+ "@reventlessdev/rescript-graphql-yoga": "1.0.0-alpha.29",
40
40
  "@reventlessdev/rescript-mcp-sdk": "1.0.0-alpha.24",
41
41
  "@reventlessdev/rescript-node": "2.0.0-alpha.24",
42
+ "@reventlessdev/reventless-core": "3.0.0-alpha.321",
42
43
  "@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
43
- "@reventlessdev/reventless-core": "3.0.0-alpha.319",
44
- "@reventlessdev/reventless-gwt": "1.0.0-alpha.267",
45
- "@reventlessdev/reventless-graphql-server": "1.0.0-alpha.167",
46
- "@reventlessdev/reventless-postgres": "3.0.0-alpha.183",
47
- "@reventlessdev/reventless-infra": "3.0.0-alpha.216",
48
- "@reventlessdev/reventless-spec": "3.0.0-alpha.187",
49
- "@reventlessdev/reventless-seed": "1.0.0-alpha.39"
44
+ "@reventlessdev/reventless-graphql-server": "1.0.0-alpha.169",
45
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.218",
46
+ "@reventlessdev/reventless-postgres": "3.0.0-alpha.185",
47
+ "@reventlessdev/reventless-seed": "1.0.0-alpha.39",
48
+ "@reventlessdev/reventless-gwt": "1.0.0-alpha.269",
49
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.189"
50
50
  },
51
51
  "devDependencies": {
52
52
  "rescript": "12.3.1",
@@ -45,9 +45,10 @@ describe("OutboundTranslationSlice Callback", () => {
45
45
  testPromise(
46
46
  "OrderShipped event creates a pending outbound item",
47
47
  async () => {
48
- FireForgetCallback.phase1([
49
- ("evt", OrderShipped({orderId: "ord-1", email: "test@example.com"})),
50
- ])
48
+ await FireForgetCallback.phase1(
49
+ [("evt", OrderShipped({orderId: "ord-1", email: "test@example.com"}))],
50
+ ~capabilities=Reventless.Capabilities.none,
51
+ )
51
52
  let items = FireForgetCallback.todoItems
52
53
  expect(items->Dict.toArray->Array.length)->toBe(1)
53
54
  let row = items->Dict.get("ord-1")
@@ -61,12 +62,14 @@ describe("OutboundTranslationSlice Callback", () => {
61
62
  testPromise(
62
63
  "duplicate event does not create a second item (idempotent)",
63
64
  async () => {
64
- FireForgetCallback.phase1([
65
- ("evt", OrderShipped({orderId: "ord-1", email: "test@example.com"})),
66
- ])
67
- FireForgetCallback.phase1([
68
- ("evt", OrderShipped({orderId: "ord-1", email: "other@example.com"})),
69
- ])
65
+ await FireForgetCallback.phase1(
66
+ [("evt", OrderShipped({orderId: "ord-1", email: "test@example.com"}))],
67
+ ~capabilities=Reventless.Capabilities.none,
68
+ )
69
+ await FireForgetCallback.phase1(
70
+ [("evt", OrderShipped({orderId: "ord-1", email: "other@example.com"}))],
71
+ ~capabilities=Reventless.Capabilities.none,
72
+ )
70
73
  let items = FireForgetCallback.todoItems
71
74
  expect(items->Dict.toArray->Array.length)->toBe(1)
72
75
  },
@@ -75,10 +78,13 @@ describe("OutboundTranslationSlice Callback", () => {
75
78
  testPromise(
76
79
  "multiple different events create multiple items",
77
80
  async () => {
78
- FireForgetCallback.phase1([
79
- ("evt", OrderShipped({orderId: "ord-1", email: "a@example.com"})),
80
- ("evt", OrderShipped({orderId: "ord-2", email: "b@example.com"})),
81
- ])
81
+ await FireForgetCallback.phase1(
82
+ [
83
+ ("evt", OrderShipped({orderId: "ord-1", email: "a@example.com"})),
84
+ ("evt", OrderShipped({orderId: "ord-2", email: "b@example.com"})),
85
+ ],
86
+ ~capabilities=Reventless.Capabilities.none,
87
+ )
82
88
  let items = FireForgetCallback.todoItems
83
89
  expect(items->Dict.toArray->Array.length)->toBe(2)
84
90
  },
@@ -89,9 +95,10 @@ describe("OutboundTranslationSlice Callback", () => {
89
95
  testPromise(
90
96
  "Ok(None) marks item as Completed, no command published",
91
97
  async () => {
92
- FireForgetCallback.phase1([
93
- ("evt", OrderShipped({orderId: "ord-1", email: "test@example.com"})),
94
- ])
98
+ await FireForgetCallback.phase1(
99
+ [("evt", OrderShipped({orderId: "ord-1", email: "test@example.com"}))],
100
+ ~capabilities=Reventless.Capabilities.none,
101
+ )
95
102
  let publishedCommands = ref([])
96
103
  let mockPublish: ReventlessInfra.CommandTopic.publishJsons = async cmds => {
97
104
  publishedCommands := cmds
@@ -120,7 +127,10 @@ describe("OutboundTranslationSlice Callback", () => {
120
127
  testPromise(
121
128
  "Ok(Some(...)) marks item as Completed and publishes command",
122
129
  async () => {
123
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
130
+ await CommandBackCallback.phase1(
131
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
132
+ ~capabilities=Reventless.Capabilities.none,
133
+ )
124
134
  let publishedCommands = ref([])
125
135
  let mockPublish: ReventlessInfra.CommandTopic.publishJsons = async cmds => {
126
136
  publishedCommands := Array.concat(publishedCommands.contents, cmds)
@@ -142,7 +152,10 @@ describe("OutboundTranslationSlice Callback", () => {
142
152
  testPromise(
143
153
  "published command is tagged with the target's name",
144
154
  async () => {
145
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
155
+ await CommandBackCallback.phase1(
156
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
157
+ ~capabilities=Reventless.Capabilities.none,
158
+ )
146
159
  let publishedCommands = ref([])
147
160
  let mockPublish: ReventlessInfra.CommandTopic.publishJsons = async cmds => {
148
161
  publishedCommands := Array.concat(publishedCommands.contents, cmds)
@@ -158,7 +171,10 @@ describe("OutboundTranslationSlice Callback", () => {
158
171
  async () => {
159
172
  ProcessPaymentSpec.translateFn := (async (_id, _item) => Error("gateway timeout"))
160
173
 
161
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
174
+ await CommandBackCallback.phase1(
175
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
176
+ ~capabilities=Reventless.Capabilities.none,
177
+ )
162
178
  let mockPublish: ReventlessInfra.CommandTopic.publishJsons = async _cmds => ()
163
179
  await CommandBackCallback.phase2(mockPublish, ~capabilities=Reventless.Capabilities.none)
164
180
 
@@ -173,7 +189,10 @@ describe("OutboundTranslationSlice Callback", () => {
173
189
  async () => {
174
190
  // First attempt fails
175
191
  ProcessPaymentSpec.translateFn := (async (_id, _item) => Error("timeout"))
176
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
192
+ await CommandBackCallback.phase1(
193
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
194
+ ~capabilities=Reventless.Capabilities.none,
195
+ )
177
196
  let mockPublish: ReventlessInfra.CommandTopic.publishJsons = async _cmds => ()
178
197
  await CommandBackCallback.phase2(mockPublish, ~capabilities=Reventless.Capabilities.none)
179
198
  let row1 = CommandBackCallback.todoItems->Dict.get("ord-1")->Option.getOrThrow
@@ -198,7 +217,10 @@ describe("OutboundTranslationSlice Callback", () => {
198
217
  async () => {
199
218
  // ProcessPaymentSpec.maxRetries = 2, so after 2 failures it should stop
200
219
  ProcessPaymentSpec.translateFn := (async (_id, _item) => Error("timeout"))
201
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
220
+ await CommandBackCallback.phase1(
221
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
222
+ ~capabilities=Reventless.Capabilities.none,
223
+ )
202
224
  let mockPublish: ReventlessInfra.CommandTopic.publishJsons = async _cmds => ()
203
225
 
204
226
  // Fail once — still retriable, and the status says so.
@@ -234,7 +256,10 @@ describe("OutboundTranslationSlice Callback", () => {
234
256
  "a row left stranded at the ceiling is normalised on the next pass",
235
257
  async () => {
236
258
  ProcessPaymentSpec.translateFn := (async (_id, _item) => Error("timeout"))
237
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
259
+ await CommandBackCallback.phase1(
260
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
261
+ ~capabilities=Reventless.Capabilities.none,
262
+ )
238
263
  let row = CommandBackCallback.todoItems->Dict.get("ord-1")->Option.getOrThrow
239
264
  CommandBackCallback.todoItems->Dict.set("ord-1", {...row, status: Failed, retryCount: 2})
240
265
 
@@ -252,7 +277,10 @@ describe("OutboundTranslationSlice Callback", () => {
252
277
  "the last error survives the transition to Abandoned",
253
278
  async () => {
254
279
  ProcessPaymentSpec.translateFn := (async (_id, _item) => Error("gateway down"))
255
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
280
+ await CommandBackCallback.phase1(
281
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
282
+ ~capabilities=Reventless.Capabilities.none,
283
+ )
256
284
  let publish: ReventlessInfra.CommandTopic.publishJsons = async _cmds => ()
257
285
  await CommandBackCallback.phase2(publish, ~capabilities=Reventless.Capabilities.none)
258
286
  await CommandBackCallback.phase2(publish, ~capabilities=Reventless.Capabilities.none)
@@ -265,7 +293,10 @@ describe("OutboundTranslationSlice Callback", () => {
265
293
  testPromise(
266
294
  "the row carries the ceiling its count is racing",
267
295
  async () => {
268
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
296
+ await CommandBackCallback.phase1(
297
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
298
+ ~capabilities=Reventless.Capabilities.none,
299
+ )
269
300
  expect(
270
301
  (CommandBackCallback.todoItems->Dict.get("ord-1")->Option.getOrThrow).maxRetries,
271
302
  )->toEqual(Some(ProcessPaymentSpec.maxRetries))
@@ -281,7 +312,10 @@ describe("OutboundTranslationSlice Callback", () => {
281
312
  ProcessPaymentSpec.onExhaustedFn :=
282
313
  ((id, _item, _lastError) => Some((id, ProcessPaymentSpec.ConfirmPayment({orderId: id}))))
283
314
 
284
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
315
+ await CommandBackCallback.phase1(
316
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
317
+ ~capabilities=Reventless.Capabilities.none,
318
+ )
285
319
  let published = ref([])
286
320
  let publish: ReventlessInfra.CommandTopic.publishJsons = async cmds =>
287
321
  published := Array.concat(published.contents, cmds)
@@ -313,7 +347,10 @@ describe("OutboundTranslationSlice Callback", () => {
313
347
  }
314
348
  )
315
349
 
316
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
350
+ await CommandBackCallback.phase1(
351
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
352
+ ~capabilities=Reventless.Capabilities.none,
353
+ )
317
354
  let publish: ReventlessInfra.CommandTopic.publishJsons = async _cmds => ()
318
355
  await CommandBackCallback.phase2(publish, ~capabilities=Reventless.Capabilities.none)
319
356
  await CommandBackCallback.phase2(publish, ~capabilities=Reventless.Capabilities.none)
@@ -326,7 +363,10 @@ describe("OutboundTranslationSlice Callback", () => {
326
363
  async () => {
327
364
  ProcessPaymentSpec.translateFn := (async (_id, _item) => Error("gateway down"))
328
365
  // onExhaustedFn stays at its default None (reset in beforeEach).
329
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
366
+ await CommandBackCallback.phase1(
367
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
368
+ ~capabilities=Reventless.Capabilities.none,
369
+ )
330
370
  let published = ref([])
331
371
  let publish: ReventlessInfra.CommandTopic.publishJsons = async cmds =>
332
372
  published := Array.concat(published.contents, cmds)
@@ -348,7 +388,10 @@ describe("OutboundTranslationSlice Callback", () => {
348
388
  ProcessPaymentSpec.onExhaustedFn :=
349
389
  ((id, _item, _lastError) => Some((id, ProcessPaymentSpec.ConfirmPayment({orderId: id}))))
350
390
 
351
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
391
+ await CommandBackCallback.phase1(
392
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
393
+ ~capabilities=Reventless.Capabilities.none,
394
+ )
352
395
  let failOnAbandonment: ReventlessInfra.CommandTopic.publishJsons = async _cmds =>
353
396
  JsError.throwWithMessage("topic unavailable")
354
397
  await CommandBackCallback.phase2(
@@ -372,7 +415,10 @@ describe("OutboundTranslationSlice Callback", () => {
372
415
  async () => {
373
416
  ProcessPaymentSpec.onExhaustedFn :=
374
417
  ((id, _item, _lastError) => Some((id, ProcessPaymentSpec.ConfirmPayment({orderId: id}))))
375
- CommandBackCallback.phase1([("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))])
418
+ await CommandBackCallback.phase1(
419
+ [("evt", PaymentReceived({orderId: "ord-1", amount: 50.0}))],
420
+ ~capabilities=Reventless.Capabilities.none,
421
+ )
376
422
  let row = CommandBackCallback.todoItems->Dict.get("ord-1")->Option.getOrThrow
377
423
  CommandBackCallback.todoItems->Dict.set("ord-1", {...row, status: Failed, retryCount: 2})
378
424
 
@@ -404,10 +450,13 @@ describe("OutboundTranslationSlice Callback", () => {
404
450
  }
405
451
  )
406
452
 
407
- CommandBackCallback.phase1([
408
- ("evt", PaymentReceived({orderId: "ord-1", amount: 50.0})),
409
- ("evt", PaymentReceived({orderId: "ord-2", amount: 75.0})),
410
- ])
453
+ await CommandBackCallback.phase1(
454
+ [
455
+ ("evt", PaymentReceived({orderId: "ord-1", amount: 50.0})),
456
+ ("evt", PaymentReceived({orderId: "ord-2", amount: 75.0})),
457
+ ],
458
+ ~capabilities=Reventless.Capabilities.none,
459
+ )
411
460
  let publishedCommands = ref([])
412
461
  let mockPublish: ReventlessInfra.CommandTopic.publishJsons = async cmds => {
413
462
  publishedCommands := Array.concat(publishedCommands.contents, cmds)
@@ -83,14 +83,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
83
83
  });
84
84
  globalThis.describe("Phase 1 — collect", () => {
85
85
  globalThis.test("OrderShipped event creates a pending outbound item", async () => {
86
- FireForgetCallback.phase1([[
86
+ await FireForgetCallback.phase1([[
87
87
  "evt",
88
88
  {
89
89
  TAG: "OrderShipped",
90
90
  orderId: "ord-1",
91
91
  email: "test@example.com"
92
92
  }
93
- ]]);
93
+ ]], Capabilities$Reventless.none);
94
94
  let items = FireForgetCallback.todoItems;
95
95
  globalThis.expect(Object.entries(items).length).toBe(1);
96
96
  let row = items["ord-1"];
@@ -100,26 +100,26 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
100
100
  globalThis.expect(r.retryCount).toBe(0);
101
101
  });
102
102
  globalThis.test("duplicate event does not create a second item (idempotent)", async () => {
103
- FireForgetCallback.phase1([[
103
+ await FireForgetCallback.phase1([[
104
104
  "evt",
105
105
  {
106
106
  TAG: "OrderShipped",
107
107
  orderId: "ord-1",
108
108
  email: "test@example.com"
109
109
  }
110
- ]]);
111
- FireForgetCallback.phase1([[
110
+ ]], Capabilities$Reventless.none);
111
+ await FireForgetCallback.phase1([[
112
112
  "evt",
113
113
  {
114
114
  TAG: "OrderShipped",
115
115
  orderId: "ord-1",
116
116
  email: "other@example.com"
117
117
  }
118
- ]]);
118
+ ]], Capabilities$Reventless.none);
119
119
  globalThis.expect(Object.entries(FireForgetCallback.todoItems).length).toBe(1);
120
120
  });
121
121
  globalThis.test("multiple different events create multiple items", async () => {
122
- FireForgetCallback.phase1([
122
+ await FireForgetCallback.phase1([
123
123
  [
124
124
  "evt",
125
125
  {
@@ -136,20 +136,20 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
136
136
  email: "b@example.com"
137
137
  }
138
138
  ]
139
- ]);
139
+ ], Capabilities$Reventless.none);
140
140
  globalThis.expect(Object.entries(FireForgetCallback.todoItems).length).toBe(2);
141
141
  });
142
142
  });
143
143
  globalThis.describe("Phase 2 — translate (fire-and-forget)", () => {
144
144
  globalThis.test("Ok(None) marks item as Completed, no command published", async () => {
145
- FireForgetCallback.phase1([[
145
+ await FireForgetCallback.phase1([[
146
146
  "evt",
147
147
  {
148
148
  TAG: "OrderShipped",
149
149
  orderId: "ord-1",
150
150
  email: "test@example.com"
151
151
  }
152
- ]]);
152
+ ]], Capabilities$Reventless.none);
153
153
  let publishedCommands = {
154
154
  contents: []
155
155
  };
@@ -174,14 +174,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
174
174
  });
175
175
  globalThis.describe("Phase 2 — translate (command-back)", () => {
176
176
  globalThis.test("Ok(Some(...)) marks item as Completed and publishes command", async () => {
177
- CommandBackCallback.phase1([[
177
+ await CommandBackCallback.phase1([[
178
178
  "evt",
179
179
  {
180
180
  TAG: "PaymentReceived",
181
181
  orderId: "ord-1",
182
182
  amount: 50.0
183
183
  }
184
- ]]);
184
+ ]], Capabilities$Reventless.none);
185
185
  let publishedCommands = {
186
186
  contents: []
187
187
  };
@@ -196,14 +196,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
196
196
  globalThis.expect(row.status).toBe("Completed");
197
197
  });
198
198
  globalThis.test("published command is tagged with the target's name", async () => {
199
- CommandBackCallback.phase1([[
199
+ await CommandBackCallback.phase1([[
200
200
  "evt",
201
201
  {
202
202
  TAG: "PaymentReceived",
203
203
  orderId: "ord-1",
204
204
  amount: 50.0
205
205
  }
206
- ]]);
206
+ ]], Capabilities$Reventless.none);
207
207
  let publishedCommands = {
208
208
  contents: []
209
209
  };
@@ -219,14 +219,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
219
219
  TAG: "Error",
220
220
  _0: "gateway timeout"
221
221
  });
222
- CommandBackCallback.phase1([[
222
+ await CommandBackCallback.phase1([[
223
223
  "evt",
224
224
  {
225
225
  TAG: "PaymentReceived",
226
226
  orderId: "ord-1",
227
227
  amount: 50.0
228
228
  }
229
- ]]);
229
+ ]], Capabilities$Reventless.none);
230
230
  let mockPublish = async _cmds => {};
231
231
  await CommandBackCallback.phase2(mockPublish, Capabilities$Reventless.none);
232
232
  let row = Stdlib_Option.getOrThrow(CommandBackCallback.todoItems["ord-1"], undefined);
@@ -238,14 +238,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
238
238
  TAG: "Error",
239
239
  _0: "timeout"
240
240
  });
241
- CommandBackCallback.phase1([[
241
+ await CommandBackCallback.phase1([[
242
242
  "evt",
243
243
  {
244
244
  TAG: "PaymentReceived",
245
245
  orderId: "ord-1",
246
246
  amount: 50.0
247
247
  }
248
- ]]);
248
+ ]], Capabilities$Reventless.none);
249
249
  let mockPublish = async _cmds => {};
250
250
  await CommandBackCallback.phase2(mockPublish, Capabilities$Reventless.none);
251
251
  let row1 = Stdlib_Option.getOrThrow(CommandBackCallback.todoItems["ord-1"], undefined);
@@ -276,14 +276,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
276
276
  TAG: "Error",
277
277
  _0: "timeout"
278
278
  });
279
- CommandBackCallback.phase1([[
279
+ await CommandBackCallback.phase1([[
280
280
  "evt",
281
281
  {
282
282
  TAG: "PaymentReceived",
283
283
  orderId: "ord-1",
284
284
  amount: 50.0
285
285
  }
286
- ]]);
286
+ ]], Capabilities$Reventless.none);
287
287
  let mockPublish = async _cmds => {};
288
288
  await CommandBackCallback.phase2(mockPublish, Capabilities$Reventless.none);
289
289
  globalThis.expect(Stdlib_Option.getOrThrow(CommandBackCallback.todoItems["ord-1"], undefined).status).toBe("Failed");
@@ -308,14 +308,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
308
308
  TAG: "Error",
309
309
  _0: "timeout"
310
310
  });
311
- CommandBackCallback.phase1([[
311
+ await CommandBackCallback.phase1([[
312
312
  "evt",
313
313
  {
314
314
  TAG: "PaymentReceived",
315
315
  orderId: "ord-1",
316
316
  amount: 50.0
317
317
  }
318
- ]]);
318
+ ]], Capabilities$Reventless.none);
319
319
  let row = Stdlib_Option.getOrThrow(CommandBackCallback.todoItems["ord-1"], undefined);
320
320
  let newrecord = {...row};
321
321
  newrecord.retryCount = 2;
@@ -329,14 +329,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
329
329
  TAG: "Error",
330
330
  _0: "gateway down"
331
331
  });
332
- CommandBackCallback.phase1([[
332
+ await CommandBackCallback.phase1([[
333
333
  "evt",
334
334
  {
335
335
  TAG: "PaymentReceived",
336
336
  orderId: "ord-1",
337
337
  amount: 50.0
338
338
  }
339
- ]]);
339
+ ]], Capabilities$Reventless.none);
340
340
  let publish = async _cmds => {};
341
341
  await CommandBackCallback.phase2(publish, Capabilities$Reventless.none);
342
342
  await CommandBackCallback.phase2(publish, Capabilities$Reventless.none);
@@ -345,14 +345,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
345
345
  globalThis.expect(row.lastError).toEqual("gateway down");
346
346
  });
347
347
  globalThis.test("the row carries the ceiling its count is racing", async () => {
348
- CommandBackCallback.phase1([[
348
+ await CommandBackCallback.phase1([[
349
349
  "evt",
350
350
  {
351
351
  TAG: "PaymentReceived",
352
352
  orderId: "ord-1",
353
353
  amount: 50.0
354
354
  }
355
- ]]);
355
+ ]], Capabilities$Reventless.none);
356
356
  globalThis.expect(Stdlib_Option.getOrThrow(CommandBackCallback.todoItems["ord-1"], undefined).maxRetries).toEqual(OutboundTranslationSliceFixtures$ReventlessLocal.ProcessPaymentSpec.maxRetries);
357
357
  });
358
358
  globalThis.test("a slice that answers onExhausted has its command published", async () => {
@@ -367,14 +367,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
367
367
  orderId: id
368
368
  }
369
369
  ];
370
- CommandBackCallback.phase1([[
370
+ await CommandBackCallback.phase1([[
371
371
  "evt",
372
372
  {
373
373
  TAG: "PaymentReceived",
374
374
  orderId: "ord-1",
375
375
  amount: 50.0
376
376
  }
377
- ]]);
377
+ ]], Capabilities$Reventless.none);
378
378
  let published = {
379
379
  contents: []
380
380
  };
@@ -400,14 +400,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
400
400
  OutboundTranslationSliceFixtures$ReventlessLocal.ProcessPaymentSpec.onExhaustedFn.contents = (_id, _item, lastError) => {
401
401
  seen.contents = lastError;
402
402
  };
403
- CommandBackCallback.phase1([[
403
+ await CommandBackCallback.phase1([[
404
404
  "evt",
405
405
  {
406
406
  TAG: "PaymentReceived",
407
407
  orderId: "ord-1",
408
408
  amount: 50.0
409
409
  }
410
- ]]);
410
+ ]], Capabilities$Reventless.none);
411
411
  let publish = async _cmds => {};
412
412
  await CommandBackCallback.phase2(publish, Capabilities$Reventless.none);
413
413
  await CommandBackCallback.phase2(publish, Capabilities$Reventless.none);
@@ -418,14 +418,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
418
418
  TAG: "Error",
419
419
  _0: "gateway down"
420
420
  });
421
- CommandBackCallback.phase1([[
421
+ await CommandBackCallback.phase1([[
422
422
  "evt",
423
423
  {
424
424
  TAG: "PaymentReceived",
425
425
  orderId: "ord-1",
426
426
  amount: 50.0
427
427
  }
428
- ]]);
428
+ ]], Capabilities$Reventless.none);
429
429
  let published = {
430
430
  contents: []
431
431
  };
@@ -449,14 +449,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
449
449
  orderId: id
450
450
  }
451
451
  ];
452
- CommandBackCallback.phase1([[
452
+ await CommandBackCallback.phase1([[
453
453
  "evt",
454
454
  {
455
455
  TAG: "PaymentReceived",
456
456
  orderId: "ord-1",
457
457
  amount: 50.0
458
458
  }
459
- ]]);
459
+ ]], Capabilities$Reventless.none);
460
460
  let failOnAbandonment = async _cmds => Stdlib_JsError.throwWithMessage("topic unavailable");
461
461
  await CommandBackCallback.phase2(failOnAbandonment, Capabilities$Reventless.none);
462
462
  await CommandBackCallback.phase2(failOnAbandonment, Capabilities$Reventless.none);
@@ -472,14 +472,14 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
472
472
  orderId: id
473
473
  }
474
474
  ];
475
- CommandBackCallback.phase1([[
475
+ await CommandBackCallback.phase1([[
476
476
  "evt",
477
477
  {
478
478
  TAG: "PaymentReceived",
479
479
  orderId: "ord-1",
480
480
  amount: 50.0
481
481
  }
482
- ]]);
482
+ ]], Capabilities$Reventless.none);
483
483
  let row = Stdlib_Option.getOrThrow(CommandBackCallback.todoItems["ord-1"], undefined);
484
484
  let newrecord = {...row};
485
485
  newrecord.retryCount = 2;
@@ -518,7 +518,7 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
518
518
  };
519
519
  }
520
520
  };
521
- CommandBackCallback.phase1([
521
+ await CommandBackCallback.phase1([
522
522
  [
523
523
  "evt",
524
524
  {
@@ -535,7 +535,7 @@ globalThis.describe("OutboundTranslationSlice Callback", () => {
535
535
  amount: 75.0
536
536
  }
537
537
  ]
538
- ]);
538
+ ], Capabilities$Reventless.none);
539
539
  let publishedCommands = {
540
540
  contents: []
541
541
  };
@@ -0,0 +1,160 @@
1
+ // An outbound work item that carries personal data is stored as an event is: its
2
+ // marked fields sealed, its row keyed by a fingerprint of the key `collect`
3
+ // chose, opened before it is translated, and completed without a call once its
4
+ // subject is erased.
5
+
6
+ open JestGlobals
7
+
8
+ let sent: ref<array<string>> = ref([])
9
+
10
+ module VerifySpec = {
11
+ let name = "VerifyAddress"
12
+ let moduleUrl: string = %raw(`import.meta.url`)
13
+
14
+ @schema
15
+ type consumedEvent = AddressGiven({customerId: string, email: string})
16
+
17
+ @schema
18
+ type outboundItem = {
19
+ customerId: string,
20
+ email: @s.matches(Reventless.Pii.mark(~subject="customerId", S.string)) string,
21
+ }
22
+
23
+ @schema
24
+ type inboundCommand = unit
25
+
26
+ // Keyed by the address, as the shop's translations are: a change is new work.
27
+ let collect = (event, ~sourceId as _) =>
28
+ switch event {
29
+ | AddressGiven({customerId, email}) => [(`${customerId}:${email}`, {customerId, email})]
30
+ }
31
+
32
+ let translate = async (_id, item: outboundItem, ~capabilities as _) => {
33
+ sent := sent.contents->Array.concat([item.email])
34
+ Ok(None)
35
+ }
36
+ let onExhausted = (_id, _item, ~lastError as _) => None
37
+
38
+ let maxRetries = 3
39
+ let targetName = None
40
+ let sourceNames: array<string> = []
41
+ let externalSystem = None
42
+ let capabilityNeeds: array<Reventless.CapabilityNeed.t> = []
43
+ let traits: array<Reventless.Trait.t> = []
44
+ }
45
+ module VerifyTranslation = {
46
+ let collect = VerifySpec.collect
47
+ let translate = VerifySpec.translate
48
+ let onExhausted = VerifySpec.onExhausted
49
+ let moduleUrl = VerifySpec.moduleUrl
50
+ }
51
+ module Callback = ReventlessCore.OutboundTranslationSlice_Callback.Make(
52
+ VerifySpec,
53
+ VerifyTranslation,
54
+ )
55
+
56
+ let toBase64 = (s: string) =>
57
+ NodeCrypto.bufferFromString(s, "utf8")->NodeCrypto.bufferToString("base64")
58
+ let fromBase64 = (s: string) =>
59
+ NodeCrypto.bufferFromString(s, "base64")->NodeCrypto.bufferToString("utf8")
60
+
61
+ /** "Encrypts" by base64; `erased` makes every key gone, as an erasure does. */
62
+ let erased = ref(false)
63
+ let provider: Reventless.Pii.provider = {
64
+ name: "fake",
65
+ encrypts: true,
66
+ seal: async (~subject, ~field as _, ~forgettable as _, json) => Ok(
67
+ Reventless.Pii.wrap(`enc:v1:${subject}:fake:${json->JSON.stringify->toBase64}`),
68
+ ),
69
+ prefetch: async _ => Ok(),
70
+ openNow: (~field, json) =>
71
+ switch json->Reventless.Pii.unwrap->Option.flatMap(Reventless.Pii.parseStored) {
72
+ | Some(Cipher(_)) if erased.contents => Ok(Reventless.Pii.wrap(Reventless.Pii.erasedMarker))
73
+ | Some(Cipher({bytes})) => Ok(bytes->fromBase64->JSON.parseOrThrow)
74
+ | _ => Error(Reventless.Pii.UnknownForm({field: field}))
75
+ },
76
+ release: async (~subject as _, ~ref as _) => Ok(),
77
+ }
78
+
79
+ let keyed: Reventless.Capabilities.t = {
80
+ ...Reventless.Capabilities.none,
81
+ secrets: Reventless.Secrets.fixed(
82
+ ~token="t",
83
+ ~hash=s => s,
84
+ ~fingerprint=(~purpose, input) =>
85
+ `fp(${purpose})#${input->toBase64->String.length->Int.toString}`,
86
+ ),
87
+ }
88
+
89
+ let given = VerifySpec.AddressGiven({customerId: "c-1", email: "ada@example.org"})
90
+ let rows = () => Callback.todoItems->Dict.toArray
91
+ let publish: ReventlessInfra.CommandTopic.publishJsons = async _ => ()
92
+
93
+ @val external env: dict<string> = "process.env"
94
+
95
+ describe("an outbound work item with personal data", () => {
96
+ beforeEach(() => {
97
+ Callback.todoItems->Dict.keysToArray->Array.forEach(k => Callback.todoItems->Dict.delete(k))
98
+ sent := []
99
+ erased := false
100
+ Reventless.Pii.Provider.install(provider)
101
+ })
102
+ afterEach(() => {
103
+ Reventless.Pii.Provider.install(Reventless.Pii.plain)
104
+ env->Dict.delete("REVENTLESS_PII_REQUIRE_ENCRYPTION")
105
+ })
106
+
107
+ testPromise("is stored sealed, under a key that holds no address", async () => {
108
+ await Callback.phase1([("c-1", given)], ~capabilities=keyed)
109
+ let stored = rows()->JSON.stringifyAny->Option.getOr("")
110
+ expect(stored->String.includes("ada@example.org"))->toBe(false)
111
+ switch rows() {
112
+ | [(id, row)] =>
113
+ expect(id->String.startsWith("fp(outboundWorkItem:VerifyAddress)"))->toBe(true)
114
+ // A sealed string stays a string, so the work list still serves it as one.
115
+ let email = row.item->JSON.Decode.object->Option.flatMap(d => d->Dict.get("email"))
116
+ expect(
117
+ email
118
+ ->Option.flatMap(JSON.Decode.string)
119
+ ->Option.mapOr(false, s => s->String.startsWith("enc:v1:c-1:")),
120
+ )->toBe(true)
121
+ | _ => fail("expected one row")
122
+ }
123
+ })
124
+
125
+ testPromise("is collected once, however often its event arrives", async () => {
126
+ await Callback.phase1([("c-1", given)], ~capabilities=keyed)
127
+ await Callback.phase1([("c-1", given)], ~capabilities=keyed)
128
+ expect(rows()->Array.length)->toBe(1)
129
+ })
130
+
131
+ testPromise("is opened before it is translated", async () => {
132
+ await Callback.phase1([("c-1", given)], ~capabilities=keyed)
133
+ await Callback.phase2(publish, ~capabilities=keyed)
134
+ expect(sent.contents)->toEqual(["ada@example.org"])
135
+ })
136
+
137
+ testPromise("is completed without a call once its subject is erased", async () => {
138
+ await Callback.phase1([("c-1", given)], ~capabilities=keyed)
139
+ erased := true
140
+ await Callback.phase2(publish, ~capabilities=keyed)
141
+ expect(sent.contents)->toEqual([])
142
+ expect(rows()->Array.map(((_, row)) => row.status))->toEqual([
143
+ ReventlessCore.OutboundTranslationSlice_Callback.Completed,
144
+ ])
145
+ })
146
+
147
+ testPromise("keeps the key it was given where nothing can fingerprint it", async () => {
148
+ await Callback.phase1([("c-1", given)], ~capabilities=Reventless.Capabilities.none)
149
+ expect(rows()->Array.map(Pair.first))->toEqual(["c-1:ada@example.org"])
150
+ })
151
+
152
+ testPromise(
153
+ "is not stored at all where encryption is required and nothing can fingerprint it",
154
+ async () => {
155
+ env->Dict.set("REVENTLESS_PII_REQUIRE_ENCRYPTION", "true")
156
+ await Callback.phase1([("c-1", given)], ~capabilities=Reventless.Capabilities.none)
157
+ expect(rows())->toEqual([])
158
+ },
159
+ )
160
+ })
@@ -0,0 +1,300 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Sury from "sury";
4
+ import * as JestGlobals from "@reventlessdev/rescript-jest/src/JestGlobals.res.mjs";
5
+ import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
6
+ import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
7
+ import * as Nodebuffer from "node:buffer";
8
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
9
+ import * as Pii$Reventless from "@reventlessdev/reventless-spec/src/components/Pii.res.mjs";
10
+ import * as Secrets$Reventless from "@reventlessdev/reventless-spec/src/semantic/Secrets.res.mjs";
11
+ import * as Capabilities$Reventless from "@reventlessdev/reventless-spec/src/semantic/Capabilities.res.mjs";
12
+ import * as OutboundTranslationSlice_Callback$ReventlessCore from "@reventlessdev/reventless-core/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs";
13
+
14
+ let sent = {
15
+ contents: []
16
+ };
17
+
18
+ let name = "VerifyAddress";
19
+
20
+ let moduleUrl = import.meta.url;
21
+
22
+ let consumedEventSchema = Sury.$schema(s => ({
23
+ TAG: "AddressGiven",
24
+ customerId: s.m(Sury.string),
25
+ email: s.m(Sury.string)
26
+ }));
27
+
28
+ let outboundItemSchema = Sury.$schema(s => ({
29
+ customerId: s.m(Sury.string),
30
+ email: s.m(Pii$Reventless.mark("customerId", undefined, Sury.string))
31
+ }));
32
+
33
+ let inboundCommandSchema = Sury.$unit;
34
+
35
+ function collect(event, param) {
36
+ let email = event.email;
37
+ let customerId = event.customerId;
38
+ return [[
39
+ customerId + `:` + email,
40
+ {
41
+ customerId: customerId,
42
+ email: email
43
+ }
44
+ ]];
45
+ }
46
+
47
+ async function translate(_id, item, param) {
48
+ sent.contents = sent.contents.concat([item.email]);
49
+ return {
50
+ TAG: "Ok",
51
+ _0: undefined
52
+ };
53
+ }
54
+
55
+ function onExhausted(_id, _item, param) {
56
+
57
+ }
58
+
59
+ let sourceNames = [];
60
+
61
+ let capabilityNeeds = [];
62
+
63
+ let traits = [];
64
+
65
+ let VerifySpec = {
66
+ name: name,
67
+ moduleUrl: moduleUrl,
68
+ consumedEventSchema: consumedEventSchema,
69
+ outboundItemSchema: outboundItemSchema,
70
+ inboundCommandSchema: inboundCommandSchema,
71
+ collect: collect,
72
+ translate: translate,
73
+ onExhausted: onExhausted,
74
+ maxRetries: 3,
75
+ targetName: undefined,
76
+ sourceNames: sourceNames,
77
+ externalSystem: undefined,
78
+ capabilityNeeds: capabilityNeeds,
79
+ traits: traits
80
+ };
81
+
82
+ let VerifyTranslation = {
83
+ collect: collect,
84
+ translate: translate,
85
+ onExhausted: onExhausted,
86
+ moduleUrl: moduleUrl
87
+ };
88
+
89
+ let Callback = OutboundTranslationSlice_Callback$ReventlessCore.Make({
90
+ name: name,
91
+ moduleUrl: moduleUrl,
92
+ consumedEventSchema: consumedEventSchema,
93
+ outboundItemSchema: outboundItemSchema,
94
+ inboundCommandSchema: inboundCommandSchema,
95
+ maxRetries: 3,
96
+ targetName: undefined,
97
+ sourceNames: sourceNames,
98
+ externalSystem: undefined,
99
+ capabilityNeeds: capabilityNeeds,
100
+ traits: traits
101
+ })(VerifyTranslation);
102
+
103
+ function toBase64(s) {
104
+ return Nodebuffer.Buffer.from(s, "utf8").toString("base64");
105
+ }
106
+
107
+ function fromBase64(s) {
108
+ return Nodebuffer.Buffer.from(s, "base64").toString("utf8");
109
+ }
110
+
111
+ let erased = {
112
+ contents: false
113
+ };
114
+
115
+ async function provider_seal(subject, param, param$1, json) {
116
+ return {
117
+ TAG: "Ok",
118
+ _0: Pii$Reventless.wrap(`enc:v1:` + subject + `:fake:` + toBase64(JSON.stringify(json)))
119
+ };
120
+ }
121
+
122
+ async function provider_prefetch(param) {
123
+ return {
124
+ TAG: "Ok",
125
+ _0: undefined
126
+ };
127
+ }
128
+
129
+ function provider_openNow(field, json) {
130
+ let match = Stdlib_Option.flatMap(Pii$Reventless.unwrap(json), Pii$Reventless.parseStored);
131
+ if (match === undefined) {
132
+ return {
133
+ TAG: "Error",
134
+ _0: {
135
+ TAG: "UnknownForm",
136
+ field: field
137
+ }
138
+ };
139
+ }
140
+ switch (match.TAG) {
141
+ case "Cipher" :
142
+ if (erased.contents) {
143
+ return {
144
+ TAG: "Ok",
145
+ _0: Pii$Reventless.wrap(Pii$Reventless.erasedMarker)
146
+ };
147
+ } else {
148
+ return {
149
+ TAG: "Ok",
150
+ _0: JSON.parse(fromBase64(match.bytes))
151
+ };
152
+ }
153
+ case "ErasedForm" :
154
+ case "ForgottenForm" :
155
+ return {
156
+ TAG: "Error",
157
+ _0: {
158
+ TAG: "UnknownForm",
159
+ field: field
160
+ }
161
+ };
162
+ }
163
+ }
164
+
165
+ async function provider_release(param, param$1) {
166
+ return {
167
+ TAG: "Ok",
168
+ _0: undefined
169
+ };
170
+ }
171
+
172
+ let provider = {
173
+ name: "fake",
174
+ encrypts: true,
175
+ seal: provider_seal,
176
+ prefetch: provider_prefetch,
177
+ openNow: provider_openNow,
178
+ release: provider_release
179
+ };
180
+
181
+ let keyed_geocode = Capabilities$Reventless.none.geocode;
182
+
183
+ let keyed_messaging = Capabilities$Reventless.none.messaging;
184
+
185
+ let keyed_identityProvider = Capabilities$Reventless.none.identityProvider;
186
+
187
+ let keyed_secrets = Secrets$Reventless.fixed("t", s => s, (purpose, input) => `fp(` + purpose + `)#` + toBase64(input).length.toString());
188
+
189
+ let keyed_stash = Capabilities$Reventless.none.stash;
190
+
191
+ let keyed = {
192
+ geocode: keyed_geocode,
193
+ messaging: keyed_messaging,
194
+ identityProvider: keyed_identityProvider,
195
+ secrets: keyed_secrets,
196
+ stash: keyed_stash
197
+ };
198
+
199
+ let given = {
200
+ TAG: "AddressGiven",
201
+ customerId: "c-1",
202
+ email: "ada@example.org"
203
+ };
204
+
205
+ function rows() {
206
+ return Object.entries(Callback.todoItems);
207
+ }
208
+
209
+ async function publish(param) {
210
+
211
+ }
212
+
213
+ globalThis.describe("an outbound work item with personal data", () => {
214
+ globalThis.beforeEach(() => {
215
+ Object.keys(Callback.todoItems).forEach(k => Stdlib_Dict.$$delete(Callback.todoItems, k));
216
+ sent.contents = [];
217
+ erased.contents = false;
218
+ Pii$Reventless.Provider.install(provider);
219
+ });
220
+ globalThis.afterEach(() => {
221
+ Pii$Reventless.Provider.install(Pii$Reventless.plain);
222
+ Stdlib_Dict.$$delete(process.env, "REVENTLESS_PII_REQUIRE_ENCRYPTION");
223
+ });
224
+ globalThis.test("is stored sealed, under a key that holds no address", async () => {
225
+ await Callback.phase1([[
226
+ "c-1",
227
+ given
228
+ ]], keyed);
229
+ let stored = Stdlib_Option.getOr(JSON.stringify(Object.entries(Callback.todoItems)), "");
230
+ globalThis.expect(stored.includes("ada@example.org")).toBe(false);
231
+ let match = Object.entries(Callback.todoItems);
232
+ if (match.length !== 1) {
233
+ return JestGlobals.fail("expected one row");
234
+ }
235
+ let match$1 = match[0];
236
+ globalThis.expect(match$1[0].startsWith("fp(outboundWorkItem:VerifyAddress)")).toBe(true);
237
+ let email = Stdlib_Option.flatMap(Stdlib_JSON.Decode.object(match$1[1].item), d => d["email"]);
238
+ globalThis.expect(Stdlib_Option.mapOr(Stdlib_Option.flatMap(email, Stdlib_JSON.Decode.string), false, s => s.startsWith("enc:v1:c-1:"))).toBe(true);
239
+ });
240
+ globalThis.test("is collected once, however often its event arrives", async () => {
241
+ await Callback.phase1([[
242
+ "c-1",
243
+ given
244
+ ]], keyed);
245
+ await Callback.phase1([[
246
+ "c-1",
247
+ given
248
+ ]], keyed);
249
+ globalThis.expect(Object.entries(Callback.todoItems).length).toBe(1);
250
+ });
251
+ globalThis.test("is opened before it is translated", async () => {
252
+ await Callback.phase1([[
253
+ "c-1",
254
+ given
255
+ ]], keyed);
256
+ await Callback.phase2(publish, keyed);
257
+ globalThis.expect(sent.contents).toEqual(["ada@example.org"]);
258
+ });
259
+ globalThis.test("is completed without a call once its subject is erased", async () => {
260
+ await Callback.phase1([[
261
+ "c-1",
262
+ given
263
+ ]], keyed);
264
+ erased.contents = true;
265
+ await Callback.phase2(publish, keyed);
266
+ globalThis.expect(sent.contents).toEqual([]);
267
+ globalThis.expect(Object.entries(Callback.todoItems).map(param => param[1].status)).toEqual(["Completed"]);
268
+ });
269
+ globalThis.test("keeps the key it was given where nothing can fingerprint it", async () => {
270
+ await Callback.phase1([[
271
+ "c-1",
272
+ given
273
+ ]], Capabilities$Reventless.none);
274
+ globalThis.expect(Object.entries(Callback.todoItems).map(prim => prim[0])).toEqual(["c-1:ada@example.org"]);
275
+ });
276
+ globalThis.test("is not stored at all where encryption is required and nothing can fingerprint it", async () => {
277
+ process.env["REVENTLESS_PII_REQUIRE_ENCRYPTION"] = "true";
278
+ await Callback.phase1([[
279
+ "c-1",
280
+ given
281
+ ]], Capabilities$Reventless.none);
282
+ globalThis.expect(Object.entries(Callback.todoItems)).toEqual([]);
283
+ });
284
+ });
285
+
286
+ export {
287
+ sent,
288
+ VerifySpec,
289
+ VerifyTranslation,
290
+ Callback,
291
+ toBase64,
292
+ fromBase64,
293
+ erased,
294
+ provider,
295
+ keyed,
296
+ given,
297
+ rows,
298
+ publish,
299
+ }
300
+ /* moduleUrl Not a pure module */