@basis-theory/basis-theory-js 1.69.4 → 1.70.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/BasisTheory.js CHANGED
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BasisTheory = void 0;
7
7
 
8
+ var _axios = _interopRequireDefault(require("axios"));
9
+
8
10
  var _applications = require("./applications");
9
11
 
10
12
  var _common = require("./common");
@@ -27,12 +29,15 @@ var _sessions = require("./sessions");
27
29
 
28
30
  var _tenants = require("./tenants");
29
31
 
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+
30
34
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
35
 
32
36
  const defaultInitOptions = {
33
37
  apiBaseUrl: _common.DEFAULT_BASE_URL,
34
38
  elements: false,
35
- appInfo: {}
39
+ appInfo: {},
40
+ httpsAgent: _axios.default.defaults.httpsAgent
36
41
  };
37
42
 
38
43
  class BasisTheory {
@@ -73,60 +78,72 @@ class BasisTheory {
73
78
  await this.loadElements(apiKey);
74
79
  }
75
80
 
81
+ const httpsAgent = this._initOptions.httpsAgent;
76
82
  this._tokens = new ((0, _elements.delegateTokens)(this._elements))({
77
83
  apiKey,
78
84
  baseURL: new URL(_common.CLIENT_BASE_PATHS.tokens, baseUrl).toString(),
79
- appInfo
85
+ appInfo,
86
+ httpsAgent
80
87
  });
81
88
  this._tokenize = new ((0, _elements.delegateTokenize)(this._elements))({
82
89
  apiKey,
83
90
  baseURL: new URL(_common.CLIENT_BASE_PATHS.tokenize, baseUrl).toString(),
84
- appInfo
91
+ appInfo,
92
+ httpsAgent
85
93
  });
86
94
  this._applications = new _applications.BasisTheoryApplications({
87
95
  apiKey,
88
96
  baseURL: new URL(_common.CLIENT_BASE_PATHS.applications, baseUrl).toString(),
89
- appInfo
97
+ appInfo,
98
+ httpsAgent
90
99
  });
91
100
  this._tenants = new _tenants.BasisTheoryTenants({
92
101
  apiKey,
93
102
  baseURL: new URL(_common.CLIENT_BASE_PATHS.tenants, baseUrl).toString(),
94
- appInfo
103
+ appInfo,
104
+ httpsAgent
95
105
  });
96
106
  this._logs = new _logs.BasisTheoryLogs({
97
107
  apiKey,
98
108
  baseURL: new URL(_common.CLIENT_BASE_PATHS.logs, baseUrl).toString(),
99
- appInfo
109
+ appInfo,
110
+ httpsAgent
100
111
  });
101
112
  this._reactorFormulas = new _reactorFormulas.BasisTheoryReactorFormulas({
102
113
  apiKey,
103
114
  baseURL: new URL(_common.CLIENT_BASE_PATHS.reactorFormulas, baseUrl).toString(),
104
- appInfo
115
+ appInfo,
116
+ httpsAgent
105
117
  });
106
118
  this._reactors = new _reactors.BasisTheoryReactors({
107
119
  apiKey,
108
120
  baseURL: new URL(_common.CLIENT_BASE_PATHS.reactors, baseUrl).toString(),
109
- appInfo
121
+ appInfo,
122
+ httpsAgent
110
123
  });
111
124
  this._permissions = new _permissions.BasisTheoryPermissions({
112
125
  apiKey,
113
126
  baseURL: new URL(_common.CLIENT_BASE_PATHS.permissions, baseUrl).toString(),
114
- appInfo
127
+ appInfo,
128
+ httpsAgent
115
129
  });
116
130
  this._proxies = new _proxies.BasisTheoryProxies({
117
131
  apiKey,
118
132
  baseURL: new URL(_common.CLIENT_BASE_PATHS.proxies, baseUrl).toString(),
119
- appInfo
133
+ appInfo,
134
+ httpsAgent
120
135
  });
121
136
  this._proxy = new ((0, _elements.delegateProxy)(this._elements))({
122
137
  apiKey,
123
138
  baseURL: new URL(_common.CLIENT_BASE_PATHS.proxy, baseUrl).toString(),
124
- appInfo
139
+ appInfo,
140
+ httpsAgent
125
141
  });
126
142
  this._sessions = new _sessions.BasisTheorySessions({
127
143
  apiKey,
128
144
  baseURL: new URL(_common.CLIENT_BASE_PATHS.sessions, baseUrl).toString(),
129
- appInfo
145
+ appInfo,
146
+ httpsAgent
130
147
  });
131
148
  this._initStatus = 'done';
132
149
  } catch (error) {
@@ -20,7 +20,7 @@ const USER_AGENT_CLIENT = 'BasisTheoryJS';
20
20
  exports.USER_AGENT_CLIENT = USER_AGENT_CLIENT;
21
21
  const DEFAULT_BASE_URL = `https://${"api.basistheory.com"}`;
22
22
  exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL;
23
- const DEFAULT_ELEMENTS_BASE_URL = `https://${"elements.basistheory.com"}`;
23
+ const DEFAULT_ELEMENTS_BASE_URL = `https://${"js.basistheory.com/hosted-elements"}`;
24
24
  exports.DEFAULT_ELEMENTS_BASE_URL = DEFAULT_ELEMENTS_BASE_URL;
25
25
  const CLIENT_BASE_PATHS = {
26
26
  tokens: 'tokens',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.69.4",
3
+ "version": "1.70.1",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -18,7 +18,8 @@ class BasisTheoryService {
18
18
  baseURL,
19
19
  transformRequest,
20
20
  transformResponse,
21
- appInfo
21
+ appInfo,
22
+ httpsAgent
22
23
  } = options;
23
24
  this.client = _axios.default.create({
24
25
  baseURL,
@@ -32,7 +33,8 @@ class BasisTheoryService {
32
33
 
33
34
  /* eslint-disable unicorn/prefer-spread */
34
35
  transformRequest: [].concat(transformRequest || _common.transformRequestSnakeCase, _axios.default.defaults.transformRequest),
35
- transformResponse: _axios.default.defaults.transformResponse.concat(transformResponse || _common.transformResponseCamelCase)
36
+ transformResponse: _axios.default.defaults.transformResponse.concat(transformResponse || _common.transformResponseCamelCase),
37
+ httpsAgent
36
38
  /* eslint-enable unicorn/prefer-spread */
37
39
 
38
40
  });
@@ -1,9 +1,12 @@
1
+ /// <reference types="node" />
1
2
  import type { AxiosRequestConfig } from 'axios';
3
+ import https from 'https';
2
4
  import type { ApplicationInfo } from '../types/sdk';
3
5
  interface BasisTheoryServiceOptions extends Pick<AxiosRequestConfig, 'transformRequest' | 'transformResponse'> {
4
6
  apiKey: string;
5
7
  baseURL: string;
6
8
  appInfo?: ApplicationInfo;
9
+ httpsAgent?: https.Agent;
7
10
  }
8
11
  declare type RequestTransformers = Pick<AxiosRequestConfig, 'transformRequest' | 'transformResponse'>;
9
12
  export type { BasisTheoryServiceOptions, RequestTransformers };
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ import https from 'https';
1
3
  import type { BasisTheoryElements } from '../../types/elements';
2
4
  import type { Tokens, Tokenize, Applications, Tenants, Logs, ReactorFormulas, Reactors, Permissions, Proxies, Proxy, Sessions } from './services';
3
5
  interface ApplicationInfo {
@@ -8,6 +10,7 @@ interface ApplicationInfo {
8
10
  interface BasisTheoryInitOptions {
9
11
  apiBaseUrl?: string;
10
12
  appInfo?: ApplicationInfo;
13
+ httpsAgent?: https.Agent;
11
14
  }
12
15
  interface BasisTheoryInitOptionsWithoutElements extends BasisTheoryInitOptions {
13
16
  elements?: false;