wapi-client 0.8.1 → 0.8.3
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/http-client.browser.cjs +4 -538
- package/dist/api/http-client.browser.js +4 -548
- package/dist/api/http-client.cjs +4 -14
- package/dist/api/http-client.js +2 -2
- package/dist/api/ws-client.cjs +1 -1
- package/dist/api/ws-client.js +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/fns/create-access-token/create-access-token.browser.cjs +24 -1
- package/dist/fns/create-access-token/create-access-token.browser.js +24 -1
- package/dist/fns/create-access-token/create-access-token.cjs +24 -1
- package/dist/fns/create-access-token/create-access-token.enums.d.ts +14 -2
- package/dist/fns/create-access-token/create-access-token.js +24 -1
- package/dist/fns/create-access-token/create-access-token.schema.input.json +50 -1
- package/dist/lib/isomorphic/node/fetch.cjs +6732 -0
- package/dist/lib/isomorphic/node/fetch.d.ts +2 -0
- package/dist/lib/isomorphic/node/fetch.js +6731 -0
- package/dist/lib/isomorphic/web/fetch.browser.cjs +26 -0
- package/dist/lib/isomorphic/web/fetch.browser.js +6 -0
- package/dist/txs/create-access-token/create-access-token.schema.input.json +0 -6
- package/dist/types/index.d.ts +20 -3
- package/dist/wapi-client-web.iife.js +6 -7
- package/dist/wapi-client.iife.js +6 -7
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -66,7 +66,7 @@ var import_errors = require('./lib/errors.cjs');
|
|
|
66
66
|
var import_fns = require('./fns/index.cjs');
|
|
67
67
|
var import_import_data = require('./fns/import-data/import-data.guards.cjs');
|
|
68
68
|
var _a;
|
|
69
|
-
var CLIENT_VERSION = (_a = '0.8.
|
|
69
|
+
var CLIENT_VERSION = (_a = '0.8.3') != null ? _a : "";
|
|
70
70
|
var Client = class {
|
|
71
71
|
/**
|
|
72
72
|
* @internal
|
package/dist/client.js
CHANGED
|
@@ -25,8 +25,19 @@ __export(create_access_token_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(create_access_token_exports);
|
|
26
26
|
var import_utils = require('../../lib/utils.cjs');
|
|
27
27
|
var import_validator = require('../../lib/validator.cjs');
|
|
28
|
+
var clientFnToTxMap = new Map(
|
|
29
|
+
Object.entries({
|
|
30
|
+
aggregateTransfers: "aggregateTransferMany",
|
|
31
|
+
findBalances: "findBalanceMany",
|
|
32
|
+
findTokens: "findTokenMany",
|
|
33
|
+
findTransferGroups: "findTransferGroupMany",
|
|
34
|
+
findTransfers: "findTransferMany",
|
|
35
|
+
findWallets: "findWalletMany"
|
|
36
|
+
})
|
|
37
|
+
);
|
|
28
38
|
var validate = (0, import_validator.getValidator)(import_validator.SchemaNames.CreateAccessTokenFnInput);
|
|
29
39
|
function createAccessToken(options, input, fnOptions) {
|
|
40
|
+
var _a;
|
|
30
41
|
const { client } = options;
|
|
31
42
|
const { inputCopy, error } = (0, import_utils.validateClientFnInput)({
|
|
32
43
|
input,
|
|
@@ -36,8 +47,20 @@ function createAccessToken(options, input, fnOptions) {
|
|
|
36
47
|
if (error) {
|
|
37
48
|
throw error;
|
|
38
49
|
}
|
|
50
|
+
if (inputCopy.token && "scopes" in inputCopy.token) {
|
|
51
|
+
inputCopy.token.scopes = Array.from(
|
|
52
|
+
new Set(
|
|
53
|
+
(_a = inputCopy.token) == null ? void 0 : _a.scopes.map(
|
|
54
|
+
(scope) => {
|
|
55
|
+
var _a2;
|
|
56
|
+
return (_a2 = clientFnToTxMap.get(scope)) != null ? _a2 : scope;
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
39
62
|
return client.api.createAccessToken({
|
|
40
63
|
token: inputCopy.token,
|
|
41
|
-
options
|
|
64
|
+
options: fnOptions
|
|
42
65
|
});
|
|
43
66
|
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
// src/fns/create-access-token/create-access-token.ts
|
|
2
2
|
import { validateClientFnInput } from "../../lib/utils.browser.js";
|
|
3
3
|
import { getValidator, SchemaNames } from "../../lib/validator.browser.js";
|
|
4
|
+
var clientFnToTxMap = new Map(
|
|
5
|
+
Object.entries({
|
|
6
|
+
aggregateTransfers: "aggregateTransferMany",
|
|
7
|
+
findBalances: "findBalanceMany",
|
|
8
|
+
findTokens: "findTokenMany",
|
|
9
|
+
findTransferGroups: "findTransferGroupMany",
|
|
10
|
+
findTransfers: "findTransferMany",
|
|
11
|
+
findWallets: "findWalletMany"
|
|
12
|
+
})
|
|
13
|
+
);
|
|
4
14
|
var validate = getValidator(SchemaNames.CreateAccessTokenFnInput);
|
|
5
15
|
function createAccessToken(options, input, fnOptions) {
|
|
16
|
+
var _a;
|
|
6
17
|
const { client } = options;
|
|
7
18
|
const { inputCopy, error } = validateClientFnInput({
|
|
8
19
|
input,
|
|
@@ -12,9 +23,21 @@ function createAccessToken(options, input, fnOptions) {
|
|
|
12
23
|
if (error) {
|
|
13
24
|
throw error;
|
|
14
25
|
}
|
|
26
|
+
if (inputCopy.token && "scopes" in inputCopy.token) {
|
|
27
|
+
inputCopy.token.scopes = Array.from(
|
|
28
|
+
new Set(
|
|
29
|
+
(_a = inputCopy.token) == null ? void 0 : _a.scopes.map(
|
|
30
|
+
(scope) => {
|
|
31
|
+
var _a2;
|
|
32
|
+
return (_a2 = clientFnToTxMap.get(scope)) != null ? _a2 : scope;
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
15
38
|
return client.api.createAccessToken({
|
|
16
39
|
token: inputCopy.token,
|
|
17
|
-
options
|
|
40
|
+
options: fnOptions
|
|
18
41
|
});
|
|
19
42
|
}
|
|
20
43
|
export {
|
|
@@ -25,8 +25,19 @@ __export(create_access_token_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(create_access_token_exports);
|
|
26
26
|
var import_utils = require('../../lib/utils.cjs');
|
|
27
27
|
var import_validator = require('../../lib/validator.cjs');
|
|
28
|
+
var clientFnToTxMap = new Map(
|
|
29
|
+
Object.entries({
|
|
30
|
+
aggregateTransfers: "aggregateTransferMany",
|
|
31
|
+
findBalances: "findBalanceMany",
|
|
32
|
+
findTokens: "findTokenMany",
|
|
33
|
+
findTransferGroups: "findTransferGroupMany",
|
|
34
|
+
findTransfers: "findTransferMany",
|
|
35
|
+
findWallets: "findWalletMany"
|
|
36
|
+
})
|
|
37
|
+
);
|
|
28
38
|
var validate = (0, import_validator.getValidator)(import_validator.SchemaNames.CreateAccessTokenFnInput);
|
|
29
39
|
function createAccessToken(options, input, fnOptions) {
|
|
40
|
+
var _a;
|
|
30
41
|
const { client } = options;
|
|
31
42
|
const { inputCopy, error } = (0, import_utils.validateClientFnInput)({
|
|
32
43
|
input,
|
|
@@ -36,9 +47,21 @@ function createAccessToken(options, input, fnOptions) {
|
|
|
36
47
|
if (error) {
|
|
37
48
|
throw error;
|
|
38
49
|
}
|
|
50
|
+
if (inputCopy.token && "scopes" in inputCopy.token) {
|
|
51
|
+
inputCopy.token.scopes = Array.from(
|
|
52
|
+
new Set(
|
|
53
|
+
(_a = inputCopy.token) == null ? void 0 : _a.scopes.map(
|
|
54
|
+
(scope) => {
|
|
55
|
+
var _a2;
|
|
56
|
+
return (_a2 = clientFnToTxMap.get(scope)) != null ? _a2 : scope;
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
39
62
|
return client.api.createAccessToken({
|
|
40
63
|
token: inputCopy.token,
|
|
41
|
-
options
|
|
64
|
+
options: fnOptions
|
|
42
65
|
});
|
|
43
66
|
}
|
|
44
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateAccessTokenAdmin, CreateAccessTokenTxOptions, CreateAccessTokenForcedFilters, CreateAccessTokenTxOutput } from '../../txs/create-access-token/create-access-token.enums';
|
|
2
|
+
export interface CreateAccessTokenFnLimited {
|
|
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')[];
|
|
5
|
+
/**
|
|
6
|
+
* JWT expiration time in minutes
|
|
7
|
+
*/
|
|
8
|
+
expiresIn: number;
|
|
9
|
+
/**
|
|
10
|
+
* Forced filters for requests
|
|
11
|
+
*/
|
|
12
|
+
filters?: CreateAccessTokenForcedFilters;
|
|
13
|
+
}
|
|
2
14
|
/**
|
|
3
15
|
* Optional flags for input
|
|
4
16
|
*/
|
|
@@ -12,7 +24,7 @@ export interface CreateAccessTokenFnInput {
|
|
|
12
24
|
/**
|
|
13
25
|
* Properties of the token to create
|
|
14
26
|
*/
|
|
15
|
-
token?:
|
|
27
|
+
token?: CreateAccessTokenFnLimited | CreateAccessTokenAdmin;
|
|
16
28
|
options?: CreateAccessTokenFnOptions;
|
|
17
29
|
}
|
|
18
30
|
/**
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
// src/fns/create-access-token/create-access-token.ts
|
|
2
2
|
import { validateClientFnInput } from "../../lib/utils";
|
|
3
3
|
import { getValidator, SchemaNames } from "../../lib/validator";
|
|
4
|
+
var clientFnToTxMap = new Map(
|
|
5
|
+
Object.entries({
|
|
6
|
+
aggregateTransfers: "aggregateTransferMany",
|
|
7
|
+
findBalances: "findBalanceMany",
|
|
8
|
+
findTokens: "findTokenMany",
|
|
9
|
+
findTransferGroups: "findTransferGroupMany",
|
|
10
|
+
findTransfers: "findTransferMany",
|
|
11
|
+
findWallets: "findWalletMany"
|
|
12
|
+
})
|
|
13
|
+
);
|
|
4
14
|
var validate = getValidator(SchemaNames.CreateAccessTokenFnInput);
|
|
5
15
|
function createAccessToken(options, input, fnOptions) {
|
|
16
|
+
var _a;
|
|
6
17
|
const { client } = options;
|
|
7
18
|
const { inputCopy, error } = validateClientFnInput({
|
|
8
19
|
input,
|
|
@@ -12,9 +23,21 @@ function createAccessToken(options, input, fnOptions) {
|
|
|
12
23
|
if (error) {
|
|
13
24
|
throw error;
|
|
14
25
|
}
|
|
26
|
+
if (inputCopy.token && "scopes" in inputCopy.token) {
|
|
27
|
+
inputCopy.token.scopes = Array.from(
|
|
28
|
+
new Set(
|
|
29
|
+
(_a = inputCopy.token) == null ? void 0 : _a.scopes.map(
|
|
30
|
+
(scope) => {
|
|
31
|
+
var _a2;
|
|
32
|
+
return (_a2 = clientFnToTxMap.get(scope)) != null ? _a2 : scope;
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
15
38
|
return client.api.createAccessToken({
|
|
16
39
|
token: inputCopy.token,
|
|
17
|
-
options
|
|
40
|
+
options: fnOptions
|
|
18
41
|
});
|
|
19
42
|
}
|
|
20
43
|
export {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"description": "Properties of the token to create",
|
|
10
10
|
"anyOf": [
|
|
11
11
|
{
|
|
12
|
-
"$ref": "
|
|
12
|
+
"$ref": "#/definitions/create_access_token_fn_limited"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"$ref": "/txs/create-access-token/create-access-token.schema.input.json#/definitions/create_access_token_admin"
|
|
@@ -29,6 +29,55 @@
|
|
|
29
29
|
"$ref": "/txs/create-access-token/create-access-token.schema.input.json#/definitions/create_access_token_tx_options"
|
|
30
30
|
}
|
|
31
31
|
]
|
|
32
|
+
},
|
|
33
|
+
"create_access_token_fn_limited": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"type": {
|
|
37
|
+
"enum": ["limited"]
|
|
38
|
+
},
|
|
39
|
+
"scopes": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": [
|
|
44
|
+
"aggregateTransfers",
|
|
45
|
+
"findBalances",
|
|
46
|
+
"findTokens",
|
|
47
|
+
"findTransferGroups",
|
|
48
|
+
"findTransfers",
|
|
49
|
+
"findWallets",
|
|
50
|
+
|
|
51
|
+
"aggregateTransferMany",
|
|
52
|
+
"findBalanceMany",
|
|
53
|
+
"findTokenMany",
|
|
54
|
+
"findTransferGroupMany",
|
|
55
|
+
"findTransferMany",
|
|
56
|
+
"findWalletMany",
|
|
57
|
+
"getBalance",
|
|
58
|
+
"getBalanceHistory",
|
|
59
|
+
"getStatistics",
|
|
60
|
+
"getToken",
|
|
61
|
+
"getTokenMany",
|
|
62
|
+
"getTransfer",
|
|
63
|
+
"getTransferGroup",
|
|
64
|
+
"getWallet",
|
|
65
|
+
"getWalletMany"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"filters": {
|
|
70
|
+
"description": "Forced filters for requests",
|
|
71
|
+
"type": "object",
|
|
72
|
+
"$ref": "/txs/create-access-token/create-access-token.schema.input.json#/definitions/create_access_token_forced_filters"
|
|
73
|
+
},
|
|
74
|
+
"expiresIn": {
|
|
75
|
+
"description": "JWT expiration time in minutes",
|
|
76
|
+
"type": "number"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"required": ["scopes", "type", "expiresIn"],
|
|
80
|
+
"additionalProperties": false
|
|
32
81
|
}
|
|
33
82
|
},
|
|
34
83
|
"additionalProperties": false
|