@reventlessdev/reventless-core 3.0.0-alpha.180 → 3.0.0-alpha.181

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 (115) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +7 -7
  3. package/src/Message.res +2 -1
  4. package/src/Message.res.mjs +5 -1
  5. package/src/admin/Platform_Admin_Structure.res +2 -0
  6. package/src/admin/Platform_Admin_Structure.res.mjs +2 -0
  7. package/src/admin/Platform_ComponentDefinitionsApi.res +2 -1
  8. package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +5 -1
  9. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments_Projection.res +1 -1
  10. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments_Projection.res.mjs +2 -1
  11. package/src/components/Api/ApiTargetStateHelpers.res +20 -0
  12. package/src/components/Api/ApiTargetStateHelpers.res.mjs +16 -0
  13. package/src/components/Api/GraphQL_FragmentGenerator.res +1 -0
  14. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +1 -0
  15. package/src/components/Api/SchemaType.res +3 -0
  16. package/src/components/Api/SchemaType.res.mjs +10 -2
  17. package/src/components/Api/SuryToJsonSchema.res +16 -0
  18. package/src/components/Api/SuryToJsonSchema.res.mjs +28 -0
  19. package/src/components/Dcb/Dcb_Builder.res +4 -5
  20. package/src/components/Dcb/Dcb_Builder.res.mjs +3 -5
  21. package/src/components/DcbEventLog/DcbEventLog_Operations.res +6 -1
  22. package/src/components/DcbEventLog/DcbEventLog_Operations.res.mjs +2 -1
  23. package/src/components/InboundTranslationSlice/InboundTranslationSlice.res +25 -0
  24. package/src/components/InboundTranslationSlice/InboundTranslationSlice.res.mjs +31 -0
  25. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +8 -8
  26. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +26 -6
  27. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +44 -37
  28. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +17 -25
  29. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +27 -2
  30. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -0
  31. package/src/components/StateViewSlice/StateViewSlice_Builder.res +20 -6
  32. package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +23 -5
  33. package/src/components/StateViewSlice/StateViewSlice_Callback.res +1 -1
  34. package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +5 -1
  35. package/src/plugin/component/Plugin_Helpers.res +4 -1
  36. package/src/plugin/component/Plugin_Structure.res +15 -1
  37. package/src/plugin/component/Plugin_Structure.res.mjs +4 -1
  38. package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +2 -0
  39. package/tests/IdentityTest.res.mjs +174 -0
  40. package/tests/ResourceAttributionTest.res.mjs +75 -0
  41. package/tests/adapter/MonitoringTest.res.mjs +116 -0
  42. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +10 -0
  43. package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +365 -0
  44. package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +101 -0
  45. package/tests/aggregate/AggregateCacheTest.res.mjs +433 -0
  46. package/tests/aggregate/AggregateCallbackTest.res.mjs +143 -0
  47. package/tests/aggregate/AggregateCausationTest.res.mjs +47 -0
  48. package/tests/aggregate/AggregateConflictTest.res.mjs +386 -0
  49. package/tests/aggregate/AggregateFixtures.res.mjs +308 -0
  50. package/tests/aggregate/AggregateRejectionTest.res.mjs +166 -0
  51. package/tests/aggregate/AggregateSnapshotTest.res.mjs +645 -0
  52. package/tests/api/ApiNoApiTest.res.mjs +90 -0
  53. package/tests/api/GraphQL_StitcherTest.res.mjs +112 -0
  54. package/tests/api/SimpleTest.res.mjs +10 -0
  55. package/tests/api/SuryToJsonSchemaTest.res +68 -0
  56. package/tests/api/SuryToJsonSchemaTest.res.mjs +843 -0
  57. package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +160 -0
  58. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +197 -0
  59. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +152 -0
  60. package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +106 -0
  61. package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +109 -0
  62. package/tests/counter/CounterCallbackTest.res.mjs +140 -0
  63. package/tests/counter/CounterFixtures.res.mjs +67 -0
  64. package/tests/dcb/DcbDecodeTest.res.mjs +194 -0
  65. package/tests/dcb/DcbEventLogOperationsTest.res.mjs +268 -0
  66. package/tests/dcb/DcbFixtures.res.mjs +534 -0
  67. package/tests/dcb/DcbScopeInferenceTest.res.mjs +480 -0
  68. package/tests/dcb/DcbStateChangeSliceTest.res.mjs +540 -0
  69. package/tests/dcb/DcbTagTest.res.mjs +867 -0
  70. package/tests/dcb/DcbValidationTest.res.mjs +476 -0
  71. package/tests/eventlog/EventLogFixtures.res.mjs +196 -0
  72. package/tests/eventlog/EventLogOperationsTest.res.mjs +192 -0
  73. package/tests/eventlog/EventLogRetryTest.res.mjs +195 -0
  74. package/tests/eventmapper/EventMapperCallbackTest.res.mjs +141 -0
  75. package/tests/eventmapper/EventMapperFixtures.res.mjs +440 -0
  76. package/tests/eventmapper/EventMapperTest.res.mjs +83 -0
  77. package/tests/eventtopic/EventTopicFixtures.res.mjs +65 -0
  78. package/tests/eventtopic/EventTopicOperationsTest.res.mjs +71 -0
  79. package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +94 -0
  80. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +205 -0
  81. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +304 -0
  82. package/tests/extensionpoint/PluginDisconnectScheduleTest.res.mjs +92 -0
  83. package/tests/ftp/FTPTest.res.mjs +88 -0
  84. package/tests/logger/LogFormatTest.res.mjs +329 -0
  85. package/tests/logger/LoggerLazyTest.res.mjs +40 -0
  86. package/tests/message/MessageTest.res.mjs +218 -0
  87. package/tests/message/MetaEnvelopeTest.res.mjs +188 -0
  88. package/tests/plugin/HeartbeatDisconnectGraceTest.res.mjs +91 -0
  89. package/tests/plugin/ManifestVisibilityTest.res.mjs +215 -0
  90. package/tests/plugin/PluginSpecExperiment.res.mjs +31 -0
  91. package/tests/plugin/PluginStructureTest.res +55 -0
  92. package/tests/plugin/PluginStructureTest.res.mjs +467 -0
  93. package/tests/plugin/PluginVersionTest.res.mjs +30 -0
  94. package/tests/plugin/SchemaWalkerTest.res.mjs +160 -0
  95. package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +62 -0
  96. package/tests/plugin/StateChangeSlice/PsShipOrder.res +4 -1
  97. package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +77 -0
  98. package/tests/plugin/StateViewSlice/PsAnnotatedView.res +5 -4
  99. package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +110 -0
  100. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res +1 -1
  101. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +70 -0
  102. package/tests/plugin/StateViewSlice/PsCustomersView.res +1 -1
  103. package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +70 -0
  104. package/tests/plugin/StateViewSlice/PsOrdersView.res +1 -1
  105. package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +82 -0
  106. package/tests/poc/StructuralSubtypingPoc.res.mjs +61 -0
  107. package/tests/projection/ProjectionOptimizeTest.res.mjs +75 -0
  108. package/tests/querydb/QueryDbFixtures.res.mjs +135 -0
  109. package/tests/querydb/QueryDbOperationsTest.res.mjs +168 -0
  110. package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +77 -0
  111. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +139 -0
  112. package/tests/util/CommandPublisherTest.res.mjs +78 -0
  113. package/tests/util/CsvStreamTest.res.mjs +51 -0
  114. package/tests/util/LruTest.res.mjs +105 -0
  115. package/tests/util/MetricsTest.res.mjs +53 -0
