@trycourier/transport 6.0.1-internal.00141d1.0 → 6.0.1-internal.1e0f6ce.0
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/base.js +4 -0
- package/dist/courier/index.js +14 -9
- package/package.json +3 -3
- package/typings/courier/index.d.ts +4 -3
- package/typings/courier/index.d.ts.map +1 -1
- package/typings/courier/types.d.ts +10 -5
- package/typings/courier/types.d.ts.map +1 -1
- package/typings/index.d.ts +2 -2
- package/typings/index.d.ts.map +1 -1
- package/typings/ws.d.ts +1 -1
- package/typings/ws.d.ts.map +1 -1
package/dist/base.js
CHANGED
package/dist/courier/index.js
CHANGED
|
@@ -43,26 +43,26 @@ var CourierTransport = /*#__PURE__*/function (_Transport) {
|
|
|
43
43
|
|
|
44
44
|
(0, _classCallCheck2["default"])(this, CourierTransport);
|
|
45
45
|
_this = _super.call(this);
|
|
46
|
+
var clientKeyOptions = options;
|
|
47
|
+
var jwtOptions = options;
|
|
46
48
|
|
|
47
|
-
if (!
|
|
49
|
+
if (!clientKeyOptions.clientKey && !jwtOptions.authorization) {
|
|
48
50
|
throw new Error("Missing Authorization");
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
_this.authorization =
|
|
53
|
+
_this.authorization = jwtOptions.authorization;
|
|
52
54
|
_this.clientSourceId = options.clientSourceId;
|
|
53
|
-
_this.clientKey =
|
|
54
|
-
_this.userSignature =
|
|
55
|
+
_this.clientKey = clientKeyOptions.clientKey;
|
|
56
|
+
_this.userSignature = clientKeyOptions.userSignature;
|
|
55
57
|
_this.ws = new _ws.CourierWS({
|
|
56
58
|
tenantId: options.tenantId,
|
|
57
|
-
authorization:
|
|
59
|
+
authorization: jwtOptions.authorization,
|
|
58
60
|
clientSourceId: options.clientSourceId,
|
|
59
|
-
clientKey:
|
|
61
|
+
clientKey: clientKeyOptions.clientKey,
|
|
60
62
|
options: options.wsOptions,
|
|
61
|
-
userSignature:
|
|
63
|
+
userSignature: clientKeyOptions.userSignature
|
|
62
64
|
});
|
|
63
65
|
|
|
64
|
-
_this.ws.connect();
|
|
65
|
-
|
|
66
66
|
if ((_options$wsOptions = options.wsOptions) !== null && _options$wsOptions !== void 0 && _options$wsOptions.onReconnect) {
|
|
67
67
|
var _options$wsOptions2;
|
|
68
68
|
|
|
@@ -85,6 +85,11 @@ var CourierTransport = /*#__PURE__*/function (_Transport) {
|
|
|
85
85
|
value: function connect() {
|
|
86
86
|
this.ws.connect();
|
|
87
87
|
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "isConnected",
|
|
90
|
+
value: function isConnected() {
|
|
91
|
+
return this.ws.connected;
|
|
92
|
+
}
|
|
88
93
|
}, {
|
|
89
94
|
key: "keepAlive",
|
|
90
95
|
value: function keepAlive() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/transport",
|
|
3
|
-
"version": "6.0.1-internal.
|
|
3
|
+
"version": "6.0.1-internal.1e0f6ce.0+1e0f6ce",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "typings/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "ISC",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@trycourier/core": "^6.0.1-internal.
|
|
17
|
+
"@trycourier/core": "^6.0.1-internal.1e0f6ce.0+1e0f6ce",
|
|
18
18
|
"jwt-decode": "^3.1.2",
|
|
19
19
|
"reconnecting-websocket": "^4.4.0",
|
|
20
20
|
"rimraf": "^3.0.2"
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"dist/",
|
|
24
24
|
"typings/"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "1e0f6ce4dee7fe62a5cd45736a08b73799659773"
|
|
27
27
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { CourierWS } from "../ws";
|
|
2
2
|
import { Transport } from "../base";
|
|
3
3
|
import { Interceptor } from "@trycourier/core";
|
|
4
|
-
import {
|
|
4
|
+
import { TransportOptions } from "./types";
|
|
5
5
|
export declare class CourierTransport extends Transport {
|
|
6
6
|
protected tenantId?: string;
|
|
7
7
|
protected authorization?: string;
|
|
8
|
-
protected clientSourceId
|
|
8
|
+
protected clientSourceId?: string;
|
|
9
9
|
protected clientKey?: string;
|
|
10
10
|
protected interceptor?: Interceptor;
|
|
11
11
|
protected userSignature?: string;
|
|
12
12
|
protected ws: CourierWS;
|
|
13
|
-
constructor(options:
|
|
13
|
+
constructor(options: TransportOptions);
|
|
14
14
|
closeConnection(): void;
|
|
15
15
|
connect(): void;
|
|
16
|
+
isConnected(): boolean;
|
|
16
17
|
keepAlive(): void;
|
|
17
18
|
send(message: any): void;
|
|
18
19
|
subscribe(channel: string, event?: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/courier/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/courier/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAkC,MAAM,SAAS,CAAC;AAE3E,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAkB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC5C,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC;gBAEZ,OAAO,EAAE,gBAAgB;IAgCrC,eAAe,IAAI,IAAI;IAIvB,OAAO,IAAI,IAAI;IAIf,WAAW,IAAI,OAAO;IAItB,SAAS,IAAI,IAAI;IAMjB,IAAI,CAAC,OAAO,KAAA,GAAG,IAAI;IAUnB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAchD,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAIlD,cAAc,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,IAAI;IAInE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAGlC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { WSOptions } from "~/types";
|
|
2
|
-
export interface
|
|
2
|
+
export interface IBaseOptions {
|
|
3
3
|
tenantId?: string;
|
|
4
|
-
|
|
5
|
-
clientKey?: string;
|
|
6
|
-
clientSourceId: string;
|
|
7
|
-
userSignature?: string;
|
|
4
|
+
clientSourceId?: string;
|
|
8
5
|
wsOptions?: WSOptions;
|
|
9
6
|
}
|
|
7
|
+
export interface IClientKeyOptions extends IBaseOptions {
|
|
8
|
+
clientKey: string;
|
|
9
|
+
userSignature?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IJWTOptions extends IBaseOptions {
|
|
12
|
+
authorization: string;
|
|
13
|
+
}
|
|
14
|
+
export declare type TransportOptions = IClientKeyOptions | IJWTOptions;
|
|
10
15
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/courier/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/courier/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AACD,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,oBAAY,gBAAgB,GAAG,iBAAiB,GAAG,WAAW,CAAC"}
|
package/typings/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransportOptions } from "./courier/types";
|
|
2
2
|
export * from "./courier";
|
|
3
3
|
export * from "./base";
|
|
4
4
|
export * from "./types";
|
|
5
5
|
export * from "./ws";
|
|
6
|
-
export type {
|
|
6
|
+
export type { TransportOptions };
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/typings/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AAErB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
package/typings/ws.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import ReconnectingWebSocket from "reconnecting-websocket";
|
|
|
3
3
|
import { WSOptions } from "./types";
|
|
4
4
|
export declare class CourierWS {
|
|
5
5
|
connection?: ReconnectingWebSocket;
|
|
6
|
+
connected: boolean;
|
|
6
7
|
private subscriptions;
|
|
7
8
|
private tenantId?;
|
|
8
9
|
private clientSourceId?;
|
|
@@ -15,7 +16,6 @@ export declare class CourierWS {
|
|
|
15
16
|
private url;
|
|
16
17
|
private userSignature?;
|
|
17
18
|
private connectionCount;
|
|
18
|
-
protected connected: any;
|
|
19
19
|
protected messageCallback: any;
|
|
20
20
|
constructor({ tenantId, authorization, clientKey, options, clientSourceId, userSignature, }: {
|
|
21
21
|
tenantId?: string;
|
package/typings/ws.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAGtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,qBAAqC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAqB,SAAS,EAAE,MAAM,SAAS,CAAC;AAGvD,qBAAa,SAAS;
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAGtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,qBAAqC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAqB,SAAS,EAAE,MAAM,SAAS,CAAC;AAGvD,qBAAa,SAAS;IACb,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC;IAE1B,OAAO,CAAC,aAAa,CAIlB;IACH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