@reventlessdev/reventless-spec 3.0.0-alpha.132 → 3.0.0-alpha.134
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 +14 -0
- package/package.json +2 -2
- package/src/AnsiStyle.res +0 -1
- package/src/LogPrefix.res +4 -13
- package/src/components/AutomationSlice.res +1 -5
- package/src/components/CapabilityManifest.res +2 -3
- 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 +52 -0
- package/src/components/FieldDefault.res.mjs +50 -0
- 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 +13 -11
- 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 +173 -145
- package/src/lifecycle/CheckLifecycleModel.res.mjs +17 -2
- package/src/semantic/Bytes.res +0 -1
- package/src/semantic/CalendarDate.res +2 -2
- package/src/semantic/Capabilities.res +4 -6
- package/src/semantic/Capabilities.res.mjs +9 -11
- package/src/semantic/CapabilityNeed.res +4 -5
- 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/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/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/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 +1 -3
- 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_Sury.res +1 -4
|
@@ -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
|
|
package/src/semantic/Email.res
CHANGED
package/src/semantic/FileRef.res
CHANGED
|
@@ -14,7 +14,6 @@ the pair exists and what the grammar refuses.
|
|
|
14
14
|
})
|
|
15
15
|
```
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
/** Transparent `string`; see `Email.t`. */
|
|
19
18
|
type t = string
|
|
20
19
|
|
|
@@ -25,4 +24,5 @@ let fromString = (raw: string): result<t, string> => Media_Ref.check(~what="file
|
|
|
25
24
|
|
|
26
25
|
/** The sury schema for a file-reference field.
|
|
27
26
|
Use with `@s.matches(Reventless.FileRef.schema)`. */
|
|
28
|
-
let schema: S.t<t> =
|
|
27
|
+
let schema: S.t<t> =
|
|
28
|
+
S.string->Semantic.refined(~id=Semantic.Id.fileRef, ~check=fromString)
|
|
@@ -64,7 +64,6 @@ type has, and it is the one most existing coordinate fields are on. It costs a
|
|
|
64
64
|
log something only if it *collapses* two flattened scalar fields back into one,
|
|
65
65
|
which rewrites that shape.
|
|
66
66
|
*/
|
|
67
|
-
|
|
68
67
|
/**
|
|
69
68
|
Validate a latitude, saying why when it is out of range.
|
|
70
69
|
|
|
@@ -76,8 +75,9 @@ let validateLat = (raw: float): result<float, string> =>
|
|
|
76
75
|
Error(`a latitude must be a finite number of degrees, got ${Float.toString(raw)}`)
|
|
77
76
|
} else if raw < -90.0 || raw > 90.0 {
|
|
78
77
|
Error(
|
|
79
|
-
`a latitude runs from -90 to 90 degrees, got ${Float.toString(
|
|
80
|
-
|
|
78
|
+
`a latitude runs from -90 to 90 degrees, got ${Float.toString(
|
|
79
|
+
raw,
|
|
80
|
+
)}. ` ++ `A value beyond ±90 is usually a longitude in the latitude's place.`,
|
|
81
81
|
)
|
|
82
82
|
} else {
|
|
83
83
|
Ok(raw)
|
|
@@ -99,25 +99,20 @@ let validateLng = (raw: float): result<float, string> =>
|
|
|
99
99
|
11-alpha miscompiles a refinement wrapping a *record* schema. Refining the
|
|
100
100
|
field is both the honest placement and the one that works. */
|
|
101
101
|
let latSchema: S.t<float> =
|
|
102
|
-
S.float->S.refine(
|
|
103
|
-
raw
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
~error="expected a latitude in -90…90",
|
|
109
|
-
)
|
|
102
|
+
S.float->S.refine(raw =>
|
|
103
|
+
switch validateLat(raw) {
|
|
104
|
+
| Ok(_) => true
|
|
105
|
+
| Error(_) => false
|
|
106
|
+
}
|
|
107
|
+
, ~error="expected a latitude in -90…90")
|
|
110
108
|
|
|
111
109
|
/** The longitude's own schema, for the same reason. */
|
|
112
|
-
let lngSchema: S.t<float> =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
~error="expected a longitude in -180…180",
|
|
120
|
-
)
|
|
110
|
+
let lngSchema: S.t<float> = S.float->S.refine(raw =>
|
|
111
|
+
switch validateLng(raw) {
|
|
112
|
+
| Ok(_) => true
|
|
113
|
+
| Error(_) => false
|
|
114
|
+
}
|
|
115
|
+
, ~error="expected a longitude in -180…180")
|
|
121
116
|
|
|
122
117
|
@schema
|
|
123
118
|
type t = {
|
|
@@ -131,7 +126,8 @@ type t = {
|
|
|
131
126
|
|
|
132
127
|
Shadows the schema sury-ppx derived from the type above: the derived one is
|
|
133
128
|
the shape, and this adds the marker the shape cannot carry. */
|
|
134
|
-
let schema: S.t<t> =
|
|
129
|
+
let schema: S.t<t> =
|
|
130
|
+
schema->Semantic.mark(~id=Semantic.Id.geoPoint)
|
|
135
131
|
|
|
136
132
|
/** Build a validated point. Both coordinates are checked, and the message names
|
|
137
133
|
which one is wrong — the common mistake is a swapped pair, where the
|
|
@@ -5,7 +5,6 @@ The transport is provider-specific and lives with its provider. What is here is
|
|
|
5
5
|
provider-neutral: the shape of an answer, the two ways a lookup fails, and the
|
|
6
6
|
confidence rule — decided once, so no transport invents its own.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
8
|
/** One candidate a geocoder returned. */
|
|
10
9
|
type candidate = {
|
|
11
10
|
/** The provider's canonical rendering of the address it matched. */
|
|
@@ -19,10 +18,10 @@ type candidate = {
|
|
|
19
18
|
/** Why a lookup produced no usable point. Two constructors because the retry
|
|
20
19
|
decision turns on the distinction: an outage must not become a verdict. */
|
|
21
20
|
type failure =
|
|
22
|
-
|
|
23
|
-
Unavailable(string)
|
|
24
|
-
|
|
25
|
-
NoMatch
|
|
21
|
+
/** The provider could not be reached, or refused the call. Retry. */
|
|
22
|
+
| Unavailable(string)
|
|
23
|
+
/** The provider answered, and had nothing for this text. Do not retry. */
|
|
24
|
+
| NoMatch
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
The port a caller reaches a geocoder through, so swapping the implementation is a
|
|
@@ -51,11 +50,11 @@ let defaultAmbiguityMargin = 0.01
|
|
|
51
50
|
type assessment =
|
|
52
51
|
| Confident(candidate)
|
|
53
52
|
| NoCandidates
|
|
54
|
-
|
|
55
|
-
Unscored(candidate)
|
|
53
|
+
/** Unscored is not a low score, and must not read as a high one. */
|
|
54
|
+
| Unscored(candidate)
|
|
56
55
|
| LowRelevance({top: candidate, score: float, floor: float})
|
|
57
|
-
|
|
58
|
-
Ambiguous({top: candidate, runnerUp: candidate, margin: float})
|
|
56
|
+
/** Several matches about equally well. */
|
|
57
|
+
| Ambiguous({top: candidate, runnerUp: candidate, margin: float})
|
|
59
58
|
|
|
60
59
|
/** The confidence rule, stated once. Everything else here derives from it. */
|
|
61
60
|
let assess = (
|
|
@@ -5,14 +5,13 @@ Three arms rather than `option<GeoPoint.t>`, whose `None` means both "has not ru
|
|
|
5
5
|
and "ran and failed". Emitted as a GraphQL union (see `Reventless.TaggedUnion`).
|
|
6
6
|
Replacing a point/status/note trio with it is wire-breaking.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
8
|
@schema
|
|
10
9
|
type t =
|
|
11
|
-
|
|
12
|
-
Pending({requestedFor: string})
|
|
10
|
+
/** `requestedFor` is the address asked about, so a stale answer is detectable. */
|
|
11
|
+
| Pending({requestedFor: string})
|
|
13
12
|
| Located({point: GeoPoint.t})
|
|
14
|
-
|
|
15
|
-
Unresolvable({reason: string})
|
|
13
|
+
/** Answered, with nothing storable unattended. A verdict for a human. */
|
|
14
|
+
| Unresolvable({reason: string})
|
|
16
15
|
|
|
17
16
|
/** Adds the two markers the shape cannot carry: the semantic, and the union name
|
|
18
17
|
the SDL and the `__typename` stamp share. */
|
|
@@ -59,8 +58,7 @@ let ofSearch = (
|
|
|
59
58
|
| Unscored(top) =>
|
|
60
59
|
Some(
|
|
61
60
|
Unresolvable({
|
|
62
|
-
reason: `the geocoder returned "${top.label}" for "${requestedFor}" without scoring it, ` ++
|
|
63
|
-
`and an unscored answer cannot be accepted unattended`,
|
|
61
|
+
reason: `the geocoder returned "${top.label}" for "${requestedFor}" without scoring it, ` ++ `and an unscored answer cannot be accepted unattended`,
|
|
64
62
|
}),
|
|
65
63
|
)
|
|
66
64
|
| LowRelevance({top, score, floor}) =>
|
|
@@ -73,8 +71,7 @@ let ofSearch = (
|
|
|
73
71
|
| Ambiguous({top, runnerUp}) =>
|
|
74
72
|
Some(
|
|
75
73
|
Unresolvable({
|
|
76
|
-
reason: `"${requestedFor}" matched "${top.label}" and "${runnerUp.label}" ` ++
|
|
77
|
-
`about equally well`,
|
|
74
|
+
reason: `"${requestedFor}" matched "${top.label}" and "${runnerUp.label}" ` ++ `about equally well`,
|
|
78
75
|
}),
|
|
79
76
|
)
|
|
80
77
|
}
|