@dfns/sdk 0.5.8 → 0.5.9-rc.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/generated/auth/client.js +1 -1
- package/generated/auth/delegatedClient.js +1 -1
- package/generated/auth/types.d.ts +3 -3
- package/generated/exchanges/types.d.ts +1 -1
- package/generated/networks/types.d.ts +2 -2
- package/generated/policies/types.d.ts +75 -72
- package/generated/wallets/client.js +1 -1
- package/generated/wallets/delegatedClient.js +1 -1
- package/generated/wallets/types.d.ts +62 -44
- package/package.json +1 -1
- package/signer.d.ts +1 -1
- package/utils/fetch.d.ts +1 -0
- package/utils/fetch.js +13 -2
- package/utils/userActionFetch.js +1 -1
package/utils/fetch.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.simpleFetch = exports.dfnsAuth = exports.catchPolicyPending = exports.errorHandler = exports.jsonSerializer = exports.fullUrl = void 0;
|
|
3
|
+
exports.simpleFetch = exports.dfnsAuth = exports.catchPolicyPending = exports.errorHandler = exports.jsonSerializer = exports.userAgent = exports.fullUrl = void 0;
|
|
4
4
|
const cross_fetch_1 = require("cross-fetch");
|
|
5
5
|
const nonce_1 = require("./nonce");
|
|
6
6
|
const dfnsError_1 = require("../dfnsError");
|
|
7
7
|
const DEFAULT_DFNS_BASE_URL = 'https://api.dfns.io';
|
|
8
|
+
const package_json_1 = require("../package.json");
|
|
8
9
|
const fullUrl = (fetch) => {
|
|
9
10
|
return async (resource, options) => {
|
|
10
11
|
const baseUrl = options.apiOptions.baseUrl || DEFAULT_DFNS_BASE_URL;
|
|
@@ -13,6 +14,16 @@ const fullUrl = (fetch) => {
|
|
|
13
14
|
};
|
|
14
15
|
};
|
|
15
16
|
exports.fullUrl = fullUrl;
|
|
17
|
+
const userAgent = (fetch) => {
|
|
18
|
+
return async (resource, options) => {
|
|
19
|
+
options.headers = {
|
|
20
|
+
'x-dfns-sdk-version': package_json_1.version,
|
|
21
|
+
...(options.headers ?? {}),
|
|
22
|
+
};
|
|
23
|
+
return fetch(resource, options);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.userAgent = userAgent;
|
|
16
27
|
const jsonSerializer = (fetch) => {
|
|
17
28
|
return async (resource, options) => {
|
|
18
29
|
if (options.body) {
|
|
@@ -81,4 +92,4 @@ const dfnsAuth = (fetch) => {
|
|
|
81
92
|
};
|
|
82
93
|
};
|
|
83
94
|
exports.dfnsAuth = dfnsAuth;
|
|
84
|
-
exports.simpleFetch = (0, exports.fullUrl)((0, exports.jsonSerializer)((0, exports.dfnsAuth)((0, exports.catchPolicyPending)((0, exports.errorHandler)(cross_fetch_1.fetch)))));
|
|
95
|
+
exports.simpleFetch = (0, exports.fullUrl)((0, exports.jsonSerializer)((0, exports.dfnsAuth)((0, exports.catchPolicyPending)((0, exports.errorHandler)((0, exports.userAgent)(cross_fetch_1.fetch))))));
|
package/utils/userActionFetch.js
CHANGED
|
@@ -38,4 +38,4 @@ const userAction = (fetch) => {
|
|
|
38
38
|
return fetch(resource, options);
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
exports.userActionFetch = (0, fetch_1.fullUrl)((0, fetch_1.jsonSerializer)((0, fetch_1.dfnsAuth)(userAction((0, fetch_1.catchPolicyPending)((0, fetch_1.errorHandler)(cross_fetch_1.fetch))))));
|
|
41
|
+
exports.userActionFetch = (0, fetch_1.fullUrl)((0, fetch_1.jsonSerializer)((0, fetch_1.dfnsAuth)(userAction((0, fetch_1.catchPolicyPending)((0, fetch_1.errorHandler)((0, fetch_1.userAgent)(cross_fetch_1.fetch)))))));
|