@reventlessdev/reventless-core 3.0.0-alpha.256 → 3.0.0-alpha.258

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 (67) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/package.json +8 -8
  3. package/src/adapter/Monitoring/Monitoring.res +79 -5
  4. package/src/adapter/Monitoring/Monitoring.res.mjs +42 -2
  5. package/src/admin/Platform_Admin_Structure.res.mjs +1 -1
  6. package/src/admin/Platform_ComponentDefinitionsApi.res +5 -1
  7. package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +5 -1
  8. package/src/admin/Platform_UiSlots.res +21 -0
  9. package/src/admin/Platform_UiSlots.res.mjs +15 -0
  10. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +1 -1
  11. package/src/components/Aggregate/Aggregate_Callback.res +13 -4
  12. package/src/components/Aggregate/Aggregate_Callback.res.mjs +6 -5
  13. package/src/components/Api/GraphQL_FragmentGenerator.res +2 -0
  14. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +4 -0
  15. package/src/components/Api/MCP_SchemaGenerator.res.mjs +2 -2
  16. package/src/components/Api/SchemaType.res +8 -0
  17. package/src/components/Api/SchemaType.res.mjs +15 -5
  18. package/src/components/Api/SuryToJsonSchema.res +70 -12
  19. package/src/components/Api/SuryToJsonSchema.res.mjs +43 -16
  20. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +6 -1
  21. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +1 -1
  22. package/src/components/StateViewSlice/StateViewSlice_Builder.res +7 -2
  23. package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +4 -1
  24. package/src/components/StateViewSlice/StateViewSlice_Callback.res +3 -1
  25. package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +1 -1
  26. package/src/plugin/component/Plugin.res +1 -0
  27. package/src/plugin/component/Plugin_Builder.res +2 -0
  28. package/src/plugin/component/Plugin_Builder.res.mjs +3 -2
  29. package/src/plugin/component/Plugin_Structure.res +105 -10
  30. package/src/plugin/component/Plugin_Structure.res.mjs +71 -27
  31. package/src/util/Validation.res +1 -1
  32. package/src/util/Validation.res.mjs +2 -2
  33. package/tests/adapter/MonitoringTest.res +46 -7
  34. package/tests/adapter/MonitoringTest.res.mjs +47 -5
  35. package/tests/admin/AdminApiSchemaDriftTest.res +1 -0
  36. package/tests/admin/AdminApiSchemaDriftTest.res.mjs +3 -0
  37. package/tests/admin/Platform_Admin_StructureTest.res.mjs +2 -14
  38. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +1 -0
  39. package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +2 -0
  40. package/tests/aggregate/AggregateCacheTest.res.mjs +1 -1
  41. package/tests/aggregate/AggregateConflictTest.res.mjs +1 -1
  42. package/tests/aggregate/AggregateFixtures.res.mjs +1 -1
  43. package/tests/aggregate/AggregateSnapshotTest.res.mjs +1 -1
  44. package/tests/api/GraphQL_FragmentGeneratorTest.res +6 -4
  45. package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +5 -5
  46. package/tests/api/SuryToJsonSchemaTest.res.mjs +57 -57
  47. package/tests/api/TaggedUnionSchemaTest.res.mjs +1 -1
  48. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +1 -1
  49. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +1 -1
  50. package/tests/dcb/DcbFixtures.res.mjs +1 -1
  51. package/tests/eventmapper/EventMapperFixtures.res.mjs +1 -1
  52. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +1 -1
  53. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +1 -1
  54. package/tests/plugin/ManifestVisibilityTest.res.mjs +1 -1
  55. package/tests/plugin/PluginStructureAccessTest.res.mjs +1 -1
  56. package/tests/plugin/PluginStructureTest.res +184 -0
  57. package/tests/plugin/PluginStructureTest.res.mjs +142 -17
  58. package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +1 -1
  59. package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +1 -1
  60. package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +1 -1
  61. package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +1 -1
  62. package/tests/plugin/StateChangeSlice/PsReserveStock.res +14 -1
  63. package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +9 -2
  64. package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +1 -1
  65. package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +1 -1
  66. package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +1 -1
  67. package/tests/util/CommandPublisherTest.res.mjs +1 -1
