@reventlessdev/reventless-core 3.0.0-alpha.307 → 3.0.0-alpha.309

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 (74) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/package.json +7 -7
  3. package/src/Projection.res +4 -4
  4. package/src/Projection.res.mjs +11 -9
  5. package/src/ResourceAttribution.res +3 -3
  6. package/src/ResourceAttribution.res.mjs +1 -4
  7. package/src/adapter/Auth/Auth_ActiveRole.res +13 -18
  8. package/src/adapter/Auth/Auth_ActiveRole.res.mjs +4 -9
  9. package/src/adapter/EventLogProvisioning/EventLogProvisioning.res +1 -1
  10. package/src/adapter/Monitoring/Monitoring.res +5 -5
  11. package/src/adapter/Stash/Stash_Memory_Backend.res +35 -0
  12. package/src/adapter/Stash/Stash_Memory_Backend.res.mjs +44 -0
  13. package/src/adapter/Throttle/AnonymousLimiter.res +37 -0
  14. package/src/adapter/Throttle/AnonymousLimiter.res.mjs +43 -0
  15. package/src/admin/Platform_Admin.res +2 -2
  16. package/src/admin/Platform_Admin_Structure.res +0 -9
  17. package/src/admin/Platform_Admin_Structure.res.mjs +3 -12
  18. package/src/admin/Platform_BakedManifest.res +6 -6
  19. package/src/admin/Platform_BakedManifest.res.mjs +11 -26
  20. package/src/admin/Platform_PluginStructuresApi.res +36 -2
  21. package/src/admin/Platform_PluginStructuresApi.res.mjs +43 -1
  22. package/src/admin/Platform_SelfRegistration.res +79 -0
  23. package/src/admin/Platform_SelfRegistration.res.mjs +95 -0
  24. package/src/components/Api/GraphQL_SchemaInspector.res +3 -3
  25. package/src/components/Api/SuryToJsonSchema.res +3 -3
  26. package/src/components/Dcb/Dcb_Builder.res +6 -9
  27. package/src/components/Dcb/Dcb_Builder.res.mjs +0 -3
  28. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +14 -1
  29. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res.mjs +3 -3
  30. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +73 -8
  31. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +60 -12
  32. package/src/plugin/component/Plugin.res +2 -0
  33. package/src/plugin/component/Plugin_Builder.res +9 -8
  34. package/src/plugin/component/Plugin_Builder.res.mjs +6 -10
  35. package/src/plugin/component/Plugin_Helpers.res +4 -4
  36. package/src/plugin/component/Plugin_Structure.res +179 -115
  37. package/src/plugin/component/Plugin_Structure.res.mjs +83 -17
  38. package/src/plugin/lifecycle/PluginsProjection.res +10 -6
  39. package/src/plugin/lifecycle/PluginsReadModelSpec.res +8 -8
  40. package/src/util/FTPHandler.res +3 -3
  41. package/src/util/ScheduleTime.res +5 -8
  42. package/src/util/ScheduleTime.res.mjs +0 -3
  43. package/src/util/Util_Promise.res +1 -1
  44. package/tests/AnonymousLimiterTest.res +66 -0
  45. package/tests/AnonymousLimiterTest.res.mjs +89 -0
  46. package/tests/ResourceAttributionTest.res +1 -1
  47. package/tests/ResourceAttributionTest.res.mjs +1 -4
  48. package/tests/Stash_Memory_BackendTest.res +63 -0
  49. package/tests/Stash_Memory_BackendTest.res.mjs +98 -0
  50. package/tests/admin/AdminApiSchemaDriftTest.res +72 -44
  51. package/tests/admin/AdminApiSchemaDriftTest.res.mjs +41 -3
  52. package/tests/admin/Platform_Admin_StructureTest.res +1 -1
  53. package/tests/admin/Platform_Admin_StructureTest.res.mjs +4 -22
  54. package/tests/admin/Platform_BakedManifestTest.res +11 -29
  55. package/tests/admin/Platform_BakedManifestTest.res.mjs +8 -39
  56. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +24 -84
  57. package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +36 -169
  58. package/tests/admin/Platform_PluginStructuresApiTest.res +46 -31
  59. package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +37 -34
  60. package/tests/admin/Platform_SelfRegistrationTest.res +91 -0
  61. package/tests/admin/Platform_SelfRegistrationTest.res.mjs +112 -0
  62. package/tests/admin/Platform_UIFragmentsApiTest.res +1 -4
  63. package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +1 -4
  64. package/tests/api/GeocodingTest.res +1 -1
  65. package/tests/logger/LogFormatTest.res +0 -2
  66. package/tests/logger/LogFormatTest.res.mjs +0 -2
  67. package/tests/message/MessageTest.res +0 -13
  68. package/tests/message/MessageTest.res.mjs +2 -15
  69. package/tests/plugin/ManifestVisibilityTest.res.mjs +1 -1
  70. package/tests/plugin/PluginStructureAccessTest.res +6 -1
  71. package/tests/plugin/PluginStructureAccessTest.res.mjs +9 -5
  72. package/tests/plugin/PluginStructureTest.res +99 -23
  73. package/tests/plugin/PluginStructureTest.res.mjs +123 -79
  74. package/tests/plugin/pluginDefinitionRequiredScalars.txt +10 -0
