@reventlessdev/reventless-core 3.0.0-alpha.292 → 3.0.0-alpha.294

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 (49) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/package.json +9 -9
  3. package/src/admin/Platform_Admin_Structure.res +1 -2
  4. package/src/admin/Platform_Admin_Structure.res.mjs +1 -1
  5. package/src/admin/UiFragmentRegistry/StateChange/UiFragmentRegistry.res.mjs +2 -2
  6. package/src/components/Dcb/Dcb_Builder.res +11 -20
  7. package/src/components/Dcb/Dcb_Builder.res.mjs +7 -12
  8. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +27 -24
  9. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +4 -4
  10. package/src/plugin/component/Plugin_Builder.res +8 -18
  11. package/src/plugin/component/Plugin_Builder.res.mjs +2 -8
  12. package/src/plugin/component/Plugin_Helpers.res +5 -6
  13. package/src/plugin/component/Plugin_Helpers.res.mjs +1 -1
  14. package/src/plugin/component/Plugin_Structure.res +22 -28
  15. package/src/plugin/component/Plugin_Structure.res.mjs +12 -12
  16. package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +1 -1
  17. package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +1 -1
  18. package/src/plugin/connect/PluginExtensionPoint_UiFragment.res +1 -1
  19. package/src/plugin/connect/PluginExtensionPoint_UiFragment.res.mjs +1 -1
  20. package/src/plugin/lifecycle/PluginSpec.res.mjs +2 -2
  21. package/tests/aggregate/AggregateCacheTest.res.mjs +4 -4
  22. package/tests/aggregate/AggregateConflictTest.res.mjs +4 -4
  23. package/tests/aggregate/AggregateFixtures.res.mjs +4 -4
  24. package/tests/aggregate/AggregateSnapshotTest.res.mjs +6 -6
  25. package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +6 -6
  26. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +3 -3
  27. package/tests/commandgenerator/OwnerActingTest.res.mjs +7 -7
  28. package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +1 -1
  29. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +3 -3
  30. package/tests/dcb/DcbFixtures.res.mjs +2 -2
  31. package/tests/dcb/DcbStateChangeSliceTest.res.mjs +7 -7
  32. package/tests/eventmapper/EventMapperFixtures.res.mjs +4 -4
  33. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +2 -2
  34. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +2 -2
  35. package/tests/plugin/PluginStructureAccessTest.res +6 -5
  36. package/tests/plugin/PluginStructureAccessTest.res.mjs +17 -14
  37. package/tests/plugin/PluginStructureTest.res.mjs +10 -10
  38. package/tests/plugin/StateChange/PsAttachInvoice.res.mjs +2 -2
  39. package/tests/plugin/StateChange/PsChangePhoto.res.mjs +2 -2
  40. package/tests/plugin/StateChange/PsDispatchShipment.res.mjs +2 -2
  41. package/tests/plugin/StateChange/PsGatedCommands.res.mjs +3 -3
  42. package/tests/plugin/StateChange/PsPlaceOrder.res.mjs +2 -2
  43. package/tests/plugin/StateChange/PsReserveStock.res.mjs +2 -2
  44. package/tests/plugin/StateChange/PsShipOrder.res.mjs +2 -2
  45. package/tests/plugin/StateChange/PsTransitionSwitch.res.mjs +2 -2
  46. package/tests/plugin/StateChange/PsTypoStore.res.mjs +2 -2
  47. package/tests/plugin/StateChange/PsUploadAvatar.res.mjs +2 -2
  48. package/tests/plugin/StateChange/PsUploadImages.res.mjs +2 -2
  49. package/tests/util/CommandPublisherTest.res.mjs +2 -2
@@ -644,12 +644,12 @@ function syntheticCommand(schema, variantName) {
644
644
  }
645
645
  }
646
646
 
