@reventlessdev/reventless-gwt 1.0.0-alpha.285 → 1.0.0-alpha.287
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 +16 -0
- package/package.json +5 -5
- package/src/Capabilities_Fake.res +6 -1
- package/src/Capabilities_Fake.res.mjs +13 -3
- package/src/InboundTranslation_GWT.res.mjs +2 -2
- package/src/OutboundTranslation_GWT.res +14 -4
- package/src/OutboundTranslation_GWT.res.mjs +9 -6
- package/tests/InboundFromSliceGwtTest.res.mjs +1 -1
- package/tests/OutboundFromSliceGwtTest.res.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.287 (2026-11-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @reventlessdev/reventless-gwt
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 1.0.0-alpha.286 (2026-11-11)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **registration:** a visitor's mails are written in the language they asked in ([b677e08](https://github.com/ReventlessDev/reventless-core/commit/b677e08cafe11af28cf917270f9ae8fafb2425da))
|
|
19
|
+
* **spec:** a server's messages are written in the recipient's language ([31bbf5f](https://github.com/ReventlessDev/reventless-core/commit/31bbf5f0a613131113d6f3e8a569578d29c439af))
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# 1.0.0-alpha.285 (2026-11-09)
|
|
7
23
|
|
|
8
24
|
**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.
|
|
3
|
+
"version": "1.0.0-alpha.287",
|
|
4
4
|
"description": "Given-When-Then DSLs and test harness for Reventless slice testing",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"sury": "11.1.0",
|
|
17
17
|
"@reventlessdev/rescript-effect": "1.0.0-alpha.3",
|
|
18
18
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
19
|
-
"@reventlessdev/reventless-
|
|
20
|
-
"@reventlessdev/reventless-
|
|
21
|
-
"@reventlessdev/reventless-
|
|
19
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.338",
|
|
20
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.231",
|
|
21
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.200",
|
|
22
22
|
"@reventlessdev/rescript-node": "2.0.0-alpha.26"
|
|
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.
|
|
27
|
+
"@reventlessdev/reventless-ppx": "1.0.0-alpha.113"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"rescript": "^12.3.1"
|
|
@@ -8,6 +8,7 @@ module Messaging = Reventless.Messaging
|
|
|
8
8
|
module IdentityProvider = Reventless.IdentityProvider
|
|
9
9
|
module Secrets = Reventless.Secrets
|
|
10
10
|
module Stash = Reventless.Stash
|
|
11
|
+
module Text = Reventless.Text
|
|
11
12
|
|
|
12
13
|
/** One call a slice made through its capabilities. */
|
|
13
14
|
type call =
|
|
@@ -41,7 +42,8 @@ principal with a numbered id, `token` (or `t` repeated to length), and a hash
|
|
|
41
42
|
that prefixes `"hash:"`. `~secrets` replaces the secret source whole, e.g. with
|
|
42
43
|
`Secrets.unavailable`; its calls are still recorded. The stash holds what is put
|
|
43
44
|
in it and hands each value over once, starting from `~stashed`; `~stash`
|
|
44
|
-
replaces it whole, e.g. with `Stash.unavailable`.
|
|
45
|
+
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.
|
|
45
47
|
*/
|
|
46
48
|
let make = (
|
|
47
49
|
~geocode: option<Geocoding.search>=?,
|
|
@@ -60,6 +62,7 @@ let make = (
|
|
|
60
62
|
~secrets: option<Secrets.t>=?,
|
|
61
63
|
~stashed: array<(string, string)>=[],
|
|
62
64
|
~stash: option<Stash.t>=?,
|
|
65
|
+
~text: Text.t=Text.sourceOnly,
|
|
63
66
|
(),
|
|
64
67
|
): t => {
|
|
65
68
|
let log: array<call> = []
|
|
@@ -147,6 +150,7 @@ let make = (
|
|
|
147
150
|
}
|
|
148
151
|
},
|
|
149
152
|
},
|
|
153
|
+
text,
|
|
150
154
|
}
|
|
151
155
|
{capabilities, calls: () => log->Array.copy}
|
|
152
156
|
}
|
|
@@ -171,6 +175,7 @@ let toJson = (c: call): JSON.t => {
|
|
|
171
175
|
("recipient", str(recipientText(recipient))),
|
|
172
176
|
("subject", message.subject->Option.mapOr(JSON.Encode.null, str)),
|
|
173
177
|
("body", str(message.body)),
|
|
178
|
+
("language", message.language->Option.mapOr(JSON.Encode.null, str)),
|
|
174
179
|
],
|
|
175
180
|
)
|
|
176
181
|
| PrincipalCreated({contact, groups, _}) =>
|
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
|
|
4
4
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
+
import * as Text$Reventless from "@reventlessdev/reventless-spec/src/i18n/Text.res.mjs";
|
|
6
7
|
import * as Secrets$Reventless from "@reventlessdev/reventless-spec/src/semantic/Secrets.res.mjs";
|
|
7
8
|
import * as Messaging$Reventless from "@reventlessdev/reventless-spec/src/semantic/Messaging.res.mjs";
|
|
8
9
|
import * as IdentityProvider$Reventless from "@reventlessdev/reventless-spec/src/semantic/IdentityProvider.res.mjs";
|
|
9
10
|
|
|
10
|
-
function make(geocode, send, channelsOpt, pushServicesOpt, createPrincipal, token, hash, secrets, stashedOpt, stash, param) {
|
|
11
|
+
function make(geocode, send, channelsOpt, pushServicesOpt, createPrincipal, token, hash, secrets, stashedOpt, stash, textOpt, param) {
|
|
11
12
|
let channels = channelsOpt !== undefined ? channelsOpt : [
|
|
12
13
|
"Email",
|
|
13
14
|
"Sms"
|
|
14
15
|
];
|
|
15
16
|
let pushServices = pushServicesOpt !== undefined ? pushServicesOpt : [];
|
|
16
17
|
let stashed = stashedOpt !== undefined ? stashedOpt : [];
|
|
18
|
+
let text = textOpt !== undefined ? textOpt : Text$Reventless.sourceOnly;
|
|
17
19
|
let log = [];
|
|
18
20
|
let geocode$1 = async text => {
|
|
19
21
|
log.push({
|
|
@@ -181,7 +183,8 @@ function make(geocode, send, channelsOpt, pushServicesOpt, createPrincipal, toke
|
|
|
181
183
|
messaging: capabilities_messaging,
|
|
182
184
|
identityProvider: capabilities_identityProvider,
|
|
183
185
|
secrets: capabilities_secrets,
|
|
184
|
-
stash: capabilities_stash
|
|
186
|
+
stash: capabilities_stash,
|
|
187
|
+
text: text
|
|
185
188
|
};
|
|
186
189
|
return {
|
|
187
190
|
capabilities: capabilities,
|
|
@@ -228,6 +231,10 @@ function toJson(c) {
|
|
|
228
231
|
[
|
|
229
232
|
"body",
|
|
230
233
|
message.body
|
|
234
|
+
],
|
|
235
|
+
[
|
|
236
|
+
"language",
|
|
237
|
+
Stdlib_Option.mapOr(message.language, null, str)
|
|
231
238
|
]
|
|
232
239
|
]);
|
|
233
240
|
case "PrincipalCreated" :
|
|
@@ -309,6 +316,8 @@ let Secrets;
|
|
|
309
316
|
|
|
310
317
|
let Stash;
|
|
311
318
|
|
|
319
|
+
let Text;
|
|
320
|
+
|
|
312
321
|
export {
|
|
313
322
|
Capabilities,
|
|
314
323
|
Geocoding,
|
|
@@ -316,7 +325,8 @@ export {
|
|
|
316
325
|
IdentityProvider,
|
|
317
326
|
Secrets,
|
|
318
327
|
Stash,
|
|
328
|
+
Text,
|
|
319
329
|
make,
|
|
320
330
|
toJson,
|
|
321
331
|
}
|
|
322
|
-
/*
|
|
332
|
+
/* Text-Reventless Not a pure module */
|
|
@@ -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);
|
|
114
|
+
let fakes = fakesOpt !== undefined ? fakesOpt : Capabilities_Fake$ReventlessGwt.make(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);
|
|
143
|
+
let fakes = fakesOpt !== undefined ? fakesOpt : Capabilities_Fake$ReventlessGwt.make(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);
|
|
@@ -103,8 +103,10 @@ module Make = (Spec: SliceSpec): (T with module Spec = Spec) => {
|
|
|
103
103
|
// aggregate-source test passes the entity id it is exercising.
|
|
104
104
|
let givenEvent = e => e
|
|
105
105
|
let whenCollect = (e, ~sourceId="") => e->Spec.collect(~sourceId)
|
|
106
|
+
// Compared as they are written, so an optional field left out and one set to nothing
|
|
107
|
+
// read alike, as they do on the wire.
|
|
106
108
|
let thenTodos = (actual, expected) =>
|
|
107
|
-
if actual == expected {
|
|
109
|
+
if JSON.stringifyAny(encItems(actual)) == JSON.stringifyAny(encItems(expected)) {
|
|
108
110
|
Outcome.pass
|
|
109
111
|
} else {
|
|
110
112
|
Outcome.fail(
|
|
@@ -147,7 +149,10 @@ module Make = (Spec: SliceSpec): (T with module Spec = Spec) => {
|
|
|
147
149
|
let thenCommand = async (pending, expectedId, expectedCmd) => {
|
|
148
150
|
let {result, _} = await pending
|
|
149
151
|
switch result {
|
|
150
|
-
| Ok(Some((id, cmd)))
|
|
152
|
+
| Ok(Some((id, cmd)))
|
|
153
|
+
if id == expectedId &&
|
|
154
|
+
JSON.stringifyAny(commandPairJson(id, cmd)) ==
|
|
155
|
+
JSON.stringifyAny(commandPairJson(expectedId, expectedCmd)) => Outcome.pass
|
|
151
156
|
| Ok(Some((id, cmd))) =>
|
|
152
157
|
Outcome.fail(
|
|
153
158
|
EventsMismatch({
|
|
@@ -273,8 +278,10 @@ module FromSlice = (
|
|
|
273
278
|
// Unit: collect
|
|
274
279
|
let givenEvent = (e: Spec.consumedEvent) => e
|
|
275
280
|
let whenCollect = (e, ~sourceId="") => Translation.collect(e, ~sourceId)
|
|
281
|
+
// Compared as they are written, so an optional field left out and one set to nothing
|
|
282
|
+
// read alike, as they do on the wire.
|
|
276
283
|
let thenTodos = (actual, expected) =>
|
|
277
|
-
actual == expected
|
|
284
|
+
JSON.stringifyAny(encItems(actual)) == JSON.stringifyAny(encItems(expected))
|
|
278
285
|
? Outcome.pass
|
|
279
286
|
: Outcome.fail(TodoMismatch({expected: encItems(expected), actual: encItems(actual)}))
|
|
280
287
|
|
|
@@ -350,7 +357,10 @@ module FromSlice = (
|
|
|
350
357
|
let thenCommand = async (pending, expectedId, expectedCmd) => {
|
|
351
358
|
let {result, _} = await pending
|
|
352
359
|
switch result {
|
|
353
|
-
| Ok(Some((id, cmd)))
|
|
360
|
+
| Ok(Some((id, cmd)))
|
|
361
|
+
if id == expectedId &&
|
|
362
|
+
JSON.stringifyAny(commandPairJson(id, cmd)) ==
|
|
363
|
+
JSON.stringifyAny(commandPairJson(expectedId, expectedCmd)) => Outcome.pass
|
|
354
364
|
| Ok(actual) =>
|
|
355
365
|
Outcome.fail(
|
|
356
366
|
EventsMismatch({
|
|
@@ -24,7 +24,7 @@ function Make(Spec) {
|
|
|
24
24
|
return Spec.collect(e, sourceId);
|
|
25
25
|
};
|
|
26
26
|
let thenTodos = (actual, expected) => {
|
|
27
|
-
if (Primitive_object.equal(actual, expected)) {
|
|
27
|
+
if (Primitive_object.equal(JSON.stringify(encItems(actual)), JSON.stringify(encItems(expected)))) {
|
|
28
28
|
return Outcome$ReventlessGwt.pass;
|
|
29
29
|
} else {
|
|
30
30
|
return Outcome$ReventlessGwt.fail({
|
|
@@ -97,7 +97,7 @@ function Make(Spec) {
|
|
|
97
97
|
}
|
|
98
98
|
let cmd = match$1[1];
|
|
99
99
|
let id = match$1[0];
|
|
100
|
-
if (id === expectedId && Primitive_object.equal(cmd, expectedCmd)) {
|
|
100
|
+
if (id === expectedId && Primitive_object.equal(JSON.stringify(commandPairJson(id, cmd)), JSON.stringify(commandPairJson(expectedId, expectedCmd)))) {
|
|
101
101
|
return Outcome$ReventlessGwt.pass;
|
|
102
102
|
} else {
|
|
103
103
|
return Outcome$ReventlessGwt.fail({
|
|
@@ -216,7 +216,7 @@ function FromSlice(Spec) {
|
|
|
216
216
|
return Translation.collect(e, sourceId);
|
|
217
217
|
};
|
|
218
218
|
let thenTodos = (actual, expected) => {
|
|
219
|
-
if (Primitive_object.equal(actual, expected)) {
|
|
219
|
+
if (Primitive_object.equal(JSON.stringify(encItems(actual)), JSON.stringify(encItems(expected)))) {
|
|
220
220
|
return Outcome$ReventlessGwt.pass;
|
|
221
221
|
} else {
|
|
222
222
|
return Outcome$ReventlessGwt.fail({
|
|
@@ -229,7 +229,7 @@ function FromSlice(Spec) {
|
|
|
229
229
|
let givenTodo = (id, item) => ({
|
|
230
230
|
id: id,
|
|
231
231
|
item: item,
|
|
232
|
-
fakes: Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined)
|
|
232
|
+
fakes: Capabilities_Fake$ReventlessGwt.make(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined)
|
|
233
233
|
});
|
|
234
234
|
let givenCapabilities = (todo, fakes) => ({
|
|
235
235
|
id: todo.id,
|
|
@@ -316,8 +316,11 @@ function FromSlice(Spec) {
|
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
let actual = result._0;
|
|
319
|
-
if (actual !== undefined
|
|
320
|
-
|
|
319
|
+
if (actual !== undefined) {
|
|
320
|
+
let id = actual[0];
|
|
321
|
+
if (id === expectedId && Primitive_object.equal(JSON.stringify(commandPairJson(id, actual[1])), JSON.stringify(commandPairJson(expectedId, expectedCmd)))) {
|
|
322
|
+
return Outcome$ReventlessGwt.pass;
|
|
323
|
+
}
|
|
321
324
|
}
|
|
322
325
|
return Outcome$ReventlessGwt.fail({
|
|
323
326
|
TAG: "EventsMismatch",
|
|
@@ -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), "down"));
|
|
256
|
+
}), 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);
|
|
154
|
+
}), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
155
155
|
|
|
156
156
|
let welcome = {
|
|
157
157
|
TAG: "Sent",
|