@reventlessdev/reventless-aws 3.0.0-alpha.396 → 3.0.0-alpha.397
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
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.397 (2026-10-23)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **aws:** a supplied pool without an identity store deploys, and its accounts keep their pool id ([49695ef](https://github.com/ReventlessDev/reventless-core/commit/49695ef79de89925c1e718ee9afa9a6ad7abd1f9))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
# 3.0.0-alpha.396 (2026-10-23)
|
|
7
14
|
|
|
8
15
|
### Features
|
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.397",
|
|
4
4
|
"description": "AWS adapters for Reventless",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"sury": "11.0.0",
|
|
23
23
|
"uuid": "^13.0.0",
|
|
24
24
|
"yaml": "^2.8.3",
|
|
25
|
-
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.
|
|
26
|
-
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
25
|
+
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.35",
|
|
27
26
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
28
|
-
"@reventlessdev/rescript-pulumi-aws": "3.0.0-alpha.
|
|
27
|
+
"@reventlessdev/rescript-pulumi-aws": "3.0.0-alpha.33",
|
|
28
|
+
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
29
29
|
"@reventlessdev/rescript-node": "2.0.0-alpha.23",
|
|
30
30
|
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
31
31
|
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
32
32
|
"@reventlessdev/rescript-web": "1.0.0-alpha.8",
|
|
33
|
-
"@reventlessdev/reventless-core": "3.0.0-alpha.307",
|
|
34
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.204",
|
|
35
33
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.42",
|
|
34
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.204",
|
|
36
35
|
"@reventlessdev/reventless-postgres": "3.0.0-alpha.171",
|
|
37
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.175"
|
|
36
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.175",
|
|
37
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.307"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"rescript": "12.3.1",
|
|
@@ -64,7 +64,7 @@ let make = (
|
|
|
64
64
|
~id=name ++ "Policy",
|
|
65
65
|
~statements=[
|
|
66
66
|
{
|
|
67
|
-
sid: "AllowLambdaLogging",
|
|
67
|
+
PolicyDocument.sid: "AllowLambdaLogging",
|
|
68
68
|
effect: Allow,
|
|
69
69
|
actions: Actions([
|
|
70
70
|
"logs:CreateLogGroup",
|
|
@@ -79,13 +79,20 @@ let make = (
|
|
|
79
79
|
actions: Action("dynamodb:GetItem"),
|
|
80
80
|
resources: Resource(tableArn),
|
|
81
81
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
]->Array.concat(
|
|
83
|
+
// A supplied pool with no identity store yet: nothing to read, and
|
|
84
|
+
// an empty resource would make the policy invalid.
|
|
85
|
+
identityArn == ""
|
|
86
|
+
? []
|
|
87
|
+
: [
|
|
88
|
+
{
|
|
89
|
+
sid: "AllowReadingDomainId",
|
|
90
|
+
effect: Allow,
|
|
91
|
+
actions: Action("dynamodb:GetItem"),
|
|
92
|
+
resources: Resource(identityArn),
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
),
|
|
89
96
|
)
|
|
90
97
|
->PolicyDocument.toJsonString
|
|
91
98
|
->Pulumi.Input.make,
|
|
@@ -19,6 +19,7 @@ function make(activeRoleTableName, activeRoleTableArn, identityTableName, identi
|
|
|
19
19
|
activeRoleTableArn,
|
|
20
20
|
identityTableArn
|
|
21
21
|
]).apply(param => {
|
|
22
|
+
let identityArn = param[1];
|
|
22
23
|
new (Aws.iam.RolePolicy)(name + "Policy", {
|
|
23
24
|
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, name + "Policy", [
|
|
24
25
|
{
|
|
@@ -36,14 +37,13 @@ function make(activeRoleTableName, activeRoleTableArn, identityTableName, identi
|
|
|
36
37
|
Effect: "Allow",
|
|
37
38
|
Action: "dynamodb:GetItem",
|
|
38
39
|
Resource: param[0]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
Sid: "AllowReadingDomainId",
|
|
42
|
-
Effect: "Allow",
|
|
43
|
-
Action: "dynamodb:GetItem",
|
|
44
|
-
Resource: param[1]
|
|
45
40
|
}
|
|
46
|
-
]
|
|
41
|
+
].concat(identityArn === "" ? [] : [{
|
|
42
|
+
Sid: "AllowReadingDomainId",
|
|
43
|
+
Effect: "Allow",
|
|
44
|
+
Action: "dynamodb:GetItem",
|
|
45
|
+
Resource: identityArn
|
|
46
|
+
}]))),
|
|
47
47
|
role: lambdaRole.id
|
|
48
48
|
}, opts$1);
|
|
49
49
|
});
|
|
@@ -41,12 +41,51 @@ let makeTable = (
|
|
|
41
41
|
{name: table.name, arn: table.arn}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
let log = ReventlessCore.Logger.fromEnv()
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
The [ProviderScoped] table if `provision-identity` has created it, else an empty
|
|
48
|
+
name and ARN.
|
|
49
|
+
|
|
50
|
+
🚨 **Absent is a supported state, not a failed lookup** — unlike the active-role
|
|
51
|
+
store, which a supplied pool has always had. A pool provisioned before this store
|
|
52
|
+
existed has no table, and its deployments must keep deploying: the trigger then
|
|
53
|
+
adds no claim and every account keeps its `sub`, which is exactly what each one
|
|
54
|
+
did before. Running `provision-identity` again creates the table, and the next
|
|
55
|
+
deploy picks it up. A Pulumi `getTable` fails the whole program on a missing
|
|
56
|
+
table, so this asks DynamoDB directly.
|
|
57
|
+
*/
|
|
58
|
+
let lookupTableIfPresent = (~tableName: string): storeTable => {
|
|
59
|
+
let arn = Pulumi.Output.make(tableName)->Pulumi.Output.flatMap(name =>
|
|
60
|
+
(
|
|
61
|
+
async () =>
|
|
62
|
+
try {
|
|
63
|
+
let out = await AwsSdk.DynamoDb_DynamoDb.DescribeTableCommand.make({
|
|
64
|
+
tableName: name,
|
|
65
|
+
})->AwsSdk.DynamoDb_DynamoDb.DescribeTableCommand.send
|
|
66
|
+
out.table->Option.flatMap(t => t.tableArn)->Option.getOr("")
|
|
67
|
+
} catch {
|
|
68
|
+
| exn if Util_AwsError.isNotFound(exn) =>
|
|
69
|
+
log.warn(
|
|
70
|
+
~comp="IdentityStore",
|
|
71
|
+
`no identity store "${name}" on this provider — accounts keep their pool id. Run provision-identity to create it.`,
|
|
72
|
+
)
|
|
73
|
+
""
|
|
74
|
+
}
|
|
75
|
+
)()->Pulumi.Output.fromPromise
|
|
76
|
+
)
|
|
77
|
+
{
|
|
78
|
+
name: arn->Pulumi.Output.apply(found => found == "" ? "" : tableName),
|
|
79
|
+
arn,
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The store a resolved provider calls for — created, or looked up if present. */
|
|
45
84
|
let resolveTable = (
|
|
46
85
|
~choice: Auth_ActiveRoleStore.storeChoice,
|
|
47
86
|
~opts: Pulumi.ComponentResource.options,
|
|
48
87
|
): storeTable =>
|
|
49
88
|
switch choice {
|
|
50
89
|
| StackScoped => makeTable(~opts)
|
|
51
|
-
| ProviderScoped(tableName) =>
|
|
90
|
+
| ProviderScoped(tableName) => lookupTableIfPresent(~tableName)
|
|
52
91
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
6
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
7
|
+
import * as Logger$ReventlessCore from "@reventlessdev/reventless-core/src/util/Logger.res.mjs";
|
|
3
8
|
import * as AWS_Tags$ReventlessAws from "../AWS_Tags.res.mjs";
|
|
9
|
+
import * as ClientDynamodb from "@aws-sdk/client-dynamodb";
|
|
10
|
+
import * as DynamoDb_DynamoDb$AwsSdk from "@reventlessdev/rescript-aws-sdk/src/DynamoDb_DynamoDb.res.mjs";
|
|
4
11
|
import * as Util_Pulumi$ReventlessCore from "@reventlessdev/reventless-core/src/util/Util_Pulumi.res.mjs";
|
|
12
|
+
import * as Util_AwsError$ReventlessAws from "../../util/Util_AwsError.res.mjs";
|
|
5
13
|
import * as Util_DynamoDb$ReventlessAws from "../../util/Util_DynamoDb.res.mjs";
|
|
6
|
-
import * as Auth_ActiveRoleStore$ReventlessAws from "./Auth_ActiveRoleStore.res.mjs";
|
|
7
14
|
import * as Auth_IdentityStore_Schema$ReventlessAws from "./Auth_IdentityStore_Schema.res.mjs";
|
|
8
15
|
|
|
9
16
|
function chooseStore(identityProviderId) {
|
|
@@ -30,17 +37,49 @@ function makeTable(nameOpt, opts) {
|
|
|
30
37
|
};
|
|
31
38
|
}
|
|
32
39
|
|
|
40
|
+
let log = Logger$ReventlessCore.fromEnv();
|
|
41
|
+
|
|
42
|
+
function lookupTableIfPresent(tableName) {
|
|
43
|
+
let arn = Output$Pulumi.flatMap(Pulumi.output(tableName), name => (async () => {
|
|
44
|
+
try {
|
|
45
|
+
let out = await DynamoDb_DynamoDb$AwsSdk.DescribeTableCommand.send(new ClientDynamodb.DescribeTableCommand({
|
|
46
|
+
TableName: name
|
|
47
|
+
}));
|
|
48
|
+
return Stdlib_Option.getOr(Stdlib_Option.flatMap(out.Table, t => t.TableArn), "");
|
|
49
|
+
} catch (raw_exn) {
|
|
50
|
+
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
51
|
+
if (Util_AwsError$ReventlessAws.isNotFound(exn)) {
|
|
52
|
+
log.warn("IdentityStore", undefined, `no identity store "` + name + `" on this provider — accounts keep their pool id. Run provision-identity to create it.`);
|
|
53
|
+
return "";
|
|
54
|
+
}
|
|
55
|
+
throw exn;
|
|
56
|
+
}
|
|
57
|
+
})());
|
|
58
|
+
return {
|
|
59
|
+
name: arn.apply(found => {
|
|
60
|
+
if (found === "") {
|
|
61
|
+
return "";
|
|
62
|
+
} else {
|
|
63
|
+
return tableName;
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
arn: arn
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
33
70
|
function resolveTable(choice, opts) {
|
|
34
71
|
if (typeof choice !== "object") {
|
|
35
72
|
return makeTable(undefined, opts);
|
|
36
73
|
} else {
|
|
37
|
-
return
|
|
74
|
+
return lookupTableIfPresent(choice._0);
|
|
38
75
|
}
|
|
39
76
|
}
|
|
40
77
|
|
|
41
78
|
export {
|
|
42
79
|
chooseStore,
|
|
43
80
|
makeTable,
|
|
81
|
+
log,
|
|
82
|
+
lookupTableIfPresent,
|
|
44
83
|
resolveTable,
|
|
45
84
|
}
|
|
46
|
-
/*
|
|
85
|
+
/* log Not a pure module */
|