@@ -0,0 +1,98 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Capabilities$Reventless from "@reventlessdev/reventless-spec/src/semantic/Capabilities.res.mjs";
4
+ import * as Stash_Memory_Backend$ReventlessCore from "../src/adapter/Stash/Stash_Memory_Backend.res.mjs";
5
+
6
+ function clock() {
7
+ let at = {
8
+ contents: 1000000
9
+ };
10
+ return [
11
+ () => at.contents,
12
+ seconds => {
13
+ at.contents = at.contents + seconds * 1000;
14
+ }
15
+ ];
16
+ }
17
+
18
+ globalThis.describe("Stash_Memory_Backend", () => {
19
+ globalThis.test("hands a value over once", async () => {
20
+ let match = clock();
21
+ let stash = Stash_Memory_Backend$ReventlessCore.make(match[0]);
22
+ globalThis.expect(await stash.put("k", "secret", 60)).toEqual({
23
+ TAG: "Ok",
24
+ _0: undefined
25
+ });
26
+ globalThis.expect(await stash.take("k")).toEqual({
27
+ TAG: "Ok",
28
+ _0: "secret"
29
+ });
30
+ globalThis.expect(await stash.take("k")).toEqual({
31
+ TAG: "Ok",
32
+ _0: undefined
33
+ });
34
+ });
35
+ globalThis.test("a value past its time is gone", async () => {
36
+ let match = clock();
37
+ let stash = Stash_Memory_Backend$ReventlessCore.make(match[0]);
38
+ await stash.put("k", "secret", 60);
39
+ match[1](61);
40
+ globalThis.expect(await stash.take("k")).toEqual({
41
+ TAG: "Ok",
42
+ _0: undefined
43
+ });
44
+ });
45
+ globalThis.test("a value within its time is still there", async () => {
46
+ let match = clock();
47
+ let stash = Stash_Memory_Backend$ReventlessCore.make(match[0]);
48
+ await stash.put("k", "secret", 60);
49
+ match[1](59);
50
+ globalThis.expect(await stash.take("k")).toEqual({
51
+ TAG: "Ok",
52
+ _0: "secret"
53
+ });
54
+ });
55
+ globalThis.test("a second put under one key replaces the first", async () => {
56
+ let match = clock();
57
+ let stash = Stash_Memory_Backend$ReventlessCore.make(match[0]);
58
+ await stash.put("k", "first", 60);
59
+ await stash.put("k", "second", 60);
60
+ globalThis.expect(await stash.take("k")).toEqual({
61
+ TAG: "Ok",
62
+ _0: "second"
63
+ });
64
+ });
65
+ globalThis.test("two stashes share nothing", async () => {
66
+ let match = clock();
67
+ let now = match[0];
68
+ let a = Stash_Memory_Backend$ReventlessCore.make(now);
69
+ let b = Stash_Memory_Backend$ReventlessCore.make(now);
70
+ await a.put("k", "secret", 60);
71
+ globalThis.expect(await b.take("k")).toEqual({
72
+ TAG: "Ok",
73
+ _0: undefined
74
+ });
75
+ });
76
+ globalThis.test("a platform with none refuses both operations", async () => {
77
+ let none = Capabilities$Reventless.none.stash;
78
+ globalThis.expect(await none.put("k", "v", 60)).toEqual({
79
+ TAG: "Error",
80
+ _0: {
81
+ TAG: "Unavailable",
82
+ _0: "no stash is configured for this platform"
83
+ }
84
+ });
85
+ globalThis.expect(await none.take("k")).toEqual({
86
+ TAG: "Error",
87
+ _0: {
88
+ TAG: "Unavailable",
89
+ _0: "no stash is configured for this platform"
90
+ }
91
+ });
92
+ });
93
+ });
94
+
95
+ export {
96
+ clock,
97
+ }
98
+ /* Not a pure module */
@@ -59,22 +59,22 @@ let missing = (names: array<string>, from: array<string>): array<string> =>
59
59
  let fieldRef: fieldReference = {
60
60
  fieldName: "categoryId",
61
61
  entity: "Category",
62
- plugin: Some("Catalog"),
62
+ plugin: "Catalog",
63
63
  }
