@ariva-mds/mds 2.2.0 → 2.3.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/lib/cjs/index.js
CHANGED
|
@@ -24,17 +24,20 @@ class MdsConnection {
|
|
|
24
24
|
this.counter = 0;
|
|
25
25
|
this.runningRequestsObservable = new Map();
|
|
26
26
|
this.runningRequestsPromise = new Map();
|
|
27
|
+
this.runningRequestsParameters = new Map();
|
|
27
28
|
this.authdataCallback = authdataCallback;
|
|
28
29
|
this.websocketUrl = websocketUrl;
|
|
29
30
|
this.websocket = new reconnecting_websocket_1.default(this.websocketUrl, [], options.wsOptions);
|
|
30
31
|
this.stayAuthenticated();
|
|
32
|
+
const outer = this;
|
|
31
33
|
this.websocket.onopen = function () {
|
|
32
|
-
|
|
34
|
+
for (let [key, value] of outer.runningRequestsParameters) {
|
|
35
|
+
outer.websocket.send(JSON.stringify(value));
|
|
36
|
+
}
|
|
33
37
|
};
|
|
34
38
|
this.websocket.onclose = function () {
|
|
35
39
|
console.log("close");
|
|
36
40
|
};
|
|
37
|
-
const outer = this;
|
|
38
41
|
this.websocket.onmessage = function (e) {
|
|
39
42
|
outer.processWebsocketMessageEvent(e);
|
|
40
43
|
};
|
|
@@ -97,11 +100,13 @@ class MdsConnection {
|
|
|
97
100
|
const outer = this;
|
|
98
101
|
const observable = new rxjs_1.Observable((subscriber) => {
|
|
99
102
|
outer.runningRequestsObservable.set(requestId, subscriber);
|
|
103
|
+
outer.runningRequestsParameters.set(requestId, req);
|
|
100
104
|
outer.websocket.send(JSON.stringify(req));
|
|
101
105
|
// Provide a way of canceling and disposing the resources
|
|
102
106
|
return function unsubscribe() {
|
|
103
107
|
if (outer.runningRequestsObservable.has(requestId)) {
|
|
104
108
|
outer.runningRequestsObservable.delete(requestId);
|
|
109
|
+
outer.runningRequestsParameters.delete(requestId);
|
|
105
110
|
outer.websocket.send(JSON.stringify({
|
|
106
111
|
'cancel': { 'requestId': requestId }
|
|
107
112
|
}));
|
|
@@ -116,6 +121,7 @@ class MdsConnection {
|
|
|
116
121
|
const outer = this;
|
|
117
122
|
const promise = new Promise((resolve, reject) => {
|
|
118
123
|
outer.runningRequestsPromise.set(requestId, { 'resolve': resolve, 'reject': reject });
|
|
124
|
+
outer.runningRequestsParameters.set(requestId, req);
|
|
119
125
|
outer.websocket.send(JSON.stringify(req));
|
|
120
126
|
});
|
|
121
127
|
return promise;
|
|
@@ -128,23 +134,28 @@ class MdsConnection {
|
|
|
128
134
|
if (msg.isError) {
|
|
129
135
|
promise.reject(msg.errorMessage);
|
|
130
136
|
this.runningRequestsPromise.delete(msg.requestId);
|
|
137
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
131
138
|
}
|
|
132
139
|
else if (msg.isComplete == true) {
|
|
133
140
|
promise.resolve(msg);
|
|
134
141
|
this.runningRequestsPromise.delete(msg.requestId);
|
|
142
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
135
143
|
}
|
|
136
144
|
else {
|
|
137
145
|
promise.reject("strange message " + msg);
|
|
138
146
|
this.runningRequestsPromise.delete(msg.requestId);
|
|
147
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
139
148
|
}
|
|
140
149
|
}
|
|
141
150
|
else if (subscriber) {
|
|
142
151
|
if (msg.isError) {
|
|
143
152
|
this.runningRequestsObservable.delete(msg.requestId);
|
|
153
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
144
154
|
subscriber.error(msg.errorMessage);
|
|
145
155
|
}
|
|
146
156
|
else if (msg.isComplete == true) {
|
|
147
157
|
this.runningRequestsObservable.delete(msg.requestId);
|
|
158
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
148
159
|
subscriber.complete();
|
|
149
160
|
}
|
|
150
161
|
else {
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class MdsConnection {
|
|
|
18
18
|
private counter;
|
|
19
19
|
private readonly runningRequestsObservable;
|
|
20
20
|
private readonly runningRequestsPromise;
|
|
21
|
+
private readonly runningRequestsParameters;
|
|
21
22
|
private readonly authdataCallback;
|
|
22
23
|
constructor(websocketUrl: string, authdataCallback: () => Promise<MdsAuthdata>, options?: Options);
|
|
23
24
|
heartbeat(): Observable<String>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,UAAU,EAAqB,MAAM,MAAM,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,4BAA4B,EAAC,MAAM,wBAAwB,CAAC;AAE/E,qBAAa,WAAW;IAEb,KAAK,EAAE,MAAM,CAAC;gBAET,KAAK,EAAE,MAAM;CAI5B;AAED,qBAAa,iBAAiB;IAEnB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAG,GAAG,CAAA;gBAEP,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;CAKtC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,UAAU,EAAqB,MAAM,MAAM,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,4BAA4B,EAAC,MAAM,wBAAwB,CAAC;AAE/E,qBAAa,WAAW;IAEb,KAAK,EAAE,MAAM,CAAC;gBAET,KAAK,EAAE,MAAM;CAI5B;AAED,qBAAa,iBAAiB;IAEnB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAG,GAAG,CAAA;gBAEP,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;CAKtC;AAED,MAAM,MAAM,OAAO,GAAG;IAClB,SAAS,CAAC,EAAE,4BAA4B,CAAC;CAC5C,CAAC;AAEF,qBAAa,aAAa;IAEtB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,SAAS,CAAwB;IAEzC,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA2C;IACrF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA+B;IACtE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA+B;IAEzE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6B;gBAElD,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,GAAE,OAAY;IAyB9F,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC;IAK/B,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAkBzE,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC;IAKjE,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC;IAMjE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAQhD,OAAO,CAAC,iBAAiB;IA4BzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,UAAU;IA4BlB,OAAO,CAAC,OAAO;IAkBf,OAAO,CAAC,4BAA4B;CAkCvC"}
|
package/lib/esm/index.mjs
CHANGED
|
@@ -20,19 +20,22 @@ export class MdsConnection {
|
|
|
20
20
|
counter = 0;
|
|
21
21
|
runningRequestsObservable = new Map();
|
|
22
22
|
runningRequestsPromise = new Map();
|
|
23
|
+
runningRequestsParameters = new Map();
|
|
23
24
|
authdataCallback;
|
|
24
25
|
constructor(websocketUrl, authdataCallback, options = {}) {
|
|
25
26
|
this.authdataCallback = authdataCallback;
|
|
26
27
|
this.websocketUrl = websocketUrl;
|
|
27
28
|
this.websocket = new ReconnectingWebSocket(this.websocketUrl, [], options.wsOptions);
|
|
28
29
|
this.stayAuthenticated();
|
|
30
|
+
const outer = this;
|
|
29
31
|
this.websocket.onopen = function () {
|
|
30
|
-
|
|
32
|
+
for (let [key, value] of outer.runningRequestsParameters) {
|
|
33
|
+
outer.websocket.send(JSON.stringify(value));
|
|
34
|
+
}
|
|
31
35
|
};
|
|
32
36
|
this.websocket.onclose = function () {
|
|
33
37
|
console.log("close");
|
|
34
38
|
};
|
|
35
|
-
const outer = this;
|
|
36
39
|
this.websocket.onmessage = function (e) {
|
|
37
40
|
outer.processWebsocketMessageEvent(e);
|
|
38
41
|
};
|
|
@@ -95,11 +98,13 @@ export class MdsConnection {
|
|
|
95
98
|
const outer = this;
|
|
96
99
|
const observable = new Observable((subscriber) => {
|
|
97
100
|
outer.runningRequestsObservable.set(requestId, subscriber);
|
|
101
|
+
outer.runningRequestsParameters.set(requestId, req);
|
|
98
102
|
outer.websocket.send(JSON.stringify(req));
|
|
99
103
|
// Provide a way of canceling and disposing the resources
|
|
100
104
|
return function unsubscribe() {
|
|
101
105
|
if (outer.runningRequestsObservable.has(requestId)) {
|
|
102
106
|
outer.runningRequestsObservable.delete(requestId);
|
|
107
|
+
outer.runningRequestsParameters.delete(requestId);
|
|
103
108
|
outer.websocket.send(JSON.stringify({
|
|
104
109
|
'cancel': { 'requestId': requestId }
|
|
105
110
|
}));
|
|
@@ -114,6 +119,7 @@ export class MdsConnection {
|
|
|
114
119
|
const outer = this;
|
|
115
120
|
const promise = new Promise((resolve, reject) => {
|
|
116
121
|
outer.runningRequestsPromise.set(requestId, { 'resolve': resolve, 'reject': reject });
|
|
122
|
+
outer.runningRequestsParameters.set(requestId, req);
|
|
117
123
|
outer.websocket.send(JSON.stringify(req));
|
|
118
124
|
});
|
|
119
125
|
return promise;
|
|
@@ -126,23 +132,28 @@ export class MdsConnection {
|
|
|
126
132
|
if (msg.isError) {
|
|
127
133
|
promise.reject(msg.errorMessage);
|
|
128
134
|
this.runningRequestsPromise.delete(msg.requestId);
|
|
135
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
129
136
|
}
|
|
130
137
|
else if (msg.isComplete == true) {
|
|
131
138
|
promise.resolve(msg);
|
|
132
139
|
this.runningRequestsPromise.delete(msg.requestId);
|
|
140
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
133
141
|
}
|
|
134
142
|
else {
|
|
135
143
|
promise.reject("strange message " + msg);
|
|
136
144
|
this.runningRequestsPromise.delete(msg.requestId);
|
|
145
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
137
146
|
}
|
|
138
147
|
}
|
|
139
148
|
else if (subscriber) {
|
|
140
149
|
if (msg.isError) {
|
|
141
150
|
this.runningRequestsObservable.delete(msg.requestId);
|
|
151
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
142
152
|
subscriber.error(msg.errorMessage);
|
|
143
153
|
}
|
|
144
154
|
else if (msg.isComplete == true) {
|
|
145
155
|
this.runningRequestsObservable.delete(msg.requestId);
|
|
156
|
+
this.runningRequestsParameters.delete(msg.requestId);
|
|
146
157
|
subscriber.complete();
|
|
147
158
|
}
|
|
148
159
|
else {
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class MdsConnection {
|
|
|
18
18
|
private counter;
|
|
19
19
|
private readonly runningRequestsObservable;
|
|
20
20
|
private readonly runningRequestsPromise;
|
|
21
|
+
private readonly runningRequestsParameters;
|
|
21
22
|
private readonly authdataCallback;
|
|
22
23
|
constructor(websocketUrl: string, authdataCallback: () => Promise<MdsAuthdata>, options?: Options);
|
|
23
24
|
heartbeat(): Observable<String>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,UAAU,EAAqB,MAAM,MAAM,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,4BAA4B,EAAC,MAAM,wBAAwB,CAAC;AAE/E,qBAAa,WAAW;IAEb,KAAK,EAAE,MAAM,CAAC;gBAET,KAAK,EAAE,MAAM;CAI5B;AAED,qBAAa,iBAAiB;IAEnB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAG,GAAG,C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