@reventlessdev/reventless-core 3.0.0-alpha.307 → 3.0.0-alpha.309
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 +7 -7
- 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/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 +79 -0
- package/src/admin/Platform_SelfRegistration.res.mjs +95 -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/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 +91 -0
- package/tests/admin/Platform_SelfRegistrationTest.res.mjs +112 -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
|
@@ -17,6 +17,10 @@ type auditRow = {
|
|
|
17
17
|
receivedAt: string,
|
|
18
18
|
/** Absent on rows written before the slice had a second door. */
|
|
19
19
|
door?: ReventlessInfra.InboundTranslationSlice.door,
|
|
20
|
+
/** Who called the door: their `userId`, `anonymous` for a caller who is not
|
|
21
|
+
signed in. Absent where the platform acted for itself, and on rows written
|
|
22
|
+
before doors were handed their caller. */
|
|
23
|
+
caller?: string,
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/** A refused caller is access, a failed publish the platform; anything else is
|
|
@@ -104,6 +108,44 @@ let checkReachable = (~plugin: string, ~slice: string, ~mutation: bool, ~webhook
|
|
|
104
108
|
)
|
|
105
109
|
}
|
|
106
110
|
|
|
111
|
+
/** What an audit row holds in place of a sensitive value. */
|
|
112
|
+
let withheld = JSON.String("[withheld]")
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
The input as an audit row may hold it: every field `externalInput` marks
|
|
116
|
+
`@sensitive` replaced by [withheld].
|
|
117
|
+
|
|
118
|
+
The row is stored, and readable by operators, so a password a registration door
|
|
119
|
+
receives would otherwise sit there for as long as the row does. Redacted by the
|
|
120
|
+
field names the schema declares rather than by guessing at values, and on the raw
|
|
121
|
+
JSON rather than the decoded input, so a request that failed to decode is
|
|
122
|
+
redacted all the same.
|
|
123
|
+
*/
|
|
124
|
+
let redactInput = (inputJson: JSON.t, ~sensitive: array<string>): JSON.t =>
|
|
125
|
+
switch inputJson {
|
|
126
|
+
| Object(fields) if sensitive != [] =>
|
|
127
|
+
fields
|
|
128
|
+
->Dict.toArray
|
|
129
|
+
->Array.map(((name, value)) => (name, sensitive->Array.includes(name) ? withheld : value))
|
|
130
|
+
->Dict.fromArray
|
|
131
|
+
->JSON.Object
|
|
132
|
+
| other => other
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
A raw body as an audit row may hold it. A body that does not parse cannot be
|
|
137
|
+
redacted field by field, so a slice with sensitive fields keeps none of it.
|
|
138
|
+
*/
|
|
139
|
+
let redactBody = (body: string, ~sensitive: array<string>): string =>
|
|
140
|
+
switch sensitive {
|
|
141
|
+
| [] => body
|
|
142
|
+
| _ =>
|
|
143
|
+
switch JSON.parseOrThrow(body) {
|
|
144
|
+
| json => json->redactInput(~sensitive)->JSON.stringify
|
|
145
|
+
| exception _ => "[withheld: unreadable, and this input carries sensitive fields]"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
107
149
|
module type T = {
|
|
108
150
|
module Spec: Reventless.InboundTranslationSlice.Spec
|
|
109
151
|
module Translation: Reventless.InboundTranslationSlice.Translation with module Spec := Spec
|
|
@@ -115,6 +157,7 @@ module type T = {
|
|
|
115
157
|
let receive: (
|
|
116
158
|
ReventlessInfra.CommandTopic.publishJsons,
|
|
117
159
|
JSON.t,
|
|
160
|
+
~capabilities: Reventless.Capabilities.t,
|
|
118
161
|
~caller: Reventless.Identity.t=?,
|
|
119
162
|
~door: ReventlessInfra.InboundTranslationSlice.door=?,
|
|
120
163
|
) => promise<ReventlessInfra.InboundTranslationSlice.receiveResult>
|
|
@@ -139,6 +182,8 @@ module Make = (
|
|
|
139
182
|
|
|
140
183
|
let auditLog: Dict.t<auditRow> = Dict.make()
|
|
141
184
|
|
|
185
|
+
let sensitive = Reventless.Sensitive.fieldNames(Spec.externalInputSchema->S.castToUnknown)
|
|
186
|
+
|
|
142
187
|
let now = () => Date.make()->Date.toISOString
|
|
143
188
|
|
|
144
189
|
// External input has no upstream meta, so each command starts a correlation
|
|
@@ -149,22 +194,23 @@ module Make = (
|
|
|
149
194
|
exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr(fallback)
|
|
150
195
|
|
|
151
196
|
// One audit row per request, whatever the outcome.
|
|
152
|
-
let failWith = (~requestId, ~input, ~door, ~errorCode=?, error) => {
|
|
153
|
-
auditLog->Dict.set(requestId, {input, status: Failure, error, receivedAt: now(), door})
|
|
197
|
+
let failWith = (~requestId, ~input, ~door, ~caller=?, ~errorCode=?, error) => {
|
|
198
|
+
auditLog->Dict.set(requestId, {input, status: Failure, error, receivedAt: now(), door, ?caller})
|
|
154
199
|
Error({ReventlessInfra.InboundTranslationSlice.requestId, error, ?errorCode})
|
|
155
200
|
}
|
|
156
201
|
|
|
157
|
-
let succeed = (~requestId, ~inputJson, ~door, targetIds) => {
|
|
202
|
+
let succeed = (~requestId, ~inputJson, ~door, ~caller=?, targetIds) => {
|
|
158
203
|
let commandCount = targetIds->Array.length
|
|
159
204
|
auditLog->Dict.set(
|
|
160
205
|
requestId,
|
|
161
206
|
{
|
|
162
|
-
input: inputJson->JSON.stringify,
|
|
207
|
+
input: inputJson->redactInput(~sensitive)->JSON.stringify,
|
|
163
208
|
status: Success,
|
|
164
209
|
targetIds,
|
|
165
210
|
commandCount,
|
|
166
211
|
receivedAt: now(),
|
|
167
212
|
door,
|
|
213
|
+
?caller,
|
|
168
214
|
},
|
|
169
215
|
)
|
|
170
216
|
Ok({ReventlessInfra.InboundTranslationSlice.requestId, targetIds, commandCount})
|
|
@@ -191,13 +237,22 @@ module Make = (
|
|
|
191
237
|
let receive = async (
|
|
192
238
|
publishJsons: ReventlessInfra.CommandTopic.publishJsons,
|
|
193
239
|
inputJson: JSON.t,
|
|
240
|
+
~capabilities: Reventless.Capabilities.t,
|
|
194
241
|
~caller: option<Reventless.Identity.t>=?,
|
|
195
242
|
~door: ReventlessInfra.InboundTranslationSlice.door=Mutation,
|
|
196
243
|
): ReventlessInfra.InboundTranslationSlice.receiveResult => {
|
|
197
244
|
let requestId = Uuid.v4()
|
|
245
|
+
let callerId = caller->Option.map(identity => identity.userId)
|
|
198
246
|
let fail = (~errorCode=?, error) =>
|
|
199
|
-
failWith(
|
|
200
|
-
|
|
247
|
+
failWith(
|
|
248
|
+
~requestId,
|
|
249
|
+
~input=inputJson->redactInput(~sensitive)->JSON.stringify,
|
|
250
|
+
~door,
|
|
251
|
+
~caller=?callerId,
|
|
252
|
+
~errorCode?,
|
|
253
|
+
error,
|
|
254
|
+
)
|
|
255
|
+
let succeed = succeed(~requestId, ~inputJson, ~door, ~caller=?callerId, ...)
|
|
201
256
|
let parsed = try Ok(inputJson->S.parseOrThrow(~to=Spec.externalInputSchema)) catch {
|
|
202
257
|
| exn => Error(messageOf(exn, "invalid input"))
|
|
203
258
|
}
|
|
@@ -205,7 +260,11 @@ module Make = (
|
|
|
205
260
|
switch parsed {
|
|
206
261
|
| Error(msg) => fail(msg)
|
|
207
262
|
| Ok(input) =>
|
|
208
|
-
|
|
263
|
+
// A throw is the translation failing, not the platform: it is the input's
|
|
264
|
+
// answer, recorded like any other refusal.
|
|
265
|
+
switch try await Translation.translate(input, ~capabilities, ~caller) catch {
|
|
266
|
+
| exn => Error(messageOf(exn, "translate failed"))
|
|
267
|
+
} {
|
|
209
268
|
| Error(msg) => fail(msg)
|
|
210
269
|
| Ok(pairs) =>
|
|
211
270
|
switch pairs->Array.reduce(Ok([]), (acc, pair) =>
|
|
@@ -250,7 +309,13 @@ module Make = (
|
|
|
250
309
|
}
|
|
251
310
|
|
|
252
311
|
let refuse = (~body, ~errorCode, error) =>
|
|
253
|
-
failWith(
|
|
312
|
+
failWith(
|
|
313
|
+
~requestId=Uuid.v4(),
|
|
314
|
+
~input=body->redactBody(~sensitive),
|
|
315
|
+
~door=Webhook,
|
|
316
|
+
~errorCode,
|
|
317
|
+
error,
|
|
318
|
+
)
|
|
254
319
|
|
|
255
320
|
let webhook =
|
|
256
321
|
Spec.endpoint->Option.map(endpoint =>
|
|
@@ -8,10 +8,12 @@ import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
|
8
8
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
10
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
11
|
+
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
11
12
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
12
13
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
13
14
|
import * as Identity$Reventless from "@reventlessdev/reventless-spec/src/types/Identity.res.mjs";
|
|
14
15
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
16
|
+
import * as Sensitive$Reventless from "@reventlessdev/reventless-spec/src/components/Sensitive.res.mjs";
|
|
15
17
|
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
16
18
|
import * as OwnerScope$Reventless from "@reventlessdev/reventless-spec/src/types/OwnerScope.res.mjs";
|
|
17
19
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
@@ -34,7 +36,8 @@ let auditRowSchema = Sury.$schema(s => ({
|
|
|
34
36
|
commandCount: s.m(Sury.$option(Sury.int32)),
|
|
35
37
|
error: s.m(Sury.$option(Sury.string)),
|
|
36
38
|
receivedAt: s.m(Sury.string),
|
|
37
|
-
door: s.m(Sury.$option(InboundTranslationSlice$ReventlessInfra.doorSchema))
|
|
39
|
+
door: s.m(Sury.$option(InboundTranslationSlice$ReventlessInfra.doorSchema)),
|
|
40
|
+
caller: s.m(Sury.$option(Sury.string))
|
|
38
41
|
}));
|
|
39
42
|
|
|
40
43
|
function rejectionCauseOf(errorCode) {
|
|
@@ -115,18 +118,49 @@ function checkReachable(plugin, slice, mutation, webhook) {
|
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
120
|
|
|
121
|
+
let withheld = "[withheld]";
|
|
122
|
+
|
|
123
|
+
function redactInput(inputJson, sensitive) {
|
|
124
|
+
if (typeof inputJson === "object" && inputJson !== null && !Array.isArray(inputJson) && Primitive_object.notequal(sensitive, [])) {
|
|
125
|
+
return Object.fromEntries(Object.entries(inputJson).map(param => {
|
|
126
|
+
let name = param[0];
|
|
127
|
+
return [
|
|
128
|
+
name,
|
|
129
|
+
sensitive.includes(name) ? withheld : param[1]
|
|
130
|
+
];
|
|
131
|
+
}));
|
|
132
|
+
} else {
|
|
133
|
+
return inputJson;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function redactBody(body, sensitive) {
|
|
138
|
+
if (sensitive.length === 0) {
|
|
139
|
+
return body;
|
|
140
|
+
}
|
|
141
|
+
let json;
|
|
142
|
+
try {
|
|
143
|
+
json = JSON.parse(body);
|
|
144
|
+
} catch (exn) {
|
|
145
|
+
return "[withheld: unreadable, and this input carries sensitive fields]";
|
|
146
|
+
}
|
|
147
|
+
return JSON.stringify(redactInput(json, sensitive));
|
|
148
|
+
}
|
|
149
|
+
|
|
118
150
|
function Make(Spec) {
|
|
119
151
|
return Translation => {
|
|
120
152
|
let auditLog = {};
|
|
153
|
+
let sensitive = Sensitive$Reventless.fieldNames(Spec.externalInputSchema);
|
|
121
154
|
let makeMeta = () => Message$ReventlessCore.generateMeta(Spec.targetName, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
122
155
|
let messageOf = (exn, fallback) => Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), fallback);
|
|
123
|
-
let failWith = (requestId, input, door, errorCode, error) => {
|
|
156
|
+
let failWith = (requestId, input, door, caller, errorCode, error) => {
|
|
124
157
|
auditLog[requestId] = {
|
|
125
158
|
input: input,
|
|
126
159
|
status: "Failure",
|
|
127
160
|
error: error,
|
|
128
161
|
receivedAt: new Date().toISOString(),
|
|
129
|
-
door: door
|
|
162
|
+
door: door,
|
|
163
|
+
caller: caller
|
|
130
164
|
};
|
|
131
165
|
return {
|
|
132
166
|
TAG: "Error",
|
|
@@ -156,19 +190,21 @@ function Make(Spec) {
|
|
|
156
190
|
};
|
|
157
191
|
}
|
|
158
192
|
};
|
|
159
|
-
let receive = async (publishJsons, inputJson, caller, doorOpt) => {
|
|
193
|
+
let receive = async (publishJsons, inputJson, capabilities, caller, doorOpt) => {
|
|
160
194
|
let door = doorOpt !== undefined ? doorOpt : "Mutation";
|
|
161
195
|
let requestId = Uuid.v4();
|
|
162
|
-
let
|
|
196
|
+
let callerId = Stdlib_Option.map(caller, identity => identity.userId);
|
|
197
|
+
let fail = (errorCode, error) => failWith(requestId, JSON.stringify(redactInput(inputJson, sensitive)), door, callerId, errorCode, error);
|
|
163
198
|
let succeed = extra => {
|
|
164
199
|
let commandCount = extra.length;
|
|
165
200
|
auditLog[requestId] = {
|
|
166
|
-
input: JSON.stringify(inputJson),
|
|
201
|
+
input: JSON.stringify(redactInput(inputJson, sensitive)),
|
|
167
202
|
status: "Success",
|
|
168
203
|
targetIds: extra,
|
|
169
204
|
commandCount: commandCount,
|
|
170
205
|
receivedAt: new Date().toISOString(),
|
|
171
|
-
door: door
|
|
206
|
+
door: door,
|
|
207
|
+
caller: callerId
|
|
172
208
|
};
|
|
173
209
|
return {
|
|
174
210
|
TAG: "Ok",
|
|
@@ -195,7 +231,16 @@ function Make(Spec) {
|
|
|
195
231
|
if (parsed.TAG !== "Ok") {
|
|
196
232
|
return fail(undefined, parsed._0);
|
|
197
233
|
}
|
|
198
|
-
let msg
|
|
234
|
+
let msg;
|
|
235
|
+
try {
|
|
236
|
+
msg = await Translation.translate(parsed._0, capabilities, caller);
|
|
237
|
+
} catch (raw_exn$1) {
|
|
238
|
+
let exn$1 = Primitive_exceptions.internalToException(raw_exn$1);
|
|
239
|
+
msg = {
|
|
240
|
+
TAG: "Error",
|
|
241
|
+
_0: messageOf(exn$1, "translate failed")
|
|
242
|
+
};
|
|
243
|
+
}
|
|
199
244
|
if (msg.TAG !== "Ok") {
|
|
200
245
|
return fail(undefined, msg._0);
|
|
201
246
|
}
|
|
@@ -234,12 +279,12 @@ function Make(Spec) {
|
|
|
234
279
|
try {
|
|
235
280
|
await publishJsons(msgs);
|
|
236
281
|
return succeed(pairs.map(param => param[0]));
|
|
237
|
-
} catch (raw_exn$
|
|
238
|
-
let exn$
|
|
239
|
-
return fail(CommandOutcome$Reventless.code("PublishFailed"), messageOf(exn$
|
|
282
|
+
} catch (raw_exn$2) {
|
|
283
|
+
let exn$2 = Primitive_exceptions.internalToException(raw_exn$2);
|
|
284
|
+
return fail(CommandOutcome$Reventless.code("PublishFailed"), messageOf(exn$2, "publish failed"));
|
|
240
285
|
}
|
|
241
286
|
};
|
|
242
|
-
let refuse = (body, errorCode, error) => failWith(Uuid.v4(), body, "Webhook", errorCode, error);
|
|
287
|
+
let refuse = (body, errorCode, error) => failWith(Uuid.v4(), redactBody(body, sensitive), "Webhook", undefined, errorCode, error);
|
|
243
288
|
let webhook = Stdlib_Option.map(Spec.endpoint, endpoint => InboundTranslationSlice_Webhook$ReventlessCore.routeOf(Spec.name, endpoint));
|
|
244
289
|
return {
|
|
245
290
|
Spec: Spec,
|
|
@@ -262,6 +307,9 @@ export {
|
|
|
262
307
|
doorCaller,
|
|
263
308
|
exposesMutation,
|
|
264
309
|
checkReachable,
|
|
310
|
+
withheld,
|
|
311
|
+
redactInput,
|
|
312
|
+
redactBody,
|
|
265
313
|
Make,
|
|
266
314
|
}
|
|
267
315
|
/* auditStatusSchema Not a pure module */
|
|
@@ -56,6 +56,8 @@ module type T = {
|
|
|
56
56
|
~componentChapters: dict<string>=?,
|
|
57
57
|
~lifecycleModel: array<Reventless.Plugin.derivedEdge>=?,
|
|
58
58
|
~identities: array<string>=?,
|
|
59
|
+
~admission: Reventless.Admission.t=?,
|
|
60
|
+
~admissionDoors: array<(string, Reventless.Admission.door)>=?,
|
|
59
61
|
) => Reventless.Plugin.pluginStructure
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -819,9 +819,9 @@ module Make = (
|
|
|
819
819
|
eventCollector: eventCollectorUrn,
|
|
820
820
|
extensionProtocols: [],
|
|
821
821
|
apiSchemaFragment: Some(apiSchemaFragmentPayload),
|
|
822
|
-
apiTarget:
|
|
822
|
+
apiTarget: capturedDeployTarget,
|
|
823
823
|
structure: structurePayload,
|
|
824
|
-
dcbEventLog: dcbEventLogDef,
|
|
824
|
+
dcbEventLog: ?dcbEventLogDef,
|
|
825
825
|
// Business role from the deploy-time metadata registry (set via
|
|
826
826
|
// registerPluginMetadata). Unset → Domain. Rides the handshake to the
|
|
827
827
|
// plugin-lifecycle projection so the admin can segregate infrastructure.
|
|
@@ -992,8 +992,8 @@ module Make = (
|
|
|
992
992
|
tasks: tasksOutputs->Array.map(el => (el.name, el))->Dict.fromArray,
|
|
993
993
|
resolvers,
|
|
994
994
|
heartbeat: heartbeat->Component.outputs,
|
|
995
|
-
dcbEventLog: dcbResult.dcbEventLogOutputs,
|
|
996
|
-
uiFragments: (uiFragments: option<Reventless.Plugin.uiFragmentManifest>),
|
|
995
|
+
dcbEventLog: ?dcbResult.dcbEventLogOutputs,
|
|
996
|
+
uiFragments: ?(uiFragments: option<Reventless.Plugin.uiFragmentManifest>),
|
|
997
997
|
}
|
|
998
998
|
})
|
|
999
999
|
}
|
|
@@ -1065,20 +1065,17 @@ module Make = (
|
|
|
1065
1065
|
title: q.name,
|
|
1066
1066
|
description: "",
|
|
1067
1067
|
positions: readModelPositions,
|
|
1068
|
-
requiredAccess: None,
|
|
1069
1068
|
}
|
|
1070
1069
|
let detailPanel = (w: Reventless.Plugin.writeSideDef): Reventless.Plugin.panelManifestEntry => {
|
|
1071
1070
|
fragmentId: name ++ "." ++ w.name ++ ".detail",
|
|
1072
1071
|
title: w.name,
|
|
1073
1072
|
description: "",
|
|
1074
1073
|
positions: aggregatePositions,
|
|
1075
|
-
requiredAccess: None,
|
|
1076
1074
|
}
|
|
1077
1075
|
let listPage = (q: Reventless.Plugin.readSideDef): Reventless.Plugin.pageManifestEntry => {
|
|
1078
1076
|
fragmentId: name ++ "." ++ q.name ++ ".list",
|
|
1079
1077
|
title: q.name,
|
|
1080
|
-
menuEntry: {label: q.name,
|
|
1081
|
-
requiredAccess: None,
|
|
1078
|
+
menuEntry: {label: q.name, sortOrder: 0},
|
|
1082
1079
|
}
|
|
1083
1080
|
let panels = Array.flat([
|
|
1084
1081
|
visibleReadModels->Array.map(listPanel),
|
|
@@ -1109,6 +1106,8 @@ module Make = (
|
|
|
1109
1106
|
~componentChapters: dict<string>=Dict.make(),
|
|
1110
1107
|
~lifecycleModel: array<Reventless.Plugin.derivedEdge>=[],
|
|
1111
1108
|
~identities: array<string>=[],
|
|
1109
|
+
~admission: option<Reventless.Admission.t>=?,
|
|
1110
|
+
~admissionDoors: array<(string, Reventless.Admission.door)>=[],
|
|
1112
1111
|
): Reventless.Plugin.pluginStructure =>
|
|
1113
1112
|
Plugin_Structure.make(
|
|
1114
1113
|
~name,
|
|
@@ -1124,6 +1123,8 @@ module Make = (
|
|
|
1124
1123
|
~componentChapters,
|
|
1125
1124
|
~lifecycleModel,
|
|
1126
1125
|
~identities,
|
|
1126
|
+
~admission?,
|
|
1127
|
+
~admissionDoors,
|
|
1127
1128
|
)
|
|
1128
1129
|
|
|
1129
1130
|
let make = (
|
|
@@ -61,26 +61,21 @@ function Make(Spec) {
|
|
|
61
61
|
fragmentId: name + "." + q.name + ".list",
|
|
62
62
|
title: q.name,
|
|
63
63
|
description: "",
|
|
64
|
-
positions: readModelPositions
|
|
65
|
-
requiredAccess: undefined
|
|
64
|
+
positions: readModelPositions
|
|
66
65
|
});
|
|
67
66
|
let detailPanel = w => ({
|
|
68
67
|
fragmentId: name + "." + w.name + ".detail",
|
|
69
68
|
title: w.name,
|
|
70
69
|
description: "",
|
|
71
|
-
positions: aggregatePositions
|
|
72
|
-
requiredAccess: undefined
|
|
70
|
+
positions: aggregatePositions
|
|
73
71
|
});
|
|
74
72
|
let listPage = q => ({
|
|
75
73
|
fragmentId: name + "." + q.name + ".list",
|
|
76
74
|
title: q.name,
|
|
77
75
|
menuEntry: {
|
|
78
76
|
label: q.name,
|
|
79
|
-
icon: undefined,
|
|
80
|
-
group: undefined,
|
|
81
77
|
sortOrder: 0
|
|
82
|
-
}
|
|
83
|
-
requiredAccess: undefined
|
|
78
|
+
}
|
|
84
79
|
});
|
|
85
80
|
let panels = [
|
|
86
81
|
visibleReadModels.map(listPanel),
|
|
@@ -98,7 +93,7 @@ function Make(Spec) {
|
|
|
98
93
|
pages: pages
|
|
99
94
|
};
|
|
100
95
|
};
|
|
101
|
-
let makePluginDefinition = (name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChangeSlicesOpt, automationSlicesOpt, outboundTranslationSlicesOpt, inboundTranslationSlicesOpt, extensionsOpt, extensionPointsOpt, componentChaptersOpt, lifecycleModelOpt, identitiesOpt) => {
|
|
96
|
+
let makePluginDefinition = (name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChangeSlicesOpt, automationSlicesOpt, outboundTranslationSlicesOpt, inboundTranslationSlicesOpt, extensionsOpt, extensionPointsOpt, componentChaptersOpt, lifecycleModelOpt, identitiesOpt, admission, admissionDoorsOpt) => {
|
|
102
97
|
let aggregates = aggregatesOpt !== undefined ? aggregatesOpt : [];
|
|
103
98
|
let readModels = readModelsOpt !== undefined ? readModelsOpt : [];
|
|
104
99
|
let stateViewSlices = stateViewSlicesOpt !== undefined ? stateViewSlicesOpt : [];
|
|
@@ -111,7 +106,8 @@ function Make(Spec) {
|
|
|
111
106
|
let componentChapters = componentChaptersOpt !== undefined ? componentChaptersOpt : ({});
|
|
112
107
|
let lifecycleModel = lifecycleModelOpt !== undefined ? lifecycleModelOpt : [];
|
|
113
108
|
let identities = identitiesOpt !== undefined ? identitiesOpt : [];
|
|
114
|
-
|
|
109
|
+
let admissionDoors = admissionDoorsOpt !== undefined ? admissionDoorsOpt : [];
|
|
110
|
+
return Plugin_Structure$ReventlessCore.make(name, aggregates, readModels, stateViewSlices, stateChangeSlices, automationSlices, outboundTranslationSlices, inboundTranslationSlices, extensions, extensionPoints, componentChapters, lifecycleModel, identities, admission, admissionDoors);
|
|
115
111
|
};
|
|
116
112
|
let make = (name, heartbeatInterval, extensionPointsOpt, extensionsOpt, aggregatesOpt, readModelsOpt, tasksOpt, stateChangeSlicesOpt, stateViewSlicesOpt, automationSlicesOpt, outboundTranslationSlicesOpt, inboundTranslationSlicesOpt, systemCallableComponentsOpt, componentRuntimeOpt, uiFragments, pluginStructure, opts) => {
|
|
117
113
|
let extensionPoints = extensionPointsOpt !== undefined ? extensionPointsOpt : [];
|
|
@@ -27,8 +27,8 @@ type builderOutputs = {
|
|
|
27
27
|
tasks: dict<Task.outputs>,
|
|
28
28
|
resolvers: array<ReventlessInfra.Adapter.resource>,
|
|
29
29
|
heartbeat: Heartbeat.outputs,
|
|
30
|
-
dcbEventLog
|
|
31
|
-
uiFragments
|
|
30
|
+
dcbEventLog?: DcbEventLog.outputs,
|
|
31
|
+
uiFragments?: Reventless.Plugin.uiFragmentManifest,
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
let getRemoteStorageResources = (pluginName, queryDbName) =>
|
|
@@ -158,7 +158,7 @@ type eventCollectorContext = {
|
|
|
158
158
|
extensionPoints: array<extensionPointEntry>,
|
|
159
159
|
// The auto-included PluginConnectExtension entry. Some for plugins; None for
|
|
160
160
|
// the admin Lambda (the admin IS the Plugin EP, doesn't consume it).
|
|
161
|
-
connectExtension
|
|
161
|
+
connectExtension?: connectExtensionEntry,
|
|
162
162
|
// User-declared extensions on this plugin. Empty for the admin Lambda.
|
|
163
163
|
extensions: array<extensionEntry>,
|
|
164
164
|
// SQS URL of the admin's Plugin EP command topic — where extensions publish
|
|
@@ -720,7 +720,7 @@ module MakeEventCollectorHelper = (
|
|
|
720
720
|
pluginDefinitionJson,
|
|
721
721
|
uiFragmentsJson,
|
|
722
722
|
extensionPoints: extensionPointEntries,
|
|
723
|
-
connectExtension,
|
|
723
|
+
?connectExtension,
|
|
724
724
|
extensions,
|
|
725
725
|
pluginExtensionPointCmdTopicUrl,
|
|
726
726
|
publishToAggregates: mergedAggregateUrls,
|