64
64
 
65
65
  let cmd: commandDef = {
66
66
  name: "Add",
67
67
  schema: "{}",
68
68
  level: Collection,
69
- aggregateIdField: Some("productId"),
69
+ aggregateIdField: "productId",
70
70
  mutationField: "Catalog_Product_Add",
71
71
  references: [fieldRef],
72
- allowedStates: Some(["Draft"]),
73
- targetState: Some("Active"),
72
+ allowedStates: ["Draft"],
73
+ targetState: "Active",
74
74
  allowedStatesSource: "declared",
75
- apiExposed: Some(true),
76
- requiredAccess: Some(["catalog.write"]),
77
- ownerField: Some("ownerId"),
75
+ apiExposed: true,
76
+ requiredAccess: ["catalog.write"],
77
+ ownerField: "ownerId",
78
78
  }
79
79
 
80
80
  let evt: eventDef = {name: "ProductAdded", schema: "{}", references: [fieldRef]}
@@ -86,10 +86,10 @@ let writeSide: writeSideDef = {
86
86
  producedEventTypes: ["ProductAdded"],
87
87
  consumedEventTypes: [],
88
88
  linkedViews: ["Products"],
89
- consistencyRead: Some("Products"),
89
+ consistencyRead: "Products",
90
90
  events: [evt],
91
91
  errors: [err],
92
- chapter: Some("Catalogue"),
92
+ chapter: "Catalogue",
93
93
  }
94
94
 
