@reventlessdev/reventless-local 3.0.0-alpha.227 → 3.0.0-alpha.229
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 +20 -0
- package/package.json +10 -10
- package/src/LocalPlatformRegistry.res +2 -2
- package/src/LocalPlatformRegistry.res.mjs +14 -13
- package/src/Platform.res +10 -10
- package/src/Platform.res.mjs +17 -16
- package/src/adapter/Auth/LocalAuth.res +3 -3
- package/src/adapter/Auth/LocalAuth.res.mjs +3 -2
- package/src/adapter/Auth/UserStore.res +1 -1
- package/src/adapter/Auth/UserStore.res.mjs +7 -6
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_GraphQL.res +1 -1
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_GraphQL.res.mjs +1 -1
- package/src/adapter/CommandTopic/LocalCommandTopicRemoteChannel.res +1 -1
- package/src/adapter/CommandTopic/LocalCommandTopicRemoteChannel.res.mjs +3 -3
- package/src/adapter/DcbEventLog/DcbEventLogStorage_Sqlite.res +2 -2
- package/src/adapter/DcbEventLog/DcbEventLogStorage_Sqlite.res.mjs +4 -4
- package/src/adapter/DomainGraphQL_Server.res +2 -2
- package/src/adapter/DomainGraphQL_Server.res.mjs +3 -3
- package/src/adapter/DomainMCP_Server.res +1 -1
- package/src/adapter/MCP_ServerInstance.res +1 -1
- package/tests/BakedManifestFilesTest.res +0 -1
- package/tests/PluginEventDecodeTest.res +3 -3
- package/tests/PluginEventDecodeTest.res.mjs +4 -4
- package/tests/ShellConfigTest.res +0 -1
- package/tests/adapter/CommandAuthorizationTest.res.mjs +7 -7
- package/tests/adapter/GraphQL_SchemaInspectorTest.res.mjs +59 -59
- package/tests/adapter/LocalAuthHttpTest.res +1 -1
- package/tests/adapter/LocalAuthHttpTest.res.mjs +2 -2
- package/tests/adapter/QueryDbListResolverTest.res.mjs +5 -5
- package/tests/components/aggregate/AggregateFixtures.res.mjs +6 -6
- package/tests/components/automationslice/AutomationSliceFixtures.res +4 -4
- package/tests/components/automationslice/AutomationSliceFixtures.res.mjs +20 -19
- package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res +2 -2
- package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res.mjs +23 -22
- package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res +4 -4
- package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res.mjs +21 -20
- package/tests/components/commandgenerator/CommandGeneratorFixtures.res +0 -1
- package/tests/components/commandgenerator/CommandGeneratorFixtures.res.mjs +6 -8
- package/tests/components/commandgenerator/CommandGeneratorTest.res +1 -1
- package/tests/components/commandgenerator/CommandGeneratorTest.res.mjs +2 -2
- package/tests/components/commandtopic/CommandTopicFixtures.res.mjs +9 -9
- package/tests/components/commandtopic/CommandTopicStreamFixtures.res.mjs +9 -9
- package/tests/components/dcb/DcbCrossPartitionFixtures.res +3 -3
- package/tests/components/dcb/DcbCrossPartitionFixtures.res.mjs +22 -21
- package/tests/components/dcb/DcbEventLogAppendStreamTest.res +1 -1
- package/tests/components/dcb/DcbEventLogAppendStreamTest.res.mjs +2 -2
- package/tests/components/dcb/DcbFixtures.res +2 -2
- package/tests/components/dcb/DcbFixtures.res.mjs +12 -11
- package/tests/components/eventlog/EventLogFixtures.res.mjs +6 -6
- package/tests/components/eventlog/EventLogProvisioningSeamTest.res.mjs +3 -3
- package/tests/components/eventtopic/EventTopicFixtures.res.mjs +6 -6
- package/tests/components/eventtopic/EventTopicStreamFixtures.res.mjs +6 -6
- package/tests/components/extensionpoint/ExtensionPointFixtures.res +0 -1
- package/tests/components/extensionpoint/ExtensionPointFixtures.res.mjs +11 -13
- package/tests/components/extensionpoint/ExtensionPointTest.res +3 -3
- package/tests/components/extensionpoint/ExtensionPointTest.res.mjs +4 -4
- package/tests/components/inboundtranslationslice/InboundTranslationSliceCallbackTest.res.mjs +10 -10
- package/tests/components/inboundtranslationslice/InboundTranslationSliceFixtures.res.mjs +9 -9
- package/tests/components/outboundtranslationslice/OutboundTranslationSliceFixtures.res.mjs +23 -21
- package/tests/components/outboundtranslationslice/OutboundTranslationSlicePlatformFixtures.res +2 -2
- package/tests/components/outboundtranslationslice/OutboundTranslationSlicePlatformFixtures.res.mjs +17 -14
- package/tests/components/querydb/QueryDbFixtures.res.mjs +4 -4
- package/tests/components/querydb/QueryDbSubIdFixtures.res.mjs +6 -6
- package/tests/components/readmodel/DcbReadModelE2EFixtures.res +3 -3
- package/tests/components/readmodel/DcbReadModelE2EFixtures.res.mjs +17 -16
- package/tests/components/readmodel/DcbReadModelTypoFailFastTest.res.mjs +7 -7
- package/tests/components/readmodel/MixedSourceReadModelFixtures.res +5 -5
- package/tests/components/readmodel/MixedSourceReadModelFixtures.res.mjs +20 -19
- package/tests/components/readmodel/ReadModelFixtures.res +3 -3
- package/tests/components/readmodel/ReadModelFixtures.res.mjs +9 -8
- package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res +2 -3
- package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +7 -8
- package/tests/components/stateviewslice/StateViewSliceFixtures.res +2 -2
- package/tests/components/stateviewslice/StateViewSliceFixtures.res.mjs +22 -21
- package/tests/components/stateviewslice/StateViewSliceSubIdFixtures.res +2 -2
- package/tests/components/stateviewslice/StateViewSliceSubIdFixtures.res.mjs +27 -26
- package/tests/components/task/TaskFixtures.res +0 -1
- package/tests/components/task/TaskFixtures.res.mjs +0 -3
|
@@ -157,7 +157,7 @@ let make = (~label: string="MCP"): t => {
|
|
|
157
157
|
| Some(json) =>
|
|
158
158
|
json
|
|
159
159
|
->JSON.parseOrThrow
|
|
160
|
-
->S.parseOrThrow(Reventless.Identity.schema)
|
|
160
|
+
->S.parseOrThrow(~to=Reventless.Identity.schema)
|
|
161
161
|
| None => Reventless.Identity.anonymous
|
|
162
162
|
}
|
|
163
163
|
} catch {
|
|
@@ -16,7 +16,6 @@ let keysOf = (config: ReventlessInfra.Platform.bakedManifest) =>
|
|
|
16
16
|
BakedManifest.files(~config)->Array.map(((key, _)) => key)
|
|
17
17
|
|
|
18
18
|
describe("BakedManifest.files", () => {
|
|
19
|
-
open Expect
|
|
20
19
|
|
|
21
20
|
// The regression line: one declaration, one file, under the name every
|
|
22
21
|
// existing deployment's config.json already points at.
|
|
@@ -16,7 +16,7 @@ let envelopeOf = (event: ReventlessCore.PluginSpec.event) =>
|
|
|
16
16
|
"Catalog",
|
|
17
17
|
meta,
|
|
18
18
|
~recordedAt="2024-01-01T00:00:00Z",
|
|
19
|
-
event->
|
|
19
|
+
event->Reventless.Util_Sury.toJson(ReventlessCore.PluginSpec.eventSchema),
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
describe("Platform.decodePluginEventEnvelope", () => {
|
|
@@ -38,7 +38,7 @@ describe("Platform.decodePluginEventEnvelope", () => {
|
|
|
38
38
|
testSync("returns None for a bare event JSON (no envelope) and malformed input", () => {
|
|
39
39
|
// The old bug class: input that is not the {id, meta, event} envelope.
|
|
40
40
|
let bare =
|
|
41
|
-
ReventlessCore.PluginSpec.VersionDetected("2.0.0")->
|
|
41
|
+
ReventlessCore.PluginSpec.VersionDetected("2.0.0")->Reventless.Util_Sury.toJson(
|
|
42
42
|
ReventlessCore.PluginSpec.eventSchema,
|
|
43
43
|
)
|
|
44
44
|
expect(Platform.decodePluginEventEnvelope(bare))->toEqual(None)
|
|
@@ -64,7 +64,7 @@ describe("Platform.decodeUiFragmentRegistryEventEnvelope", () => {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
let dcbEnvelopeOf = (event: ReventlessCore.UiFragmentRegistry.event) => {
|
|
67
|
-
let json = event->
|
|
67
|
+
let json = event->Reventless.Util_Sury.toJson(ReventlessCore.UiFragmentRegistry.eventSchema)
|
|
68
68
|
let (eventType, data) = json->ReventlessCore.Message.splitMessage
|
|
69
69
|
ReventlessCore.Message.composeEventJson'(
|
|
70
70
|
"Catalog",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
4
4
|
import * as Message$ReventlessCore from "@reventlessdev/reventless-core/src/Message.res.mjs";
|
|
5
5
|
import * as Platform$ReventlessLocal from "../src/Platform.res.mjs";
|
|
6
6
|
import * as PluginSpec$ReventlessCore from "@reventlessdev/reventless-core/src/plugin/lifecycle/PluginSpec.res.mjs";
|
|
@@ -15,7 +15,7 @@ TestRunner$ReventlessLocal.setup();
|
|
|
15
15
|
let meta = Message$ReventlessCore.generateMeta(PluginSpec$ReventlessCore.name, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
16
16
|
|
|
17
17
|
function envelopeOf(event) {
|
|
18
|
-
return Message$ReventlessCore.composeEventJson$p("Catalog", meta, "2024-01-01T00:00:00Z",
|
|
18
|
+
return Message$ReventlessCore.composeEventJson$p("Catalog", meta, "2024-01-01T00:00:00Z", Util_Sury$Reventless.toJson(event, PluginSpec$ReventlessCore.eventSchema));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
globalThis.describe("Platform.decodePluginEventEnvelope", () => {
|
|
@@ -46,7 +46,7 @@ globalThis.describe("Platform.decodePluginEventEnvelope", () => {
|
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
globalThis.test("returns None for a bare event JSON (no envelope) and malformed input", () => {
|
|
49
|
-
let bare =
|
|
49
|
+
let bare = Util_Sury$Reventless.toJson({
|
|
50
50
|
TAG: "VersionDetected",
|
|
51
51
|
_0: "2.0.0"
|
|
52
52
|
}, PluginSpec$ReventlessCore.eventSchema);
|
|
@@ -62,7 +62,7 @@ globalThis.describe("Platform.decodePluginEventEnvelope", () => {
|
|
|
62
62
|
globalThis.describe("Platform.decodeUiFragmentRegistryEventEnvelope", () => {
|
|
63
63
|
let dcbMeta = Message$ReventlessCore.generateMeta(ComponentType$ReventlessCore.name(Platform_Admin_Structure$ReventlessCore.pluginId, "DcbEventLog"), undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
64
64
|
let dcbEnvelopeOf = event => {
|
|
65
|
-
let json =
|
|
65
|
+
let json = Util_Sury$Reventless.toJson(event, UiFragmentRegistry$ReventlessCore.eventSchema);
|
|
66
66
|
let match = Message$ReventlessCore.splitMessage(json);
|
|
67
67
|
return Message$ReventlessCore.composeEventJson$p("Catalog", dcbMeta, "2024-01-01T00:00:00Z", Message$ReventlessCore.combineMessage(match[0], match[1]));
|
|
68
68
|
};
|
|
@@ -167,7 +167,6 @@ let fulfilment: ReventlessInfra.Platform.bakedJourney = {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
describe("ShellConfig.overlay — journeys", () => {
|
|
170
|
-
open Expect
|
|
171
170
|
|
|
172
171
|
// The regression line. A shell that has never heard of journeys must not
|
|
173
172
|
// suddenly find a key it does not know.
|
|
@@ -1,6 +1,6 @@
|
|
|
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_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
5
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
6
6
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
@@ -15,16 +15,16 @@ import * as CommandGeneratorResolvers_GraphQL$ReventlessLocal from "../../src/ad
|
|
|
15
15
|
|
|
16
16
|
TestRunner$ReventlessLocal.setup();
|
|
17
17
|
|
|
18
|
-
let commandSchema =
|
|
19
|
-
|
|
18
|
+
let commandSchema = Sury.union([
|
|
19
|
+
Sury.$schema(s => ({
|
|
20
20
|
TAG: "Add",
|
|
21
|
-
name: s.m(
|
|
21
|
+
name: s.m(Sury.string)
|
|
22
22
|
})),
|
|
23
|
-
|
|
23
|
+
Sury.$schema(s => ({
|
|
24
24
|
TAG: "Rename",
|
|
25
|
-
name: s.m(
|
|
25
|
+
name: s.m(Sury.string)
|
|
26
26
|
})),
|
|
27
|
-
|
|
27
|
+
Sury.literal("Archive")
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
30
|
function commandAuthorization(cmd) {
|
|
@@ -1,6 +1,6 @@
|
|
|
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 DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
6
6
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
@@ -16,87 +16,93 @@ import * as Plugin_SubscriptionSchema$ReventlessCore from "@reventlessdev/revent
|
|
|
16
16
|
|
|
17
17
|
TestRunner$ReventlessLocal.setup();
|
|
18
18
|
|
|
19
|
-
let
|
|
19
|
+
let stringSchema = Sury.string;
|
|
20
|
+
|
|
21
|
+
let numberSchema = Sury.float;
|
|
22
|
+
|
|
23
|
+
let boolSchema = Sury.bool;
|
|
24
|
+
|
|
25
|
+
let testStateSchema = Sury.$schema(s => ({
|
|
20
26
|
id: s.m(DcbTag$Reventless.string),
|
|
21
|
-
name: s.m(
|
|
22
|
-
price: s.m(
|
|
23
|
-
active: s.m(
|
|
27
|
+
name: s.m(Sury.string),
|
|
28
|
+
price: s.m(Sury.float),
|
|
29
|
+
active: s.m(Sury.bool)
|
|
24
30
|
}));
|
|
25
31
|
|
|
26
|
-
let svStateSchema =
|
|
32
|
+
let svStateSchema = Sury.$schema(s => ({
|
|
27
33
|
productId: s.m(DcbTag$Reventless.string),
|
|
28
|
-
name: s.m(
|
|
29
|
-
price: s.m(
|
|
34
|
+
name: s.m(Sury.string),
|
|
35
|
+
price: s.m(Sury.float)
|
|
30
36
|
}));
|
|
31
37
|
|
|
32
|
-
let sourceKindSchema =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
let sourceKindSchema = Sury.union([
|
|
39
|
+
Sury.literal("tagged"),
|
|
40
|
+
Sury.literal("ancestry"),
|
|
41
|
+
Sury.literal("substrate")
|
|
36
42
|
]);
|
|
37
43
|
|
|
38
|
-
let enumStateSchema =
|
|
44
|
+
let enumStateSchema = Sury.$schema(s => ({
|
|
39
45
|
productId: s.m(DcbTag$Reventless.string),
|
|
40
46
|
requiredSource: s.m(sourceKindSchema),
|
|
41
|
-
optionalSource: s.m(
|
|
47
|
+
optionalSource: s.m(Sury.$option(sourceKindSchema))
|
|
42
48
|
}));
|
|
43
49
|
|
|
44
|
-
let addCommandSchema =
|
|
50
|
+
let addCommandSchema = Sury.$schema(s => ({
|
|
45
51
|
productId: s.m(DcbTag$Reventless.string),
|
|
46
|
-
name: s.m(
|
|
52
|
+
name: s.m(Sury.string)
|
|
47
53
|
}));
|
|
48
54
|
|
|
49
|
-
let unionCommandSchema =
|
|
50
|
-
|
|
55
|
+
let unionCommandSchema = Sury.union([
|
|
56
|
+
Sury.$schema(s => ({
|
|
51
57
|
TAG: "Create",
|
|
52
58
|
itemId: s.m(DcbTag$Reventless.string),
|
|
53
|
-
name: s.m(
|
|
59
|
+
name: s.m(Sury.string)
|
|
54
60
|
})),
|
|
55
|
-
|
|
61
|
+
Sury.$schema(s => ({
|
|
56
62
|
TAG: "Rename",
|
|
57
63
|
itemId: s.m(DcbTag$Reventless.string),
|
|
58
|
-
newName: s.m(
|
|
64
|
+
newName: s.m(Sury.string)
|
|
59
65
|
}))
|
|
60
66
|
]);
|
|
61
67
|
|
|
62
|
-
let dcbSingleCommandSchema =
|
|
68
|
+
let dcbSingleCommandSchema = Sury.$schema(s => ({
|
|
63
69
|
TAG: "AddCategory",
|
|
64
70
|
categoryId: s.m(DcbTag$Reventless.string),
|
|
65
|
-
name: s.m(
|
|
71
|
+
name: s.m(Sury.string)
|
|
66
72
|
}));
|
|
67
73
|
|
|
68
|
-
let dcbMultiCommandSchema =
|
|
69
|
-
|
|
74
|
+
let dcbMultiCommandSchema = Sury.union([
|
|
75
|
+
Sury.$schema(s => ({
|
|
70
76
|
TAG: "SyncNewProduct",
|
|
71
77
|
productId: s.m(DcbTag$Reventless.string),
|
|
72
|
-
name: s.m(
|
|
73
|
-
price: s.m(
|
|
78
|
+
name: s.m(Sury.string),
|
|
79
|
+
price: s.m(Sury.float)
|
|
74
80
|
})),
|
|
75
|
-
|
|
81
|
+
Sury.$schema(s => ({
|
|
76
82
|
TAG: "ChangeSyncedPrice",
|
|
77
83
|
productId: s.m(DcbTag$Reventless.string),
|
|
78
|
-
price: s.m(
|
|
84
|
+
price: s.m(Sury.float)
|
|
79
85
|
}))
|
|
80
86
|
]);
|
|
81
87
|
|
|
82
|
-
let plainStateSchema =
|
|
88
|
+
let plainStateSchema = Sury.$schema(s => ({
|
|
83
89
|
productId: s.m(DcbTag$Reventless.string),
|
|
84
|
-
name: s.m(
|
|
90
|
+
name: s.m(Sury.string)
|
|
85
91
|
}));
|
|
86
92
|
|
|
87
|
-
let keylessStateSchema =
|
|
88
|
-
name: s.m(
|
|
89
|
-
note: s.m(
|
|
93
|
+
let keylessStateSchema = Sury.$schema(s => ({
|
|
94
|
+
name: s.m(Sury.string),
|
|
95
|
+
note: s.m(Sury.string)
|
|
90
96
|
}));
|
|
91
97
|
|
|
92
|
-
let indexedStateSchema =
|
|
98
|
+
let indexedStateSchema = Sury.$schema(s => ({
|
|
93
99
|
productId: s.m(DcbTag$Reventless.string),
|
|
94
|
-
ownerId: s.m(
|
|
95
|
-
status: s.m(
|
|
96
|
-
name: s.m(
|
|
100
|
+
ownerId: s.m(Sury.string),
|
|
101
|
+
status: s.m(Sury.string),
|
|
102
|
+
name: s.m(Sury.string)
|
|
97
103
|
}));
|
|
98
104
|
|
|
99
|
-
let indexedStateSchemaWithAnnotations =
|
|
105
|
+
let indexedStateSchemaWithAnnotations = Sury.$Metadata_set(indexedStateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
100
106
|
ids: ["productId"],
|
|
101
107
|
compositeIds: [],
|
|
102
108
|
subIds: [],
|
|
@@ -121,13 +127,13 @@ let indexedStateSchemaWithAnnotations = S.Metadata.set(indexedStateSchema, State
|
|
|
121
127
|
retired: undefined
|
|
122
128
|
});
|
|
123
129
|
|
|
124
|
-
let orderedStateSchema =
|
|
130
|
+
let orderedStateSchema = Sury.$schema(s => ({
|
|
125
131
|
productId: s.m(DcbTag$Reventless.string),
|
|
126
|
-
createdAt: s.m(
|
|
127
|
-
name: s.m(
|
|
132
|
+
createdAt: s.m(Sury.string),
|
|
133
|
+
name: s.m(Sury.string)
|
|
128
134
|
}));
|
|
129
135
|
|
|
130
|
-
let orderedStateSchemaWithAnnotations =
|
|
136
|
+
let orderedStateSchemaWithAnnotations = Sury.$Metadata_set(orderedStateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
131
137
|
ids: ["productId"],
|
|
132
138
|
compositeIds: [],
|
|
133
139
|
subIds: ["createdAt"],
|
|
@@ -149,14 +155,14 @@ let orderedStateSchemaWithAnnotations = S.Metadata.set(orderedStateSchema, State
|
|
|
149
155
|
retired: undefined
|
|
150
156
|
});
|
|
151
157
|
|
|
152
|
-
let scanStateSchema =
|
|
158
|
+
let scanStateSchema = Sury.$schema(s => ({
|
|
153
159
|
productId: s.m(DcbTag$Reventless.string),
|
|
154
|
-
status: s.m(
|
|
155
|
-
name: s.m(
|
|
156
|
-
description: s.m(
|
|
160
|
+
status: s.m(Sury.string),
|
|
161
|
+
name: s.m(Sury.string),
|
|
162
|
+
description: s.m(Sury.string)
|
|
157
163
|
}));
|
|
158
164
|
|
|
159
|
-
let scanStateSchemaWithAnnotations =
|
|
165
|
+
let scanStateSchemaWithAnnotations = Sury.$Metadata_set(scanStateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
160
166
|
ids: ["productId"],
|
|
161
167
|
compositeIds: [],
|
|
162
168
|
subIds: [],
|
|
@@ -181,16 +187,16 @@ let scanStateSchemaWithAnnotations = S.Metadata.set(scanStateSchema, StateAnnota
|
|
|
181
187
|
globalThis.describe("GraphQL_SchemaInspector", () => {
|
|
182
188
|
globalThis.describe("inspectScalar", () => {
|
|
183
189
|
globalThis.test("plain string derives to String", async () => {
|
|
184
|
-
globalThis.expect(GraphQL_SchemaInspector$ReventlessCore.inspectScalar(
|
|
190
|
+
globalThis.expect(GraphQL_SchemaInspector$ReventlessCore.inspectScalar(stringSchema)).toBe("String");
|
|
185
191
|
});
|
|
186
192
|
globalThis.test("tagged string derives to ID", async () => {
|
|
187
193
|
globalThis.expect(GraphQL_SchemaInspector$ReventlessCore.inspectScalar(DcbTag$Reventless.string)).toBe("ID");
|
|
188
194
|
});
|
|
189
195
|
globalThis.test("float derives to Float", async () => {
|
|
190
|
-
globalThis.expect(GraphQL_SchemaInspector$ReventlessCore.inspectScalar(
|
|
196
|
+
globalThis.expect(GraphQL_SchemaInspector$ReventlessCore.inspectScalar(numberSchema)).toBe("Float");
|
|
191
197
|
});
|
|
192
198
|
globalThis.test("bool derives to Boolean", async () => {
|
|
193
|
-
globalThis.expect(GraphQL_SchemaInspector$ReventlessCore.inspectScalar(
|
|
199
|
+
globalThis.expect(GraphQL_SchemaInspector$ReventlessCore.inspectScalar(boolSchema)).toBe("Boolean");
|
|
194
200
|
});
|
|
195
201
|
});
|
|
196
202
|
globalThis.describe("inspectObjectType", () => {
|
|
@@ -205,7 +211,7 @@ globalThis.describe("GraphQL_SchemaInspector", () => {
|
|
|
205
211
|
globalThis.expect(sdl.includes("active: Boolean")).toBe(true);
|
|
206
212
|
});
|
|
207
213
|
globalThis.test("returns None for non-object schema", async () => {
|
|
208
|
-
let result = GraphQL_SchemaInspector$ReventlessCore.inspectObjectType("Foo",
|
|
214
|
+
let result = GraphQL_SchemaInspector$ReventlessCore.inspectObjectType("Foo", stringSchema);
|
|
209
215
|
globalThis.expect(Stdlib_Option.isNone(result)).toBe(true);
|
|
210
216
|
});
|
|
211
217
|
});
|
|
@@ -229,7 +235,7 @@ globalThis.describe("GraphQL_SchemaInspector", () => {
|
|
|
229
235
|
globalThis.expect(renameField.includes("newName: String")).toBe(true);
|
|
230
236
|
});
|
|
231
237
|
globalThis.test("returns empty for non-object/non-union schema", async () => {
|
|
232
|
-
let fields = GraphQL_SchemaInspector$ReventlessCore.inspectMutationFields("Foo",
|
|
238
|
+
let fields = GraphQL_SchemaInspector$ReventlessCore.inspectMutationFields("Foo", stringSchema);
|
|
233
239
|
globalThis.expect(fields.length).toBe(0);
|
|
234
240
|
});
|
|
235
241
|
});
|
|
@@ -707,14 +713,8 @@ globalThis.describe("optional enum fields preserve GraphQL nullability", () => {
|
|
|
707
713
|
});
|
|
708
714
|
});
|
|
709
715
|
|
|
710
|
-
let stringSchema = S.string;
|
|
711
|
-
|
|
712
716
|
let taggedSchema = DcbTag$Reventless.string;
|
|
713
717
|
|
|
714
|
-
let numberSchema = S.float;
|
|
715
|
-
|
|
716
|
-
let boolSchema = S.bool;
|
|
717
|
-
|
|
718
718
|
export {
|
|
719
719
|
stringSchema,
|
|
720
720
|
taggedSchema,
|
|
@@ -163,7 +163,7 @@ testPromise("POST /__inmemory/login returns {token, identity} for valid credenti
|
|
|
163
163
|
// The echoed identity matches what LocalAuth.lookupUser returns.
|
|
164
164
|
switch getJsonField(body, "identity") {
|
|
165
165
|
| Some(idJson) =>
|
|
166
|
-
let id = idJson->
|
|
166
|
+
let id = idJson->Reventless.Util_Sury.fromJson(Reventless.Identity.schema)
|
|
167
167
|
expect(id.username)->toEqual("alice")
|
|
168
168
|
expect(id.groups)->toEqual(["Editor"])
|
|
169
169
|
| None => JsError.throwWithMessage("response missing identity field")
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
3
|
import * as Nodehttp from "node:http";
|
|
5
4
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
6
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
6
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
8
7
|
import * as Identity$Reventless from "@reventlessdev/reventless-spec/src/types/Identity.res.mjs";
|
|
8
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
9
9
|
import * as LocalAuth$ReventlessLocal from "../../src/adapter/Auth/LocalAuth.res.mjs";
|
|
10
10
|
import * as TestRunner$ReventlessLocal from "../../src/test/TestRunner.res.mjs";
|
|
11
11
|
import * as DomainGraphQL_Server$ReventlessLocal from "../../src/adapter/DomainGraphQL_Server.res.mjs";
|
|
@@ -151,7 +151,7 @@ globalThis.test("POST /__inmemory/login returns {token, identity} for valid cred
|
|
|
151
151
|
if (idJson === undefined) {
|
|
152
152
|
return Stdlib_JsError.throwWithMessage("response missing identity field");
|
|
153
153
|
}
|
|
154
|
-
let id =
|
|
154
|
+
let id = Util_Sury$Reventless.fromJson(idJson, Identity$Reventless.schema);
|
|
155
155
|
globalThis.expect(id.username).toEqual("alice");
|
|
156
156
|
globalThis.expect(id.groups).toEqual(["Editor"]);
|
|
157
157
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
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_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
5
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
6
6
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
@@ -26,13 +26,13 @@ import * as QueryDbResolvers_GraphQL$ReventlessLocal from "../../src/adapter/Que
|
|
|
26
26
|
|
|
27
27
|
TestRunner$ReventlessLocal.setup();
|
|
28
28
|
|
|
29
|
-
let rowStateSchema =
|
|
29
|
+
let rowStateSchema = Sury.$schema(s => ({
|
|
30
30
|
productId: s.m(DcbTag$Reventless.string),
|
|
31
|
-
status: s.m(
|
|
32
|
-
name: s.m(
|
|
31
|
+
status: s.m(Sury.string),
|
|
32
|
+
name: s.m(Sury.string)
|
|
33
33
|
}));
|
|
34
34
|
|
|
35
|
-
let rowStateSchemaWithAnnotations =
|
|
35
|
+
let rowStateSchemaWithAnnotations = Sury.$Metadata_set(rowStateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
36
36
|
ids: ["productId"],
|
|
37
37
|
compositeIds: [],
|
|
38
38
|
subIds: [],
|
|
@@ -1,6 +1,6 @@
|
|
|
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 LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
6
6
|
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
@@ -9,17 +9,17 @@ import * as Aggregate_Builder$ReventlessLocal from "../../../src/components/Aggr
|
|
|
9
9
|
|
|
10
10
|
let name = "TestItem";
|
|
11
11
|
|
|
12
|
-
let commandSchema =
|
|
12
|
+
let commandSchema = Sury.$schema(s => ({
|
|
13
13
|
TAG: "CreateItem",
|
|
14
|
-
name: s.m(
|
|
14
|
+
name: s.m(Sury.string)
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
|
-
let eventSchema =
|
|
17
|
+
let eventSchema = Sury.$schema(s => ({
|
|
18
18
|
TAG: "ItemCreated",
|
|
19
|
-
name: s.m(
|
|
19
|
+
name: s.m(Sury.string)
|
|
20
20
|
}));
|
|
21
21
|
|
|
22
|
-
let errorSchema =
|
|
22
|
+
let errorSchema = Sury.literal("AlreadyExists");
|
|
23
23
|
|
|
24
24
|
let moduleUrl = import.meta.url;
|
|
25
25
|
|
|
@@ -138,7 +138,7 @@ let testContext: Reventless.AutomationSlice.context = {
|
|
|
138
138
|
// the event payload with a `meta.service` matching the source name so the
|
|
139
139
|
// callback's per-source dispatch picks the right mapping.
|
|
140
140
|
let encodeShipOrderEvent = (event: ShipOrderSource.event): JSON.t => {
|
|
141
|
-
let payloadJson = event->
|
|
141
|
+
let payloadJson = event->Reventless.Util_Sury.toJson(ShipOrderSource.eventSchema)
|
|
142
142
|
let dict = switch payloadJson->JSON.Decode.object {
|
|
143
143
|
| Some(d) => d->Dict.copy
|
|
144
144
|
| None =>
|
|
@@ -158,13 +158,13 @@ let encodeShipOrderEvent = (event: ShipOrderSource.event): JSON.t => {
|
|
|
158
158
|
msgId: "msg-1",
|
|
159
159
|
correlationId: "",
|
|
160
160
|
}
|
|
161
|
-
dict->Dict.set("meta", meta->
|
|
161
|
+
dict->Dict.set("meta", meta->Reventless.Util_Sury.toJson(Reventless.Message.metaSchema))
|
|
162
162
|
dict->Dict.set("id", JSON.Encode.string("env-id"))
|
|
163
163
|
JSON.Encode.object(dict)
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
let encodeSkipProcessEvent = (event: SkipProcessSource.event): JSON.t => {
|
|
167
|
-
let payloadJson = event->
|
|
167
|
+
let payloadJson = event->Reventless.Util_Sury.toJson(SkipProcessSource.eventSchema)
|
|
168
168
|
let dict = switch payloadJson->JSON.Decode.object {
|
|
169
169
|
| Some(d) => d->Dict.copy
|
|
170
170
|
| None =>
|
|
@@ -183,7 +183,7 @@ let encodeSkipProcessEvent = (event: SkipProcessSource.event): JSON.t => {
|
|
|
183
183
|
msgId: "msg-1",
|
|
184
184
|
correlationId: "",
|
|
185
185
|
}
|
|
186
|
-
dict->Dict.set("meta", meta->
|
|
186
|
+
dict->Dict.set("meta", meta->Reventless.Util_Sury.toJson(Reventless.Message.metaSchema))
|
|
187
187
|
dict->Dict.set("id", JSON.Encode.string("env-id"))
|
|
188
188
|
JSON.Encode.object(dict)
|
|
189
189
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
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_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
5
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
6
6
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
7
7
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
8
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
8
9
|
import * as AutomationSlice$Reventless from "@reventlessdev/reventless-spec/src/components/AutomationSlice.res.mjs";
|
|
9
10
|
|
|
10
11
|
let name = "ShipOrderDcbEventLog";
|
|
11
12
|
|
|
12
|
-
let eventSchema =
|
|
13
|
-
|
|
13
|
+
let eventSchema = Sury.union([
|
|
14
|
+
Sury.$schema(s => ({
|
|
14
15
|
TAG: "OrderPlaced",
|
|
15
16
|
orderId: s.m(DcbTag$Reventless.string),
|
|
16
|
-
address: s.m(
|
|
17
|
+
address: s.m(Sury.string)
|
|
17
18
|
})),
|
|
18
|
-
|
|
19
|
+
Sury.$schema(s => ({
|
|
19
20
|
TAG: "ShipmentCreated",
|
|
20
21
|
orderId: s.m(DcbTag$Reventless.string)
|
|
21
22
|
}))
|
|
@@ -29,12 +30,12 @@ let ShipOrderSource = {
|
|
|
29
30
|
|
|
30
31
|
let name$1 = "SkipProcessDcbEventLog";
|
|
31
32
|
|
|
32
|
-
let eventSchema$1 =
|
|
33
|
-
|
|
33
|
+
let eventSchema$1 = Sury.union([
|
|
34
|
+
Sury.$schema(s => ({
|
|
34
35
|
TAG: "OrderPlaced",
|
|
35
36
|
orderId: s.m(DcbTag$Reventless.string)
|
|
36
37
|
})),
|
|
37
|
-
|
|
38
|
+
Sury.$schema(s => ({
|
|
38
39
|
TAG: "ShipmentCreated",
|
|
39
40
|
orderId: s.m(DcbTag$Reventless.string)
|
|
40
41
|
}))
|
|
@@ -48,12 +49,12 @@ let SkipProcessSource = {
|
|
|
48
49
|
|
|
49
50
|
let moduleUrl = import.meta.url;
|
|
50
51
|
|
|
51
|
-
let todoItemSchema =
|
|
52
|
-
orderId: s.m(
|
|
53
|
-
address: s.m(
|
|
52
|
+
let todoItemSchema = Sury.$schema(s => ({
|
|
53
|
+
orderId: s.m(Sury.string),
|
|
54
|
+
address: s.m(Sury.string)
|
|
54
55
|
}));
|
|
55
56
|
|
|
56
|
-
let commandSchema =
|
|
57
|
+
let commandSchema = Sury.$schema(s => ({
|
|
57
58
|
TAG: "CreateShipment",
|
|
58
59
|
orderId: s.m(DcbTag$Reventless.string)
|
|
59
60
|
}));
|
|
@@ -75,11 +76,11 @@ let ShipOrderSpec = {
|
|
|
75
76
|
|
|
76
77
|
let moduleUrl$1 = import.meta.url;
|
|
77
78
|
|
|
78
|
-
let todoItemSchema$1 =
|
|
79
|
-
orderId: s.m(
|
|
79
|
+
let todoItemSchema$1 = Sury.$schema(s => ({
|
|
80
|
+
orderId: s.m(Sury.string)
|
|
80
81
|
}));
|
|
81
82
|
|
|
82
|
-
let commandSchema$1 =
|
|
83
|
+
let commandSchema$1 = Sury.literal("Noop");
|
|
83
84
|
|
|
84
85
|
function commandAuthorization$1(param) {
|
|
85
86
|
return "AllowAuthenticated";
|
|
@@ -196,7 +197,7 @@ let SkipProcessAutomation = {
|
|
|
196
197
|
};
|
|
197
198
|
|
|
198
199
|
function encodeShipOrderEvent(event) {
|
|
199
|
-
let payloadJson =
|
|
200
|
+
let payloadJson = Util_Sury$Reventless.toJson(event, eventSchema);
|
|
200
201
|
let d = Stdlib_JSON.Decode.object(payloadJson);
|
|
201
202
|
let dict;
|
|
202
203
|
if (d !== undefined) {
|
|
@@ -219,13 +220,13 @@ function encodeShipOrderEvent(event) {
|
|
|
219
220
|
msgId: "msg-1",
|
|
220
221
|
correlationId: ""
|
|
221
222
|
};
|
|
222
|
-
dict["meta"] =
|
|
223
|
+
dict["meta"] = Util_Sury$Reventless.toJson(meta, Message$Reventless.metaSchema);
|
|
223
224
|
dict["id"] = "env-id";
|
|
224
225
|
return dict;
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
function encodeSkipProcessEvent(event) {
|
|
228
|
-
let payloadJson =
|
|
229
|
+
let payloadJson = Util_Sury$Reventless.toJson(event, eventSchema$1);
|
|
229
230
|
let d = Stdlib_JSON.Decode.object(payloadJson);
|
|
230
231
|
let dict;
|
|
231
232
|
if (d !== undefined) {
|
|
@@ -248,7 +249,7 @@ function encodeSkipProcessEvent(event) {
|
|
|
248
249
|
msgId: "msg-1",
|
|
249
250
|
correlationId: ""
|
|
250
251
|
};
|
|
251
|
-
dict["meta"] =
|
|
252
|
+
dict["meta"] = Util_Sury$Reventless.toJson(meta, Message$Reventless.metaSchema);
|
|
252
253
|
dict["id"] = "env-id";
|
|
253
254
|
return dict;
|
|
254
255
|
}
|
|
@@ -207,7 +207,7 @@ let publishJsons: ReventlessInfra.CommandTopic.publishJsons = async cmdJsons =>
|
|
|
207
207
|
let fullBody = JSON.Encode.object(
|
|
208
208
|
Dict.fromArray([
|
|
209
209
|
("id", JSON.Encode.string(cmdJson.id)),
|
|
210
|
-
("meta", cmdJson.meta->
|
|
210
|
+
("meta", cmdJson.meta->Reventless.Util_Sury.toJson(Reventless.Message.metaSchema)),
|
|
211
211
|
("command", cmdJson.commandJson),
|
|
212
212
|
]),
|
|
213
213
|
)
|
|
@@ -266,7 +266,7 @@ let placeCmdJson = (orderId: string): Reventless.Message.commandJson => {
|
|
|
266
266
|
id: orderId,
|
|
267
267
|
meta: testMeta,
|
|
268
268
|
commandJson: PlaceSpec.Place({orderId: orderId})
|
|
269
|
-
->
|
|
269
|
+
->Reventless.Util_Sury.toJson(PlaceSpec.commandSchema),
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
// Promise-based timeout used to fail fast if the chain self-deadlocks.
|