@awsless/awsless 0.0.404 → 0.0.406
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/README.MD +1 -1
- package/dist/bin.js +17 -18
- package/dist/client.js +3 -2
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/server.js +14 -8
- package/package.json +12 -10
package/README.MD
CHANGED
package/dist/bin.js
CHANGED
|
@@ -7413,7 +7413,7 @@ var line = (message) => {
|
|
|
7413
7413
|
};
|
|
7414
7414
|
var table = (props) => {
|
|
7415
7415
|
console.log(color.line("\u2502"));
|
|
7416
|
-
const
|
|
7416
|
+
const table2 = new Table({
|
|
7417
7417
|
// wordWrap: true,
|
|
7418
7418
|
// wrapOnWordBoundary: false,
|
|
7419
7419
|
// truncate: '...',
|
|
@@ -7436,7 +7436,7 @@ var table = (props) => {
|
|
|
7436
7436
|
// 'right-mid': '',
|
|
7437
7437
|
}
|
|
7438
7438
|
});
|
|
7439
|
-
|
|
7439
|
+
table2.push(
|
|
7440
7440
|
...props.body.map(
|
|
7441
7441
|
(row) => row.map((v) => {
|
|
7442
7442
|
if (typeof v === "boolean") {
|
|
@@ -7446,7 +7446,7 @@ var table = (props) => {
|
|
|
7446
7446
|
})
|
|
7447
7447
|
)
|
|
7448
7448
|
);
|
|
7449
|
-
return
|
|
7449
|
+
return table2.toString();
|
|
7450
7450
|
};
|
|
7451
7451
|
|
|
7452
7452
|
// src/cli/ui/complex/bootstrap-awsless.ts
|
|
@@ -7512,12 +7512,12 @@ var createStateBucket = (client, accountId) => {
|
|
|
7512
7512
|
var bootstrapAwsless = async (props) => {
|
|
7513
7513
|
const dynamo = new DynamoDB(props);
|
|
7514
7514
|
const s3 = new S3Client(props);
|
|
7515
|
-
const [
|
|
7515
|
+
const [table2, bucket] = await Promise.all([
|
|
7516
7516
|
//
|
|
7517
7517
|
hasLockTable(dynamo),
|
|
7518
7518
|
hasStateBucket(s3, props.accountId)
|
|
7519
7519
|
]);
|
|
7520
|
-
if (!
|
|
7520
|
+
if (!table2 || !bucket) {
|
|
7521
7521
|
log.warn(`Awsless hasn't been bootstrapped yet.`);
|
|
7522
7522
|
if (!process.env.SKIP_PROMPT) {
|
|
7523
7523
|
const confirmed = await confirm({
|
|
@@ -7528,7 +7528,7 @@ var bootstrapAwsless = async (props) => {
|
|
|
7528
7528
|
}
|
|
7529
7529
|
}
|
|
7530
7530
|
await task("Bootstrapping", async (update) => {
|
|
7531
|
-
if (!
|
|
7531
|
+
if (!table2) {
|
|
7532
7532
|
await createLockTable(dynamo);
|
|
7533
7533
|
}
|
|
7534
7534
|
if (!bucket) {
|
|
@@ -13378,14 +13378,14 @@ var tableFeature = defineFeature({
|
|
|
13378
13378
|
resourceName: id
|
|
13379
13379
|
});
|
|
13380
13380
|
const deletionProtection = props.deletionProtection ?? ctx.appConfig.defaults.table?.deletionProtection;
|
|
13381
|
-
const
|
|
13381
|
+
const table2 = new aws22.dynamodb.Table(group, "table", {
|
|
13382
13382
|
...props,
|
|
13383
13383
|
name,
|
|
13384
13384
|
stream: props.stream?.type,
|
|
13385
13385
|
deletionProtection
|
|
13386
13386
|
});
|
|
13387
13387
|
if (deletionProtection) {
|
|
13388
|
-
|
|
13388
|
+
table2.deletionPolicy = "retain";
|
|
13389
13389
|
}
|
|
13390
13390
|
if (props.stream) {
|
|
13391
13391
|
const { lambda, policy } = createLambdaFunction(group, ctx, "table", id, props.stream.consumer);
|
|
@@ -13393,7 +13393,7 @@ var tableFeature = defineFeature({
|
|
|
13393
13393
|
const onFailure = getGlobalOnFailure(ctx);
|
|
13394
13394
|
const source = new aws22.lambda.EventSourceMapping(group, id, {
|
|
13395
13395
|
functionArn: lambda.arn,
|
|
13396
|
-
sourceArn:
|
|
13396
|
+
sourceArn: table2.streamArn,
|
|
13397
13397
|
batchSize: 100,
|
|
13398
13398
|
bisectBatchOnError: true,
|
|
13399
13399
|
// retryAttempts: props.stream.consumer.retryAttempts ?? -1,
|
|
@@ -13401,7 +13401,7 @@ var tableFeature = defineFeature({
|
|
|
13401
13401
|
startingPosition: "latest",
|
|
13402
13402
|
onFailure
|
|
13403
13403
|
});
|
|
13404
|
-
policy.addStatement(
|
|
13404
|
+
policy.addStatement(table2.streamPermissions);
|
|
13405
13405
|
source.dependsOn(policy);
|
|
13406
13406
|
if (onFailure) {
|
|
13407
13407
|
policy.addStatement({
|
|
@@ -13411,7 +13411,7 @@ var tableFeature = defineFeature({
|
|
|
13411
13411
|
}
|
|
13412
13412
|
}
|
|
13413
13413
|
ctx.onStackPolicy((policy) => {
|
|
13414
|
-
policy.addStatement(...
|
|
13414
|
+
policy.addStatement(...table2.permissions);
|
|
13415
13415
|
});
|
|
13416
13416
|
}
|
|
13417
13417
|
}
|
|
@@ -13660,12 +13660,12 @@ var vpcFeature = defineFeature({
|
|
|
13660
13660
|
const zones = ["a", "b"];
|
|
13661
13661
|
const tables = [privateRouteTable, publicRouteTable];
|
|
13662
13662
|
let block = 0n;
|
|
13663
|
-
for (const
|
|
13663
|
+
for (const table2 of tables) {
|
|
13664
13664
|
for (const i in zones) {
|
|
13665
13665
|
const index = Number(i) + 1;
|
|
13666
|
-
const id = `${
|
|
13666
|
+
const id = `${table2.identifier}-${index}`;
|
|
13667
13667
|
const subnet = new aws24.ec2.Subnet(group, id, {
|
|
13668
|
-
name: `${ctx.app.name}--${
|
|
13668
|
+
name: `${ctx.app.name}--${table2.identifier}-${index}`,
|
|
13669
13669
|
vpcId: vpc.id,
|
|
13670
13670
|
cidrBlock: aws24.ec2.Peer.ipv4(`10.0.${block++}.0/24`),
|
|
13671
13671
|
// ipv6CidrBlock: aws.ec2.Peer.ipv6(`fd00:10:20:${++block}::/64`),
|
|
@@ -13674,14 +13674,14 @@ var vpcFeature = defineFeature({
|
|
|
13674
13674
|
// ipv6CidrBlock: slices.apply(list => aws.ec2.Peer.ipv6(list.get(block++).toString())),
|
|
13675
13675
|
// assignIpv6AddressOnCreation: true,
|
|
13676
13676
|
// ipv6Native: true,
|
|
13677
|
-
mapPublicIpOnLaunch:
|
|
13677
|
+
mapPublicIpOnLaunch: table2.identifier === "public",
|
|
13678
13678
|
availabilityZone: ctx.appConfig.region + zones[i]
|
|
13679
13679
|
});
|
|
13680
13680
|
new aws24.ec2.SubnetRouteTableAssociation(group, id, {
|
|
13681
|
-
routeTableId:
|
|
13681
|
+
routeTableId: table2.id,
|
|
13682
13682
|
subnetId: subnet.id
|
|
13683
13683
|
});
|
|
13684
|
-
ctx.shared.set(`vpc-${
|
|
13684
|
+
ctx.shared.set(`vpc-${table2.identifier}-subnet-id-${index}`, subnet.id);
|
|
13685
13685
|
}
|
|
13686
13686
|
}
|
|
13687
13687
|
}
|
|
@@ -15112,7 +15112,6 @@ var list3 = (program2) => {
|
|
|
15112
15112
|
const credentials = getCredentials(appConfig.profile);
|
|
15113
15113
|
const accountId = await getAccountId(credentials, region);
|
|
15114
15114
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
15115
|
-
const resources = [];
|
|
15116
15115
|
const formatResource = (stack, urn) => {
|
|
15117
15116
|
return urn.replace(stack.urn + ":", "").replace(/\{([a-z0-9\-\s\/\._]+)\}/gi, (_, v) => {
|
|
15118
15117
|
return `${color.dim("{")}${color.warning(v)}${color.dim("}")}`;
|
package/dist/client.js
CHANGED
|
@@ -79,6 +79,7 @@ var createHttpClient = (fetcher) => {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
// src/lib/client/pubsub.ts
|
|
82
|
+
import { parse, stringify } from "@awsless/json";
|
|
82
83
|
import { createClient } from "@awsless/mqtt";
|
|
83
84
|
var createPubSubClient = (app, props) => {
|
|
84
85
|
const mqtt = createClient(async () => {
|
|
@@ -104,11 +105,11 @@ var createPubSubClient = (app, props) => {
|
|
|
104
105
|
return mqtt.topics.map(fromPubSubTopic);
|
|
105
106
|
},
|
|
106
107
|
publish(topic, event, payload, qos) {
|
|
107
|
-
return mqtt.publish(getPubSubTopic(topic),
|
|
108
|
+
return mqtt.publish(getPubSubTopic(topic), stringify([event, payload]), qos);
|
|
108
109
|
},
|
|
109
110
|
subscribe(topic, event, callback) {
|
|
110
111
|
return mqtt.subscribe(getPubSubTopic(topic), (message) => {
|
|
111
|
-
const [eventName, payload] =
|
|
112
|
+
const [eventName, payload] = parse(message.toString("utf8"));
|
|
112
113
|
if (event === eventName) {
|
|
113
114
|
callback(payload);
|
|
114
115
|
}
|
package/dist/prebuild/rpc/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
baa4f5591254516e6462b0b073ae7f4b638ea501
|
|
Binary file
|
package/dist/server.js
CHANGED
|
@@ -365,6 +365,7 @@ var Config = /* @__PURE__ */ new Proxy(
|
|
|
365
365
|
// src/lib/server/pubsub.ts
|
|
366
366
|
import { hours, toSeconds } from "@awsless/duration";
|
|
367
367
|
import { publish as publish2, QoS } from "@awsless/iot";
|
|
368
|
+
import { stringify } from "@awsless/json";
|
|
368
369
|
var getPubSubTopic = (name) => {
|
|
369
370
|
return `${APP}/pubsub/${name}`;
|
|
370
371
|
};
|
|
@@ -372,7 +373,7 @@ var PubSub = {
|
|
|
372
373
|
async publish(topic, event, payload, opts = {}) {
|
|
373
374
|
await publish2({
|
|
374
375
|
topic: getPubSubTopic(topic),
|
|
375
|
-
payload: Buffer.from(
|
|
376
|
+
payload: Buffer.from(stringify([event, payload])),
|
|
376
377
|
...opts
|
|
377
378
|
});
|
|
378
379
|
}
|
|
@@ -406,14 +407,14 @@ var pubsubAuthorizerResponse = (props) => {
|
|
|
406
407
|
Resource: props.subscribe.map((topic) => {
|
|
407
408
|
return `${prefix}:topicfilter/${getPubSubTopic(topic)}`;
|
|
408
409
|
})
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
Action: "iot:Receive",
|
|
412
|
-
Effect: "Allow",
|
|
413
|
-
Resource: props.subscribe.map((topic) => {
|
|
414
|
-
return `${prefix}:topic/${getPubSubTopic(topic)}`;
|
|
415
|
-
})
|
|
416
410
|
}
|
|
411
|
+
// {
|
|
412
|
+
// Action: 'iot:Receive',
|
|
413
|
+
// Effect: 'Allow',
|
|
414
|
+
// Resource: props.subscribe.map(topic => {
|
|
415
|
+
// return `${prefix}:topic/${getPubSubTopic(topic)}`
|
|
416
|
+
// }),
|
|
417
|
+
// }
|
|
417
418
|
);
|
|
418
419
|
}
|
|
419
420
|
return {
|
|
@@ -431,6 +432,11 @@ var pubsubAuthorizerResponse = (props) => {
|
|
|
431
432
|
Resource: "*"
|
|
432
433
|
// Resource: `${prefix}:client/\${iot:ClientId}`,
|
|
433
434
|
},
|
|
435
|
+
{
|
|
436
|
+
Action: "iot:Receive",
|
|
437
|
+
Effect: "Allow",
|
|
438
|
+
Resource: "*"
|
|
439
|
+
},
|
|
434
440
|
...statements
|
|
435
441
|
]
|
|
436
442
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.406",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,17 +28,18 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
+
"@awsless/lambda": "^0.0.29",
|
|
31
32
|
"@awsless/iot": "^0.0.2",
|
|
32
|
-
"@awsless/lambda": "^0.0.27",
|
|
33
33
|
"@awsless/mqtt": "^0.0.2",
|
|
34
|
+
"@awsless/sqs": "^0.0.7",
|
|
34
35
|
"@awsless/open-search": "^0.0.15",
|
|
36
|
+
"@awsless/json": "^0.0.6",
|
|
35
37
|
"@awsless/redis": "^0.0.13",
|
|
36
|
-
"@awsless/
|
|
38
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
39
|
+
"@awsless/validate": "^0.0.16",
|
|
37
40
|
"@awsless/s3": "^0.0.18",
|
|
38
|
-
"@awsless/sqs": "^0.0.7",
|
|
39
41
|
"@awsless/ssm": "^0.0.7",
|
|
40
|
-
"@awsless/
|
|
41
|
-
"@awsless/weak-cache": "^0.0.1"
|
|
42
|
+
"@awsless/sns": "^0.0.7"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -112,13 +113,14 @@
|
|
|
112
113
|
"zip-a-folder": "^3.1.6",
|
|
113
114
|
"zod": "^3.21.4",
|
|
114
115
|
"zod-to-json-schema": "^3.22.3",
|
|
115
|
-
"@awsless/code": "^0.0.10",
|
|
116
116
|
"@awsless/duration": "^0.0.1",
|
|
117
117
|
"@awsless/formation": "^0.0.57",
|
|
118
|
-
"@awsless/
|
|
119
|
-
"@awsless/
|
|
118
|
+
"@awsless/size": "^0.0.1",
|
|
119
|
+
"@awsless/json": "^0.0.6",
|
|
120
120
|
"@awsless/validate": "^0.0.16",
|
|
121
|
-
"@awsless/
|
|
121
|
+
"@awsless/code": "^0.0.10",
|
|
122
|
+
"@awsless/graphql": "^0.0.9",
|
|
123
|
+
"@awsless/ts-file-cache": "^0.0.10"
|
|
122
124
|
},
|
|
123
125
|
"devDependencies": {
|
|
124
126
|
"@node-rs/bcrypt": "^1.10.5"
|