@reventlessdev/reventless-core 3.0.0-alpha.250 → 3.0.0-alpha.252
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 +40 -0
- package/package.json +7 -7
- package/src/admin/Platform_Admin_Structure.res +4 -1
- package/src/admin/Platform_Admin_Structure.res.mjs +4 -2
- package/src/admin/Platform_BakedManifest.res.mjs +3 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res +31 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +29 -1
- package/src/admin/Platform_PluginStructuresApi.res +80 -8
- package/src/admin/Platform_PluginStructuresApi.res.mjs +76 -2
- package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +8 -0
- package/src/components/Api/ApiNoApiHelpers.res +37 -3
- package/src/components/Api/ApiNoApiHelpers.res.mjs +29 -2
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +4 -4
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +3 -3
- package/src/plugin/api/PluginBaseFragment.res +3 -3
- package/src/plugin/component/Plugin_Structure.res +787 -384
- package/src/plugin/component/Plugin_Structure.res.mjs +430 -20
- package/src/plugin/connect/PluginConnectExtension_Mapping.res +3 -6
- package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +14 -2
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +0 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +63 -3
- package/src/plugin/connect/PluginExtensionPoint_UiFragment.res.mjs +22 -3
- package/src/plugin/lifecycle/PluginBehavior.res +11 -11
- package/src/plugin/lifecycle/PluginBehavior.res.mjs +11 -11
- package/src/plugin/lifecycle/PluginSpec.res +11 -3
- package/src/plugin/lifecycle/PluginSpec.res.mjs +11 -3
- package/tests/admin/AdminApiSchemaDriftTest.res +486 -0
- package/tests/admin/AdminApiSchemaDriftTest.res.mjs +619 -0
- package/tests/admin/Platform_Admin_StructureTest.res +8 -3
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +8 -2
- package/tests/admin/Platform_BakedManifestTest.res +2 -0
- package/tests/admin/Platform_BakedManifestTest.res.mjs +3 -1
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +10 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +30 -8
- package/tests/admin/Platform_PluginStructuresApiTest.res +28 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +27 -5
- package/tests/aggregate/AggregateCacheTest.res.mjs +15 -3
- package/tests/aggregate/AggregateConflictTest.res.mjs +15 -3
- package/tests/aggregate/AggregateFixtures.res.mjs +15 -3
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +21 -5
- package/tests/api/ApiNoApiTest.res +46 -0
- package/tests/api/ApiNoApiTest.res.mjs +49 -1
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +27 -3
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +12 -2
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +2 -0
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +12 -2
- package/tests/dcb/DcbFixtures.res.mjs +8 -0
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +18 -0
- package/tests/eventmapper/EventMapperFixtures.res.mjs +15 -3
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +9 -1
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -1
- package/tests/message/MessageTest.res +2 -0
- package/tests/message/MessageTest.res.mjs +3 -1
- package/tests/plugin/PluginStructureAccessTest.res.mjs +2 -0
- package/tests/plugin/PluginStructureTest.res +294 -1
- package/tests/plugin/PluginStructureTest.res.mjs +373 -3
- package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsTransitionSwitch.res +59 -0
- package/tests/plugin/StateChangeSlice/PsTransitionSwitch.res.mjs +115 -0
- package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +8 -0
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +26 -0
- package/tests/util/CommandPublisherTest.res.mjs +9 -1
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Plugin$Reventless from "@reventlessdev/reventless-spec/src/components/Plugin.res.mjs";
|
|
6
|
+
import * as SchemaType$ReventlessCore from "../../src/components/Api/SchemaType.res.mjs";
|
|
7
|
+
import * as UiFragments$ReventlessCore from "../../src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs";
|
|
8
|
+
import * as Platform_UIFragmentsApi$ReventlessCore from "../../src/admin/Platform_UIFragmentsApi.res.mjs";
|
|
9
|
+
import * as Platform_PluginStructuresApi$ReventlessCore from "../../src/admin/Platform_PluginStructuresApi.res.mjs";
|
|
10
|
+
import * as Platform_ComponentDefinitionsApi$ReventlessCore from "../../src/admin/Platform_ComponentDefinitionsApi.res.mjs";
|
|
11
|
+
|
|
12
|
+
function sdlFieldNames(typeName, sdlTypes) {
|
|
13
|
+
return Stdlib_Option.mapOr(sdlTypes.find(block => block.startsWith(`type ` + typeName + ` {`)), [], block => Stdlib_Array.filterMap(block.split("\n"), line => {
|
|
14
|
+
let trimmed = line.trim();
|
|
15
|
+
let i = trimmed.indexOf(":");
|
|
16
|
+
if (i !== -1) {
|
|
17
|
+
return trimmed.slice(0, i);
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function jsonKeys(j) {
|
|
23
|
+
if (typeof j === "object" && j !== null && !Array.isArray(j)) {
|
|
24
|
+
return Object.keys(j);
|
|
25
|
+
} else {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function schemaKeys(schema) {
|
|
31
|
+
return Stdlib_Option.mapOr(SchemaType$ReventlessCore.fromSuryObject("", schema), [], prim => Object.keys(prim));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function firstOf(j, key) {
|
|
35
|
+
if (typeof j !== "object" || j === null || Array.isArray(j)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
let match = j[key];
|
|
39
|
+
if (Array.isArray(match)) {
|
|
40
|
+
return Stdlib_Option.getOr(match[0], null);
|
|
41
|
+
} else {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function missing(names, from) {
|
|
47
|
+
return names.filter(n => !from.includes(n));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let fieldRef = {
|
|
51
|
+
fieldName: "categoryId",
|
|
52
|
+
entity: "Category",
|
|
53
|
+
plugin: "Catalog"
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
let cmd_aggregateIdField = "productId";
|
|
57
|
+
|
|
58
|
+
let cmd_references = [fieldRef];
|
|
59
|
+
|
|
60
|
+
let cmd_allowedStates = ["Draft"];
|
|
61
|
+
|
|
62
|
+
let cmd_targetState = "Active";
|
|
63
|
+
|
|
64
|
+
let cmd_apiExposed = true;
|
|
65
|
+
|
|
66
|
+
let cmd_requiredAccess = ["catalog.write"];
|
|
67
|
+
|
|
68
|
+
let cmd_ownerField = "ownerId";
|
|
69
|
+
|
|
70
|
+
let cmd = {
|
|
71
|
+
name: "Add",
|
|
72
|
+
schema: "{}",
|
|
73
|
+
level: "Collection",
|
|
74
|
+
aggregateIdField: cmd_aggregateIdField,
|
|
75
|
+
mutationField: "Catalog_Product_Add",
|
|
76
|
+
references: cmd_references,
|
|
77
|
+
allowedStates: cmd_allowedStates,
|
|
78
|
+
targetState: cmd_targetState,
|
|
79
|
+
apiExposed: cmd_apiExposed,
|
|
80
|
+
requiredAccess: cmd_requiredAccess,
|
|
81
|
+
ownerField: cmd_ownerField
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
let evt_references = [fieldRef];
|
|
85
|
+
|
|
86
|
+
let evt = {
|
|
87
|
+
name: "ProductAdded",
|
|
88
|
+
schema: "{}",
|
|
89
|
+
references: evt_references
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
let err_references = [];
|
|
93
|
+
|
|
94
|
+
let err = {
|
|
95
|
+
name: "ProductAlreadyExists",
|
|
96
|
+
schema: "{}",
|
|
97
|
+
references: err_references
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
let writable_commands = [cmd];
|
|
101
|
+
|
|
102
|
+
let writable_producedEventTypes = ["ProductAdded"];
|
|
103
|
+
|
|
104
|
+
let writable_consumedEventTypes = [];
|
|
105
|
+
|
|
106
|
+
let writable_linkedViews = ["Products"];
|
|
107
|
+
|
|
108
|
+
let writable_consistencyRead = "Products";
|
|
109
|
+
|
|
110
|
+
let writable_events = [evt];
|
|
111
|
+
|
|
112
|
+
let writable_errors = [err];
|
|
113
|
+
|
|
114
|
+
let writable_chapter = "Catalogue";
|
|
115
|
+
|
|
116
|
+
let writable = {
|
|
117
|
+
name: "Product",
|
|
118
|
+
commands: writable_commands,
|
|
119
|
+
producedEventTypes: writable_producedEventTypes,
|
|
120
|
+
consumedEventTypes: writable_consumedEventTypes,
|
|
121
|
+
linkedViews: writable_linkedViews,
|
|
122
|
+
consistencyRead: writable_consistencyRead,
|
|
123
|
+
events: writable_events,
|
|
124
|
+
errors: writable_errors,
|
|
125
|
+
chapter: writable_chapter
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
let queryable_consumedEventTypes = ["ProductAdded"];
|
|
129
|
+
|
|
130
|
+
let queryable_linkedWriteSide = ["Product"];
|
|
131
|
+
|
|
132
|
+
let queryable_searchableFields = ["displayName"];
|
|
133
|
+
|
|
134
|
+
let queryable_labelFieldSource = "annotation";
|
|
135
|
+
|
|
136
|
+
let queryable_lifecycleField = "lifecycle";
|
|
137
|
+
|
|
138
|
+
let queryable_ownerField = "ownerId";
|
|
139
|
+
|
|
140
|
+
let queryable_retiredField = "archived";
|
|
141
|
+
|
|
142
|
+
let queryable_retiredValues = ["Archived"];
|
|
143
|
+
|
|
144
|
+
let queryable_namedWhenRetired = true;
|
|
145
|
+
|
|
146
|
+
let queryable_chapter = "Catalogue";
|
|
147
|
+
|
|
148
|
+
let queryable_singleQueryField = "Catalog_Product";
|
|
149
|
+
|
|
150
|
+
let queryable_idField = "productId";
|
|
151
|
+
|
|
152
|
+
let queryable_idFieldSource = "convention";
|
|
153
|
+
|
|
154
|
+
let queryable_requiredAccess = ["catalog.read"];
|
|
155
|
+
|
|
156
|
+
let queryable = {
|
|
157
|
+
name: "Products",
|
|
158
|
+
queryField: "Catalog_Products",
|
|
159
|
+
schema: "{}",
|
|
160
|
+
consumedEventTypes: queryable_consumedEventTypes,
|
|
161
|
+
linkedWriteSide: queryable_linkedWriteSide,
|
|
162
|
+
labelField: "displayName",
|
|
163
|
+
searchableFields: queryable_searchableFields,
|
|
164
|
+
labelFieldSource: queryable_labelFieldSource,
|
|
165
|
+
lifecycleField: queryable_lifecycleField,
|
|
166
|
+
ownerField: queryable_ownerField,
|
|
167
|
+
retiredField: queryable_retiredField,
|
|
168
|
+
retiredValues: queryable_retiredValues,
|
|
169
|
+
namedWhenRetired: queryable_namedWhenRetired,
|
|
170
|
+
visibility: undefined,
|
|
171
|
+
chapter: queryable_chapter,
|
|
172
|
+
singleQueryField: queryable_singleQueryField,
|
|
173
|
+
idField: queryable_idField,
|
|
174
|
+
idFieldSource: queryable_idFieldSource,
|
|
175
|
+
requiredAccess: queryable_requiredAccess
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
let automation_consumedEventTypes = ["StockLow"];
|
|
179
|
+
|
|
180
|
+
let automation_producedCommandTypes = ["Restock"];
|
|
181
|
+
|
|
182
|
+
let automation_chapter = "Replenishment";
|
|
183
|
+
|
|
184
|
+
let automation = {
|
|
185
|
+
name: "Restocker",
|
|
186
|
+
consumedEventTypes: automation_consumedEventTypes,
|
|
187
|
+
producedCommandTypes: automation_producedCommandTypes,
|
|
188
|
+
targetName: "Product",
|
|
189
|
+
chapter: automation_chapter
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
let outbound_consumedEventTypes = ["OrderPlaced"];
|
|
193
|
+
|
|
194
|
+
let outbound_inboundCommandTypes = ["Ship"];
|
|
195
|
+
|
|
196
|
+
let outbound_targetName = "Shipment";
|
|
197
|
+
|
|
198
|
+
let outbound_externalSystem = "Shipper";
|
|
199
|
+
|
|
200
|
+
let outbound_chapter = "Fulfilment";
|
|
201
|
+
|
|
202
|
+
let outbound = {
|
|
203
|
+
name: "ToShipper",
|
|
204
|
+
consumedEventTypes: outbound_consumedEventTypes,
|
|
205
|
+
inboundCommandTypes: outbound_inboundCommandTypes,
|
|
206
|
+
targetName: outbound_targetName,
|
|
207
|
+
externalSystem: outbound_externalSystem,
|
|
208
|
+
chapter: outbound_chapter
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
let inbound_commandTypes = ["RecordPayment"];
|
|
212
|
+
|
|
213
|
+
let inbound_externalSystem = "Psp";
|
|
214
|
+
|
|
215
|
+
let inbound_chapter = "Payments";
|
|
216
|
+
|
|
217
|
+
let inbound = {
|
|
218
|
+
name: "FromPsp",
|
|
219
|
+
commandTypes: inbound_commandTypes,
|
|
220
|
+
targetName: "Order",
|
|
221
|
+
externalSystem: inbound_externalSystem,
|
|
222
|
+
chapter: inbound_chapter
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
let extension_delegateNames = ["Product"];
|
|
226
|
+
|
|
227
|
+
let extension_eventTypes = ["ProductAdded"];
|
|
228
|
+
|
|
229
|
+
let extension_commandTypes = ["Add"];
|
|
230
|
+
|
|
231
|
+
let extension_handledEvents = [{
|
|
232
|
+
name: "ProductAdded",
|
|
233
|
+
toCommandTypes: ["Ordering.SyncNewProduct"]
|
|
234
|
+
}];
|
|
235
|
+
|
|
236
|
+
let extension_issuedCommands = [{
|
|
237
|
+
name: "Catalog.Products.Ack",
|
|
238
|
+
fromEventTypes: ["Ordering.Synced"]
|
|
239
|
+
}];
|
|
240
|
+
|
|
241
|
+
let extension = {
|
|
242
|
+
name: "Catalog.Products",
|
|
243
|
+
delegateNames: extension_delegateNames,
|
|
244
|
+
eventTypes: extension_eventTypes,
|
|
245
|
+
commandTypes: extension_commandTypes,
|
|
246
|
+
handledEvents: extension_handledEvents,
|
|
247
|
+
issuedCommands: extension_issuedCommands
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
let extensionPoint_delegateNames = ["Product"];
|
|
251
|
+
|
|
252
|
+
let extensionPoint_sourceEventTypes = ["Catalog.ProductAdded"];
|
|
253
|
+
|
|
254
|
+
let extensionPoint_commandTypes = ["Add"];
|
|
255
|
+
|
|
256
|
+
let extensionPoint_publishedEvents = [{
|
|
257
|
+
name: "Catalog.Products.ProductAdded",
|
|
258
|
+
fromEventTypes: ["Catalog.ProductAdded"]
|
|
259
|
+
}];
|
|
260
|
+
|
|
261
|
+
let extensionPoint_acceptedCommands = [{
|
|
262
|
+
name: "Catalog.Products.Add",
|
|
263
|
+
toCommandTypes: ["Catalog.Add"]
|
|
264
|
+
}];
|
|
265
|
+
|
|
266
|
+
let extensionPoint = {
|
|
267
|
+
name: "Catalog.Products",
|
|
268
|
+
delegateNames: extensionPoint_delegateNames,
|
|
269
|
+
sourceEventTypes: extensionPoint_sourceEventTypes,
|
|
270
|
+
commandTypes: extensionPoint_commandTypes,
|
|
271
|
+
publishedEvents: extensionPoint_publishedEvents,
|
|
272
|
+
acceptedCommands: extensionPoint_acceptedCommands
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
let storeDecl = {
|
|
276
|
+
store: "catalog.images",
|
|
277
|
+
component: "Product",
|
|
278
|
+
field: "image",
|
|
279
|
+
annotation: "images"
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
let capabilityDecl = {
|
|
283
|
+
capability: "Geocoding",
|
|
284
|
+
component: "GeocodeAddress"
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
let structure_readModels = [queryable];
|
|
288
|
+
|
|
289
|
+
let structure_stateViewSlices = [];
|
|
290
|
+
|
|
291
|
+
let structure_stateChangeSlices = [];
|
|
292
|
+
|
|
293
|
+
let structure_aggregates = [writable];
|
|
294
|
+
|
|
295
|
+
let structure_automationSlices = [automation];
|
|
296
|
+
|
|
297
|
+
let structure_outboundTranslationSlices = [outbound];
|
|
298
|
+
|
|
299
|
+
let structure_inboundTranslationSlices = [inbound];
|
|
300
|
+
|
|
301
|
+
let structure_extensions = [extension];
|
|
302
|
+
|
|
303
|
+
let structure_extensionPoints = [extensionPoint];
|
|
304
|
+
|
|
305
|
+
let structure_requiredStores = ["catalog.images"];
|
|
306
|
+
|
|
307
|
+
let structure_requiredStoreDeclarations = [storeDecl];
|
|
308
|
+
|
|
309
|
+
let structure_requiredCapabilities = [capabilityDecl];
|
|
310
|
+
|
|
311
|
+
let structure = {
|
|
312
|
+
readModels: structure_readModels,
|
|
313
|
+
stateViewSlices: structure_stateViewSlices,
|
|
314
|
+
stateChangeSlices: structure_stateChangeSlices,
|
|
315
|
+
aggregates: structure_aggregates,
|
|
316
|
+
automationSlices: structure_automationSlices,
|
|
317
|
+
outboundTranslationSlices: structure_outboundTranslationSlices,
|
|
318
|
+
inboundTranslationSlices: structure_inboundTranslationSlices,
|
|
319
|
+
extensions: structure_extensions,
|
|
320
|
+
extensionPoints: structure_extensionPoints,
|
|
321
|
+
requiredStores: structure_requiredStores,
|
|
322
|
+
requiredStoreDeclarations: structure_requiredStoreDeclarations,
|
|
323
|
+
requiredCapabilities: structure_requiredCapabilities,
|
|
324
|
+
traitDeclarations: undefined
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
let panel_positions = ["platform-summary"];
|
|
328
|
+
|
|
329
|
+
let panel_requiredAccess = "admin";
|
|
330
|
+
|
|
331
|
+
let panel = {
|
|
332
|
+
fragmentId: "Catalog.Products.list",
|
|
333
|
+
title: "Products",
|
|
334
|
+
description: "",
|
|
335
|
+
positions: panel_positions,
|
|
336
|
+
requiredAccess: panel_requiredAccess
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
let menu = {
|
|
340
|
+
label: "Products",
|
|
341
|
+
icon: "box",
|
|
342
|
+
group: "Catalog",
|
|
343
|
+
sortOrder: 0
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
let page_requiredAccess = "admin";
|
|
347
|
+
|
|
348
|
+
let page = {
|
|
349
|
+
fragmentId: "Catalog.Products.list",
|
|
350
|
+
title: "Products",
|
|
351
|
+
menuEntry: menu,
|
|
352
|
+
requiredAccess: page_requiredAccess
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
let uiState_panels = [panel];
|
|
356
|
+
|
|
357
|
+
let uiState_pages = [page];
|
|
358
|
+
|
|
359
|
+
let uiState = {
|
|
360
|
+
pluginId: "Catalog",
|
|
361
|
+
remoteEntryUrl: "https://cdn.example.test/catalog@1.0/remoteEntry.js",
|
|
362
|
+
panels: uiState_panels,
|
|
363
|
+
pages: uiState_pages,
|
|
364
|
+
registeredAt: "2026-01-01T00:00:00Z",
|
|
365
|
+
updatedAt: "2026-01-01T00:00:00Z"
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
let encodedExtension = Platform_ComponentDefinitionsApi$ReventlessCore.encodeExtensionDef(extension);
|
|
369
|
+
|
|
370
|
+
let encodedExtensionPoint = Platform_PluginStructuresApi$ReventlessCore.encodeExtensionPointDef(extensionPoint);
|
|
371
|
+
|
|
372
|
+
let guards = [
|
|
373
|
+
{
|
|
374
|
+
gqlType: "Platform_FieldReference",
|
|
375
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
376
|
+
recordFields: schemaKeys(Plugin$Reventless.fieldReferenceSchema),
|
|
377
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeFieldReference(fieldRef)),
|
|
378
|
+
wireOnly: [],
|
|
379
|
+
recordOnly: []
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
gqlType: "Platform_CommandDef",
|
|
383
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
384
|
+
recordFields: schemaKeys(Plugin$Reventless.commandDefSchema),
|
|
385
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeCommandDef(cmd)),
|
|
386
|
+
wireOnly: [],
|
|
387
|
+
recordOnly: []
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
gqlType: "Platform_EventDef",
|
|
391
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
392
|
+
recordFields: schemaKeys(Plugin$Reventless.eventDefSchema),
|
|
393
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeEventDef(evt)),
|
|
394
|
+
wireOnly: [],
|
|
395
|
+
recordOnly: []
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
gqlType: "Platform_ErrorDef",
|
|
399
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
400
|
+
recordFields: schemaKeys(Plugin$Reventless.errorDefSchema),
|
|
401
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeErrorDef(err)),
|
|
402
|
+
wireOnly: [],
|
|
403
|
+
recordOnly: []
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
gqlType: "Platform_WriteSideDef",
|
|
407
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
408
|
+
recordFields: schemaKeys(Plugin$Reventless.writableDefSchema),
|
|
409
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeWritableDef(writable)),
|
|
410
|
+
wireOnly: [],
|
|
411
|
+
recordOnly: []
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
gqlType: "Platform_ReadSideDef",
|
|
415
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
416
|
+
recordFields: schemaKeys(Plugin$Reventless.queryableDefSchema),
|
|
417
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeQueryableDef(queryable)),
|
|
418
|
+
wireOnly: [],
|
|
419
|
+
recordOnly: []
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
gqlType: "Platform_AutomationSliceDef",
|
|
423
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
424
|
+
recordFields: schemaKeys(Plugin$Reventless.automationSliceDefSchema),
|
|
425
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeAutomationSliceDef(automation)),
|
|
426
|
+
wireOnly: [],
|
|
427
|
+
recordOnly: []
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
gqlType: "Platform_OutboundTranslationSliceDef",
|
|
431
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
432
|
+
recordFields: schemaKeys(Plugin$Reventless.outboundTranslationSliceDefSchema),
|
|
433
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeOutboundTranslationSliceDef(outbound)),
|
|
434
|
+
wireOnly: [],
|
|
435
|
+
recordOnly: []
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
gqlType: "Platform_InboundTranslationSliceDef",
|
|
439
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
440
|
+
recordFields: schemaKeys(Plugin$Reventless.inboundTranslationSliceDefSchema),
|
|
441
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeInboundTranslationSliceDef(inbound)),
|
|
442
|
+
wireOnly: [],
|
|
443
|
+
recordOnly: []
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
gqlType: "Platform_ExtensionDef",
|
|
447
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
448
|
+
recordFields: schemaKeys(Plugin$Reventless.extensionDefSchema),
|
|
449
|
+
wireFields: jsonKeys(encodedExtension),
|
|
450
|
+
wireOnly: [],
|
|
451
|
+
recordOnly: []
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
gqlType: "Platform_HandledEventDef",
|
|
455
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
456
|
+
recordFields: schemaKeys(Plugin$Reventless.handledEventDefSchema),
|
|
457
|
+
wireFields: jsonKeys(firstOf(encodedExtension, "handledEvents")),
|
|
458
|
+
wireOnly: [],
|
|
459
|
+
recordOnly: []
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
gqlType: "Platform_ComponentDefinitionEntry",
|
|
463
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
464
|
+
recordFields: schemaKeys(Plugin$Reventless.pluginStructureSchema),
|
|
465
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Catalog", undefined, structure)),
|
|
466
|
+
wireOnly: [
|
|
467
|
+
"pluginId",
|
|
468
|
+
"internalQueryables"
|
|
469
|
+
],
|
|
470
|
+
recordOnly: [
|
|
471
|
+
"extensionPoints",
|
|
472
|
+
"requiredStores",
|
|
473
|
+
"requiredStoreDeclarations",
|
|
474
|
+
"requiredCapabilities",
|
|
475
|
+
"traitDeclarations"
|
|
476
|
+
]
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
gqlType: "Platform_PublishedEventDef",
|
|
480
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
481
|
+
recordFields: schemaKeys(Plugin$Reventless.publishedEventDefSchema),
|
|
482
|
+
wireFields: jsonKeys(firstOf(encodedExtensionPoint, "publishedEvents")),
|
|
483
|
+
wireOnly: [],
|
|
484
|
+
recordOnly: []
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
gqlType: "Platform_ExtensionPointDef",
|
|
488
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
489
|
+
recordFields: schemaKeys(Plugin$Reventless.extensionPointDefSchema),
|
|
490
|
+
wireFields: jsonKeys(encodedExtensionPoint),
|
|
491
|
+
wireOnly: [],
|
|
492
|
+
recordOnly: []
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
gqlType: "Platform_RequiredStoreDeclaration",
|
|
496
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
497
|
+
recordFields: schemaKeys(Plugin$Reventless.requiredStoreDeclarationSchema),
|
|
498
|
+
wireFields: jsonKeys(Platform_PluginStructuresApi$ReventlessCore.encodeRequiredStoreDeclaration(storeDecl)),
|
|
499
|
+
wireOnly: [],
|
|
500
|
+
recordOnly: []
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
gqlType: "Platform_RequiredCapabilityDeclaration",
|
|
504
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
505
|
+
recordFields: schemaKeys(Plugin$Reventless.requiredCapabilityDeclarationSchema),
|
|
506
|
+
wireFields: jsonKeys(Platform_PluginStructuresApi$ReventlessCore.encodeRequiredCapabilityDeclaration(capabilityDecl)),
|
|
507
|
+
wireOnly: [],
|
|
508
|
+
recordOnly: []
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
gqlType: "Platform_PluginStructureEntry",
|
|
512
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
513
|
+
recordFields: schemaKeys(Plugin$Reventless.pluginStructureSchema),
|
|
514
|
+
wireFields: jsonKeys(Platform_PluginStructuresApi$ReventlessCore.encodePluginStructureEntry("Catalog", structure)),
|
|
515
|
+
wireOnly: ["pluginId"],
|
|
516
|
+
recordOnly: []
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
gqlType: "Platform_UIPanel",
|
|
520
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
521
|
+
recordFields: schemaKeys(Plugin$Reventless.panelManifestEntrySchema),
|
|
522
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodePanel(panel)),
|
|
523
|
+
wireOnly: [],
|
|
524
|
+
recordOnly: []
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
gqlType: "Platform_UIMenuEntry",
|
|
528
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
529
|
+
recordFields: schemaKeys(Plugin$Reventless.menuEntrySchema),
|
|
530
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodeMenuEntry(menu)),
|
|
531
|
+
wireOnly: [],
|
|
532
|
+
recordOnly: []
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
gqlType: "Platform_UIPage",
|
|
536
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
537
|
+
recordFields: schemaKeys(Plugin$Reventless.pageManifestEntrySchema),
|
|
538
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodePage(page)),
|
|
539
|
+
wireOnly: [],
|
|
540
|
+
recordOnly: []
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
gqlType: "Platform_UIFragmentEntry",
|
|
544
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
545
|
+
recordFields: schemaKeys(UiFragments$ReventlessCore.stateSchema),
|
|
546
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodeUIFragmentEntry(uiState)),
|
|
547
|
+
wireOnly: [],
|
|
548
|
+
recordOnly: []
|
|
549
|
+
}
|
|
550
|
+
];
|
|
551
|
+
|
|
552
|
+
guards.forEach(g => {
|
|
553
|
+
let sdlFields = sdlFieldNames(g.gqlType, g.sdlTypes);
|
|
554
|
+
globalThis.describe(g.gqlType, () => {
|
|
555
|
+
globalThis.test("the SDL block and the record schema are both readable", () => {
|
|
556
|
+
globalThis.expect(sdlFields.length !== 0).toEqual(true);
|
|
557
|
+
globalThis.expect(g.recordFields.length !== 0).toEqual(true);
|
|
558
|
+
});
|
|
559
|
+
globalThis.test("every encoded field is selectable", () => {
|
|
560
|
+
globalThis.expect(missing(g.wireFields, sdlFields)).toEqual([]);
|
|
561
|
+
});
|
|
562
|
+
globalThis.test("every declared field is encoded", () => {
|
|
563
|
+
globalThis.expect(missing(sdlFields, g.wireFields)).toEqual([]);
|
|
564
|
+
});
|
|
565
|
+
globalThis.test("every record field reaches the wire", () => {
|
|
566
|
+
globalThis.expect(missing(g.recordFields, sdlFields.concat(g.recordOnly))).toEqual([]);
|
|
567
|
+
});
|
|
568
|
+
globalThis.test("the wire carries nothing the record and the divergences do not name", () => {
|
|
569
|
+
globalThis.expect(missing(sdlFields, g.recordFields.concat(g.wireOnly))).toEqual([]);
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
globalThis.describe("derivedPages", () => {
|
|
575
|
+
globalThis.test("is emitted only for the baked manifest, and is not selectable", () => {
|
|
576
|
+
let baked = Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Catalog", ["dashboard"], structure);
|
|
577
|
+
globalThis.expect(jsonKeys(baked).includes("derivedPages")).toEqual(true);
|
|
578
|
+
globalThis.expect(sdlFieldNames("Platform_ComponentDefinitionEntry", Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes).includes("derivedPages")).toEqual(false);
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
let componentSdl = Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes;
|
|
583
|
+
|
|
584
|
+
let structuresSdl = Platform_PluginStructuresApi$ReventlessCore.sdlTypes;
|
|
585
|
+
|
|
586
|
+
let fragmentsSdl = Platform_UIFragmentsApi$ReventlessCore.sdlTypes;
|
|
587
|
+
|
|
588
|
+
export {
|
|
589
|
+
sdlFieldNames,
|
|
590
|
+
jsonKeys,
|
|
591
|
+
schemaKeys,
|
|
592
|
+
firstOf,
|
|
593
|
+
missing,
|
|
594
|
+
fieldRef,
|
|
595
|
+
cmd,
|
|
596
|
+
evt,
|
|
597
|
+
err,
|
|
598
|
+
writable,
|
|
599
|
+
queryable,
|
|
600
|
+
automation,
|
|
601
|
+
outbound,
|
|
602
|
+
inbound,
|
|
603
|
+
extension,
|
|
604
|
+
extensionPoint,
|
|
605
|
+
storeDecl,
|
|
606
|
+
capabilityDecl,
|
|
607
|
+
structure,
|
|
608
|
+
panel,
|
|
609
|
+
menu,
|
|
610
|
+
page,
|
|
611
|
+
uiState,
|
|
612
|
+
componentSdl,
|
|
613
|
+
structuresSdl,
|
|
614
|
+
fragmentsSdl,
|
|
615
|
+
encodedExtension,
|
|
616
|
+
encodedExtensionPoint,
|
|
617
|
+
guards,
|
|
618
|
+
}
|
|
619
|
+
/* encodedExtension Not a pure module */
|
|
@@ -111,13 +111,18 @@ describe("the admin structure's declared transitions are checked", () => {
|
|
|
111
111
|
|
|
112
112
|
// The drift that made deriving these defs worth doing rather than tidy. The
|
|
113
113
|
// hand-written arg schema described only `id`, while the SDL generated off the
|
|
114
|
-
// same `commandSchema` declares `Platform_Plugin_Activate(
|
|
114
|
+
// same `commandSchema` declares `Platform_Plugin_Activate(id: ID!, version: String!)`.
|
|
115
115
|
// AutoUI builds its mutation document from the published schema, so it sent a
|
|
116
116
|
// document missing a required argument and every admin row action was rejected at
|
|
117
117
|
// GraphQL validation, before the aggregate saw it.
|
|
118
118
|
describe("the Plugin command defs carry every argument the SDL requires", () => {
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
// Named, not positional. A caller can match `version` against a field it holds;
|
|
120
|
+
// `_0` is a name only the encoder ever chose.
|
|
121
|
+
testSync("the version argument is published, under its own name", () =>
|
|
122
|
+
expect((
|
|
123
|
+
activate().schema->String.includes(`"version"`),
|
|
124
|
+
activate().schema->String.includes(`"_0"`),
|
|
125
|
+
))->toEqual((true, false))
|
|
121
126
|
)
|
|
122
127
|
|
|
123
128
|
testSync("and so is the aggregate id", () => {
|
|
@@ -101,8 +101,14 @@ globalThis.describe("the admin structure's declared transitions are checked", ()
|
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
globalThis.describe("the Plugin command defs carry every argument the SDL requires", () => {
|
|
104
|
-
globalThis.test("the version argument is published", () => {
|
|
105
|
-
globalThis.expect(
|
|
104
|
+
globalThis.test("the version argument is published, under its own name", () => {
|
|
105
|
+
globalThis.expect([
|
|
106
|
+
commandNamed("Activate").schema.includes(`"version"`),
|
|
107
|
+
commandNamed("Activate").schema.includes(`"_0"`)
|
|
108
|
+
]).toEqual([
|
|
109
|
+
true,
|
|
110
|
+
false
|
|
111
|
+
]);
|
|
106
112
|
});
|
|
107
113
|
globalThis.test("and so is the aggregate id", () => {
|
|
108
114
|
globalThis.expect(commandNamed("Activate").aggregateIdField).toEqual(undefined);
|
|
@@ -100,7 +100,9 @@ let structure = {
|
|
|
100
100
|
extensions: structure_extensions,
|
|
101
101
|
extensionPoints: undefined,
|
|
102
102
|
requiredStores: undefined,
|
|
103
|
-
requiredStoreDeclarations: undefined
|
|
103
|
+
requiredStoreDeclarations: undefined,
|
|
104
|
+
requiredCapabilities: undefined,
|
|
105
|
+
traitDeclarations: undefined
|
|
104
106
|
};
|
|
105
107
|
|
|
106
108
|
let structures = [[
|