95
95
  let readSide: readSideDef = {
@@ -100,18 +100,17 @@ let readSide: readSideDef = {
100
100
  linkedWriteSide: ["Product"],
101
101
  labelField: "displayName",
102
102
  searchableFields: ["displayName"],
103
- labelFieldSource: Some("annotation"),
104
- lifecycleField: Some("lifecycle"),
105
- ownerField: Some("ownerId"),
106
- retiredField: Some("archived"),
107
- retiredValues: Some(["Archived"]),
108
- namedWhenRetired: Some(true),
109
- visibility: None,
110
- chapter: Some("Catalogue"),
111
- singleQueryField: Some("Catalog_Product"),
112
- idField: Some("productId"),
113
- idFieldSource: Some("convention"),
114
- requiredAccess: Some(["catalog.read"]),
103
+ labelFieldSource: "annotation",
104
+ lifecycleField: "lifecycle",
105
+ ownerField: "ownerId",
106
+ retiredField: "archived",
107
+ retiredValues: ["Archived"],
108
+ namedWhenRetired: true,
109
+ chapter: "Catalogue",
110
+ singleQueryField: "Catalog_Product",
111
+ idField: "productId",
112
+ idFieldSource: "convention",
113
+ requiredAccess: ["catalog.read"],
115
114
  }
116
115
 
117
116
  let automation: automationSliceDef = {
@@ -119,7 +118,7 @@ let automation: automationSliceDef = {
119
118
  consumedEventTypes: ["StockLow"],
120
119
  producedCommandTypes: ["Restock"],
121
120
  targetName: "Product",
122
- chapter: Some("Replenishment"),
121
+ chapter: "Replenishment",
123
122
  schedule: `{"TAG":"Every","_0":{"TAG":"Minutes","_0":15}}`,
124
123
  }
125
124
 
@@ -127,18 +126,18 @@ let outbound: outboundTranslationSliceDef = {
127
126
  name: "ToShipper",
128
127
  consumedEventTypes: ["OrderPlaced"],
129
128
  inboundCommandTypes: ["Ship"],
130
- targetName: Some("Shipment"),
131
- externalSystem: Some("Shipper"),
132
- chapter: Some("Fulfilment"),
133
- consumedSources: Some(["OrderingDcbEventLog"]),
129
+ targetName: "Shipment",
130
+ externalSystem: "Shipper",
131
+ chapter: "Fulfilment",
132
+ consumedSources: ["OrderingDcbEventLog"],
134
133
  }
135
134
 
136
135
  let inbound: inboundTranslationSliceDef = {
137
136
  name: "FromPsp",
138
137
  commandTypes: ["RecordPayment"],
139
138
  targetName: "Order",
140
- externalSystem: Some("Psp"),
141
- chapter: Some("Payments"),
139
+ externalSystem: "Psp",
140
+ chapter: "Payments",
142
141
  }
143
142
 
144
143
  let extension: extensionDef = {
@@ -146,26 +145,26 @@ let extension: extensionDef = {
146
145
  delegateNames: ["Product"],
147
146
  eventTypes: ["ProductAdded"],
148
147
  commandTypes: ["Add"],
149
- handledEvents: Some([{name: "ProductAdded", toCommandTypes: ["Ordering.SyncNewProduct"]}]),
150
- issuedCommands: Some([{name: "Catalog.Products.Ack", fromEventTypes: ["Ordering.Synced"]}]),
148
+ handledEvents: [{name: "ProductAdded", toCommandTypes: ["Ordering.SyncNewProduct"]}],
149
+ issuedCommands: [{name: "Catalog.Products.Ack", fromEventTypes: ["Ordering.Synced"]}],
151
150
  }
152
151
 
153
152
  let extensionPoint: extensionPointDef = {
154
153
  name: "Catalog.Products",
155
154
  delegateNames: ["Product"],
156
155
  sourceEventTypes: ["Catalog.ProductAdded"],
157
- commandTypes: Some(["Add"]),
158
- publishedEvents: Some([
156
+ commandTypes: ["Add"],
157
+ publishedEvents: [
159
158
  {name: "Catalog.Products.ProductAdded", fromEventTypes: ["Catalog.ProductAdded"]},
160
- ]),
161
- acceptedCommands: Some([{name: "Catalog.Products.Add", toCommandTypes: ["Catalog.Add"]}]),
159
+ ],
160
+ acceptedCommands: [{name: "Catalog.Products.Add", toCommandTypes: ["Catalog.Add"]}],
162
161
  }
163
162
 
164
163
  let storeDecl: requiredStoreDeclaration = {
165
164
  store: "catalog.images",
166
165
  component: "Product",
167
166
  field: "image",
168
- annotation: Some("images"),
167
+ annotation: "images",
169
168
  }
170
169
 
171
170
  let capabilityDecl: requiredCapabilityDeclaration = {
@@ -173,6 +172,14 @@ let capabilityDecl: requiredCapabilityDeclaration = {
173
172
  component: "GeocodeAddress",
174
173
  }
175
174
 
175
+ let admissionDef: Reventless.Admission.def = {
176
+ role: "Clerk",
177
+ strategy: "Invitation",
178
+ invitedBy: ["Admin"],
179
+ }
180
+
181
+ let admissionDoor: Reventless.Admission.doorDef = {component: "SignUp", part: "start"}
182
+
176
183
  let structure: pluginStructure = {
177
184
  readModels: [readSide],
178
185
  stateViewSlices: [],
@@ -182,11 +189,12 @@ let structure: pluginStructure = {
182
189
  outboundTranslationSlices: [outbound],
183
190
  inboundTranslationSlices: [inbound],
184
191
  extensions: [extension],
185
- extensionPoints: Some([extensionPoint]),
186
- requiredStores: Some(["catalog.images"]),
187
- requiredStoreDeclarations: Some([storeDecl]),
188
- requiredCapabilities: Some([capabilityDecl]),
189
- traitDeclarations: None,
192
+ extensionPoints: [extensionPoint],
193
+ requiredStores: ["catalog.images"],
194
+ requiredStoreDeclarations: [storeDecl],
195
+ requiredCapabilities: [capabilityDecl],
196
+ admission: [admissionDef],
197
+ admissionDoors: [admissionDoor],
190
198
  }
191
199
 
192
200
  let panel: panelManifestEntry = {
@@ -194,13 +202,13 @@ let panel: panelManifestEntry = {
194
202
  title: "Products",
195
203
  description: "",
196
204
  positions: ["platform-summary"],
197
- requiredAccess: Some("admin"),
205
+ requiredAccess: "admin",
198
206
  }
199
207
 
200
208
  let menu: menuEntry = {
201
209
  label: "Products",
202
- icon: Some("box"),
203
- group: Some("Catalog"),
210
+ icon: "box",
211
+ group: "Catalog",
204
212
  sortOrder: 0,
205
213
  }
206
214
 
@@ -208,7 +216,7 @@ let page: pageManifestEntry = {
208
216
  fragmentId: "Catalog.Products.list",
209
217
  title: "Products",
210
218
  menuEntry: menu,
211
- requiredAccess: Some("admin"),
219
+ requiredAccess: "admin",
212
220
  }
213
221
 
214
222
  let uiState: UiFragments.state = {
@@ -363,6 +371,10 @@ let guards: array<guard> = [
363
371
  // components, and where one came from is the map's question rather than a
364
372
  // generated page's. It reaches the wire on `Platform_PluginStructures`.
365
373
  "traitDeclarations",
374
+ // The shell learns the doors from the config.json the platform writes, and
375
+ // which roles are open from the registration plugin's public view.
376
+ "admission",
377
+ "admissionDoors",
366
378
  ],
367
379
  },
368
380
  {
@@ -399,6 +411,22 @@ let guards: array<guard> = [
399
411
  wireOnly: [],
400
412
  recordOnly: [],
401
413
  },
414
+ {
415
+ gqlType: "Platform_AdmissionDef",
416
+ sdlTypes: structuresSdl,
417
+ recordFields: schemaKeys(Reventless.Admission.defSchema),
418
+ wireFields: jsonKeys(Platform_PluginStructuresApi.encodeAdmissionDef(admissionDef)),
419
+ wireOnly: [],
420
+ recordOnly: [],
421
+ },
422
+ {
423
+ gqlType: "Platform_AdmissionDoorDef",
424
+ sdlTypes: structuresSdl,
425
+ recordFields: schemaKeys(Reventless.Admission.doorDefSchema),
426
+ wireFields: jsonKeys(Platform_PluginStructuresApi.encodeAdmissionDoorDef(admissionDoor)),
427
+ wireOnly: [],
428
+ recordOnly: [],
429
+ },
402
430
  {
403
431
  gqlType: "Platform_PluginStructureEntry",
404
432
  sdlTypes: structuresSdl,
@@ -3,6 +3,7 @@
3
3
  import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
4
4
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
5
  import * as Plugin$Reventless from "@reventlessdev/reventless-spec/src/components/Plugin.res.mjs";
6
+ import * as Admission$Reventless from "@reventlessdev/reventless-spec/src/types/Admission.res.mjs";
6
7
  import * as SchemaType$ReventlessCore from "../../src/components/Api/SchemaType.res.mjs";
7
8
  import * as UiFragments$ReventlessCore from "../../src/admin/UiFragmentRegistry/StateView/UiFragments.res.mjs";
8
9
  import * as Platform_UIFragmentsApi$ReventlessCore from "../../src/admin/Platform_UIFragmentsApi.res.mjs";
@@ -170,7 +171,6 @@ let readSide = {
170
171
  retiredField: readSide_retiredField,
171
172
  retiredValues: readSide_retiredValues,
172
173
  namedWhenRetired: readSide_namedWhenRetired,
173
- visibility: undefined,
174
174
  chapter: readSide_chapter,
175
175
  singleQueryField: readSide_singleQueryField,
176
176
  idField: readSide_idField,
@@ -293,6 +293,19 @@ let capabilityDecl = {
293
293
  component: "GeocodeAddress"
294
294
  };
295
295
 
296
+ let admissionDef_invitedBy = ["Admin"];
297
+
298
+ let admissionDef = {
299
+ role: "Clerk",
300
+ strategy: "Invitation",
301
+ invitedBy: admissionDef_invitedBy
302
+ };
303
+
304
+ let admissionDoor = {
305
+ component: "SignUp",
306
+ part: "start"
307
+ };
308
+
296
309
  let structure_readModels = [readSide];
297
310
 
298
311
  let structure_stateViewSlices = [];
@@ -317,6 +330,10 @@ let structure_requiredStoreDeclarations = [storeDecl];
317
330
 
318
331
  let structure_requiredCapabilities = [capabilityDecl];
319
332
 
333
+ let structure_admission = [admissionDef];
334
+
335
+ let structure_admissionDoors = [admissionDoor];
336
+
320
337
  let structure = {
321
338
  readModels: structure_readModels,
322
339
  stateViewSlices: structure_stateViewSlices,
@@ -330,7 +347,8 @@ let structure = {
330
347
  requiredStores: structure_requiredStores,
331
348
  requiredStoreDeclarations: structure_requiredStoreDeclarations,
332
349
  requiredCapabilities: structure_requiredCapabilities,
333
- traitDeclarations: undefined
350
+ admission: structure_admission,
351
+ admissionDoors: structure_admissionDoors
334
352
  };
335
353
 
336
354
  let panel_positions = ["platform-summary"];
@@ -481,7 +499,9 @@ let guards = [
481
499
  "requiredStores",
482
500
  "requiredStoreDeclarations",
483
501
  "requiredCapabilities",
484
- "traitDeclarations"
502
+ "traitDeclarations",
503
+ "admission",
504
+ "admissionDoors"
485
505
  ]
486
506
  },
487
507
  {
@@ -516,6 +536,22 @@ let guards = [
516
536
  wireOnly: [],
517
537
  recordOnly: []
518
538
  },
539
+ {
540
+ gqlType: "Platform_AdmissionDef",
541
+ sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
542
+ recordFields: schemaKeys(Admission$Reventless.defSchema),
543
+ wireFields: jsonKeys(Platform_PluginStructuresApi$ReventlessCore.encodeAdmissionDef(admissionDef)),
544
+ wireOnly: [],
545
+ recordOnly: []
546
+ },
547
+ {
548
+ gqlType: "Platform_AdmissionDoorDef",
549
+ sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
550
+ recordFields: schemaKeys(Admission$Reventless.doorDefSchema),
551
+ wireFields: jsonKeys(Platform_PluginStructuresApi$ReventlessCore.encodeAdmissionDoorDef(admissionDoor)),
552
+ wireOnly: [],
553
+ recordOnly: []
554
+ },
519
555
  {
520
556
  gqlType: "Platform_PluginStructureEntry",
521
557
  sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
@@ -613,6 +649,8 @@ export {
613
649
  extensionPoint,
614
650
  storeDecl,
615
651
  capabilityDecl,
652
+ admissionDef,
653
+ admissionDoor,
616
654
  structure,
617
655
  panel,
618
656
  menu,
@@ -100,7 +100,7 @@ describe("the admin structure's declared transitions are checked", () => {
100
100
  commands: [
101
101
  {
102
102
  ...activate(),
103
- targetState: Some("Conected"),
103
+ targetState: "Conected",
104
104
  },
105
105
  ],
106
106
  }
@@ -65,28 +65,10 @@ globalThis.describe("the admin structure's declared transitions are checked", ()
65
65
  globalThis.expect(raises([Platform_Admin_Structure$ReventlessCore.pluginAggregate])).toEqual(false);
66
66
  });
67
67
  globalThis.test("and a state the view does not declare is caught", () => {
68
- let newrecord = {...commandNamed("Activate")};
69
- let bogus_name = Platform_Admin_Structure$ReventlessCore.pluginAggregate.name;
70
- let bogus_commands = [(newrecord.targetState = "Conected", newrecord)];
71
- let bogus_producedEventTypes = Platform_Admin_Structure$ReventlessCore.pluginAggregate.producedEventTypes;
72
- let bogus_consumedEventTypes = Platform_Admin_Structure$ReventlessCore.pluginAggregate.consumedEventTypes;
73
- let bogus_linkedViews = Platform_Admin_Structure$ReventlessCore.pluginAggregate.linkedViews;
74
- let bogus_consistencyRead = Platform_Admin_Structure$ReventlessCore.pluginAggregate.consistencyRead;
75
- let bogus_events = Platform_Admin_Structure$ReventlessCore.pluginAggregate.events;
76
- let bogus_errors = Platform_Admin_Structure$ReventlessCore.pluginAggregate.errors;
77
- let bogus_chapter = Platform_Admin_Structure$ReventlessCore.pluginAggregate.chapter;
78
- let bogus = {
79
- name: bogus_name,
80
- commands: bogus_commands,
81
- producedEventTypes: bogus_producedEventTypes,
82
- consumedEventTypes: bogus_consumedEventTypes,
83
- linkedViews: bogus_linkedViews,
84
- consistencyRead: bogus_consistencyRead,
85
- events: bogus_events,
86
- errors: bogus_errors,
87
- chapter: bogus_chapter
88
- };
89
- globalThis.expect(raises([bogus])).toEqual(true);
68
+ let newrecord = {...Platform_Admin_Structure$ReventlessCore.pluginAggregate};
69
+ let newrecord$1 = {...commandNamed("Activate")};
70
+ newrecord.commands = [(newrecord$1.targetState = "Conected", newrecord$1)];
71
+ globalThis.expect(raises([newrecord])).toEqual(true);
90
72
  });
91
73
  });
92
74
 
@@ -14,44 +14,31 @@ let readSide = (~name, ~visibility=?, ~ownerField=?, ()): readSideDef => {
14
14
  linkedWriteSide: [],
15
15
  labelField: "displayName",
16
16
  searchableFields: ["displayName"],
17
- labelFieldSource: None,
18
- lifecycleField: None,
19
- visibility,
20
- chapter: None,
21
- singleQueryField: Some(`Ordering_${name}Single`),
22
- idField: Some("id"),
23
- idFieldSource: Some("convention"),
24
- requiredAccess: None,
25
- ownerField,
26
- retiredField: None,
27
- retiredValues: None,
28
- namedWhenRetired: None,
17
+ ?visibility,
18
+ singleQueryField: `Ordering_${name}Single`,
19
+ idField: "id",
20
+ idFieldSource: "convention",
21
+ ?ownerField,
29
22
  }
30
23
 
31
24
  let command = (~name, ~references=[], ~ownerField=?, ()): commandDef => {
32
25
  name,
33
26
  schema: "{}",
34
27
  level: Collection,
35
- aggregateIdField: None,
36
28
  mutationField: name->String.toLowerCase,
37
29
  references,
38
- allowedStates: None,
39
- targetState: None,
40
- apiExposed: Some(true),
41
- requiredAccess: None,
42
- ownerField,
30
+ apiExposed: true,
31
+ ?ownerField,
43
32
  }
44
33
 
45
34
  let writeSide = (~name, ~commands): writeSideDef => {
46
35
  name,
47
36
  commands,
48
37
  linkedViews: [],
49
- consistencyRead: None,
50
38
  producedEventTypes: [],
51
39
  consumedEventTypes: [],
52
40
  events: [],
53
41
  errors: [],
54
- chapter: None,
55
42
  }
56
43
 
57
44
  // Mirrors the hybrid example's shape: a public order list, an Internal
@@ -69,7 +56,7 @@ let structure: pluginStructure = {
69
56
  ~commands=[
70
57
  command(
71
58
  ~name="PlaceOrder",
72
- ~references=[{fieldName: "productIds", entity: "AvailableProducts", plugin: None}],
59
+ ~references=[{fieldName: "productIds", entity: "AvailableProducts"}],
73
60
  ~ownerField="customerId",
74
61
  (),
75
62
  ),
@@ -82,11 +69,6 @@ let structure: pluginStructure = {
82
69
  outboundTranslationSlices: [],
83
70
  inboundTranslationSlices: [],
84
71
  extensions: [],
85
- extensionPoints: None,
86
- requiredStores: None,
87
- requiredStoreDeclarations: None,
88
- requiredCapabilities: None,
89
- traitDeclarations: None,
90
72
  }
91
73
 
92
74
  let structures = [("Ordering@1.0.0", structure)]
@@ -97,9 +79,9 @@ let bake = selections => Platform_BakedManifest.curate(~structures, ~selections)
97
79
  // which is exactly what an omitted labelled argument says.
98
80
  let sel = (~plugin, ~views=?, ~commands=?, ~derived=?): Platform_BakedManifest.selection => {
99
81
  plugin,
100
- views,
101
- commands,
102
- derived,
82
+ ?views,
83
+ ?commands,
84
+ ?derived,
103
85
  }
104
86
 
105
87
  let entries = (json: JSON.t) => json->JSON.Decode.array->Option.getOr([])
@@ -17,18 +17,11 @@ function readSide(name, visibility, ownerField, param) {
17
17
  linkedWriteSide: [],
18
18
  labelField: "displayName",
19
19
  searchableFields: ["displayName"],
20
- labelFieldSource: undefined,
21
- lifecycleField: undefined,
22
20
  ownerField: ownerField,
23
- retiredField: undefined,
24
- retiredValues: undefined,
25
- namedWhenRetired: undefined,
26
21
  visibility: visibility,
27
- chapter: undefined,
28
22
  singleQueryField: `Ordering_` + name + `Single`,
29
23
  idField: "id",
30
- idFieldSource: "convention",
31
- requiredAccess: undefined
24
+ idFieldSource: "convention"
32
25
  };
33
26
  }
34
27
 
@@ -38,13 +31,9 @@ function command(name, referencesOpt, ownerField, param) {
38
31
  name: name,
39
32
  schema: "{}",
40
33
  level: "Collection",
41
- aggregateIdField: undefined,
42
34
  mutationField: name.toLowerCase(),
43
35
  references: references,
44
- allowedStates: undefined,
45
- targetState: undefined,
46
36
  apiExposed: true,
47
- requiredAccess: undefined,
48
37
  ownerField: ownerField
49
38
  };
50
39
  }
@@ -56,10 +45,8 @@ function writeSide(name, commands) {
56
45
  producedEventTypes: [],
57
46
  consumedEventTypes: [],
58
47
  linkedViews: [],
59
- consistencyRead: undefined,
60
48
  events: [],
61
- errors: [],
62
- chapter: undefined
49
+ errors: []
63
50
  };
64
51
  }
65
52
 
@@ -73,8 +60,7 @@ let structure_stateViewSlices = [
73
60
  let structure_stateChangeSlices = [
74
61
  writeSide("PlaceOrder", [command("PlaceOrder", [{
75
62
  fieldName: "productIds",
76
- entity: "AvailableProducts",
77
- plugin: undefined
63
+ entity: "AvailableProducts"
78
64
  }], "customerId", undefined)]),
79
65
  writeSide("ImportOrders", [command("ImportOrders", undefined, undefined, undefined)])
80
66
  ];
@@ -97,12 +83,7 @@ let structure = {
97
83
  automationSlices: structure_automationSlices,
98
84
  outboundTranslationSlices: structure_outboundTranslationSlices,
99
85
  inboundTranslationSlices: structure_inboundTranslationSlices,
100
- extensions: structure_extensions,
101
- extensionPoints: undefined,
102
- requiredStores: undefined,
103
- requiredStoreDeclarations: undefined,
104
- requiredCapabilities: undefined,
105
- traitDeclarations: undefined
86
+ extensions: structure_extensions
106
87
  };
107
88
 
108
89
  let structures = [[
@@ -156,10 +137,7 @@ globalThis.describe("curate", () => {
156
137
  });
157
138
  globalThis.test("unset views and commands include every public component", () => {
158
139
  let entry = firstEntry(Platform_BakedManifest$ReventlessCore.curate(structures, [{
159
- plugin: "Ordering",
160
- views: undefined,
161
- commands: undefined,
162
- derived: undefined
140
+ plugin: "Ordering"
163
141
  }]));
164
142
  globalThis.expect([
165
143
  names(entry, "readModels"),
@@ -185,10 +163,7 @@ globalThis.describe("curate", () => {
185
163
  let derivedOf = entry => Stdlib_Option.map(Stdlib_Option.flatMap(Stdlib_JSON.Decode.object(entry), d => d["derivedPages"]), v => Stdlib_Array.filterMap(Stdlib_Option.getOr(Stdlib_JSON.Decode.array(v), []), Stdlib_JSON.Decode.string));
186
164
  globalThis.test("unset derived says nothing, leaving every kind to the shell", () => {
187
165
  globalThis.expect(derivedOf(firstEntry(Platform_BakedManifest$ReventlessCore.curate(structures, [{
188
- plugin: "Ordering",
189
- views: undefined,
190
- commands: undefined,
191
- derived: undefined
166
+ plugin: "Ordering"
192
167
  }])))).toEqual(undefined);
193
168
  });
194
169
  globalThis.test("an empty derived list is carried, and is not the same as unset", () => {
@@ -228,10 +203,7 @@ globalThis.describe("curate", () => {
228
203
  });
229
204
  globalThis.test("fails naming an unknown plugin", () => {
230
205
  globalThis.expect(Platform_BakedManifest$ReventlessCore.curate(structures, [{
231
- plugin: "Shipping",
232
- views: undefined,
233
- commands: undefined,
234
- derived: undefined
206
+ plugin: "Shipping"
235
207
  }])).toEqual({
236
208
  TAG: "Error",
237
209
  _0: {
@@ -252,10 +224,7 @@ globalThis.describe("curate", () => {
252
224
  });
253
225
  globalThis.test("an all-inclusive bake is byte-identical to the served entry", () => {
254
226
  let baked = firstEntry(Platform_BakedManifest$ReventlessCore.curate(structures, [{
255
- plugin: "Ordering",
256
- views: undefined,
257
- commands: undefined,
258
- derived: undefined
227
+ plugin: "Ordering"
259
228
  }]));
260
229
  let served = Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Ordering@1.0.0", undefined, structure);
261
230
  globalThis.expect(JSON.stringify(baked)).toEqual(JSON.stringify(served));