@awsless/awsless 0.0.365 → 0.0.366
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/client.d.ts +8 -2
- package/dist/client.js +8 -1
- package/package.json +6 -6
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _awsless_mqtt from '@awsless/mqtt';
|
|
2
|
-
import {
|
|
2
|
+
import { QoS } from '@awsless/mqtt';
|
|
3
3
|
|
|
4
4
|
interface AuthResources {
|
|
5
5
|
}
|
|
@@ -55,7 +55,13 @@ declare const createHttpClient: <S extends Schema>(fetcher: HttpFetcher) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
type MessageCallback = (payload: any) => void;
|
|
58
|
-
|
|
58
|
+
type ClientProps = {
|
|
59
|
+
endpoint: string;
|
|
60
|
+
authorizer: string;
|
|
61
|
+
token: string;
|
|
62
|
+
};
|
|
63
|
+
type ClientPropsProvider = () => Promise<ClientProps> | ClientProps;
|
|
64
|
+
declare const createPubSubClient: (props: ClientProps | ClientPropsProvider) => {
|
|
59
65
|
publish(topic: string, event: string, payload: unknown, qos: QoS): Promise<void>;
|
|
60
66
|
subscribe(topic: string, event: string, callback: MessageCallback): Promise<_awsless_mqtt.Unsubscribe>;
|
|
61
67
|
connected: boolean;
|
package/dist/client.js
CHANGED
|
@@ -81,7 +81,14 @@ var createHttpClient = (fetcher) => {
|
|
|
81
81
|
// src/lib/client/pubsub.ts
|
|
82
82
|
import { createClient } from "@awsless/mqtt";
|
|
83
83
|
var createPubSubClient = (props) => {
|
|
84
|
-
const mqtt = createClient(
|
|
84
|
+
const mqtt = createClient(async () => {
|
|
85
|
+
const config = typeof props === "function" ? await props() : props;
|
|
86
|
+
return {
|
|
87
|
+
endpoint: `wss://${config.endpoint}/mqtt`,
|
|
88
|
+
username: `?x-amz-customauthorizer-name=${config.authorizer}`,
|
|
89
|
+
password: config.token
|
|
90
|
+
};
|
|
91
|
+
});
|
|
85
92
|
return {
|
|
86
93
|
...mqtt,
|
|
87
94
|
publish(topic, event, payload, qos) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.366",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@awsless/iot": "^0.0.2",
|
|
32
|
-
"@awsless/open-search": "^0.0.15",
|
|
33
32
|
"@awsless/lambda": "^0.0.26",
|
|
33
|
+
"@awsless/open-search": "^0.0.15",
|
|
34
34
|
"@awsless/redis": "^0.0.12",
|
|
35
|
+
"@awsless/s3": "^0.0.18",
|
|
36
|
+
"@awsless/validate": "^0.0.15",
|
|
35
37
|
"@awsless/sns": "^0.0.7",
|
|
36
38
|
"@awsless/sqs": "^0.0.7",
|
|
37
39
|
"@awsless/ssm": "^0.0.7",
|
|
38
|
-
"@awsless/validate": "^0.0.15",
|
|
39
|
-
"@awsless/s3": "^0.0.18",
|
|
40
40
|
"@awsless/weak-cache": "^0.0.1",
|
|
41
41
|
"@awsless/mqtt": "^0.0.2"
|
|
42
42
|
},
|
|
@@ -112,9 +112,9 @@
|
|
|
112
112
|
"@awsless/duration": "^0.0.1",
|
|
113
113
|
"@awsless/graphql": "^0.0.9",
|
|
114
114
|
"@awsless/size": "^0.0.1",
|
|
115
|
-
"@awsless/ts-file-cache": "^0.0.10",
|
|
116
115
|
"@awsless/validate": "^0.0.15",
|
|
117
|
-
"@awsless/formation": "^0.0.56"
|
|
116
|
+
"@awsless/formation": "^0.0.56",
|
|
117
|
+
"@awsless/ts-file-cache": "^0.0.10"
|
|
118
118
|
},
|
|
119
119
|
"scripts": {
|
|
120
120
|
"test": "pnpm code test",
|