@basis-theory/basis-theory-js 2.1.0 → 2.3.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 +4 -0
- package/BasisTheory.js +5 -0
- package/README.md +4 -4
- package/package.json +3 -2
- package/tokens/BasisTheoryTokens.d.ts +0 -4
- package/tokens/BasisTheoryTokens.js +0 -20
- package/types/models/bin-details.d.ts +38 -0
- package/types/models/bin-details.js +1 -0
- package/types/models/index.d.ts +1 -0
- package/types/models/index.js +13 -0
- package/types/models/reactor-formulas.d.ts +8 -0
- package/types/models/reactors.d.ts +8 -3
- package/types/models/tokens.d.ts +6 -1
- package/types/sdk/services/reactor-formulas.d.ts +8 -0
- package/types/sdk/services/tokens.d.ts +0 -4
package/BasisTheory.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
33
33
|
get client(): HttpClient | undefined;
|
|
34
34
|
get tenants(): Tenants;
|
|
35
35
|
get logs(): Logs;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
|
|
38
|
+
* @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
|
|
39
|
+
*/
|
|
36
40
|
get reactorFormulas(): ReactorFormulas;
|
|
37
41
|
get reactors(): Reactors;
|
|
38
42
|
get permissions(): Permissions;
|
package/BasisTheory.js
CHANGED
|
@@ -204,6 +204,11 @@ class BasisTheory {
|
|
|
204
204
|
get logs() {
|
|
205
205
|
return (0, _common.assertInit)(this._logs);
|
|
206
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
|
|
209
|
+
* @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
|
|
210
|
+
*/
|
|
211
|
+
|
|
207
212
|
|
|
208
213
|
get reactorFormulas() {
|
|
209
214
|
return (0, _common.assertInit)(this._reactorFormulas);
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ For a complete list of endpoints and examples, please refer to our [API docs](ht
|
|
|
31
31
|
```javascript
|
|
32
32
|
import { BasisTheory } from '@basis-theory/basis-theory-js';
|
|
33
33
|
|
|
34
|
-
const bt = await new BasisTheory().init('
|
|
34
|
+
const bt = await new BasisTheory().init('<API Key>'); // replace with your application key
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### Per-request configuration
|
|
@@ -45,7 +45,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
45
45
|
await bt.applications.list(
|
|
46
46
|
{},
|
|
47
47
|
{
|
|
48
|
-
apiKey: '
|
|
48
|
+
apiKey: '<Management API Key>',
|
|
49
49
|
correlationId: 'aa5d3379-6385-4ef4-9fdb-ca1341572153',
|
|
50
50
|
idempotencyKey: 'bb5d3379-6385-4ef4-9fdb-ca1341572154',
|
|
51
51
|
}
|
|
@@ -57,7 +57,7 @@ await bt.tokens.create(
|
|
|
57
57
|
data: "Sensitive Value",
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
apiKey: '
|
|
60
|
+
apiKey: '<API Key>',
|
|
61
61
|
correlationId: 'aa5d3379-6385-4ef4-9fdb-ca1341572153',
|
|
62
62
|
idempotencyKey: 'bb5d3379-6385-4ef4-9fdb-ca1341572154',
|
|
63
63
|
transactionId: 'cc5d3379-3921-4ef4-9fdb-ca1341572169',
|
|
@@ -72,7 +72,7 @@ You can set a custom API Url to be used across all clients when creating a new S
|
|
|
72
72
|
```javascript
|
|
73
73
|
import { BasisTheory } from '@basis-theory/basis-theory-js';
|
|
74
74
|
|
|
75
|
-
const bt = await new BasisTheory().init('
|
|
75
|
+
const bt = await new BasisTheory().init('<API Key>', {
|
|
76
76
|
apiBaseUrl: 'https://api.somedomain.com',
|
|
77
77
|
}); // replace with your application key and api base URL.
|
|
78
78
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basis-theory/basis-theory-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"repository": "https://github.com/Basis-Theory/basis-theory-js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"tar": "^4.4.19",
|
|
36
36
|
"minimist": "^1.2.6",
|
|
37
37
|
"json-schema": "^0.4.0",
|
|
38
|
-
"terser": "^5.14.2"
|
|
38
|
+
"terser": "^5.14.2",
|
|
39
|
+
"word-wrap": "^1.2.5"
|
|
39
40
|
},
|
|
40
41
|
"engines": {
|
|
41
42
|
"node": ">=10.12.0"
|
|
@@ -5,10 +5,6 @@ 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): Promise<void>;
|
|
9
|
-
deleteAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
|
|
10
|
-
createChild(parentId: string, token: CreateToken, options?: RequestOptions): Promise<Token>;
|
|
11
|
-
listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
12
8
|
search(searchRequest: SearchTokensRequest, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
13
9
|
readonly client: import("axios").AxiosInstance;
|
|
14
10
|
};
|
|
@@ -40,26 +40,6 @@ const BasisTheoryTokens = new _CrudBuilder.CrudBuilder(class BasisTheoryTokens e
|
|
|
40
40
|
}).then(_utils.dataExtractor);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
async createAssociation(parentId, childId, options) {
|
|
44
|
-
const url = `/${parentId}/children/${childId}`;
|
|
45
|
-
await this.client.post(url, {}, (0, _common.createRequestConfig)(options));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async deleteAssociation(parentId, childId, options) {
|
|
49
|
-
const url = `/${parentId}/children/${childId}`;
|
|
50
|
-
await this.client.delete(url, (0, _common.createRequestConfig)(options));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
createChild(parentId, token, options) {
|
|
54
|
-
const url = `/${parentId}/children`;
|
|
55
|
-
return this.client.post(url, token, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
listChildren(parentId, query = {}, options = {}) {
|
|
59
|
-
const url = `/${parentId}/children${(0, _common.getQueryParams)(query)}`;
|
|
60
|
-
return this.client.get(url, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
43
|
search(searchRequest, options) {
|
|
64
44
|
return this.client.post('/search', searchRequest, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
65
45
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface BinDetails {
|
|
2
|
+
cardBrand?: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
prepaid?: boolean;
|
|
5
|
+
cardSegmentType?: string;
|
|
6
|
+
reloadable?: boolean;
|
|
7
|
+
panOrToken?: string;
|
|
8
|
+
accountUpdater?: boolean;
|
|
9
|
+
alm?: boolean;
|
|
10
|
+
domesticOnly?: boolean;
|
|
11
|
+
gamblingBlocked?: boolean;
|
|
12
|
+
level2?: boolean;
|
|
13
|
+
level3?: boolean;
|
|
14
|
+
issuerCurrency?: string;
|
|
15
|
+
comboCard?: string;
|
|
16
|
+
binLength?: number;
|
|
17
|
+
authentication?: any;
|
|
18
|
+
cost?: any;
|
|
19
|
+
bank?: BinDetailsBank;
|
|
20
|
+
country?: BinDetailsCountry;
|
|
21
|
+
product?: BinDetailsProduct;
|
|
22
|
+
}
|
|
23
|
+
interface BinDetailsBank {
|
|
24
|
+
name?: string;
|
|
25
|
+
phone?: string;
|
|
26
|
+
url?: string;
|
|
27
|
+
cleanName?: string;
|
|
28
|
+
}
|
|
29
|
+
interface BinDetailsCountry {
|
|
30
|
+
alpha2?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
numeric?: string;
|
|
33
|
+
}
|
|
34
|
+
interface BinDetailsProduct {
|
|
35
|
+
code?: string;
|
|
36
|
+
name?: string;
|
|
37
|
+
}
|
|
38
|
+
export type { BinDetails, BinDetailsBank, BinDetailsCountry, BinDetailsProduct, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/types/models/index.d.ts
CHANGED
package/types/models/index.js
CHANGED
|
@@ -160,6 +160,19 @@ Object.keys(_cards).forEach(function (key) {
|
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
+
var _binDetails = require("./bin-details");
|
|
164
|
+
|
|
165
|
+
Object.keys(_binDetails).forEach(function (key) {
|
|
166
|
+
if (key === "default" || key === "__esModule") return;
|
|
167
|
+
if (key in exports && exports[key] === _binDetails[key]) return;
|
|
168
|
+
Object.defineProperty(exports, key, {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _binDetails[key];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
163
176
|
var _util = require("./util");
|
|
164
177
|
|
|
165
178
|
Object.keys(_util).forEach(function (key) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Auditable } from './shared';
|
|
2
2
|
type FormulaType = 'official' | 'private';
|
|
3
3
|
type DataType = 'string' | 'boolean' | 'number';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
|
|
6
|
+
* @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
|
|
7
|
+
*/
|
|
4
8
|
interface ReactorFormula extends Auditable {
|
|
5
9
|
id: string;
|
|
6
10
|
name: string;
|
|
@@ -22,5 +26,9 @@ interface ReactorFormulaRequestParam {
|
|
|
22
26
|
type: DataType;
|
|
23
27
|
optional?: boolean;
|
|
24
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
|
|
31
|
+
* @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
|
|
32
|
+
*/
|
|
25
33
|
type CreateReactorFormula = Omit<ReactorFormula, 'id' | 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'>;
|
|
26
34
|
export type { FormulaType, DataType, ReactorFormula, ReactorFormulaConfig, ReactorFormulaRequestParam, CreateReactorFormula, };
|
|
@@ -6,15 +6,20 @@ interface Reactor extends Auditable {
|
|
|
6
6
|
id: string;
|
|
7
7
|
tenantId: string;
|
|
8
8
|
name: string;
|
|
9
|
-
formula: ReactorFormula;
|
|
10
9
|
application?: Application;
|
|
10
|
+
code?: string;
|
|
11
11
|
configuration?: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
|
|
14
|
+
* @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
|
|
15
|
+
*/
|
|
16
|
+
formula?: ReactorFormula;
|
|
12
17
|
}
|
|
13
18
|
type CreateReactor = Pick<Reactor, 'name' | 'configuration'> & {
|
|
14
|
-
|
|
19
|
+
code?: string;
|
|
15
20
|
application?: Pick<Application, 'id'>;
|
|
16
21
|
};
|
|
17
|
-
type UpdateReactor = Pick<Reactor, 'name' | 'configuration'> & {
|
|
22
|
+
type UpdateReactor = Pick<Reactor, 'name' | 'configuration' | 'code'> & {
|
|
18
23
|
application?: Pick<Application, 'id'>;
|
|
19
24
|
};
|
|
20
25
|
type PatchReactor = Omit<Partial<UpdateReactor>, 'configuration'> & {
|
package/types/models/tokens.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BinDetails } from './bin-details';
|
|
1
2
|
import type { Primitive, TokenBase } from './shared';
|
|
2
3
|
declare const DATA_CLASSIFICATIONS: readonly ["general", "bank", "pci", "pii"];
|
|
3
4
|
type DataClassification = typeof DATA_CLASSIFICATIONS[number];
|
|
@@ -28,6 +29,9 @@ interface TokenPrivacy {
|
|
|
28
29
|
impactLevel?: DataImpactLevel;
|
|
29
30
|
restrictionPolicy?: DataRestrictionPolicy;
|
|
30
31
|
}
|
|
32
|
+
interface TokenEnrichments {
|
|
33
|
+
binDetails?: BinDetails;
|
|
34
|
+
}
|
|
31
35
|
interface Token<DataType = Primitive> extends TokenBase {
|
|
32
36
|
data: TokenData<DataType>;
|
|
33
37
|
privacy?: TokenPrivacy;
|
|
@@ -37,6 +41,7 @@ interface Token<DataType = Primitive> extends TokenBase {
|
|
|
37
41
|
fingerprintExpression?: string;
|
|
38
42
|
mask?: TokenMask;
|
|
39
43
|
expiresAt?: string;
|
|
44
|
+
enrichments?: TokenEnrichments;
|
|
40
45
|
}
|
|
41
46
|
type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
|
|
42
47
|
deduplicateToken?: boolean;
|
|
@@ -46,5 +51,5 @@ type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' |
|
|
|
46
51
|
privacy: Omit<TokenPrivacy, 'classification'>;
|
|
47
52
|
deduplicateToken: boolean;
|
|
48
53
|
}>;
|
|
49
|
-
export type { Token, CreateToken, UpdateToken, DataArray, DataObject, TokenData, DataClassification, DataImpactLevel, DataRestrictionPolicy, };
|
|
54
|
+
export type { Token, TokenEnrichments, CreateToken, UpdateToken, DataArray, DataObject, TokenData, DataClassification, DataImpactLevel, DataRestrictionPolicy, };
|
|
50
55
|
export { DATA_CLASSIFICATIONS, DATA_IMPACT_LEVELS, DATA_RESTRICTION_POLICIES };
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { CreateReactorFormula, ReactorFormula } from '../../../types/models';
|
|
2
2
|
import type { Create, Delete, List, PaginatedQuery, Retrieve, Update } from './shared';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
|
|
5
|
+
* @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
|
|
6
|
+
*/
|
|
3
7
|
interface ListReactorFormulaQuery extends PaginatedQuery {
|
|
4
8
|
name?: string;
|
|
5
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Reactor Formulas are now deprecated and will be removed in a future release.
|
|
12
|
+
* @description We have introduced a `code` property for Reactors to replace Formula's code. For more details visit [our API reference](https://developers.basistheory.com/docs/api/reactors#create-reactor).
|
|
13
|
+
*/
|
|
6
14
|
interface ReactorFormulas extends Create<ReactorFormula, CreateReactorFormula>, Retrieve<ReactorFormula>, Update<ReactorFormula, CreateReactorFormula>, Delete, List<ReactorFormula, ListReactorFormulaQuery> {
|
|
7
15
|
}
|
|
8
16
|
export type { ListReactorFormulaQuery, ReactorFormulas };
|
|
@@ -11,10 +11,6 @@ interface SearchTokensRequest {
|
|
|
11
11
|
size?: number;
|
|
12
12
|
}
|
|
13
13
|
interface Tokens extends Create<Token, CreateToken>, Update<Token, UpdateToken>, Retrieve<Token<any>>, Delete, List<Token, ListTokensQuery> {
|
|
14
|
-
createAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
|
|
15
|
-
deleteAssociation(parentId: string, childId: string, options?: RequestOptions): Promise<void>;
|
|
16
|
-
createChild(parentId: string, token: CreateToken, options?: RequestOptions): Promise<Token>;
|
|
17
|
-
listChildren(parentId: string, query?: ListTokensQuery, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
18
14
|
search(searchRequest: SearchTokensRequest, options?: RequestOptions): Promise<PaginatedList<Token>>;
|
|
19
15
|
}
|
|
20
16
|
export type { Tokens, ListTokensQuery, SearchTokensRequest };
|