@basis-theory/basis-theory-js 1.22.2 → 1.25.0

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.d.ts CHANGED
@@ -28,7 +28,13 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
28
28
  get logs(): Logs;
29
29
  get reactorFormulas(): ReactorFormulas;
30
30
  get reactors(): Reactors;
31
+ /**
32
+ * @deprecated use {@link tokens} or {@link tokenize}
33
+ */
31
34
  get atomicBanks(): AtomicBanks & ElementsAtomicBanks;
35
+ /**
36
+ * @deprecated use {@link tokens} or {@link tokenize}
37
+ */
32
38
  get atomicCards(): AtomicCards & ElementsAtomicCards;
33
39
  get permissions(): Permissions;
34
40
  /**
package/BasisTheory.js CHANGED
@@ -187,10 +187,18 @@ class BasisTheory {
187
187
  get reactors() {
188
188
  return (0, _common.assertInit)(this._reactors);
189
189
  }
190
+ /**
191
+ * @deprecated use {@link tokens} or {@link tokenize}
192
+ */
193
+
190
194
 
191
195
  get atomicBanks() {
192
196
  return (0, _common.assertInit)(this._atomicBanks);
193
197
  }
198
+ /**
199
+ * @deprecated use {@link tokens} or {@link tokenize}
200
+ */
201
+
194
202
 
195
203
  get atomicCards() {
196
204
  return (0, _common.assertInit)(this._atomicCards);
@@ -1,11 +1,11 @@
1
- import type { AtomicBank, ReactRequest, ReactResponse, UpdateAtomicBank } from '@basis-theory/basis-theory-elements-interfaces/models';
1
+ import type { AtomicBank, AtomicReactRequest, ReactResponse, UpdateAtomicBank } from '@basis-theory/basis-theory-elements-interfaces/models';
2
2
  import type { PaginatedQuery, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
3
  import type { BasisTheoryServiceOptions } from '../../service';
4
4
  export declare const BasisTheoryAtomicBanks: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
6
  update(id: string, request: UpdateAtomicBank, options?: RequestOptions | undefined): Promise<AtomicBank>;
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicBank>;
8
- react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
8
+ react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
9
9
  readonly client: import("axios").AxiosInstance;
10
10
  };
11
11
  } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<AtomicBank, Pick<AtomicBank, "bank" | "metadata">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<AtomicBank>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<AtomicBank, PaginatedQuery>);
@@ -30,8 +30,8 @@ const BasisTheoryAtomicBanks = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
30
30
  return this.client.get(`/${id}/decrypt`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
31
31
  }
32
32
 
33
- react(id, request, options) {
34
- return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
33
+ react(tokenId, request, options) {
34
+ return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
35
35
  transformRequest: _common.transformAtomicReactionRequestSnakeCase,
36
36
  transformResponse: _common.proxyRaw
37
37
  })).then(_common.dataExtractor);
@@ -1,11 +1,11 @@
1
- import type { AtomicCard, ReactRequest, ReactResponse, UpdateAtomicCard } from '@basis-theory/basis-theory-elements-interfaces/models';
1
+ import type { AtomicCard, AtomicReactRequest, ReactResponse, UpdateAtomicCard } from '@basis-theory/basis-theory-elements-interfaces/models';
2
2
  import type { PaginatedQuery, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
3
  import type { BasisTheoryServiceOptions } from '../../service';
4
4
  export declare const BasisTheoryAtomicCards: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
6
  update(id: string, request: UpdateAtomicCard, options?: RequestOptions | undefined): Promise<AtomicCard>;
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicCard>;
8
- react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
8
+ react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
9
9
  readonly client: import("axios").AxiosInstance;
10
10
  };
11
11
  } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<AtomicCard, Pick<AtomicCard, "card" | "metadata">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<AtomicCard>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<AtomicCard, PaginatedQuery>);
@@ -32,8 +32,8 @@ const BasisTheoryAtomicCards = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
32
32
  return this.client.get(`/${id}/decrypt`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
33
33
  }
34
34
 
