@reventlessdev/reventless-core 3.0.0-alpha.336 → 3.0.0-alpha.337

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.
@@ -17,7 +17,9 @@ import * as Api_Naming$ReventlessCore from "../../src/components/Api/Api_Naming.
17
17
  import * as PsShipOrder$ReventlessCore from "./StateChange/PsShipOrder.res.mjs";
18
18
  import * as PsTypoStore$ReventlessCore from "./StateChange/PsTypoStore.res.mjs";
19
19
  import * as PsOrdersView$ReventlessCore from "./StateView/PsOrdersView.res.mjs";
20
+ import * as PsPeopleView$ReventlessCore from "./StateView/PsPeopleView.res.mjs";
20
21
  import * as PsPlaceOrder$ReventlessCore from "./StateChange/PsPlaceOrder.res.mjs";
22
+ import * as PsStatusView$ReventlessCore from "./StateView/PsStatusView.res.mjs";
21
23
  import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
22
24
  import * as PsChangePhoto$ReventlessCore from "./StateChange/PsChangePhoto.res.mjs";
23
25
  import * as CapabilityManifest$Reventless from "@reventlessdev/reventless-spec/src/components/CapabilityManifest.res.mjs";
@@ -262,6 +264,72 @@ let PsCategoriesViewSlice = {
262
264
  make: make$6
263
265
  };
264
266
 
