@basis-theory/basis-theory-js 1.38.0 → 1.41.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.
@@ -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, };
@@ -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';
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.38.0",
3
+ "version": "1.41.0",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -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
- 'Content-Type': 'application/merge-patch+json'
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 Tokens = Create<Token, CreateToken>;
6
- export type { Tokens, CreateToken };
5
+ declare type UpdateToken = UpdateTokenModel<ElementValue>;
6
+ declare type Tokens = Create<Token, CreateToken> & Update<Token, UpdateToken>;
7
+ export type { Tokens, CreateToken, UpdateToken };
@@ -10,6 +10,11 @@ declare type DataObject<DataType = Primitive> = {
10
10
  };
11
11
  declare type DataArray<DataType> = Array<TokenData<DataType>>;
12
12
  declare type TokenData<DataType = Primitive> = Primitive | DataObject<DataType> | DataArray<DataType> | DataType;
13
+ declare type MaskObject = {
14
+ [member: string]: TokenMask;
15
+ };
16
+ declare type MaskArray = Array<TokenMask>;
17
+ declare type TokenMask = string | MaskObject | MaskArray;
13
18
  interface TokenEncryptionKey {
14
19
  key: string;
15
20
  alg: string;
@@ -29,11 +34,13 @@ interface Token<DataType = Primitive> extends TokenBase {
29
34
  encryption?: TokenEncryption;
30
35
  searchIndexes?: string[];
31
36
  fingerprintExpression?: string;
37
+ mask?: TokenMask;
32
38
  }
33
- declare type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression'> & {
39
+ declare type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask'> & {
34
40
  deduplicateToken?: boolean;
41
+ id?: string;
35
42
  };
36
- declare type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression'> & {
43
+ declare type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask'> & {
37
44
  privacy: Omit<TokenPrivacy, 'classification'>;
38
45
  deduplicateToken: boolean;
39
46
  }>;