@reventlessdev/reventless-gwt 1.0.0-alpha.291 → 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,13 @@
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
+
6
13
  # 1.0.0-alpha.291 (2026-11-19)
7
14
 
8
15
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-gwt",
3
- "version": "1.0.0-alpha.291",
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.342",
21
- "@reventlessdev/reventless-infra": "3.0.0-alpha.235",
22
- "@reventlessdev/reventless-spec": "3.0.0-alpha.204"
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
 
@@ -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",