@reventlessdev/reventless-spec 3.0.0-alpha.117 → 3.0.0-alpha.119

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/package.json +3 -3
  3. package/src/components/CapabilityManifest.res +1 -1
  4. package/src/components/CapabilityManifest.res.mjs +13 -12
  5. package/src/components/DcbDecode.res +8 -8
  6. package/src/components/DcbDecode.res.mjs +9 -8
  7. package/src/components/DcbTag.res +43 -42
  8. package/src/components/DcbTag.res.mjs +90 -87
  9. package/src/components/DcbValidation.res +6 -6
  10. package/src/components/DcbValidation.res.mjs +6 -6
  11. package/src/components/DisplayName.res.mjs +3 -3
  12. package/src/components/Owner.res +1 -1
  13. package/src/components/Owner.res.mjs +7 -7
  14. package/src/components/Plugin.res +8 -11
  15. package/src/components/Plugin.res.mjs +133 -134
  16. package/src/components/Reference.res.mjs +5 -5
  17. package/src/components/StateAnnotations.res +23 -0
  18. package/src/components/StateAnnotations.res.mjs +3 -3
  19. package/src/components/TaggedUnion.res +238 -0
  20. package/src/components/TaggedUnion.res.mjs +193 -0
  21. package/src/generator/PlatformCodegen.res +17 -14
  22. package/src/generator/PlatformCodegen.res.mjs +1 -1
  23. package/src/generator/PlatformGenerator.res +1 -1
  24. package/src/semantic/Bytes.res.mjs +2 -2
  25. package/src/semantic/Color.res.mjs +2 -2
  26. package/src/semantic/Currency.res.mjs +167 -167
  27. package/src/semantic/DateRange.res.mjs +2 -2
  28. package/src/semantic/Duration.res.mjs +2 -2
  29. package/src/semantic/Email.res +2 -2
  30. package/src/semantic/Email.res.mjs +3 -2
  31. package/src/semantic/FileRef.res +28 -0
  32. package/src/semantic/FileRef.res.mjs +17 -0
  33. package/src/semantic/GeoPoint.res +14 -10
  34. package/src/semantic/GeoPoint.res.mjs +10 -17
  35. package/src/semantic/ImageRef.res +51 -0
  36. package/src/semantic/ImageRef.res.mjs +17 -0
  37. package/src/semantic/Media_Ref.res +33 -0
  38. package/src/semantic/Media_Ref.res.mjs +37 -0
  39. package/src/semantic/Money.res +7 -5
  40. package/src/semantic/Money.res.mjs +6 -9
  41. package/src/semantic/Offload.res +29 -43
  42. package/src/semantic/Offload.res.mjs +18 -49
  43. package/src/semantic/Percent.res.mjs +2 -2
  44. package/src/semantic/Phone.res.mjs +2 -2
  45. package/src/semantic/Semantic.res +24 -6
  46. package/src/semantic/Semantic.res.mjs +13 -12
  47. package/src/semantic/StorageRef.res +33 -19
  48. package/src/semantic/StorageRef.res.mjs +14 -14
  49. package/src/semantic/UploadableFile.res +30 -0
  50. package/src/semantic/UploadableFile.res.mjs +23 -0
  51. package/src/semantic/UploadableImage.res +56 -0
  52. package/src/semantic/UploadableImage.res.mjs +23 -0
  53. package/src/semantic/Url.res +8 -2
  54. package/src/semantic/Url.res.mjs +3 -2
  55. package/src/types/Authorization.res.mjs +7 -7
  56. package/src/types/DateTime.res.mjs +2 -2
  57. package/src/types/Id.res.mjs +6 -4
  58. package/src/types/Identity.res +0 -1
  59. package/src/types/Identity.res.mjs +12 -14
  60. package/src/types/Message.res +29 -10
  61. package/src/types/Message.res.mjs +56 -37
  62. package/src/types/ReadConsistency.res.mjs +5 -5
  63. package/src/types/Schedule.res.mjs +37 -37
  64. package/src/types/StoredEvent.res +2 -2
  65. package/src/types/StoredEvent.res.mjs +11 -10
  66. package/src/types/Visibility.res.mjs +4 -4
  67. package/src/util/Util_Sury.res +32 -0
  68. package/src/util/Util_Sury.res.mjs +39 -0
@@ -1,27 +1,28 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
  import * as DcbTag$Reventless from "../components/DcbTag.res.mjs";
5
5
  import * as Message$Reventless from "./Message.res.mjs";
6
+ import * as Util_Sury$Reventless from "../util/Util_Sury.res.mjs";
6
7
 