@@ -0,0 +1,365 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
4
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
+ import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
6
+ import * as Platform_ComponentDefinitionsApi$ReventlessCore from "../../src/admin/Platform_ComponentDefinitionsApi.res.mjs";
7
+
8
+ let cmd_references = [{
9
+ fieldName: "categoryId",
10
+ entity: "Category",
11
+ plugin: "Catalog"
12
+ }];
13
+
14
+ let cmd_apiExposed = true;
15
+
16
+ let cmd = {
17
+ name: "Add",
18
+ schema: "{}",
19
+ level: "Collection",
20
+ aggregateIdField: undefined,
21
+ mutationField: "AddProduct",
22
+ references: cmd_references,
23
+ allowedStates: undefined,
24
+ targetState: undefined,
25
+ apiExposed: cmd_apiExposed
26
+ };
27
+
28
+ let qbl_consumedEventTypes = ["ProductAdded"];
29
+
30
+ let qbl_linkedWriteSide = ["Product"];
31
+
32
+ let qbl_searchableFields = ["displayName"];
33
+
34
+ let qbl = {
35
+ name: "Products",
36
+ queryField: "Catalog_Products",
37
+ schema: "{}",
38
+ consumedEventTypes: qbl_consumedEventTypes,
39
+ linkedWriteSide: qbl_linkedWriteSide,
40
+ labelField: "displayName",
41
+ searchableFields: qbl_searchableFields,
42
+ statusField: undefined,
43
+ visibility: undefined,
44
+ chapter: undefined
45
+ };
46
+
47
+ let wbl_commands = [cmd];
48
+
49
+ let wbl_producedEventTypes = ["ProductAdded"];
50
+
51
+ let wbl_consumedEventTypes = [];
52
+
53
+ let wbl_linkedViews = ["Products"];
54
+
55
+ let wbl_events = [{
56
+ name: "ProductAdded",
57
+ schema: "{}",
58
+ references: []
59
+ }];
60
+
61
+ let wbl = {
62
+ name: "Product",
63
+ commands: wbl_commands,
64
+ producedEventTypes: wbl_producedEventTypes,
65
+ consumedEventTypes: wbl_consumedEventTypes,
66
+ linkedViews: wbl_linkedViews,
67
+ consistencyRead: undefined,
68
+ events: wbl_events,
69
+ chapter: undefined
70
+ };
71
+
72
+ let structure_readModels = [qbl];
73
+
74
+ let structure_stateViewSlices = [];
75
+
76
+ let structure_stateChangeSlices = [];
77
+
78
+ let structure_aggregates = [wbl];
79
+
80
+ let structure_automationSlices = [{
81
+ name: "Restocker",
82
+ consumedEventTypes: ["StockLow"],
83
+ producedCommandTypes: ["Restock"],
84
+ targetName: "Product",
85
+ chapter: undefined
86
+ }];
87
+
88
+ let structure_outboundTranslationSlices = [{
89
+ name: "ToShipper",
90
+ consumedEventTypes: ["OrderPlaced"],
91
+ inboundCommandTypes: ["Ship"],
92
+ targetName: undefined,
93
+ externalSystem: undefined,
94
+ chapter: undefined
95
+ }];
96
+
97
+ let structure_inboundTranslationSlices = [{
98
+ name: "FromBilling",
99
+ commandTypes: ["RecordPayment"],
100
+ targetName: "Order",
101
+ externalSystem: undefined,
102
+ chapter: undefined
103
+ }];
104
+
105
+ let structure_extensions = [{
106
+ name: "Catalog.Products.Watcher",
107
+ delegateNames: ["onAdded"],
108
+ eventTypes: ["ProductAdded"],
109
+ commandTypes: []
110
+ }];
111
+
112
+ let structure = {
113
+ readModels: structure_readModels,
114
+ stateViewSlices: structure_stateViewSlices,
115
+ stateChangeSlices: structure_stateChangeSlices,
116
+ aggregates: structure_aggregates,
117
+ automationSlices: structure_automationSlices,
118
+ outboundTranslationSlices: structure_outboundTranslationSlices,
119
+ inboundTranslationSlices: structure_inboundTranslationSlices,
120
+ extensions: structure_extensions,
121
+ extensionPoints: undefined
122
+ };
123
+
124
+ let encoded = Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Catalog", structure);
125
+
126
+ let json = JSON.stringify(encoded);
127
+
128
+ globalThis.describe("encodePluginStructureEntry", () => {
129
+ globalThis.test("produces a JSON object with the expected top-level keys", () => {
130
+ let dict = Stdlib_Option.getOr(Stdlib_JSON.Decode.object(encoded), {});
131
+ let keys = Object.keys(dict).toSorted(Primitive_string.compare);
132
+ globalThis.expect(keys).toEqual([
133
+ "aggregates",
134
+ "automationSlices",
135
+ "extensions",
136
+ "inboundTranslationSlices",
137
+ "outboundTranslationSlices",
138
+ "pluginId",
139
+ "readModels",
140
+ "stateChangeSlices",
141
+ "stateViewSlices"
142
+ ]);
143
+ });
144
+ globalThis.test("encodes pluginId", () => {
145
+ globalThis.expect(json.includes("\"pluginId\":\"Catalog\"")).toEqual(true);
146
+ });
147
+ globalThis.test("encodes commandLevel as a literal string", () => {
148
+ globalThis.expect(json.includes("\"level\":\"Collection\"")).toEqual(true);
149
+ });
150
+ globalThis.test("encodes None aggregateIdField as null", () => {
151
+ globalThis.expect(json.includes("\"aggregateIdField\":null")).toEqual(true);
152
+ });
153
+ globalThis.test("encodes None consistencyRead as null", () => {
154
+ globalThis.expect(json.includes("\"consistencyRead\":null")).toEqual(true);
155
+ });
156
+ globalThis.test("encodes Some plugin reference as its inner string", () => {
157
+ globalThis.expect(json.includes("\"plugin\":\"Catalog\"")).toEqual(true);
158
+ });
159
+ globalThis.test("includes the queryableDef name", () => {
160
+ globalThis.expect(json.includes("\"name\":\"Products\"")).toEqual(true);
161
+ });
162
+ globalThis.test("includes the automation slice name", () => {
163
+ globalThis.expect(json.includes("\"name\":\"Restocker\"")).toEqual(true);
164
+ });
165
+ globalThis.test("encodes None allowedStates as null", () => {
166
+ globalThis.expect(json.includes("\"allowedStates\":null")).toEqual(true);
167
+ });
168
+ globalThis.test("encodes None targetState as null (back-compat: resolver falls back to name-stem)", () => {
169
+ globalThis.expect(json.includes("\"targetState\":null")).toEqual(true);
170
+ });
171
+ globalThis.test("encodes the command's apiExposed flag (drives the event-graph API badge)", () => {
172
+ globalThis.expect(json.includes("\"apiExposed\":true")).toEqual(true);
173
+ });
174
+ globalThis.test("encodes None statusField as null", () => {
175
+ globalThis.expect(json.includes("\"statusField\":null")).toEqual(true);
176
+ });
177
+ globalThis.test("encodes writableDef events", () => {
178
+ globalThis.expect(json.includes("\"events\":[{\"name\":\"ProductAdded\"")).toEqual(true);
179
+ });
180
+ globalThis.test("encodes None outbound externalSystem as null", () => {
181
+ globalThis.expect(json.includes("\"inboundCommandTypes\":[\"Ship\"],\"externalSystem\":null")).toEqual(true);
182
+ });
183
+ globalThis.test("encodes None inbound externalSystem as null", () => {
184
+ globalThis.expect(json.includes("\"commandTypes\":[\"RecordPayment\"],\"externalSystem\":null")).toEqual(true);
185
+ });
186
+ });
187
+
188
+ globalThis.describe("translation-slice externalSystem round-trip", () => {
189
+ let externalStructure_readModels = structure_readModels;
190
+ let externalStructure_stateViewSlices = structure_stateViewSlices;
191
+ let externalStructure_stateChangeSlices = structure_stateChangeSlices;
192
+ let externalStructure_aggregates = structure_aggregates;
193
+ let externalStructure_automationSlices = structure_automationSlices;
194
+ let externalStructure_outboundTranslationSlices = [{
195
+ name: "ToShipper",
196
+ consumedEventTypes: ["OrderPlaced"],
197
+ inboundCommandTypes: ["Ship"],
198
+ targetName: undefined,
199
+ externalSystem: "ShipperGateway",
200
+ chapter: undefined
201
+ }];
202
+ let externalStructure_inboundTranslationSlices = [{
203
+ name: "FromBilling",
204
+ commandTypes: ["RecordPayment"],
205
+ targetName: "Order",
206
+ externalSystem: "BillingProvider",
207
+ chapter: undefined
208
+ }];
209
+ let externalStructure_extensions = structure_extensions;
210
+ let externalStructure = {
211
+ readModels: externalStructure_readModels,
212
+ stateViewSlices: externalStructure_stateViewSlices,
213
+ stateChangeSlices: externalStructure_stateChangeSlices,
214
+ aggregates: externalStructure_aggregates,
215
+ automationSlices: externalStructure_automationSlices,
216
+ outboundTranslationSlices: externalStructure_outboundTranslationSlices,
217
+ inboundTranslationSlices: externalStructure_inboundTranslationSlices,
218
+ extensions: externalStructure_extensions,
219
+ extensionPoints: undefined
220
+ };
221
+ let externalJson = JSON.stringify(Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Catalog", externalStructure));
222
+ globalThis.test("surfaces Some outbound externalSystem as its inner string", () => {
223
+ globalThis.expect(externalJson.includes("\"externalSystem\":\"ShipperGateway\"")).toEqual(true);
224
+ });
225
+ globalThis.test("surfaces Some inbound externalSystem as its inner string", () => {
226
+ globalThis.expect(externalJson.includes("\"externalSystem\":\"BillingProvider\"")).toEqual(true);
227
+ });
228
+ });
229
+
230
+ globalThis.describe("visibility filtering (deployed AutoUI hides Internal)", () => {
231
+ let internalQbl_consumedEventTypes = ["CatalogProductSynced"];
232
+ let internalQbl_linkedWriteSide = [];
233
+ let internalQbl_searchableFields = ["name"];
234
+ let internalQbl_visibility = "Internal";
235
+ let internalQbl = {
236
+ name: "AvailableProducts",
237
+ queryField: "Ordering_AvailableProducts",
238
+ schema: "{}",
239
+ consumedEventTypes: internalQbl_consumedEventTypes,
240
+ linkedWriteSide: internalQbl_linkedWriteSide,
241
+ labelField: "name",
242
+ searchableFields: internalQbl_searchableFields,
243
+ statusField: undefined,
244
+ visibility: internalQbl_visibility,
245
+ chapter: undefined
246
+ };
247
+ let mixed_readModels = [
248
+ qbl,
249
+ internalQbl
250
+ ];
251
+ let mixed_stateViewSlices = [internalQbl];
252
+ let mixed_stateChangeSlices = structure_stateChangeSlices;
253
+ let mixed_aggregates = structure_aggregates;
254
+ let mixed_automationSlices = structure_automationSlices;
255
+ let mixed_outboundTranslationSlices = structure_outboundTranslationSlices;
256
+ let mixed_inboundTranslationSlices = structure_inboundTranslationSlices;
257
+ let mixed_extensions = structure_extensions;
258
+ let mixed = {
259
+ readModels: mixed_readModels,
260
+ stateViewSlices: mixed_stateViewSlices,
261
+ stateChangeSlices: mixed_stateChangeSlices,
262
+ aggregates: mixed_aggregates,
263
+ automationSlices: mixed_automationSlices,
264
+ outboundTranslationSlices: mixed_outboundTranslationSlices,
265
+ inboundTranslationSlices: mixed_inboundTranslationSlices,
266
+ extensions: mixed_extensions,
267
+ extensionPoints: undefined
268
+ };
269
+ let mixedJson = JSON.stringify(Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Ordering", mixed));
270
+ globalThis.test("excludes an Internal queryableDef from the encoded read-side", () => {
271
+ globalThis.expect(mixedJson.includes("AvailableProducts")).toEqual(false);
272
+ });
273
+ globalThis.test("keeps a Public queryableDef", () => {
274
+ globalThis.expect(mixedJson.includes("\"name\":\"Products\"")).toEqual(true);
275
+ });
276
+ });
277
+
278
+ globalThis.describe("allowedStates + statusField populated", () => {
279
+ let cmdWithStates_aggregateIdField = "id";
280
+ let cmdWithStates_references = [];
281
+ let cmdWithStates_allowedStates = ["Inactive"];
282
+ let cmdWithStates_targetState = "Active";
283
+ let cmdWithStates_apiExposed = true;
284
+ let cmdWithStates = {
285
+ name: "Activate",
286
+ schema: "{}",
287
+ level: "Instance",
288
+ aggregateIdField: cmdWithStates_aggregateIdField,
289
+ mutationField: "Platform_Plugin_Activate",
290
+ references: cmdWithStates_references,
291
+ allowedStates: cmdWithStates_allowedStates,
292
+ targetState: cmdWithStates_targetState,
293
+ apiExposed: cmdWithStates_apiExposed
294
+ };
295
+ let qblWithStatus_consumedEventTypes = [];
296
+ let qblWithStatus_linkedWriteSide = ["Plugin"];
297
+ let qblWithStatus_searchableFields = ["name"];
298
+ let qblWithStatus_statusField = "status";
299
+ let qblWithStatus = {
300
+ name: "Plugin",
301
+ queryField: "Platform_Plugins",
302
+ schema: "{}",
303
+ consumedEventTypes: qblWithStatus_consumedEventTypes,
304
+ linkedWriteSide: qblWithStatus_linkedWriteSide,
305
+ labelField: "name",
306
+ searchableFields: qblWithStatus_searchableFields,
307
+ statusField: qblWithStatus_statusField,
308
+ visibility: undefined,
309
+ chapter: undefined
310
+ };
311
+ let wblWithStates_commands = [cmdWithStates];
312
+ let wblWithStates_producedEventTypes = [];
313
+ let wblWithStates_consumedEventTypes = [];
314
+ let wblWithStates_linkedViews = ["Plugin"];
315
+ let wblWithStates_events = [];
316
+ let wblWithStates = {
317
+ name: "Plugin",
318
+ commands: wblWithStates_commands,
319
+ producedEventTypes: wblWithStates_producedEventTypes,
320
+ consumedEventTypes: wblWithStates_consumedEventTypes,
321
+ linkedViews: wblWithStates_linkedViews,
322
+ consistencyRead: undefined,
323
+ events: wblWithStates_events,
324
+ chapter: undefined
325
+ };
326
+ let structureWithStates_readModels = [qblWithStatus];
327
+ let structureWithStates_stateViewSlices = [];
328
+ let structureWithStates_stateChangeSlices = [];
329
+ let structureWithStates_aggregates = [wblWithStates];
330
+ let structureWithStates_automationSlices = [];
331
+ let structureWithStates_outboundTranslationSlices = [];
332
+ let structureWithStates_inboundTranslationSlices = [];
333
+ let structureWithStates_extensions = [];
334
+ let structureWithStates = {
335
+ readModels: structureWithStates_readModels,
336
+ stateViewSlices: structureWithStates_stateViewSlices,
337
+ stateChangeSlices: structureWithStates_stateChangeSlices,
338
+ aggregates: structureWithStates_aggregates,
339
+ automationSlices: structureWithStates_automationSlices,
340
+ outboundTranslationSlices: structureWithStates_outboundTranslationSlices,
341
+ inboundTranslationSlices: structureWithStates_inboundTranslationSlices,
342
+ extensions: structureWithStates_extensions,
343
+ extensionPoints: undefined
344
+ };
345
+ let json = JSON.stringify(Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Platform", structureWithStates));
346
+ globalThis.test("encodes populated allowedStates as a JSON array", () => {
347
+ globalThis.expect(json.includes("\"allowedStates\":[\"Inactive\"]")).toEqual(true);
348
+ });
349
+ globalThis.test("round-trips a declared targetState as the status string", () => {
350
+ globalThis.expect(json.includes("\"targetState\":\"Active\"")).toEqual(true);
351
+ });
352
+ globalThis.test("encodes populated statusField as the field name string", () => {
353
+ globalThis.expect(json.includes("\"statusField\":\"status\"")).toEqual(true);
354
+ });
355
+ });
356
+
357
+ export {
358
+ cmd,
359
+ qbl,
360
+ wbl,
361
+ structure,
362
+ encoded,
363
+ json,
364
+ }
365
+ /* encoded Not a pure module */
@@ -0,0 +1,101 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
4
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
+ import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
6
+ import * as Platform_UIFragmentsApi$ReventlessCore from "../../src/admin/Platform_UIFragmentsApi.res.mjs";
7
+
8
+ let panel_positions = ["platform-summary"];
9
+
10
+ let panel = {
11
+ fragmentId: "Catalog.Categories.list",
12
+ title: "Categories",
13
+ description: "",
14
+ positions: panel_positions,
15
+ requiredAccess: undefined
16
+ };
17
+
18
+ let page = {
19
+ fragmentId: "Catalog.Categories.list",
20
+ title: "Categories",
21
+ menuEntry: {
22
+ label: "Categories",
23
+ icon: undefined,
24
+ group: undefined,
25
+ sortOrder: 0
26
+ },
27
+ requiredAccess: "admin"
28
+ };
29
+
30
+ let state_panels = [panel];
31
+
32
+ let state_pages = [page];
33
+
34
+ let state = {
35
+ pluginId: "Catalog",
36
+ remoteEntryUrl: "https://cdn.example.com/catalog@1.0/remoteEntry.js",
37
+ panels: state_panels,
38
+ pages: state_pages,
39
+ registeredAt: "2026-05-14T00:00:00.000Z",
40
+ updatedAt: "2026-05-14T00:00:00.000Z"
41
+ };
42
+
43
+ let encoded = Platform_UIFragmentsApi$ReventlessCore.encodeUIFragmentEntry(state);
44
+
45
+ let json = JSON.stringify(encoded);
46
+
47
+ globalThis.describe("encodeUIFragmentEntry", () => {
48
+ globalThis.test("produces a JSON object with the expected top-level keys", () => {
49
+ let dict = Stdlib_Option.getOr(Stdlib_JSON.Decode.object(encoded), {});
50
+ let keys = Object.keys(dict).toSorted(Primitive_string.compare);
51
+ globalThis.expect(keys).toEqual([
52
+ "pages",
53
+ "panels",
54
+ "pluginId",
55
+ "registeredAt",
56
+ "remoteEntryUrl",
57
+ "updatedAt"
58
+ ]);
59
+ });
60
+ globalThis.test("encodes pluginId", () => {
61
+ globalThis.expect(json.includes("\"pluginId\":\"Catalog\"")).toEqual(true);
62
+ });
63
+ globalThis.test("encodes remoteEntryUrl", () => {
64
+ globalThis.expect(json.includes("\"remoteEntryUrl\":\"https://cdn.example.com/catalog@1.0/remoteEntry.js\"")).toEqual(true);
65
+ });
66
+ globalThis.test("encodes None requiredAccess on panel as null", () => {
67
+ globalThis.expect(json.includes("\"requiredAccess\":null")).toEqual(true);
68
+ });
69
+ globalThis.test("encodes Some requiredAccess on page as its inner string", () => {
70
+ globalThis.expect(json.includes("\"requiredAccess\":\"admin\"")).toEqual(true);
71
+ });
72
+ globalThis.test("encodes nested menuEntry as an object with sortOrder", () => {
73
+ globalThis.expect(json.includes("\"sortOrder\":0")).toEqual(true);
74
+ });
75
+ globalThis.test("encodes panel positions as an array of strings", () => {
76
+ globalThis.expect(json.includes("\"positions\":[\"platform-summary\"]")).toEqual(true);
77
+ });
78
+ });
79
+
80
+ globalThis.describe("Platform_UIFragmentsApi.sdl", () => {
81
+ globalThis.test("query field declares the list type", () => {
82
+ globalThis.expect(Platform_UIFragmentsApi$ReventlessCore.sdlQueryField.includes("[Platform_UIFragmentEntry!]!")).toEqual(true);
83
+ });
84
+ globalThis.test("sdlTypes includes Platform_UIFragmentEntry", () => {
85
+ let allTypes = Platform_UIFragmentsApi$ReventlessCore.sdlTypes.join("\n");
86
+ globalThis.expect(allTypes.includes("Platform_UIFragmentEntry")).toEqual(true);
87
+ });
88
+ globalThis.test("sdlTypes includes Platform_UIPanel with positions field", () => {
89
+ let allTypes = Platform_UIFragmentsApi$ReventlessCore.sdlTypes.join("\n");
90
+ globalThis.expect(allTypes.includes("positions: [String!]!")).toEqual(true);
91
+ });
92
+ });
93
+
94
+ export {
95
+ panel,
96
+ page,
97
+ state,
98
+ encoded,
99
+ json,
100
+ }
101
+ /* encoded Not a pure module */