@reventlessdev/reventless-spec 3.0.0-alpha.140 → 3.0.0-alpha.141
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 +7 -7
- package/src/components/DcbTag.res.mjs +2 -2
- package/src/components/Plugin.res.mjs +3 -3
- package/src/components/TraitCertificate.res.mjs +3 -3
- package/src/components/TraitManifest.res.mjs +2 -2
- package/src/generator/PlatformGenerator.res.mjs +2 -2
- package/src/semantic/Bytes.res.mjs +1 -1
- package/src/semantic/CalendarDate.res +1 -1
- package/src/semantic/CalendarDate.res.mjs +1 -2
- package/src/semantic/DateTime.res +3 -3
- package/src/semantic/DateTime.res.mjs +2 -3
- package/src/semantic/Duration.res.mjs +1 -1
- package/src/semantic/Email.res +1 -1
- package/src/semantic/Email.res.mjs +1 -2
- package/src/semantic/GeoPoint.res.mjs +2 -2
- package/src/semantic/Money.res +1 -1
- package/src/semantic/Money.res.mjs +1 -1
- package/src/semantic/Offload.res.mjs +1 -1
- package/src/semantic/Percent.res.mjs +1 -1
- package/src/semantic/Template.res.mjs +3 -3
- package/src/semantic/Url.res +1 -1
- package/src/semantic/Url.res.mjs +1 -2
- package/src/types/AccountsManifest.res.mjs +1 -2
- package/src/types/Identity.res.mjs +1 -1
- package/src/types/Lifecycle.res.mjs +1 -1
- package/src/types/Message.res.mjs +2 -2
- package/src/types/Schedule.res.mjs +8 -8
- package/src/util/Util_Sury.res +6 -3
- package/src/util/Util_Sury.res.mjs +6 -4
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.141 (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.140 (2026-09-21)
|
|
7
15
|
|
|
8
16
|
* feat(spec)!: typed projection keys ([fc6a018](https://github.com/ReventlessDev/reventless-core/commit/fc6a01811ba788f3289e84a435a09f77fa627e1a))
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-spec",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.141",
|
|
4
4
|
"description": "Specifications for Reventless",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"jsonschema2graphql": "1.1.1",
|
|
26
|
-
"sury": "11.0.0
|
|
27
|
-
"sury-ppx": "11.0.0
|
|
26
|
+
"sury": "11.0.0",
|
|
27
|
+
"sury-ppx": "11.0.0",
|
|
28
28
|
"yaml": "^2.8.3",
|
|
29
|
-
"@reventlessdev/rescript-node": "2.0.0-alpha.
|
|
29
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.13"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"rescript": "12.3.
|
|
33
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.
|
|
32
|
+
"rescript": "12.3.1",
|
|
33
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.11"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"rescript": "12.3.
|
|
36
|
+
"rescript": "^12.3.1"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"registry": "https://registry.npmjs.org"
|
|
@@ -54,7 +54,7 @@ function stringForKey(key) {
|
|
|
54
54
|
return markForKey(Sury.string, key);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
let int = Sury.$Metadata_set(Sury.
|
|
57
|
+
let int = Sury.$Metadata_set(Sury.int32, dcbTagId, true);
|
|
58
58
|
|
|
59
59
|
let partition = markPartition(Sury.string);
|
|
60
60
|
|
|
@@ -88,7 +88,7 @@ let derivedPartitionTagSchema = Sury.union([
|
|
|
88
88
|
})),
|
|
89
89
|
Sury.$schema(s => ({
|
|
90
90
|
TAG: "ByEventType",
|
|
91
|
-
_0: s.m(Sury.
|
|
91
|
+
_0: s.m(Sury.record(Sury.string))
|
|
92
92
|
}))
|
|
93
93
|
]);
|
|
94
94
|
|
|
@@ -61,7 +61,7 @@ let menuEntrySchema = Sury.$schema(s => ({
|
|
|
61
61
|
label: s.m(Sury.string),
|
|
62
62
|
icon: s.m(Sury.$option(Sury.string)),
|
|
63
63
|
group: s.m(Sury.$option(Sury.string)),
|
|
64
|
-
sortOrder: s.m(Sury.
|
|
64
|
+
sortOrder: s.m(Sury.int32)
|
|
65
65
|
}));
|
|
66
66
|
|
|
67
67
|
let pageManifestEntrySchema = Sury.$schema(s => ({
|
|
@@ -100,7 +100,7 @@ let commandDefSchema = Sury.$schema(s => ({
|
|
|
100
100
|
allowedStates: s.m(Sury.$option(Sury.array(Sury.string))),
|
|
101
101
|
targetState: s.m(Sury.$option(Sury.string)),
|
|
102
102
|
allowedStatesSource: s.m(Sury.$option(Sury.string)),
|
|
103
|
-
apiExposed: s.m(Sury.$option(Sury.
|
|
103
|
+
apiExposed: s.m(Sury.$option(Sury.boolean)),
|
|
104
104
|
requiredAccess: s.m(Sury.$option(Sury.array(Sury.string))),
|
|
105
105
|
ownerField: s.m(Sury.$option(Sury.string))
|
|
106
106
|
}));
|
|
@@ -118,7 +118,7 @@ let queryableDefSchema = Sury.$schema(s => ({
|
|
|
118
118
|
ownerField: s.m(Sury.$option(Sury.string)),
|
|
119
119
|
retiredField: s.m(Sury.$option(Sury.string)),
|
|
120
120
|
retiredValues: s.m(Sury.$option(Sury.array(Sury.string))),
|
|
121
|
-
namedWhenRetired: s.m(Sury.$option(Sury.
|
|
121
|
+
namedWhenRetired: s.m(Sury.$option(Sury.boolean)),
|
|
122
122
|
visibility: s.m(Sury.$option(Sury.string)),
|
|
123
123
|
chapter: s.m(Sury.$option(Sury.string)),
|
|
124
124
|
singleQueryField: s.m(Sury.$option(Sury.string)),
|
|
@@ -5,7 +5,7 @@ import * as Util_Sury$Reventless from "../util/Util_Sury.res.mjs";
|
|
|
5
5
|
|
|
6
6
|
let assertionSchema = Sury.$schema(s => ({
|
|
7
7
|
name: s.m(Sury.string),
|
|
8
|
-
passed: s.m(Sury.
|
|
8
|
+
passed: s.m(Sury.boolean)
|
|
9
9
|
}));
|
|
10
10
|
|
|
11
11
|
let schema = Sury.$schema(s => ({
|
|
@@ -15,8 +15,8 @@ let schema = Sury.$schema(s => ({
|
|
|
15
15
|
host: s.m(Sury.string),
|
|
16
16
|
suite: s.m(Sury.string),
|
|
17
17
|
assertions: s.m(Sury.array(assertionSchema)),
|
|
18
|
-
passed: s.m(Sury.
|
|
19
|
-
failed: s.m(Sury.
|
|
18
|
+
passed: s.m(Sury.int32),
|
|
19
|
+
failed: s.m(Sury.int32)
|
|
20
20
|
}));
|
|
21
21
|
|
|
22
22
|
function verified(certificate) {
|
|
@@ -6,7 +6,7 @@ import * as Util_Sury$Reventless from "../util/Util_Sury.res.mjs";
|
|
|
6
6
|
|
|
7
7
|
let configFieldSchema = Sury.$schema(s => ({
|
|
8
8
|
name: s.m(Sury.string),
|
|
9
|
-
required: s.m(Sury.
|
|
9
|
+
required: s.m(Sury.boolean)
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
12
|
let schema = Sury.$schema(s => ({
|
|
@@ -16,7 +16,7 @@ let schema = Sury.$schema(s => ({
|
|
|
16
16
|
license: s.m(Sury.string),
|
|
17
17
|
capabilities: s.m(Sury.array(Sury.string)),
|
|
18
18
|
config: s.m(Sury.array(configFieldSchema)),
|
|
19
|
-
scaffolded: s.m(Sury.
|
|
19
|
+
scaffolded: s.m(Sury.boolean)
|
|
20
20
|
}));
|
|
21
21
|
|
|
22
22
|
function render(manifest) {
|
|
@@ -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 Yaml from "yaml";
|
|
5
5
|
import * as Nodefs from "node:fs";
|
|
6
6
|
import * as Nodepath from "node:path";
|
|
@@ -73,7 +73,7 @@ if (manifestArg === "") {
|
|
|
73
73
|
console.log(`Read: ` + pluginName + ` — ` + path + ` (via ` + PlatformManifests$Reventless.describeVia(param.via) + `)`);
|
|
74
74
|
let manifest;
|
|
75
75
|
try {
|
|
76
|
-
manifest =
|
|
76
|
+
manifest = Sury.parseOrThrow(JSON.parse(Nodefs.readFileSync(path, "utf8")), CapabilityManifest$Reventless.schema);
|
|
77
77
|
} catch (exn) {
|
|
78
78
|
fail(`could not parse ` + path + ` as a capability manifest`);
|
|
79
79
|
manifest = {
|
|
@@ -29,7 +29,7 @@ function fromFloat(raw) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
let schema = Semantic$Reventless.refined(Sury.
|
|
32
|
+
let schema = Semantic$Reventless.refined(Sury.number, Semantic$Reventless.Id.bytes, fromFloat);
|
|
33
33
|
|
|
34
34
|
let units = [
|
|
35
35
|
"B",
|
|
@@ -40,7 +40,7 @@ external toString: t => string = "%identity"
|
|
|
40
40
|
|
|
41
41
|
// Sury's rule, held once. `fromString` runs it rather than restating it, and
|
|
42
42
|
// `schema` is built from `fromString`, so there is exactly one grammar here.
|
|
43
|
-
let grammar: S.t<string> = S.isoDate
|
|
43
|
+
let grammar: S.t<string> = (S.isoDate :> S.t<string>)
|
|
44
44
|
|
|
45
45
|
/** Validate a raw string as an ISO-8601 calendar day, saying why when it is not one. */
|
|
46
46
|
let fromString = (raw: string): result<t, string> =>
|
|
@@ -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 Semantic$Reventless from "./Semantic.res.mjs";
|
|
6
5
|
|
|
@@ -9,7 +8,7 @@ let grammar = Sury.isoDate;
|
|
|
9
8
|
function fromString(raw) {
|
|
10
9
|
let value;
|
|
11
10
|
try {
|
|
12
|
-
value =
|
|
11
|
+
value = Sury.parseOrThrow(raw, grammar);
|
|
13
12
|
} catch (exn) {
|
|
14
13
|
return {
|
|
15
14
|
TAG: "Error",
|
|
@@ -3,14 +3,14 @@ Marks a `string` field as an ISO-8601 instant.
|
|
|
3
3
|
|
|
4
4
|
## The grammar
|
|
5
5
|
|
|
6
|
-
Sury's `S.
|
|
6
|
+
Sury's `S.utcDateTime`, and nothing added — the same rule the branded scalars
|
|
7
7
|
follow. `S.datetime` is the other binding and is not this one: it *transforms* to
|
|
8
8
|
`Js.Date.t`, changing the field's runtime type, where this keeps the string the
|
|
9
9
|
projection wrote.
|
|
10
10
|
|
|
11
11
|
## UTC only
|
|
12
12
|
|
|
13
|
-
`S.
|
|
13
|
+
`S.utcDateTime` accepts a `Z` instant and rejects an offset — `2026-03-02T09:00:00+01:00`
|
|
14
14
|
and a bare `2026-03-02T09:00:00` both fail. That is stricter than RFC 3339 and it
|
|
15
15
|
is the strictness worth adopting: every instant the framework produces comes from
|
|
16
16
|
`Message.nowAsISOString`, which is always `Z`. "Instants are stored in UTC" is a
|
|
@@ -48,7 +48,7 @@ external toString: t => string = "%identity"
|
|
|
48
48
|
|
|
49
49
|
// Sury's rule, held once. `fromString` runs it rather than restating it, and
|
|
50
50
|
// `schema` is built from `fromString`, so there is exactly one grammar here.
|
|
51
|
-
let grammar: S.t<string> = S.
|
|
51
|
+
let grammar: S.t<string> = (S.utcDateTime :> S.t<string>)
|
|
52
52
|
|
|
53
53
|
/** Validate a raw string as a UTC ISO-8601 instant, saying why when it is not one. */
|
|
54
54
|
let fromString = (raw: string): result<t, string> =>
|
|
@@ -1,16 +1,15 @@
|
|
|
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 Primitive_float from "@rescript/runtime/lib/es6/Primitive_float.js";
|
|
6
5
|
import * as Semantic$Reventless from "./Semantic.res.mjs";
|
|
7
6
|
|
|
8
|
-
let grammar = Sury.
|
|
7
|
+
let grammar = Sury.utcDateTime;
|
|
9
8
|
|
|
10
9
|
function fromString(raw) {
|
|
11
10
|
let value;
|
|
12
11
|
try {
|
|
13
|
-
value =
|
|
12
|
+
value = Sury.parseOrThrow(raw, grammar);
|
|
14
13
|
} catch (exn) {
|
|
15
14
|
return {
|
|
16
15
|
TAG: "Error",
|
package/src/semantic/Email.res
CHANGED
|
@@ -37,7 +37,7 @@ external toString: t => string = "%identity"
|
|
|
37
37
|
|
|
38
38
|
// Sury's check, held once. `fromString` runs it rather than restating it, and
|
|
39
39
|
// `schema` is built from `fromString`, so there is exactly one grammar here.
|
|
40
|
-
let grammar: S.t<string> = S.email
|
|
40
|
+
let grammar: S.t<string> = (S.email :> S.t<string>)
|
|
41
41
|
|
|
42
42
|
/** Validate a raw string as an email address, saying why when it is not one. */
|
|
43
43
|
let fromString = (raw: string): result<t, string> =>
|
|
@@ -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 Semantic$Reventless from "./Semantic.res.mjs";
|
|
6
5
|
|
|
@@ -9,7 +8,7 @@ let grammar = Sury.email;
|
|
|
9
8
|
function fromString(raw) {
|
|
10
9
|
let value;
|
|
11
10
|
try {
|
|
12
|
-
value =
|
|
11
|
+
value = Sury.parseOrThrow(raw, grammar);
|
|
13
12
|
} catch (exn) {
|
|
14
13
|
return {
|
|
15
14
|
TAG: "Error",
|
|
@@ -48,12 +48,12 @@ function validateLng(raw) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
let latSchema = S.refine(Sury.
|
|
51
|
+
let latSchema = S.refine(Sury.number, raw => {
|
|
52
52
|
let match = validateLat(raw);
|
|
53
53
|
return match.TAG === "Ok";
|
|
54
54
|
}, "expected a latitude in -90…90", undefined);
|
|
55
55
|
|
|
56
|
-
let lngSchema = S.refine(Sury.
|
|
56
|
+
let lngSchema = S.refine(Sury.number, raw => {
|
|
57
57
|
let match = validateLng(raw);
|
|
58
58
|
return match.TAG === "Ok";
|
|
59
59
|
}, "expected a longitude in -180…180", undefined);
|
package/src/semantic/Money.res
CHANGED
|
@@ -91,7 +91,7 @@ let validateAmount = (amount: float): result<float, string> =>
|
|
|
91
91
|
The check sits on the field rather than on the pair because wholeness is a
|
|
92
92
|
property of the amount: it does not need the currency, and a rule placed
|
|
93
93
|
where it needs nothing else is a rule that cannot be read wrong. (A
|
|
94
|
-
record-level refinement is available — sury 11
|
|
94
|
+
record-level refinement is available — sury 11 compiles one
|
|
95
95
|
correctly, where 11-alpha hoisted the result object above the field reads and
|
|
96
96
|
threw `Cannot access 'v0' before initialization` — it is simply not what this
|
|
97
97
|
check wants.) */
|
|
@@ -28,7 +28,7 @@ function validateAmount(amount) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
let amountSchema = S.refine(Sury.
|
|
31
|
+
let amountSchema = S.refine(Sury.number, amount => {
|
|
32
32
|
let match = validateAmount(amount);
|
|
33
33
|
return match.TAG === "Ok";
|
|
34
34
|
}, "expected a monetary amount", undefined);
|
|
@@ -24,7 +24,7 @@ function fromFloat(raw) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
let schema = Semantic$Reventless.refined(Sury.
|
|
27
|
+
let schema = Semantic$Reventless.refined(Sury.number, Semantic$Reventless.Id.percent, fromFloat);
|
|
28
28
|
|
|
29
29
|
function format(p) {
|
|
30
30
|
return p.toString() + "%";
|
|
@@ -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_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Stdlib_Result from "@rescript/runtime/lib/es6/Stdlib_Result.js";
|
|
@@ -347,7 +347,7 @@ function isWithheld(schema) {
|
|
|
347
347
|
|
|
348
348
|
function parseSafely(json, schema) {
|
|
349
349
|
try {
|
|
350
|
-
return Primitive_option.some(
|
|
350
|
+
return Primitive_option.some(Sury.parseOrThrow(json, schema));
|
|
351
351
|
} catch (exn) {
|
|
352
352
|
return;
|
|
353
353
|
}
|
|
@@ -542,4 +542,4 @@ export {
|
|
|
542
542
|
renderSource,
|
|
543
543
|
variantSchema,
|
|
544
544
|
}
|
|
545
|
-
/*
|
|
545
|
+
/* sury Not a pure module */
|
package/src/semantic/Url.res
CHANGED
|
@@ -38,7 +38,7 @@ external toString: t => string = "%identity"
|
|
|
38
38
|
// to an append-only log, so the address has to survive the round trip as the
|
|
39
39
|
// caller wrote it. `S.uri` is the string-preserving arm — it still rejects what
|
|
40
40
|
// does not parse, and returns exactly what it was given.
|
|
41
|
-
let grammar: S.t<string> = S.uri
|
|
41
|
+
let grammar: S.t<string> = (S.uri :> S.t<string>)
|
|
42
42
|
|
|
43
43
|
// Schemes are case-insensitive per RFC 3986, and `HTTPS://x` parses fine, so the
|
|
44
44
|
// allowlist has to fold case or it rejects a valid address on a technicality.
|
package/src/semantic/Url.res.mjs
CHANGED
|
@@ -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 Semantic$Reventless from "./Semantic.res.mjs";
|
|
6
5
|
|
|
@@ -18,7 +17,7 @@ function hasWebScheme(raw) {
|
|
|
18
17
|
function fromString(raw) {
|
|
19
18
|
let value;
|
|
20
19
|
try {
|
|
21
|
-
value =
|
|
20
|
+
value = Sury.parseOrThrow(raw, grammar);
|
|
22
21
|
} catch (exn) {
|
|
23
22
|
return {
|
|
24
23
|
TAG: "Error",
|
|
@@ -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 Yaml from "yaml";
|
|
6
5
|
import * as Nodefs from "node:fs";
|
|
@@ -25,7 +24,7 @@ function parseString(yamlText) {
|
|
|
25
24
|
try {
|
|
26
25
|
return {
|
|
27
26
|
TAG: "Ok",
|
|
28
|
-
_0:
|
|
27
|
+
_0: Sury.parseOrThrow(Yaml.parse(yamlText), entriesSchema)
|
|
29
28
|
};
|
|
30
29
|
} catch (raw_err) {
|
|
31
30
|
let err = Primitive_exceptions.internalToException(raw_err);
|
|
@@ -15,7 +15,7 @@ let schema = Sury.$schema(s => ({
|
|
|
15
15
|
userId: s.m(Sury.string),
|
|
16
16
|
username: s.m(Sury.string),
|
|
17
17
|
groups: s.m(Sury.array(Sury.string)),
|
|
18
|
-
claims: s.m(Sury.$option(Sury.
|
|
18
|
+
claims: s.m(Sury.$option(Sury.record(Sury.string))),
|
|
19
19
|
provider: s.m(providerSchema)
|
|
20
20
|
}));
|
|
21
21
|
|
|
@@ -16,7 +16,7 @@ let metaSchema = Sury.$schema(s => ({
|
|
|
16
16
|
causationId: s.m(Sury.$option(Sury.string)),
|
|
17
17
|
traceparent: s.m(Sury.$option(Sury.string)),
|
|
18
18
|
schemaVersion: s.m(Sury.$option(Sury.string)),
|
|
19
|
-
headers: s.m(Sury.$option(Sury.
|
|
19
|
+
headers: s.m(Sury.$option(Sury.record(Sury.string)))
|
|
20
20
|
}));
|
|
21
21
|
|
|
22
22
|
let contextSchema = Sury.$schema(s => ({
|
|
@@ -33,7 +33,7 @@ let commandJsonSchema = Sury.$schema(s => ({
|
|
|
33
33
|
id: s.m(Sury.string),
|
|
34
34
|
meta: s.m(metaSchema),
|
|
35
35
|
commandJson: s.m(Sury.json),
|
|
36
|
-
delay: s.m(Sury.$option(Sury.
|
|
36
|
+
delay: s.m(Sury.$option(Sury.int32))
|
|
37
37
|
}));
|
|
38
38
|
|
|
39
39
|
let fillMissingDefaults = (function(schema, json, scalarFills){
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Sury from "sury";
|
|
4
4
|
|
|
5
|
-
let yearSchema = Sury.
|
|
5
|
+
let yearSchema = Sury.int32;
|
|
6
6
|
|
|
7
|
-
let monthSchema = Sury.
|
|
7
|
+
let monthSchema = Sury.int32;
|
|
8
8
|
|
|
9
|
-
let daySchema = Sury.
|
|
9
|
+
let daySchema = Sury.int32;
|
|
10
10
|
|
|
11
|
-
let hourSchema = Sury.
|
|
11
|
+
let hourSchema = Sury.int32;
|
|
12
12
|
|
|
13
|
-
let minuteSchema = Sury.
|
|
13
|
+
let minuteSchema = Sury.int32;
|
|
14
14
|
|
|
15
15
|
let rateSchema = Sury.union([
|
|
16
16
|
Sury.$schema(s => ({
|
|
@@ -23,15 +23,15 @@ let rateSchema = Sury.union([
|
|
|
23
23
|
})),
|
|
24
24
|
Sury.$schema(s => ({
|
|
25
25
|
TAG: "Minutes",
|
|
26
|
-
_0: s.m(Sury.
|
|
26
|
+
_0: s.m(Sury.int32)
|
|
27
27
|
})),
|
|
28
28
|
Sury.$schema(s => ({
|
|
29
29
|
TAG: "Hours",
|
|
30
|
-
_0: s.m(Sury.
|
|
30
|
+
_0: s.m(Sury.int32)
|
|
31
31
|
})),
|
|
32
32
|
Sury.$schema(s => ({
|
|
33
33
|
TAG: "Days",
|
|
34
|
-
_0: s.m(Sury.
|
|
34
|
+
_0: s.m(Sury.int32)
|
|
35
35
|
})),
|
|
36
36
|
Sury.$schema(s => ({
|
|
37
37
|
TAG: "Daily",
|
package/src/util/Util_Sury.res
CHANGED
|
@@ -7,16 +7,19 @@
|
|
|
7
7
|
// See docs/plans/sury-11-migration.md.
|
|
8
8
|
|
|
9
9
|
let toJson: ('a, S.t<'a>) => JSON.t = (value, schema) =>
|
|
10
|
-
value->S.
|
|
10
|
+
value->S.convertOrThrow(~from=schema, ~to=S.json)
|
|
11
11
|
|
|
12
12
|
// `~space` defaults to compact, matching the removed `reverseConvertToJsonStringOrThrow`.
|
|
13
13
|
let toJsonString = (value: 'a, schema: S.t<'a>, ~space: int=0): string =>
|
|
14
|
-
value->S.
|
|
14
|
+
(value->S.convertOrThrow(
|
|
15
|
+
~from=schema,
|
|
16
|
+
~to=space == 0 ? S.jsonString : S.jsonStringWithSpace(space),
|
|
17
|
+
) :> string)
|
|
15
18
|
|
|
16
19
|
let fromJson: (JSON.t, S.t<'a>) => 'a = (json, schema) => json->S.parseOrThrow(~to=schema)
|
|
17
20
|
|
|
18
21
|
let fromJsonString: (string, S.t<'a>) => 'a = (str, schema) =>
|
|
19
|
-
str->S.
|
|
22
|
+
S.JsonString(str)->S.convertOrThrow(~from=S.jsonString, ~to=schema)
|
|
20
23
|
|
|
21
24
|
// Sury raises `S.Exn`, which carries `RE_EXN_ID: "S.Exn"` and so is not a `JsExn`
|
|
22
25
|
// even though it is a JS Error at runtime — the usual
|
|
@@ -6,18 +6,20 @@ 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";
|
|
7
7
|
|
|
8
8
|
function toJson(value, schema) {
|
|
9
|
-
return S.
|
|
9
|
+
return S.convertOrThrow(value, schema, undefined, Sury.json);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function toJsonString(value, schema, spaceOpt) {
|
|
13
13
|
let space = spaceOpt !== undefined ? spaceOpt : 0;
|
|
14
|
-
return S.
|
|
14
|
+
return S.convertOrThrow(value, schema, undefined, space === 0 ? Sury.jsonString : Sury.jsonStringWithSpace(space));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
function fromJson(json, schema) {
|
|
18
|
+
return Sury.parseOrThrow(json, schema);
|
|
19
|
+
}
|
|
18
20
|
|
|
19
21
|
function fromJsonString(str, schema) {
|
|
20
|
-
return S.
|
|
22
|
+
return S.convertOrThrow(str, Sury.jsonString, undefined, schema);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
function exnMessage(exn, fallbackOpt) {
|