@basis-theory/basis-theory-js 1.1.0 → 1.2.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 (48) hide show
  1. package/BasisTheory.d.ts +10 -11
  2. package/BasisTheory.js +32 -28
  3. package/applications/BasisTheoryApplications.d.ts +2 -2
  4. package/applications/BasisTheoryApplications.js +1 -1
  5. package/applications/types.d.ts +7 -6
  6. package/atomic/BasisTheoryAtomic.js +4 -4
  7. package/atomic/banks/BasisTheoryAtomicBanks.d.ts +2 -2
  8. package/atomic/banks/BasisTheoryAtomicBanks.js +10 -6
  9. package/atomic/banks/types.d.ts +4 -3
  10. package/atomic/cards/BasisTheoryAtomicCards.d.ts +2 -2
  11. package/atomic/cards/BasisTheoryAtomicCards.js +12 -8
  12. package/atomic/cards/types.d.ts +6 -5
  13. package/atomic/types.d.ts +4 -2
  14. package/common/constants.d.ts +6 -5
  15. package/common/elements.js +0 -1
  16. package/common/script.d.ts +3 -2
  17. package/common/script.js +2 -4
  18. package/common/utils.d.ts +17 -16
  19. package/common/utils.js +39 -40
  20. package/elements/index.d.ts +3 -2
  21. package/encryption/BasisTheoryEncryption.d.ts +1 -2
  22. package/encryption/BasisTheoryEncryption.js +5 -4
  23. package/encryption/BasisTheoryEncryptionAdapters.js +6 -4
  24. package/encryption/providers/browser.js +23 -32
  25. package/encryption/providers/node.js +11 -13
  26. package/encryption/providers/utils.d.ts +3 -2
  27. package/encryption/providers/utils.js +8 -7
  28. package/encryption/types.d.ts +3 -2
  29. package/logs/BasisTheoryLogs.d.ts +1 -1
  30. package/logs/types.d.ts +3 -2
  31. package/package.json +2 -2
  32. package/permissions/BasisTheoryPermissions.js +1 -1
  33. package/permissions/types.d.ts +5 -3
  34. package/reactor-formulas/BasisTheoryReactorFormulas.d.ts +1 -1
  35. package/reactor-formulas/types.d.ts +8 -7
  36. package/reactors/BasisTheoryReactors.js +9 -5
  37. package/reactors/types.d.ts +6 -5
  38. package/service/BasisTheoryService.js +9 -3
  39. package/service/CrudBuilder.d.ts +10 -10
  40. package/service/CrudBuilder.js +15 -4
  41. package/service/types.d.ts +6 -6
  42. package/tenants/BasisTheoryTenants.d.ts +2 -2
  43. package/tenants/BasisTheoryTenants.js +2 -2
  44. package/tenants/types.d.ts +3 -2
  45. package/tokens/BasisTheoryTokens.d.ts +5 -5
  46. package/tokens/BasisTheoryTokens.js +16 -13
  47. package/tokens/types.d.ts +14 -12
  48. package/types.d.ts +11 -9
package/BasisTheory.d.ts CHANGED
@@ -1,17 +1,16 @@
1
- import { BasisTheoryAtomic } from './atomic';
2
- import type { BasisTheoryInitOptions } from './types';
3
1
  import { BasisTheoryApplications } from './applications';
4
- import { BasisTheoryTokens } from './tokens';
5
- import { BasisTheoryEncryptionAdapters } from './encryption/BasisTheoryEncryptionAdapters';
2
+ import { BasisTheoryAtomic } from './atomic';
3
+ import { BasisTheoryAtomicBanks } from './atomic/banks';
4
+ import { BasisTheoryAtomicCards } from './atomic/cards';
6
5
  import type { BasisTheoryElements } from './elements';
7
- import { BasisTheoryTenants } from './tenants';
6
+ import { BasisTheoryEncryptionAdapters } from './encryption/BasisTheoryEncryptionAdapters';
8
7
  import { BasisTheoryLogs } from './logs';
