@reventlessdev/reventless-core 3.0.0-alpha.239 → 3.0.0-alpha.240
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/CHANGELOG.md +28 -0
- package/package.json +9 -9
- package/src/Message.res +11 -11
- package/src/Message.res.mjs +15 -14
- package/src/Projection.res +2 -2
- package/src/Projection.res.mjs +5 -4
- package/src/adapter/Monitoring/Monitoring.res +24 -2
- package/src/adapter/Monitoring/Monitoring.res.mjs +3 -3
- package/src/admin/Platform_AdminApi.res.mjs +3 -3
- package/src/admin/Platform_Admin_Structure.res +33 -113
- package/src/admin/Platform_Admin_Structure.res.mjs +8 -139
- package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +12 -12
- package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs +14 -14
- package/src/components/Aggregate/Aggregate_Callback.res +2 -2
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +4 -4
- package/src/components/Api/ApiAllowedStatesHelpers.res.mjs +3 -3
- package/src/components/Api/ApiNoApiHelpers.res.mjs +5 -5
- package/src/components/Api/ApiTargetStateHelpers.res.mjs +3 -3
- package/src/components/Api/GraphQL_FragmentGenerator.res +18 -12
- package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +7 -13
- package/src/components/Api/GraphQL_SchemaInspector.res +1 -1
- package/src/components/Api/GraphQL_SchemaInspector.res.mjs +1 -1
- package/src/components/Api/MCP_SchemaGenerator.res +1 -1
- package/src/components/Api/MCP_SchemaGenerator.res.mjs +1 -1
- package/src/components/Api/SchemaType.res +6 -10
- package/src/components/Api/SchemaType.res.mjs +4 -4
- package/src/components/Api/StorageRefFields.res +1 -1
- package/src/components/Api/StorageRefFields.res.mjs +1 -1
- package/src/components/Api/SuryToJsonSchema.res +11 -0
- package/src/components/Api/SuryToJsonSchema.res.mjs +2 -1
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -4
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +22 -23
- package/src/components/CommandTopic/CommandTopic_Callback.res +1 -2
- package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +3 -4
- package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -1
- package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +3 -3
- package/src/components/Counter/Counter.res.mjs +2 -2
- package/src/components/Counter/Counter_Callback.res.mjs +4 -4
- package/src/components/Counter/Counter_Operations.res.mjs +4 -4
- package/src/components/Dcb/Dcb_Builder.res +1 -1
- package/src/components/Dcb/Dcb_Builder.res.mjs +8 -6
- package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +4 -3
- package/src/components/EventCollector/EventCollector_Builder.res +1 -1
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +1 -2
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +11 -12
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +3 -4
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +24 -25
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +1 -1
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +3 -3
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +2 -2
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -4
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +1 -1
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +3 -3
- package/src/plugin/api/PluginBaseFragment.res +12 -29
- package/src/plugin/api/PluginBaseFragment.res.mjs +3 -22
- package/src/plugin/component/Capability_Inference.res +118 -1
- package/src/plugin/component/Capability_Inference.res.mjs +128 -1
- package/src/plugin/component/Plugin_Builder.res +2 -2
- package/src/plugin/component/Plugin_Builder.res.mjs +2 -1
- package/src/plugin/component/Plugin_Helpers.res +11 -11
- package/src/plugin/component/Plugin_Helpers.res.mjs +11 -10
- package/src/plugin/component/Plugin_Structure.res +349 -274
- package/src/plugin/component/Plugin_Structure.res.mjs +212 -175
- package/src/plugin/component/Plugin_SubscriptionSchema.res +1 -1
- package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +1 -1
- package/src/plugin/component/SchemaWalker.res +11 -11
- package/src/plugin/component/SchemaWalker.res.mjs +8 -9
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +15 -15
- package/src/plugin/lifecycle/PluginBehavior.res.mjs +55 -55
- package/src/plugin/lifecycle/PluginSpec.res +22 -7
- package/src/plugin/lifecycle/PluginSpec.res.mjs +91 -36
- package/src/plugin/lifecycle/PluginsReadModelSpec.res +36 -9
- package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +33 -22
- package/src/util/Interstack.res +3 -3
- package/src/util/LogFormat.res +1 -2
- package/src/util/LogFormat.res.mjs +2 -2
- package/tests/IdentityTest.res +6 -7
- package/tests/IdentityTest.res.mjs +7 -9
- package/tests/adapter/MonitoringTest.res +30 -3
- package/tests/adapter/MonitoringTest.res.mjs +31 -12
- package/tests/adapter/RuntimeExtensionHookReachTest.res +0 -1
- package/tests/adapter/RuntimeExtensionHookReachTest.res.mjs +5 -7
- package/tests/admin/Platform_Admin_StructureTest.res +254 -0
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +219 -0
- package/tests/aggregate/AggregateCacheTest.res +0 -1
- package/tests/aggregate/AggregateCacheTest.res.mjs +13 -15
- package/tests/aggregate/AggregateConflictTest.res +0 -1
- package/tests/aggregate/AggregateConflictTest.res.mjs +7 -9
- package/tests/aggregate/AggregateFixtures.res +0 -1
- package/tests/aggregate/AggregateFixtures.res.mjs +19 -21
- package/tests/aggregate/AggregateSnapshotTest.res +1 -2
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +15 -16
- package/tests/api/ApiNoApiTest.res.mjs +17 -9
- package/tests/api/GraphQL_FragmentGeneratorTest.res +62 -1
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +102 -58
- package/tests/api/PsInternalFieldsReadModel.res +21 -0
- package/tests/api/PsInternalFieldsReadModel.res.mjs +74 -0
- package/tests/api/StorageRefFieldsTest.res.mjs +13 -13
- package/tests/api/SuryToJsonSchemaTest.res +43 -0
- package/tests/api/SuryToJsonSchemaTest.res.mjs +352 -849
- package/tests/commandgenerator/CommandGeneratorFixtures.res +0 -1
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +19 -21
- package/tests/commandgenerator/OwnerStampingTest.res +0 -1
- package/tests/commandgenerator/OwnerStampingTest.res.mjs +9 -11
- package/tests/commandtopic/CommandTopicCallbackFixtures.res +0 -1
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +7 -9
- package/tests/counter/CounterFixtures.res +0 -1
- package/tests/counter/CounterFixtures.res.mjs +1 -4
- package/tests/dcb/DcbDecodeTest.res.mjs +24 -24
- package/tests/dcb/DcbEventLogOperationsTest.res +2 -2
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +3 -3
- package/tests/dcb/DcbEventLogSchemaTest.res.mjs +7 -7
- package/tests/dcb/DcbFixtures.res +0 -1
- package/tests/dcb/DcbFixtures.res.mjs +87 -89
- package/tests/dcb/DcbTagTest.res.mjs +6 -6
- package/tests/dcb/DcbValidationTest.res.mjs +52 -52
- package/tests/eventlog/EventLogFixtures.res +0 -1
- package/tests/eventlog/EventLogFixtures.res.mjs +7 -9
- package/tests/eventmapper/EventMapperFixtures.res +0 -1
- package/tests/eventmapper/EventMapperFixtures.res.mjs +24 -26
- package/tests/eventtopic/EventTopicFixtures.res +0 -1
- package/tests/eventtopic/EventTopicFixtures.res.mjs +7 -9
- package/tests/extensionpoint/ExtensionPointFixtures.res +0 -1
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +10 -12
- package/tests/extensionpoint/ExtensionPointOperationsTest.res +1 -2
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -10
- package/tests/logger/LogFormatTest.res +3 -2
- package/tests/logger/LogFormatTest.res.mjs +7 -9
- package/tests/message/MessageTest.res +2 -2
- package/tests/message/MessageTest.res.mjs +8 -7
- package/tests/message/MetaEnvelopeTest.res +5 -5
- package/tests/message/MetaEnvelopeTest.res.mjs +12 -11
- package/tests/plugin/ManifestVisibilityTest.res.mjs +7 -7
- package/tests/plugin/PluginDefinitionScalars.res +5 -3
- package/tests/plugin/PluginDefinitionScalars.res.mjs +2 -2
- package/tests/plugin/PluginLifecycleCorpusTest.res +4 -3
- package/tests/plugin/PluginLifecycleCorpusTest.res.mjs +3 -6
- package/tests/plugin/PluginSpecExperiment.res +0 -1
- package/tests/plugin/PluginSpecExperiment.res.mjs +12 -14
- package/tests/plugin/PluginStructureTest.res +188 -1
- package/tests/plugin/PluginStructureTest.res.mjs +293 -102
- package/tests/plugin/Plugin_EventQuerySchemaTest.res.mjs +3 -3
- package/tests/plugin/SchemaWalkerTest.res +0 -1
- package/tests/plugin/SchemaWalkerTest.res.mjs +17 -19
- package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +9 -9
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +15 -15
- package/tests/plugin/StateChangeSlice/PsTypoStore.res +31 -0
- package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +62 -0
- package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsUploadImages.res +40 -0
- package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +66 -0
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +13 -12
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +8 -8
- package/tests/plugin/StateViewSlice/PsCategoriesView.res.mjs +6 -6
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +10 -10
- package/tests/plugin/StateViewSlice/PsGatedView.res.mjs +6 -6
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +9 -9
- package/tests/plugin/StateViewSlice/PsShipmentsView.res.mjs +11 -10
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +15 -0
- package/tests/querydb/QueryDbFixtures.res +0 -1
- package/tests/querydb/QueryDbFixtures.res.mjs +5 -7
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +0 -1
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -6
- package/tests/util/CommandPublisherTest.res +0 -1
- package/tests/util/CommandPublisherTest.res.mjs +4 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
4
|
-
import * as Stdlib_Exn from "@rescript/runtime/lib/es6/Stdlib_Exn.js";
|
|
3
|
+
import * as Sury from "sury";
|
|
5
4
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
6
5
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
6
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
7
7
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
8
8
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
9
9
|
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
@@ -14,6 +14,7 @@ import * as Reference$Reventless from "@reventlessdev/reventless-spec/src/compon
|
|
|
14
14
|
import * as StorageRef$Reventless from "@reventlessdev/reventless-spec/src/semantic/StorageRef.res.mjs";
|
|
15
15
|
import * as Api_Naming$ReventlessCore from "../../src/components/Api/Api_Naming.res.mjs";
|
|
16
16
|
import * as PsShipOrder$ReventlessCore from "./StateChangeSlice/PsShipOrder.res.mjs";
|
|
17
|
+
import * as PsTypoStore$ReventlessCore from "./StateChangeSlice/PsTypoStore.res.mjs";
|
|
17
18
|
import * as PsOrdersView$ReventlessCore from "./StateViewSlice/PsOrdersView.res.mjs";
|
|
18
19
|
import * as PsPlaceOrder$ReventlessCore from "./StateChangeSlice/PsPlaceOrder.res.mjs";
|
|
19
20
|
import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
|
|
@@ -21,6 +22,7 @@ import * as PsChangePhoto$ReventlessCore from "./StateChangeSlice/PsChangePhoto.
|
|
|
21
22
|
import * as CapabilityManifest$Reventless from "@reventlessdev/reventless-spec/src/components/CapabilityManifest.res.mjs";
|
|
22
23
|
import * as PsReserveStock$ReventlessCore from "./StateChangeSlice/PsReserveStock.res.mjs";
|
|
23
24
|
import * as PsUploadAvatar$ReventlessCore from "./StateChangeSlice/PsUploadAvatar.res.mjs";
|
|
25
|
+
import * as PsUploadImages$ReventlessCore from "./StateChangeSlice/PsUploadImages.res.mjs";
|
|
24
26
|
import * as PsAnnotatedView$ReventlessCore from "./StateViewSlice/PsAnnotatedView.res.mjs";
|
|
25
27
|
import * as PsAttachInvoice$ReventlessCore from "./StateChangeSlice/PsAttachInvoice.res.mjs";
|
|
26
28
|
import * as PsCustomersView$ReventlessCore from "./StateViewSlice/PsCustomersView.res.mjs";
|
|
@@ -282,13 +284,73 @@ let PsUploadAvatarSlice = {
|
|
|
282
284
|
};
|
|
283
285
|
|
|
284
286
|
let Behavior$4 = {
|
|
287
|
+
initialState: false,
|
|
288
|
+
evolve: PsUploadImages$ReventlessCore.evolve,
|
|
289
|
+
decide: PsUploadImages$ReventlessCore.decide,
|
|
290
|
+
moduleUrl: PsUploadImages$ReventlessCore.moduleUrl
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
function make$9(param, param$1, param$2, param$3, param$4, param$5) {
|
|
294
|
+
return 0;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let PsUploadImagesSlice_Spec = {
|
|
298
|
+
name: PsUploadImages$ReventlessCore.name,
|
|
299
|
+
moduleUrl: PsUploadImages$ReventlessCore.moduleUrl,
|
|
300
|
+
Id: Id$Reventless.$$String,
|
|
301
|
+
consumedEventSchema: PsUploadImages$ReventlessCore.consumedEventSchema,
|
|
302
|
+
errorSchema: PsUploadImages$ReventlessCore.errorSchema,
|
|
303
|
+
eventSchema: PsUploadImages$ReventlessCore.eventSchema,
|
|
304
|
+
commandSchema: PsUploadImages$ReventlessCore.commandSchema,
|
|
305
|
+
commandAuthorization: PsUploadImages$ReventlessCore.commandAuthorization,
|
|
306
|
+
readConsistency: PsUploadImages$ReventlessCore.readConsistency
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
let PsUploadImagesSlice = {
|
|
310
|
+
Spec: PsUploadImagesSlice_Spec,
|
|
311
|
+
Behavior: Behavior$4,
|
|
312
|
+
isAsync: false,
|
|
313
|
+
make: make$9
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
let Behavior$5 = {
|
|
317
|
+
initialState: false,
|
|
318
|
+
evolve: PsTypoStore$ReventlessCore.evolve,
|
|
319
|
+
decide: PsTypoStore$ReventlessCore.decide,
|
|
320
|
+
moduleUrl: PsTypoStore$ReventlessCore.moduleUrl
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
function make$10(param, param$1, param$2, param$3, param$4, param$5) {
|
|
324
|
+
return 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let PsTypoStoreSlice_Spec = {
|
|
328
|
+
name: PsTypoStore$ReventlessCore.name,
|
|
329
|
+
moduleUrl: PsTypoStore$ReventlessCore.moduleUrl,
|
|
330
|
+
Id: Id$Reventless.$$String,
|
|
331
|
+
consumedEventSchema: PsTypoStore$ReventlessCore.consumedEventSchema,
|
|
332
|
+
errorSchema: PsTypoStore$ReventlessCore.errorSchema,
|
|
333
|
+
eventSchema: PsTypoStore$ReventlessCore.eventSchema,
|
|
334
|
+
commandSchema: PsTypoStore$ReventlessCore.commandSchema,
|
|
335
|
+
commandAuthorization: PsTypoStore$ReventlessCore.commandAuthorization,
|
|
336
|
+
readConsistency: PsTypoStore$ReventlessCore.readConsistency
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
let PsTypoStoreSlice = {
|
|
340
|
+
Spec: PsTypoStoreSlice_Spec,
|
|
341
|
+
Behavior: Behavior$5,
|
|
342
|
+
isAsync: false,
|
|
343
|
+
make: make$10
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
let Behavior$6 = {
|
|
285
347
|
initialState: false,
|
|
286
348
|
evolve: PsChangePhoto$ReventlessCore.evolve,
|
|
287
349
|
decide: PsChangePhoto$ReventlessCore.decide,
|
|
288
350
|
moduleUrl: PsChangePhoto$ReventlessCore.moduleUrl
|
|
289
351
|
};
|
|
290
352
|
|
|
291
|
-
function make$
|
|
353
|
+
function make$11(param, param$1, param$2, param$3, param$4, param$5) {
|
|
292
354
|
return 0;
|
|
293
355
|
}
|
|
294
356
|
|
|
@@ -306,19 +368,19 @@ let PsChangePhotoSlice_Spec = {
|
|
|
306
368
|
|
|
307
369
|
let PsChangePhotoSlice = {
|
|
308
370
|
Spec: PsChangePhotoSlice_Spec,
|
|
309
|
-
Behavior: Behavior$
|
|
371
|
+
Behavior: Behavior$6,
|
|
310
372
|
isAsync: false,
|
|
311
|
-
make: make$
|
|
373
|
+
make: make$11
|
|
312
374
|
};
|
|
313
375
|
|
|
314
|
-
let Behavior$
|
|
376
|
+
let Behavior$7 = {
|
|
315
377
|
initialState: false,
|
|
316
378
|
evolve: PsReserveStock$ReventlessCore.evolve,
|
|
317
379
|
decide: PsReserveStock$ReventlessCore.decide,
|
|
318
380
|
moduleUrl: PsReserveStock$ReventlessCore.moduleUrl
|
|
319
381
|
};
|
|
320
382
|
|
|
321
|
-
function make$
|
|
383
|
+
function make$12(param, param$1, param$2, param$3, param$4, param$5) {
|
|
322
384
|
return 0;
|
|
323
385
|
}
|
|
324
386
|
|
|
@@ -336,19 +398,19 @@ let PsReserveStockSlice_Spec = {
|
|
|
336
398
|
|
|
337
399
|
let PsReserveStockSlice = {
|
|
338
400
|
Spec: PsReserveStockSlice_Spec,
|
|
339
|
-
Behavior: Behavior$
|
|
401
|
+
Behavior: Behavior$7,
|
|
340
402
|
isAsync: false,
|
|
341
|
-
make: make$
|
|
403
|
+
make: make$12
|
|
342
404
|
};
|
|
343
405
|
|
|
344
|
-
let Behavior$
|
|
406
|
+
let Behavior$8 = {
|
|
345
407
|
initialState: false,
|
|
346
408
|
evolve: PsDispatchShipment$ReventlessCore.evolve,
|
|
347
409
|
decide: PsDispatchShipment$ReventlessCore.decide,
|
|
348
410
|
moduleUrl: PsDispatchShipment$ReventlessCore.moduleUrl
|
|
349
411
|
};
|
|
350
412
|
|
|
351
|
-
function make$
|
|
413
|
+
function make$13(param, param$1, param$2, param$3, param$4, param$5) {
|
|
352
414
|
return 0;
|
|
353
415
|
}
|
|
354
416
|
|
|
@@ -366,9 +428,9 @@ let PsDispatchShipmentSlice_Spec = {
|
|
|
366
428
|
|
|
367
429
|
let PsDispatchShipmentSlice = {
|
|
368
430
|
Spec: PsDispatchShipmentSlice_Spec,
|
|
369
|
-
Behavior: Behavior$
|
|
431
|
+
Behavior: Behavior$8,
|
|
370
432
|
isAsync: false,
|
|
371
|
-
make: make$
|
|
433
|
+
make: make$13
|
|
372
434
|
};
|
|
373
435
|
|
|
374
436
|
let Projection$5 = {
|
|
@@ -376,7 +438,7 @@ let Projection$5 = {
|
|
|
376
438
|
moduleUrl: PsShipmentsView$ReventlessCore.moduleUrl
|
|
377
439
|
};
|
|
378
440
|
|
|
379
|
-
function make$
|
|
441
|
+
function make$14(param, param$1, param$2) {
|
|
380
442
|
return 0;
|
|
381
443
|
}
|
|
382
444
|
|
|
@@ -394,7 +456,7 @@ let PsShipmentsViewSlice_Spec = {
|
|
|
394
456
|
let PsShipmentsViewSlice = {
|
|
395
457
|
Spec: PsShipmentsViewSlice_Spec,
|
|
396
458
|
Projection: Projection$5,
|
|
397
|
-
make: make$
|
|
459
|
+
make: make$14
|
|
398
460
|
};
|
|
399
461
|
|
|
400
462
|
let structure = Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, [
|
|
@@ -474,8 +536,8 @@ globalThis.describe("@transition cross-check", () => {
|
|
|
474
536
|
return;
|
|
475
537
|
} catch (raw_e) {
|
|
476
538
|
let e = Primitive_exceptions.internalToException(raw_e);
|
|
477
|
-
if (e.RE_EXN_ID ===
|
|
478
|
-
return Stdlib_Option.getOr(e._1
|
|
539
|
+
if (e.RE_EXN_ID === "JsExn") {
|
|
540
|
+
return Stdlib_Option.getOr(Stdlib_JsExn.message(e._1), "");
|
|
479
541
|
} else {
|
|
480
542
|
return "";
|
|
481
543
|
}
|
|
@@ -740,7 +802,7 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
740
802
|
];
|
|
741
803
|
};
|
|
742
804
|
globalThis.test("a DateTime is not a name — a state whose only string is one falls to id", () => {
|
|
743
|
-
let schema =
|
|
805
|
+
let schema = Sury.$schema(s => ({
|
|
744
806
|
orderId: s.m(Reference$Reventless.to_(undefined, undefined, "Order")),
|
|
745
807
|
placedAt: s.m(DateTime$Reventless.string),
|
|
746
808
|
shippedAt: s.m(DateTime$Reventless.string)
|
|
@@ -751,9 +813,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
751
813
|
]);
|
|
752
814
|
});
|
|
753
815
|
globalThis.test("a DateTime is skipped, not fatal — a later plain string still wins", () => {
|
|
754
|
-
let schema =
|
|
816
|
+
let schema = Sury.$schema(s => ({
|
|
755
817
|
placedAt: s.m(DateTime$Reventless.string),
|
|
756
|
-
reference: s.m(
|
|
818
|
+
reference: s.m(Sury.string)
|
|
757
819
|
}));
|
|
758
820
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
759
821
|
"reference",
|
|
@@ -761,8 +823,8 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
761
823
|
]);
|
|
762
824
|
});
|
|
763
825
|
globalThis.test("an optional string is still the entity's name", () => {
|
|
764
|
-
let schema =
|
|
765
|
-
nickname: s.m(
|
|
826
|
+
let schema = Sury.$schema(s => ({
|
|
827
|
+
nickname: s.m(Sury.$option(Sury.string))
|
|
766
828
|
}));
|
|
767
829
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
768
830
|
"nickname",
|
|
@@ -770,9 +832,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
770
832
|
]);
|
|
771
833
|
});
|
|
772
834
|
globalThis.test("a reference is not a name even when its field is not called `*Id`", () => {
|
|
773
|
-
let schema =
|
|
835
|
+
let schema = Sury.$schema(s => ({
|
|
774
836
|
customer: s.m(Reference$Reventless.to_(undefined, undefined, "Customer")),
|
|
775
|
-
note: s.m(
|
|
837
|
+
note: s.m(Sury.string)
|
|
776
838
|
}));
|
|
777
839
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
778
840
|
"note",
|
|
@@ -780,9 +842,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
780
842
|
]);
|
|
781
843
|
});
|
|
782
844
|
globalThis.test("a DCB-tagged string is not a name", () => {
|
|
783
|
-
let schema =
|
|
845
|
+
let schema = Sury.$schema(s => ({
|
|
784
846
|
partition: s.m(DcbTag$Reventless.string),
|
|
785
|
-
note: s.m(
|
|
847
|
+
note: s.m(Sury.string)
|
|
786
848
|
}));
|
|
787
849
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
788
850
|
"note",
|
|
@@ -790,9 +852,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
790
852
|
]);
|
|
791
853
|
});
|
|
792
854
|
globalThis.test("the `*Id` test is case-insensitive — `productID` is a reference", () => {
|
|
793
|
-
let schema =
|
|
794
|
-
productID: s.m(
|
|
795
|
-
note: s.m(
|
|
855
|
+
let schema = Sury.$schema(s => ({
|
|
856
|
+
productID: s.m(Sury.string),
|
|
857
|
+
note: s.m(Sury.string)
|
|
796
858
|
}));
|
|
797
859
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
798
860
|
"note",
|
|
@@ -800,9 +862,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
800
862
|
]);
|
|
801
863
|
});
|
|
802
864
|
globalThis.test("a semantic-carrying string is a value, not a name", () => {
|
|
803
|
-
let schema =
|
|
865
|
+
let schema = Sury.$schema(s => ({
|
|
804
866
|
imageUrl: s.m(StorageRef$Reventless.forStore(undefined, "productImages")),
|
|
805
|
-
note: s.m(
|
|
867
|
+
note: s.m(Sury.string)
|
|
806
868
|
}));
|
|
807
869
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
808
870
|
"note",
|
|
@@ -810,7 +872,7 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
810
872
|
]);
|
|
811
873
|
});
|
|
812
874
|
globalThis.test("a state whose only string is a semantic falls to id", () => {
|
|
813
|
-
let schema =
|
|
875
|
+
let schema = Sury.$schema(s => ({
|
|
814
876
|
imageUrl: s.m(StorageRef$Reventless.forStore(undefined, "productImages"))
|
|
815
877
|
}));
|
|
816
878
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
@@ -819,9 +881,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
819
881
|
]);
|
|
820
882
|
});
|
|
821
883
|
globalThis.test("`id` itself is still excluded by name", () => {
|
|
822
|
-
let schema =
|
|
823
|
-
id: s.m(
|
|
824
|
-
note: s.m(
|
|
884
|
+
let schema = Sury.$schema(s => ({
|
|
885
|
+
id: s.m(Sury.string),
|
|
886
|
+
note: s.m(Sury.string)
|
|
825
887
|
}));
|
|
826
888
|
globalThis.expect(labelOf(undefined, schema)).toEqual([
|
|
827
889
|
"note",
|
|
@@ -838,9 +900,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
838
900
|
];
|
|
839
901
|
};
|
|
840
902
|
globalThis.test("a field named `name` beats an earlier string", () => {
|
|
841
|
-
let schema =
|
|
842
|
-
sku: s.m(
|
|
843
|
-
name: s.m(
|
|
903
|
+
let schema = Sury.$schema(s => ({
|
|
904
|
+
sku: s.m(Sury.string),
|
|
905
|
+
name: s.m(Sury.string)
|
|
844
906
|
}));
|
|
845
907
|
globalThis.expect(labelOf(schema)).toEqual([
|
|
846
908
|
"name",
|
|
@@ -848,9 +910,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
848
910
|
]);
|
|
849
911
|
});
|
|
850
912
|
globalThis.test("`title` counts too, case-insensitively", () => {
|
|
851
|
-
let schema =
|
|
852
|
-
body: s.m(
|
|
853
|
-
Title: s.m(
|
|
913
|
+
let schema = Sury.$schema(s => ({
|
|
914
|
+
body: s.m(Sury.string),
|
|
915
|
+
Title: s.m(Sury.string)
|
|
854
916
|
}));
|
|
855
917
|
globalThis.expect(labelOf(schema)).toEqual([
|
|
856
918
|
"Title",
|
|
@@ -858,9 +920,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
858
920
|
]);
|
|
859
921
|
});
|
|
860
922
|
globalThis.test("the match is exact — `customerName` is a customer's name, not this record's", () => {
|
|
861
|
-
let schema =
|
|
862
|
-
customerName: s.m(
|
|
863
|
-
note: s.m(
|
|
923
|
+
let schema = Sury.$schema(s => ({
|
|
924
|
+
customerName: s.m(Sury.string),
|
|
925
|
+
note: s.m(Sury.string)
|
|
864
926
|
}));
|
|
865
927
|
globalThis.expect(labelOf(schema)).toEqual([
|
|
866
928
|
"customerName",
|
|
@@ -868,9 +930,9 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
868
930
|
]);
|
|
869
931
|
});
|
|
870
932
|
globalThis.test("an optional `name` still outranks an earlier string", () => {
|
|
871
|
-
let schema =
|
|
872
|
-
sku: s.m(
|
|
873
|
-
name: s.m(
|
|
933
|
+
let schema = Sury.$schema(s => ({
|
|
934
|
+
sku: s.m(Sury.string),
|
|
935
|
+
name: s.m(Sury.$option(Sury.string))
|
|
874
936
|
}));
|
|
875
937
|
globalThis.expect(labelOf(schema)).toEqual([
|
|
876
938
|
"name",
|
|
@@ -891,21 +953,21 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
891
953
|
]);
|
|
892
954
|
});
|
|
893
955
|
globalThis.test("a field named `name` is a guess the consumer can also make", () => {
|
|
894
|
-
let schema =
|
|
895
|
-
sku: s.m(
|
|
896
|
-
name: s.m(
|
|
956
|
+
let schema = Sury.$schema(s => ({
|
|
957
|
+
sku: s.m(Sury.string),
|
|
958
|
+
name: s.m(Sury.string)
|
|
897
959
|
}));
|
|
898
960
|
globalThis.expect(sourceOf(schema)).toEqual("convention");
|
|
899
961
|
});
|
|
900
962
|
globalThis.test("declaration order is a guess only this side can make", () => {
|
|
901
|
-
let schema =
|
|
902
|
-
customerName: s.m(
|
|
903
|
-
note: s.m(
|
|
963
|
+
let schema = Sury.$schema(s => ({
|
|
964
|
+
customerName: s.m(Sury.string),
|
|
965
|
+
note: s.m(Sury.string)
|
|
904
966
|
}));
|
|
905
967
|
globalThis.expect(sourceOf(schema)).toEqual("position");
|
|
906
968
|
});
|
|
907
969
|
globalThis.test("no candidate at all is the state saying it has no human field", () => {
|
|
908
|
-
let schema =
|
|
970
|
+
let schema = Sury.$schema(s => ({
|
|
909
971
|
orderId: s.m(Reference$Reventless.to_(undefined, undefined, "Order")),
|
|
910
972
|
placedAt: s.m(DateTime$Reventless.string)
|
|
911
973
|
}));
|
|
@@ -965,7 +1027,7 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
965
1027
|
});
|
|
966
1028
|
});
|
|
967
1029
|
globalThis.describe("lifecycleField — the name rule and the shape rule", () => {
|
|
968
|
-
let withLifecycle = (schema, field) =>
|
|
1030
|
+
let withLifecycle = (schema, field) => Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
969
1031
|
ids: [],
|
|
970
1032
|
compositeIds: [],
|
|
971
1033
|
subIds: [],
|
|
@@ -987,50 +1049,50 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
987
1049
|
retired: undefined
|
|
988
1050
|
});
|
|
989
1051
|
globalThis.test("a `lifecycle` field holding a closed set of values is the lifecycle field", () => {
|
|
990
|
-
let schema =
|
|
991
|
-
lifecycle: s.m(
|
|
992
|
-
|
|
993
|
-
|
|
1052
|
+
let schema = Sury.$schema(s => ({
|
|
1053
|
+
lifecycle: s.m(Sury.union([
|
|
1054
|
+
Sury.literal("Placed"),
|
|
1055
|
+
Sury.literal("Shipped")
|
|
994
1056
|
]))
|
|
995
1057
|
}));
|
|
996
1058
|
globalThis.expect(Plugin_Structure$ReventlessCore.lifecycleFieldFromStateSchema("Test", schema)).toEqual("lifecycle");
|
|
997
1059
|
});
|
|
998
1060
|
globalThis.test("an optional one counts too", () => {
|
|
999
|
-
let schema =
|
|
1000
|
-
lifecycle: s.m(
|
|
1001
|
-
|
|
1002
|
-
|
|
1061
|
+
let schema = Sury.$schema(s => ({
|
|
1062
|
+
lifecycle: s.m(Sury.$option(Sury.union([
|
|
1063
|
+
Sury.literal("Placed"),
|
|
1064
|
+
Sury.literal("Shipped")
|
|
1003
1065
|
])))
|
|
1004
1066
|
}));
|
|
1005
1067
|
globalThis.expect(Plugin_Structure$ReventlessCore.lifecycleFieldFromStateSchema("Test", schema)).toEqual("lifecycle");
|
|
1006
1068
|
});
|
|
1007
1069
|
globalThis.test("free text named `lifecycle` is not a lifecycle", () => {
|
|
1008
|
-
let schema =
|
|
1009
|
-
lifecycle: s.m(
|
|
1070
|
+
let schema = Sury.$schema(s => ({
|
|
1071
|
+
lifecycle: s.m(Sury.string)
|
|
1010
1072
|
}));
|
|
1011
1073
|
globalThis.expect(Plugin_Structure$ReventlessCore.lifecycleFieldFromStateSchema("Test", schema)).toEqual(undefined);
|
|
1012
1074
|
});
|
|
1013
1075
|
globalThis.test("an unannotated field named `status` resolves to None", () => {
|
|
1014
|
-
let schema =
|
|
1015
|
-
status: s.m(
|
|
1016
|
-
|
|
1017
|
-
|
|
1076
|
+
let schema = Sury.$schema(s => ({
|
|
1077
|
+
status: s.m(Sury.union([
|
|
1078
|
+
Sury.literal("Placed"),
|
|
1079
|
+
Sury.literal("Shipped")
|
|
1018
1080
|
]))
|
|
1019
1081
|
}));
|
|
1020
1082
|
globalThis.expect(Plugin_Structure$ReventlessCore.lifecycleFieldFromStateSchema("Test", schema)).toEqual(undefined);
|
|
1021
1083
|
});
|
|
1022
1084
|
globalThis.test("the annotation names a field the convention would never reach", () => {
|
|
1023
|
-
let schema =
|
|
1024
|
-
locationStatus: s.m(
|
|
1025
|
-
|
|
1026
|
-
|
|
1085
|
+
let schema = Sury.$schema(s => ({
|
|
1086
|
+
locationStatus: s.m(Sury.union([
|
|
1087
|
+
Sury.literal("Pending"),
|
|
1088
|
+
Sury.literal("Located")
|
|
1027
1089
|
]))
|
|
1028
1090
|
}));
|
|
1029
1091
|
globalThis.expect(Plugin_Structure$ReventlessCore.lifecycleFieldFromStateSchema("Test", withLifecycle(schema, "locationStatus"))).toEqual("locationStatus");
|
|
1030
1092
|
});
|
|
1031
1093
|
});
|
|
1032
1094
|
globalThis.describe("retiredField — annotation and nothing else", () => {
|
|
1033
|
-
let withRetired = (schema, field) =>
|
|
1095
|
+
let withRetired = (schema, field) => Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
1034
1096
|
ids: [],
|
|
1035
1097
|
compositeIds: [],
|
|
1036
1098
|
subIds: [],
|
|
@@ -1058,7 +1120,7 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1058
1120
|
}
|
|
1059
1121
|
});
|
|
1060
1122
|
globalThis.test("publishes the retirement state beside the field", () => {
|
|
1061
|
-
let withState = schema =>
|
|
1123
|
+
let withState = schema => Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
1062
1124
|
ids: [],
|
|
1063
1125
|
compositeIds: [],
|
|
1064
1126
|
subIds: [],
|
|
@@ -1088,8 +1150,8 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1088
1150
|
namedWhenRetired: false
|
|
1089
1151
|
}
|
|
1090
1152
|
});
|
|
1091
|
-
let schema = withState(
|
|
1092
|
-
accountStatus: s.m(
|
|
1153
|
+
let schema = withState(Sury.$schema(s => ({
|
|
1154
|
+
accountStatus: s.m(Sury.string)
|
|
1093
1155
|
})));
|
|
1094
1156
|
globalThis.expect([
|
|
1095
1157
|
Plugin_Structure$ReventlessCore.retiredFieldFromStateSchema(schema),
|
|
@@ -1103,33 +1165,33 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1103
1165
|
]);
|
|
1104
1166
|
});
|
|
1105
1167
|
globalThis.test("publishes no states on the boolean form", () => {
|
|
1106
|
-
let schema =
|
|
1107
|
-
archived: s.m(
|
|
1168
|
+
let schema = Sury.$schema(s => ({
|
|
1169
|
+
archived: s.m(Sury.bool)
|
|
1108
1170
|
}));
|
|
1109
1171
|
globalThis.expect(Plugin_Structure$ReventlessCore.retiredValuesFromStateSchema(withRetired(schema, "archived"))).toEqual(undefined);
|
|
1110
1172
|
});
|
|
1111
1173
|
globalThis.test("names the annotated field", () => {
|
|
1112
|
-
let schema =
|
|
1113
|
-
archived: s.m(
|
|
1174
|
+
let schema = Sury.$schema(s => ({
|
|
1175
|
+
archived: s.m(Sury.bool)
|
|
1114
1176
|
}));
|
|
1115
1177
|
globalThis.expect(Plugin_Structure$ReventlessCore.retiredFieldFromStateSchema(withRetired(schema, "archived"))).toEqual("archived");
|
|
1116
1178
|
});
|
|
1117
1179
|
globalThis.test("declines a conventionally-named boolean nobody annotated", () => {
|
|
1118
|
-
let schema =
|
|
1119
|
-
archived: s.m(
|
|
1120
|
-
deactivated: s.m(
|
|
1180
|
+
let schema = Sury.$schema(s => ({
|
|
1181
|
+
archived: s.m(Sury.bool),
|
|
1182
|
+
deactivated: s.m(Sury.bool)
|
|
1121
1183
|
}));
|
|
1122
1184
|
globalThis.expect(Plugin_Structure$ReventlessCore.retiredFieldFromStateSchema(schema)).toEqual(undefined);
|
|
1123
1185
|
});
|
|
1124
1186
|
globalThis.test("declines a schema carrying no annotation spec at all", () => {
|
|
1125
|
-
let schema =
|
|
1126
|
-
id: s.m(
|
|
1187
|
+
let schema = Sury.$schema(s => ({
|
|
1188
|
+
id: s.m(Sury.string)
|
|
1127
1189
|
}));
|
|
1128
1190
|
globalThis.expect(Plugin_Structure$ReventlessCore.retiredFieldFromStateSchema(schema)).toEqual(undefined);
|
|
1129
1191
|
});
|
|
1130
1192
|
});
|
|
1131
1193
|
globalThis.describe("@retired state names are checked against the field's own enum", () => {
|
|
1132
|
-
let withRetiredStates = (schema, field, lifecycle, values) =>
|
|
1194
|
+
let withRetiredStates = (schema, field, lifecycle, values) => Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
1133
1195
|
ids: [],
|
|
1134
1196
|
compositeIds: [],
|
|
1135
1197
|
subIds: [],
|
|
@@ -1156,10 +1218,10 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1156
1218
|
namedWhenRetired: false
|
|
1157
1219
|
}
|
|
1158
1220
|
});
|
|
1159
|
-
let shelf = values => withRetiredStates(
|
|
1160
|
-
shelf: s.m(
|
|
1161
|
-
|
|
1162
|
-
|
|
1221
|
+
let shelf = values => withRetiredStates(Sury.$schema(s => ({
|
|
1222
|
+
shelf: s.m(Sury.union([
|
|
1223
|
+
Sury.literal("Listed"),
|
|
1224
|
+
Sury.literal("Archived")
|
|
1163
1225
|
]))
|
|
1164
1226
|
})), "shelf", "shelf", values);
|
|
1165
1227
|
globalThis.test("a declared state passes", () => {
|
|
@@ -1195,8 +1257,8 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1195
1257
|
globalThis.expect(failures$1.every(f => f.includes("Listed, Archived"))).toBe(true);
|
|
1196
1258
|
});
|
|
1197
1259
|
globalThis.test("a field with no cases to compare against says so instead of passing", () => {
|
|
1198
|
-
let schema = withRetiredStates(
|
|
1199
|
-
shelf: s.m(
|
|
1260
|
+
let schema = withRetiredStates(Sury.$schema(s => ({
|
|
1261
|
+
shelf: s.m(Sury.string)
|
|
1200
1262
|
})), "shelf", "shelf", ["Archived"]);
|
|
1201
1263
|
let why = Plugin_Structure$ReventlessCore.checkRetiredValue("Products", schema);
|
|
1202
1264
|
if (typeof why !== "object") {
|
|
@@ -1216,20 +1278,20 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1216
1278
|
});
|
|
1217
1279
|
});
|
|
1218
1280
|
globalThis.test("the boolean form is not a skip", () => {
|
|
1219
|
-
let schema = withRetiredStates(
|
|
1220
|
-
archived: s.m(
|
|
1281
|
+
let schema = withRetiredStates(Sury.$schema(s => ({
|
|
1282
|
+
archived: s.m(Sury.bool)
|
|
1221
1283
|
})), "archived", undefined, undefined);
|
|
1222
1284
|
globalThis.expect(Plugin_Structure$ReventlessCore.checkRetiredValue("Products", schema)).toEqual("NotDeclared");
|
|
1223
1285
|
});
|
|
1224
1286
|
globalThis.test("a state on a non-lifecycle field is not a failure", () => {
|
|
1225
|
-
let schema = withRetiredStates(
|
|
1226
|
-
shelf: s.m(
|
|
1227
|
-
|
|
1228
|
-
|
|
1287
|
+
let schema = withRetiredStates(Sury.$schema(s => ({
|
|
1288
|
+
shelf: s.m(Sury.union([
|
|
1289
|
+
Sury.literal("Listed"),
|
|
1290
|
+
Sury.literal("Archived")
|
|
1229
1291
|
])),
|
|
1230
|
-
lifecycle: s.m(
|
|
1231
|
-
|
|
1232
|
-
|
|
1292
|
+
lifecycle: s.m(Sury.union([
|
|
1293
|
+
Sury.literal("Draft"),
|
|
1294
|
+
Sury.literal("Live")
|
|
1233
1295
|
]))
|
|
1234
1296
|
})), "shelf", "lifecycle", ["Archived"]);
|
|
1235
1297
|
globalThis.expect(Plugin_Structure$ReventlessCore.checkRetiredValue("Products", schema)).toEqual({
|
|
@@ -1418,6 +1480,133 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1418
1480
|
});
|
|
1419
1481
|
});
|
|
1420
1482
|
});
|
|
1483
|
+
globalThis.describe("uploadable types derive their store from the field name", () => {
|
|
1484
|
+
let withUploads = Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, undefined, [PsUploadImagesSlice], undefined, undefined, undefined, undefined, undefined, undefined);
|
|
1485
|
+
let stores = Stdlib_Option.getOr(withUploads.requiredStores, []);
|
|
1486
|
+
globalThis.test("the derived store is the field name, pluralised", () => {
|
|
1487
|
+
globalThis.expect(stores.includes("TestPlugin.productImages")).toBe(true);
|
|
1488
|
+
});
|
|
1489
|
+
globalThis.test("an optional field still declares its store", () => {
|
|
1490
|
+
globalThis.expect(stores.includes("TestPlugin.categoryImages")).toBe(true);
|
|
1491
|
+
});
|
|
1492
|
+
globalThis.test("an array field declares through its element", () => {
|
|
1493
|
+
globalThis.expect(stores.includes("TestPlugin.datasheets")).toBe(true);
|
|
1494
|
+
});
|
|
1495
|
+
globalThis.test("an explicit @storageRef overrides the derived name", () => {
|
|
1496
|
+
globalThis.expect(stores.includes("branding.logos")).toBe(true);
|
|
1497
|
+
});
|
|
1498
|
+
globalThis.test("nothing else is collected", () => {
|
|
1499
|
+
globalThis.expect(stores.length).toBe(4);
|
|
1500
|
+
});
|
|
1501
|
+
globalThis.test("each requirement keeps its declaring sites", () => {
|
|
1502
|
+
let expected = [
|
|
1503
|
+
{
|
|
1504
|
+
store: "TestPlugin.categoryImages",
|
|
1505
|
+
component: "UploadImages",
|
|
1506
|
+
field: "categoryImage",
|
|
1507
|
+
annotation: "categoryImages"
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
store: "TestPlugin.datasheets",
|
|
1511
|
+
component: "UploadImages",
|
|
1512
|
+
field: "datasheets",
|
|
1513
|
+
annotation: "datasheets"
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
store: "TestPlugin.productImages",
|
|
1517
|
+
component: "UploadImages",
|
|
1518
|
+
field: "productImage",
|
|
1519
|
+
annotation: "productImages"
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
store: "branding.logos",
|
|
1523
|
+
component: "UploadImages",
|
|
1524
|
+
field: "logo",
|
|
1525
|
+
annotation: "branding.logos"
|
|
1526
|
+
}
|
|
1527
|
+
];
|
|
1528
|
+
globalThis.expect(withUploads.requiredStoreDeclarations).toEqual(expected);
|
|
1529
|
+
});
|
|
1530
|
+
let commandJson = JSON.parse(withUploads.stateChangeSlices[0].commands[0].schema);
|
|
1531
|
+
let semanticOf = field => Stdlib_Option.flatMap(Stdlib_Option.flatMap(getPropertyOf(commandJson, field), s => getProperty(s, "x-reventless-semantic")), Stdlib_JSON.Decode.string);
|
|
1532
|
+
globalThis.test("the wire carries the content half, not just the store", () => {
|
|
1533
|
+
globalThis.expect(semanticOf("productImage")).toBe("uploadableImage");
|
|
1534
|
+
});
|
|
1535
|
+
globalThis.test("an overridden field keeps its uploadable semantic", () => {
|
|
1536
|
+
globalThis.expect(semanticOf("logo")).toBe("uploadableImage");
|
|
1537
|
+
});
|
|
1538
|
+
globalThis.test("the non-image arm carries its own id, on the element", () => {
|
|
1539
|
+
globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_Option.flatMap(getPropertyOf(commandJson, "datasheets"), s => getProperty(s, "items")), s => getProperty(s, "x-reventless-semantic")), Stdlib_JSON.Decode.string)).toBe("uploadableFile");
|
|
1540
|
+
});
|
|
1541
|
+
});
|
|
1542
|
+
globalThis.describe("near-duplicate stores are refused", () => {
|
|
1543
|
+
let failureText = () => {
|
|
1544
|
+
try {
|
|
1545
|
+
Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, undefined, [PsTypoStoreSlice], undefined, undefined, undefined, undefined, undefined, undefined);
|
|
1546
|
+
return "";
|
|
1547
|
+
} catch (raw_e) {
|
|
1548
|
+
let e = Primitive_exceptions.internalToException(raw_e);
|
|
1549
|
+
if (e.RE_EXN_ID === "JsExn") {
|
|
1550
|
+
return Stdlib_Option.getOr(Stdlib_JsExn.message(e._1), "(no message)");
|
|
1551
|
+
} else {
|
|
1552
|
+
return "(not a JS error)";
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
globalThis.test("two stores one transposition apart fail the build", () => {
|
|
1557
|
+
globalThis.expect(failureText() !== "").toBe(true);
|
|
1558
|
+
});
|
|
1559
|
+
globalThis.test("the failure names both stores and both fields", () => {
|
|
1560
|
+
let text = failureText();
|
|
1561
|
+
globalThis.expect([
|
|
1562
|
+
text.includes("TestPlugin.productImages"),
|
|
1563
|
+
text.includes("TestPlugin.productImgaes"),
|
|
1564
|
+
text.includes("TypoStore.productImage"),
|
|
1565
|
+
text.includes("@storageRef")
|
|
1566
|
+
]).toEqual([
|
|
1567
|
+
true,
|
|
1568
|
+
true,
|
|
1569
|
+
true,
|
|
1570
|
+
true
|
|
1571
|
+
]);
|
|
1572
|
+
});
|
|
1573
|
+
globalThis.test("the four stores of the uploadable fixture do not collide", () => {
|
|
1574
|
+
globalThis.expect(Capability_Inference$ReventlessCore.collisions(Stdlib_Option.getOr(Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, undefined, [PsUploadImagesSlice], undefined, undefined, undefined, undefined, undefined, undefined).requiredStoreDeclarations, []))).toEqual([]);
|
|
1575
|
+
});
|
|
1576
|
+
globalThis.test("one edit, transpositions included; two edits not", () => {
|
|
1577
|
+
globalThis.expect([
|
|
1578
|
+
[
|
|
1579
|
+
"productImages",
|
|
1580
|
+
"productImgaes"
|
|
1581
|
+
],
|
|
1582
|
+
[
|
|
1583
|
+
"productImages",
|
|
1584
|
+
"productImage"
|
|
1585
|
+
],
|
|
1586
|
+
[
|
|
1587
|
+
"logos",
|
|
1588
|
+
"logo"
|
|
1589
|
+
],
|
|
1590
|
+
[
|
|
1591
|
+
"documents",
|
|
1592
|
+
"logos"
|
|
1593
|
+
],
|
|
1594
|
+
[
|
|
1595
|
+
"productImages",
|
|
1596
|
+
"productImgeas"
|
|
1597
|
+
]
|
|
1598
|
+
].map(param => Capability_Inference$ReventlessCore.withinOneEdit(param[0], param[1]))).toEqual([
|
|
1599
|
+
true,
|
|
1600
|
+
true,
|
|
1601
|
+
true,
|
|
1602
|
+
false,
|
|
1603
|
+
false
|
|
1604
|
+
]);
|
|
1605
|
+
});
|
|
1606
|
+
globalThis.test("a singular/plural pair collides even at two edits apart", () => {
|
|
1607
|
+
globalThis.expect(Capability_Inference$ReventlessCore.sameStem("productImage", "productImages")).toBe(true);
|
|
1608
|
+
});
|
|
1609
|
+
});
|
|
1421
1610
|
globalThis.describe("optional carriers keep their declarations", () => {
|
|
1422
1611
|
let withOptional = Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, undefined, [PsUploadAvatarSlice], undefined, undefined, undefined, undefined, undefined, undefined);
|
|
1423
1612
|
globalThis.test("an optional storage ref still requires its store", () => {
|
|
@@ -1552,6 +1741,8 @@ export {
|
|
|
1552
1741
|
PsCategoriesViewSlice,
|
|
1553
1742
|
PsAttachInvoiceSlice,
|
|
1554
1743
|
PsUploadAvatarSlice,
|
|
1744
|
+
PsUploadImagesSlice,
|
|
1745
|
+
PsTypoStoreSlice,
|
|
1555
1746
|
PsChangePhotoSlice,
|
|
1556
1747
|
PsReserveStockSlice,
|
|
1557
1748
|
PsDispatchShipmentSlice,
|