@basis-theory/basis-theory-js 1.75.0 → 1.76.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 +3 -0
- package/BasisTheory.js +11 -0
- package/README.md +15 -2
- package/applications/BasisTheoryApplications.d.ts +5 -5
- package/common/constants.d.ts +2 -1
- package/common/constants.js +5 -2
- package/common/utils.d.ts +4 -3
- package/common/utils.js +5 -0
- package/elements/load.d.ts +1 -1
- package/elements/services/proxy.d.ts +1 -1
- package/elements/services/tokenize.d.ts +1 -1
- package/elements/services/tokens.d.ts +1 -1
- package/logs/BasisTheoryLogs.d.ts +1 -1
- package/package.json +1 -1
- package/reactor-formulas/BasisTheoryReactorFormulas.d.ts +3 -3
- package/reactors/BasisTheoryReactors.d.ts +2 -2
- package/service/CrudBuilder.d.ts +6 -6
- package/service/types.d.ts +1 -1
- package/tenants/BasisTheoryTenants.d.ts +12 -12
- package/tokens/BasisTheoryTokens.d.ts +6 -6
- package/transactions/BasisTheoryTransactions.d.ts +10 -0
- package/transactions/BasisTheoryTransactions.js +41 -0
- package/transactions/index.d.ts +1 -0
- package/transactions/index.js +18 -0
- package/types/elements/elements.d.ts +7 -7
- package/types/elements/events.d.ts +15 -15
- package/types/elements/options.d.ts +15 -15
- package/types/elements/services/tokenize.d.ts +1 -1
- package/types/elements/services/tokens.d.ts +3 -3
- package/types/elements/shared.d.ts +7 -7
- package/types/elements/styles.d.ts +11 -11
- package/types/models/applications.d.ts +5 -5
- package/types/models/proxies.d.ts +2 -2
- package/types/models/reactor-formulas.d.ts +3 -3
- package/types/models/reactors.d.ts +2 -2
- package/types/models/shared.d.ts +2 -2
- package/types/models/tenants.d.ts +2 -2
- package/types/models/tokenize.d.ts +3 -3
- package/types/models/tokens.d.ts +11 -11
- package/types/sdk/sdk.d.ts +5 -3
- package/types/sdk/services/index.d.ts +1 -0
- package/types/sdk/services/index.js +13 -0
- package/types/sdk/services/logs.d.ts +1 -1
- package/types/sdk/services/proxy.d.ts +4 -4
- package/types/sdk/services/sessions.d.ts +2 -2
- package/types/sdk/services/shared.d.ts +7 -6
- package/types/sdk/services/transactions.d.ts +13 -0
- package/types/sdk/services/transactions.js +1 -0
package/BasisTheory.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BasisTheoryElements, CardElement, CardNumberElement, CardExpirationDateElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardNumberElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from './types/elements';
|
|
2
2
|
import type { TokenizeData } from './types/models';
|
|
3
3
|
import type { Applications, BasisTheory as IBasisTheory, BasisTheoryInit, Logs, Permissions, ReactorFormulas, Reactors, RequestOptions, Tenants, Tokens, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, Proxies, Proxy, Sessions } from './types/sdk';
|
|
4
|
+
import { Transactions } from './types/sdk/services/transactions';
|
|
4
5
|
export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
|
|
5
6
|
private _initStatus;
|
|
6
7
|
private _initOptions?;
|
|
@@ -16,6 +17,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
16
17
|
private _proxies?;
|
|
17
18
|
private _proxy?;
|
|
18
19
|
private _sessions?;
|
|
20
|
+
private _transactions?;
|
|
19
21
|
init(apiKey: string | undefined, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
|
|
20
22
|
init(apiKey: string | undefined, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
|
|
21
23
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
@@ -36,6 +38,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
36
38
|
get proxies(): Proxies;
|
|
37
39
|
get proxy(): Proxy;
|
|
38
40
|
get sessions(): Sessions;
|
|
41
|
+
get transactions(): Transactions;
|
|
39
42
|
/**
|
|
40
43
|
* @deprecated
|
|
41
44
|
*/
|
package/BasisTheory.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.BasisTheory = void 0;
|
|
7
7
|
|
|
8
|
+
var _transactions = require("./transactions");
|
|
9
|
+
|
|
8
10
|
var _applications = require("./applications");
|
|
9
11
|
|
|
10
12
|
var _common = require("./common");
|
|
@@ -128,6 +130,11 @@ class BasisTheory {
|
|
|
128
130
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.sessions, baseUrl).toString(),
|
|
129
131
|
appInfo
|
|
130
132
|
});
|
|
133
|
+
this._transactions = new _transactions.BasisTheoryTransactions({
|
|
134
|
+
apiKey,
|
|
135
|
+
baseURL: new URL(_common.CLIENT_BASE_PATHS.transactions, baseUrl).toString(),
|
|
136
|
+
appInfo
|
|
137
|
+
});
|
|
131
138
|
this._initStatus = 'done';
|
|
132
139
|
} catch (error) {
|
|
133
140
|
this._initStatus = 'error';
|
|
@@ -209,6 +216,10 @@ class BasisTheory {
|
|
|
209
216
|
get sessions() {
|
|
210
217
|
return (0, _common.assertInit)(this._sessions);
|
|
211
218
|
}
|
|
219
|
+
|
|
220
|
+
get transactions() {
|
|
221
|
+
return (0, _common.assertInit)(this._transactions);
|
|
222
|
+
}
|
|
212
223
|
/* eslint-enable accessor-pairs */
|
|
213
224
|
|
|
214
225
|
/**
|
package/README.md
CHANGED
|
@@ -36,8 +36,8 @@ const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED'); // replac
|
|
|
36
36
|
|
|
37
37
|
### Per-request configuration
|
|
38
38
|
|
|
39
|
-
All of the service methods accept an optional `RequestOptions` object. This is used if you want to set a per-request `BT-TRACE-ID`, `BT-API-KEY`
|
|
40
|
-
`BT-
|
|
39
|
+
All of the service methods accept an optional `RequestOptions` object. This is used if you want to set a per-request `BT-TRACE-ID`, `BT-API-KEY`, `BT-IDEMPOTENCY-KEY`
|
|
40
|
+
and/or `BT-TRANSACTION-ID`.
|
|
41
41
|
|
|
42
42
|
```javascript
|
|
43
43
|
import { v4 as uuid } from 'uuid';
|
|
@@ -50,6 +50,19 @@ await bt.applications.list(
|
|
|
50
50
|
idempotencyKey: 'bb5d3379-6385-4ef4-9fdb-ca1341572154',
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
+
|
|
54
|
+
await bt.tokens.create(
|
|
55
|
+
{
|
|
56
|
+
type: "token",
|
|
57
|
+
data: "Sensitive Value",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
apiKey: 'key_N88mVGsp3sCXkykyN2EFED',
|
|
61
|
+
correlationId: 'aa5d3379-6385-4ef4-9fdb-ca1341572153',
|
|
62
|
+
idempotencyKey: 'bb5d3379-6385-4ef4-9fdb-ca1341572154',
|
|
63
|
+
transactionId: 'cc5d3379-3921-4ef4-9fdb-ca1341572169',
|
|
64
|
+
}
|
|
65
|
+
);
|
|
53
66
|
```
|
|
54
67
|
|
|
55
68
|
### Setting a custom API Url
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Application } from '../types/models';
|
|
1
|
+
import type { Application, CreateApplication, UpdateApplication } from '../types/models';
|
|
2
2
|
import type { ListApplicationsQuery, RequestOptions } from '../types/sdk';
|
|
3
3
|
export declare const BasisTheoryApplications: {
|
|
4
4
|
new (options: import("../service/types").BasisTheoryServiceOptions): {
|
|
@@ -6,9 +6,9 @@ export declare const BasisTheoryApplications: {
|
|
|
6
6
|
* @deprecated use {@link retrieveByKey} instead
|
|
7
7
|
*/
|
|
8
8
|
getApplicationByKey(): Promise<Application>;
|
|
9
|
-
retrieveByKey(options?: RequestOptions
|
|
10
|
-
regenerateKey(id: string, options?: RequestOptions
|
|
9
|
+
retrieveByKey(options?: RequestOptions): Promise<Application>;
|
|
10
|
+
regenerateKey(id: string, options?: RequestOptions): Promise<Application>;
|
|
11
11
|
readonly client: import("axios").AxiosInstance;
|
|
12
12
|
};
|
|
13
|
-
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Application,
|
|
14
|
-
export
|
|
13
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Application, CreateApplication>) & (new (...args: any[]) => import("../types/sdk/services/shared").Retrieve<Application>) & (new (...args: any[]) => import("../types/sdk/services/shared").Update<Application, UpdateApplication>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../types/sdk/services/shared").List<Application, ListApplicationsQuery>);
|
|
14
|
+
export type BasisTheoryApplications = InstanceType<typeof BasisTheoryApplications>;
|
package/common/constants.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare const API_KEY_HEADER = "BT-API-KEY";
|
|
|
3
3
|
declare const BT_TRACE_ID_HEADER = "bt-trace-id";
|
|
4
4
|
declare const BT_IDEMPOTENCY_KEY_HEADER = "bt-idempotency-key";
|
|
5
5
|
declare const BT_EXPOSE_PROXY_RESPONSE_HEADER = "BT-EXPOSE-RAW-PROXY-RESPONSE";
|
|
6
|
+
declare const BT_TRANSACTION_ID_HEADER = "BT-TRANSACTION-ID";
|
|
6
7
|
declare const CONTENT_TYPE_HEADER = "Content-Type";
|
|
7
8
|
declare const USER_AGENT_HEADER = "User-Agent";
|
|
8
9
|
declare const CLIENT_USER_AGENT_HEADER = "BT-CLIENT-USER-AGENT";
|
|
@@ -14,4 +15,4 @@ declare const BROWSER_LIST: {
|
|
|
14
15
|
browserName: string;
|
|
15
16
|
browserUA: string;
|
|
16
17
|
}[];
|
|
17
|
-
export { API_KEY_HEADER, BT_TRACE_ID_HEADER, BT_IDEMPOTENCY_KEY_HEADER, CONTENT_TYPE_HEADER, USER_AGENT_HEADER, CLIENT_USER_AGENT_HEADER, USER_AGENT_CLIENT, BT_EXPOSE_PROXY_RESPONSE_HEADER, DEFAULT_BASE_URL, DEFAULT_ELEMENTS_BASE_URL, CLIENT_BASE_PATHS, BROWSER_LIST, };
|
|
18
|
+
export { API_KEY_HEADER, BT_TRACE_ID_HEADER, BT_IDEMPOTENCY_KEY_HEADER, CONTENT_TYPE_HEADER, USER_AGENT_HEADER, CLIENT_USER_AGENT_HEADER, USER_AGENT_CLIENT, BT_EXPOSE_PROXY_RESPONSE_HEADER, DEFAULT_BASE_URL, DEFAULT_ELEMENTS_BASE_URL, CLIENT_BASE_PATHS, BROWSER_LIST, BT_TRANSACTION_ID_HEADER, };
|
package/common/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.CONTENT_TYPE_HEADER = exports.CLIENT_USER_AGENT_HEADER = exports.CLIENT_BASE_PATHS = exports.BT_TRACE_ID_HEADER = exports.BT_IDEMPOTENCY_KEY_HEADER = exports.BT_EXPOSE_PROXY_RESPONSE_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_TRANSACTION_ID_HEADER = exports.BT_TRACE_ID_HEADER = exports.BT_IDEMPOTENCY_KEY_HEADER = exports.BT_EXPOSE_PROXY_RESPONSE_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';
|
|
@@ -12,6 +12,8 @@ const BT_IDEMPOTENCY_KEY_HEADER = 'bt-idempotency-key';
|
|
|
12
12
|
exports.BT_IDEMPOTENCY_KEY_HEADER = BT_IDEMPOTENCY_KEY_HEADER;
|
|
13
13
|
const BT_EXPOSE_PROXY_RESPONSE_HEADER = 'BT-EXPOSE-RAW-PROXY-RESPONSE';
|
|
14
14
|
exports.BT_EXPOSE_PROXY_RESPONSE_HEADER = BT_EXPOSE_PROXY_RESPONSE_HEADER;
|
|
15
|
+
const BT_TRANSACTION_ID_HEADER = 'BT-TRANSACTION-ID';
|
|
16
|
+
exports.BT_TRANSACTION_ID_HEADER = BT_TRANSACTION_ID_HEADER;
|
|
15
17
|
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
16
18
|
exports.CONTENT_TYPE_HEADER = CONTENT_TYPE_HEADER;
|
|
17
19
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
@@ -35,7 +37,8 @@ const CLIENT_BASE_PATHS = {
|
|
|
35
37
|
permissions: 'permissions',
|
|
36
38
|
proxies: 'proxies',
|
|
37
39
|
proxy: 'proxy',
|
|
38
|
-
sessions: 'sessions'
|
|
40
|
+
sessions: 'sessions',
|
|
41
|
+
transactions: 'transactions'
|
|
39
42
|
};
|
|
40
43
|
exports.CLIENT_BASE_PATHS = CLIENT_BASE_PATHS;
|
|
41
44
|
const BROWSER_LIST = [{
|
package/common/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, AxiosResponse, AxiosTransformer } from 'axios';
|
|
2
|
+
import type { RequestTransformers } from '../service';
|
|
2
3
|
import type { ApplicationInfo, ProxyRequestOptions, RequestOptions } from '../types/sdk';
|
|
3
4
|
declare const assertInit: <T>(prop: T) => NonNullable<T>;
|
|
4
5
|
declare const transformRequestSnakeCase: AxiosTransformer;
|
|
@@ -16,12 +17,12 @@ declare const dataExtractor: <T>(res: AxiosResponse<T>) => T;
|
|
|
16
17
|
declare const dataAndHeadersExtractor: <T>(res: AxiosResponse<T>) => Pick<AxiosResponse<T>, "data" | "headers">;
|
|
17
18
|
declare const concatRequestTransformerWithDefault: (requestTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
|
|
18
19
|
declare const concatResponseTransformerWithDefault: (responseTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
|
|
19
|
-
declare const createRequestConfig: (options?:
|
|
20
|
+
declare const createRequestConfig: (options?: ProxyRequestOptions | RequestOptions, transformers?: RequestTransformers) => AxiosRequestConfig | undefined;
|
|
20
21
|
declare const errorInterceptor: (error: any) => void;
|
|
21
22
|
declare const getQueryParams: <Q>(query?: Q) => string;
|
|
22
|
-
declare const buildUserAgentString: (appInfo?: ApplicationInfo
|
|
23
|
+
declare const buildUserAgentString: (appInfo?: ApplicationInfo) => string;
|
|
23
24
|
declare const getBrowser: () => string;
|
|
24
25
|
declare const getOSVersion: () => string;
|
|
25
26
|
declare const getRuntime: () => string;
|
|
26
|
-
declare const buildClientUserAgentString: (appInfo?: ApplicationInfo
|
|
27
|
+
declare const buildClientUserAgentString: (appInfo?: ApplicationInfo) => string;
|
|
27
28
|
export { assertInit, transformRequestSnakeCase, proxyRaw, dataAndHeadersExtractor, transformReactorRequestSnakeCase, transformProxyRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformProxyResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformerWithDefault, errorInterceptor, getQueryParams, buildUserAgentString, buildClientUserAgentString, getOSVersion, getRuntime, getBrowser, };
|
package/common/utils.js
CHANGED
|
@@ -232,6 +232,7 @@ const createRequestConfig = (options, transformers) => {
|
|
|
232
232
|
apiKey,
|
|
233
233
|
correlationId,
|
|
234
234
|
idempotencyKey,
|
|
235
|
+
transactionId,
|
|
235
236
|
query,
|
|
236
237
|
headers
|
|
237
238
|
} = options;
|
|
@@ -244,10 +245,14 @@ const createRequestConfig = (options, transformers) => {
|
|
|
244
245
|
const idempotencyKeyHeader = idempotencyKey ? {
|
|
245
246
|
[_constants.BT_IDEMPOTENCY_KEY_HEADER]: idempotencyKey
|
|
246
247
|
} : {};
|
|
248
|
+
const transactionIdHeader = transactionId ? {
|
|
249
|
+
[_constants.BT_TRANSACTION_ID_HEADER]: transactionId
|
|
250
|
+
} : {};
|
|
247
251
|
return {
|
|
248
252
|
headers: { ...apiKeyHeader,
|
|
249
253
|
...correlationIdHeader,
|
|
250
254
|
...idempotencyKeyHeader,
|
|
255
|
+
...transactionIdHeader,
|
|
251
256
|
...(typeof headers !== 'undefined' && { ...headers
|
|
252
257
|
})
|
|
253
258
|
},
|
package/elements/load.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BasisTheoryElements } from '../types/elements';
|
|
2
|
-
declare const loadElements: (elementsClientUrl?: string
|
|
2
|
+
declare const loadElements: (elementsClientUrl?: string) => Promise<BasisTheoryElements>;
|
|
3
3
|
export { loadElements };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasisTheoryProxy } from '../../proxy';
|
|
2
2
|
import type { Proxy as ElementsProxy, BasisTheoryElementsInternal } from '../../types/elements';
|
|
3
3
|
import type { Proxy } from '../../types/sdk';
|
|
4
|
-
declare const delegateProxy: (elements?: BasisTheoryElementsInternal
|
|
4
|
+
declare const delegateProxy: (elements?: BasisTheoryElementsInternal) => new (options: import("../../service/types").BasisTheoryServiceOptions) => ElementsProxy & Proxy;
|
|
5
5
|
export { delegateProxy };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasisTheoryTokenize } from '../../tokenize';
|
|
2
2
|
import type { Tokenize as ElementsTokenize, BasisTheoryElementsInternal } from '../../types/elements';
|
|
3
3
|
import type { Tokenize } from '../../types/sdk';
|
|
4
|
-
declare const delegateTokenize: (elements?: BasisTheoryElementsInternal
|
|
4
|
+
declare const delegateTokenize: (elements?: BasisTheoryElementsInternal) => new (options: import("../../service/types").BasisTheoryServiceOptions) => ElementsTokenize & Tokenize;
|
|
5
5
|
export { delegateTokenize };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasisTheoryTokens } from '../../tokens';
|
|
2
2
|
import type { Tokens as ElementsTokens, BasisTheoryElementsInternal } from '../../types/elements';
|
|
3
3
|
import type { Tokens } from '../../types/sdk';
|
|
4
|
-
declare const delegateTokens: (elements?: BasisTheoryElementsInternal
|
|
4
|
+
declare const delegateTokens: (elements?: BasisTheoryElementsInternal) => new (options: import("../../service/types").BasisTheoryServiceOptions) => ElementsTokens & Tokens;
|
|
5
5
|
export { delegateTokens };
|
|
@@ -5,4 +5,4 @@ export declare const BasisTheoryLogs: {
|
|
|
5
5
|
readonly client: import("axios").AxiosInstance;
|
|
6
6
|
};
|
|
7
7
|
} & (new (...args: any[]) => import("../types/sdk/services/shared").List<Log, ListLogQuery>);
|
|
8
|
-
export
|
|
8
|
+
export type BasisTheoryLogs = InstanceType<typeof BasisTheoryLogs>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ReactorFormula } from '../types/models';
|
|
1
|
+
import type { CreateReactorFormula, ReactorFormula } from '../types/models';
|
|
2
2
|
import type { ListReactorFormulaQuery } from '../types/sdk';
|
|
3
3
|
export declare const BasisTheoryReactorFormulas: {
|
|
4
4
|
new (options: import("../service/types").BasisTheoryServiceOptions): {
|
|
5
5
|
readonly client: import("axios").AxiosInstance;
|
|
6
6
|
};
|
|
7
|
-
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<ReactorFormula,
|
|
8
|
-
export
|
|
7
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<ReactorFormula, CreateReactorFormula>) & (new (...args: any[]) => import("../types/sdk/services/shared").Retrieve<ReactorFormula>) & (new (...args: any[]) => import("../types/sdk/services/shared").Update<ReactorFormula, CreateReactorFormula>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../types/sdk/services/shared").List<ReactorFormula, ListReactorFormulaQuery>);
|
|
8
|
+
export type BasisTheoryReactorFormulas = InstanceType<typeof BasisTheoryReactorFormulas>;
|
|
@@ -3,8 +3,8 @@ import type { Reactor, CreateReactor, UpdateReactor, ReactResponse } from '../ty
|
|
|
3
3
|
import type { ListReactorQuery, ReactRequest, RequestOptions } from '../types/sdk';
|
|
4
4
|
export declare const BasisTheoryReactors: {
|
|
5
5
|
new (options: BasisTheoryServiceOptions): {
|
|
6
|
-
react(reactorId: string, request: ReactRequest, options?: RequestOptions
|
|
6
|
+
react(reactorId: string, request: ReactRequest, options?: RequestOptions): Promise<ReactResponse>;
|
|
7
7
|
readonly client: import("axios").AxiosInstance;
|
|
8
8
|
};
|
|
9
9
|
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Reactor, CreateReactor>) & (new (...args: any[]) => import("../types/sdk/services/shared").Retrieve<Reactor>) & (new (...args: any[]) => import("../types/sdk/services/shared").Update<Reactor, UpdateReactor>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../types/sdk/services/shared").List<Reactor, ListReactorQuery>);
|
|
10
|
-
export
|
|
10
|
+
export type BasisTheoryReactors = InstanceType<typeof BasisTheoryReactors>;
|
package/service/CrudBuilder.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PaginatedQuery, Create as ICreate, Retrieve as IRetrieve, Update as IUpdate, Delete as IDelete, List as IList } from '../types/sdk';
|
|
2
2
|
import { BasisTheoryService } from './BasisTheoryService';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
type BasisTheoryServiceConstructor<T extends BasisTheoryService = BasisTheoryService> = new (...params: any[]) => T;
|
|
4
|
+
type ICreateConstructor<T, C> = new (...args: any[]) => ICreate<T, C>;
|
|
5
|
+
type IRetrieveConstructor<T> = new (...args: any[]) => IRetrieve<T>;
|
|
6
|
+
type IUpdateConstructor<T, U> = new (...args: any[]) => IUpdate<T, U>;
|
|
7
|
+
type IDeleteConstructor = new (...args: any[]) => IDelete;
|
|
8
|
+
type IListConstructor<T, Q extends PaginatedQuery> = new (...args: any[]) => IList<T, Q>;
|
|
9
9
|
declare class CrudBuilder<Class extends BasisTheoryServiceConstructor> {
|
|
10
10
|
private BaseService;
|
|
11
11
|
constructor(baseService: Class);
|
package/service/types.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ interface BasisTheoryServiceOptions extends Pick<AxiosRequestConfig, 'transformR
|
|
|
5
5
|
baseURL: string;
|
|
6
6
|
appInfo?: ApplicationInfo;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
type RequestTransformers = Pick<AxiosRequestConfig, 'transformRequest' | 'transformResponse'>;
|
|
9
9
|
export type { BasisTheoryServiceOptions, RequestTransformers };
|
|
@@ -4,18 +4,18 @@ import type { PaginatedList } from '../types/sdk/services/shared';
|
|
|
4
4
|
import type { ListTenantInvitationsQuery, ListTenantMembersQuery } from '../types/sdk/services/tenants';
|
|
5
5
|
export declare const BasisTheoryTenants: {
|
|
6
6
|
new (options: import("../service/types").BasisTheoryServiceOptions): {
|
|
7
|
-
retrieve(options?: RequestOptions
|
|
8
|
-
update(model: UpdateTenant, options?: RequestOptions
|
|
9
|
-
delete(options?: RequestOptions
|
|
10
|
-
retrieveUsageReport(options?: RequestOptions
|
|
11
|
-
createInvitation(model: CreateTenantInvitation, options?: RequestOptions
|
|
12
|
-
resendInvitation(invitationId: string, options?: RequestOptions
|
|
13
|
-
listInvitations(query?: ListTenantInvitationsQuery
|
|
14
|
-
retrieveInvitation(invitationId: string, options?: RequestOptions
|
|
15
|
-
deleteInvitation(invitationId: string, options?: RequestOptions
|
|
16
|
-
listMembers(query?: ListTenantMembersQuery
|
|
17
|
-
deleteMember(memberId: string, options?: RequestOptions
|
|
7
|
+
retrieve(options?: RequestOptions): Promise<Tenant>;
|
|
8
|
+
update(model: UpdateTenant, options?: RequestOptions): Promise<Tenant>;
|
|
9
|
+
delete(options?: RequestOptions): Promise<void>;
|
|
10
|
+
retrieveUsageReport(options?: RequestOptions): Promise<TenantUsageReport>;
|
|
11
|
+
createInvitation(model: CreateTenantInvitation, options?: RequestOptions): Promise<TenantInvitation>;
|
|
12
|
+
resendInvitation(invitationId: string, options?: RequestOptions): Promise<TenantInvitation>;
|
|
13
|
+
listInvitations(query?: ListTenantInvitationsQuery, options?: RequestOptions): Promise<PaginatedList<TenantInvitation>>;
|
|
14
|
+
retrieveInvitation(invitationId: string, options?: RequestOptions): Promise<TenantInvitation>;
|
|
15
|
+
deleteInvitation(invitationId: string, options?: RequestOptions): Promise<void>;
|
|
16
|
+
listMembers(query?: ListTenantMembersQuery, options?: RequestOptions): Promise<PaginatedList<TenantMember>>;
|
|
17
|
+
deleteMember(memberId: string, options?: RequestOptions): Promise<void>;
|
|
18
18
|
readonly client: import("axios").AxiosInstance;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type BasisTheoryTenants = InstanceType<typeof BasisTheoryTenants>;
|
|
@@ -5,12 +5,12 @@ export declare const BasisTheoryTokens: {
|
|
|
5
5
|
new (options: BasisTheoryServiceOptions): {
|
|
6
6
|
retrieve(id: string, options?: RequestOptions): Promise<Token<any>>;
|
|
7
7
|
update(id: string, model: UpdateToken, options?: RequestOptions): Promise<Token>;
|
|
8
|
-
createAssociation(parentId: string, childId: string, options?: RequestOptions
|
|
9
|
-
deleteAssociation(parentId: string, childId: string, options?: RequestOptions
|
|
10
|
-
createChild(parentId: string, token: CreateToken, options?: RequestOptions
|
|
8
|
+
createAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
|
|
9
|
+
deleteAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
|
|
10
|
+
createChild(parentId: string, token: CreateToken, options?: RequestOptions): Promise<Token>;
|
|
11
11
|
listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
12
|
-
search(searchRequest: SearchTokensRequest, options?: RequestOptions
|
|
12
|
+
search(searchRequest: SearchTokensRequest, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
13
13
|
readonly client: import("axios").AxiosInstance;
|
|
14
14
|
};
|
|
15
|
-
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Token<import("../types/models/shared").Primitive>, CreateToken
|
|
16
|
-
export
|
|
15
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Token<import("../types/models/shared").Primitive>, CreateToken>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../types/sdk/services/shared").List<Token<import("../types/models/shared").Primitive>, ListTokensQuery>);
|
|
16
|
+
export type BasisTheoryTokens = InstanceType<typeof BasisTheoryTokens>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BasisTheoryService } from '../service';
|
|
2
|
+
import type { BasisTheoryServiceOptions } from '../service';
|
|
3
|
+
import type { RequestOptions } from '../types/sdk';
|
|
4
|
+
import { CreateTransactionResponse, Transactions } from '../types/sdk/services/transactions';
|
|
5
|
+
export declare class BasisTheoryTransactions extends BasisTheoryService implements Transactions {
|
|
6
|
+
constructor(options: BasisTheoryServiceOptions);
|
|
7
|
+
create(options?: RequestOptions): Promise<CreateTransactionResponse>;
|
|
8
|
+
commit(id: string, options?: RequestOptions): Promise<void>;
|
|
9
|
+
rollback(id: string, options?: RequestOptions): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BasisTheoryTransactions = void 0;
|
|
7
|
+
|
|
8
|
+
var _common = require("./../common");
|
|
9
|
+
|
|
10
|
+
var _utils = require("./../common/utils");
|
|
11
|
+
|
|
12
|
+
var _service = require("./../service");
|
|
13
|
+
|
|
14
|
+
class BasisTheoryTransactions extends _service.BasisTheoryService {
|
|
15
|
+
constructor(options) {
|
|
16
|
+
const _options = { ...options
|
|
17
|
+
}; // eslint-disable-next-line unicorn/prefer-spread
|
|
18
|
+
|
|
19
|
+
_options.transformRequest = [].concat(_utils.transformProxyRequestSnakeCase, options.transformRequest || []); // eslint-disable-next-line unicorn/prefer-spread
|
|
20
|
+
|
|
21
|
+
_options.transformResponse = [].concat(_utils.transformProxyResponseCamelCase, options.transformResponse || []);
|
|
22
|
+
super(_options);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
create(options = {}) {
|
|
26
|
+
return this.client.post('/', undefined, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
commit(id, options = {}) {
|
|
30
|
+
const url = `/${id}/commit`;
|
|
31
|
+
return this.client.post(url, undefined, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
rollback(id, options = {}) {
|
|
35
|
+
const url = `/${id}/rollback`;
|
|
36
|
+
return this.client.post(url, undefined, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.BasisTheoryTransactions = BasisTheoryTransactions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BasisTheoryTransactions';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _BasisTheoryTransactions = require("./BasisTheoryTransactions");
|
|
8
|
+
|
|
9
|
+
Object.keys(_BasisTheoryTransactions).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _BasisTheoryTransactions[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _BasisTheoryTransactions[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -14,30 +14,30 @@ interface BaseElement<UpdateOptions, ElementEvents> {
|
|
|
14
14
|
unmount(): void;
|
|
15
15
|
on<T extends EventType>(eventType: T, listener: ElementEventListener<ElementEvents, T>): Subscription;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
type CardElement = BaseElement<UpdateCardElementOptions, CardElementEvents> & {
|
|
18
18
|
readonly cardMetadata?: CardMetadata;
|
|
19
19
|
setValue(value: CardElementValue<'reference'>): void;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
type TextElement = BaseElement<UpdateTextElementOptions, TextElementEvents> & {
|
|
22
22
|
setValue(value: DataElementReference): void;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
type CardNumberElement = BaseElement<UpdateCardNumberElementOptions, CardNumberElementEvents> & {
|
|
25
25
|
readonly cardMetadata?: CardMetadata;
|
|
26
26
|
setValue(value: DataElementReference): void;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
type CardExpirationDateElement = BaseElement<UpdateCardExpirationDateElementOptions, CardExpirationDateElementEvents> & {
|
|
29
29
|
month(): ElementWrapper<CardExpirationDateElement>;
|
|
30
30
|
year(): ElementWrapper<CardExpirationDateElement>;
|
|
31
31
|
setValue(value: CardExpirationDateValue<'reference'>): void;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
type CardVerificationCodeElement = BaseElement<UpdateCardVerificationCodeElementOptions, CardVerificationCodeElementEvents> & {
|
|
34
34
|
setValue(value: DataElementReference): void;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, any>> = {
|
|
37
37
|
element: T;
|
|
38
38
|
method?: string;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
type ElementValue = TextElement | CardElement | CardNumberElement | CardExpirationDateElement | CardVerificationCodeElement | ElementWrapper;
|
|
41
41
|
interface BasisTheoryElements extends Tokenize {
|
|
42
42
|
tokens: Tokens;
|
|
43
43
|
proxy: Proxy;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import type { Brand, FieldError, ListenableKey, Targeted } from './shared';
|
|
2
|
-
|
|
2
|
+
type EventType = 'ready' | 'change' | 'focus' | 'blur' | 'keydown';
|
|
3
3
|
interface BaseEvent<T extends EventType> {
|
|
4
4
|
type: T;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ReadyEvent = BaseEvent<'ready'>;
|
|
7
|
+
type ChangeEvent = BaseEvent<'change'> & {
|
|
8
8
|
empty: boolean;
|
|
9
9
|
complete: boolean;
|
|
10
10
|
valid?: boolean;
|
|
11
11
|
maskSatisfied?: boolean;
|
|
12
12
|
errors?: FieldError[];
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type CardChangeEvent = ChangeEvent & {
|
|
15
15
|
cardBrand: Brand;
|
|
16
16
|
cardLast4?: string;
|
|
17
17
|
cardBin?: string;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
type InputFocusEvent = BaseEvent<'focus'> & Targeted;
|
|
20
|
+
type InputBlurEvent = BaseEvent<'blur'> & Targeted;
|
|
21
|
+
type InputKeydownEvent = BaseEvent<'keydown'> & Targeted & {
|
|
22
22
|
key: ListenableKey;
|
|
23
23
|
} & Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'shiftKey' | 'metaKey'>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
type BaseElementEvents = ReadyEvent | InputFocusEvent | InputBlurEvent | InputKeydownEvent;
|
|
25
|
+
type TextElementEvents = BaseElementEvents | ChangeEvent;
|
|
26
|
+
type CardElementEvents = BaseElementEvents | CardChangeEvent;
|
|
27
|
+
type CardNumberElementEvents = BaseElementEvents | CardChangeEvent;
|
|
28
|
+
type CardExpirationDateElementEvents = BaseElementEvents | ChangeEvent;
|
|
29
|
+
type CardVerificationCodeElementEvents = BaseElementEvents | ChangeEvent;
|
|
30
30
|
/**
|
|
31
31
|
* Utility type that helps find a Union type based on a `type` property
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
type FindByType<Union, Type> = Union extends {
|
|
34
34
|
type: Type;
|
|
35
35
|
} ? Union : never;
|
|
36
|
-
|
|
36
|
+
type ElementEventListener<Events, Type> = (event: FindByType<Events, Type>) => void;
|
|
37
37
|
interface Subscription {
|
|
38
38
|
unsubscribe(): void;
|
|
39
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AutoCompleteValue, DataElementReference } from './shared';
|
|
2
2
|
import type { ElementStyle } from './styles';
|
|
3
3
|
declare const ELEMENTS_TYPES: readonly ["card", "text", "cardNumber", "cardExpirationDate", "cardVerificationCode", "data"];
|
|
4
|
-
|
|
4
|
+
type ElementType = typeof ELEMENTS_TYPES[number];
|
|
5
5
|
interface ElementInternalOptions {
|
|
6
6
|
apiKey: string | undefined;
|
|
7
7
|
type: ElementType;
|
|
@@ -25,16 +25,16 @@ interface SanitizedElementOptions {
|
|
|
25
25
|
value?: CardElementValue<'static'> | CardExpirationDateValue<'static'> | string;
|
|
26
26
|
validation?: RegExp;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
|
|
29
|
+
type Transform = RegExp | [RegExp, string?] | null;
|
|
30
30
|
interface TransformOption {
|
|
31
31
|
transform?: Transform;
|
|
32
32
|
}
|
|
33
33
|
interface AutoCompleteOption {
|
|
34
34
|
autoComplete?: AutoCompleteValue;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabled' | 'validateOnChange' | 'enableCopy'> & AutoCompleteOption;
|
|
37
|
+
type ElementValueType = 'static' | 'reference';
|
|
38
38
|
interface CardElementValue<T extends ElementValueType> {
|
|
39
39
|
number?: T extends 'reference' ? DataElementReference : string;
|
|
40
40
|
expiration_month?: T extends 'reference' ? DataElementReference : number;
|
|
@@ -45,29 +45,29 @@ interface CardExpirationDateValue<T extends ElementValueType> {
|
|
|
45
45
|
month: T extends 'reference' ? DataElementReference : number;
|
|
46
46
|
year: T extends 'reference' ? DataElementReference : number;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
type CreateCardElementOptions = CustomizableElementOptions & {
|
|
49
49
|
value?: CardElementValue<'static'>;
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
type UpdateCardElementOptions = Omit<CreateCardElementOptions, 'validateOnChange' | 'enableCopy'>;
|
|
52
|
+
type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'password' | 'validation'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
53
53
|
'aria-label'?: string;
|
|
54
54
|
value?: string;
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
type UpdateTextElementOptions = Omit<CreateTextElementOptions, 'targetId' | 'mask' | 'validateOnChange'>;
|
|
57
|
+
type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
58
58
|
'aria-label'?: string;
|
|
59
59
|
value?: string;
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
type UpdateCardNumberElementOptions = Omit<CreateCardNumberElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
|
|
62
|
+
type CreateCardExpirationDateElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
63
63
|
'aria-label'?: string;
|
|
64
64
|
value?: CardExpirationDateValue<'static'> | string;
|
|
65
65
|
};
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
type UpdateCardExpirationDateElementOptions = Omit<CreateCardExpirationDateElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
|
|
67
|
+
type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand'> & Required<Pick<ElementOptions, 'targetId'>> & {
|
|
68
68
|
'aria-label'?: string;
|
|
69
69
|
value?: string;
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
|
|
72
72
|
export type { ElementInternalOptions, ElementType, ElementOptions, SanitizedElementOptions, Transform, CustomizableElementOptions, CreateCardElementOptions, UpdateCardElementOptions, CreateTextElementOptions, UpdateTextElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, CreateCardExpirationDateElementOptions, UpdateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, UpdateCardVerificationCodeElementOptions, CardElementValue, CardExpirationDateValue, };
|
|
73
73
|
export { ELEMENTS_TYPES };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ElementValue } from '../../../types/elements';
|
|
2
2
|
import type { TokenizeData as TokenizeDataModel } from '../../../types/models';
|
|
3
3
|
import type { RequestOptions } from '../../../types/sdk';
|
|
4
|
-
|
|
4
|
+
type TokenizeData = TokenizeDataModel<ElementValue>;
|
|
5
5
|
interface Tokenize {
|
|
6
6
|
tokenize(tokens: TokenizeData, options?: RequestOptions): Promise<TokenizeDataModel>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ElementValue } from '../../../types/elements';
|
|
2
2
|
import type { CreateToken as CreateTokenModel, UpdateToken as UpdateTokenModel, Token } from '../../../types/models';
|
|
3
3
|
import type { Create, Retrieve, Update } from '../../../types/sdk';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type CreateToken = CreateTokenModel<ElementValue>;
|
|
5
|
+
type UpdateToken = UpdateTokenModel<ElementValue>;
|
|
6
|
+
type Tokens = Create<Token, CreateToken> & Retrieve<Token<any>> & Update<Token, UpdateToken>;
|
|
7
7
|
export type { Tokens, CreateToken, UpdateToken };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AUTOCOMPLETE_VALUES, CARD_BRANDS, CARD_ICON_POSITIONS } from '../../elements/constants';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type FieldErrorType = 'incomplete' | 'invalid';
|
|
3
|
+
type ConfigErrorType = 'missing-configuration' | 'missing-permission' | 'invalid-configuration';
|
|
4
4
|
interface ConfigError {
|
|
5
5
|
type: ConfigErrorType;
|
|
6
6
|
message: string;
|
|
@@ -8,7 +8,7 @@ interface ConfigError {
|
|
|
8
8
|
interface Targeted {
|
|
9
9
|
targetId: string;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
type ListenableKey = 'Escape' | 'Enter';
|
|
12
12
|
interface FieldError {
|
|
13
13
|
targetId: string;
|
|
14
14
|
type: FieldErrorType;
|
|
@@ -30,19 +30,19 @@ interface CardMetadata {
|
|
|
30
30
|
/**
|
|
31
31
|
* Card brands type
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
type Brand = typeof CARD_BRANDS[number];
|
|
34
34
|
/**
|
|
35
35
|
* Icon position for card number element
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
type CardIconPosition = typeof CARD_ICON_POSITIONS[number];
|
|
38
38
|
/**
|
|
39
39
|
* Values for the element input autocomplete attribute
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
type AutoCompleteValue = typeof AUTOCOMPLETE_VALUES[number];
|
|
42
42
|
/**
|
|
43
43
|
* Type used for detokenization responses stored on Data Elements
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
type DataElementReference = {
|
|
46
46
|
correlationId: string;
|
|
47
47
|
elementId: string;
|
|
48
48
|
path: string;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { Properties as CSSProperties } from 'csstype';
|
|
2
2
|
declare const SAFE_CSS_PROPERTIES: readonly ["backgroundColor", "color", "fontFamily", "fontSize", "fontSmooth", "fontStyle", "fontVariant", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "padding", "textDecoration", "textShadow", "textTransform"];
|
|
3
|
-
|
|
3
|
+
type SafeCSSProperty = typeof SAFE_CSS_PROPERTIES[number];
|
|
4
4
|
declare const SAFE_CSS_PROPERTIES_ALTERNATES: Partial<Record<SafeCSSProperty, string[]>>;
|
|
5
5
|
declare const SAFE_CSS_PROPERTIES_WITH_ALTERNATES: string[];
|
|
6
|
-
|
|
6
|
+
type SafeStyle = Pick<CSSProperties, SafeCSSProperty>;
|
|
7
7
|
declare const CARD_ELEMENT_STYLE_VARIANT_SELECTORS: readonly [":hover", ":focus", "::placeholder", "::selection", ":disabled"];
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type CardElementStyleVariantSelector = typeof CARD_ELEMENT_STYLE_VARIANT_SELECTORS[number];
|
|
9
|
+
type CardElementStyleVariantStyle = SafeStyle & Partial<Record<CardElementStyleVariantSelector, SafeStyle>>;
|
|
10
10
|
declare const CARD_ELEMENT_STYLE_VARIANTS: readonly ["base", "complete", "invalid", "empty"];
|
|
11
11
|
declare const CARD_ELEMENT_STYLE_FONTS_ATTR: "fonts";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
type CardElementStyleVariant = typeof CARD_ELEMENT_STYLE_VARIANTS[number];
|
|
13
|
+
type CardElementStyleFontAttr = typeof CARD_ELEMENT_STYLE_FONTS_ATTR;
|
|
14
|
+
type FontSource = string;
|
|
15
|
+
type FontSources = FontSource[];
|
|
16
|
+
type Fonts = Record<CardElementStyleFontAttr, FontSources>;
|
|
17
|
+
type CardElementStyle = Partial<Record<CardElementStyleVariant, CardElementStyleVariantStyle> & Fonts>;
|
|
18
|
+
type ElementStyle = CardElementStyle;
|
|
19
19
|
export { SAFE_CSS_PROPERTIES, SAFE_CSS_PROPERTIES_ALTERNATES, SAFE_CSS_PROPERTIES_WITH_ALTERNATES, CARD_ELEMENT_STYLE_VARIANT_SELECTORS, CARD_ELEMENT_STYLE_VARIANTS, CARD_ELEMENT_STYLE_FONTS_ATTR, };
|
|
20
20
|
export type { SafeCSSProperty, SafeStyle, CardElementStyleVariantSelector, CardElementStyleVariantStyle, CardElementStyleVariant, FontSources, Fonts, CardElementStyle, ElementStyle, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Auditable } from './shared';
|
|
2
2
|
declare const APPLICATION_TYPES: readonly ["private", "public", "management"];
|
|
3
3
|
declare const TRANSFORM_TYPES: readonly ["mask", "redact", "reveal"];
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type ApplicationType = typeof APPLICATION_TYPES[number];
|
|
5
|
+
type TransformType = typeof TRANSFORM_TYPES[number];
|
|
6
6
|
interface Application extends Auditable {
|
|
7
7
|
id: string;
|
|
8
8
|
tenantId: string;
|
|
@@ -21,12 +21,12 @@ interface AccessRule {
|
|
|
21
21
|
permissions: string[];
|
|
22
22
|
conditions?: Condition[];
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
type Condition = {
|
|
25
25
|
attribute: string;
|
|
26
26
|
operator: string;
|
|
27
27
|
value: string;
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | 'expiresAt'>;
|
|
30
|
+
type UpdateApplication = Pick<Application, 'name' | 'permissions' | 'rules'>;
|
|
31
31
|
export type { ApplicationType, Application, CreateApplication, TransformType, UpdateApplication, };
|
|
32
32
|
export { APPLICATION_TYPES, TRANSFORM_TYPES, AccessRule };
|
|
@@ -17,8 +17,8 @@ interface Proxy extends Auditable {
|
|
|
17
17
|
interface ProxyTransform {
|
|
18
18
|
code: string;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
type CreateProxy = Pick<Proxy, 'name' | 'destinationUrl' | 'requestReactorId' | 'responseReactorId' | 'requestTransform' | 'responseTransform' | 'configuration' | 'requireAuth'> & {
|
|
21
21
|
application?: Pick<Application, 'id'>;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
type UpdateProxy = CreateProxy;
|
|
24
24
|
export type { Proxy, CreateProxy, UpdateProxy };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Auditable } from './shared';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type FormulaType = 'official' | 'private';
|
|
3
|
+
type DataType = 'string' | 'boolean' | 'number';
|
|
4
4
|
interface ReactorFormula extends Auditable {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
@@ -22,5 +22,5 @@ interface ReactorFormulaRequestParam {
|
|
|
22
22
|
type: DataType;
|
|
23
23
|
optional?: boolean;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
type CreateReactorFormula = Omit<ReactorFormula, 'id' | 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'>;
|
|
26
26
|
export type { FormulaType, DataType, ReactorFormula, ReactorFormulaConfig, ReactorFormulaRequestParam, CreateReactorFormula, };
|
|
@@ -9,11 +9,11 @@ interface Reactor extends Auditable {
|
|
|
9
9
|
application?: Application;
|
|
10
10
|
configuration?: Record<string, string>;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
type CreateReactor = Pick<Reactor, 'name' | 'configuration'> & {
|
|
13
13
|
formula: Pick<ReactorFormula, 'id'>;
|
|
14
14
|
application?: Pick<Application, 'id'>;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
type UpdateReactor = Pick<Reactor, 'name' | 'configuration'> & {
|
|
17
17
|
application?: Pick<Application, 'id'>;
|
|
18
18
|
};
|
|
19
19
|
export type { Reactor, CreateReactor, UpdateReactor };
|
package/types/models/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataObject } from './tokens';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Primitive = string | number | boolean | null;
|
|
3
|
+
type TokenType = 'token' | 'card' | 'bank' | 'card_number' | 'us_bank_routing_number' | 'us_bank_account_number' | 'social_security_number';
|
|
4
4
|
interface Auditable {
|
|
5
5
|
createdBy?: string;
|
|
6
6
|
createdAt?: string;
|
|
@@ -5,7 +5,7 @@ interface Tenant extends Auditable {
|
|
|
5
5
|
name: string;
|
|
6
6
|
settings?: Record<string, string>;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
type UpdateTenant = Pick<Tenant, 'name' | 'settings'>;
|
|
9
9
|
interface TenantUsageReport {
|
|
10
10
|
tokenReport: TokenReport;
|
|
11
11
|
}
|
|
@@ -25,7 +25,7 @@ interface TenantInvitation extends Auditable {
|
|
|
25
25
|
status: string;
|
|
26
26
|
expiresAt: string;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
type CreateTenantInvitation = Pick<TenantInvitation, 'email'>;
|
|
29
29
|
interface User {
|
|
30
30
|
id: string;
|
|
31
31
|
email?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Primitive } from './shared';
|
|
2
|
-
|
|
2
|
+
type TokenizeObject<DataType = Primitive> = {
|
|
3
3
|
[key: string]: Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type TokenizeArray<DataType = Primitive> = Array<Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType>;
|
|
6
|
+
type TokenizeData<DataType = Primitive> = TokenizeArray<DataType> | TokenizeObject<DataType>;
|
|
7
7
|
export type { TokenizeObject, TokenizeArray, TokenizeData };
|
package/types/models/tokens.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { Primitive, TokenBase } from './shared';
|
|
2
2
|
declare const DATA_CLASSIFICATIONS: readonly ["general", "bank", "pci", "pii"];
|
|
3
|
-
|
|
3
|
+
type DataClassification = typeof DATA_CLASSIFICATIONS[number];
|
|
4
4
|
declare const DATA_IMPACT_LEVELS: readonly ["low", "moderate", "high"];
|
|
5
|
-
|
|
5
|
+
type DataImpactLevel = typeof DATA_IMPACT_LEVELS[number];
|
|
6
6
|
declare const DATA_RESTRICTION_POLICIES: readonly ["mask", "redact"];
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type DataRestrictionPolicy = typeof DATA_RESTRICTION_POLICIES[number];
|
|
8
|
+
type DataObject<DataType = Primitive> = {
|
|
9
9
|
[member: string]: TokenData<DataType>;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
type DataArray<DataType> = Array<TokenData<DataType>>;
|
|
12
|
+
type TokenData<DataType = Primitive> = Primitive | DataObject<DataType> | DataArray<DataType> | DataType;
|
|
13
|
+
type MaskObject = {
|
|
14
14
|
[member: string]: TokenMask;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
type MaskArray = Array<TokenMask>;
|
|
17
|
+
type TokenMask = string | null | MaskObject | MaskArray;
|
|
18
18
|
interface TokenEncryptionKey {
|
|
19
19
|
key: string;
|
|
20
20
|
alg: string;
|
|
@@ -38,11 +38,11 @@ interface Token<DataType = Primitive> extends TokenBase {
|
|
|
38
38
|
mask?: TokenMask;
|
|
39
39
|
expiresAt?: string;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
42
42
|
deduplicateToken?: boolean;
|
|
43
43
|
id?: string;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
46
46
|
privacy: Omit<TokenPrivacy, 'classification'>;
|
|
47
47
|
deduplicateToken: boolean;
|
|
48
48
|
}>;
|
package/types/sdk/sdk.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BasisTheoryElements } from '../../types/elements';
|
|
2
|
+
import { Transactions } from '../../types/sdk/services/transactions';
|
|
2
3
|
import type { Tokens, Tokenize, Applications, Tenants, Logs, ReactorFormulas, Reactors, Permissions, Proxies, Proxy, Sessions } from './services';
|
|
3
4
|
interface ApplicationInfo {
|
|
4
5
|
name?: string;
|
|
@@ -32,6 +33,7 @@ interface BasisTheory extends Tokenize {
|
|
|
32
33
|
proxies: Proxies;
|
|
33
34
|
proxy: Proxy;
|
|
34
35
|
sessions: Sessions;
|
|
36
|
+
transactions: Transactions;
|
|
35
37
|
}
|
|
36
38
|
interface ClientUserAgent {
|
|
37
39
|
client: string;
|
|
@@ -40,9 +42,9 @@ interface ClientUserAgent {
|
|
|
40
42
|
runtimeVersion: string;
|
|
41
43
|
application?: ApplicationInfo;
|
|
42
44
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
type BasisTheoryServices = keyof BasisTheory;
|
|
46
|
+
type BasisTheoryServicesBasePathMap = {
|
|
45
47
|
[key in BasisTheoryServices]: string;
|
|
46
48
|
};
|
|
47
|
-
|
|
49
|
+
type BasisTheoryInitStatus = 'not-started' | 'in-progress' | 'done' | 'error';
|
|
48
50
|
export type { ApplicationInfo, BasisTheoryInitStatus, BasisTheoryInit, BasisTheory, BasisTheoryInitOptionsWithoutElements, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptions, BasisTheoryServicesBasePathMap, ClientUserAgent, };
|
|
@@ -158,4 +158,17 @@ Object.keys(_sessions).forEach(function (key) {
|
|
|
158
158
|
return _sessions[key];
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
var _transactions = require("./transactions");
|
|
164
|
+
|
|
165
|
+
Object.keys(_transactions).forEach(function (key) {
|
|
166
|
+
if (key === "default" || key === "__esModule") return;
|
|
167
|
+
if (key in exports && exports[key] === _transactions[key]) return;
|
|
168
|
+
Object.defineProperty(exports, key, {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _transactions[key];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
161
174
|
});
|
|
@@ -6,17 +6,17 @@ interface Proxy {
|
|
|
6
6
|
put(options?: ProxyRequestOptions): Promise<any>;
|
|
7
7
|
delete(options?: ProxyRequestOptions): Promise<any>;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
type BasisTheoryProxyHeaders = {
|
|
10
10
|
[key: string]: string;
|
|
11
11
|
'BT-PROXY-URL': string;
|
|
12
12
|
'BT-PROXY-KEY': string;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type ProxyHeaders = Partial<BasisTheoryProxyHeaders>;
|
|
15
|
+
type BasisTheoryQueryParams = {
|
|
16
16
|
[key: string]: string;
|
|
17
17
|
'bt-proxy-key': string;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
type ProxyQuery = Partial<BasisTheoryQueryParams>;
|
|
20
20
|
interface ProxyRequestOptions extends RequestOptions {
|
|
21
21
|
includeResponseHeaders?: boolean;
|
|
22
22
|
path?: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { RequestOptions } from '../../../types/sdk';
|
|
2
2
|
import { AccessRule } from '../../models/applications';
|
|
3
|
-
|
|
3
|
+
type AuthorizeSessionRequest = {
|
|
4
4
|
nonce: string;
|
|
5
5
|
expiresAt?: string;
|
|
6
6
|
permissions?: string[];
|
|
7
7
|
rules?: AccessRule[];
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type CreateSessionResponse = {
|
|
10
10
|
sessionKey: string;
|
|
11
11
|
nonce: string;
|
|
12
12
|
expiresAt: string;
|
|
@@ -2,8 +2,9 @@ interface RequestOptions {
|
|
|
2
2
|
apiKey?: string;
|
|
3
3
|
correlationId?: string;
|
|
4
4
|
idempotencyKey?: string;
|
|
5
|
+
transactionId?: string;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
type QueryValue = boolean | number | string | null | undefined | Record<string, string> | (number | string)[];
|
|
7
8
|
interface PaginatedQuery {
|
|
8
9
|
[key: string]: QueryValue;
|
|
9
10
|
[key: number]: QueryValue;
|
|
@@ -19,19 +20,19 @@ interface PaginatedList<T> {
|
|
|
19
20
|
};
|
|
20
21
|
data: T[];
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
type Create<T, C> = {
|
|
23
24
|
create(model: C, options?: RequestOptions): Promise<T>;
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
+
type Retrieve<T> = {
|
|
26
27
|
retrieve(id: string, options?: RequestOptions): Promise<T>;
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
+
type Update<T, U> = {
|
|
29
30
|
update(id: string, model: U, options?: RequestOptions): Promise<T>;
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
+
type Delete = {
|
|
32
33
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
+
type List<T, Q extends PaginatedQuery = PaginatedQuery> = {
|
|
35
36
|
list(query?: Q, options?: RequestOptions): Promise<PaginatedList<T>>;
|
|
36
37
|
};
|
|
37
38
|
export type { RequestOptions, PaginatedQuery, PaginatedList, Create, Retrieve, Update, Delete, List, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RequestOptions } from '../../../types/sdk';
|
|
2
|
+
type CreateTransactionResponse = {
|
|
3
|
+
id: string;
|
|
4
|
+
createdBy: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
expiresAt: string;
|
|
7
|
+
};
|
|
8
|
+
interface Transactions {
|
|
9
|
+
create(options?: RequestOptions): Promise<CreateTransactionResponse>;
|
|
10
|
+
commit(id: string, options?: RequestOptions): Promise<void>;
|
|
11
|
+
rollback(id: string, options?: RequestOptions): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export { CreateTransactionResponse, Transactions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|