@reventlessdev/reventless-core 3.0.0-alpha.306 → 3.0.0-alpha.308
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 +39 -0
- package/package.json +5 -5
- package/src/Projection.res +4 -4
- package/src/Projection.res.mjs +11 -9
- package/src/ResourceAttribution.res +3 -3
- package/src/ResourceAttribution.res.mjs +1 -4
- package/src/adapter/Auth/Auth_ActiveRole.res +13 -18
- package/src/adapter/Auth/Auth_ActiveRole.res.mjs +4 -9
- package/src/adapter/Auth/Auth_UserId.res +24 -0
- package/src/adapter/Auth/Auth_UserId.res.mjs +23 -0
- package/src/adapter/EventLogProvisioning/EventLogProvisioning.res +1 -1
- package/src/adapter/Monitoring/Monitoring.res +5 -5
- package/src/adapter/Stash/Stash_Memory_Backend.res +35 -0
- package/src/adapter/Stash/Stash_Memory_Backend.res.mjs +44 -0
- package/src/adapter/Throttle/AnonymousLimiter.res +37 -0
- package/src/adapter/Throttle/AnonymousLimiter.res.mjs +43 -0
- package/src/admin/Platform_Admin.res +2 -2
- package/src/admin/Platform_Admin_Structure.res +0 -9
- package/src/admin/Platform_Admin_Structure.res.mjs +3 -12
- package/src/admin/Platform_BakedManifest.res +6 -6
- package/src/admin/Platform_BakedManifest.res.mjs +11 -26
- package/src/admin/Platform_PluginStructuresApi.res +36 -2
- package/src/admin/Platform_PluginStructuresApi.res.mjs +43 -1
- package/src/admin/Platform_SelfRegistration.res +54 -0
- package/src/admin/Platform_SelfRegistration.res.mjs +77 -0
- package/src/components/Api/GraphQL_SchemaInspector.res +3 -3
- package/src/components/Api/SuryToJsonSchema.res +3 -3
- package/src/components/Dcb/Dcb_Builder.res +6 -9
- package/src/components/Dcb/Dcb_Builder.res.mjs +0 -3
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +14 -1
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res.mjs +3 -3
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +73 -8
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +60 -12
- package/src/plugin/component/Plugin.res +2 -0
- package/src/plugin/component/Plugin_Builder.res +9 -8
- package/src/plugin/component/Plugin_Builder.res.mjs +6 -10
- package/src/plugin/component/Plugin_Helpers.res +4 -4
- package/src/plugin/component/Plugin_Structure.res +179 -115
- package/src/plugin/component/Plugin_Structure.res.mjs +83 -17
- package/src/plugin/lifecycle/PluginsProjection.res +10 -6
- package/src/plugin/lifecycle/PluginsReadModelSpec.res +8 -8
- package/src/util/FTPHandler.res +3 -3
- package/src/util/ScheduleTime.res +5 -8
- package/src/util/ScheduleTime.res.mjs +0 -3
- package/src/util/Util_Promise.res +1 -1
- package/tests/AnonymousLimiterTest.res +66 -0
- package/tests/AnonymousLimiterTest.res.mjs +89 -0
- package/tests/Auth_UserIdTest.res +24 -0
- package/tests/Auth_UserIdTest.res.mjs +23 -0
- package/tests/ResourceAttributionTest.res +1 -1
- package/tests/ResourceAttributionTest.res.mjs +1 -4
- package/tests/Stash_Memory_BackendTest.res +63 -0
- package/tests/Stash_Memory_BackendTest.res.mjs +98 -0
- package/tests/admin/AdminApiSchemaDriftTest.res +72 -44
- package/tests/admin/AdminApiSchemaDriftTest.res.mjs +41 -3
- package/tests/admin/Platform_Admin_StructureTest.res +1 -1
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +4 -22
- package/tests/admin/Platform_BakedManifestTest.res +11 -29
- package/tests/admin/Platform_BakedManifestTest.res.mjs +8 -39
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +24 -84
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +36 -169
- package/tests/admin/Platform_PluginStructuresApiTest.res +46 -31
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +37 -34
- package/tests/admin/Platform_SelfRegistrationTest.res +70 -0
- package/tests/admin/Platform_SelfRegistrationTest.res.mjs +98 -0
- package/tests/admin/Platform_UIFragmentsApiTest.res +1 -4
- package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +1 -4
- package/tests/api/GeocodingTest.res +1 -1
- package/tests/logger/LogFormatTest.res +0 -2
- package/tests/logger/LogFormatTest.res.mjs +0 -2
- package/tests/message/MessageTest.res +0 -13
- package/tests/message/MessageTest.res.mjs +2 -15
- package/tests/plugin/ManifestVisibilityTest.res.mjs +1 -1
- package/tests/plugin/PluginStructureAccessTest.res +6 -1
- package/tests/plugin/PluginStructureAccessTest.res.mjs +9 -5
- package/tests/plugin/PluginStructureTest.res +99 -23
- package/tests/plugin/PluginStructureTest.res.mjs +123 -79
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +10 -0
|
@@ -620,7 +620,7 @@ let identityReference = (
|
|
|
620
620
|
switch declared {
|
|
621
621
|
| [] =>
|
|
622
622
|
switch keyed {
|
|
623
|
-
| [view] => [(fieldName, {Reventless.Semantic.entity: view,
|
|
623
|
+
| [view] => [(fieldName, {Reventless.Semantic.entity: view, identity: key})]
|
|
624
624
|
| [] =>
|
|
625
625
|
let say =
|
|
626
626
|
identityViews.ownIdentities->Array.includes(key)
|
|
@@ -637,7 +637,7 @@ let identityReference = (
|
|
|
637
637
|
| _ => []
|
|
638
638
|
}
|
|
639
639
|
switch inChapter {
|
|
640
|
-
| [view] => [(fieldName, {Reventless.Semantic.entity: view,
|
|
640
|
+
| [view] => [(fieldName, {Reventless.Semantic.entity: view, identity: key})]
|
|
641
641
|
| _ =>
|
|
642
642
|
identityViews.report(
|
|
643
643
|
`${fieldName} is a ${key}, and ${several->Array.join(
|
|
@@ -690,7 +690,7 @@ let extractReferences = (
|
|
|
690
690
|
targets->Array.map(((path, target)): Reventless.Plugin.fieldReference => {
|
|
691
691
|
Reventless.Plugin.fieldName: path,
|
|
692
692
|
entity: target.entity,
|
|
693
|
-
plugin: target.plugin,
|
|
693
|
+
plugin: ?target.plugin,
|
|
694
694
|
})
|
|
695
695
|
})
|
|
696
696
|
|
|
@@ -757,12 +757,57 @@ let isCreateCommandName = name =>
|
|
|
757
757
|
name->String.startsWith(p)
|
|
758
758
|
)
|
|
759
759
|
|
|
760
|
+
/** Each variant of an event schema by name, with the identity keys its tagged fields carry. */
|
|
761
|
+
let tagKeysByVariant = (schema: S.t<unknown>): array<(string, array<string>)> => {
|
|
762
|
+
let ofVariant = (v: S.t<unknown>) =>
|
|
763
|
+
switch v {
|
|
764
|
+
| Object({properties}) =>
|
|
765
|
+
switch properties->Dict.get("TAG") {
|
|
766
|
+
| Some(String({const: ?Some(name)})) =>
|
|
767
|
+
Some((name, Reventless.DcbTag.tagKeysOfProperties(properties)))
|
|
768
|
+
| _ => None
|
|
769
|
+
}
|
|
770
|
+
| String({const: ?Some(name)}) => Some((name, []))
|
|
771
|
+
| _ => None
|
|
772
|
+
}
|
|
773
|
+
switch schema {
|
|
774
|
+
| AnyOf({anyOf}) => anyOf->Array.filterMap(ofVariant)
|
|
775
|
+
| v => ofVariant(v)->Option.mapOr([], x => [x])
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
Whether a slice's decision creates the row its command names, by what it reads:
|
|
781
|
+
it reads its own events, to refuse doing it twice, and no other event about the
|
|
782
|
+
same identity. `CommissionCharger` reads `ChargerCommissioned` (its own), and
|
|
783
|
+
reading `SiteAdded` too would not change that, as it is about a site; it creates
|
|
784
|
+
the charger, whatever its name says. `RetireCharger` reads `ChargerCommissioned`,
|
|
785
|
+
which is about the charger and not its own: the charger must exist. A decision
|
|
786
|
+
that reads none of its own events says nothing here, and its name decides. Nor
|
|
787
|
+
does one that reads another event whose identity it cannot tell (a payload-less
|
|
788
|
+
`OrderPlaced`): that event may be the row's own history.
|
|
789
|
+
|
|
790
|
+
Answers per identity key, since which of the command's fields is its id is
|
|
791
|
+
settled where the level is.
|
|
792
|
+
*/
|
|
793
|
+
let createsBy = (~produced: S.t<unknown>, ~consumed: S.t<unknown>): (string => bool) => {
|
|
794
|
+
let own = tagKeysByVariant(produced)->Array.map(((name, _)) => name)
|
|
795
|
+
let read = tagKeysByVariant(consumed)
|
|
796
|
+
let readsOwn = read->Array.some(((name, _)) => own->Array.includes(name))
|
|
797
|
+
let foreign = read->Array.filter(((name, _)) => !(own->Array.includes(name)))
|
|
798
|
+
let untold = foreign->Array.some(((_, keys)) => keys == [])
|
|
799
|
+
let foreignKeys = foreign->Array.flatMap(((_, keys)) => keys)
|
|
800
|
+
key => readsOwn && !untold && !(foreignKeys->Array.includes(key))
|
|
801
|
+
}
|
|
802
|
+
|
|
760
803
|
// A slice command's id field is the one carrying its slice's partition key, as the
|
|
761
804
|
// boundary infers it; a `@partitionTag` or the first tagged field stands in only
|
|
762
|
-
// where no key was inferred.
|
|
805
|
+
// where no key was inferred. A slice that creates the row its id names, by what
|
|
806
|
+
// it reads (`createsBy`), is Collection-level as a create-stem name is.
|
|
763
807
|
let commandLevelAndId = (
|
|
764
808
|
~isAggregate,
|
|
765
809
|
~partitionKey: option<string>=?,
|
|
810
|
+
~createsFor: option<string => bool>=?,
|
|
766
811
|
~variantName,
|
|
767
812
|
properties: dict<S.t<unknown>>,
|
|
768
813
|
) =>
|
|
@@ -794,8 +839,9 @@ let commandLevelAndId = (
|
|
|
794
839
|
)
|
|
795
840
|
->Option.orElse(taggedFields->Array.get(0))
|
|
796
841
|
switch taggedField {
|
|
797
|
-
| Some((fieldName, _)) =>
|
|
798
|
-
|
|
842
|
+
| Some((fieldName, _) as field) =>
|
|
843
|
+
let creates = createsFor->Option.mapOr(false, f => f(keyOf(field)))
|
|
844
|
+
if creates || isCreateCommandName(variantName) {
|
|
799
845
|
// Creation command: Collection-level, but UUID is injected into the tagged ID field.
|
|
800
846
|
(Reventless.Plugin.Collection, Some(fieldName))
|
|
801
847
|
} else {
|
|
@@ -868,6 +914,7 @@ let toCommandDef = (
|
|
|
868
914
|
~identityViews: option<identityViews>=?,
|
|
869
915
|
~isAggregate,
|
|
870
916
|
~partitionKey: option<string>=?,
|
|
917
|
+
~createsFor: option<string => bool>=?,
|
|
871
918
|
~mutationFieldFor: string => string,
|
|
872
919
|
~parentSchema: S.t<unknown>,
|
|
873
920
|
// The spec's `authorizationOf`, by constructor name. Per VARIANT, not per
|
|
@@ -898,6 +945,7 @@ let toCommandDef = (
|
|
|
898
945
|
let (guessedLevel, aggregateIdField) = commandLevelAndId(
|
|
899
946
|
~isAggregate,
|
|
900
947
|
~partitionKey?,
|
|
948
|
+
~createsFor?,
|
|
901
949
|
~variantName,
|
|
902
950
|
properties,
|
|
903
951
|
)
|
|
@@ -1000,21 +1048,21 @@ let toCommandDef = (
|
|
|
1000
1048
|
// marker the PPX put on the fields. Also carries `x-reventless-graphql-type`.
|
|
1001
1049
|
schema: annotatedSchema->JSON.stringify,
|
|
1002
1050
|
level,
|
|
1003
|
-
aggregateIdField,
|
|
1051
|
+
?aggregateIdField,
|
|
1004
1052
|
// Empty for a `@noApi` variant: `mutationFieldFor` would resolve it to a
|
|
1005
1053
|
// sibling's field, which reads as callable. Exposed variants are unchanged.
|
|
1006
1054
|
mutationField,
|
|
1007
1055
|
references,
|
|
1008
|
-
allowedStates,
|
|
1009
|
-
targetState,
|
|
1056
|
+
?allowedStates,
|
|
1057
|
+
?targetState,
|
|
1010
1058
|
?allowedStatesSource,
|
|
1011
|
-
apiExposed
|
|
1012
|
-
requiredAccess,
|
|
1059
|
+
apiExposed,
|
|
1060
|
+
?requiredAccess,
|
|
1013
1061
|
requiredRoles: ?rolesFor(rule),
|
|
1014
1062
|
// Resolved from this constructor's own properties, not the union's: two
|
|
1015
1063
|
// commands in one slice can disagree about whether they record an owner,
|
|
1016
1064
|
// and the write path stamps per constructor for the same reason.
|
|
1017
|
-
ownerField: Reventless.Owner.fieldNamesOfProperties(properties)->Array.get(0),
|
|
1065
|
+
ownerField: ?(Reventless.Owner.fieldNamesOfProperties(properties)->Array.get(0)),
|
|
1018
1066
|
}: Reventless.Plugin.commandDef
|
|
1019
1067
|
)
|
|
1020
1068
|
}
|
|
@@ -1041,6 +1089,7 @@ let extractCommandDefs = (
|
|
|
1041
1089
|
~identityViews: option<identityViews>=?,
|
|
1042
1090
|
~isAggregate,
|
|
1043
1091
|
~partitionKey: option<string>=?,
|
|
1092
|
+
~createsFor: option<string => bool>=?,
|
|
1044
1093
|
~mutationFieldFor: string => string,
|
|
1045
1094
|
~authorizationOf: string => Reventless.Authorization.permission,
|
|
1046
1095
|
~commandTransition: unknown => Reventless.Transition.t<string>,
|
|
@@ -1054,6 +1103,7 @@ let extractCommandDefs = (
|
|
|
1054
1103
|
~identityViews?,
|
|
1055
1104
|
~isAggregate,
|
|
1056
1105
|
~partitionKey?,
|
|
1106
|
+
~createsFor?,
|
|
1057
1107
|
~mutationFieldFor,
|
|
1058
1108
|
~parentSchema=commandSchema,
|
|
1059
1109
|
~authorizationOf,
|
|
@@ -1068,6 +1118,7 @@ let extractCommandDefs = (
|
|
|
1068
1118
|
~identityViews?,
|
|
1069
1119
|
~isAggregate,
|
|
1070
1120
|
~partitionKey?,
|
|
1121
|
+
~createsFor?,
|
|
1071
1122
|
~mutationFieldFor,
|
|
1072
1123
|
~parentSchema=commandSchema,
|
|
1073
1124
|
~authorizationOf,
|
|
@@ -1118,18 +1169,18 @@ let readSideDefFromSpec = (
|
|
|
1118
1169
|
linkedWriteSide,
|
|
1119
1170
|
labelField: label.field,
|
|
1120
1171
|
searchableFields: label.searchableFields,
|
|
1121
|
-
labelFieldSource:
|
|
1122
|
-
lifecycleField: lifecycleFieldFromStateSchema(stateSchema),
|
|
1123
|
-
ownerField: Reventless.Owner.fieldNames(stateSchema)->Array.get(0),
|
|
1124
|
-
retiredField: retiredFieldFromStateSchema(stateSchema),
|
|
1125
|
-
retiredValues: retiredValuesFromStateSchema(stateSchema),
|
|
1126
|
-
namedWhenRetired:
|
|
1127
|
-
visibility: visibilityTag(visibility),
|
|
1128
|
-
chapter,
|
|
1129
|
-
singleQueryField:
|
|
1130
|
-
idField: keyField->Option.map(((f, _)) => f),
|
|
1131
|
-
idFieldSource: keyField->Option.map(((_, rung)) => rung),
|
|
1132
|
-
requiredAccess: accessKeysFor(authorization),
|
|
1172
|
+
labelFieldSource: labelFieldSourceToString(label.source),
|
|
1173
|
+
lifecycleField: ?lifecycleFieldFromStateSchema(stateSchema),
|
|
1174
|
+
ownerField: ?(Reventless.Owner.fieldNames(stateSchema)->Array.get(0)),
|
|
1175
|
+
retiredField: ?retiredFieldFromStateSchema(stateSchema),
|
|
1176
|
+
retiredValues: ?retiredValuesFromStateSchema(stateSchema),
|
|
1177
|
+
namedWhenRetired: namedWhenRetiredFromStateSchema(stateSchema),
|
|
1178
|
+
visibility: ?visibilityTag(visibility),
|
|
1179
|
+
?chapter,
|
|
1180
|
+
singleQueryField: qf.singleFieldName,
|
|
1181
|
+
idField: ?(keyField->Option.map(((f, _)) => f)),
|
|
1182
|
+
idFieldSource: ?(keyField->Option.map(((_, rung)) => rung)),
|
|
1183
|
+
requiredAccess: ?accessKeysFor(authorization),
|
|
1133
1184
|
requiredRoles: ?rolesFor(authorization),
|
|
1134
1185
|
}
|
|
1135
1186
|
}
|
|
@@ -1157,6 +1208,10 @@ let make = (
|
|
|
1157
1208
|
// The keys of the identities the plugin declares in its own `src/`, passed by
|
|
1158
1209
|
// the plugin generator. One no view lists is reported as information.
|
|
1159
1210
|
~identities: array<string>=[],
|
|
1211
|
+
// How each role is admitted, from the plugin's `Admission.res` where it has one.
|
|
1212
|
+
~admission: option<Reventless.Admission.t>=?,
|
|
1213
|
+
// The inbound doors marked with the part they play in admission.
|
|
1214
|
+
~admissionDoors: array<(string, Reventless.Admission.door)>=[],
|
|
1160
1215
|
): Reventless.Plugin.pluginStructure => {
|
|
1161
1216
|
let chapterOf = (compName: string): option<string> => componentChapters->Dict.get(compName)
|
|
1162
1217
|
// The harvest compares its own reading of the corpus with the DECLARATION, so
|
|
@@ -1298,12 +1353,10 @@ let make = (
|
|
|
1298
1353
|
field,
|
|
1299
1354
|
// The source text, not a guess: `target.plugin` is `None` exactly when the
|
|
1300
1355
|
// field left the store unqualified, and only here does that survive.
|
|
1301
|
-
annotation:
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
},
|
|
1306
|
-
),
|
|
1356
|
+
annotation: switch target.plugin {
|
|
1357
|
+
| None => target.store
|
|
1358
|
+
| Some(plugin) => plugin ++ "." ++ target.store
|
|
1359
|
+
},
|
|
1307
1360
|
})
|
|
1308
1361
|
)
|
|
1309
1362
|
|
|
@@ -1441,17 +1494,22 @@ let make = (
|
|
|
1441
1494
|
|
|
1442
1495
|
// Capabilities a slice declares its `translate` reaches for. Sorted and
|
|
1443
1496
|
// deduplicated for the same reason the store declarations are: the manifest is
|
|
1444
|
-
// committed, so it must not churn on a re-build.
|
|
1445
|
-
//
|
|
1497
|
+
// committed, so it must not churn on a re-build. Translation slices are the ones
|
|
1498
|
+
// handed `Capabilities.t`, outbound and inbound alike, so only they can declare.
|
|
1499
|
+
let declarationsOf = (~component, needs) =>
|
|
1500
|
+
needs->Array.map((need): Reventless.Plugin.requiredCapabilityDeclaration => {
|
|
1501
|
+
Reventless.Plugin.capability: Reventless.CapabilityNeed.toString(need),
|
|
1502
|
+
component,
|
|
1503
|
+
})
|
|
1446
1504
|
let requiredCapabilities =
|
|
1447
1505
|
outboundTranslationSlices
|
|
1448
1506
|
->Array.flatMap((module(OTS: ReventlessInfra.OutboundTranslationSlice.T)) =>
|
|
1449
|
-
OTS.Spec.capabilityNeeds
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1507
|
+
declarationsOf(~component=OTS.Spec.name, OTS.Spec.capabilityNeeds)
|
|
1508
|
+
)
|
|
1509
|
+
->Array.concat(
|
|
1510
|
+
inboundTranslationSlices->Array.flatMap((
|
|
1511
|
+
module(ITS: ReventlessInfra.InboundTranslationSlice.T),
|
|
1512
|
+
) => declarationsOf(~component=ITS.Spec.name, ITS.Spec.capabilityNeeds)),
|
|
1455
1513
|
)
|
|
1456
1514
|
->Array.toSorted((a, b) =>
|
|
1457
1515
|
a.capability == b.capability
|
|
@@ -1571,23 +1629,23 @@ let make = (
|
|
|
1571
1629
|
linkedWriteSide: linkedWriteSideFor(consumed),
|
|
1572
1630
|
labelField: label.field,
|
|
1573
1631
|
searchableFields: label.searchableFields,
|
|
1574
|
-
labelFieldSource:
|
|
1575
|
-
lifecycleField: lifecycleFieldFromStateSchema(stateSchema),
|
|
1632
|
+
labelFieldSource: labelFieldSourceToString(label.source),
|
|
1633
|
+
lifecycleField: ?lifecycleFieldFromStateSchema(stateSchema),
|
|
1576
1634
|
// Same schema `lifecycleField` reads, so the two cannot disagree about which
|
|
1577
1635
|
// fields this view has.
|
|
1578
|
-
ownerField: Reventless.Owner.fieldNames(stateSchema)->Array.get(0),
|
|
1579
|
-
retiredField: retiredFieldFromStateSchema(stateSchema),
|
|
1580
|
-
retiredValues: retiredValuesFromStateSchema(stateSchema),
|
|
1581
|
-
namedWhenRetired:
|
|
1582
|
-
visibility: visibilityTag(R.Spec.visibility),
|
|
1583
|
-
chapter: chapterOf(R.Spec.name),
|
|
1636
|
+
ownerField: ?(Reventless.Owner.fieldNames(stateSchema)->Array.get(0)),
|
|
1637
|
+
retiredField: ?retiredFieldFromStateSchema(stateSchema),
|
|
1638
|
+
retiredValues: ?retiredValuesFromStateSchema(stateSchema),
|
|
1639
|
+
namedWhenRetired: namedWhenRetiredFromStateSchema(stateSchema),
|
|
1640
|
+
visibility: ?visibilityTag(R.Spec.visibility),
|
|
1641
|
+
chapter: ?chapterOf(R.Spec.name),
|
|
1584
1642
|
// Taken from the `qf` record, never re-derived: `Api_Naming` is the only
|
|
1585
1643
|
// place that decides how `Products`/`Categories` singularise, and the
|
|
1586
1644
|
// point of publishing the name is that a consumer stops guessing it.
|
|
1587
|
-
singleQueryField:
|
|
1588
|
-
idField: keyField->Option.map(((f, _)) => f),
|
|
1589
|
-
idFieldSource: keyField->Option.map(((_, rung)) => rung),
|
|
1590
|
-
requiredAccess: accessKeysFor(R.Spec.authorization->Reventless.Authorization.named),
|
|
1645
|
+
singleQueryField: qf.singleFieldName,
|
|
1646
|
+
idField: ?(keyField->Option.map(((f, _)) => f)),
|
|
1647
|
+
idFieldSource: ?(keyField->Option.map(((_, rung)) => rung)),
|
|
1648
|
+
requiredAccess: ?accessKeysFor(R.Spec.authorization->Reventless.Authorization.named),
|
|
1591
1649
|
requiredRoles: ?rolesFor(R.Spec.authorization->Reventless.Authorization.named),
|
|
1592
1650
|
}: Reventless.Plugin.readSideDef
|
|
1593
1651
|
)
|
|
@@ -1617,18 +1675,18 @@ let make = (
|
|
|
1617
1675
|
linkedWriteSide: linkedWriteSideFor(consumed),
|
|
1618
1676
|
labelField: label.field,
|
|
1619
1677
|
searchableFields: label.searchableFields,
|
|
1620
|
-
labelFieldSource:
|
|
1621
|
-
lifecycleField: lifecycleFieldFromStateSchema(stateSchema),
|
|
1622
|
-
ownerField: Reventless.Owner.fieldNames(stateSchema)->Array.get(0),
|
|
1623
|
-
retiredField: retiredFieldFromStateSchema(stateSchema),
|
|
1624
|
-
retiredValues: retiredValuesFromStateSchema(stateSchema),
|
|
1625
|
-
namedWhenRetired:
|
|
1626
|
-
visibility: visibilityTag(SVS.Spec.visibility),
|
|
1627
|
-
chapter: chapterOf(SVS.Spec.name),
|
|
1628
|
-
singleQueryField:
|
|
1629
|
-
idField: keyField->Option.map(((f, _)) => f),
|
|
1630
|
-
idFieldSource: keyField->Option.map(((_, rung)) => rung),
|
|
1631
|
-
requiredAccess: accessKeysFor(SVS.Spec.authorization->Reventless.Authorization.named),
|
|
1678
|
+
labelFieldSource: labelFieldSourceToString(label.source),
|
|
1679
|
+
lifecycleField: ?lifecycleFieldFromStateSchema(stateSchema),
|
|
1680
|
+
ownerField: ?(Reventless.Owner.fieldNames(stateSchema)->Array.get(0)),
|
|
1681
|
+
retiredField: ?retiredFieldFromStateSchema(stateSchema),
|
|
1682
|
+
retiredValues: ?retiredValuesFromStateSchema(stateSchema),
|
|
1683
|
+
namedWhenRetired: namedWhenRetiredFromStateSchema(stateSchema),
|
|
1684
|
+
visibility: ?visibilityTag(SVS.Spec.visibility),
|
|
1685
|
+
chapter: ?chapterOf(SVS.Spec.name),
|
|
1686
|
+
singleQueryField: qf.singleFieldName,
|
|
1687
|
+
idField: ?(keyField->Option.map(((f, _)) => f)),
|
|
1688
|
+
idFieldSource: ?(keyField->Option.map(((_, rung)) => rung)),
|
|
1689
|
+
requiredAccess: ?accessKeysFor(SVS.Spec.authorization->Reventless.Authorization.named),
|
|
1632
1690
|
requiredRoles: ?rolesFor(SVS.Spec.authorization->Reventless.Authorization.named),
|
|
1633
1691
|
}: Reventless.Plugin.readSideDef
|
|
1634
1692
|
)
|
|
@@ -1724,6 +1782,10 @@ let make = (
|
|
|
1724
1782
|
~identityViews=identityViewsOf(SCS.Spec.name),
|
|
1725
1783
|
~isAggregate=false,
|
|
1726
1784
|
~partitionKey=?partitionBySlice->Dict.get(SCS.Spec.name),
|
|
1785
|
+
~createsFor=createsBy(
|
|
1786
|
+
~produced=SCS.Spec.eventSchema->S.castToUnknown,
|
|
1787
|
+
~consumed=SCS.Spec.consumedEventSchema->S.castToUnknown,
|
|
1788
|
+
),
|
|
1727
1789
|
~mutationFieldFor=variantName =>
|
|
1728
1790
|
Api_Naming.sliceMutationFieldFor(
|
|
1729
1791
|
~plugin=name,
|
|
@@ -1739,13 +1801,13 @@ let make = (
|
|
|
1739
1801
|
producedEventTypes: produced,
|
|
1740
1802
|
consumedEventTypes: consumed,
|
|
1741
1803
|
linkedViews: linkedSvsFor(produced),
|
|
1742
|
-
consistencyRead: consistencyReadFor(consumed),
|
|
1804
|
+
consistencyRead: ?consistencyReadFor(consumed),
|
|
1743
1805
|
events: extractEventDefs(
|
|
1744
1806
|
~identityViews=identityViewsOf(SCS.Spec.name),
|
|
1745
1807
|
SCS.Spec.eventSchema->S.castToUnknown,
|
|
1746
1808
|
),
|
|
1747
1809
|
errors: extractErrorDefs(SCS.Spec.errorSchema->S.castToUnknown),
|
|
1748
|
-
chapter: chapterOf(SCS.Spec.name),
|
|
1810
|
+
chapter: ?chapterOf(SCS.Spec.name),
|
|
1749
1811
|
}: Reventless.Plugin.writeSideDef
|
|
1750
1812
|
)
|
|
1751
1813
|
})
|
|
@@ -1776,13 +1838,12 @@ let make = (
|
|
|
1776
1838
|
producedEventTypes: produced,
|
|
1777
1839
|
consumedEventTypes: [],
|
|
1778
1840
|
linkedViews: Array.concat(linkedSvsFor(produced), linkedReadModelsFor(A.Spec.name)),
|
|
1779
|
-
consistencyRead: None,
|
|
1780
1841
|
events: extractEventDefs(
|
|
1781
1842
|
~identityViews=identityViewsOf(A.Spec.name),
|
|
1782
1843
|
A.Spec.eventSchema->S.castToUnknown,
|
|
1783
1844
|
),
|
|
1784
1845
|
errors: extractErrorDefs(A.Spec.errorSchema->S.castToUnknown),
|
|
1785
|
-
chapter: chapterOf(A.Spec.name),
|
|
1846
|
+
chapter: ?chapterOf(A.Spec.name),
|
|
1786
1847
|
}: Reventless.Plugin.writeSideDef
|
|
1787
1848
|
)
|
|
1788
1849
|
})
|
|
@@ -1810,7 +1871,7 @@ let make = (
|
|
|
1810
1871
|
consumedEventTypes: qualify(~prefix=name, allConsumedVariants),
|
|
1811
1872
|
producedCommandTypes: qualify(~prefix=name, commandVariantNames(AS.Spec.commandSchema)),
|
|
1812
1873
|
targetName: AS.Spec.targetName,
|
|
1813
|
-
chapter: chapterOf(AS.Spec.name),
|
|
1874
|
+
chapter: ?chapterOf(AS.Spec.name),
|
|
1814
1875
|
schedule: ?(
|
|
1815
1876
|
AS.Spec.schedule->Option.map(time =>
|
|
1816
1877
|
time->Reventless.Util_Sury.toJson(Reventless.Schedule.timeSchema)->JSON.stringify
|
|
@@ -1832,13 +1893,13 @@ let make = (
|
|
|
1832
1893
|
~prefix=name,
|
|
1833
1894
|
commandVariantNames(OTS.Spec.inboundCommandSchema),
|
|
1834
1895
|
),
|
|
1835
|
-
targetName: OTS.Spec.targetName,
|
|
1836
|
-
externalSystem: OTS.Spec.externalSystem,
|
|
1837
|
-
chapter: chapterOf(OTS.Spec.name),
|
|
1896
|
+
targetName: ?OTS.Spec.targetName,
|
|
1897
|
+
externalSystem: ?OTS.Spec.externalSystem,
|
|
1898
|
+
chapter: ?chapterOf(OTS.Spec.name),
|
|
1838
1899
|
// Published verbatim, `[]` included: `[]` is the declared default meaning
|
|
1839
1900
|
// this plugin's own DCB log, and resolving it here to a derived name would
|
|
1840
1901
|
// be a second place that name is spelled.
|
|
1841
|
-
consumedSources:
|
|
1902
|
+
consumedSources: OTS.Spec.sourceNames,
|
|
1842
1903
|
})
|
|
1843
1904
|
|
|
1844
1905
|
// ── Inbound translation slices ────────────────────────────────────────────
|
|
@@ -1850,8 +1911,8 @@ let make = (
|
|
|
1850
1911
|
Reventless.Plugin.name: ITS.Spec.name,
|
|
1851
1912
|
commandTypes: qualify(~prefix=name, commandVariantNames(ITS.Spec.commandSchema)),
|
|
1852
1913
|
targetName: ITS.Spec.targetName,
|
|
1853
|
-
externalSystem: ITS.Spec.externalSystem,
|
|
1854
|
-
chapter: chapterOf(ITS.Spec.name),
|
|
1914
|
+
externalSystem: ?ITS.Spec.externalSystem,
|
|
1915
|
+
chapter: ?chapterOf(ITS.Spec.name),
|
|
1855
1916
|
// Every role a constructor names: the door's, plus those only the
|
|
1856
1917
|
// per-command check reads, which must map to a group all the same.
|
|
1857
1918
|
requiredRoles: ?(
|
|
@@ -1953,22 +2014,18 @@ let make = (
|
|
|
1953
2014
|
delegateNames,
|
|
1954
2015
|
eventTypes: qualify(~prefix=E.Spec.name, eventVariantNames(E.Spec.eventSchema)),
|
|
1955
2016
|
commandTypes: qualify(~prefix=E.Spec.name, commandVariantNames(E.Spec.commandSchema)),
|
|
1956
|
-
handledEvents:
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
Reventless.Plugin.name: commandName,
|
|
1969
|
-
fromEventTypes: dedupe(evs),
|
|
1970
|
-
}),
|
|
1971
|
-
),
|
|
2017
|
+
handledEvents: commandsByEvent
|
|
2018
|
+
->Dict.toArray
|
|
2019
|
+
->Array.map(((eventName, cmds)): Reventless.Plugin.handledEventDef => {
|
|
2020
|
+
Reventless.Plugin.name: eventName,
|
|
2021
|
+
toCommandTypes: dedupe(cmds),
|
|
2022
|
+
}),
|
|
2023
|
+
issuedCommands: eventsByCommand
|
|
2024
|
+
->Dict.toArray
|
|
2025
|
+
->Array.map(((commandName, evs)): Reventless.Plugin.issuedCommandDef => {
|
|
2026
|
+
Reventless.Plugin.name: commandName,
|
|
2027
|
+
fromEventTypes: dedupe(evs),
|
|
2028
|
+
}),
|
|
1972
2029
|
}: Reventless.Plugin.extensionDef
|
|
1973
2030
|
)
|
|
1974
2031
|
})
|
|
@@ -2224,27 +2281,23 @@ let make = (
|
|
|
2224
2281
|
Reventless.Plugin.name: epName,
|
|
2225
2282
|
delegateNames: dedupe(dels),
|
|
2226
2283
|
sourceEventTypes: dedupe(evs),
|
|
2227
|
-
commandTypes:
|
|
2228
|
-
publishedEvents:
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
)
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
Reventless.Plugin.name: accepted,
|
|
2245
|
-
toCommandTypes: dedupe(routed),
|
|
2246
|
-
}),
|
|
2247
|
-
),
|
|
2284
|
+
commandTypes: dedupe(cmds),
|
|
2285
|
+
publishedEvents: epPublished
|
|
2286
|
+
->Dict.get(epName)
|
|
2287
|
+
->Option.getOr(Dict.make())
|
|
2288
|
+
->Dict.toArray
|
|
2289
|
+
->Array.map(((published, sources)): Reventless.Plugin.publishedEventDef => {
|
|
2290
|
+
Reventless.Plugin.name: published,
|
|
2291
|
+
fromEventTypes: dedupe(sources),
|
|
2292
|
+
}),
|
|
2293
|
+
acceptedCommands: epAccepted
|
|
2294
|
+
->Dict.get(epName)
|
|
2295
|
+
->Option.getOr(Dict.make())
|
|
2296
|
+
->Dict.toArray
|
|
2297
|
+
->Array.map(((accepted, routed)): Reventless.Plugin.acceptedCommandDef => {
|
|
2298
|
+
Reventless.Plugin.name: accepted,
|
|
2299
|
+
toCommandTypes: dedupe(routed),
|
|
2300
|
+
}),
|
|
2248
2301
|
})
|
|
2249
2302
|
|
|
2250
2303
|
// Dead inbound surface, judged only after every mapping on an EP has been seen:
|
|
@@ -2301,10 +2354,21 @@ let make = (
|
|
|
2301
2354
|
outboundTranslationSlices: outboundTranslationSliceDefs,
|
|
2302
2355
|
inboundTranslationSlices: inboundTranslationSliceDefs,
|
|
2303
2356
|
extensions: extensionDefs,
|
|
2304
|
-
extensionPoints:
|
|
2305
|
-
requiredStores
|
|
2306
|
-
requiredStoreDeclarations
|
|
2307
|
-
traitDeclarations
|
|
2308
|
-
requiredCapabilities
|
|
2357
|
+
extensionPoints: extensionPointDefs,
|
|
2358
|
+
requiredStores,
|
|
2359
|
+
requiredStoreDeclarations,
|
|
2360
|
+
traitDeclarations,
|
|
2361
|
+
requiredCapabilities,
|
|
2362
|
+
admission: ?(admission->Option.map(Reventless.Admission.toDefs)),
|
|
2363
|
+
admissionDoors: ?switch admissionDoors {
|
|
2364
|
+
| [] => None
|
|
2365
|
+
| doors =>
|
|
2366
|
+
Some(
|
|
2367
|
+
doors->Array.map(((component, door)): Reventless.Admission.doorDef => {
|
|
2368
|
+
component,
|
|
2369
|
+
part: Reventless.Admission.doorName(door),
|
|
2370
|
+
}),
|
|
2371
|
+
)
|
|
2372
|
+
},
|
|
2309
2373
|
}
|
|
2310
2374
|
}
|