@basis-theory/basis-theory-js 1.1.0 → 1.2.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 +10 -11
- package/BasisTheory.js +32 -28
- package/applications/BasisTheoryApplications.d.ts +2 -2
- package/applications/BasisTheoryApplications.js +1 -1
- package/applications/types.d.ts +7 -6
- package/atomic/BasisTheoryAtomic.js +4 -4
- package/atomic/banks/BasisTheoryAtomicBanks.d.ts +2 -2
- package/atomic/banks/BasisTheoryAtomicBanks.js +10 -6
- package/atomic/banks/types.d.ts +4 -3
- package/atomic/cards/BasisTheoryAtomicCards.d.ts +2 -2
- package/atomic/cards/BasisTheoryAtomicCards.js +12 -8
- package/atomic/cards/types.d.ts +6 -5
- package/atomic/types.d.ts +4 -2
- package/common/constants.d.ts +6 -5
- package/common/elements.js +0 -1
- package/common/script.d.ts +3 -2
- package/common/script.js +2 -4
- package/common/utils.d.ts +17 -16
- package/common/utils.js +39 -40
- package/elements/index.d.ts +3 -2
- package/encryption/BasisTheoryEncryption.d.ts +1 -2
- package/encryption/BasisTheoryEncryption.js +5 -4
- package/encryption/BasisTheoryEncryptionAdapters.js +6 -4
- package/encryption/providers/browser.js +23 -32
- package/encryption/providers/node.js +11 -13
- package/encryption/providers/utils.d.ts +3 -2
- package/encryption/providers/utils.js +8 -7
- package/encryption/types.d.ts +3 -2
- package/logs/BasisTheoryLogs.d.ts +1 -1
- package/logs/types.d.ts +3 -2
- package/package.json +2 -2
- package/permissions/BasisTheoryPermissions.js +1 -1
- package/permissions/types.d.ts +5 -3
- package/reactor-formulas/BasisTheoryReactorFormulas.d.ts +1 -1
- package/reactor-formulas/types.d.ts +8 -7
- package/reactors/BasisTheoryReactors.js +9 -5
- package/reactors/types.d.ts +6 -5
- package/service/BasisTheoryService.js +9 -3
- package/service/CrudBuilder.d.ts +10 -10
- package/service/CrudBuilder.js +15 -4
- package/service/types.d.ts +6 -6
- package/tenants/BasisTheoryTenants.d.ts +2 -2
- package/tenants/BasisTheoryTenants.js +2 -2
- package/tenants/types.d.ts +3 -2
- package/tokens/BasisTheoryTokens.d.ts +5 -5
- package/tokens/BasisTheoryTokens.js +16 -13
- package/tokens/types.d.ts +14 -12
- package/types.d.ts +11 -9
package/reactors/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { ReactorFormula } from '../reactor-formulas/types';
|
|
1
2
|
import type { PaginatedQuery } from '../service';
|
|
2
3
|
import type { TokenType } from '../tokens/types';
|
|
3
|
-
|
|
4
|
-
export interface Reactor {
|
|
4
|
+
interface Reactor {
|
|
5
5
|
id: string;
|
|
6
6
|
tenantId: string;
|
|
7
7
|
name: string;
|
|
@@ -10,12 +10,13 @@ export interface Reactor {
|
|
|
10
10
|
createdAt: string;
|
|
11
11
|
modifiedAt: string;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
declare type CreateReactorModel = Pick<Reactor, 'name' | 'configuration'> & {
|
|
14
14
|
formula: Pick<ReactorFormula, 'id'>;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
declare type UpdateReactorModel = Pick<Reactor, 'name' | 'configuration'>;
|
|
17
|
+
interface ReactorQuery extends PaginatedQuery {
|
|
18
18
|
id?: string | string[];
|
|
19
19
|
name?: string;
|
|
20
20
|
sourceTokenType?: TokenType;
|
|
21
21
|
}
|
|
22
|
+
export type { Reactor, CreateReactorModel, UpdateReactorModel, ReactorQuery };
|
|
@@ -19,15 +19,21 @@ class BasisTheoryService {
|
|
|
19
19
|
|
|
20
20
|
const {
|
|
21
21
|
apiKey,
|
|
22
|
-
baseURL
|
|
22
|
+
baseURL,
|
|
23
|
+
transformRequest,
|
|
24
|
+
transformResponse
|
|
23
25
|
} = options;
|
|
24
26
|
this.client = _axios.default.create({
|
|
25
27
|
baseURL,
|
|
26
28
|
headers: {
|
|
27
29
|
[_common.API_KEY_HEADER]: apiKey
|
|
28
30
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
/* eslint-disable unicorn/prefer-spread */
|
|
33
|
+
transformRequest: [].concat(transformRequest || _common.transformRequestSnakeCase, _axios.default.defaults.transformRequest),
|
|
34
|
+
transformResponse: _axios.default.defaults.transformResponse.concat(transformResponse || _common.transformResponseCamelCase)
|
|
35
|
+
/* eslint-enable unicorn/prefer-spread */
|
|
36
|
+
|
|
31
37
|
});
|
|
32
38
|
this.client.interceptors.response.use(undefined, _common.errorInterceptor);
|
|
33
39
|
}
|
package/service/CrudBuilder.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { BasisTheoryService } from './BasisTheoryService';
|
|
2
|
-
import type { RequestOptions } from './types';
|
|
3
|
-
import type { PaginatedList, PaginatedQuery } from './types';
|
|
2
|
+
import type { RequestOptions, PaginatedList, PaginatedQuery } from './types';
|
|
4
3
|
declare type BasisTheoryServiceConstructor<T extends BasisTheoryService = BasisTheoryService> = new (...params: any[]) => T;
|
|
5
|
-
|
|
4
|
+
declare type ICreate<T, C> = {
|
|
6
5
|
create(model: C, options?: RequestOptions): Promise<T>;
|
|
7
6
|
};
|
|
8
|
-
|
|
7
|
+
declare type IRetrieve<T> = {
|
|
9
8
|
retrieve(id: string, options?: RequestOptions): Promise<T>;
|
|
10
9
|
};
|
|
11
|
-
|
|
10
|
+
declare type IUpdate<T, U> = {
|
|
12
11
|
update(id: string, model: U, options?: RequestOptions): Promise<T>;
|
|
13
12
|
};
|
|
14
|
-
|
|
13
|
+
declare type IDelete = {
|
|
15
14
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
16
15
|
};
|
|
17
|
-
|
|
16
|
+
declare type IList<T, Q extends PaginatedQuery> = {
|
|
18
17
|
list(query?: Q, options?: RequestOptions): Promise<PaginatedList<T>>;
|
|
19
18
|
};
|
|
20
19
|
declare type ICreateConstructor<T, C> = new (...args: any[]) => ICreate<T, C>;
|
|
@@ -22,9 +21,9 @@ declare type IRetrieveConstructor<T> = new (...args: any[]) => IRetrieve<T>;
|
|
|
22
21
|
declare type IUpdateConstructor<T, U> = new (...args: any[]) => IUpdate<T, U>;
|
|
23
22
|
declare type IDeleteConstructor = new (...args: any[]) => IDelete;
|
|
24
23
|
declare type IListConstructor<T, Q extends PaginatedQuery> = new (...args: any[]) => IList<T, Q>;
|
|
25
|
-
|
|
24
|
+
declare class CrudBuilder<Class extends BasisTheoryServiceConstructor> {
|
|
26
25
|
private BaseService;
|
|
27
|
-
constructor(
|
|
26
|
+
constructor(baseService: Class);
|
|
28
27
|
create<T, C>(): CrudBuilder<Class & ICreateConstructor<T, C>>;
|
|
29
28
|
retrieve<T>(): CrudBuilder<Class & IRetrieveConstructor<T>>;
|
|
30
29
|
update<T, U>(): CrudBuilder<Class & IUpdateConstructor<T, U>>;
|
|
@@ -32,4 +31,5 @@ export declare class CrudBuilder<Class extends BasisTheoryServiceConstructor> {
|
|
|
32
31
|
list<T, Q extends PaginatedQuery>(): CrudBuilder<Class & IListConstructor<T, Q>>;
|
|
33
32
|
build(): Class;
|
|
34
33
|
}
|
|
35
|
-
export {};
|
|
34
|
+
export { CrudBuilder };
|
|
35
|
+
export type { ICreate, IRetrieve, IUpdate, IDelete, IList };
|
package/service/CrudBuilder.js
CHANGED
|
@@ -7,7 +7,9 @@ exports.CrudBuilder = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _common = require("../common");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
11
13
|
const Create = Service => class Create extends Service {
|
|
12
14
|
create(model, options) {
|
|
13
15
|
return this.client.post('/', model, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
|
|
@@ -37,7 +39,7 @@ const Delete = Service => class Delete extends Service {
|
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const List = Service => class List extends Service {
|
|
40
|
-
list(query = {}, options) {
|
|
42
|
+
list(query = {}, options = {}) {
|
|
41
43
|
const url = `/${(0, _common.getQueryParams)(query)}`;
|
|
42
44
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
|
|
43
45
|
}
|
|
@@ -45,31 +47,38 @@ const List = Service => class List extends Service {
|
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
class CrudBuilder {
|
|
48
|
-
constructor(
|
|
49
|
-
this
|
|
50
|
+
constructor(baseService) {
|
|
51
|
+
_defineProperty(this, "BaseService", void 0);
|
|
52
|
+
|
|
53
|
+
this.BaseService = baseService;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
create() {
|
|
57
|
+
// eslint-disable-next-line new-cap
|
|
53
58
|
this.BaseService = Create(this.BaseService);
|
|
54
59
|
return this;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
retrieve() {
|
|
63
|
+
// eslint-disable-next-line new-cap
|
|
58
64
|
this.BaseService = Retrieve(this.BaseService);
|
|
59
65
|
return this;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
update() {
|
|
69
|
+
// eslint-disable-next-line new-cap
|
|
63
70
|
this.BaseService = Update(this.BaseService);
|
|
64
71
|
return this;
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
delete() {
|
|
75
|
+
// eslint-disable-next-line new-cap
|
|
68
76
|
this.BaseService = Delete(this.BaseService);
|
|
69
77
|
return this;
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
list() {
|
|
81
|
+
// eslint-disable-next-line new-cap
|
|
73
82
|
this.BaseService = List(this.BaseService);
|
|
74
83
|
return this;
|
|
75
84
|
}
|
|
@@ -79,5 +88,7 @@ class CrudBuilder {
|
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
}
|
|
91
|
+
/* eslint-enable max-classes-per-file, @typescript-eslint/no-shadow */
|
|
92
|
+
|
|
82
93
|
|
|
83
94
|
exports.CrudBuilder = CrudBuilder;
|
package/service/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
-
|
|
2
|
+
interface BasisTheoryServiceOptions extends Pick<AxiosRequestConfig, 'transformRequest' | 'transformResponse'> {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
baseURL: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface PaginatedList<T> {
|
|
7
7
|
pagination: {
|
|
8
8
|
totalItems: number;
|
|
9
9
|
pageNumber: number;
|
|
@@ -13,15 +13,15 @@ export interface PaginatedList<T> {
|
|
|
13
13
|
data: T[];
|
|
14
14
|
}
|
|
15
15
|
declare type QueryValue = boolean | number | string | null | undefined | (number | string)[];
|
|
16
|
-
|
|
16
|
+
interface PaginatedQuery {
|
|
17
17
|
[key: string]: QueryValue;
|
|
18
18
|
[key: number]: QueryValue;
|
|
19
19
|
page?: number;
|
|
20
20
|
size?: number;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
interface RequestOptions {
|
|
23
23
|
apiKey?: string;
|
|
24
24
|
correlationId?: string;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
export {};
|
|
26
|
+
declare type RequestTransformers = Pick<AxiosRequestConfig, 'transformRequest' | 'transformResponse'>;
|
|
27
|
+
export type { BasisTheoryServiceOptions, PaginatedList, PaginatedQuery, RequestOptions, RequestTransformers, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Tenant, UpdateTenantModel } from './types';
|
|
2
1
|
import { RequestOptions } from '../service';
|
|
2
|
+
import type { Tenant, UpdateTenantModel } from './types';
|
|
3
3
|
export declare const BasisTheoryTenants: {
|
|
4
|
-
new (options: import("../service").BasisTheoryServiceOptions): {
|
|
4
|
+
new (options: import("../service/types").BasisTheoryServiceOptions): {
|
|
5
5
|
retrieve(options?: RequestOptions | undefined): Promise<Tenant>;
|
|
6
6
|
update(model: UpdateTenantModel, options?: RequestOptions | undefined): Promise<Tenant>;
|
|
7
7
|
delete(options?: RequestOptions | undefined): Promise<void>;
|
|
@@ -12,11 +12,11 @@ var _service = require("../service");
|
|
|
12
12
|
var _CrudBuilder = require("../service/CrudBuilder");
|
|
13
13
|
|
|
14
14
|
const BasisTheoryTenants = new _CrudBuilder.CrudBuilder(class BasisTheoryTenants extends _service.BasisTheoryService {
|
|
15
|
-
|
|
15
|
+
retrieve(options) {
|
|
16
16
|
return this.client.get('/', (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
update(model, options) {
|
|
20
20
|
return this.client.put('/', model, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
|
|
21
21
|
}
|
|
22
22
|
|
package/tenants/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
interface Tenant {
|
|
2
2
|
id: string;
|
|
3
3
|
ownerId: string;
|
|
4
4
|
name: string;
|
|
5
5
|
createdAt: string;
|
|
6
6
|
modifiedAt: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare type UpdateTenantModel = Pick<Tenant, 'name'>;
|
|
9
|
+
export type { Tenant, UpdateTenantModel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Token, CreateTokenModel, ListTokensQuery, RetrieveTokenQuery, ListTokensQueryDecrypted, TokenData } from './types';
|
|
2
1
|
import { BasisTheoryServiceOptions, PaginatedList, RequestOptions } from '../service';
|
|
2
|
+
import type { Token, CreateTokenModel, ListTokensQuery, RetrieveTokenQuery, ListTokensQueryDecrypted, TokenData } from './types';
|
|
3
3
|
export declare const BasisTheoryTokens: {
|
|
4
4
|
new (options: BasisTheoryServiceOptions): {
|
|
5
5
|
/**
|
|
@@ -14,13 +14,13 @@ export declare const BasisTheoryTokens: {
|
|
|
14
14
|
* @deprecated use {@link delete} instead
|
|
15
15
|
*/
|
|
16
16
|
deleteToken(id: string): Promise<void>;
|
|
17
|
-
retrieve(id: string, query?: RetrieveTokenQuery, options?: RequestOptions
|
|
18
|
-
retrieveDecrypted(id: string, query?: RetrieveTokenQuery, options?: RequestOptions
|
|
19
|
-
listDecrypted(query?: ListTokensQueryDecrypted, options?: RequestOptions
|
|
17
|
+
retrieve(id: string, query?: RetrieveTokenQuery, options?: RequestOptions): Promise<Token>;
|
|
18
|
+
retrieveDecrypted(id: string, query?: RetrieveTokenQuery, options?: RequestOptions): Promise<Token>;
|
|
19
|
+
listDecrypted(query?: ListTokensQueryDecrypted, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
20
20
|
createAssociation(parentId: string, childId: string, options?: RequestOptions | undefined): Promise<void>;
|
|
21
21
|
deleteAssociation(parentId: string, childId: string, options?: RequestOptions | undefined): Promise<void>;
|
|
22
22
|
createChild(parentId: string, token: CreateTokenModel, options?: RequestOptions | undefined): Promise<Token>;
|
|
23
|
-
listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions
|
|
23
|
+
listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
24
24
|
readonly client: import("axios").AxiosInstance;
|
|
25
25
|
};
|
|
26
26
|
} & (new (...args: any[]) => import("../service/CrudBuilder").ICreate<Token, Pick<Token, "data" | "type" | "metadata" | "encryption" | "children">>) & (new (...args: any[]) => import("../service/CrudBuilder").IDelete) & (new (...args: any[]) => import("../service/CrudBuilder").IList<Token, ListTokensQuery>);
|
|
@@ -5,28 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.BasisTheoryTokens = 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");
|
|
11
13
|
|
|
12
14
|
var _CrudBuilder = require("../service/CrudBuilder");
|
|
13
15
|
|
|
14
|
-
var _common = require("../common");
|
|
15
|
-
|
|
16
16
|
const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens extends _service.BasisTheoryService {
|
|
17
17
|
constructor(options) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const _options = options; // eslint-disable-next-line unicorn/prefer-spread
|
|
19
|
+
|
|
20
|
+
_options.transformRequest = [].concat(_utils.transformTokenRequestSnakeCase, options.transformRequest || []); // eslint-disable-next-line unicorn/prefer-spread
|
|
21
|
+
|
|
22
|
+
_options.transformResponse = [].concat(_utils.transformTokenResponseCamelCase, options.transformResponse || []);
|
|
23
|
+
super(_options);
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* @deprecated use {@link create} instead
|
|
24
27
|
*/
|
|
25
28
|
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
createToken(data) {
|
|
28
31
|
return this.client.post('/', {
|
|
29
|
-
data
|
|
32
|
+
data
|
|
30
33
|
}).then(_utils.dataExtractor);
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
@@ -34,7 +37,7 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
|
|
|
34
37
|
*/
|
|
35
38
|
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
getToken(id) {
|
|
38
41
|
return this.client.get(id).then(_utils.dataExtractor);
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
@@ -46,17 +49,17 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
|
|
|
46
49
|
await this.client.delete(id);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
retrieve(id, query = {}, options = {}) {
|
|
50
53
|
const url = `/${id}${(0, _common.getQueryParams)(query)}`;
|
|
51
54
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
retrieveDecrypted(id, query = {}, options = {}) {
|
|
55
58
|
const url = `/${id}/decrypt${(0, _common.getQueryParams)(query)}`;
|
|
56
59
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
57
60
|
}
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
listDecrypted(query = {}, options = {}) {
|
|
60
63
|
const url = `/decrypt${(0, _common.getQueryParams)(query)}`;
|
|
61
64
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
62
65
|
}
|
|
@@ -71,12 +74,12 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
|
|
|
71
74
|
await this.client.delete(url, (0, _common.createRequestConfig)(options));
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
createChild(parentId, token, options) {
|
|
75
78
|
const url = `/${parentId}/children`;
|
|
76
79
|
return this.client.post(url, token, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
listChildren(parentId, query = {}, options = {}) {
|
|
80
83
|
const url = `/${parentId}/children${(0, _common.getQueryParams)(query)}`;
|
|
81
84
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
82
85
|
}
|
package/tokens/types.d.ts
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
import type { PaginatedQuery } from '../service';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type Primitive = string | number | boolean | null;
|
|
3
|
+
declare type DataObject = {
|
|
4
4
|
[member: string]: TokenData;
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
declare type DataArray = Array<TokenData>;
|
|
7
|
+
declare type TokenData = Primitive | DataObject | DataArray;
|
|
8
|
+
declare type TokenType = 'token' | 'card' | 'bank' | 'card:reaction' | 'bank:reaction';
|
|
9
|
+
interface TokenEncryptionKey {
|
|
10
10
|
key: string;
|
|
11
11
|
alg: string;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface TokenEncryption {
|
|
14
14
|
cek: TokenEncryptionKey;
|
|
15
15
|
kek: TokenEncryptionKey;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
interface Token {
|
|
18
18
|
id: string;
|
|
19
19
|
tenantId: string;
|
|
20
20
|
type?: TokenType;
|
|
21
21
|
data: TokenData;
|
|
22
|
+
fingerprint?: string;
|
|
22
23
|
metadata?: Record<string, string>;
|
|
23
24
|
encryption?: TokenEncryption;
|
|
24
25
|
children?: Token[];
|
|
25
26
|
createdBy: string;
|
|
26
27
|
createdAt: string;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
declare type CreateTokenModel = Pick<Token, 'type' | 'data' | 'metadata' | 'encryption' | 'children'>;
|
|
30
|
+
interface RetrieveTokenQuery {
|
|
30
31
|
children?: boolean;
|
|
31
32
|
childrenType?: TokenType | TokenType[];
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
interface ListTokensQuery extends PaginatedQuery {
|
|
34
35
|
id?: string | string[];
|
|
35
36
|
type?: TokenType | TokenType[];
|
|
36
37
|
children?: boolean;
|
|
37
38
|
childrenType?: TokenType | TokenType[];
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
interface ListTokensQueryDecrypted extends ListTokensQuery {
|
|
40
41
|
decryptType?: TokenType | TokenType[];
|
|
41
42
|
}
|
|
43
|
+
export type { Primitive, DataObject, DataArray, TokenData, TokenType, TokenEncryptionKey, TokenEncryption, Token, CreateTokenModel, RetrieveTokenQuery, ListTokensQuery, ListTokensQueryDecrypted, };
|
package/types.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { BasisTheoryElements } from './elements';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
declare type InitStatus = 'not-started' | 'in-progress' | 'done' | 'error';
|
|
3
|
+
declare type Clients = 'tokens' | 'atomic' | 'applications' | 'reactorFormulas' | 'reactors' | 'atomicBanks' | 'atomicCards' | 'permissions' | 'logs' | 'tenants';
|
|
4
|
+
declare type ClientsBasePathMap = {
|
|
5
5
|
[key in Clients]: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
declare type Providers = 'BROWSER' | 'NODE';
|
|
8
|
+
declare const algorithm: readonly ["RSA", "AES"];
|
|
9
|
+
declare type Algorithm = typeof algorithm[number];
|
|
10
|
+
interface EncryptionProviderOptions {
|
|
11
11
|
defaultKeySize: number;
|
|
12
12
|
keyExpirationInDays: number;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
interface EncryptionOptions {
|
|
15
15
|
algorithm: Algorithm;
|
|
16
16
|
options?: EncryptionProviderOptions;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
interface BasisTheoryInitOptions {
|
|
19
19
|
apiBaseUrl?: string;
|
|
20
20
|
elements?: boolean;
|
|
21
21
|
elementsBaseUrl?: string;
|
|
@@ -25,3 +25,5 @@ declare global {
|
|
|
25
25
|
BasisTheoryElements?: BasisTheoryElements;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
export { algorithm };
|
|
29
|
+
export type { InitStatus, Clients, ClientsBasePathMap, Providers, Algorithm, EncryptionProviderOptions, EncryptionOptions, BasisTheoryInitOptions, };
|