wapi-client 0.10.4 → 0.10.10
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 +27 -8
- package/dist/api/base-client.browser.js +28 -9
- package/dist/api/base-client.cjs +27 -8
- package/dist/api/base-client.d.ts +6 -2
- package/dist/api/base-client.js +28 -9
- package/dist/api/http-client.browser.cjs +47 -21
- package/dist/api/http-client.browser.js +47 -21
- package/dist/api/http-client.cjs +47 -21
- package/dist/api/http-client.d.ts +2 -2
- package/dist/api/http-client.js +47 -21
- package/dist/api/index.d.ts +4 -0
- package/dist/api/ws-client.browser.cjs +26 -10
- package/dist/api/ws-client.browser.js +27 -11
- package/dist/api/ws-client.cjs +27 -11
- package/dist/api/ws-client.d.ts +5 -4
- package/dist/api/ws-client.js +28 -12
- package/dist/client.browser.cjs +47 -17
- package/dist/client.browser.js +48 -18
- package/dist/client.cjs +48 -18
- package/dist/client.d.ts +10 -5
- package/dist/client.js +49 -19
- package/dist/fns/create-access-token/create-access-token.browser.cjs +6 -1
- package/dist/fns/create-access-token/create-access-token.browser.js +6 -1
- package/dist/fns/create-access-token/create-access-token.cjs +6 -1
- package/dist/fns/create-access-token/create-access-token.enums.d.ts +1 -1
- package/dist/fns/create-access-token/create-access-token.js +6 -1
- package/dist/fns/create-access-token/create-access-token.schema.input.json +13 -1
- package/dist/fns/get-balance-history/get-balance-history.browser.cjs +2 -1
- package/dist/fns/get-balance-history/get-balance-history.browser.js +2 -1
- package/dist/fns/get-balance-history/get-balance-history.cjs +2 -1
- package/dist/fns/get-balance-history/get-balance-history.enums.d.ts +5 -1
- package/dist/fns/get-balance-history/get-balance-history.js +2 -1
- package/dist/fns/get-balance-history/get-balance-history.schema.input.json +5 -0
- package/dist/fns/list-exports/list-exports.browser.cjs +4 -7
- package/dist/fns/list-exports/list-exports.browser.js +9 -8
- package/dist/fns/list-exports/list-exports.cjs +4 -7
- package/dist/fns/list-exports/list-exports.enums.d.ts +9 -4
- package/dist/fns/list-exports/list-exports.js +9 -8
- package/dist/fns/list-exports/list-exports.schema.input.json +20 -2
- package/dist/index.browser.cjs +3 -0
- package/dist/index.browser.js +3 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.ts +23 -5
- package/dist/index.js +3 -0
- package/dist/lib/errors.browser.cjs +21 -1
- package/dist/lib/errors.browser.js +21 -1
- package/dist/lib/errors.cjs +21 -1
- package/dist/lib/errors.d.ts +180 -109
- package/dist/lib/errors.js +21 -1
- package/dist/lib/utils.browser.cjs +24 -0
- package/dist/lib/utils.browser.js +24 -0
- package/dist/lib/utils.cjs +27 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.js +24 -0
- package/dist/lib/validator.browser.cjs +3 -0
- package/dist/lib/validator.browser.js +4 -1
- package/dist/lib/validator.cjs +3 -0
- package/dist/lib/validator.js +4 -1
- package/dist/txs/create-access-token/create-access-token.enums.d.ts +1 -1
- package/dist/txs/create-access-token/create-access-token.schema.input.json +8 -1
- package/dist/txs/get-export/get-export.enums.d.ts +2 -1
- package/dist/txs/get-export/get-export.schema.output.json +13 -2
- package/dist/txs/get-token/get-token.enums.d.ts +5 -1
- package/dist/txs/get-token/get-token.schema.output.json +3 -0
- package/dist/txs/list-export-many/list-export-many.enums.d.ts +5 -5
- package/dist/txs/list-export-many/list-export-many.schema.input.json +5 -4
- package/dist/types/index.d.ts +264 -141
- package/dist/wapi-client-web.iife.js +6 -6
- package/dist/wapi-client.iife.js +6 -6
- package/package.json +1 -1
|
@@ -4,11 +4,16 @@ import { getValidator, SchemaNames } from "../../lib/validator.browser.js";
|
|
|
4
4
|
var clientFnToTxMap = new Map(
|
|
5
5
|
Object.entries({
|
|
6
6
|
aggregateTransfers: "aggregateTransferMany",
|
|
7
|
+
exportTokens: "exportTokenMany",
|
|
8
|
+
exportTransferGroups: "exportTransferGroupMany",
|
|
9
|
+
exportTransfers: "exportTransferMany",
|
|
10
|
+
exportWallets: "exportWalletMany",
|
|
7
11
|
findBalances: "findBalanceMany",
|
|
8
12
|
findTokens: "findTokenMany",
|
|
9
13
|
findTransferGroups: "findTransferGroupMany",
|
|
10
14
|
findTransfers: "findTransferMany",
|
|
11
|
-
findWallets: "findWalletMany"
|
|
15
|
+
findWallets: "findWalletMany",
|
|
16
|
+
listExports: "listExportMany"
|
|
12
17
|
})
|
|
13
18
|
);
|
|
14
19
|
var validate = getValidator(SchemaNames.CreateAccessTokenFnInput);
|
|
@@ -28,11 +28,16 @@ var import_validator = require('../../lib/validator.cjs');
|
|
|
28
28
|
var clientFnToTxMap = new Map(
|
|
29
29
|
Object.entries({
|
|
30
30
|
aggregateTransfers: "aggregateTransferMany",
|
|
31
|
+
exportTokens: "exportTokenMany",
|
|
32
|
+
exportTransferGroups: "exportTransferGroupMany",
|
|
33
|
+
exportTransfers: "exportTransferMany",
|
|
34
|
+
exportWallets: "exportWalletMany",
|
|
31
35
|
findBalances: "findBalanceMany",
|
|
32
36
|
findTokens: "findTokenMany",
|
|
33
37
|
findTransferGroups: "findTransferGroupMany",
|
|
34
38
|
findTransfers: "findTransferMany",
|
|
35
|
-
findWallets: "findWalletMany"
|
|
39
|
+
findWallets: "findWalletMany",
|
|
40
|
+
listExports: "listExportMany"
|
|
36
41
|
})
|
|
37
42
|
);
|
|
38
43
|
var validate = (0, import_validator.getValidator)(import_validator.SchemaNames.CreateAccessTokenFnInput);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateAccessTokenAdmin, CreateAccessTokenTxOptions, CreateAccessTokenForcedFilters, CreateAccessTokenTxOutput } from '../../txs/create-access-token/create-access-token.enums';
|
|
2
2
|
export interface CreateAccessTokenFnLimited {
|
|
3
3
|
type: 'limited';
|
|
4
|
-
scopes: ('aggregateTransfers' | 'findBalances' | 'findTokens' | 'findTransferGroups' | 'findTransfers' | 'findWallets' | 'aggregateTransferMany' | 'findBalanceMany' | 'findTokenMany' | 'findTransferGroupMany' | 'findTransferMany' | 'findWalletMany' | 'getBalance' | 'getBalanceHistory' | 'getStatistics' | 'getToken' | 'getTokenMany' | 'getTransfer' | 'getTransferGroup' | 'getWallet' | 'getWalletMany')[];
|
|
4
|
+
scopes: ('aggregateTransfers' | 'exportBalanceHistory' | 'exportTokens' | 'exportTransferGroups' | 'exportTransfers' | 'exportWallets' | 'findBalances' | 'findTokens' | 'findTransferGroups' | 'findTransfers' | 'findWallets' | 'aggregateTransferMany' | 'exportTokenMany' | 'exportTransferGroupMany' | 'exportTransferMany' | 'exportWalletMany' | 'findBalanceMany' | 'findTokenMany' | 'findTransferGroupMany' | 'findTransferMany' | 'findWalletMany' | 'getBalance' | 'getBalanceHistory' | 'getStatistics' | 'getToken' | 'getTokenMany' | 'getTransfer' | 'getTransferGroup' | 'getWallet' | 'getWalletMany' | 'healthcheck' | 'listExportMany' | 'listExports')[];
|
|
5
5
|
/**
|
|
6
6
|
* JWT expiration time in minutes
|
|
7
7
|
*/
|
|
@@ -4,11 +4,16 @@ import { getValidator, SchemaNames } from "../../lib/validator";
|
|
|
4
4
|
var clientFnToTxMap = new Map(
|
|
5
5
|
Object.entries({
|
|
6
6
|
aggregateTransfers: "aggregateTransferMany",
|
|
7
|
+
exportTokens: "exportTokenMany",
|
|
8
|
+
exportTransferGroups: "exportTransferGroupMany",
|
|
9
|
+
exportTransfers: "exportTransferMany",
|
|
10
|
+
exportWallets: "exportWalletMany",
|
|
7
11
|
findBalances: "findBalanceMany",
|
|
8
12
|
findTokens: "findTokenMany",
|
|
9
13
|
findTransferGroups: "findTransferGroupMany",
|
|
10
14
|
findTransfers: "findTransferMany",
|
|
11
|
-
findWallets: "findWalletMany"
|
|
15
|
+
findWallets: "findWalletMany",
|
|
16
|
+
listExports: "listExportMany"
|
|
12
17
|
})
|
|
13
18
|
);
|
|
14
19
|
var validate = getValidator(SchemaNames.CreateAccessTokenFnInput);
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
"type": "string",
|
|
43
43
|
"enum": [
|
|
44
44
|
"aggregateTransfers",
|
|
45
|
+
"exportBalanceHistory",
|
|
46
|
+
"exportTokens",
|
|
47
|
+
"exportTransferGroups",
|
|
48
|
+
"exportTransfers",
|
|
49
|
+
"exportWallets",
|
|
45
50
|
"findBalances",
|
|
46
51
|
"findTokens",
|
|
47
52
|
"findTransferGroups",
|
|
@@ -49,6 +54,10 @@
|
|
|
49
54
|
"findWallets",
|
|
50
55
|
|
|
51
56
|
"aggregateTransferMany",
|
|
57
|
+
"exportTokenMany",
|
|
58
|
+
"exportTransferGroupMany",
|
|
59
|
+
"exportTransferMany",
|
|
60
|
+
"exportWalletMany",
|
|
52
61
|
"findBalanceMany",
|
|
53
62
|
"findTokenMany",
|
|
54
63
|
"findTransferGroupMany",
|
|
@@ -62,7 +71,10 @@
|
|
|
62
71
|
"getTransfer",
|
|
63
72
|
"getTransferGroup",
|
|
64
73
|
"getWallet",
|
|
65
|
-
"getWalletMany"
|
|
74
|
+
"getWalletMany",
|
|
75
|
+
"healthcheck",
|
|
76
|
+
"listExportMany",
|
|
77
|
+
"listExports"
|
|
66
78
|
]
|
|
67
79
|
}
|
|
68
80
|
},
|
|
@@ -44,7 +44,8 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
44
44
|
return client.api.getBalanceHistory({
|
|
45
45
|
balance: {
|
|
46
46
|
wallet: (0, import_utils.getForeign)(inputCopy.wallet),
|
|
47
|
-
token: (0, import_utils.getForeign)(token)
|
|
47
|
+
token: (0, import_utils.getForeign)(token),
|
|
48
|
+
datetime: inputCopy.datetime
|
|
48
49
|
},
|
|
49
50
|
options: inputCopy.options
|
|
50
51
|
});
|
|
@@ -20,7 +20,8 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
20
20
|
return client.api.getBalanceHistory({
|
|
21
21
|
balance: {
|
|
22
22
|
wallet: getForeign(inputCopy.wallet),
|
|
23
|
-
token: getForeign(token)
|
|
23
|
+
token: getForeign(token),
|
|
24
|
+
datetime: inputCopy.datetime
|
|
24
25
|
},
|
|
25
26
|
options: inputCopy.options
|
|
26
27
|
});
|
|
@@ -44,7 +44,8 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
44
44
|
return client.api.getBalanceHistory({
|
|
45
45
|
balance: {
|
|
46
46
|
wallet: (0, import_utils.getForeign)(inputCopy.wallet),
|
|
47
|
-
token: (0, import_utils.getForeign)(token)
|
|
47
|
+
token: (0, import_utils.getForeign)(token),
|
|
48
|
+
datetime: inputCopy.datetime
|
|
48
49
|
},
|
|
49
50
|
options: inputCopy.options
|
|
50
51
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetBalanceHistoryTxOptions, GetBalanceHistoryTxOutput } from '../../txs/get-balance-history/get-balance-history.enums';
|
|
2
|
-
export type GetBalanceHistoryFnInputStringFields = 'token' | 'wallet';
|
|
2
|
+
export type GetBalanceHistoryFnInputStringFields = 'token' | 'wallet' | 'datetime';
|
|
3
3
|
/**
|
|
4
4
|
* Optional flags for input
|
|
5
5
|
*/
|
|
@@ -18,6 +18,10 @@ export interface GetBalanceHistoryFnInput {
|
|
|
18
18
|
* Id of the wallet to get balance from
|
|
19
19
|
*/
|
|
20
20
|
wallet: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* Select entries that are older than
|
|
23
|
+
*/
|
|
24
|
+
datetime?: string;
|
|
21
25
|
options?: GetBalanceHistoryFnOptions;
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
@@ -20,7 +20,8 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
20
20
|
return client.api.getBalanceHistory({
|
|
21
21
|
balance: {
|
|
22
22
|
wallet: getForeign(inputCopy.wallet),
|
|
23
|
-
token: getForeign(token)
|
|
23
|
+
token: getForeign(token),
|
|
24
|
+
datetime: inputCopy.datetime
|
|
24
25
|
},
|
|
25
26
|
options: inputCopy.options
|
|
26
27
|
});
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
"description": "Id of the wallet to get balance from",
|
|
14
14
|
"type": ["string", "integer"]
|
|
15
15
|
},
|
|
16
|
+
"datetime": {
|
|
17
|
+
"description": "Select entries that are older than",
|
|
18
|
+
"type": ["string"],
|
|
19
|
+
"format": "date-time"
|
|
20
|
+
},
|
|
16
21
|
"options": {
|
|
17
22
|
"$ref": "#/definitions/get_balance_history_fn_options"
|
|
18
23
|
}
|
|
@@ -36,15 +36,12 @@ function listExports(options, input, fnOptions) {
|
|
|
36
36
|
if (error) {
|
|
37
37
|
throw error;
|
|
38
38
|
}
|
|
39
|
-
const date = ((
|
|
40
|
-
|
|
41
|
-
return inputCopy.date;
|
|
42
|
-
}
|
|
43
|
-
return void 0;
|
|
44
|
-
})();
|
|
39
|
+
const date = (0, import_utils.convertToString)(inputCopy == null ? void 0 : inputCopy.date);
|
|
40
|
+
fnOptions = (0, import_utils.checkFnOptionsOrderBy)(fnOptions);
|
|
45
41
|
return client.api.listExportMany({
|
|
46
42
|
export: {
|
|
47
|
-
date
|
|
43
|
+
date,
|
|
44
|
+
type: inputCopy.type
|
|
48
45
|
},
|
|
49
46
|
options: fnOptions
|
|
50
47
|
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
// src/fns/list-exports/list-exports.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
checkFnOptionsOrderBy,
|
|
4
|
+
convertToString,
|
|
5
|
+
validateClientFnInput
|
|
6
|
+
} from "../../lib/utils.browser.js";
|
|
3
7
|
import { getValidator, SchemaNames } from "../../lib/validator.browser.js";
|
|
4
8
|
var validate = getValidator(SchemaNames.ListExportsFnInput);
|
|
5
9
|
function listExports(options, input, fnOptions) {
|
|
@@ -12,15 +16,12 @@ function listExports(options, input, fnOptions) {
|
|
|
12
16
|
if (error) {
|
|
13
17
|
throw error;
|
|
14
18
|
}
|
|
15
|
-
const date = (
|
|
16
|
-
|
|
17
|
-
return inputCopy.date;
|
|
18
|
-
}
|
|
19
|
-
return void 0;
|
|
20
|
-
})();
|
|
19
|
+
const date = convertToString(inputCopy == null ? void 0 : inputCopy.date);
|
|
20
|
+
fnOptions = checkFnOptionsOrderBy(fnOptions);
|
|
21
21
|
return client.api.listExportMany({
|
|
22
22
|
export: {
|
|
23
|
-
date
|
|
23
|
+
date,
|
|
24
|
+
type: inputCopy.type
|
|
24
25
|
},
|
|
25
26
|
options: fnOptions
|
|
26
27
|
});
|
|
@@ -36,15 +36,12 @@ function listExports(options, input, fnOptions) {
|
|
|
36
36
|
if (error) {
|
|
37
37
|
throw error;
|
|
38
38
|
}
|
|
39
|
-
const date = ((
|
|
40
|
-
|
|
41
|
-
return inputCopy.date;
|
|
42
|
-
}
|
|
43
|
-
return void 0;
|
|
44
|
-
})();
|
|
39
|
+
const date = (0, import_utils.convertToString)(inputCopy == null ? void 0 : inputCopy.date);
|
|
40
|
+
fnOptions = (0, import_utils.checkFnOptionsOrderBy)(fnOptions);
|
|
45
41
|
return client.api.listExportMany({
|
|
46
42
|
export: {
|
|
47
|
-
date
|
|
43
|
+
date,
|
|
44
|
+
type: inputCopy.type
|
|
48
45
|
},
|
|
49
46
|
options: fnOptions
|
|
50
47
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExportType } from '../../txs/get-export/get-export.enums';
|
|
2
|
+
import { ITxLimitingOptions, ITxGeneralOptions } from '../../txs/tx-consts.enums';
|
|
3
|
+
import { ListExportManyOrderingOptions, ListExportManyTxOutput } from '../../txs/list-export-many/list-export-many.enums';
|
|
4
|
+
import { IFnFindOptionsExtra } from '../fn-consts.enums';
|
|
2
5
|
export type ListExportsFnInputStringFields = 'date';
|
|
3
|
-
export
|
|
4
|
-
[k: string]: unknown;
|
|
5
|
-
}
|
|
6
|
+
export type ListExportsFnOptions = ITxLimitingOptions & ITxGeneralOptions & ListExportManyOrderingOptions & IFnFindOptionsExtra;
|
|
6
7
|
/**
|
|
7
8
|
* Input for listExports
|
|
8
9
|
*
|
|
@@ -13,6 +14,10 @@ export interface ListExportsFnInput {
|
|
|
13
14
|
* Date of the export
|
|
14
15
|
*/
|
|
15
16
|
date?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Type of the export
|
|
19
|
+
*/
|
|
20
|
+
type?: ExportType;
|
|
16
21
|
options?: ListExportsFnOptions;
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
// src/fns/list-exports/list-exports.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
checkFnOptionsOrderBy,
|
|
4
|
+
convertToString,
|
|
5
|
+
validateClientFnInput
|
|
6
|
+
} from "../../lib/utils";
|
|
3
7
|
import { getValidator, SchemaNames } from "../../lib/validator";
|
|
4
8
|
var validate = getValidator(SchemaNames.ListExportsFnInput);
|
|
5
9
|
function listExports(options, input, fnOptions) {
|
|
@@ -12,15 +16,12 @@ function listExports(options, input, fnOptions) {
|
|
|
12
16
|
if (error) {
|
|
13
17
|
throw error;
|
|
14
18
|
}
|
|
15
|
-
const date = (
|
|
16
|
-
|
|
17
|
-
return inputCopy.date;
|
|
18
|
-
}
|
|
19
|
-
return void 0;
|
|
20
|
-
})();
|
|
19
|
+
const date = convertToString(inputCopy == null ? void 0 : inputCopy.date);
|
|
20
|
+
fnOptions = checkFnOptionsOrderBy(fnOptions);
|
|
21
21
|
return client.api.listExportMany({
|
|
22
22
|
export: {
|
|
23
|
-
date
|
|
23
|
+
date,
|
|
24
|
+
type: inputCopy.type
|
|
24
25
|
},
|
|
25
26
|
options: fnOptions
|
|
26
27
|
});
|
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
"description": "Input for listExports",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
+
"type": {
|
|
9
|
+
"description": "Type of the export",
|
|
10
|
+
"$ref": "/txs/get-export/get-export.schema.output.json#/definitions/export_type"
|
|
11
|
+
},
|
|
8
12
|
"date": {
|
|
9
13
|
"description": "Date of the export",
|
|
10
|
-
"type":
|
|
14
|
+
"type": "string",
|
|
15
|
+
"format": "date"
|
|
11
16
|
},
|
|
12
17
|
"options": {
|
|
13
18
|
"$ref": "#/definitions/list_exports_fn_options"
|
|
@@ -15,7 +20,20 @@
|
|
|
15
20
|
},
|
|
16
21
|
"definitions": {
|
|
17
22
|
"list_exports_fn_options": {
|
|
18
|
-
"
|
|
23
|
+
"allOf": [
|
|
24
|
+
{
|
|
25
|
+
"$ref": "/txs/tx-consts.schema.json#/definitions/i_tx_limiting_options"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"$ref": "/txs/tx-consts.schema.json#/definitions/i_tx_general_options"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"$ref": "/txs/list-export-many/list-export-many.schema.input.json#/definitions/list_export_many_ordering_options"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"$ref": "/fns/fn-consts.schema.json#/definitions/i_fn_find_options_extra"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
19
37
|
}
|
|
20
38
|
},
|
|
21
39
|
"additionalProperties": false
|
package/dist/index.browser.cjs
CHANGED
|
@@ -59,7 +59,10 @@ var WapiClientType = /* @__PURE__ */ ((WapiClientType2) => {
|
|
|
59
59
|
return WapiClientType2;
|
|
60
60
|
})(WapiClientType || {});
|
|
61
61
|
function create(options) {
|
|
62
|
+
var _a;
|
|
62
63
|
const config = options.config;
|
|
64
|
+
delete options.config;
|
|
65
|
+
(_a = options.client) != null ? _a : options.client = "ws" /* ws */;
|
|
63
66
|
const { inputCopy, error } = validate(options);
|
|
64
67
|
if (error) {
|
|
65
68
|
throw error;
|
package/dist/index.browser.js
CHANGED
|
@@ -34,7 +34,10 @@ var WapiClientType = /* @__PURE__ */ ((WapiClientType2) => {
|
|
|
34
34
|
return WapiClientType2;
|
|
35
35
|
})(WapiClientType || {});
|
|
36
36
|
function create(options) {
|
|
37
|
+
var _a;
|
|
37
38
|
const config = options.config;
|
|
39
|
+
delete options.config;
|
|
40
|
+
(_a = options.client) != null ? _a : options.client = "ws" /* ws */;
|
|
38
41
|
const { inputCopy, error } = validate(options);
|
|
39
42
|
if (error) {
|
|
40
43
|
throw error;
|
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,10 @@ var WapiClientType = /* @__PURE__ */ ((WapiClientType2) => {
|
|
|
59
59
|
return WapiClientType2;
|
|
60
60
|
})(WapiClientType || {});
|
|
61
61
|
function create(options) {
|
|
62
|
+
var _a;
|
|
62
63
|
const config = options.config;
|
|
64
|
+
delete options.config;
|
|
65
|
+
(_a = options.client) != null ? _a : options.client = "ws" /* ws */;
|
|
63
66
|
const { inputCopy, error } = validate(options);
|
|
64
67
|
if (error) {
|
|
65
68
|
throw error;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare enum WapiClientType {
|
|
|
10
10
|
https = "https"
|
|
11
11
|
}
|
|
12
12
|
export interface WapiClientWsOptions {
|
|
13
|
-
client
|
|
13
|
+
client?: WapiClientType.ws;
|
|
14
14
|
connection: WapiConnectionOptions;
|
|
15
15
|
config?: ClientConfig;
|
|
16
16
|
}
|
|
@@ -35,32 +35,50 @@ export type WapiClientOptions = WapiClientWsOptions | WapiClientHttpOptions;
|
|
|
35
35
|
* },
|
|
36
36
|
* config: {
|
|
37
37
|
* hooks: {
|
|
38
|
+
* // will fire after initial connection has been made
|
|
38
39
|
* connected() {
|
|
39
40
|
* console.log('connected');
|
|
40
41
|
* },
|
|
42
|
+
* // will fire if the connection drops
|
|
41
43
|
* disconnected() {
|
|
42
44
|
* console.log('disconnected');
|
|
43
45
|
* },
|
|
46
|
+
* // will fire before attempting to reconnect
|
|
47
|
+
* // if this function returns false it will not reconnect
|
|
44
48
|
* reconnect() {
|
|
45
49
|
* console.log('reconnect attempt');
|
|
46
50
|
* // return false; from this hook to prevent reconnecting
|
|
47
51
|
* },
|
|
52
|
+
* // will fire if there is a problem with reconnecting
|
|
48
53
|
* reconnectError(err) {
|
|
49
54
|
* console.error(err);
|
|
50
|
-
* // this hook will fire if websocket disconnects and fails to reconnect
|
|
51
55
|
* }
|
|
56
|
+
* // will fire before each message is sent to server
|
|
57
|
+
* // if this message returns false then the message is not sent
|
|
52
58
|
* preflight(msg) => {
|
|
53
59
|
* console.log('sending msg', msg);
|
|
54
|
-
* return true; // allow
|
|
55
60
|
* },
|
|
61
|
+
* // will fire when a message is received from the server
|
|
56
62
|
* message(msg) => {
|
|
57
63
|
* console.log('got msg', msg);
|
|
58
64
|
* },
|
|
59
65
|
* },
|
|
60
|
-
* token
|
|
66
|
+
* // default token to be used in methods that require a token
|
|
67
|
+
* // allows you to skip specifying the token each time if you only care about one token
|
|
68
|
+
* token: 'EUR',
|
|
69
|
+
* // how long to wait on initial connection before throwing an error
|
|
70
|
+
* // default is to wait underlying network layer timeout
|
|
71
|
+
* connectingTimeout: 60000;
|
|
72
|
+
* // how long to wait on reconnect attempts before erroring
|
|
73
|
+
* // default is to wait underlying network layer timeout
|
|
74
|
+
* reconnectingTimeout: 60000;
|
|
75
|
+
* // how long to wait for server ACK response on sending a command
|
|
76
|
+
* // NB! erroring on this timeout does not mean the command is not executed
|
|
77
|
+
* // as the command might have gotten through, but return ACK did not
|
|
78
|
+
* sendingTimeout: 60000;
|
|
61
79
|
* }
|
|
62
80
|
* });
|
|
63
|
-
*
|
|
81
|
+
* // this direct wait for connect is not required
|
|
64
82
|
* await client.$connect;
|
|
65
83
|
*
|
|
66
84
|
* ```
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,10 @@ var WapiClientType = /* @__PURE__ */ ((WapiClientType2) => {
|
|
|
34
34
|
return WapiClientType2;
|
|
35
35
|
})(WapiClientType || {});
|
|
36
36
|
function create(options) {
|
|
37
|
+
var _a;
|
|
37
38
|
const config = options.config;
|
|
39
|
+
delete options.config;
|
|
40
|
+
(_a = options.client) != null ? _a : options.client = "ws" /* ws */;
|
|
38
41
|
const { inputCopy, error } = validate(options);
|
|
39
42
|
if (error) {
|
|
40
43
|
throw error;
|
|
@@ -238,7 +238,7 @@ var ERROR_GROUPS = {
|
|
|
238
238
|
INVALID_FIELD_FOR_MODEL: {
|
|
239
239
|
code: -12301,
|
|
240
240
|
message: "INVALID_FIELD_FOR_MODEL",
|
|
241
|
-
description: `Provided
|
|
241
|
+
description: `Provided field was not found on Model`
|
|
242
242
|
},
|
|
243
243
|
NO_METADATA_ON_MODEL: {
|
|
244
244
|
code: -12302,
|
|
@@ -426,6 +426,11 @@ var ERROR_GROUPS = {
|
|
|
426
426
|
message: "TR_UNIQUE_IDENTIFIER",
|
|
427
427
|
description: `The identifier for Transfer object must be unique`
|
|
428
428
|
},
|
|
429
|
+
TR_DIFFERENT_WALLETS: {
|
|
430
|
+
code: -19116,
|
|
431
|
+
message: "TR_DIFFERENT_WALLETS",
|
|
432
|
+
description: `To and from wallets have to be different`
|
|
433
|
+
},
|
|
429
434
|
TRG_SINGLE_PENDING_TR_CANT_RV: {
|
|
430
435
|
code: -19200,
|
|
431
436
|
message: "TRG_SINGLE_PENDING_TR_CANT_RV",
|
|
@@ -491,6 +496,21 @@ var ERROR_GROUPS = {
|
|
|
491
496
|
code: -15003,
|
|
492
497
|
message: "TRANSACTION_TIMEOUT",
|
|
493
498
|
description: "Database transaction timed out"
|
|
499
|
+
},
|
|
500
|
+
CONNECTION_TIMEOUT: {
|
|
501
|
+
code: -15004,
|
|
502
|
+
message: "CONNECTION_TIMEOUT",
|
|
503
|
+
description: "Unable to get initial response in specified time"
|
|
504
|
+
},
|
|
505
|
+
SENDING_TIMEOUT: {
|
|
506
|
+
code: -15005,
|
|
507
|
+
message: "SENDING_TIMEOUT",
|
|
508
|
+
description: "Unable to get ack from server in specified time"
|
|
509
|
+
},
|
|
510
|
+
CONFIG_INVALID: {
|
|
511
|
+
code: -15100,
|
|
512
|
+
message: "CONFIG_INVALID",
|
|
513
|
+
description: "Provided configuration is invalid"
|
|
494
514
|
}
|
|
495
515
|
}
|
|
496
516
|
}
|
|
@@ -200,7 +200,7 @@ var ERROR_GROUPS = {
|
|
|
200
200
|
INVALID_FIELD_FOR_MODEL: {
|
|
201
201
|
code: -12301,
|
|
202
202
|
message: "INVALID_FIELD_FOR_MODEL",
|
|
203
|
-
description: `Provided
|
|
203
|
+
description: `Provided field was not found on Model`
|
|
204
204
|
},
|
|
205
205
|
NO_METADATA_ON_MODEL: {
|
|
206
206
|
code: -12302,
|
|
@@ -388,6 +388,11 @@ var ERROR_GROUPS = {
|
|
|
388
388
|
message: "TR_UNIQUE_IDENTIFIER",
|
|
389
389
|
description: `The identifier for Transfer object must be unique`
|
|
390
390
|
},
|
|
391
|
+
TR_DIFFERENT_WALLETS: {
|
|
392
|
+
code: -19116,
|
|
393
|
+
message: "TR_DIFFERENT_WALLETS",
|
|
394
|
+
description: `To and from wallets have to be different`
|
|
395
|
+
},
|
|
391
396
|
TRG_SINGLE_PENDING_TR_CANT_RV: {
|
|
392
397
|
code: -19200,
|
|
393
398
|
message: "TRG_SINGLE_PENDING_TR_CANT_RV",
|
|
@@ -453,6 +458,21 @@ var ERROR_GROUPS = {
|
|
|
453
458
|
code: -15003,
|
|
454
459
|
message: "TRANSACTION_TIMEOUT",
|
|
455
460
|
description: "Database transaction timed out"
|
|
461
|
+
},
|
|
462
|
+
CONNECTION_TIMEOUT: {
|
|
463
|
+
code: -15004,
|
|
464
|
+
message: "CONNECTION_TIMEOUT",
|
|
465
|
+
description: "Unable to get initial response in specified time"
|
|
466
|
+
},
|
|
467
|
+
SENDING_TIMEOUT: {
|
|
468
|
+
code: -15005,
|
|
469
|
+
message: "SENDING_TIMEOUT",
|
|
470
|
+
description: "Unable to get ack from server in specified time"
|
|
471
|
+
},
|
|
472
|
+
CONFIG_INVALID: {
|
|
473
|
+
code: -15100,
|
|
474
|
+
message: "CONFIG_INVALID",
|
|
475
|
+
description: "Provided configuration is invalid"
|
|
456
476
|
}
|
|
457
477
|
}
|
|
458
478
|
}
|
package/dist/lib/errors.cjs
CHANGED
|
@@ -238,7 +238,7 @@ var ERROR_GROUPS = {
|
|
|
238
238
|
INVALID_FIELD_FOR_MODEL: {
|
|
239
239
|
code: -12301,
|
|
240
240
|
message: "INVALID_FIELD_FOR_MODEL",
|
|
241
|
-
description: `Provided
|
|
241
|
+
description: `Provided field was not found on Model`
|
|
242
242
|
},
|
|
243
243
|
NO_METADATA_ON_MODEL: {
|
|
244
244
|
code: -12302,
|
|
@@ -426,6 +426,11 @@ var ERROR_GROUPS = {
|
|
|
426
426
|
message: "TR_UNIQUE_IDENTIFIER",
|
|
427
427
|
description: `The identifier for Transfer object must be unique`
|
|
428
428
|
},
|
|
429
|
+
TR_DIFFERENT_WALLETS: {
|
|
430
|
+
code: -19116,
|
|
431
|
+
message: "TR_DIFFERENT_WALLETS",
|
|
432
|
+
description: `To and from wallets have to be different`
|
|
433
|
+
},
|
|
429
434
|
TRG_SINGLE_PENDING_TR_CANT_RV: {
|
|
430
435
|
code: -19200,
|
|
431
436
|
message: "TRG_SINGLE_PENDING_TR_CANT_RV",
|
|
@@ -491,6 +496,21 @@ var ERROR_GROUPS = {
|
|
|
491
496
|
code: -15003,
|
|
492
497
|
message: "TRANSACTION_TIMEOUT",
|
|
493
498
|
description: "Database transaction timed out"
|
|
499
|
+
},
|
|
500
|
+
CONNECTION_TIMEOUT: {
|
|
501
|
+
code: -15004,
|
|
502
|
+
message: "CONNECTION_TIMEOUT",
|
|
503
|
+
description: "Unable to get initial response in specified time"
|
|
504
|
+
},
|
|
505
|
+
SENDING_TIMEOUT: {
|
|
506
|
+
code: -15005,
|
|
507
|
+
message: "SENDING_TIMEOUT",
|
|
508
|
+
description: "Unable to get ack from server in specified time"
|
|
509
|
+
},
|
|
510
|
+
CONFIG_INVALID: {
|
|
511
|
+
code: -15100,
|
|
512
|
+
message: "CONFIG_INVALID",
|
|
513
|
+
description: "Provided configuration is invalid"
|
|
494
514
|
}
|
|
495
515
|
}
|
|
496
516
|
}
|