sse-cat 2.0.5 → 2.0.6
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 +2 -10
- package/lib/cli.js +4 -3
- package/lib/cli.js.map +1 -1
- package/lib/from-multiple-server-sent-events.js +5 -2
- package/lib/from-multiple-server-sent-events.js.map +1 -1
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -10,13 +10,12 @@ Options:
|
|
|
10
10
|
-V, --version output the version number
|
|
11
11
|
--header <header> Pass custom header(s) to server (default: [])
|
|
12
12
|
--event <name> Pass custom event(s) that need to be captured (default: [])
|
|
13
|
-
--heartbeat-event
|
|
14
|
-
--heartbeat-timeout
|
|
13
|
+
--heartbeat-event [name]
|
|
14
|
+
--heartbeat-timeout [ms]
|
|
15
15
|
-h, --help display help for command
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Install
|
|
19
|
-
|
|
20
19
|
```sh
|
|
21
20
|
npm install -g sse-cat
|
|
22
21
|
# or
|
|
@@ -24,7 +23,6 @@ yarn global add sse-cat
|
|
|
24
23
|
```
|
|
25
24
|
|
|
26
25
|
### Install from source
|
|
27
|
-
|
|
28
26
|
```sh
|
|
29
27
|
yarn install
|
|
30
28
|
yarn build
|
|
@@ -32,15 +30,12 @@ yarn global add "file:$(pwd)"
|
|
|
32
30
|
```
|
|
33
31
|
|
|
34
32
|
## Usage
|
|
35
|
-
|
|
36
33
|
### Single SSE
|
|
37
|
-
|
|
38
34
|
```sh
|
|
39
35
|
sse-cat 'http://localhost:8080/sse'
|
|
40
36
|
```
|
|
41
37
|
|
|
42
38
|
### Multiple SSE
|
|
43
|
-
|
|
44
39
|
```sh
|
|
45
40
|
sse-cat \
|
|
46
41
|
'http://localhost:8080/sse/1' \
|
|
@@ -48,7 +43,6 @@ sse-cat \
|
|
|
48
43
|
```
|
|
49
44
|
|
|
50
45
|
### Headers
|
|
51
|
-
|
|
52
46
|
```sh
|
|
53
47
|
sse-cat \
|
|
54
48
|
--header 'User-Agent: sse-cat' \
|
|
@@ -57,7 +51,6 @@ sse-cat \
|
|
|
57
51
|
```
|
|
58
52
|
|
|
59
53
|
### Custom events
|
|
60
|
-
|
|
61
54
|
```sh
|
|
62
55
|
sse-cat \
|
|
63
56
|
--event 'message' \
|
|
@@ -66,7 +59,6 @@ sse-cat \
|
|
|
66
59
|
```
|
|
67
60
|
|
|
68
61
|
### Heartbeat
|
|
69
|
-
|
|
70
62
|
The heartbeat checker will only be enabled when all heartbeat options are set.
|
|
71
63
|
|
|
72
64
|
```sh
|
package/lib/cli.js
CHANGED
|
@@ -13,8 +13,8 @@ commander_1.program
|
|
|
13
13
|
.description(require('../package.json').description)
|
|
14
14
|
.option('--header <header>', 'Pass custom header(s) to server', collect, [])
|
|
15
15
|
.option('--event <name>', 'Pass custom event(s) that need to be captured', collect, [])
|
|
16
|
-
.option('--heartbeat-event
|
|
17
|
-
.option('--heartbeat-timeout
|
|
16
|
+
.option('--heartbeat-event [name]')
|
|
17
|
+
.option('--heartbeat-timeout [ms]')
|
|
18
18
|
.arguments('<url...>')
|
|
19
19
|
.action((urls) => {
|
|
20
20
|
const opts = commander_1.program.opts();
|
|
@@ -31,10 +31,11 @@ commander_1.program
|
|
|
31
31
|
});
|
|
32
32
|
const heartbeatOptions = (0, go_1.go)(() => {
|
|
33
33
|
if ((0, types_1.isntNull)(heartbeatEvent) && (0, types_1.isntNull)(heartbeatTimeout)) {
|
|
34
|
-
|
|
34
|
+
const options = {
|
|
35
35
|
event: heartbeatEvent,
|
|
36
36
|
timeout: heartbeatTimeout
|
|
37
37
|
};
|
|
38
|
+
return options;
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
41
|
return undefined;
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AACA,yCAAmC;AACnC,yFAAiF;AACjF,+EAAwE;
|
|
1
|
+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AgC,CAAC,CAAA;QACrD,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;IACF,MAAM,gBAAgB,GAAG,IAAA,OAAE,EAAC,GAAG,EAAE;QAC/B,IAAI,IAAA,gBAAQ,EAAC,cAAc,CAAC,IAAI,IAAA,gBAAQ,EAAC,gBAAgB,CAAC,EAAE;YAC1D,MAAM,OAAO,GAAsB;gBACjC,KAAK,EAAE,cAAc;gBACrB,OAAO,EAAE,gBAAgB;aAC1B,CAAA;YACD,OAAO,OAAO,CAAA;SACf;aAAM;YACL,OAAO,SAAS,CAAA;SACjB;IACH,CAAC,CAAC,CAAA;IAEF,IAAA,+DAA4B,EAAC,IAAI,EAAE;QACjC,OAAO;QACP,MAAM;QACN,SAAS,EAAE,gBAAgB;KAC5B,CAAC,CAAC,SAAS,CAAC;QACX,IAAI,CAAC,OAAO;YACV,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACtB,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAC;KACD,KAAK,EAAE,CAAA;AAEV,SAAS,OAAO,CAAC,KAAa,EAAE,QAAkB;IAChD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;AACjC,CAAC;AAED,SAAS,YAAY,CAAC,MAAgB;IACpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,CAAC,SAAS,CAAC,CAAA;KACnB;SAAM;QACL,OAAO,MAAM,CAAA;KACd;AACH,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC"}
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromMultipleServerSentEvents = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
|
-
const from_server_sent_event_1 = require("./from-server-sent-event");
|
|
6
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const from_server_sent_event_1 = require("./from-server-sent-event");
|
|
7
7
|
function fromMultipleServerSentEvents(urls, { events, headers, heartbeat }) {
|
|
8
8
|
const observables = urls.map(url => {
|
|
9
9
|
return (0, from_server_sent_event_1.fromServerSentEvent)(url, {
|
|
10
10
|
events,
|
|
11
11
|
headers,
|
|
12
12
|
heartbeat
|
|
13
|
-
}).pipe((0, operators_1.
|
|
13
|
+
}).pipe((0, operators_1.catchError)(err => {
|
|
14
|
+
console.error(`${err}`);
|
|
15
|
+
return (0, rxjs_1.throwError)(() => err);
|
|
16
|
+
}), (0, operators_1.retry)());
|
|
14
17
|
});
|
|
15
18
|
return (0, rxjs_1.merge)(...observables);
|
|
16
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from-multiple-server-sent-events.js","sourceRoot":"","sources":["../src/from-multiple-server-sent-events.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"from-multiple-server-sent-events.js","sourceRoot":"","sources":["../src/from-multiple-server-sent-events.ts"],"names":[],"mappings":";;;AAAA,+BAAoD;AACpD,8CAAkD;AAClD,qEAA8D;AAI9D,SAAgB,4BAA4B,CAC1C,IAAc,EACd,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAI3B;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACjC,OAAO,IAAA,4CAAmB,EAAC,GAAG,EAAE;YAC9B,MAAM;YACN,OAAO;YACP,SAAS;SACV,CAAC,CAAC,IAAI,CACL,IAAA,sBAAU,EAAC,GAAG,CAAC,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA;YACvB,OAAO,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;QAC9B,CAAC,CAAC,EACF,IAAA,iBAAK,GAAE,CACR,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,IAAA,YAAK,EAAC,GAAG,WAAW,CAAC,CAAA;AAC9B,CAAC;AAvBD,oEAuBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sse-cat",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Command-line client for Server-Sent Events(SSE).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -37,35 +37,35 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@blackglory/errors": "^2.1
|
|
41
|
-
"@blackglory/go": "^
|
|
42
|
-
"@blackglory/types": "^
|
|
43
|
-
"commander": "^9.
|
|
44
|
-
"eventsource": "^
|
|
40
|
+
"@blackglory/errors": "^2.2.1",
|
|
41
|
+
"@blackglory/go": "^1.1.1",
|
|
42
|
+
"@blackglory/types": "^1.2.1",
|
|
43
|
+
"commander": "^9.4.0",
|
|
44
|
+
"eventsource": "^2.0.2",
|
|
45
45
|
"extra-timers": "^0.2.5",
|
|
46
|
-
"hotypes": "^0.4.
|
|
47
|
-
"justypes": "^0.
|
|
48
|
-
"rxjs": "^7.5.
|
|
46
|
+
"hotypes": "^0.4.4",
|
|
47
|
+
"justypes": "^2.0.0",
|
|
48
|
+
"rxjs": "^7.5.6"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@commitlint/cli": "^
|
|
52
|
-
"@commitlint/config-conventional": "^
|
|
53
|
-
"@types/eventsource": "^1.1.
|
|
51
|
+
"@commitlint/cli": "^17.0.3",
|
|
52
|
+
"@commitlint/config-conventional": "^17.0.3",
|
|
53
|
+
"@types/eventsource": "^1.1.9",
|
|
54
54
|
"@types/jest": "^27.4.0",
|
|
55
55
|
"@types/node": "14",
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
57
|
-
"@typescript-eslint/parser": "^5.
|
|
58
|
-
"eslint": "^8.
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
57
|
+
"@typescript-eslint/parser": "^5.31.0",
|
|
58
|
+
"eslint": "^8.20.0",
|
|
59
59
|
"husky": "4",
|
|
60
60
|
"jest": "^27.5.1",
|
|
61
61
|
"npm-run-all": "^4.1.5",
|
|
62
62
|
"rimraf": "^3.0.2",
|
|
63
|
-
"standard-version": "^9.
|
|
63
|
+
"standard-version": "^9.5.0",
|
|
64
64
|
"ts-jest": "^27.1.3",
|
|
65
|
-
"ts-node": "^10.
|
|
65
|
+
"ts-node": "^10.9.1",
|
|
66
66
|
"ts-patch": "^2.0.1",
|
|
67
|
-
"tsconfig-paths": "^
|
|
68
|
-
"typescript": "^4.
|
|
67
|
+
"tsconfig-paths": "^4.0.0",
|
|
68
|
+
"typescript": "^4.7.4",
|
|
69
69
|
"typescript-transform-paths": "^3.3.1"
|
|
70
70
|
}
|
|
71
71
|
}
|