@reventlessdev/reventless-spec 3.0.0-alpha.116 → 3.0.0-alpha.118

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 (67) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +4 -4
  3. package/schema/platform-api.graphql +11 -2
  4. package/src/components/CapabilityManifest.res +1 -1
  5. package/src/components/CapabilityManifest.res.mjs +13 -12
  6. package/src/components/DcbDecode.res +8 -8
  7. package/src/components/DcbDecode.res.mjs +9 -8
  8. package/src/components/DcbTag.res +43 -42
  9. package/src/components/DcbTag.res.mjs +90 -87
  10. package/src/components/DcbValidation.res +6 -6
  11. package/src/components/DcbValidation.res.mjs +6 -6
  12. package/src/components/DisplayName.res.mjs +3 -3
  13. package/src/components/Owner.res +1 -1
  14. package/src/components/Owner.res.mjs +7 -7
  15. package/src/components/Plugin.res +28 -11
  16. package/src/components/Plugin.res.mjs +134 -134
  17. package/src/components/Reference.res.mjs +5 -5
  18. package/src/components/StateAnnotations.res +44 -0
  19. package/src/components/StateAnnotations.res.mjs +3 -3
  20. package/src/generator/PlatformCodegen.res +17 -14
  21. package/src/generator/PlatformCodegen.res.mjs +1 -1
  22. package/src/generator/PlatformGenerator.res +1 -1
  23. package/src/semantic/Bytes.res.mjs +2 -2
  24. package/src/semantic/Color.res.mjs +2 -2
  25. package/src/semantic/Currency.res.mjs +167 -167
  26. package/src/semantic/DateRange.res.mjs +2 -2
  27. package/src/semantic/Duration.res.mjs +2 -2
  28. package/src/semantic/Email.res +2 -2
  29. package/src/semantic/Email.res.mjs +3 -2
  30. package/src/semantic/FileRef.res +28 -0
  31. package/src/semantic/FileRef.res.mjs +17 -0
  32. package/src/semantic/GeoPoint.res +14 -10
  33. package/src/semantic/GeoPoint.res.mjs +10 -17
  34. package/src/semantic/ImageRef.res +51 -0
  35. package/src/semantic/ImageRef.res.mjs +17 -0
  36. package/src/semantic/Media_Ref.res +33 -0
  37. package/src/semantic/Media_Ref.res.mjs +37 -0
  38. package/src/semantic/Money.res +7 -5
  39. package/src/semantic/Money.res.mjs +6 -9
  40. package/src/semantic/Offload.res +29 -43
  41. package/src/semantic/Offload.res.mjs +18 -49
  42. package/src/semantic/Percent.res.mjs +2 -2
  43. package/src/semantic/Phone.res.mjs +2 -2
  44. package/src/semantic/Semantic.res +24 -6
  45. package/src/semantic/Semantic.res.mjs +13 -12
  46. package/src/semantic/StorageRef.res +33 -19
  47. package/src/semantic/StorageRef.res.mjs +14 -14
  48. package/src/semantic/UploadableFile.res +30 -0
  49. package/src/semantic/UploadableFile.res.mjs +23 -0
  50. package/src/semantic/UploadableImage.res +56 -0
  51. package/src/semantic/UploadableImage.res.mjs +23 -0
  52. package/src/semantic/Url.res +8 -2
  53. package/src/semantic/Url.res.mjs +3 -2
  54. package/src/types/Authorization.res.mjs +7 -7
  55. package/src/types/DateTime.res.mjs +2 -2
  56. package/src/types/Id.res.mjs +6 -4
  57. package/src/types/Identity.res +0 -1
  58. package/src/types/Identity.res.mjs +12 -14
  59. package/src/types/Message.res +29 -10
  60. package/src/types/Message.res.mjs +56 -37
  61. package/src/types/ReadConsistency.res.mjs +5 -5
  62. package/src/types/Schedule.res.mjs +37 -37
  63. package/src/types/StoredEvent.res +2 -2
  64. package/src/types/StoredEvent.res.mjs +11 -10
  65. package/src/types/Visibility.res.mjs +4 -4
  66. package/src/util/Util_Sury.res +32 -0
  67. package/src/util/Util_Sury.res.mjs +39 -0
@@ -1,6 +1,6 @@
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 Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
5
5
  import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
6
6
  import * as Primitive_int from "@rescript/runtime/lib/es6/Primitive_int.js";
@@ -8,69 +8,70 @@ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
8
8
  import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
9
9
  import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
10
10
  import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