8
+ import { BasisTheoryPermissions } from './permissions';
9
9
  import { BasisTheoryReactorFormulas } from './reactor-formulas';
10
10
  import { BasisTheoryReactors } from './reactors';
11
- import { BasisTheoryAtomicBanks } from './atomic/banks';
12
- import { BasisTheoryAtomicCards } from './atomic/cards';
13
- import { BasisTheoryPermissions } from './permissions';
14
- export declare const defaultInitOptions: Required<BasisTheoryInitOptions>;
11
+ import { BasisTheoryTenants } from './tenants';
12
+ import { BasisTheoryTokens } from './tokens';
13
+ import type { BasisTheoryInitOptions } from './types';
15
14
  export declare class BasisTheory {
16
15
  private _initStatus;
17
16
  private _initOptions?;
@@ -33,8 +32,6 @@ export declare class BasisTheory {
33
32
  get tokens(): BasisTheoryTokens;
34
33
  get atomic(): BasisTheoryAtomic;
35
34
  get encryption(): BasisTheoryEncryptionAdapters;
36
- set elements(elements: BasisTheoryElements);
37
- get elements(): BasisTheoryElements;
38
35
  get applications(): BasisTheoryApplications;
39
36
  get tenants(): BasisTheoryTenants;
40
37
  get logs(): BasisTheoryLogs;
@@ -43,4 +40,6 @@ export declare class BasisTheory {
43
40
  get atomicBanks(): BasisTheoryAtomicBanks;
44
41
  get atomicCards(): BasisTheoryAtomicCards;
45
42
  get permissions(): BasisTheoryPermissions;
43
+ get elements(): BasisTheoryElements;
44
+ set elements(elements: BasisTheoryElements);
46
45
  }
package/BasisTheory.js CHANGED
@@ -3,33 +3,33 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.BasisTheory = exports.defaultInitOptions = void 0;
6
+ exports.BasisTheory = void 0;
7
7
 
8
- var _common = require("./common");
9
-
10
- var _constants = require("./common/constants");
8
+ var _applications = require("./applications");
11
9
 
12
10
  var _atomic = require("./atomic");
13
11
 
14
- var _applications = require("./applications");
12
+ var _banks = require("./atomic/banks");
15
13
 
16
- var _tokens = require("./tokens");
14
+ var _cards = require("./atomic/cards");
17
15
 
18
- var _BasisTheoryEncryptionAdapters = require("./encryption/BasisTheoryEncryptionAdapters");
16
+ var _common = require("./common");
19
17
 
20
- var _tenants = require("./tenants");
18
+ var _constants = require("./common/constants");
19
+
20
+ var _BasisTheoryEncryptionAdapters = require("./encryption/BasisTheoryEncryptionAdapters");
21
21
 
22
22
  var _logs = require("./logs");
23
23
 
24
+ var _permissions = require("./permissions");
25
+
24
26
  var _reactorFormulas = require("./reactor-formulas");
25
27
 
26
28
  var _reactors = require("./reactors");
27
29
 
28
- var _banks = require("./atomic/banks");
29
-
30
- var _cards = require("./atomic/cards");
30
+ var _tenants = require("./tenants");
31
31
 
32
- var _permissions = require("./permissions");
32
+ var _tokens = require("./tokens");
33
33
 
34
34
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
35
 
@@ -38,7 +38,6 @@ const defaultInitOptions = {
38
38
  elements: false,
39
39
  elementsBaseUrl: _constants.DEFAULT_ELEMENTS_BASE_URL
40
40
  };
41
- exports.defaultInitOptions = defaultInitOptions;
42
41
 
43
42
  class BasisTheory {
44
43
  constructor() {
@@ -93,8 +92,8 @@ class BasisTheory {
93
92
  baseUrlObject.protocol = 'https';
94
93
  }
95
94
 
96
- baseUrl = baseUrlObject.toString().replace(/\/$/, '');
97
- } catch (e) {
95
+ baseUrl = baseUrlObject.toString().replace(/\/$/u, '');
96
+ } catch {
98
97
  throw new Error('Invalid format for the given API base url.');
99
98
  }
100
99
 
@@ -145,9 +144,9 @@ class BasisTheory {
145
144
  }
146
145
 
147
146
  this._initStatus = 'done';
148
- } catch (e) {
147
+ } catch (error) {
149
148
  this._initStatus = 'error';
150
- throw e;
149
+ throw error;
151
150
  }
152
151
 
153
152
  return this;
@@ -158,14 +157,17 @@ class BasisTheory {
158
157
 
159
158
  try {
160
159
  elementsBaseUrl = new URL(this.initOptions.elementsBaseUrl);
161
- } catch (e) {
160
+ } catch {
162
161
  throw new Error('Invalid format for the given Elements base url.');
163
162
  }
164
163
 
165
164
  const elements = await (0, _common.loadElements)();
166
- await elements.init(apiKey, elementsBaseUrl.toString().replace(/\/$/, ''));
165
+ await elements.init(apiKey, elementsBaseUrl.toString().replace(/\/$/u, ''));
167
166
  this.elements = elements;
168
- }
167
+ } // these should be set by the init call only.
168
+
169
+ /* eslint-disable accessor-pairs */
170
+
169
171
 
170
172
  get initOptions() {
171
173
  return (0, _common.assertInit)(this._initOptions);
@@ -183,14 +185,6 @@ class BasisTheory {
183
185
  return (0, _common.assertInit)(this._encryption);
184
186
  }
185
187
 
186
- set elements(elements) {
187
- this._elements = elements;
188
- }
189
-
190
- get elements() {
191
- return (0, _common.assertInit)(this._elements);
192
- }
193
-
194
188
  get applications() {
195
189
  return (0, _common.assertInit)(this._applications);
196
190
  }
@@ -222,6 +216,16 @@ class BasisTheory {
222
216
  get permissions() {
223
217
  return (0, _common.assertInit)(this._permissions);
224
218
  }
219
+ /* eslint-enable accessor-pairs */
220
+
221
+
222
+ get elements() {
223
+ return (0, _common.assertInit)(this._elements);
224
+ }
225
+
226
+ set elements(elements) {
227
+ this._elements = elements;
228
+ }
225
229
 
226
230
  }
227
231
 
@@ -1,7 +1,7 @@
1
- import type { Application, ApplicationQuery, CreateApplicationModel } from './types';
2
1
  import { RequestOptions } from '../service';
2
+ import type { Application, ApplicationQuery, CreateApplicationModel } from './types';
3
3
  export declare const BasisTheoryApplications: {
4
- new (options: import("../service").BasisTheoryServiceOptions): {
4
+ new (options: import("../service/types").BasisTheoryServiceOptions): {
5
5
  /**
6
6
  * @deprecated use {@link retrieveByKey} instead
7
7
  */
@@ -15,7 +15,7 @@ const BasisTheoryApplications = new _CrudBuilder.CrudBuilder(class BasisTheoryAp
15
15
  /**
16
16
  * @deprecated use {@link retrieveByKey} instead
17
17
  */
18
- async getApplicationByKey() {
18
+ getApplicationByKey() {
19
19
  return this.retrieveByKey();
20
20
  }
21
21
 
@@ -1,7 +1,7 @@
1
1
  import type { PaginatedQuery } from '../service';
2
- export declare const APPLICATION_TYPES: readonly ["server_to_server", "public", "elements", "management"];
3
- export declare type ApplicationType = typeof APPLICATION_TYPES[number];
4
- export interface Application {
2
+ declare const APPLICATION_TYPES: readonly ["server_to_server", "public", "elements", "management"];
3
+ declare type ApplicationType = typeof APPLICATION_TYPES[number];
4
+ interface Application {
5
5
  id: string;
6
6
  tenantId: string;
7
7
  name: string;
@@ -11,8 +11,9 @@ export interface Application {
11
11
  createdAt: string;
12
12
  modifiedAt: string;
13
13
  }
14
- export declare type CreateApplicationModel = Pick<Application, 'name' | 'type'> & Partial<Pick<Application, 'permissions'>>;
15
- export declare type UpdateApplicationModel = Partial<Pick<Application, 'name' | 'permissions'>>;
16
- export interface ApplicationQuery extends PaginatedQuery {
14
+ declare type CreateApplicationModel = Pick<Application, 'name' | 'type'> & Partial<Pick<Application, 'permissions'>>;
15
+ declare type UpdateApplicationModel = Partial<Pick<Application, 'name' | 'permissions'>>;
16
+ interface ApplicationQuery extends PaginatedQuery {
17
17
  id?: string | string[];
18
18
  }
19
+ export { APPLICATION_TYPES, ApplicationType, Application, CreateApplicationModel, UpdateApplicationModel, ApplicationQuery, };
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BasisTheoryAtomic = void 0;
7
7
 
8
- var _service = require("../service");
9
-
10
8
  var _common = require("../common");
11
9
 
10
+ var _service = require("../service");
11
+
12
12
  /**
13
13
  * @deprecated use {@link BasisTheoryAtomicBanks} and {@link BasisTheoryAtomicCards} instead
14
14
  */
@@ -16,7 +16,7 @@ class BasisTheoryAtomic extends _service.BasisTheoryService {
16
16
  /**
17
17
  * @deprecated use {@link BasisTheoryAtomicCards.create} instead
18
18
  */
19
- async storeCreditCard(model) {
19
+ storeCreditCard(model) {
20
20
  return this.client.post('/cards', model).then(_common.dataExtractor);
21
21
  }
22
22
  /**
@@ -24,7 +24,7 @@ class BasisTheoryAtomic extends _service.BasisTheoryService {
24
24
  */
25
25
 
26
26
 
27
- async storeBank(model) {
27
+ storeBank(model) {
28
28
  return this.client.post('/banks', model).then(_common.dataExtractor);
29
29
  }
30
30
 
@@ -1,7 +1,7 @@
1
- import type { AtomicBank } from './types';
2
1
  import type { BasisTheoryServiceOptions, PaginatedQuery, RequestOptions } from '../../service';
3
- import type { ReactRequest } from '../types';
4
2
  import type { Token } from '../../tokens';
3
+ import type { ReactRequest } from '../types';
4
+ import type { AtomicBank } from './types';
5
5
  export declare const BasisTheoryAtomicBanks: {
6
6
  new (options: BasisTheoryServiceOptions): {
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicBank>;
@@ -13,23 +13,27 @@ var _CrudBuilder = require("../../service/CrudBuilder");
13
13
 
14
14
  const BasisTheoryAtomicBanks = new _CrudBuilder.CrudBuilder(class BasisTheoryAtomicBanks extends _service.BasisTheoryService {
15
15
  constructor(options) {
16
- options.transformRequest = [].concat(_common.transformAtomicRequestSnakeCase, options.transformRequest || []);
17
- options.transformResponse = [].concat(_common.transformAtomicResponseCamelCase, options.transformResponse || []);
18
- super(options);
16
+ const _options = { ...options
17
+ }; // eslint-disable-next-line unicorn/prefer-spread
18
+
19
+ _options.transformRequest = [].concat(_common.transformAtomicRequestSnakeCase, options.transformRequest || []); // eslint-disable-next-line unicorn/prefer-spread
20
+
21
+ _options.transformResponse = [].concat(_common.transformAtomicResponseCamelCase, options.transformResponse || []);
22
+ super(_options);
19
23
  }
20
24
 
21
- async retrieveDecrypted(id, options) {
25
+ retrieveDecrypted(id, options) {
22
26
  return this.client.get(`/${id}/decrypt`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
23
27
  }
24
28
 
25
- async react(id, request, options) {
29
+ react(id, request, options) {
26
30
  return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
27
31
  transformRequest: _common.transformAtomicReactionRequestSnakeCase,
28
32
  transformResponse: _common.transformTokenResponseCamelCase
29
33
  })).then(_common.dataExtractor);
30
34
  }
31
35
 
32
- async retrieveReaction(atomicBankId, reactionTokenId, options) {
36
+ retrieveReaction(atomicBankId, reactionTokenId, options) {
33
37
  return this.client.get(`/${atomicBankId}/reaction/${reactionTokenId}`, (0, _common.createRequestConfig)(options, {
34
38
  transformResponse: _common.transformTokenResponseCamelCase
35
39
  })).then(_common.dataExtractor);
@@ -1,9 +1,10 @@
1
1
  import type { Atomic } from '../types';
2
- export interface Bank {
2
+ interface Bank {
3
3
  routingNumber: string;
4
4
  accountNumber: string;
5
5
  }
6
- export interface AtomicBank extends Atomic {
6
+ interface AtomicBank extends Atomic {
7
7
  bank: Bank;
8
8
  }
9
- export declare type CreateAtomicBankModel = Pick<AtomicBank, 'bank' | 'metadata'>;
9
+ declare type CreateAtomicBankModel = Pick<AtomicBank, 'bank' | 'metadata'>;
10
+ export type { Bank, AtomicBank, CreateAtomicBankModel };
@@ -1,7 +1,7 @@
1
- import type { AtomicCard } from './types';
2
1
  import type { BasisTheoryServiceOptions, PaginatedQuery, RequestOptions } from '../../service';
3
- import type { ReactRequest } from '../types';
4
2
  import type { Token } from '../../tokens';
3
+ import type { ReactRequest } from '../types';
4
+ import type { AtomicCard } from './types';
5
5
  export declare const BasisTheoryAtomicCards: {
6
6
  new (options: BasisTheoryServiceOptions): {
7
7
  retrieveDecrypted(id: string, options?: RequestOptions | undefined): Promise<AtomicCard>;
@@ -5,33 +5,37 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.BasisTheoryAtomicCards = void 0;
7
7
 
8
- var _utils = require("./../../common/utils");
9
-
10
8
  var _common = require("../../common");
11
9
 
10
+ var _utils = require("../../common/utils");
11
+
12
12
  var _service = require("../../service");
13
13
 
14
14
  var _CrudBuilder = require("../../service/CrudBuilder");
15
15
 
16
16
  const BasisTheoryAtomicCards = new _CrudBuilder.CrudBuilder(class BasisTheoryAtomicCards extends _service.BasisTheoryService {
17
17
  constructor(options) {
18
- options.transformRequest = [].concat(_utils.transformAtomicRequestSnakeCase, options.transformRequest || []);
19
- options.transformResponse = [].concat(_utils.transformAtomicResponseCamelCase, options.transformResponse || []);
20
- super(options);
18
+ const _options = { ...options
19
+ }; // eslint-disable-next-line unicorn/prefer-spread
20
+
21
+ _options.transformRequest = [].concat(_utils.transformAtomicRequestSnakeCase, options.transformRequest || []); // eslint-disable-next-line unicorn/prefer-spread
22
+
23
+ _options.transformResponse = [].concat(_utils.transformAtomicResponseCamelCase, options.transformResponse || []);
24
+ super(_options);
21
25
  }
22
26
 
23
- async retrieveDecrypted(id, options) {
27
+ retrieveDecrypted(id, options) {
24
28
  return this.client.get(`/${id}/decrypt`, (0, _common.createRequestConfig)(options)).then(_common.dataExtractor);
25
29
  }
26
30
 
27
- async react(id, request, options) {
31
+ react(id, request, options) {
28
32
  return this.client.post(`/${id}/react`, request, (0, _common.createRequestConfig)(options, {
29
33
  transformRequest: _common.transformAtomicReactionRequestSnakeCase,
30
34
  transformResponse: _common.transformTokenResponseCamelCase
31
35
  })).then(_common.dataExtractor);
32
36
  }
33
37
 
34
- async retrieveReaction(atomicCardId, reactionTokenId, options) {
38
+ retrieveReaction(atomicCardId, reactionTokenId, options) {
35
39
  return this.client.get(`/${atomicCardId}/reaction/${reactionTokenId}`, (0, _common.createRequestConfig)(options, {
36
40
  transformResponse: _common.transformTokenResponseCamelCase
37
41
  })).then(_common.dataExtractor);
@@ -1,21 +1,21 @@
1
1
  import type { Atomic } from '../types';
2
- export interface AtomicCard extends Atomic {
2
+ interface AtomicCard extends Atomic {
3
3
  card: Card;
4
4
  billingDetails?: BillingDetails;
5
5
  }
6
- export interface Card {
6
+ interface Card {
7
7
  number: string;
8
8
  expirationMonth: number;
9
9
  expirationYear: number;
10
10
  cvc?: string;
11
11
  }
12
- export interface BillingDetails {
12
+ interface BillingDetails {
13
13
  name?: string;
14
14
  email?: string;
15
15
  phone?: string;
16
16
  address?: Address;
17
17
  }
18
- export interface Address {
18
+ interface Address {
19
19
  line1?: string;
20
20
  line2?: string;
21
21
  city?: string;
@@ -23,4 +23,5 @@ export interface Address {
23
23
  postalCode?: string;
24
24
  country?: string;
25
25
  }
26
- export declare type CreateAtomicCardModel = Pick<AtomicCard, 'card' | 'billingDetails' | 'metadata'>;
26
+ declare type CreateAtomicCardModel = Pick<AtomicCard, 'card' | 'billingDetails' | 'metadata'>;
27
+ export type { AtomicCard, Card, BillingDetails, Address, CreateAtomicCardModel, };
package/atomic/types.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import type { TokenType } from '../tokens';
2
- export interface Atomic {
2
+ interface Atomic {
3
3
  id: string;
4
4
  tenantId: string;
5
5
  type: TokenType;
6
+ fingerprint: string;
6
7
  metadata?: Record<string, string>;
7
8
  createdBy: string;
8
9
  createdAt: string;
9
10
  }
10
- export interface ReactRequest {
11
+ interface ReactRequest {
11
12
  reactorId: string;
12
13
  requestParameters?: Record<string, unknown>;
13
14
  metadata?: Record<string, string>;
14
15
  }
16
+ export type { Atomic, ReactRequest };
@@ -1,6 +1,7 @@
1
1
  import type { ClientsBasePathMap } from '../types';
2
- export declare const API_KEY_HEADER = "X-API-KEY";
3
- export declare const BT_TRACE_ID_HEADER = "bt-trace-id";
4
- export declare const DEFAULT_BASE_URL: string;
5
- export declare const DEFAULT_ELEMENTS_BASE_URL: string;
6
- export declare const CLIENT_BASE_PATHS: ClientsBasePathMap;
2
+ declare const API_KEY_HEADER = "X-API-KEY";
3
+ declare const BT_TRACE_ID_HEADER = "bt-trace-id";
4
+ declare const DEFAULT_BASE_URL: string;
5
+ declare const DEFAULT_ELEMENTS_BASE_URL: string;
6
+ declare const CLIENT_BASE_PATHS: ClientsBasePathMap;
7
+ export { API_KEY_HEADER, BT_TRACE_ID_HEADER, DEFAULT_BASE_URL, DEFAULT_ELEMENTS_BASE_URL, CLIENT_BASE_PATHS, };
@@ -18,7 +18,6 @@ const loadElements = () => {
18
18
  }
19
19
 
20
20
  if (window.BasisTheoryElements) {
21
- // TODO print console message
22
21
  resolve(window.BasisTheoryElements);
23
22
  return;
24
23
  }
@@ -1,2 +1,3 @@
1
- export declare const findScript: (url: string) => HTMLScriptElement | null;
2
- export declare const injectScript: (url: string) => HTMLScriptElement;
1
+ declare const findScript: (url: string) => HTMLScriptElement | null;
2
+ declare const injectScript: (url: string) => HTMLScriptElement;
3
+ export { findScript, injectScript };
package/common/script.js CHANGED
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.injectScript = exports.findScript = void 0;
7
7
 
8
- const findScript = url => {
9
- return document.querySelector(`script[src^="${url}"]`);
10
- };
8
+ const findScript = url => document.querySelector(`script[src^="${url}"]`);
11
9
 
12
10
  exports.findScript = findScript;
13
11
 
@@ -20,7 +18,7 @@ const injectScript = url => {
20
18
  throw new Error('No <head> or <body> elements found in document.');
21
19
  }
22
20
 
23
- parent.appendChild(script);
21
+ parent.append(script);
24
22
  return script;
25
23
  };
26
24
 
package/common/utils.d.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  import type { AxiosRequestConfig, AxiosResponse, AxiosTransformer } from 'axios';
2
2
  import type { RequestOptions } from '../service';
3
- export declare const assertInit: <T>(prop: T) => NonNullable<T>;
4
- export declare const transformRequestSnakeCase: AxiosTransformer;
5
- export declare const transformReactorRequestSnakeCase: AxiosTransformer;
6
- export declare const transformAtomicRequestSnakeCase: AxiosTransformer;
7
- export declare const transformTokenRequestSnakeCase: AxiosTransformer;
8
- export declare const transformAtomicReactionRequestSnakeCase: AxiosTransformer;
9
- export declare const transformTokenResponseCamelCase: AxiosTransformer;
10
- export declare const transformReactorResponseCamelCase: AxiosTransformer;
11
- export declare const transformResponseCamelCase: AxiosTransformer;
12
- export declare const transformAtomicResponseCamelCase: AxiosTransformer;
13
- export declare const dataExtractor: <T>(res: AxiosResponse<T>) => T;
14
- export declare const createRequestConfig: (options?: RequestOptions | undefined, transformers?: Pick<AxiosRequestConfig, "transformRequest" | "transformResponse"> | undefined) => AxiosRequestConfig | undefined;
15
- export declare const concatRequestTransformerWithDefault: (requestTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
16
- export declare const concatResponseTransformermWithDefault: (responseTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
17
- export declare const errorInterceptor: (error: any) => void;
18
- export declare function getQueryParams<Q>(query: Q): string;
3
+ declare const assertInit: <T>(prop: T) => NonNullable<T>;
4
+ declare const transformRequestSnakeCase: AxiosTransformer;
5
+ declare const transformReactorRequestSnakeCase: AxiosTransformer;
6
+ declare const transformAtomicRequestSnakeCase: AxiosTransformer;
7
+ declare const transformTokenRequestSnakeCase: AxiosTransformer;
8
+ declare const transformAtomicReactionRequestSnakeCase: AxiosTransformer;
9
+ declare const transformTokenResponseCamelCase: AxiosTransformer;
10
+ declare const transformReactorResponseCamelCase: AxiosTransformer;
11
+ declare const transformResponseCamelCase: AxiosTransformer;
12
+ declare const transformAtomicResponseCamelCase: AxiosTransformer;
13
+ declare const dataExtractor: <T>(res: AxiosResponse<T>) => T;
14
+ declare const concatRequestTransformerWithDefault: (requestTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
15
+ declare const concatResponseTransformermWithDefault: (responseTransformer: AxiosTransformer | AxiosTransformer[]) => AxiosTransformer | AxiosTransformer[] | undefined;
16
+ declare const createRequestConfig: (options?: RequestOptions | undefined, transformers?: Pick<AxiosRequestConfig, "transformRequest" | "transformResponse"> | undefined) => AxiosRequestConfig | undefined;
17
+ declare const errorInterceptor: (error: any) => void;
18
+ declare const getQueryParams: <Q>(query: Q) => string;
19
+ export { assertInit, transformRequestSnakeCase, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformAtomicReactionRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformermWithDefault, errorInterceptor, getQueryParams, };