@basis-theory/basis-theory-js 1.75.0 → 1.77.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.
Files changed (54) hide show
  1. package/BasisTheory.d.ts +9 -0
  2. package/BasisTheory.js +33 -0
  3. package/README.md +15 -2
  4. package/applications/BasisTheoryApplications.d.ts +5 -5
  5. package/common/BasisTheoryClient.d.ts +9 -0
  6. package/common/BasisTheoryClient.js +65 -0
  7. package/common/HttpClientError.d.ts +6 -0
  8. package/common/HttpClientError.js +45 -0
  9. package/common/constants.d.ts +2 -1
  10. package/common/constants.js +5 -2
  11. package/common/index.d.ts +1 -0
  12. package/common/index.js +11 -2
  13. package/common/utils.d.ts +4 -3
  14. package/common/utils.js +5 -0
  15. package/elements/load.d.ts +1 -1
  16. package/elements/services/proxy.d.ts +1 -1
  17. package/elements/services/tokenize.d.ts +1 -1
  18. package/elements/services/tokens.d.ts +1 -1
  19. package/logs/BasisTheoryLogs.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/reactor-formulas/BasisTheoryReactorFormulas.d.ts +3 -3
  22. package/reactors/BasisTheoryReactors.d.ts +2 -2
  23. package/service/CrudBuilder.d.ts +6 -6
  24. package/service/types.d.ts +1 -1
  25. package/tenants/BasisTheoryTenants.d.ts +12 -12
  26. package/tokens/BasisTheoryTokens.d.ts +6 -6
  27. package/transactions/BasisTheoryTransactions.d.ts +10 -0
  28. package/transactions/BasisTheoryTransactions.js +41 -0
  29. package/transactions/index.d.ts +1 -0
  30. package/transactions/index.js +18 -0
  31. package/types/elements/elements.d.ts +16 -7
  32. package/types/elements/events.d.ts +15 -15
  33. package/types/elements/options.d.ts +15 -15
  34. package/types/elements/services/tokenize.d.ts +1 -1
  35. package/types/elements/services/tokens.d.ts +3 -3
  36. package/types/elements/shared.d.ts +7 -7
  37. package/types/elements/styles.d.ts +11 -11
  38. package/types/models/applications.d.ts +5 -5
  39. package/types/models/proxies.d.ts +2 -2
  40. package/types/models/reactor-formulas.d.ts +3 -3
  41. package/types/models/reactors.d.ts +2 -2
  42. package/types/models/shared.d.ts +2 -2
  43. package/types/models/tenants.d.ts +2 -2
  44. package/types/models/tokenize.d.ts +3 -3
  45. package/types/models/tokens.d.ts +11 -11
  46. package/types/sdk/sdk.d.ts +5 -3
  47. package/types/sdk/services/index.d.ts +1 -0
  48. package/types/sdk/services/index.js +13 -0
  49. package/types/sdk/services/logs.d.ts +1 -1
  50. package/types/sdk/services/proxy.d.ts +4 -4
  51. package/types/sdk/services/sessions.d.ts +2 -2
  52. package/types/sdk/services/shared.d.ts +7 -6
  53. package/types/sdk/services/transactions.d.ts +13 -0
  54. package/types/sdk/services/transactions.js +1 -0
@@ -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
+ });
@@ -1,3 +1,4 @@
1
+ import type { Config } from '../../common/BasisTheoryClient';
1
2
  import type { ElementEventListener, EventType, Subscription, TextElementEvents, CardElementEvents, CardNumberElementEvents, CardExpirationDateElementEvents, CardVerificationCodeElementEvents } from './events';
2
3
  import type { CreateCardElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, UpdateCardElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, UpdateCardExpirationDateElementOptions, UpdateCardVerificationCodeElementOptions, UpdateTextElementOptions, CardElementValue, CardExpirationDateValue } from './options';
3
4
  import type { Tokenize, Tokens, Proxy } from './services';
@@ -14,30 +15,30 @@ interface BaseElement<UpdateOptions, ElementEvents> {
14
15
  unmount(): void;
15
16
  on<T extends EventType>(eventType: T, listener: ElementEventListener<ElementEvents, T>): Subscription;
16
17
  }