@@ -71,6 +71,7 @@ let cmd: commandDef = {
71
71
  references: [fieldRef],
72
72
  allowedStates: Some(["Draft"]),
73
73
  targetState: Some("Active"),
74
+ allowedStatesSource: "declared",
74
75
  apiExposed: Some(true),
75
76
  requiredAccess: Some(["catalog.write"]),
76
77
  ownerField: Some("ownerId"),
@@ -61,6 +61,8 @@ let cmd_allowedStates = ["Draft"];
61
61
 
62
62
  let cmd_targetState = "Active";
63
63
 
64
+ let cmd_allowedStatesSource = "declared";
65
+
64
66
  let cmd_apiExposed = true;
65
67
 
66
68
  let cmd_requiredAccess = ["catalog.write"];
@@ -76,6 +78,7 @@ let cmd = {
76
78
  references: cmd_references,
77
79
  allowedStates: cmd_allowedStates,
78
80
  targetState: cmd_targetState,
81
+ allowedStatesSource: cmd_allowedStatesSource,
79
82
  apiExposed: cmd_apiExposed,
80
83
  requiredAccess: cmd_requiredAccess,
81
84
  ownerField: cmd_ownerField
@@ -63,21 +63,9 @@ globalThis.describe("the admin structure's declared transitions are checked", ()
63
63
  globalThis.expect(raises([Platform_Admin_Structure$ReventlessCore.pluginAggregate])).toEqual(false);
64
64
  });
65
65
  globalThis.test("and a state the view does not declare is caught", () => {
66
- let init = commandNamed("Activate");
66
+ let newrecord = {...commandNamed("Activate")};
67
67
  let bogus_name = Platform_Admin_Structure$ReventlessCore.pluginAggregate.name;
68
- let bogus_commands = [{
69
- name: init.name,
70
- schema: init.schema,
71
- level: init.level,
72
- aggregateIdField: init.aggregateIdField,
73
- mutationField: init.mutationField,
74
- references: init.references,
75
- allowedStates: init.allowedStates,
76
- targetState: "Conected",
77
- apiExposed: init.apiExposed,
78
- requiredAccess: init.requiredAccess,
79
- ownerField: init.ownerField
80
- }];
68
+ let bogus_commands = [(newrecord.targetState = "Conected", newrecord)];
81
69
  let bogus_producedEventTypes = Platform_Admin_Structure$ReventlessCore.pluginAggregate.producedEventTypes;
82
70
  let bogus_consumedEventTypes = Platform_Admin_Structure$ReventlessCore.pluginAggregate.consumedEventTypes;
83
71
  let bogus_linkedViews = Platform_Admin_Structure$ReventlessCore.pluginAggregate.linkedViews;
@@ -355,6 +355,7 @@ describe("allowedStates + lifecycleField populated", () => {
355
355
  references: [],
356
356
  allowedStates: Some(["Inactive"]),
357
357
  targetState: Some("Active"),
358
+ allowedStatesSource: "declared",
358
359
  apiExposed: Some(true),
359
360
  requiredAccess: None,
360
361
  ownerField: None,
@@ -410,6 +410,7 @@ globalThis.describe("allowedStates + lifecycleField populated", () => {
410
410
  let cmdWithStates_references = [];
411
411
  let cmdWithStates_allowedStates = ["Inactive"];
412
412
  let cmdWithStates_targetState = "Active";
413
+ let cmdWithStates_allowedStatesSource = "declared";
413
414
  let cmdWithStates_apiExposed = true;
414
415
  let cmdWithStates = {
415
416
  name: "Activate",
@@ -420,6 +421,7 @@ globalThis.describe("allowedStates + lifecycleField populated", () => {
420
421
  references: cmdWithStates_references,
421
422
  allowedStates: cmdWithStates_allowedStates,
422
423
  targetState: cmdWithStates_targetState,
424
+ allowedStatesSource: cmdWithStates_allowedStatesSource,
423
425
  apiExposed: cmdWithStates_apiExposed,
424
426
  requiredAccess: undefined,
425
427
  ownerField: undefined
@@ -38,7 +38,7 @@ function commandAuthorization(param) {
38
38
  }
39
39
 
40
40
  function commandTransition(param) {
41
- return "Unrestricted";
41
+ return "Undeclared";
42
42
  }
43
43
 
44
44
  let traits = [];
@@ -27,7 +27,7 @@ function commandAuthorization(param) {
27
27
  }
28
28
 
29
29
  function commandTransition(param) {
30
- return "Unrestricted";
30
+ return "Undeclared";
31
31
  }
32
32
 
33
33
  let traits = [];
@@ -41,7 +41,7 @@ function commandAuthorization(param) {
41
41
  }
42
42
 
43
43
  function commandTransition(param) {
44
- return "Unrestricted";
44
+ return "Undeclared";
45
45
  }
46
46
 
47
47
  let traits = [];
@@ -33,7 +33,7 @@ function commandAuthorization(param) {
33
33
  }
34
34
 
35
35
  function commandTransition(param) {
36
- return "Unrestricted";
36
+ return "Undeclared";
37
37
  }
38
38
 
39
39
  let traits = [];
@@ -357,11 +357,13 @@ describe("GraphQL_FragmentGenerator.mutationArgTypes", () => {
357
357
  expect((typeOf("tip"), typeOf("total")))->toEqual((Some("MoneyInput"), Some("MoneyInput!")))
358
358
  )
359
359
 
360
- // Both of these differ from what the JSON-Schema type alone suggests —
361
- // `orderId` is a plain string there and `itemCount` an integer — which is the
362
- // narrower reason a client cannot derive even the scalars itself.
360
+ // `orderId` differs from what the JSON-Schema type alone suggests — a plain
361
+ // string there, an `ID!` here — which is the narrower reason a client cannot
362
+ // derive even the scalars itself. `itemCount` is an `Int!` on both sides: sury
363
+ // carries the whole-number format and the walk now keeps it, so a quantity is
364
+ // no longer a field a client could legally send `2.5` in.
363
365
  testSync("reports the scalar the server chose, not the JSON-Schema one", () =>
364
- expect((typeOf("orderId"), typeOf("itemCount")))->toEqual((Some("ID!"), Some("Float!")))
366
+ expect((typeOf("orderId"), typeOf("itemCount")))->toEqual((Some("ID!"), Some("Int!")))
365
367
  )
366
368
 
367
369
  // The property that makes publishing worth more than re-deriving downstream:
@@ -25,7 +25,7 @@ function commandAuthorization(param) {
25
25
  }
26
26
 
27
27
  function commandTransition(param) {
28
- return "Unrestricted";
28
+ return "Undeclared";
29
29
  }
30
30
 
31
31
  let traits = [];
@@ -237,7 +237,7 @@ function commandAuthorization$1(param) {
237
237
  }
238
238
 
239
239
  function commandTransition$1(param) {
240
- return "Unrestricted";
240
+ return "Undeclared";
241
241
  }
242
242
 
243
243
  let traits$1 = [];
@@ -266,7 +266,7 @@ function commandAuthorization$2(param) {
266
266
  }
267
267
 
268
268
  function commandTransition$2(param) {
269
- return "Unrestricted";
269
+ return "Undeclared";
270
270
  }
271
271
 
272
272
  let traits$2 = [];
@@ -359,7 +359,7 @@ globalThis.describe("GraphQL_FragmentGenerator.mutationArgTypes", () => {
359
359
  argTypes["itemCount"]
360
360
  ]).toEqual([
361
361
  "ID!",
362
- "Float!"
362
+ "Int!"
363
363
  ]);
364
364
  });
365
365
  globalThis.test("agrees with every argument the SDL declares", () => {
@@ -550,7 +550,7 @@ globalThis.describe("@internal keeps a field off the generated type", () => {
550
550
  ]);
551
551
  });
552
552
  globalThis.test("the published state schema drops them too", () => {
553
- let json = JSON.stringify(SuryToJsonSchema$ReventlessCore.deriveObjectSchema(PsInternalFieldsReadModel$ReventlessCore.stateSchema));
553
+ let json = JSON.stringify(SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, PsInternalFieldsReadModel$ReventlessCore.stateSchema));
554
554
  globalThis.expect([
555
555
  json.includes("eventCollector"),
556
556
  json.includes("name")