@reventlessdev/reventless-core 3.0.0-alpha.239 → 3.0.0-alpha.241
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 +35 -0
- package/package.json +11 -11
- 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_Admin.res +1 -16
- package/src/admin/Platform_Admin.res.mjs +2 -30
- package/src/admin/Platform_AdminApi.res.mjs +3 -3
- package/src/admin/Platform_Admin_Structure.res +58 -113
- package/src/admin/Platform_Admin_Structure.res.mjs +24 -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,22 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
3
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
6
|
+
import * as Plugin_Structure$ReventlessCore from "../../src/plugin/component/Plugin_Structure.res.mjs";
|
|
7
|
+
import * as PluginBaseFragment$ReventlessCore from "../../src/plugin/api/PluginBaseFragment.res.mjs";
|
|
8
|
+
import * as PluginsReadModelSpec$ReventlessCore from "../../src/plugin/lifecycle/PluginsReadModelSpec.res.mjs";
|
|
4
9
|
import * as Platform_Admin_Structure$ReventlessCore from "../../src/admin/Platform_Admin_Structure.res.mjs";
|
|
5
10
|
import * as Platform_ComponentDefinitionsApi$ReventlessCore from "../../src/admin/Platform_ComponentDefinitionsApi.res.mjs";
|
|
6
11
|
|
|
12
|
+
function commandNamed(name) {
|
|
13
|
+
return Stdlib_Option.getOrThrow(Platform_Admin_Structure$ReventlessCore.pluginCommands.find(c => c.name === name), `Platform_Admin_Structure publishes no "` + name + `" command`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function activate() {
|
|
17
|
+
return commandNamed("Activate");
|
|
18
|
+
}
|
|
19
|
+
|
|
7
20
|
globalThis.describe("the Plugins read model declares its lifecycle", () => {
|
|
8
21
|
globalThis.test("names the field commands branch on", () => {
|
|
9
22
|
globalThis.expect(Platform_Admin_Structure$ReventlessCore.pluginReadModel.lifecycleField).toEqual("status");
|
|
@@ -21,4 +34,210 @@ globalThis.describe("the Plugins read model declares its lifecycle", () => {
|
|
|
21
34
|
});
|
|
22
35
|
});
|
|
23
36
|
|
|
37
|
+
globalThis.describe("the admin structure's declared transitions are checked", () => {
|
|
38
|
+
let states = Plugin_Structure$ReventlessCore.lifecycleStatesFromStateSchema(PluginsReadModelSpec$ReventlessCore.name, PluginsReadModelSpec$ReventlessCore.stateSchema);
|
|
39
|
+
let statesByView = () => {
|
|
40
|
+
let d = {};
|
|
41
|
+
Stdlib_Option.forEach(states, s => {
|
|
42
|
+
d[PluginsReadModelSpec$ReventlessCore.name] = s;
|
|
43
|
+
});
|
|
44
|
+
return d;
|
|
45
|
+
};
|
|
46
|
+
let raises = writables => {
|
|
47
|
+
try {
|
|
48
|
+
Plugin_Structure$ReventlessCore.checkDeclaredTransitions("Platform", writables, statesByView());
|
|
49
|
+
return false;
|
|
50
|
+
} catch (exn) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
globalThis.test("the linked view yields its lifecycle states", () => {
|
|
55
|
+
globalThis.expect(states).toEqual([
|
|
56
|
+
"Connected",
|
|
57
|
+
"Disconnected",
|
|
58
|
+
"Inactive",
|
|
59
|
+
"Retired"
|
|
60
|
+
]);
|
|
61
|
+
});
|
|
62
|
+
globalThis.test("every state the Plugin commands name is one the view declares", () => {
|
|
63
|
+
globalThis.expect(raises([Platform_Admin_Structure$ReventlessCore.pluginAggregate])).toEqual(false);
|
|
64
|
+
});
|
|
65
|
+
globalThis.test("and a state the view does not declare is caught", () => {
|
|
66
|
+
let init = commandNamed("Activate");
|
|
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
|
+
}];
|
|
81
|
+
let bogus_producedEventTypes = Platform_Admin_Structure$ReventlessCore.pluginAggregate.producedEventTypes;
|
|
82
|
+
let bogus_consumedEventTypes = Platform_Admin_Structure$ReventlessCore.pluginAggregate.consumedEventTypes;
|
|
83
|
+
let bogus_linkedViews = Platform_Admin_Structure$ReventlessCore.pluginAggregate.linkedViews;
|
|
84
|
+
let bogus_consistencyRead = Platform_Admin_Structure$ReventlessCore.pluginAggregate.consistencyRead;
|
|
85
|
+
let bogus_events = Platform_Admin_Structure$ReventlessCore.pluginAggregate.events;
|
|
86
|
+
let bogus_errors = Platform_Admin_Structure$ReventlessCore.pluginAggregate.errors;
|
|
87
|
+
let bogus_chapter = Platform_Admin_Structure$ReventlessCore.pluginAggregate.chapter;
|
|
88
|
+
let bogus = {
|
|
89
|
+
name: bogus_name,
|
|
90
|
+
commands: bogus_commands,
|
|
91
|
+
producedEventTypes: bogus_producedEventTypes,
|
|
92
|
+
consumedEventTypes: bogus_consumedEventTypes,
|
|
93
|
+
linkedViews: bogus_linkedViews,
|
|
94
|
+
consistencyRead: bogus_consistencyRead,
|
|
95
|
+
events: bogus_events,
|
|
96
|
+
errors: bogus_errors,
|
|
97
|
+
chapter: bogus_chapter
|
|
98
|
+
};
|
|
99
|
+
globalThis.expect(raises([bogus])).toEqual(true);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
globalThis.describe("the Plugin command defs carry every argument the SDL requires", () => {
|
|
104
|
+
globalThis.test("the version argument is published", () => {
|
|
105
|
+
globalThis.expect(commandNamed("Activate").schema.includes(`"_0"`)).toEqual(true);
|
|
106
|
+
});
|
|
107
|
+
globalThis.test("and so is the aggregate id", () => {
|
|
108
|
+
globalThis.expect(commandNamed("Activate").aggregateIdField).toEqual(undefined);
|
|
109
|
+
});
|
|
110
|
+
globalThis.test("the exposed commands name the field PluginBaseFragment generates", () => {
|
|
111
|
+
globalThis.expect(Platform_Admin_Structure$ReventlessCore.pluginCommands.filter(c => Primitive_object.notequal(c.apiExposed, false)).map(c => c.mutationField)).toEqual([
|
|
112
|
+
"Platform_Plugin_Activate",
|
|
113
|
+
"Platform_Plugin_Deactivate",
|
|
114
|
+
"Platform_Plugin_Retire"
|
|
115
|
+
]);
|
|
116
|
+
});
|
|
117
|
+
globalThis.test("the internal commands are published as uncallable", () => {
|
|
118
|
+
let internal = Platform_Admin_Structure$ReventlessCore.pluginCommands.filter(c => Primitive_object.equal(c.apiExposed, false));
|
|
119
|
+
globalThis.expect(internal.map(c => c.name)).toEqual([
|
|
120
|
+
"Connect",
|
|
121
|
+
"ReportIncompatibility",
|
|
122
|
+
"Heartbeat",
|
|
123
|
+
"Redetect",
|
|
124
|
+
"Disconnect"
|
|
125
|
+
]);
|
|
126
|
+
globalThis.expect(internal.every(c => c.mutationField === "")).toEqual(true);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
globalThis.describe("the internal commands declare the edges they move rows along", () => {
|
|
131
|
+
let states = Plugin_Structure$ReventlessCore.lifecycleStatesFromStateSchema(PluginsReadModelSpec$ReventlessCore.name, PluginsReadModelSpec$ReventlessCore.stateSchema);
|
|
132
|
+
let statesByView = () => {
|
|
133
|
+
let d = {};
|
|
134
|
+
Stdlib_Option.forEach(states, s => {
|
|
135
|
+
d[PluginsReadModelSpec$ReventlessCore.name] = s;
|
|
136
|
+
});
|
|
137
|
+
return d;
|
|
138
|
+
};
|
|
139
|
+
globalThis.test("the only edge into Disconnected is declared", () => {
|
|
140
|
+
globalThis.expect([
|
|
141
|
+
commandNamed("Disconnect").allowedStates,
|
|
142
|
+
commandNamed("Disconnect").targetState
|
|
143
|
+
]).toEqual([
|
|
144
|
+
["Connected"],
|
|
145
|
+
"Disconnected"
|
|
146
|
+
]);
|
|
147
|
+
});
|
|
148
|
+
globalThis.test("the handshake declares a target and no from-set", () => {
|
|
149
|
+
globalThis.expect([
|
|
150
|
+
commandNamed("Connect").allowedStates,
|
|
151
|
+
commandNamed("Connect").targetState
|
|
152
|
+
]).toEqual([
|
|
153
|
+
undefined,
|
|
154
|
+
"Connected"
|
|
155
|
+
]);
|
|
156
|
+
});
|
|
157
|
+
globalThis.test("and no state is left unreachable", () => {
|
|
158
|
+
globalThis.expect(Plugin_Structure$ReventlessCore.lifecycleTopologyFindings([Platform_Admin_Structure$ReventlessCore.pluginAggregate], statesByView())).toEqual([]);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
globalThis.describe("the Plugins view publishes the rule the server enforces", () => {
|
|
163
|
+
globalThis.test("the spec declares the group", () => {
|
|
164
|
+
globalThis.expect(PluginsReadModelSpec$ReventlessCore.authorization).toEqual({
|
|
165
|
+
TAG: "AllowGroups",
|
|
166
|
+
_0: ["Admin"]
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
globalThis.test("and the published access keys are derived from it", () => {
|
|
170
|
+
globalThis.expect(Platform_Admin_Structure$ReventlessCore.pluginReadModel.requiredAccess).toEqual(["Admin"]);
|
|
171
|
+
});
|
|
172
|
+
globalThis.test("the query entry carries the spec's rule and no hand-written pair", () => {
|
|
173
|
+
let entry = PluginBaseFragment$ReventlessCore.queryEntries[0];
|
|
174
|
+
globalThis.expect([
|
|
175
|
+
entry.permission,
|
|
176
|
+
entry.authorization
|
|
177
|
+
]).toEqual([
|
|
178
|
+
PluginsReadModelSpec$ReventlessCore.authorization,
|
|
179
|
+
undefined
|
|
180
|
+
]);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
globalThis.describe("the Plugins queryableDef is what the generic helpers produce", () => {
|
|
185
|
+
globalThis.test("the field names are the generic ones", () => {
|
|
186
|
+
globalThis.expect([
|
|
187
|
+
Platform_Admin_Structure$ReventlessCore.pluginReadModel.queryField,
|
|
188
|
+
Platform_Admin_Structure$ReventlessCore.pluginReadModel.singleQueryField
|
|
189
|
+
]).toEqual([
|
|
190
|
+
"Platform_Plugins",
|
|
191
|
+
"Platform_Plugin"
|
|
192
|
+
]);
|
|
193
|
+
});
|
|
194
|
+
globalThis.test("the label ladder reaches the same field, by convention", () => {
|
|
195
|
+
globalThis.expect([
|
|
196
|
+
Platform_Admin_Structure$ReventlessCore.pluginReadModel.labelField,
|
|
197
|
+
Platform_Admin_Structure$ReventlessCore.pluginReadModel.labelFieldSource,
|
|
198
|
+
Platform_Admin_Structure$ReventlessCore.pluginReadModel.searchableFields
|
|
199
|
+
]).toEqual([
|
|
200
|
+
"name",
|
|
201
|
+
"convention",
|
|
202
|
+
["name"]
|
|
203
|
+
]);
|
|
204
|
+
});
|
|
205
|
+
globalThis.test("the key ladder finds no id field, as the hand-written def claimed", () => {
|
|
206
|
+
globalThis.expect([
|
|
207
|
+
Platform_Admin_Structure$ReventlessCore.pluginReadModel.idField,
|
|
208
|
+
Platform_Admin_Structure$ReventlessCore.pluginReadModel.idFieldSource
|
|
209
|
+
]).toEqual([
|
|
210
|
+
undefined,
|
|
211
|
+
undefined
|
|
212
|
+
]);
|
|
213
|
+
});
|
|
214
|
+
globalThis.test("the blob fields are published, and marked hidden", () => {
|
|
215
|
+
let props = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_JSON.Decode.object(JSON.parse(Platform_Admin_Structure$ReventlessCore.pluginReadModel.schema)), o => o["properties"]), Stdlib_JSON.Decode.object), {});
|
|
216
|
+
let isHidden = key => Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_Option.flatMap(props[key], Stdlib_JSON.Decode.object), o => o["x-reventless-hidden"]), Stdlib_JSON.Decode.bool);
|
|
217
|
+
globalThis.expect([
|
|
218
|
+
isHidden("apiSchemaFragment"),
|
|
219
|
+
isHidden("structure")
|
|
220
|
+
]).toEqual([
|
|
221
|
+
true,
|
|
222
|
+
true
|
|
223
|
+
]);
|
|
224
|
+
});
|
|
225
|
+
globalThis.test("while the internal fields are not published at all", () => {
|
|
226
|
+
let props = Stdlib_Option.mapOr(Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_JSON.Decode.object(JSON.parse(Platform_Admin_Structure$ReventlessCore.pluginReadModel.schema)), o => o["properties"]), Stdlib_JSON.Decode.object), [], prim => Object.keys(prim));
|
|
227
|
+
globalThis.expect([
|
|
228
|
+
props.includes("eventCollector"),
|
|
229
|
+
props.includes("extensionNames"),
|
|
230
|
+
props.includes("statusChange")
|
|
231
|
+
]).toEqual([
|
|
232
|
+
false,
|
|
233
|
+
false,
|
|
234
|
+
true
|
|
235
|
+
]);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
commandNamed,
|
|
241
|
+
activate,
|
|
242
|
+
}
|
|
24
243
|
/* Not a pure module */
|
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
5
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Stream from "effect/Stream";
|
|
8
8
|
import * as Aggregate_Callback$ReventlessCore from "../../src/components/Aggregate/Aggregate_Callback.res.mjs";
|
|
9
9
|
|
|
10
|
-
S.enableJson();
|
|
11
|
-
|
|
12
10
|
let name = "CacheTestAggregate";
|
|
13
11
|
|
|
14
|
-
let commandSchema =
|
|
15
|
-
|
|
12
|
+
let commandSchema = Sury.union([
|
|
13
|
+
Sury.$schema(s => ({
|
|
16
14
|
TAG: "Add",
|
|
17
|
-
name: s.m(
|
|
15
|
+
name: s.m(Sury.string)
|
|
18
16
|
})),
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
Sury.literal("Checkpoint"),
|
|
18
|
+
Sury.literal("Noop")
|
|
21
19
|
]);
|
|
22
20
|
|
|
23
|
-
let eventSchema =
|
|
24
|
-
|
|
21
|
+
let eventSchema = Sury.union([
|
|
22
|
+
Sury.$schema(s => ({
|
|
25
23
|
TAG: "Added",
|
|
26
|
-
name: s.m(
|
|
24
|
+
name: s.m(Sury.string)
|
|
27
25
|
})),
|
|
28
|
-
|
|
26
|
+
Sury.$schema(s => ({
|
|
29
27
|
TAG: "CheckpointTaken",
|
|
30
|
-
count: s.m(
|
|
28
|
+
count: s.m(Sury.int)
|
|
31
29
|
}))
|
|
32
30
|
]);
|
|
33
31
|
|
|
34
|
-
let errorSchema =
|
|
32
|
+
let errorSchema = Sury.literal("Never");
|
|
35
33
|
|
|
36
34
|
let moduleUrl = import.meta.url;
|
|
37
35
|
|
|
@@ -430,4 +428,4 @@ export {
|
|
|
430
428
|
makeTopicItem,
|
|
431
429
|
run,
|
|
432
430
|
}
|
|
433
|
-
/*
|
|
431
|
+
/* commandSchema Not a pure module */
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Stream from "effect/Stream";
|
|
7
7
|
import * as Aggregate_Callback$ReventlessCore from "../../src/components/Aggregate/Aggregate_Callback.res.mjs";
|
|
8
8
|
|
|
9
|
-
S.enableJson();
|
|
10
|
-
|
|
11
9
|
let name = "ConflictTestAggregate";
|
|
12
10
|
|
|
13
|
-
let commandSchema =
|
|
11
|
+
let commandSchema = Sury.$schema(s => ({
|
|
14
12
|
TAG: "Create",
|
|
15
|
-
name: s.m(
|
|
13
|
+
name: s.m(Sury.string)
|
|
16
14
|
}));
|
|
17
15
|
|
|
18
|
-
let eventSchema =
|
|
16
|
+
let eventSchema = Sury.$schema(s => ({
|
|
19
17
|
TAG: "Created",
|
|
20
|
-
name: s.m(
|
|
18
|
+
name: s.m(Sury.string)
|
|
21
19
|
}));
|
|
22
20
|
|
|
23
|
-
let errorSchema =
|
|
21
|
+
let errorSchema = Sury.literal("AlreadyExists");
|
|
24
22
|
|
|
25
23
|
let moduleUrl = import.meta.url;
|
|
26
24
|
|
|
@@ -383,4 +381,4 @@ export {
|
|
|
383
381
|
testMeta,
|
|
384
382
|
makeTopicItem,
|
|
385
383
|
}
|
|
386
|
-
/*
|
|
384
|
+
/* commandSchema Not a pure module */
|
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
5
|
import * as Stream from "effect/Stream";
|
|
6
6
|
import * as Aggregate_Callback$ReventlessCore from "../../src/components/Aggregate/Aggregate_Callback.res.mjs";
|
|
7
7
|
|
|
8
|
-
S.enableJson();
|
|
9
|
-
|
|
10
8
|
let name = "TestAggregate";
|
|
11
9
|
|
|
12
|
-
let commandSchema =
|
|
13
|
-
|
|
10
|
+
let commandSchema = Sury.union([
|
|
11
|
+
Sury.$schema(s => ({
|
|
14
12
|
TAG: "Create",
|
|
15
|
-
name: s.m(
|
|
13
|
+
name: s.m(Sury.string)
|
|
16
14
|
})),
|
|
17
|
-
|
|
15
|
+
Sury.$schema(s => ({
|
|
18
16
|
TAG: "Rename",
|
|
19
|
-
newName: s.m(
|
|
17
|
+
newName: s.m(Sury.string)
|
|
20
18
|
}))
|
|
21
19
|
]);
|
|
22
20
|
|
|
23
|
-
let eventSchema =
|
|
24
|
-
|
|
21
|
+
let eventSchema = Sury.union([
|
|
22
|
+
Sury.$schema(s => ({
|
|
25
23
|
TAG: "Created",
|
|
26
|
-
name: s.m(
|
|
24
|
+
name: s.m(Sury.string)
|
|
27
25
|
})),
|
|
28
|
-
|
|
26
|
+
Sury.$schema(s => ({
|
|
29
27
|
TAG: "Renamed",
|
|
30
|
-
newName: s.m(
|
|
28
|
+
newName: s.m(Sury.string)
|
|
31
29
|
}))
|
|
32
30
|
]);
|
|
33
31
|
|
|
34
|
-
let errorSchema =
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
let errorSchema = Sury.union([
|
|
33
|
+
Sury.literal("AlreadyExists"),
|
|
34
|
+
Sury.literal("NotFound")
|
|
37
35
|
]);
|
|
38
36
|
|
|
39
37
|
let moduleUrl = import.meta.url;
|
|
@@ -52,11 +50,11 @@ let AggSpec = {
|
|
|
52
50
|
commandAuthorization: commandAuthorization
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
let stateSchema =
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
let stateSchema = Sury.union([
|
|
54
|
+
Sury.literal("NotCreated"),
|
|
55
|
+
Sury.$schema(s => ({
|
|
58
56
|
TAG: "Created",
|
|
59
|
-
name: s.m(
|
|
57
|
+
name: s.m(Sury.string)
|
|
60
58
|
}))
|
|
61
59
|
]);
|
|
62
60
|
|
|
@@ -305,4 +303,4 @@ export {
|
|
|
305
303
|
testMeta,
|
|
306
304
|
makeTopicItem,
|
|
307
305
|
}
|
|
308
|
-
/*
|
|
306
|
+
/* commandSchema Not a pure module */
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
open JestGlobals
|
|
14
14
|
|
|
15
|
-
S.enableJson()
|
|
16
15
|
|
|
17
16
|
module AggSpec = {
|
|
18
17
|
module Id = Reventless.Id.StringPure
|
|
@@ -300,7 +299,7 @@ describe("Aggregate_Callback — snapshots:", () => {
|
|
|
300
299
|
| Some(snap) =>
|
|
301
300
|
expect(snap.seqNr)->toBe(20)
|
|
302
301
|
// 20 items folded through the seeded state — no double-count, no gap.
|
|
303
|
-
let decoded = snap.state->
|
|
302
|
+
let decoded = snap.state->Reventless.Util_Sury.fromJson(TestBehavior.stateSchema)
|
|
304
303
|
expect(decoded.items->Array.length)->toBe(20)
|
|
305
304
|
| None => expect("expected snapshot at 20")->toBe("none")
|
|
306
305
|
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Stream from "@reventlessdev/rescript-effect/src/Stream.res.mjs";
|
|
5
5
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
6
6
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Stream$1 from "effect/Stream";
|
|
9
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
9
10
|
import * as Aggregate_Callback$ReventlessCore from "../../src/components/Aggregate/Aggregate_Callback.res.mjs";
|
|
10
11
|
|
|
11
|
-
S.enableJson();
|
|
12
|
-
|
|
13
12
|
let name = "SnapshotTestAggregate";
|
|
14
13
|
|
|
15
|
-
let commandSchema =
|
|
16
|
-
|
|
14
|
+
let commandSchema = Sury.union([
|
|
15
|
+
Sury.$schema(s => ({
|
|
17
16
|
TAG: "Add",
|
|
18
|
-
item: s.m(
|
|
17
|
+
item: s.m(Sury.string)
|
|
19
18
|
})),
|
|
20
|
-
|
|
19
|
+
Sury.literal("Noop")
|
|
21
20
|
]);
|
|
22
21
|
|
|
23
|
-
let eventSchema =
|
|
22
|
+
let eventSchema = Sury.$schema(s => ({
|
|
24
23
|
TAG: "Added",
|
|
25
|
-
item: s.m(
|
|
24
|
+
item: s.m(Sury.string)
|
|
26
25
|
}));
|
|
27
26
|
|
|
28
|
-
let errorSchema =
|
|
27
|
+
let errorSchema = Sury.literal("Never");
|
|
29
28
|
|
|
30
29
|
let moduleUrl = import.meta.url;
|
|
31
30
|
|
|
@@ -43,8 +42,8 @@ let AggSpec = {
|
|
|
43
42
|
commandAuthorization: commandAuthorization
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
let stateSchema =
|
|
47
|
-
items: s.m(
|
|
45
|
+
let stateSchema = Sury.$schema(s => ({
|
|
46
|
+
items: s.m(Sury.array(Sury.string))
|
|
48
47
|
}));
|
|
49
48
|
|
|
50
49
|
let initialState = {
|
|
@@ -325,8 +324,8 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
|
|
|
325
324
|
eventLog: eventLog
|
|
326
325
|
});
|
|
327
326
|
|
|
328
|
-
let stateSchema$1 =
|
|
329
|
-
items: s.m(
|
|
327
|
+
let stateSchema$1 = Sury.$schema(s => ({
|
|
328
|
+
items: s.m(Sury.array(Sury.string))
|
|
330
329
|
}));
|
|
331
330
|
|
|
332
331
|
let initialState$1 = {
|
|
@@ -550,7 +549,7 @@ globalThis.describe("Aggregate_Callback — snapshots:", () => {
|
|
|
550
549
|
let snap = mock.getSnapshot("agg-1");
|
|
551
550
|
if (snap !== undefined) {
|
|
552
551
|
globalThis.expect(snap.seqNr).toBe(20);
|
|
553
|
-
let decoded =
|
|
552
|
+
let decoded = Util_Sury$Reventless.fromJson(snap.state, stateSchema);
|
|
554
553
|
globalThis.expect(decoded.items.length).toBe(20);
|
|
555
554
|
} else {
|
|
556
555
|
globalThis.expect("expected snapshot at 20").toBe("none");
|
|
@@ -642,4 +641,4 @@ export {
|
|
|
642
641
|
run,
|
|
643
642
|
tick,
|
|
644
643
|
}
|
|
645
|
-
/*
|
|
644
|
+
/* commandSchema Not a pure module */
|
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
5
|
import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
|
|
6
6
|
import * as ApiNoApiHelpers$ReventlessCore from "../../src/components/Api/ApiNoApiHelpers.res.mjs";
|
|
7
7
|
|
|
8
8
|
globalThis.describe("ApiNoApiHelpers:", () => {
|
|
9
9
|
globalThis.test("isNoApi returns false for schema without noApi metadata", () => {
|
|
10
|
-
|
|
10
|
+
let schema = Sury.string;
|
|
11
|
+
globalThis.expect(ApiNoApiHelpers$ReventlessCore.isNoApi(schema)).toBe(false);
|
|
11
12
|
});
|
|
12
13
|
globalThis.test("isNoApi returns true for schema with noApi metadata set to true", () => {
|
|
13
|
-
let schema
|
|
14
|
+
let schema = Sury.string;
|
|
15
|
+
let schema$p = Sury.$Metadata_set(schema, Api$ReventlessInfra.noApiId, true);
|
|
14
16
|
globalThis.expect(ApiNoApiHelpers$ReventlessCore.isNoApi(schema$p)).toBe(true);
|
|
15
17
|
});
|
|
16
18
|
globalThis.test("getExcludedVariants returns None for schema without noApiVariants metadata", () => {
|
|
17
|
-
|
|
19
|
+
let schema = Sury.string;
|
|
20
|
+
globalThis.expect(ApiNoApiHelpers$ReventlessCore.getExcludedVariants(schema)).toBe(undefined);
|
|
18
21
|
});
|
|
19
22
|
globalThis.test("getExcludedVariants returns Some with DeleteItem when set", () => {
|
|
23
|
+
let schema = Sury.string;
|
|
20
24
|
let excluded = new Set([
|
|
21
25
|
"DeleteItem",
|
|
22
26
|
"UpdateItem"
|
|
23
27
|
]);
|
|
24
|
-
let schema$p =
|
|
28
|
+
let schema$p = Sury.$Metadata_set(schema, Api$ReventlessInfra.noApiVariantsId, excluded);
|
|
25
29
|
let result = ApiNoApiHelpers$ReventlessCore.getExcludedVariants(schema$p);
|
|
26
30
|
globalThis.expect(Stdlib_Option.getOr(Stdlib_Option.map(result, set => set.has("DeleteItem")), false)).toBe(true);
|
|
27
31
|
});
|
|
28
32
|
globalThis.test("filterNoApiVariants returns all field names when no variants are excluded", () => {
|
|
33
|
+
let schema = Sury.string;
|
|
29
34
|
let fieldNames = [
|
|
30
35
|
"CreateItem",
|
|
31
36
|
"DeleteItem",
|
|
32
37
|
"UpdateItem"
|
|
33
38
|
];
|
|
34
|
-
let filtered = ApiNoApiHelpers$ReventlessCore.filterNoApiVariants(fieldNames,
|
|
39
|
+
let filtered = ApiNoApiHelpers$ReventlessCore.filterNoApiVariants(fieldNames, schema);
|
|
35
40
|
globalThis.expect(filtered).toEqual([
|
|
36
41
|
"CreateItem",
|
|
37
42
|
"DeleteItem",
|
|
@@ -39,8 +44,9 @@ globalThis.describe("ApiNoApiHelpers:", () => {
|
|
|
39
44
|
]);
|
|
40
45
|
});
|
|
41
46
|
globalThis.test("filterNoApiVariants filters out excluded variants", () => {
|
|
47
|
+
let schema = Sury.string;
|
|
42
48
|
let excluded = new Set(["DeleteItem"]);
|
|
43
|
-
let schema$p =
|
|
49
|
+
let schema$p = Sury.$Metadata_set(schema, Api$ReventlessInfra.noApiVariantsId, excluded);
|
|
44
50
|
let fieldNames = [
|
|
45
51
|
"CreateItem",
|
|
46
52
|
"DeleteItem",
|
|
@@ -53,11 +59,12 @@ globalThis.describe("ApiNoApiHelpers:", () => {
|
|
|
53
59
|
]);
|
|
54
60
|
});
|
|
55
61
|
globalThis.test("filterNoApiVariants filters out multiple excluded variants", () => {
|
|
62
|
+
let schema = Sury.string;
|
|
56
63
|
let excluded = new Set([
|
|
57
64
|
"DeleteItem",
|
|
58
65
|
"UpdateItem"
|
|
59
66
|
]);
|
|
60
|
-
let schema$p =
|
|
67
|
+
let schema$p = Sury.$Metadata_set(schema, Api$ReventlessInfra.noApiVariantsId, excluded);
|
|
61
68
|
let fieldNames = [
|
|
62
69
|
"CreateItem",
|
|
63
70
|
"DeleteItem",
|
|
@@ -71,12 +78,13 @@ globalThis.describe("ApiNoApiHelpers:", () => {
|
|
|
71
78
|
]);
|
|
72
79
|
});
|
|
73
80
|
globalThis.test("filterNoApiVariants returns empty array when all variants are excluded", () => {
|
|
81
|
+
let schema = Sury.string;
|
|
74
82
|
let excluded = new Set([
|
|
75
83
|
"CreateItem",
|
|
76
84
|
"DeleteItem",
|
|
77
85
|
"UpdateItem"
|
|
78
86
|
]);
|
|
79
|
-
let schema$p =
|
|
87
|
+
let schema$p = Sury.$Metadata_set(schema, Api$ReventlessInfra.noApiVariantsId, excluded);
|
|
80
88
|
let fieldNames = [
|
|
81
89
|
"CreateItem",
|
|
82
90
|
"DeleteItem",
|