@reventlessdev/rescript-pulumi-aws 3.0.0-alpha.24 → 3.0.0-alpha.26
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,21 @@
|
|
|
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.26 (2026-10-10)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* an inbound translation is gated alike on every door, and encodes its commands by schema ([6ec3ce6](https://github.com/ReventlessDev/reventless-core/commit/6ec3ce672e53e2c162c64a90d103be691391be5e))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# 3.0.0-alpha.25 (2026-10-08)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package @reventlessdev/rescript-pulumi-aws
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# 3.0.0-alpha.24 (2026-10-06)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @reventlessdev/rescript-pulumi-aws
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/rescript-pulumi-aws",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.26",
|
|
4
4
|
"description": "ReScript bindings for @pulumi/aws",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"@pulumi/aws": "~7.19.0",
|
|
23
23
|
"@pulumi/aws-native": "^1.62.0",
|
|
24
24
|
"sury": "11.0.0",
|
|
25
|
-
"@reventlessdev/rescript-
|
|
26
|
-
"@reventlessdev/rescript-
|
|
27
|
-
"@reventlessdev/rescript-
|
|
25
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.22",
|
|
26
|
+
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.23",
|
|
27
|
+
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.30"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"esbuild": "^0.25.12",
|
|
@@ -1671,6 +1671,24 @@ ${resultResponseCode}
|
|
|
1671
1671
|
// Lambda invocations
|
|
1672
1672
|
// ---------------------------------------------------------------------------
|
|
1673
1673
|
|
|
1674
|
+
// The caller as a command Lambda reads it: a Cognito user, an IAM principal, or null.
|
|
1675
|
+
let callerIdentity = `identity: isCognito
|
|
1676
|
+
? {
|
|
1677
|
+
userId: id.sub,
|
|
1678
|
+
username: id.username,
|
|
1679
|
+
groups: id.claims?.['cognito:groups'] ?? [],
|
|
1680
|
+
claims: id.claims,
|
|
1681
|
+
provider: 'Cognito'
|
|
1682
|
+
}
|
|
1683
|
+
: id != null
|
|
1684
|
+
? {
|
|
1685
|
+
userArn: id.userArn ?? null,
|
|
1686
|
+
accountId: id.accountId ?? null,
|
|
1687
|
+
username: id.username ?? null,
|
|
1688
|
+
provider: 'IAM'
|
|
1689
|
+
}
|
|
1690
|
+
: null`
|
|
1691
|
+
|
|
1674
1692
|
/** Invoke a CommandGenerator Lambda. `command` is the Aggregate command name. */
|
|
1675
1693
|
let invokeCommandGenerator = (command: string) =>
|
|
1676
1694
|
`${importUtil}
|
|
@@ -1687,22 +1705,7 @@ export function request(ctx) {
|
|
|
1687
1705
|
user: id?.username ?? null,
|
|
1688
1706
|
info: ctx.info.parentTypeName + '.' + ctx.info.fieldName
|
|
1689
1707
|
},
|
|
1690
|
-
|
|
1691
|
-
? {
|
|
1692
|
-
userId: id.sub,
|
|
1693
|
-
username: id.username,
|
|
1694
|
-
groups: id.claims?.['cognito:groups'] ?? [],
|
|
1695
|
-
claims: id.claims,
|
|
1696
|
-
provider: 'Cognito'
|
|
1697
|
-
}
|
|
1698
|
-
: id != null
|
|
1699
|
-
? {
|
|
1700
|
-
userArn: id.userArn ?? null,
|
|
1701
|
-
accountId: id.accountId ?? null,
|
|
1702
|
-
username: id.username ?? null,
|
|
1703
|
-
provider: 'IAM'
|
|
1704
|
-
}
|
|
1705
|
-
: null
|
|
1708
|
+
${callerIdentity}
|
|
1706
1709
|
}
|
|
1707
1710
|
};
|
|
1708
1711
|
}
|
|
@@ -1725,22 +1728,7 @@ export function request(ctx) {
|
|
|
1725
1728
|
user: id?.username ?? null,
|
|
1726
1729
|
info: ctx.info.parentTypeName + '.' + ctx.info.fieldName
|
|
1727
1730
|
},
|
|
1728
|
-
|
|
1729
|
-
? {
|
|
1730
|
-
userId: id.sub,
|
|
1731
|
-
username: id.username,
|
|
1732
|
-
groups: id.claims?.['cognito:groups'] ?? [],
|
|
1733
|
-
claims: id.claims,
|
|
1734
|
-
provider: 'Cognito'
|
|
1735
|
-
}
|
|
1736
|
-
: id != null
|
|
1737
|
-
? {
|
|
1738
|
-
userArn: id.userArn ?? null,
|
|
1739
|
-
accountId: id.accountId ?? null,
|
|
1740
|
-
username: id.username ?? null,
|
|
1741
|
-
provider: 'IAM'
|
|
1742
|
-
}
|
|
1743
|
-
: null
|
|
1731
|
+
${callerIdentity}
|
|
1744
1732
|
}
|
|
1745
1733
|
};
|
|
1746
1734
|
}
|
|
@@ -1751,12 +1739,15 @@ ${resultResponseCode}
|
|
|
1751
1739
|
let invokeInboundTranslation = (fieldName: string) =>
|
|
1752
1740
|
`${importUtil}
|
|
1753
1741
|
export function request(ctx) {
|
|
1742
|
+
const id = ctx.identity;
|
|
1743
|
+
const isCognito = id != null && id.sub != null;
|
|
1754
1744
|
return {
|
|
1755
1745
|
operation: 'Invoke',
|
|
1756
1746
|
payload: {
|
|
1757
1747
|
__inboundTranslation: true,
|
|
1758
1748
|
fieldName: '${fieldName}',
|
|
1759
|
-
arguments: ctx.args
|
|
1749
|
+
arguments: ctx.args,
|
|
1750
|
+
${callerIdentity}
|
|
1760
1751
|
}
|
|
1761
1752
|
};
|
|
1762
1753
|
}
|
|
@@ -1140,6 +1140,23 @@ export function request(ctx) {
|
|
|
1140
1140
|
` + resultResponseCode + `
|
|
1141
1141
|
`;
|
|
1142
1142
|
|
|
1143
|
+
let callerIdentity = `identity: isCognito
|
|
1144
|
+
? {
|
|
1145
|
+
userId: id.sub,
|
|
1146
|
+
username: id.username,
|
|
1147
|
+
groups: id.claims?.['cognito:groups'] ?? [],
|
|
1148
|
+
claims: id.claims,
|
|
1149
|
+
provider: 'Cognito'
|
|
1150
|
+
}
|
|
1151
|
+
: id != null
|
|
1152
|
+
? {
|
|
1153
|
+
userArn: id.userArn ?? null,
|
|
1154
|
+
accountId: id.accountId ?? null,
|
|
1155
|
+
username: id.username ?? null,
|
|
1156
|
+
provider: 'IAM'
|
|
1157
|
+
}
|
|
1158
|
+
: null`;
|
|
1159
|
+
|
|
1143
1160
|
function invokeCommandGenerator(command) {
|
|
1144
1161
|
return importUtil + `
|
|
1145
1162
|
export function request(ctx) {
|
|
@@ -1155,22 +1172,7 @@ export function request(ctx) {
|
|
|
1155
1172
|
user: id?.username ?? null,
|
|
1156
1173
|
info: ctx.info.parentTypeName + '.' + ctx.info.fieldName
|
|
1157
1174
|
},
|
|
1158
|
-
|
|
1159
|
-
? {
|
|
1160
|
-
userId: id.sub,
|
|
1161
|
-
username: id.username,
|
|
1162
|
-
groups: id.claims?.['cognito:groups'] ?? [],
|
|
1163
|
-
claims: id.claims,
|
|
1164
|
-
provider: 'Cognito'
|
|
1165
|
-
}
|
|
1166
|
-
: id != null
|
|
1167
|
-
? {
|
|
1168
|
-
userArn: id.userArn ?? null,
|
|
1169
|
-
accountId: id.accountId ?? null,
|
|
1170
|
-
username: id.username ?? null,
|
|
1171
|
-
provider: 'IAM'
|
|
1172
|
-
}
|
|
1173
|
-
: null
|
|
1175
|
+
` + callerIdentity + `
|
|
1174
1176
|
}
|
|
1175
1177
|
};
|
|
1176
1178
|
}
|
|
@@ -1193,22 +1195,7 @@ export function request(ctx) {
|
|
|
1193
1195
|
user: id?.username ?? null,
|
|
1194
1196
|
info: ctx.info.parentTypeName + '.' + ctx.info.fieldName
|
|
1195
1197
|
},
|
|
1196
|
-
|
|
1197
|
-
? {
|
|
1198
|
-
userId: id.sub,
|
|
1199
|
-
username: id.username,
|
|
1200
|
-
groups: id.claims?.['cognito:groups'] ?? [],
|
|
1201
|
-
claims: id.claims,
|
|
1202
|
-
provider: 'Cognito'
|
|
1203
|
-
}
|
|
1204
|
-
: id != null
|
|
1205
|
-
? {
|
|
1206
|
-
userArn: id.userArn ?? null,
|
|
1207
|
-
accountId: id.accountId ?? null,
|
|
1208
|
-
username: id.username ?? null,
|
|
1209
|
-
provider: 'IAM'
|
|
1210
|
-
}
|
|
1211
|
-
: null
|
|
1198
|
+
` + callerIdentity + `
|
|
1212
1199
|
}
|
|
1213
1200
|
};
|
|
1214
1201
|
}
|
|
@@ -1219,12 +1206,15 @@ export function request(ctx) {
|
|
|
1219
1206
|
function invokeInboundTranslation(fieldName) {
|
|
1220
1207
|
return importUtil + `
|
|
1221
1208
|
export function request(ctx) {
|
|
1209
|
+
const id = ctx.identity;
|
|
1210
|
+
const isCognito = id != null && id.sub != null;
|
|
1222
1211
|
return {
|
|
1223
1212
|
operation: 'Invoke',
|
|
1224
1213
|
payload: {
|
|
1225
1214
|
__inboundTranslation: true,
|
|
1226
1215
|
fieldName: '` + fieldName + `',
|
|
1227
|
-
arguments: ctx.args
|
|
1216
|
+
arguments: ctx.args,
|
|
1217
|
+
` + callerIdentity + `
|
|
1228
1218
|
}
|
|
1229
1219
|
};
|
|
1230
1220
|
}
|
|
@@ -1355,6 +1345,7 @@ export {
|
|
|
1355
1345
|
putItem,
|
|
1356
1346
|
addItemToList,
|
|
1357
1347
|
deleteItem,
|
|
1348
|
+
callerIdentity,
|
|
1358
1349
|
invokeCommandGenerator,
|
|
1359
1350
|
invokeDcbMutation,
|
|
1360
1351
|
invokeInboundTranslation,
|
|
@@ -757,6 +757,28 @@ describe('invokeInboundTranslation', () => {
|
|
|
757
757
|
expect(result.payload.fieldName).toBe('importProduct')
|
|
758
758
|
expect(result.payload.arguments).toEqual({ csv: 'data' })
|
|
759
759
|
})
|
|
760
|
+
|
|
761
|
+
// The Lambda checks each translated command against the caller's groups.
|
|
762
|
+
test('request carries the Cognito caller and its groups', () => {
|
|
763
|
+
const ctx = makeCtx({
|
|
764
|
+
identity: { username: 'alice', sub: 's1', sourceIp: [], claims: { 'cognito:groups': ['Merchandiser'] } },
|
|
765
|
+
})
|
|
766
|
+
const { payload } = request(ctx)
|
|
767
|
+
expect(payload.identity.userId).toBe('s1')
|
|
768
|
+
expect(payload.identity.groups).toEqual(['Merchandiser'])
|
|
769
|
+
expect(payload.identity.provider).toBe('Cognito')
|
|
770
|
+
})
|
|
771
|
+
|
|
772
|
+
test('request carries an IAM caller as IAM', () => {
|
|
773
|
+
const ctx = makeCtx({ identity: { userArn: 'arn:aws:iam::123:role/Sync', accountId: '123' } })
|
|
774
|
+
const { payload } = request(ctx)
|
|
775
|
+
expect(payload.identity.provider).toBe('IAM')
|
|
776
|
+
})
|
|
777
|
+
|
|
778
|
+
test('request emits null identity when ctx.identity is null', () => {
|
|
779
|
+
const { payload } = request(makeCtx({ identity: null }))
|
|
780
|
+
expect(payload.identity).toBeNull()
|
|
781
|
+
})
|
|
760
782
|
})
|
|
761
783
|
|
|
762
784
|
// ---------------------------------------------------------------------------
|