35
- react(id, request, options) {
36
- return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
35
+ react(tokenId, request, options) {
36
+ return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
37
37
  transformRequest: _common.transformAtomicReactionRequestSnakeCase,
38
38
  transformResponse: _common.proxyRaw
39
39
  })).then(_common.dataExtractor);
package/common/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './constants';
2
2
  export * from './utils';
3
- export * from './BasisTheoryApiError';
3
+ export { BasisTheoryApiError } from '@basis-theory/basis-theory-elements-interfaces/sdk';
package/common/index.js CHANGED
@@ -3,11 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ BasisTheoryApiError: true
8
+ };
9
+ Object.defineProperty(exports, "BasisTheoryApiError", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _sdk.BasisTheoryApiError;
13
+ }
14
+ });
6
15
 
7
16
  var _constants = require("./constants");
8
17
 
9
18
  Object.keys(_constants).forEach(function (key) {
10
19
  if (key === "default" || key === "__esModule") return;
20
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
11
21
  if (key in exports && exports[key] === _constants[key]) return;
12
22
  Object.defineProperty(exports, key, {
13
23
  enumerable: true,
@@ -21,6 +31,7 @@ var _utils = require("./utils");
21
31
 
22
32
  Object.keys(_utils).forEach(function (key) {
23
33
  if (key === "default" || key === "__esModule") return;
34
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
24
35
  if (key in exports && exports[key] === _utils[key]) return;
25
36
  Object.defineProperty(exports, key, {
26
37
  enumerable: true,
@@ -30,15 +41,4 @@ Object.keys(_utils).forEach(function (key) {
30
41
  });
31
42
  });
32
43
 
33
- var _BasisTheoryApiError = require("./BasisTheoryApiError");
34
-
35
- Object.keys(_BasisTheoryApiError).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _BasisTheoryApiError[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function () {
41
- return _BasisTheoryApiError[key];
42
- }
43
- });
44
- });
44
+ var _sdk = require("@basis-theory/basis-theory-elements-interfaces/sdk");
package/common/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk/services';
1
+ import { RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
2
2
  import type { AxiosRequestConfig, AxiosResponse, AxiosTransformer } from 'axios';
3
3
  import type { ApplicationInfo } from '../types';
4
4
  declare const assertInit: <T>(prop: T) => NonNullable<T>;
@@ -17,7 +17,7 @@ declare const concatRequestTransformerWithDefault: (requestTransformer: AxiosTra
17
17
  declare const concatResponseTransformermWithDefault: (responseTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
18
18
  declare const createRequestConfig: (options?: RequestOptions | undefined, transformers?: Pick<AxiosRequestConfig, "transformRequest" | "transformResponse"> | undefined) => AxiosRequestConfig | undefined;
19
19
  declare const errorInterceptor: (error: any) => void;
20
- declare const getQueryParams: <Q>(query: Q) => string;
20
+ declare const getQueryParams: <Q>(query?: Q) => string;
21
21
  declare const buildUserAgentString: (appInfo?: ApplicationInfo | undefined) => string;
22
22
  declare const getBrowser: () => string;
23
23
  declare const getOSVersion: () => string;
package/common/utils.js CHANGED
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.transformAtomicReactionRequestSnakeCase = exports.proxyRaw = exports.getRuntime = exports.getQueryParams = exports.getOSVersion = exports.getBrowser = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformermWithDefault = exports.concatRequestTransformerWithDefault = exports.buildUserAgentString = exports.buildClientUserAgentString = exports.assertInit = void 0;
7
7
 
8
+ var _sdk = require("@basis-theory/basis-theory-elements-interfaces/sdk");
9
+
8
10
  var _axios = _interopRequireDefault(require("axios"));
9
11
 
10
12
  var _camelcaseKeys = _interopRequireDefault(require("camelcase-keys"));
@@ -15,8 +17,6 @@ var _snakeCase = require("snake-case");
15
17
 
16
18
  var _snakecaseKeys = _interopRequireDefault(require("snakecase-keys"));
17
19
 
18
- var _BasisTheoryApiError = require("./BasisTheoryApiError");
19
-
20
20
  var _constants = require("./constants");
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -237,12 +237,12 @@ const errorInterceptor = error => {
237
237
 
238
238
  const status = ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) || -1;
239
239
  const data = (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data;
240
- throw new _BasisTheoryApiError.BasisTheoryApiError(error.message, status, data);
240
+ throw new _sdk.BasisTheoryApiError(error.message, status, data);
241
241
  };
242
242
 
243
243
  exports.errorInterceptor = errorInterceptor;
244
244
 
245
- const getQueryParams = query => {
245
+ const getQueryParams = (query = {}) => {
246
246
  const keys = Object.keys(query);
247
247
 
248
248
  if (keys.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.22.2",
3
+ "version": "1.25.0",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -15,7 +15,7 @@
15
15
  "!*.bundle.js"
16
16
  ],
17
17
  "dependencies": {
18
- "@basis-theory/basis-theory-elements-interfaces": "^3.4.0",
18
+ "@basis-theory/basis-theory-elements-interfaces": "^3.8.0",
19
19
  "axios": "^0.21.2",
20
20
  "camelcase-keys": "^6.2.2",
21
21
  "os": "^0.1.2",
@@ -4,5 +4,5 @@ export declare const BasisTheoryReactorFormulas: {
4
4
  new (options: import("../service/types").BasisTheoryServiceOptions): {
5
5
  readonly client: import("axios").AxiosInstance;
6
6
  };
7
- } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "sourceTokenType" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<ReactorFormula>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Update<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "sourceTokenType" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<ReactorFormula, ListReactorFormulaQuery>);
7
+ } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<ReactorFormula>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Update<ReactorFormula, Pick<ReactorFormula, "name" | "type" | "code" | "description" | "icon" | "configuration" | "requestParameters">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<ReactorFormula, ListReactorFormulaQuery>);
8
8
  export declare type BasisTheoryReactorFormulas = InstanceType<typeof BasisTheoryReactorFormulas>;
@@ -1,8 +1,9 @@
1
- import type { Reactor, CreateReactor } from '@basis-theory/basis-theory-elements-interfaces/models';
2
- import type { ListReactorQuery } from '@basis-theory/basis-theory-elements-interfaces/sdk';
1
+ import type { Reactor, CreateReactor, ReactResponse } from '@basis-theory/basis-theory-elements-interfaces/models';
2
+ import type { ListReactorQuery, ReactRequest, RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk';
3
3
  import type { BasisTheoryServiceOptions } from '../service';
4
4
  export declare const BasisTheoryReactors: {
5
5
  new (options: BasisTheoryServiceOptions): {
6
+ react(reactorId: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
6
7
  readonly client: import("axios").AxiosInstance;
7
8
  };
8
9
  } & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Create<Reactor, CreateReactor>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Retrieve<Reactor>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Update<Reactor, Pick<Reactor, "name" | "configuration">>) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").Delete) & (new (...args: any[]) => import("@basis-theory/basis-theory-elements-interfaces/sdk/services/shared").List<Reactor, ListReactorQuery>);
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BasisTheoryReactors = void 0;
7
7
 
8
+ var _common = require("../common");
9
+
8
10
  var _utils = require("../common/utils");
9
11
 
10
12
  var _service = require("../service");
@@ -22,5 +24,12 @@ const BasisTheoryReactors = new _CrudBuilder.CrudBuilder(class BasisTheoryReacto
22
24
  super(_options);
23
25
  }
24
26
 
27
+ react(reactorId, request, options) {
28
+ return this.client.post(`/${reactorId}/react`, request, (0, _common.createRequestConfig)(options, {
29
+ transformRequest: _common.proxyRaw,
30
+ transformResponse: _common.proxyRaw
31
+ })).then(_common.dataExtractor);
32
+ }
33
+
25
34
  }).create().retrieve().update().delete().list().build();
26
35
  exports.BasisTheoryReactors = BasisTheoryReactors;
@@ -1,11 +1,20 @@
1
- import type { Tenant, TenantUsageReport, UpdateTenant } from '@basis-theory/basis-theory-elements-interfaces/models';
1
+ import type { Tenant, TenantUsageReport, UpdateTenant, CreateTenantInvitation, TenantInvitation, TenantMember } from '@basis-theory/basis-theory-elements-interfaces/models';
2
2
  import type { RequestOptions } from '@basis-theory/basis-theory-elements-interfaces/sdk/services';
3
+ import type { PaginatedList } from '@basis-theory/basis-theory-elements-interfaces/sdk/services/shared';
4
+ import type { ListTenantInvitationsQuery, ListTenantMembersQuery } from '@basis-theory/basis-theory-elements-interfaces/sdk/services/tenants';
3
5
  export declare const BasisTheoryTenants: {
4
6
  new (options: import("../service/types").BasisTheoryServiceOptions): {
5
7
  retrieve(options?: RequestOptions | undefined): Promise<Tenant>;
6
8
  update(model: UpdateTenant, options?: RequestOptions | undefined): Promise<Tenant>;
7
9
  delete(options?: RequestOptions | undefined): Promise<void>;
8
10
  retrieveUsageReport(options?: RequestOptions | undefined): Promise<TenantUsageReport>;
11
+ createInvitation(model: CreateTenantInvitation, options?: RequestOptions | undefined): Promise<TenantInvitation>;
12
+ resendInvitation(invitationId: string, options?: RequestOptions | undefined): Promise<TenantInvitation>;
13
+ listInvitations(query?: ListTenantInvitationsQuery | undefined, options?: RequestOptions | undefined): Promise<PaginatedList<TenantInvitation>>;
14
+ retrieveInvitation(invitationId: string, options?: RequestOptions | undefined): Promise<TenantInvitation>;
15
+ deleteInvitation(invitationId: string, options?: RequestOptions | undefined): Promise<void>;
16
+ listMembers(query?: ListTenantMembersQuery | undefined, options?: RequestOptions | undefined): Promise<PaginatedList<TenantMember>>;
17
+ deleteMember(memberId: string, options?: RequestOptions | undefined): Promise<void>;
9
18
  readonly client: import("axios").AxiosInstance;
10
19
  };
11
20
  };
@@ -28,5 +28,35 @@ const BasisTheoryTenants = new _CrudBuilder.CrudBuilder(class BasisTheoryTenants
28
28
  return this.client.get('/reports/usage', (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
29
29
  }
30
30
 
31
+ createInvitation(model, options) {
32
+ return this.client.post('/invitations', model, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
33
+ }
34
+
35
+ resendInvitation(invitationId, options) {
36
+ return this.client.post(`/invitations/${invitationId}/resend`, {}, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
37
+ }
38
+
39
+ listInvitations(query, options) {
40
+ const url = `/invitations${(0, _common.getQueryParams)(query)}`;
41
+ return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
42
+ }
43
+
44
+ retrieveInvitation(invitationId, options) {
45
+ return this.client.get(`/invitations/${invitationId}`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
46
+ }
47
+
48
+ async deleteInvitation(invitationId, options) {
49
+ await this.client.delete(`/invitations/${invitationId}`, (0, _common.createRequestConfig)(options));
50
+ }
51
+
52
+ listMembers(query, options) {
53
+ const url = `/members${(0, _common.getQueryParams)(query)}`;
54
+ return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
55
+ }
56
+
57
+ async deleteMember(memberId, options) {
58
+ await this.client.delete(`/members/${memberId}`, (0, _common.createRequestConfig)(options));
59
+ }
60
+
31
61
  }).build();
32
62
  exports.BasisTheoryTenants = BasisTheoryTenants;
@@ -1,5 +0,0 @@
1
- export declare class BasisTheoryApiError extends Error {
2
- readonly status: number;
3
- readonly data?: unknown;
4
- constructor(message: string, status: number, data?: unknown);
5
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BasisTheoryApiError = void 0;
7
-
8
- class BasisTheoryApiError extends Error {
9
- constructor(message, status, data) {
10
- super(message);
11
- this.status = status;
12
- this.data = data;
13
- this.name = 'BasisTheoryApiError';
14
- this.status = status;
15
- this.data = data;
16
- }
17
-
18
- }
19
-
20
- exports.BasisTheoryApiError = BasisTheoryApiError;