@reventlessdev/reventless-aws 3.0.0-alpha.213 → 3.0.0-alpha.215
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 +15 -15
- package/scripts/run-integration-tests.sh +1 -1
- package/scripts/run-pg-integration-tests.sh +1 -1
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res +21 -6
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res.mjs +6 -1
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single_Async.res +15 -4
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single_Async.res.mjs +6 -1
- package/src/adapter/Runtime/StateChangeSliceRuntime_Builder_Single.res +17 -2
- package/src/adapter/Runtime/StateChangeSliceRuntime_Builder_Single.res.mjs +7 -2
- package/src/components/Aggregate_Builder_Micro.res +2 -2
- package/src/components/Aggregate_Builder_Micro.res.mjs +2 -2
- package/src/components/Aggregate_Builder_NoResolver.res +2 -2
- package/src/components/Aggregate_Builder_NoResolver.res.mjs +2 -2
- package/src/components/Aggregate_Builder_PerAggregate.res +2 -2
- package/src/components/Aggregate_Builder_PerAggregate.res.mjs +2 -2
- package/src/components/Aggregate_Builder_Single.res +2 -2
- package/src/components/Aggregate_Builder_Single.res.mjs +2 -2
- package/src/components/Aggregate_Builder_Single_Async.res +2 -2
- package/src/components/Aggregate_Builder_Single_Async.res.mjs +2 -2
- package/src/components/AutomationSlice_Builder.res +2 -2
- package/src/components/AutomationSlice_Builder.res.mjs +2 -2
- package/src/components/ExtensionPoint_Builder.res +8 -0
- package/src/components/ExtensionPoint_Builder.res.mjs +7 -1
- package/src/components/OutboundTranslationSlice_Builder.res +2 -2
- package/src/components/OutboundTranslationSlice_Builder.res.mjs +2 -2
- package/src/components/ReadModel_Builder_NoResolver.res +2 -2
- package/src/components/ReadModel_Builder_NoResolver.res.mjs +2 -2
- package/src/components/ReadModel_Builder_NoResolver_Stream.res +2 -2
- package/src/components/ReadModel_Builder_NoResolver_Stream.res.mjs +2 -2
- package/src/components/ReadModel_Builder_PerReadModel.res +2 -2
- package/src/components/ReadModel_Builder_PerReadModel.res.mjs +2 -2
- package/src/components/ReadModel_Builder_Single.res +2 -2
- package/src/components/ReadModel_Builder_Single.res.mjs +2 -2
- package/src/components/ReadModel_Builder_Single_Stream.res +2 -2
- package/src/components/ReadModel_Builder_Single_Stream.res.mjs +2 -2
- package/src/components/StateViewSlice_Builder.res +2 -2
- package/src/components/StateViewSlice_Builder.res.mjs +2 -2
- package/src/components/StateViewSlice_Builder_Stream.res +2 -2
- package/src/components/StateViewSlice_Builder_Stream.res.mjs +2 -2
- package/src/components/Task_Builder.res.mjs +3 -0
- package/src/components/Task_Builder_PerBucket.res +8 -0
- package/src/components/Task_Builder_PerBucket.res.mjs +7 -1
- package/src/plugin/runtime/PluginRuntime_Builder.res +6 -1
- package/src/plugin/runtime/PluginRuntime_Builder.res.mjs +4 -4
- package/src/plugin/stack/Plugin_ExtensionPoint_Builder.res +1 -0
- package/src/plugin/stack/Plugin_ExtensionPoint_Builder.res.mjs +3 -2
- package/tests/ComponentRuntimeDefaultsTest.res +26 -0
- package/tests/ComponentRuntimeDefaultsTest.res.mjs +24 -0
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.215 (2026-07-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **runtime:** platform-supplied EP/task pod runtime floors ([37544d0](https://github.com/ReventlessDev/reventless-core/commit/37544d029d278bbcae6eeb0f583da07d6ce70f04))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# 3.0.0-alpha.214 (2026-07-16)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **aws:** consume per-component runtime hints; fold into shared command Lambdas ([7ba2485](https://github.com/ReventlessDev/reventless-core/commit/7ba248579f2472f2fc847b26033927199353f3e6))
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
# 3.0.0-alpha.213 (2026-07-15)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @reventlessdev/reventless-aws
|
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.215",
|
|
4
4
|
"description": "AWS adapters for Reventless",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"dependencies": {
|
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
"@aws-sdk/client-cloudfront": "3.970.0",
|
|
9
9
|
"sury": "11.0.0-alpha.4",
|
|
10
10
|
"uuid": "^13.0.0",
|
|
11
|
-
"@reventlessdev/rescript-
|
|
12
|
-
"@reventlessdev/rescript-
|
|
13
|
-
"@reventlessdev/rescript-pulumi-
|
|
14
|
-
"@reventlessdev/rescript-
|
|
15
|
-
"@reventlessdev/rescript-
|
|
16
|
-
"@reventlessdev/
|
|
17
|
-
"@reventlessdev/reventless-
|
|
18
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.
|
|
19
|
-
"@reventlessdev/
|
|
20
|
-
"@reventlessdev/reventless-
|
|
21
|
-
"@reventlessdev/reventless-
|
|
11
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.9",
|
|
12
|
+
"@reventlessdev/rescript-pulumi-aws": "2.4.0-alpha.55",
|
|
13
|
+
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.17",
|
|
14
|
+
"@reventlessdev/rescript-aws-sdk": "2.2.0-alpha.23",
|
|
15
|
+
"@reventlessdev/rescript-uuid": "1.1.0-alpha.17",
|
|
16
|
+
"@reventlessdev/rescript-effect": "0.1.0-alpha.29",
|
|
17
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.171",
|
|
18
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.102",
|
|
19
|
+
"@reventlessdev/reventless-interop": "3.0.0-alpha.28",
|
|
20
|
+
"@reventlessdev/reventless-postgres": "3.0.0-alpha.35",
|
|
21
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.79"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"rescript": "
|
|
24
|
+
"rescript": "12.3.0",
|
|
25
25
|
"sury-ppx": "11.0.0-alpha.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"rescript": "
|
|
28
|
+
"rescript": "12.3.0"
|
|
29
29
|
},
|
|
30
30
|
"jest": {
|
|
31
31
|
"setupFiles": [
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"repository": {
|
|
57
57
|
"type": "git",
|
|
58
58
|
"url": "git+https://github.com/ReventlessDev/reventless-core.git",
|
|
59
|
-
"directory": "reventless/
|
|
59
|
+
"directory": "reventless/aws"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "rescript build",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
set -euo pipefail
|
|
6
6
|
|
|
7
7
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
|
8
|
-
COMPOSE="$ROOT/reventless/
|
|
8
|
+
COMPOSE="$ROOT/reventless/aws/docker-compose.dynamodb-local.yml"
|
|
9
9
|
ENDPOINT="${AWS_ENDPOINT_URL_DYNAMODB:-http://localhost:8000}"
|
|
10
10
|
|
|
11
11
|
if ! command -v docker >/dev/null 2>&1; then
|
|
@@ -191,12 +191,27 @@ let finish = () =>
|
|
|
191
191
|
if !finished.contents {
|
|
192
192
|
let specs = storedSpecs->Dict.valuesToArray
|
|
193
193
|
if specs->Array.length > 0 {
|
|
194
|
-
// The legacy reduce-max-across-specs over `memorySize` / `timeout` was always
|
|
195
|
-
// a max-of-zeros (the Aggregate_Builder call site never passed those args).
|
|
196
|
-
// We only need `parent` from the specs here; per-Lambda tuning now lives in
|
|
197
|
-
// `configRef`, populated by `Platform.MakeWithConfig`.
|
|
198
194
|
let parent = specs->Array.reduce(None, (_, {aggregateResource}) => aggregateResource.parent)
|
|
199
195
|
let cfg = configRef.contents
|
|
196
|
+
|
|
197
|
+
// Per-component runtime hints (plugin.json `runtime`) accumulate into each
|
|
198
|
+
// stored spec's memorySize/timeout via forCommandTopic/forCommandGenerator
|
|
199
|
+
// (Math.Int.max over the per-aggregate resolved values, floored at the
|
|
200
|
+
// per-kind default 1024/30). The shared AllAggregates Lambda hosts every
|
|
201
|
+
// aggregate's handler, so it takes the max across them, folded with the
|
|
202
|
+
// operator's commandHandlerConfig (whichever is higher wins). An override
|
|
203
|
+
// on one aggregate raises the shared Lambda above the floor.
|
|
204
|
+
// See docs/plans/configurable-component-runtime-resources.md.
|
|
205
|
+
let specMemorySize = specs->Array.reduce(0, (acc, {memorySize}) => Math.Int.max(acc, memorySize))
|
|
206
|
+
let specTimeout = specs->Array.reduce(0, (acc, {timeout}) => Math.Int.max(acc, timeout))
|
|
207
|
+
let memorySize = Math.Int.max(
|
|
208
|
+
cfg.memorySize->Option.getOr(ReventlessCore.Runtime.CommandHandlerDefaults.memorySize),
|
|
209
|
+
specMemorySize,
|
|
210
|
+
)
|
|
211
|
+
let timeout = Math.Int.max(
|
|
212
|
+
cfg.timeout->Option.getOr(ReventlessCore.Runtime.CommandHandlerDefaults.timeout),
|
|
213
|
+
specTimeout,
|
|
214
|
+
)
|
|
200
215
|
switch parent {
|
|
201
216
|
| Some(parent) =>
|
|
202
217
|
let opts = {Pulumi.ComponentResource.parent: parent}
|
|
@@ -315,8 +330,8 @@ let finish = () =>
|
|
|
315
330
|
~code,
|
|
316
331
|
~sourceCodeHash,
|
|
317
332
|
~envVars,
|
|
318
|
-
~memorySize
|
|
319
|
-
~timeout
|
|
333
|
+
~memorySize,
|
|
334
|
+
~timeout,
|
|
320
335
|
~reservedConcurrency=?cfg.reservedConcurrency,
|
|
321
336
|
~ephemeralStorageMb=?cfg.ephemeralStorageMb,
|
|
322
337
|
~logRetentionDays=?cfg.logRetentionDays,
|
|
@@ -7,6 +7,7 @@ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
|
7
7
|
import * as Pulumi from "@pulumi/pulumi";
|
|
8
8
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
9
9
|
import * as Logger$ReventlessCore from "@reventlessdev/reventless-core/src/util/Logger.res.mjs";
|
|
10
|
+
import * as Runtime$ReventlessCore from "@reventlessdev/reventless-core/src/adapter/Runtime/Runtime.res.mjs";
|
|
10
11
|
import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
|
|
11
12
|
import * as PolicyDocument$PulumiAws from "@reventlessdev/rescript-pulumi-aws/src/IAM/PolicyDocument.res.mjs";
|
|
12
13
|
import * as Util_Bundle$ReventlessAws from "../../util/Util_Bundle.res.mjs";
|
|
@@ -149,6 +150,10 @@ function finish() {
|
|
|
149
150
|
if (specs.length !== 0) {
|
|
150
151
|
let parent = Stdlib_Array.reduce(specs, undefined, (param, param$1) => param$1.aggregateResource.__parentResource);
|
|
151
152
|
let cfg = configRef.contents;
|
|
153
|
+
let specMemorySize = Stdlib_Array.reduce(specs, 0, (acc, param) => Math.max(acc, param.memorySize));
|
|
154
|
+
let specTimeout = Stdlib_Array.reduce(specs, 0, (acc, param) => Math.max(acc, param.timeout));
|
|
155
|
+
let memorySize = Math.max(Stdlib_Option.getOr(cfg.memorySize, Runtime$ReventlessCore.CommandHandlerDefaults.memorySize), specMemorySize);
|
|
156
|
+
let timeout = Math.max(Stdlib_Option.getOr(cfg.timeout, Runtime$ReventlessCore.CommandHandlerDefaults.timeout), specTimeout);
|
|
152
157
|
if (parent !== undefined) {
|
|
153
158
|
let opts_parent = parent;
|
|
154
159
|
let opts = {
|
|
@@ -196,7 +201,7 @@ function finish() {
|
|
|
196
201
|
subnetIds: pgSelection.subnetIds,
|
|
197
202
|
securityGroupIds: [sgId]
|
|
198
203
|
})) : undefined;
|
|
199
|
-
let runtime = RuntimeEnvironment_Lambda$ReventlessAws.makeFromCodeAsset("AllAggregatesCmdHandler", "CommandHandler", match.code, match.sourceCodeHash, envVars,
|
|
204
|
+
let runtime = RuntimeEnvironment_Lambda$ReventlessAws.makeFromCodeAsset("AllAggregatesCmdHandler", "CommandHandler", match.code, match.sourceCodeHash, envVars, memorySize, timeout, cfg.reservedConcurrency, cfg.ephemeralStorageMb, cfg.logRetentionDays, undefined, vpcConfig, opts);
|
|
200
205
|
if (pgSelection !== undefined) {
|
|
201
206
|
pgSelection.connectionConfig.apply(cc => new (Aws.iam.RolePolicy)("AllAggregatesCmdHandler-pgSecret", {
|
|
202
207
|
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, "AllAggregatesCmdHandler-pgSecretPolicy", [{
|
|
@@ -180,10 +180,21 @@ let finish = () =>
|
|
|
180
180
|
if !finished.contents {
|
|
181
181
|
let specs = storedSpecs->Dict.valuesToArray
|
|
182
182
|
if specs->Array.length > 0 {
|
|
183
|
-
// See AggregateRuntime_Builder_Single.finish for the rationale behind
|
|
184
|
-
// dropping the max-of-zeros reduce in favor of `configRef`.
|
|
185
183
|
let parent = specs->Array.reduce(None, (_, {aggregateResource}) => aggregateResource.parent)
|
|
186
184
|
let cfg = configRef.contents
|
|
185
|
+
|
|
186
|
+
// Per-component runtime hints fold into the shared async command Lambda —
|
|
187
|
+
// see AggregateRuntime_Builder_Single.finish for the full rationale.
|
|
188
|
+
let specMemorySize = specs->Array.reduce(0, (acc, {memorySize}) => Math.Int.max(acc, memorySize))
|
|
189
|
+
let specTimeout = specs->Array.reduce(0, (acc, {timeout}) => Math.Int.max(acc, timeout))
|
|
190
|
+
let memorySize = Math.Int.max(
|
|
191
|
+
cfg.memorySize->Option.getOr(ReventlessCore.Runtime.CommandHandlerDefaults.memorySize),
|
|
192
|
+
specMemorySize,
|
|
193
|
+
)
|
|
194
|
+
let timeout = Math.Int.max(
|
|
195
|
+
cfg.timeout->Option.getOr(ReventlessCore.Runtime.CommandHandlerDefaults.timeout),
|
|
196
|
+
specTimeout,
|
|
197
|
+
)
|
|
187
198
|
switch parent {
|
|
188
199
|
| Some(parent) =>
|
|
189
200
|
let opts = {Pulumi.ComponentResource.parent: parent}
|
|
@@ -294,8 +305,8 @@ let finish = () =>
|
|
|
294
305
|
~code,
|
|
295
306
|
~sourceCodeHash,
|
|
296
307
|
~envVars,
|
|
297
|
-
~memorySize
|
|
298
|
-
~timeout
|
|
308
|
+
~memorySize,
|
|
309
|
+
~timeout,
|
|
299
310
|
~reservedConcurrency=?cfg.reservedConcurrency,
|
|
300
311
|
~ephemeralStorageMb=?cfg.ephemeralStorageMb,
|
|
301
312
|
~logRetentionDays=?cfg.logRetentionDays,
|
|
@@ -7,6 +7,7 @@ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
|
7
7
|
import * as Pulumi from "@pulumi/pulumi";
|
|
8
8
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
9
9
|
import * as Logger$ReventlessCore from "@reventlessdev/reventless-core/src/util/Logger.res.mjs";
|
|
10
|
+
import * as Runtime$ReventlessCore from "@reventlessdev/reventless-core/src/adapter/Runtime/Runtime.res.mjs";
|
|
10
11
|
import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
|
|
11
12
|
import * as PolicyDocument$PulumiAws from "@reventlessdev/rescript-pulumi-aws/src/IAM/PolicyDocument.res.mjs";
|
|
12
13
|
import * as Util_Bundle$ReventlessAws from "../../util/Util_Bundle.res.mjs";
|
|
@@ -141,6 +142,10 @@ function finish() {
|
|
|
141
142
|
if (specs.length !== 0) {
|
|
142
143
|
let parent = Stdlib_Array.reduce(specs, undefined, (param, param$1) => param$1.aggregateResource.__parentResource);
|
|
143
144
|
let cfg = configRef.contents;
|
|
145
|
+
let specMemorySize = Stdlib_Array.reduce(specs, 0, (acc, param) => Math.max(acc, param.memorySize));
|
|
146
|
+
let specTimeout = Stdlib_Array.reduce(specs, 0, (acc, param) => Math.max(acc, param.timeout));
|
|
147
|
+
let memorySize = Math.max(Stdlib_Option.getOr(cfg.memorySize, Runtime$ReventlessCore.CommandHandlerDefaults.memorySize), specMemorySize);
|
|
148
|
+
let timeout = Math.max(Stdlib_Option.getOr(cfg.timeout, Runtime$ReventlessCore.CommandHandlerDefaults.timeout), specTimeout);
|
|
144
149
|
if (parent !== undefined) {
|
|
145
150
|
let opts_parent = parent;
|
|
146
151
|
let opts = {
|
|
@@ -185,7 +190,7 @@ function finish() {
|
|
|
185
190
|
subnetIds: pgSelection.subnetIds,
|
|
186
191
|
securityGroupIds: [sgId]
|
|
187
192
|
})) : undefined;
|
|
188
|
-
let runtime = RuntimeEnvironment_Lambda$ReventlessAws.makeFromCodeAsset("AllAggregatesAsyncCmdHandler", "CommandHandler", match.code, match.sourceCodeHash, envVars,
|
|
193
|
+
let runtime = RuntimeEnvironment_Lambda$ReventlessAws.makeFromCodeAsset("AllAggregatesAsyncCmdHandler", "CommandHandler", match.code, match.sourceCodeHash, envVars, memorySize, timeout, cfg.reservedConcurrency, cfg.ephemeralStorageMb, cfg.logRetentionDays, undefined, vpcConfig, opts);
|
|
189
194
|
if (pgSelection !== undefined) {
|
|
190
195
|
pgSelection.connectionConfig.apply(cc => new (Aws.iam.RolePolicy)("AllAggregatesAsyncCmdHandler-pgSecret", {
|
|
191
196
|
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, "AllAggregatesAsyncCmdHandler-pgSecretPolicy", [{
|
|
@@ -21,6 +21,11 @@ let forDcbCommandTopic = (
|
|
|
21
21
|
~pluginName: string,
|
|
22
22
|
~syncConfig: ReventlessCore.Runtime.commandHandlerConfig,
|
|
23
23
|
~asyncConfig: ReventlessCore.Runtime.commandHandlerConfig,
|
|
24
|
+
// Per-component runtime floor: the max across this shared Lambda's
|
|
25
|
+
// StateChangeSlices' plugin.json `runtime` overrides (0 if none). Folded with
|
|
26
|
+
// the per-flavor commandHandlerConfig below (whichever is higher wins).
|
|
27
|
+
~sliceMemoryFloor: int=0,
|
|
28
|
+
~sliceTimeoutFloor: int=0,
|
|
24
29
|
~connect,
|
|
25
30
|
dcbCommandTopic,
|
|
26
31
|
) =>
|
|
@@ -63,6 +68,16 @@ let forDcbCommandTopic = (
|
|
|
63
68
|
let name = baseName ++ "CmdHandler"
|
|
64
69
|
|
|
65
70
|
let cfg = isAsync ? asyncConfig : syncConfig
|
|
71
|
+
// Fold the per-component runtime floor with the config: config wins when
|
|
72
|
+
// higher, an override raises the shared Lambda above the per-kind default.
|
|
73
|
+
let memorySize = Math.Int.max(
|
|
74
|
+
cfg.memorySize->Option.getOr(ReventlessCore.Runtime.CommandHandlerDefaults.memorySize),
|
|
75
|
+
sliceMemoryFloor,
|
|
76
|
+
)
|
|
77
|
+
let timeout = Math.Int.max(
|
|
78
|
+
cfg.timeout->Option.getOr(ReventlessCore.Runtime.CommandHandlerDefaults.timeout),
|
|
79
|
+
sliceTimeoutFloor,
|
|
80
|
+
)
|
|
66
81
|
|
|
67
82
|
let envVars: dict<Pulumi.Input.t<string>> = Dict.make()
|
|
68
83
|
envVars->Dict.set("DCB_TABLE", dcbTableName->Pulumi.Output.asInput)
|
|
@@ -170,8 +185,8 @@ let forDcbCommandTopic = (
|
|
|
170
185
|
~code,
|
|
171
186
|
~sourceCodeHash,
|
|
172
187
|
~envVars,
|
|
173
|
-
~memorySize
|
|
174
|
-
~timeout
|
|
188
|
+
~memorySize,
|
|
189
|
+
~timeout,
|
|
175
190
|
~reservedConcurrency=?cfg.reservedConcurrency,
|
|
176
191
|
~ephemeralStorageMb=?cfg.ephemeralStorageMb,
|
|
177
192
|
~logRetentionDays=?cfg.logRetentionDays,
|
|
@@ -5,6 +5,7 @@ import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Pulumi from "@pulumi/pulumi";
|
|
7
7
|
import * as Logger$ReventlessCore from "@reventlessdev/reventless-core/src/util/Logger.res.mjs";
|
|
8
|
+
import * as Runtime$ReventlessCore from "@reventlessdev/reventless-core/src/adapter/Runtime/Runtime.res.mjs";
|
|
8
9
|
import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
|
|
9
10
|
import * as DcbBackend$ReventlessAws from "../DcbEventLog/DcbBackend.res.mjs";
|
|
10
11
|
import * as PolicyDocument$PulumiAws from "@reventlessdev/rescript-pulumi-aws/src/IAM/PolicyDocument.res.mjs";
|
|
@@ -15,7 +16,9 @@ import * as RuntimeEnvironment_Lambda$ReventlessAws from "./RuntimeEnvironment_L
|
|
|
15
16
|
|
|
16
17
|
let log = Logger$ReventlessCore.fromEnv();
|
|
17
18
|
|
|
18
|
-
function forDcbCommandTopic(slicePaths, dcbTableName, pluginName, syncConfig, asyncConfig, connect, dcbCommandTopic) {
|
|
19
|
+
function forDcbCommandTopic(slicePaths, dcbTableName, pluginName, syncConfig, asyncConfig, sliceMemoryFloorOpt, sliceTimeoutFloorOpt, connect, dcbCommandTopic) {
|
|
20
|
+
let sliceMemoryFloor = sliceMemoryFloorOpt !== undefined ? sliceMemoryFloorOpt : 0;
|
|
21
|
+
let sliceTimeoutFloor = sliceTimeoutFloorOpt !== undefined ? sliceTimeoutFloorOpt : 0;
|
|
19
22
|
if (slicePaths.length === 0) {
|
|
20
23
|
return log.warn("StateChangeSliceRuntime_Builder_Single", undefined, "forDcbCommandTopic skipped (no slice specs)");
|
|
21
24
|
}
|
|
@@ -35,6 +38,8 @@ function forDcbCommandTopic(slicePaths, dcbTableName, pluginName, syncConfig, as
|
|
|
35
38
|
let isAsync = baseName.endsWith("Async");
|
|
36
39
|
let name = baseName + "CmdHandler";
|
|
37
40
|
let cfg = isAsync ? asyncConfig : syncConfig;
|
|
41
|
+
let memorySize = Math.max(Stdlib_Option.getOr(cfg.memorySize, Runtime$ReventlessCore.CommandHandlerDefaults.memorySize), sliceMemoryFloor);
|
|
42
|
+
let timeout = Math.max(Stdlib_Option.getOr(cfg.timeout, Runtime$ReventlessCore.CommandHandlerDefaults.timeout), sliceTimeoutFloor);
|
|
38
43
|
let envVars = {};
|
|
39
44
|
envVars["DCB_TABLE"] = dcbTableName$1;
|
|
40
45
|
envVars["QUEUE_URL"] = queue.id;
|
|
@@ -77,7 +82,7 @@ function forDcbCommandTopic(slicePaths, dcbTableName, pluginName, syncConfig, as
|
|
|
77
82
|
subnetIds: pgSelection.subnetIds,
|
|
78
83
|
securityGroupIds: [sgId]
|
|
79
84
|
})) : undefined;
|
|
80
|
-
let runtime = RuntimeEnvironment_Lambda$ReventlessAws.makeFromCodeAsset(name, "CommandHandler", match.code, match.sourceCodeHash, envVars,
|
|
85
|
+
let runtime = RuntimeEnvironment_Lambda$ReventlessAws.makeFromCodeAsset(name, "CommandHandler", match.code, match.sourceCodeHash, envVars, memorySize, timeout, cfg.reservedConcurrency, cfg.ephemeralStorageMb, cfg.logRetentionDays, true, vpcConfig, opts);
|
|
81
86
|
if (pgSelection !== undefined) {
|
|
82
87
|
pgSelection.connectionConfig.apply(cc => new (Aws.iam.RolePolicy)(name + `-pgSecret`, {
|
|
83
88
|
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, name + `-pgSecretPolicy`, [{
|
|
@@ -39,8 +39,8 @@ module Make = (
|
|
|
39
39
|
type api = Inner.api
|
|
40
40
|
type component = Inner.component
|
|
41
41
|
|
|
42
|
-
let make = (~api, ~opts=?): component => {
|
|
43
|
-
let aggregate = Inner.make(~api, ~opts?)
|
|
42
|
+
let make = (~api, ~runtime=?, ~opts=?): component => {
|
|
43
|
+
let aggregate = Inner.make(~api, ~runtime?, ~opts?)
|
|
44
44
|
|
|
45
45
|
let eventLogOutputs = (aggregate->Inner.outputs).eventLog
|
|
46
46
|
let tableResource = eventLogOutputs.resources->Array.getUnsafe(0)
|
|
@@ -40,8 +40,8 @@ function Make(Spec) {
|
|
|
40
40
|
forEventCollector: AggregateRuntime_Builder_Micro$ReventlessAws.forEventCollector,
|
|
41
41
|
finish: AggregateRuntime_Builder_Micro$ReventlessAws.finish
|
|
42
42
|
})(Plugin_Helpers$ReventlessCore.NoopHooksConfig);
|
|
43
|
-
let make = (api, opts) => {
|
|
44
|
-
let aggregate = Inner.make(api, opts);
|
|
43
|
+
let make = (api, runtime, opts) => {
|
|
44
|
+
let aggregate = Inner.make(api, runtime, opts);
|
|
45
45
|
let eventLogOutputs = Inner.outputs(aggregate).eventLog;
|
|
46
46
|
let tableResource = eventLogOutputs.resources[0];
|
|
47
47
|
let eventLogTableName = tableResource.name;
|
|
@@ -38,8 +38,8 @@ module Make = (
|
|
|
38
38
|
type api = Inner.api
|
|
39
39
|
type component = Inner.component
|
|
40
40
|
|
|
41
|
-
let make = (~api, ~opts=?): component => {
|
|
42
|
-
let aggregate = Inner.make(~api, ~opts?)
|
|
41
|
+
let make = (~api, ~runtime=?, ~opts=?): component => {
|
|
42
|
+
let aggregate = Inner.make(~api, ~runtime?, ~opts?)
|
|
43
43
|
|
|
44
44
|
let eventLogOutputs = (aggregate->Inner.outputs).eventLog
|
|
45
45
|
let tableResource = eventLogOutputs.resources->Array.getUnsafe(0)
|
|
@@ -40,8 +40,8 @@ function Make(Spec) {
|
|
|
40
40
|
forEventCollector: AggregateRuntime_Builder_Single$ReventlessAws.forEventCollector,
|
|
41
41
|
finish: AggregateRuntime_Builder_Single$ReventlessAws.finish
|
|
42
42
|
})(Plugin_Helpers$ReventlessCore.NoopHooksConfig);
|
|
43
|
-
let make = (api, opts) => {
|
|
44
|
-
let aggregate = Inner.make(api, opts);
|
|
43
|
+
let make = (api, runtime, opts) => {
|
|
44
|
+
let aggregate = Inner.make(api, runtime, opts);
|
|
45
45
|
let eventLogOutputs = Inner.outputs(aggregate).eventLog;
|
|
46
46
|
let tableResource = eventLogOutputs.resources[0];
|
|
47
47
|
let eventLogTableName = tableResource.name;
|
|
@@ -34,8 +34,8 @@ module Make = (
|
|
|
34
34
|
type api = Inner.api
|
|
35
35
|
type component = Inner.component
|
|
36
36
|
|
|
37
|
-
let make = (~api, ~opts=?): component => {
|
|
38
|
-
let aggregate = Inner.make(~api, ~opts?)
|
|
37
|
+
let make = (~api, ~runtime=?, ~opts=?): component => {
|
|
38
|
+
let aggregate = Inner.make(~api, ~runtime?, ~opts?)
|
|
39
39
|
|
|
40
40
|
let eventLogOutputs = (aggregate->Inner.outputs).eventLog
|
|
41
41
|
let tableResource = eventLogOutputs.resources->Array.getUnsafe(0)
|
|
@@ -40,8 +40,8 @@ function Make(Spec) {
|
|
|
40
40
|
forEventCollector: AggregateRuntime_Builder_PerAggregate$ReventlessAws.forEventCollector,
|
|
41
41
|
finish: AggregateRuntime_Builder_PerAggregate$ReventlessAws.finish
|
|
42
42
|
})(Plugin_Helpers$ReventlessCore.NoopHooksConfig);
|
|
43
|
-
let make = (api, opts) => {
|
|
44
|
-
let aggregate = Inner.make(api, opts);
|
|
43
|
+
let make = (api, runtime, opts) => {
|
|
44
|
+
let aggregate = Inner.make(api, runtime, opts);
|
|
45
45
|
let eventLogOutputs = Inner.outputs(aggregate).eventLog;
|
|
46
46
|
let tableResource = eventLogOutputs.resources[0];
|
|
47
47
|
let eventLogTableName = tableResource.name;
|
|
@@ -34,8 +34,8 @@ module Make = (
|
|
|
34
34
|
type api = Inner.api
|
|
35
35
|
type component = Inner.component
|
|
36
36
|
|
|
37
|
-
let make = (~api, ~opts=?): component => {
|
|
38
|
-
let aggregate = Inner.make(~api, ~opts?)
|
|
37
|
+
let make = (~api, ~runtime=?, ~opts=?): component => {
|
|
38
|
+
let aggregate = Inner.make(~api, ~runtime?, ~opts?)
|
|
39
39
|
|
|
40
40
|
// Extract the event log table name from the aggregate's outputs.
|
|
41
41
|
// EventLog.outputs.resources[0] is the DynamoDB table resource. On the
|
|
@@ -42,8 +42,8 @@ function Make(Spec) {
|
|
|
42
42
|
forEventCollector: AggregateRuntime_Builder_Single$ReventlessAws.forEventCollector,
|
|
43
43
|
finish: AggregateRuntime_Builder_Single$ReventlessAws.finish
|
|
44
44
|
})(Plugin_Helpers$ReventlessCore.NoopHooksConfig);
|
|
45
|
-
let make = (api, opts) => {
|
|
46
|
-
let aggregate = Inner.make(api, opts);
|
|
45
|
+
let make = (api, runtime, opts) => {
|
|
46
|
+
let aggregate = Inner.make(api, runtime, opts);
|
|
47
47
|
let eventLogTableName;
|
|
48
48
|
if (EventLogBackend$ReventlessAws.isPostgres()) {
|
|
49
49
|
eventLogTableName = Pulumi.output(Spec.name + "EventLog");
|
|
@@ -34,8 +34,8 @@ module Make = (
|
|
|
34
34
|
type api = Inner.api
|
|
35
35
|
type component = Inner.component
|
|
36
36
|
|
|
37
|
-
let make = (~api, ~opts=?): component => {
|
|
38
|
-
let aggregate = Inner.make(~api, ~opts?)
|
|
37
|
+
let make = (~api, ~runtime=?, ~opts=?): component => {
|
|
38
|
+
let aggregate = Inner.make(~api, ~runtime?, ~opts?)
|
|
39
39
|
|
|
40
40
|
// Extract the event log table name from the aggregate's outputs.
|
|
41
41
|
// EventLog.outputs.resources[0] is the DynamoDB table resource. On the
|
|
@@ -42,8 +42,8 @@ function Make(Spec) {
|
|
|
42
42
|
forEventCollector: AggregateRuntime_Builder_Single_Async$ReventlessAws.forEventCollector,
|
|
43
43
|
finish: AggregateRuntime_Builder_Single_Async$ReventlessAws.finish
|
|
44
44
|
})(Plugin_Helpers$ReventlessCore.NoopHooksConfig);
|
|
45
|
-
let make = (api, opts) => {
|
|
46
|
-
let aggregate = Inner.make(api, opts);
|
|
45
|
+
let make = (api, runtime, opts) => {
|
|
46
|
+
let aggregate = Inner.make(api, runtime, opts);
|
|
47
47
|
let eventLogTableName;
|
|
48
48
|
if (EventLogBackend$ReventlessAws.isPostgres()) {
|
|
49
49
|
eventLogTableName = Pulumi.output(Spec.name + "EventLog");
|
|
@@ -30,8 +30,8 @@ module Make = (Api: {
|
|
|
30
30
|
let queryDbName = InnerMake.queryDbName
|
|
31
31
|
let sourceNames = InnerMake.sourceNames
|
|
32
32
|
|
|
33
|
-
let make = (~allEventTopics, ~publishJsons, ~context, ~opts=?): component => {
|
|
34
|
-
let as_ = InnerMake.make(~allEventTopics, ~publishJsons, ~context, ~opts?)
|
|
33
|
+
let make = (~allEventTopics, ~publishJsons, ~context, ~runtime=?, ~opts=?): component => {
|
|
34
|
+
let as_ = InnerMake.make(~allEventTopics, ~publishJsons, ~context, ~runtime?, ~opts?)
|
|
35
35
|
|
|
36
36
|
let queryDbOutputs = (as_->ReventlessCore.Component.outputs).queryDb
|
|
37
37
|
let tableResource = queryDbOutputs.resources->Array.getUnsafe(0)
|
|
@@ -33,8 +33,8 @@ function Make(Api) {
|
|
|
33
33
|
})(Api);
|
|
34
34
|
let Make$1 = Spec => (Automation => {
|
|
35
35
|
let InnerMake = Inner.Make(Spec)(Automation);
|
|
36
|
-
let make = (allEventTopics, publishJsons, context, opts) => {
|
|
37
|
-
let as_ = InnerMake.make(allEventTopics, publishJsons, context, opts);
|
|
36
|
+
let make = (allEventTopics, publishJsons, context, runtime, opts) => {
|
|
37
|
+
let as_ = InnerMake.make(allEventTopics, publishJsons, context, runtime, opts);
|
|
38
38
|
let queryDbOutputs = Component$ReventlessCore.outputs(as_).queryDb;
|
|
39
39
|
let tableResource = queryDbOutputs.resources[0];
|
|
40
40
|
let queryDbTableName = tableResource.name;
|
|
@@ -2,6 +2,13 @@ module CommandTopicChannel = CommandTopicChannel.SQS_Sync
|
|
|
2
2
|
module RuntimeEnvironment = RuntimeEnvironment.Lambda
|
|
3
3
|
module ExtensionPointRuntimeBuilder = ExtensionPointRuntime_Builder_PerExtensionPoint
|
|
4
4
|
|
|
5
|
+
// Per-extension-point Lambda floor for AWS; a plugin.json `runtime` override
|
|
6
|
+
// raises it via `RuntimeHints.resolveMemory`/`resolveTimeout`.
|
|
7
|
+
module Defaults: ReventlessInfra.RuntimeDefaults.T = {
|
|
8
|
+
let memorySize = 1024
|
|
9
|
+
let timeout = 30
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
module Make = (
|
|
6
13
|
Spec: ReventlessInfra.ExtensionPointMapping.Spec,
|
|
7
14
|
Mappings: ReventlessInfra.ExtensionPoint.Mappings with module Spec := Spec,
|
|
@@ -13,4 +20,5 @@ module Make = (
|
|
|
13
20
|
CommandTopicChannel,
|
|
14
21
|
EventTopicPublisher.SNS,
|
|
15
22
|
ExtensionPointRuntimeBuilder,
|
|
23
|
+
Defaults,
|
|
16
24
|
)
|
|
@@ -6,6 +6,11 @@ import * as RuntimeEnvironment_Lambda$ReventlessAws from "../adapter/Runtime/Run
|
|
|
6
6
|
import * as CommandTopicChannel_SQS_Sync$ReventlessAws from "../adapter/CommandTopic/CommandTopicChannel_SQS_Sync.res.mjs";
|
|
7
7
|
import * as ExtensionPointRuntime_Builder_PerExtensionPoint$ReventlessAws from "../adapter/Runtime/ExtensionPointRuntime_Builder_PerExtensionPoint.res.mjs";
|
|
8
8
|
|
|
9
|
+
let Defaults = {
|
|
10
|
+
memorySize: 1024,
|
|
11
|
+
timeout: 30
|
|
12
|
+
};
|
|
13
|
+
|
|
9
14
|
function Make(Spec) {
|
|
10
15
|
return Mappings => ExtensionPoint_Builder$ReventlessCore.Make(Spec)(Mappings)({
|
|
11
16
|
make: RuntimeEnvironment_Lambda$ReventlessAws.make,
|
|
@@ -19,7 +24,7 @@ function Make(Spec) {
|
|
|
19
24
|
make: EventTopicPublisher_SNS$ReventlessAws.make
|
|
20
25
|
})({
|
|
21
26
|
forCommandTopic: ExtensionPointRuntime_Builder_PerExtensionPoint$ReventlessAws.forCommandTopic
|
|
22
|
-
});
|
|
27
|
+
})(Defaults);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
let CommandTopicChannel;
|
|
@@ -32,6 +37,7 @@ export {
|
|
|
32
37
|
CommandTopicChannel,
|
|
33
38
|
RuntimeEnvironment,
|
|
34
39
|
ExtensionPointRuntimeBuilder,
|
|
40
|
+
Defaults,
|
|
35
41
|
Make,
|
|
36
42
|
}
|
|
37
43
|
/* EventTopicPublisher_SNS-ReventlessAws Not a pure module */
|
|
@@ -38,8 +38,8 @@ module Make = (Api: {
|
|
|
38
38
|
type component = InnerMake.component
|
|
39
39
|
let queryDbName = InnerMake.queryDbName
|
|
40
40
|
|
|
41
|
-
let make = (~dcbEventLog, ~publishJsons, ~opts=?): component => {
|
|
42
|
-
let ots = InnerMake.make(~dcbEventLog, ~publishJsons, ~opts?)
|
|
41
|
+
let make = (~dcbEventLog, ~publishJsons, ~runtime=?, ~opts=?): component => {
|
|
42
|
+
let ots = InnerMake.make(~dcbEventLog, ~publishJsons, ~runtime?, ~opts?)
|
|
43
43
|
|
|
44
44
|
let queryDbOutputs = (ots->ReventlessCore.Component.outputs).queryDb
|
|
45
45
|
let tableResource = queryDbOutputs.resources->Array.getUnsafe(0)
|
|
@@ -40,8 +40,8 @@ function Make(Api) {
|
|
|
40
40
|
})(Api);
|
|
41
41
|
let Make$1 = Spec => (Translation => {
|
|
42
42
|
let InnerMake = Inner.Make(Spec)(Translation);
|
|
43
|
-
let make = (dcbEventLog, publishJsons, opts) => {
|
|
44
|
-
let ots = InnerMake.make(dcbEventLog, publishJsons, opts);
|
|
43
|
+
let make = (dcbEventLog, publishJsons, runtime, opts) => {
|
|
44
|
+
let ots = InnerMake.make(dcbEventLog, publishJsons, runtime, opts);
|
|
45
45
|
let queryDbOutputs = Component$ReventlessCore.outputs(ots).queryDb;
|
|
46
46
|
let tableResource = queryDbOutputs.resources[0];
|
|
47
47
|
let queryDbTableName = tableResource.name;
|
|
@@ -31,8 +31,8 @@ module Make = (
|
|
|
31
31
|
type api = Inner.api
|
|
32
32
|
type role = Inner.role
|
|
33
33
|
type component = Inner.component
|
|
34
|
-
let make = (~api, ~apiRole, ~allEventTopics, ~opts=?): component => {
|
|
35
|
-
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~opts?)
|
|
34
|
+
let make = (~api, ~apiRole, ~allEventTopics, ~runtime=?, ~opts=?): component => {
|
|
35
|
+
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~runtime?, ~opts?)
|
|
36
36
|
|
|
37
37
|
let queryDbOutputs = (readModel->Inner.outputs).queryDb
|
|
38
38
|
let tableResource = queryDbOutputs.resources->Array.getUnsafe(0)
|
|
@@ -29,8 +29,8 @@ function Make(Spec) {
|
|
|
29
29
|
forEventCollector: EventCollectorRuntime_Builder_Single$ReventlessAws.forEventCollector,
|
|
30
30
|
finish: EventCollectorRuntime_Builder_Single$ReventlessAws.finish
|
|
31
31
|
});
|
|
32
|
-
let make = (api, apiRole, allEventTopics, opts) => {
|
|
33
|
-
let readModel = Inner.make(api, apiRole, allEventTopics, opts);
|
|
32
|
+
let make = (api, apiRole, allEventTopics, runtime, opts) => {
|
|
33
|
+
let readModel = Inner.make(api, apiRole, allEventTopics, runtime, opts);
|
|
34
34
|
let queryDbOutputs = Inner.outputs(readModel).queryDb;
|
|
35
35
|
let tableResource = queryDbOutputs.resources[0];
|
|
36
36
|
let queryDbTableName = tableResource.name;
|
|
@@ -36,8 +36,8 @@ module Make = (
|
|
|
36
36
|
type api = Inner.api
|
|
37
37
|
type role = Inner.role
|
|
38
38
|
type component = Inner.component
|
|
39
|
-
let make = (~api, ~apiRole, ~allEventTopics, ~opts=?): component => {
|
|
40
|
-
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~opts?)
|
|
39
|
+
let make = (~api, ~apiRole, ~allEventTopics, ~runtime=?, ~opts=?): component => {
|
|
40
|
+
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~runtime?, ~opts?)
|
|
41
41
|
|
|
42
42
|
// On the Postgres backend there is no DynamoDB table (resources is empty) —
|
|
43
43
|
// the read-model spec name is the stable `qdb_<name>` discriminator, both
|
|
@@ -29,8 +29,8 @@ function Make(Spec) {
|
|
|
29
29
|
forEventCollector: EventCollectorRuntime_Builder_Single$ReventlessAws.forEventCollector,
|
|
30
30
|
finish: EventCollectorRuntime_Builder_Single$ReventlessAws.finish
|
|
31
31
|
});
|
|
32
|
-
let make = (api, apiRole, allEventTopics, opts) => {
|
|
33
|
-
let readModel = Inner.make(api, apiRole, allEventTopics, opts);
|
|
32
|
+
let make = (api, apiRole, allEventTopics, runtime, opts) => {
|
|
33
|
+
let readModel = Inner.make(api, apiRole, allEventTopics, runtime, opts);
|
|
34
34
|
let pgBacked = QueryDbBackend$ReventlessAws.isPostgresFor(Inner.Spec.name);
|
|
35
35
|
let queryDbTableName;
|
|
36
36
|
if (pgBacked) {
|
|
@@ -29,8 +29,8 @@ module Make = (
|
|
|
29
29
|
type role = Inner.role
|
|
30
30
|
type component = Inner.component
|
|
31
31
|
|
|
32
|
-
let make = (~api, ~apiRole, ~allEventTopics, ~opts=?): component => {
|
|
33
|
-
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~opts?)
|
|
32
|
+
let make = (~api, ~apiRole, ~allEventTopics, ~runtime=?, ~opts=?): component => {
|
|
33
|
+
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~runtime?, ~opts?)
|
|
34
34
|
|
|
35
35
|
let queryDbOutputs = (readModel->Inner.outputs).queryDb
|
|
36
36
|
let tableResource = queryDbOutputs.resources->Array.getUnsafe(0)
|
|
@@ -31,8 +31,8 @@ function Make(Spec) {
|
|
|
31
31
|
forEventCollector: EventCollectorRuntime_Builder_PerEventCollector$ReventlessAws.forEventCollector,
|
|
32
32
|
finish: EventCollectorRuntime_Builder_PerEventCollector$ReventlessAws.finish
|
|
33
33
|
});
|
|
34
|
-
let make = (api, apiRole, allEventTopics, opts) => {
|
|
35
|
-
let readModel = Inner.make(api, apiRole, allEventTopics, opts);
|
|
34
|
+
let make = (api, apiRole, allEventTopics, runtime, opts) => {
|
|
35
|
+
let readModel = Inner.make(api, apiRole, allEventTopics, runtime, opts);
|
|
36
36
|
let queryDbOutputs = Inner.outputs(readModel).queryDb;
|
|
37
37
|
let tableResource = queryDbOutputs.resources[0];
|
|
38
38
|
let queryDbTableName = tableResource.name;
|
|
@@ -28,8 +28,8 @@ module Make = (
|
|
|
28
28
|
type api = Inner.api
|
|
29
29
|
type role = Inner.role
|
|
30
30
|
type component = Inner.component
|
|
31
|
-
let make = (~api, ~apiRole, ~allEventTopics, ~opts=?): component => {
|
|
32
|
-
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~opts?)
|
|
31
|
+
let make = (~api, ~apiRole, ~allEventTopics, ~runtime=?, ~opts=?): component => {
|
|
32
|
+
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~runtime?, ~opts?)
|
|
33
33
|
|
|
34
34
|
// On the Postgres backend there is no DynamoDB table (resources is empty) —
|
|
35
35
|
// the read-model spec name is the stable `qdb_<name>` discriminator, both
|
|
@@ -29,8 +29,8 @@ function Make(Spec) {
|
|
|
29
29
|
forEventCollector: EventCollectorRuntime_Builder_Single$ReventlessAws.forEventCollector,
|
|
30
30
|
finish: EventCollectorRuntime_Builder_Single$ReventlessAws.finish
|
|
31
31
|
});
|
|
32
|
-
let make = (api, apiRole, allEventTopics, opts) => {
|
|
33
|
-
let readModel = Inner.make(api, apiRole, allEventTopics, opts);
|
|
32
|
+
let make = (api, apiRole, allEventTopics, runtime, opts) => {
|
|
33
|
+
let readModel = Inner.make(api, apiRole, allEventTopics, runtime, opts);
|
|
34
34
|
let pgBacked = QueryDbBackend$ReventlessAws.isPostgresFor(Inner.Spec.name);
|
|
35
35
|
let queryDbTableName;
|
|
36
36
|
if (pgBacked) {
|
|
@@ -36,8 +36,8 @@ module Make = (
|
|
|
36
36
|
type api = Inner.api
|
|
37
37
|
type role = Inner.role
|
|
38
38
|
type component = Inner.component
|
|
39
|
-
let make = (~api, ~apiRole, ~allEventTopics, ~opts=?): component => {
|
|
40
|
-
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~opts?)
|
|
39
|
+
let make = (~api, ~apiRole, ~allEventTopics, ~runtime=?, ~opts=?): component => {
|
|
40
|
+
let readModel = Inner.make(~api, ~apiRole, ~allEventTopics, ~runtime?, ~opts?)
|
|
41
41
|
|
|
42
42
|
// On the Postgres backend there is no DynamoDB table (resources is empty) —
|
|
43
43
|
// the read-model spec name is the stable `qdb_<name>` discriminator, both
|
|
@@ -29,8 +29,8 @@ function Make(Spec) {
|
|
|
29
29
|
forEventCollector: EventCollectorRuntime_Builder_Single$ReventlessAws.forEventCollector,
|
|
30
30
|
finish: EventCollectorRuntime_Builder_Single$ReventlessAws.finish
|
|
31
31
|
});
|
|
32
|
-
let make = (api, apiRole, allEventTopics, opts) => {
|
|
33
|
-
let readModel = Inner.make(api, apiRole, allEventTopics, opts);
|
|
32
|
+
let make = (api, apiRole, allEventTopics, runtime, opts) => {
|
|
33
|
+
let readModel = Inner.make(api, apiRole, allEventTopics, runtime, opts);
|
|
34
34
|
let pgBacked = QueryDbBackend$ReventlessAws.isPostgresFor(Inner.Spec.name);
|
|
35
35
|
let queryDbTableName;
|
|
36
36
|
if (pgBacked) {
|
|
@@ -29,8 +29,8 @@ module Make = (Api: {
|
|
|
29
29
|
module Projection = Projection
|
|
30
30
|
type component = InnerMake.component
|
|
31
31
|
|
|
32
|
-
let make = (~dcbEventLog, ~opts=?): component => {
|
|
33
|
-
let sv = InnerMake.make(~dcbEventLog, ~opts?)
|
|
32
|
+
let make = (~dcbEventLog, ~runtime=?, ~opts=?): component => {
|
|
33
|
+
let sv = InnerMake.make(~dcbEventLog, ~runtime?, ~opts?)
|
|
34
34
|
let queryDbOutputs = (sv->ReventlessCore.Component.outputs).queryDb
|
|
35
35
|
// On the Postgres backend there is no DynamoDB table (resources is
|
|
36
36
|
// empty) — the slice spec name is the stable `qdb_<name>` discriminator.
|
|
@@ -31,8 +31,8 @@ function Make(Api) {
|
|
|
31
31
|
})(Api);
|
|
32
32
|
let Make$1 = Spec => (Projection => {
|
|
33
33
|
let InnerMake = Inner.Make(Spec)(Projection);
|
|
34
|
-
let make = (dcbEventLog, opts) => {
|
|
35
|
-
let sv = InnerMake.make(dcbEventLog, opts);
|
|
34
|
+
let make = (dcbEventLog, runtime, opts) => {
|
|
35
|
+
let sv = InnerMake.make(dcbEventLog, runtime, opts);
|
|
36
36
|
let queryDbOutputs = Component$ReventlessCore.outputs(sv).queryDb;
|
|
37
37
|
let queryDbTableName = QueryDbBackend$ReventlessAws.isPostgresFor(Spec.name) ? Pulumi.output(Spec.name) : queryDbOutputs.resources[0].name;
|
|
38
38
|
StateViewSliceRuntime_Builder_Single$ReventlessAws.registerStateViewSlice(Spec.name, Util_Bundle$ReventlessAws.getModuleSpecifier(Spec.moduleUrl), Util_Bundle$ReventlessAws.getModuleSpecifier(Projection.moduleUrl), queryDbTableName, queryDbOutputs.resources);
|
|
@@ -33,8 +33,8 @@ module Make = (Api: {
|
|
|
33
33
|
module Projection = Projection
|
|
34
34
|
type component = InnerMake.component
|
|
35
35
|
|
|
36
|
-
let make = (~dcbEventLog, ~opts=?): component => {
|
|
37
|
-
let sv = InnerMake.make(~dcbEventLog, ~opts?)
|
|
36
|
+
let make = (~dcbEventLog, ~runtime=?, ~opts=?): component => {
|
|
37
|
+
let sv = InnerMake.make(~dcbEventLog, ~runtime?, ~opts?)
|
|
38
38
|
let queryDbOutputs = (sv->ReventlessCore.Component.outputs).queryDb
|
|
39
39
|
// On the Postgres backend there is no DynamoDB table (resources is
|
|
40
40
|
// empty) — the slice spec name is the stable `qdb_<name>` discriminator.
|
|
@@ -31,8 +31,8 @@ function Make(Api) {
|
|
|
31
31
|
})(Api);
|
|
32
32
|
let Make$1 = Spec => (Projection => {
|
|
33
33
|
let InnerMake = Inner.Make(Spec)(Projection);
|
|
34
|
-
let make = (dcbEventLog, opts) => {
|
|
35
|
-
let sv = InnerMake.make(dcbEventLog, opts);
|
|
34
|
+
let make = (dcbEventLog, runtime, opts) => {
|
|
35
|
+
let sv = InnerMake.make(dcbEventLog, runtime, opts);
|
|
36
36
|
let queryDbOutputs = Component$ReventlessCore.outputs(sv).queryDb;
|
|
37
37
|
let queryDbTableName = QueryDbBackend$ReventlessAws.isPostgresFor(Spec.name) ? Pulumi.output(Spec.name) : queryDbOutputs.resources[0].name;
|
|
38
38
|
StateViewSliceRuntime_Builder_Single$ReventlessAws.registerStateViewSlice(Spec.name, Util_Bundle$ReventlessAws.getModuleSpecifier(Spec.moduleUrl), Util_Bundle$ReventlessAws.getModuleSpecifier(Projection.moduleUrl), queryDbTableName, queryDbOutputs.resources);
|
|
@@ -14,6 +14,8 @@ let TaskRuntimeBuilder = Task_Builder_PerBucket$ReventlessAws.TaskRuntimeBuilder
|
|
|
14
14
|
|
|
15
15
|
let SideEffectHandler = Task_Builder_PerBucket$ReventlessAws.SideEffectHandler;
|
|
16
16
|
|
|
17
|
+
let Defaults = Task_Builder_PerBucket$ReventlessAws.Defaults;
|
|
18
|
+
|
|
17
19
|
let Make = Task_Builder_PerBucket$ReventlessAws.Make;
|
|
18
20
|
|
|
19
21
|
export {
|
|
@@ -23,6 +25,7 @@ export {
|
|
|
23
25
|
TaskBucket,
|
|
24
26
|
TaskRuntimeBuilder,
|
|
25
27
|
SideEffectHandler,
|
|
28
|
+
Defaults,
|
|
26
29
|
Make,
|
|
27
30
|
}
|
|
28
31
|
/* Task_Builder_PerBucket-ReventlessAws Not a pure module */
|
|
@@ -8,6 +8,13 @@ module TaskBucket = TaskBucket.S3
|
|
|
8
8
|
module TaskRuntimeBuilder = TaskRuntime_Builder_PerBucket
|
|
9
9
|
module SideEffectHandler = SideEffectHandler_PerSideEffectHandler
|
|
10
10
|
|
|
11
|
+
// Per-bucket task Lambda floor for AWS (large envelope for bulk import/export);
|
|
12
|
+
// a plugin.json `runtime` override raises it via `RuntimeHints`.
|
|
13
|
+
module Defaults: ReventlessInfra.RuntimeDefaults.T = {
|
|
14
|
+
let memorySize = 4096
|
|
15
|
+
let timeout = 600
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
module Make = (Spec: ReventlessCore.Task.Spec): (
|
|
12
19
|
ReventlessCore.Task.T with module Spec = Spec
|
|
13
20
|
) =>
|
|
@@ -19,4 +26,5 @@ module Make = (Spec: ReventlessCore.Task.Spec): (
|
|
|
19
26
|
TaskRuntimeBuilder,
|
|
20
27
|
TaskBucket,
|
|
21
28
|
SideEffectHandler,
|
|
29
|
+
Defaults,
|
|
22
30
|
)
|
|
@@ -19,6 +19,11 @@ let EventCollectorRuntimeBuilder = EventCollectorRuntime_Builder_PerEventCollect
|
|
|
19
19
|
connect: EventCollectorChannel_DynamoDbStream$ReventlessAws.connect
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
let Defaults = {
|
|
23
|
+
memorySize: 4096,
|
|
24
|
+
timeout: 600
|
|
25
|
+
};
|
|
26
|
+
|
|
22
27
|
function Make(Spec) {
|
|
23
28
|
return Task_Builder$ReventlessCore.Make(Spec)({
|
|
24
29
|
make: RuntimeEnvironment_Lambda$ReventlessAws.make,
|
|
@@ -38,7 +43,7 @@ function Make(Spec) {
|
|
|
38
43
|
make: TaskBucket_S3$ReventlessAws.make
|
|
39
44
|
})({
|
|
40
45
|
make: SideEffectHandler_PerSideEffectHandler$ReventlessAws.make
|
|
41
|
-
});
|
|
46
|
+
})(Defaults);
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
let EventCollectorChannel;
|
|
@@ -58,6 +63,7 @@ export {
|
|
|
58
63
|
TaskBucket,
|
|
59
64
|
TaskRuntimeBuilder,
|
|
60
65
|
SideEffectHandler,
|
|
66
|
+
Defaults,
|
|
61
67
|
Make,
|
|
62
68
|
}
|
|
63
69
|
/* EventCollectorRuntimeBuilder Not a pure module */
|
|
@@ -748,7 +748,10 @@ module Make = (
|
|
|
748
748
|
ReventlessCore.Runtime.effectHandler<'callbackEvent, context, unit, string>,
|
|
749
749
|
runtimeParts,
|
|
750
750
|
ReventlessCore.CommandTopic.component<'op>,
|
|
751
|
-
|
|
751
|
+
// `~memorySize`/`~timeout` carry the per-component runtime floor (max across
|
|
752
|
+
// this shared Lambda's StateChangeSlices' plugin.json overrides, 0 if none),
|
|
753
|
+
// folded with the per-flavor commandHandlerConfig in the build below.
|
|
754
|
+
> = (~handler as _, ~connect, ~memorySize=0, ~timeout=0, dcbCommandTopic) => {
|
|
752
755
|
let dcbConfig = dcbConfigRef.contents
|
|
753
756
|
let slicePaths =
|
|
754
757
|
registeredSliceModulePaths
|
|
@@ -760,6 +763,8 @@ module Make = (
|
|
|
760
763
|
~pluginName=dcbConfig.pluginName,
|
|
761
764
|
~syncConfig=syncStateChangesConfigRef.contents,
|
|
762
765
|
~asyncConfig=asyncStateChangesConfigRef.contents,
|
|
766
|
+
~sliceMemoryFloor=memorySize,
|
|
767
|
+
~sliceTimeoutFloor=timeout,
|
|
763
768
|
~connect,
|
|
764
769
|
dcbCommandTopic,
|
|
765
770
|
)
|
|
@@ -425,15 +425,15 @@ function Make(EventCollectorChannel) {
|
|
|
425
425
|
let match = Util_Bundle$ReventlessAws.buildCodeArchive("@reventlessdev/reventless-aws/src/adapter/Runtime/HeartbeatEntryPoint.mjs", {}, undefined);
|
|
426
426
|
connect(RuntimeEnvironment_Lambda$ReventlessAws.makeFromCodeAsset(name, "Scheduler", match.code, match.sourceCodeHash, envVars, memorySize, timeout, undefined, undefined, undefined, undefined, undefined, opts));
|
|
427
427
|
};
|
|
428
|
-
let forDcbCommandTopic = (param, connect,
|
|
429
|
-
|
|
430
|
-
|
|
428
|
+
let forDcbCommandTopic = (param, connect, memorySizeOpt, timeoutOpt, dcbCommandTopic) => {
|
|
429
|
+
let memorySize = memorySizeOpt !== undefined ? memorySizeOpt : 0;
|
|
430
|
+
let timeout = timeoutOpt !== undefined ? timeoutOpt : 0;
|
|
431
431
|
let dcbConfig = dcbConfigRef.contents;
|
|
432
432
|
let slicePaths = registeredSliceModulePaths.concat(dcbConfig.stateChangeSliceModulePaths).map(param => [
|
|
433
433
|
param.specPath,
|
|
434
434
|
param.behaviorPath
|
|
435
435
|
]);
|
|
436
|
-
StateChangeSliceRuntime_Builder_Single$ReventlessAws.forDcbCommandTopic(slicePaths, dcbConfig.dcbTableName, dcbConfig.pluginName, syncStateChangesConfigRef.contents, asyncStateChangesConfigRef.contents, connect, dcbCommandTopic);
|
|
436
|
+
StateChangeSliceRuntime_Builder_Single$ReventlessAws.forDcbCommandTopic(slicePaths, dcbConfig.dcbTableName, dcbConfig.pluginName, syncStateChangesConfigRef.contents, asyncStateChangesConfigRef.contents, memorySize, timeout, connect, dcbCommandTopic);
|
|
437
437
|
};
|
|
438
438
|
let finish = () => {};
|
|
439
439
|
return {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
+
import * as ExtensionPoint_Builder$ReventlessAws from "../../components/ExtensionPoint_Builder.res.mjs";
|
|
4
5
|
import * as EventTopicPublisher_SNS$ReventlessAws from "../../adapter/EventTopic/EventTopicPublisher_SNS.res.mjs";
|
|
5
6
|
import * as PluginRuntimeOperations$ReventlessAws from "../runtime/PluginRuntimeOperations.res.mjs";
|
|
6
7
|
import * as RuntimeEnvironment_Lambda$ReventlessAws from "../../adapter/Runtime/RuntimeEnvironment_Lambda.res.mjs";
|
|
@@ -27,7 +28,7 @@ function MakeWithConfig(Config) {
|
|
|
27
28
|
make: EventTopicPublisher_SNS$ReventlessAws.make
|
|
28
29
|
})({
|
|
29
30
|
forCommandTopic: PluginExtensionPointRuntime_Builder$ReventlessAws.forCommandTopic
|
|
30
|
-
});
|
|
31
|
+
})(ExtensionPoint_Builder$ReventlessAws.Defaults);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
let environment = Stdlib_Option.getOr(process.env.Environment, "unknown");
|
|
@@ -49,7 +50,7 @@ let Make = PluginExtensionPoint_Builder$ReventlessCore.Make({
|
|
|
49
50
|
make: EventTopicPublisher_SNS$ReventlessAws.make
|
|
50
51
|
})({
|
|
51
52
|
forCommandTopic: PluginExtensionPointRuntime_Builder$ReventlessAws.forCommandTopic
|
|
52
|
-
});
|
|
53
|
+
})(ExtensionPoint_Builder$ReventlessAws.Defaults);
|
|
53
54
|
|
|
54
55
|
let CommandTopicChannel;
|
|
55
56
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
open JestGlobals
|
|
2
|
+
|
|
3
|
+
// The per-kind EP/task pod floor is now supplied by each platform's `Defaults`
|
|
4
|
+
// module (RuntimeDefaults.T) and fed into RuntimeHints.resolveMemory/resolveTimeout
|
|
5
|
+
// by the core builders, replacing core's old hardcoded literals. These guard that
|
|
6
|
+
// the AWS binding stays behavior-preserving: EP pods still floor at 1024 MiB / 30 s
|
|
7
|
+
// and task pods at 4096 MiB / 600 s. A plugin.json `runtime` override still raises
|
|
8
|
+
// memory (Math.Int.max) and replaces timeout on top of these — see RuntimeHintsTest.
|
|
9
|
+
|
|
10
|
+
describe("AWS extension-point runtime defaults", () => {
|
|
11
|
+
testSync("memory floor is 1024 MiB", () => {
|
|
12
|
+
expect(ExtensionPoint_Builder.Defaults.memorySize)->toBe(1024)
|
|
13
|
+
})
|
|
14
|
+
testSync("timeout floor is 30 s", () => {
|
|
15
|
+
expect(ExtensionPoint_Builder.Defaults.timeout)->toBe(30)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
describe("AWS task runtime defaults", () => {
|
|
20
|
+
testSync("memory floor is 4096 MiB", () => {
|
|
21
|
+
expect(Task_Builder_PerBucket.Defaults.memorySize)->toBe(4096)
|
|
22
|
+
})
|
|
23
|
+
testSync("timeout floor is 600 s", () => {
|
|
24
|
+
expect(Task_Builder_PerBucket.Defaults.timeout)->toBe(600)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as ExtensionPoint_Builder$ReventlessAws from "../src/components/ExtensionPoint_Builder.res.mjs";
|
|
4
|
+
import * as Task_Builder_PerBucket$ReventlessAws from "../src/components/Task_Builder_PerBucket.res.mjs";
|
|
5
|
+
|
|
6
|
+
globalThis.describe("AWS extension-point runtime defaults", () => {
|
|
7
|
+
globalThis.test("memory floor is 1024 MiB", () => {
|
|
8
|
+
globalThis.expect(ExtensionPoint_Builder$ReventlessAws.Defaults.memorySize).toBe(1024);
|
|
9
|
+
});
|
|
10
|
+
globalThis.test("timeout floor is 30 s", () => {
|
|
11
|
+
globalThis.expect(ExtensionPoint_Builder$ReventlessAws.Defaults.timeout).toBe(30);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
globalThis.describe("AWS task runtime defaults", () => {
|
|
16
|
+
globalThis.test("memory floor is 4096 MiB", () => {
|
|
17
|
+
globalThis.expect(Task_Builder_PerBucket$ReventlessAws.Defaults.memorySize).toBe(4096);
|
|
18
|
+
});
|
|
19
|
+
globalThis.test("timeout floor is 600 s", () => {
|
|
20
|
+
globalThis.expect(Task_Builder_PerBucket$ReventlessAws.Defaults.timeout).toBe(600);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/* Not a pure module */
|