@reventlessdev/reventless-core 3.0.0-alpha.291 → 3.0.0-alpha.293
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 +21 -0
- package/package.json +7 -7
- package/src/admin/Platform_Admin_Structure.res +1 -2
- package/src/admin/Platform_Admin_Structure.res.mjs +1 -1
- package/src/admin/UiFragmentRegistry/StateChange/UiFragmentRegistry.res.mjs +2 -2
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +25 -46
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +27 -46
- package/src/components/AutomationSlice/AutomationSlice_Route.res +50 -0
- package/src/components/AutomationSlice/AutomationSlice_Route.res.mjs +39 -0
- package/src/components/Dcb/Dcb_Builder.res +31 -56
- package/src/components/Dcb/Dcb_Builder.res.mjs +13 -29
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +2 -2
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res.mjs +2 -2
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +125 -164
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +121 -130
- package/src/plugin/component/Plugin_Builder.res +8 -18
- package/src/plugin/component/Plugin_Builder.res.mjs +2 -8
- package/src/plugin/component/Plugin_Helpers.res +16 -9
- package/src/plugin/component/Plugin_Helpers.res.mjs +1 -1
- package/src/plugin/component/Plugin_Structure.res +35 -28
- package/src/plugin/component/Plugin_Structure.res.mjs +18 -8
- package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +1 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +1 -1
- package/src/plugin/connect/PluginExtensionPoint_UiFragment.res +1 -1
- package/src/plugin/connect/PluginExtensionPoint_UiFragment.res.mjs +1 -1
- package/src/plugin/lifecycle/PluginSpec.res.mjs +2 -2
- package/tests/aggregate/AggregateCacheTest.res.mjs +4 -4
- package/tests/aggregate/AggregateConflictTest.res.mjs +4 -4
- package/tests/aggregate/AggregateFixtures.res.mjs +4 -4
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +6 -6
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +6 -6
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +3 -3
- package/tests/commandgenerator/OwnerActingTest.res.mjs +7 -7
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +1 -1
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +3 -3
- package/tests/dcb/DcbFixtures.res.mjs +2 -2
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +7 -7
- package/tests/eventmapper/EventMapperFixtures.res.mjs +4 -4
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +2 -2
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +2 -2
- package/tests/plugin/PluginStructureAccessTest.res +57 -0
- package/tests/plugin/PluginStructureAccessTest.res.mjs +91 -1
- package/tests/plugin/PluginStructureTest.res.mjs +10 -10
- package/tests/plugin/StateChange/PsAttachInvoice.res.mjs +2 -2
- package/tests/plugin/StateChange/PsChangePhoto.res.mjs +2 -2
- package/tests/plugin/StateChange/PsDispatchShipment.res.mjs +2 -2
- package/tests/plugin/StateChange/PsGatedCommands.res.mjs +3 -3
- package/tests/plugin/StateChange/PsPlaceOrder.res.mjs +2 -2
- package/tests/plugin/StateChange/PsReserveStock.res.mjs +2 -2
- package/tests/plugin/StateChange/PsShipOrder.res.mjs +2 -2
- package/tests/plugin/StateChange/PsTransitionSwitch.res.mjs +2 -2
- package/tests/plugin/StateChange/PsTypoStore.res.mjs +2 -2
- package/tests/plugin/StateChange/PsUploadAvatar.res.mjs +2 -2
- package/tests/plugin/StateChange/PsUploadImages.res.mjs +2 -2
- package/tests/util/CommandPublisherTest.res.mjs +2 -2
|
@@ -214,32 +214,22 @@ module Make = (
|
|
|
214
214
|
~kind=Aggregate,
|
|
215
215
|
~fields=fieldNames,
|
|
216
216
|
~commandSchema,
|
|
217
|
-
~
|
|
218
|
-
M.Spec.
|
|
217
|
+
~authorizationOf=name =>
|
|
218
|
+
M.Spec.authorizationOf(name)->Reventless.Authorization.named,
|
|
219
219
|
)
|
|
220
220
|
)
|
|
221
221
|
let aggDef =
|
|
222
222
|
pluginStructure->Option.flatMap(s =>
|
|
223
223
|
s.aggregates->Array.find(d => d.name == M.Spec.name)
|
|
224
224
|
)
|
|
225
|
-
//
|
|
226
|
-
// evaluating the PPX-generated `commandAuthorization` against a
|
|
227
|
-
// synthetic command value per constructor. Mirrors the resolver-time
|
|
228
|
-
// shape from `CommandGeneratorResolvers_GraphQL.syntheticCommand` —
|
|
229
|
-
// payload-bearing variants compile to `{TAG, ...}`, payload-less to
|
|
230
|
-
// bare strings.
|
|
225
|
+
// Each field gated by its own constructor's rule.
|
|
231
226
|
let fieldPermissions = Dict.make()
|
|
232
|
-
filteredConstructorNames->Array.forEachWithIndex((cname, idx) =>
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
M.Spec.
|
|
236
|
-
cname,
|
|
227
|
+
filteredConstructorNames->Array.forEachWithIndex((cname, idx) =>
|
|
228
|
+
fieldPermissions->Dict.set(
|
|
229
|
+
fieldNames->Array.getUnsafe(idx),
|
|
230
|
+
M.Spec.authorizationOf(cname)->Reventless.Authorization.named,
|
|
237
231
|
)
|
|
238
|
-
|
|
239
|
-
let rule =
|
|
240
|
-
M.Spec.commandAuthorization(syntheticCmd->Obj.magic)->Reventless.Authorization.named
|
|
241
|
-
fieldPermissions->Dict.set(fieldName, rule)
|
|
242
|
-
})
|
|
232
|
+
)
|
|
243
233
|
[
|
|
244
234
|
{
|
|
245
235
|
ReventlessInfra.Api.fieldNames,
|
|
@@ -176,17 +176,11 @@ function Make(Spec) {
|
|
|
176
176
|
if (fieldNames.length === 0) {
|
|
177
177
|
return [];
|
|
178
178
|
}
|
|
179
|
-
Stdlib_Option.forEach(Spec.hooks.mutationResolverHook, registerResolver => registerResolver("Aggregate", fieldNames, commandSchema,
|
|
179
|
+
Stdlib_Option.forEach(Spec.hooks.mutationResolverHook, registerResolver => registerResolver("Aggregate", fieldNames, commandSchema, name => Authorization$Reventless.named(M.Spec.authorizationOf(name))));
|
|
180
180
|
let aggDef = Stdlib_Option.flatMap(pluginStructure, s => s.aggregates.find(d => d.name === M.Spec.name));
|
|
181
181
|
let fieldPermissions = {};
|
|
182
182
|
filteredConstructorNames.forEach((cname, idx) => {
|
|
183
|
-
|
|
184
|
-
let hasPayload = DcbTag$Reventless.isVariantPayloadBearing(M.Spec.commandSchema, cname);
|
|
185
|
-
let syntheticCmd = hasPayload ? ({
|
|
186
|
-
TAG: cname
|
|
187
|
-
}) : cname;
|
|
188
|
-
let rule = Authorization$Reventless.named(M.Spec.commandAuthorization(syntheticCmd));
|
|
189
|
-
fieldPermissions[fieldName] = rule;
|
|
183
|
+
fieldPermissions[fieldNames[idx]] = Authorization$Reventless.named(M.Spec.authorizationOf(cname));
|
|
190
184
|
});
|
|
191
185
|
return [{
|
|
192
186
|
fieldNames: fieldNames,
|
|
@@ -1006,23 +1006,31 @@ type subscriptionInfraParams = {
|
|
|
1006
1006
|
type platformHooks = {
|
|
1007
1007
|
// ── In-memory GraphQL mutation registration ────────────────────────────
|
|
1008
1008
|
// Phase 1: register SDL + resolver stub synchronously.
|
|
1009
|
-
// `
|
|
1010
|
-
//
|
|
1011
|
-
//
|
|
1009
|
+
// `authorizationOf` is the aggregate / slice Spec's rule by constructor name;
|
|
1010
|
+
// the resolver evaluates it per-request against `ctx.identity` to enforce
|
|
1011
|
+
// per-constructor authorization rules.
|
|
1012
1012
|
mutationResolverHook?: (
|
|
1013
1013
|
~kind: mutationKind,
|
|
1014
1014
|
~fields: array<string>,
|
|
1015
1015
|
~commandSchema: S.t<unknown>,
|
|
1016
|
-
~
|
|
1016
|
+
~authorizationOf: string => Reventless.Authorization.permission,
|
|
1017
1017
|
) => unit,
|
|
1018
1018
|
// Phase 2: bind generateCommand inside Output.apply.
|
|
1019
1019
|
mutationBindHook?: (~field: string, ~generateCommand: CommandGenerator.commandGenerator) => unit,
|
|
1020
|
-
// InboundTranslationSlice — phase 1: register SDL + stub.
|
|
1021
|
-
|
|
1020
|
+
// InboundTranslationSlice — phase 1: register SDL + stub. `permission` is the
|
|
1021
|
+
// door's rule (`Plugin_Structure.inboundDoorPermission`); `None` admits nobody.
|
|
1022
|
+
inboundMutationResolverHook?: (
|
|
1023
|
+
~fieldName: string,
|
|
1024
|
+
~externalInputSchema: S.t<unknown>,
|
|
1025
|
+
~permission: Reventless.Authorization.permission=?,
|
|
1026
|
+
) => unit,
|
|
1022
1027
|
// InboundTranslationSlice — phase 2: bind receive.
|
|
1023
1028
|
inboundMutationBindReceiveHook?: (
|
|
1024
1029
|
~fieldName: string,
|
|
1025
|
-
~receive:
|
|
1030
|
+
~receive: (
|
|
1031
|
+
JSON.t,
|
|
1032
|
+
~caller: Reventless.Identity.t=?,
|
|
1033
|
+
) => promise<ReventlessInfra.InboundTranslationSlice.receiveResult>,
|
|
1026
1034
|
) => unit,
|
|
1027
1035
|
// GraphQL type definitions.
|
|
1028
1036
|
schemaTypeRegistrationHook?: array<string> => unit,
|
|
@@ -1150,8 +1158,7 @@ let registerAdminAggregateMutations = (
|
|
|
1150
1158
|
~kind=Aggregate,
|
|
1151
1159
|
~fields=fieldNames,
|
|
1152
1160
|
~commandSchema,
|
|
1153
|
-
~
|
|
1154
|
-
M.Spec.commandAuthorization(command->Obj.magic)->Reventless.Authorization.named,
|
|
1161
|
+
~authorizationOf=name => M.Spec.authorizationOf(name)->Reventless.Authorization.named,
|
|
1155
1162
|
)
|
|
1156
1163
|
)
|
|
1157
1164
|
}
|
|
@@ -541,7 +541,7 @@ function registerAdminAggregateMutations(aggregates, hooks) {
|
|
|
541
541
|
let fieldNames = filteredConstructorNames.map(cname => Api_Naming$ReventlessCore.adminField(M.Spec.name + "_" + cname));
|
|
542
542
|
aggregateMutationFieldsRegistry[M.Spec.name] = fieldNames;
|
|
543
543
|
if (fieldNames.length !== 0) {
|
|
544
|
-
return Stdlib_Option.forEach(hooks.mutationResolverHook, registerResolver => registerResolver("Aggregate", fieldNames, commandSchema,
|
|
544
|
+
return Stdlib_Option.forEach(hooks.mutationResolverHook, registerResolver => registerResolver("Aggregate", fieldNames, commandSchema, name => Authorization$Reventless.named(M.Spec.authorizationOf(name))));
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
547
|
}
|
|
@@ -810,15 +810,26 @@ let nonEmpty = (xs: array<string>): option<array<string>> => xs->Array.length >
|
|
|
810
810
|
let rolesFor = (rule: Reventless.Authorization.permission): option<array<string>> =>
|
|
811
811
|
rule->Reventless.Authorization.rolesOf->Array.map(role => (role :> string))->nonEmpty
|
|
812
812
|
|
|
813
|
-
// A stand-in for one constructor
|
|
814
|
-
//
|
|
815
|
-
//
|
|
816
|
-
// the constructor alone.
|
|
813
|
+
// A stand-in for one constructor: a payload-bearing variant compiles to
|
|
814
|
+
// `{TAG, ...}`, a payload-less one to a bare string. Enough for a spec's
|
|
815
|
+
// `commandTransition`, whose switch matches on the constructor alone.
|
|
817
816
|
let syntheticCommand = (~schema: S.t<unknown>, variantName: string): 'command =>
|
|
818
817
|
Reventless.DcbTag.isVariantPayloadBearing(schema, variantName)
|
|
819
818
|
? {"TAG": variantName}->Obj.magic
|
|
820
819
|
: variantName->Obj.magic
|
|
821
820
|
|
|
821
|
+
// Each constructor's rule.
|
|
822
|
+
let constructorPermissions = (
|
|
823
|
+
~commandSchema: S.t<unknown>,
|
|
824
|
+
~authorizationOf: string => Reventless.Authorization.permission,
|
|
825
|
+
): array<Reventless.Authorization.permission> =>
|
|
826
|
+
Reventless.DcbTag.extractAllVariantNames(commandSchema)->Array.map(authorizationOf)
|
|
827
|
+
|
|
828
|
+
// An inbound slice's gate where no command exists yet: any constructor's rule.
|
|
829
|
+
// Both the deployed gate and the local resolver apply this one.
|
|
830
|
+
let inboundDoorPermission = (~commandSchema, ~authorizationOf) =>
|
|
831
|
+
constructorPermissions(~commandSchema, ~authorizationOf)->Reventless.Authorization.anyOf
|
|
832
|
+
|
|
822
833
|
// Each mutation argument's GraphQL type onto its property, so a consumer declares
|
|
823
834
|
// the variable the server expects. Mutates the freshly derived schema in place.
|
|
824
835
|
let annotateArgTypes = (schema: JSON.t, argTypes: dict<string>): JSON.t => {
|
|
@@ -846,13 +857,13 @@ let toCommandDef = (
|
|
|
846
857
|
~partitionKey: option<string>=?,
|
|
847
858
|
~mutationFieldFor: string => string,
|
|
848
859
|
~parentSchema: S.t<unknown>,
|
|
849
|
-
// The
|
|
850
|
-
// one aggregate carries commands with very different audiences,
|
|
851
|
-
// component-level shortcut would gate `AddProduct` and `PlaceOrder` alike.
|
|
852
|
-
~
|
|
853
|
-
// The spec's `command => Transition.t<_>`, evaluated per variant
|
|
854
|
-
//
|
|
855
|
-
//
|
|
860
|
+
// The spec's `authorizationOf`, by constructor name. Per VARIANT, not per
|
|
861
|
+
// component: one aggregate carries commands with very different audiences,
|
|
862
|
+
// and a component-level shortcut would gate `AddProduct` and `PlaceOrder` alike.
|
|
863
|
+
~authorizationOf: string => Reventless.Authorization.permission,
|
|
864
|
+
// The spec's `command => Transition.t<_>`, evaluated per variant against a
|
|
865
|
+
// stand-in, and the only declaration of an edge there is — the PPX injects
|
|
866
|
+
// `Undeclared` for a spec that writes no switch.
|
|
856
867
|
//
|
|
857
868
|
// Read at `t<string>` because this is the erasure boundary: the spec declares
|
|
858
869
|
// its edges over the linked view's own lifecycle enum, whose arms are
|
|
@@ -947,7 +958,7 @@ let toCommandDef = (
|
|
|
947
958
|
| Some(excluded) => !(excluded->Set.has(variantName))
|
|
948
959
|
| None => true
|
|
949
960
|
}
|
|
950
|
-
let rule =
|
|
961
|
+
let rule = authorizationOf(variantName)
|
|
951
962
|
let requiredAccess = accessKeysFor(rule)
|
|
952
963
|
// See the note on the record's `mutationField` for why a non-exposed
|
|
953
964
|
// variant gets the empty sentinel. It has no callable field, and the
|
|
@@ -1018,7 +1029,7 @@ let extractCommandDefs = (
|
|
|
1018
1029
|
~isAggregate,
|
|
1019
1030
|
~partitionKey: option<string>=?,
|
|
1020
1031
|
~mutationFieldFor: string => string,
|
|
1021
|
-
~
|
|
1032
|
+
~authorizationOf: string => Reventless.Authorization.permission,
|
|
1022
1033
|
~commandTransition: unknown => Reventless.Transition.t<string>,
|
|
1023
1034
|
~derivedEdgeFor: string => option<Reventless.Plugin.derivedEdge>=_ => None,
|
|
1024
1035
|
commandSchema: S.t<unknown>,
|
|
@@ -1032,7 +1043,7 @@ let extractCommandDefs = (
|
|
|
1032
1043
|
~partitionKey?,
|
|
1033
1044
|
~mutationFieldFor,
|
|
1034
1045
|
~parentSchema=commandSchema,
|
|
1035
|
-
~
|
|
1046
|
+
~authorizationOf,
|
|
1036
1047
|
~commandTransition,
|
|
1037
1048
|
~derivedEdgeFor,
|
|
1038
1049
|
v,
|
|
@@ -1046,7 +1057,7 @@ let extractCommandDefs = (
|
|
|
1046
1057
|
~partitionKey?,
|
|
1047
1058
|
~mutationFieldFor,
|
|
1048
1059
|
~parentSchema=commandSchema,
|
|
1049
|
-
~
|
|
1060
|
+
~authorizationOf,
|
|
1050
1061
|
~commandTransition,
|
|
1051
1062
|
~derivedEdgeFor,
|
|
1052
1063
|
commandSchema,
|
|
@@ -1705,8 +1716,7 @@ let make = (
|
|
|
1705
1716
|
~commandSchema=SCS.Spec.commandSchema->S.castToUnknown,
|
|
1706
1717
|
~variant=variantName,
|
|
1707
1718
|
),
|
|
1708
|
-
~
|
|
1709
|
-
SCS.Spec.commandAuthorization(command->Obj.magic)->Reventless.Authorization.named,
|
|
1719
|
+
~authorizationOf=name => SCS.Spec.authorizationOf(name)->Reventless.Authorization.named,
|
|
1710
1720
|
~commandTransition=SCS.Spec.commandTransition->Obj.magic,
|
|
1711
1721
|
~derivedEdgeFor=derivedEdgeFor(~component=SCS.Spec.name, ...),
|
|
1712
1722
|
SCS.Spec.commandSchema->S.castToUnknown,
|
|
@@ -1740,8 +1750,7 @@ let make = (
|
|
|
1740
1750
|
~aggregate=A.Spec.name,
|
|
1741
1751
|
~command=variantName,
|
|
1742
1752
|
),
|
|
1743
|
-
~
|
|
1744
|
-
A.Spec.commandAuthorization(command->Obj.magic)->Reventless.Authorization.named,
|
|
1753
|
+
~authorizationOf=name => A.Spec.authorizationOf(name)->Reventless.Authorization.named,
|
|
1745
1754
|
~commandTransition=A.Spec.commandTransition->Obj.magic,
|
|
1746
1755
|
~derivedEdgeFor=derivedEdgeFor(~component=A.Spec.name, ...),
|
|
1747
1756
|
A.Spec.commandSchema->S.castToUnknown,
|
|
@@ -1815,17 +1824,15 @@ let make = (
|
|
|
1815
1824
|
targetName: ITS.Spec.targetName,
|
|
1816
1825
|
externalSystem: ITS.Spec.externalSystem,
|
|
1817
1826
|
chapter: chapterOf(ITS.Spec.name),
|
|
1818
|
-
//
|
|
1819
|
-
//
|
|
1827
|
+
// Every role a constructor names: the door's, plus those only the
|
|
1828
|
+
// per-command check reads, which must map to a group all the same.
|
|
1820
1829
|
requiredRoles: ?(
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
->ITS.Spec.commandAuthorization
|
|
1825
|
-
->Reventless.Authorization.named
|
|
1826
|
-
->Reventless.Authorization.rolesOf
|
|
1827
|
-
->Array.map(role => (role :> string))
|
|
1830
|
+
constructorPermissions(
|
|
1831
|
+
~commandSchema=ITS.Spec.commandSchema->S.castToUnknown,
|
|
1832
|
+
~authorizationOf=name => ITS.Spec.authorizationOf(name)->Reventless.Authorization.named,
|
|
1828
1833
|
)
|
|
1834
|
+
->Array.flatMap(Reventless.Authorization.rolesOf)
|
|
1835
|
+
->Array.map(role => (role :> string))
|
|
1829
1836
|
->Set.fromArray
|
|
1830
1837
|
->Set.values
|
|
1831
1838
|
->Array.fromIterator
|
|
@@ -644,6 +644,14 @@ function syntheticCommand(schema, variantName) {
|
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
|
|
647
|
+
function constructorPermissions(commandSchema, authorizationOf) {
|
|
648
|
+
return DcbTag$Reventless.extractAllVariantNames(commandSchema).map(authorizationOf);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function inboundDoorPermission(commandSchema, authorizationOf) {
|
|
652
|
+
return Authorization$Reventless.anyOf(DcbTag$Reventless.extractAllVariantNames(commandSchema).map(authorizationOf));
|
|
653
|
+
}
|
|
654
|
+
|
|
647
655
|
function annotateArgTypes(schema, argTypes) {
|
|
648
656
|
Stdlib_Option.forEach(Stdlib_Option.flatMap(Stdlib_Option.flatMap(Stdlib_JSON.Decode.object(schema), o => o["properties"]), Stdlib_JSON.Decode.object), props => {
|
|
649
657
|
Object.entries(props).forEach(param => {
|
|
@@ -658,7 +666,7 @@ function annotateArgTypes(schema, argTypes) {
|
|
|
658
666
|
return schema;
|
|
659
667
|
}
|
|
660
668
|
|
|
661
|
-
function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, parentSchema,
|
|
669
|
+
function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, parentSchema, authorizationOf, commandTransition, derivedEdgeFor, v) {
|
|
662
670
|
let mkDef = (variantName, properties) => {
|
|
663
671
|
let match = commandLevelAndId(isAggregate, partitionKey, variantName, properties);
|
|
664
672
|
let aggregateIdField = match[1];
|
|
@@ -700,7 +708,7 @@ function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor
|
|
|
700
708
|
let excluded = ApiNoApiHelpers$ReventlessCore.getExcludedVariants(parentSchema);
|
|
701
709
|
apiExposed = excluded !== undefined ? !excluded.has(variantName) : true;
|
|
702
710
|
}
|
|
703
|
-
let rule =
|
|
711
|
+
let rule = authorizationOf(variantName);
|
|
704
712
|
let requiredAccess = accessKeysFor(rule);
|
|
705
713
|
let mutationField = apiExposed ? mutationFieldFor(variantName) : "";
|
|
706
714
|
let jsonSchema = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(apiExposed, mutationField, v);
|
|
@@ -745,12 +753,12 @@ function toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor
|
|
|
745
753
|
}
|
|
746
754
|
}
|
|
747
755
|
|
|
748
|
-
function extractCommandDefs(identityViews, isAggregate, partitionKey, mutationFieldFor,
|
|
756
|
+
function extractCommandDefs(identityViews, isAggregate, partitionKey, mutationFieldFor, authorizationOf, commandTransition, derivedEdgeForOpt, commandSchema) {
|
|
749
757
|
let derivedEdgeFor = derivedEdgeForOpt !== undefined ? derivedEdgeForOpt : param => {};
|
|
750
758
|
if (commandSchema.type === "anyOf") {
|
|
751
|
-
return Stdlib_Array.filterMap(commandSchema.anyOf, v => toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema,
|
|
759
|
+
return Stdlib_Array.filterMap(commandSchema.anyOf, v => toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema, authorizationOf, commandTransition, derivedEdgeFor, v));
|
|
752
760
|
} else {
|
|
753
|
-
return Stdlib_Option.mapOr(toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema,
|
|
761
|
+
return Stdlib_Option.mapOr(toCommandDef(identityViews, isAggregate, partitionKey, mutationFieldFor, commandSchema, authorizationOf, commandTransition, derivedEdgeFor, commandSchema), [], def => [def]);
|
|
754
762
|
}
|
|
755
763
|
}
|
|
756
764
|
|
|
@@ -1218,7 +1226,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
1218
1226
|
let consumed = match$1[1];
|
|
1219
1227
|
return {
|
|
1220
1228
|
name: SCS.Spec.name,
|
|
1221
|
-
commands: extractCommandDefs(identityViews, false, partitionBySlice[SCS.Spec.name], variantName => Api_Naming$ReventlessCore.sliceMutationFieldFor(name, SCS.Spec.name, SCS.Spec.commandSchema, variantName),
|
|
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),
|
|
1222
1230
|
producedEventTypes: produced,
|
|
1223
1231
|
consumedEventTypes: consumed,
|
|
1224
1232
|
linkedViews: linkedSvsFor(produced),
|
|
@@ -1233,7 +1241,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
1233
1241
|
let produced = match[1];
|
|
1234
1242
|
return {
|
|
1235
1243
|
name: A.Spec.name,
|
|
1236
|
-
commands: extractCommandDefs(identityViews, true, undefined, variantName => Api_Naming$ReventlessCore.aggregateMutationField(name, A.Spec.name, variantName),
|
|
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),
|
|
1237
1245
|
producedEventTypes: produced,
|
|
1238
1246
|
consumedEventTypes: [],
|
|
1239
1247
|
linkedViews: linkedSvsFor(produced).concat(linkedReadModelsFor(A.Spec.name)),
|
|
@@ -1268,7 +1276,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
1268
1276
|
targetName: ITS.Spec.targetName,
|
|
1269
1277
|
externalSystem: ITS.Spec.externalSystem,
|
|
1270
1278
|
chapter: componentChapters[ITS.Spec.name],
|
|
1271
|
-
requiredRoles: nonEmpty(Array.from(new Set(DcbTag$Reventless.extractAllVariantNames(ITS.Spec.commandSchema).
|
|
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()))
|
|
1272
1280
|
}));
|
|
1273
1281
|
let tableFailures = [];
|
|
1274
1282
|
let tableWarnings = [];
|
|
@@ -1574,6 +1582,8 @@ export {
|
|
|
1574
1582
|
nonEmpty,
|
|
1575
1583
|
rolesFor,
|
|
1576
1584
|
syntheticCommand,
|
|
1585
|
+
constructorPermissions,
|
|
1586
|
+
inboundDoorPermission,
|
|
1577
1587
|
annotateArgTypes,
|
|
1578
1588
|
toCommandDef,
|
|
1579
1589
|
extractCommandDefs,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
117
|
+
authorizationOf: authorizationOf,
|
|
118
118
|
commandTransition: commandTransition,
|
|
119
119
|
traits: traits
|
|
120
120
|
});
|