@reventlessdev/reventless-core 3.0.0-alpha.170 → 3.0.0-alpha.171

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 (74) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +14 -14
  3. package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +5 -2
  4. package/src/components/ExtensionPoint/ExtensionPoint_Builder.res.mjs +3 -3
  5. package/src/components/Task/Task_Builder.res +6 -4
  6. package/src/components/Task/Task_Builder.res.mjs +4 -4
  7. package/src/plugin/connect/PluginExtensionPoint_Builder.res +2 -0
  8. package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +3 -3
  9. package/tests/IdentityTest.res.mjs +0 -174
  10. package/tests/adapter/MonitoringTest.res.mjs +0 -82
  11. package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +0 -356
  12. package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +0 -101
  13. package/tests/aggregate/AggregateCacheTest.res.mjs +0 -433
  14. package/tests/aggregate/AggregateCallbackTest.res.mjs +0 -143
  15. package/tests/aggregate/AggregateCausationTest.res.mjs +0 -47
  16. package/tests/aggregate/AggregateConflictTest.res.mjs +0 -386
  17. package/tests/aggregate/AggregateFixtures.res.mjs +0 -308
  18. package/tests/aggregate/AggregateRejectionTest.res.mjs +0 -166
  19. package/tests/aggregate/AggregateSnapshotTest.res.mjs +0 -645
  20. package/tests/api/ApiNoApiTest.res.mjs +0 -90
  21. package/tests/api/GraphQL_StitcherTest.res.mjs +0 -112
  22. package/tests/api/SimpleTest.res.mjs +0 -10
  23. package/tests/api/SuryToJsonSchemaTest.res.mjs +0 -674
  24. package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +0 -160
  25. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +0 -197
  26. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +0 -152
  27. package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +0 -106
  28. package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +0 -109
  29. package/tests/counter/CounterCallbackTest.res.mjs +0 -140
  30. package/tests/counter/CounterFixtures.res.mjs +0 -67
  31. package/tests/dcb/DcbDecodeTest.res.mjs +0 -194
  32. package/tests/dcb/DcbEventLogOperationsTest.res.mjs +0 -268
  33. package/tests/dcb/DcbFixtures.res.mjs +0 -534
  34. package/tests/dcb/DcbScopeInferenceTest.res.mjs +0 -480
  35. package/tests/dcb/DcbStateChangeSliceTest.res.mjs +0 -540
  36. package/tests/dcb/DcbTagTest.res.mjs +0 -867
  37. package/tests/dcb/DcbValidationTest.res.mjs +0 -476
  38. package/tests/eventlog/EventLogFixtures.res.mjs +0 -196
  39. package/tests/eventlog/EventLogOperationsTest.res.mjs +0 -192
  40. package/tests/eventlog/EventLogRetryTest.res.mjs +0 -195
  41. package/tests/eventmapper/EventMapperCallbackTest.res.mjs +0 -141
  42. package/tests/eventmapper/EventMapperFixtures.res.mjs +0 -440
  43. package/tests/eventmapper/EventMapperTest.res.mjs +0 -83
  44. package/tests/eventtopic/EventTopicFixtures.res.mjs +0 -65
  45. package/tests/eventtopic/EventTopicOperationsTest.res.mjs +0 -71
  46. package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +0 -94
  47. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +0 -205
  48. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +0 -304
  49. package/tests/ftp/FTPTest.res.mjs +0 -88
  50. package/tests/logger/LogFormatTest.res.mjs +0 -309
  51. package/tests/logger/LoggerLazyTest.res.mjs +0 -40
  52. package/tests/message/MessageTest.res.mjs +0 -218
  53. package/tests/message/MetaEnvelopeTest.res.mjs +0 -188
  54. package/tests/plugin/ManifestVisibilityTest.res.mjs +0 -215
  55. package/tests/plugin/PluginSpecExperiment.res.mjs +0 -31
  56. package/tests/plugin/PluginStructureTest.res.mjs +0 -419
  57. package/tests/plugin/PluginVersionTest.res.mjs +0 -30
  58. package/tests/plugin/SchemaWalkerTest.res.mjs +0 -160
  59. package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +0 -62
  60. package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +0 -69
  61. package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +0 -95
  62. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +0 -69
  63. package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +0 -69
  64. package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +0 -81
  65. package/tests/poc/StructuralSubtypingPoc.res.mjs +0 -61
  66. package/tests/projection/ProjectionOptimizeTest.res.mjs +0 -75
  67. package/tests/querydb/QueryDbFixtures.res.mjs +0 -135
  68. package/tests/querydb/QueryDbOperationsTest.res.mjs +0 -168
  69. package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +0 -77
  70. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +0 -139
  71. package/tests/util/CommandPublisherTest.res.mjs +0 -78
  72. package/tests/util/CsvStreamTest.res.mjs +0 -51
  73. package/tests/util/LruTest.res.mjs +0 -105
  74. package/tests/util/MetricsTest.res.mjs +0 -53
