@awsless/awsless 0.0.405 → 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/dist/bin.js +1 -2
- 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 +21 -25
- package/package.json +15 -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
|
-
|
|
12305
|
+
new aws13.iot.DomainConfiguration(group, "domain", {
|
|
12306
12306
|
name,
|
|
12307
12307
|
domainName,
|
|
12308
12308
|
certificates: [ctx.shared.get(`local-certificate-${props.domain}-arn`)],
|
|
@@ -12311,7 +12311,6 @@ var pubsubFeature = defineFeature({
|
|
|
12311
12311
|
}
|
|
12312
12312
|
// validationCertificate: ctx.shared.get(`global-certificate-${props.domain}-arn`),
|
|
12313
12313
|
});
|
|
12314
|
-
domain.dependsOn(authorizer);
|
|
12315
12314
|
new aws13.route53.RecordSet(group, "record", {
|
|
12316
12315
|
hostedZoneId: ctx.shared.get(`hosted-zone-${props.domain}-id`),
|
|
12317
12316
|
name: domainName,
|
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
|
}
|
|
@@ -416,35 +417,30 @@ var pubsubAuthorizerResponse = (props) => {
|
|
|
416
417
|
// }
|
|
417
418
|
);
|
|
418
419
|
}
|
|
419
|
-
const policyDocuments = [
|
|
420
|
-
{
|
|
421
|
-
Version: "2012-10-17",
|
|
422
|
-
Statement: [
|
|
423
|
-
{
|
|
424
|
-
Action: "iot:Connect",
|
|
425
|
-
Effect: "Allow",
|
|
426
|
-
Resource: "*"
|
|
427
|
-
// Resource: `${prefix}:client/\${iot:ClientId}`,
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
Action: "iot:Receive",
|
|
431
|
-
Effect: "Allow",
|
|
432
|
-
Resource: "*"
|
|
433
|
-
// Resource: `${prefix}:client/\${iot:ClientId}`,
|
|
434
|
-
},
|
|
435
|
-
...statements
|
|
436
|
-
]
|
|
437
|
-
}
|
|
438
|
-
];
|
|
439
|
-
if (JSON.stringify(policyDocuments).length > 2048) {
|
|
440
|
-
throw new Error("IoT Policy is too large");
|
|
441
|
-
}
|
|
442
420
|
return {
|
|
443
421
|
isAuthenticated: props.authorized,
|
|
444
422
|
principalId: props.principalId ?? Date.now().toString(),
|
|
445
423
|
disconnectAfterInSeconds: Number(toSeconds(props.disconnectAfter ?? hours(1))),
|
|
446
424
|
refreshAfterInSeconds: Number(toSeconds(props.disconnectAfter ?? hours(1))),
|
|
447
|
-
policyDocuments
|
|
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
|
+
]
|
|
448
444
|
};
|
|
449
445
|
};
|
|
450
446
|
|
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.
|
|
31
|
+
"@awsless/lambda": "^0.0.29",
|
|
32
|
+
"@awsless/iot": "^0.0.2",
|
|
33
|
+
"@awsless/mqtt": "^0.0.2",
|
|
34
|
+
"@awsless/sqs": "^0.0.7",
|
|
32
35
|
"@awsless/open-search": "^0.0.15",
|
|
33
|
-
"@awsless/
|
|
36
|
+
"@awsless/json": "^0.0.6",
|
|
34
37
|
"@awsless/redis": "^0.0.13",
|
|
35
|
-
"@awsless/sqs": "^0.0.7",
|
|
36
|
-
"@awsless/iot": "^0.0.2",
|
|
37
|
-
"@awsless/validate": "^0.0.16",
|
|
38
|
-
"@awsless/ssm": "^0.0.7",
|
|
39
38
|
"@awsless/weak-cache": "^0.0.1",
|
|
39
|
+
"@awsless/validate": "^0.0.16",
|
|
40
40
|
"@awsless/s3": "^0.0.18",
|
|
41
|
-
"@awsless/
|
|
41
|
+
"@awsless/ssm": "^0.0.7",
|
|
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
|
-
"@awsless/size": "^0.0.1",
|
|
117
|
-
"@awsless/validate": "^0.0.16",
|
|
118
116
|
"@awsless/duration": "^0.0.1",
|
|
119
117
|
"@awsless/formation": "^0.0.57",
|
|
120
|
-
"@awsless/
|
|
121
|
-
"@awsless/
|
|
118
|
+
"@awsless/size": "^0.0.1",
|
|
119
|
+
"@awsless/json": "^0.0.6",
|
|
120
|
+
"@awsless/validate": "^0.0.16",
|
|
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"
|