wapi-client 0.10.11 → 0.10.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 +1 -0
- package/dist/api/base-client.browser.js +1 -0
- package/dist/api/base-client.cjs +1 -0
- package/dist/api/base-client.js +1 -0
- package/dist/api/http-client.browser.cjs +13 -5
- package/dist/api/http-client.browser.js +13 -5
- package/dist/api/http-client.cjs +13 -5
- package/dist/api/http-client.js +13 -5
- package/dist/api/index.d.ts +2 -0
- package/dist/api/ws-client.browser.cjs +19 -7
- package/dist/api/ws-client.browser.js +21 -7
- package/dist/api/ws-client.cjs +20 -8
- package/dist/api/ws-client.d.ts +1 -0
- package/dist/api/ws-client.js +22 -8
- package/dist/client.browser.cjs +9 -11
- package/dist/client.browser.js +9 -11
- package/dist/client.cjs +10 -12
- package/dist/client.d.ts +2 -1
- package/dist/client.js +10 -12
- package/dist/lib/errors.browser.cjs +4 -2
- package/dist/lib/errors.browser.js +4 -2
- package/dist/lib/errors.cjs +4 -2
- package/dist/lib/errors.js +4 -2
- package/dist/lib/isomorphic/node/streams.cjs +1 -1
- package/dist/lib/isomorphic/node/streams.js +1 -1
- package/dist/lib/utils.browser.cjs +2 -1
- package/dist/lib/utils.browser.js +2 -1
- package/dist/lib/utils.cjs +2 -1
- package/dist/lib/utils.js +2 -1
- package/dist/lib/validator.browser.cjs +15 -20
- package/dist/lib/validator.browser.js +15 -20
- package/dist/types/index.d.ts +5 -1
- package/dist/wapi-client-web.iife.js +4 -4
- package/dist/wapi-client.iife.js +4 -4
- package/package.json +1 -1
|
@@ -113,6 +113,7 @@ var BaseClient = class {
|
|
|
113
113
|
_send(input) {
|
|
114
114
|
throw new Error("This method must be implemented by child class");
|
|
115
115
|
}
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
116
117
|
_reconnect(nrOfAttempts) {
|
|
117
118
|
throw new Error("This method must be implemented by child class");
|
|
118
119
|
}
|
|
@@ -100,6 +100,7 @@ var BaseClient = class {
|
|
|
100
100
|
_send(input) {
|
|
101
101
|
throw new Error("This method must be implemented by child class");
|
|
102
102
|
}
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
104
|
_reconnect(nrOfAttempts) {
|
|
104
105
|
throw new Error("This method must be implemented by child class");
|
|
105
106
|
}
|
package/dist/api/base-client.cjs
CHANGED
|
@@ -113,6 +113,7 @@ var BaseClient = class {
|
|
|
113
113
|
_send(input) {
|
|
114
114
|
throw new Error("This method must be implemented by child class");
|
|
115
115
|
}
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
116
117
|
_reconnect(nrOfAttempts) {
|
|
117
118
|
throw new Error("This method must be implemented by child class");
|
|
118
119
|
}
|
package/dist/api/base-client.js
CHANGED
|
@@ -100,6 +100,7 @@ var BaseClient = class {
|
|
|
100
100
|
_send(input) {
|
|
101
101
|
throw new Error("This method must be implemented by child class");
|
|
102
102
|
}
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
104
|
_reconnect(nrOfAttempts) {
|
|
104
105
|
throw new Error("This method must be implemented by child class");
|
|
105
106
|
}
|
|
@@ -69,7 +69,9 @@ var import_errors = require('../lib/errors.cjs');
|
|
|
69
69
|
var import_utils = require('../lib/utils.cjs');
|
|
70
70
|
function createHttpClient(opts, config) {
|
|
71
71
|
const initialConnection = createConnection(opts, {
|
|
72
|
-
timeout: config == null ? void 0 : config.connectingTimeout
|
|
72
|
+
timeout: config == null ? void 0 : config.connectingTimeout,
|
|
73
|
+
skipInit: config == null ? void 0 : config.httpSkipInitialAuthConnection,
|
|
74
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
73
75
|
});
|
|
74
76
|
return new HttpClient(
|
|
75
77
|
initialConnection,
|
|
@@ -80,6 +82,7 @@ function createHttpClient(opts, config) {
|
|
|
80
82
|
function createConnection(opts, connectionConfig) {
|
|
81
83
|
const url = opts.host.replace(/^wss:/, "https:");
|
|
82
84
|
const REQ_HEADER_ID = "x-wapi-req-id";
|
|
85
|
+
const REQ_CONN_NAME = "x-wapi-conn-name";
|
|
83
86
|
function onmessage(body) {
|
|
84
87
|
return __async(this, null, function* () {
|
|
85
88
|
(0, import_debug.debugLog)(`http_createConnection>message(body:$0)`, body);
|
|
@@ -91,10 +94,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
91
94
|
const res = yield (0, import_fetch.fetch)(`${url}/api`, {
|
|
92
95
|
keepalive: true,
|
|
93
96
|
method: "POST",
|
|
94
|
-
headers: {
|
|
97
|
+
headers: __spreadValues({
|
|
95
98
|
Authorization: `Bearer ${jwt}`,
|
|
99
|
+
"content-type": "application/json",
|
|
96
100
|
[REQ_HEADER_ID]: jsonBody == null ? void 0 : jsonBody.id
|
|
97
|
-
},
|
|
101
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
98
102
|
body
|
|
99
103
|
});
|
|
100
104
|
const responseBody = yield res.json();
|
|
@@ -103,6 +107,9 @@ function createConnection(opts, connectionConfig) {
|
|
|
103
107
|
}
|
|
104
108
|
const connectId = (0, import_utils.getRandomHex)();
|
|
105
109
|
const $connect = new Promise((resolve, reject) => {
|
|
110
|
+
if (connectionConfig == null ? void 0 : connectionConfig.skipInit) {
|
|
111
|
+
return resolve(void 0);
|
|
112
|
+
}
|
|
106
113
|
const controller = new AbortController();
|
|
107
114
|
(0, import_debug.debugLog)(
|
|
108
115
|
`createConnection(sending http auth request${(connectionConfig == null ? void 0 : connectionConfig.timeout) ? " with timeout " + connectionConfig.timeout : ""})`
|
|
@@ -117,10 +124,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
117
124
|
}, connectionConfig.timeout) : void 0;
|
|
118
125
|
(0, import_fetch.fetch)(`${url}/api`, {
|
|
119
126
|
method: "POST",
|
|
120
|
-
headers: {
|
|
127
|
+
headers: __spreadValues({
|
|
121
128
|
Authorization: `Bearer ${opts.jwt}`,
|
|
129
|
+
"content-type": "application/json",
|
|
122
130
|
[REQ_HEADER_ID]: connectId
|
|
123
|
-
},
|
|
131
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
124
132
|
body: JSON.stringify({
|
|
125
133
|
jsonrpc: import_jsonrpc.JSONRPC.version,
|
|
126
134
|
method: "authenticationCheck",
|
|
@@ -50,7 +50,9 @@ import { ConfigError } from "../lib/errors.browser.js";
|
|
|
50
50
|
import { getRandomHex } from "../lib/utils.browser.js";
|
|
51
51
|
function createHttpClient(opts, config) {
|
|
52
52
|
const initialConnection = createConnection(opts, {
|
|
53
|
-
timeout: config == null ? void 0 : config.connectingTimeout
|
|
53
|
+
timeout: config == null ? void 0 : config.connectingTimeout,
|
|
54
|
+
skipInit: config == null ? void 0 : config.httpSkipInitialAuthConnection,
|
|
55
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
54
56
|
});
|
|
55
57
|
return new HttpClient(
|
|
56
58
|
initialConnection,
|
|
@@ -61,6 +63,7 @@ function createHttpClient(opts, config) {
|
|
|
61
63
|
function createConnection(opts, connectionConfig) {
|
|
62
64
|
const url = opts.host.replace(/^wss:/, "https:");
|
|
63
65
|
const REQ_HEADER_ID = "x-wapi-req-id";
|
|
66
|
+
const REQ_CONN_NAME = "x-wapi-conn-name";
|
|
64
67
|
function onmessage(body) {
|
|
65
68
|
return __async(this, null, function* () {
|
|
66
69
|
debugLog(`http_createConnection>message(body:$0)`, body);
|
|
@@ -72,10 +75,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
72
75
|
const res = yield fetch(`${url}/api`, {
|
|
73
76
|
keepalive: true,
|
|
74
77
|
method: "POST",
|
|
75
|
-
headers: {
|
|
78
|
+
headers: __spreadValues({
|
|
76
79
|
Authorization: `Bearer ${jwt}`,
|
|
80
|
+
"content-type": "application/json",
|
|
77
81
|
[REQ_HEADER_ID]: jsonBody == null ? void 0 : jsonBody.id
|
|
78
|
-
},
|
|
82
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
79
83
|
body
|
|
80
84
|
});
|
|
81
85
|
const responseBody = yield res.json();
|
|
@@ -84,6 +88,9 @@ function createConnection(opts, connectionConfig) {
|
|
|
84
88
|
}
|
|
85
89
|
const connectId = getRandomHex();
|
|
86
90
|
const $connect = new Promise((resolve, reject) => {
|
|
91
|
+
if (connectionConfig == null ? void 0 : connectionConfig.skipInit) {
|
|
92
|
+
return resolve(void 0);
|
|
93
|
+
}
|
|
87
94
|
const controller = new AbortController();
|
|
88
95
|
debugLog(
|
|
89
96
|
`createConnection(sending http auth request${(connectionConfig == null ? void 0 : connectionConfig.timeout) ? " with timeout " + connectionConfig.timeout : ""})`
|
|
@@ -98,10 +105,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
98
105
|
}, connectionConfig.timeout) : void 0;
|
|
99
106
|
fetch(`${url}/api`, {
|
|
100
107
|
method: "POST",
|
|
101
|
-
headers: {
|
|
108
|
+
headers: __spreadValues({
|
|
102
109
|
Authorization: `Bearer ${opts.jwt}`,
|
|
110
|
+
"content-type": "application/json",
|
|
103
111
|
[REQ_HEADER_ID]: connectId
|
|
104
|
-
},
|
|
112
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
105
113
|
body: JSON.stringify({
|
|
106
114
|
jsonrpc: JSONRPC.version,
|
|
107
115
|
method: "authenticationCheck",
|
package/dist/api/http-client.cjs
CHANGED
|
@@ -69,7 +69,9 @@ var import_errors = require('../lib/errors.cjs');
|
|
|
69
69
|
var import_utils = require('../lib/utils.cjs');
|
|
70
70
|
function createHttpClient(opts, config) {
|
|
71
71
|
const initialConnection = createConnection(opts, {
|
|
72
|
-
timeout: config == null ? void 0 : config.connectingTimeout
|
|
72
|
+
timeout: config == null ? void 0 : config.connectingTimeout,
|
|
73
|
+
skipInit: config == null ? void 0 : config.httpSkipInitialAuthConnection,
|
|
74
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
73
75
|
});
|
|
74
76
|
return new HttpClient(
|
|
75
77
|
initialConnection,
|
|
@@ -80,6 +82,7 @@ function createHttpClient(opts, config) {
|
|
|
80
82
|
function createConnection(opts, connectionConfig) {
|
|
81
83
|
const url = opts.host.replace(/^wss:/, "https:");
|
|
82
84
|
const REQ_HEADER_ID = "x-wapi-req-id";
|
|
85
|
+
const REQ_CONN_NAME = "x-wapi-conn-name";
|
|
83
86
|
function onmessage(body) {
|
|
84
87
|
return __async(this, null, function* () {
|
|
85
88
|
(0, import_debug.debugLog)(`http_createConnection>message(body:$0)`, body);
|
|
@@ -91,10 +94,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
91
94
|
const res = yield (0, import_fetch.fetch)(`${url}/api`, {
|
|
92
95
|
keepalive: true,
|
|
93
96
|
method: "POST",
|
|
94
|
-
headers: {
|
|
97
|
+
headers: __spreadValues({
|
|
95
98
|
Authorization: `Bearer ${jwt}`,
|
|
99
|
+
"content-type": "application/json",
|
|
96
100
|
[REQ_HEADER_ID]: jsonBody == null ? void 0 : jsonBody.id
|
|
97
|
-
},
|
|
101
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
98
102
|
body
|
|
99
103
|
});
|
|
100
104
|
const responseBody = yield res.json();
|
|
@@ -103,6 +107,9 @@ function createConnection(opts, connectionConfig) {
|
|
|
103
107
|
}
|
|
104
108
|
const connectId = (0, import_utils.getRandomHex)();
|
|
105
109
|
const $connect = new Promise((resolve, reject) => {
|
|
110
|
+
if (connectionConfig == null ? void 0 : connectionConfig.skipInit) {
|
|
111
|
+
return resolve(void 0);
|
|
112
|
+
}
|
|
106
113
|
const controller = new AbortController();
|
|
107
114
|
(0, import_debug.debugLog)(
|
|
108
115
|
`createConnection(sending http auth request${(connectionConfig == null ? void 0 : connectionConfig.timeout) ? " with timeout " + connectionConfig.timeout : ""})`
|
|
@@ -117,10 +124,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
117
124
|
}, connectionConfig.timeout) : void 0;
|
|
118
125
|
(0, import_fetch.fetch)(`${url}/api`, {
|
|
119
126
|
method: "POST",
|
|
120
|
-
headers: {
|
|
127
|
+
headers: __spreadValues({
|
|
121
128
|
Authorization: `Bearer ${opts.jwt}`,
|
|
129
|
+
"content-type": "application/json",
|
|
122
130
|
[REQ_HEADER_ID]: connectId
|
|
123
|
-
},
|
|
131
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
124
132
|
body: JSON.stringify({
|
|
125
133
|
jsonrpc: import_jsonrpc.JSONRPC.version,
|
|
126
134
|
method: "authenticationCheck",
|
package/dist/api/http-client.js
CHANGED
|
@@ -50,7 +50,9 @@ import { ConfigError } from "../lib/errors";
|
|
|
50
50
|
import { getRandomHex } from "../lib/utils";
|
|
51
51
|
function createHttpClient(opts, config) {
|
|
52
52
|
const initialConnection = createConnection(opts, {
|
|
53
|
-
timeout: config == null ? void 0 : config.connectingTimeout
|
|
53
|
+
timeout: config == null ? void 0 : config.connectingTimeout,
|
|
54
|
+
skipInit: config == null ? void 0 : config.httpSkipInitialAuthConnection,
|
|
55
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
54
56
|
});
|
|
55
57
|
return new HttpClient(
|
|
56
58
|
initialConnection,
|
|
@@ -61,6 +63,7 @@ function createHttpClient(opts, config) {
|
|
|
61
63
|
function createConnection(opts, connectionConfig) {
|
|
62
64
|
const url = opts.host.replace(/^wss:/, "https:");
|
|
63
65
|
const REQ_HEADER_ID = "x-wapi-req-id";
|
|
66
|
+
const REQ_CONN_NAME = "x-wapi-conn-name";
|
|
64
67
|
function onmessage(body) {
|
|
65
68
|
return __async(this, null, function* () {
|
|
66
69
|
debugLog(`http_createConnection>message(body:$0)`, body);
|
|
@@ -72,10 +75,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
72
75
|
const res = yield fetch(`${url}/api`, {
|
|
73
76
|
keepalive: true,
|
|
74
77
|
method: "POST",
|
|
75
|
-
headers: {
|
|
78
|
+
headers: __spreadValues({
|
|
76
79
|
Authorization: `Bearer ${jwt}`,
|
|
80
|
+
"content-type": "application/json",
|
|
77
81
|
[REQ_HEADER_ID]: jsonBody == null ? void 0 : jsonBody.id
|
|
78
|
-
},
|
|
82
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
79
83
|
body
|
|
80
84
|
});
|
|
81
85
|
const responseBody = yield res.json();
|
|
@@ -84,6 +88,9 @@ function createConnection(opts, connectionConfig) {
|
|
|
84
88
|
}
|
|
85
89
|
const connectId = getRandomHex();
|
|
86
90
|
const $connect = new Promise((resolve, reject) => {
|
|
91
|
+
if (connectionConfig == null ? void 0 : connectionConfig.skipInit) {
|
|
92
|
+
return resolve(void 0);
|
|
93
|
+
}
|
|
87
94
|
const controller = new AbortController();
|
|
88
95
|
debugLog(
|
|
89
96
|
`createConnection(sending http auth request${(connectionConfig == null ? void 0 : connectionConfig.timeout) ? " with timeout " + connectionConfig.timeout : ""})`
|
|
@@ -98,10 +105,11 @@ function createConnection(opts, connectionConfig) {
|
|
|
98
105
|
}, connectionConfig.timeout) : void 0;
|
|
99
106
|
fetch(`${url}/api`, {
|
|
100
107
|
method: "POST",
|
|
101
|
-
headers: {
|
|
108
|
+
headers: __spreadValues({
|
|
102
109
|
Authorization: `Bearer ${opts.jwt}`,
|
|
110
|
+
"content-type": "application/json",
|
|
103
111
|
[REQ_HEADER_ID]: connectId
|
|
104
|
-
},
|
|
112
|
+
}, (connectionConfig == null ? void 0 : connectionConfig.connectionName) ? { [REQ_CONN_NAME]: connectionConfig == null ? void 0 : connectionConfig.connectionName } : {}),
|
|
105
113
|
body: JSON.stringify({
|
|
106
114
|
jsonrpc: JSONRPC.version,
|
|
107
115
|
method: "authenticationCheck",
|
package/dist/api/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface WapiHttpConnectionOptions {
|
|
|
17
17
|
export interface ConnectionConfig {
|
|
18
18
|
connectingTimeout?: number;
|
|
19
19
|
reconnectingTimeout?: number;
|
|
20
|
+
connectionName?: string;
|
|
21
|
+
httpSkipInitialAuthConnection?: boolean;
|
|
20
22
|
}
|
|
21
23
|
export { BaseClient, WsClient, HttpClient, createWsClient, createHttpClient };
|
|
22
24
|
import JSONRPCRequestSchema from './jsonrpc/jsonrpc.request.schema.json';
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
5
19
|
var __export = (target, all) => {
|
|
6
20
|
for (var name in all)
|
|
7
21
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -64,13 +78,11 @@ function createWsClient(opts, config) {
|
|
|
64
78
|
}
|
|
65
79
|
function createConnection(opts, connectionConfig) {
|
|
66
80
|
var _a2;
|
|
67
|
-
const config =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
opts
|
|
73
|
-
);
|
|
81
|
+
const config = __spreadValues({
|
|
82
|
+
rejectUnauthorized: (_a2 = opts.rejectUnauthorized) != null ? _a2 : true,
|
|
83
|
+
connectionName: connectionConfig.connectionName,
|
|
84
|
+
clientVersion: CLIENT_VERSION
|
|
85
|
+
}, opts);
|
|
74
86
|
const params = (0, import_utils.getConnectionParams)(config);
|
|
75
87
|
const ws = new browser_default(...params);
|
|
76
88
|
let _resolve;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
1
17
|
var __async = (__this, __arguments, generator) => {
|
|
2
18
|
return new Promise((resolve, reject) => {
|
|
3
19
|
var fulfilled = (value) => {
|
|
@@ -42,13 +58,11 @@ function createWsClient(opts, config) {
|
|
|
42
58
|
}
|
|
43
59
|
function createConnection(opts, connectionConfig) {
|
|
44
60
|
var _a2;
|
|
45
|
-
const config =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
opts
|
|
51
|
-
);
|
|
61
|
+
const config = __spreadValues({
|
|
62
|
+
rejectUnauthorized: (_a2 = opts.rejectUnauthorized) != null ? _a2 : true,
|
|
63
|
+
connectionName: connectionConfig.connectionName,
|
|
64
|
+
clientVersion: CLIENT_VERSION
|
|
65
|
+
}, opts);
|
|
52
66
|
const params = getConnectionParams(config);
|
|
53
67
|
const ws = new browser_default(...params);
|
|
54
68
|
let _resolve;
|
package/dist/api/ws-client.cjs
CHANGED
|
@@ -2,8 +2,22 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
7
21
|
var __export = (target, all) => {
|
|
8
22
|
for (var name in all)
|
|
9
23
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -61,7 +75,7 @@ var import_base_client = require('./base-client.cjs');
|
|
|
61
75
|
var import_connection = require('./connection/connection.enums.cjs');
|
|
62
76
|
var import__ = require('../index.cjs');
|
|
63
77
|
var _a;
|
|
64
|
-
var CLIENT_VERSION = (_a = '0.10.
|
|
78
|
+
var CLIENT_VERSION = (_a = '0.10.13') != null ? _a : "";
|
|
65
79
|
function createWsClient(opts, config) {
|
|
66
80
|
const initialConnection = createConnection(opts, {
|
|
67
81
|
timeout: config == null ? void 0 : config.connectingTimeout
|
|
@@ -70,13 +84,11 @@ function createWsClient(opts, config) {
|
|
|
70
84
|
}
|
|
71
85
|
function createConnection(opts, connectionConfig) {
|
|
72
86
|
var _a2;
|
|
73
|
-
const config =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
opts
|
|
79
|
-
);
|
|
87
|
+
const config = __spreadValues({
|
|
88
|
+
rejectUnauthorized: (_a2 = opts.rejectUnauthorized) != null ? _a2 : true,
|
|
89
|
+
connectionName: connectionConfig.connectionName,
|
|
90
|
+
clientVersion: CLIENT_VERSION
|
|
91
|
+
}, opts);
|
|
80
92
|
const params = (0, import_utils.getConnectionParams)(config);
|
|
81
93
|
const ws = new import_modern_isomorphic_ws.default(...params);
|
|
82
94
|
let _resolve;
|
package/dist/api/ws-client.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface ConnectionWPromise {
|
|
|
11
11
|
export interface EWapiConnectionOptions extends WapiConnectionOptions {
|
|
12
12
|
rejectUnauthorized: boolean;
|
|
13
13
|
clientVersion: string;
|
|
14
|
+
connectionName?: string;
|
|
14
15
|
}
|
|
15
16
|
export declare class WsClient extends BaseClient {
|
|
16
17
|
private _pingTimeout;
|
package/dist/api/ws-client.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
1
17
|
var __async = (__this, __arguments, generator) => {
|
|
2
18
|
return new Promise((resolve, reject) => {
|
|
3
19
|
var fulfilled = (value) => {
|
|
@@ -31,7 +47,7 @@ import {
|
|
|
31
47
|
} from "./connection/connection.enums";
|
|
32
48
|
import { WapiClientType } from "../index";
|
|
33
49
|
var _a;
|
|
34
|
-
var CLIENT_VERSION = (_a = '0.10.
|
|
50
|
+
var CLIENT_VERSION = (_a = '0.10.13') != null ? _a : "";
|
|
35
51
|
function createWsClient(opts, config) {
|
|
36
52
|
const initialConnection = createConnection(opts, {
|
|
37
53
|
timeout: config == null ? void 0 : config.connectingTimeout
|
|
@@ -40,13 +56,11 @@ function createWsClient(opts, config) {
|
|
|
40
56
|
}
|
|
41
57
|
function createConnection(opts, connectionConfig) {
|
|
42
58
|
var _a2;
|
|
43
|
-
const config =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
opts
|
|
49
|
-
);
|
|
59
|
+
const config = __spreadValues({
|
|
60
|
+
rejectUnauthorized: (_a2 = opts.rejectUnauthorized) != null ? _a2 : true,
|
|
61
|
+
connectionName: connectionConfig.connectionName,
|
|
62
|
+
clientVersion: CLIENT_VERSION
|
|
63
|
+
}, opts);
|
|
50
64
|
const params = getConnectionParams(config);
|
|
51
65
|
const ws = new WebSocket(...params);
|
|
52
66
|
let _resolve;
|
package/dist/client.browser.cjs
CHANGED
|
@@ -73,13 +73,17 @@ var Client = class {
|
|
|
73
73
|
this.api = _apiClient;
|
|
74
74
|
this.$connect = _apiClient.$connect;
|
|
75
75
|
if (initialConf) {
|
|
76
|
-
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
76
|
+
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
77
77
|
sendingTimeout: initialConf.sendingTimeout
|
|
78
78
|
}), initialConf.connectingTimeout && {
|
|
79
79
|
connectingTimeout: initialConf.connectingTimeout
|
|
80
80
|
}), initialConf.reconnectingTimeout && {
|
|
81
81
|
reconnectingTimeout: initialConf.reconnectingTimeout
|
|
82
|
-
}), initialConf.hooks && { hooks: initialConf.hooks })
|
|
82
|
+
}), initialConf.hooks && { hooks: initialConf.hooks }), initialConf.connectionName && {
|
|
83
|
+
connectionName: initialConf.connectionName
|
|
84
|
+
}), initialConf.httpSkipInitialAuthConnection && {
|
|
85
|
+
httpSkipInitialAuthConnection: initialConf.httpSkipInitialAuthConnection
|
|
86
|
+
}));
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
@@ -175,14 +179,6 @@ var Client = class {
|
|
|
175
179
|
}
|
|
176
180
|
return this;
|
|
177
181
|
}
|
|
178
|
-
/**
|
|
179
|
-
* Get current config key value (token)
|
|
180
|
-
* ```javascript
|
|
181
|
-
*
|
|
182
|
-
* const token = wapiClient.getConfig('token');
|
|
183
|
-
*
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
182
|
getConfig(key) {
|
|
187
183
|
return this.config[key];
|
|
188
184
|
}
|
|
@@ -1817,7 +1813,9 @@ function createClientWithWS(opts, config) {
|
|
|
1817
1813
|
function createClientWithHttp(opts, config) {
|
|
1818
1814
|
const httpClient = (0, import_api.createHttpClient)(opts, {
|
|
1819
1815
|
connectingTimeout: config == null ? void 0 : config.connectingTimeout,
|
|
1820
|
-
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout
|
|
1816
|
+
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout,
|
|
1817
|
+
httpSkipInitialAuthConnection: config == null ? void 0 : config.httpSkipInitialAuthConnection,
|
|
1818
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
1821
1819
|
});
|
|
1822
1820
|
return new Client(httpClient, config);
|
|
1823
1821
|
}
|
package/dist/client.browser.js
CHANGED
|
@@ -57,13 +57,17 @@ var Client = class {
|
|
|
57
57
|
this.api = _apiClient;
|
|
58
58
|
this.$connect = _apiClient.$connect;
|
|
59
59
|
if (initialConf) {
|
|
60
|
-
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
60
|
+
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
61
61
|
sendingTimeout: initialConf.sendingTimeout
|
|
62
62
|
}), initialConf.connectingTimeout && {
|
|
63
63
|
connectingTimeout: initialConf.connectingTimeout
|
|
64
64
|
}), initialConf.reconnectingTimeout && {
|
|
65
65
|
reconnectingTimeout: initialConf.reconnectingTimeout
|
|
66
|
-
}), initialConf.hooks && { hooks: initialConf.hooks })
|
|
66
|
+
}), initialConf.hooks && { hooks: initialConf.hooks }), initialConf.connectionName && {
|
|
67
|
+
connectionName: initialConf.connectionName
|
|
68
|
+
}), initialConf.httpSkipInitialAuthConnection && {
|
|
69
|
+
httpSkipInitialAuthConnection: initialConf.httpSkipInitialAuthConnection
|
|
70
|
+
}));
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
/**
|
|
@@ -159,14 +163,6 @@ var Client = class {
|
|
|
159
163
|
}
|
|
160
164
|
return this;
|
|
161
165
|
}
|
|
162
|
-
/**
|
|
163
|
-
* Get current config key value (token)
|
|
164
|
-
* ```javascript
|
|
165
|
-
*
|
|
166
|
-
* const token = wapiClient.getConfig('token');
|
|
167
|
-
*
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
166
|
getConfig(key) {
|
|
171
167
|
return this.config[key];
|
|
172
168
|
}
|
|
@@ -1801,7 +1797,9 @@ function createClientWithWS(opts, config) {
|
|
|
1801
1797
|
function createClientWithHttp(opts, config) {
|
|
1802
1798
|
const httpClient = createHttpClient(opts, {
|
|
1803
1799
|
connectingTimeout: config == null ? void 0 : config.connectingTimeout,
|
|
1804
|
-
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout
|
|
1800
|
+
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout,
|
|
1801
|
+
httpSkipInitialAuthConnection: config == null ? void 0 : config.httpSkipInitialAuthConnection,
|
|
1802
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
1805
1803
|
});
|
|
1806
1804
|
return new Client(httpClient, config);
|
|
1807
1805
|
}
|
package/dist/client.cjs
CHANGED
|
@@ -63,7 +63,7 @@ var import_errors = require('./lib/errors.cjs');
|
|
|
63
63
|
var import_fns = require('./fns/index.cjs');
|
|
64
64
|
var import_import_data = require('./fns/import-data/import-data.guards.cjs');
|
|
65
65
|
var _a;
|
|
66
|
-
var CLIENT_VERSION = (_a = '0.10.
|
|
66
|
+
var CLIENT_VERSION = (_a = '0.10.13') != null ? _a : "";
|
|
67
67
|
var Client = class {
|
|
68
68
|
/**
|
|
69
69
|
* @internal
|
|
@@ -73,13 +73,17 @@ var Client = class {
|
|
|
73
73
|
this.api = _apiClient;
|
|
74
74
|
this.$connect = _apiClient.$connect;
|
|
75
75
|
if (initialConf) {
|
|
76
|
-
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
76
|
+
this.configure(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, initialConf.token && { token: initialConf.token }), initialConf.sendingTimeout && {
|
|
77
77
|
sendingTimeout: initialConf.sendingTimeout
|
|
78
78
|
}), initialConf.connectingTimeout && {
|
|
79
79
|
connectingTimeout: initialConf.connectingTimeout
|
|
80
80
|
}), initialConf.reconnectingTimeout && {
|
|
81
81
|
reconnectingTimeout: initialConf.reconnectingTimeout
|
|
82
|
-
}), initialConf.hooks && { hooks: initialConf.hooks })
|
|
82
|
+
}), initialConf.hooks && { hooks: initialConf.hooks }), initialConf.connectionName && {
|
|
83
|
+
connectionName: initialConf.connectionName
|
|
84
|
+
}), initialConf.httpSkipInitialAuthConnection && {
|
|
85
|
+
httpSkipInitialAuthConnection: initialConf.httpSkipInitialAuthConnection
|
|
86
|
+
}));
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
@@ -175,14 +179,6 @@ var Client = class {
|
|
|
175
179
|
}
|
|
176
180
|
return this;
|
|
177
181
|
}
|
|
178
|
-
/**
|
|
179
|
-
* Get current config key value (token)
|
|
180
|
-
* ```javascript
|
|
181
|
-
*
|
|
182
|
-
* const token = wapiClient.getConfig('token');
|
|
183
|
-
*
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
182
|
getConfig(key) {
|
|
187
183
|
return this.config[key];
|
|
188
184
|
}
|
|
@@ -1817,7 +1813,9 @@ function createClientWithWS(opts, config) {
|
|
|
1817
1813
|
function createClientWithHttp(opts, config) {
|
|
1818
1814
|
const httpClient = (0, import_api.createHttpClient)(opts, {
|
|
1819
1815
|
connectingTimeout: config == null ? void 0 : config.connectingTimeout,
|
|
1820
|
-
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout
|
|
1816
|
+
reconnectingTimeout: config == null ? void 0 : config.reconnectingTimeout,
|
|
1817
|
+
httpSkipInitialAuthConnection: config == null ? void 0 : config.httpSkipInitialAuthConnection,
|
|
1818
|
+
connectionName: config == null ? void 0 : config.connectionName
|
|
1821
1819
|
});
|
|
1822
1820
|
return new Client(httpClient, config);
|
|
1823
1821
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -138,7 +138,8 @@ export declare class Client {
|
|
|
138
138
|
*
|
|
139
139
|
* ```
|
|
140
140
|
*/
|
|
141
|
-
getConfig(key:
|
|
141
|
+
getConfig(key: 'httpSkipInitialAuthConnection'): boolean | undefined;
|
|
142
|
+
getConfig(key: keyof Omit<ClientConfig, 'hooks' | 'httpSkipInitialAuthConnection'>): number | string | undefined;
|
|
142
143
|
/**
|
|
143
144
|
*
|
|
144
145
|
* Aggregate Transfers using either a simple filter or queryBuilder
|