particle-api-js 11.1.4 → 11.1.5
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/.circleci/config.yml +23 -1
- package/.nvmrc +1 -1
- package/CHANGELOG.md +5 -0
- package/EventStream-e2e-node.js +15 -15
- package/dist/particle.min.js +1 -1
- package/dist/particle.min.js.map +1 -1
- package/docs/api.md +137 -137
- package/eslint.config.mjs +7 -0
- package/fs.js +1 -0
- package/karma.conf.js +60 -59
- package/package.json +17 -18
- package/src/Agent.js +241 -240
- package/src/Client.js +113 -112
- package/src/Defaults.js +6 -5
- package/src/EventStream.js +260 -260
- package/src/Library.js +19 -19
- package/src/Particle.js +1318 -1317
- package/test/Agent.integration.js +15 -15
- package/test/Agent.spec.js +474 -473
- package/test/Client.spec.js +204 -203
- package/test/Defaults.spec.js +21 -20
- package/test/EventStream.spec.js +235 -234
- package/test/FakeAgent.js +19 -18
- package/test/Library.spec.js +31 -30
- package/test/Particle.integration.js +30 -29
- package/test/Particle.spec.js +3174 -3173
- package/test/fixtures/index.js +8 -8
- package/test/support/FixtureHttpServer.js +17 -16
- package/test/test-setup.js +4 -4
- package/tsconfig.json +2 -1
- package/webpack.config.js +40 -39
- package/.eslintrc.js +0 -25
- package/test/.eslintrc +0 -6
package/.circleci/config.yml
CHANGED
|
@@ -4,6 +4,20 @@ orbs:
|
|
|
4
4
|
browser-tools: circleci/browser-tools@2.2.0
|
|
5
5
|
|
|
6
6
|
jobs:
|
|
7
|
+
lint:
|
|
8
|
+
docker:
|
|
9
|
+
- image: cimg/node:22.18 # eslint 9.x requires 18+, so we've separated it from the test step
|
|
10
|
+
auth:
|
|
11
|
+
username: $DOCKERHUB_USERNAME
|
|
12
|
+
password: $DOCKERHUB_PASSWORD
|
|
13
|
+
steps:
|
|
14
|
+
- checkout
|
|
15
|
+
- run:
|
|
16
|
+
name: NPM install
|
|
17
|
+
command: npm ci
|
|
18
|
+
- run:
|
|
19
|
+
name: Lint
|
|
20
|
+
command: npm run lint
|
|
7
21
|
run-tests:
|
|
8
22
|
parameters:
|
|
9
23
|
node-version:
|
|
@@ -57,12 +71,19 @@ workflows:
|
|
|
57
71
|
version: 2
|
|
58
72
|
test-and-publish:
|
|
59
73
|
jobs:
|
|
74
|
+
- lint:
|
|
75
|
+
context:
|
|
76
|
+
- particle-ci-private
|
|
77
|
+
# run tests for all branches
|
|
78
|
+
filters:
|
|
79
|
+
branches:
|
|
80
|
+
only: /.*/
|
|
60
81
|
- run-tests:
|
|
61
82
|
context:
|
|
62
83
|
- particle-ci-private
|
|
63
84
|
matrix:
|
|
64
85
|
parameters:
|
|
65
|
-
node-version: ["
|
|
86
|
+
node-version: ["16.20.0", "22.18"]
|
|
66
87
|
# run tests for all branches and tags
|
|
67
88
|
filters:
|
|
68
89
|
tags:
|
|
@@ -71,6 +92,7 @@ workflows:
|
|
|
71
92
|
only: /.*/
|
|
72
93
|
- publish-npm:
|
|
73
94
|
requires:
|
|
95
|
+
- lint
|
|
74
96
|
- run-tests
|
|
75
97
|
context:
|
|
76
98
|
- particle-ci-private
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
22
|
package/CHANGELOG.md
CHANGED
package/EventStream-e2e-node.js
CHANGED
|
@@ -7,7 +7,7 @@ Steps:
|
|
|
7
7
|
- Follow the scenarios in EventStream.feature
|
|
8
8
|
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
'use strict';
|
|
11
11
|
const Particle = require('./src/Particle');
|
|
12
12
|
const baseUrl = process.env.PARTICLE_API_BASE_URL || 'http://localhost:9090';
|
|
13
13
|
const auth = process.env.PARTICLE_API_TOKEN;
|
|
@@ -16,19 +16,19 @@ const particle = new Particle({ baseUrl });
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable no-console */
|
|
18
18
|
particle.getEventStream({ deviceId: 'mine', auth })
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
.then(stream => {
|
|
20
|
+
console.log('event stream connected');
|
|
21
|
+
|
|
22
|
+
['event', 'error', 'disconnect', 'reconnect', 'reconnect-success', 'reconnect-error']
|
|
23
|
+
.forEach(eventName => {
|
|
24
|
+
stream.on(eventName, (arg) => {
|
|
25
|
+
console.log(eventName, arg);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
})
|
|
29
|
+
.catch((err) => {
|
|
30
|
+
console.error(err);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
});
|
|
33
33
|
/* eslint-enable no-console */
|
|
34
34
|
|