@reventlessdev/reventless-core 3.0.0-alpha.268 → 3.0.0-alpha.269
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 +8 -0
- package/README.md +1 -1
- package/package.json +16 -16
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +4 -4
- package/src/components/CommandGenerator/CommandGenerator_Callback.res.mjs +90 -92
- package/src/components/Counter/Counter_Callback.res.mjs +1 -1
- package/src/components/Counter/Counter_Operations.res.mjs +1 -1
- package/src/components/EventCollector/EventCollector_Builder.res.mjs +3 -3
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +2 -3
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +4 -4
- package/src/plugin/component/Plugin_Builder.res.mjs +3 -3
- package/src/plugin/component/Plugin_Helpers.res.mjs +2 -2
- package/src/plugin/lifecycle/PluginBehavior.res.mjs +1 -1
- package/src/util/Interstack.res.mjs +4 -4
- package/tests/aggregate/AggregateCacheTest.res.mjs +1 -1
- package/tests/api/BrandedMarkerCompositionTest.res.mjs +2 -3
- package/tests/api/GeolocationSemanticTest.res.mjs +1 -2
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +2 -2
- package/tests/api/SuryToJsonSchemaTest.res +8 -8
- package/tests/api/SuryToJsonSchemaTest.res.mjs +24 -24
- package/tests/dcb/DcbFixtures.res.mjs +6 -6
- package/tests/dcb/DcbValidationTest.res.mjs +3 -3
- package/tests/eventmapper/EventMapperFixtures.res.mjs +5 -5
- package/tests/plugin/PluginSpecExperiment.res +2 -2
- package/tests/plugin/PluginSpecExperiment.res.mjs +3 -3
- package/tests/plugin/PluginStructureTest.res +1 -1
- package/tests/plugin/PluginStructureTest.res.mjs +5 -5
- package/tests/plugin/SchemaWalkerTest.res.mjs +2 -2
- package/tests/plugin/StateChange/PsReserveStock.res.mjs +1 -1
- package/tests/plugin/StateView/PsAnnotatedView.res +1 -1
- package/tests/plugin/StateView/PsAnnotatedView.res.mjs +4 -4
- package/tests/querydb/QueryDbFixtures.res.mjs +1 -1
- package/tests/util/CommandPublisherTest.res.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.269 (2026-09-21)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **deps:** update rescript to 12.3.1 ([ea1ce37](https://github.com/ReventlessDev/reventless-core/commit/ea1ce377297640f6d0d360e6c84c778d59ecbcc5))
|
|
11
|
+
* **deps:** update sury to 11.0.0 ([8715b22](https://github.com/ReventlessDev/reventless-core/commit/8715b22b33856c46ba57518aad151065c123a995))
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# 3.0.0-alpha.268 (2026-09-21)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.269",
|
|
4
4
|
"description": "Core package for Reventless framework",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -26,27 +26,27 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"sury": "11.0.0
|
|
29
|
+
"sury": "11.0.0",
|
|
30
30
|
"uuid": "^13.0.0",
|
|
31
|
-
"@reventlessdev/rescript-effect": "0.1.0-alpha.
|
|
32
|
-
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.
|
|
33
|
-
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.
|
|
34
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.
|
|
35
|
-
"@reventlessdev/rescript-node": "2.0.0-alpha.
|
|
36
|
-
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.
|
|
37
|
-
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.
|
|
38
|
-
"@reventlessdev/rescript-uuid": "2.0.0-alpha.
|
|
39
|
-
"@reventlessdev/reventless-
|
|
40
|
-
"@reventlessdev/reventless-
|
|
41
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.
|
|
31
|
+
"@reventlessdev/rescript-effect": "0.1.0-alpha.34",
|
|
32
|
+
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
33
|
+
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.13",
|
|
34
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.11",
|
|
35
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.13",
|
|
36
|
+
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.22",
|
|
37
|
+
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.13",
|
|
38
|
+
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
39
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.169",
|
|
40
|
+
"@reventlessdev/reventless-interop": "3.0.0-alpha.38",
|
|
41
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.141"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"rescript": "12.3.
|
|
45
|
-
"sury-ppx": "11.0.0
|
|
44
|
+
"rescript": "12.3.1",
|
|
45
|
+
"sury-ppx": "11.0.0",
|
|
46
46
|
"@reventlessdev/reventless-ppx": "1.0.0-alpha.81"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"rescript": "12.3.
|
|
49
|
+
"rescript": "^12.3.1"
|
|
50
50
|
},
|
|
51
51
|
"gitHead": "ddea51534dc210635d7b11968089627b3b697ce2",
|
|
52
52
|
"publishConfig": {
|
|
@@ -28,8 +28,8 @@ let todoRowSchema = Sury.$schema(s => ({
|
|
|
28
28
|
createdAt: s.m(Sury.string),
|
|
29
29
|
processedAt: s.m(Sury.$option(Sury.string)),
|
|
30
30
|
completedAt: s.m(Sury.$option(Sury.string)),
|
|
31
|
-
retryCount: s.m(Sury.
|
|
32
|
-
maxRetries: s.m(Sury.$option(Sury.
|
|
31
|
+
retryCount: s.m(Sury.int32),
|
|
32
|
+
maxRetries: s.m(Sury.$option(Sury.int32))
|
|
33
33
|
}));
|
|
34
34
|
|
|
35
35
|
function todoRowSchemaFor(itemSchema) {
|
|
@@ -39,8 +39,8 @@ function todoRowSchemaFor(itemSchema) {
|
|
|
39
39
|
createdAt: s.m(Sury.string),
|
|
40
40
|
processedAt: s.m(Sury.$option(Sury.string)),
|
|
41
41
|
completedAt: s.m(Sury.$option(Sury.string)),
|
|
42
|
-
retryCount: s.m(Sury.
|
|
43
|
-
maxRetries: s.m(Sury.$option(Sury.
|
|
42
|
+
retryCount: s.m(Sury.int32),
|
|
43
|
+
maxRetries: s.m(Sury.$option(Sury.int32))
|
|
44
44
|
}));
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -59,103 +59,101 @@ function dropNullArguments(obj) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
function makeGenerateCommand(publishJsons, publishJsonsAndWait, serviceName, commandSchema, componentKind,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
let message = Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message);
|
|
116
|
-
let reason = message !== undefined ? message : Stdlib_Option.getOr(JSON.stringify(err), "unknown error");
|
|
117
|
-
return Plugin_ResolverError$ReventlessCore.throwCallerFault(`Error: Couldn't decode ` + JSON.stringify(commandJson) + `: ` + reason);
|
|
62
|
+
function makeGenerateCommand(publishJsons, publishJsonsAndWait, serviceName, commandSchema, componentKind, stripIdFromParamsOpt, partitionTag) {
|
|
63
|
+
let stripIdFromParams = stripIdFromParamsOpt !== undefined ? stripIdFromParamsOpt : true;
|
|
64
|
+
return payload => Effect.flatMap(Effect.tap(Effect.sync(() => {
|
|
65
|
+
let msgId = Message$ReventlessCore.uuid();
|
|
66
|
+
let meta_time = Message$ReventlessCore.nowAsISOString();
|
|
67
|
+
let meta_ip = Stdlib_Option.getOr(payload.meta.ip.shift(), "");
|
|
68
|
+
let meta_user = payload.meta.user;
|
|
69
|
+
let meta = {
|
|
70
|
+
service: serviceName,
|
|
71
|
+
time: meta_time,
|
|
72
|
+
ip: meta_ip,
|
|
73
|
+
user: meta_user,
|
|
74
|
+
msgId: msgId,
|
|
75
|
+
correlationId: msgId
|
|
76
|
+
};
|
|
77
|
+
let obj = Stdlib_Option.flatMap(JSON.stringify(payload.arguments), jsonString => Stdlib_JSON.Decode.object(JSON.parse(jsonString)));
|
|
78
|
+
let params = obj !== undefined ? (stripIdFromParams ? Stdlib_Dict.$$delete(obj, "id") : undefined, dropNullArguments(obj), stampOwnerFields(obj, commandSchema, payload.command, payload.identity, serviceName), Object.entries(obj)) : Stdlib_JsError.throwWithMessage("Couldn't decode:" + Stdlib_Option.getOr(JSON.stringify(payload.arguments), "<payload.arguments>"));
|
|
79
|
+
let commandStr = payload.command;
|
|
80
|
+
let match = params.length;
|
|
81
|
+
let commandJson = match !== 0 ? Object.fromEntries([[
|
|
82
|
+
"TAG",
|
|
83
|
+
commandStr
|
|
84
|
+
]].concat(params)) : commandStr;
|
|
85
|
+
let suppliedId = payload.arguments.id;
|
|
86
|
+
let id;
|
|
87
|
+
id = componentKind === "Aggregate" || !(suppliedId == null) ? suppliedId : Stdlib_Option.mapOr(partitionTag, "", pt => DcbTag$Reventless.partitionValueOfTags(DcbTag$Reventless.extractTagsFromJson(commandSchema, commandJson), pt));
|
|
88
|
+
return [
|
|
89
|
+
meta,
|
|
90
|
+
commandJson,
|
|
91
|
+
id
|
|
92
|
+
];
|
|
93
|
+
}), param => {
|
|
94
|
+
let commandJson = param[1];
|
|
95
|
+
return EffectLogger$ReventlessCore.logInfo(`CommandGenerator(` + serviceName + `)`, commandJson, `generated command: ` + LogFormat$ReventlessCore.cmdLabelOfJson(commandJson));
|
|
96
|
+
}), param => {
|
|
97
|
+
let id = param[2];
|
|
98
|
+
let commandJson = param[1];
|
|
99
|
+
let meta = param[0];
|
|
100
|
+
let val;
|
|
101
|
+
try {
|
|
102
|
+
val = Message$ReventlessCore.decode(commandJson, commandSchema);
|
|
103
|
+
} catch (raw_err) {
|
|
104
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
105
|
+
let hook = Plugin_ResolverError$ReventlessCore.onResolverErrorHook.contents;
|
|
106
|
+
if (hook !== undefined) {
|
|
107
|
+
hook({
|
|
108
|
+
pluginName: "",
|
|
109
|
+
componentName: serviceName,
|
|
110
|
+
attemptedCommandType: Message$ReventlessCore.variantNameOfJson(commandJson),
|
|
111
|
+
timestamp: Message$ReventlessCore.nowAsISOString()
|
|
112
|
+
});
|
|
118
113
|
}
|
|
119
|
-
let
|
|
120
|
-
let
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return newrecord;
|
|
138
|
-
case "Rejected" :
|
|
139
|
-
case "Pending" :
|
|
114
|
+
let message = Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message);
|
|
115
|
+
let reason = message !== undefined ? message : Stdlib_Option.getOr(JSON.stringify(err), "unknown error");
|
|
116
|
+
return Plugin_ResolverError$ReventlessCore.throwCallerFault(`Error: Couldn't decode ` + JSON.stringify(commandJson) + `: ` + reason);
|
|
117
|
+
}
|
|
118
|
+
let interceptor = commandInterceptorHook.contents;
|
|
119
|
+
let interceptEffect = interceptor !== undefined ? Effect.promise(() => interceptor(payload.identity, serviceName, componentKind, payload.command, payload.arguments)) : Effect.succeed("Allow");
|
|
120
|
+
return Effect.flatMap(interceptEffect, interceptResult => {
|
|
121
|
+
if (typeof interceptResult !== "object") {
|
|
122
|
+
if (publishJsonsAndWait !== undefined) {
|
|
123
|
+
return Effect.map(Effect.promise(() => publishJsonsAndWait([{
|
|
124
|
+
id: id,
|
|
125
|
+
meta: meta,
|
|
126
|
+
commandJson: commandJson
|
|
127
|
+
}])), outcomes => {
|
|
128
|
+
let payload = outcomes[0];
|
|
129
|
+
switch (payload.TAG) {
|
|
130
|
+
case "Accepted" :
|
|
131
|
+
if (!Stdlib_Option.isNone(payload.entityId)) {
|
|
140
132
|
return payload;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
msgId: meta.msgId
|
|
151
|
-
}));
|
|
152
|
-
}
|
|
133
|
+
}
|
|
134
|
+
let newrecord = {...payload};
|
|
135
|
+
newrecord.entityId = id;
|
|
136
|
+
return newrecord;
|
|
137
|
+
case "Rejected" :
|
|
138
|
+
case "Pending" :
|
|
139
|
+
return payload;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
153
142
|
} else {
|
|
154
|
-
return
|
|
143
|
+
return Effect.map(Effect.promise(() => publishJsons([{
|
|
144
|
+
id: id,
|
|
145
|
+
meta: meta,
|
|
146
|
+
commandJson: commandJson
|
|
147
|
+
}])), () => ({
|
|
148
|
+
TAG: "Pending",
|
|
149
|
+
msgId: meta.msgId
|
|
150
|
+
}));
|
|
155
151
|
}
|
|
156
|
-
}
|
|
152
|
+
} else {
|
|
153
|
+
return Stdlib_JsError.throwWithMessage(interceptResult._0);
|
|
154
|
+
}
|
|
157
155
|
});
|
|
158
|
-
};
|
|
156
|
+
});
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
function Make(Spec) {
|
|
@@ -9,7 +9,7 @@ import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
|
9
9
|
|
|
10
10
|
let referencesStateSchema = Sury.$schema(s => ({
|
|
11
11
|
id: s.m(Sury.string),
|
|
12
|
-
inc: s.m(Sury.
|
|
12
|
+
inc: s.m(Sury.int32)
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
15
|
function groupCountItemsByCounterId(countItems) {
|
|
@@ -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 Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Stream from "effect/Stream";
|
|
@@ -9,7 +9,7 @@ import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
|
9
9
|
import * as EventCollector$ReventlessCore from "./EventCollector.res.mjs";
|
|
10
10
|
|
|
11
11
|
function makeStreamHandler(eventCollector, schema, jsonEventsHandler) {
|
|
12
|
-
let jsonHandler = stream => jsonEventsHandler(Stream.mapEffect(stream, json => Effect.trySync(_exn => "decode error", () =>
|
|
12
|
+
let jsonHandler = stream => jsonEventsHandler(Stream.mapEffect(stream, json => Effect.trySync(_exn => "decode error", () => Sury.parseOrThrow(json, schema))));
|
|
13
13
|
let channel = eventCollector.channel;
|
|
14
14
|
return channel.handleChannelEvent(jsonHandler);
|
|
15
15
|
}
|
|
@@ -61,4 +61,4 @@ export {
|
|
|
61
61
|
makeStreamHandler,
|
|
62
62
|
Make,
|
|
63
63
|
}
|
|
64
|
-
/*
|
|
64
|
+
/* sury Not a pure module */
|
|
@@ -1,6 +1,5 @@
|
|
|
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 Sury from "sury";
|
|
5
4
|
import * as Uuid from "uuid";
|
|
6
5
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
@@ -20,7 +19,7 @@ let auditRowSchema = Sury.$schema(s => ({
|
|
|
20
19
|
input: s.m(Sury.string),
|
|
21
20
|
status: s.m(auditStatusSchema),
|
|
22
21
|
targetIds: s.m(Sury.$option(Sury.array(Sury.string))),
|
|
23
|
-
commandCount: s.m(Sury.$option(Sury.
|
|
22
|
+
commandCount: s.m(Sury.$option(Sury.int32)),
|
|
24
23
|
error: s.m(Sury.$option(Sury.string)),
|
|
25
24
|
receivedAt: s.m(Sury.string)
|
|
26
25
|
}));
|
|
@@ -75,7 +74,7 @@ function Make(Spec) {
|
|
|
75
74
|
try {
|
|
76
75
|
input = {
|
|
77
76
|
TAG: "Ok",
|
|
78
|
-
_0:
|
|
77
|
+
_0: Sury.parseOrThrow(inputJson, Spec.externalInputSchema)
|
|
79
78
|
};
|
|
80
79
|
} catch (raw_exn) {
|
|
81
80
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
@@ -25,8 +25,8 @@ let todoRowSchema = Sury.$schema(s => ({
|
|
|
25
25
|
createdAt: s.m(Sury.string),
|
|
26
26
|
processedAt: s.m(Sury.$option(Sury.string)),
|
|
27
27
|
completedAt: s.m(Sury.$option(Sury.string)),
|
|
28
|
-
retryCount: s.m(Sury.
|
|
29
|
-
maxRetries: s.m(Sury.$option(Sury.
|
|
28
|
+
retryCount: s.m(Sury.int32),
|
|
29
|
+
maxRetries: s.m(Sury.$option(Sury.int32)),
|
|
30
30
|
lastError: s.m(Sury.$option(Sury.string))
|
|
31
31
|
}));
|
|
32
32
|
|
|
@@ -37,8 +37,8 @@ function todoRowSchemaFor(itemSchema) {
|
|
|
37
37
|
createdAt: s.m(Sury.string),
|
|
38
38
|
processedAt: s.m(Sury.$option(Sury.string)),
|
|
39
39
|
completedAt: s.m(Sury.$option(Sury.string)),
|
|
40
|
-
retryCount: s.m(Sury.
|
|
41
|
-
maxRetries: s.m(Sury.$option(Sury.
|
|
40
|
+
retryCount: s.m(Sury.int32),
|
|
41
|
+
maxRetries: s.m(Sury.$option(Sury.int32)),
|
|
42
42
|
lastError: s.m(Sury.$option(Sury.string))
|
|
43
43
|
}));
|
|
44
44
|
}
|
|
@@ -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 Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Pulumi from "@pulumi/pulumi";
|
|
@@ -461,7 +461,7 @@ function Make(Spec) {
|
|
|
461
461
|
let extensionPointsOutputs = match$1[0];
|
|
462
462
|
let coreSetup;
|
|
463
463
|
if (interstackAdminExtensionPoints !== undefined) {
|
|
464
|
-
let pluginExtensionPointUnwrapped =
|
|
464
|
+
let pluginExtensionPointUnwrapped = Sury.parseOrThrow(StackReference$Pulumi.get(interstackAdminExtensionPoints, PluginExtensionPointSpec$ReventlessInfra.name), ExtensionPoint$ReventlessInterop.resolvedOutputsSchema);
|
|
465
465
|
let pluginExtensionPointCommandTopicRemoteChannel = PluginExtensionPointRemoteChannel.make(pluginExtensionPointUnwrapped.commandTopic.resources.map(Adapter$ReventlessCore.fromInteropResolved));
|
|
466
466
|
coreSetup = [
|
|
467
467
|
pluginExtensionPointUnwrapped,
|
|
@@ -671,4 +671,4 @@ export {
|
|
|
671
671
|
PluginExtensionPointSpec,
|
|
672
672
|
Make,
|
|
673
673
|
}
|
|
674
|
-
/*
|
|
674
|
+
/* sury Not a pure module */
|
|
@@ -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_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
5
5
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
6
6
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
@@ -79,7 +79,7 @@ function getRemoteStorageResources(pluginName, queryDbName) {
|
|
|
79
79
|
return [];
|
|
80
80
|
}
|
|
81
81
|
try {
|
|
82
|
-
let readModel =
|
|
82
|
+
let readModel = Sury.parseOrThrow(rawReadModel, ReadModel$ReventlessInterop.resolvedOutputsSchema);
|
|
83
83
|
return Adapter$ReventlessCore.fromInteropResources(readModel.queryDb.resources);
|
|
84
84
|
} catch (raw_exn) {
|
|
85
85
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
@@ -20,7 +20,7 @@ let knownVersionSchema = Sury.$schema(s => ({
|
|
|
20
20
|
|
|
21
21
|
let stateSchema = Sury.$schema(s => ({
|
|
22
22
|
current: s.m(Sury.$option(Plugin$Reventless.versionSchema)),
|
|
23
|
-
known: s.m(Sury.
|
|
23
|
+
known: s.m(Sury.record(knownVersionSchema))
|
|
24
24
|
}));
|
|
25
25
|
|
|
26
26
|
let initialState_known = {};
|
|
@@ -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_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Pulumi from "@pulumi/pulumi";
|
|
@@ -25,7 +25,7 @@ function fromJson(json) {
|
|
|
25
25
|
try {
|
|
26
26
|
return {
|
|
27
27
|
TAG: "Ok",
|
|
28
|
-
_0:
|
|
28
|
+
_0: Sury.parseOrThrow(json, Task$ReventlessInterop.resolvedOutputsSchema)
|
|
29
29
|
};
|
|
30
30
|
} catch (raw_exn) {
|
|
31
31
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
@@ -54,7 +54,7 @@ function fromJson$1(json) {
|
|
|
54
54
|
try {
|
|
55
55
|
return {
|
|
56
56
|
TAG: "Ok",
|
|
57
|
-
_0:
|
|
57
|
+
_0: Sury.parseOrThrow(json, EventMapper$ReventlessInterop.resolvedOutputsSchema)
|
|
58
58
|
};
|
|
59
59
|
} catch (raw_exn) {
|
|
60
60
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
@@ -88,7 +88,7 @@ function fromJson$2(json) {
|
|
|
88
88
|
try {
|
|
89
89
|
return {
|
|
90
90
|
TAG: "Ok",
|
|
91
|
-
_0:
|
|
91
|
+
_0: Sury.parseOrThrow(json, ExtensionPoint$ReventlessInterop.resolvedOutputsSchema)
|
|
92
92
|
};
|
|
93
93
|
} catch (raw_exn) {
|
|
94
94
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
@@ -1,6 +1,5 @@
|
|
|
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 Sury from "sury";
|
|
5
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
5
|
import * as Owner$Reventless from "@reventlessdev/reventless-spec/src/components/Owner.res.mjs";
|
|
@@ -28,7 +27,7 @@ globalThis.describe("a field marker on a branded semantic:", () => {
|
|
|
28
27
|
return false;
|
|
29
28
|
}
|
|
30
29
|
try {
|
|
31
|
-
|
|
30
|
+
Sury.parseOrThrow(raw, schema);
|
|
32
31
|
return true;
|
|
33
32
|
} catch (exn) {
|
|
34
33
|
return false;
|
|
@@ -54,7 +53,7 @@ globalThis.describe("a field marker on a branded semantic:", () => {
|
|
|
54
53
|
return false;
|
|
55
54
|
}
|
|
56
55
|
try {
|
|
57
|
-
|
|
56
|
+
Sury.parseOrThrow(raw, schema);
|
|
58
57
|
return true;
|
|
59
58
|
} catch (exn) {
|
|
60
59
|
return false;
|
|
@@ -1,6 +1,5 @@
|
|
|
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 Sury from "sury";
|
|
5
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
5
|
import * as Semantic$Reventless from "@reventlessdev/reventless-spec/src/semantic/Semantic.res.mjs";
|
|
@@ -89,7 +88,7 @@ globalThis.describe("a row in the pre-union shape does not decode", () => {
|
|
|
89
88
|
globalThis.test("the three-field shape is refused against the union schema", () => {
|
|
90
89
|
let decodes;
|
|
91
90
|
try {
|
|
92
|
-
|
|
91
|
+
Sury.parseOrThrow(oldShapedRow, stateSchema);
|
|
93
92
|
decodes = true;
|
|
94
93
|
} catch (exn) {
|
|
95
94
|
decodes = false;
|
|
@@ -234,7 +234,7 @@ globalThis.describe("deriveServerCapability — inferred keys reach the SDL surf
|
|
|
234
234
|
globalThis.test("an inferred key yields an eq filter and a sort field", () => {
|
|
235
235
|
let schema = Sury.$schema(s => ({
|
|
236
236
|
orderId: s.m(Sury.string),
|
|
237
|
-
total: s.m(Sury.
|
|
237
|
+
total: s.m(Sury.number)
|
|
238
238
|
}));
|
|
239
239
|
let c = GraphQL_FragmentGenerator$ReventlessCore.deriveServerCapability("Orders", schema);
|
|
240
240
|
globalThis.expect(c.filterFields.map(f => f.name)).toEqual(["orderId"]);
|
|
@@ -387,7 +387,7 @@ let schema = Sury.$schema(s => ({
|
|
|
387
387
|
shippingMethod: s.m(shippingMethodSchema),
|
|
388
388
|
total: s.m(Money$Reventless.schema),
|
|
389
389
|
tip: s.m(Sury.$option(Money$Reventless.schema)),
|
|
390
|
-
itemCount: s.m(Sury.
|
|
390
|
+
itemCount: s.m(Sury.int32)
|
|
391
391
|
}));
|
|
392
392
|
|
|
393
393
|
let PlaceOrder = {
|
|
@@ -1012,10 +1012,10 @@ describe("SuryToJsonSchema:", () => {
|
|
|
1012
1012
|
)
|
|
1013
1013
|
})
|
|
1014
1014
|
|
|
1015
|
-
// Parity sanity-check: deriveObjectSchema and the legacy S.
|
|
1015
|
+
// Parity sanity-check: deriveObjectSchema and the legacy S.toInputJSONSchemaOrThrow must
|
|
1016
1016
|
// agree on `properties` keyset and `required` array for unannotated objects,
|
|
1017
1017
|
// so swapping the encoder at Plugin_Structure.res:261/280 doesn't drop fields.
|
|
1018
|
-
describe("parity with S.
|
|
1018
|
+
describe("parity with S.toInputJSONSchemaOrThrow for unannotated objects:", () => {
|
|
1019
1019
|
let getKeys = (schema: JSON.t): array<string> =>
|
|
1020
1020
|
switch getProperty(schema, "properties")->Option.flatMap(JSON.Decode.object) {
|
|
1021
1021
|
| Some(obj) => obj->Dict.keysToArray
|
|
@@ -1031,7 +1031,7 @@ describe("SuryToJsonSchema:", () => {
|
|
|
1031
1031
|
let sortStrings = (xs: array<string>): array<string> => xs->Array.toSorted(String.compare)
|
|
1032
1032
|
|
|
1033
1033
|
testSync(
|
|
1034
|
-
"properties keyset matches between deriveObjectSchema and S.
|
|
1034
|
+
"properties keyset matches between deriveObjectSchema and S.toInputJSONSchemaOrThrow",
|
|
1035
1035
|
() => {
|
|
1036
1036
|
let schema = S.schema(
|
|
1037
1037
|
s =>
|
|
@@ -1042,13 +1042,13 @@ describe("SuryToJsonSchema:", () => {
|
|
|
1042
1042
|
},
|
|
1043
1043
|
)->S.castToUnknown
|
|
1044
1044
|
let derived = SuryToJsonSchema.deriveObjectSchema(schema)
|
|
1045
|
-
let native = (schema->S.
|
|
1045
|
+
let native = (schema->S.toInputJSONSchemaOrThrow->Obj.magic: JSON.t)
|
|
1046
1046
|
expect(derived->getKeys->sortStrings)->toEqual(native->getKeys->sortStrings)
|
|
1047
1047
|
},
|
|
1048
1048
|
)
|
|
1049
1049
|
|
|
1050
1050
|
testSync(
|
|
1051
|
-
"required array matches between deriveObjectSchema and S.
|
|
1051
|
+
"required array matches between deriveObjectSchema and S.toInputJSONSchemaOrThrow",
|
|
1052
1052
|
() => {
|
|
1053
1053
|
let schema = S.schema(
|
|
1054
1054
|
s =>
|
|
@@ -1058,13 +1058,13 @@ describe("SuryToJsonSchema:", () => {
|
|
|
1058
1058
|
},
|
|
1059
1059
|
)->S.castToUnknown
|
|
1060
1060
|
let derived = SuryToJsonSchema.deriveObjectSchema(schema)
|
|
1061
|
-
let native = (schema->S.
|
|
1061
|
+
let native = (schema->S.toInputJSONSchemaOrThrow->Obj.magic: JSON.t)
|
|
1062
1062
|
expect(derived->getRequired->sortStrings)->toEqual(native->getRequired->sortStrings)
|
|
1063
1063
|
},
|
|
1064
1064
|
)
|
|
1065
1065
|
|
|
1066
1066
|
testSync(
|
|
1067
|
-
"S.
|
|
1067
|
+
"S.toInputJSONSchemaOrThrow does NOT emit x-reventless-* keys even when metadata is set",
|
|
1068
1068
|
() => {
|
|
1069
1069
|
let withSpec = (schema, spec) =>
|
|
1070
1070
|
schema->S.Metadata.set(~id=Reventless.StateAnnotations.stateAnnotationsId, spec)
|
|
@@ -1076,7 +1076,7 @@ describe("SuryToJsonSchema:", () => {
|
|
|
1076
1076
|
},
|
|
1077
1077
|
)->S.castToUnknown
|
|
1078
1078
|
let schema' = schema->withSpec({...emptySpec, ids: ["entityId"]})
|
|
1079
|
-
let native = (schema'->S.
|
|
1079
|
+
let native = (schema'->S.toInputJSONSchemaOrThrow->Obj.magic: JSON.t)
|
|
1080
1080
|
let entityIdSchema = getPropertyOf(native, "entityId")
|
|
1081
1081
|
expect(entityIdSchema->Option.flatMap(s => getProperty(s, "x-reventless-id")))->toBe(None)
|
|
1082
1082
|
},
|
|
@@ -471,7 +471,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
471
471
|
globalThis.test("emits x-reventless-semantic on the field listed in semantic", () => {
|
|
472
472
|
let schema = Sury.$schema(s => ({
|
|
473
473
|
id: s.m(Sury.string),
|
|
474
|
-
total: s.m(Sury.
|
|
474
|
+
total: s.m(Sury.number)
|
|
475
475
|
}));
|
|
476
476
|
let newrecord = {...emptySpec};
|
|
477
477
|
newrecord.semantic = [[
|
|
@@ -494,7 +494,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
494
494
|
globalThis.test("emits x-reventless-metric {aggregate,label} on the field listed in metric", () => {
|
|
495
495
|
let schema = Sury.$schema(s => ({
|
|
496
496
|
id: s.m(Sury.string),
|
|
497
|
-
total: s.m(Sury.
|
|
497
|
+
total: s.m(Sury.number)
|
|
498
498
|
}));
|
|
499
499
|
let newrecord = {...emptySpec};
|
|
500
500
|
newrecord.metric = [[
|
|
@@ -518,7 +518,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
518
518
|
});
|
|
519
519
|
globalThis.test("omits the metric label when empty (UI derives one from the field name)", () => {
|
|
520
520
|
let schema = Sury.$schema(s => ({
|
|
521
|
-
total: s.m(Sury.
|
|
521
|
+
total: s.m(Sury.number)
|
|
522
522
|
}));
|
|
523
523
|
let newrecord = {...emptySpec};
|
|
524
524
|
newrecord.metric = [[
|
|
@@ -543,7 +543,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
543
543
|
globalThis.test("emits x-reventless-retired {label,showWhenFalse} on the retired field", () => {
|
|
544
544
|
let schema = Sury.$schema(s => ({
|
|
545
545
|
id: s.m(Sury.string),
|
|
546
|
-
archived: s.m(Sury.
|
|
546
|
+
archived: s.m(Sury.boolean)
|
|
547
547
|
}));
|
|
548
548
|
let newrecord = {...emptySpec};
|
|
549
549
|
newrecord.retired = {
|
|
@@ -612,7 +612,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
612
612
|
});
|
|
613
613
|
globalThis.test("omits both value and values entirely on the boolean form", () => {
|
|
614
614
|
let schema = Sury.$schema(s => ({
|
|
615
|
-
archived: s.m(Sury.
|
|
615
|
+
archived: s.m(Sury.boolean)
|
|
616
616
|
}));
|
|
617
617
|
let newrecord = {...emptySpec};
|
|
618
618
|
newrecord.retired = {
|
|
@@ -637,7 +637,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
637
637
|
globalThis.test("carries namedWhenRetired only when the record opted in", () => {
|
|
638
638
|
let build = named => {
|
|
639
639
|
let schema = Sury.$schema(s => ({
|
|
640
|
-
archived: s.m(Sury.
|
|
640
|
+
archived: s.m(Sury.boolean)
|
|
641
641
|
}));
|
|
642
642
|
let newrecord = {...emptySpec};
|
|
643
643
|
newrecord.retired = {
|
|
@@ -660,7 +660,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
660
660
|
});
|
|
661
661
|
globalThis.test("omits the retired label when empty but always states showWhenFalse", () => {
|
|
662
662
|
let schema = Sury.$schema(s => ({
|
|
663
|
-
deactivated: s.m(Sury.
|
|
663
|
+
deactivated: s.m(Sury.boolean)
|
|
664
664
|
}));
|
|
665
665
|
let newrecord = {...emptySpec};
|
|
666
666
|
newrecord.retired = {
|
|
@@ -684,7 +684,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
684
684
|
});
|
|
685
685
|
globalThis.test("emits nothing for a schema with no retired annotation", () => {
|
|
686
686
|
let schema = Sury.$schema(s => ({
|
|
687
|
-
archived: s.m(Sury.
|
|
687
|
+
archived: s.m(Sury.boolean)
|
|
688
688
|
}));
|
|
689
689
|
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, emptySpec));
|
|
690
690
|
globalThis.expect(Stdlib_Option.flatMap(getPropertyOf(json, "archived"), s => getProperty(s, "x-reventless-retired"))).toBe(undefined);
|
|
@@ -801,7 +801,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
801
801
|
]);
|
|
802
802
|
});
|
|
803
803
|
});
|
|
804
|
-
globalThis.describe("parity with S.
|
|
804
|
+
globalThis.describe("parity with S.toInputJSONSchemaOrThrow for unannotated objects:", () => {
|
|
805
805
|
let getKeys = schema => {
|
|
806
806
|
let obj = Stdlib_Option.flatMap(getProperty(schema, "properties"), Stdlib_JSON.Decode.object);
|
|
807
807
|
if (obj !== undefined) {
|
|
@@ -819,26 +819,26 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
819
819
|
}
|
|
820
820
|
};
|
|
821
821
|
let sortStrings = xs => xs.toSorted(Primitive_string.compare);
|
|
822
|
-
globalThis.test("properties keyset matches between deriveObjectSchema and S.
|
|
822
|
+
globalThis.test("properties keyset matches between deriveObjectSchema and S.toInputJSONSchemaOrThrow", () => {
|
|
823
823
|
let schema = Sury.$schema(s => ({
|
|
824
824
|
id: s.m(Sury.string),
|
|
825
825
|
name: s.m(Sury.string),
|
|
826
|
-
count: s.m(Sury.
|
|
826
|
+
count: s.m(Sury.int32)
|
|
827
827
|
}));
|
|
828
828
|
let derived = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, schema);
|
|
829
|
-
let native = Sury.
|
|
829
|
+
let native = Sury.toInputJSONSchemaOrThrow(schema);
|
|
830
830
|
globalThis.expect(sortStrings(getKeys(derived))).toEqual(sortStrings(getKeys(native)));
|
|
831
831
|
});
|
|
832
|
-
globalThis.test("required array matches between deriveObjectSchema and S.
|
|
832
|
+
globalThis.test("required array matches between deriveObjectSchema and S.toInputJSONSchemaOrThrow", () => {
|
|
833
833
|
let schema = Sury.$schema(s => ({
|
|
834
834
|
id: s.m(Sury.string),
|
|
835
835
|
name: s.m(Sury.string)
|
|
836
836
|
}));
|
|
837
837
|
let derived = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, schema);
|
|
838
|
-
let native = Sury.
|
|
838
|
+
let native = Sury.toInputJSONSchemaOrThrow(schema);
|
|
839
839
|
globalThis.expect(sortStrings(getRequired(derived))).toEqual(sortStrings(getRequired(native)));
|
|
840
840
|
});
|
|
841
|
-
globalThis.test("S.
|
|
841
|
+
globalThis.test("S.toInputJSONSchemaOrThrow does NOT emit x-reventless-* keys even when metadata is set", () => {
|
|
842
842
|
let schema = Sury.$schema(s => ({
|
|
843
843
|
entityId: s.m(Sury.string),
|
|
844
844
|
name: s.m(Sury.string)
|
|
@@ -847,7 +847,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
847
847
|
newrecord.ids = ["entityId"];
|
|
848
848
|
let spec = newrecord;
|
|
849
849
|
let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
|
|
850
|
-
let native = Sury.
|
|
850
|
+
let native = Sury.toInputJSONSchemaOrThrow(schema$p);
|
|
851
851
|
let entityIdSchema = getPropertyOf(native, "entityId");
|
|
852
852
|
globalThis.expect(Stdlib_Option.flatMap(entityIdSchema, s => getProperty(s, "x-reventless-id"))).toBe(undefined);
|
|
853
853
|
});
|
|
@@ -932,15 +932,15 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
932
932
|
globalThis.expect(Stdlib_Option.isSome(Stdlib_Option.flatMap(getPropertyOf(json, "imageUrl"), s => getProperty(s, "oneOf")))).toBe(true);
|
|
933
933
|
});
|
|
934
934
|
globalThis.test("a type-carried semantic beats an annotation naming the same field", () => {
|
|
935
|
+
let schema = Sury.$schema(s => ({
|
|
936
|
+
imageUrl: s.m(StorageRef$Reventless.forStore(undefined, "productImages"))
|
|
937
|
+
}));
|
|
935
938
|
let newrecord = {...emptySpec};
|
|
936
939
|
newrecord.semantic = [[
|
|
937
940
|
"imageUrl",
|
|
938
941
|
"image"
|
|
939
942
|
]];
|
|
940
943
|
let spec = newrecord;
|
|
941
|
-
let schema = Sury.$schema(s => ({
|
|
942
|
-
imageUrl: s.m(StorageRef$Reventless.forStore(undefined, "productImages"))
|
|
943
|
-
}));
|
|
944
944
|
let schema$1 = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
|
|
945
945
|
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, schema$1);
|
|
946
946
|
globalThis.expect(semanticOf(json, "imageUrl")).toEqual("storageRef");
|
|
@@ -1022,7 +1022,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
1022
1022
|
globalThis.describe("Money changes the field's shape, and says so:", () => {
|
|
1023
1023
|
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, Sury.$schema(s => ({
|
|
1024
1024
|
price: s.m(Money$Reventless.schema),
|
|
1025
|
-
quantity: s.m(Sury.
|
|
1025
|
+
quantity: s.m(Sury.number)
|
|
1026
1026
|
})));
|
|
1027
1027
|
let keyOf = (name, key) => Stdlib_Option.flatMap(getPropertyOf(json, name), s => getProperty(s, key));
|
|
1028
1028
|
globalThis.test("the field is an object, not a number", () => {
|
|
@@ -1112,7 +1112,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
1112
1112
|
globalThis.describe("GeoPoint is an object carrying the geoPoint marker:", () => {
|
|
1113
1113
|
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, Sury.$schema(s => ({
|
|
1114
1114
|
location: s.m(GeoPoint$Reventless.schema),
|
|
1115
|
-
lat: s.m(Sury.
|
|
1115
|
+
lat: s.m(Sury.number)
|
|
1116
1116
|
})));
|
|
1117
1117
|
let keyOf = (name, key) => Stdlib_Option.flatMap(getPropertyOf(json, name), s => getProperty(s, key));
|
|
1118
1118
|
globalThis.test("the field is an object, not a pair of numbers", () => {
|
|
@@ -1167,9 +1167,9 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
1167
1167
|
globalThis.describe("a field declaring a default:", () => {
|
|
1168
1168
|
let defaultOf = (json, field) => Stdlib_Option.flatMap(getPropertyOf(json, field), s => getProperty(s, "default"));
|
|
1169
1169
|
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, Sury.$schema(s => ({
|
|
1170
|
-
quantity: s.m(FieldDefault$Reventless.int(Sury.
|
|
1170
|
+
quantity: s.m(FieldDefault$Reventless.int(Sury.int32, 1)),
|
|
1171
1171
|
shippingMethod: s.m(FieldDefault$Reventless.string(Sury.string, "Standard")),
|
|
1172
|
-
plain: s.m(Sury.
|
|
1172
|
+
plain: s.m(Sury.int32)
|
|
1173
1173
|
})));
|
|
1174
1174
|
globalThis.test("carries it as `default`", () => {
|
|
1175
1175
|
globalThis.expect(defaultOf(json, "quantity")).toEqual(1);
|
|
@@ -1186,7 +1186,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
|
|
|
1186
1186
|
globalThis.test("and reaches a field of a nested record", () => {
|
|
1187
1187
|
let lineItem = Sury.$schema(s => ({
|
|
1188
1188
|
productId: s.m(Sury.string),
|
|
1189
|
-
quantity: s.m(FieldDefault$Reventless.int(Sury.
|
|
1189
|
+
quantity: s.m(FieldDefault$Reventless.int(Sury.int32, 1))
|
|
1190
1190
|
}));
|
|
1191
1191
|
let nested = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(undefined, undefined, Sury.$schema(s => ({
|
|
1192
1192
|
lineItems: s.m(Sury.array(lineItem))
|
|
@@ -38,7 +38,7 @@ let eventSchema$1 = Sury.union([
|
|
|
38
38
|
Sury.$schema(s => ({
|
|
39
39
|
TAG: "PlainEvent",
|
|
40
40
|
name: s.m(Sury.string),
|
|
41
|
-
value: s.m(Sury.
|
|
41
|
+
value: s.m(Sury.int32)
|
|
42
42
|
})),
|
|
43
43
|
Sury.literal("EmptyEvent")
|
|
44
44
|
]);
|
|
@@ -325,7 +325,7 @@ function makeMockStorage() {
|
|
|
325
325
|
|
|
326
326
|
let plainRecordSchema = Sury.$schema(s => ({
|
|
327
327
|
name: s.m(Sury.string),
|
|
328
|
-
value: s.m(Sury.
|
|
328
|
+
value: s.m(Sury.int32)
|
|
329
329
|
}));
|
|
330
330
|
|
|
331
331
|
let multiTagRecordSchema = Sury.$schema(s => ({
|
|
@@ -350,7 +350,7 @@ let mixedEventSchema = Sury.union([
|
|
|
350
350
|
Sury.$schema(s => ({
|
|
351
351
|
TAG: "EventB",
|
|
352
352
|
id: s.m(DcbTag$Reventless.string),
|
|
353
|
-
count: s.m(Sury.
|
|
353
|
+
count: s.m(Sury.int32)
|
|
354
354
|
})),
|
|
355
355
|
Sury.$schema(s => ({
|
|
356
356
|
TAG: "EventC",
|
|
@@ -373,7 +373,7 @@ let complexEventSchema = Sury.union([
|
|
|
373
373
|
TAG: "OrderPlaced",
|
|
374
374
|
orderId: s.m(DcbTag$Reventless.string),
|
|
375
375
|
userId: s.m(DcbTag$Reventless.string),
|
|
376
|
-
amount: s.m(Sury.
|
|
376
|
+
amount: s.m(Sury.number)
|
|
377
377
|
})),
|
|
378
378
|
Sury.$schema(s => ({
|
|
379
379
|
TAG: "OrderShipped",
|
|
@@ -383,7 +383,7 @@ let complexEventSchema = Sury.union([
|
|
|
383
383
|
Sury.$schema(s => ({
|
|
384
384
|
TAG: "PaymentProcessed",
|
|
385
385
|
paymentId: s.m(DcbTag$Reventless.string),
|
|
386
|
-
amount: s.m(Sury.
|
|
386
|
+
amount: s.m(Sury.number)
|
|
387
387
|
}))
|
|
388
388
|
]);
|
|
389
389
|
|
|
@@ -463,7 +463,7 @@ let compositeMultiVariantSchema = Sury.union([
|
|
|
463
463
|
TAG: "VariantB",
|
|
464
464
|
env: s.m(DcbTag$Reventless.compositePartitionMember(0, undefined)),
|
|
465
465
|
name: s.m(DcbTag$Reventless.compositePartitionMember(1, undefined)),
|
|
466
|
-
count: s.m(Sury.
|
|
466
|
+
count: s.m(Sury.int32)
|
|
467
467
|
}))
|
|
468
468
|
]);
|
|
469
469
|
|
|
@@ -43,7 +43,7 @@ let producedAMismatchTagsSchema = Sury.$schema(s => ({
|
|
|
43
43
|
let producedAMismatchTypeSchema = Sury.$schema(s => ({
|
|
44
44
|
TAG: "ItemCreated",
|
|
45
45
|
itemId: s.m(DcbTag$Reventless.string),
|
|
46
|
-
name: s.m(Sury.
|
|
46
|
+
name: s.m(Sury.number)
|
|
47
47
|
}));
|
|
48
48
|
|
|
49
49
|
let consumedFullSchema = Sury.union([
|
|
@@ -77,13 +77,13 @@ let consumedDanglingSchema = Sury.$schema(s => ({
|
|
|
77
77
|
let consumedBadFieldSchema = Sury.$schema(s => ({
|
|
78
78
|
TAG: "ItemCreated",
|
|
79
79
|
itemId: s.m(Sury.string),
|
|
80
|
-
rating: s.m(Sury.
|
|
80
|
+
rating: s.m(Sury.number)
|
|
81
81
|
}));
|
|
82
82
|
|
|
83
83
|
let consumedBadTypeSchema = Sury.$schema(s => ({
|
|
84
84
|
TAG: "ItemCreated",
|
|
85
85
|
itemId: s.m(Sury.string),
|
|
86
|
-
name: s.m(Sury.
|
|
86
|
+
name: s.m(Sury.number)
|
|
87
87
|
}));
|
|
88
88
|
|
|
89
89
|
let recordDemandCommandSchema = Sury.$schema(s => ({
|
|
@@ -14,11 +14,11 @@ let eventSchema = Sury.union([
|
|
|
14
14
|
Sury.$schema(s => ({
|
|
15
15
|
TAG: "ItemCreated",
|
|
16
16
|
name: s.m(Sury.string),
|
|
17
|
-
price: s.m(Sury.
|
|
17
|
+
price: s.m(Sury.number)
|
|
18
18
|
})),
|
|
19
19
|
Sury.$schema(s => ({
|
|
20
20
|
TAG: "ItemPriceUpdated",
|
|
21
|
-
newPrice: s.m(Sury.
|
|
21
|
+
newPrice: s.m(Sury.number)
|
|
22
22
|
})),
|
|
23
23
|
Sury.literal("ItemRemoved")
|
|
24
24
|
]);
|
|
@@ -36,7 +36,7 @@ let name$1 = "ItemCatalog";
|
|
|
36
36
|
|
|
37
37
|
let stateSchema = Sury.$schema(s => ({
|
|
38
38
|
name: s.m(Sury.string),
|
|
39
|
-
price: s.m(Sury.
|
|
39
|
+
price: s.m(Sury.number)
|
|
40
40
|
}));
|
|
41
41
|
|
|
42
42
|
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
@@ -128,7 +128,7 @@ let eventSchema$1 = Sury.union([
|
|
|
128
128
|
Sury.$schema(s => ({
|
|
129
129
|
TAG: "OrderPlaced",
|
|
130
130
|
orderId: s.m(Sury.string),
|
|
131
|
-
amount: s.m(Sury.
|
|
131
|
+
amount: s.m(Sury.number)
|
|
132
132
|
})),
|
|
133
133
|
Sury.$schema(s => ({
|
|
134
134
|
TAG: "OrderShipped",
|
|
@@ -151,7 +151,7 @@ let commandSchema = Sury.union([
|
|
|
151
151
|
Sury.$schema(s => ({
|
|
152
152
|
TAG: "ProcessOrder",
|
|
153
153
|
orderId: s.m(Sury.string),
|
|
154
|
-
amount: s.m(Sury.
|
|
154
|
+
amount: s.m(Sury.number)
|
|
155
155
|
})),
|
|
156
156
|
Sury.$schema(s => ({
|
|
157
157
|
TAG: "ShipOrder",
|
|
@@ -7,5 +7,5 @@ type record = {
|
|
|
7
7
|
@schema
|
|
8
8
|
type variant = | @s.meta({description: "QQQ"}) Q(int) | @s.meta({description: "XXX"}) X | Y
|
|
9
9
|
|
|
10
|
-
Console.log2("Record:", recordSchema->S.
|
|
11
|
-
Console.log2("Variant:", variantSchema->S.
|
|
10
|
+
Console.log2("Record:", recordSchema->S.toInputJSONSchemaOrThrow->JSON.stringifyAny(~space=2))
|
|
11
|
+
Console.log2("Variant:", variantSchema->S.toInputJSONSchemaOrThrow->JSON.stringifyAny(~space=2))
|
|
@@ -12,15 +12,15 @@ let recordSchema = Sury.$schema(s => ({
|
|
|
12
12
|
let variantSchema = Sury.union([
|
|
13
13
|
Sury.$schema(s => ({
|
|
14
14
|
TAG: "Q",
|
|
15
|
-
_0: s.m(Sury.
|
|
15
|
+
_0: s.m(Sury.int32)
|
|
16
16
|
})),
|
|
17
17
|
Sury.literal("X"),
|
|
18
18
|
Sury.literal("Y")
|
|
19
19
|
]);
|
|
20
20
|
|
|
21
|
-
console.log("Record:", JSON.stringify(Sury.
|
|
21
|
+
console.log("Record:", JSON.stringify(Sury.toInputJSONSchemaOrThrow(recordSchema), undefined, 2));
|
|
22
22
|
|
|
23
|
-
console.log("Variant:", JSON.stringify(Sury.
|
|
23
|
+
console.log("Variant:", JSON.stringify(Sury.toInputJSONSchemaOrThrow(variantSchema), undefined, 2));
|
|
24
24
|
|
|
25
25
|
export {
|
|
26
26
|
recordSchema,
|
|
@@ -1740,7 +1740,7 @@ describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1740
1740
|
|
|
1741
1741
|
// Phase 4: queryableDef.schema must carry x-reventless-* extension keys for
|
|
1742
1742
|
// annotated state types. Plugin_Structure now uses SuryToJsonSchema.deriveObjectSchema
|
|
1743
|
-
// (annotation-aware) instead of S.
|
|
1743
|
+
// (annotation-aware) instead of S.toInputJSONSchemaOrThrow (metadata-blind).
|
|
1744
1744
|
describe("queryableDef.schema propagates x-reventless-* annotations", () => {
|
|
1745
1745
|
let parseSchema = (svs: Reventless.Plugin.queryableDef): JSON.t => svs.schema->JSON.parseOrThrow
|
|
1746
1746
|
|
|
@@ -1417,20 +1417,20 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1417
1417
|
});
|
|
1418
1418
|
globalThis.test("publishes no states on the boolean form", () => {
|
|
1419
1419
|
let schema = Sury.$schema(s => ({
|
|
1420
|
-
archived: s.m(Sury.
|
|
1420
|
+
archived: s.m(Sury.boolean)
|
|
1421
1421
|
}));
|
|
1422
1422
|
globalThis.expect(Plugin_Structure$ReventlessCore.retiredValuesFromStateSchema(withRetired(schema, "archived"))).toEqual(undefined);
|
|
1423
1423
|
});
|
|
1424
1424
|
globalThis.test("names the annotated field", () => {
|
|
1425
1425
|
let schema = Sury.$schema(s => ({
|
|
1426
|
-
archived: s.m(Sury.
|
|
1426
|
+
archived: s.m(Sury.boolean)
|
|
1427
1427
|
}));
|
|
1428
1428
|
globalThis.expect(Plugin_Structure$ReventlessCore.retiredFieldFromStateSchema(withRetired(schema, "archived"))).toEqual("archived");
|
|
1429
1429
|
});
|
|
1430
1430
|
globalThis.test("declines a conventionally-named boolean nobody annotated", () => {
|
|
1431
1431
|
let schema = Sury.$schema(s => ({
|
|
1432
|
-
archived: s.m(Sury.
|
|
1433
|
-
deactivated: s.m(Sury.
|
|
1432
|
+
archived: s.m(Sury.boolean),
|
|
1433
|
+
deactivated: s.m(Sury.boolean)
|
|
1434
1434
|
}));
|
|
1435
1435
|
globalThis.expect(Plugin_Structure$ReventlessCore.retiredFieldFromStateSchema(schema)).toEqual(undefined);
|
|
1436
1436
|
});
|
|
@@ -1530,7 +1530,7 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
|
|
|
1530
1530
|
});
|
|
1531
1531
|
globalThis.test("the boolean form is not a skip", () => {
|
|
1532
1532
|
let schema = withRetiredStates(Sury.$schema(s => ({
|
|
1533
|
-
archived: s.m(Sury.
|
|
1533
|
+
archived: s.m(Sury.boolean)
|
|
1534
1534
|
})), "archived", undefined, undefined);
|
|
1535
1535
|
globalThis.expect(Plugin_Structure$ReventlessCore.checkRetiredValue("Products", schema)).toEqual("NotDeclared");
|
|
1536
1536
|
});
|
|
@@ -7,8 +7,8 @@ import * as SchemaWalker$ReventlessCore from "../../src/plugin/component/SchemaW
|
|
|
7
7
|
|
|
8
8
|
let simpleRecordSchema = Sury.$schema(s => ({
|
|
9
9
|
label: s.m(Sury.string),
|
|
10
|
-
count: s.m(Sury.
|
|
11
|
-
rating: s.m(Sury.$option(Sury.
|
|
10
|
+
count: s.m(Sury.int32),
|
|
11
|
+
rating: s.m(Sury.$option(Sury.number))
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
14
|
let simpleVariantSchema = Sury.union([
|
|
@@ -15,7 +15,7 @@ function evolve(_state, _event) {
|
|
|
15
15
|
|
|
16
16
|
let lineItemSchema = Sury.$schema(s => ({
|
|
17
17
|
productId: s.m(Reference$Reventless.to_(undefined, undefined, "AvailableProducts")),
|
|
18
|
-
quantity: s.m(Sury.
|
|
18
|
+
quantity: s.m(Sury.int32)
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
21
|
let commandSchema = Sury.$schema(s => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Phase 4 fixture: state-view slice with structural annotations.
|
|
2
2
|
// Used to verify Plugin_Structure.make ships x-reventless-* extension
|
|
3
|
-
// properties through queryableDef.schema after swapping S.
|
|
3
|
+
// properties through queryableDef.schema after swapping S.toInputJSONSchemaOrThrow
|
|
4
4
|
// for SuryToJsonSchema.deriveObjectSchema.
|
|
5
5
|
|
|
6
6
|
@@reventless.spec("AnnotatedView")
|
|
@@ -13,9 +13,9 @@ let consumedEventSchema = Sury.$schema(s => ({
|
|
|
13
13
|
ownerId: s.m(DcbTag$Reventless.string),
|
|
14
14
|
version: s.m(Sury.string),
|
|
15
15
|
name: s.m(Sury.string),
|
|
16
|
-
total: s.m(Sury.
|
|
16
|
+
total: s.m(Sury.number),
|
|
17
17
|
contact: s.m(Sensitive$Reventless.string),
|
|
18
|
-
quantity: s.m(FieldDefault$Reventless.int(Sury.
|
|
18
|
+
quantity: s.m(FieldDefault$Reventless.int(Sury.int32, 1))
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
21
|
let stateSchema = Sury.$schema(s => ({
|
|
@@ -23,9 +23,9 @@ let stateSchema = Sury.$schema(s => ({
|
|
|
23
23
|
version: s.m(Sury.string),
|
|
24
24
|
ownerId: s.m(Sury.string),
|
|
25
25
|
name: s.m(Sury.string),
|
|
26
|
-
total: s.m(Sury.
|
|
26
|
+
total: s.m(Sury.number),
|
|
27
27
|
contact: s.m(Sensitive$Reventless.string),
|
|
28
|
-
quantity: s.m(FieldDefault$Reventless.int(Sury.
|
|
28
|
+
quantity: s.m(FieldDefault$Reventless.int(Sury.int32, 1))
|
|
29
29
|
}));
|
|
30
30
|
|
|
31
31
|
function project(param) {
|