@reventlessdev/reventless-spec 3.0.0-alpha.133 → 3.0.0-alpha.135
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 +33 -0
- package/package.json +4 -3
- package/run-check-lifecycle.mjs +2 -1
- package/run-prepare-accounts.mjs +3 -0
- package/src/AnsiStyle.res +0 -1
- package/src/LogPrefix.res +4 -13
- package/src/components/AutomationSlice.res +1 -5
- package/src/components/CapabilityManifest.res +6 -3
- package/src/components/CapabilityManifest.res.mjs +13 -2
- package/src/components/DcbDecode.res +6 -2
- package/src/components/DcbScopeInference.res +16 -12
- package/src/components/DcbTag.res +74 -46
- package/src/components/DcbValidation.res +114 -89
- package/src/components/DisplayName.res +4 -2
- package/src/components/ExtensionPoint.res +0 -1
- package/src/components/FieldDefault.res +2 -4
- package/src/components/InboundTranslationSlice.res +0 -2
- package/src/components/OutboundTranslationSlice.res +10 -8
- package/src/components/Owner.res +4 -4
- package/src/components/Plugin.res +10 -4
- package/src/components/ReadModel.res +0 -1
- package/src/components/Reference.res +2 -8
- package/src/components/Sensitive.res +4 -4
- package/src/components/StateAnnotations.res +4 -2
- package/src/components/StateChangeSlice.res +0 -2
- package/src/components/StateViewSlice.res +0 -2
- package/src/components/TaggedUnion.res +1 -2
- package/src/components/Task.res +0 -1
- package/src/components/TraitCertificate.res +2 -2
- package/src/components/TraitManifest.res +1 -1
- package/src/generator/CertifyTrait.res +2 -4
- package/src/generator/Codegen.res +77 -68
- package/src/generator/Discovery.res +29 -12
- package/src/generator/GraftTrait.res +17 -9
- package/src/generator/Pairing.res +39 -13
- package/src/generator/PlatformCodegen.res +14 -11
- package/src/generator/PlatformCodegen.res.mjs +5 -0
- package/src/generator/PlatformManifests.res +1 -3
- package/src/generator/PluginGenerator.res +0 -1
- package/src/generator/TraitManifestCli.res +7 -7
- package/src/lifecycle/CheckLifecycleModel.res +206 -148
- package/src/lifecycle/CheckLifecycleModel.res.mjs +23 -5
- package/src/semantic/Bytes.res +0 -1
- package/src/semantic/CalendarDate.res +2 -2
- package/src/semantic/Capabilities.res +21 -6
- package/src/semantic/Capabilities.res.mjs +18 -12
- package/src/semantic/CapabilityNeed.res +16 -5
- package/src/semantic/CapabilityNeed.res.mjs +9 -4
- package/src/semantic/CaptionedImage.res +0 -1
- package/src/semantic/Color.res +0 -1
- package/src/semantic/Currency.res +189 -170
- package/src/semantic/DateRange.res +3 -4
- package/src/semantic/DateTime.res +5 -5
- package/src/semantic/Duration.res +2 -2
- package/src/semantic/Email.res +0 -1
- package/src/semantic/FileRef.res +2 -2
- package/src/semantic/GeoPoint.res +17 -21
- package/src/semantic/Geocoding.res +8 -9
- package/src/semantic/Geolocation.res +6 -9
- package/src/semantic/IdentityProvider.res +127 -0
- package/src/semantic/IdentityProvider.res.mjs +65 -0
- package/src/semantic/ImageRef.res +2 -2
- package/src/semantic/MemberRef.res +0 -1
- package/src/semantic/Messaging.res +141 -21
- package/src/semantic/Messaging.res.mjs +51 -8
- package/src/semantic/Money.res +23 -20
- package/src/semantic/Offload.res +6 -4
- package/src/semantic/Percent.res +3 -3
- package/src/semantic/Phone.res +0 -1
- package/src/semantic/RowImage.res +4 -3
- package/src/semantic/Secrets.res +76 -0
- package/src/semantic/Secrets.res.mjs +49 -0
- package/src/semantic/Semantic.res +8 -11
- package/src/semantic/StorageRef.res +17 -17
- package/src/semantic/Template.res +5 -7
- package/src/semantic/UploadableFile.res +0 -1
- package/src/semantic/UploadableImage.res +0 -1
- package/src/semantic/Url.res +3 -3
- package/src/types/AccountsManifest.res +281 -0
- package/src/types/AccountsManifest.res.mjs +311 -0
- package/src/types/AdminGroup.res +27 -0
- package/src/types/AdminGroup.res.mjs +9 -0
- package/src/types/Authorization.res +1 -2
- package/src/types/Handler.res +0 -1
- package/src/types/Identity.res +1 -3
- package/src/types/Lifecycle.res +7 -6
- package/src/types/Message.res +6 -4
- package/src/types/OwnerScope.res +28 -3
- package/src/types/OwnerScope.res.mjs +12 -0
- package/src/types/PrepareAccounts.res +119 -0
- package/src/types/PrepareAccounts.res.mjs +148 -0
- package/src/types/Projection.res +9 -2
- package/src/types/StoredEvent.res +2 -4
- package/src/types/Transition.res +8 -4
- package/src/util/Util_Password.res +60 -0
- package/src/util/Util_Password.res.mjs +53 -0
- package/src/util/Util_Sury.res +1 -4
|
@@ -27,6 +27,15 @@ type t = {
|
|
|
27
27
|
/** Send a message to a person, and say which channels this deployment can
|
|
28
28
|
attempt at all. See `Messaging.provider`. */
|
|
29
29
|
messaging: Messaging.provider,
|
|
30
|
+
/** Make, group and unmake principals, and say which of those this
|
|
31
|
+
deployment's provider can do at all. Administrative only — authenticating
|
|
32
|
+
one is `Auth_Adapter.Provider`'s. See `IdentityProvider.t`. */
|
|
33
|
+
identityProvider: IdentityProvider.t,
|
|
34
|
+
/** Unguessable material and a one-way function over it. Injected rather than
|
|
35
|
+
imported so a test can pin the secret a flow is about to use — a suite
|
|
36
|
+
cannot assert what a flow does with a value it cannot predict. See
|
|
37
|
+
`Secrets.t`. */
|
|
38
|
+
secrets: Secrets.t,
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
/**
|
|
@@ -50,10 +59,16 @@ let none: t = {
|
|
|
50
59
|
// `UnsupportedChannel` because a caller that got this far is looking at a
|
|
51
60
|
// deployment gap, not at a fact about the recipient, and abandoning the message
|
|
52
61
|
// would record the second.
|
|
53
|
-
messaging:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
messaging: Messaging.makeProvider(~emailAndSms=[], ~pushServices=[], ~send=async (
|
|
63
|
+
~recipient as _,
|
|
64
|
+
~message as _,
|
|
65
|
+
) => Error(Unavailable("no messaging provider is configured for this platform"))),
|
|
66
|
+
identityProvider: IdentityProvider.unavailable(
|
|
67
|
+
~reason="no identity provider is configured for this platform",
|
|
68
|
+
),
|
|
69
|
+
// Refusing rather than falling back to a weak source. Every runtime has a
|
|
70
|
+
// cryptographic one, so a platform reaching this arm has skipped wiring rather
|
|
71
|
+
// than declined to provision — and a guessable token would be accepted
|
|
72
|
+
// everywhere while looking exactly like a real one.
|
|
73
|
+
secrets: Secrets.unavailable(~reason="no secret source is configured for this platform"),
|
|
59
74
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Secrets$Reventless from "./Secrets.res.mjs";
|
|
4
|
+
import * as Messaging$Reventless from "./Messaging.res.mjs";
|
|
5
|
+
import * as IdentityProvider$Reventless from "./IdentityProvider.res.mjs";
|
|
3
6
|
|
|
4
7
|
async function none_geocode(param) {
|
|
5
8
|
return {
|
|
@@ -11,23 +14,26 @@ async function none_geocode(param) {
|
|
|
11
14
|
};
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
let none_messaging = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
TAG: "
|
|
18
|
-
_0:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
let none_messaging = Messaging$Reventless.makeProvider([], [], async (param, param$1) => ({
|
|
18
|
+
TAG: "Error",
|
|
19
|
+
_0: {
|
|
20
|
+
TAG: "Unavailable",
|
|
21
|
+
_0: "no messaging provider is configured for this platform"
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
let none_identityProvider = IdentityProvider$Reventless.unavailable("no identity provider is configured for this platform");
|
|
26
|
+
|
|
27
|
+
let none_secrets = Secrets$Reventless.unavailable("no secret source is configured for this platform");
|
|
24
28
|
|
|
25
29
|
let none = {
|
|
26
30
|
geocode: none_geocode,
|
|
27
|
-
messaging: none_messaging
|
|
31
|
+
messaging: none_messaging,
|
|
32
|
+
identityProvider: none_identityProvider,
|
|
33
|
+
secrets: none_secrets
|
|
28
34
|
};
|
|
29
35
|
|
|
30
36
|
export {
|
|
31
37
|
none,
|
|
32
38
|
}
|
|
33
|
-
/*
|
|
39
|
+
/* none Not a pure module */
|
|
@@ -18,12 +18,22 @@ rather than a string a README repeats.
|
|
|
18
18
|
*/
|
|
19
19
|
type t =
|
|
20
20
|
| Geocoding
|
|
21
|
-
|
|
21
|
+
/** Sending a message to a person, reached through `Capabilities.messaging`.
|
|
22
22
|
One need however many channels the platform provisions — which channels
|
|
23
23
|
those are is a runtime answer the provider publishes, not a second
|
|
24
24
|
declaration, because a plugin that named `Sms` would fail a deploy it
|
|
25
25
|
could have run on email. */
|
|
26
|
-
Messaging
|
|
26
|
+
| Messaging
|
|
27
|
+
/** Making, grouping and unmaking principals, reached through
|
|
28
|
+
`Capabilities.identityProvider`. No payload, for the reason `Geocoding`
|
|
29
|
+
has none: one identity provider per deployment is a real answer, and a
|
|
30
|
+
deployment wanting a second pool is the `{alternatives, min}` question
|
|
31
|
+
`Messaging` already answers by publishing what it provisioned.
|
|
32
|
+
|
|
33
|
+
Not authentication. Token issuance and session handling are
|
|
34
|
+
`Auth_Adapter.Provider`'s, read at a different time — two seams over one
|
|
35
|
+
provider, the way this type and `Capabilities.t` are already two. */
|
|
36
|
+
| IdentityProvider
|
|
27
37
|
|
|
28
38
|
/** The spelling carried in `pluginStructure` and in `capabilities.json`.
|
|
29
39
|
Persisted structures hold strings, not enum members, so a plugin built
|
|
@@ -32,6 +42,7 @@ let toString = (need: t): string =>
|
|
|
32
42
|
switch need {
|
|
33
43
|
| Geocoding => "Geocoding"
|
|
34
44
|
| Messaging => "Messaging"
|
|
45
|
+
| IdentityProvider => "IdentityProvider"
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
/** The inverse, for readers of a persisted structure or a committed manifest.
|
|
@@ -41,6 +52,7 @@ let fromString = (name: string): option<t> =>
|
|
|
41
52
|
switch name {
|
|
42
53
|
| "Geocoding" => Some(Geocoding)
|
|
43
54
|
| "Messaging" => Some(Messaging)
|
|
55
|
+
| "IdentityProvider" => Some(IdentityProvider)
|
|
44
56
|
| _ => None
|
|
45
57
|
}
|
|
46
58
|
|
|
@@ -62,7 +74,7 @@ unprovisioned capability it never named degrades exactly as it always has, which
|
|
|
62
74
|
is the modelled outcome for a deployment that simply does not have one.
|
|
63
75
|
*/
|
|
64
76
|
let unmet = (~declared: array<(string, string)>, ~provisioned: array<t>): array<unmet> =>
|
|
65
|
-
declared->Array.filterMap(((
|
|
77
|
+
declared->Array.filterMap(((capability, component)) =>
|
|
66
78
|
switch fromString(capability) {
|
|
67
79
|
| Some(need) if !(provisioned->Array.includes(need)) => Some({need, component})
|
|
68
80
|
| _ => None
|
|
@@ -77,5 +89,4 @@ let unmetMessage = (unmet: array<unmet>): string =>
|
|
|
77
89
|
->Array.map(u => `${toString(u.need)} (${u.component})`)
|
|
78
90
|
->Array.join(", ")}.\n` ++
|
|
79
91
|
` Provision them in the platform stack and redeploy the platform first.\n` ++
|
|
80
|
-
` Without it every call answers Unavailable, the slice exhausts its retries, and a ` ++
|
|
81
|
-
`permanent verdict is recorded against data that is fine — no error anywhere.`
|
|
92
|
+
` Without it every call answers Unavailable, the slice exhausts its retries, and a ` ++ `permanent verdict is recorded against data that is fine — no error anywhere.`
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
4
|
|
|
5
5
|
function toString(need) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
switch (need) {
|
|
7
|
+
case "Geocoding" :
|
|
8
|
+
return "Geocoding";
|
|
9
|
+
case "Messaging" :
|
|
10
|
+
return "Messaging";
|
|
11
|
+
case "IdentityProvider" :
|
|
12
|
+
return "IdentityProvider";
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
15
|
|
|
@@ -14,6 +17,8 @@ function fromString(name) {
|
|
|
14
17
|
switch (name) {
|
|
15
18
|
case "Geocoding" :
|
|
16
19
|
return "Geocoding";
|
|
20
|
+
case "IdentityProvider" :
|
|
21
|
+
return "IdentityProvider";
|
|
17
22
|
case "Messaging" :
|
|
18
23
|
return "Messaging";
|
|
19
24
|
default:
|
|
@@ -59,7 +59,6 @@ value depicts, not in how a reference to it is written. It would carry no
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
*/
|
|
62
|
-
|
|
63
62
|
/** The record itself. No `@schema`: the derived schema would have to name a
|
|
64
63
|
store, and the store is the host field's — so `forField` is the only way to
|
|
65
64
|
a schema, and a field the ppx did not reach fails to compile rather than
|
package/src/semantic/Color.res
CHANGED
|
@@ -47,182 +47,201 @@ a checked type in the domain.
|
|
|
47
47
|
*/
|
|
48
48
|
@schema
|
|
49
49
|
type t =
|
|
50
|
-
|
|
51
|
-
|
|
|
52
|
-
|
|
53
|
-
|
|
|
54
|
-
|
|
55
|
-
|
|
|
56
|
-
|
|
57
|
-
|
|
|
58
|
-
|
|
59
|
-
|
|
|
50
|
+
/** Australian Dollar */
|
|
51
|
+
| AUD
|
|
52
|
+
/** Canadian Dollar */
|
|
53
|
+
| CAD
|
|
54
|
+
/** Swiss Franc */
|
|
55
|
+
| CHF
|
|
56
|
+
/** Yuan Renminbi */
|
|
57
|
+
| CNY
|
|
58
|
+
/** Euro */
|
|
59
|
+
| EUR
|
|
60
|
+
/** Pound Sterling */
|
|
61
|
+
| GBP
|
|
62
|
+
/** Yen */
|
|
63
|
+
| JPY
|
|
64
|
+
/** Norwegian Krone */
|
|
65
|
+
| NOK
|
|
66
|
+
/** Swedish Krona */
|
|
67
|
+
| SEK
|
|
68
|
+
/** US Dollar */
|
|
69
|
+
| USD
|
|
60
70
|
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
71
|
+
// ── Dormant ─────────────────────────────────────────────────────────────
|
|
72
|
+
// The rest of ISO 4217, kept for the day one of them is needed. Uncomment
|
|
73
|
+
// the code here and in the other three blocks — or add it to `active` in
|
|
74
|
+
// scripts/GenerateCurrency.res and regenerate — to admit it.
|
|
75
|
+
// | /** UAE Dirham */ AED
|
|
76
|
+
// | /** Afghani */ AFN
|
|
77
|
+
// | /** Lek */ ALL
|
|
78
|
+
// | /** Armenian Dram */ AMD
|
|
79
|
+
// | /** Kwanza */ AOA
|
|
80
|
+
// | /** Argentine Peso */ ARS
|
|
81
|
+
// | /** Aruban Florin */ AWG
|
|
82
|
+
// | /** Azerbaijan Manat */ AZN
|
|
83
|
+
// | /** Convertible Mark */ BAM
|
|
84
|
+
// | /** Barbados Dollar */ BBD
|
|
85
|
+
// | /** Taka */ BDT
|
|
86
|
+
// | /** Bahraini Dinar */ BHD
|
|
87
|
+
// | /** Burundi Franc */ BIF
|
|
88
|
+
// | /** Bermudian Dollar */ BMD
|
|
89
|
+
// | /** Brunei Dollar */ BND
|
|
90
|
+
// | /** Boliviano */ BOB
|
|
91
|
+
// | /** BOV */ BOV
|
|
92
|
+
// | /** Brazilian Real */ BRL
|
|
93
|
+
// | /** Bahamian Dollar */ BSD
|
|
94
|
+
// | /** Ngultrum */ BTN
|
|
95
|
+
// | /** Pula */ BWP
|
|
96
|
+
// | /** Belarusian Ruble */ BYN
|
|
97
|
+
// | /** Belize Dollar */ BZD
|
|
98
|
+
// | /** Congolese Franc */ CDF
|
|
99
|
+
// | /** CHE */ CHE
|
|
100
|
+
// | /** CHW */ CHW
|
|
101
|
+
// | /** CLF */ CLF
|
|
102
|
+
// | /** Chilean Peso */ CLP
|
|
103
|
+
// | /** Colombian Peso */ COP
|
|
104
|
+
// | /** COU */ COU
|
|
105
|
+
// | /** Costa Rican Colon */ CRC
|
|
106
|
+
// | /** Cuban Peso */ CUP
|
|
107
|
+
// | /** Cabo Verde Escudo */ CVE
|
|
108
|
+
// | /** Czech Koruna */ CZK
|
|
109
|
+
// | /** Djibouti Franc */ DJF
|
|
110
|
+
// | /** Danish Krone */ DKK
|
|
111
|
+
// | /** Dominican Peso */ DOP
|
|
112
|
+
// | /** Algerian Dinar */ DZD
|
|
113
|
+
// | /** Egyptian Pound */ EGP
|
|
114
|
+
// | /** Nakfa */ ERN
|
|
115
|
+
// | /** Ethiopian Birr */ ETB
|
|
116
|
+
// | /** Fiji Dollar */ FJD
|
|
117
|
+
// | /** Falkland Islands Pound */ FKP
|
|
118
|
+
// | /** Lari */ GEL
|
|
119
|
+
// | /** Ghana Cedi */ GHS
|
|
120
|
+
// | /** Gibraltar Pound */ GIP
|
|
121
|
+
// | /** Dalasi */ GMD
|
|
122
|
+
// | /** Guinean Franc */ GNF
|
|
123
|
+
// | /** Quetzal */ GTQ
|
|
124
|
+
// | /** Guyana Dollar */ GYD
|
|
125
|
+
// | /** Hong Kong Dollar */ HKD
|
|
126
|
+
// | /** Lempira */ HNL
|
|
127
|
+
// | /** Gourde */ HTG
|
|
128
|
+
// | /** Forint */ HUF
|
|
129
|
+
// | /** Rupiah */ IDR
|
|
130
|
+
// | /** New Israeli Sheqel */ ILS
|
|
131
|
+
// | /** Indian Rupee */ INR
|
|
132
|
+
// | /** Iraqi Dinar */ IQD
|
|
133
|
+
// | /** Iranian Rial */ IRR
|
|
134
|
+
// | /** Iceland Krona */ ISK
|
|
135
|
+
// | /** Jamaican Dollar */ JMD
|
|
136
|
+
// | /** Jordanian Dinar */ JOD
|
|
137
|
+
// | /** Kenyan Shilling */ KES
|
|
138
|
+
// | /** Som */ KGS
|
|
139
|
+
// | /** Riel */ KHR
|
|
140
|
+
// | /** Comorian Franc */ KMF
|
|
141
|
+
// | /** North Korean Won */ KPW
|
|
142
|
+
// | /** Won */ KRW
|
|
143
|
+
// | /** Kuwaiti Dinar */ KWD
|
|
144
|
+
// | /** Cayman Islands Dollar */ KYD
|
|
145
|
+
// | /** Tenge */ KZT
|
|
146
|
+
// | /** Lao Kip */ LAK
|
|
147
|
+
// | /** Lebanese Pound */ LBP
|
|
148
|
+
// | /** Sri Lanka Rupee */ LKR
|
|
149
|
+
// | /** Liberian Dollar */ LRD
|
|
150
|
+
// | /** Loti */ LSL
|
|
151
|
+
// | /** Libyan Dinar */ LYD
|
|
152
|
+
// | /** Moroccan Dirham */ MAD
|
|
153
|
+
// | /** Moldovan Leu */ MDL
|
|
154
|
+
// | /** Malagasy Ariary */ MGA
|
|
155
|
+
// | /** Denar */ MKD
|
|
156
|
+
// | /** Kyat */ MMK
|
|
157
|
+
// | /** Tugrik */ MNT
|
|
158
|
+
// | /** Pataca */ MOP
|
|
159
|
+
// | /** Ouguiya */ MRU
|
|
160
|
+
// | /** Mauritius Rupee */ MUR
|
|
161
|
+
// | /** Rufiyaa */ MVR
|
|
162
|
+
// | /** Malawi Kwacha */ MWK
|
|
163
|
+
// | /** Mexican Peso */ MXN
|
|
164
|
+
// | /** MXV */ MXV
|
|
165
|
+
// | /** Malaysian Ringgit */ MYR
|
|
166
|
+
// | /** Mozambique Metical */ MZN
|
|
167
|
+
// | /** Namibia Dollar */ NAD
|
|
168
|
+
// | /** Naira */ NGN
|
|
169
|
+
// | /** Cordoba Oro */ NIO
|
|
170
|
+
// | /** Nepalese Rupee */ NPR
|
|
171
|
+
// | /** New Zealand Dollar */ NZD
|
|
172
|
+
// | /** Rial Omani */ OMR
|
|
173
|
+
// | /** Balboa */ PAB
|
|
174
|
+
// | /** Sol */ PEN
|
|
175
|
+
// | /** Kina */ PGK
|
|
176
|
+
// | /** Philippine Peso */ PHP
|
|
177
|
+
// | /** Pakistan Rupee */ PKR
|
|
178
|
+
// | /** Zloty */ PLN
|
|
179
|
+
// | /** Guarani */ PYG
|
|
180
|
+
// | /** Qatari Rial */ QAR
|
|
181
|
+
// | /** Romanian Leu */ RON
|
|
182
|
+
// | /** Serbian Dinar */ RSD
|
|
183
|
+
// | /** Russian Ruble */ RUB
|
|
184
|
+
// | /** Rwanda Franc */ RWF
|
|
185
|
+
// | /** Saudi Riyal */ SAR
|
|
186
|
+
// | /** Solomon Islands Dollar */ SBD
|
|
187
|
+
// | /** Seychelles Rupee */ SCR
|
|
188
|
+
// | /** Sudanese Pound */ SDG
|
|
189
|
+
// | /** Singapore Dollar */ SGD
|
|
190
|
+
// | /** Saint Helena Pound */ SHP
|
|
191
|
+
// | /** Leone */ SLE
|
|
192
|
+
// | /** Somali Shilling */ SOS
|
|
193
|
+
// | /** Surinam Dollar */ SRD
|
|
194
|
+
// | /** South Sudanese Pound */ SSP
|
|
195
|
+
// | /** Dobra */ STN
|
|
196
|
+
// | /** El Salvador Colon */ SVC
|
|
197
|
+
// | /** Syrian Pound */ SYP
|
|
198
|
+
// | /** Lilangeni */ SZL
|
|
199
|
+
// | /** Baht */ THB
|
|
200
|
+
// | /** Somoni */ TJS
|
|
201
|
+
// | /** Turkmenistan New Manat */ TMT
|
|
202
|
+
// | /** Tunisian Dinar */ TND
|
|
203
|
+
// | /** Pa’anga */ TOP
|
|
204
|
+
// | /** Turkish Lira */ TRY
|
|
205
|
+
// | /** Trinidad and Tobago Dollar */ TTD
|
|
206
|
+
// | /** New Taiwan Dollar */ TWD
|
|
207
|
+
// | /** Tanzanian Shilling */ TZS
|
|
208
|
+
// | /** Hryvnia */ UAH
|
|
209
|
+
// | /** Uganda Shilling */ UGX
|
|
210
|
+
// | /** USN */ USN
|
|
211
|
+
// | /** UYI */ UYI
|
|
212
|
+
// | /** Peso Uruguayo */ UYU
|
|
213
|
+
// | /** Unidad Previsional */ UYW
|
|
214
|
+
// | /** Uzbekistan Sum */ UZS
|
|
215
|
+
// | /** Bolívar Soberano */ VED
|
|
216
|
+
// | /** Bolívar Soberano */ VES
|
|
217
|
+
// | /** Dong */ VND
|
|
218
|
+
// | /** Vatu */ VUV
|
|
219
|
+
// | /** Tala */ WST
|
|
220
|
+
// | /** Arab Accounting Dinar */ XAD
|
|
221
|
+
// | /** CFA Franc BEAC */ XAF
|
|
222
|
+
// | /** East Caribbean Dollar */ XCD
|
|
223
|
+
// | /** Caribbean Guilder */ XCG
|
|
224
|
+
// | /** CFA Franc BCEAO */ XOF
|
|
225
|
+
// | /** CFP Franc */ XPF
|
|
226
|
+
// | /** Yemeni Rial */ YER
|
|
227
|
+
// | /** Rand */ ZAR
|
|
228
|
+
// | /** Zambian Kwacha */ ZMW
|
|
229
|
+
// | /** Zimbabwe Gold */ ZWG
|
|
220
230
|
|
|
221
231
|
/** Every currency the type admits, in code order. `fromString` is derived from
|
|
222
232
|
this, so a code that parses and a code that exists are the same set by
|
|
223
233
|
construction. */
|
|
224
234
|
let all: array<t> = [
|
|
225
|
-
AUD,
|
|
235
|
+
AUD,
|
|
236
|
+
CAD,
|
|
237
|
+
CHF,
|
|
238
|
+
CNY,
|
|
239
|
+
EUR,
|
|
240
|
+
GBP,
|
|
241
|
+
JPY,
|
|
242
|
+
NOK,
|
|
243
|
+
SEK,
|
|
244
|
+
USD,
|
|
226
245
|
// AED, AFN, ALL, AMD, AOA, ARS, AWG, AZN, BAM, BBD, BDT, BHD, BIF, BMD, BND, BOB, BOV, BRL,
|
|
227
246
|
// BSD, BTN, BWP, BYN, BZD, CDF, CHE, CHW, CLF, CLP, COP, COU, CRC, CUP, CVE, CZK, DJF, DKK,
|
|
228
247
|
// DOP, DZD, EGP, ERN, ETB, FJD, FKP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HTG, HUF,
|
|
@@ -66,7 +66,6 @@ projection rebuild. It costs a log something only if it *collapses* an existing
|
|
|
66
66
|
`start*`/`end*` pair, which rewrites the wire shape the way `Money` rewrote
|
|
67
67
|
`price: float`. That collapse belongs to whoever builds the upcaster.
|
|
68
68
|
*/
|
|
69
|
-
|
|
70
69
|
@schema
|
|
71
70
|
type t = {
|
|
72
71
|
/** The instant the range opens, inclusive. */
|
|
@@ -83,7 +82,8 @@ type t = {
|
|
|
83
82
|
Shadows the schema sury-ppx derived from the type above: the derived one is
|
|
84
83
|
the shape, and this adds the marker the shape cannot carry. The ordering rule
|
|
85
84
|
is deliberately *not* refined in here — see the module doc. */
|
|
86
|
-
let schema: S.t<t> =
|
|
85
|
+
let schema: S.t<t> =
|
|
86
|
+
schema->Semantic.mark(~id=Semantic.Id.dateRange)
|
|
87
87
|
|
|
88
88
|
/** An instant as milliseconds since the epoch. `DateTime`'s, so end-exclusivity
|
|
89
89
|
and the ordering rule are expressed against the same single parse the type
|
|
@@ -101,8 +101,7 @@ that both parse, the earlier one second.
|
|
|
101
101
|
let validate = (range: t): result<t, string> =>
|
|
102
102
|
millis(range.start) > millis(range.end_)
|
|
103
103
|
? Error(
|
|
104
|
-
`a range ends before it starts: ${range.start} is after ${range.end_}. ` ++
|
|
105
|
-
`A range is [start, end) — the start is the earlier instant.`,
|
|
104
|
+
`a range ends before it starts: ${range.start} is after ${range.end_}. ` ++ `A range is [start, end) — the start is the earlier instant.`,
|
|
106
105
|
)
|
|
107
106
|
: Ok(range)
|
|
108
107
|
|
|
@@ -38,7 +38,6 @@ type state = {
|
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
41
|
/** The instant's representation. Transparent `string`: the marker refines an
|
|
43
42
|
existing field rather than replacing it, so nothing stored changes, and
|
|
44
43
|
`placedAt: meta.time` keeps compiling. */
|
|
@@ -55,18 +54,19 @@ let grammar: S.t<string> = S.isoDateTime
|
|
|
55
54
|
let fromString = (raw: string): result<t, string> =>
|
|
56
55
|
switch raw->S.parseOrThrow(~to=grammar) {
|
|
57
56
|
| value => Ok(value)
|
|
58
|
-
| exception _ =>
|
|
59
|
-
Error(`expected a UTC ISO-8601 instant, got ${Semantic.showString(raw)}`)
|
|
57
|
+
| exception _ => Error(`expected a UTC ISO-8601 instant, got ${Semantic.showString(raw)}`)
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
/** The sury schema for an instant field. Use with `@s.matches(Reventless.DateTime.schema)`,
|
|
63
61
|
or write the field's type as `Reventless.DateTime.t` and let sury-ppx resolve it. */
|
|
64
|
-
let schema: S.t<t> =
|
|
62
|
+
let schema: S.t<t> =
|
|
63
|
+
S.string->Semantic.refined(~id=Semantic.Id.dateTime, ~check=fromString)
|
|
65
64
|
|
|
66
65
|
/** A sury string schema annotated as an instant, without the grammar.
|
|
67
66
|
|
|
68
67
|
@deprecated Use `schema`, which carries the same marker and checks the value. */
|
|
69
|
-
let string: S.t<string> =
|
|
68
|
+
let string: S.t<string> =
|
|
69
|
+
S.string->Semantic.mark(~id=Semantic.Id.dateTime)
|
|
70
70
|
|
|
71
71
|
/** Whether a field schema carries the date-time marker. */
|
|
72
72
|
let isDateTime = (fieldSchema: S.t<unknown>) => fieldSchema->Semantic.has(~id=Semantic.Id.dateTime)
|
|
@@ -14,7 +14,6 @@ wire. `int` is safe here — int32 seconds is 68 years.
|
|
|
14
14
|
}
|
|
15
15
|
```
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
/** The duration's representation, in seconds. Transparent `int`. */
|
|
19
18
|
type t = int
|
|
20
19
|
|
|
@@ -31,7 +30,8 @@ let fromInt = (raw: int): result<t, string> =>
|
|
|
31
30
|
|
|
32
31
|
/** The sury schema for a duration field, in seconds.
|
|
33
32
|
Use with `@s.matches(Reventless.Duration.schema)`. */
|
|
34
|
-
let schema: S.t<t> =
|
|
33
|
+
let schema: S.t<t> =
|
|
34
|
+
S.int->Semantic.refined(~id=Semantic.Id.duration, ~check=fromInt)
|
|
35
35
|
|
|
36
36
|
let scales = [(86400, "d"), (3600, "h"), (60, "m"), (1, "s")]
|
|
37
37
|
|