@reventlessdev/trait-address-geocoding 1.0.0-alpha.50 → 1.0.0-alpha.51
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/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Most of this graft is not emitted at all. The four facts and the two `@noApi` re
|
|
|
19
19
|
commands are real constructors the host **splices** — `...AddressGeocoding.events` and
|
|
20
20
|
`...AddressGeocoding.reportCommands` — so the compiler carries them, annotations and
|
|
21
21
|
schema included. The emitter writes the outbound slice, which the host does not have
|
|
22
|
-
yet, and prints the arms that belong inside the aggregate, its
|
|
22
|
+
yet, and prints the arms that belong inside the aggregate, its decision and the
|
|
23
23
|
projection: those interleave with the host's own state machine, and placing an arm in
|
|
24
24
|
an ordered `switch` is an AST operation a text splice gets silently wrong.
|
|
25
25
|
|
|
@@ -54,7 +54,7 @@ pnpm exec graft-trait @reventlessdev/trait-address-geocoding \
|
|
|
54
54
|
the suite below needs no hand-written file — and prints three patches.
|
|
55
55
|
|
|
56
56
|
2. Paste the three patches. The aggregate's is two spread lines plus the arms for
|
|
57
|
-
`commandTransition`; the
|
|
57
|
+
`commandTransition`; the decision's is the state fields and the `evolve` / `decide`
|
|
58
58
|
arms; the projection's is the view's `geolocation` field and its arms.
|
|
59
59
|
|
|
60
60
|
Policy is yours and is not config. Which states an address may change in goes in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/trait-address-geocoding",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.51",
|
|
4
4
|
"description": "Address-geocoding domain trait: rules, host contract, conformance suite and emitter for grafting geocoding onto an aggregate",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"sury": "11.0.0",
|
|
15
15
|
"sury-ppx": "11.0.0",
|
|
16
|
-
"@reventlessdev/reventless-
|
|
17
|
-
"@reventlessdev/reventless-
|
|
18
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.
|
|
19
|
-
"@reventlessdev/reventless-
|
|
16
|
+
"@reventlessdev/reventless-gwt": "1.0.0-alpha.249",
|
|
17
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.198",
|
|
18
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.170",
|
|
19
|
+
"@reventlessdev/reventless-ppx": "1.0.0-alpha.103"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"rescript": "12.3.1"
|
package/src/AddressGeocoding.res
CHANGED
|
@@ -8,7 +8,7 @@ host by `AddressGeocoding_Conformance`; the confidence rule stays core's
|
|
|
8
8
|
*/
|
|
9
9
|
/** Whether the graft reports back into its host. This trait does — the two `@noApi`
|
|
10
10
|
commands — and the runner accepts nothing else yet; the flag is here so a
|
|
11
|
-
competency that only observes is not mis-
|
|
11
|
+
competency that only observes is not mis-modeled as one that writes. */
|
|
12
12
|
type posture = WritesBack | Observes
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -138,8 +138,8 @@ module type Binding = {
|
|
|
138
138
|
|
|
139
139
|
let posture: posture
|
|
140
140
|
|
|
141
|
-
module Spec: ReventlessGwt.
|
|
142
|
-
module
|
|
141
|
+
module Spec: ReventlessGwt.Decision_GWT.AggregateSpec
|
|
142
|
+
module Decision: Reventless.Decision.T with module Spec = Spec
|
|
143
143
|
|
|
144
144
|
/** History leaving the entity active at `subject` with nothing resolved. */
|
|
145
145
|
let created: subject => array<Spec.event>
|
|
@@ -9,7 +9,7 @@ module Outcome = ReventlessGwt.Outcome
|
|
|
9
9
|
let suiteName = (host: string) => `${host} conforms to the address-geocoding trait`
|
|
10
10
|
|
|
11
11
|
module Make = (B: AddressGeocoding.Binding) => {
|
|
12
|
-
module A = ReventlessGwt.
|
|
12
|
+
module A = ReventlessGwt.Decision_GWT.MakeFromAggregate(B.Spec, B.Decision)
|
|
13
13
|
module S = ReventlessGwt.OutboundTranslation_GWT.Make(B.Slice)
|
|
14
14
|
|
|
15
15
|
let vienna: Reventless.GeoPoint.t = {lat: 48.2082, lng: 16.3738}
|
|
@@ -6,7 +6,7 @@ import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Me
|
|
|
6
6
|
import * as DcbDecode$Reventless from "@reventlessdev/reventless-spec/src/components/DcbDecode.res.mjs";
|
|
7
7
|
import * as Outcome$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Outcome.res.mjs";
|
|
8
8
|
import * as Capabilities$Reventless from "@reventlessdev/reventless-spec/src/semantic/Capabilities.res.mjs";
|
|
9
|
-
import * as
|
|
9
|
+
import * as Decision_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Decision_GWT.res.mjs";
|
|
10
10
|
import * as OutboundTranslation_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/OutboundTranslation_GWT.res.mjs";
|
|
11
11
|
|
|
12
12
|
function suiteName(host) {
|
|
@@ -14,7 +14,7 @@ function suiteName(host) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function Make(B) {
|
|
17
|
-
let A =
|
|
17
|
+
let A = Decision_GWT$ReventlessGwt.MakeFromAggregate(B.Spec)(B.Decision);
|
|
18
18
|
let S = OutboundTranslation_GWT$ReventlessGwt.Make(B.Slice);
|
|
19
19
|
let vienna = {
|
|
20
20
|
lat: 48.2082,
|
|
@@ -290,7 +290,7 @@ let conformanceBinding = (c: config): string => {
|
|
|
290
290
|
` let posture = TraitAddressGeocoding.AddressGeocoding.WritesBack`,
|
|
291
291
|
``,
|
|
292
292
|
` module Spec = ${c.entity}`,
|
|
293
|
-
` module
|
|
293
|
+
` module Decision = ${c.entity}_Decision`,
|
|
294
294
|
``,
|
|
295
295
|
` let created = ${n.subject} => [${c.entity}.${createdValue}]`,
|
|
296
296
|
` let subjectChanged = ${n.subject} => ${c.entity}.${n.updated}({${n.subject}: ${n.subject}})`,
|
|
@@ -432,12 +432,12 @@ let aggregatePatch = (c: config): patch => {
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
// ── The aggregate
|
|
435
|
+
// ── The aggregate decision patch ─────────────────────────────────────────────
|
|
436
436
|
|
|
437
|
-
let
|
|
437
|
+
let decisionPatch = (c: config): patch => {
|
|
438
438
|
let n = namesOf(c)
|
|
439
439
|
{
|
|
440
|
-
into: `Aggregate/${c.entity}
|
|
440
|
+
into: `Aggregate/${c.entity}_Decision.res`,
|
|
441
441
|
at: `the state's fields, the \`evolve\` and \`decide\` switches, and two helpers`,
|
|
442
442
|
contents: lines([
|
|
443
443
|
`module Guards = TraitAddressGeocoding.AddressGeocoding_Guards`,
|
|
@@ -587,6 +587,6 @@ let emit = (~config: config, ~into: string, ~tests: string): output => {
|
|
|
587
587
|
contents: conformanceBinding(config),
|
|
588
588
|
},
|
|
589
589
|
],
|
|
590
|
-
patches: [aggregatePatch(config),
|
|
590
|
+
patches: [aggregatePatch(config), decisionPatch(config), projectionPatch(config)],
|
|
591
591
|
}
|
|
592
592
|
}
|
|
@@ -168,7 +168,7 @@ function conformanceBinding(c) {
|
|
|
168
168
|
` let posture = TraitAddressGeocoding.AddressGeocoding.WritesBack`,
|
|
169
169
|
``,
|
|
170
170
|
` module Spec = ` + c.entity,
|
|
171
|
-
` module
|
|
171
|
+
` module Decision = ` + c.entity + `_Decision`,
|
|
172
172
|
``,
|
|
173
173
|
` let created = ` + n.subject + ` => [` + c.entity + `.` + createdValue + `]`,
|
|
174
174
|
` let subjectChanged = ` + n.subject + ` => ` + c.entity + `.` + n.updated + `({` + n.subject + `: ` + n.subject + `})`,
|
|
@@ -284,10 +284,10 @@ function aggregatePatch(c) {
|
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
function
|
|
287
|
+
function decisionPatch(c) {
|
|
288
288
|
let n = namesOf(c);
|
|
289
289
|
return {
|
|
290
|
-
into: `Aggregate/` + c.entity + `
|
|
290
|
+
into: `Aggregate/` + c.entity + `_Decision.res`,
|
|
291
291
|
at: `the state's fields, the \`evolve\` and \`decide\` switches, and two helpers`,
|
|
292
292
|
contents: [
|
|
293
293
|
`module Guards = TraitAddressGeocoding.AddressGeocoding_Guards`,
|
|
@@ -427,7 +427,7 @@ function emit(config, into, tests) {
|
|
|
427
427
|
],
|
|
428
428
|
patches: [
|
|
429
429
|
aggregatePatch(config),
|
|
430
|
-
|
|
430
|
+
decisionPatch(config),
|
|
431
431
|
projectionPatch(config)
|
|
432
432
|
]
|
|
433
433
|
};
|
|
@@ -444,7 +444,7 @@ export {
|
|
|
444
444
|
conformanceBinding,
|
|
445
445
|
transitionArms,
|
|
446
446
|
aggregatePatch,
|
|
447
|
-
|
|
447
|
+
decisionPatch,
|
|
448
448
|
projectionPatch,
|
|
449
449
|
emit,
|
|
450
450
|
}
|