@basis-theory/basis-theory-js 4.10.0 → 4.10.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/common/utils.d.ts +4 -3
- package/common/utils.js +7 -7
- package/package.json +1 -1
- package/token-intents/BasisTheoryTokenIntents.d.ts +3 -2
- package/token-intents/BasisTheoryTokenIntents.js +13 -1
- package/tokens/BasisTheoryTokens.d.ts +1 -1
- package/types/models/shared.d.ts +9 -8
- package/types/models/token-intents.d.ts +19 -13
- package/types/models/tokens.d.ts +7 -9
package/common/utils.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, AxiosResponse, AxiosRequestTransformer, AxiosResponseTransformer } from 'axios';
|
|
2
2
|
import type { RequestTransformers } from '../service';
|
|
3
|
-
import type { Reactor, Proxy, Token, CreateReactor, UpdateReactor,
|
|
3
|
+
import type { Reactor, Proxy, Token, CreateReactor, UpdateReactor, CreateProxy, UpdateProxy, Primitive } from '../types/models';
|
|
4
4
|
import type { ApplicationInfo, PaginatedList, ProxyRequestOptions, RequestOptions } from '../types/sdk';
|
|
5
5
|
declare const assertInit: <T>(prop: T) => NonNullable<T>;
|
|
6
6
|
declare const transformRequestSnakeCase: <T, S>(data: T) => S | undefined;
|
|
7
7
|
declare const proxyRaw: <T>(data: T) => T | undefined;
|
|
8
8
|
declare const transformReactorRequestSnakeCase: (reactor: Reactor | CreateReactor | UpdateReactor) => Reactor | CreateReactor | UpdateReactor | undefined;
|
|
9
9
|
declare const transformProxyRequestSnakeCase: (proxy: Proxy | CreateProxy | UpdateProxy) => Proxy | CreateProxy | UpdateProxy | undefined;
|
|
10
|
-
|
|
11
|
-
declare const
|
|
10
|
+
type TokenLike<DataType> = Partial<Token<DataType>> & Record<string, unknown>;
|
|
11
|
+
declare const transformTokenRequestSnakeCase: <DataType = Primitive>(payload: TokenLike<DataType>) => TokenLike<DataType> | undefined;
|
|
12
|
+
declare const transformTokenResponseCamelCase: <DataType = Primitive>(tokenResponse: PaginatedList<Token> | TokenLike<DataType> | undefined) => PaginatedList<Token> | TokenLike<DataType> | undefined;
|
|
12
13
|
declare const transformReactorResponseCamelCase: (reactorResponse: Reactor | PaginatedList<Reactor> | undefined) => Reactor | PaginatedList<Reactor> | undefined;
|
|
13
14
|
declare const transformProxyResponseCamelCase: (proxyResponse: Proxy | PaginatedList<Proxy> | undefined) => Proxy | PaginatedList<Proxy> | undefined;
|
|
14
15
|
declare const transformResponseCamelCase: <T, C>(data: T) => C | undefined;
|
package/common/utils.js
CHANGED
|
@@ -79,19 +79,19 @@ const transformProxyRequestSnakeCase = proxy => {
|
|
|
79
79
|
|
|
80
80
|
exports.transformProxyRequestSnakeCase = transformProxyRequestSnakeCase;
|
|
81
81
|
|
|
82
|
-
const transformTokenRequestSnakeCase =
|
|
83
|
-
if (typeof
|
|
82
|
+
const transformTokenRequestSnakeCase = payload => {
|
|
83
|
+
if (typeof payload === 'undefined') {
|
|
84
84
|
return undefined;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
return { ...(0, _snakecaseKeys.default)(
|
|
87
|
+
return { ...(0, _snakecaseKeys.default)(payload, {
|
|
88
88
|
deep: true
|
|
89
89
|
}),
|
|
90
|
-
...(
|
|
91
|
-
data:
|
|
90
|
+
...(payload.data !== undefined ? {
|
|
91
|
+
data: payload.data
|
|
92
92
|
} : {}),
|
|
93
|
-
...(
|
|
94
|
-
metadata:
|
|
93
|
+
...(payload.metadata !== undefined ? {
|
|
94
|
+
metadata: payload.metadata
|
|
95
95
|
} : {})
|
|
96
96
|
};
|
|
97
97
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { BasisTheoryServiceOptions } from '../service';
|
|
1
2
|
import type { TokenIntent, CreateTokenIntent } from '../types/models';
|
|
2
3
|
export declare const BasisTheoryTokenIntents: {
|
|
3
|
-
new (options:
|
|
4
|
+
new (options: BasisTheoryServiceOptions): {
|
|
4
5
|
readonly client: import("axios").AxiosInstance;
|
|
5
6
|
};
|
|
6
|
-
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<TokenIntent
|
|
7
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<TokenIntent, CreateTokenIntent>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete);
|
|
7
8
|
export type BasisTheoryTokenIntents = InstanceType<typeof BasisTheoryTokenIntents>;
|
|
@@ -5,9 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.BasisTheoryTokenIntents = void 0;
|
|
7
7
|
|
|
8
|
+
var _common = require("./../common");
|
|
9
|
+
|
|
8
10
|
var _service = require("./../service");
|
|
9
11
|
|
|
10
12
|
var _CrudBuilder = require("./../service/CrudBuilder");
|
|
11
13
|
|
|
12
|
-
const BasisTheoryTokenIntents = new _CrudBuilder.CrudBuilder(class BasisTheoryTokenIntents extends _service.BasisTheoryService {
|
|
14
|
+
const BasisTheoryTokenIntents = new _CrudBuilder.CrudBuilder(class BasisTheoryTokenIntents extends _service.BasisTheoryService {
|
|
15
|
+
constructor(options) {
|
|
16
|
+
const _options = options; // eslint-disable-next-line unicorn/prefer-spread
|
|
17
|
+
|
|
18
|
+
_options.transformRequest = [].concat(_common.transformTokenRequestSnakeCase, options.transformRequest || []); // eslint-disable-next-line unicorn/prefer-spread
|
|
19
|
+
|
|
20
|
+
_options.transformResponse = [].concat(_common.transformTokenResponseCamelCase, options.transformResponse || []);
|
|
21
|
+
super(_options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}).create().delete().build();
|
|
13
25
|
exports.BasisTheoryTokenIntents = BasisTheoryTokenIntents;
|
|
@@ -8,5 +8,5 @@ export declare const BasisTheoryTokens: {
|
|
|
8
8
|
search(searchRequest: SearchTokensRequest, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
9
9
|
readonly client: import("axios").AxiosInstance;
|
|
10
10
|
};
|
|
11
|
-
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Token
|
|
11
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Token, CreateToken>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../types/sdk/services/shared").List<Token, ListTokensQuery>);
|
|
12
12
|
export type BasisTheoryTokens = InstanceType<typeof BasisTheoryTokens>;
|
package/types/models/shared.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { DataObject } from './tokens';
|
|
2
1
|
type Primitive = string | number | boolean | null;
|
|
3
2
|
type TokenType = 'token' | 'card' | 'bank' | 'card_number' | 'us_bank_routing_number' | 'us_bank_account_number' | 'social_security_number';
|
|
4
3
|
interface Auditable {
|
|
@@ -7,15 +6,17 @@ interface Auditable {
|
|
|
7
6
|
modifiedBy?: string;
|
|
8
7
|
modifiedAt?: string;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
type DataObject<DataType = Primitive> = {
|
|
10
|
+
[member: string]: TokenData<DataType>;
|
|
11
|
+
};
|
|
12
|
+
type DataArray<DataType> = Array<TokenData<DataType>>;
|
|
13
|
+
type TokenData<DataType = Primitive> = Primitive | DataObject<DataType> | DataArray<DataType> | DataType;
|
|
14
|
+
interface TokenBase<DataType = Primitive> extends Auditable {
|
|
15
|
+
data: TokenData<DataType>;
|
|
16
|
+
type: TokenType;
|
|
16
17
|
}
|
|
17
18
|
interface ReactResponse {
|
|
18
19
|
tokens: DataObject;
|
|
19
20
|
raw: DataObject;
|
|
20
21
|
}
|
|
21
|
-
export type { Primitive, Auditable, TokenType, TokenBase, ReactResponse };
|
|
22
|
+
export type { Primitive, Auditable, TokenType, TokenBase, ReactResponse, DataObject, };
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TokenBase, DataObject, Auditable, TokenType } from '../../types/models';
|
|
2
2
|
interface TokenIntentCardDetails {
|
|
3
|
-
|
|
3
|
+
type: 'card';
|
|
4
|
+
card: {
|
|
4
5
|
bin: string;
|
|
5
6
|
last4: string;
|
|
6
7
|
brand: string;
|
|
7
|
-
|
|
8
|
-
expirationMonth:
|
|
9
|
-
expirationYear:
|
|
8
|
+
funding: string;
|
|
9
|
+
expirationMonth: number;
|
|
10
|
+
expirationYear: number;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
type TokenTypesForTokenIntents = Exclude<TokenType, 'token' | 'card'>;
|
|
14
|
+
type TokenTypeMap = {
|
|
15
|
+
[K in TokenTypesForTokenIntents]: {
|
|
16
|
+
type: K;
|
|
17
|
+
} & Record<K, Record<string, unknown>>;
|
|
18
|
+
};
|
|
19
|
+
type TokenIntent<DataType = DataObject> = (TokenBase<DataType> & Omit<Auditable, 'modifiedAt' | 'modifiedBy'> & {
|
|
20
|
+
id: string;
|
|
16
21
|
tenantId: string;
|
|
17
22
|
expiresAt: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
23
|
+
fingerprint?: string;
|
|
24
|
+
}) & (TokenTypeMap[TokenTypesForTokenIntents] | TokenIntentCardDetails | {
|
|
25
|
+
type: 'token';
|
|
26
|
+
});
|
|
27
|
+
type CreateTokenIntent<DataType = DataObject> = Pick<TokenIntent<DataType>, 'type' | 'data'>;
|
|
22
28
|
export type { TokenIntent, CreateTokenIntent, TokenIntentCardDetails };
|
package/types/models/tokens.d.ts
CHANGED
|
@@ -6,11 +6,6 @@ declare const DATA_IMPACT_LEVELS: readonly ["low", "moderate", "high"];
|
|
|
6
6
|
type DataImpactLevel = typeof DATA_IMPACT_LEVELS[number];
|
|
7
7
|
declare const DATA_RESTRICTION_POLICIES: readonly ["mask", "redact"];
|
|
8
8
|
type DataRestrictionPolicy = typeof DATA_RESTRICTION_POLICIES[number];
|
|
9
|
-
type DataObject<DataType = Primitive> = {
|
|
10
|
-
[member: string]: TokenData<DataType>;
|
|
11
|
-
};
|
|
12
|
-
type DataArray<DataType> = Array<TokenData<DataType>>;
|
|
13
|
-
type TokenData<DataType = Primitive> = Primitive | DataObject<DataType> | DataArray<DataType> | DataType;
|
|
14
9
|
type MaskObject = {
|
|
15
10
|
[member: string]: TokenMask;
|
|
16
11
|
};
|
|
@@ -32,8 +27,8 @@ interface TokenPrivacy {
|
|
|
32
27
|
interface TokenEnrichments {
|
|
33
28
|
binDetails?: BinDetails;
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
type Token<DataType = Primitive> = TokenBase<DataType> & {
|
|
31
|
+
id: string;
|
|
37
32
|
privacy?: TokenPrivacy;
|
|
38
33
|
containers?: string[];
|
|
39
34
|
encryption?: TokenEncryption;
|
|
@@ -42,7 +37,10 @@ interface Token<DataType = Primitive> extends TokenBase {
|
|
|
42
37
|
mask?: TokenMask;
|
|
43
38
|
expiresAt?: string;
|
|
44
39
|
enrichments?: TokenEnrichments;
|
|
45
|
-
|
|
40
|
+
tenantId: string;
|
|
41
|
+
fingerprint?: string;
|
|
42
|
+
metadata?: Record<string, string>;
|
|
43
|
+
};
|
|
46
44
|
type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
47
45
|
deduplicateToken?: boolean;
|
|
48
46
|
id?: string;
|
|
@@ -51,5 +49,5 @@ type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' |
|
|
|
51
49
|
privacy: Omit<TokenPrivacy, 'classification'>;
|
|
52
50
|
deduplicateToken: boolean;
|
|
53
51
|
}>;
|
|
54
|
-
export type { Token, TokenEnrichments, CreateToken, UpdateToken,
|
|
52
|
+
export type { Token, TokenEnrichments, CreateToken, UpdateToken, DataClassification, DataImpactLevel, DataRestrictionPolicy, };
|
|
55
53
|
export { DATA_CLASSIFICATIONS, DATA_IMPACT_LEVELS, DATA_RESTRICTION_POLICIES };
|