wapi-client 0.15.8 → 0.16.0-beta.1
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 +62 -41
- package/dist/api/base-client.browser.js +62 -41
- package/dist/api/base-client.cjs +62 -41
- package/dist/api/base-client.js +62 -41
- package/dist/api/http-client.browser.cjs +13 -13
- package/dist/api/http-client.browser.js +14 -14
- package/dist/api/http-client.cjs +13 -13
- package/dist/api/http-client.js +14 -14
- package/dist/api/ws-client.browser.cjs +2 -2
- package/dist/api/ws-client.browser.js +2 -2
- package/dist/api/ws-client.cjs +2 -2
- package/dist/api/ws-client.js +2 -2
- package/dist/client-options.schema.zod.browser.cjs +12 -17
- package/dist/client-options.schema.zod.browser.js +12 -17
- package/dist/client-options.schema.zod.cjs +15 -21
- package/dist/client-options.schema.zod.js +12 -17
- package/dist/client.browser.cjs +19 -5
- package/dist/client.browser.js +19 -5
- package/dist/client.cjs +19 -5
- package/dist/client.js +19 -5
- package/dist/lib/env.browser.cjs +1 -1
- package/dist/lib/env.browser.js +1 -1
- package/dist/lib/env.cjs +1 -1
- package/dist/lib/env.js +1 -1
- package/dist/lib/errors.browser.cjs +5 -0
- package/dist/lib/errors.browser.js +5 -0
- package/dist/lib/errors.cjs +5 -0
- package/dist/lib/errors.js +5 -0
- package/dist/lib/utils.browser.cjs +10 -4
- package/dist/lib/utils.browser.js +10 -4
- package/dist/lib/utils.cjs +11 -4
- package/dist/lib/utils.js +10 -4
- package/dist/types/wapi-client.d.ts +79 -52
- package/dist/wapi-client-web.iife.js +7 -7
- package/dist/wapi-client.browser.cjs +4 -6
- package/dist/wapi-client.browser.js +5 -10
- package/dist/wapi-client.cjs +4 -6
- package/dist/wapi-client.iife.js +7 -7
- package/dist/wapi-client.js +5 -10
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -123,7 +123,7 @@ var Client = class {
|
|
|
123
123
|
this.api = _apiClient;
|
|
124
124
|
this.$connect = _apiClient.$connect;
|
|
125
125
|
if (initialConf) {
|
|
126
|
-
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
126
|
+
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
127
127
|
sendingTimeout: initialConf.sendingTimeout
|
|
128
128
|
}), initialConf.connectingTimeout && {
|
|
129
129
|
connectingTimeout: initialConf.connectingTimeout
|
|
@@ -133,6 +133,8 @@ var Client = class {
|
|
|
133
133
|
connectionName: initialConf.connectionName
|
|
134
134
|
}), initialConf.httpSkipInitialAuthConnection && {
|
|
135
135
|
httpSkipInitialAuthConnection: initialConf.httpSkipInitialAuthConnection
|
|
136
|
+
}), initialConf.requestTimeout && {
|
|
137
|
+
requestTimeout: initialConf.requestTimeout
|
|
136
138
|
}));
|
|
137
139
|
}
|
|
138
140
|
}
|
|
@@ -190,7 +192,10 @@ var Client = class {
|
|
|
190
192
|
*
|
|
191
193
|
* wapiClient.configure({
|
|
192
194
|
* token: 'EURO',
|
|
193
|
-
*
|
|
195
|
+
* connectingTimeout: 45000,
|
|
196
|
+
* reconnectingTimeout: 45000,
|
|
197
|
+
* sendingTimeout: 10000,
|
|
198
|
+
* requestTimeout: 120000,
|
|
194
199
|
* hooks: {
|
|
195
200
|
* disconnect: () => {}
|
|
196
201
|
* },
|
|
@@ -206,7 +211,12 @@ var Client = class {
|
|
|
206
211
|
error: `Must be a string|number, '${newConf.token}' provided`
|
|
207
212
|
});
|
|
208
213
|
}
|
|
209
|
-
[
|
|
214
|
+
[
|
|
215
|
+
"sendingTimeout",
|
|
216
|
+
"connectingTimeout",
|
|
217
|
+
"reconnectingTimeout",
|
|
218
|
+
"requestTimeout"
|
|
219
|
+
].forEach((t) => {
|
|
210
220
|
if (newConf[t] && typeof newConf[t] !== "number") {
|
|
211
221
|
throw new import_errors.ConfigError("CONFIG_INVALID", {
|
|
212
222
|
field: t,
|
|
@@ -217,9 +227,12 @@ var Client = class {
|
|
|
217
227
|
const hooks = newConf.hooks;
|
|
218
228
|
delete newConf.hooks;
|
|
219
229
|
this.config = __spreadValues(__spreadValues({}, this.config), newConf);
|
|
220
|
-
if (this.config
|
|
230
|
+
if ("sendingTimeout" in this.config) {
|
|
221
231
|
this.api.sendingTimeout = this.config.sendingTimeout;
|
|
222
232
|
}
|
|
233
|
+
if ("requestTimeout" in this.config) {
|
|
234
|
+
this.api.requestTimeout = this.config.requestTimeout;
|
|
235
|
+
}
|
|
223
236
|
if (hooks) {
|
|
224
237
|
for (const [hookName, value] of Object.entries(hooks)) {
|
|
225
238
|
this.setHook(hookName, value);
|
|
@@ -2182,7 +2195,8 @@ var Client = class {
|
|
|
2182
2195
|
function createClientWithWS(opts, config) {
|
|
2183
2196
|
const wsClient = (0, import_api.createWsClient)(opts, {
|
|
2184
2197
|
connectingTimeout: config == null ? void 0 : config.connectingTimeout,
|
|
2185
|
-
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout
|
|
2198
|
+
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout,
|
|
2199
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
2186
2200
|
});
|
|
2187
2201
|
return new Client(wsClient, config);
|
|
2188
2202
|
}
|
package/dist/client.js
CHANGED
|
@@ -103,7 +103,7 @@ var Client = class {
|
|
|
103
103
|
this.api = _apiClient;
|
|
104
104
|
this.$connect = _apiClient.$connect;
|
|
105
105
|
if (initialConf) {
|
|
106
|
-
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
106
|
+
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
107
107
|
sendingTimeout: initialConf.sendingTimeout
|
|
108
108
|
}), initialConf.connectingTimeout && {
|
|
109
109
|
connectingTimeout: initialConf.connectingTimeout
|
|
@@ -113,6 +113,8 @@ var Client = class {
|
|
|
113
113
|
connectionName: initialConf.connectionName
|
|
114
114
|
}), initialConf.httpSkipInitialAuthConnection && {
|
|
115
115
|
httpSkipInitialAuthConnection: initialConf.httpSkipInitialAuthConnection
|
|
116
|
+
}), initialConf.requestTimeout && {
|
|
117
|
+
requestTimeout: initialConf.requestTimeout
|
|
116
118
|
}));
|
|
117
119
|
}
|
|
118
120
|
}
|
|
@@ -170,7 +172,10 @@ var Client = class {
|
|
|
170
172
|
*
|
|
171
173
|
* wapiClient.configure({
|
|
172
174
|
* token: 'EURO',
|
|
173
|
-
*
|
|
175
|
+
* connectingTimeout: 45000,
|
|
176
|
+
* reconnectingTimeout: 45000,
|
|
177
|
+
* sendingTimeout: 10000,
|
|
178
|
+
* requestTimeout: 120000,
|
|
174
179
|
* hooks: {
|
|
175
180
|
* disconnect: () => {}
|
|
176
181
|
* },
|
|
@@ -186,7 +191,12 @@ var Client = class {
|
|
|
186
191
|
error: `Must be a string|number, '${newConf.token}' provided`
|
|
187
192
|
});
|
|
188
193
|
}
|
|
189
|
-
[
|
|
194
|
+
[
|
|
195
|
+
"sendingTimeout",
|
|
196
|
+
"connectingTimeout",
|
|
197
|
+
"reconnectingTimeout",
|
|
198
|
+
"requestTimeout"
|
|
199
|
+
].forEach((t) => {
|
|
190
200
|
if (newConf[t] && typeof newConf[t] !== "number") {
|
|
191
201
|
throw new ConfigError("CONFIG_INVALID", {
|
|
192
202
|
field: t,
|
|
@@ -197,9 +207,12 @@ var Client = class {
|
|
|
197
207
|
const hooks = newConf.hooks;
|
|
198
208
|
delete newConf.hooks;
|
|
199
209
|
this.config = __spreadValues(__spreadValues({}, this.config), newConf);
|
|
200
|
-
if (this.config
|
|
210
|
+
if ("sendingTimeout" in this.config) {
|
|
201
211
|
this.api.sendingTimeout = this.config.sendingTimeout;
|
|
202
212
|
}
|
|
213
|
+
if ("requestTimeout" in this.config) {
|
|
214
|
+
this.api.requestTimeout = this.config.requestTimeout;
|
|
215
|
+
}
|
|
203
216
|
if (hooks) {
|
|
204
217
|
for (const [hookName, value] of Object.entries(hooks)) {
|
|
205
218
|
this.setHook(hookName, value);
|
|
@@ -2162,7 +2175,8 @@ var Client = class {
|
|
|
2162
2175
|
function createClientWithWS(opts, config) {
|
|
2163
2176
|
const wsClient = createWsClient(opts, {
|
|
2164
2177
|
connectingTimeout: config == null ? void 0 : config.connectingTimeout,
|
|
2165
|
-
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout
|
|
2178
|
+
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout,
|
|
2179
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
2166
2180
|
});
|
|
2167
2181
|
return new Client(wsClient, config);
|
|
2168
2182
|
}
|
package/dist/lib/env.browser.cjs
CHANGED
|
@@ -24,7 +24,7 @@ __export(env_exports, {
|
|
|
24
24
|
getEnvConfig: () => getEnvConfig
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(env_exports);
|
|
27
|
-
var CLIENT_VERSION = "0.
|
|
27
|
+
var CLIENT_VERSION = "0.16.0-beta.1";
|
|
28
28
|
function getEnvConfig(key, defaultValue) {
|
|
29
29
|
const val = getVariable(key);
|
|
30
30
|
if (val === void 0) {
|
package/dist/lib/env.browser.js
CHANGED
package/dist/lib/env.cjs
CHANGED
|
@@ -24,7 +24,7 @@ __export(env_exports, {
|
|
|
24
24
|
getEnvConfig: () => getEnvConfig
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(env_exports);
|
|
27
|
-
var CLIENT_VERSION = "0.
|
|
27
|
+
var CLIENT_VERSION = "0.16.0-beta.1";
|
|
28
28
|
function getEnvConfig(key, defaultValue) {
|
|
29
29
|
const val = getVariable(key);
|
|
30
30
|
if (val === void 0) {
|
package/dist/lib/env.js
CHANGED
|
@@ -553,6 +553,11 @@ var ERROR_GROUPS = {
|
|
|
553
553
|
message: "SENDING_TIMEOUT",
|
|
554
554
|
description: "Unable to get ack from server in specified time"
|
|
555
555
|
},
|
|
556
|
+
REQUEST_TIMEOUT: {
|
|
557
|
+
code: -15006,
|
|
558
|
+
message: "REQUEST_TIMEOUT",
|
|
559
|
+
description: "Unable to get a response from server in specified time"
|
|
560
|
+
},
|
|
556
561
|
CONFIG_INVALID: {
|
|
557
562
|
code: -15100,
|
|
558
563
|
message: "CONFIG_INVALID",
|
|
@@ -515,6 +515,11 @@ var ERROR_GROUPS = {
|
|
|
515
515
|
message: "SENDING_TIMEOUT",
|
|
516
516
|
description: "Unable to get ack from server in specified time"
|
|
517
517
|
},
|
|
518
|
+
REQUEST_TIMEOUT: {
|
|
519
|
+
code: -15006,
|
|
520
|
+
message: "REQUEST_TIMEOUT",
|
|
521
|
+
description: "Unable to get a response from server in specified time"
|
|
522
|
+
},
|
|
518
523
|
CONFIG_INVALID: {
|
|
519
524
|
code: -15100,
|
|
520
525
|
message: "CONFIG_INVALID",
|
package/dist/lib/errors.cjs
CHANGED
|
@@ -553,6 +553,11 @@ var ERROR_GROUPS = {
|
|
|
553
553
|
message: "SENDING_TIMEOUT",
|
|
554
554
|
description: "Unable to get ack from server in specified time"
|
|
555
555
|
},
|
|
556
|
+
REQUEST_TIMEOUT: {
|
|
557
|
+
code: -15006,
|
|
558
|
+
message: "REQUEST_TIMEOUT",
|
|
559
|
+
description: "Unable to get a response from server in specified time"
|
|
560
|
+
},
|
|
556
561
|
CONFIG_INVALID: {
|
|
557
562
|
code: -15100,
|
|
558
563
|
message: "CONFIG_INVALID",
|
package/dist/lib/errors.js
CHANGED
|
@@ -515,6 +515,11 @@ var ERROR_GROUPS = {
|
|
|
515
515
|
message: "SENDING_TIMEOUT",
|
|
516
516
|
description: "Unable to get ack from server in specified time"
|
|
517
517
|
},
|
|
518
|
+
REQUEST_TIMEOUT: {
|
|
519
|
+
code: -15006,
|
|
520
|
+
message: "REQUEST_TIMEOUT",
|
|
521
|
+
description: "Unable to get a response from server in specified time"
|
|
522
|
+
},
|
|
518
523
|
CONFIG_INVALID: {
|
|
519
524
|
code: -15100,
|
|
520
525
|
message: "CONFIG_INVALID",
|
|
@@ -50,6 +50,7 @@ __export(utils_exports, {
|
|
|
50
50
|
convertToNumber: () => convertToNumber,
|
|
51
51
|
convertToString: () => convertToString,
|
|
52
52
|
copyObject: () => copyObject,
|
|
53
|
+
getBasicAuth: () => getBasicAuth,
|
|
53
54
|
getConnectionParams: () => getConnectionParams,
|
|
54
55
|
getConnectionUrl: () => getConnectionUrl,
|
|
55
56
|
getIdentifier: () => getIdentifier,
|
|
@@ -212,13 +213,18 @@ function toQueryString(obj) {
|
|
|
212
213
|
}
|
|
213
214
|
function getConnectionUrl(config) {
|
|
214
215
|
const url = config.host.replace(/^https:/, "wss:");
|
|
215
|
-
return url + "?" + toQueryString({
|
|
216
|
-
apikey: config.apikey,
|
|
217
|
-
apisecret: config.apisecret,
|
|
216
|
+
return url + "?" + toQueryString(__spreadValues(__spreadValues({
|
|
218
217
|
db: config.database,
|
|
219
218
|
clientVersion: config.clientVersion,
|
|
220
219
|
connectionName: config.connectionName
|
|
221
|
-
});
|
|
220
|
+
}, "jwt" in config ? { jwt: config.jwt } : {}), "apikey" in config ? { apikey: config.apikey, apisecret: config.apisecret } : {}));
|
|
221
|
+
}
|
|
222
|
+
function getBasicAuth({
|
|
223
|
+
apikey,
|
|
224
|
+
apisecret,
|
|
225
|
+
database
|
|
226
|
+
}) {
|
|
227
|
+
return btoa(`${database != null ? database : ""}:${apikey}:${apisecret}`);
|
|
222
228
|
}
|
|
223
229
|
function getConnectionParams(config) {
|
|
224
230
|
if (typeof window === "undefined") {
|
|
@@ -174,13 +174,18 @@ function toQueryString(obj) {
|
|
|
174
174
|
}
|
|
175
175
|
function getConnectionUrl(config) {
|
|
176
176
|
const url = config.host.replace(/^https:/, "wss:");
|
|
177
|
-
return url + "?" + toQueryString({
|
|
178
|
-
apikey: config.apikey,
|
|
179
|
-
apisecret: config.apisecret,
|
|
177
|
+
return url + "?" + toQueryString(__spreadValues(__spreadValues({
|
|
180
178
|
db: config.database,
|
|
181
179
|
clientVersion: config.clientVersion,
|
|
182
180
|
connectionName: config.connectionName
|
|
183
|
-
});
|
|
181
|
+
}, "jwt" in config ? { jwt: config.jwt } : {}), "apikey" in config ? { apikey: config.apikey, apisecret: config.apisecret } : {}));
|
|
182
|
+
}
|
|
183
|
+
function getBasicAuth({
|
|
184
|
+
apikey,
|
|
185
|
+
apisecret,
|
|
186
|
+
database
|
|
187
|
+
}) {
|
|
188
|
+
return btoa(`${database != null ? database : ""}:${apikey}:${apisecret}`);
|
|
184
189
|
}
|
|
185
190
|
function getConnectionParams(config) {
|
|
186
191
|
if (typeof window === "undefined") {
|
|
@@ -282,6 +287,7 @@ export {
|
|
|
282
287
|
convertToNumber,
|
|
283
288
|
convertToString,
|
|
284
289
|
copyObject,
|
|
290
|
+
getBasicAuth,
|
|
285
291
|
getConnectionParams,
|
|
286
292
|
getConnectionUrl,
|
|
287
293
|
getIdentifier,
|
package/dist/lib/utils.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(utils_exports, {
|
|
|
50
50
|
convertToNumber: () => convertToNumber,
|
|
51
51
|
convertToString: () => convertToString,
|
|
52
52
|
copyObject: () => copyObject,
|
|
53
|
+
getBasicAuth: () => getBasicAuth,
|
|
53
54
|
getConnectionParams: () => getConnectionParams,
|
|
54
55
|
getConnectionUrl: () => getConnectionUrl,
|
|
55
56
|
getIdentifier: () => getIdentifier,
|
|
@@ -211,13 +212,18 @@ function toQueryString(obj) {
|
|
|
211
212
|
}
|
|
212
213
|
function getConnectionUrl(config) {
|
|
213
214
|
const url = config.host.replace(/^https:/, "wss:");
|
|
214
|
-
return url + "?" + toQueryString({
|
|
215
|
-
apikey: config.apikey,
|
|
216
|
-
apisecret: config.apisecret,
|
|
215
|
+
return url + "?" + toQueryString(__spreadValues(__spreadValues({
|
|
217
216
|
db: config.database,
|
|
218
217
|
clientVersion: config.clientVersion,
|
|
219
218
|
connectionName: config.connectionName
|
|
220
|
-
});
|
|
219
|
+
}, "jwt" in config ? { jwt: config.jwt } : {}), "apikey" in config ? { apikey: config.apikey, apisecret: config.apisecret } : {}));
|
|
220
|
+
}
|
|
221
|
+
function getBasicAuth({
|
|
222
|
+
apikey,
|
|
223
|
+
apisecret,
|
|
224
|
+
database
|
|
225
|
+
}) {
|
|
226
|
+
return btoa(`${database != null ? database : ""}:${apikey}:${apisecret}`);
|
|
221
227
|
}
|
|
222
228
|
function getConnectionParams(config) {
|
|
223
229
|
if (typeof window === "undefined") {
|
|
@@ -320,6 +326,7 @@ function isDateTime(str) {
|
|
|
320
326
|
convertToNumber,
|
|
321
327
|
convertToString,
|
|
322
328
|
copyObject,
|
|
329
|
+
getBasicAuth,
|
|
323
330
|
getConnectionParams,
|
|
324
331
|
getConnectionUrl,
|
|
325
332
|
getIdentifier,
|
package/dist/lib/utils.js
CHANGED
|
@@ -173,13 +173,18 @@ function toQueryString(obj) {
|
|
|
173
173
|
}
|
|
174
174
|
function getConnectionUrl(config) {
|
|
175
175
|
const url = config.host.replace(/^https:/, "wss:");
|
|
176
|
-
return url + "?" + toQueryString({
|
|
177
|
-
apikey: config.apikey,
|
|
178
|
-
apisecret: config.apisecret,
|
|
176
|
+
return url + "?" + toQueryString(__spreadValues(__spreadValues({
|
|
179
177
|
db: config.database,
|
|
180
178
|
clientVersion: config.clientVersion,
|
|
181
179
|
connectionName: config.connectionName
|
|
182
|
-
});
|
|
180
|
+
}, "jwt" in config ? { jwt: config.jwt } : {}), "apikey" in config ? { apikey: config.apikey, apisecret: config.apisecret } : {}));
|
|
181
|
+
}
|
|
182
|
+
function getBasicAuth({
|
|
183
|
+
apikey,
|
|
184
|
+
apisecret,
|
|
185
|
+
database
|
|
186
|
+
}) {
|
|
187
|
+
return btoa(`${database != null ? database : ""}:${apikey}:${apisecret}`);
|
|
183
188
|
}
|
|
184
189
|
function getConnectionParams(config) {
|
|
185
190
|
if (typeof window === "undefined") {
|
|
@@ -281,6 +286,7 @@ export {
|
|
|
281
286
|
convertToNumber,
|
|
282
287
|
convertToString,
|
|
283
288
|
copyObject,
|
|
289
|
+
getBasicAuth,
|
|
284
290
|
getConnectionParams,
|
|
285
291
|
getConnectionUrl,
|
|
286
292
|
getIdentifier,
|
|
@@ -224,6 +224,7 @@ declare module "wapi-client/lib/errors" {
|
|
|
224
224
|
TRANSACTION_TIMEOUT: ErrorSpec;
|
|
225
225
|
CONNECTION_TIMEOUT: ErrorSpec;
|
|
226
226
|
SENDING_TIMEOUT: ErrorSpec;
|
|
227
|
+
REQUEST_TIMEOUT: ErrorSpec;
|
|
227
228
|
CONFIG_INVALID: ErrorSpec;
|
|
228
229
|
};
|
|
229
230
|
};
|
|
@@ -322,6 +323,7 @@ declare module "wapi-client/lib/errors" {
|
|
|
322
323
|
TRANSACTION_TIMEOUT: ErrorSpec;
|
|
323
324
|
CONNECTION_TIMEOUT: ErrorSpec;
|
|
324
325
|
SENDING_TIMEOUT: ErrorSpec;
|
|
326
|
+
REQUEST_TIMEOUT: ErrorSpec;
|
|
325
327
|
CONFIG_INVALID: ErrorSpec;
|
|
326
328
|
AUTHENTICATION_ERROR: ErrorSpec;
|
|
327
329
|
AUTHORIZATION_ERROR: ErrorSpec;
|
|
@@ -418,6 +420,7 @@ declare module "wapi-client/lib/errors" {
|
|
|
418
420
|
TRANSACTION_TIMEOUT: "TRANSACTION_TIMEOUT";
|
|
419
421
|
CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT";
|
|
420
422
|
SENDING_TIMEOUT: "SENDING_TIMEOUT";
|
|
423
|
+
REQUEST_TIMEOUT: "REQUEST_TIMEOUT";
|
|
421
424
|
CONFIG_INVALID: "CONFIG_INVALID";
|
|
422
425
|
AUTHENTICATION_ERROR: "AUTHENTICATION_ERROR";
|
|
423
426
|
AUTHORIZATION_ERROR: "AUTHORIZATION_ERROR";
|
|
@@ -1566,6 +1569,11 @@ declare module "wapi-client/lib/utils" {
|
|
|
1566
1569
|
[key: string]: string | undefined;
|
|
1567
1570
|
}): string;
|
|
1568
1571
|
export function getConnectionUrl(config: EWapiConnectionOptions): string;
|
|
1572
|
+
export function getBasicAuth({ apikey, apisecret, database, }: {
|
|
1573
|
+
apikey: string;
|
|
1574
|
+
apisecret: string;
|
|
1575
|
+
database?: string;
|
|
1576
|
+
}): string;
|
|
1569
1577
|
export function getConnectionParams(config: EWapiConnectionOptions): [string, {
|
|
1570
1578
|
rejectUnauthorized: boolean;
|
|
1571
1579
|
}?];
|
|
@@ -1666,18 +1674,18 @@ declare module "wapi-client/lib/stream-promise" {
|
|
|
1666
1674
|
}
|
|
1667
1675
|
}
|
|
1668
1676
|
declare module "wapi-client/api/http-client" {
|
|
1669
|
-
import { ConnectionConfig,
|
|
1677
|
+
import { ConnectionConfig, WapiConnectionOptions } from "wapi-client/api/index";
|
|
1670
1678
|
import { JSONRPCRequest, JSONRPCResponse } from "wapi-client/api/jsonrpc/jsonrpc.enums";
|
|
1671
1679
|
import { BaseClient } from "wapi-client/api/base-client";
|
|
1672
1680
|
export interface HttpConnectionClient {
|
|
1673
|
-
send: (data: string
|
|
1681
|
+
send: (data: string) => void;
|
|
1674
1682
|
onmessage: (response: JSONRPCResponse) => void;
|
|
1675
1683
|
$connect: Promise<undefined>;
|
|
1676
1684
|
}
|
|
1677
|
-
export function createHttpClient(opts:
|
|
1685
|
+
export function createHttpClient(opts: WapiConnectionOptions, config?: ConnectionConfig): HttpClient;
|
|
1678
1686
|
export class HttpClient extends BaseClient {
|
|
1679
1687
|
protected _connection: HttpConnectionClient;
|
|
1680
|
-
constructor(connection: HttpConnectionClient, opts:
|
|
1688
|
+
constructor(connection: HttpConnectionClient, opts: WapiConnectionOptions);
|
|
1681
1689
|
protected _send(input: JSONRPCRequest | JSONRPCResponse): void;
|
|
1682
1690
|
private _ready;
|
|
1683
1691
|
close(): Promise<void>;
|
|
@@ -26075,9 +26083,11 @@ declare module "wapi-client/txs/update-wallet/update-wallet.enums" {
|
|
|
26075
26083
|
export type UpdateWalletTxOutput = z.infer<typeof updateWalletTxOutputSchema>;
|
|
26076
26084
|
}
|
|
26077
26085
|
declare module "wapi-client/api/base-client" {
|
|
26086
|
+
import { WAPIError } from "wapi-client/lib/errors";
|
|
26078
26087
|
import WebSocket from 'modern-isomorphic-ws';
|
|
26079
26088
|
import { StreamPromise } from "wapi-client/lib/stream-promise";
|
|
26080
|
-
import {
|
|
26089
|
+
import { ReadStream } from "wapi-client/lib/streams";
|
|
26090
|
+
import { IJSONRPCError, JSONRPCRequest, JSONRPCResponse } from "wapi-client/api/jsonrpc/jsonrpc.enums";
|
|
26081
26091
|
import { WapiClientType } from "wapi-client";
|
|
26082
26092
|
import { HttpConnectionClient } from "wapi-client/api/http-client";
|
|
26083
26093
|
import { ValuesOf } from "wapi-client/lib/ts-utils";
|
|
@@ -26144,6 +26154,19 @@ declare module "wapi-client/api/base-client" {
|
|
|
26144
26154
|
message?: (msg: JSONRPCResponse) => void;
|
|
26145
26155
|
}
|
|
26146
26156
|
export type ISocketId = string | undefined;
|
|
26157
|
+
type BaseRequest = {
|
|
26158
|
+
stream: ReadStream;
|
|
26159
|
+
start: number;
|
|
26160
|
+
message: JSONRPCRequest;
|
|
26161
|
+
sendingTimeout?: ReturnType<typeof setTimeout>;
|
|
26162
|
+
requestTimeout?: ReturnType<typeof setTimeout>;
|
|
26163
|
+
};
|
|
26164
|
+
type OutboundRequest = BaseRequest | (BaseRequest & {
|
|
26165
|
+
handle?: (result: JSONRPCResponse) => void;
|
|
26166
|
+
error: (err: IJSONRPCError) => void;
|
|
26167
|
+
pause: () => void;
|
|
26168
|
+
resume: () => void;
|
|
26169
|
+
});
|
|
26147
26170
|
export class BaseClient {
|
|
26148
26171
|
type: ValuesOf<typeof WapiClientType>;
|
|
26149
26172
|
protected _connection: WebSocket | HttpConnectionClient;
|
|
@@ -26160,6 +26183,7 @@ declare module "wapi-client/api/base-client" {
|
|
|
26160
26183
|
timeout?: ReturnType<typeof setTimeout>;
|
|
26161
26184
|
}>;
|
|
26162
26185
|
sendingTimeout: number | undefined;
|
|
26186
|
+
requestTimeout: number | undefined;
|
|
26163
26187
|
constructor(connection: WebSocket | HttpConnectionClient, connectionType: ValuesOf<typeof WapiClientType>, $connect?: Promise<ISocketId>);
|
|
26164
26188
|
protected _setConnected(value: boolean): void;
|
|
26165
26189
|
protected _setErrored(err: Error): void;
|
|
@@ -26168,8 +26192,11 @@ declare module "wapi-client/api/base-client" {
|
|
|
26168
26192
|
protected _reconnect(nrOfAttempts?: number | undefined): void;
|
|
26169
26193
|
close(): Promise<void>;
|
|
26170
26194
|
protected _connectionLost(): void;
|
|
26195
|
+
protected _completeRequest(request: OutboundRequest, error?: WAPIError): void;
|
|
26196
|
+
protected _fireConnectionLost(requestInfo: OutboundRequest): void;
|
|
26197
|
+
protected _fireSendingTimeout(requestInfo: OutboundRequest): void;
|
|
26198
|
+
protected _fireRequestTimeout(requestInfo: OutboundRequest): void;
|
|
26171
26199
|
protected _handleMessage(incoming: JSONRPCResponse | JSONRPCRequest): void;
|
|
26172
|
-
private _setSending;
|
|
26173
26200
|
_sendRaw<Input, Output>(method: string, params: Input): StreamPromise<Output>;
|
|
26174
26201
|
/**
|
|
26175
26202
|
*
|
|
@@ -26571,11 +26598,11 @@ declare module "wapi-client/api/ws-client" {
|
|
|
26571
26598
|
ws: WebSocket;
|
|
26572
26599
|
$connect: Promise<ISocketId>;
|
|
26573
26600
|
}
|
|
26574
|
-
export
|
|
26601
|
+
export type EWapiConnectionOptions = WapiConnectionOptions & {
|
|
26575
26602
|
rejectUnauthorized: boolean;
|
|
26576
26603
|
clientVersion: string;
|
|
26577
26604
|
connectionName?: string;
|
|
26578
|
-
}
|
|
26605
|
+
};
|
|
26579
26606
|
export class WsClient extends BaseClient {
|
|
26580
26607
|
private _pingTimeout;
|
|
26581
26608
|
private _opts;
|
|
@@ -26597,16 +26624,19 @@ declare module "wapi-client/api/index" {
|
|
|
26597
26624
|
import { BaseClient } from "wapi-client/api/base-client";
|
|
26598
26625
|
import { WsClient } from "wapi-client/api/ws-client";
|
|
26599
26626
|
import { HttpClient } from "wapi-client/api/http-client";
|
|
26600
|
-
export
|
|
26601
|
-
|
|
26602
|
-
database?: string;
|
|
26627
|
+
export type WapiConnectionOptions = WapiCredsConnectionOptions | WapiJWTConnectionOptions;
|
|
26628
|
+
export interface WapiCredsConnectionOptions {
|
|
26603
26629
|
apikey: string;
|
|
26604
26630
|
apisecret: string;
|
|
26631
|
+
host: string;
|
|
26632
|
+
database?: string;
|
|
26605
26633
|
rejectUnauthorized?: boolean;
|
|
26606
26634
|
}
|
|
26607
|
-
export interface
|
|
26608
|
-
host: string;
|
|
26635
|
+
export interface WapiJWTConnectionOptions {
|
|
26609
26636
|
jwt: string;
|
|
26637
|
+
host: string;
|
|
26638
|
+
database?: string;
|
|
26639
|
+
rejectUnauthorized?: boolean;
|
|
26610
26640
|
}
|
|
26611
26641
|
export interface ConnectionConfig {
|
|
26612
26642
|
connectingTimeout?: number;
|
|
@@ -31774,7 +31804,7 @@ declare module "wapi-client/fns/update-wallet/update-wallet" {
|
|
|
31774
31804
|
export function updateWallet(options: ClientFunctionOptions, input: UpdateWalletFnInput, fnOptions?: UpdateWalletFnOptions): StreamPromise<UpdateWalletFnOutput>;
|
|
31775
31805
|
}
|
|
31776
31806
|
declare module "client.js" {
|
|
31777
|
-
import { WapiConnectionOptions,
|
|
31807
|
+
import { WapiConnectionOptions, WsClient, HttpClient, ConnectionConfig } from "wapi-client/api/index";
|
|
31778
31808
|
import { ClientHooks, ISocketId } from "wapi-client/api/base-client";
|
|
31779
31809
|
import { StreamPromise } from "wapi-client/lib/stream-promise";
|
|
31780
31810
|
import { AggregateTransfersFnInput, AggregateTransfersFnOptions } from "wapi-client/fns/aggregate-transfers/aggregate-transfers.enums";
|
|
@@ -31824,6 +31854,7 @@ declare module "client.js" {
|
|
|
31824
31854
|
token?: number | string;
|
|
31825
31855
|
hooks?: ClientHooks;
|
|
31826
31856
|
sendingTimeout?: number;
|
|
31857
|
+
requestTimeout?: number;
|
|
31827
31858
|
}
|
|
31828
31859
|
export class Client {
|
|
31829
31860
|
/**
|
|
@@ -31881,7 +31912,10 @@ declare module "client.js" {
|
|
|
31881
31912
|
*
|
|
31882
31913
|
* wapiClient.configure({
|
|
31883
31914
|
* token: 'EURO',
|
|
31884
|
-
*
|
|
31915
|
+
* connectingTimeout: 45000,
|
|
31916
|
+
* reconnectingTimeout: 45000,
|
|
31917
|
+
* sendingTimeout: 10000,
|
|
31918
|
+
* requestTimeout: 120000,
|
|
31885
31919
|
* hooks: {
|
|
31886
31920
|
* disconnect: () => {}
|
|
31887
31921
|
* },
|
|
@@ -31900,7 +31934,8 @@ declare module "client.js" {
|
|
|
31900
31934
|
* ```
|
|
31901
31935
|
*/
|
|
31902
31936
|
getConfig(key: 'httpSkipInitialAuthConnection'): boolean | undefined;
|
|
31903
|
-
getConfig(key:
|
|
31937
|
+
getConfig(key: 'connectingTimeout' | 'reconnectingTimeout' | 'sendingTimeout' | 'requestTimeout'): number | undefined;
|
|
31938
|
+
getConfig(key: 'token'): number | string | undefined;
|
|
31904
31939
|
/**
|
|
31905
31940
|
*
|
|
31906
31941
|
* Aggregate Transfers using either a simple filter or queryBuilder
|
|
@@ -36610,7 +36645,7 @@ declare module "client.js" {
|
|
|
36610
36645
|
updateWallet(input: UpdateWalletFnInput, options?: UpdateWalletFnOptions): StreamPromise<UpdateWalletFnOutput>;
|
|
36611
36646
|
}
|
|
36612
36647
|
export function createClientWithWS(opts: WapiConnectionOptions, config?: ClientConfig): Client;
|
|
36613
|
-
export function createClientWithHttp(opts:
|
|
36648
|
+
export function createClientWithHttp(opts: WapiConnectionOptions, config?: ClientConfig): Client;
|
|
36614
36649
|
}
|
|
36615
36650
|
declare module "client-options.schema.zod.js" {
|
|
36616
36651
|
import { z } from "wapi-client/lib/zod";
|
|
@@ -36618,44 +36653,37 @@ declare module "client-options.schema.zod.js" {
|
|
|
36618
36653
|
ws: "ws";
|
|
36619
36654
|
https: "https";
|
|
36620
36655
|
}>;
|
|
36621
|
-
export const
|
|
36656
|
+
export const credsConnectionSchema: z.ZodObject<{
|
|
36622
36657
|
host: z.ZodString;
|
|
36623
36658
|
apikey: z.ZodString;
|
|
36624
36659
|
apisecret: z.ZodString;
|
|
36625
36660
|
}, z.core.$loose>;
|
|
36626
|
-
export const
|
|
36627
|
-
client: z.ZodLiteral<"ws">;
|
|
36628
|
-
connection: z.ZodObject<{
|
|
36629
|
-
host: z.ZodString;
|
|
36630
|
-
apikey: z.ZodString;
|
|
36631
|
-
apisecret: z.ZodString;
|
|
36632
|
-
}, z.core.$loose>;
|
|
36633
|
-
}, z.core.$strip>;
|
|
36634
|
-
export const httpsConnectionSchema: z.ZodObject<{
|
|
36661
|
+
export const jwtConnectionSchema: z.ZodObject<{
|
|
36635
36662
|
host: z.ZodString;
|
|
36636
36663
|
jwt: z.ZodString;
|
|
36637
36664
|
}, z.core.$loose>;
|
|
36638
|
-
export const
|
|
36639
|
-
|
|
36640
|
-
|
|
36665
|
+
export const connectionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
36666
|
+
host: z.ZodString;
|
|
36667
|
+
jwt: z.ZodString;
|
|
36668
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
36669
|
+
host: z.ZodString;
|
|
36670
|
+
apikey: z.ZodString;
|
|
36671
|
+
apisecret: z.ZodString;
|
|
36672
|
+
}, z.core.$loose>]>;
|
|
36673
|
+
export const clientOptionsSchema: z.ZodObject<{
|
|
36674
|
+
client: z.ZodEnum<{
|
|
36675
|
+
ws: "ws";
|
|
36676
|
+
https: "https";
|
|
36677
|
+
}>;
|
|
36678
|
+
connection: z.ZodUnion<readonly [z.ZodObject<{
|
|
36641
36679
|
host: z.ZodString;
|
|
36642
36680
|
jwt: z.ZodString;
|
|
36643
|
-
}, z.core.$loose
|
|
36644
|
-
}, z.core.$strip>;
|
|
36645
|
-
export const clientOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36646
|
-
client: z.ZodLiteral<"ws">;
|
|
36647
|
-
connection: z.ZodObject<{
|
|
36681
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
36648
36682
|
host: z.ZodString;
|
|
36649
36683
|
apikey: z.ZodString;
|
|
36650
36684
|
apisecret: z.ZodString;
|
|
36651
|
-
}, z.core.$loose>;
|
|
36652
|
-
}, z.core.$strip
|
|
36653
|
-
client: z.ZodLiteral<"https">;
|
|
36654
|
-
connection: z.ZodObject<{
|
|
36655
|
-
host: z.ZodString;
|
|
36656
|
-
jwt: z.ZodString;
|
|
36657
|
-
}, z.core.$loose>;
|
|
36658
|
-
}, z.core.$strip>], "client">;
|
|
36685
|
+
}, z.core.$loose>]>;
|
|
36686
|
+
}, z.core.$strip>;
|
|
36659
36687
|
}
|
|
36660
36688
|
declare module "wapi-client/lib/polyfill" {
|
|
36661
36689
|
export function initPolyfills(): void;
|
|
@@ -36886,7 +36914,7 @@ declare module "wapi-client/fns/fn-types" {
|
|
|
36886
36914
|
export * from "wapi-client/fns/update-wallet/update-wallet.enums";
|
|
36887
36915
|
}
|
|
36888
36916
|
declare module "wapi-client" {
|
|
36889
|
-
import { WapiConnectionOptions
|
|
36917
|
+
import { WapiConnectionOptions } from "wapi-client/api/index";
|
|
36890
36918
|
import { Client, ClientConfig } from "client.js";
|
|
36891
36919
|
import { ERROR_MESSAGES as ErrorMessage, ERROR_TYPES as ErrorType, ERROR_DESCRIPTIONS as ErrorDescription, ERRORS as Errors } from "wapi-client/lib/errors";
|
|
36892
36920
|
import { getIdentifier } from "wapi-client/lib/utils";
|
|
@@ -36895,17 +36923,11 @@ declare module "wapi-client" {
|
|
|
36895
36923
|
readonly ws: "ws";
|
|
36896
36924
|
readonly https: "https";
|
|
36897
36925
|
};
|
|
36898
|
-
export interface
|
|
36899
|
-
client?: 'ws';
|
|
36926
|
+
export interface WapiClientOptions {
|
|
36927
|
+
client?: 'ws' | 'https';
|
|
36900
36928
|
connection: WapiConnectionOptions;
|
|
36901
36929
|
config?: ClientConfig;
|
|
36902
36930
|
}
|
|
36903
|
-
export interface WapiClientHttpOptions {
|
|
36904
|
-
client: 'https';
|
|
36905
|
-
connection: WapiHttpConnectionOptions;
|
|
36906
|
-
config?: ClientConfig;
|
|
36907
|
-
}
|
|
36908
|
-
export type WapiClientOptions = WapiClientWsOptions | WapiClientHttpOptions;
|
|
36909
36931
|
/**
|
|
36910
36932
|
*
|
|
36911
36933
|
* Create a WAPI Client
|
|
@@ -36962,6 +36984,9 @@ declare module "wapi-client" {
|
|
|
36962
36984
|
* // NB! erroring on this timeout does not mean the command is not executed
|
|
36963
36985
|
* // as the command might have gotten through, but return ACK did not
|
|
36964
36986
|
* sendingTimeout: 60000;
|
|
36987
|
+
* // how long to wait for a request to finish
|
|
36988
|
+
* // NB! erroring on this timeout does not mean the command is not executed
|
|
36989
|
+
* requestTimeout: 120000;
|
|
36965
36990
|
* }
|
|
36966
36991
|
* });
|
|
36967
36992
|
* // this direct wait for connect is not required
|
|
@@ -37077,6 +37102,7 @@ declare module "wapi-client" {
|
|
|
37077
37102
|
TRANSACTION_TIMEOUT: "TRANSACTION_TIMEOUT";
|
|
37078
37103
|
CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT";
|
|
37079
37104
|
SENDING_TIMEOUT: "SENDING_TIMEOUT";
|
|
37105
|
+
REQUEST_TIMEOUT: "REQUEST_TIMEOUT";
|
|
37080
37106
|
CONFIG_INVALID: "CONFIG_INVALID";
|
|
37081
37107
|
AUTHENTICATION_ERROR: "AUTHENTICATION_ERROR";
|
|
37082
37108
|
AUTHORIZATION_ERROR: "AUTHORIZATION_ERROR";
|
|
@@ -37180,6 +37206,7 @@ declare module "wapi-client" {
|
|
|
37180
37206
|
TRANSACTION_TIMEOUT: import("wapi-client/lib/errors").ErrorSpec;
|
|
37181
37207
|
CONNECTION_TIMEOUT: import("wapi-client/lib/errors").ErrorSpec;
|
|
37182
37208
|
SENDING_TIMEOUT: import("wapi-client/lib/errors").ErrorSpec;
|
|
37209
|
+
REQUEST_TIMEOUT: import("wapi-client/lib/errors").ErrorSpec;
|
|
37183
37210
|
CONFIG_INVALID: import("wapi-client/lib/errors").ErrorSpec;
|
|
37184
37211
|
AUTHENTICATION_ERROR: import("wapi-client/lib/errors").ErrorSpec;
|
|
37185
37212
|
AUTHORIZATION_ERROR: import("wapi-client/lib/errors").ErrorSpec;
|