@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.
- package/CHANGELOG.md +35 -0
- package/package.json +11 -11
- package/src/Message.res +11 -11
- package/src/Message.res.mjs +15 -14
- package/src/Projection.res +2 -2
- package/src/Projection.res.mjs +5 -4
- package/src/adapter/Monitoring/Monitoring.res +24 -2
- package/src/adapter/Monitoring/Monitoring.res.mjs +3 -3
- package/src/admin/Platform_Admin.res +1 -16
- package/src/admin/Platform_Admin.res.mjs +2 -30
- package/src/admin/Platform_AdminApi.res.mjs +3 -3
- package/src/admin/Platform_Admin_Structure.res +58 -113
- package/src/admin/Platform_Admin_Structure.res.mjs +24 -139
- package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +12 -12
- package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs +14 -14
- package/src/components/Aggregate/Aggregate_Callback.res +2 -2
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +4 -4
- package/src/components/Api/ApiAllowedStatesHelpers.res.mjs +3 -3
- package/src/components/Api/ApiNoApiHelpers.res.mjs +5 -5
- package/src/components/Api/ApiTargetStateHelpers.res.mjs +3 -3
- package/src/components/Api/GraphQL_FragmentGenerator.res +18 -12
- package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +7 -13
- package/src/components/Api/GraphQL_SchemaInspector.res +1 -1
- package/src/components/Api/GraphQL_SchemaInspector.res.mjs +1 -1
- package/src/components/Api/MCP_SchemaGenerator.res +1 -1
- package/src/components/Api/MCP_SchemaGenerator.res.mjs +1 -1
- package/src/components/Api/SchemaType.res +6 -10
- package/src/components/Api/SchemaType.res.mjs +4 -4
- package/src/components/Api/StorageRefFields.res +1 -1
- package/src/components/Api/StorageRefFields.res.mjs +1 -1
- package/src/components/Api/SuryToJsonSchema.res +11 -0
- package/src/components/Api/SuryToJsonSchema.res.mjs +2 -1
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -4
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +22 -23
- package/src/components/CommandTopic/CommandTopic_Callback.res +1 -2
- package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +3 -4
- package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -1
- package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +3 -3
- package/src/components/Counter/Counter.res.mjs +2 -2
- package/src/components/Counter/Counter_Callback.res.mjs +4 -4
- package/src/components/Counter/Counter_Operations.res.mjs +4 -4
- package/src/components/Dcb/Dcb_Builder.res +1 -1
- package/src/components/Dcb/Dcb_Builder.res.mjs +8 -6
- package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +4 -3
- package/src/components/EventCollector/EventCollector_Builder.res +1 -1
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +1 -2
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +11 -12
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +3 -4
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +24 -25
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +1 -1
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +3 -3
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +2 -2
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -4
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +1 -1
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +3 -3
- package/src/plugin/api/PluginBaseFragment.res +12 -29
- package/src/plugin/api/PluginBaseFragment.res.mjs +3 -22
- package/src/plugin/component/Capability_Inference.res +118 -1
- package/src/plugin/component/Capability_Inference.res.mjs +128 -1
- package/src/plugin/component/Plugin_Builder.res +2 -2
- package/src/plugin/component/Plugin_Builder.res.mjs +2 -1
- package/src/plugin/component/Plugin_Helpers.res +11 -11
- package/src/plugin/component/Plugin_Helpers.res.mjs +11 -10
- package/src/plugin/component/Plugin_Structure.res +349 -274
- package/src/plugin/component/Plugin_Structure.res.mjs +212 -175
- package/src/plugin/component/Plugin_SubscriptionSchema.res +1 -1
- package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +1 -1
- package/src/plugin/component/SchemaWalker.res +11 -11
- package/src/plugin/component/SchemaWalker.res.mjs +8 -9
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +15 -15
- package/src/plugin/lifecycle/PluginBehavior.res.mjs +55 -55
- package/src/plugin/lifecycle/PluginSpec.res +22 -7
- package/src/plugin/lifecycle/PluginSpec.res.mjs +91 -36
- package/src/plugin/lifecycle/PluginsReadModelSpec.res +36 -9
- package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +33 -22
- package/src/util/Interstack.res +3 -3
- package/src/util/LogFormat.res +1 -2
- package/src/util/LogFormat.res.mjs +2 -2
- package/tests/IdentityTest.res +6 -7
- package/tests/IdentityTest.res.mjs +7 -9
- package/tests/adapter/MonitoringTest.res +30 -3
- package/tests/adapter/MonitoringTest.res.mjs +31 -12
- package/tests/adapter/RuntimeExtensionHookReachTest.res +0 -1
- package/tests/adapter/RuntimeExtensionHookReachTest.res.mjs +5 -7
- package/tests/admin/Platform_Admin_StructureTest.res +254 -0
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +219 -0
- package/tests/aggregate/AggregateCacheTest.res +0 -1
- package/tests/aggregate/AggregateCacheTest.res.mjs +13 -15
- package/tests/aggregate/AggregateConflictTest.res +0 -1
- package/tests/aggregate/AggregateConflictTest.res.mjs +7 -9
- package/tests/aggregate/AggregateFixtures.res +0 -1
- package/tests/aggregate/AggregateFixtures.res.mjs +19 -21
- package/tests/aggregate/AggregateSnapshotTest.res +1 -2
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +15 -16
- package/tests/api/ApiNoApiTest.res.mjs +17 -9
- package/tests/api/GraphQL_FragmentGeneratorTest.res +62 -1
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +102 -58
- package/tests/api/PsInternalFieldsReadModel.res +21 -0
- package/tests/api/PsInternalFieldsReadModel.res.mjs +74 -0
- package/tests/api/StorageRefFieldsTest.res.mjs +13 -13
- package/tests/api/SuryToJsonSchemaTest.res +43 -0
- package/tests/api/SuryToJsonSchemaTest.res.mjs +352 -849
- package/tests/commandgenerator/CommandGeneratorFixtures.res +0 -1
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +19 -21
- package/tests/commandgenerator/OwnerStampingTest.res +0 -1
- package/tests/commandgenerator/OwnerStampingTest.res.mjs +9 -11
- package/tests/commandtopic/CommandTopicCallbackFixtures.res +0 -1
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +7 -9
- package/tests/counter/CounterFixtures.res +0 -1
- package/tests/counter/CounterFixtures.res.mjs +1 -4
- package/tests/dcb/DcbDecodeTest.res.mjs +24 -24
- package/tests/dcb/DcbEventLogOperationsTest.res +2 -2
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +3 -3
- package/tests/dcb/DcbEventLogSchemaTest.res.mjs +7 -7
- package/tests/dcb/DcbFixtures.res +0 -1
- package/tests/dcb/DcbFixtures.res.mjs +87 -89
- package/tests/dcb/DcbTagTest.res.mjs +6 -6
- package/tests/dcb/DcbValidationTest.res.mjs +52 -52
- package/tests/eventlog/EventLogFixtures.res +0 -1
- package/tests/eventlog/EventLogFixtures.res.mjs +7 -9
- package/tests/eventmapper/EventMapperFixtures.res +0 -1
- package/tests/eventmapper/EventMapperFixtures.res.mjs +24 -26
- package/tests/eventtopic/EventTopicFixtures.res +0 -1
- package/tests/eventtopic/EventTopicFixtures.res.mjs +7 -9
- package/tests/extensionpoint/ExtensionPointFixtures.res +0 -1
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +10 -12
- package/tests/extensionpoint/ExtensionPointOperationsTest.res +1 -2
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -10
- package/tests/logger/LogFormatTest.res +3 -2
- package/tests/logger/LogFormatTest.res.mjs +7 -9
- package/tests/message/MessageTest.res +2 -2
- package/tests/message/MessageTest.res.mjs +8 -7
- package/tests/message/MetaEnvelopeTest.res +5 -5
- package/tests/message/MetaEnvelopeTest.res.mjs +12 -11
- package/tests/plugin/ManifestVisibilityTest.res.mjs +7 -7
- package/tests/plugin/PluginDefinitionScalars.res +5 -3
- package/tests/plugin/PluginDefinitionScalars.res.mjs +2 -2
- package/tests/plugin/PluginLifecycleCorpusTest.res +4 -3
- package/tests/plugin/PluginLifecycleCorpusTest.res.mjs +3 -6
- package/tests/plugin/PluginSpecExperiment.res +0 -1
- package/tests/plugin/PluginSpecExperiment.res.mjs +12 -14
- package/tests/plugin/PluginStructureTest.res +188 -1
- package/tests/plugin/PluginStructureTest.res.mjs +293 -102
- package/tests/plugin/Plugin_EventQuerySchemaTest.res.mjs +3 -3
- package/tests/plugin/SchemaWalkerTest.res +0 -1
- package/tests/plugin/SchemaWalkerTest.res.mjs +17 -19
- package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +9 -9
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +15 -15
- package/tests/plugin/StateChangeSlice/PsTypoStore.res +31 -0
- package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +62 -0
- package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsUploadImages.res +40 -0
- package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +66 -0
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +13 -12
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +8 -8
- package/tests/plugin/StateViewSlice/PsCategoriesView.res.mjs +6 -6
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +10 -10
- package/tests/plugin/StateViewSlice/PsGatedView.res.mjs +6 -6
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +9 -9
- package/tests/plugin/StateViewSlice/PsShipmentsView.res.mjs +11 -10
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +15 -0
- package/tests/querydb/QueryDbFixtures.res +0 -1
- package/tests/querydb/QueryDbFixtures.res.mjs +5 -7
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +0 -1
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -6
- package/tests/util/CommandPublisherTest.res +0 -1
- 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
|
|
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 =
|
|
94
|
-
id: s.m(
|
|
95
|
-
name: s.m(
|
|
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 =
|
|
102
|
+
let schema = Sury.$schema(s => ({
|
|
103
103
|
placedAt: s.m(DateTime$Reventless.string),
|
|
104
|
-
name: s.m(
|
|
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(
|
|
113
|
+
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
|
|
114
114
|
customerId: s.m(Owner$Reventless.string),
|
|
115
|
-
note: s.m(
|
|
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(
|
|
128
|
-
customerId: s.m(
|
|
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 =
|
|
137
|
-
entityId: s.m(
|
|
138
|
-
name: s.m(
|
|
135
|
+
let schema = Sury.$schema(s => ({
|
|
136
|
+
entityId: s.m(Sury.string),
|
|
137
|
+
name: s.m(Sury.string)
|
|
139
138
|
}));
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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 =
|
|
167
|
-
environment: s.m(
|
|
168
|
-
platformName: s.m(
|
|
169
|
-
name: s.m(
|
|
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
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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 =
|
|
208
|
-
itemId: s.m(
|
|
209
|
-
version: s.m(
|
|
172
|
+
let schema = Sury.$schema(s => ({
|
|
173
|
+
itemId: s.m(Sury.string),
|
|
174
|
+
version: s.m(Sury.string)
|
|
210
175
|
}));
|
|
211
|
-
let
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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 =
|
|
238
|
-
id: s.m(
|
|
239
|
-
ownerId: s.m(
|
|
185
|
+
let schema = Sury.$schema(s => ({
|
|
186
|
+
id: s.m(Sury.string),
|
|
187
|
+
ownerId: s.m(Sury.string)
|
|
240
188
|
}));
|
|
241
|
-
let
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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 =
|
|
271
|
-
id: s.m(
|
|
272
|
-
category: s.m(
|
|
201
|
+
let schema = Sury.$schema(s => ({
|
|
202
|
+
id: s.m(Sury.string),
|
|
203
|
+
category: s.m(Sury.string)
|
|
273
204
|
}));
|
|
274
|
-
let
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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 =
|
|
304
|
-
entityId: s.m(
|
|
305
|
-
name: s.m(
|
|
217
|
+
let schema = Sury.$schema(s => ({
|
|
218
|
+
entityId: s.m(Sury.string),
|
|
219
|
+
name: s.m(Sury.string)
|
|
306
220
|
}));
|
|
307
|
-
let
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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 =
|
|
334
|
-
id: s.m(
|
|
335
|
-
deploymentId: s.m(
|
|
230
|
+
let schema = Sury.$schema(s => ({
|
|
231
|
+
id: s.m(Sury.string),
|
|
232
|
+
deploymentId: s.m(Sury.string)
|
|
336
233
|
}));
|
|
337
|
-
let
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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 =
|
|
371
|
-
id: s.m(
|
|
372
|
-
pluginName: s.m(
|
|
279
|
+
let schema = Sury.$schema(s => ({
|
|
280
|
+
id: s.m(Sury.string),
|
|
281
|
+
pluginName: s.m(Sury.string)
|
|
373
282
|
}));
|
|
374
|
-
let
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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 =
|
|
408
|
-
id: s.m(
|
|
409
|
-
components: s.m(
|
|
299
|
+
let schema = Sury.$schema(s => ({
|
|
300
|
+
id: s.m(Sury.string),
|
|
301
|
+
components: s.m(Sury.string)
|
|
410
302
|
}));
|
|
411
|
-
let
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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 =
|
|
448
|
-
id: s.m(
|
|
449
|
-
components: s.m(
|
|
322
|
+
let schema = Sury.$schema(s => ({
|
|
323
|
+
id: s.m(Sury.string),
|
|
324
|
+
components: s.m(Sury.string)
|
|
450
325
|
}));
|
|
451
|
-
let
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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 =
|
|
484
|
-
id: s.m(
|
|
485
|
-
components: s.m(
|
|
342
|
+
let schema = Sury.$schema(s => ({
|
|
343
|
+
id: s.m(Sury.string),
|
|
344
|
+
components: s.m(Sury.string)
|
|
486
345
|
}));
|
|
487
|
-
let
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
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 =
|
|
517
|
-
id: s.m(
|
|
518
|
-
status: s.m(
|
|
358
|
+
let schema = Sury.$schema(s => ({
|
|
359
|
+
id: s.m(Sury.string),
|
|
360
|
+
status: s.m(Sury.string)
|
|
519
361
|
}));
|
|
520
|
-
let
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
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 =
|
|
554
|
-
id: s.m(
|
|
555
|
-
name: s.m(
|
|
378
|
+
let schema = Sury.$schema(s => ({
|
|
379
|
+
id: s.m(Sury.string),
|
|
380
|
+
name: s.m(Sury.string)
|
|
556
381
|
}));
|
|
557
|
-
let
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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 =
|
|
591
|
-
id: s.m(
|
|
592
|
-
total: s.m(
|
|
398
|
+
let schema = Sury.$schema(s => ({
|
|
399
|
+
id: s.m(Sury.string),
|
|
400
|
+
total: s.m(Sury.float)
|
|
593
401
|
}));
|
|
594
|
-
let
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
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 =
|
|
631
|
-
id: s.m(
|
|
632
|
-
total: s.m(
|
|
421
|
+
let schema = Sury.$schema(s => ({
|
|
422
|
+
id: s.m(Sury.string),
|
|
423
|
+
total: s.m(Sury.float)
|
|
633
424
|
}));
|
|
634
|
-
let
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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 =
|
|
673
|
-
total: s.m(
|
|
446
|
+
let schema = Sury.$schema(s => ({
|
|
447
|
+
total: s.m(Sury.float)
|
|
674
448
|
}));
|
|
675
|
-
let
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
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 =
|
|
714
|
-
id: s.m(
|
|
715
|
-
archived: s.m(
|
|
470
|
+
let schema = Sury.$schema(s => ({
|
|
471
|
+
id: s.m(Sury.string),
|
|
472
|
+
archived: s.m(Sury.bool)
|
|
716
473
|
}));
|
|
717
|
-
let
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
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 =
|
|
758
|
-
customerId: s.m(
|
|
759
|
-
accountStatus: s.m(
|
|
760
|
-
|
|
761
|
-
|
|
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
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
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 =
|
|
817
|
-
archived: s.m(
|
|
540
|
+
let schema = Sury.$schema(s => ({
|
|
541
|
+
archived: s.m(Sury.bool)
|
|
818
542
|
}));
|
|
819
|
-
let
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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 =
|
|
859
|
-
archived: s.m(
|
|
565
|
+
let schema = Sury.$schema(s => ({
|
|
566
|
+
archived: s.m(Sury.bool)
|
|
860
567
|
}));
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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 =
|
|
899
|
-
deactivated: s.m(
|
|
588
|
+
let schema = Sury.$schema(s => ({
|
|
589
|
+
deactivated: s.m(Sury.bool)
|
|
900
590
|
}));
|
|
901
|
-
let
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
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 =
|
|
940
|
-
archived: s.m(
|
|
612
|
+
let schema = Sury.$schema(s => ({
|
|
613
|
+
archived: s.m(Sury.bool)
|
|
941
614
|
}));
|
|
942
|
-
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(
|
|
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 =
|
|
947
|
-
id: s.m(
|
|
948
|
-
kind: s.m(
|
|
619
|
+
let schema = Sury.$schema(s => ({
|
|
620
|
+
id: s.m(Sury.string),
|
|
621
|
+
kind: s.m(Sury.string)
|
|
949
622
|
}));
|
|
950
|
-
let
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
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 =
|
|
984
|
-
id: s.m(
|
|
985
|
-
primaryResource: s.m(
|
|
639
|
+
let schema = Sury.$schema(s => ({
|
|
640
|
+
id: s.m(Sury.string),
|
|
641
|
+
primaryResource: s.m(Sury.string)
|
|
986
642
|
}));
|
|
987
|
-
let
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
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 =
|
|
1021
|
-
id: s.m(
|
|
659
|
+
let schema = Sury.$schema(s => ({
|
|
660
|
+
id: s.m(Sury.string)
|
|
1022
661
|
}));
|
|
1023
|
-
let
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
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 =
|
|
1049
|
-
id: s.m(
|
|
670
|
+
let schema = Sury.$schema(s => ({
|
|
671
|
+
id: s.m(Sury.string)
|
|
1050
672
|
}));
|
|
1051
|
-
let
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
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 =
|
|
1077
|
-
id: s.m(
|
|
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 =
|
|
1131
|
-
id: s.m(
|
|
701
|
+
let schema = Sury.$schema(s => ({
|
|
702
|
+
id: s.m(Sury.string)
|
|
1132
703
|
}));
|
|
1133
|
-
let
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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 =
|
|
1159
|
-
id: s.m(
|
|
712
|
+
let schema = Sury.$schema(s => ({
|
|
713
|
+
id: s.m(Sury.string)
|
|
1160
714
|
}));
|
|
1161
|
-
let
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
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 =
|
|
1212
|
-
id: s.m(
|
|
1213
|
-
name: s.m(
|
|
1214
|
-
count: s.m(
|
|
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 =
|
|
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 =
|
|
1222
|
-
id: s.m(
|
|
1223
|
-
name: s.m(
|
|
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 =
|
|
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
|
|
1231
|
-
|
|
1232
|
-
|
|
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
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1300
|
-
productId: s.m(
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1334
|
-
imageUrl: s.m(
|
|
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
|
|
1342
|
-
|
|
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
|
-
|
|
1346
|
-
|
|
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(
|
|
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(
|
|
910
|
+
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
|
|
1408
911
|
price: s.m(Money$Reventless.schema),
|
|
1409
|
-
quantity: s.m(
|
|
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(
|
|
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(
|
|
1000
|
+
let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(Sury.$schema(s => ({
|
|
1498
1001
|
location: s.m(GeoPoint$Reventless.schema),
|
|
1499
|
-
lat: s.m(
|
|
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 =
|
|
1536
|
-
street: s.m(
|
|
1537
|
-
unit: s.m(
|
|
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(
|
|
1540
|
-
id: s.m(
|
|
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);
|