267
+ let Projection$5 = {
268
+ project: PsPeopleView$ReventlessCore.project,
269
+ moduleUrl: PsPeopleView$ReventlessCore.moduleUrl
270
+ };
271
+
272
+ function make$7(param, param$1, param$2) {
273
+ return 0;
274
+ }
275
+
276
+ let PsPeopleViewSlice_Spec = {
277
+ name: PsPeopleView$ReventlessCore.name,
278
+ moduleUrl: PsPeopleView$ReventlessCore.moduleUrl,
279
+ stateSchema: PsPeopleView$ReventlessCore.stateSchema,
280
+ Id: {
281
+ schema: Id$Reventless.StringPure.schema,
282
+ make: prim => prim,
283
+ makeFromString: prim => prim,
284
+ toString: prim => prim,
285
+ cmp: Id$Reventless.StringPure.cmp
286
+ },
287
+ consumedEventSchema: PsPeopleView$ReventlessCore.consumedEventSchema,
288
+ config: PsPeopleView$ReventlessCore.config,
289
+ subIdConfig: undefined,
290
+ authorization: PsPeopleView$ReventlessCore.authorization,
291
+ visibility: PsPeopleView$ReventlessCore.visibility
292
+ };
293
+
294
+ let PsPeopleViewSlice = {
295
+ Spec: PsPeopleViewSlice_Spec,
296
+ Projection: Projection$5,
297
+ make: make$7
298
+ };
299
+
300
+ let Projection$6 = {
301
+ project: PsStatusView$ReventlessCore.project,
302
+ moduleUrl: PsStatusView$ReventlessCore.moduleUrl
303
+ };
304
+
305
+ function make$8(param, param$1, param$2) {
306
+ return 0;
307
+ }
308
+
309
+ let PsStatusViewSlice_Spec = {
310
+ name: PsStatusView$ReventlessCore.name,
311
+ moduleUrl: PsStatusView$ReventlessCore.moduleUrl,
312
+ stateSchema: PsStatusView$ReventlessCore.stateSchema,
313
+ Id: {
314
+ schema: Id$Reventless.StringPure.schema,
315
+ make: prim => prim,
316
+ makeFromString: prim => prim,
317
+ toString: prim => prim,
318
+ cmp: Id$Reventless.StringPure.cmp
319
+ },
320
+ consumedEventSchema: PsStatusView$ReventlessCore.consumedEventSchema,
321
+ config: PsStatusView$ReventlessCore.config,
322
+ subIdConfig: undefined,
323
+ authorization: PsStatusView$ReventlessCore.authorization,
324
+ visibility: PsStatusView$ReventlessCore.visibility
325
+ };
326
+
327
+ let PsStatusViewSlice = {
328
+ Spec: PsStatusViewSlice_Spec,
329
+ Projection: Projection$6,
330
+ make: make$8
331
+ };
332
+
265
333
  let Decision$2 = {
266
334
  initialState: false,
267
335
  evolve: PsAttachInvoice$ReventlessCore.evolve,
@@ -269,7 +337,7 @@ let Decision$2 = {
269
337
  moduleUrl: PsAttachInvoice$ReventlessCore.moduleUrl
270
338
  };
271
339
 
272
- function make$7(param, param$1, param$2, param$3, param$4, param$5, param$6) {
340
+ function make$9(param, param$1, param$2, param$3, param$4, param$5, param$6) {
273
341
  return 0;
274
342
  }
275
343
 
@@ -290,7 +358,7 @@ let PsAttachInvoiceSlice = {
290
358
  Spec: PsAttachInvoiceSlice_Spec,
291
359
  Decision: Decision$2,
292
360
  isAsync: false,
293
- make: make$7
361
+ make: make$9
294
362
  };
295
363
 
296
364
  let Decision$3 = {
@@ -300,7 +368,7 @@ let Decision$3 = {
300
368
  moduleUrl: PsUploadAvatar$ReventlessCore.moduleUrl
301
369
  };
302
370
 
303
- function make$8(param, param$1, param$2, param$3, param$4, param$5, param$6) {
371
+ function make$10(param, param$1, param$2, param$3, param$4, param$5, param$6) {
304
372
  return 0;
305
373
  }
306
374
 
@@ -321,7 +389,7 @@ let PsUploadAvatarSlice = {
321
389
  Spec: PsUploadAvatarSlice_Spec,
322
390
  Decision: Decision$3,
323
391
  isAsync: false,
324
- make: make$8
392
+ make: make$10
325
393
  };
326
394
 
327
395
  let Decision$4 = {
@@ -331,7 +399,7 @@ let Decision$4 = {
331
399
  moduleUrl: PsUploadImages$ReventlessCore.moduleUrl
332
400
  };
333
401
 
334
- function make$9(param, param$1, param$2, param$3, param$4, param$5, param$6) {
402
+ function make$11(param, param$1, param$2, param$3, param$4, param$5, param$6) {
335
403
  return 0;
336
404
  }
337
405
 
@@ -352,7 +420,7 @@ let PsUploadImagesSlice = {
352
420
  Spec: PsUploadImagesSlice_Spec,
353
421
  Decision: Decision$4,
354
422
  isAsync: false,
355
- make: make$9
423
+ make: make$11
356
424
  };
357
425
 
358
426
  let Decision$5 = {
@@ -362,7 +430,7 @@ let Decision$5 = {
362
430
  moduleUrl: PsTypoStore$ReventlessCore.moduleUrl
363
431
  };
364
432
 
365
- function make$10(param, param$1, param$2, param$3, param$4, param$5, param$6) {
433
+ function make$12(param, param$1, param$2, param$3, param$4, param$5, param$6) {
366
434
  return 0;
367
435
  }
368
436
 
@@ -383,7 +451,7 @@ let PsTypoStoreSlice = {
383
451
  Spec: PsTypoStoreSlice_Spec,
384
452
  Decision: Decision$5,
385
453
  isAsync: false,
386
- make: make$10
454
+ make: make$12
387
455
  };
388
456
 
389
457
  let Decision$6 = {
@@ -393,7 +461,7 @@ let Decision$6 = {
393
461
  moduleUrl: PsChangePhoto$ReventlessCore.moduleUrl
394
462
  };
395
463
 
396
- function make$11(param, param$1, param$2, param$3, param$4, param$5, param$6) {
464
+ function make$13(param, param$1, param$2, param$3, param$4, param$5, param$6) {
397
465
  return 0;
398
466
  }
399
467
 
@@ -414,7 +482,7 @@ let PsChangePhotoSlice = {
414
482
  Spec: PsChangePhotoSlice_Spec,
415
483
  Decision: Decision$6,
416
484
  isAsync: false,
417
- make: make$11
485
+ make: make$13
418
486
  };
419
487
 
420
488
  let Decision$7 = {
@@ -424,7 +492,7 @@ let Decision$7 = {
424
492
  moduleUrl: PsReserveStock$ReventlessCore.moduleUrl
425
493
  };
426
494
 
427
- function make$12(param, param$1, param$2, param$3, param$4, param$5, param$6) {
495
+ function make$14(param, param$1, param$2, param$3, param$4, param$5, param$6) {
428
496
  return 0;
429
497
  }
430
498
 
@@ -445,7 +513,7 @@ let PsReserveStockSlice = {
445
513
  Spec: PsReserveStockSlice_Spec,
446
514
  Decision: Decision$7,
447
515
  isAsync: false,
448
- make: make$12
516
+ make: make$14
449
517
  };
450
518
 
451
519
  let Decision$8 = {
@@ -455,7 +523,7 @@ let Decision$8 = {
455
523
  moduleUrl: PsDispatchShipment$ReventlessCore.moduleUrl
456
524
  };
457
525
 
458
- function make$13(param, param$1, param$2, param$3, param$4, param$5, param$6) {
526
+ function make$15(param, param$1, param$2, param$3, param$4, param$5, param$6) {
459
527
  return 0;
460
528
  }
461
529
 
@@ -476,7 +544,7 @@ let PsDispatchShipmentSlice = {
476
544
  Spec: PsDispatchShipmentSlice_Spec,
477
545
  Decision: Decision$8,
478
546
  isAsync: false,
479
- make: make$13
547
+ make: make$15
480
548
  };
481
549
 
482
550
  let Decision$9 = {
@@ -486,7 +554,7 @@ let Decision$9 = {
486
554
  moduleUrl: PsTransitionSwitch$ReventlessCore.moduleUrl
487
555
  };
488
556
 
489
- function make$14(param, param$1, param$2, param$3, param$4, param$5, param$6) {
557
+ function make$16(param, param$1, param$2, param$3, param$4, param$5, param$6) {
490
558
  return 0;
491
559
  }
492
560
 
@@ -507,15 +575,15 @@ let PsTransitionSwitchSlice = {
507
575
  Spec: PsTransitionSwitchSlice_Spec,
508
576
  Decision: Decision$9,
509
577
  isAsync: false,
510
- make: make$14
578
+ make: make$16
511
579
  };
512
580
 
513
- let Projection$5 = {
581
+ let Projection$7 = {
514
582
  project: PsShipmentsView$ReventlessCore.project,
515
583
  moduleUrl: PsShipmentsView$ReventlessCore.moduleUrl
516
584
  };
517
585
 
518
- function make$15(param, param$1, param$2) {
586
+ function make$17(param, param$1, param$2) {
519
587
  return 0;
520
588
  }
521
589
 
@@ -539,8 +607,8 @@ let PsShipmentsViewSlice_Spec = {
539
607
 
540
608
  let PsShipmentsViewSlice = {
541
609
  Spec: PsShipmentsViewSlice_Spec,
542
- Projection: Projection$5,
543
- make: make$15
610
+ Projection: Projection$7,
611
+ make: make$17
544
612
  };
545
613
 
546
614
  let structure = Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, [
@@ -1236,10 +1304,62 @@ globalThis.describe("Plugin_Structure.make — Phase 2 graph fields", () => {
1236
1304
  ]);
1237
1305
  });
1238
1306
  globalThis.test("every built def states the name Api_Naming returned", () => {
1239
- let stated = structure.stateViewSlices.every(q => Primitive_object.equal(q.singleQueryField, Api_Naming$ReventlessCore.queryFieldNamesForStateView("TestPlugin", q.name, undefined).singleFieldName));
1307
+ let stated = structure.stateViewSlices.every(q => Primitive_object.equal(q.singleQueryField, Api_Naming$ReventlessCore.queryFieldNamesForStateView("TestPlugin", q.name, undefined, undefined, undefined).singleFieldName));
1240
1308
  globalThis.expect(stated).toEqual(true);
1241
1309
  });
1242
1310
  });
1311
+ globalThis.describe("plural / pluralSource — the plural the list field is built from", () => {
1312
+ let views = Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, [
1313
+ PsCategoriesViewSlice,
1314
+ PsPeopleViewSlice
1315
+ ], [], undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined).stateViewSlices;
1316
+ let summary = q => [
1317
+ q.queryField,
1318
+ q.singleQueryField,
1319
+ q.plural,
1320
+ q.pluralSource
1321
+ ];
1322
+ globalThis.test("@singular names the single field and the row type; the key follows it", () => {
1323
+ let status = Plugin_Structure$ReventlessCore.make("TestPlugin", undefined, undefined, [PsStatusViewSlice], [], undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined).stateViewSlices[0];
1324
+ globalThis.expect([
1325
+ status.queryField,
1326
+ status.singleQueryField,
1327
+ status.idField,
1328
+ status.idFieldSource
1329
+ ]).toEqual([
1330
+ "TestPlugin_Statuses",
1331
+ "TestPlugin_Status",
1332
+ "statusId",
1333
+ "convention"
1334
+ ]);
1335
+ });
1336
+ globalThis.test("a @resolves target's row type is the singular its view declares", () => {
1337
+ Api_Naming$ReventlessCore.registerSingular("TestPlugin", "Status", PsStatusView$ReventlessCore.stateSchema);
1338
+ globalThis.expect([
1339
+ Api_Naming$ReventlessCore.returnTypeNameFor("TestPlugin", "Status"),
1340
+ Api_Naming$ReventlessCore.returnTypeNameFor("TestPlugin", "Categories")
1341
+ ]).toEqual([
1342
+ "TestPlugin_Status",
1343
+ "TestPlugin_Category"
1344
+ ]);
1345
+ });
1346
+ globalThis.test("@plural names the list field and the singular stays the name", () => {
1347
+ globalThis.expect(views.map(summary)).toEqual([
1348
+ [
1349
+ "TestPlugin_Categories",
1350
+ "TestPlugin_Category",
1351
+ "Categories",
1352
+ "derived"
1353
+ ],
1354
+ [
1355
+ "TestPlugin_People",
1356
+ "TestPlugin_Person",
1357
+ "People",
1358
+ "declared"
1359
+ ]
1360
+ ]);
1361
+ });
1362
+ });
1243
1363
  globalThis.describe("idField / idFieldSource — the key and its provenance", () => {
1244
1364
  let keyOf = q => [
1245
1365
  q.idField,
@@ -2359,6 +2479,8 @@ export {
2359
2479
  PsCustomersViewSlice,
2360
2480
  PsAnnotatedViewSlice,
2361
2481
  PsCategoriesViewSlice,
2482
+ PsPeopleViewSlice,
2483
+ PsStatusViewSlice,
2362
2484
  PsAttachInvoiceSlice,
2363
2485
  PsUploadAvatarSlice,
2364
2486
  PsUploadImagesSlice,
@@ -0,0 +1,14 @@
1
+ // Test fixture for a declared plural: the English rule makes `Persons` of `Person`.
2
+
3
+ @@reventless.spec("Person")
4
+
5
+ @schema
6
+ type consumedEvent = PersonAdded({personId: string, name: string})
7
+
8
+ @plural("People") @schema
9
+ type state = {personId: string, name: string}
10
+
11
+ let project = ({event}: Reventless.StateViewSlice.consumed<consumedEvent>) =>
12
+ switch event {
13
+ | PersonAdded({personId, name}) => [Set(personId, {personId, name})]
14
+ }
@@ -0,0 +1,82 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Sury from "sury";
4
+ import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
5
+ import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
6
+ import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
7
+
8
+ let consumedEventSchema = Sury.$schema(s => ({
9
+ TAG: "PersonAdded",
10
+ personId: s.m(DcbTag$Reventless.string),
11
+ name: s.m(Sury.string)
12
+ }));
13
+
14
+ let stateSchema = Sury.$schema(s => ({
15
+ personId: s.m(Sury.string),
16
+ name: s.m(Sury.string)
17
+ }));
18
+
19
+ function project(param) {
20
+ let event = param.event;
21
+ let personId = event.personId;
22
+ return [{
23
+ TAG: "Set",
24
+ _0: personId,
25
+ _1: {
26
+ personId: personId,
27
+ name: event.name
28
+ }
29
+ }];
30
+ }
31
+
32
+ let config = ReadModel$Reventless.config(undefined, undefined, undefined);
33
+
34
+ let stateSchema$1 = Sury.$Metadata_set(stateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
35
+ ids: [],
36
+ compositeIds: [],
37
+ subIds: [],
38
+ compositeSubIds: [],
39
+ indexes: [],
40
+ hidden: [],
41
+ summary: [],
42
+ internal: [],
43
+ drillTargets: [],
44
+ drillTargetKeys: [],
45
+ collapsed: [],
46
+ scan: [],
47
+ scanSort: [],
48
+ semantic: [],
49
+ metric: [],
50
+ lifecycle: undefined,
51
+ groupBy: undefined,
52
+ visibility: undefined,
53
+ live: undefined,
54
+ retired: undefined,
55
+ plural: "People"
56
+ });
57
+
58
+ let name = "Person";
59
+
60
+ let Id;
61
+
62
+ let subIdConfig;
63
+
64
+ let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateView/PsPeopleView.res.mjs";
65
+
66
+ let authorization = "AllowAuthenticated";
67
+
68
+ let visibility = "Public";
69
+
70
+ export {
71
+ name,
72
+ consumedEventSchema,
73
+ project,
74
+ config,
75
+ Id,
76
+ subIdConfig,
77
+ stateSchema$1 as stateSchema,
78
+ moduleUrl,
79
+ authorization,
80
+ visibility,
81
+ }
82
+ /* consumedEventSchema Not a pure module */
@@ -0,0 +1,15 @@
1
+ // Test fixture for a declared singular: the English rule makes `Statu` of `Status`, and `Status`
2
+ // its own plural.
3
+
4
+ @@reventless.spec("Status")
5
+
6
+ @schema
7
+ type consumedEvent = StatusSet({statusId: string, label: string})
8
+
9
+ @singular("Status") @plural("Statuses") @schema
10
+ type state = {statusId: string, label: string}
11
+
12
+ let project = ({event}: Reventless.StateViewSlice.consumed<consumedEvent>) =>
13
+ switch event {
14
+ | StatusSet({statusId, label}) => [Set(statusId, {statusId, label})]
15
+ }
@@ -0,0 +1,83 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Sury from "sury";
4
+ import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
5
+ import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
6
+ import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
7
+
8
+ let consumedEventSchema = Sury.$schema(s => ({
9
+ TAG: "StatusSet",
10
+ statusId: s.m(DcbTag$Reventless.string),
11
+ label: s.m(Sury.string)
12
+ }));
13
+
14
+ let stateSchema = Sury.$schema(s => ({
15
+ statusId: s.m(Sury.string),
16
+ label: s.m(Sury.string)
17
+ }));
18
+
19
+ function project(param) {
20
+ let event = param.event;
21
+ let statusId = event.statusId;
22
+ return [{
23
+ TAG: "Set",
24
+ _0: statusId,
25
+ _1: {
26
+ statusId: statusId,
27
+ label: event.label
28
+ }
29
+ }];
30
+ }
31
+
32
+ let config = ReadModel$Reventless.config(undefined, undefined, undefined);
33
+
34
+ let stateSchema$1 = Sury.$Metadata_set(stateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
35
+ ids: [],
36
+ compositeIds: [],
37
+ subIds: [],
38
+ compositeSubIds: [],
39
+ indexes: [],
40
+ hidden: [],
41
+ summary: [],
42
+ internal: [],
43
+ drillTargets: [],
44
+ drillTargetKeys: [],
45
+ collapsed: [],
46
+ scan: [],
47
+ scanSort: [],
48
+ semantic: [],
49
+ metric: [],
50
+ lifecycle: undefined,
51
+ groupBy: undefined,
52
+ visibility: undefined,
53
+ live: undefined,
54
+ retired: undefined,
55
+ plural: "Statuses",
56
+ singular: "Status"
57
+ });
58
+
59
+ let name = "Status";
60
+
61
+ let Id;
62
+
63
+ let subIdConfig;
64
+
65
+ let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateView/PsStatusView.res.mjs";
66
+
67
+ let authorization = "AllowAuthenticated";
68
+
69
+ let visibility = "Public";
70
+
71
+ export {
72
+ name,
73
+ consumedEventSchema,
74
+ project,
75
+ config,
76
+ Id,
77
+ subIdConfig,
78
+ stateSchema$1 as stateSchema,
79
+ moduleUrl,
80
+ authorization,
81
+ visibility,
82
+ }
83
+ /* consumedEventSchema Not a pure module */