@reventlessdev/reventless-core 3.0.0-alpha.239 → 3.0.0-alpha.241

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 (172) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +11 -11
  3. package/src/Message.res +11 -11
  4. package/src/Message.res.mjs +15 -14
  5. package/src/Projection.res +2 -2
  6. package/src/Projection.res.mjs +5 -4
  7. package/src/adapter/Monitoring/Monitoring.res +24 -2
  8. package/src/adapter/Monitoring/Monitoring.res.mjs +3 -3
  9. package/src/admin/Platform_Admin.res +1 -16
  10. package/src/admin/Platform_Admin.res.mjs +2 -30
  11. package/src/admin/Platform_AdminApi.res.mjs +3 -3
  12. package/src/admin/Platform_Admin_Structure.res +58 -113
  13. package/src/admin/Platform_Admin_Structure.res.mjs +24 -139
  14. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +12 -12
  15. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs +14 -14
  16. package/src/components/Aggregate/Aggregate_Callback.res +2 -2
  17. package/src/components/Aggregate/Aggregate_Callback.res.mjs +4 -4
  18. package/src/components/Api/ApiAllowedStatesHelpers.res.mjs +3 -3
  19. package/src/components/Api/ApiNoApiHelpers.res.mjs +5 -5
  20. package/src/components/Api/ApiTargetStateHelpers.res.mjs +3 -3
  21. package/src/components/Api/GraphQL_FragmentGenerator.res +18 -12
  22. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +7 -13
  23. package/src/components/Api/GraphQL_SchemaInspector.res +1 -1
  24. package/src/components/Api/GraphQL_SchemaInspector.res.mjs +1 -1
  25. package/src/components/Api/MCP_SchemaGenerator.res +1 -1
  26. package/src/components/Api/MCP_SchemaGenerator.res.mjs +1 -1
  27. package/src/components/Api/SchemaType.res +6 -10
  28. package/src/components/Api/SchemaType.res.mjs +4 -4
  29. package/src/components/Api/StorageRefFields.res +1 -1
  30. package/src/components/Api/StorageRefFields.res.mjs +1 -1
  31. package/src/components/Api/SuryToJsonSchema.res +11 -0
  32. package/src/components/Api/SuryToJsonSchema.res.mjs +2 -1
  33. package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -4
  34. package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +22 -23
  35. package/src/components/CommandTopic/CommandTopic_Callback.res +1 -2
  36. package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +3 -4
  37. package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -1
  38. package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +3 -3
  39. package/src/components/Counter/Counter.res.mjs +2 -2
  40. package/src/components/Counter/Counter_Callback.res.mjs +4 -4
  41. package/src/components/Counter/Counter_Operations.res.mjs +4 -4
  42. package/src/components/Dcb/Dcb_Builder.res +1 -1
  43. package/src/components/Dcb/Dcb_Builder.res.mjs +8 -6
  44. package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +4 -3
  45. package/src/components/EventCollector/EventCollector_Builder.res +1 -1
  46. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +1 -2
  47. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +11 -12
  48. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +3 -4
  49. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +24 -25
  50. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +1 -1
  51. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +3 -3
  52. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +2 -2
  53. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -4
  54. package/src/components/StateViewSlice/StateViewSlice_Builder.res +1 -1
  55. package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +3 -3
  56. package/src/plugin/api/PluginBaseFragment.res +12 -29
  57. package/src/plugin/api/PluginBaseFragment.res.mjs +3 -22
  58. package/src/plugin/component/Capability_Inference.res +118 -1
  59. package/src/plugin/component/Capability_Inference.res.mjs +128 -1
  60. package/src/plugin/component/Plugin_Builder.res +2 -2
  61. package/src/plugin/component/Plugin_Builder.res.mjs +2 -1
  62. package/src/plugin/component/Plugin_Helpers.res +11 -11
  63. package/src/plugin/component/Plugin_Helpers.res.mjs +11 -10
  64. package/src/plugin/component/Plugin_Structure.res +349 -274
  65. package/src/plugin/component/Plugin_Structure.res.mjs +212 -175
  66. package/src/plugin/component/Plugin_SubscriptionSchema.res +1 -1
  67. package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +1 -1
  68. package/src/plugin/component/SchemaWalker.res +11 -11
  69. package/src/plugin/component/SchemaWalker.res.mjs +8 -9
  70. package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +15 -15
  71. package/src/plugin/lifecycle/PluginBehavior.res.mjs +55 -55
  72. package/src/plugin/lifecycle/PluginSpec.res +22 -7
  73. package/src/plugin/lifecycle/PluginSpec.res.mjs +91 -36
  74. package/src/plugin/lifecycle/PluginsReadModelSpec.res +36 -9
  75. package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +33 -22
  76. package/src/util/Interstack.res +3 -3
  77. package/src/util/LogFormat.res +1 -2
  78. package/src/util/LogFormat.res.mjs +2 -2
  79. package/tests/IdentityTest.res +6 -7
  80. package/tests/IdentityTest.res.mjs +7 -9
  81. package/tests/adapter/MonitoringTest.res +30 -3
  82. package/tests/adapter/MonitoringTest.res.mjs +31 -12
  83. package/tests/adapter/RuntimeExtensionHookReachTest.res +0 -1
  84. package/tests/adapter/RuntimeExtensionHookReachTest.res.mjs +5 -7
  85. package/tests/admin/Platform_Admin_StructureTest.res +254 -0
  86. package/tests/admin/Platform_Admin_StructureTest.res.mjs +219 -0
  87. package/tests/aggregate/AggregateCacheTest.res +0 -1
  88. package/tests/aggregate/AggregateCacheTest.res.mjs +13 -15
  89. package/tests/aggregate/AggregateConflictTest.res +0 -1
  90. package/tests/aggregate/AggregateConflictTest.res.mjs +7 -9
  91. package/tests/aggregate/AggregateFixtures.res +0 -1
  92. package/tests/aggregate/AggregateFixtures.res.mjs +19 -21
  93. package/tests/aggregate/AggregateSnapshotTest.res +1 -2
  94. package/tests/aggregate/AggregateSnapshotTest.res.mjs +15 -16
  95. package/tests/api/ApiNoApiTest.res.mjs +17 -9
  96. package/tests/api/GraphQL_FragmentGeneratorTest.res +62 -1
  97. package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +102 -58
  98. package/tests/api/PsInternalFieldsReadModel.res +21 -0
  99. package/tests/api/PsInternalFieldsReadModel.res.mjs +74 -0
  100. package/tests/api/StorageRefFieldsTest.res.mjs +13 -13
  101. package/tests/api/SuryToJsonSchemaTest.res +43 -0
  102. package/tests/api/SuryToJsonSchemaTest.res.mjs +352 -849
  103. package/tests/commandgenerator/CommandGeneratorFixtures.res +0 -1
  104. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +19 -21
  105. package/tests/commandgenerator/OwnerStampingTest.res +0 -1
  106. package/tests/commandgenerator/OwnerStampingTest.res.mjs +9 -11
  107. package/tests/commandtopic/CommandTopicCallbackFixtures.res +0 -1
  108. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +7 -9
  109. package/tests/counter/CounterFixtures.res +0 -1
  110. package/tests/counter/CounterFixtures.res.mjs +1 -4
  111. package/tests/dcb/DcbDecodeTest.res.mjs +24 -24
  112. package/tests/dcb/DcbEventLogOperationsTest.res +2 -2
  113. package/tests/dcb/DcbEventLogOperationsTest.res.mjs +3 -3
  114. package/tests/dcb/DcbEventLogSchemaTest.res.mjs +7 -7
  115. package/tests/dcb/DcbFixtures.res +0 -1
  116. package/tests/dcb/DcbFixtures.res.mjs +87 -89
  117. package/tests/dcb/DcbTagTest.res.mjs +6 -6
  118. package/tests/dcb/DcbValidationTest.res.mjs +52 -52
  119. package/tests/eventlog/EventLogFixtures.res +0 -1
  120. package/tests/eventlog/EventLogFixtures.res.mjs +7 -9
  121. package/tests/eventmapper/EventMapperFixtures.res +0 -1
  122. package/tests/eventmapper/EventMapperFixtures.res.mjs +24 -26
  123. package/tests/eventtopic/EventTopicFixtures.res +0 -1
  124. package/tests/eventtopic/EventTopicFixtures.res.mjs +7 -9
  125. package/tests/extensionpoint/ExtensionPointFixtures.res +0 -1
  126. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +10 -12
  127. package/tests/extensionpoint/ExtensionPointOperationsTest.res +1 -2
  128. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -10
  129. package/tests/logger/LogFormatTest.res +3 -2
  130. package/tests/logger/LogFormatTest.res.mjs +7 -9
  131. package/tests/message/MessageTest.res +2 -2
  132. package/tests/message/MessageTest.res.mjs +8 -7
  133. package/tests/message/MetaEnvelopeTest.res +5 -5
  134. package/tests/message/MetaEnvelopeTest.res.mjs +12 -11
  135. package/tests/plugin/ManifestVisibilityTest.res.mjs +7 -7
  136. package/tests/plugin/PluginDefinitionScalars.res +5 -3
  137. package/tests/plugin/PluginDefinitionScalars.res.mjs +2 -2
  138. package/tests/plugin/PluginLifecycleCorpusTest.res +4 -3
  139. package/tests/plugin/PluginLifecycleCorpusTest.res.mjs +3 -6
  140. package/tests/plugin/PluginSpecExperiment.res +0 -1
  141. package/tests/plugin/PluginSpecExperiment.res.mjs +12 -14
  142. package/tests/plugin/PluginStructureTest.res +188 -1
  143. package/tests/plugin/PluginStructureTest.res.mjs +293 -102
  144. package/tests/plugin/Plugin_EventQuerySchemaTest.res.mjs +3 -3
  145. package/tests/plugin/SchemaWalkerTest.res +0 -1
  146. package/tests/plugin/SchemaWalkerTest.res.mjs +17 -19
  147. package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +5 -5
  148. package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -8
  149. package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +5 -5
  150. package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +9 -9
  151. package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +5 -5
  152. package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -8
  153. package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +15 -15
  154. package/tests/plugin/StateChangeSlice/PsTypoStore.res +31 -0
  155. package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +62 -0
  156. package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -8
  157. package/tests/plugin/StateChangeSlice/PsUploadImages.res +40 -0
  158. package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +66 -0
  159. package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +13 -12
  160. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +8 -8
  161. package/tests/plugin/StateViewSlice/PsCategoriesView.res.mjs +6 -6
  162. package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +10 -10
  163. package/tests/plugin/StateViewSlice/PsGatedView.res.mjs +6 -6
  164. package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +9 -9
  165. package/tests/plugin/StateViewSlice/PsShipmentsView.res.mjs +11 -10
  166. package/tests/plugin/pluginDefinitionRequiredScalars.txt +15 -0
  167. package/tests/querydb/QueryDbFixtures.res +0 -1
  168. package/tests/querydb/QueryDbFixtures.res.mjs +5 -7
  169. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +0 -1
  170. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -6
  171. package/tests/util/CommandPublisherTest.res +0 -1
  172. package/tests/util/CommandPublisherTest.res.mjs +4 -6