11
+ import * as Util_Sury$Reventless from "../util/Util_Sury.res.mjs";
11
12
  import * as DcbScopeInference$Reventless from "./DcbScopeInference.res.mjs";
12
13
 
13
- let tagSchema = S.schema(s => ({
14
- key: s.m(S.string),
15
- value: s.m(S.string)
14
+ let tagSchema = Sury.$schema(s => ({
15
+ key: s.m(Sury.string),
16
+ value: s.m(Sury.string)
16
17
  }));
17
18
 
18
- let partitionTagSchema = S.schema(s => ({
19
- key: s.m(S.string)
19
+ let partitionTagSchema = Sury.$schema(s => ({
20
+ key: s.m(Sury.string)
20
21
  }));
21
22
 
22
- let dcbTagId = S.Metadata.Id.make("dcb", "tag");
23
+ let dcbTagId = Sury.$Metadata_Id_make("dcb", "tag");
23
24
 
24
- let dcbPartitionTagId = S.Metadata.Id.make("dcb", "partitionTag");
25
+ let dcbPartitionTagId = Sury.$Metadata_Id_make("dcb", "partitionTag");
25
26
 
26
- let dcbCrossPartitionId = S.Metadata.Id.make("dcb", "crossPartition");
27
+ let dcbCrossPartitionId = Sury.$Metadata_Id_make("dcb", "crossPartition");
27
28
 
28
- let dcbCompositePartitionMemberId = S.Metadata.Id.make("dcb", "compositePartitionMember");
29
+ let dcbCompositePartitionMemberId = Sury.$Metadata_Id_make("dcb", "compositePartitionMember");
29
30
 
30
- let dcbTagKeyOverrideId = S.Metadata.Id.make("dcb", "tagKeyOverride");
31
+ let dcbTagKeyOverrideId = Sury.$Metadata_Id_make("dcb", "tagKeyOverride");
31
32
 
32
- let string = S.Metadata.set(S.string, dcbTagId, true);
33
+ let string = Sury.$Metadata_set(Sury.string, dcbTagId, true);
33
34
 
34
35
  function stringForKey(key) {
35
- return S.Metadata.set(S.Metadata.set(S.string, dcbTagId, true), dcbTagKeyOverrideId, key);
36
+ return Sury.$Metadata_set(Sury.$Metadata_set(Sury.string, dcbTagId, true), dcbTagKeyOverrideId, key);
36
37
  }
37
38
 
38
- let int = S.Metadata.set(S.int, dcbTagId, true);
39
+ let int = Sury.$Metadata_set(Sury.int, dcbTagId, true);
39
40
 
40
- let partition = S.Metadata.set(S.Metadata.set(S.string, dcbTagId, true), dcbPartitionTagId, true);
41
+ let partition = Sury.$Metadata_set(Sury.$Metadata_set(Sury.string, dcbTagId, true), dcbPartitionTagId, true);
41
42
 
42
- let crossPartition = S.Metadata.set(S.Metadata.set(S.string, dcbTagId, true), dcbCrossPartitionId, true);
43
+ let crossPartition = Sury.$Metadata_set(Sury.$Metadata_set(Sury.string, dcbTagId, true), dcbCrossPartitionId, true);
43
44
 
44
45
  function compositePartitionMember(position, sepOpt) {
45
46
  let sep = sepOpt !== undefined ? sepOpt : "/";
46
- return S.Metadata.set(S.Metadata.set(S.string, dcbTagId, true), dcbCompositePartitionMemberId, {
47
+ return Sury.$Metadata_set(Sury.$Metadata_set(Sury.string, dcbTagId, true), dcbCompositePartitionMemberId, {
47
48
  position: position,
48
49
  sep: sep
49
50
  });
50
51
  }
51
52
 
52
53
  function isCompositePartitionMember(fieldSchema) {
53
- return Stdlib_Option.isSome(S.Metadata.get(fieldSchema, dcbCompositePartitionMemberId));
54
+ return Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbCompositePartitionMemberId));
54
55
  }
55
56
 
56
- let compositePartitionSpecSchema = S.schema(s => ({
57
- keys: s.m(S.array(S.string)),
58
- seps: s.m(S.array(S.string))
57
+ let compositePartitionSpecSchema = Sury.$schema(s => ({
58
+ keys: s.m(Sury.array(Sury.string)),
59
+ seps: s.m(Sury.array(Sury.string))
59
60
  }));
60
61
 
61
- let derivedPartitionTagSchema = S.union([
62
- S.schema(s => ({
62
+ let derivedPartitionTagSchema = Sury.union([
63
+ Sury.$schema(s => ({
63
64
  TAG: "Simple",
64
65
  _0: s.m(partitionTagSchema)
65
66
  })),
66
- S.schema(s => ({
67
+ Sury.$schema(s => ({
67
68
  TAG: "Composite",
68
69
  _0: s.m(compositePartitionSpecSchema)
69
70
  }))
70
71
  ]);
71
72
 
72
73
  function isTagged(fieldSchema) {
73
- return Stdlib_Option.isSome(S.Metadata.get(fieldSchema, dcbTagId));
74
+ return Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbTagId));
74
75
  }
75
76
 
76
77
  function isTaggedArray(fieldSchema) {
@@ -81,16 +82,16 @@ function isTaggedArray(fieldSchema) {
81
82
  if (itemSchema === "strip" || itemSchema === "strict") {
82
83
  return false;
83
84
  } else {
84
- return isTagged(itemSchema);
85
+ return Stdlib_Option.isSome(Sury.$Metadata_get(itemSchema, dcbTagId));
85
86
  }
86
87
  }
87
88
 
88
89
  function isPartitionTag(fieldSchema) {
89
- return Stdlib_Option.isSome(S.Metadata.get(fieldSchema, dcbPartitionTagId));
90
+ return Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbPartitionTagId));
90
91
  }
91
92
 
92
93
  function isCrossPartitionTag(fieldSchema) {
93
- return Stdlib_Option.isSome(S.Metadata.get(fieldSchema, dcbCrossPartitionId));
94
+ return Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbCrossPartitionId));
94
95
  }
95
96
 
96
97
  function isCrossPartitionTaggedArray(fieldSchema) {
@@ -101,12 +102,12 @@ function isCrossPartitionTaggedArray(fieldSchema) {
101
102
  if (itemSchema === "strip" || itemSchema === "strict") {
102
103
  return false;
103
104
  } else {
104
- return isCrossPartitionTag(itemSchema);
105
+ return Stdlib_Option.isSome(Sury.$Metadata_get(itemSchema, dcbCrossPartitionId));
105
106
  }
106
107
  }
107
108
 
108
109
  function resolveTagKey(fieldName, fieldSchema) {
109
- return Stdlib_Option.getOr(S.Metadata.get(fieldSchema, dcbTagKeyOverrideId), fieldName);
110
+ return Stdlib_Option.getOr(Sury.$Metadata_get(fieldSchema, dcbTagKeyOverrideId), fieldName);
110
111
  }
111
112
 
112
113
  function resolveArrayTagKey(fieldName, fieldSchema) {
@@ -117,7 +118,7 @@ function resolveArrayTagKey(fieldName, fieldSchema) {
117
118
  if (itemSchema === "strip" || itemSchema === "strict") {
118
119
  return fieldName;
119
120
  } else {
120
- return Stdlib_Option.getOr(S.Metadata.get(itemSchema, dcbTagKeyOverrideId), fieldName);
121
+ return Stdlib_Option.getOr(Sury.$Metadata_get(itemSchema, dcbTagKeyOverrideId), fieldName);
121
122
  }
122
123
  }
123
124
 
@@ -142,7 +143,7 @@ function extractTagsFromProperties(properties, jsonDict) {
142
143
  return Stdlib_Array.filterMap(Object.entries(properties), param => {
143
144
  let fieldSchema = param[1];
144
145
  let fieldName = param[0];
145
- if (isTagged(fieldSchema)) {
146
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbTagId))) {
146
147
  return Stdlib_Option.map(jsonDict[fieldName], jsonValue => ({
147
148
  key: resolveTagKey(fieldName, fieldSchema),
148
149
  value: jsonValueToString(jsonValue)
@@ -151,15 +152,14 @@ function extractTagsFromProperties(properties, jsonDict) {
151
152
  });
152
153
  }
153
154
 
154
- function variantTagName(items) {
155
- return Stdlib_Option.flatMap(items.find(item => item.location === "TAG"), item => {
156
- let match = item.schema;
157
- if (match.type !== "string") {
155
+ function variantTagName(properties) {
156
+ return Stdlib_Option.flatMap(properties["TAG"], schema => {
157
+ if (schema.type !== "string") {
158
158
  return;
159
159
  }
160
- let $$const = match.const;
161
- if ($$const !== undefined) {
162
- return $$const;
160
+ let name = schema.const;
161
+ if (name !== undefined) {
162
+ return name;
163
163
  }
164
164
  });
165
165
  }
@@ -173,7 +173,7 @@ function extractTagsFromJson(schema, json) {
173
173
  } else {
174
174
  return [];
175
175
  }
176
- case "union" :
176
+ case "anyOf" :
177
177
  let jsonDict$1 = Stdlib_JSON.Decode.object(json);
178
178
  if (jsonDict$1 === undefined) {
179
179
  return [];
@@ -186,12 +186,13 @@ function extractTagsFromJson(schema, json) {
186
186
  return Stdlib_Array.reduce(schema.anyOf, [], (acc, variantSchema) => {
187
187
  if (acc.length !== 0) {
188
188
  return acc;
189
- } else if (variantSchema.type === "object") {
190
- if (Primitive_object.equal(variantTagName(variantSchema.items), jsonTag)) {
191
- return extractTagsFromProperties(variantSchema.properties, jsonDict$1);
192
- } else {
193
- return [];
194
- }
189
+ }
190
+ if (variantSchema.type !== "object") {
191
+ return [];
192
+ }
193
+ let properties = variantSchema.properties;
194
+ if (Primitive_object.equal(variantTagName(properties), jsonTag)) {
195
+ return extractTagsFromProperties(properties, jsonDict$1);
195
196
  } else {
196
197
  return [];
197
198
  }
@@ -202,17 +203,17 @@ function extractTagsFromJson(schema, json) {
202
203
  }
203
204
 
204
205
  function extractTags(schema, value) {
205
- return extractTagsFromJson(schema, S.reverseConvertToJsonOrThrow(value, schema));
206
+ return extractTagsFromJson(schema, Util_Sury$Reventless.toJson(value, schema));
206
207
  }
207
208
 
208
209
  function extractVariantNames(schema) {
209
210
  switch (schema.type) {
210
211
  case "object" :
211
- return Stdlib_Option.mapOr(variantTagName(schema.items), [], t => [t]);
212
- case "union" :
212
+ return Stdlib_Option.mapOr(variantTagName(schema.properties), [], t => [t]);
213
+ case "anyOf" :
213
214
  return Stdlib_Array.filterMap(schema.anyOf, variantSchema => {
214
215
  if (variantSchema.type === "object") {
215
- return variantTagName(variantSchema.items);
216
+ return variantTagName(variantSchema.properties);
216
217
  }
217
218
  });
218
219
  default:
@@ -230,8 +231,8 @@ function extractAllVariantNames(schema) {
230
231
  return [];
231
232
  }
232
233
  case "object" :
233
- return Stdlib_Option.mapOr(variantTagName(schema.items), [], t => [t]);
234
- case "union" :
234
+ return Stdlib_Option.mapOr(variantTagName(schema.properties), [], t => [t]);
235
+ case "anyOf" :
235
236
  return Stdlib_Array.filterMap(schema.anyOf, variantSchema => {
236
237
  switch (variantSchema.type) {
237
238
  case "string" :
@@ -242,7 +243,7 @@ function extractAllVariantNames(schema) {
242
243
  return;
243
244
  }
244
245
  case "object" :
245
- return variantTagName(variantSchema.items);
246
+ return variantTagName(variantSchema.properties);
246
247
  default:
247
248
  return;
248
249
  }
@@ -259,11 +260,11 @@ function isVariantPayloadBearing(schema, name) {
259
260
  }
260
261
  switch (schema.type) {
261
262
  case "object" :
262
- return Stdlib_Option.mapOr(variantTagName(schema.items), false, t => t === name);
263
- case "union" :
263
+ return Stdlib_Option.mapOr(variantTagName(schema.properties), false, t => t === name);
264
+ case "anyOf" :
264
265
  return schema.anyOf.some(variantSchema => {
265
266
  if (variantSchema.type === "object") {
266
- return Stdlib_Option.mapOr(variantTagName(variantSchema.items), false, t => t === name);
267
+ return Stdlib_Option.mapOr(variantTagName(variantSchema.properties), false, t => t === name);
267
268
  } else {
268
269
  return false;
269
270
  }
@@ -277,7 +278,7 @@ function extractTagsFromPropertiesExpanded(properties, jsonDict) {
277
278
  return Object.entries(properties).flatMap(param => {
278
279
  let fieldSchema = param[1];
279
280
  let fieldName = param[0];
280
- if (isTagged(fieldSchema)) {
281
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbTagId))) {
281
282
  let jsonValue = jsonDict[fieldName];
282
283
  if (jsonValue !== undefined) {
283
284
  return [{
@@ -315,7 +316,7 @@ function extractTagsFromJsonExpanded(schema, json) {
315
316
  } else {
316
317
  return [];
317
318
  }
318
- case "union" :
319
+ case "anyOf" :
319
320
  let jsonDict$1 = Stdlib_JSON.Decode.object(json);
320
321
  if (jsonDict$1 === undefined) {
321
322
  return [];
@@ -328,12 +329,13 @@ function extractTagsFromJsonExpanded(schema, json) {
328
329
  return Stdlib_Array.reduce(schema.anyOf, [], (acc, variantSchema) => {
329
330
  if (acc.length !== 0) {
330
331
  return acc;
331
- } else if (variantSchema.type === "object") {
332
- if (Primitive_object.equal(variantTagName(variantSchema.items), jsonTag)) {
333
- return extractTagsFromPropertiesExpanded(variantSchema.properties, jsonDict$1);
334
- } else {
335
- return [];
336
- }
332
+ }
333
+ if (variantSchema.type !== "object") {
334
+ return [];
335
+ }
336
+ let properties = variantSchema.properties;
337
+ if (Primitive_object.equal(variantTagName(properties), jsonTag)) {
338
+ return extractTagsFromPropertiesExpanded(properties, jsonDict$1);
337
339
  } else {
338
340
  return [];
339
341
  }
@@ -344,14 +346,14 @@ function extractTagsFromJsonExpanded(schema, json) {
344
346
  }
345
347
 
346
348
  function extractTagsExpanded(schema, value) {
347
- return extractTagsFromJsonExpanded(schema, S.reverseConvertToJsonOrThrow(value, schema));
349
+ return extractTagsFromJsonExpanded(schema, Util_Sury$Reventless.toJson(value, schema));
348
350
  }
349
351
 
350
352
  function hasTaggedArrayFields(schema) {
351
353
  switch (schema.type) {
352
354
  case "object" :
353
355
  return Object.entries(schema.properties).some(param => isTaggedArray(param[1]));
354
- case "union" :
356
+ case "anyOf" :
355
357
  return schema.anyOf.some(variantSchema => {
356
358
  if (variantSchema.type === "object") {
357
359
  return Object.entries(variantSchema.properties).some(param => isTaggedArray(param[1]));
@@ -368,7 +370,7 @@ function tagKeysOfProperties(properties) {
368
370
  return Stdlib_Array.filterMap(Object.entries(properties), param => {
369
371
  let fieldSchema = param[1];
370
372
  let fieldName = param[0];
371
- if (isTagged(fieldSchema)) {
373
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbTagId))) {
372
374
  return resolveTagKey(fieldName, fieldSchema);
373
375
  } else if (isTaggedArray(fieldSchema)) {
374
376
  return resolveArrayTagKey(fieldName, fieldSchema);
@@ -385,7 +387,7 @@ function extractTagKeysByEventType(schema) {
385
387
  return;
386
388
  }
387
389
  let properties = variantSchema.properties;
388
- Stdlib_Option.forEach(variantTagName(variantSchema.items), eventType => {
390
+ Stdlib_Option.forEach(variantTagName(properties), eventType => {
389
391
  result[eventType] = tagKeysOfProperties(properties);
390
392
  });
391
393
  };
@@ -393,7 +395,7 @@ function extractTagKeysByEventType(schema) {
393
395
  case "object" :
394
396
  addVariant(schema);
395
397
  break;
396
- case "union" :
398
+ case "anyOf" :
397
399
  schema.anyOf.forEach(addVariant);
398
400
  break;
399
401
  }
@@ -462,15 +464,15 @@ function extractTaggedFields(schema) {
462
464
  switch (schema.type) {
463
465
  case "object" :
464
466
  return Stdlib_Array.filterMap(Object.entries(schema.properties), param => {
465
- if (isTagged(param[1])) {
467
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(param[1], dcbTagId))) {
466
468
  return param[0];
467
469
  }
468
470
  }).toSorted(Primitive_string.compare);
469
- case "union" :
471
+ case "anyOf" :
470
472
  let allFields = schema.anyOf.flatMap(variantSchema => {
471
473
  if (variantSchema.type === "object") {
472
474
  return Stdlib_Array.filterMap(Object.entries(variantSchema.properties), param => {
473
- if (isTagged(param[1])) {
475
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(param[1], dcbTagId))) {
474
476
  return param[0];
475
477
  }
476
478
  });
@@ -492,7 +494,7 @@ function crossPartitionKeysOfProperties(properties) {
492
494
  return Stdlib_Array.filterMap(Object.entries(properties), param => {
493
495
  let fieldSchema = param[1];
494
496
  let fieldName = param[0];
495
- if (isTagged(fieldSchema) && isCrossPartitionTag(fieldSchema)) {
497
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbTagId)) && Stdlib_Option.isSome(Sury.$Metadata_get(fieldSchema, dcbCrossPartitionId))) {
496
498
  return resolveTagKey(fieldName, fieldSchema);
497
499
  } else if (isCrossPartitionTaggedArray(fieldSchema)) {
498
500
  return resolveArrayTagKey(fieldName, fieldSchema);
@@ -508,7 +510,7 @@ function extractCrossPartitionTagKeys(schema) {
508
510
  case "object" :
509
511
  keys = crossPartitionKeysOfProperties(schema.properties);
510
512
  break;
511
- case "union" :
513
+ case "anyOf" :
512
514
  keys = schema.anyOf.flatMap(variantSchema => {
513
515
  if (variantSchema.type === "object") {
514
516
  return crossPartitionKeysOfProperties(variantSchema.properties);
@@ -557,7 +559,7 @@ function eventShapesOfSchema(schema) {
557
559
  }
558
560
  case "object" :
559
561
  let properties = variantSchema.properties;
560
- return Stdlib_Option.map(variantTagName(variantSchema.items), eventType => ({
562
+ return Stdlib_Option.map(variantTagName(properties), eventType => ({
561
563
  eventType: eventType,
562
564
  idFields: idFieldsOfProperties(properties)
563
565
  }));
@@ -568,7 +570,7 @@ function eventShapesOfSchema(schema) {
568
570
  switch (schema.type) {
569
571
  case "object" :
570
572
  return Stdlib_Option.mapOr(ofVariant(schema), [], s => [s]);
571
- case "union" :
573
+ case "anyOf" :
572
574
  return Stdlib_Array.filterMap(schema.anyOf, ofVariant);
573
575
  default:
574
576
  return [];
@@ -579,15 +581,15 @@ function extractPartitionTagFields(schema) {
579
581
  switch (schema.type) {
580
582
  case "object" :
581
583
  return Stdlib_Array.filterMap(Object.entries(schema.properties), param => {
582
- if (isPartitionTag(param[1])) {
584
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(param[1], dcbPartitionTagId))) {
583
585
  return param[0];
584
586
  }
585
587
  });
586
- case "union" :
588
+ case "anyOf" :
587
589
  let allFields = schema.anyOf.flatMap(variantSchema => {
588
590
  if (variantSchema.type === "object") {
589
591
  return Stdlib_Array.filterMap(Object.entries(variantSchema.properties), param => {
590
- if (isPartitionTag(param[1])) {
592
+ if (Stdlib_Option.isSome(Sury.$Metadata_get(param[1], dcbPartitionTagId))) {
591
593
  return param[0];
592
594
  }
593
595
  });
@@ -641,14 +643,14 @@ function deriveEffectiveScope(slices) {
641
643
  function hasMultiTagVariant(schema) {
642
644
  switch (schema.type) {
643
645
  case "object" :
644
- let tagCount = Object.entries(schema.properties).filter(param => isTagged(param[1])).length;
646
+ let tagCount = Object.entries(schema.properties).filter(param => Stdlib_Option.isSome(Sury.$Metadata_get(param[1], dcbTagId))).length;
645
647
  return tagCount > 1;
646
- case "union" :
648
+ case "anyOf" :
647
649
  return schema.anyOf.some(variantSchema => {
648
650
  if (variantSchema.type !== "object") {
649
651
  return false;
650
652
  }
651
- let tagCount = Object.entries(variantSchema.properties).filter(param => isTagged(param[1])).length;
653
+ let tagCount = Object.entries(variantSchema.properties).filter(param => Stdlib_Option.isSome(Sury.$Metadata_get(param[1], dcbTagId))).length;
652
654
  return tagCount > 1;
653
655
  });
654
656
  default:
@@ -661,12 +663,13 @@ function findMultiTagVariantNames(schema) {
661
663
  if (variantSchema.type !== "object") {
662
664
  return;
663
665
  }
664
- let tagCount = Object.entries(variantSchema.properties).filter(param => isTagged(param[1])).length;
666
+ let properties = variantSchema.properties;
667
+ let tagCount = Object.entries(properties).filter(param => Stdlib_Option.isSome(Sury.$Metadata_get(param[1], dcbTagId))).length;
665
668
  if (tagCount > 1) {
666
- return Stdlib_Option.getOr(variantTagName(variantSchema.items), "(unknown)");
669
+ return Stdlib_Option.getOr(variantTagName(properties), "(unknown)");
667
670
  }
668
671
  };
669
- if (schema.type === "union") {
672
+ if (schema.type === "anyOf") {
670
673
  return Stdlib_Array.filterMap(schema.anyOf, variantName);
671
674
  }
672
675
  let name = variantName(schema);
@@ -679,7 +682,7 @@ function findMultiTagVariantNames(schema) {
679
682
 
680
683
  function extractCompositePartitionFieldsFromProperties(properties) {
681
684
  return Stdlib_Array.filterMap(Object.entries(properties), param => {
682
- let meta = S.Metadata.get(param[1], dcbCompositePartitionMemberId);
685
+ let meta = Sury.$Metadata_get(param[1], dcbCompositePartitionMemberId);
683
686
  if (meta !== undefined) {
684
687
  return {
685
688
  name: param[0],
@@ -703,7 +706,7 @@ function extractCompositePartitionFields(schema) {
703
706
  switch (schema.type) {
704
707
  case "object" :
705
708
  return collect(schema.properties);
706
- case "union" :
709
+ case "anyOf" :
707
710
  return schema.anyOf.flatMap(variantSchema => {
708
711
  if (variantSchema.type === "object") {
709
712
  return collect(variantSchema.properties);
@@ -12,8 +12,8 @@ type variantInfo = {
12
12
  // Extract variant info (TAG name, fields, tagged fields) from a single variant schema
13
13
  let extractVariantInfo = (variantSchema: S.t<unknown>): option<variantInfo> =>
14
14
  switch variantSchema {
15
- | Object({items, properties}) =>
16
- DcbTag.variantTagName(items)->Option.map(tagName => {
15
+ | Object({properties}) =>
16
+ DcbTag.variantTagName(properties)->Option.map(tagName => {
17
17
  let taggedFields =
18
18
  properties
19
19
  ->Dict.toArray
@@ -42,7 +42,7 @@ let extractVariantInfo = (variantSchema: S.t<unknown>): option<variantInfo> =>
42
42
  // Extract all variant infos from a schema (handles Union and single variants)
43
43
  let extractAllVariants = (schema: S.t<unknown>): array<variantInfo> =>
44
44
  switch schema {
45
- | Union({anyOf}) => anyOf->Array.filterMap(extractVariantInfo)
45
+ | AnyOf({anyOf}) => anyOf->Array.filterMap(extractVariantInfo)
46
46
  | _ =>
47
47
  switch extractVariantInfo(schema) {
48
48
  | Some(info) => [info]
@@ -66,7 +66,7 @@ let rec schemasAreCompatible = (a: S.t<unknown>, b: S.t<unknown>): bool =>
66
66
  | (Array({additionalItems: Schema(aItem)}), Array({additionalItems: Schema(bItem)})) =>
67
67
  schemasAreCompatible(aItem, bItem)
68
68
  | (Object({properties: aProps}), Object({properties: bProps})) => propsCompatible(aProps, bProps)
69
- | (Union(_), Union(_)) =>
69
+ | (AnyOf(_), AnyOf(_)) =>
70
70
  // Same set of variant tags, and each shared variant's payload compatible.
71
71
  let av = extractAllVariants(a)
72
72
  let bv = extractAllVariants(b)
@@ -104,7 +104,7 @@ let schemaTypeName = (schema: S.t<unknown>): string =>
104
104
  | BigInt(_) => "bigint"
105
105
  | Array(_) => "array"
106
106
  | Object(_) => "object"
107
- | Union(_) => "union"
107
+ | AnyOf(_) => "union"
108
108
  | Never(_) => "never"
109
109
  | Unknown(_) => "unknown"
110
110
  | Ref(_) => "ref"
@@ -126,7 +126,7 @@ let schemaTypeName = (schema: S.t<unknown>): string =>
126
126
  // since that is all there is to say about it.
127
127
  let describeSchema = (schema: S.t<unknown>): string =>
128
128
  switch schema {
129
- | Union({anyOf}) =>
129
+ | AnyOf({anyOf}) =>
130
130
  let tags = extractAllVariants(schema)->Array.map(v => v.tagName)
131
131
  let members = tags->Array.length > 0 ? tags : anyOf->Array.map(schemaTypeName)
132
132
  `union[${members->Array.join(" | ")}]`
@@ -21,7 +21,7 @@ function extractVariantInfo(variantSchema) {
21
21
  }
22
22
  case "object" :
23
23
  let properties = variantSchema.properties;
24
- return Stdlib_Option.map(DcbTag$Reventless.variantTagName(variantSchema.items), tagName => {
24
+ return Stdlib_Option.map(DcbTag$Reventless.variantTagName(properties), tagName => {
25
25
  let taggedFields = Stdlib_Array.filterMap(Object.entries(properties), param => {
26
26
  if (DcbTag$Reventless.isTagged(param[1])) {
27
27
  return param[0];
@@ -39,7 +39,7 @@ function extractVariantInfo(variantSchema) {
39
39
  }
40
40
 
41
41
  function extractAllVariants(schema) {
42
- if (schema.type === "union") {
42
+ if (schema.type === "anyOf") {
43
43
  return Stdlib_Array.filterMap(schema.anyOf, extractVariantInfo);
44
44
  }
45
45
  let info = extractVariantInfo(schema);
@@ -88,8 +88,8 @@ function schemasAreCompatible(_a, _b) {
88
88
  } else {
89
89
  return false;
90
90
  }
91
- case "union" :
92
- if (b.type !== "union") {
91
+ case "anyOf" :
92
+ if (b.type !== "anyOf") {
93
93
  return false;
94
94
  }
95
95
  let av = extractAllVariants(a);
@@ -149,7 +149,7 @@ function schemaTypeName(schema) {
149
149
  return "array";
150
150
  case "object" :
151
151
  return "object";
152
- case "union" :
152
+ case "anyOf" :
153
153
  return "union";
154
154
  case "ref" :
155
155
  return "ref";
@@ -169,7 +169,7 @@ function describeSchema(schema) {
169
169
  }
170
170
  case "object" :
171
171
  return `object{` + Object.keys(schema.properties).toSorted(Primitive_string.compare).join(", ") + `}`;
172
- case "union" :
172
+ case "anyOf" :
173
173
  let tags = extractAllVariants(schema).map(v => v.tagName);
174
174
  let members = tags.length !== 0 ? tags : schema.anyOf.map(schemaTypeName);
175
175
  return `union[` + members.join(" | ") + `]`;
@@ -1,12 +1,12 @@
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 Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
5
5
 
6
- let displayNameId = S.Metadata.Id.make("reventless", "displayName");
6
+ let displayNameId = Sury.$Metadata_Id_make("reventless", "displayName");
7
7
 
8
8
  function getSpec(schema) {
9
- return S.Metadata.get(schema, displayNameId);
9
+ return Sury.$Metadata_get(schema, displayNameId);
10
10
  }
11
11
 
12
12
  function computeLabel(spec, state) {
@@ -119,7 +119,7 @@ let variantFieldNames = (schema: S.t<unknown>, ~variant: string): array<string>
119
119
  | _ => false
120
120
  }
121
121
  switch schema {
122
- | Union({anyOf}) =>
122
+ | AnyOf({anyOf}) =>
123
123
  anyOf
124
124
  ->Array.find(v =>
125
125
  switch v {
@@ -1,22 +1,22 @@
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 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 Semantic$Reventless from "../semantic/Semantic.res.mjs";
7
7
 
8
- let ownerId = S.Metadata.Id.make("reventless", "owner");
8
+ let ownerId = Sury.$Metadata_Id_make("reventless", "owner");
9
9
 
10
10
  function mark(schema) {
11
- return S.Metadata.set(schema, ownerId, true);
11
+ return Sury.$Metadata_set(schema, ownerId, true);
12
12
  }
13
13
 
14
- let string = mark(S.string);
14
+ let string = Sury.$Metadata_set(Sury.string, ownerId, true);
15
15
 
16
- let optionString = S.option(string);
16
+ let optionString = Sury.$option(string);
17
17
 
18
18
  function isOwner(schema) {
19
- return Stdlib_Option.getOr(S.Metadata.get(schema, ownerId), false);
19
+ return Stdlib_Option.getOr(Sury.$Metadata_get(schema, ownerId), false);
20
20
  }
21
21
 
22
22
  function isFieldOwner(schema) {
@@ -71,7 +71,7 @@ function variantFieldNames(schema, variant) {
71
71
  } else {
72
72
  return [];
73
73
  }
74
- case "union" :
74
+ case "anyOf" :
75
75
  return Stdlib_Option.mapOr(schema.anyOf.find(v => {
76
76
  if (v.type === "object") {
77
77
  return isVariant(v.properties);