@reventlessdev/reventless-aws 3.0.0-alpha.260 → 3.0.0-alpha.262
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 +14 -0
- package/package.json +9 -9
- package/src/adapter/Runtime/AutomationSliceEntryPoint.mjs +13 -1
- package/src/adapter/Runtime/AutomationSliceRuntime_Builder_Single.res +89 -9
- package/src/adapter/Runtime/AutomationSliceRuntime_Builder_Single.res.mjs +37 -6
- package/src/components/AutomationSlice_Builder.res +13 -0
- package/src/components/AutomationSlice_Builder.res.mjs +7 -2
- package/src/components/OutboundTranslationSlice_Builder.res +16 -0
- package/src/components/OutboundTranslationSlice_Builder.res.mjs +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.262 (2026-08-03)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **aws:** key the shared automation channel's DCB topic by convention ([fe473d5](https://github.com/ReventlessDev/reventless-core/commit/fe473d561343f39bc1d05a2afaa902459142bbd0))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# 3.0.0-alpha.261 (2026-08-03)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **aws:** let an outbound slice read an aggregate at runtime ([24585f8](https://github.com/ReventlessDev/reventless-core/commit/24585f869c15a07910434632d76d8c8d8058042b))
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
# 3.0.0-alpha.260 (2026-08-03)
|
|
7
21
|
|
|
8
22
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-aws",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.262",
|
|
4
4
|
"description": "AWS adapters for Reventless",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"dependencies": {
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
"@aws-sdk/s3-request-presigner": "3.970.0",
|
|
12
12
|
"sury": "11.0.0-alpha.4",
|
|
13
13
|
"uuid": "^13.0.0",
|
|
14
|
-
"@reventlessdev/rescript-
|
|
15
|
-
"@reventlessdev/rescript-node": "2.0.0-alpha.1",
|
|
14
|
+
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.3",
|
|
16
15
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.10",
|
|
17
16
|
"@reventlessdev/rescript-pulumi-aws": "2.4.0-alpha.65",
|
|
18
|
-
"@reventlessdev/rescript-
|
|
17
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.1",
|
|
18
|
+
"@reventlessdev/rescript-effect": "0.1.0-alpha.32",
|
|
19
19
|
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.18",
|
|
20
|
-
"@reventlessdev/
|
|
21
|
-
"@reventlessdev/reventless-
|
|
20
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.207",
|
|
21
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.124",
|
|
22
22
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.30",
|
|
23
|
-
"@reventlessdev/reventless-postgres": "3.0.0-alpha.
|
|
24
|
-
"@reventlessdev/
|
|
25
|
-
"@reventlessdev/reventless-
|
|
23
|
+
"@reventlessdev/reventless-postgres": "3.0.0-alpha.71",
|
|
24
|
+
"@reventlessdev/rescript-uuid": "2.0.0-alpha.0",
|
|
25
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.99"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"rescript": "12.3.0",
|
|
@@ -45,7 +45,19 @@ async function buildAllHandlers() {
|
|
|
45
45
|
specModule.name,
|
|
46
46
|
automationSliceCallbackMake(specModule)(bodyModule)
|
|
47
47
|
);
|
|
48
|
-
|
|
48
|
+
// A slice can listen on several streams — its plugin's DCB log and any
|
|
49
|
+
// Aggregate EventTopic it named. Register the one handler under each, since
|
|
50
|
+
// the router dispatches by the record's own eventSourceARN. `sourceUrn` is
|
|
51
|
+
// the pre-multi-source spelling, kept as a fallback so an older handler
|
|
52
|
+
// config still routes.
|
|
53
|
+
const sourceUrns = entry.sourceUrns?.length
|
|
54
|
+
? entry.sourceUrns
|
|
55
|
+
: entry.sourceUrn
|
|
56
|
+
? [entry.sourceUrn]
|
|
57
|
+
: [];
|
|
58
|
+
for (const sourceUrn of sourceUrns) {
|
|
59
|
+
StreamOps.addToRegistry(handlers, sourceUrn, registered);
|
|
60
|
+
}
|
|
49
61
|
}));
|
|
50
62
|
|
|
51
63
|
return handlers;
|
|
@@ -24,6 +24,20 @@ type sliceInfo = {
|
|
|
24
24
|
// Threaded to phase 1 collect/resolve on the automation path (mirrors the
|
|
25
25
|
// in-process builder's `~context`); outbound slices take no context.
|
|
26
26
|
context: option<Reventless.AutomationSlice.context>,
|
|
27
|
+
// The non-DCB topics this slice subscribes to — an Aggregate's EventTopic when
|
|
28
|
+
// it names one by `Spec.name`. Empty for the common DCB-only slice.
|
|
29
|
+
//
|
|
30
|
+
// Captured *synchronously* here for the same reason the whole `bundledInfos`
|
|
31
|
+
// path exists: `forEventCollector` runs inside a `Pulumi.Output.apply`, so
|
|
32
|
+
// `storedSpecs` — which carries the resolved topics on the dead `finish` path
|
|
33
|
+
// — is still empty when `finishWithDcbEventLog` runs. The core builders
|
|
34
|
+
// compute this dict before that apply, so the value is available in time; it
|
|
35
|
+
// just had nowhere to go until now.
|
|
36
|
+
sourceTopics: ReventlessCore.EventTopic.allOutputs,
|
|
37
|
+
// Whether this slice also reads the plugin's own DCB event log. True for every
|
|
38
|
+
// slice that declares no sources (the default) and for any that names the log
|
|
39
|
+
// explicitly, which is why it is not derivable from `sourceTopics` being empty.
|
|
40
|
+
consumesDcbLog: bool,
|
|
27
41
|
}
|
|
28
42
|
|
|
29
43
|
let bundledInfos: dict<sliceInfo> = Dict.make()
|
|
@@ -35,6 +49,9 @@ let setDcbQueueUrl = url => dcbQueueUrlRef := Some(url)
|
|
|
35
49
|
// ApiFragmentRegistry push (2e) to dispatch RecordApiFragmentPush.
|
|
36
50
|
let getDcbQueueUrl = () => dcbQueueUrlRef.contents
|
|
37
51
|
|
|
52
|
+
// `~sourceTopics` / `~consumesDcbLog` default to the DCB-only shape every slice
|
|
53
|
+
// had before aggregate sources existed, so a caller that has not been updated
|
|
54
|
+
// keeps exactly its previous wiring.
|
|
38
55
|
let registerAutomationSlice = (
|
|
39
56
|
~name,
|
|
40
57
|
~specModulePath,
|
|
@@ -43,10 +60,21 @@ let registerAutomationSlice = (
|
|
|
43
60
|
~queryDbTableName,
|
|
44
61
|
~queryDbResources=[],
|
|
45
62
|
~context=?,
|
|
63
|
+
~sourceTopics=Dict.make(),
|
|
64
|
+
~consumesDcbLog=true,
|
|
46
65
|
) =>
|
|
47
66
|
bundledInfos->Dict.set(
|
|
48
67
|
name,
|
|
49
|
-
{
|
|
68
|
+
{
|
|
69
|
+
specModulePath,
|
|
70
|
+
bodyModulePath,
|
|
71
|
+
callbackType,
|
|
72
|
+
queryDbTableName,
|
|
73
|
+
queryDbResources,
|
|
74
|
+
context,
|
|
75
|
+
sourceTopics,
|
|
76
|
+
consumesDcbLog,
|
|
77
|
+
},
|
|
50
78
|
)
|
|
51
79
|
|
|
52
80
|
type storedSpec = {
|
|
@@ -259,9 +287,28 @@ let finishWithDcbEventLog = (dcbEventLog: ReventlessCore.DcbEventLog.component)
|
|
|
259
287
|
let opts = {Pulumi.ComponentResource.parent: parent}
|
|
260
288
|
let dcbOutputs: ReventlessCore.DcbEventLog.outputs =
|
|
261
289
|
dcbEventLog->ReventlessCore.Component.outputs
|
|
290
|
+
// The plugin's DCB log, plus every Aggregate EventTopic any slice on this
|
|
291
|
+
// Lambda named. One channel spans them all: `connect` turns each topic
|
|
292
|
+
// into its own event-source mapping, and the entry point routes an
|
|
293
|
+
// incoming record to the handlers registered for its stream, so a slice
|
|
294
|
+
// only ever sees the sources it asked for.
|
|
295
|
+
//
|
|
296
|
+
// Keyed `<plugin>DcbEventLog`, the convention `Dcb_Builder` uses when it
|
|
297
|
+
// puts the log into `allEventTopics`. That matters because a slice naming
|
|
298
|
+
// the log explicitly (every DCB-sourced AutomationSlice does) contributes
|
|
299
|
+
// it back under that key: a different key here would leave the same topic
|
|
300
|
+
// in the dict twice, and since an event-source mapping is named after the
|
|
301
|
+
// *topic resource* rather than the key, both would render as
|
|
302
|
+
// `<plugin>DcbEventLog2AllAutomationSlices` and the deploy would fail on a
|
|
303
|
+
// duplicate URN.
|
|
304
|
+
let dcbTopicKey = dcbResource.name->Option.getOr("") ++ "DcbEventLog"
|
|
262
305
|
let eventTopics: ReventlessCore.EventTopic.allOutputs = Dict.fromArray([
|
|
263
|
-
(
|
|
306
|
+
(dcbTopicKey, dcbOutputs.eventTopic),
|
|
264
307
|
])
|
|
308
|
+
bundledInfos->Dict.forEach(info =>
|
|
309
|
+
info.sourceTopics->Dict.forEachWithKey((topic, key) => eventTopics->Dict.set(key, topic))
|
|
310
|
+
)
|
|
311
|
+
|
|
265
312
|
let channel = EventCollectorChannel.make(
|
|
266
313
|
~name="AllAutomationSlices",
|
|
267
314
|
~eventTopics,
|
|
@@ -269,13 +316,40 @@ let finishWithDcbEventLog = (dcbEventLog: ReventlessCore.DcbEventLog.component)
|
|
|
269
316
|
~opts,
|
|
270
317
|
)
|
|
271
318
|
|
|
272
|
-
|
|
273
|
-
// dispatch key the entry point maps event-source records back to.
|
|
274
|
-
let sourceUrn = switch dcbOutputs.eventTopic.resources->Array.get(0) {
|
|
319
|
+
let dcbSourceUrn = switch dcbOutputs.eventTopic.resources->Array.get(0) {
|
|
275
320
|
| Some(resource) => resource.urn
|
|
276
321
|
| None => Pulumi.Output.make("")
|
|
277
322
|
}
|
|
278
323
|
|
|
324
|
+
// The stream URNs this one slice listens on — the dispatch keys the entry
|
|
325
|
+
// point maps event-source records back to. Per slice rather than one
|
|
326
|
+
// shared DCB URN, which is what lets an Aggregate-sourced slice exist at
|
|
327
|
+
// all: its events arrive on the Aggregate's stream and would otherwise
|
|
328
|
+
// reach a registry that has never heard of them.
|
|
329
|
+
let sourceUrnsFor = (info: sliceInfo): Pulumi.Output.t<array<string>> => {
|
|
330
|
+
let urns = []
|
|
331
|
+
if info.consumesDcbLog {
|
|
332
|
+
urns->Array.push(dcbSourceUrn)->ignore
|
|
333
|
+
}
|
|
334
|
+
info.sourceTopics
|
|
335
|
+
->Dict.valuesToArray
|
|
336
|
+
->Array.forEach(topic =>
|
|
337
|
+
topic.resources->Array.forEach(resource => urns->Array.push(resource.urn)->ignore)
|
|
338
|
+
)
|
|
339
|
+
// Deduped after resolution, because the same stream can be reached two
|
|
340
|
+
// ways — `consumesDcbLog` and an explicit source naming the DCB log.
|
|
341
|
+
// The entry point registers the handler once per URN, so a repeat would
|
|
342
|
+
// run the slice twice for every event: no error, no log, just doubled
|
|
343
|
+
// work and doubled commands.
|
|
344
|
+
urns
|
|
345
|
+
->Pulumi.Output.all
|
|
346
|
+
->Pulumi.Output.apply(resolved =>
|
|
347
|
+
resolved->Array.reduce([], (acc, urn) =>
|
|
348
|
+
acc->Array.includes(urn) ? acc : acc->Array.concat([urn])
|
|
349
|
+
)
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
|
|
279
353
|
let dcbQueueUrl = switch dcbQueueUrlRef.contents {
|
|
280
354
|
| Some(url) => url
|
|
281
355
|
| None => Pulumi.Output.make("NOT_AVAILABLE")
|
|
@@ -307,10 +381,16 @@ let finishWithDcbEventLog = (dcbEventLog: ReventlessCore.DcbEventLog.component)
|
|
|
307
381
|
}
|
|
308
382
|
|
|
309
383
|
let handlerJson =
|
|
310
|
-
Pulumi.Output.all3((info.queryDbTableName, dcbQueueUrl,
|
|
311
|
-
->Pulumi.Output.apply(((tableName, queueUrl,
|
|
312
|
-
|
|
313
|
-
|
|
384
|
+
Pulumi.Output.all3((info.queryDbTableName, dcbQueueUrl, sourceUrnsFor(info)))
|
|
385
|
+
->Pulumi.Output.apply(((tableName, queueUrl, urns)) => {
|
|
386
|
+
let urnsJson =
|
|
387
|
+
urns->Array.map(JSON.Encode.string)->JSON.Encode.array->JSON.stringify
|
|
388
|
+
// `sourceUrn` stays beside `sourceUrns` so a handler config read by
|
|
389
|
+
// an entry point that predates multi-source still routes its first
|
|
390
|
+
// stream rather than none.
|
|
391
|
+
let firstUrn = urns->Array.get(0)->Option.getOr("")
|
|
392
|
+
`{"specModule":${specModule},"bodyModule":${bodyModule},"callbackType":${callbackType},"queryDbTableName":"${tableName}","dcbQueueUrl":"${queueUrl}","sourceUrn":"${firstUrn}","sourceUrns":${urnsJson}${contextFragment}}`
|
|
393
|
+
})
|
|
314
394
|
let _ = handlerOutputs->Array.push(handlerJson)
|
|
315
395
|
})
|
|
316
396
|
|
|
@@ -28,16 +28,20 @@ function getDcbQueueUrl() {
|
|
|
28
28
|
return dcbQueueUrlRef.contents;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function registerAutomationSlice(name, specModulePath, bodyModulePath, callbackTypeOpt, queryDbTableName, queryDbResourcesOpt, context) {
|
|
31
|
+
function registerAutomationSlice(name, specModulePath, bodyModulePath, callbackTypeOpt, queryDbTableName, queryDbResourcesOpt, context, sourceTopicsOpt, consumesDcbLogOpt) {
|
|
32
32
|
let callbackType = callbackTypeOpt !== undefined ? callbackTypeOpt : "automation";
|
|
33
33
|
let queryDbResources = queryDbResourcesOpt !== undefined ? queryDbResourcesOpt : [];
|
|
34
|
+
let sourceTopics = sourceTopicsOpt !== undefined ? sourceTopicsOpt : ({});
|
|
35
|
+
let consumesDcbLog = consumesDcbLogOpt !== undefined ? consumesDcbLogOpt : true;
|
|
34
36
|
bundledInfos[name] = {
|
|
35
37
|
specModulePath: specModulePath,
|
|
36
38
|
bodyModulePath: bodyModulePath,
|
|
37
39
|
callbackType: callbackType,
|
|
38
40
|
queryDbTableName: queryDbTableName,
|
|
39
41
|
queryDbResources: queryDbResources,
|
|
40
|
-
context: context
|
|
42
|
+
context: context,
|
|
43
|
+
sourceTopics: sourceTopics,
|
|
44
|
+
consumesDcbLog: consumesDcbLog
|
|
41
45
|
};
|
|
42
46
|
}
|
|
43
47
|
|
|
@@ -157,13 +161,35 @@ function finishWithDcbEventLog(dcbEventLog) {
|
|
|
157
161
|
parent: opts_parent
|
|
158
162
|
};
|
|
159
163
|
let dcbOutputs = Component$ReventlessCore.outputs(dcbEventLog);
|
|
164
|
+
let dcbTopicKey = Stdlib_Option.getOr(dcbResource.__name, "") + "DcbEventLog";
|
|
160
165
|
let eventTopics = Object.fromEntries([[
|
|
161
|
-
|
|
166
|
+
dcbTopicKey,
|
|
162
167
|
dcbOutputs.eventTopic
|
|
163
168
|
]]);
|
|
169
|
+
Stdlib_Dict.forEach(bundledInfos, info => Stdlib_Dict.forEachWithKey(info.sourceTopics, (topic, key) => {
|
|
170
|
+
eventTopics[key] = topic;
|
|
171
|
+
}));
|
|
164
172
|
let channel = EventCollectorChannel_DynamoDbStream$ReventlessAws.make("AllAutomationSlices", eventTopics, undefined, opts);
|
|
165
173
|
let resource = dcbOutputs.eventTopic.resources[0];
|
|
166
|
-
let
|
|
174
|
+
let dcbSourceUrn = resource !== undefined ? resource.urn : Pulumi.output("");
|
|
175
|
+
let sourceUrnsFor = info => {
|
|
176
|
+
let urns = [];
|
|
177
|
+
if (info.consumesDcbLog) {
|
|
178
|
+
urns.push(dcbSourceUrn);
|
|
179
|
+
}
|
|
180
|
+
Object.values(info.sourceTopics).forEach(topic => {
|
|
181
|
+
topic.resources.forEach(resource => {
|
|
182
|
+
urns.push(resource.urn);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
return Pulumi.all(urns).apply(resolved => Stdlib_Array.reduce(resolved, [], (acc, urn) => {
|
|
186
|
+
if (acc.includes(urn)) {
|
|
187
|
+
return acc;
|
|
188
|
+
} else {
|
|
189
|
+
return acc.concat([urn]);
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
};
|
|
167
193
|
let url = dcbQueueUrlRef.contents;
|
|
168
194
|
let dcbQueueUrl = url !== undefined ? url : Pulumi.output("NOT_AVAILABLE");
|
|
169
195
|
let handlerOutputs = [];
|
|
@@ -185,8 +211,13 @@ function finishWithDcbEventLog(dcbEventLog) {
|
|
|
185
211
|
let handlerJson = Pulumi.all([
|
|
186
212
|
info.queryDbTableName,
|
|
187
213
|
dcbQueueUrl,
|
|
188
|
-
|
|
189
|
-
]).apply(param =>
|
|
214
|
+
sourceUrnsFor(info)
|
|
215
|
+
]).apply(param => {
|
|
216
|
+
let urns = param[2];
|
|
217
|
+
let urnsJson = JSON.stringify(urns.map(prim => prim));
|
|
218
|
+
let firstUrn = Stdlib_Option.getOr(urns[0], "");
|
|
219
|
+
return `{"specModule":` + specModule + `,"bodyModule":` + bodyModule + `,"callbackType":` + callbackType + `,"queryDbTableName":"` + param[0] + `","dcbQueueUrl":"` + param[1] + `","sourceUrn":"` + firstUrn + `","sourceUrns":` + urnsJson + contextFragment + `}`;
|
|
220
|
+
});
|
|
190
221
|
handlerOutputs.push(handlerJson);
|
|
191
222
|
});
|
|
192
223
|
let handlerConfigOutput = Pulumi.all(handlerOutputs).apply(handlers => `{"handlers":[` + handlers.join(",") + `]}`);
|
|
@@ -37,6 +37,17 @@ module Make = (Api: {
|
|
|
37
37
|
let tableResource = queryDbOutputs.resources->Array.getUnsafe(0)
|
|
38
38
|
let queryDbTableName = tableResource.name
|
|
39
39
|
|
|
40
|
+
// An automation names its sources through its Mappings rather than a flat
|
|
41
|
+
// list, but the runtime question is the same one the outbound builder
|
|
42
|
+
// answers: which streams must this Lambda listen on. Unlike outbound, an
|
|
43
|
+
// automation's DCB log is already a key in `allEventTopics`, so the filter
|
|
44
|
+
// picks it up and nothing extra has to be assumed.
|
|
45
|
+
let sourceTopics =
|
|
46
|
+
allEventTopics->ReventlessCore.EventTopic.filter(sourceNames->Belt.Set.String.fromArray)
|
|
47
|
+
let consumesDcbLog =
|
|
48
|
+
sourceNames->Array.length == 0 ||
|
|
49
|
+
sourceNames->Array.some(name => !(allEventTopics->Dict.has(name)))
|
|
50
|
+
|
|
40
51
|
EventCollectorRuntimeBuilder.registerAutomationSlice(
|
|
41
52
|
~name=Spec.name,
|
|
42
53
|
~specModulePath=Util_Bundle.getModuleSpecifier(Spec.moduleUrl),
|
|
@@ -45,6 +56,8 @@ module Make = (Api: {
|
|
|
45
56
|
~queryDbTableName,
|
|
46
57
|
~queryDbResources=queryDbOutputs.resources,
|
|
47
58
|
~context,
|
|
59
|
+
~sourceTopics,
|
|
60
|
+
~consumesDcbLog,
|
|
48
61
|
)
|
|
49
62
|
|
|
50
63
|
as_
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Belt_SetString from "@rescript/runtime/lib/es6/Belt_SetString.js";
|
|
3
4
|
import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
|
|
5
|
+
import * as EventTopic$ReventlessCore from "@reventlessdev/reventless-core/src/components/EventTopic/EventTopic.res.mjs";
|
|
4
6
|
import * as Util_Bundle$ReventlessAws from "../util/Util_Bundle.res.mjs";
|
|
5
7
|
import * as QueryDbStorage_DynamoDb$ReventlessAws from "../adapter/QueryDb/QueryDbStorage_DynamoDb.res.mjs";
|
|
6
8
|
import * as AutomationSlice_Builder$ReventlessCore from "@reventlessdev/reventless-core/src/components/AutomationSlice/AutomationSlice_Builder.res.mjs";
|
|
@@ -36,19 +38,22 @@ function Make(Api) {
|
|
|
36
38
|
})(Api);
|
|
37
39
|
let Make$1 = Spec => (Automation => {
|
|
38
40
|
let InnerMake = Inner.Make(Spec)(Automation);
|
|
41
|
+
let sourceNames = InnerMake.sourceNames;
|
|
39
42
|
let make = (allEventTopics, publishJsons, context, runtime, opts) => {
|
|
40
43
|
let as_ = InnerMake.make(allEventTopics, publishJsons, context, runtime, opts);
|
|
41
44
|
let queryDbOutputs = Component$ReventlessCore.outputs(as_).queryDb;
|
|
42
45
|
let tableResource = queryDbOutputs.resources[0];
|
|
43
46
|
let queryDbTableName = tableResource.name;
|
|
44
|
-
|
|
47
|
+
let sourceTopics = EventTopic$ReventlessCore.filter(allEventTopics, Belt_SetString.fromArray(sourceNames));
|
|
48
|
+
let consumesDcbLog = sourceNames.length === 0 || sourceNames.some(name => !(name in allEventTopics));
|
|
49
|
+
AutomationSliceRuntime_Builder_Single$ReventlessAws.registerAutomationSlice(Spec.name, Util_Bundle$ReventlessAws.getModuleSpecifier(Spec.moduleUrl), Util_Bundle$ReventlessAws.getModuleSpecifier(Automation.moduleUrl), "automation", queryDbTableName, queryDbOutputs.resources, context, sourceTopics, consumesDcbLog);
|
|
45
50
|
return as_;
|
|
46
51
|
};
|
|
47
52
|
return {
|
|
48
53
|
Spec: Spec,
|
|
49
54
|
Automation: Automation,
|
|
50
55
|
queryDbName: InnerMake.queryDbName,
|
|
51
|
-
sourceNames:
|
|
56
|
+
sourceNames: sourceNames,
|
|
52
57
|
make: make
|
|
53
58
|
};
|
|
54
59
|
});
|
|
@@ -45,6 +45,20 @@ module Make = (Api: {
|
|
|
45
45
|
let tableResource = queryDbOutputs.resources->Array.getUnsafe(0)
|
|
46
46
|
let queryDbTableName = tableResource.name
|
|
47
47
|
|
|
48
|
+
// Which streams this slice's Lambda must actually listen on. The core
|
|
49
|
+
// `make` above has already validated every declared name and thrown on a
|
|
50
|
+
// typo, so this only has to select — a name absent from `allEventTopics`
|
|
51
|
+
// is necessarily the plugin's own DCB log, the one source that dict does
|
|
52
|
+
// not carry.
|
|
53
|
+
let declaredSources = Spec.sourceNames
|
|
54
|
+
let sourceTopics =
|
|
55
|
+
allEventTopics->ReventlessCore.EventTopic.filter(
|
|
56
|
+
declaredSources->Belt.Set.String.fromArray,
|
|
57
|
+
)
|
|
58
|
+
let consumesDcbLog =
|
|
59
|
+
declaredSources->Array.length == 0 ||
|
|
60
|
+
declaredSources->Array.some(name => !(allEventTopics->Dict.has(name)))
|
|
61
|
+
|
|
48
62
|
AutomationSliceRuntime_Builder_Single.registerAutomationSlice(
|
|
49
63
|
~name=Spec.name,
|
|
50
64
|
~specModulePath=Util_Bundle.getModuleSpecifier(Spec.moduleUrl),
|
|
@@ -52,6 +66,8 @@ module Make = (Api: {
|
|
|
52
66
|
~callbackType="outbound",
|
|
53
67
|
~queryDbTableName,
|
|
54
68
|
~queryDbResources=queryDbOutputs.resources,
|
|
69
|
+
~sourceTopics,
|
|
70
|
+
~consumesDcbLog,
|
|
55
71
|
)
|
|
56
72
|
|
|
57
73
|
ots
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Belt_SetString from "@rescript/runtime/lib/es6/Belt_SetString.js";
|
|
3
4
|
import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
|
|
5
|
+
import * as EventTopic$ReventlessCore from "@reventlessdev/reventless-core/src/components/EventTopic/EventTopic.res.mjs";
|
|
4
6
|
import * as Util_Bundle$ReventlessAws from "../util/Util_Bundle.res.mjs";
|
|
5
7
|
import * as QueryDbStorage_DynamoDb$ReventlessAws from "../adapter/QueryDb/QueryDbStorage_DynamoDb.res.mjs";
|
|
6
8
|
import * as QueryDbResolvers_AppSync$ReventlessAws from "../adapter/QueryDb/QueryDbResolvers_AppSync.res.mjs";
|
|
@@ -49,7 +51,10 @@ function Make(Api) {
|
|
|
49
51
|
let queryDbOutputs = Component$ReventlessCore.outputs(ots).queryDb;
|
|
50
52
|
let tableResource = queryDbOutputs.resources[0];
|
|
51
53
|
let queryDbTableName = tableResource.name;
|
|
52
|
-
|
|
54
|
+
let declaredSources = Spec.sourceNames;
|
|
55
|
+
let sourceTopics = EventTopic$ReventlessCore.filter(allEventTopics, Belt_SetString.fromArray(declaredSources));
|
|
56
|
+
let consumesDcbLog = declaredSources.length === 0 || declaredSources.some(name => !(name in allEventTopics));
|
|
57
|
+
AutomationSliceRuntime_Builder_Single$ReventlessAws.registerAutomationSlice(Spec.name, Util_Bundle$ReventlessAws.getModuleSpecifier(Spec.moduleUrl), Util_Bundle$ReventlessAws.getModuleSpecifier(Translation.moduleUrl), "outbound", queryDbTableName, queryDbOutputs.resources, undefined, sourceTopics, consumesDcbLog);
|
|
53
58
|
return ots;
|
|
54
59
|
};
|
|
55
60
|
return {
|