@@ -1,674 +0,0 @@
1
- // Generated by ReScript, PLEASE EDIT WITH CARE
2
-
3
- import * as S from "sury/src/S.res.mjs";
4
- import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
5
- import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
6
- import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
7
- import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
8
- import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
9
- import * as SuryToJsonSchema$ReventlessCore from "../../src/components/Api/SuryToJsonSchema.res.mjs";
10
-
11
- function getProperty(schema, key) {
12
- let obj = Stdlib_JSON.Decode.object(schema);
13
- if (obj !== undefined) {
14
- return obj[key];
15
- }
16
- }
17
-
18
- function getPropertyOf(schema, fieldName) {
19
- let props = getProperty(schema, "properties");
20
- if (props === undefined) {
21
- return;
22
- }
23
- let obj = Stdlib_JSON.Decode.object(props);
24
- if (obj !== undefined) {
25
- return obj[fieldName];
26
- }
27
- }
28
-
29
- let emptySpec_ids = [];
30
-
31
- let emptySpec_compositeIds = [];
32
-
33
- let emptySpec_subIds = [];
34
-
35
- let emptySpec_compositeSubIds = [];
36
-
37
- let emptySpec_indexes = [];
38
-
39
- let emptySpec_hidden = [];
40
-
41
- let emptySpec_summary = [];
42
-
43
- let emptySpec_drillTargets = [];
44
-
45
- let emptySpec_drillTargetKeys = [];
46
-
47
- let emptySpec_collapsed = [];
48
-
49
- let emptySpec_scan = [];
50
-
51
- let emptySpec_scanSort = [];
52
-
53
- let emptySpec = {
54
- ids: emptySpec_ids,
55
- compositeIds: emptySpec_compositeIds,
56
- subIds: emptySpec_subIds,
57
- compositeSubIds: emptySpec_compositeSubIds,
58
- indexes: emptySpec_indexes,
59
- hidden: emptySpec_hidden,
60
- summary: emptySpec_summary,
61
- drillTargets: emptySpec_drillTargets,
62
- drillTargetKeys: emptySpec_drillTargetKeys,
63
- collapsed: emptySpec_collapsed,
64
- scan: emptySpec_scan,
65
- scanSort: emptySpec_scanSort,
66
- status: undefined,
67
- groupBy: undefined,
68
- visibility: undefined
69
- };
70
-
71
- globalThis.describe("SuryToJsonSchema:", () => {
72
- globalThis.describe("deriveObjectSchema with no annotations:", () => {
73
- globalThis.test("emits plain JSON Schema when no metadata is attached", () => {
74
- let schema = S.schema(s => ({
75
- id: s.m(S.string),
76
- name: s.m(S.string)
77
- }));
78
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
79
- let idSchema = getPropertyOf(json, "id");
80
- globalThis.expect(Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-id"))).toBe(undefined);
81
- });
82
- });
83
- globalThis.describe("deriveObjectSchema with stateAnnotations metadata:", () => {
84
- let withSpec = (schema, spec) => S.Metadata.set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
85
- globalThis.test("emits x-reventless-id on field listed in ids", () => {
86
- let schema = S.schema(s => ({
87
- entityId: s.m(S.string),
88
- name: s.m(S.string)
89
- }));
90
- let schema$p = withSpec(schema, {
91
- ids: ["entityId"],
92
- compositeIds: emptySpec_compositeIds,
93
- subIds: emptySpec_subIds,
94
- compositeSubIds: emptySpec_compositeSubIds,
95
- indexes: emptySpec_indexes,
96
- hidden: emptySpec_hidden,
97
- summary: emptySpec_summary,
98
- drillTargets: emptySpec_drillTargets,
99
- drillTargetKeys: emptySpec_drillTargetKeys,
100
- collapsed: emptySpec_collapsed,
101
- scan: emptySpec_scan,
102
- scanSort: emptySpec_scanSort,
103
- status: undefined,
104
- groupBy: undefined,
105
- visibility: undefined
106
- });
107
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
108
- let entityIdSchema = getPropertyOf(json, "entityId");
109
- globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(entityIdSchema, s => getProperty(s, "x-reventless-id")), Stdlib_JSON.Decode.bool)).toBe(true);
110
- });
111
- globalThis.test("emits x-reventless-compositeId on each compositeId field", () => {
112
- let schema = S.schema(s => ({
113
- environment: s.m(S.string),
114
- platformName: s.m(S.string),
115
- name: s.m(S.string)
116
- }));
117
- let schema$p = withSpec(schema, {
118
- ids: emptySpec_ids,
119
- compositeIds: [
120
- "environment",
121
- "platformName"
122
- ],
123
- subIds: emptySpec_subIds,
124
- compositeSubIds: emptySpec_compositeSubIds,
125
- indexes: emptySpec_indexes,
126
- hidden: emptySpec_hidden,
127
- summary: emptySpec_summary,
128
- drillTargets: emptySpec_drillTargets,
129
- drillTargetKeys: emptySpec_drillTargetKeys,
130
- collapsed: emptySpec_collapsed,
131
- scan: emptySpec_scan,
132
- scanSort: emptySpec_scanSort,
133
- status: undefined,
134
- groupBy: undefined,
135
- visibility: undefined
136
- });
137
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
138
- let envSchema = getPropertyOf(json, "environment");
139
- let platformSchema = getPropertyOf(json, "platformName");
140
- globalThis.expect([
141
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(envSchema, s => getProperty(s, "x-reventless-compositeId")), Stdlib_JSON.Decode.bool),
142
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(platformSchema, s => getProperty(s, "x-reventless-compositeId")), Stdlib_JSON.Decode.bool)
143
- ]).toEqual([
144
- true,
145
- true
146
- ]);
147
- });
148
- globalThis.test("emits x-reventless-subId on field listed in subIds", () => {
149
- let schema = S.schema(s => ({
150
- itemId: s.m(S.string),
151
- version: s.m(S.string)
152
- }));
153
- let schema$p = withSpec(schema, {
154
- ids: emptySpec_ids,
155
- compositeIds: emptySpec_compositeIds,
156
- subIds: ["version"],
157
- compositeSubIds: emptySpec_compositeSubIds,
158
- indexes: emptySpec_indexes,
159
- hidden: emptySpec_hidden,
160
- summary: emptySpec_summary,
161
- drillTargets: emptySpec_drillTargets,
162
- drillTargetKeys: emptySpec_drillTargetKeys,
163
- collapsed: emptySpec_collapsed,
164
- scan: emptySpec_scan,
165
- scanSort: emptySpec_scanSort,
166
- status: undefined,
167
- groupBy: undefined,
168
- visibility: undefined
169
- });
170
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
171
- let versionSchema = getPropertyOf(json, "version");
172
- globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(versionSchema, s => getProperty(s, "x-reventless-subId")), Stdlib_JSON.Decode.bool)).toBe(true);
173
- });
174
- globalThis.test("emits x-reventless-index as the index name when named", () => {
175
- let schema = S.schema(s => ({
176
- id: s.m(S.string),
177
- ownerId: s.m(S.string)
178
- }));
179
- let schema$p = withSpec(schema, {
180
- ids: emptySpec_ids,
181
- compositeIds: emptySpec_compositeIds,
182
- subIds: emptySpec_subIds,
183
- compositeSubIds: emptySpec_compositeSubIds,
184
- indexes: [[
185
- "ownerId",
186
- "byOwner"
187
- ]],
188
- hidden: emptySpec_hidden,
189
- summary: emptySpec_summary,
190
- drillTargets: emptySpec_drillTargets,
191
- drillTargetKeys: emptySpec_drillTargetKeys,
192
- collapsed: emptySpec_collapsed,
193
- scan: emptySpec_scan,
194
- scanSort: emptySpec_scanSort,
195
- status: undefined,
196
- groupBy: undefined,
197
- visibility: undefined
198
- });
199
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
200
- let ownerIdSchema = getPropertyOf(json, "ownerId");
201
- globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(ownerIdSchema, s => getProperty(s, "x-reventless-index")), Stdlib_JSON.Decode.string)).toBe("byOwner");
202
- });
203
- globalThis.test("emits x-reventless-index as true for unnamed @index", () => {
204
- let schema = S.schema(s => ({
205
- id: s.m(S.string),
206
- category: s.m(S.string)
207
- }));
208
- let schema$p = withSpec(schema, {
209
- ids: emptySpec_ids,
210
- compositeIds: emptySpec_compositeIds,
211
- subIds: emptySpec_subIds,
212
- compositeSubIds: emptySpec_compositeSubIds,
213
- indexes: [[
214
- "category",
215
- ""
216
- ]],
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
- status: undefined,
225
- groupBy: undefined,
226
- visibility: undefined
227
- });
228
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
229
- let categorySchema = getPropertyOf(json, "category");
230
- globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(categorySchema, s => getProperty(s, "x-reventless-index")), Stdlib_JSON.Decode.bool)).toBe(true);
231
- });
232
- globalThis.test("does not emit x-reventless-* on unannotated fields", () => {
233
- let schema = S.schema(s => ({
234
- entityId: s.m(S.string),
235
- name: s.m(S.string)
236
- }));
237
- let schema$p = withSpec(schema, {
238
- ids: ["entityId"],
239
- compositeIds: emptySpec_compositeIds,
240
- subIds: emptySpec_subIds,
241
- compositeSubIds: emptySpec_compositeSubIds,
242
- indexes: emptySpec_indexes,
243
- hidden: emptySpec_hidden,
244
- summary: emptySpec_summary,
245
- drillTargets: emptySpec_drillTargets,
246
- drillTargetKeys: emptySpec_drillTargetKeys,
247
- collapsed: emptySpec_collapsed,
248
- scan: emptySpec_scan,
249
- scanSort: emptySpec_scanSort,
250
- status: undefined,
251
- groupBy: undefined,
252
- visibility: undefined
253
- });
254
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
255
- let nameSchema = getPropertyOf(json, "name");
256
- globalThis.expect(Stdlib_Option.flatMap(nameSchema, s => getProperty(s, "x-reventless-id"))).toBe(undefined);
257
- });
258
- globalThis.test("emits x-reventless-hidden on field listed in hidden", () => {
259
- let schema = S.schema(s => ({
260
- id: s.m(S.string),
261
- deploymentId: s.m(S.string)
262
- }));
263
- let schema$p = withSpec(schema, {
264
- ids: emptySpec_ids,
265
- compositeIds: emptySpec_compositeIds,
266
- subIds: emptySpec_subIds,
267
- compositeSubIds: emptySpec_compositeSubIds,
268
- indexes: emptySpec_indexes,
269
- hidden: ["deploymentId"],
270
- summary: emptySpec_summary,
271
- drillTargets: emptySpec_drillTargets,
272
- drillTargetKeys: emptySpec_drillTargetKeys,
273
- collapsed: emptySpec_collapsed,
274
- scan: emptySpec_scan,
275
- scanSort: emptySpec_scanSort,
276
- status: undefined,
277
- groupBy: undefined,
278
- visibility: undefined
279
- });
280
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
281
- let deploymentIdSchema = getPropertyOf(json, "deploymentId");
282
- let idSchema = getPropertyOf(json, "id");
283
- globalThis.expect([
284
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(deploymentIdSchema, s => getProperty(s, "x-reventless-hidden")), Stdlib_JSON.Decode.bool),
285
- Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-hidden"))
286
- ]).toEqual([
287
- true,
288
- undefined
289
- ]);
290
- });
291
- globalThis.test("emits x-reventless-summary on field listed in summary", () => {
292
- let schema = S.schema(s => ({
293
- id: s.m(S.string),
294
- pluginName: s.m(S.string)
295
- }));
296
- let schema$p = withSpec(schema, {
297
- ids: emptySpec_ids,
298
- compositeIds: emptySpec_compositeIds,
299
- subIds: emptySpec_subIds,
300
- compositeSubIds: emptySpec_compositeSubIds,
301
- indexes: emptySpec_indexes,
302
- hidden: emptySpec_hidden,
303
- summary: ["pluginName"],
304
- drillTargets: emptySpec_drillTargets,
305
- drillTargetKeys: emptySpec_drillTargetKeys,
306
- collapsed: emptySpec_collapsed,
307
- scan: emptySpec_scan,
308
- scanSort: emptySpec_scanSort,
309
- status: undefined,
310
- groupBy: undefined,
311
- visibility: undefined
312
- });
313
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
314
- let pluginNameSchema = getPropertyOf(json, "pluginName");
315
- let idSchema = getPropertyOf(json, "id");
316
- globalThis.expect([
317
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(pluginNameSchema, s => getProperty(s, "x-reventless-summary")), Stdlib_JSON.Decode.bool),
318
- Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-summary"))
319
- ]).toEqual([
320
- true,
321
- undefined
322
- ]);
323
- });
324
- globalThis.test("emits x-reventless-drillTarget as the slice name", () => {
325
- let schema = S.schema(s => ({
326
- id: s.m(S.string),
327
- components: s.m(S.string)
328
- }));
329
- let schema$p = withSpec(schema, {
330
- ids: emptySpec_ids,
331
- compositeIds: emptySpec_compositeIds,
332
- subIds: emptySpec_subIds,
333
- compositeSubIds: emptySpec_compositeSubIds,
334
- indexes: emptySpec_indexes,
335
- hidden: emptySpec_hidden,
336
- summary: emptySpec_summary,
337
- drillTargets: [[
338
- "components",
339
- "ResourceInventory"
340
- ]],
341
- drillTargetKeys: emptySpec_drillTargetKeys,
342
- collapsed: emptySpec_collapsed,
343
- scan: emptySpec_scan,
344
- scanSort: emptySpec_scanSort,
345
- status: undefined,
346
- groupBy: undefined,
347
- visibility: undefined
348
- });
349
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
350
- let componentsSchema = getPropertyOf(json, "components");
351
- let idSchema = getPropertyOf(json, "id");
352
- globalThis.expect([
353
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(componentsSchema, s => getProperty(s, "x-reventless-drillTarget")), Stdlib_JSON.Decode.string),
354
- Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-drillTarget"))
355
- ]).toEqual([
356
- "ResourceInventory",
357
- undefined
358
- ]);
359
- });
360
- globalThis.test("emits x-reventless-drillTargetKey as the key path", () => {
361
- let schema = S.schema(s => ({
362
- id: s.m(S.string),
363
- components: s.m(S.string)
364
- }));
365
- let schema$p = withSpec(schema, {
366
- ids: emptySpec_ids,
367
- compositeIds: emptySpec_compositeIds,
368
- subIds: emptySpec_subIds,
369
- compositeSubIds: emptySpec_compositeSubIds,
370
- indexes: emptySpec_indexes,
371
- hidden: emptySpec_hidden,
372
- summary: emptySpec_summary,
373
- drillTargets: [[
374
- "components",
375
- "ResourceInventory"
376
- ]],
377
- drillTargetKeys: [[
378
- "components",
379
- "kind/name"
380
- ]],
381
- collapsed: emptySpec_collapsed,
382
- scan: emptySpec_scan,
383
- scanSort: emptySpec_scanSort,
384
- status: undefined,
385
- groupBy: undefined,
386
- visibility: undefined
387
- });
388
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
389
- let componentsSchema = getPropertyOf(json, "components");
390
- globalThis.expect(Stdlib_Option.flatMap(Stdlib_Option.flatMap(componentsSchema, s => getProperty(s, "x-reventless-drillTargetKey")), Stdlib_JSON.Decode.string)).toBe("kind/name");
391
- });
392
- globalThis.test("does not emit x-reventless-drillTargetKey when no key was supplied", () => {
393
- let schema = S.schema(s => ({
394
- id: s.m(S.string),
395
- components: s.m(S.string)
396
- }));
397
- let schema$p = withSpec(schema, {
398
- ids: emptySpec_ids,
399
- compositeIds: emptySpec_compositeIds,
400
- subIds: emptySpec_subIds,
401
- compositeSubIds: emptySpec_compositeSubIds,
402
- indexes: emptySpec_indexes,
403
- hidden: emptySpec_hidden,
404
- summary: emptySpec_summary,
405
- drillTargets: [[
406
- "components",
407
- "ResourceInventory"
408
- ]],
409
- drillTargetKeys: emptySpec_drillTargetKeys,
410
- collapsed: emptySpec_collapsed,
411
- scan: emptySpec_scan,
412
- scanSort: emptySpec_scanSort,
413
- status: undefined,
414
- groupBy: undefined,
415
- visibility: undefined
416
- });
417
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
418
- let componentsSchema = getPropertyOf(json, "components");
419
- globalThis.expect(Stdlib_Option.flatMap(componentsSchema, s => getProperty(s, "x-reventless-drillTargetKey"))).toBe(undefined);
420
- });
421
- globalThis.test("emits x-reventless-scan on field listed in scan", () => {
422
- let schema = S.schema(s => ({
423
- id: s.m(S.string),
424
- status: s.m(S.string)
425
- }));
426
- let schema$p = withSpec(schema, {
427
- ids: emptySpec_ids,
428
- compositeIds: emptySpec_compositeIds,
429
- subIds: emptySpec_subIds,
430
- compositeSubIds: emptySpec_compositeSubIds,
431
- indexes: emptySpec_indexes,
432
- hidden: emptySpec_hidden,
433
- summary: emptySpec_summary,
434
- drillTargets: emptySpec_drillTargets,
435
- drillTargetKeys: emptySpec_drillTargetKeys,
436
- collapsed: emptySpec_collapsed,
437
- scan: ["status"],
438
- scanSort: emptySpec_scanSort,
439
- status: undefined,
440
- groupBy: undefined,
441
- visibility: undefined
442
- });
443
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
444
- let statusSchema = getPropertyOf(json, "status");
445
- let idSchema = getPropertyOf(json, "id");
446
- globalThis.expect([
447
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(statusSchema, s => getProperty(s, "x-reventless-scan")), Stdlib_JSON.Decode.bool),
448
- Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-scan"))
449
- ]).toEqual([
450
- true,
451
- undefined
452
- ]);
453
- });
454
- globalThis.test("emits x-reventless-scanSort on field listed in scanSort", () => {
455
- let schema = S.schema(s => ({
456
- id: s.m(S.string),
457
- name: s.m(S.string)
458
- }));
459
- let schema$p = withSpec(schema, {
460
- ids: emptySpec_ids,
461
- compositeIds: emptySpec_compositeIds,
462
- subIds: emptySpec_subIds,
463
- compositeSubIds: emptySpec_compositeSubIds,
464
- indexes: emptySpec_indexes,
465
- hidden: emptySpec_hidden,
466
- summary: emptySpec_summary,
467
- drillTargets: emptySpec_drillTargets,
468
- drillTargetKeys: emptySpec_drillTargetKeys,
469
- collapsed: emptySpec_collapsed,
470
- scan: emptySpec_scan,
471
- scanSort: ["name"],
472
- status: undefined,
473
- groupBy: undefined,
474
- visibility: undefined
475
- });
476
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
477
- let nameSchema = getPropertyOf(json, "name");
478
- let idSchema = getPropertyOf(json, "id");
479
- globalThis.expect([
480
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(nameSchema, s => getProperty(s, "x-reventless-scanSort")), Stdlib_JSON.Decode.bool),
481
- Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-scanSort"))
482
- ]).toEqual([
483
- true,
484
- undefined
485
- ]);
486
- });
487
- globalThis.test("emits x-reventless-group-by on the field named by groupBy", () => {
488
- let schema = S.schema(s => ({
489
- id: s.m(S.string),
490
- kind: s.m(S.string)
491
- }));
492
- let schema$p = withSpec(schema, {
493
- ids: emptySpec_ids,
494
- compositeIds: emptySpec_compositeIds,
495
- subIds: emptySpec_subIds,
496
- compositeSubIds: emptySpec_compositeSubIds,
497
- indexes: emptySpec_indexes,
498
- hidden: emptySpec_hidden,
499
- summary: emptySpec_summary,
500
- drillTargets: emptySpec_drillTargets,
501
- drillTargetKeys: emptySpec_drillTargetKeys,
502
- collapsed: emptySpec_collapsed,
503
- scan: emptySpec_scan,
504
- scanSort: emptySpec_scanSort,
505
- status: undefined,
506
- groupBy: "kind",
507
- visibility: undefined
508
- });
509
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
510
- let kindSchema = getPropertyOf(json, "kind");
511
- let idSchema = getPropertyOf(json, "id");
512
- globalThis.expect([
513
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(kindSchema, s => getProperty(s, "x-reventless-group-by")), Stdlib_JSON.Decode.bool),
514
- Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-group-by"))
515
- ]).toEqual([
516
- true,
517
- undefined
518
- ]);
519
- });
520
- globalThis.test("emits x-reventless-collapsed on field listed in collapsed", () => {
521
- let schema = S.schema(s => ({
522
- id: s.m(S.string),
523
- primaryResource: s.m(S.string)
524
- }));
525
- let schema$p = withSpec(schema, {
526
- ids: emptySpec_ids,
527
- compositeIds: emptySpec_compositeIds,
528
- subIds: emptySpec_subIds,
529
- compositeSubIds: emptySpec_compositeSubIds,
530
- indexes: emptySpec_indexes,
531
- hidden: emptySpec_hidden,
532
- summary: emptySpec_summary,
533
- drillTargets: emptySpec_drillTargets,
534
- drillTargetKeys: emptySpec_drillTargetKeys,
535
- collapsed: ["primaryResource"],
536
- scan: emptySpec_scan,
537
- scanSort: emptySpec_scanSort,
538
- status: undefined,
539
- groupBy: undefined,
540
- visibility: undefined
541
- });
542
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
543
- let primarySchema = getPropertyOf(json, "primaryResource");
544
- let idSchema = getPropertyOf(json, "id");
545
- globalThis.expect([
546
- Stdlib_Option.flatMap(Stdlib_Option.flatMap(primarySchema, s => getProperty(s, "x-reventless-collapsed")), Stdlib_JSON.Decode.bool),
547
- Stdlib_Option.flatMap(idSchema, s => getProperty(s, "x-reventless-collapsed"))
548
- ]).toEqual([
549
- true,
550
- undefined
551
- ]);
552
- });
553
- globalThis.test("emits x-reventless-visibility at top level when visibility is Internal", () => {
554
- let schema = S.schema(s => ({
555
- id: s.m(S.string)
556
- }));
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: emptySpec_scanSort,
570
- status: undefined,
571
- groupBy: undefined,
572
- visibility: "Internal"
573
- });
574
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
575
- globalThis.expect(Stdlib_Option.flatMap(getProperty(json, "x-reventless-visibility"), Stdlib_JSON.Decode.string)).toBe("Internal");
576
- });
577
- globalThis.test("omits x-reventless-visibility when visibility is None (default Public)", () => {
578
- let schema = S.schema(s => ({
579
- id: s.m(S.string)
580
- }));
581
- let schema$p = withSpec(schema, {
582
- ids: emptySpec_ids,
583
- compositeIds: emptySpec_compositeIds,
584
- subIds: emptySpec_subIds,
585
- compositeSubIds: emptySpec_compositeSubIds,
586
- indexes: emptySpec_indexes,
587
- hidden: emptySpec_hidden,
588
- summary: emptySpec_summary,
589
- drillTargets: emptySpec_drillTargets,
590
- drillTargetKeys: emptySpec_drillTargetKeys,
591
- collapsed: emptySpec_collapsed,
592
- scan: emptySpec_scan,
593
- scanSort: emptySpec_scanSort,
594
- status: undefined,
595
- groupBy: undefined,
596
- visibility: undefined
597
- });
598
- let json = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema$p);
599
- globalThis.expect(getProperty(json, "x-reventless-visibility")).toBe(undefined);
600
- });
601
- });
602
- globalThis.describe("parity with S.toJSONSchema for unannotated objects:", () => {
603
- let getKeys = schema => {
604
- let obj = Stdlib_Option.flatMap(getProperty(schema, "properties"), Stdlib_JSON.Decode.object);
605
- if (obj !== undefined) {
606
- return Object.keys(obj);
607
- } else {
608
- return [];
609
- }
610
- };
611
- let getRequired = schema => {
612
- let arr = Stdlib_Option.flatMap(getProperty(schema, "required"), Stdlib_JSON.Decode.array);
613
- if (arr !== undefined) {
614
- return Stdlib_Array.filterMap(arr, Stdlib_JSON.Decode.string);
615
- } else {
616
- return [];
617
- }
618
- };
619
- let sortStrings = xs => xs.toSorted(Primitive_string.compare);
620
- globalThis.test("properties keyset matches between deriveObjectSchema and S.toJSONSchema", () => {
621
- let schema = S.schema(s => ({
622
- id: s.m(S.string),
623
- name: s.m(S.string),
624
- count: s.m(S.int)
625
- }));
626
- let derived = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
627
- let native = S.toJSONSchema(schema);
628
- globalThis.expect(sortStrings(getKeys(derived))).toEqual(sortStrings(getKeys(native)));
629
- });
630
- globalThis.test("required array matches between deriveObjectSchema and S.toJSONSchema", () => {
631
- let schema = S.schema(s => ({
632
- id: s.m(S.string),
633
- name: s.m(S.string)
634
- }));
635
- let derived = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
636
- let native = S.toJSONSchema(schema);
637
- globalThis.expect(sortStrings(getRequired(derived))).toEqual(sortStrings(getRequired(native)));
638
- });
639
- globalThis.test("S.toJSONSchema does NOT emit x-reventless-* keys even when metadata is set", () => {
640
- let withSpec = (schema, spec) => S.Metadata.set(schema, StateAnnotations$Reventless.stateAnnotationsId, spec);
641
- let schema = S.schema(s => ({
642
- entityId: s.m(S.string),
643
- name: s.m(S.string)
644
- }));
645
- let schema$p = withSpec(schema, {
646
- ids: ["entityId"],
647
- compositeIds: emptySpec_compositeIds,
648
- subIds: emptySpec_subIds,
649
- compositeSubIds: emptySpec_compositeSubIds,
650
- indexes: emptySpec_indexes,
651
- hidden: emptySpec_hidden,
652
- summary: emptySpec_summary,
653
- drillTargets: emptySpec_drillTargets,
654
- drillTargetKeys: emptySpec_drillTargetKeys,
655
- collapsed: emptySpec_collapsed,
656
- scan: emptySpec_scan,
657
- scanSort: emptySpec_scanSort,
658
- status: undefined,
659
- groupBy: undefined,
660
- visibility: undefined
661
- });
662
- let native = S.toJSONSchema(schema$p);
663
- let entityIdSchema = getPropertyOf(native, "entityId");
664
- globalThis.expect(Stdlib_Option.flatMap(entityIdSchema, s => getProperty(s, "x-reventless-id"))).toBe(undefined);
665
- });
666
- });
667
- });
668
-
669
- export {
670
- getProperty,
671
- getPropertyOf,
672
- emptySpec,
673
- }
674
- /* Not a pure module */