@reventlessdev/online-shop-hybrid-ordering 1.0.0-alpha.269 → 1.0.0-alpha.271

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/package.json +10 -10
  3. package/src/CatalogProduct/StateChange/SyncCatalogProduct.res.mjs +2 -2
  4. package/src/Customer/Aggregate/Customer.res.mjs +2 -2
  5. package/src/Customer/StateChange/EmailVerificationChallenges.res.mjs +2 -2
  6. package/src/ExtensionPoint/Orders_ExtensionPointMapping.res.mjs +2 -2
  7. package/src/Notification/Automation/NotificationIntake.res.mjs +2 -2
  8. package/src/Notification/StateChange/NotificationPreferences.res.mjs +2 -2
  9. package/src/Notification/StateChange/NotificationSourceClaims.res.mjs +2 -2
  10. package/src/Order/Automation/AutoShipOrder.res.mjs +2 -2
  11. package/src/Order/StateChange/CancelOrder.res.mjs +2 -2
  12. package/src/Order/StateChange/PlaceOrder.res.mjs +2 -2
  13. package/src/Order/StateChange/ShipOrder.res.mjs +13 -9
  14. package/src/Plugin.res.mjs +11 -11
  15. package/tests/CatalogProduct/StateChange/SyncCatalogProduct_GWT.res.mjs +1 -1
  16. package/tests/Customer/AddressGeocodingConformance_GWT.res.mjs +2 -2
  17. package/tests/Customer/Aggregate/Customer_GWT.res.mjs +2 -2
  18. package/tests/Customer/OutboundTranslation/GeocodeCustomerAddress_GWT.res +41 -27
  19. package/tests/Customer/OutboundTranslation/GeocodeCustomerAddress_GWT.res.mjs +82 -37
  20. package/tests/Customer/OutboundTranslation/VerifyCustomerEmail_GWT.res +49 -73
  21. package/tests/Customer/OutboundTranslation/VerifyCustomerEmail_GWT.res.mjs +117 -95
  22. package/tests/Customer/StateChange/EmailVerificationChallenges_GWT.res.mjs +1 -1
  23. package/tests/Extension/Products_Extension_GWT.res.mjs +1 -1
  24. package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +1 -1
  25. package/tests/Flow/OrderingFlow_GWT.res +2 -37
  26. package/tests/Flow/OrderingFlow_GWT.res.mjs +23 -87
  27. package/tests/Notification/Automation/NotificationIntake_GWT.res +2 -18
  28. package/tests/Notification/Automation/NotificationIntake_GWT.res.mjs +48 -52
  29. package/tests/Notification/NotificationConformance_GWT.res.mjs +2 -2
  30. package/tests/Notification/OutboundTranslation/AnnounceRecipientContact_GWT.res +37 -0
  31. package/tests/Notification/OutboundTranslation/AnnounceRecipientContact_GWT.res.mjs +137 -0
  32. package/tests/Notification/OutboundTranslation/SendNotification_GWT.res +17 -25
  33. package/tests/Notification/OutboundTranslation/SendNotification_GWT.res.mjs +61 -46
  34. package/tests/Notification/StateChange/NotificationPreferences_GWT.res.mjs +1 -1
  35. package/tests/Notification/StateChange/NotificationSourceClaims_GWT.res.mjs +1 -1
  36. package/tests/Order/Automation/AutoShipOrder_GWT.res +17 -22
  37. package/tests/Order/Automation/AutoShipOrder_GWT.res.mjs +78 -57
  38. package/tests/Order/StateChange/CancelOrder_GWT.res.mjs +1 -1
  39. package/tests/Order/StateChange/PlaceOrder_GWT.res.mjs +1 -1
  40. package/tests/Order/StateChange/ShipOrder_GWT.res.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
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.271 (2026-10-10)
7
+
8
+ * feat!: a command's rule is looked up by its name, without a cast ([5f02c40](https://github.com/ReventlessDev/reventless-core/commit/5f02c4081d077bf4a6951d8c9b2b16553a8ca87b))
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ * a spec that writes `commandAuthorization` by hand writes
13
+ `authorizationOf = (name: string) => …` instead; the PPX refuses the old name.
14
+
15
+
16
+
17
+ # 1.0.0-alpha.270 (2026-10-10)
18
+
19
+ ### Features
20
+
21
+ * **gwt:** automation and translation tests take the slice as written, and the sidecars read them ([93a0919](https://github.com/ReventlessDev/reventless-core/commit/93a0919a0d66730cf9bf89144ad8fba3cb025332))
22
+
23
+
6
24
  # 1.0.0-alpha.269 (2026-10-08)
7
25
 
8
26
  **Note:** Version bump only for package @reventlessdev/online-shop-hybrid-ordering
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/online-shop-hybrid-ordering",
3
- "version": "1.0.0-alpha.269",
3
+ "version": "1.0.0-alpha.271",
4
4
  "description": "Online Shop Hybrid example — Ordering plugin (Customer aggregate + Order/CatalogProduct DCB)",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -21,20 +21,20 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "sury": "11.0.0",
24
- "@reventlessdev/online-shop-hybrid-catalog-spec": "1.0.0-alpha.157",
25
- "@reventlessdev/online-shop-hybrid-ordering-spec": "1.0.0-alpha.156",
24
+ "@reventlessdev/online-shop-hybrid-catalog-spec": "1.0.0-alpha.159",
25
+ "@reventlessdev/online-shop-hybrid-ordering-spec": "1.0.0-alpha.158",
26
26
  "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.23",
27
- "@reventlessdev/reventless-infra": "3.0.0-alpha.188",
28
- "@reventlessdev/reventless-gwt": "1.0.0-alpha.238",
29
- "@reventlessdev/reventless-spec": "3.0.0-alpha.160",
30
- "@reventlessdev/reventless-local": "3.0.0-alpha.281",
31
- "@reventlessdev/trait-address-geocoding": "1.0.0-alpha.40",
32
- "@reventlessdev/trait-notification": "1.0.0-alpha.40"
27
+ "@reventlessdev/reventless-gwt": "1.0.0-alpha.240",
28
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.190",
29
+ "@reventlessdev/reventless-local": "3.0.0-alpha.283",
30
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.162",
31
+ "@reventlessdev/trait-address-geocoding": "1.0.0-alpha.42",
32
+ "@reventlessdev/trait-notification": "1.0.0-alpha.42"
33
33
  },
34
34
  "devDependencies": {
35
35
  "rescript": "12.3.1",
36
36
  "sury-ppx": "11.0.0",
37
- "@reventlessdev/reventless-ppx": "1.0.0-alpha.98"
37
+ "@reventlessdev/reventless-ppx": "1.0.0-alpha.99"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "rescript": "^12.3.1"
@@ -82,7 +82,7 @@ let eventSchema = Sury.union([
82
82
  }))
83
83
  ]);
