@basis-theory/basis-theory-js 1.10.0 → 1.13.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.d.ts +3 -0
- package/BasisTheory.js +10 -0
- package/atomic/banks/BasisTheoryAtomicBanks.d.ts +2 -4
- package/atomic/banks/BasisTheoryAtomicBanks.js +1 -7
- package/atomic/cards/BasisTheoryAtomicCards.d.ts +3 -5
- package/atomic/cards/BasisTheoryAtomicCards.js +1 -7
- package/atomic/cards/types.d.ts +2 -18
- package/atomic/types.d.ts +6 -3
- package/common/constants.js +1 -0
- package/common/utils.d.ts +2 -1
- package/common/utils.js +11 -4
- package/logs/types.d.ts +2 -1
- package/package.json +1 -1
- package/tokenize/BasisTheoryTokenize.d.ts +6 -0
- package/tokenize/BasisTheoryTokenize.js +33 -0
- package/tokenize/index.d.ts +1 -0
- package/tokenize/index.js +13 -0
- package/tokenize/types.d.ts +7 -0
- package/tokenize/types.js +1 -0
- package/tokens/BasisTheoryTokens.d.ts +4 -4
- package/tokens/BasisTheoryTokens.js +4 -4
- package/tokens/types.d.ts +4 -10
- package/types.d.ts +1 -1
package/BasisTheory.d.ts
CHANGED
|
@@ -9,12 +9,14 @@ import { BasisTheoryPermissions } from './permissions';
|
|
|
9
9
|
import { BasisTheoryReactorFormulas } from './reactor-formulas';
|
|
10
10
|
import { BasisTheoryReactors } from './reactors';
|
|
11
11
|
import { BasisTheoryTenants } from './tenants';
|
|
12
|
+
import { BasisTheoryTokenize } from './tokenize';
|
|
12
13
|
import { BasisTheoryTokens } from './tokens';
|
|
13
14
|
import type { BasisTheoryInitOptions } from './types';
|
|
14
15
|
export declare class BasisTheory {
|
|
15
16
|
private _initStatus;
|
|
16
17
|
private _initOptions?;
|
|
17
18
|
private _tokens?;
|
|
19
|
+
private _tokenize?;
|
|
18
20
|
private _atomic?;
|
|
19
21
|
private _encryption?;
|
|
20
22
|
private _elements?;
|
|
@@ -30,6 +32,7 @@ export declare class BasisTheory {
|
|
|
30
32
|
private loadElements;
|
|
31
33
|
get initOptions(): Required<BasisTheoryInitOptions>;
|
|
32
34
|
get tokens(): BasisTheoryTokens;
|
|
35
|
+
get tokenize(): BasisTheoryTokenize;
|
|
33
36
|
get atomic(): BasisTheoryAtomic;
|
|
34
37
|
get encryption(): BasisTheoryEncryptionAdapters;
|
|
35
38
|
get applications(): BasisTheoryApplications;
|
package/BasisTheory.js
CHANGED
|
@@ -29,6 +29,8 @@ var _reactors = require("./reactors");
|
|
|
29
29
|
|
|
30
30
|
var _tenants = require("./tenants");
|
|
31
31
|
|
|
32
|
+
var _tokenize = require("./tokenize");
|
|
33
|
+
|
|
32
34
|
var _tokens = require("./tokens");
|
|
33
35
|
|
|
34
36
|
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; }
|
|
@@ -75,6 +77,10 @@ class BasisTheory {
|
|
|
75
77
|
apiKey,
|
|
76
78
|
baseURL: new URL(_constants.CLIENT_BASE_PATHS.tokens, baseUrl).toString()
|
|
77
79
|
});
|
|
80
|
+
this._tokenize = new _tokenize.BasisTheoryTokenize({
|
|
81
|
+
apiKey,
|
|
82
|
+
baseURL: new URL(_constants.CLIENT_BASE_PATHS.tokenize, baseUrl).toString()
|
|
83
|
+
});
|
|
78
84
|
this._atomic = new _atomic.BasisTheoryAtomic({
|
|
79
85
|
apiKey,
|
|
80
86
|
baseURL: new URL(_constants.CLIENT_BASE_PATHS.atomic, baseUrl).toString()
|
|
@@ -151,6 +157,10 @@ class BasisTheory {
|
|
|
151
157
|
return (0, _common.assertInit)(this._tokens);
|
|
152
158
|
}
|
|
153
159
|
|
|
160
|
+
get tokenize() {
|
|
161
|
+
return (0, _common.assertInit)(this._tokenize);
|
|
162
|
+
}
|
|
163
|
+
|
|
154
164
|
get atomic() {
|
|
155
165
|
return (0, _common.assertInit)(this._atomic);
|
|
156
166
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { BasisTheoryServiceOptions, PaginatedQuery, RequestOptions } from '../../service';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ReactRequest } from '../types';
|
|
2
|
+
import type { ReactRequest, ReactResponse } from '../types';
|
|
4
3
|
import type { AtomicBank, UpdateAtomicBankModel } from './types';
|
|
5
4
|
export declare const BasisTheoryAtomicBanks: {
|
|
6
5
|
new (options: BasisTheoryServiceOptions): {
|
|
7
6
|
update(id: string, request: UpdateAtomicBankModel, options?: RequestOptions | undefined): Promise<AtomicBank>;
|
|
8
7
|
retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicBank>;
|
|
9
|
-
react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<
|
|
10
|
-
retrieveReaction(atomicBankId: string, reactionTokenId: string, options?: RequestOptions | undefined): Promise<Token>;
|
|
8
|
+
react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
|
|
11
9
|
readonly client: import("axios").AxiosInstance;
|
|
12
10
|
};
|
|
13
11
|
} & (new (...args: any[]) => import("../../service/CrudBuilder").ICreate<AtomicBank, Pick<AtomicBank, "bank" | "metadata">>) & (new (...args: any[]) => import("../../service/CrudBuilder").IRetrieve<AtomicBank>) & (new (...args: any[]) => import("../../service/CrudBuilder").IDelete) & (new (...args: any[]) => import("../../service/CrudBuilder").IList<AtomicBank, PaginatedQuery>);
|
|
@@ -33,13 +33,7 @@ const BasisTheoryAtomicBanks = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
|
|
|
33
33
|
react(id, request, options) {
|
|
34
34
|
return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
|
|
35
35
|
transformRequest: _common.transformAtomicReactionRequestSnakeCase,
|
|
36
|
-
transformResponse: _common.
|
|
37
|
-
})).then(_common.dataExtractor);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
retrieveReaction(atomicBankId, reactionTokenId, options) {
|
|
41
|
-
return this.client.get(`/${atomicBankId}/reactions/${reactionTokenId}`, (0, _common.createRequestConfig)(options, {
|
|
42
|
-
transformResponse: _common.transformTokenResponseCamelCase
|
|
36
|
+
transformResponse: _common.proxyRaw
|
|
43
37
|
})).then(_common.dataExtractor);
|
|
44
38
|
}
|
|
45
39
|
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { BasisTheoryServiceOptions, PaginatedQuery, RequestOptions } from '../../service';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ReactRequest } from '../types';
|
|
2
|
+
import type { ReactRequest, ReactResponse } from '../types';
|
|
4
3
|
import type { AtomicCard, UpdateAtomicCardModel } from './types';
|
|
5
4
|
export declare const BasisTheoryAtomicCards: {
|
|
6
5
|
new (options: BasisTheoryServiceOptions): {
|
|
7
6
|
update(id: string, request: UpdateAtomicCardModel, options?: RequestOptions | undefined): Promise<AtomicCard>;
|
|
8
7
|
retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicCard>;
|
|
9
|
-
react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<
|
|
10
|
-
retrieveReaction(atomicCardId: string, reactionTokenId: string, options?: RequestOptions | undefined): Promise<Token>;
|
|
8
|
+
react(id: string, request: ReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
|
|
11
9
|
readonly client: import("axios").AxiosInstance;
|
|
12
10
|
};
|
|
13
|
-
} & (new (...args: any[]) => import("../../service/CrudBuilder").ICreate<AtomicCard, Pick<AtomicCard, "card" | "metadata"
|
|
11
|
+
} & (new (...args: any[]) => import("../../service/CrudBuilder").ICreate<AtomicCard, Pick<AtomicCard, "card" | "metadata">>) & (new (...args: any[]) => import("../../service/CrudBuilder").IRetrieve<AtomicCard>) & (new (...args: any[]) => import("../../service/CrudBuilder").IDelete) & (new (...args: any[]) => import("../../service/CrudBuilder").IList<AtomicCard, PaginatedQuery>);
|
|
14
12
|
export declare type BasisTheoryAtomicCards = InstanceType<typeof BasisTheoryAtomicCards>;
|
|
@@ -35,13 +35,7 @@ const BasisTheoryAtomicCards = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
|
|
|
35
35
|
react(id, request, options) {
|
|
36
36
|
return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
|
|
37
37
|
transformRequest: _common.transformAtomicReactionRequestSnakeCase,
|
|
38
|
-
transformResponse: _common.
|
|
39
|
-
})).then(_common.dataExtractor);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
retrieveReaction(atomicCardId, reactionTokenId, options) {
|
|
43
|
-
return this.client.get(`/${atomicCardId}/reactions/${reactionTokenId}`, (0, _common.createRequestConfig)(options, {
|
|
44
|
-
transformResponse: _common.transformTokenResponseCamelCase
|
|
38
|
+
transformResponse: _common.proxyRaw
|
|
45
39
|
})).then(_common.dataExtractor);
|
|
46
40
|
}
|
|
47
41
|
|
package/atomic/cards/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Atomic } from '../types';
|
|
2
2
|
interface AtomicCard extends Atomic {
|
|
3
3
|
card: Card;
|
|
4
|
-
billingDetails?: BillingDetails;
|
|
5
4
|
}
|
|
6
5
|
interface Card {
|
|
7
6
|
number: string;
|
|
@@ -9,23 +8,8 @@ interface Card {
|
|
|
9
8
|
expirationYear?: number;
|
|
10
9
|
cvc?: string;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
name?: string;
|
|
14
|
-
email?: string;
|
|
15
|
-
phone?: string;
|
|
16
|
-
address?: Address;
|
|
17
|
-
}
|
|
18
|
-
interface Address {
|
|
19
|
-
line1?: string;
|
|
20
|
-
line2?: string;
|
|
21
|
-
city?: string;
|
|
22
|
-
state?: string;
|
|
23
|
-
postalCode?: string;
|
|
24
|
-
country?: string;
|
|
25
|
-
}
|
|
26
|
-
declare type CreateAtomicCardModel = Pick<AtomicCard, 'card' | 'billingDetails' | 'metadata'>;
|
|
11
|
+
declare type CreateAtomicCardModel = Pick<AtomicCard, 'card' | 'metadata'>;
|
|
27
12
|
interface UpdateAtomicCardModel {
|
|
28
|
-
billingDetails?: BillingDetails;
|
|
29
13
|
card?: Partial<Card>;
|
|
30
14
|
}
|
|
31
|
-
export type { AtomicCard, Card,
|
|
15
|
+
export type { AtomicCard, Card, CreateAtomicCardModel, UpdateAtomicCardModel };
|
package/atomic/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TokenType } from '../tokens';
|
|
1
|
+
import type { DataObject, TokenType } from '../tokens';
|
|
2
2
|
import type { Auditable } from '../types';
|
|
3
3
|
interface Atomic extends Auditable {
|
|
4
4
|
id: string;
|
|
@@ -10,6 +10,9 @@ interface Atomic extends Auditable {
|
|
|
10
10
|
interface ReactRequest {
|
|
11
11
|
reactorId: string;
|
|
12
12
|
requestParameters?: Record<string, unknown>;
|
|
13
|
-
metadata?: Record<string, string>;
|
|
14
13
|
}
|
|
15
|
-
|
|
14
|
+
interface ReactResponse {
|
|
15
|
+
tokens: DataObject;
|
|
16
|
+
raw: DataObject;
|
|
17
|
+
}
|
|
18
|
+
export type { Atomic, ReactRequest, ReactResponse };
|
package/common/constants.js
CHANGED
|
@@ -14,6 +14,7 @@ const DEFAULT_ELEMENTS_BASE_URL = `https://${"elements.basistheory.com"}`;
|
|
|
14
14
|
exports.DEFAULT_ELEMENTS_BASE_URL = DEFAULT_ELEMENTS_BASE_URL;
|
|
15
15
|
const CLIENT_BASE_PATHS = {
|
|
16
16
|
tokens: 'tokens',
|
|
17
|
+
tokenize: 'tokenize',
|
|
17
18
|
atomic: 'atomic',
|
|
18
19
|
applications: 'applications',
|
|
19
20
|
tenants: 'tenants/self',
|
package/common/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AxiosRequestConfig, AxiosResponse, AxiosTransformer } from 'axios'
|
|
|
2
2
|
import type { RequestOptions } from '../service';
|
|
3
3
|
declare const assertInit: <T>(prop: T) => NonNullable<T>;
|
|
4
4
|
declare const transformRequestSnakeCase: AxiosTransformer;
|
|
5
|
+
declare const proxyRaw: AxiosTransformer;
|
|
5
6
|
declare const transformReactorRequestSnakeCase: AxiosTransformer;
|
|
6
7
|
declare const transformAtomicRequestSnakeCase: AxiosTransformer;
|
|
7
8
|
declare const transformTokenRequestSnakeCase: AxiosTransformer;
|
|
@@ -16,4 +17,4 @@ declare const concatResponseTransformermWithDefault: (responseTransformer: Axios
|
|
|
16
17
|
declare const createRequestConfig: (options?: RequestOptions | undefined, transformers?: Pick<AxiosRequestConfig, "transformRequest" | "transformResponse"> | undefined) => AxiosRequestConfig | undefined;
|
|
17
18
|
declare const errorInterceptor: (error: any) => void;
|
|
18
19
|
declare const getQueryParams: <Q>(query: Q) => string;
|
|
19
|
-
export { assertInit, transformRequestSnakeCase, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformAtomicReactionRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformermWithDefault, errorInterceptor, getQueryParams, };
|
|
20
|
+
export { assertInit, transformRequestSnakeCase, proxyRaw, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformAtomicReactionRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformermWithDefault, errorInterceptor, getQueryParams, };
|
package/common/utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.transformAtomicReactionRequestSnakeCase = exports.getQueryParams = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformermWithDefault = exports.concatRequestTransformerWithDefault = exports.assertInit = void 0;
|
|
6
|
+
exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.transformAtomicReactionRequestSnakeCase = exports.proxyRaw = exports.getQueryParams = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformermWithDefault = exports.concatRequestTransformerWithDefault = exports.assertInit = void 0;
|
|
7
7
|
|
|
8
8
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9
9
|
|
|
@@ -42,6 +42,10 @@ const transformRequestSnakeCase = data => {
|
|
|
42
42
|
|
|
43
43
|
exports.transformRequestSnakeCase = transformRequestSnakeCase;
|
|
44
44
|
|
|
45
|
+
const proxyRaw = data => data;
|
|
46
|
+
|
|
47
|
+
exports.proxyRaw = proxyRaw;
|
|
48
|
+
|
|
45
49
|
const transformReactorRequestSnakeCase = reactor => {
|
|
46
50
|
if (typeof reactor === 'undefined') {
|
|
47
51
|
return undefined;
|
|
@@ -85,6 +89,9 @@ const transformTokenRequestSnakeCase = token => {
|
|
|
85
89
|
...(token.data !== undefined ? {
|
|
86
90
|
data: token.data
|
|
87
91
|
} : {}),
|
|
92
|
+
...(token.mask !== undefined ? {
|
|
93
|
+
mask: token.mask
|
|
94
|
+
} : {}),
|
|
88
95
|
...(token.metadata !== undefined ? {
|
|
89
96
|
metadata: token.metadata
|
|
90
97
|
} : {})
|
|
@@ -104,9 +111,6 @@ const transformAtomicReactionRequestSnakeCase = request => {
|
|
|
104
111
|
...(request.requestParameters !== undefined ? // eslint-disable-next-line camelcase
|
|
105
112
|
{
|
|
106
113
|
request_parameters: request.requestParameters
|
|
107
|
-
} : {}),
|
|
108
|
-
...(request.metadata !== undefined ? {
|
|
109
|
-
metadata: request.metadata
|
|
110
114
|
} : {})
|
|
111
115
|
};
|
|
112
116
|
};
|
|
@@ -124,6 +128,9 @@ const transformTokenResponseCamelCase = token => {
|
|
|
124
128
|
...(token.data !== undefined ? {
|
|
125
129
|
data: token.data
|
|
126
130
|
} : {}),
|
|
131
|
+
...(token.mask !== undefined ? {
|
|
132
|
+
mask: token.mask
|
|
133
|
+
} : {}),
|
|
127
134
|
...(token.metadata !== undefined ? {
|
|
128
135
|
metadata: token.metadata
|
|
129
136
|
} : {})
|
package/logs/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BasisTheoryService, BasisTheoryServiceOptions, RequestOptions } from '../service';
|
|
2
|
+
import type { TokenizeData } from './types';
|
|
3
|
+
export declare class BasisTheoryTokenize extends BasisTheoryService {
|
|
4
|
+
constructor(options: BasisTheoryServiceOptions);
|
|
5
|
+
tokenize(tokens: TokenizeData, options?: RequestOptions): Promise<TokenizeData>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BasisTheoryTokenize = void 0;
|
|
7
|
+
|
|
8
|
+
var _common = require("../common");
|
|
9
|
+
|
|
10
|
+
var _utils = require("../common/utils");
|
|
11
|
+
|
|
12
|
+
var _service = require("../service");
|
|
13
|
+
|
|
14
|
+
class BasisTheoryTokenize extends _service.BasisTheoryService {
|
|
15
|
+
constructor(options) {
|
|
16
|
+
const _options = options; // eslint-disable-next-line unicorn/prefer-spread
|
|
17
|
+
|
|
18
|
+
_options.transformRequest = [].concat(_utils.transformTokenRequestSnakeCase, options.transformRequest || []); // eslint-disable-next-line unicorn/prefer-spread
|
|
19
|
+
|
|
20
|
+
_options.transformResponse = [].concat(_utils.transformTokenResponseCamelCase, options.transformResponse || []);
|
|
21
|
+
super(_options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
tokenize(tokens, options = {}) {
|
|
25
|
+
return this.client.post('/', tokens, (0, _common.createRequestConfig)(options, {
|
|
26
|
+
transformRequest: _utils.proxyRaw,
|
|
27
|
+
transformResponse: _utils.proxyRaw
|
|
28
|
+
})).then(_utils.dataExtractor);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.BasisTheoryTokenize = BasisTheoryTokenize;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BasisTheoryTokenize } from './BasisTheoryTokenize';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BasisTheoryTokenize", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _BasisTheoryTokenize.BasisTheoryTokenize;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _BasisTheoryTokenize = require("./BasisTheoryTokenize");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Primitive } from '../tokens';
|
|
2
|
+
declare type TokenizeObject<Other = Primitive> = {
|
|
3
|
+
[key: string]: Primitive | TokenizeObject<Other> | TokenizeArray<Other> | Other;
|
|
4
|
+
};
|
|
5
|
+
declare type TokenizeArray<Other = Primitive> = Array<Primitive | TokenizeObject<Other> | TokenizeArray<Other> | Other>;
|
|
6
|
+
declare type TokenizeData<Other = Primitive> = TokenizeArray<Other> | TokenizeObject<Other>;
|
|
7
|
+
export type { TokenizeData };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BasisTheoryServiceOptions, PaginatedList, RequestOptions } from '../service';
|
|
2
|
-
import type { Token, CreateTokenModel, ListTokensQuery,
|
|
2
|
+
import type { Token, CreateTokenModel, ListTokensQuery, ListTokensQueryDecrypted } from './types';
|
|
3
3
|
export declare const BasisTheoryTokens: {
|
|
4
4
|
new (options: BasisTheoryServiceOptions): {
|
|
5
|
-
retrieve(id: string,
|
|
6
|
-
retrieveDecrypted(id: string,
|
|
5
|
+
retrieve(id: string, options?: RequestOptions): Promise<Token>;
|
|
6
|
+
retrieveDecrypted(id: string, options?: RequestOptions): Promise<Token>;
|
|
7
7
|
listDecrypted(query?: ListTokensQueryDecrypted, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
8
8
|
createAssociation(parentId: string, childId: string, options?: RequestOptions | undefined): Promise<void>;
|
|
9
9
|
deleteAssociation(parentId: string, childId: string, options?: RequestOptions | undefined): Promise<void>;
|
|
@@ -11,5 +11,5 @@ export declare const BasisTheoryTokens: {
|
|
|
11
11
|
listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
12
12
|
readonly client: import("axios").AxiosInstance;
|
|
13
13
|
};
|
|
14
|
-
} & (new (...args: any[]) => import("../service/CrudBuilder").ICreate<Token, Pick<Token, "data" | "type" | "metadata" | "encryption"
|
|
14
|
+
} & (new (...args: any[]) => import("../service/CrudBuilder").ICreate<Token, Pick<Token, "data" | "type" | "metadata" | "encryption">>) & (new (...args: any[]) => import("../service/CrudBuilder").IDelete) & (new (...args: any[]) => import("../service/CrudBuilder").IList<Token, ListTokensQuery>);
|
|
15
15
|
export declare type BasisTheoryTokens = InstanceType<typeof BasisTheoryTokens>;
|
|
@@ -23,13 +23,13 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
|
|
|
23
23
|
super(_options);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
retrieve(id,
|
|
27
|
-
const url = `/${id}
|
|
26
|
+
retrieve(id, options = {}) {
|
|
27
|
+
const url = `/${id}`;
|
|
28
28
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
retrieveDecrypted(id,
|
|
32
|
-
const url = `/${id}/decrypt
|
|
31
|
+
retrieveDecrypted(id, options = {}) {
|
|
32
|
+
const url = `/${id}/decrypt`;
|
|
33
33
|
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
34
34
|
}
|
|
35
35
|
|
package/tokens/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare type DataObject = {
|
|
|
6
6
|
};
|
|
7
7
|
declare type DataArray = Array<TokenData>;
|
|
8
8
|
declare type TokenData = Primitive | DataObject | DataArray;
|
|
9
|
-
declare type TokenType = 'token' | 'card' | 'bank'
|
|
9
|
+
declare type TokenType = 'token' | 'card' | 'bank';
|
|
10
10
|
interface TokenEncryptionKey {
|
|
11
11
|
key: string;
|
|
12
12
|
alg: string;
|
|
@@ -21,22 +21,16 @@ interface Token extends Auditable {
|
|
|
21
21
|
type: TokenType;
|
|
22
22
|
data: TokenData;
|
|
23
23
|
fingerprint?: string;
|
|
24
|
+
mask?: DataObject;
|
|
24
25
|
metadata?: Record<string, string>;
|
|
25
26
|
encryption?: TokenEncryption;
|
|
26
|
-
children?: Token[];
|
|
27
|
-
}
|
|
28
|
-
declare type CreateTokenModel = Pick<Token, 'type' | 'data' | 'metadata' | 'encryption' | 'children'>;
|
|
29
|
-
interface RetrieveTokenQuery {
|
|
30
|
-
children?: boolean;
|
|
31
|
-
childrenType?: TokenType | TokenType[];
|
|
32
27
|
}
|
|
28
|
+
declare type CreateTokenModel = Pick<Token, 'type' | 'data' | 'metadata' | 'encryption'>;
|
|
33
29
|
interface ListTokensQuery extends PaginatedQuery {
|
|
34
30
|
id?: string | string[];
|
|
35
31
|
type?: TokenType | TokenType[];
|
|
36
|
-
children?: boolean;
|
|
37
|
-
childrenType?: TokenType | TokenType[];
|
|
38
32
|
}
|
|
39
33
|
interface ListTokensQueryDecrypted extends ListTokensQuery {
|
|
40
34
|
decryptType?: TokenType | TokenType[];
|
|
41
35
|
}
|
|
42
|
-
export type { Primitive, DataObject, DataArray, TokenData, TokenType, TokenEncryptionKey, TokenEncryption, Token, CreateTokenModel,
|
|
36
|
+
export type { Primitive, DataObject, DataArray, TokenData, TokenType, TokenEncryptionKey, TokenEncryption, Token, CreateTokenModel, ListTokensQuery, ListTokensQueryDecrypted, };
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BasisTheoryElements } from './elements';
|
|
2
2
|
declare type InitStatus = 'not-started' | 'in-progress' | 'done' | 'error';
|
|
3
|
-
declare type Clients = 'tokens' | 'atomic' | 'applications' | 'reactorFormulas' | 'reactors' | 'atomicBanks' | 'atomicCards' | 'permissions' | 'logs' | 'tenants';
|
|
3
|
+
declare type Clients = 'tokens' | 'tokenize' | 'atomic' | 'applications' | 'reactorFormulas' | 'reactors' | 'atomicBanks' | 'atomicCards' | 'permissions' | 'logs' | 'tenants';
|
|
4
4
|
declare type ClientsBasePathMap = {
|
|
5
5
|
[key in Clients]: string;
|
|
6
6
|
};
|