647
- function constructorPermissions(commandSchema, commandAuthorization) {
648
- return DcbTag$Reventless.extractAllVariantNames(commandSchema).map(variantName => commandAuthorization(syntheticCommand(commandSchema, variantName)));
647
+ function constructorPermissions(commandSchema, authorizationOf) {
648
+ return DcbTag$Reventless.extractAllVariantNames(commandSchema).map(authorizationOf);
649
649
  }
650
650
 
651
- function inboundDoorPermission(commandSchema, commandAuthorization) {
652
- return Authorization$Reventless.anyOf(constructorPermissions(commandSchema, commandAuthorization));
651
+ function inboundDoorPermission(commandSchema, authorizationOf) {
652
+ return Authorization$Reventless.anyOf(DcbTag$Reventless.extractAllVariantNames(commandSchema).map(authorizationOf));
653
653
  }
654
654
 
655
655
  function annotateArgTypes(schema, argTypes) {
@@ -666,7 +666,7 @@ function annotateArgTypes(schema, argTypes) {
666
666
  return schema;
667
667
  }
668
668
 
669
- function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, parentSchema, commandAuthorization, commandTransition, derivedEdgeFor, v) {
669
+ function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, parentSchema, authorizationOf, commandTransition, derivedEdgeFor, v) {
670
670
  let mkDef = (variantName, properties) => {
671
671
  let match = commandLevelAndId(isAggregate, partitionKey, variantName, properties);
672
672
  let aggregateIdField = match[1];
@@ -708,7 +708,7 @@ function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor
708
708
  let excluded = ApiNoApiHelpers$ReventlessCore.getExcludedVariants(parentSchema);
709
709
  apiExposed = excluded !== undefined ? !excluded.has(variantName) : true;
710
710
  }
711
- let rule = commandAuthorization(syntheticCommand$1);
711
+ let rule = authorizationOf(variantName);
712
712
  let requiredAccess = accessKeysFor(rule);
713
713
  let mutationField = apiExposed ? mutationFieldFor(variantName) : "";
714
714
  let jsonSchema = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(apiExposed, mutationField, v);
@@ -753,12 +753,12 @@ function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor
753
753
  }
754
754
  }
755
755
 
756
- function extractCommandDefs(identityViews, isAggregate, partitionKey, mutationFieldFor, commandAuthorization, commandTransition, derivedEdgeForOpt, commandSchema) {
756
+ function extractCommandDefs(identityViews, isAggregate, partitionKey, mutationFieldFor, authorizationOf, commandTransition, derivedEdgeForOpt, commandSchema) {
757
757
  let derivedEdgeFor = derivedEdgeForOpt !== undefined ? derivedEdgeForOpt : param => {};
758
758
  if (commandSchema.type === "anyOf") {
759
- return Stdlib_Array.filterMap(commandSchema.anyOf, v => toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema, commandAuthorization, commandTransition, derivedEdgeFor, v));
759
+ return Stdlib_Array.filterMap(commandSchema.anyOf, v => toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema, authorizationOf, commandTransition, derivedEdgeFor, v));
760
760
  } else {
761
- return Stdlib_Option.mapOr(toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema, commandAuthorization, commandTransition, derivedEdgeFor, commandSchema), [], def => [def]);
761
+ return Stdlib_Option.mapOr(toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema, authorizationOf, commandTransition, derivedEdgeFor, commandSchema), [], def => [def]);
762
762
  }
763
763
  }
764
764
 
@@ -1226,7 +1226,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
1226
1226
  let consumed = match$1[1];
1227
1227
  return {
1228
1228
  name: SCS.Spec.name,
1229
- commands: extractCommandDefs(identityViews, false, partitionBySlice[SCS.Spec.name], variantName => Api_Naming$ReventlessCore.sliceMutationFieldFor(name, SCS.Spec.name, SCS.Spec.commandSchema, variantName), command => Authorization$Reventless.named(SCS.Spec.commandAuthorization(command)), SCS.Spec.commandTransition, extra => derivedEdgeFor(SCS.Spec.name, extra), SCS.Spec.commandSchema),
1229
+ commands: extractCommandDefs(identityViews, false, partitionBySlice[SCS.Spec.name], variantName => Api_Naming$ReventlessCore.sliceMutationFieldFor(name, SCS.Spec.name, SCS.Spec.commandSchema, variantName), name => Authorization$Reventless.named(SCS.Spec.authorizationOf(name)), SCS.Spec.commandTransition, extra => derivedEdgeFor(SCS.Spec.name, extra), SCS.Spec.commandSchema),
1230
1230
  producedEventTypes: produced,
1231
1231
  consumedEventTypes: consumed,
1232
1232
  linkedViews: linkedSvsFor(produced),
@@ -1241,7 +1241,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
1241
1241
  let produced = match[1];
1242
1242
  return {
1243
1243
  name: A.Spec.name,
1244
- commands: extractCommandDefs(identityViews, true, undefined, variantName => Api_Naming$ReventlessCore.aggregateMutationField(name, A.Spec.name, variantName), command => Authorization$Reventless.named(A.Spec.commandAuthorization(command)), A.Spec.commandTransition, extra => derivedEdgeFor(A.Spec.name, extra), A.Spec.commandSchema),
1244
+ commands: extractCommandDefs(identityViews, true, undefined, variantName => Api_Naming$ReventlessCore.aggregateMutationField(name, A.Spec.name, variantName), name => Authorization$Reventless.named(A.Spec.authorizationOf(name)), A.Spec.commandTransition, extra => derivedEdgeFor(A.Spec.name, extra), A.Spec.commandSchema),
1245
1245
  producedEventTypes: produced,
1246
1246
  consumedEventTypes: [],
1247
1247
  linkedViews: linkedSvsFor(produced).concat(linkedReadModelsFor(A.Spec.name)),
@@ -1276,7 +1276,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
1276
1276
  targetName: ITS.Spec.targetName,
1277
1277
  externalSystem: ITS.Spec.externalSystem,
1278
1278
  chapter: componentChapters[ITS.Spec.name],
1279
- requiredRoles: nonEmpty(Array.from(new Set(constructorPermissions(ITS.Spec.commandSchema, cmd => Authorization$Reventless.named(ITS.Spec.commandAuthorization(cmd))).flatMap(Authorization$Reventless.rolesOf).map(role => role)).values()))
1279
+ requiredRoles: nonEmpty(Array.from(new Set(DcbTag$Reventless.extractAllVariantNames(ITS.Spec.commandSchema).map(name => Authorization$Reventless.named(ITS.Spec.authorizationOf(name))).flatMap(Authorization$Reventless.rolesOf).map(role => role)).values()))
1280
1280
  }));
