@reventlessdev/trait-attachments 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 +1 -1
- package/package.json +3 -3
- package/src/Attachments.res +4 -4
- package/src/Attachments_Conformance.res +2 -2
- package/src/Attachments_Conformance.res.mjs +6 -6
- package/src/Attachments_Rules.res +1 -1
- package/src/Attachments_Scaffold.res +5 -5
- package/src/Attachments_Scaffold.res.mjs +6 -6
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ the types are the host's own:
|
|
|
15
15
|
behavior change for every host: version it `fix:`/`feat:` accordingly.
|
|
16
16
|
|
|
17
17
|
The graft *is* a StateChangeSlice, so the emitter writes nearly all of it: the slice
|
|
18
|
-
spec, its
|
|
18
|
+
spec, its decision and the conformance binding, whole. Only the view's projection is
|
|
19
19
|
printed as a patch — the view already exists, and placing an arm in an ordered `switch`
|
|
20
20
|
is an AST operation a text splice gets silently wrong.
|
|
21
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/trait-attachments",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.51",
|
|
4
4
|
"description": "Attachments domain trait: rules, host contract, conformance suite and emitter for an ordered set of stored files on an entity, with a primary and captions",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"sury": "11.0.0",
|
|
15
15
|
"sury-ppx": "11.0.0",
|
|
16
|
-
"@reventlessdev/reventless-gwt": "1.0.0-alpha.
|
|
17
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.
|
|
16
|
+
"@reventlessdev/reventless-gwt": "1.0.0-alpha.249",
|
|
17
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.170"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"rescript": "12.3.1"
|
package/src/Attachments.res
CHANGED
|
@@ -39,8 +39,8 @@ module type Binding = {
|
|
|
39
39
|
let refA: ref
|
|
40
40
|
let refB: ref
|
|
41
41
|
|
|
42
|
-
module Spec: ReventlessGwt.
|
|
43
|
-
module
|
|
42
|
+
module Spec: ReventlessGwt.Decision_GWT.DecisionSpec
|
|
43
|
+
module Decision: ReventlessGwt.Decision_GWT.Decision with module Spec = Spec
|
|
44
44
|
|
|
45
45
|
/** The same facts as the slice **consumes** them, for building history.
|
|
46
46
|
|
|
@@ -103,8 +103,8 @@ module type SingleBinding = {
|
|
|
103
103
|
let refA: ref
|
|
104
104
|
let refB: ref
|
|
105
105
|
|
|
106
|
-
module Spec: ReventlessGwt.
|
|
107
|
-
module
|
|
106
|
+
module Spec: ReventlessGwt.Decision_GWT.DecisionSpec
|
|
107
|
+
module Decision: ReventlessGwt.Decision_GWT.Decision with module Spec = Spec
|
|
108
108
|
|
|
109
109
|
/** The facts as the slice **consumes** them — see `Binding.Consumed`. No
|
|
110
110
|
`primarySet`: at this cardinality nothing emits one. */
|
|
@@ -14,7 +14,7 @@ inside a Jest test file registers one `describe` block over the binding.
|
|
|
14
14
|
let suiteName = (host: string) => `${host} conforms to the attachments trait`
|
|
15
15
|
|
|
16
16
|
module Make = (B: Attachments.Binding) => {
|
|
17
|
-
module G = ReventlessGwt.
|
|
17
|
+
module G = ReventlessGwt.Decision_GWT.Make(B.Spec, B.Decision)
|
|
18
18
|
|
|
19
19
|
let withA = Array.concat(B.Consumed.created, [B.Consumed.attached(B.refA)])
|
|
20
20
|
let withAB = Array.concat(withA, [B.Consumed.attached(B.refB)])
|
|
@@ -132,7 +132,7 @@ replaces rather than joins — plus the ref-less remove and the captions, which
|
|
|
132
132
|
single image wants exactly as much as a gallery member does.
|
|
133
133
|
*/
|
|
134
134
|
module MakeSingle = (B: Attachments.SingleBinding) => {
|
|
135
|
-
module G = ReventlessGwt.
|
|
135
|
+
module G = ReventlessGwt.Decision_GWT.Make(B.Spec, B.Decision)
|
|
136
136
|
|
|
137
137
|
let withA = Array.concat(B.Consumed.created, [B.Consumed.attached(B.refA)])
|
|
138
138
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as Decision_GWT$ReventlessGwt from "@reventlessdev/reventless-gwt/src/Decision_GWT.res.mjs";
|
|
5
5
|
|
|
6
6
|
function suiteName(host) {
|
|
7
7
|
return host + ` conforms to the attachments trait`;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
function Make(B) {
|
|
11
|
-
let $$let = B.
|
|
12
|
-
let G =
|
|
11
|
+
let $$let = B.Decision;
|
|
12
|
+
let G = Decision_GWT$ReventlessGwt.Make(B.Spec)({
|
|
13
13
|
initialState: $$let.initialState,
|
|
14
14
|
evolve: $$let.evolve,
|
|
15
15
|
decide: $$let.decide
|
|
@@ -64,8 +64,8 @@ function Make(B) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function MakeSingle(B) {
|
|
67
|
-
let $$let = B.
|
|
68
|
-
let G =
|
|
67
|
+
let $$let = B.Decision;
|
|
68
|
+
let G = Decision_GWT$ReventlessGwt.Make(B.Spec)({
|
|
69
69
|
initialState: $$let.initialState,
|
|
70
70
|
evolve: $$let.evolve,
|
|
71
71
|
decide: $$let.decide
|
|
@@ -115,4 +115,4 @@ export {
|
|
|
115
115
|
Make,
|
|
116
116
|
MakeSingle,
|
|
117
117
|
}
|
|
118
|
-
/*
|
|
118
|
+
/* Decision_GWT-ReventlessGwt Not a pure module */
|
|
@@ -22,7 +22,7 @@ How many members a host's set may hold.
|
|
|
22
22
|
Not a runtime variation: a graft fixes this once, and every command the graft
|
|
23
23
|
emits is shaped by the answer. It reaches `decide` as an argument rather than
|
|
24
24
|
sitting on `t` so that `empty` stays one value and a host that never mentions
|
|
25
|
-
cardinality gets the
|
|
25
|
+
cardinality gets the behavior it has today.
|
|
26
26
|
|
|
27
27
|
Exactly one rule reads it — `Attach` — and that is the whole of the difference:
|
|
28
28
|
a bounded set replaces its member where an unbounded one appends beside it.
|
|
@@ -423,12 +423,12 @@ let sliceSpec = (c: config): string => {
|
|
|
423
423
|
|
|
424
424
|
// ── The slice body ───────────────────────────────────────────────────────────
|
|
425
425
|
|
|
426
|
-
let
|
|
426
|
+
let sliceDecision = (c: config): string => {
|
|
427
427
|
let n = namesOf(c)
|
|
428
428
|
let single = isSingle(c)
|
|
429
429
|
lines(
|
|
430
430
|
[
|
|
431
|
-
`@@reventless.
|
|
431
|
+
`@@reventless.decision`,
|
|
432
432
|
``,
|
|
433
433
|
`// The set's rules are the trait's. What is left here is this host's own refusal`,
|
|
434
434
|
`// and the mapping between its constructors and the trait's ops and facts.`,
|
|
@@ -575,7 +575,7 @@ let conformanceBinding = (c: config): string => {
|
|
|
575
575
|
` let refB = "${refB}"`,
|
|
576
576
|
``,
|
|
577
577
|
` module Spec = ${n.slice}`,
|
|
578
|
-
` module
|
|
578
|
+
` module Decision = ${n.slice}_Decision`,
|
|
579
579
|
``,
|
|
580
580
|
` // Annotated: the slice consumes and emits same-named constructors.`,
|
|
581
581
|
` // The same facts as the slice consumes them: no ${c.entityId}, because the`,
|
|
@@ -788,8 +788,8 @@ let emit = (~config: config, ~into: string, ~tests: string): output => {
|
|
|
788
788
|
files: [
|
|
789
789
|
{path: `${into}/StateChange/${n.slice}.res`, contents: sliceSpec(config)},
|
|
790
790
|
{
|
|
791
|
-
path: `${into}/StateChange/${n.slice}
|
|
792
|
-
contents:
|
|
791
|
+
path: `${into}/StateChange/${n.slice}_Decision.res`,
|
|
792
|
+
contents: sliceDecision(config),
|
|
793
793
|
},
|
|
794
794
|
{
|
|
795
795
|
path: `${tests}/${n.slice}Conformance_GWT.res`,
|
|
@@ -268,12 +268,12 @@ function sliceSpec(c) {
|
|
|
268
268
|
]).join("\n");
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
function
|
|
271
|
+
function sliceDecision(c) {
|
|
272
272
|
let n = namesOf(c);
|
|
273
273
|
let single = Stdlib_Option.getOr(c.cardinality, "Many") === "Single";
|
|
274
274
|
return Belt_Array.concatMany([
|
|
275
275
|
[
|
|
276
|
-
`@@reventless.
|
|
276
|
+
`@@reventless.decision`,
|
|
277
277
|
``,
|
|
278
278
|
`// The set's rules are the trait's. What is left here is this host's own refusal`,
|
|
279
279
|
`// and the mapping between its constructors and the trait's ops and facts.`,
|
|
@@ -397,7 +397,7 @@ function conformanceBinding(c) {
|
|
|
397
397
|
` let refB = "` + refB + `"`,
|
|
398
398
|
``,
|
|
399
399
|
` module Spec = ` + n.slice,
|
|
400
|
-
` module
|
|
400
|
+
` module Decision = ` + n.slice + `_Decision`,
|
|
401
401
|
``,
|
|
402
402
|
` // Annotated: the slice consumes and emits same-named constructors.`,
|
|
403
403
|
` // The same facts as the slice consumes them: no ` + c.entityId + `, because the`,
|
|
@@ -564,8 +564,8 @@ function emit(config, into, tests) {
|
|
|
564
564
|
contents: sliceSpec(config)
|
|
565
565
|
},
|
|
566
566
|
{
|
|
567
|
-
path: into + `/StateChange/` + n.slice + `
|
|
568
|
-
contents:
|
|
567
|
+
path: into + `/StateChange/` + n.slice + `_Decision.res`,
|
|
568
|
+
contents: sliceDecision(config)
|
|
569
569
|
},
|
|
570
570
|
{
|
|
571
571
|
path: tests + `/` + n.slice + `Conformance_GWT.res`,
|
|
@@ -594,7 +594,7 @@ export {
|
|
|
594
594
|
commandTransitionBinding,
|
|
595
595
|
lines,
|
|
596
596
|
sliceSpec,
|
|
597
|
-
|
|
597
|
+
sliceDecision,
|
|
598
598
|
conformanceBinding,
|
|
599
599
|
singleProjectionPatch,
|
|
600
600
|
manyProjectionPatch,
|