@reventlessdev/reventless-core 3.0.0-alpha.249 → 3.0.0-alpha.251
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 +32 -0
- package/package.json +9 -9
- package/src/admin/Platform_ComponentDefinitionsApi.res +31 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +29 -1
- package/src/admin/Platform_PluginStructuresApi.res +37 -1
- package/src/admin/Platform_PluginStructuresApi.res.mjs +29 -1
- package/src/components/Api/QueryDbListQuery.res +26 -6
- package/src/components/Api/QueryDbListQuery.res.mjs +12 -5
- package/src/plugin/component/Plugin_Structure.res +620 -370
- package/src/plugin/component/Plugin_Structure.res.mjs +341 -3
- package/src/plugin/connect/PluginConnectExtension_Mapping.res +3 -6
- package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +11 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +0 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +60 -2
- package/src/plugin/connect/PluginExtensionPoint_UiFragment.res.mjs +19 -2
- package/tests/admin/AdminApiSchemaDriftTest.res +460 -0
- package/tests/admin/AdminApiSchemaDriftTest.res.mjs +599 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +6 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +9 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res +12 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +10 -2
- package/tests/plugin/PluginStructureTest.res +109 -0
- package/tests/plugin/PluginStructureTest.res.mjs +127 -0
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +8 -0
|
@@ -0,0 +1,599 @@
|
|
|
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 structure_readModels = [queryable];
|
|
283
|
+
|
|
284
|
+
let structure_stateViewSlices = [];
|
|
285
|
+
|
|
286
|
+
let structure_stateChangeSlices = [];
|
|
287
|
+
|
|
288
|
+
let structure_aggregates = [writable];
|
|
289
|
+
|
|
290
|
+
let structure_automationSlices = [automation];
|
|
291
|
+
|
|
292
|
+
let structure_outboundTranslationSlices = [outbound];
|
|
293
|
+
|
|
294
|
+
let structure_inboundTranslationSlices = [inbound];
|
|
295
|
+
|
|
296
|
+
let structure_extensions = [extension];
|
|
297
|
+
|
|
298
|
+
let structure_extensionPoints = [extensionPoint];
|
|
299
|
+
|
|
300
|
+
let structure_requiredStores = ["catalog.images"];
|
|
301
|
+
|
|
302
|
+
let structure_requiredStoreDeclarations = [storeDecl];
|
|
303
|
+
|
|
304
|
+
let structure = {
|
|
305
|
+
readModels: structure_readModels,
|
|
306
|
+
stateViewSlices: structure_stateViewSlices,
|
|
307
|
+
stateChangeSlices: structure_stateChangeSlices,
|
|
308
|
+
aggregates: structure_aggregates,
|
|
309
|
+
automationSlices: structure_automationSlices,
|
|
310
|
+
outboundTranslationSlices: structure_outboundTranslationSlices,
|
|
311
|
+
inboundTranslationSlices: structure_inboundTranslationSlices,
|
|
312
|
+
extensions: structure_extensions,
|
|
313
|
+
extensionPoints: structure_extensionPoints,
|
|
314
|
+
requiredStores: structure_requiredStores,
|
|
315
|
+
requiredStoreDeclarations: structure_requiredStoreDeclarations
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
let panel_positions = ["platform-summary"];
|
|
319
|
+
|
|
320
|
+
let panel_requiredAccess = "admin";
|
|
321
|
+
|
|
322
|
+
let panel = {
|
|
323
|
+
fragmentId: "Catalog.Products.list",
|
|
324
|
+
title: "Products",
|
|
325
|
+
description: "",
|
|
326
|
+
positions: panel_positions,
|
|
327
|
+
requiredAccess: panel_requiredAccess
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
let menu = {
|
|
331
|
+
label: "Products",
|
|
332
|
+
icon: "box",
|
|
333
|
+
group: "Catalog",
|
|
334
|
+
sortOrder: 0
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
let page_requiredAccess = "admin";
|
|
338
|
+
|
|
339
|
+
let page = {
|
|
340
|
+
fragmentId: "Catalog.Products.list",
|
|
341
|
+
title: "Products",
|
|
342
|
+
menuEntry: menu,
|
|
343
|
+
requiredAccess: page_requiredAccess
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
let uiState_panels = [panel];
|
|
347
|
+
|
|
348
|
+
let uiState_pages = [page];
|
|
349
|
+
|
|
350
|
+
let uiState = {
|
|
351
|
+
pluginId: "Catalog",
|
|
352
|
+
remoteEntryUrl: "https://cdn.example.test/catalog@1.0/remoteEntry.js",
|
|
353
|
+
panels: uiState_panels,
|
|
354
|
+
pages: uiState_pages,
|
|
355
|
+
registeredAt: "2026-01-01T00:00:00Z",
|
|
356
|
+
updatedAt: "2026-01-01T00:00:00Z"
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
let encodedExtension = Platform_ComponentDefinitionsApi$ReventlessCore.encodeExtensionDef(extension);
|
|
360
|
+
|
|
361
|
+
let encodedExtensionPoint = Platform_PluginStructuresApi$ReventlessCore.encodeExtensionPointDef(extensionPoint);
|
|
362
|
+
|
|
363
|
+
let guards = [
|
|
364
|
+
{
|
|
365
|
+
gqlType: "Platform_FieldReference",
|
|
366
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
367
|
+
recordFields: schemaKeys(Plugin$Reventless.fieldReferenceSchema),
|
|
368
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeFieldReference(fieldRef)),
|
|
369
|
+
wireOnly: [],
|
|
370
|
+
recordOnly: []
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
gqlType: "Platform_CommandDef",
|
|
374
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
375
|
+
recordFields: schemaKeys(Plugin$Reventless.commandDefSchema),
|
|
376
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeCommandDef(cmd)),
|
|
377
|
+
wireOnly: [],
|
|
378
|
+
recordOnly: []
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
gqlType: "Platform_EventDef",
|
|
382
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
383
|
+
recordFields: schemaKeys(Plugin$Reventless.eventDefSchema),
|
|
384
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeEventDef(evt)),
|
|
385
|
+
wireOnly: [],
|
|
386
|
+
recordOnly: []
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
gqlType: "Platform_ErrorDef",
|
|
390
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
391
|
+
recordFields: schemaKeys(Plugin$Reventless.errorDefSchema),
|
|
392
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeErrorDef(err)),
|
|
393
|
+
wireOnly: [],
|
|
394
|
+
recordOnly: []
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
gqlType: "Platform_WriteSideDef",
|
|
398
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
399
|
+
recordFields: schemaKeys(Plugin$Reventless.writableDefSchema),
|
|
400
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeWritableDef(writable)),
|
|
401
|
+
wireOnly: [],
|
|
402
|
+
recordOnly: []
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
gqlType: "Platform_ReadSideDef",
|
|
406
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
407
|
+
recordFields: schemaKeys(Plugin$Reventless.queryableDefSchema),
|
|
408
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeQueryableDef(queryable)),
|
|
409
|
+
wireOnly: [],
|
|
410
|
+
recordOnly: []
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
gqlType: "Platform_AutomationSliceDef",
|
|
414
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
415
|
+
recordFields: schemaKeys(Plugin$Reventless.automationSliceDefSchema),
|
|
416
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeAutomationSliceDef(automation)),
|
|
417
|
+
wireOnly: [],
|
|
418
|
+
recordOnly: []
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
gqlType: "Platform_OutboundTranslationSliceDef",
|
|
422
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
423
|
+
recordFields: schemaKeys(Plugin$Reventless.outboundTranslationSliceDefSchema),
|
|
424
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeOutboundTranslationSliceDef(outbound)),
|
|
425
|
+
wireOnly: [],
|
|
426
|
+
recordOnly: []
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
gqlType: "Platform_InboundTranslationSliceDef",
|
|
430
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
431
|
+
recordFields: schemaKeys(Plugin$Reventless.inboundTranslationSliceDefSchema),
|
|
432
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodeInboundTranslationSliceDef(inbound)),
|
|
433
|
+
wireOnly: [],
|
|
434
|
+
recordOnly: []
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
gqlType: "Platform_ExtensionDef",
|
|
438
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
439
|
+
recordFields: schemaKeys(Plugin$Reventless.extensionDefSchema),
|
|
440
|
+
wireFields: jsonKeys(encodedExtension),
|
|
441
|
+
wireOnly: [],
|
|
442
|
+
recordOnly: []
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
gqlType: "Platform_HandledEventDef",
|
|
446
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
447
|
+
recordFields: schemaKeys(Plugin$Reventless.handledEventDefSchema),
|
|
448
|
+
wireFields: jsonKeys(firstOf(encodedExtension, "handledEvents")),
|
|
449
|
+
wireOnly: [],
|
|
450
|
+
recordOnly: []
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
gqlType: "Platform_ComponentDefinitionEntry",
|
|
454
|
+
sdlTypes: Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes,
|
|
455
|
+
recordFields: schemaKeys(Plugin$Reventless.pluginStructureSchema),
|
|
456
|
+
wireFields: jsonKeys(Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Catalog", undefined, structure)),
|
|
457
|
+
wireOnly: [
|
|
458
|
+
"pluginId",
|
|
459
|
+
"internalQueryables"
|
|
460
|
+
],
|
|
461
|
+
recordOnly: [
|
|
462
|
+
"extensionPoints",
|
|
463
|
+
"requiredStores",
|
|
464
|
+
"requiredStoreDeclarations"
|
|
465
|
+
]
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
gqlType: "Platform_PublishedEventDef",
|
|
469
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
470
|
+
recordFields: schemaKeys(Plugin$Reventless.publishedEventDefSchema),
|
|
471
|
+
wireFields: jsonKeys(firstOf(encodedExtensionPoint, "publishedEvents")),
|
|
472
|
+
wireOnly: [],
|
|
473
|
+
recordOnly: []
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
gqlType: "Platform_ExtensionPointDef",
|
|
477
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
478
|
+
recordFields: schemaKeys(Plugin$Reventless.extensionPointDefSchema),
|
|
479
|
+
wireFields: jsonKeys(encodedExtensionPoint),
|
|
480
|
+
wireOnly: [],
|
|
481
|
+
recordOnly: []
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
gqlType: "Platform_RequiredStoreDeclaration",
|
|
485
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
486
|
+
recordFields: schemaKeys(Plugin$Reventless.requiredStoreDeclarationSchema),
|
|
487
|
+
wireFields: jsonKeys(Platform_PluginStructuresApi$ReventlessCore.encodeRequiredStoreDeclaration(storeDecl)),
|
|
488
|
+
wireOnly: [],
|
|
489
|
+
recordOnly: []
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
gqlType: "Platform_PluginStructureEntry",
|
|
493
|
+
sdlTypes: Platform_PluginStructuresApi$ReventlessCore.sdlTypes,
|
|
494
|
+
recordFields: schemaKeys(Plugin$Reventless.pluginStructureSchema),
|
|
495
|
+
wireFields: jsonKeys(Platform_PluginStructuresApi$ReventlessCore.encodePluginStructureEntry("Catalog", structure)),
|
|
496
|
+
wireOnly: ["pluginId"],
|
|
497
|
+
recordOnly: []
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
gqlType: "Platform_UIPanel",
|
|
501
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
502
|
+
recordFields: schemaKeys(Plugin$Reventless.panelManifestEntrySchema),
|
|
503
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodePanel(panel)),
|
|
504
|
+
wireOnly: [],
|
|
505
|
+
recordOnly: []
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
gqlType: "Platform_UIMenuEntry",
|
|
509
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
510
|
+
recordFields: schemaKeys(Plugin$Reventless.menuEntrySchema),
|
|
511
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodeMenuEntry(menu)),
|
|
512
|
+
wireOnly: [],
|
|
513
|
+
recordOnly: []
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
gqlType: "Platform_UIPage",
|
|
517
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
518
|
+
recordFields: schemaKeys(Plugin$Reventless.pageManifestEntrySchema),
|
|
519
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodePage(page)),
|
|
520
|
+
wireOnly: [],
|
|
521
|
+
recordOnly: []
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
gqlType: "Platform_UIFragmentEntry",
|
|
525
|
+
sdlTypes: Platform_UIFragmentsApi$ReventlessCore.sdlTypes,
|
|
526
|
+
recordFields: schemaKeys(UiFragments$ReventlessCore.stateSchema),
|
|
527
|
+
wireFields: jsonKeys(Platform_UIFragmentsApi$ReventlessCore.encodeUIFragmentEntry(uiState)),
|
|
528
|
+
wireOnly: [],
|
|
529
|
+
recordOnly: []
|
|
530
|
+
}
|
|
531
|
+
];
|
|
532
|
+
|
|
533
|
+
guards.forEach(g => {
|
|
534
|
+
let sdlFields = sdlFieldNames(g.gqlType, g.sdlTypes);
|
|
535
|
+
globalThis.describe(g.gqlType, () => {
|
|
536
|
+
globalThis.test("the SDL block and the record schema are both readable", () => {
|
|
537
|
+
globalThis.expect(sdlFields.length !== 0).toEqual(true);
|
|
538
|
+
globalThis.expect(g.recordFields.length !== 0).toEqual(true);
|
|
539
|
+
});
|
|
540
|
+
globalThis.test("every encoded field is selectable", () => {
|
|
541
|
+
globalThis.expect(missing(g.wireFields, sdlFields)).toEqual([]);
|
|
542
|
+
});
|
|
543
|
+
globalThis.test("every declared field is encoded", () => {
|
|
544
|
+
globalThis.expect(missing(sdlFields, g.wireFields)).toEqual([]);
|
|
545
|
+
});
|
|
546
|
+
globalThis.test("every record field reaches the wire", () => {
|
|
547
|
+
globalThis.expect(missing(g.recordFields, sdlFields.concat(g.recordOnly))).toEqual([]);
|
|
548
|
+
});
|
|
549
|
+
globalThis.test("the wire carries nothing the record and the divergences do not name", () => {
|
|
550
|
+
globalThis.expect(missing(sdlFields, g.recordFields.concat(g.wireOnly))).toEqual([]);
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
globalThis.describe("derivedPages", () => {
|
|
556
|
+
globalThis.test("is emitted only for the baked manifest, and is not selectable", () => {
|
|
557
|
+
let baked = Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry("Catalog", ["dashboard"], structure);
|
|
558
|
+
globalThis.expect(jsonKeys(baked).includes("derivedPages")).toEqual(true);
|
|
559
|
+
globalThis.expect(sdlFieldNames("Platform_ComponentDefinitionEntry", Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes).includes("derivedPages")).toEqual(false);
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
let componentSdl = Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes;
|
|
564
|
+
|
|
565
|
+
let structuresSdl = Platform_PluginStructuresApi$ReventlessCore.sdlTypes;
|
|
566
|
+
|
|
567
|
+
let fragmentsSdl = Platform_UIFragmentsApi$ReventlessCore.sdlTypes;
|
|
568
|
+
|
|
569
|
+
export {
|
|
570
|
+
sdlFieldNames,
|
|
571
|
+
jsonKeys,
|
|
572
|
+
schemaKeys,
|
|
573
|
+
firstOf,
|
|
574
|
+
missing,
|
|
575
|
+
fieldRef,
|
|
576
|
+
cmd,
|
|
577
|
+
evt,
|
|
578
|
+
err,
|
|
579
|
+
writable,
|
|
580
|
+
queryable,
|
|
581
|
+
automation,
|
|
582
|
+
outbound,
|
|
583
|
+
inbound,
|
|
584
|
+
extension,
|
|
585
|
+
extensionPoint,
|
|
586
|
+
storeDecl,
|
|
587
|
+
structure,
|
|
588
|
+
panel,
|
|
589
|
+
menu,
|
|
590
|
+
page,
|
|
591
|
+
uiState,
|
|
592
|
+
componentSdl,
|
|
593
|
+
structuresSdl,
|
|
594
|
+
fragmentsSdl,
|
|
595
|
+
encodedExtension,
|
|
596
|
+
encodedExtensionPoint,
|
|
597
|
+
guards,
|
|
598
|
+
}
|
|
599
|
+
/* encodedExtension Not a pure module */
|
|
@@ -94,6 +94,12 @@ let structure: pluginStructure = {
|
|
|
94
94
|
delegateNames: ["onAdded"],
|
|
95
95
|
eventTypes: ["ProductAdded"],
|
|
96
96
|
commandTypes: [],
|
|
97
|
+
handledEvents: Some([
|
|
98
|
+
{name: "Catalog.Products.ProductAdded", toCommandTypes: ["Catalog.Watch"]},
|
|
99
|
+
]),
|
|
100
|
+
issuedCommands: Some([
|
|
101
|
+
{name: "Catalog.Products.Acknowledge", fromEventTypes: ["Catalog.Watched"]},
|
|
102
|
+
]),
|
|
97
103
|
},
|
|
98
104
|
],
|
|
99
105
|
extensionPoints: None,
|
|
@@ -133,7 +133,15 @@ let structure_extensions = [{
|
|
|
133
133
|
name: "Catalog.Products.Watcher",
|
|
134
134
|
delegateNames: ["onAdded"],
|
|
135
135
|
eventTypes: ["ProductAdded"],
|
|
136
|
-
commandTypes: []
|
|
136
|
+
commandTypes: [],
|
|
137
|
+
handledEvents: [{
|
|
138
|
+
name: "Catalog.Products.ProductAdded",
|
|
139
|
+
toCommandTypes: ["Catalog.Watch"]
|
|
140
|
+
}],
|
|
141
|
+
issuedCommands: [{
|
|
142
|
+
name: "Catalog.Products.Acknowledge",
|
|
143
|
+
fromEventTypes: ["Catalog.Watched"]
|
|
144
|
+
}]
|
|
137
145
|
}];
|
|
138
146
|
|
|
139
147
|
let structure = {
|
|
@@ -52,6 +52,15 @@ let structure: pluginStructure = {
|
|
|
52
52
|
delegateNames: ["onAdded"],
|
|
53
53
|
sourceEventTypes: ["Catalog.ProductAdded"],
|
|
54
54
|
commandTypes: None,
|
|
55
|
+
publishedEvents: Some([
|
|
56
|
+
{
|
|
57
|
+
name: "Catalog.Products.ProductBecameAvailable",
|
|
58
|
+
fromEventTypes: ["Catalog.ProductAdded"],
|
|
59
|
+
},
|
|
60
|
+
]),
|
|
61
|
+
acceptedCommands: Some([
|
|
62
|
+
{name: "Catalog.Products.Reserve", toCommandTypes: ["Catalog.ReserveStock"]},
|
|
63
|
+
]),
|
|
55
64
|
},
|
|
56
65
|
]),
|
|
57
66
|
requiredStores: Some(["Catalog.images"]),
|
|
@@ -116,7 +125,9 @@ describe("Platform_PluginStructures entry", () => {
|
|
|
116
125
|
testSync("encodes extension points with their source event types", () =>
|
|
117
126
|
expect(
|
|
118
127
|
json->String.includes(
|
|
119
|
-
"\"extensionPoints\":[{\"name\":\"Catalog.Products\",\"delegateNames\":[\"onAdded\"],\"sourceEventTypes\":[\"Catalog.ProductAdded\"],\"commandTypes\":null
|
|
128
|
+
"\"extensionPoints\":[{\"name\":\"Catalog.Products\",\"delegateNames\":[\"onAdded\"],\"sourceEventTypes\":[\"Catalog.ProductAdded\"],\"commandTypes\":null," ++
|
|
129
|
+
"\"publishedEvents\":[{\"name\":\"Catalog.Products.ProductBecameAvailable\",\"fromEventTypes\":[\"Catalog.ProductAdded\"]}]," ++
|
|
130
|
+
"\"acceptedCommands\":[{\"name\":\"Catalog.Products.Reserve\",\"toCommandTypes\":[\"Catalog.ReserveStock\"]}]}]",
|
|
120
131
|
),
|
|
121
132
|
)->toEqual(true)
|
|
122
133
|
)
|
|
@@ -107,7 +107,15 @@ let structure_extensionPoints = [{
|
|
|
107
107
|
name: "Catalog.Products",
|
|
108
108
|
delegateNames: ["onAdded"],
|
|
109
109
|
sourceEventTypes: ["Catalog.ProductAdded"],
|
|
110
|
-
commandTypes: undefined
|
|
110
|
+
commandTypes: undefined,
|
|
111
|
+
publishedEvents: [{
|
|
112
|
+
name: "Catalog.Products.ProductBecameAvailable",
|
|
113
|
+
fromEventTypes: ["Catalog.ProductAdded"]
|
|
114
|
+
}],
|
|
115
|
+
acceptedCommands: [{
|
|
116
|
+
name: "Catalog.Products.Reserve",
|
|
117
|
+
toCommandTypes: ["Catalog.ReserveStock"]
|
|
118
|
+
}]
|
|
111
119
|
}];
|
|
112
120
|
|
|
113
121
|
let structure_requiredStores = ["Catalog.images"];
|
|
@@ -176,7 +184,7 @@ globalThis.describe("Platform_PluginStructures entry", () => {
|
|
|
176
184
|
globalThis.expect(json.includes("\"chapter\":\"Inventory\"")).toEqual(true);
|
|
177
185
|
});
|
|
178
186
|
globalThis.test("encodes extension points with their source event types", () => {
|
|
179
|
-
globalThis.expect(json.includes("\"extensionPoints\":[{\"name\":\"Catalog.Products\",\"delegateNames\":[\"onAdded\"],\"sourceEventTypes\":[\"Catalog.ProductAdded\"],\"commandTypes\":null}]")).toEqual(true);
|
|
187
|
+
globalThis.expect(json.includes("\"extensionPoints\":[{\"name\":\"Catalog.Products\",\"delegateNames\":[\"onAdded\"],\"sourceEventTypes\":[\"Catalog.ProductAdded\"],\"commandTypes\":null,\"publishedEvents\":[{\"name\":\"Catalog.Products.ProductBecameAvailable\",\"fromEventTypes\":[\"Catalog.ProductAdded\"]}],\"acceptedCommands\":[{\"name\":\"Catalog.Products.Reserve\",\"toCommandTypes\":[\"Catalog.ReserveStock\"]}]}]")).toEqual(true);
|
|
180
188
|
});
|
|
181
189
|
globalThis.test("encodes the singular query field beside the list one", () => {
|
|
182
190
|
globalThis.expect(json.includes("\"singleQueryField\":\"Catalog_Product\"")).toEqual(true);
|