@reventlessdev/reventless-gwt 1.0.0-alpha.290 → 1.0.0-alpha.292

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
+ # 1.0.0-alpha.292 (2026-11-20)
7
+
8
+ ### Features
9
+
10
+ * **spec:** a translation tells one thing something through a devices capability ([548f28b](https://github.com/ReventlessDev/reventless-core/commit/548f28bcff1caa6f40273619826a387f0bcf9b70))
11
+
12
+
13
+ # 1.0.0-alpha.291 (2026-11-19)
14
+
15
+ ### Features
16
+
17
+ * **dcb:** a pair's events are read across partitions, its hits fetched in batches ([636b9e7](https://github.com/ReventlessDev/reventless-core/commit/636b9e7cdc85c31fe2aa9ca8909fc439f446536d))
18
+ * **dcb:** a slice can mark its own key on a consumed event to read it across partitions ([bf380ee](https://github.com/ReventlessDev/reventless-core/commit/bf380eeffeed7a1d29ef114c8f8e500a6af306d4))
19
+
20
+
6
21
  # 1.0.0-alpha.290 (2026-11-16)
7
22
 
8
23
  **Note:** Version bump only for package @reventlessdev/reventless-gwt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-gwt",
3
- "version": "1.0.0-alpha.290",
3
+ "version": "1.0.0-alpha.292",
4
4
  "description": "Given-When-Then DSLs and test harness for Reventless slice testing",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -14,17 +14,17 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "sury": "11.1.0",
17
- "@reventlessdev/rescript-effect": "1.0.0-alpha.3",
18
- "@reventlessdev/rescript-jest": "1.0.0-alpha.13",
17
+ "@reventlessdev/rescript-effect": "1.0.0-alpha.4",
18
+ "@reventlessdev/rescript-jest": "1.0.0-alpha.14",
19
19
  "@reventlessdev/rescript-node": "2.0.0-alpha.26",
20
- "@reventlessdev/reventless-core": "3.0.0-alpha.341",
21
- "@reventlessdev/reventless-infra": "3.0.0-alpha.234",
22
- "@reventlessdev/reventless-spec": "3.0.0-alpha.203"
20
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.236",
21
+ "@reventlessdev/reventless-core": "3.0.0-alpha.343",
22
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.205"
23
23
  },
24
24
  "devDependencies": {
25
25
  "rescript": "12.3.1",
26
26
  "sury-ppx": "11.1.0",
27
- "@reventlessdev/reventless-ppx": "1.0.0-alpha.114"
27
+ "@reventlessdev/reventless-ppx": "1.0.0-alpha.116"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "rescript": "^12.3.1"
@@ -28,6 +28,8 @@ type call =
28
28
  assert which secret was handed over — a fake has no log to keep it out of. */
29
29
  | Stashed({key: string, value: string, ttl: Reventless.Duration.t})
30
30
  | Taken({key: string})
31
+ /** A thing told something, by kind and instance. */
32
+ | Told({kind: string, instance: string, message: string, body: JSON.t})
31
33
 
32
34
  type t = {
33
35
  capabilities: Capabilities.t,
@@ -43,7 +45,8 @@ that prefixes `"hash:"`. `~secrets` replaces the secret source whole, e.g. with
43
45
  `Secrets.unavailable`; its calls are still recorded. The stash holds what is put
44
46
  in it and hands each value over once, starting from `~stashed`; `~stash`
45
47
  replaces it whole, e.g. with `Stash.unavailable`. `~text` is the deployment's
46
- languages and catalogue; without it every message is in its English.
48
+ languages and catalogue; without it every message is in its English. A thing told
49
+ something accepts it unless `~tell` answers otherwise.
47
50
  */
48
51
  let make = (
49
52
  ~geocode: option<Geocoding.search>=?,
@@ -63,6 +66,14 @@ let make = (
63
66
  ~stashed: array<(string, string)>=[],
64
67
  ~stash: option<Stash.t>=?,
65
68
  ~text: Text.t=Text.sourceOnly,
69
+ ~tell: option<
70
+ (
71
+ ~kind: string,
72
+ ~instance: string,
73
+ ~message: string,
74
+ ~body: JSON.t,
75
+ ) => promise<Reventless.Devices.answer>,
76
+ >=?,
66
77
  (),
67
78
  ): t => {
68
79
  let log: array<call> = []
@@ -151,6 +162,15 @@ let make = (
151
162
  },
152
163
  },
153
164
  text,
165
+ devices: {
166
+ tell: async (~kind, ~instance, ~message, ~body) => {
167
+ record(Told({kind, instance, message, body}))
168
+ switch tell {
169
+ | Some(f) => await f(~kind, ~instance, ~message, ~body)
170
+ | None => Accepted
171
+ }
172
+ },
173
+ },
154
174
  }
155
175
  {capabilities, calls: () => log->Array.copy}
156
176
  }
@@ -196,5 +216,10 @@ let toJson = (c: call): JSON.t => {
196
216
  | Hashed({input}) => obj("Hashed", [("input", str(input))])
197
217
  | Stashed({key, ttl, _}) => obj("Stashed", [("key", str(key)), ("ttl", JSON.Encode.int(ttl))])
198
218
  | Taken({key}) => obj("Taken", [("key", str(key))])
219
+ | Told({kind, instance, message, body}) =>
220
+ obj(
221
+ "Told",
222
+ [("kind", str(kind)), ("instance", str(instance)), ("message", str(message)), ("body", body)],
223
+ )
199
224
  }
200
225
  }
@@ -8,7 +8,7 @@ import * as Secrets$Reventless from "@reventlessdev/reventless-spec/src/semantic
8
8
  import * as Messaging$Reventless from "@reventlessdev/reventless-spec/src/semantic/Messaging.res.mjs";
9
9
  import * as IdentityProvider$Reventless from "@reventlessdev/reventless-spec/src/semantic/IdentityProvider.res.mjs";
10
10
 
11
- function make(geocode, send, channelsOpt, pushServicesOpt, createPrincipal, token, hash, secrets, stashedOpt, stash, textOpt, param) {
11
+ function make(geocode, send, channelsOpt, pushServicesOpt, createPrincipal, token, hash, secrets, stashedOpt, stash, textOpt, tell, param) {
12
12
  let channels = channelsOpt !== undefined ? channelsOpt : [
13
13
  "Email",
14
14
  "Sms"
@@ -178,13 +178,30 @@ function make(geocode, send, channelsOpt, pushServicesOpt, createPrincipal, toke
178
178
  };
179
179
  }
180
180
  };
181
+ let capabilities_devices = {
182
+ tell: async (kind, instance, message, body) => {
183
+ log.push({
184
+ TAG: "Told",
185
+ kind: kind,
186
+ instance: instance,
187
+ message: message,
188
+ body: body
189
+ });
190
+ if (tell !== undefined) {
191
+ return await tell(kind, instance, message, body);
192
+ } else {
193
+ return "Accepted";
194
+ }
195
+ }
196
+ };
181
197
  let capabilities = {
182
198
  geocode: geocode$1,
183
199
  messaging: capabilities_messaging,
184
200
  identityProvider: capabilities_identityProvider,
185
201
  secrets: capabilities_secrets,
186
202
  stash: capabilities_stash,
187
- text: text
203
+ text: text,
204
+ devices: capabilities_devices
188
205
  };
189
206
  return {
190
207
  capabilities: capabilities,
@@ -301,6 +318,25 @@ function toJson(c) {
301
318
  "key",
302
319
  c.key
303
320
  ]]);
321
+ case "Told" :
322
+ return obj("Told", [
323
+ [
324
+ "kind",
325
+ c.kind
326
+ ],
327
+ [
328
+ "instance",
329
+ c.instance
330
+ ],
331
+ [
332
+ "message",
333
+ c.message
334
+ ],
335
+ [
336
+ "body",
337
+ c.body
338
+ ]
339
+ ]);
304
340
  }
305
341
  }
306
342
 
@@ -534,7 +534,7 @@ function Make(Spec) {
534
534
  }
535
535
  errors.contents = [];
536
536
  appendConditionFailure.contents = undefined;
537
- let query = DcbTag$Reventless.buildQueryFromCommand(consumedEventTypes, Spec.commandSchema, cmd, tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys);
537
+ let query = DcbTag$Reventless.buildQueryFromCommand(consumedEventTypes, Spec.commandSchema, cmd, tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys, undefined);
538
538
  let condition = {
539
539
  query: query
540
540
  };
package/src/Flow_GWT.res CHANGED
@@ -245,10 +245,16 @@ let thenBoundaryScopeResolves = async (
245
245
  // Deploy and boot derive the storage partition from the same slices and refuse
246
246
  // the boundary when it fails, so the test fails with their reasons.
247
247
  let partitionReasons = {
248
- let hints = Reventless.DcbValidation.validatePartitionHintsVsInference(
249
- ~shapes=slices->Array.map(Reventless.DcbTag.sliceShape),
248
+ let shapes = slices->Array.map(Reventless.DcbTag.sliceShape)
249
+ let hints = Reventless.DcbValidation.validatePartitionHintsVsInference(~shapes)
250
+ let arms = Reventless.DcbValidation.validateCrossPartitionArms(
251
+ ~shapes,
252
+ ~inferred=Reventless.DcbScopeInference.infer(shapes),
250
253
  )
251
- let contradictions = hints.contradictions->Array.map(e => `${e.sliceName}: ${e.message}`)
254
+ let contradictions =
255
+ hints.contradictions
256
+ ->Array.concat(arms.contradictions)
257
+ ->Array.map(e => `${e.sliceName}: ${e.message}`)
252
258
  switch Reventless.DcbTag.deriveBoundaryPartition(slices) {
253
259
  | _ => contradictions
254
260
  | exception JsExn(err) =>
@@ -141,8 +141,10 @@ function test(name, timeout, body) {
141
141
  async function thenBoundaryScopeResolves(flowP, name, slices) {
142
142
  let s = await flowP;
143
143
  let scope = DcbTag$Reventless.deriveEffectiveScope(slices);
144
- let hints = DcbValidation$Reventless.validatePartitionHintsVsInference(slices.map(DcbTag$Reventless.sliceShape));
145
- let contradictions = hints.contradictions.map(e => e.sliceName + `: ` + e.message);
144
+ let shapes = slices.map(DcbTag$Reventless.sliceShape);
145
+ let hints = DcbValidation$Reventless.validatePartitionHintsVsInference(shapes);
146
+ let arms = DcbValidation$Reventless.validateCrossPartitionArms(shapes, DcbScopeInference$Reventless.infer(shapes));
147
+ let contradictions = hints.contradictions.concat(arms.contradictions).map(e => e.sliceName + `: ` + e.message);
146
148
  let partitionReasons;
147
149
  try {
148
150
  DcbTag$Reventless.deriveBoundaryPartition(slices);
@@ -205,7 +207,7 @@ function CommandStep(Spec) {
205
207
  })), crossPartitionTagKeys);
206
208
  let whenCommand = async (flowP, command) => {
207
209
  let s = await flowP;
208
- let query = DcbTag$Reventless.buildQueryFromCommand(consumedEventTypes, Spec.commandSchema, command, tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys);
210
+ let query = DcbTag$Reventless.buildQueryFromCommand(consumedEventTypes, Spec.commandSchema, command, tagKeysByEventType, crossPartitionTagKeys, payloadTagKeys, undefined);
209
211
  let history = decodeMatching(s.log, consumedDecoder, query);
210
212
  let state = Stdlib_Array.reduce(history, Decision.initialState, Decision.evolve);
211
213
  let events = Decision.decide(state, command);
@@ -111,7 +111,7 @@ function FromSlice(Spec) {
111
111
  }
112
112
  };
113
113
  let whenInput = async (input, fakesOpt, caller) => {
114
- let fakes = fakesOpt !== undefined ? fakesOpt : Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
114
+ let fakes = fakesOpt !== undefined ? fakesOpt : Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
115
115
  let outcome;
116
116
  let exit = 0;
117
117
  let pairs;
@@ -140,7 +140,7 @@ function FromSlice(Spec) {
140
140
  };
141
141
  };
142
142
  let whenReceived = async (json, fakesOpt, caller) => {
143
- let fakes = fakesOpt !== undefined ? fakesOpt : Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
143
+ let fakes = fakesOpt !== undefined ? fakesOpt : Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
144
144
  let input;
145
145
  try {
146
146
  input = Util_Sury$Reventless.fromJson(json, Spec.externalInputSchema);
@@ -222,7 +222,7 @@ function FromSlice(Spec) {
222
222
  let givenTodo = (id, item) => ({
223
223
  id: id,
224
224
  item: item,
225
- fakes: Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined)
225
+ fakes: Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined)
226
226
  });
227
227
  let givenCapabilities = (todo, fakes) => ({
228
228
  id: todo.id,
@@ -253,7 +253,7 @@ describe("InboundTranslation_GWT.FromSlice", () => {
253
253
  TAG: "Unavailable",
254
254
  _0: "down"
255
255
  }
256
- }), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined), undefined), "down"));
256
+ }), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined), undefined), "down"));
257
257
  test("a translation that throws declined the input", undefined, () => thenNotUnderstood(whenInput({
258
258
  orderId: "o1",
259
259
  status: "broken"
@@ -151,7 +151,7 @@ let down = Capabilities_Fake$ReventlessGwt.make(undefined, async (param, param$1
151
151
  TAG: "Unavailable",
152
152
  _0: "smtp down"
153
153
  }
154
- }), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
154
+ }), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
155
155
 
156
156
  let welcome = {
157
157
  TAG: "Sent",