@awsless/awsless 0.0.406 → 0.0.407
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/dist/bin.js +29 -16
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/server.js +25 -19
- package/package.json +13 -13
package/dist/bin.js
CHANGED
|
@@ -12302,7 +12302,7 @@ var pubsubFeature = defineFeature({
|
|
|
12302
12302
|
});
|
|
12303
12303
|
if (props.domain) {
|
|
12304
12304
|
const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
|
|
12305
|
-
new aws13.iot.DomainConfiguration(group, "domain", {
|
|
12305
|
+
const domain = new aws13.iot.DomainConfiguration(group, "domain", {
|
|
12306
12306
|
name,
|
|
12307
12307
|
domainName,
|
|
12308
12308
|
certificates: [ctx.shared.get(`local-certificate-${props.domain}-arn`)],
|
|
@@ -12311,6 +12311,7 @@ var pubsubFeature = defineFeature({
|
|
|
12311
12311
|
}
|
|
12312
12312
|
// validationCertificate: ctx.shared.get(`global-certificate-${props.domain}-arn`),
|
|
12313
12313
|
});
|
|
12314
|
+
domain.dependsOn(authorizer);
|
|
12314
12315
|
new aws13.route53.RecordSet(group, "record", {
|
|
12315
12316
|
hostedZoneId: ctx.shared.get(`hosted-zone-${props.domain}-id`),
|
|
12316
12317
|
name: domainName,
|
|
@@ -12548,7 +12549,7 @@ var restFeature = defineFeature({
|
|
|
12548
12549
|
|
|
12549
12550
|
// src/feature/rpc/index.ts
|
|
12550
12551
|
import { camelCase as camelCase6, constantCase as constantCase10, paramCase as paramCase6 } from "change-case";
|
|
12551
|
-
import { Asset as Asset5, aws as aws17, Node as Node16
|
|
12552
|
+
import { Asset as Asset5, aws as aws17, Node as Node16 } from "@awsless/formation";
|
|
12552
12553
|
import { mebibytes as mebibytes2 } from "@awsless/size";
|
|
12553
12554
|
import { dirname as dirname10, join as join9, relative as relative5 } from "path";
|
|
12554
12555
|
import { fileURLToPath } from "node:url";
|
|
@@ -12745,22 +12746,23 @@ var rpcFeature = defineFeature({
|
|
|
12745
12746
|
resourceType: "rpc",
|
|
12746
12747
|
resourceName: id
|
|
12747
12748
|
});
|
|
12748
|
-
const { lambda, code } = createPrebuildLambdaFunction(group, ctx, "rpc", id, {
|
|
12749
|
+
const { lambda, policy, code } = createPrebuildLambdaFunction(group, ctx, "rpc", id, {
|
|
12749
12750
|
bundleFile: join9(__dirname, "/prebuild/rpc/bundle.zip"),
|
|
12750
12751
|
bundleHash: join9(__dirname, "/prebuild/rpc/HASH"),
|
|
12751
12752
|
memorySize: mebibytes2(256),
|
|
12752
12753
|
warm: 3
|
|
12753
12754
|
});
|
|
12754
|
-
const
|
|
12755
|
-
|
|
12756
|
-
"
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12755
|
+
const table2 = new aws17.dynamodb.Table(group, "schema", {
|
|
12756
|
+
name,
|
|
12757
|
+
hash: "query"
|
|
12758
|
+
});
|
|
12759
|
+
lambda.addEnvironment("SCHEMA_TABLE", table2.name);
|
|
12760
|
+
policy.addStatement({
|
|
12761
|
+
effect: "allow",
|
|
12762
|
+
actions: ["dynamodb:GetItem"],
|
|
12763
|
+
resources: [table2.arn]
|
|
12764
|
+
});
|
|
12765
|
+
ctx.shared.set(`rpc-${id}-schema-table`, table2);
|
|
12764
12766
|
if (props.auth) {
|
|
12765
12767
|
const authGroup = new Node16(group, "auth", "authorizer");
|
|
12766
12768
|
const auth2 = createLambdaFunction(authGroup, ctx, "rpc", `${id}-auth`, props.auth);
|
|
@@ -12843,16 +12845,27 @@ var rpcFeature = defineFeature({
|
|
|
12843
12845
|
if (!defaultProps) {
|
|
12844
12846
|
throw new FileError(ctx.stackConfig.file, `RPC definition is not defined on app level for "${id}"`);
|
|
12845
12847
|
}
|
|
12846
|
-
const
|
|
12848
|
+
const table2 = ctx.shared.get(`rpc-${id}-schema-table`);
|
|
12847
12849
|
const group = new Node16(ctx.stack, "rpc", id);
|
|
12848
12850
|
for (const [name, props] of Object.entries(queries ?? {})) {
|
|
12849
12851
|
const queryGroup = new Node16(group, "query", name);
|
|
12850
12852
|
const entryId = paramCase6(`${id}-${shortId(name)}`);
|
|
12851
|
-
|
|
12853
|
+
createLambdaFunction(queryGroup, ctx, `rpc`, entryId, {
|
|
12852
12854
|
...props,
|
|
12853
12855
|
description: `${id} ${name}`
|
|
12854
12856
|
});
|
|
12855
|
-
|
|
12857
|
+
new aws17.dynamodb.TableItem(queryGroup, "query", {
|
|
12858
|
+
table: table2,
|
|
12859
|
+
item: Asset5.fromJSON({
|
|
12860
|
+
query: name,
|
|
12861
|
+
function: formatLocalResourceName({
|
|
12862
|
+
appName: ctx.app.name,
|
|
12863
|
+
stackName: ctx.stack.name,
|
|
12864
|
+
resourceType: "rpc",
|
|
12865
|
+
resourceName: entryId
|
|
12866
|
+
})
|
|
12867
|
+
})
|
|
12868
|
+
});
|
|
12856
12869
|
}
|
|
12857
12870
|
}
|
|
12858
12871
|
}
|
package/dist/prebuild/rpc/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
775126f16ab12a3cc007fed5f2de3518b92ce405
|
|
Binary file
|
package/dist/server.js
CHANGED
|
@@ -417,30 +417,36 @@ var pubsubAuthorizerResponse = (props) => {
|
|
|
417
417
|
// }
|
|
418
418
|
);
|
|
419
419
|
}
|
|
420
|
+
const policyDocuments = [
|
|
421
|
+
{
|
|
422
|
+
Version: "2012-10-17",
|
|
423
|
+
Statement: [
|
|
424
|
+
{
|
|
425
|
+
Action: "iot:Connect",
|
|
426
|
+
Effect: "Allow",
|
|
427
|
+
Resource: "*"
|
|
428
|
+
// Resource: `${prefix}:client/\${iot:ClientId}`,
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
Action: "iot:Receive",
|
|
432
|
+
Effect: "Allow",
|
|
433
|
+
Resource: "*"
|
|
434
|
+
// Resource: `${prefix}:client/\${iot:ClientId}`,
|
|
435
|
+
},
|
|
436
|
+
...statements
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
];
|
|
440
|
+
const documentSize = JSON.stringify(policyDocuments).length;
|
|
441
|
+
if (documentSize > 2048) {
|
|
442
|
+
throw new Error(`IoT policy document size can't exceed 2048 characters. Current size is ${documentSize}`);
|
|
443
|
+
}
|
|
420
444
|
return {
|
|
421
445
|
isAuthenticated: props.authorized,
|
|
422
446
|
principalId: props.principalId ?? Date.now().toString(),
|
|
423
447
|
disconnectAfterInSeconds: Number(toSeconds(props.disconnectAfter ?? hours(1))),
|
|
424
448
|
refreshAfterInSeconds: Number(toSeconds(props.disconnectAfter ?? hours(1))),
|
|
425
|
-
policyDocuments
|
|
426
|
-
{
|
|
427
|
-
Version: "2012-10-17",
|
|
428
|
-
Statement: [
|
|
429
|
-
{
|
|
430
|
-
Action: "iot:Connect",
|
|
431
|
-
Effect: "Allow",
|
|
432
|
-
Resource: "*"
|
|
433
|
-
// Resource: `${prefix}:client/\${iot:ClientId}`,
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
Action: "iot:Receive",
|
|
437
|
-
Effect: "Allow",
|
|
438
|
-
Resource: "*"
|
|
439
|
-
},
|
|
440
|
-
...statements
|
|
441
|
-
]
|
|
442
|
-
}
|
|
443
|
-
]
|
|
449
|
+
policyDocuments
|
|
444
450
|
};
|
|
445
451
|
};
|
|
446
452
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.407",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@awsless/lambda": "^0.0.29",
|
|
32
31
|
"@awsless/iot": "^0.0.2",
|
|
33
|
-
"@awsless/
|
|
32
|
+
"@awsless/lambda": "^0.0.30",
|
|
33
|
+
"@awsless/s3": "^0.0.18",
|
|
34
|
+
"@awsless/sns": "^0.0.7",
|
|
34
35
|
"@awsless/sqs": "^0.0.7",
|
|
35
|
-
"@awsless/open-search": "^0.0.15",
|
|
36
|
-
"@awsless/json": "^0.0.6",
|
|
37
|
-
"@awsless/redis": "^0.0.13",
|
|
38
|
-
"@awsless/weak-cache": "^0.0.1",
|
|
39
36
|
"@awsless/validate": "^0.0.16",
|
|
40
|
-
"@awsless/
|
|
37
|
+
"@awsless/json": "^0.0.6",
|
|
38
|
+
"@awsless/open-search": "^0.0.15",
|
|
41
39
|
"@awsless/ssm": "^0.0.7",
|
|
42
|
-
"@awsless/
|
|
40
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
41
|
+
"@awsless/redis": "^0.0.13",
|
|
42
|
+
"@awsless/mqtt": "^0.0.2"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -113,14 +113,14 @@
|
|
|
113
113
|
"zip-a-folder": "^3.1.6",
|
|
114
114
|
"zod": "^3.21.4",
|
|
115
115
|
"zod-to-json-schema": "^3.22.3",
|
|
116
|
+
"@awsless/code": "^0.0.10",
|
|
116
117
|
"@awsless/duration": "^0.0.1",
|
|
117
118
|
"@awsless/formation": "^0.0.57",
|
|
118
|
-
"@awsless/
|
|
119
|
+
"@awsless/graphql": "^0.0.9",
|
|
119
120
|
"@awsless/json": "^0.0.6",
|
|
120
121
|
"@awsless/validate": "^0.0.16",
|
|
121
|
-
"@awsless/
|
|
122
|
-
"@awsless/
|
|
123
|
-
"@awsless/ts-file-cache": "^0.0.10"
|
|
122
|
+
"@awsless/ts-file-cache": "^0.0.10",
|
|
123
|
+
"@awsless/size": "^0.0.1"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@node-rs/bcrypt": "^1.10.5"
|