17
- declare type CardElement = BaseElement<UpdateCardElementOptions, CardElementEvents> & {
18
+ type CardElement = BaseElement<UpdateCardElementOptions, CardElementEvents> & {
18
19
  readonly cardMetadata?: CardMetadata;
19
20
  setValue(value: CardElementValue<'reference'>): void;
20
21
  };
21
- declare type TextElement = BaseElement<UpdateTextElementOptions, TextElementEvents> & {
22
+ type TextElement = BaseElement<UpdateTextElementOptions, TextElementEvents> & {
22
23
  setValue(value: DataElementReference): void;
23
24
  };
24
- declare type CardNumberElement = BaseElement<UpdateCardNumberElementOptions, CardNumberElementEvents> & {
25
+ type CardNumberElement = BaseElement<UpdateCardNumberElementOptions, CardNumberElementEvents> & {
25
26
  readonly cardMetadata?: CardMetadata;
26
27
  setValue(value: DataElementReference): void;
27
28
  };
28
- declare type CardExpirationDateElement = BaseElement<UpdateCardExpirationDateElementOptions, CardExpirationDateElementEvents> & {
29
+ type CardExpirationDateElement = BaseElement<UpdateCardExpirationDateElementOptions, CardExpirationDateElementEvents> & {
29
30
  month(): ElementWrapper<CardExpirationDateElement>;
30
31
  year(): ElementWrapper<CardExpirationDateElement>;
31
32
  setValue(value: CardExpirationDateValue<'reference'>): void;
32
33
  };
33
- declare type CardVerificationCodeElement = BaseElement<UpdateCardVerificationCodeElementOptions, CardVerificationCodeElementEvents> & {
34
+ type CardVerificationCodeElement = BaseElement<UpdateCardVerificationCodeElementOptions, CardVerificationCodeElementEvents> & {
34
35
  setValue(value: DataElementReference): void;
35
36
  };
36
- declare type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, any>> = {
37
+ type ElementWrapper<T extends BaseElement<any, any> = BaseElement<any, any>> = {
37
38
  element: T;
38
39
  method?: string;
39
40
  };
40
- declare type ElementValue = TextElement | CardElement | CardNumberElement | CardExpirationDateElement | CardVerificationCodeElement | ElementWrapper;
41
+ type ElementValue = TextElement | CardElement | CardNumberElement | CardExpirationDateElement | CardVerificationCodeElement | ElementWrapper;
41
42
  interface BasisTheoryElements extends Tokenize {
42
43
  tokens: Tokens;
43
44
  proxy: Proxy;
@@ -47,9 +48,17 @@ interface BasisTheoryElements extends Tokenize {
47
48
  createElement(type: 'cardExpirationDate', options: CreateCardExpirationDateElementOptions): CardExpirationDateElement;
48
49
  createElement(type: 'cardVerificationCode', options: CreateCardVerificationCodeElementOptions): CardVerificationCodeElement;
49
50
  }
51
+ interface ElementClient {
52
+ post(url: string, payload: unknown, config?: Config): Promise<unknown>;
53
+ put(url: string, payload: unknown, config?: Config): Promise<unknown>;
54
+ patch(url: string, payload: unknown, config?: Config): Promise<unknown>;
55
+ get(url: string, config?: Config): Promise<unknown>;
56
+ delete(url: string, config?: Config): Promise<unknown>;
57
+ }
50
58
  interface BasisTheoryElementsInternal extends BasisTheoryElements {
51
59
  init: (apiKey: string | undefined, elementsBaseUrl: string) => Promise<BasisTheoryElements>;
52
60
  hasElement: (payload: unknown) => boolean;
61
+ client: ElementClient;
53
62
  }
54
63
  declare global {
55
64
  interface Window {
@@ -1,39 +1,39 @@
1
1
  import type { Brand, FieldError, ListenableKey, Targeted } from './shared';
2
- declare type EventType = 'ready' | 'change' | 'focus' | 'blur' | 'keydown';
2
+ type EventType = 'ready' | 'change' | 'focus' | 'blur' | 'keydown';
3
3
  interface BaseEvent<T extends EventType> {
4
4
  type: T;
5
5
  }
6
- declare type ReadyEvent = BaseEvent<'ready'>;
7
- declare type ChangeEvent = BaseEvent<'change'> & {
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
- declare type CardChangeEvent = ChangeEvent & {
14
+ type CardChangeEvent = ChangeEvent & {
15
15
  cardBrand: Brand;
16
16
  cardLast4?: string;
17
17
  cardBin?: string;
18
18
  };
19
- declare type InputFocusEvent = BaseEvent<'focus'> & Targeted;
20
- declare type InputBlurEvent = BaseEvent<'blur'> & Targeted;
21
- declare type InputKeydownEvent = BaseEvent<'keydown'> & Targeted & {
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
- declare type BaseElementEvents = ReadyEvent | InputFocusEvent | InputBlurEvent | InputKeydownEvent;
25
- declare type TextElementEvents = BaseElementEvents | ChangeEvent;
26
- declare type CardElementEvents = BaseElementEvents | CardChangeEvent;
27
- declare type CardNumberElementEvents = BaseElementEvents | CardChangeEvent;
28
- declare type CardExpirationDateElementEvents = BaseElementEvents | ChangeEvent;
29
- declare type CardVerificationCodeElementEvents = BaseElementEvents | ChangeEvent;
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
- declare type FindByType<Union, Type> = Union extends {
33
+ type FindByType<Union, Type> = Union extends {
34
34
  type: Type;
35
35
  } ? Union : never;
36
- declare type ElementEventListener<Events, Type> = (event: FindByType<Events, Type>) => void;
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
- declare type ElementType = typeof ELEMENTS_TYPES[number];
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
- declare type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
29
- declare type Transform = RegExp | [RegExp, string?] | null;
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
- declare type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabled' | 'validateOnChange' | 'enableCopy'> & AutoCompleteOption;
37
- declare type ElementValueType = 'static' | 'reference';
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
- declare type CreateCardElementOptions = CustomizableElementOptions & {
48
+ type CreateCardElementOptions = CustomizableElementOptions & {
49
49
  value?: CardElementValue<'static'>;
50
50
  };
51
- declare type UpdateCardElementOptions = Omit<CreateCardElementOptions, 'validateOnChange' | 'enableCopy'>;
52
- declare type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'password' | 'validation'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
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
- declare type UpdateTextElementOptions = Omit<CreateTextElementOptions, 'targetId' | 'mask' | 'validateOnChange'>;
57
- declare type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition'> & Required<Pick<ElementOptions, 'targetId'>> & {
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
- declare type UpdateCardNumberElementOptions = Omit<CreateCardNumberElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
62
- declare type CreateCardExpirationDateElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder'> & Required<Pick<ElementOptions, 'targetId'>> & {
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
- declare type UpdateCardExpirationDateElementOptions = Omit<CreateCardExpirationDateElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
67
- declare type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand'> & Required<Pick<ElementOptions, 'targetId'>> & {
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
- declare type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId' | 'validateOnChange' | 'enableCopy'>;
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
- declare type TokenizeData = TokenizeDataModel<ElementValue>;
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
- declare type CreateToken = CreateTokenModel<ElementValue>;
5
- declare type UpdateToken = UpdateTokenModel<ElementValue>;
6
- declare type Tokens = Create<Token, CreateToken> & Retrieve<Token<any>> & Update<Token, UpdateToken>;
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
- declare type FieldErrorType = 'incomplete' | 'invalid';
3
- declare type ConfigErrorType = 'missing-configuration' | 'missing-permission' | 'invalid-configuration';
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
- declare type ListenableKey = 'Escape' | 'Enter';
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
- declare type Brand = typeof CARD_BRANDS[number];
33
+ type Brand = typeof CARD_BRANDS[number];
34
34
  /**
35
35
  * Icon position for card number element
36
36
  */
37
- declare type CardIconPosition = typeof CARD_ICON_POSITIONS[number];
37
+ type CardIconPosition = typeof CARD_ICON_POSITIONS[number];
38
38
  /**
39
39
  * Values for the element input autocomplete attribute
40
40
  */
41
- declare type AutoCompleteValue = typeof AUTOCOMPLETE_VALUES[number];
41
+ type AutoCompleteValue = typeof AUTOCOMPLETE_VALUES[number];
42
42
  /**
43
43
  * Type used for detokenization responses stored on Data Elements
44
44
  */
45
- declare type DataElementReference = {
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
- declare type SafeCSSProperty = typeof SAFE_CSS_PROPERTIES[number];
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
- declare type SafeStyle = Pick<CSSProperties, SafeCSSProperty>;
6
+ type SafeStyle = Pick<CSSProperties, SafeCSSProperty>;
7
7
  declare const CARD_ELEMENT_STYLE_VARIANT_SELECTORS: readonly [":hover", ":focus", "::placeholder", "::selection", ":disabled"];
8
- declare type CardElementStyleVariantSelector = typeof CARD_ELEMENT_STYLE_VARIANT_SELECTORS[number];
9
- declare type CardElementStyleVariantStyle = SafeStyle & Partial<Record<CardElementStyleVariantSelector, SafeStyle>>;
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
- declare type CardElementStyleVariant = typeof CARD_ELEMENT_STYLE_VARIANTS[number];
13
- declare type CardElementStyleFontAttr = typeof CARD_ELEMENT_STYLE_FONTS_ATTR;
14
- declare type FontSource = string;
15
- declare type FontSources = FontSource[];
16
- declare type Fonts = Record<CardElementStyleFontAttr, FontSources>;
17
- declare type CardElementStyle = Partial<Record<CardElementStyleVariant, CardElementStyleVariantStyle> & Fonts>;
18
- declare type ElementStyle = CardElementStyle;
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
- declare type ApplicationType = typeof APPLICATION_TYPES[number];
5
- declare type TransformType = typeof TRANSFORM_TYPES[number];
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
- declare type Condition = {
24
+ type Condition = {
25
25
  attribute: string;
26
26
  operator: string;
27
27
  value: string;
28
28
  };
29
- declare type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | 'expiresAt'>;
30
- declare type UpdateApplication = Pick<Application, 'name' | 'permissions' | 'rules'>;
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
- declare type CreateProxy = Pick<Proxy, 'name' | 'destinationUrl' | 'requestReactorId' | 'responseReactorId' | 'requestTransform' | 'responseTransform' | 'configuration' | 'requireAuth'> & {
20
+ type CreateProxy = Pick<Proxy, 'name' | 'destinationUrl' | 'requestReactorId' | 'responseReactorId' | 'requestTransform' | 'responseTransform' | 'configuration' | 'requireAuth'> & {
21
21
  application?: Pick<Application, 'id'>;
22
22
  };
23
- declare type UpdateProxy = CreateProxy;
23
+ type UpdateProxy = CreateProxy;
24
24
  export type { Proxy, CreateProxy, UpdateProxy };
@@ -1,6 +1,6 @@
1
1
  import type { Auditable } from './shared';
2
- declare type FormulaType = 'official' | 'private';
3
- declare type DataType = 'string' | 'boolean' | 'number';
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
- declare type CreateReactorFormula = Omit<ReactorFormula, 'id' | 'createdAt' | 'createdBy' | 'modifiedAt' | 'modifiedBy'>;
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
- declare type CreateReactor = Pick<Reactor, 'name' | 'configuration'> & {
12
+ type CreateReactor = Pick<Reactor, 'name' | 'configuration'> & {
13
13
  formula: Pick<ReactorFormula, 'id'>;
14
14
  application?: Pick<Application, 'id'>;
15
15
  };
16
- declare type UpdateReactor = Pick<Reactor, 'name' | 'configuration'> & {
16
+ type UpdateReactor = Pick<Reactor, 'name' | 'configuration'> & {
17
17
  application?: Pick<Application, 'id'>;
18
18
  };
19
19
  export type { Reactor, CreateReactor, UpdateReactor };
@@ -1,6 +1,6 @@
1
1
  import type { DataObject } from './tokens';
2
- declare type Primitive = string | number | boolean | null;
3
- declare type TokenType = 'token' | 'card' | 'bank' | 'card_number' | 'us_bank_routing_number' | 'us_bank_account_number' | 'social_security_number';
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
- declare type UpdateTenant = Pick<Tenant, 'name' | 'settings'>;
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
- declare type CreateTenantInvitation = Pick<TenantInvitation, 'email'>;
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
- declare type TokenizeObject<DataType = Primitive> = {
2
+ type TokenizeObject<DataType = Primitive> = {
3
3
  [key: string]: Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType;
4
4
  };
5
- declare type TokenizeArray<DataType = Primitive> = Array<Primitive | TokenizeObject<DataType> | TokenizeArray<DataType> | DataType>;
6
- declare type TokenizeData<DataType = Primitive> = TokenizeArray<DataType> | TokenizeObject<DataType>;
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 };
@@ -1,20 +1,20 @@
1
1
  import type { Primitive, TokenBase } from './shared';
2
2
  declare const DATA_CLASSIFICATIONS: readonly ["general", "bank", "pci", "pii"];
3
- declare type DataClassification = typeof DATA_CLASSIFICATIONS[number];
3
+ type DataClassification = typeof DATA_CLASSIFICATIONS[number];
4
4
  declare const DATA_IMPACT_LEVELS: readonly ["low", "moderate", "high"];
5
- declare type DataImpactLevel = typeof DATA_IMPACT_LEVELS[number];
5
+ type DataImpactLevel = typeof DATA_IMPACT_LEVELS[number];
6
6
  declare const DATA_RESTRICTION_POLICIES: readonly ["mask", "redact"];
7
- declare type DataRestrictionPolicy = typeof DATA_RESTRICTION_POLICIES[number];
8
- declare type DataObject<DataType = Primitive> = {
7
+ type DataRestrictionPolicy = typeof DATA_RESTRICTION_POLICIES[number];
8
+ type DataObject<DataType = Primitive> = {
9
9
  [member: string]: TokenData<DataType>;
10
10
  };
11
- declare type DataArray<DataType> = Array<TokenData<DataType>>;
12
- declare type TokenData<DataType = Primitive> = Primitive | DataObject<DataType> | DataArray<DataType> | DataType;
13
- declare type MaskObject = {
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
- declare type MaskArray = Array<TokenMask>;
17
- declare type TokenMask = string | null | MaskObject | MaskArray;
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
- declare type CreateToken<DataType = Primitive> = Pick<Token<DataType>, 'type' | 'data' | 'privacy' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
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
- declare type UpdateToken<DataType = Primitive> = Partial<Pick<Token<DataType>, 'data' | 'containers' | 'metadata' | 'encryption' | 'searchIndexes' | 'fingerprintExpression' | 'mask' | 'expiresAt'> & {
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
  }>;
@@ -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
- declare type BasisTheoryServices = keyof BasisTheory;
44
- declare type BasisTheoryServicesBasePathMap = {
45
+ type BasisTheoryServices = keyof BasisTheory;
46
+ type BasisTheoryServicesBasePathMap = {
45
47
  [key in BasisTheoryServices]: string;
46
48
  };
47
- declare type BasisTheoryInitStatus = 'not-started' | 'in-progress' | 'done' | 'error';
49
+ type BasisTheoryInitStatus = 'not-started' | 'in-progress' | 'done' | 'error';
48
50
  export type { ApplicationInfo, BasisTheoryInitStatus, BasisTheoryInit, BasisTheory, BasisTheoryInitOptionsWithoutElements, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptions, BasisTheoryServicesBasePathMap, ClientUserAgent, };
@@ -10,3 +10,4 @@ export * from './permissions';
10
10
  export * from './proxies';
11
11
  export * from './proxy';
12
12
  export * from './sessions';
13
+ export * from './transactions';
@@ -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,5 +6,5 @@ interface ListLogQuery extends PaginatedQuery {
6
6
  startDate?: string;
7
7
  endDate?: string;
8
8
  }
9
- declare type Logs = List<Log, ListLogQuery>;
9
+ type Logs = List<Log, ListLogQuery>;
10
10
  export type { ListLogQuery, Logs };
@@ -6,17 +6,17 @@ interface Proxy {
6
6
  put(options?: ProxyRequestOptions): Promise<any>;
7
7
  delete(options?: ProxyRequestOptions): Promise<any>;
8
8
  }
9
- declare type BasisTheoryProxyHeaders = {
9
+ type BasisTheoryProxyHeaders = {
10
10
  [key: string]: string;
11
11
  'BT-PROXY-URL': string;
12
12
  'BT-PROXY-KEY': string;
13
13
  };
14
- declare type ProxyHeaders = Partial<BasisTheoryProxyHeaders>;
15
- declare type BasisTheoryQueryParams = {
14
+ type ProxyHeaders = Partial<BasisTheoryProxyHeaders>;
15
+ type BasisTheoryQueryParams = {
16
16
  [key: string]: string;
17
17
  'bt-proxy-key': string;
18
18
  };
19
- declare type ProxyQuery = Partial<BasisTheoryQueryParams>;
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
- declare type AuthorizeSessionRequest = {
3
+ type AuthorizeSessionRequest = {
4
4
  nonce: string;
5
5
  expiresAt?: string;
6
6
  permissions?: string[];
7
7
  rules?: AccessRule[];
8
8
  };
9
- declare type CreateSessionResponse = {
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
- declare type QueryValue = boolean | number | string | null | undefined | Record<string, string> | (number | string)[];
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
- declare type Create<T, C> = {
23
+ type Create<T, C> = {
23
24
  create(model: C, options?: RequestOptions): Promise<T>;
24
25
  };
25
- declare type Retrieve<T> = {
26
+ type Retrieve<T> = {
26
27
  retrieve(id: string, options?: RequestOptions): Promise<T>;
27
28
  };
28
- declare type Update<T, U> = {
29
+ type Update<T, U> = {
29
30
  update(id: string, model: U, options?: RequestOptions): Promise<T>;
30
31
  };
31
- declare type Delete = {
32
+ type Delete = {
32
33
  delete(id: string, options?: RequestOptions): Promise<void>;
33
34
  };
34
- declare type List<T, Q extends PaginatedQuery = PaginatedQuery> = {
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";