1281
1281
  let tableFailures = [];
1282
1282
  let tableWarnings = [];
@@ -75,7 +75,7 @@ function Make(Spec) {
75
75
  errorSchema: ExtensionMapping$ReventlessInfra.NoDelegate.errorSchema,
76
76
  commandSchema: ExtensionMapping$ReventlessInfra.NoDelegate.commandSchema,
77
77
  moduleUrl: ExtensionMapping$ReventlessInfra.NoDelegate.moduleUrl,
78
- commandAuthorization: ExtensionMapping$ReventlessInfra.NoDelegate.commandAuthorization,
78
+ authorizationOf: ExtensionMapping$ReventlessInfra.NoDelegate.authorizationOf,
79
79
  commandTransition: ExtensionMapping$ReventlessInfra.NoDelegate.commandTransition,
80
80
  traits: ExtensionMapping$ReventlessInfra.NoDelegate.traits
81
81
  },
@@ -405,7 +405,7 @@ function Make(Spec) {
405
405
  errorSchema: PluginSpec$ReventlessCore.errorSchema,
406
406
  commandSchema: PluginSpec$ReventlessCore.commandSchema,
407
407
  moduleUrl: PluginSpec$ReventlessCore.moduleUrl,
408
- commandAuthorization: PluginSpec$ReventlessCore.commandAuthorization,
408
+ authorizationOf: PluginSpec$ReventlessCore.authorizationOf,
409
409
  commandTransition: PluginSpec$ReventlessCore.commandTransition,
410
410
  traits: PluginSpec$ReventlessCore.traits
411
411
  },
@@ -9,7 +9,7 @@
9
9
  // aggregate; the two run side by side on the same EP.
10
10
  //
11
11
  // A StateChangeSlice Spec structurally satisfies Reventless.Aggregate.Spec (name, Id,
12
- // command/event/error + schemas, commandSchema, commandAuthorization, moduleUrl), which is all
12
+ // command/event/error + schemas, commandSchema, authorizationOf, moduleUrl), which is all
13
13
  // ExtensionPointMapping.Make consumes from a Delegate.
14
14
 
15
15
  open ReventlessInfra.ExtensionPointMapping
@@ -72,7 +72,7 @@ let Mapping = ExtensionPointMapping$ReventlessInfra.Make({
72
72
  errorSchema: UiFragmentRegistry$ReventlessCore.errorSchema,
73
73
  commandSchema: UiFragmentRegistry$ReventlessCore.commandSchema,
74
74
  moduleUrl: UiFragmentRegistry$ReventlessCore.moduleUrl,
75
- commandAuthorization: UiFragmentRegistry$ReventlessCore.commandAuthorization,
75
+ authorizationOf: UiFragmentRegistry$ReventlessCore.authorizationOf,
76
76
  commandTransition: UiFragmentRegistry$ReventlessCore.commandTransition,
77
77
  traits: UiFragmentRegistry$ReventlessCore.traits
78
78
  },
@@ -146,7 +146,7 @@ let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, [
146
146
  "Disconnect"
147
147
  ]);
148
148
 