7
8
  function toStoredEventSchema(idSchema) {
8
- return S.object(s => ({
9
+ return Sury.object(s => ({
9
10
  id: s.f("id", idSchema),
10
- position: s.f("position", S.string),
11
- event: s.f("event", S.string),
12
- data: s.f("data", S.json),
11
+ position: s.f("position", Sury.string),
12
+ event: s.f("event", Sury.string),
13
+ data: s.f("data", Sury.json),
13
14
  meta: s.f("meta", Message$Reventless.metaSchema),
14
- recordedAt: s.f("recordedAt", S.string),
15
- tags: s.f("tags", S.option(S.array(DcbTag$Reventless.tagSchema)))
15
+ recordedAt: s.f("recordedAt", Sury.string),
16
+ tags: s.f("tags", Sury.$option(Sury.array(DcbTag$Reventless.tagSchema)))
16
17
  }));
17
18
  }
18
19
 
19
20
  function decode(json, idSchema) {
20
- return S.parseJsonOrThrow(json, toStoredEventSchema(idSchema));
21
+ return Util_Sury$Reventless.fromJson(json, toStoredEventSchema(idSchema));
21
22
  }
22
23
 
23
24
  function encode(stored, idSchema) {
24
- return S.reverseConvertToJsonOrThrow(stored, toStoredEventSchema(idSchema));
25
+ return Util_Sury$Reventless.toJson(stored, toStoredEventSchema(idSchema));
25
26
  }
26
27
 
27
28
  export {
@@ -29,4 +30,4 @@ export {
29
30
  decode,
30
31
  encode,
31
32
  }
32
- /* S Not a pure module */
33
+ /* sury Not a pure module */
@@ -1,10 +1,10 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
 
5
- let schema = S.union([
6
- S.literal("Public"),
7
- S.literal("Internal")
5
+ let schema = Sury.union([
6
+ Sury.literal("Public"),
7
+ Sury.literal("Internal")
8
8
  ]);
9
9
 
10
10
  function toString(v) {
@@ -0,0 +1,32 @@
1
+ // Sury-version isolation seam. Wraps the sury 11 conversion API behind stable
2
+ // names so each call site is a mechanical rename from the removed alpha.4 helpers
3
+ // (`reverseConvertToJsonOrThrow` / `parseJsonOrThrow` / …), and a future sury bump
4
+ // is a one-file change. Signatures verified against sury@11.0.0-alpha.8 (S.resi):
5
+ // `parseOrThrow(~to)` / `decodeOrThrow(~from, ~to)` with labeled args; there is no
6
+ // `S.encoder` in the ReScript API — encoding goes `decodeOrThrow(~from=schema, ~to=S.json)`.
7
+ // See docs/plans/sury-11-migration.md.
8
+
9
+ let toJson: ('a, S.t<'a>) => JSON.t = (value, schema) =>
10
+ value->S.decodeOrThrow(~from=schema, ~to=S.json)
11
+
12
+ // `~space` defaults to compact, matching the removed `reverseConvertToJsonStringOrThrow`.
13
+ let toJsonString = (value: 'a, schema: S.t<'a>, ~space: int=0): string =>
14
+ value->S.decodeOrThrow(
15
+ ~from=schema,
16
+ ~to=space == 0 ? S.jsonString : S.jsonStringWithSpace(space),
17
+ )
18
+
19
+ let fromJson: (JSON.t, S.t<'a>) => 'a = (json, schema) => json->S.parseOrThrow(~to=schema)
20
+
21
+ let fromJsonString: (string, S.t<'a>) => 'a = (str, schema) =>
22
+ str->S.decodeOrThrow(~from=S.jsonString, ~to=schema)
23
+
24
+ // Sury raises `S.Exn`, which carries `RE_EXN_ID: "S.Exn"` and so is not a `JsExn`
25
+ // even though it is a JS Error at runtime — the usual
26
+ // `JsExn.fromException->flatMap(JsExn.message)` yields None and the reason is
27
+ // logged as "unknown". Reach for this at any site that catches a decode.
28
+ let exnMessage = (exn: exn, ~fallback: string="unknown"): string =>
29
+ switch exn {
30
+ | S.Exn(e) => e.message
31
+ | _ => exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr(fallback)
32
+ }
@@ -0,0 +1,39 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as S from "sury/src/S.res.mjs";
4
+ import * as Sury from "sury";
5
+ import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
6
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
7
+
8
+ function toJson(value, schema) {
9
+ return S.decodeOrThrow(value, schema, Sury.json);
10
+ }
11
+
12
+ function toJsonString(value, schema, spaceOpt) {
13
+ let space = spaceOpt !== undefined ? spaceOpt : 0;
14
+ return S.decodeOrThrow(value, schema, space === 0 ? Sury.jsonString : Sury.jsonStringWithSpace(space));
15
+ }
16
+
17
+ let fromJson = S.parseOrThrow;
18
+
19
+ function fromJsonString(str, schema) {
20
+ return S.decodeOrThrow(str, Sury.jsonString, schema);
21
+ }
22
+
23
+ function exnMessage(exn, fallbackOpt) {
24
+ let fallback = fallbackOpt !== undefined ? fallbackOpt : "unknown";
25
+ if (exn.RE_EXN_ID === S.Exn) {
26
+ return exn._1.message;
27
+ } else {
28
+ return Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), fallback);
29
+ }
30
+ }
31
+
32
+ export {
33
+ toJson,
34
+ toJsonString,
35
+ fromJson,
36
+ fromJsonString,
37
+ exnMessage,
38
+ }
39
+ /* S Not a pure module */