@reventlessdev/trait-attachments 1.0.0-alpha.1 → 1.0.0-alpha.3
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/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.3",
|
|
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-rc.2",
|
|
15
15
|
"sury-ppx": "11.0.0-rc.2",
|
|
16
|
-
"@reventlessdev/reventless-gwt": "1.0.0-alpha.
|
|
17
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.
|
|
16
|
+
"@reventlessdev/reventless-gwt": "1.0.0-alpha.201",
|
|
17
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.127"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"rescript": "12.3.0"
|
|
@@ -133,9 +133,9 @@ let refTypeOf = (c: config) => c.refType->Option.getOr("Reventless.UploadableIma
|
|
|
133
133
|
//
|
|
134
134
|
// The rule survives being emitted as an annotation because the PPX lowers it
|
|
135
135
|
// into a `switch` whose arms are ordinary expressions: `AllowGroupz` does not
|
|
136
|
-
// compile.
|
|
137
|
-
//
|
|
138
|
-
//
|
|
136
|
+
// compile. A stripped-before-the-typechecker attribute had no such second
|
|
137
|
+
// chance, which is why the states go out through `commandTransition` below,
|
|
138
|
+
// where the compiler resolves them.
|
|
139
139
|
let commandAttributes = (c: config): string =>
|
|
140
140
|
switch c.authorize {
|
|
141
141
|
| Some(a) => ` | @authorize(${a})\n `
|
|
@@ -146,8 +146,8 @@ let commandAttributes = (c: config): string =>
|
|
|
146
146
|
// slice is a file the trait writes.
|
|
147
147
|
//
|
|
148
148
|
// The states arrive as config either way; what changes is where they land. In
|
|
149
|
-
// `@transition([Products.Listed])` they
|
|
150
|
-
// matched as strings at
|
|
149
|
+
// the removed `@transition([Products.Listed])` they were stripped before the
|
|
150
|
+
// typechecker and matched as strings at assembly; in `Guards([Products.Listed])` they are
|
|
151
151
|
// constructor references the compiler resolves, so a config typo is a build
|
|
152
152
|
// error naming it. Same input, and the difference is only who checks it.
|
|
153
153
|
let commandTransitionBinding = (c: config): array<string> => {
|
|
@@ -210,10 +210,10 @@ let sliceSpec = (c: config): string => {
|
|
|
210
210
|
`@schema`,
|
|
211
211
|
`type consumedEvent =`,
|
|
212
212
|
createdArm,
|
|
213
|
-
` | ${n.attached}({ ${c.file}:
|
|
214
|
-
` | ${n.removed}({ ${c.file}:
|
|
215
|
-
` | ${n.primarySet}({ ${c.file}:
|
|
216
|
-
` | ${n.altTextSet}({ ${c.file}:
|
|
213
|
+
` | ${n.attached}({ ${c.file}: ${ref}})`,
|
|
214
|
+
` | ${n.removed}({ ${c.file}: ${ref}})`,
|
|
215
|
+
` | ${n.primarySet}({ ${c.file}: ${ref}})`,
|
|
216
|
+
` | ${n.altTextSet}({ ${c.file}: ${ref}, altText: string})`,
|
|
217
217
|
` // TODO(graft): add the events this host's own refusal turns on — whatever`,
|
|
218
218
|
` // moves it into a state where attachments may not be changed.`,
|
|
219
219
|
``,
|
|
@@ -395,8 +395,8 @@ let projectionPatch = (c: config): patch => {
|
|
|
395
395
|
`// The second is not redundancy: a card, a gallery tile and a reference cell`,
|
|
396
396
|
`// each read one image-semantic string per row, so without it every tile is blank.`,
|
|
397
397
|
`//`,
|
|
398
|
-
`// ${c.file}s: array<{${c.file}:
|
|
399
|
-
`// ${c.file}?:
|
|
398
|
+
`// ${c.file}s: array<{${c.file}: ${refTypeOf(c)}, altText?: string}>,`,
|
|
399
|
+
`// ${c.file}?: ${refTypeOf(c)},`,
|
|
400
400
|
``,
|
|
401
401
|
`| ${n.attached}({${c.entityId}, ${c.file}, altText: ?altText}) =>`,
|
|
402
402
|
` Update(${c.entityId}, state => {`,
|
|
@@ -112,10 +112,10 @@ function sliceSpec(c) {
|
|
|
112
112
|
`@schema`,
|
|
113
113
|
`type consumedEvent =`,
|
|
114
114
|
createdArm,
|
|
115
|
-
` | ` + n.attached + `({ ` + c.file + `:
|
|
116
|
-
` | ` + n.removed + `({ ` + c.file + `:
|
|
117
|
-
` | ` + n.primarySet + `({ ` + c.file + `:
|
|
118
|
-
` | ` + n.altTextSet + `({ ` + c.file + `:
|
|
115
|
+
` | ` + n.attached + `({ ` + c.file + `: ` + ref + `})`,
|
|
116
|
+
` | ` + n.removed + `({ ` + c.file + `: ` + ref + `})`,
|
|
117
|
+
` | ` + n.primarySet + `({ ` + c.file + `: ` + ref + `})`,
|
|
118
|
+
` | ` + n.altTextSet + `({ ` + c.file + `: ` + ref + `, altText: string})`,
|
|
119
119
|
` // TODO(graft): add the events this host's own refusal turns on — whatever`,
|
|
120
120
|
` // moves it into a state where attachments may not be changed.`,
|
|
121
121
|
``,
|
|
@@ -283,8 +283,8 @@ function projectionPatch(c) {
|
|
|
283
283
|
`// The second is not redundancy: a card, a gallery tile and a reference cell`,
|
|
284
284
|
`// each read one image-semantic string per row, so without it every tile is blank.`,
|
|
285
285
|
`//`,
|
|
286
|
-
`// ` + c.file + `s: array<{` + c.file + `:
|
|
287
|
-
`// ` + c.file + `?:
|
|
286
|
+
`// ` + c.file + `s: array<{` + c.file + `: ` + Stdlib_Option.getOr(c.refType, "Reventless.UploadableImage.t") + `, altText?: string}>,`,
|
|
287
|
+
`// ` + c.file + `?: ` + Stdlib_Option.getOr(c.refType, "Reventless.UploadableImage.t") + `,`,
|
|
288
288
|
``,
|
|
289
289
|
`| ` + n.attached + `({` + c.entityId + `, ` + c.file + `, altText: ?altText}) =>`,
|
|
290
290
|
` Update(` + c.entityId + `, state => {`,
|