149
- function commandAuthorization(param) {
149
+ function authorizationOf(param) {
150
150
  return "AllowAuthenticated";
151
151
  }
152
152
 
@@ -170,7 +170,7 @@ export {
170
170
  commandTransition,
171
171
  commandSchema$1 as commandSchema,
172
172
  moduleUrl,
173
- commandAuthorization,
173
+ authorizationOf,
174
174
  traits,
175
175
  }
176
176
  /* commandSchema Not a pure module */
@@ -33,7 +33,7 @@ let errorSchema = Sury.literal("Never");
33
33
 
34
34
  let moduleUrl = import.meta.url;
35
35
 
36
- function commandAuthorization(param) {
36
+ function authorizationOf(param) {
37
37
  return "AllowAuthenticated";
38
38
  }
39
39
 
@@ -50,7 +50,7 @@ let AggSpec = {
50
50
  eventSchema: eventSchema,
51
51
  errorSchema: errorSchema,
52
52
  moduleUrl: moduleUrl,
53
- commandAuthorization: commandAuthorization,
53
+ authorizationOf: authorizationOf,
54
54
  commandTransition: commandTransition,
55
55
  traits: traits
56
56
  };
@@ -245,7 +245,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
245
245
  errorSchema: errorSchema,
246
246
  commandSchema: commandSchema,
247
247
  moduleUrl: moduleUrl,
248
- commandAuthorization: commandAuthorization,
248
+ authorizationOf: authorizationOf,
249
249
  commandTransition: commandTransition,
250
250
  traits: traits
251
251
  })({
@@ -268,7 +268,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
268
268
  errorSchema: errorSchema,
269
269
  commandSchema: commandSchema,
270
270
  moduleUrl: moduleUrl,
271
- commandAuthorization: commandAuthorization,
271
+ authorizationOf: authorizationOf,
272
272
  commandTransition: commandTransition,
273
273
  traits: traits
274
274
  },
@@ -22,7 +22,7 @@ let errorSchema = Sury.literal("AlreadyExists");
22
22
 
23
23
  let moduleUrl = import.meta.url;
24
24
 
25
- function commandAuthorization(param) {
25
+ function authorizationOf(param) {
26
26
  return "AllowAuthenticated";
27
27
  }
28
28
 
@@ -39,7 +39,7 @@ let AggSpec = {
39
39
  eventSchema: eventSchema,
40
40
  errorSchema: errorSchema,
41
41
  moduleUrl: moduleUrl,
42
- commandAuthorization: commandAuthorization,
42
+ authorizationOf: authorizationOf,
43
43
  commandTransition: commandTransition,
44
44
  traits: traits
45
45
  };
@@ -202,7 +202,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
202
202
  errorSchema: errorSchema,
203
203
  commandSchema: commandSchema,
204
204
  moduleUrl: moduleUrl,
205
- commandAuthorization: commandAuthorization,
205
+ authorizationOf: authorizationOf,
206
206
  commandTransition: commandTransition,
207
207
  traits: traits
208
208
  })({
@@ -225,7 +225,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
225
225
  errorSchema: errorSchema,
226
226
  commandSchema: commandSchema,
227
227
  moduleUrl: moduleUrl,
228
- commandAuthorization: commandAuthorization,
228
+ authorizationOf: authorizationOf,
229
229
  commandTransition: commandTransition,
230
230
  traits: traits
231
231
  },
@@ -36,7 +36,7 @@ let errorSchema = Sury.union([
36
36
 
37
37
  let moduleUrl = import.meta.url;
38
38
 
39
- function commandAuthorization(param) {
39
+ function authorizationOf(param) {
40
40
  return "AllowAuthenticated";
41
41
  }
42
42
 
@@ -53,7 +53,7 @@ let AggSpec = {
53
53
  eventSchema: eventSchema,
54
54
  errorSchema: errorSchema,
55
55
  moduleUrl: moduleUrl,
56
- commandAuthorization: commandAuthorization,
56
+ authorizationOf: authorizationOf,
57
57
  commandTransition: commandTransition,
58
58
  traits: traits
59
59
  };
@@ -237,7 +237,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
237
237
  errorSchema: errorSchema,
238
238
  commandSchema: commandSchema,
239
239
  moduleUrl: moduleUrl,
240
- commandAuthorization: commandAuthorization,
240
+ authorizationOf: authorizationOf,
241
241
  commandTransition: commandTransition,
242
242
  traits: traits
243
243
  })({
@@ -260,7 +260,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
260
260
  errorSchema: errorSchema,
261
261
  commandSchema: commandSchema,
262
262
  moduleUrl: moduleUrl,
263
- commandAuthorization: commandAuthorization,
263
+ authorizationOf: authorizationOf,
264
264
  commandTransition: commandTransition,
265
265
  traits: traits
266
266
  },
@@ -28,7 +28,7 @@ let errorSchema = Sury.literal("Never");
28
28
 
29
29
  let moduleUrl = import.meta.url;
30
30
 
31
- function commandAuthorization(param) {
31
+ function authorizationOf(param) {
32
32
  return "AllowAuthenticated";
33
33
  }
34
34
 
@@ -45,7 +45,7 @@ let AggSpec = {
45
45
  eventSchema: eventSchema,
46
46
  errorSchema: errorSchema,
47
47
  moduleUrl: moduleUrl,
48
- commandAuthorization: commandAuthorization,
48
+ authorizationOf: authorizationOf,
49
49
  commandTransition: commandTransition,
50
50
  traits: traits
51
51
  };
@@ -292,7 +292,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
292
292
  errorSchema: errorSchema,
293
293
  commandSchema: commandSchema,
294
294
  moduleUrl: moduleUrl,
295
- commandAuthorization: commandAuthorization,
295
+ authorizationOf: authorizationOf,
296
296
  commandTransition: commandTransition,
297
297
  traits: traits
298
298
  })({
@@ -315,7 +315,7 @@ let TestHandler = Aggregate_Callback$ReventlessCore.Make({
315
315
  errorSchema: errorSchema,
316
316
  commandSchema: commandSchema,
317
317
  moduleUrl: moduleUrl,
318
- commandAuthorization: commandAuthorization,
318
+ authorizationOf: authorizationOf,
319
319
  commandTransition: commandTransition,
320
320
  traits: traits
321
321
  },
@@ -438,7 +438,7 @@ let PlainHandler = Aggregate_Callback$ReventlessCore.Make({
438
438
  errorSchema: errorSchema,
439
439
  commandSchema: commandSchema,
440
440
  moduleUrl: moduleUrl,
441
- commandAuthorization: commandAuthorization,
441
+ authorizationOf: authorizationOf,
442
442
  commandTransition: commandTransition,
443
443
  traits: traits
444
444
  })({
@@ -461,7 +461,7 @@ let PlainHandler = Aggregate_Callback$ReventlessCore.Make({
461
461
  errorSchema: errorSchema,
462
462
  commandSchema: commandSchema,
463
463
  moduleUrl: moduleUrl,
464
- commandAuthorization: commandAuthorization,
464
+ authorizationOf: authorizationOf,
465
465
  commandTransition: commandTransition,
466
466
  traits: traits
467
467
  },
@@ -29,7 +29,7 @@ let commandSchema = Sury.union([
29
29
  }))
30
30
  ]);
31
31
 
32
- function commandAuthorization(param) {
32
+ function authorizationOf(param) {
33
33
  return "AllowAuthenticated";
34
34
  }
35
35
 
@@ -41,7 +41,7 @@ let traits = [];
41
41
 
42
42
  let OrderSliceCmd = {
43
43
  commandSchema: commandSchema,
44
- commandAuthorization: commandAuthorization,
44
+ authorizationOf: authorizationOf,
45
45
  commandTransition: commandTransition,
46
46
  traits: traits
47
47
  };
@@ -291,7 +291,7 @@ let commandSchema$1 = Sury.union([
291
291
  }))
292
292
  ]);
293
293
 
294
- function commandAuthorization$1(param) {
294
+ function authorizationOf$1(param) {
295
295
  return "AllowAuthenticated";
296
296
  }
297
297
 
@@ -303,7 +303,7 @@ let traits$1 = [];
303
303
 
304
304
  let AddProductCmd = {
305
305
  commandSchema: commandSchema$1,
306
- commandAuthorization: commandAuthorization$1,
306
+ authorizationOf: authorizationOf$1,
307
307
  commandTransition: commandTransition$1,
308
308
  traits: traits$1
309
309
  };
@@ -320,7 +320,7 @@ let commandSchema$2 = Sury.union([
320
320
  }))
321
321
  ]);
322
322
 
323
- function commandAuthorization$2(param) {
323
+ function authorizationOf$2(param) {
324
324
  return "AllowAuthenticated";
325
325
  }
326
326
 
@@ -332,7 +332,7 @@ let traits$2 = [];
332
332
 
333
333
  let ChangePriceCmd = {
334
334
  commandSchema: commandSchema$2,
335
- commandAuthorization: commandAuthorization$2,
335
+ authorizationOf: authorizationOf$2,
336
336
  commandTransition: commandTransition$2,
337
337
  traits: traits$2
338
338
  };
@@ -28,7 +28,7 @@ let errorSchema = Sury.literal("InvalidCommand");
28
28
 
29
29
  let moduleUrl = import.meta.url;
30
30
 
31
- function commandAuthorization(param) {
31
+ function authorizationOf(param) {
32
32
  return "AllowAuthenticated";
33
33
  }
34
34
 
@@ -45,7 +45,7 @@ let CmdGenAggSpec = {
45
45
  eventSchema: eventSchema,
46
46
  errorSchema: errorSchema,
47
47
  moduleUrl: moduleUrl,
48
- commandAuthorization: commandAuthorization,
48
+ authorizationOf: authorizationOf,
49
49
  commandTransition: commandTransition,
50
50
  traits: traits
51
51
  };
@@ -114,7 +114,7 @@ let TestGenerator = CommandGenerator_Callback$ReventlessCore.Make(MockPublishSpe
114
114
  errorSchema: errorSchema,
115
115
  commandSchema: commandSchema,
116
116
  moduleUrl: moduleUrl,
117
- commandAuthorization: commandAuthorization,
117
+ authorizationOf: authorizationOf,
118
118
  commandTransition: commandTransition,
119
119
  traits: traits
120
120
  });
@@ -72,7 +72,7 @@ let errorSchema = Sury.union([
72
72
  Sury.literal("OrderNotFound")
73
73
  ]);
74
74
 
75
- function commandAuthorization(param) {
75
+ function authorizationOf(param) {
76
76
  return "AllowAuthenticated";
77
77
  }
78
78
 
@@ -90,7 +90,7 @@ let OrderSlice = {
90
90
  consumedEventSchema: consumedEventSchema,
91
91
  commandSchema: commandSchema,
92
92
  errorSchema: errorSchema,
93
- commandAuthorization: commandAuthorization,
93
+ authorizationOf: authorizationOf,
94
94
  commandTransition: commandTransition,
95
95
  traits: traits,
96
96
  readConsistency: "EscalateOnRetry"
@@ -189,7 +189,7 @@ let OrderHandler = StateChangeSlice_Callback$ReventlessCore.Make({
189
189
  errorSchema: errorSchema,
190
190
  eventSchema: eventSchema,
191
191
  commandSchema: commandSchema,
192
- commandAuthorization: commandAuthorization,
192
+ authorizationOf: authorizationOf,
193
193
  commandTransition: commandTransition,
194
194
  traits: traits,
195
195
  readConsistency: "EscalateOnRetry"
@@ -270,7 +270,7 @@ let errorSchema$1 = Sury.union([
270
270
 
271
271
  let moduleUrl$1 = import.meta.url;
272
272
 
273
- function commandAuthorization$1(param) {
273
+ function authorizationOf$1(param) {
274
274
  return "AllowAuthenticated";
275
275
  }
276
276
 
@@ -287,7 +287,7 @@ let AccountSpec = {
287
287
  eventSchema: eventSchema$1,
288
288
  errorSchema: errorSchema$1,
289
289
  moduleUrl: moduleUrl$1,
290
- commandAuthorization: commandAuthorization$1,
290
+ authorizationOf: authorizationOf$1,
291
291
  commandTransition: commandTransition$1,
292
292
  traits: traits$1
293
293
  };
@@ -453,7 +453,7 @@ let AccountHandler = Aggregate_Callback$ReventlessCore.Make({
453
453
  errorSchema: errorSchema$1,
454
454
  commandSchema: commandSchema$1,
455
455
  moduleUrl: moduleUrl$1,
456
- commandAuthorization: commandAuthorization$1,
456
+ authorizationOf: authorizationOf$1,
457
457
  commandTransition: commandTransition$1,
458
458
  traits: traits$1
459
459
  })({
@@ -476,7 +476,7 @@ let AccountHandler = Aggregate_Callback$ReventlessCore.Make({
476
476
  errorSchema: errorSchema$1,
477
477
  commandSchema: commandSchema$1,
478
478
  moduleUrl: moduleUrl$1,
479
- commandAuthorization: commandAuthorization$1,
479
+ authorizationOf: authorizationOf$1,
480
480
  commandTransition: commandTransition$1,
481
481
  traits: traits$1
482
482
  },
@@ -63,7 +63,7 @@ let SliceHandler = StateChangeSlice_Callback$ReventlessCore.Make({
63
63
  errorSchema: DcbFixtures$ReventlessCore.TestCommandSpec.errorSchema,
64
64
  eventSchema: DcbFixtures$ReventlessCore.TestCommandSpec.eventSchema,
65
65
  commandSchema: DcbFixtures$ReventlessCore.TestCommandSpec.commandSchema,
66
- commandAuthorization: DcbFixtures$ReventlessCore.TestCommandSpec.commandAuthorization,
66
+ authorizationOf: DcbFixtures$ReventlessCore.TestCommandSpec.authorizationOf,
67
67
  commandTransition: DcbFixtures$ReventlessCore.TestCommandSpec.commandTransition,
68
68
  traits: DcbFixtures$ReventlessCore.TestCommandSpec.traits,
69
69
  readConsistency: DcbFixtures$ReventlessCore.TestCommandSpec.readConsistency
@@ -21,7 +21,7 @@ let commandSchema = Sury.union([
21
21
  }))
22
22
  ]);
23
23
 
24
- function commandAuthorization(param) {
24
+ function authorizationOf(param) {
25
25
  return "AllowAuthenticated";
26
26
  }
27
27
 
@@ -35,7 +35,7 @@ let TestSpec = {
35
35
  Id: undefined,
36
36
  name: name,
37
37
  commandSchema: commandSchema,
38
- commandAuthorization: commandAuthorization,
38
+ authorizationOf: authorizationOf,
39
39
  commandTransition: commandTransition,
40
40
  traits: traits
41
41
  };
@@ -72,7 +72,7 @@ let TestOps_Spec = {
72
72
  Id: Id$Reventless.StringPure,
73
73
  name: name,
74
74
  commandSchema: commandSchema,
75
- commandAuthorization: commandAuthorization,
75
+ authorizationOf: authorizationOf,
76
76
  commandTransition: commandTransition,
77
77
  traits: traits
78
78
  };
@@ -152,7 +152,7 @@ function decide(state, command) {
152
152
  }
153
153
  }
154
154
 
155
- function commandAuthorization(param) {
155
+ function authorizationOf(param) {
156
156
  return "AllowAuthenticated";
157
157
  }
158
158
 
@@ -178,7 +178,7 @@ let TestCommandSpec = {
178
178
  initialState: TestCommandSpec_initialState,
179
179
  evolve: evolve,
180
180
  decide: decide,
181
- commandAuthorization: commandAuthorization,
181
+ authorizationOf: authorizationOf,
182
182
  commandTransition: commandTransition,
183
183
  traits: traits,
184
184
  readConsistency: "EscalateOnRetry"
@@ -59,7 +59,7 @@ let TestHandler = StateChangeSlice_Callback$ReventlessCore.Make({
59
59
  errorSchema: DcbFixtures$ReventlessCore.TestCommandSpec.errorSchema,
60
60
  eventSchema: DcbFixtures$ReventlessCore.TestCommandSpec.eventSchema,
61
61
  commandSchema: DcbFixtures$ReventlessCore.TestCommandSpec.commandSchema,
62
- commandAuthorization: DcbFixtures$ReventlessCore.TestCommandSpec.commandAuthorization,
62
+ authorizationOf: DcbFixtures$ReventlessCore.TestCommandSpec.authorizationOf,
63
63
  commandTransition: DcbFixtures$ReventlessCore.TestCommandSpec.commandTransition,
64
64
  traits: DcbFixtures$ReventlessCore.TestCommandSpec.traits,
65
65
  readConsistency: DcbFixtures$ReventlessCore.TestCommandSpec.readConsistency
@@ -77,7 +77,7 @@ let commandSchema = DcbFixtures$ReventlessCore.TestCommandSpec.commandSchema;
77
77
 
78
78
  let errorSchema = DcbFixtures$ReventlessCore.TestCommandSpec.errorSchema;
79
79
 
80
- let commandAuthorization = DcbFixtures$ReventlessCore.TestCommandSpec.commandAuthorization;
80
+ let authorizationOf = DcbFixtures$ReventlessCore.TestCommandSpec.authorizationOf;
81
81
 
82
82
  let commandTransition = DcbFixtures$ReventlessCore.TestCommandSpec.commandTransition;
83
83
 
@@ -102,7 +102,7 @@ let StrongSpec = {
102
102
  initialState: StrongSpec_initialState,
103
103
  evolve: StrongSpec_evolve,
104
104
  decide: StrongSpec_decide,
105
- commandAuthorization: commandAuthorization,
105
+ authorizationOf: authorizationOf,
106
106
  commandTransition: commandTransition,
107
107
  traits: traits,
108
108
  readConsistency: "AlwaysStrong"
@@ -120,7 +120,7 @@ let commandSchema$1 = DcbFixtures$ReventlessCore.TestCommandSpec.commandSchema;
120
120
 
121
121
  let errorSchema$1 = DcbFixtures$ReventlessCore.TestCommandSpec.errorSchema;
122
122
 
123
- let commandAuthorization$1 = DcbFixtures$ReventlessCore.TestCommandSpec.commandAuthorization;
123
+ let authorizationOf$1 = DcbFixtures$ReventlessCore.TestCommandSpec.authorizationOf;
124
124
 
125
125
  let commandTransition$1 = DcbFixtures$ReventlessCore.TestCommandSpec.commandTransition;
126
126
 
@@ -145,7 +145,7 @@ let EventualSpec = {
145
145
  initialState: EventualSpec_initialState,
146
146
  evolve: EventualSpec_evolve,
147
147
  decide: EventualSpec_decide,
148
- commandAuthorization: commandAuthorization$1,
148
+ authorizationOf: authorizationOf$1,
149
149
  commandTransition: commandTransition$1,
150
150
  traits: traits$1,
151
151
  readConsistency: "AlwaysEventual"
@@ -158,7 +158,7 @@ let StrongHandler = StateChangeSlice_Callback$ReventlessCore.Make({
158
158
  errorSchema: errorSchema,
159
159
  eventSchema: eventSchema,
160
160
  commandSchema: commandSchema,
161
- commandAuthorization: commandAuthorization,
161
+ authorizationOf: authorizationOf,
162
162
  commandTransition: commandTransition,
163
163
  traits: traits,
164
164
  readConsistency: "AlwaysStrong"
@@ -171,7 +171,7 @@ let EventualHandler = StateChangeSlice_Callback$ReventlessCore.Make({
171
171
  errorSchema: errorSchema$1,
172
172
  eventSchema: eventSchema$1,
173
173
  commandSchema: commandSchema$1,
174
- commandAuthorization: commandAuthorization$1,
174
+ authorizationOf: authorizationOf$1,
175
175
  commandTransition: commandTransition$1,
176
176
  traits: traits$1,
177
177
  readConsistency: "AlwaysEventual"
@@ -161,7 +161,7 @@ let commandSchema = Sury.union([
161
161
 
162
162
  let moduleUrl$2 = import.meta.url;
163
163
 
164
- function commandAuthorization(param) {
164
+ function authorizationOf(param) {
165
165
  return "AllowAuthenticated";
166
166
  }
167
167
 
@@ -176,7 +176,7 @@ let CmdTargetSpec = {
176
176
  name: name$3,
177
177
  commandSchema: commandSchema,
178
178
  moduleUrl: moduleUrl$2,
179
- commandAuthorization: commandAuthorization,
179
+ authorizationOf: authorizationOf,
180
180
  commandTransition: commandTransition,
181
181
  traits: traits
182
182
  };
@@ -253,7 +253,7 @@ let OrderMappings_Target = {
253
253
  name: name$3,
254
254
  commandSchema: commandSchema,
255
255
  moduleUrl: moduleUrl$2,
256
- commandAuthorization: commandAuthorization,
256
+ authorizationOf: authorizationOf,
257
257
  commandTransition: commandTransition,
258
258
  traits: traits
259
259
  };
@@ -284,7 +284,7 @@ let CountOrderMappings_Target = {
284
284
  name: name$3,
285
285
  commandSchema: commandSchema,
286
286
  moduleUrl: moduleUrl$2,
287
- commandAuthorization: commandAuthorization,
287
+ authorizationOf: authorizationOf,
288
288
  commandTransition: commandTransition,
289
289
  traits: traits
290
290
  };
@@ -26,7 +26,7 @@ let directiveSchema = Sury.literal("DirectiveA");
26
26
 
27
27
  let moduleUrl = import.meta.url;
28
28
 
29
- function commandAuthorization(param) {
29
+ function authorizationOf(param) {
30
30
  return "AllowAuthenticated";
31
31
  }
32
32
 
@@ -42,7 +42,7 @@ let TestEPSpec = {
42
42
  eventSchema: eventSchema,
43
43
  directiveSchema: directiveSchema,
44
44
  moduleUrl: moduleUrl,
45
- commandAuthorization: commandAuthorization,
45
+ authorizationOf: authorizationOf,
46
46
  commandTransition: commandTransition,
47
47
  traits: traits
48
48
  };
@@ -21,7 +21,7 @@ let directiveSchema = Sury.literal("OpsEPNoDirective");
21
21
 
22
22
  let moduleUrl = import.meta.url;
23
23
 
24
- function commandAuthorization(param) {
24
+ function authorizationOf(param) {
25
25
  return "AllowAuthenticated";
26
26
  }
27
27
 
@@ -37,7 +37,7 @@ let OpsEPSpec = {
37
37
  eventSchema: eventSchema,
38
38
  directiveSchema: directiveSchema,
39
39
  moduleUrl: moduleUrl,
40
- commandAuthorization: commandAuthorization,
40
+ authorizationOf: authorizationOf,
41
41
  commandTransition: commandTransition,
42
42
  traits: traits
43
43
  };
@@ -147,10 +147,11 @@ module PsTwoRuleFeed = {
147
147
  let targetName = "AddProduct"
148
148
  let externalSystem = None
149
149
  type role = Reventless.Role.name
150
- let commandAuthorization = (command: command): Reventless.Authorization.rule<role> =>
151
- switch command {
152
- | AddProduct(_) => AllowRoles([Reventless.Role.make("Merchandiser")])
153
- | AddCategory(_) => AllowRoles([Reventless.Role.make("Admin")])
150
+ let authorizationOf = (name: string): Reventless.Authorization.rule<role> =>
151
+ switch name {
152
+ | "AddProduct" => AllowRoles([Reventless.Role.make("Merchandiser")])
153
+ | "AddCategory" => AllowRoles([Reventless.Role.make("Admin")])
154
+ | _ => DenyAll
154
155
  }
155
156
  }
156
157
 
@@ -172,7 +173,7 @@ module PsTwoRuleFeedSlice: ReventlessInfra.InboundTranslationSlice.T = {
172
173
  describe("an inbound slice's roles", () => {
173
174
  let door = Dcb_Builder.inboundDoorPermission(
174
175
  PsTwoRuleFeed.commandSchema,
175
- PsTwoRuleFeed.commandAuthorization,
176
+ PsTwoRuleFeed.authorizationOf,
176
177
  )
177
178
 
178
179
  testSync("the door admits any constructor's roles", () =>