@basis-theory/basis-theory-js 1.39.0 → 1.41.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/atomic/banks/BasisTheoryAtomicBanks.d.ts +1 -2
- package/atomic/banks/BasisTheoryAtomicBanks.js +0 -7
- package/atomic/cards/BasisTheoryAtomicCards.d.ts +1 -2
- package/atomic/cards/BasisTheoryAtomicCards.js +0 -7
- package/common/constants.d.ts +2 -1
- package/common/constants.js +3 -1
- package/common/utils.d.ts +1 -2
- package/common/utils.js +2 -19
- package/elements/services/tokens.js +8 -0
- package/package.json +1 -1
- package/tokens/BasisTheoryTokens.js +1 -1
- package/types/elements/services/tokens.d.ts +5 -4
- package/types/models/shared.d.ts +1 -5
- package/types/models/tokens.d.ts +1 -0
- package/types/sdk/services/banks.d.ts +2 -2
- package/types/sdk/services/cards.d.ts +2 -2
- package/types/sdk/services/shared.d.ts +1 -5
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { BasisTheoryServiceOptions } from '@/service';
|
|
2
|
-
import type { AtomicBank,
|
|
2
|
+
import type { AtomicBank, UpdateAtomicBank } from '@/types/models';
|
|
3
3
|
import type { PaginatedQuery, RequestOptions } from '@/types/sdk';
|
|
4
4
|
export declare const BasisTheoryAtomicBanks: {
|
|
5
5
|
new (options: BasisTheoryServiceOptions): {
|
|
6
6
|
update(id: string, request: UpdateAtomicBank, options?: RequestOptions | undefined): Promise<AtomicBank>;
|
|
7
|
-
react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
|
|
8
7
|
readonly client: import("axios").AxiosInstance;
|
|
9
8
|
};
|
|
10
9
|
} & (new (...args: any[]) => import("../../types/sdk/services/shared").Create<AtomicBank, Pick<AtomicBank, "bank" | "metadata">>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Retrieve<AtomicBank>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../../types/sdk/services/shared").List<AtomicBank, PaginatedQuery>);
|
|
@@ -26,12 +26,5 @@ const BasisTheoryAtomicBanks = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
|
|
|
26
26
|
return this.client.patch(`/${id}`, request, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
react(tokenId, request, options) {
|
|
30
|
-
return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
|
|
31
|
-
transformRequest: _common.transformAtomicReactionRequestSnakeCase,
|
|
32
|
-
transformResponse: _common.proxyRaw
|
|
33
|
-
})).then(_common.dataExtractor);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
29
|
}).create().retrieve().delete().list().build();
|
|
37
30
|
exports.BasisTheoryAtomicBanks = BasisTheoryAtomicBanks;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { BasisTheoryServiceOptions } from '@/service';
|
|
2
|
-
import type { AtomicCard,
|
|
2
|
+
import type { AtomicCard, UpdateAtomicCard } from '@/types/models';
|
|
3
3
|
import type { PaginatedQuery, RequestOptions } from '@/types/sdk';
|
|
4
4
|
export declare const BasisTheoryAtomicCards: {
|
|
5
5
|
new (options: BasisTheoryServiceOptions): {
|
|
6
6
|
update(id: string, request: UpdateAtomicCard, options?: RequestOptions | undefined): Promise<AtomicCard>;
|
|
7
|
-
react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions | undefined): Promise<ReactResponse>;
|
|
8
7
|
readonly client: import("axios").AxiosInstance;
|
|
9
8
|
};
|
|
10
9
|
} & (new (...args: any[]) => import("../../types/sdk/services/shared").Create<AtomicCard, Pick<AtomicCard, "card" | "metadata">>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Retrieve<AtomicCard>) & (new (...args: any[]) => import("../../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../../types/sdk/services/shared").List<AtomicCard, PaginatedQuery>);
|
|
@@ -28,12 +28,5 @@ const BasisTheoryAtomicCards = new _CrudBuilder.CrudBuilder(class BasisTheoryAto
|
|
|
28
28
|
return this.client.patch(`/${id}`, request, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
react(tokenId, request, options) {
|
|
32
|
-
return this.client.post(`/${tokenId}/react`, request, (0, _common.createRequestConfig)(options, {
|
|
33
|
-
transformRequest: _common.transformAtomicReactionRequestSnakeCase,
|
|
34
|
-
transformResponse: _common.proxyRaw
|
|
35
|
-
})).then(_common.dataExtractor);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
31
|
}).create().retrieve().delete().list().build();
|
|
39
32
|
exports.BasisTheoryAtomicCards = BasisTheoryAtomicCards;
|
package/common/constants.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BasisTheoryServicesBasePathMap } from '@/types/sdk';
|
|
2
2
|
declare const API_KEY_HEADER = "BT-API-KEY";
|
|
3
3
|
declare const BT_TRACE_ID_HEADER = "bt-trace-id";
|
|
4
|
+
declare const CONTENT_TYPE_HEADER = "Content-Type";
|
|
4
5
|
declare const USER_AGENT_HEADER = "User-Agent";
|
|
5
6
|
declare const CLIENT_USER_AGENT_HEADER = "BT-CLIENT-USER-AGENT";
|
|
6
7
|
declare const USER_AGENT_CLIENT = "BasisTheoryJS";
|
|
@@ -11,4 +12,4 @@ declare const BROWSER_LIST: {
|
|
|
11
12
|
browserName: string;
|
|
12
13
|
browserUA: string;
|
|
13
14
|
}[];
|
|
14
|
-
export { API_KEY_HEADER, BT_TRACE_ID_HEADER, USER_AGENT_HEADER, CLIENT_USER_AGENT_HEADER, USER_AGENT_CLIENT, DEFAULT_BASE_URL, DEFAULT_ELEMENTS_BASE_URL, CLIENT_BASE_PATHS, BROWSER_LIST, };
|
|
15
|
+
export { API_KEY_HEADER, BT_TRACE_ID_HEADER, CONTENT_TYPE_HEADER, USER_AGENT_HEADER, CLIENT_USER_AGENT_HEADER, USER_AGENT_CLIENT, DEFAULT_BASE_URL, DEFAULT_ELEMENTS_BASE_URL, CLIENT_BASE_PATHS, BROWSER_LIST, };
|
package/common/constants.js
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.USER_AGENT_HEADER = exports.USER_AGENT_CLIENT = exports.DEFAULT_ELEMENTS_BASE_URL = exports.DEFAULT_BASE_URL = exports.CLIENT_USER_AGENT_HEADER = exports.CLIENT_BASE_PATHS = exports.BT_TRACE_ID_HEADER = exports.BROWSER_LIST = exports.API_KEY_HEADER = void 0;
|
|
6
|
+
exports.USER_AGENT_HEADER = exports.USER_AGENT_CLIENT = exports.DEFAULT_ELEMENTS_BASE_URL = exports.DEFAULT_BASE_URL = exports.CONTENT_TYPE_HEADER = exports.CLIENT_USER_AGENT_HEADER = exports.CLIENT_BASE_PATHS = exports.BT_TRACE_ID_HEADER = exports.BROWSER_LIST = exports.API_KEY_HEADER = void 0;
|
|
7
7
|
const API_KEY_HEADER = 'BT-API-KEY';
|
|
8
8
|
exports.API_KEY_HEADER = API_KEY_HEADER;
|
|
9
9
|
const BT_TRACE_ID_HEADER = 'bt-trace-id';
|
|
10
10
|
exports.BT_TRACE_ID_HEADER = BT_TRACE_ID_HEADER;
|
|
11
|
+
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
12
|
+
exports.CONTENT_TYPE_HEADER = CONTENT_TYPE_HEADER;
|
|
11
13
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12
14
|
exports.USER_AGENT_HEADER = USER_AGENT_HEADER;
|
|
13
15
|
const CLIENT_USER_AGENT_HEADER = 'BT-CLIENT-USER-AGENT';
|
package/common/utils.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ declare const proxyRaw: AxiosTransformer;
|
|
|
6
6
|
declare const transformReactorRequestSnakeCase: AxiosTransformer;
|
|
7
7
|
declare const transformAtomicRequestSnakeCase: AxiosTransformer;
|
|
8
8
|
declare const transformTokenRequestSnakeCase: AxiosTransformer;
|
|
9
|
-
declare const transformAtomicReactionRequestSnakeCase: AxiosTransformer;
|
|
10
9
|
declare const transformTokenResponseCamelCase: AxiosTransformer;
|
|
11
10
|
declare const transformReactorResponseCamelCase: AxiosTransformer;
|
|
12
11
|
declare const transformResponseCamelCase: AxiosTransformer;
|
|
@@ -22,4 +21,4 @@ declare const getBrowser: () => string;
|
|
|
22
21
|
declare const getOSVersion: () => string;
|
|
23
22
|
declare const getRuntime: () => string;
|
|
24
23
|
declare const buildClientUserAgentString: (appInfo?: ApplicationInfo | undefined) => string;
|
|
25
|
-
export { assertInit, transformRequestSnakeCase, proxyRaw, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase,
|
|
24
|
+
export { assertInit, transformRequestSnakeCase, proxyRaw, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformerWithDefault, errorInterceptor, getQueryParams, buildUserAgentString, buildClientUserAgentString, getOSVersion, getRuntime, getBrowser, };
|
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.
|
|
6
|
+
exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.proxyRaw = exports.getRuntime = exports.getQueryParams = exports.getOSVersion = exports.getBrowser = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformerWithDefault = exports.concatRequestTransformerWithDefault = exports.buildUserAgentString = exports.buildClientUserAgentString = exports.assertInit = void 0;
|
|
7
7
|
|
|
8
8
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9
9
|
|
|
@@ -99,23 +99,6 @@ const transformTokenRequestSnakeCase = token => {
|
|
|
99
99
|
|
|
100
100
|
exports.transformTokenRequestSnakeCase = transformTokenRequestSnakeCase;
|
|
101
101
|
|
|
102
|
-
const transformAtomicReactionRequestSnakeCase = request => {
|
|
103
|
-
if (typeof request === 'undefined') {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return { ...(0, _snakecaseKeys.default)(request, {
|
|
108
|
-
deep: true
|
|
109
|
-
}),
|
|
110
|
-
...(request.requestParameters !== undefined ? // eslint-disable-next-line camelcase
|
|
111
|
-
{
|
|
112
|
-
request_parameters: request.requestParameters
|
|
113
|
-
} : {})
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
exports.transformAtomicReactionRequestSnakeCase = transformAtomicReactionRequestSnakeCase;
|
|
118
|
-
|
|
119
102
|
const transformTokenResponseCamelCase = token => {
|
|
120
103
|
if (typeof token === 'undefined') {
|
|
121
104
|
return undefined;
|
|
@@ -267,7 +250,7 @@ const getQueryParams = (query = {}) => {
|
|
|
267
250
|
} else if (value && typeof value === 'object') {
|
|
268
251
|
const objectKeys = Object.keys(value);
|
|
269
252
|
objectKeys.forEach(objectKey => {
|
|
270
|
-
appendSafe(`${key}.${objectKey}`, value[objectKey], true);
|
|
253
|
+
appendSafe(`${String(key)}.${objectKey}`, value[objectKey], true);
|
|
271
254
|
});
|
|
272
255
|
} else {
|
|
273
256
|
appendSafe(String(key), value);
|
|
@@ -16,6 +16,14 @@ const delegateTokens = elements => class BasisTheoryTokensElementsDelegate exten
|
|
|
16
16
|
return super.create(payload, requestOptions);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
update(id, payload, requestOptions) {
|
|
20
|
+
if (elements !== null && elements !== void 0 && elements.hasElement(payload)) {
|
|
21
|
+
return elements.tokens.update(id, payload, requestOptions);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return super.update(id, payload, requestOptions);
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
};
|
|
20
28
|
|
|
21
29
|
exports.delegateTokens = delegateTokens;
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
|
|
|
33
33
|
const config = (0, _common.createRequestConfig)(options);
|
|
34
34
|
return this.client.patch(url, model, { ...config,
|
|
35
35
|
headers: { ...(config === null || config === void 0 ? void 0 : config.headers),
|
|
36
|
-
|
|
36
|
+
[_common.CONTENT_TYPE_HEADER]: 'application/merge-patch+json'
|
|
37
37
|
}
|
|
38
38
|
}).then(_utils.dataExtractor);
|
|
39
39
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ElementValue } from '@/types/elements';
|
|
2
|
-
import type { CreateToken as CreateTokenModel, Token } from '@/types/models';
|
|
3
|
-
import type { Create } from '@/types/sdk';
|
|
2
|
+
import type { CreateToken as CreateTokenModel, UpdateToken as UpdateTokenModel, Token } from '@/types/models';
|
|
3
|
+
import type { Create, Update } from '@/types/sdk';
|
|
4
4
|
declare type CreateToken = CreateTokenModel<ElementValue>;
|
|
5
|
-
declare type
|
|
6
|
-
|
|
5
|
+
declare type UpdateToken = UpdateTokenModel<ElementValue>;
|
|
6
|
+
declare type Tokens = Create<Token, CreateToken> & Update<Token, UpdateToken>;
|
|
7
|
+
export type { Tokens, CreateToken, UpdateToken };
|
package/types/models/shared.d.ts
CHANGED
|
@@ -14,12 +14,8 @@ interface TokenBase<T extends TokenType = TokenType> extends Auditable {
|
|
|
14
14
|
fingerprint?: string;
|
|
15
15
|
metadata?: Record<string, string>;
|
|
16
16
|
}
|
|
17
|
-
interface AtomicReactRequest {
|
|
18
|
-
reactorId: string;
|
|
19
|
-
requestParameters?: Record<string, unknown>;
|
|
20
|
-
}
|
|
21
17
|
interface ReactResponse {
|
|
22
18
|
tokens: DataObject;
|
|
23
19
|
raw: DataObject;
|
|
24
20
|
}
|
|
25
|
-
export type { Primitive, Auditable, TokenType, TokenBase,
|
|
21
|
+
export type { Primitive, Auditable, TokenType, TokenBase, ReactResponse };
|
package/types/models/tokens.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ interface Token<DataType = Primitive> extends TokenBase {
|
|
|
38
38
|
}
|
|
39
39
|
declare type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask'> & {
|
|
40
40
|
deduplicateToken?: boolean;
|
|
41
|
+
id?: string;
|
|
41
42
|
};
|
|
42
43
|
declare type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask'> & {
|
|
43
44
|
privacy: Omit<TokenPrivacy, 'classification'>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AtomicBank, CreateAtomicBank, UpdateAtomicBank } from '@/types/models';
|
|
2
|
-
import type { Create, Retrieve, Update, Delete, List
|
|
3
|
-
interface AtomicBanks extends Create<AtomicBank, CreateAtomicBank>, Retrieve<AtomicBank>, Update<AtomicBank, UpdateAtomicBank>, Delete, List<AtomicBank
|
|
2
|
+
import type { Create, Retrieve, Update, Delete, List } from './shared';
|
|
3
|
+
interface AtomicBanks extends Create<AtomicBank, CreateAtomicBank>, Retrieve<AtomicBank>, Update<AtomicBank, UpdateAtomicBank>, Delete, List<AtomicBank> {
|
|
4
4
|
}
|
|
5
5
|
export type { AtomicBanks };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AtomicCard, CreateAtomicCard, UpdateAtomicCard } from '@/types/models';
|
|
2
|
-
import type { Create, Retrieve, Update, Delete, List
|
|
3
|
-
interface AtomicCards extends Create<AtomicCard, CreateAtomicCard>, Retrieve<AtomicCard>, Update<AtomicCard, UpdateAtomicCard>, Delete, List<AtomicCard
|
|
2
|
+
import type { Create, Retrieve, Update, Delete, List } from './shared';
|
|
3
|
+
interface AtomicCards extends Create<AtomicCard, CreateAtomicCard>, Retrieve<AtomicCard>, Update<AtomicCard, UpdateAtomicCard>, Delete, List<AtomicCard> {
|
|
4
4
|
}
|
|
5
5
|
export type { AtomicCards };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AtomicReactRequest, ReactResponse } from '@/types/models';
|
|
2
1
|
interface RequestOptions {
|
|
3
2
|
apiKey?: string;
|
|
4
3
|
correlationId?: string;
|
|
@@ -34,7 +33,4 @@ declare type Delete = {
|
|
|
34
33
|
declare type List<T, Q extends PaginatedQuery = PaginatedQuery> = {
|
|
35
34
|
list(query?: Q, options?: RequestOptions): Promise<PaginatedList<T>>;
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
react(tokenId: string, request: AtomicReactRequest, options?: RequestOptions): Promise<ReactResponse>;
|
|
39
|
-
};
|
|
40
|
-
export type { RequestOptions, PaginatedQuery, PaginatedList, Create, Retrieve, Update, Delete, List, AtomicReact, };
|
|
36
|
+
export type { RequestOptions, PaginatedQuery, PaginatedList, Create, Retrieve, Update, Delete, List, };
|