@@ -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 Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
@@ -90,18 +90,18 @@ let emptySpec = {
90
90
  globalThis.describe("SuryToJsonSchema:", () => {
91
91
  globalThis.describe("deriveObjectSchema with no annotations:", () => {
92
92
  globalThis.test("emits plain JSON Schema when no metadata is attached", () => {
93
- let schema = S.schema(s => ({
94
- id: s.m(S.string),
95
- name: s.m(S.string)
93
+ let schema = Sury.$schema(s => ({
94
+ id: s.m(Sury.string),
95
+ name: s.m(Sury.string)
96
96
  }));
97
97
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
98
98
  let idSchema = getPropertyOf(json, "id");
99
99
  globalThis.expect(Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-id"))).toBe(undefined);
100
100
  });
101
101
  globalThis.test("emits format:\"date-time\" for a DateTime-marked string field", () => {
102
- let schema = S.schema(s => ({
102
+ let schema = Sury.$schema(s => ({
103
103
  placedAt: s.m(DateTime$Reventless.string),
104
- name: s.m(S.string)
104
+ name: s.m(Sury.string)
105
105
  }));
106
106
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
107
107
  globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(getPropertyOf(json, "placedAt"), s => getProperty(s, "format")), Stdlib_JSON.Decode.string)).toBe("date-time");
@@ -110,9 +110,9 @@ globalThis.describe("SuryToJsonSchema:", () => {
110
110
  });
111
111
  globalThis.describe("deriveObjectSchema with an owner field:", () => {
112
112
  let ownerOf = (json, name) => Stdlib_Option.flatMap(getPropertyOf(json, name), s => getProperty(s, "x-reventless-owner"));
113
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(S.schema(s => ({
113
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
114
114
  customerId: s.m(Owner$Reventless.string),
115
- note: s.m(S.string)
115
+ note: s.m(Sury.string)
116
116
  })));
117
117
  globalThis.test("the marked field carries x-reventless-owner", () => {
118
118
  globalThis.expect(ownerOf(json, "customerId")).toEqual(true);
@@ -124,74 +124,39 @@ globalThis.describe("SuryToJsonSchema:", () => {
124
124
  globalThis.expect(Stdlib_Option.flatMap(getPropertyOf(json, "customerId"), s => getProperty(s, "type"))).toEqual("string");
125
125
  });
126
126
  globalThis.test("an optional owner field is still recognised", () => {
127
- let optJson = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(S.schema(s => ({
128
- customerId: s.m(S.option(Owner$Reventless.string))
127
+ let optJson = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
128
+ customerId: s.m(Sury.$option(Owner$Reventless.string))
129
129
  })));
130
130
  globalThis.expect(ownerOf(optJson, "customerId")).toEqual(true);
131
131
  });
132
132
  });
133
133
  globalThis.describe("deriveObjectSchema with stateAnnotations metadata:", () => {
134
- let withSpec = (schema, spec) => S.Metadata.set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
135
134
  globalThis.test("emits x-reventless-id on field listed in ids", () => {
136
- let schema = S.schema(s => ({
137
- entityId: s.m(S.string),
138
- name: s.m(S.string)
135
+ let schema = Sury.$schema(s => ({
136
+ entityId: s.m(Sury.string),
137
+ name: s.m(Sury.string)
139
138
  }));
140
- let schema$p = withSpec(schema, {
141
- ids: ["entityId"],
142
- compositeIds: emptySpec_compositeIds,
143
- subIds: emptySpec_subIds,
144
- compositeSubIds: emptySpec_compositeSubIds,
145
- indexes: emptySpec_indexes,
146
- hidden: emptySpec_hidden,
147
- summary: emptySpec_summary,
148
- drillTargets: emptySpec_drillTargets,
149
- drillTargetKeys: emptySpec_drillTargetKeys,
150
- collapsed: emptySpec_collapsed,
151
- scan: emptySpec_scan,
152
- scanSort: emptySpec_scanSort,
153
- semantic: emptySpec_semantic,
154
- metric: emptySpec_metric,
155
- lifecycle: undefined,
156
- groupBy: undefined,
157
- visibility: undefined,
158
- live: undefined,
159
- retired: undefined
160
- });
139
+ let newrecord = {...emptySpec};
140
+ newrecord.ids = ["entityId"];
141
+ let spec = newrecord;
142
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
161
143
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
162
144
  let entityIdSchema = getPropertyOf(json, "entityId");
163
145
  globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(entityIdSchema, s => getProperty(s, "x-reventless-id")), Stdlib_JSON.Decode.bool)).toBe(true);
164
146
  });
165
147
  globalThis.test("emits x-reventless-compositeId on each compositeId field", () => {
166
- let schema = S.schema(s => ({
167
- environment: s.m(S.string),
168
- platformName: s.m(S.string),
169
- name: s.m(S.string)
148
+ let schema = Sury.$schema(s => ({
149
+ environment: s.m(Sury.string),
150
+ platformName: s.m(Sury.string),
151
+ name: s.m(Sury.string)
170
152
  }));
171
- let schema$p = withSpec(schema, {
172
- ids: emptySpec_ids,
173
- compositeIds: [
174
- "environment",
175
- "platformName"
176
- ],
177
- subIds: emptySpec_subIds,
178
- compositeSubIds: emptySpec_compositeSubIds,
179
- indexes: emptySpec_indexes,
180
- hidden: emptySpec_hidden,
181
- summary: emptySpec_summary,
182
- drillTargets: emptySpec_drillTargets,
183
- drillTargetKeys: emptySpec_drillTargetKeys,
184
- collapsed: emptySpec_collapsed,
185
- scan: emptySpec_scan,
186
- scanSort: emptySpec_scanSort,
187
- semantic: emptySpec_semantic,
188
- metric: emptySpec_metric,
189
- lifecycle: undefined,
190
- groupBy: undefined,
191
- visibility: undefined,
192
- live: undefined,
193
- retired: undefined
194
- });
153
+ let newrecord = {...emptySpec};
154
+ newrecord.compositeIds = [
155
+ "environment",
156
+ "platformName"
157
+ ];
158
+ let spec = newrecord;
159
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
195
160
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
196
161
  let envSchema = getPropertyOf(json, "environment");
197
162
  let platformSchema = getPropertyOf(json, "platformName");
@@ -204,157 +169,72 @@ globalThis.describe("SuryToJsonSchema:", () => {
204
169
  ]);
205
170
  });
206
171
  globalThis.test("emits x-reventless-subId on field listed in subIds", () => {
207
- let schema = S.schema(s => ({
208
- itemId: s.m(S.string),
209
- version: s.m(S.string)
172
+ let schema = Sury.$schema(s => ({
173
+ itemId: s.m(Sury.string),
174
+ version: s.m(Sury.string)
210
175
  }));
211
- let schema$p = withSpec(schema, {
212
- ids: emptySpec_ids,
213
- compositeIds: emptySpec_compositeIds,
214
- subIds: ["version"],
215
- compositeSubIds: emptySpec_compositeSubIds,
216
- indexes: emptySpec_indexes,
217
- hidden: emptySpec_hidden,
218
- summary: emptySpec_summary,
219
- drillTargets: emptySpec_drillTargets,
220
- drillTargetKeys: emptySpec_drillTargetKeys,
221
- collapsed: emptySpec_collapsed,
222
- scan: emptySpec_scan,
223
- scanSort: emptySpec_scanSort,
224
- semantic: emptySpec_semantic,
225
- metric: emptySpec_metric,
226
- lifecycle: undefined,
227
- groupBy: undefined,
228
- visibility: undefined,
229
- live: undefined,
230
- retired: undefined
231
- });
176
+ let newrecord = {...emptySpec};
177
+ newrecord.subIds = ["version"];
178
+ let spec = newrecord;
179
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
232
180
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
233
181
  let versionSchema = getPropertyOf(json, "version");
234
182
  globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(versionSchema, s => getProperty(s, "x-reventless-subId")), Stdlib_JSON.Decode.bool)).toBe(true);
235
183
  });
236
184
  globalThis.test("emits x-reventless-index as the index name when named", () => {
237
- let schema = S.schema(s => ({
238
- id: s.m(S.string),
239
- ownerId: s.m(S.string)
185
+ let schema = Sury.$schema(s => ({
186
+ id: s.m(Sury.string),
187
+ ownerId: s.m(Sury.string)
240
188
  }));
241
- let schema$p = withSpec(schema, {
242
- ids: emptySpec_ids,
243
- compositeIds: emptySpec_compositeIds,
244
- subIds: emptySpec_subIds,
245
- compositeSubIds: emptySpec_compositeSubIds,
246
- indexes: [[
247
- "ownerId",
248
- "byOwner"
249
- ]],
250
- hidden: emptySpec_hidden,
251
- summary: emptySpec_summary,
252
- drillTargets: emptySpec_drillTargets,
253
- drillTargetKeys: emptySpec_drillTargetKeys,
254
- collapsed: emptySpec_collapsed,
255
- scan: emptySpec_scan,
256
- scanSort: emptySpec_scanSort,
257
- semantic: emptySpec_semantic,
258
- metric: emptySpec_metric,
259
- lifecycle: undefined,
260
- groupBy: undefined,
261
- visibility: undefined,
262
- live: undefined,
263
- retired: undefined
264
- });
189
+ let newrecord = {...emptySpec};
190
+ newrecord.indexes = [[
191
+ "ownerId",
192
+ "byOwner"
193
+ ]];
194
+ let spec = newrecord;
195
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
265
196
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
266
197
  let ownerIdSchema = getPropertyOf(json, "ownerId");
267
198
  globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(ownerIdSchema, s => getProperty(s, "x-reventless-index")), Stdlib_JSON.Decode.string)).toBe("byOwner");
268
199
  });
269
200
  globalThis.test("emits x-reventless-index as true for unnamed @index", () => {
270
- let schema = S.schema(s => ({
271
- id: s.m(S.string),
272
- category: s.m(S.string)
201
+ let schema = Sury.$schema(s => ({
202
+ id: s.m(Sury.string),
203
+ category: s.m(Sury.string)
273
204
  }));
274
- let schema$p = withSpec(schema, {
275
- ids: emptySpec_ids,
276
- compositeIds: emptySpec_compositeIds,
277
- subIds: emptySpec_subIds,
278
- compositeSubIds: emptySpec_compositeSubIds,
279
- indexes: [[
280
- "category",
281
- ""
282
- ]],
283
- hidden: emptySpec_hidden,
284
- summary: emptySpec_summary,
285
- drillTargets: emptySpec_drillTargets,
286
- drillTargetKeys: emptySpec_drillTargetKeys,
287
- collapsed: emptySpec_collapsed,
288
- scan: emptySpec_scan,
289
- scanSort: emptySpec_scanSort,
290
- semantic: emptySpec_semantic,
291
- metric: emptySpec_metric,
292
- lifecycle: undefined,
293
- groupBy: undefined,
294
- visibility: undefined,
295
- live: undefined,
296
- retired: undefined
297
- });
205
+ let newrecord = {...emptySpec};
206
+ newrecord.indexes = [[
207
+ "category",
208
+ ""
209
+ ]];
210
+ let spec = newrecord;
211
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
298
212
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
299
213
  let categorySchema = getPropertyOf(json, "category");
300
214
  globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(categorySchema, s => getProperty(s, "x-reventless-index")), Stdlib_JSON.Decode.bool)).toBe(true);
301
215
  });
302
216
  globalThis.test("does not emit x-reventless-* on unannotated fields", () => {
303
- let schema = S.schema(s => ({
304
- entityId: s.m(S.string),
305
- name: s.m(S.string)
217
+ let schema = Sury.$schema(s => ({
218
+ entityId: s.m(Sury.string),
219
+ name: s.m(Sury.string)
306
220
  }));
307
- let schema$p = withSpec(schema, {
308
- ids: ["entityId"],
309
- compositeIds: emptySpec_compositeIds,
310
- subIds: emptySpec_subIds,
311
- compositeSubIds: emptySpec_compositeSubIds,
312
- indexes: emptySpec_indexes,
313
- hidden: emptySpec_hidden,
314
- summary: emptySpec_summary,
315
- drillTargets: emptySpec_drillTargets,
316
- drillTargetKeys: emptySpec_drillTargetKeys,
317
- collapsed: emptySpec_collapsed,
318
- scan: emptySpec_scan,
319
- scanSort: emptySpec_scanSort,
320
- semantic: emptySpec_semantic,
321
- metric: emptySpec_metric,
322
- lifecycle: undefined,
323
- groupBy: undefined,
324
- visibility: undefined,
325
- live: undefined,
326
- retired: undefined
327
- });
221
+ let newrecord = {...emptySpec};
222
+ newrecord.ids = ["entityId"];
223
+ let spec = newrecord;
224
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
328
225
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
329
226
  let nameSchema = getPropertyOf(json, "name");
330
227
  globalThis.expect(Stdlib_Option.flatMap(nameSchema, s => getProperty(s, "x-reventless-id"))).toBe(undefined);
331
228
  });
332
229
  globalThis.test("emits x-reventless-hidden on field listed in hidden", () => {
333
- let schema = S.schema(s => ({
334
- id: s.m(S.string),
335
- deploymentId: s.m(S.string)
230
+ let schema = Sury.$schema(s => ({
231
+ id: s.m(Sury.string),
232
+ deploymentId: s.m(Sury.string)
336
233
  }));
337
- let schema$p = withSpec(schema, {
338
- ids: emptySpec_ids,
339
- compositeIds: emptySpec_compositeIds,
340
- subIds: emptySpec_subIds,
341
- compositeSubIds: emptySpec_compositeSubIds,
342
- indexes: emptySpec_indexes,
343
- hidden: ["deploymentId"],
344
- summary: emptySpec_summary,
345
- drillTargets: emptySpec_drillTargets,
346
- drillTargetKeys: emptySpec_drillTargetKeys,
347
- collapsed: emptySpec_collapsed,
348
- scan: emptySpec_scan,
349
- scanSort: emptySpec_scanSort,
350
- semantic: emptySpec_semantic,
351
- metric: emptySpec_metric,
352
- lifecycle: undefined,
353
- groupBy: undefined,
354
- visibility: undefined,
355
- live: undefined,
356
- retired: undefined
357
- });
234
+ let newrecord = {...emptySpec};
235
+ newrecord.hidden = ["deploymentId"];
236
+ let spec = newrecord;
237
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
358
238
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
359
239
  let deploymentIdSchema = getPropertyOf(json, "deploymentId");
360
240
  let idSchema = getPropertyOf(json, "id");
@@ -366,32 +246,44 @@ globalThis.describe("SuryToJsonSchema:", () => {
366
246
  undefined
367
247
  ]);
368
248
  });
249
+ globalThis.test("drops a field listed in internal rather than annotating it", () => {
250
+ let schema = Sury.$schema(s => ({
251
+ id: s.m(Sury.string),
252
+ eventCollector: s.m(Sury.string)
253
+ }));
254
+ let newrecord = {...emptySpec};
255
+ newrecord.internal = ["eventCollector"];
256
+ let spec = newrecord;
257
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
258
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
259
+ globalThis.expect([
260
+ Stdlib_Option.isNone(getPropertyOf(json, "eventCollector")),
261
+ Stdlib_Option.isSome(getPropertyOf(json, "id"))
262
+ ]).toEqual([
263
+ true,
264
+ true
265
+ ]);
266
+ });
267
+ globalThis.test("keeps a dropped field out of required", () => {
268
+ let schema = Sury.$schema(s => ({
269
+ id: s.m(Sury.string),
270
+ eventCollector: s.m(Sury.string)
271
+ }));
272
+ let newrecord = {...emptySpec};
273
+ newrecord.internal = ["eventCollector"];
274
+ let spec = newrecord;
275
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec));
276
+ globalThis.expect(Stdlib_Array.filterMap(Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_JSON.Decode.object(json), o => o["required"]), Stdlib_JSON.Decode.array), []), Stdlib_JSON.Decode.string)).toEqual(["id"]);
277
+ });
369
278
  globalThis.test("emits x-reventless-summary on field listed in summary", () => {
370
- let schema = S.schema(s => ({
371
- id: s.m(S.string),
372
- pluginName: s.m(S.string)
279
+ let schema = Sury.$schema(s => ({
280
+ id: s.m(Sury.string),
281
+ pluginName: s.m(Sury.string)
373
282
  }));
374
- let schema$p = withSpec(schema, {
375
- ids: emptySpec_ids,
376
- compositeIds: emptySpec_compositeIds,
377
- subIds: emptySpec_subIds,
378
- compositeSubIds: emptySpec_compositeSubIds,
379
- indexes: emptySpec_indexes,
380
- hidden: emptySpec_hidden,
381
- summary: ["pluginName"],
382
- drillTargets: emptySpec_drillTargets,
383
- drillTargetKeys: emptySpec_drillTargetKeys,
384
- collapsed: emptySpec_collapsed,
385
- scan: emptySpec_scan,
386
- scanSort: emptySpec_scanSort,
387
- semantic: emptySpec_semantic,
388
- metric: emptySpec_metric,
389
- lifecycle: undefined,
390
- groupBy: undefined,
391
- visibility: undefined,
392
- live: undefined,
393
- retired: undefined
394
- });
283
+ let newrecord = {...emptySpec};
284
+ newrecord.summary = ["pluginName"];
285
+ let spec = newrecord;
286
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
395
287
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
396
288
  let pluginNameSchema = getPropertyOf(json, "pluginName");
397
289
  let idSchema = getPropertyOf(json, "id");
@@ -404,34 +296,17 @@ globalThis.describe("SuryToJsonSchema:", () => {
404
296
  ]);
405
297
  });
406
298
  globalThis.test("emits x-reventless-drillTarget as the slice name", () => {
407
- let schema = S.schema(s => ({
408
- id: s.m(S.string),
409
- components: s.m(S.string)
299
+ let schema = Sury.$schema(s => ({
300
+ id: s.m(Sury.string),
301
+ components: s.m(Sury.string)
410
302
  }));
411
- let schema$p = withSpec(schema, {
412
- ids: emptySpec_ids,
413
- compositeIds: emptySpec_compositeIds,
414
- subIds: emptySpec_subIds,
415
- compositeSubIds: emptySpec_compositeSubIds,
416
- indexes: emptySpec_indexes,
417
- hidden: emptySpec_hidden,
418
- summary: emptySpec_summary,
419
- drillTargets: [[
420
- "components",
421
- "ResourceInventory"
422
- ]],
423
- drillTargetKeys: emptySpec_drillTargetKeys,
424
- collapsed: emptySpec_collapsed,
425
- scan: emptySpec_scan,
426
- scanSort: emptySpec_scanSort,
427
- semantic: emptySpec_semantic,
428
- metric: emptySpec_metric,
429
- lifecycle: undefined,
430
- groupBy: undefined,
431
- visibility: undefined,
432
- live: undefined,
433
- retired: undefined
434
- });
303
+ let newrecord = {...emptySpec};
304
+ newrecord.drillTargets = [[
305
+ "components",
306
+ "ResourceInventory"
307
+ ]];
308
+ let spec = newrecord;
309
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
435
310
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
436
311
  let componentsSchema = getPropertyOf(json, "components");
437
312
  let idSchema = getPropertyOf(json, "id");
@@ -444,100 +319,50 @@ globalThis.describe("SuryToJsonSchema:", () => {
444
319
  ]);
445
320
  });
446
321
  globalThis.test("emits x-reventless-drillTargetKey as the key path", () => {
447
- let schema = S.schema(s => ({
448
- id: s.m(S.string),
449
- components: s.m(S.string)
322
+ let schema = Sury.$schema(s => ({
323
+ id: s.m(Sury.string),
324
+ components: s.m(Sury.string)
450
325
  }));
451
- let schema$p = withSpec(schema, {
452
- ids: emptySpec_ids,
453
- compositeIds: emptySpec_compositeIds,
454
- subIds: emptySpec_subIds,
455
- compositeSubIds: emptySpec_compositeSubIds,
456
- indexes: emptySpec_indexes,
457
- hidden: emptySpec_hidden,
458
- summary: emptySpec_summary,
459
- drillTargets: [[
460
- "components",
461
- "ResourceInventory"
462
- ]],
463
- drillTargetKeys: [[
464
- "components",
465
- "kind/name"
466
- ]],
467
- collapsed: emptySpec_collapsed,
468
- scan: emptySpec_scan,
469
- scanSort: emptySpec_scanSort,
470
- semantic: emptySpec_semantic,
471
- metric: emptySpec_metric,
472
- lifecycle: undefined,
473
- groupBy: undefined,
474
- visibility: undefined,
475
- live: undefined,
476
- retired: undefined
477
- });
326
+ let newrecord = {...emptySpec};
327
+ newrecord.drillTargetKeys = [[
328
+ "components",
329
+ "kind/name"
330
+ ]];
331
+ newrecord.drillTargets = [[
332
+ "components",
333
+ "ResourceInventory"
334
+ ]];
335
+ let spec = newrecord;
336
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
478
337
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
479
338
  let componentsSchema = getPropertyOf(json, "components");
480
339
  globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(componentsSchema, s => getProperty(s, "x-reventless-drillTargetKey")), Stdlib_JSON.Decode.string)).toBe("kind/name");
481
340
  });
482
341
  globalThis.test("does not emit x-reventless-drillTargetKey when no key was supplied", () => {
483
- let schema = S.schema(s => ({
484
- id: s.m(S.string),
485
- components: s.m(S.string)
342
+ let schema = Sury.$schema(s => ({
343
+ id: s.m(Sury.string),
344
+ components: s.m(Sury.string)
486
345
  }));
487
- let schema$p = withSpec(schema, {
488
- ids: emptySpec_ids,
489
- compositeIds: emptySpec_compositeIds,
490
- subIds: emptySpec_subIds,
491
- compositeSubIds: emptySpec_compositeSubIds,
492
- indexes: emptySpec_indexes,
493
- hidden: emptySpec_hidden,
494
- summary: emptySpec_summary,
495
- drillTargets: [[
496
- "components",
497
- "ResourceInventory"
498
- ]],
499
- drillTargetKeys: emptySpec_drillTargetKeys,
500
- collapsed: emptySpec_collapsed,
501
- scan: emptySpec_scan,
502
- scanSort: emptySpec_scanSort,
503
- semantic: emptySpec_semantic,
504
- metric: emptySpec_metric,
505
- lifecycle: undefined,
506
- groupBy: undefined,
507
- visibility: undefined,
508
- live: undefined,
509
- retired: undefined
510
- });
346
+ let newrecord = {...emptySpec};
347
+ newrecord.drillTargets = [[
348
+ "components",
349
+ "ResourceInventory"
350
+ ]];
351
+ let spec = newrecord;
352
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
511
353
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
512
354
  let componentsSchema = getPropertyOf(json, "components");
513
355
  globalThis.expect(Stdlib_Option.flatMap(componentsSchema, s => getProperty(s, "x-reventless-drillTargetKey"))).toBe(undefined);
514
356
  });
515
357
  globalThis.test("emits x-reventless-scan on field listed in scan", () => {
516
- let schema = S.schema(s => ({
517
- id: s.m(S.string),
518
- status: s.m(S.string)
358
+ let schema = Sury.$schema(s => ({
359
+ id: s.m(Sury.string),
360
+ status: s.m(Sury.string)
519
361
  }));
520
- let schema$p = withSpec(schema, {
521
- ids: emptySpec_ids,
522
- compositeIds: emptySpec_compositeIds,
523
- subIds: emptySpec_subIds,
524
- compositeSubIds: emptySpec_compositeSubIds,
525
- indexes: emptySpec_indexes,
526
- hidden: emptySpec_hidden,
527
- summary: emptySpec_summary,
528
- drillTargets: emptySpec_drillTargets,
529
- drillTargetKeys: emptySpec_drillTargetKeys,
530
- collapsed: emptySpec_collapsed,
531
- scan: ["status"],
532
- scanSort: emptySpec_scanSort,
533
- semantic: emptySpec_semantic,
534
- metric: emptySpec_metric,
535
- lifecycle: undefined,
536
- groupBy: undefined,
537
- visibility: undefined,
538
- live: undefined,
539
- retired: undefined
540
- });
362
+ let newrecord = {...emptySpec};
363
+ newrecord.scan = ["status"];
364
+ let spec = newrecord;
365
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
541
366
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
542
367
  let statusSchema = getPropertyOf(json, "status");
543
368
  let idSchema = getPropertyOf(json, "id");
@@ -550,31 +375,14 @@ globalThis.describe("SuryToJsonSchema:", () => {
550
375
  ]);
551
376
  });
552
377
  globalThis.test("emits x-reventless-scanSort on field listed in scanSort", () => {
553
- let schema = S.schema(s => ({
554
- id: s.m(S.string),
555
- name: s.m(S.string)
378
+ let schema = Sury.$schema(s => ({
379
+ id: s.m(Sury.string),
380
+ name: s.m(Sury.string)
556
381
  }));
557
- let schema$p = withSpec(schema, {
558
- ids: emptySpec_ids,
559
- compositeIds: emptySpec_compositeIds,
560
- subIds: emptySpec_subIds,
561
- compositeSubIds: emptySpec_compositeSubIds,
562
- indexes: emptySpec_indexes,
563
- hidden: emptySpec_hidden,
564
- summary: emptySpec_summary,
565
- drillTargets: emptySpec_drillTargets,
566
- drillTargetKeys: emptySpec_drillTargetKeys,
567
- collapsed: emptySpec_collapsed,
568
- scan: emptySpec_scan,
569
- scanSort: ["name"],
570
- semantic: emptySpec_semantic,
571
- metric: emptySpec_metric,
572
- lifecycle: undefined,
573
- groupBy: undefined,
574
- visibility: undefined,
575
- live: undefined,
576
- retired: undefined
577
- });
382
+ let newrecord = {...emptySpec};
383
+ newrecord.scanSort = ["name"];
384
+ let spec = newrecord;
385
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
578
386
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
579
387
  let nameSchema = getPropertyOf(json, "name");
580
388
  let idSchema = getPropertyOf(json, "id");
@@ -587,34 +395,17 @@ globalThis.describe("SuryToJsonSchema:", () => {
587
395
  ]);
588
396
  });
589
397
  globalThis.test("emits x-reventless-semantic on the field listed in semantic", () => {
590
- let schema = S.schema(s => ({
591
- id: s.m(S.string),
592
- total: s.m(S.float)
398
+ let schema = Sury.$schema(s => ({
399
+ id: s.m(Sury.string),
400
+ total: s.m(Sury.float)
593
401
  }));
594
- let schema$p = withSpec(schema, {
595
- ids: emptySpec_ids,
596
- compositeIds: emptySpec_compositeIds,
597
- subIds: emptySpec_subIds,
598
- compositeSubIds: emptySpec_compositeSubIds,
599
- indexes: emptySpec_indexes,
600
- hidden: emptySpec_hidden,
601
- summary: emptySpec_summary,
602
- drillTargets: emptySpec_drillTargets,
603
- drillTargetKeys: emptySpec_drillTargetKeys,
604
- collapsed: emptySpec_collapsed,
605
- scan: emptySpec_scan,
606
- scanSort: emptySpec_scanSort,
607
- semantic: [[
608
- "total",
609
- "currency"
610
- ]],
611
- metric: emptySpec_metric,
612
- lifecycle: undefined,
613
- groupBy: undefined,
614
- visibility: undefined,
615
- live: undefined,
616
- retired: undefined
617
- });
402
+ let newrecord = {...emptySpec};
403
+ newrecord.semantic = [[
404
+ "total",
405
+ "currency"
406
+ ]];
407
+ let spec = newrecord;
408
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
618
409
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
619
410
  let totalSchema = getPropertyOf(json, "total");
620
411
  let idSchema = getPropertyOf(json, "id");
@@ -627,37 +418,20 @@ globalThis.describe("SuryToJsonSchema:", () => {
627
418
  ]);
628
419
  });
629
420
  globalThis.test("emits x-reventless-metric {aggregate,label} on the field listed in metric", () => {
630
- let schema = S.schema(s => ({
631
- id: s.m(S.string),
632
- total: s.m(S.float)
421
+ let schema = Sury.$schema(s => ({
422
+ id: s.m(Sury.string),
423
+ total: s.m(Sury.float)
633
424
  }));
634
- let schema$p = withSpec(schema, {
635
- ids: emptySpec_ids,
636
- compositeIds: emptySpec_compositeIds,
637
- subIds: emptySpec_subIds,
638
- compositeSubIds: emptySpec_compositeSubIds,
639
- indexes: emptySpec_indexes,
640
- hidden: emptySpec_hidden,
641
- summary: emptySpec_summary,
642
- drillTargets: emptySpec_drillTargets,
643
- drillTargetKeys: emptySpec_drillTargetKeys,
644
- collapsed: emptySpec_collapsed,
645
- scan: emptySpec_scan,
646
- scanSort: emptySpec_scanSort,
647
- semantic: emptySpec_semantic,
648
- metric: [[
649
- "total",
650
- {
651
- aggregate: "sum",
652
- label: "Revenue"
653
- }
654
- ]],
655
- lifecycle: undefined,
656
- groupBy: undefined,
657
- visibility: undefined,
658
- live: undefined,
659
- retired: undefined
660
- });
425
+ let newrecord = {...emptySpec};
426
+ newrecord.metric = [[
427
+ "total",
428
+ {
429
+ aggregate: "sum",
430
+ label: "Revenue"
431
+ }
432
+ ]];
433
+ let spec = newrecord;
434
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
661
435
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
662
436
  let metricObj = Stdlib_Option.flatMap(getPropertyOf(json, "total"), s => getProperty(s, "x-reventless-metric"));
663
437
  globalThis.expect([
@@ -669,36 +443,19 @@ globalThis.describe("SuryToJsonSchema:", () => {
669
443
  ]);
670
444
  });
671
445
  globalThis.test("omits the metric label when empty (UI derives one from the field name)", () => {
672
- let schema = S.schema(s => ({
673
- total: s.m(S.float)
446
+ let schema = Sury.$schema(s => ({
447
+ total: s.m(Sury.float)
674
448
  }));
675
- let schema$p = withSpec(schema, {
676
- ids: emptySpec_ids,
677
- compositeIds: emptySpec_compositeIds,
678
- subIds: emptySpec_subIds,
679
- compositeSubIds: emptySpec_compositeSubIds,
680
- indexes: emptySpec_indexes,
681
- hidden: emptySpec_hidden,
682
- summary: emptySpec_summary,
683
- drillTargets: emptySpec_drillTargets,
684
- drillTargetKeys: emptySpec_drillTargetKeys,
685
- collapsed: emptySpec_collapsed,
686
- scan: emptySpec_scan,
687
- scanSort: emptySpec_scanSort,
688
- semantic: emptySpec_semantic,
689
- metric: [[
690
- "total",
691
- {
692
- aggregate: "sum",
693
- label: ""
694
- }
695
- ]],
696
- lifecycle: undefined,
697
- groupBy: undefined,
698
- visibility: undefined,
699
- live: undefined,
700
- retired: undefined
701
- });
449
+ let newrecord = {...emptySpec};
450
+ newrecord.metric = [[
451
+ "total",
452
+ {
453
+ aggregate: "sum",
454
+ label: ""
455
+ }
456
+ ]];
457
+ let spec = newrecord;
458
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
702
459
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
703
460
  let metricObj = Stdlib_Option.flatMap(getPropertyOf(json, "total"), s => getProperty(s, "x-reventless-metric"));
704
461
  globalThis.expect([
@@ -710,37 +467,20 @@ globalThis.describe("SuryToJsonSchema:", () => {
710
467
  ]);
711
468
  });
712
469
  globalThis.test("emits x-reventless-retired {label,showWhenFalse} on the retired field", () => {
713
- let schema = S.schema(s => ({
714
- id: s.m(S.string),
715
- archived: s.m(S.bool)
470
+ let schema = Sury.$schema(s => ({
471
+ id: s.m(Sury.string),
472
+ archived: s.m(Sury.bool)
716
473
  }));
717
- let schema$p = withSpec(schema, {
718
- ids: emptySpec_ids,
719
- compositeIds: emptySpec_compositeIds,
720
- subIds: emptySpec_subIds,
721
- compositeSubIds: emptySpec_compositeSubIds,
722
- indexes: emptySpec_indexes,
723
- hidden: emptySpec_hidden,
724
- summary: emptySpec_summary,
725
- drillTargets: emptySpec_drillTargets,
726
- drillTargetKeys: emptySpec_drillTargetKeys,
727
- collapsed: emptySpec_collapsed,
728
- scan: emptySpec_scan,
729
- scanSort: emptySpec_scanSort,
730
- semantic: emptySpec_semantic,
731
- metric: emptySpec_metric,
732
- lifecycle: undefined,
733
- groupBy: undefined,
734
- visibility: undefined,
735
- live: undefined,
736
- retired: {
737
- field: "archived",
738
- label: "Archived",
739
- showWhenFalse: true,
740
- values: undefined,
741
- namedWhenRetired: false
742
- }
743
- });
474
+ let newrecord = {...emptySpec};
475
+ newrecord.retired = {
476
+ field: "archived",
477
+ label: "Archived",
478
+ showWhenFalse: true,
479
+ values: undefined,
480
+ namedWhenRetired: false
481
+ };
482
+ let spec = newrecord;
483
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
744
484
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
745
485
  let retiredObj = Stdlib_Option.flatMap(getPropertyOf(json, "archived"), s => getProperty(s, "x-reventless-retired"));
746
486
  globalThis.expect([
@@ -754,40 +494,24 @@ globalThis.describe("SuryToJsonSchema:", () => {
754
494
  ]);
755
495
  });
756
496
  let stateFormJson = values => {
757
- let schema = S.schema(s => ({
758
- customerId: s.m(S.string),
759
- accountStatus: s.m(S.union([
760
- S.literal("Active"),
761
- S.literal("Deactivated")
497
+ let schema = Sury.$schema(s => ({
498
+ customerId: s.m(Sury.string),
499
+ accountStatus: s.m(Sury.union([
500
+ Sury.literal("Active"),
501
+ Sury.literal("Deactivated")
762
502
  ]))
763
503
  }));
764
- return SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, {
765
- ids: emptySpec_ids,
766
- compositeIds: emptySpec_compositeIds,
767
- subIds: emptySpec_subIds,
768
- compositeSubIds: emptySpec_compositeSubIds,
769
- indexes: emptySpec_indexes,
770
- hidden: emptySpec_hidden,
771
- summary: emptySpec_summary,
772
- drillTargets: emptySpec_drillTargets,
773
- drillTargetKeys: emptySpec_drillTargetKeys,
774
- collapsed: emptySpec_collapsed,
775
- scan: emptySpec_scan,
776
- scanSort: emptySpec_scanSort,
777
- semantic: emptySpec_semantic,
778
- metric: emptySpec_metric,
779
- lifecycle: "accountStatus",
780
- groupBy: undefined,
781
- visibility: undefined,
782
- live: undefined,
783
- retired: {
784
- field: "accountStatus",
785
- label: "",
786
- showWhenFalse: false,
787
- values: values,
788
- namedWhenRetired: false
789
- }
790
- }));
504
+ let newrecord = {...emptySpec};
505
+ newrecord.retired = {
506
+ field: "accountStatus",
507
+ label: "",
508
+ showWhenFalse: false,
509
+ values: values,
510
+ namedWhenRetired: false
511
+ };
512
+ newrecord.lifecycle = "accountStatus";
513
+ let spec = newrecord;
514
+ return SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec));
791
515
  };
792
516
  let retiredOn = (json, field) => Stdlib_Option.flatMap(getPropertyOf(json, field), s => getProperty(s, "x-reventless-retired"));
793
517
  let stringsAt = (retiredObj, key) => Stdlib_Option.map(Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredObj, r => getProperty(r, key)), Stdlib_JSON.Decode.array), a => Stdlib_Array.filterMap(a, Stdlib_JSON.Decode.string));
@@ -813,36 +537,19 @@ globalThis.describe("SuryToJsonSchema:", () => {
813
537
  ]), "accountStatus"), r => getProperty(r, "value"))).toEqual(undefined);
814
538
  });
815
539
  globalThis.test("omits both value and values entirely on the boolean form", () => {
816
- let schema = S.schema(s => ({
817
- archived: s.m(S.bool)
540
+ let schema = Sury.$schema(s => ({
541
+ archived: s.m(Sury.bool)
818
542
  }));
819
- let schema$p = withSpec(schema, {
820
- ids: emptySpec_ids,
821
- compositeIds: emptySpec_compositeIds,
822
- subIds: emptySpec_subIds,
823
- compositeSubIds: emptySpec_compositeSubIds,
824
- indexes: emptySpec_indexes,
825
- hidden: emptySpec_hidden,
826
- summary: emptySpec_summary,
827
- drillTargets: emptySpec_drillTargets,
828
- drillTargetKeys: emptySpec_drillTargetKeys,
829
- collapsed: emptySpec_collapsed,
830
- scan: emptySpec_scan,
831
- scanSort: emptySpec_scanSort,
832
- semantic: emptySpec_semantic,
833
- metric: emptySpec_metric,
834
- lifecycle: undefined,
835
- groupBy: undefined,
836
- visibility: undefined,
837
- live: undefined,
838
- retired: {
839
- field: "archived",
840
- label: "",
841
- showWhenFalse: false,
842
- values: undefined,
843
- namedWhenRetired: false
844
- }
845
- });
543
+ let newrecord = {...emptySpec};
544
+ newrecord.retired = {
545
+ field: "archived",
546
+ label: "",
547
+ showWhenFalse: false,
548
+ values: undefined,
549
+ namedWhenRetired: false
550
+ };
551
+ let spec = newrecord;
552
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
846
553
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
847
554
  let retiredObj = retiredOn(json, "archived");
848
555
  globalThis.expect([
@@ -855,36 +562,19 @@ globalThis.describe("SuryToJsonSchema:", () => {
855
562
  });
856
563
  globalThis.test("carries namedWhenRetired only when the record opted in", () => {
857
564
  let build = named => {
858
- let schema = S.schema(s => ({
859
- archived: s.m(S.bool)
565
+ let schema = Sury.$schema(s => ({
566
+ archived: s.m(Sury.bool)
860
567
  }));
861
- return Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredOn(SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, {
862
- ids: emptySpec_ids,
863
- compositeIds: emptySpec_compositeIds,
864
- subIds: emptySpec_subIds,
865
- compositeSubIds: emptySpec_compositeSubIds,
866
- indexes: emptySpec_indexes,
867
- hidden: emptySpec_hidden,
868
- summary: emptySpec_summary,
869
- drillTargets: emptySpec_drillTargets,
870
- drillTargetKeys: emptySpec_drillTargetKeys,
871
- collapsed: emptySpec_collapsed,
872
- scan: emptySpec_scan,
873
- scanSort: emptySpec_scanSort,
874
- semantic: emptySpec_semantic,
875
- metric: emptySpec_metric,
876
- lifecycle: undefined,
877
- groupBy: undefined,
878
- visibility: undefined,
879
- live: undefined,
880
- retired: {
881
- field: "archived",
882
- label: "",
883
- showWhenFalse: false,
884
- values: undefined,
885
- namedWhenRetired: named
886
- }
887
- })), "archived"), r => getProperty(r, "namedWhenRetired")), Stdlib_JSON.Decode.bool);
568
+ let newrecord = {...emptySpec};
569
+ newrecord.retired = {
570
+ field: "archived",
571
+ label: "",
572
+ showWhenFalse: false,
573
+ values: undefined,
574
+ namedWhenRetired: named
575
+ };
576
+ let spec = newrecord;
577
+ return Stdlib_Option.flatMap(Stdlib_Option.flatMap(retiredOn(SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec)), "archived"), r => getProperty(r, "namedWhenRetired")), Stdlib_JSON.Decode.bool);
888
578
  };
889
579
  globalThis.expect([
890
580
  build(true),
@@ -895,36 +585,19 @@ globalThis.describe("SuryToJsonSchema:", () => {
895
585
  ]);
896
586
  });
897
587
  globalThis.test("omits the retired label when empty but always states showWhenFalse", () => {
898
- let schema = S.schema(s => ({
899
- deactivated: s.m(S.bool)
588
+ let schema = Sury.$schema(s => ({
589
+ deactivated: s.m(Sury.bool)
900
590
  }));
901
- let schema$p = withSpec(schema, {
902
- ids: emptySpec_ids,
903
- compositeIds: emptySpec_compositeIds,
904
- subIds: emptySpec_subIds,
905
- compositeSubIds: emptySpec_compositeSubIds,
906
- indexes: emptySpec_indexes,
907
- hidden: emptySpec_hidden,
908
- summary: emptySpec_summary,
909
- drillTargets: emptySpec_drillTargets,
910
- drillTargetKeys: emptySpec_drillTargetKeys,
911
- collapsed: emptySpec_collapsed,
912
- scan: emptySpec_scan,
913
- scanSort: emptySpec_scanSort,
914
- semantic: emptySpec_semantic,
915
- metric: emptySpec_metric,
916
- lifecycle: undefined,
917
- groupBy: undefined,
918
- visibility: undefined,
919
- live: undefined,
920
- retired: {
921
- field: "deactivated",
922
- label: "",
923
- showWhenFalse: false,
924
- values: undefined,
925
- namedWhenRetired: false
926
- }
927
- });
591
+ let newrecord = {...emptySpec};
592
+ newrecord.retired = {
593
+ field: "deactivated",
594
+ label: "",
595
+ showWhenFalse: false,
596
+ values: undefined,
597
+ namedWhenRetired: false
598
+ };
599
+ let spec = newrecord;
600
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
928
601
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
929
602
  let retiredObj = Stdlib_Option.flatMap(getPropertyOf(json, "deactivated"), s => getProperty(s, "x-reventless-retired"));
930
603
  globalThis.expect([
@@ -936,38 +609,21 @@ globalThis.describe("SuryToJsonSchema:", () => {
936
609
  ]);
937
610
  });
938
611
  globalThis.test("emits nothing for a schema with no retired annotation", () => {
939
- let schema = S.schema(s => ({
940
- archived: s.m(S.bool)
612
+ let schema = Sury.$schema(s => ({
613
+ archived: s.m(Sury.bool)
941
614
  }));
942
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, emptySpec));
615
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, emptySpec));
943
616
  globalThis.expect(Stdlib_Option.flatMap(getPropertyOf(json, "archived"), s => getProperty(s, "x-reventless-retired"))).toBe(undefined);
944
617
  });
945
618
  globalThis.test("emits x-reventless-group-by on the field named by groupBy", () => {
946
- let schema = S.schema(s => ({
947
- id: s.m(S.string),
948
- kind: s.m(S.string)
619
+ let schema = Sury.$schema(s => ({
620
+ id: s.m(Sury.string),
621
+ kind: s.m(Sury.string)
949
622
  }));
950
- let schema$p = withSpec(schema, {
951
- ids: emptySpec_ids,
952
- compositeIds: emptySpec_compositeIds,
953
- subIds: emptySpec_subIds,
954
- compositeSubIds: emptySpec_compositeSubIds,
955
- indexes: emptySpec_indexes,
956
- hidden: emptySpec_hidden,
957
- summary: emptySpec_summary,
958
- drillTargets: emptySpec_drillTargets,
959
- drillTargetKeys: emptySpec_drillTargetKeys,
960
- collapsed: emptySpec_collapsed,
961
- scan: emptySpec_scan,
962
- scanSort: emptySpec_scanSort,
963
- semantic: emptySpec_semantic,
964
- metric: emptySpec_metric,
965
- lifecycle: undefined,
966
- groupBy: "kind",
967
- visibility: undefined,
968
- live: undefined,
969
- retired: undefined
970
- });
623
+ let newrecord = {...emptySpec};
624
+ newrecord.groupBy = "kind";
625
+ let spec = newrecord;
626
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
971
627
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
972
628
  let kindSchema = getPropertyOf(json, "kind");
973
629
  let idSchema = getPropertyOf(json, "id");
@@ -980,31 +636,14 @@ globalThis.describe("SuryToJsonSchema:", () => {
980
636
  ]);
981
637
  });
982
638
  globalThis.test("emits x-reventless-collapsed on field listed in collapsed", () => {
983
- let schema = S.schema(s => ({
984
- id: s.m(S.string),
985
- primaryResource: s.m(S.string)
639
+ let schema = Sury.$schema(s => ({
640
+ id: s.m(Sury.string),
641
+ primaryResource: s.m(Sury.string)
986
642
  }));
987
- let schema$p = withSpec(schema, {
988
- ids: emptySpec_ids,
989
- compositeIds: emptySpec_compositeIds,
990
- subIds: emptySpec_subIds,
991
- compositeSubIds: emptySpec_compositeSubIds,
992
- indexes: emptySpec_indexes,
993
- hidden: emptySpec_hidden,
994
- summary: emptySpec_summary,
995
- drillTargets: emptySpec_drillTargets,
996
- drillTargetKeys: emptySpec_drillTargetKeys,
997
- collapsed: ["primaryResource"],
998
- scan: emptySpec_scan,
999
- scanSort: emptySpec_scanSort,
1000
- semantic: emptySpec_semantic,
1001
- metric: emptySpec_metric,
1002
- lifecycle: undefined,
1003
- groupBy: undefined,
1004
- visibility: undefined,
1005
- live: undefined,
1006
- retired: undefined
1007
- });
643
+ let newrecord = {...emptySpec};
644
+ newrecord.collapsed = ["primaryResource"];
645
+ let spec = newrecord;
646
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
1008
647
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
1009
648
  let primarySchema = getPropertyOf(json, "primaryResource");
1010
649
  let idSchema = getPropertyOf(json, "id");
@@ -1017,107 +656,39 @@ globalThis.describe("SuryToJsonSchema:", () => {
1017
656
  ]);
1018
657
  });
1019
658
  globalThis.test("emits x-reventless-visibility at top level when visibility is Internal", () => {
1020
- let schema = S.schema(s => ({
1021
- id: s.m(S.string)
659
+ let schema = Sury.$schema(s => ({
660
+ id: s.m(Sury.string)
1022
661
  }));
1023
- let schema$p = withSpec(schema, {
1024
- ids: emptySpec_ids,
1025
- compositeIds: emptySpec_compositeIds,
1026
- subIds: emptySpec_subIds,
1027
- compositeSubIds: emptySpec_compositeSubIds,
1028
- indexes: emptySpec_indexes,
1029
- hidden: emptySpec_hidden,
1030
- summary: emptySpec_summary,
1031
- drillTargets: emptySpec_drillTargets,
1032
- drillTargetKeys: emptySpec_drillTargetKeys,
1033
- collapsed: emptySpec_collapsed,
1034
- scan: emptySpec_scan,
1035
- scanSort: emptySpec_scanSort,
1036
- semantic: emptySpec_semantic,
1037
- metric: emptySpec_metric,
1038
- lifecycle: undefined,
1039
- groupBy: undefined,
1040
- visibility: "Internal",
1041
- live: undefined,
1042
- retired: undefined
1043
- });
662
+ let newrecord = {...emptySpec};
663
+ newrecord.visibility = "Internal";
664
+ let spec = newrecord;
665
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
1044
666
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
1045
667
  globalThis.expect(Stdlib_Option.flatMap(getProperty(json, "x-reventless-visibility"), Stdlib_JSON.Decode.string)).toBe("Internal");
1046
668
  });
1047
669
  globalThis.test("omits x-reventless-visibility when visibility is None (default Public)", () => {
1048
- let schema = S.schema(s => ({
1049
- id: s.m(S.string)
670
+ let schema = Sury.$schema(s => ({
671
+ id: s.m(Sury.string)
1050
672
  }));
1051
- let schema$p = withSpec(schema, {
1052
- ids: emptySpec_ids,
1053
- compositeIds: emptySpec_compositeIds,
1054
- subIds: emptySpec_subIds,
1055
- compositeSubIds: emptySpec_compositeSubIds,
1056
- indexes: emptySpec_indexes,
1057
- hidden: emptySpec_hidden,
1058
- summary: emptySpec_summary,
1059
- drillTargets: emptySpec_drillTargets,
1060
- drillTargetKeys: emptySpec_drillTargetKeys,
1061
- collapsed: emptySpec_collapsed,
1062
- scan: emptySpec_scan,
1063
- scanSort: emptySpec_scanSort,
1064
- semantic: emptySpec_semantic,
1065
- metric: emptySpec_metric,
1066
- lifecycle: undefined,
1067
- groupBy: undefined,
1068
- visibility: undefined,
1069
- live: undefined,
1070
- retired: undefined
1071
- });
673
+ let newrecord = {...emptySpec};
674
+ newrecord.visibility = undefined;
675
+ let spec = newrecord;
676
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
1072
677
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
1073
678
  globalThis.expect(getProperty(json, "x-reventless-visibility")).toBe(undefined);
1074
679
  });
1075
680
  globalThis.test("emits x-reventless-live at top level when live is declared", () => {
1076
- let schema = S.schema(s => ({
1077
- id: s.m(S.string)
1078
- }));
1079
- let offJson = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, {
1080
- ids: emptySpec_ids,
1081
- compositeIds: emptySpec_compositeIds,
1082
- subIds: emptySpec_subIds,
1083
- compositeSubIds: emptySpec_compositeSubIds,
1084
- indexes: emptySpec_indexes,
1085
- hidden: emptySpec_hidden,
1086
- summary: emptySpec_summary,
1087
- drillTargets: emptySpec_drillTargets,
1088
- drillTargetKeys: emptySpec_drillTargetKeys,
1089
- collapsed: emptySpec_collapsed,
1090
- scan: emptySpec_scan,
1091
- scanSort: emptySpec_scanSort,
1092
- semantic: emptySpec_semantic,
1093
- metric: emptySpec_metric,
1094
- lifecycle: undefined,
1095
- groupBy: undefined,
1096
- visibility: undefined,
1097
- live: false,
1098
- retired: undefined
1099
- }));
1100
- let onJson = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(withSpec(schema, {
1101
- ids: emptySpec_ids,
1102
- compositeIds: emptySpec_compositeIds,
1103
- subIds: emptySpec_subIds,
1104
- compositeSubIds: emptySpec_compositeSubIds,
1105
- indexes: emptySpec_indexes,
1106
- hidden: emptySpec_hidden,
1107
- summary: emptySpec_summary,
1108
- drillTargets: emptySpec_drillTargets,
1109
- drillTargetKeys: emptySpec_drillTargetKeys,
1110
- collapsed: emptySpec_collapsed,
1111
- scan: emptySpec_scan,
1112
- scanSort: emptySpec_scanSort,
1113
- semantic: emptySpec_semantic,
1114
- metric: emptySpec_metric,
1115
- lifecycle: undefined,
1116
- groupBy: undefined,
1117
- visibility: undefined,
1118
- live: true,
1119
- retired: undefined
681
+ let schema = Sury.$schema(s => ({
682
+ id: s.m(Sury.string)
1120
683
  }));
684
+ let newrecord = {...emptySpec};
685
+ newrecord.live = false;
686
+ let spec = newrecord;
687
+ let offJson = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec));
688
+ let newrecord$1 = {...emptySpec};
689
+ newrecord$1.live = true;
690
+ let spec$1 = newrecord$1;
691
+ let onJson = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec$1));
1121
692
  globalThis.expect([
1122
693
  Stdlib_Option.flatMap(getProperty(offJson, "x-reventless-live"), Stdlib_JSON.Decode.bool),
1123
694
  Stdlib_Option.flatMap(getProperty(onJson, "x-reventless-live"), Stdlib_JSON.Decode.bool)
@@ -1127,58 +698,25 @@ globalThis.describe("SuryToJsonSchema:", () => {
1127
698
  ]);
1128
699
  });
1129
700
  globalThis.test("omits x-reventless-live when live is None (no annotation)", () => {
1130
- let schema = S.schema(s => ({
1131
- id: s.m(S.string)
701
+ let schema = Sury.$schema(s => ({
702
+ id: s.m(Sury.string)
1132
703
  }));
1133
- let schema$p = withSpec(schema, {
1134
- ids: emptySpec_ids,
1135
- compositeIds: emptySpec_compositeIds,
1136
- subIds: emptySpec_subIds,
1137
- compositeSubIds: emptySpec_compositeSubIds,
1138
- indexes: emptySpec_indexes,
1139
- hidden: emptySpec_hidden,
1140
- summary: emptySpec_summary,
1141
- drillTargets: emptySpec_drillTargets,
1142
- drillTargetKeys: emptySpec_drillTargetKeys,
1143
- collapsed: emptySpec_collapsed,
1144
- scan: emptySpec_scan,
1145
- scanSort: emptySpec_scanSort,
1146
- semantic: emptySpec_semantic,
1147
- metric: emptySpec_metric,
1148
- lifecycle: undefined,
1149
- groupBy: undefined,
1150
- visibility: undefined,
1151
- live: undefined,
1152
- retired: undefined
1153
- });
704
+ let newrecord = {...emptySpec};
705
+ newrecord.live = undefined;
706
+ let spec = newrecord;
707
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
1154
708
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
1155
709
  globalThis.expect(getProperty(json, "x-reventless-live")).toBe(undefined);
1156
710
  });
1157
711
  globalThis.test("emits x-reventless-live and x-reventless-visibility together", () => {
1158
- let schema = S.schema(s => ({
1159
- id: s.m(S.string)
712
+ let schema = Sury.$schema(s => ({
713
+ id: s.m(Sury.string)
1160
714
  }));
1161
- let schema$p = withSpec(schema, {
1162
- ids: emptySpec_ids,
1163
- compositeIds: emptySpec_compositeIds,
1164
- subIds: emptySpec_subIds,
1165
- compositeSubIds: emptySpec_compositeSubIds,
1166
- indexes: emptySpec_indexes,
1167
- hidden: emptySpec_hidden,
1168
- summary: emptySpec_summary,
1169
- drillTargets: emptySpec_drillTargets,
1170
- drillTargetKeys: emptySpec_drillTargetKeys,
1171
- collapsed: emptySpec_collapsed,
1172
- scan: emptySpec_scan,
1173
- scanSort: emptySpec_scanSort,
1174
- semantic: emptySpec_semantic,
1175
- metric: emptySpec_metric,
1176
- lifecycle: undefined,
1177
- groupBy: undefined,
1178
- visibility: "Internal",
1179
- live: false,
1180
- retired: undefined
1181
- });
715
+ let newrecord = {...emptySpec};
716
+ newrecord.live = false;
717
+ newrecord.visibility = "Internal";
718
+ let spec = newrecord;
719
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
1182
720
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
1183
721
  globalThis.expect([
1184
722
  Stdlib_Option.flatMap(getProperty(json, "x-reventless-visibility"), Stdlib_JSON.Decode.string),
@@ -1208,52 +746,34 @@ globalThis.describe("SuryToJsonSchema:", () => {
1208
746
  };
1209
747
  let sortStrings = xs => xs.toSorted(Primitive_string.compare);
1210
748
  globalThis.test("properties keyset matches between deriveObjectSchema and S.toJSONSchema", () => {
1211
- let schema = S.schema(s => ({
1212
- id: s.m(S.string),
1213
- name: s.m(S.string),
1214
- count: s.m(S.int)
749
+ let schema = Sury.$schema(s => ({
750
+ id: s.m(Sury.string),
751
+ name: s.m(Sury.string),
752
+ count: s.m(Sury.int)
1215
753
  }));
1216
754
  let derived = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
1217
- let native = S.toJSONSchema(schema);
755
+ let native = Sury.toJSONSchema(schema);
1218
756
  globalThis.expect(sortStrings(getKeys(derived))).toEqual(sortStrings(getKeys(native)));
1219
757
  });
1220
758
  globalThis.test("required array matches between deriveObjectSchema and S.toJSONSchema", () => {
1221
- let schema = S.schema(s => ({
1222
- id: s.m(S.string),
1223
- name: s.m(S.string)
759
+ let schema = Sury.$schema(s => ({
760
+ id: s.m(Sury.string),
761
+ name: s.m(Sury.string)
1224
762
  }));
1225
763
  let derived = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
1226
- let native = S.toJSONSchema(schema);
764
+ let native = Sury.toJSONSchema(schema);
1227
765
  globalThis.expect(sortStrings(getRequired(derived))).toEqual(sortStrings(getRequired(native)));
1228
766
  });
1229
767
  globalThis.test("S.toJSONSchema does NOT emit x-reventless-* keys even when metadata is set", () => {
1230
- let withSpec = (schema, spec) => S.Metadata.set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
1231
- let schema = S.schema(s => ({
1232
- entityId: s.m(S.string),
1233
- name: s.m(S.string)
768
+ let schema = Sury.$schema(s => ({
769
+ entityId: s.m(Sury.string),
770
+ name: s.m(Sury.string)
1234
771
  }));
1235
- let schema$p = withSpec(schema, {
1236
- ids: ["entityId"],
1237
- compositeIds: emptySpec_compositeIds,
1238
- subIds: emptySpec_subIds,
1239
- compositeSubIds: emptySpec_compositeSubIds,
1240
- indexes: emptySpec_indexes,
1241
- hidden: emptySpec_hidden,
1242
- summary: emptySpec_summary,
1243
- drillTargets: emptySpec_drillTargets,
1244
- drillTargetKeys: emptySpec_drillTargetKeys,
1245
- collapsed: emptySpec_collapsed,
1246
- scan: emptySpec_scan,
1247
- scanSort: emptySpec_scanSort,
1248
- semantic: emptySpec_semantic,
1249
- metric: emptySpec_metric,
1250
- lifecycle: undefined,
1251
- groupBy: undefined,
1252
- visibility: undefined,
1253
- live: undefined,
1254
- retired: undefined
1255
- });
1256
- let native = S.toJSONSchema(schema$p);
772
+ let newrecord = {...emptySpec};
773
+ newrecord.ids = ["entityId"];
774
+ let spec = newrecord;
775
+ let schema$p = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
776
+ let native = Sury.toJSONSchema(schema$p);
1257
777
  let entityIdSchema = getPropertyOf(native, "entityId");
1258
778
  globalThis.expect(Stdlib_Option.flatMap(entityIdSchema, s => getProperty(s, "x-reventless-id"))).toBe(undefined);
1259
779
  });
@@ -1261,7 +781,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
1261
781
  globalThis.describe("reference / DCB-tag decoupling:", () => {
1262
782
  let formatOf = (schema, fieldName) => Stdlib_Option.flatMap(getPropertyOf(schema, fieldName), s => getProperty(s, "format"));
1263
783
  globalThis.test("a DCB-tagged field with no reference is still an entity id", () => {
1264
- let schema = S.schema(s => ({
784
+ let schema = Sury.$schema(s => ({
1265
785
  orderId: s.m(DcbTag$Reventless.string)
1266
786
  }));
1267
787
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
@@ -1270,7 +790,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
1270
790
  });
1271
791
  globalThis.test("a reference without a DCB tag is still an entity id", () => {
1272
792
  let field = Reference$Reventless.toWithoutDcbTag(undefined, "Customer");
1273
- let schema = S.schema(s => ({
793
+ let schema = Sury.$schema(s => ({
1274
794
  customerId: s.m(field)
1275
795
  }));
1276
796
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
@@ -1283,7 +803,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
1283
803
  globalThis.expect(Stdlib_Option.map(Reference$Reventless.getTarget(field), t => t.entity)).toEqual("Customer");
1284
804
  });
1285
805
  globalThis.test("neither reference nor tag emits x-reventless-semantic on the wire", () => {
1286
- let schema = S.schema(s => ({
806
+ let schema = Sury.$schema(s => ({
1287
807
  customerId: s.m(Reference$Reventless.to_(undefined, undefined, "Customer")),
1288
808
  placedAt: s.m(DateTime$Reventless.string)
1289
809
  }));
@@ -1296,8 +816,8 @@ globalThis.describe("SuryToJsonSchema:", () => {
1296
816
  globalThis.describe("type-carried semantics on a command field:", () => {
1297
817
  let semanticOf = (json, fieldName) => Stdlib_Option.flatMap(getPropertyOf(json, fieldName), s => getProperty(s, "x-reventless-semantic"));
1298
818
  globalThis.test("a storage-ref command field emits the semantic id", () => {
1299
- let schema = S.schema(s => ({
1300
- productId: s.m(S.string),
819
+ let schema = Sury.$schema(s => ({
820
+ productId: s.m(Sury.string),
1301
821
  imageUrl: s.m(StorageRef$Reventless.forStore(undefined, "productImages"))
1302
822
  }));
1303
823
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
@@ -1305,7 +825,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
1305
825
  globalThis.expect(semanticOf(json, "productId")).toBe(undefined);
1306
826
  });
1307
827
  globalThis.test("it carries the store identity and marks the type as its source", () => {
1308
- let schema = S.schema(s => ({
828
+ let schema = Sury.$schema(s => ({
1309
829
  imageUrl: s.m(StorageRef$Reventless.forStore("catalog", "productImages"))
1310
830
  }));
1311
831
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
@@ -1323,55 +843,38 @@ globalThis.describe("SuryToJsonSchema:", () => {
1323
843
  ]));
1324
844
  });
1325
845
  globalThis.test("the underlying string shape is unchanged", () => {
1326
- let schema = S.schema(s => ({
846
+ let schema = Sury.$schema(s => ({
1327
847
  imageUrl: s.m(StorageRef$Reventless.forStore(undefined, "productImages"))
1328
848
  }));
1329
849
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
1330
850
  globalThis.expect(Stdlib_Option.flatMap(getPropertyOf(json, "imageUrl"), s => getProperty(s, "type"))).toEqual("string");
1331
851
  });
1332
852
  globalThis.test("an optional storage-ref field keeps both its semantic and its nullability", () => {
1333
- let schema = S.schema(s => ({
1334
- imageUrl: s.m(S.option(StorageRef$Reventless.forStore(undefined, "productImages")))
853
+ let schema = Sury.$schema(s => ({
854
+ imageUrl: s.m(Sury.$option(StorageRef$Reventless.forStore(undefined, "productImages")))
1335
855
  }));
1336
856
  let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
1337
857
  globalThis.expect(semanticOf(json, "imageUrl")).toEqual("storageRef");
1338
858
  globalThis.expect(Stdlib_Option.isSome(Stdlib_Option.flatMap(getPropertyOf(json, "imageUrl"), s => getProperty(s, "oneOf")))).toBe(true);
1339
859
  });
1340
860
  globalThis.test("a type-carried semantic beats an annotation naming the same field", () => {
1341
- let withSpec = (schema, spec) => S.Metadata.set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
1342
- let schema = withSpec(S.schema(s => ({
861
+ let newrecord = {...emptySpec};
862
+ newrecord.semantic = [[
863
+ "imageUrl",
864
+ "image"
865
+ ]];
866
+ let spec = newrecord;
867
+ let schema = Sury.$schema(s => ({
1343
868
  imageUrl: s.m(StorageRef$Reventless.forStore(undefined, "productImages"))
1344
- })), {
1345
- ids: emptySpec_ids,
1346
- compositeIds: emptySpec_compositeIds,
1347
- subIds: emptySpec_subIds,
1348
- compositeSubIds: emptySpec_compositeSubIds,
1349
- indexes: emptySpec_indexes,
1350
- hidden: emptySpec_hidden,
1351
- summary: emptySpec_summary,
1352
- drillTargets: emptySpec_drillTargets,
1353
- drillTargetKeys: emptySpec_drillTargetKeys,
1354
- collapsed: emptySpec_collapsed,
1355
- scan: emptySpec_scan,
1356
- scanSort: emptySpec_scanSort,
1357
- semantic: [[
1358
- "imageUrl",
1359
- "image"
1360
- ]],
1361
- metric: emptySpec_metric,
1362
- lifecycle: undefined,
1363
- groupBy: undefined,
1364
- visibility: undefined,
1365
- live: undefined,
1366
- retired: undefined
1367
- });
1368
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
869
+ }));
870
+ let schema$1 = Sury.$Metadata_set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
871
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$1);
1369
872
  globalThis.expect(semanticOf(json, "imageUrl")).toEqual("storageRef");
1370
873
  });
1371
874
  });
1372
875
  globalThis.describe("branded scalars keep their underlying shape:", () => {
1373
876
  let keyOf = (json, name, key) => Stdlib_Option.flatMap(getPropertyOf(json, name), s => getProperty(s, key));
1374
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(S.schema(s => ({
877
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
1375
878
  contactEmail: s.m(Email$Reventless.schema),
1376
879
  taxRate: s.m(Percent$Reventless.schema)
1377
880
  })));
@@ -1404,9 +907,9 @@ globalThis.describe("SuryToJsonSchema:", () => {
1404
907
  });
1405
908
  });
1406
909
  globalThis.describe("Money changes the field's shape, and says so:", () => {
1407
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(S.schema(s => ({
910
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
1408
911
  price: s.m(Money$Reventless.schema),
1409
- quantity: s.m(S.float)
912
+ quantity: s.m(Sury.float)
1410
913
  })));
1411
914
  let keyOf = (name, key) => Stdlib_Option.flatMap(getPropertyOf(json, name), s => getProperty(s, key));
1412
915
  globalThis.test("the field is an object, not a number", () => {
@@ -1456,7 +959,7 @@ globalThis.describe("SuryToJsonSchema:", () => {
1456
959
  });
1457
960
  });
1458
961
  globalThis.describe("DateRange is an object whose parts stay date-times:", () => {
1459
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(S.schema(s => ({
962
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
1460
963
  deliveryWindow: s.m(DateRange$Reventless.schema),
1461
964
  orderedAt: s.m(DateTime$Reventless.string)
1462
965
  })));
@@ -1494,9 +997,9 @@ globalThis.describe("SuryToJsonSchema:", () => {
1494
997
  });
1495
998
  });
1496
999
  globalThis.describe("GeoPoint is an object carrying the geoPoint marker:", () => {
1497
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(S.schema(s => ({
1000
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
1498
1001
  location: s.m(GeoPoint$Reventless.schema),
1499
- lat: s.m(S.float)
1002
+ lat: s.m(Sury.float)
1500
1003
  })));
1501
1004
  let keyOf = (name, key) => Stdlib_Option.flatMap(getPropertyOf(json, name), s => getProperty(s, key));
1502
1005
  globalThis.test("the field is an object, not a pair of numbers", () => {
@@ -1532,12 +1035,12 @@ globalThis.describe("SuryToJsonSchema:", () => {
1532
1035
  });
1533
1036
  });
1534
1037
  globalThis.describe("an optional field inside a nested record:", () => {
1535
- let inner = S.schema(s => ({
1536
- street: s.m(S.string),
1537
- unit: s.m(S.option(S.string))
1038
+ let inner = Sury.$schema(s => ({
1039
+ street: s.m(Sury.string),
1040
+ unit: s.m(Sury.$option(Sury.string))
1538
1041
  }));
1539
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(S.schema(s => ({
1540
- id: s.m(S.string),
1042
+ let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
1043
+ id: s.m(Sury.string),
1541
1044
  address: s.m(inner)
1542
1045
  })));
1543
1046
  let nestedRequired = Stdlib_Array.filterMap(Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_Option.flatMap(getPropertyOf(json, "address"), a => getProperty(a, "required")), Stdlib_JSON.Decode.array), []), Stdlib_JSON.Decode.string);