@basis-theory/basis-theory-js 4.3.0 → 4.4.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
@@ -1,23 +1,24 @@
1
1
  import type { BasisTheoryElements, CardElement, CardExpirationDateElement, CardNumberElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardNumberElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from './types/elements';
2
2
  import type { TokenizeData } from './types/models';
3
- import type { Applications, ApplicationTemplates, BasisTheory as IBasisTheory, BasisTheoryInit, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, RequestOptions, Sessions, Tenants, Tokens, ThreeDS } from './types/sdk';
3
+ import type { ApplicationKeys, Applications, ApplicationTemplates, BasisTheory as IBasisTheory, BasisTheoryInit, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, RequestOptions, Sessions, Tenants, ThreeDS, Tokens } from './types/sdk';
4
4
  export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
5
5
  private _initStatus;
6
- private _initOptions?;
7
- private _tokens?;
8
- private _tokenize?;
9
- private _elements?;
6
+ private _applicationKeys?;
10
7
  private _applications?;
11
8
  private _applicationTemplates?;
12
- private _tenants?;
9
+ private _elements?;
10
+ private _initOptions?;
13
11
  private _logs?;
14
- private _reactorFormulas?;
15
- private _reactors?;
16
12
  private _permissions?;
17
13
  private _proxies?;
18
14
  private _proxy?;
15
+ private _reactorFormulas?;
16
+ private _reactors?;
19
17
  private _sessions?;
18
+ private _tenants?;
20
19
  private _threeds?;
20
+ private _tokenize?;
21
+ private _tokens?;
21
22
  init(apiKey: string | undefined, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
22
23
  init(apiKey: string | undefined, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
23
24
  createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
@@ -30,6 +31,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
30
31
  get initOptions(): Required<BasisTheoryInitOptions>;
31
32
  get tokens(): Tokens & ElementsTokens;
32
33
  get applications(): Applications;
34
+ get applicationKeys(): ApplicationKeys;
33
35
  get applicationTemplates(): ApplicationTemplates;
34
36
  get client(): HttpClient | undefined;
35
37
  get tenants(): Tenants;
package/BasisTheory.js CHANGED
@@ -7,6 +7,8 @@ exports.BasisTheory = void 0;
7
7
 
8
8
  var _applicationTemplates = require("./application-templates");
9
9
 
10
+ var _applicationKeys = require("./applicationKeys");
11
+
10
12
  var _applications = require("./applications");
11
13
 
12
14
  var _common = require("./common");
@@ -92,6 +94,11 @@ class BasisTheory {
92
94
  baseURL: new URL(_common.CLIENT_BASE_PATHS.applications, baseUrl).toString(),
93
95
  appInfo
94
96
  });
97
+ this._applicationKeys = new _applicationKeys.BasisTheoryApplicationKeys({
98
+ apiKey,
99
+ baseURL: new URL(_common.CLIENT_BASE_PATHS.applicationKeys, baseUrl).toString(),
100
+ appInfo
101
+ });
95
102
  this._applicationTemplates = new _applicationTemplates.BasisTheoryApplicationTemplates({
96
103
  apiKey,
97
104
  baseURL: new URL(_common.CLIENT_BASE_PATHS.applicationTemplates, baseUrl).toString(),
@@ -193,6 +200,10 @@ class BasisTheory {
193
200
  return (0, _common.assertInit)(this._applications);
194
201
  }
195
202
 
203
+ get applicationKeys() {
204
+ return (0, _common.assertInit)(this._applicationKeys);
205
+ }
206
+
196
207
  get applicationTemplates() {
197
208
  return (0, _common.assertInit)(this._applicationTemplates);
198
209
  }
@@ -0,0 +1,11 @@
1
+ import type { ApplicationKey } from '../types/models';
2
+ export declare const BasisTheoryApplicationKeys: {
3
+ new (options: import("../service/types").BasisTheoryServiceOptions): {
4
+ create(applicationId: string): Promise<ApplicationKey>;
5
+ get(applicationId: string): Promise<ApplicationKey[]>;
6
+ getById(applicationId: string, keyId: string): Promise<ApplicationKey>;
7
+ delete(applicationId: string, keyId: string): Promise<void>;
8
+ readonly client: import("axios").AxiosInstance;
9
+ };
10
+ };
11
+ export type BasisTheoryApplicationKeys = InstanceType<typeof BasisTheoryApplicationKeys>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BasisTheoryApplicationKeys = void 0;
7
+
8
+ var _common = require("./../common");
9
+
10
+ var _service = require("./../service");
11
+
12
+ var _CrudBuilder = require("./../service/CrudBuilder");
13
+
14
+ const BasisTheoryApplicationKeys = new _CrudBuilder.CrudBuilder(class BasisTheoryApplicationKeys extends _service.BasisTheoryService {
15
+ create(applicationId) {
16
+ return this.client.post(`${applicationId}/keys`).then(_common.dataExtractor);
17
+ }
18
+
19
+ get(applicationId) {
20
+ return this.client.get(`${applicationId}/keys`).then(_common.dataExtractor);
21
+ }
22
+
23
+ getById(applicationId, keyId) {
24
+ return this.client.get(`${applicationId}/keys/${keyId}`).then(_common.dataExtractor);
25
+ }
26
+
27
+ delete(applicationId, keyId) {
28
+ return this.client.delete(`${applicationId}/keys/${keyId}`).then(_common.dataExtractor);
29
+ }
30
+
31
+ }).build();
32
+ exports.BasisTheoryApplicationKeys = BasisTheoryApplicationKeys;
@@ -0,0 +1 @@
1
+ export { BasisTheoryApplicationKeys } from './BasisTheoryApplicationKeys';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BasisTheoryApplicationKeys", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _BasisTheoryApplicationKeys.BasisTheoryApplicationKeys;
10
+ }
11
+ });
12
+
13
+ var _BasisTheoryApplicationKeys = require("./BasisTheoryApplicationKeys");
@@ -7,6 +7,9 @@ export declare const BasisTheoryApplications: {
7
7
  */
8
8
  getApplicationByKey(): Promise<Application>;
9
9
  retrieveByKey(options?: RequestOptions): Promise<Application>;
10
+ /**
11
+ * @deprecated This method is deprecated. Use Terraform or https://portal.basistheory.com to manage keys instead.
12
+ */
10
13
  regenerateKey(id: string, options?: RequestOptions): Promise<Application>;
11
14
  readonly client: import("axios").AxiosInstance;
12
15
  };
@@ -22,6 +22,10 @@ const BasisTheoryApplications = new _CrudBuilder.CrudBuilder(class BasisTheoryAp
22
22
  retrieveByKey(options) {
23
23
  return this.client.get('/key', (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
24
24
  }
25
+ /**
26
+ * @deprecated This method is deprecated. Use Terraform or https://portal.basistheory.com to manage keys instead.
27
+ */
28
+
25
29
 
26
30
  regenerateKey(id, options) {
27
31
  return this.client.post(`${id}/regenerate`, undefined, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
@@ -30,6 +30,7 @@ const CLIENT_BASE_PATHS = {
30
30
  tokens: 'tokens',
31
31
  tokenize: 'tokenize',
32
32
  applications: 'applications',
33
+ applicationKeys: 'applications',
33
34
  applicationTemplates: 'application-templates',
34
35
  tenants: 'tenants/self',
35
36
  logs: 'logs',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -7,7 +7,11 @@ interface Application extends Auditable {
7
7
  id: string;
8
8
  tenantId: string;
9
9
  name?: string;
10
+ /**
11
+ * @deprecated use `keys` instead.
12
+ */
10
13
  key?: string;
14
+ keys?: ApplicationKey[];
11
15
  type: ApplicationType;
12
16
  permissions?: string[];
13
17
  rules?: AccessRule[];
@@ -26,7 +30,15 @@ type Condition = {
26
30
  operator: string;
27
31
  value: string;
28
32
  };
29
- type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | 'expiresAt'>;
33
+ type ApplicationKey = {
34
+ id?: string;
35
+ key?: string;
36
+ createdAt?: string;
37
+ createdBy?: string;
38
+ };
39
+ type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | 'expiresAt'> & {
40
+ createKey?: boolean;
41
+ };
30
42
  type UpdateApplication = Pick<Application, 'name' | 'permissions' | 'rules'>;
31
- export type { ApplicationType, Application, CreateApplication, TransformType, UpdateApplication, };
43
+ export type { Application, ApplicationKey, ApplicationType, CreateApplication, TransformType, UpdateApplication, };
32
44
  export { APPLICATION_TYPES, TRANSFORM_TYPES, AccessRule };
@@ -1,5 +1,6 @@
1
1
  import type { BasisTheoryElements } from '../../types/elements';
2
2
  import type { Applications, ApplicationTemplates, HttpClient, Logs, Permissions, Proxies, Proxy, ReactorFormulas, Reactors, Sessions, Tenants, Tokenize, Tokens, ThreeDS } from './services';
3
+ import { ApplicationKeys } from './services/applicationKeys';
3
4
  interface ApplicationInfo {
4
5
  name?: string;
5
6
  version?: string;
@@ -24,6 +25,7 @@ interface BasisTheoryInit {
24
25
  }
25
26
  interface BasisTheory extends Tokenize {
26
27
  applications: Applications;
28
+ applicationKeys: ApplicationKeys;
27
29
  applicationTemplates: ApplicationTemplates;
28
30
  /**
29
31
  * @description Allows you to utilize element values in requests to a third-party API using our HTTP client service.
@@ -0,0 +1,8 @@
1
+ import type { ApplicationKey } from '../../../types/models';
2
+ interface ApplicationKeys {
3
+ create(id: string): Promise<ApplicationKey>;
4
+ delete(applicationId: string, keyId: string): Promise<void>;
5
+ get(applicationId: string): Promise<ApplicationKey[]>;
6
+ getById(applicationId: string, keyId: string): Promise<ApplicationKey>;
7
+ }
8
+ export type { ApplicationKeys };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -2,6 +2,7 @@ export * from './shared';
2
2
  export * from './tokens';
3
3
  export * from './tokenize';
4
4
  export * from './applications';
5
+ export * from './applicationKeys';
5
6
  export * from './tenants';
6
7
  export * from './logs';
7
8
  export * from './reactor-formulas';
@@ -56,6 +56,19 @@ Object.keys(_applications).forEach(function (key) {
56
56
  });
57
57
  });
58
58
 
59
+ var _applicationKeys = require("./applicationKeys");
60
+
61
+ Object.keys(_applicationKeys).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _applicationKeys[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _applicationKeys[key];
68
+ }
69
+ });
70
+ });
71
+
59
72
  var _tenants = require("./tenants");
60
73
 
61
74
  Object.keys(_tenants).forEach(function (key) {