@basis-theory/basis-theory-js 1.71.2 → 1.71.4
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/BasisTheory.js +12 -28
- package/common/constants.d.ts +1 -2
- package/common/constants.js +1 -3
- package/package.json +1 -1
- package/service/BasisTheoryService.js +2 -4
- package/service/types.d.ts +0 -1
- package/types/sdk/sdk.d.ts +0 -1
package/BasisTheory.js
CHANGED
|
@@ -32,11 +32,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
32
32
|
const defaultInitOptions = {
|
|
33
33
|
apiBaseUrl: _common.DEFAULT_BASE_URL,
|
|
34
34
|
elements: false,
|
|
35
|
-
appInfo: {}
|
|
36
|
-
httpsAgent: {
|
|
37
|
-
keepAlive: true,
|
|
38
|
-
keepAliveMsecs: _common.DEFAULT_KEEPALIVE_TIMEOUT_MS
|
|
39
|
-
}
|
|
35
|
+
appInfo: {}
|
|
40
36
|
};
|
|
41
37
|
|
|
42
38
|
class BasisTheory {
|
|
@@ -77,72 +73,60 @@ class BasisTheory {
|
|
|
77
73
|
await this.loadElements(apiKey);
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
const httpsAgent = this._initOptions.httpsAgent;
|
|
81
76
|
this._tokens = new ((0, _elements.delegateTokens)(this._elements))({
|
|
82
77
|
apiKey,
|
|
83
78
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.tokens, baseUrl).toString(),
|
|
84
|
-
appInfo
|
|
85
|
-
httpsAgent
|
|
79
|
+
appInfo
|
|
86
80
|
});
|
|
87
81
|
this._tokenize = new ((0, _elements.delegateTokenize)(this._elements))({
|
|
88
82
|
apiKey,
|
|
89
83
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.tokenize, baseUrl).toString(),
|
|
90
|
-
appInfo
|
|
91
|
-
httpsAgent
|
|
84
|
+
appInfo
|
|
92
85
|
});
|
|
93
86
|
this._applications = new _applications.BasisTheoryApplications({
|
|
94
87
|
apiKey,
|
|
95
88
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.applications, baseUrl).toString(),
|
|
96
|
-
appInfo
|
|
97
|
-
httpsAgent
|
|
89
|
+
appInfo
|
|
98
90
|
});
|
|
99
91
|
this._tenants = new _tenants.BasisTheoryTenants({
|
|
100
92
|
apiKey,
|
|
101
93
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.tenants, baseUrl).toString(),
|
|
102
|
-
appInfo
|
|
103
|
-
httpsAgent
|
|
94
|
+
appInfo
|
|
104
95
|
});
|
|
105
96
|
this._logs = new _logs.BasisTheoryLogs({
|
|
106
97
|
apiKey,
|
|
107
98
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.logs, baseUrl).toString(),
|
|
108
|
-
appInfo
|
|
109
|
-
httpsAgent
|
|
99
|
+
appInfo
|
|
110
100
|
});
|
|
111
101
|
this._reactorFormulas = new _reactorFormulas.BasisTheoryReactorFormulas({
|
|
112
102
|
apiKey,
|
|
113
103
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.reactorFormulas, baseUrl).toString(),
|
|
114
|
-
appInfo
|
|
115
|
-
httpsAgent
|
|
104
|
+
appInfo
|
|
116
105
|
});
|
|
117
106
|
this._reactors = new _reactors.BasisTheoryReactors({
|
|
118
107
|
apiKey,
|
|
119
108
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.reactors, baseUrl).toString(),
|
|
120
|
-
appInfo
|
|
121
|
-
httpsAgent
|
|
109
|
+
appInfo
|
|
122
110
|
});
|
|
123
111
|
this._permissions = new _permissions.BasisTheoryPermissions({
|
|
124
112
|
apiKey,
|
|
125
113
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.permissions, baseUrl).toString(),
|
|
126
|
-
appInfo
|
|
127
|
-
httpsAgent
|
|
114
|
+
appInfo
|
|
128
115
|
});
|
|
129
116
|
this._proxies = new _proxies.BasisTheoryProxies({
|
|
130
117
|
apiKey,
|
|
131
118
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.proxies, baseUrl).toString(),
|
|
132
|
-
appInfo
|
|
133
|
-
httpsAgent
|
|
119
|
+
appInfo
|
|
134
120
|
});
|
|
135
121
|
this._proxy = new ((0, _elements.delegateProxy)(this._elements))({
|
|
136
122
|
apiKey,
|
|
137
123
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.proxy, baseUrl).toString(),
|
|
138
|
-
appInfo
|
|
139
|
-
httpsAgent
|
|
124
|
+
appInfo
|
|
140
125
|
});
|
|
141
126
|
this._sessions = new _sessions.BasisTheorySessions({
|
|
142
127
|
apiKey,
|
|
143
128
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.sessions, baseUrl).toString(),
|
|
144
|
-
appInfo
|
|
145
|
-
httpsAgent
|
|
129
|
+
appInfo
|
|
146
130
|
});
|
|
147
131
|
this._initStatus = 'done';
|
|
148
132
|
} catch (error) {
|
package/common/constants.d.ts
CHANGED
|
@@ -8,10 +8,9 @@ declare const CLIENT_USER_AGENT_HEADER = "BT-CLIENT-USER-AGENT";
|
|
|
8
8
|
declare const USER_AGENT_CLIENT = "BasisTheoryJS";
|
|
9
9
|
declare const DEFAULT_BASE_URL: string;
|
|
10
10
|
declare const DEFAULT_ELEMENTS_BASE_URL: string;
|
|
11
|
-
declare const DEFAULT_KEEPALIVE_TIMEOUT_MS = 5000;
|
|
12
11
|
declare const CLIENT_BASE_PATHS: BasisTheoryServicesBasePathMap;
|
|
13
12
|
declare const BROWSER_LIST: {
|
|
14
13
|
browserName: string;
|
|
15
14
|
browserUA: string;
|
|
16
15
|
}[];
|
|
17
|
-
export { API_KEY_HEADER, BT_TRACE_ID_HEADER, BT_IDEMPOTENCY_KEY_HEADER, CONTENT_TYPE_HEADER, USER_AGENT_HEADER, CLIENT_USER_AGENT_HEADER, USER_AGENT_CLIENT, DEFAULT_BASE_URL, DEFAULT_ELEMENTS_BASE_URL, CLIENT_BASE_PATHS, BROWSER_LIST,
|
|
16
|
+
export { API_KEY_HEADER, BT_TRACE_ID_HEADER, BT_IDEMPOTENCY_KEY_HEADER, CONTENT_TYPE_HEADER, USER_AGENT_HEADER, CLIENT_USER_AGENT_HEADER, USER_AGENT_CLIENT, DEFAULT_BASE_URL, DEFAULT_ELEMENTS_BASE_URL, CLIENT_BASE_PATHS, BROWSER_LIST, };
|
package/common/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.USER_AGENT_HEADER = exports.USER_AGENT_CLIENT = exports.
|
|
6
|
+
exports.USER_AGENT_HEADER = exports.USER_AGENT_CLIENT = exports.DEFAULT_ELEMENTS_BASE_URL = exports.DEFAULT_BASE_URL = exports.CONTENT_TYPE_HEADER = exports.CLIENT_USER_AGENT_HEADER = exports.CLIENT_BASE_PATHS = exports.BT_TRACE_ID_HEADER = exports.BT_IDEMPOTENCY_KEY_HEADER = exports.BROWSER_LIST = exports.API_KEY_HEADER = void 0;
|
|
7
7
|
const API_KEY_HEADER = 'BT-API-KEY';
|
|
8
8
|
exports.API_KEY_HEADER = API_KEY_HEADER;
|
|
9
9
|
const BT_TRACE_ID_HEADER = 'bt-trace-id';
|
|
@@ -22,8 +22,6 @@ const DEFAULT_BASE_URL = `https://${"api.basistheory.com"}`;
|
|
|
22
22
|
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL;
|
|
23
23
|
const DEFAULT_ELEMENTS_BASE_URL = `https://${"js.basistheory.com/hosted-elements"}`;
|
|
24
24
|
exports.DEFAULT_ELEMENTS_BASE_URL = DEFAULT_ELEMENTS_BASE_URL;
|
|
25
|
-
const DEFAULT_KEEPALIVE_TIMEOUT_MS = 5000;
|
|
26
|
-
exports.DEFAULT_KEEPALIVE_TIMEOUT_MS = DEFAULT_KEEPALIVE_TIMEOUT_MS;
|
|
27
25
|
const CLIENT_BASE_PATHS = {
|
|
28
26
|
tokens: 'tokens',
|
|
29
27
|
tokenize: 'tokenize',
|
package/package.json
CHANGED
|
@@ -18,8 +18,7 @@ class BasisTheoryService {
|
|
|
18
18
|
baseURL,
|
|
19
19
|
transformRequest,
|
|
20
20
|
transformResponse,
|
|
21
|
-
appInfo
|
|
22
|
-
httpsAgent
|
|
21
|
+
appInfo
|
|
23
22
|
} = options;
|
|
24
23
|
this.client = _axios.default.create({
|
|
25
24
|
baseURL,
|
|
@@ -33,8 +32,7 @@ class BasisTheoryService {
|
|
|
33
32
|
|
|
34
33
|
/* eslint-disable unicorn/prefer-spread */
|
|
35
34
|
transformRequest: [].concat(transformRequest || _common.transformRequestSnakeCase, _axios.default.defaults.transformRequest),
|
|
36
|
-
transformResponse: _axios.default.defaults.transformResponse.concat(transformResponse || _common.transformResponseCamelCase)
|
|
37
|
-
httpsAgent
|
|
35
|
+
transformResponse: _axios.default.defaults.transformResponse.concat(transformResponse || _common.transformResponseCamelCase)
|
|
38
36
|
/* eslint-enable unicorn/prefer-spread */
|
|
39
37
|
|
|
40
38
|
});
|
package/service/types.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ interface BasisTheoryServiceOptions extends Pick<AxiosRequestConfig, 'transformR
|
|
|
4
4
|
apiKey: string;
|
|
5
5
|
baseURL: string;
|
|
6
6
|
appInfo?: ApplicationInfo;
|
|
7
|
-
httpsAgent?: any;
|
|
8
7
|
}
|
|
9
8
|
declare type RequestTransformers = Pick<AxiosRequestConfig, 'transformRequest' | 'transformResponse'>;
|
|
10
9
|
export type { BasisTheoryServiceOptions, RequestTransformers };
|
package/types/sdk/sdk.d.ts
CHANGED