@aws-amplify/pubsub 6.0.17-unstable.e316a2e.0 → 6.0.17
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/cjs/vendor/paho-mqtt.js +74 -74
- package/dist/esm/vendor/paho-mqtt.js +74 -74
- package/package.json +102 -102
- package/src/Providers/AWSIot.ts +1 -1
- package/src/Providers/MqttOverWS.ts +7 -7
- package/src/utils/ConnectionStateMonitor.ts +6 -6
- package/src/vendor/paho-mqtt.js +74 -74
package/package.json
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
2
|
+
"name": "@aws-amplify/pubsub",
|
|
3
|
+
"version": "6.0.17",
|
|
4
|
+
"description": "Pubsub category of aws-amplify",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
7
|
+
"typings": "./dist/esm/index.d.ts",
|
|
8
|
+
"react-native": "./src/index.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
|
|
15
|
+
"test:size": "size-limit",
|
|
16
|
+
"build-with-test": "npm run clean && npm run build",
|
|
17
|
+
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
|
|
18
|
+
"build:esm-cjs": "rollup -c rollup.config.mjs && cp -R src/vendor dist/cjs/vendor && cp -R src/vendor dist/esm/vendor",
|
|
19
|
+
"build:watch": "mkdirp dist/esm/vendor && mkdirp dist/cjs/vendor && cp -R src/vendor dist/cjs/vendor && cp -R src/vendor dist/esm/vendor && rollup -c rollup.config.mjs --watch",
|
|
20
|
+
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
|
|
21
|
+
"clean": "npm run clean:size && rimraf dist lib lib-esm",
|
|
22
|
+
"clean:size": "rimraf dual-publish-tmp tmp*",
|
|
23
|
+
"format": "echo \"Not implemented\"",
|
|
24
|
+
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
|
|
25
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 93.0 -i src/vendor/paho-mqtt.js"
|
|
26
|
+
},
|
|
27
|
+
"typesVersions": {
|
|
28
|
+
">=4.2": {
|
|
29
|
+
"iot": [
|
|
30
|
+
"./dist/esm/clients/iot.d.ts"
|
|
31
|
+
],
|
|
32
|
+
"mqtt": [
|
|
33
|
+
"./dist/esm/clients/mqtt.d.ts"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/esm/index.d.ts",
|
|
40
|
+
"import": "./dist/esm/index.mjs",
|
|
41
|
+
"require": "./dist/cjs/index.js",
|
|
42
|
+
"react-native": "./src/index.ts"
|
|
43
|
+
},
|
|
44
|
+
"./iot": {
|
|
45
|
+
"types": "./dist/esm/clients/iot.d.ts",
|
|
46
|
+
"import": "./dist/esm/clients/iot.mjs",
|
|
47
|
+
"require": "./dist/cjs/clients/iot.js",
|
|
48
|
+
"react-native": "./src/clients/iot.ts"
|
|
49
|
+
},
|
|
50
|
+
"./mqtt": {
|
|
51
|
+
"types": "./dist/esm/clients/mqtt.d.ts",
|
|
52
|
+
"import": "./dist/esm/clients/mqtt.mjs",
|
|
53
|
+
"require": "./dist/cjs/clients/mqtt.js",
|
|
54
|
+
"react-native": "./src/clients/mqtt.ts"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "https://github.com/aws-amplify/amplify-js.git"
|
|
60
|
+
},
|
|
61
|
+
"author": "Amazon Web Services",
|
|
62
|
+
"license": "Apache-2.0",
|
|
63
|
+
"bugs": {
|
|
64
|
+
"url": "https://github.com/aws/aws-amplify/issues"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://aws-amplify.github.io/",
|
|
67
|
+
"files": [
|
|
68
|
+
"dist/cjs",
|
|
69
|
+
"dist/esm",
|
|
70
|
+
"src",
|
|
71
|
+
"iot",
|
|
72
|
+
"mqtt"
|
|
73
|
+
],
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"@aws-amplify/auth": "6.0.17",
|
|
76
|
+
"buffer": "4.9.2",
|
|
77
|
+
"graphql": "15.8.0",
|
|
78
|
+
"rxjs": "^7.8.1",
|
|
79
|
+
"tslib": "^2.5.0",
|
|
80
|
+
"url": "0.11.0"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"@aws-amplify/core": "^6.0.0"
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@aws-amplify/core": "6.0.17",
|
|
87
|
+
"typescript": "5.0.2"
|
|
88
|
+
},
|
|
89
|
+
"size-limit": [
|
|
90
|
+
{
|
|
91
|
+
"name": "PubSub (IoT provider)",
|
|
92
|
+
"path": "./dist/esm/index.mjs",
|
|
93
|
+
"import": "{ generateClient }",
|
|
94
|
+
"limit": "1.2 kB"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "PubSub (Mqtt provider)",
|
|
98
|
+
"path": "./dist/esm/clients/mqtt.mjs",
|
|
99
|
+
"import": "{ generateClient }",
|
|
100
|
+
"limit": "1.07 kB"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"gitHead": "c54a19c8a654a47d559cb0fd41c74bd2c3eb79ca"
|
|
104
104
|
}
|
package/src/Providers/AWSIot.ts
CHANGED
|
@@ -69,7 +69,7 @@ class ClientsQueue {
|
|
|
69
69
|
|
|
70
70
|
async get(
|
|
71
71
|
clientId: string,
|
|
72
|
-
clientFactory?: (input: string) => Promise<PahoClient | undefined
|
|
72
|
+
clientFactory?: (input: string) => Promise<PahoClient | undefined>,
|
|
73
73
|
) {
|
|
74
74
|
const cachedPromise = this.promises.get(clientId);
|
|
75
75
|
if (cachedPromise) return cachedPromise;
|
|
@@ -129,7 +129,7 @@ export class MqttOverWS extends AbstractPubSub<MqttOptions> {
|
|
|
129
129
|
// Trigger connected to halt reconnection attempts
|
|
130
130
|
this.reconnectionMonitor.record(ReconnectEvent.HALT_RECONNECT);
|
|
131
131
|
}
|
|
132
|
-
}
|
|
132
|
+
},
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -214,7 +214,7 @@ export class MqttOverWS extends AbstractPubSub<MqttOptions> {
|
|
|
214
214
|
|
|
215
215
|
if (connected) {
|
|
216
216
|
this.connectionStateMonitor.record(
|
|
217
|
-
CONNECTION_CHANGE.CONNECTION_ESTABLISHED
|
|
217
|
+
CONNECTION_CHANGE.CONNECTION_ESTABLISHED,
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -223,7 +223,7 @@ export class MqttOverWS extends AbstractPubSub<MqttOptions> {
|
|
|
223
223
|
|
|
224
224
|
protected async connect(
|
|
225
225
|
clientId: string,
|
|
226
|
-
options: MqttOptions = {}
|
|
226
|
+
options: MqttOptions = {},
|
|
227
227
|
): Promise<PahoClient | undefined> {
|
|
228
228
|
return await this.clientsQueue.get(clientId, async clientId => {
|
|
229
229
|
const client = await this.newClient({ ...options, clientId });
|
|
@@ -233,7 +233,7 @@ export class MqttOverWS extends AbstractPubSub<MqttOptions> {
|
|
|
233
233
|
this._topicObservers.forEach(
|
|
234
234
|
(_value: Set<PubSubContentObserver>, key: string) => {
|
|
235
235
|
client.subscribe(key);
|
|
236
|
-
}
|
|
236
|
+
},
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
239
|
return client;
|
|
@@ -263,7 +263,7 @@ export class MqttOverWS extends AbstractPubSub<MqttOptions> {
|
|
|
263
263
|
logger.debug(
|
|
264
264
|
'Publishing to topic(s) failed',
|
|
265
265
|
targetTopics.join(','),
|
|
266
|
-
message
|
|
266
|
+
message,
|
|
267
267
|
);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
@@ -368,7 +368,7 @@ export class MqttOverWS extends AbstractPubSub<MqttOptions> {
|
|
|
368
368
|
if (this._clientIdObservers.get(clientId)?.size === 0) {
|
|
369
369
|
this.disconnect(clientId);
|
|
370
370
|
this.connectionStateMonitor.record(
|
|
371
|
-
CONNECTION_CHANGE.CLOSING_CONNECTION
|
|
371
|
+
CONNECTION_CHANGE.CLOSING_CONNECTION,
|
|
372
372
|
);
|
|
373
373
|
this._clientIdObservers.delete(clientId);
|
|
374
374
|
}
|
|
@@ -67,10 +67,10 @@ export class ConnectionStateMonitor {
|
|
|
67
67
|
this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(
|
|
68
68
|
({ online }) => {
|
|
69
69
|
this.record(
|
|
70
|
-
online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE
|
|
70
|
+
online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE,
|
|
71
71
|
);
|
|
72
72
|
this._initialNetworkStateSubscription?.unsubscribe();
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
this._linkedConnectionStateObservable =
|
|
@@ -92,9 +92,9 @@ export class ConnectionStateMonitor {
|
|
|
92
92
|
this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(
|
|
93
93
|
({ online }) => {
|
|
94
94
|
this.record(
|
|
95
|
-
online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE
|
|
95
|
+
online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE,
|
|
96
96
|
);
|
|
97
|
-
}
|
|
97
|
+
},
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -124,14 +124,14 @@ export class ConnectionStateMonitor {
|
|
|
124
124
|
.pipe(
|
|
125
125
|
map(value => {
|
|
126
126
|
return this.connectionStatesTranslator(value);
|
|
127
|
-
})
|
|
127
|
+
}),
|
|
128
128
|
)
|
|
129
129
|
.pipe(
|
|
130
130
|
filter(current => {
|
|
131
131
|
const toInclude = current !== previous;
|
|
132
132
|
previous = current;
|
|
133
133
|
return toInclude;
|
|
134
|
-
})
|
|
134
|
+
}),
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
|