84
84
 
85
- function commandAuthorization(param) {
85
+ function authorizationOf(param) {
86
86
  return "AllowAuthenticated";
87
87
  }
88
88
 
@@ -108,7 +108,7 @@ export {
108
108
  errorSchema,
109
109
  eventSchema,
110
110
  moduleUrl,
111
- commandAuthorization,
111
+ authorizationOf,
112
112
  readConsistency,
113
113
  commandTransition,
114
114
  traits,
@@ -84,7 +84,7 @@ let traits = [AddressGeocoding$TraitAddressGeocoding.declaration];
84
84
 
85
85
  let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, ["MarkEmailVerified"]);
86
86
 
87
- function commandAuthorization(param) {
87
+ function authorizationOf(param) {
88
88
  return "AllowAuthenticated";
89
89
  }
90
90
 
@@ -103,6 +103,6 @@ export {
103
103
  traits,
104
104
  commandSchema$1 as commandSchema,
105
105
  moduleUrl,
106
- commandAuthorization,
106
+ authorizationOf,
107
107
  }
108
108
  /* commandSchema Not a pure module */
@@ -71,7 +71,7 @@ let eventSchema = Sury.union([
71
71
 
72
72
  let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, ["IssueEmailChallenge"]);
73
73
 
74
- function commandAuthorization(param) {
74
+ function authorizationOf(param) {
75
75
  return "AllowAuthenticated";
76
76
  }
77
77
 
@@ -97,7 +97,7 @@ export {
97
97
  eventSchema,
98
98
  commandSchema$1 as commandSchema,
99
99
  moduleUrl,
100
- commandAuthorization,
100
+ authorizationOf,
101
101
  readConsistency,
102
102
  commandTransition,
103
103
  traits,
@@ -24,7 +24,7 @@ let eventSchema = Sury.union([
24
24
 
25
25
  let errorSchema = Sury.$unit;
26
26
 
27
- function commandAuthorization(param) {
27
+ function authorizationOf(param) {
28
28
  return "AllowAuthenticated";
29
29
  }
30
30
 
@@ -41,7 +41,7 @@ let Delegate = {
41
41
  eventSchema: eventSchema,
42
42
  errorSchema: errorSchema,
43
43
  moduleUrl: "@reventlessdev/online-shop-hybrid-ordering/src/ExtensionPoint/Orders_ExtensionPointMapping.res.mjs",
44
- commandAuthorization: commandAuthorization,
44
+ authorizationOf: authorizationOf,
45
45
  commandTransition: commandTransition,
46
46
  traits: traits
47
47
  };
@@ -24,7 +24,7 @@ let commandSchema = Sury.$schema(s => ({
24
24
  origin: s.m(NotificationPreferences$OrderingPlugin.originSchema)
25
25
  }));
26
26
 
27
- function commandAuthorization(param) {
27
+ function authorizationOf(param) {
28
28
  return "AllowAuthenticated";
29
29
  }
30
30
 
@@ -55,7 +55,7 @@ export {
55
55
  heartbeatInterval,
56
56
  targetName,
57
57
  moduleUrl,
58
- commandAuthorization,
58
+ authorizationOf,
59
59
  commandTransition,
60
60
  traits,
61
61
  }
@@ -180,7 +180,7 @@ let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, [
180
180
  "RecordDeliveryFailure"
181
181
  ]);
182
182
 
183
- function commandAuthorization(param) {
183
+ function authorizationOf(param) {
184
184
  return "AllowAuthenticated";
185
185
  }
186
186
 
@@ -208,7 +208,7 @@ export {
208
208
  traits,
209
209
  commandSchema$1 as commandSchema,
210
210
  moduleUrl,
211
- commandAuthorization,
211
+ authorizationOf,
212
212
  readConsistency,
213
213
  commandTransition,
214
214
  }
@@ -50,7 +50,7 @@ let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, [
50
50
  "ReleaseNotificationSource"
51
51
  ]);
52
52
 
53
- function commandAuthorization(param) {
53
+ function authorizationOf(param) {
54
54
  return "AllowAuthenticated";
55
55
  }
56
56
 
@@ -75,7 +75,7 @@ export {
75
75
  traits,
76
76
  commandSchema$1 as commandSchema,
77
77
  moduleUrl,
78
- commandAuthorization,
78
+ authorizationOf,
79
79
  readConsistency,
80
80
  commandTransition,
81
81
  }
@@ -13,7 +13,7 @@ let commandSchema = Sury.$schema(s => ({
13
13
  orderId: s.m(DcbTag$Reventless.mark(OrderId$OrderingPlugin.schema))
14
14
  }));
15
15
 
16
- function commandAuthorization(param) {
16
+ function authorizationOf(param) {
17
17
  return "AllowAuthenticated";
18
18
  }
19
19
 
@@ -44,7 +44,7 @@ export {
44
44
  heartbeatInterval,
45
45
  targetName,
46
46
  moduleUrl,
47
- commandAuthorization,
47
+ authorizationOf,
48
48
  commandTransition,
49
49
  traits,
50
50
  }
@@ -65,7 +65,7 @@ function commandTransition(command) {
65
65
 
66
66
  let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, ["ReopenOrder"]);
67
67
 
68
- function commandAuthorization(param) {
68
+ function authorizationOf(param) {
69
69
  return "AllowAuthenticated";
70
70
  }
71
71
 
@@ -88,7 +88,7 @@ export {
88
88
  commandTransition,
89
89
  commandSchema$1 as commandSchema,
90
90
  moduleUrl,
91
- commandAuthorization,
91
+ authorizationOf,
92
92
  readConsistency,
93
93
  traits,
94
94
  }
@@ -109,7 +109,7 @@ let eventSchema = Sury.$schema(s => ({
109
109
  firstProductImage: s.m(Sury.$option(UploadableImage$Reventless.forField("Catalog", "productImages")))
110
110
  }));
111
111
 
112
- function commandAuthorization(param) {
112
+ function authorizationOf(param) {
113
113
  return "AllowAuthenticated";
114
114
  }
115
115
 
@@ -138,7 +138,7 @@ export {
138
138
  orderLineSchema,
139
139
  eventSchema,
140
140
  moduleUrl,
141
- commandAuthorization,
141
+ authorizationOf,
142
142
  readConsistency,
143
143
  commandTransition,
144
144
  traits,
@@ -41,14 +41,18 @@ function commandTransition(command) {
41
41
  };
42
42
  }
43
43
 
44
- function commandAuthorization(command) {
45
- return {
46
- TAG: "AllowRoles",
47
- _0: [
48
- "Admin",
49
- "Fulfilment"
50
- ]
51
- };
44
+ function authorizationOf(name) {
45
+ if (name === "ShipOrder") {
46
+ return {
47
+ TAG: "AllowRoles",
48
+ _0: [
49
+ "Admin",
50
+ "Fulfilment"
51
+ ]
52
+ };
53
+ } else {
54
+ return "AllowAuthenticated";
55
+ }
52
56
  }
53
57
 
54
58
  let traits = [];
@@ -70,7 +74,7 @@ export {
70
74
  eventSchema,
71
75
  commandTransition,
72
76
  moduleUrl,
73
- commandAuthorization,
77
+ authorizationOf,
74
78
  readConsistency,
75
79
  traits,
76
80
  }
@@ -110,7 +110,7 @@ function Make(Platform) {
110
110
  errorSchema: CancelOrder$OrderingPlugin.errorSchema,
111
111
  eventSchema: CancelOrder$OrderingPlugin.eventSchema,
112
112
  commandSchema: CancelOrder$OrderingPlugin.commandSchema,
113
- commandAuthorization: CancelOrder$OrderingPlugin.commandAuthorization,
113
+ authorizationOf: CancelOrder$OrderingPlugin.authorizationOf,
114
114
  commandTransition: CancelOrder$OrderingPlugin.commandTransition,
115
115
  traits: CancelOrder$OrderingPlugin.traits,
116
116
  readConsistency: CancelOrder$OrderingPlugin.readConsistency
@@ -127,7 +127,7 @@ function Make(Platform) {
127
127
  errorSchema: EmailVerificationChallenges$OrderingPlugin.errorSchema,
128
128
  eventSchema: EmailVerificationChallenges$OrderingPlugin.eventSchema,
129
129
  commandSchema: EmailVerificationChallenges$OrderingPlugin.commandSchema,
130
- commandAuthorization: EmailVerificationChallenges$OrderingPlugin.commandAuthorization,
130
+ authorizationOf: EmailVerificationChallenges$OrderingPlugin.authorizationOf,
131
131
  commandTransition: EmailVerificationChallenges$OrderingPlugin.commandTransition,
132
132
  traits: EmailVerificationChallenges$OrderingPlugin.traits,
133
133
  readConsistency: EmailVerificationChallenges$OrderingPlugin.readConsistency
@@ -144,7 +144,7 @@ function Make(Platform) {
144
144
  errorSchema: NotificationPreferences$OrderingPlugin.errorSchema,
145
145
  eventSchema: NotificationPreferences$OrderingPlugin.eventSchema,
146
146
  commandSchema: NotificationPreferences$OrderingPlugin.commandSchema,
147
- commandAuthorization: NotificationPreferences$OrderingPlugin.commandAuthorization,
147
+ authorizationOf: NotificationPreferences$OrderingPlugin.authorizationOf,
148
148
  commandTransition: NotificationPreferences$OrderingPlugin.commandTransition,
149
149
  traits: NotificationPreferences$OrderingPlugin.traits,
150
150
  readConsistency: NotificationPreferences$OrderingPlugin.readConsistency
@@ -161,7 +161,7 @@ function Make(Platform) {
161
161
  errorSchema: NotificationSourceClaims$OrderingPlugin.errorSchema,
162
162
  eventSchema: NotificationSourceClaims$OrderingPlugin.eventSchema,
163
163
  commandSchema: NotificationSourceClaims$OrderingPlugin.commandSchema,
164
- commandAuthorization: NotificationSourceClaims$OrderingPlugin.commandAuthorization,
164
+ authorizationOf: NotificationSourceClaims$OrderingPlugin.authorizationOf,
165
165
  commandTransition: NotificationSourceClaims$OrderingPlugin.commandTransition,
166
166
  traits: NotificationSourceClaims$OrderingPlugin.traits,
167
167
  readConsistency: NotificationSourceClaims$OrderingPlugin.readConsistency
@@ -178,7 +178,7 @@ function Make(Platform) {
178
178
  errorSchema: PlaceOrder$OrderingPlugin.errorSchema,
179
179
  eventSchema: PlaceOrder$OrderingPlugin.eventSchema,
180
180
  commandSchema: PlaceOrder$OrderingPlugin.commandSchema,
181
- commandAuthorization: PlaceOrder$OrderingPlugin.commandAuthorization,
181
+ authorizationOf: PlaceOrder$OrderingPlugin.authorizationOf,
182
182
  commandTransition: PlaceOrder$OrderingPlugin.commandTransition,
183
183
  traits: PlaceOrder$OrderingPlugin.traits,
184
184
  readConsistency: PlaceOrder$OrderingPlugin.readConsistency
@@ -195,7 +195,7 @@ function Make(Platform) {
195
195
  errorSchema: ShipOrder$OrderingPlugin.errorSchema,
196
196
  eventSchema: ShipOrder$OrderingPlugin.eventSchema,
197
197
  commandSchema: ShipOrder$OrderingPlugin.commandSchema,
198
- commandAuthorization: ShipOrder$OrderingPlugin.commandAuthorization,
198
+ authorizationOf: ShipOrder$OrderingPlugin.authorizationOf,
199
199
  commandTransition: ShipOrder$OrderingPlugin.commandTransition,
200
200
  traits: ShipOrder$OrderingPlugin.traits,
201
201
  readConsistency: ShipOrder$OrderingPlugin.readConsistency
@@ -212,7 +212,7 @@ function Make(Platform) {
212
212
  errorSchema: SyncCatalogProduct$OrderingPlugin.errorSchema,
213
213
  eventSchema: SyncCatalogProduct$OrderingPlugin.eventSchema,
214
214
  commandSchema: SyncCatalogProduct$OrderingPlugin.commandSchema,
215
- commandAuthorization: SyncCatalogProduct$OrderingPlugin.commandAuthorization,
215
+ authorizationOf: SyncCatalogProduct$OrderingPlugin.authorizationOf,
216
216
  commandTransition: SyncCatalogProduct$OrderingPlugin.commandTransition,
217
217
  traits: SyncCatalogProduct$OrderingPlugin.traits,
218
218
  readConsistency: SyncCatalogProduct$OrderingPlugin.readConsistency
@@ -401,7 +401,7 @@ function Make(Platform) {
401
401
  errorSchema: Customer$OrderingPlugin.errorSchema,
402
402
  commandSchema: Customer$OrderingPlugin.commandSchema,
403
403
  moduleUrl: Customer$OrderingPlugin.moduleUrl,
404
- commandAuthorization: Customer$OrderingPlugin.commandAuthorization,
404
+ authorizationOf: Customer$OrderingPlugin.authorizationOf,
405
405
  commandTransition: Customer$OrderingPlugin.commandTransition,
406
406
  traits: Customer$OrderingPlugin.traits
407
407
  })({
@@ -443,7 +443,7 @@ function Make(Platform) {
443
443
  errorSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.errorSchema,
444
444
  commandSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandSchema,
445
445
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.moduleUrl,
446
- commandAuthorization: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandAuthorization,
446
+ authorizationOf: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.authorizationOf,
447
447
  commandTransition: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandTransition,
448
448
  traits: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.traits
449
449
  },
@@ -468,7 +468,7 @@ function Make(Platform) {
468
468
  errorSchema: SyncCatalogProduct$OrderingPlugin.errorSchema,
469
469
  commandSchema: SyncCatalogProduct$OrderingPlugin.commandSchema,
470
470
  moduleUrl: SyncCatalogProduct$OrderingPlugin.moduleUrl,
471
- commandAuthorization: SyncCatalogProduct$OrderingPlugin.commandAuthorization,
471
+ authorizationOf: SyncCatalogProduct$OrderingPlugin.authorizationOf,
472
472
  commandTransition: SyncCatalogProduct$OrderingPlugin.commandTransition,
473
473
  traits: SyncCatalogProduct$OrderingPlugin.traits
474
474
  },
@@ -515,7 +515,7 @@ function Make(Platform) {
515
515
  errorSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.errorSchema,
516
516
  commandSchema: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandSchema,
517
517
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.moduleUrl,
518
- commandAuthorization: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandAuthorization,
518
+ authorizationOf: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.authorizationOf,
519
519
  commandTransition: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.commandTransition,
520
520
  traits: Orders_ExtensionPointMapping$OrderingPlugin.Delegate.traits
521
521
  },
@@ -11,7 +11,7 @@ let include = Behavior_GWT$ReventlessGwt.Make({
11
11
  commandSchema: SyncCatalogProduct$OrderingPlugin.commandSchema,
12
12
  errorSchema: SyncCatalogProduct$OrderingPlugin.errorSchema,
13
13
  eventSchema: SyncCatalogProduct$OrderingPlugin.eventSchema,
14
- commandAuthorization: SyncCatalogProduct$OrderingPlugin.commandAuthorization
14
+ authorizationOf: SyncCatalogProduct$OrderingPlugin.authorizationOf
15
15
  })({
16
16
  initialState: SyncCatalogProduct_Behavior$OrderingPlugin.initialState,
17
17
  evolve: SyncCatalogProduct_Behavior$OrderingPlugin.evolve,
@@ -148,7 +148,7 @@ let Conformance = AddressGeocoding_Conformance$TraitAddressGeocoding.Make({
148
148
  commandSchema: Customer$OrderingPlugin.commandSchema,
149
149
  eventSchema: Customer$OrderingPlugin.eventSchema,
150
150
  errorSchema: Customer$OrderingPlugin.errorSchema,
151
- commandAuthorization: Customer$OrderingPlugin.commandAuthorization
151
+ authorizationOf: Customer$OrderingPlugin.authorizationOf
152
152
  },
153
153
  Behavior: {
154
154
  Spec: {
@@ -156,7 +156,7 @@ let Conformance = AddressGeocoding_Conformance$TraitAddressGeocoding.Make({
156
156
  commandSchema: Customer$OrderingPlugin.commandSchema,
157
157
  eventSchema: Customer$OrderingPlugin.eventSchema,
158
158
  errorSchema: Customer$OrderingPlugin.errorSchema,
159
- commandAuthorization: Customer$OrderingPlugin.commandAuthorization
159
+ authorizationOf: Customer$OrderingPlugin.authorizationOf
160
160
  },
161
161
  initialState: Customer_Behavior$OrderingPlugin.initialState,
162
162
  evolve: Customer_Behavior$OrderingPlugin.evolve,
@@ -10,14 +10,14 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
10
10
  commandSchema: Customer$OrderingPlugin.commandSchema,
11
11
  eventSchema: Customer$OrderingPlugin.eventSchema,
12
12
  errorSchema: Customer$OrderingPlugin.errorSchema,
13
- commandAuthorization: Customer$OrderingPlugin.commandAuthorization
13
+ authorizationOf: Customer$OrderingPlugin.authorizationOf
14
14
  })({
15
15
  Spec: {
16
16
  name: Customer$OrderingPlugin.name,
17
17
  commandSchema: Customer$OrderingPlugin.commandSchema,
18
18
  eventSchema: Customer$OrderingPlugin.eventSchema,
19
19
  errorSchema: Customer$OrderingPlugin.errorSchema,
20
- commandAuthorization: Customer$OrderingPlugin.commandAuthorization
20
+ authorizationOf: Customer$OrderingPlugin.authorizationOf
21
21
  },
22
22
  initialState: Customer_Behavior$OrderingPlugin.initialState,
23
23
  evolve: Customer_Behavior$OrderingPlugin.evolve,
@@ -2,15 +2,9 @@
2
2
  // log, which is what makes `~sourceId` load-bearing: an aggregate's event payload
3
3
  // does not name its own subject.
4
4
  //
5
- // `OutboundTranslation_GWT.Make` expects a single SliceSpec with `collect` at the
6
- // top level, so compose it on locally. The graft rules — keying, outage-vs-verdict —
7
- // are asserted by the trait's suite in `AddressGeocodingConformance_GWT.res`; what
8
- // stays here is the host-specific wording of the answers.
9
-
10
- module GeocodeCustomerAddressSlice = {
11
- include GeocodeCustomerAddress
12
- let collect = GeocodeCustomerAddress_Translation.collect
13
- }
5
+ // The graft rules — keying, outage-vs-verdict — are asserted by the trait's suite
6
+ // in `AddressGeocodingConformance_GWT.res`; what stays here is the host-specific
7
+ // wording of the answers.
14
8
 
15
9
  @@reventless.gwt
16
10
 
@@ -18,20 +12,8 @@ open Ordering_Examples
18
12
 
19
13
  let vienna: Reventless.GeoPoint.t = {lat: 48.2082, lng: 16.3738}
20
14
 
21
- // The real `translate`, driven by a stub geocoder. `whenTranslateMocked` takes any
22
- // (id, item) => promise<translateResult>, so no DSL verb is needed to reach it.
23
- let withGeocoder = (
24
- answer: result<array<Reventless.Geocoding.candidate>, Reventless.Geocoding.failure>,
25
- ) => {
26
- // Spread `none` and override the one capability under test: a literal record
27
- // would have to name every other capability the framework grows, and this test
28
- // has nothing to say about them.
29
- let capabilities: Reventless.Capabilities.t = {
30
- ...Reventless.Capabilities.none,
31
- geocode: (~text as _) => Promise.resolve(answer),
32
- }
33
- (id, item) => GeocodeCustomerAddress_Translation.translate(id, item, ~capabilities)
34
- }
15
+ // The real `translate`, against a geocoder that answers `answer`.
16
+ let geocoder = answer => fakes(~geocode=async (~text as _) => answer, ())
35
17
 
36
18
  describe("GeocodeCustomerAddress OutboundTranslationSlice", () => {
37
19
  // scenario-id: 8b319e75-7826-4d3d-bd88-a43a197fb014
@@ -63,8 +45,8 @@ describe("GeocodeCustomerAddress OutboundTranslationSlice", () => {
63
45
  address: viennaAddress,
64
46
  },
65
47
  )
66
- ->whenTranslateMocked(
67
- withGeocoder(
48
+ ->givenCapabilities(
49
+ geocoder(
68
50
  Ok([
69
51
  {
70
52
  label: "Stephansplatz 1, Vienna",
@@ -74,6 +56,7 @@ describe("GeocodeCustomerAddress OutboundTranslationSlice", () => {
74
56
  ]),
75
57
  ),
76
58
  )
59
+ ->whenTranslated
77
60
  ->thenCommand("cust-1", SetLocation({location: vienna, resolvedFrom: viennaAddress}))
78
61
  )
79
62
 
@@ -82,8 +65,8 @@ describe("GeocodeCustomerAddress OutboundTranslationSlice", () => {
82
65
  // scenario-id: 93103dd6-1304-42b1-83f9-fd4ac4a90160
83
66
  test("translate: an ambiguous answer produces a reason naming the candidates", () =>
84
67
  givenTodo("cust-1:Springfield", {customerId: cust1, address: "Springfield"})
85
- ->whenTranslateMocked(
86
- withGeocoder(
68
+ ->givenCapabilities(
69
+ geocoder(
87
70
  Ok([
88
71
  {
89
72
  label: "Springfield, IL",
@@ -98,6 +81,7 @@ describe("GeocodeCustomerAddress OutboundTranslationSlice", () => {
98
81
  ]),
99
82
  ),
100
83
  )
84
+ ->whenTranslated
101
85
  ->thenCommand(
102
86
  "cust-1",
103
87
  MarkAddressUnresolvable({
@@ -106,4 +90,34 @@ describe("GeocodeCustomerAddress OutboundTranslationSlice", () => {
106
90
  }),
107
91
  )
108
92
  )
93
+
94
+ // The address is what is asked, as written.
95
+ test("translate: the geocoder is asked for the address as written", () =>
96
+ givenTodo("cust-1:Stephansplatz 1, Vienna", {customerId: cust1, address: viennaAddress})
97
+ ->givenCapabilities(geocoder(Ok([])))
98
+ ->whenTranslated
99
+ ->thenSent([Geocoded({text: viennaAddress})])
100
+ )
101
+
102
+ // An outage is not a verdict: the row stays open for the next sweep.
103
+ test("translate: a geocoder that is down leaves the row to be retried", () =>
104
+ givenTodo("cust-1:Stephansplatz 1, Vienna", {customerId: cust1, address: viennaAddress})
105
+ ->givenCapabilities(geocoder(Error(Unavailable("timeout"))))
106
+ ->whenTranslated
107
+ ->thenTodoStatus("cust-1:Stephansplatz 1, Vienna", #Failed)
108
+ )
109
+
110
+ // The budget ran out with the geocoder never answering: the verdict is recorded
111
+ // rather than leaving the row pending forever.
112
+ test("exhausted: the address is recorded as unresolvable", () =>
113
+ givenTodo("cust-1:Stephansplatz 1, Vienna", {customerId: cust1, address: viennaAddress})
114
+ ->whenExhausted(~lastError="timeout")
115
+ ->thenCommand(
116
+ "cust-1",
117
+ MarkAddressUnresolvable({
118
+ address: viennaAddress,
119
+ reason: GeocodeCustomerAddress_Translation.Geocode.exhaustedReason(Some("timeout")),
120
+ }),
121
+ )
122
+ )
109
123
  })