wapi-client 0.8.4 → 0.8.13
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/api/base-client.browser.cjs +3 -1
- package/dist/api/base-client.browser.js +3 -1
- package/dist/api/base-client.cjs +3 -1
- package/dist/api/base-client.d.ts +2 -1
- package/dist/api/base-client.js +3 -1
- package/dist/api/http-client.browser.cjs +11 -6
- package/dist/api/http-client.browser.js +11 -6
- package/dist/api/http-client.cjs +11 -6
- package/dist/api/http-client.js +11 -6
- package/dist/api/ws-client.browser.cjs +4 -3
- package/dist/api/ws-client.browser.js +4 -3
- package/dist/api/ws-client.cjs +5 -4
- package/dist/api/ws-client.js +5 -4
- package/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/lib/debug.browser.cjs +5 -1
- package/dist/lib/debug.browser.js +5 -1
- package/dist/lib/debug.cjs +5 -1
- package/dist/lib/debug.js +5 -1
- package/dist/lib/isomorphic/web/streams.browser.cjs +3 -0
- package/dist/lib/isomorphic/web/streams.browser.js +3 -0
- package/dist/lib/stream-promise.browser.cjs +11 -1
- package/dist/lib/stream-promise.browser.js +11 -1
- package/dist/lib/stream-promise.cjs +11 -1
- package/dist/lib/stream-promise.js +11 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/wapi-client-web.iife.js +4 -4
- package/dist/wapi-client.iife.js +4 -4
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
22
22
|
import { ERROR_TYPES, getError, StreamError } from "./errors.browser.js";
|
|
23
23
|
import { JSONRPC } from "../api/jsonrpc/jsonrpc.enums.browser.js";
|
|
24
24
|
import { ReadStream } from "./isomorphic/web/streams.browser.js";
|
|
25
|
+
import { debugLog } from "./debug.browser.js";
|
|
25
26
|
var StreamPromise = class {
|
|
26
27
|
constructor(makeRequest) {
|
|
27
28
|
this.streamObject = new ReadStream({
|
|
@@ -34,6 +35,7 @@ var StreamPromise = class {
|
|
|
34
35
|
this.makeRequest = makeRequest;
|
|
35
36
|
}
|
|
36
37
|
start(asMode) {
|
|
38
|
+
debugLog("start request as", asMode);
|
|
37
39
|
if (this.mode && this.mode !== asMode) {
|
|
38
40
|
throw new Error("Already in use as " + this.mode);
|
|
39
41
|
}
|
|
@@ -57,6 +59,7 @@ var StreamPromise = class {
|
|
|
57
59
|
this.streamObject.on(
|
|
58
60
|
"data",
|
|
59
61
|
(chunk) => {
|
|
62
|
+
debugLog("stream data", chunk);
|
|
60
63
|
if (!chunk) {
|
|
61
64
|
this.outStreamObject.push(chunk);
|
|
62
65
|
}
|
|
@@ -82,6 +85,7 @@ var StreamPromise = class {
|
|
|
82
85
|
this.outStreamObject.push(chunk);
|
|
83
86
|
}
|
|
84
87
|
).on("end", () => {
|
|
88
|
+
debugLog("stream ended");
|
|
85
89
|
const lastMessage = internalArr.pop();
|
|
86
90
|
if (!lastMessage) {
|
|
87
91
|
return;
|
|
@@ -103,6 +107,7 @@ var StreamPromise = class {
|
|
|
103
107
|
this.outStreamObject.push(lastMessage);
|
|
104
108
|
this.outStreamObject.push(null);
|
|
105
109
|
}).on("error", (err) => {
|
|
110
|
+
debugLog("stream error", err);
|
|
106
111
|
this.outStreamObject.destroy(err);
|
|
107
112
|
});
|
|
108
113
|
return;
|
|
@@ -113,6 +118,7 @@ var StreamPromise = class {
|
|
|
113
118
|
"data",
|
|
114
119
|
(chunk) => {
|
|
115
120
|
var _a;
|
|
121
|
+
debugLog("streamPromise data", chunk);
|
|
116
122
|
if (chunk === void 0) {
|
|
117
123
|
return;
|
|
118
124
|
}
|
|
@@ -133,6 +139,7 @@ var StreamPromise = class {
|
|
|
133
139
|
internalMap.set(chunk.prop, arr);
|
|
134
140
|
}
|
|
135
141
|
).on("end", () => {
|
|
142
|
+
debugLog("streamPromise end");
|
|
136
143
|
const lastMessage = internalArr.pop();
|
|
137
144
|
if (!lastMessage) {
|
|
138
145
|
return;
|
|
@@ -166,7 +173,10 @@ var StreamPromise = class {
|
|
|
166
173
|
result
|
|
167
174
|
);
|
|
168
175
|
}
|
|
169
|
-
}).on("error",
|
|
176
|
+
}).on("error", (reason) => {
|
|
177
|
+
debugLog("streamPromise error", reason);
|
|
178
|
+
return this.reject(reason);
|
|
179
|
+
});
|
|
170
180
|
}
|
|
171
181
|
}
|
|
172
182
|
then(onfulfilled, onrejected) {
|
|
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(stream_promise_exports);
|
|
|
42
42
|
var import_errors = require('./errors.cjs');
|
|
43
43
|
var import_jsonrpc = require('../api/jsonrpc/jsonrpc.enums.cjs');
|
|
44
44
|
var import_streams = require('./isomorphic/node/streams.cjs');
|
|
45
|
+
var import_debug = require('./debug.cjs');
|
|
45
46
|
var StreamPromise = class {
|
|
46
47
|
constructor(makeRequest) {
|
|
47
48
|
this.streamObject = new import_streams.ReadStream({
|
|
@@ -54,6 +55,7 @@ var StreamPromise = class {
|
|
|
54
55
|
this.makeRequest = makeRequest;
|
|
55
56
|
}
|
|
56
57
|
start(asMode) {
|
|
58
|
+
(0, import_debug.debugLog)("start request as", asMode);
|
|
57
59
|
if (this.mode && this.mode !== asMode) {
|
|
58
60
|
throw new Error("Already in use as " + this.mode);
|
|
59
61
|
}
|
|
@@ -77,6 +79,7 @@ var StreamPromise = class {
|
|
|
77
79
|
this.streamObject.on(
|
|
78
80
|
"data",
|
|
79
81
|
(chunk) => {
|
|
82
|
+
(0, import_debug.debugLog)("stream data", chunk);
|
|
80
83
|
if (!chunk) {
|
|
81
84
|
this.outStreamObject.push(chunk);
|
|
82
85
|
}
|
|
@@ -102,6 +105,7 @@ var StreamPromise = class {
|
|
|
102
105
|
this.outStreamObject.push(chunk);
|
|
103
106
|
}
|
|
104
107
|
).on("end", () => {
|
|
108
|
+
(0, import_debug.debugLog)("stream ended");
|
|
105
109
|
const lastMessage = internalArr.pop();
|
|
106
110
|
if (!lastMessage) {
|
|
107
111
|
return;
|
|
@@ -123,6 +127,7 @@ var StreamPromise = class {
|
|
|
123
127
|
this.outStreamObject.push(lastMessage);
|
|
124
128
|
this.outStreamObject.push(null);
|
|
125
129
|
}).on("error", (err) => {
|
|
130
|
+
(0, import_debug.debugLog)("stream error", err);
|
|
126
131
|
this.outStreamObject.destroy(err);
|
|
127
132
|
});
|
|
128
133
|
return;
|
|
@@ -133,6 +138,7 @@ var StreamPromise = class {
|
|
|
133
138
|
"data",
|
|
134
139
|
(chunk) => {
|
|
135
140
|
var _a;
|
|
141
|
+
(0, import_debug.debugLog)("streamPromise data", chunk);
|
|
136
142
|
if (chunk === void 0) {
|
|
137
143
|
return;
|
|
138
144
|
}
|
|
@@ -153,6 +159,7 @@ var StreamPromise = class {
|
|
|
153
159
|
internalMap.set(chunk.prop, arr);
|
|
154
160
|
}
|
|
155
161
|
).on("end", () => {
|
|
162
|
+
(0, import_debug.debugLog)("streamPromise end");
|
|
156
163
|
const lastMessage = internalArr.pop();
|
|
157
164
|
if (!lastMessage) {
|
|
158
165
|
return;
|
|
@@ -186,7 +193,10 @@ var StreamPromise = class {
|
|
|
186
193
|
result
|
|
187
194
|
);
|
|
188
195
|
}
|
|
189
|
-
}).on("error",
|
|
196
|
+
}).on("error", (reason) => {
|
|
197
|
+
(0, import_debug.debugLog)("streamPromise error", reason);
|
|
198
|
+
return this.reject(reason);
|
|
199
|
+
});
|
|
190
200
|
}
|
|
191
201
|
}
|
|
192
202
|
then(onfulfilled, onrejected) {
|
|
@@ -22,6 +22,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
22
22
|
import { ERROR_TYPES, getError, StreamError } from "./errors";
|
|
23
23
|
import { JSONRPC } from "../api/jsonrpc/jsonrpc.enums";
|
|
24
24
|
import { ReadStream } from "./isomorphic/node/streams";
|
|
25
|
+
import { debugLog } from "./debug";
|
|
25
26
|
var StreamPromise = class {
|
|
26
27
|
constructor(makeRequest) {
|
|
27
28
|
this.streamObject = new ReadStream({
|
|
@@ -34,6 +35,7 @@ var StreamPromise = class {
|
|
|
34
35
|
this.makeRequest = makeRequest;
|
|
35
36
|
}
|
|
36
37
|
start(asMode) {
|
|
38
|
+
debugLog("start request as", asMode);
|
|
37
39
|
if (this.mode && this.mode !== asMode) {
|
|
38
40
|
throw new Error("Already in use as " + this.mode);
|
|
39
41
|
}
|
|
@@ -57,6 +59,7 @@ var StreamPromise = class {
|
|
|
57
59
|
this.streamObject.on(
|
|
58
60
|
"data",
|
|
59
61
|
(chunk) => {
|
|
62
|
+
debugLog("stream data", chunk);
|
|
60
63
|
if (!chunk) {
|
|
61
64
|
this.outStreamObject.push(chunk);
|
|
62
65
|
}
|
|
@@ -82,6 +85,7 @@ var StreamPromise = class {
|
|
|
82
85
|
this.outStreamObject.push(chunk);
|
|
83
86
|
}
|
|
84
87
|
).on("end", () => {
|
|
88
|
+
debugLog("stream ended");
|
|
85
89
|
const lastMessage = internalArr.pop();
|
|
86
90
|
if (!lastMessage) {
|
|
87
91
|
return;
|
|
@@ -103,6 +107,7 @@ var StreamPromise = class {
|
|
|
103
107
|
this.outStreamObject.push(lastMessage);
|
|
104
108
|
this.outStreamObject.push(null);
|
|
105
109
|
}).on("error", (err) => {
|
|
110
|
+
debugLog("stream error", err);
|
|
106
111
|
this.outStreamObject.destroy(err);
|
|
107
112
|
});
|
|
108
113
|
return;
|
|
@@ -113,6 +118,7 @@ var StreamPromise = class {
|
|
|
113
118
|
"data",
|
|
114
119
|
(chunk) => {
|
|
115
120
|
var _a;
|
|
121
|
+
debugLog("streamPromise data", chunk);
|
|
116
122
|
if (chunk === void 0) {
|
|
117
123
|
return;
|
|
118
124
|
}
|
|
@@ -133,6 +139,7 @@ var StreamPromise = class {
|
|
|
133
139
|
internalMap.set(chunk.prop, arr);
|
|
134
140
|
}
|
|
135
141
|
).on("end", () => {
|
|
142
|
+
debugLog("streamPromise end");
|
|
136
143
|
const lastMessage = internalArr.pop();
|
|
137
144
|
if (!lastMessage) {
|
|
138
145
|
return;
|
|
@@ -166,7 +173,10 @@ var StreamPromise = class {
|
|
|
166
173
|
result
|
|
167
174
|
);
|
|
168
175
|
}
|
|
169
|
-
}).on("error",
|
|
176
|
+
}).on("error", (reason) => {
|
|
177
|
+
debugLog("streamPromise error", reason);
|
|
178
|
+
return this.reject(reason);
|
|
179
|
+
});
|
|
170
180
|
}
|
|
171
181
|
}
|
|
172
182
|
then(onfulfilled, onrejected) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9730,7 +9730,8 @@ declare module 'wapi-client/api/base-client' {
|
|
|
9730
9730
|
_connection: WebSocket | HttpConnectionClient;
|
|
9731
9731
|
$connect: Promise<ISocketId> | Promise<undefined> | undefined;
|
|
9732
9732
|
connectionType: WapiClientType;
|
|
9733
|
-
|
|
9733
|
+
host: string;
|
|
9734
|
+
protected jwt: string;
|
|
9734
9735
|
isConnected: boolean;
|
|
9735
9736
|
socId: undefined | string;
|
|
9736
9737
|
hooks: ClientHooks;
|