@basis-theory/basis-theory-js 1.56.0 → 1.57.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/applications/BasisTheoryApplications.d.ts +2 -2
- package/common/utils.d.ts +3 -1
- package/common/utils.js +33 -1
- package/package.json +1 -1
- package/proxies/BasisTheoryProxies.d.ts +4 -3
- package/proxies/BasisTheoryProxies.js +14 -1
- package/types/models/applications.d.ts +2 -2
- package/types/models/proxies.d.ts +11 -1
- package/types/models/reactors.d.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Application
|
|
1
|
+
import type { Application } 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): {
|
|
@@ -10,5 +10,5 @@ export declare const BasisTheoryApplications: {
|
|
|
10
10
|
regenerateKey(id: string, options?: RequestOptions | undefined): Promise<Application>;
|
|
11
11
|
readonly client: import("axios").AxiosInstance;
|
|
12
12
|
};
|
|
13
|
-
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Application,
|
|
13
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Application, Pick<Application, "type" | "expiresAt" | "name" | "permissions" | "rules" | "canCreateExpiringApplications">>) & (new (...args: any[]) => import("../types/sdk/services/shared").Retrieve<Application>) & (new (...args: any[]) => import("../types/sdk/services/shared").Update<Application, Pick<Application, "name" | "permissions" | "rules" | "canCreateExpiringApplications">>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../types/sdk/services/shared").List<Application, ListApplicationsQuery>);
|
|
14
14
|
export declare type BasisTheoryApplications = InstanceType<typeof BasisTheoryApplications>;
|
package/common/utils.d.ts
CHANGED
|
@@ -4,10 +4,12 @@ declare const assertInit: <T>(prop: T) => NonNullable<T>;
|
|
|
4
4
|
declare const transformRequestSnakeCase: AxiosTransformer;
|
|
5
5
|
declare const proxyRaw: AxiosTransformer;
|
|
6
6
|
declare const transformReactorRequestSnakeCase: AxiosTransformer;
|
|
7
|
+
declare const transformProxyRequestSnakeCase: AxiosTransformer;
|
|
7
8
|
declare const transformAtomicRequestSnakeCase: AxiosTransformer;
|
|
8
9
|
declare const transformTokenRequestSnakeCase: AxiosTransformer;
|
|
9
10
|
declare const transformTokenResponseCamelCase: AxiosTransformer;
|
|
10
11
|
declare const transformReactorResponseCamelCase: AxiosTransformer;
|
|
12
|
+
declare const transformProxyResponseCamelCase: AxiosTransformer;
|
|
11
13
|
declare const transformResponseCamelCase: AxiosTransformer;
|
|
12
14
|
declare const transformAtomicResponseCamelCase: AxiosTransformer;
|
|
13
15
|
declare const dataExtractor: <T>(res: AxiosResponse<T>) => T;
|
|
@@ -21,4 +23,4 @@ declare const getBrowser: () => string;
|
|
|
21
23
|
declare const getOSVersion: () => string;
|
|
22
24
|
declare const getRuntime: () => string;
|
|
23
25
|
declare const buildClientUserAgentString: (appInfo?: ApplicationInfo | undefined) => string;
|
|
24
|
-
export { assertInit, transformRequestSnakeCase, proxyRaw, transformReactorRequestSnakeCase, transformAtomicRequestSnakeCase, transformTokenRequestSnakeCase, transformTokenResponseCamelCase, transformReactorResponseCamelCase, transformResponseCamelCase, transformAtomicResponseCamelCase, dataExtractor, createRequestConfig, concatRequestTransformerWithDefault, concatResponseTransformerWithDefault, errorInterceptor, getQueryParams, buildUserAgentString, buildClientUserAgentString, getOSVersion, getRuntime, getBrowser, };
|
|
26
|
+
export { assertInit, transformRequestSnakeCase, proxyRaw, 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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.proxyRaw = exports.getRuntime = exports.getQueryParams = exports.getOSVersion = exports.getBrowser = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformerWithDefault = exports.concatRequestTransformerWithDefault = exports.buildUserAgentString = exports.buildClientUserAgentString = exports.assertInit = void 0;
|
|
6
|
+
exports.transformTokenResponseCamelCase = exports.transformTokenRequestSnakeCase = exports.transformResponseCamelCase = exports.transformRequestSnakeCase = exports.transformReactorResponseCamelCase = exports.transformReactorRequestSnakeCase = exports.transformProxyResponseCamelCase = exports.transformProxyRequestSnakeCase = exports.transformAtomicResponseCamelCase = exports.transformAtomicRequestSnakeCase = exports.proxyRaw = exports.getRuntime = exports.getQueryParams = exports.getOSVersion = exports.getBrowser = exports.errorInterceptor = exports.dataExtractor = exports.createRequestConfig = exports.concatResponseTransformerWithDefault = exports.concatRequestTransformerWithDefault = exports.buildUserAgentString = exports.buildClientUserAgentString = exports.assertInit = void 0;
|
|
7
7
|
|
|
8
8
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9
9
|
|
|
@@ -64,6 +64,22 @@ const transformReactorRequestSnakeCase = reactor => {
|
|
|
64
64
|
|
|
65
65
|
exports.transformReactorRequestSnakeCase = transformReactorRequestSnakeCase;
|
|
66
66
|
|
|
67
|
+
const transformProxyRequestSnakeCase = proxy => {
|
|
68
|
+
if (typeof proxy === 'undefined') {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return { ...(0, _snakecaseKeys.default)(proxy, {
|
|
73
|
+
deep: true
|
|
74
|
+
}),
|
|
75
|
+
...(proxy.configuration !== undefined ? {
|
|
76
|
+
configuration: proxy.configuration
|
|
77
|
+
} : {})
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.transformProxyRequestSnakeCase = transformProxyRequestSnakeCase;
|
|
82
|
+
|
|
67
83
|
const transformAtomicRequestSnakeCase = data => {
|
|
68
84
|
if (typeof data === 'undefined') {
|
|
69
85
|
return undefined;
|
|
@@ -134,6 +150,22 @@ const transformReactorResponseCamelCase = reactor => {
|
|
|
134
150
|
|
|
135
151
|
exports.transformReactorResponseCamelCase = transformReactorResponseCamelCase;
|
|
136
152
|
|
|
153
|
+
const transformProxyResponseCamelCase = proxy => {
|
|
154
|
+
if (typeof proxy === 'undefined') {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return { ...(0, _camelcaseKeys.default)(proxy, {
|
|
159
|
+
deep: true
|
|
160
|
+
}),
|
|
161
|
+
...(proxy.configuration !== undefined ? {
|
|
162
|
+
configuration: proxy.configuration
|
|
163
|
+
} : {})
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
exports.transformProxyResponseCamelCase = transformProxyResponseCamelCase;
|
|
168
|
+
|
|
137
169
|
const transformResponseCamelCase = data => {
|
|
138
170
|
if (typeof data === 'undefined') {
|
|
139
171
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BasisTheoryServiceOptions } from '../service';
|
|
2
|
+
import type { CreateProxy, Proxy } from '../types/models';
|
|
2
3
|
import type { ListProxyQuery } from '../types/sdk';
|
|
3
4
|
export declare const BasisTheoryProxies: {
|
|
4
|
-
new (options:
|
|
5
|
+
new (options: BasisTheoryServiceOptions): {
|
|
5
6
|
readonly client: import("axios").AxiosInstance;
|
|
6
7
|
};
|
|
7
|
-
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Proxy,
|
|
8
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Proxy, CreateProxy>) & (new (...args: any[]) => import("../types/sdk/services/shared").Retrieve<Proxy>) & (new (...args: any[]) => import("../types/sdk/services/shared").Update<Proxy, CreateProxy>) & (new (...args: any[]) => import("../types/sdk/services/shared").Delete) & (new (...args: any[]) => import("../types/sdk/services/shared").List<Proxy, ListProxyQuery>);
|
|
@@ -5,9 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.BasisTheoryProxies = void 0;
|
|
7
7
|
|
|
8
|
+
var _utils = require("./../common/utils");
|
|
9
|
+
|
|
8
10
|
var _service = require("./../service");
|
|
9
11
|
|
|
10
12
|
var _CrudBuilder = require("./../service/CrudBuilder");
|
|
11
13
|
|
|
12
|
-
const BasisTheoryProxies = new _CrudBuilder.CrudBuilder(class BasisTheoryProxies extends _service.BasisTheoryService {
|
|
14
|
+
const BasisTheoryProxies = new _CrudBuilder.CrudBuilder(class BasisTheoryProxies 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().retrieve().update().delete().list().build();
|
|
13
26
|
exports.BasisTheoryProxies = BasisTheoryProxies;
|
|
@@ -27,7 +27,7 @@ declare type Condition = {
|
|
|
27
27
|
operator: string;
|
|
28
28
|
value: string;
|
|
29
29
|
};
|
|
30
|
-
declare type CreateApplication = Pick<Application, 'name' | 'type'
|
|
31
|
-
declare type UpdateApplication =
|
|
30
|
+
declare type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | 'canCreateExpiringApplications' | 'expiresAt'>;
|
|
31
|
+
declare type UpdateApplication = Pick<Application, 'name' | 'permissions' | 'rules' | 'canCreateExpiringApplications'>;
|
|
32
32
|
export type { ApplicationType, Application, CreateApplication, TransformType, UpdateApplication, };
|
|
33
33
|
export { APPLICATION_TYPES, TRANSFORM_TYPES };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Application } from './applications';
|
|
1
2
|
import type { Auditable } from './shared';
|
|
2
3
|
interface Proxy extends Auditable {
|
|
3
4
|
id: string;
|
|
@@ -7,8 +8,17 @@ interface Proxy extends Auditable {
|
|
|
7
8
|
destinationUrl: string;
|
|
8
9
|
requestReactorId?: string;
|
|
9
10
|
responseReactorId?: string;
|
|
11
|
+
requestTransform?: ProxyTransform;
|
|
12
|
+
responseTransform?: ProxyTransform;
|
|
13
|
+
applicationId?: string;
|
|
14
|
+
configuration?: Record<string, string>;
|
|
10
15
|
requireAuth?: boolean;
|
|
11
16
|
}
|
|
12
|
-
|
|
17
|
+
interface ProxyTransform {
|
|
18
|
+
code: string;
|
|
19
|
+
}
|
|
20
|
+
declare type CreateProxy = Pick<Proxy, 'name' | 'destinationUrl' | 'requestReactorId' | 'responseReactorId' | 'requestTransform' | 'responseTransform' | 'configuration' | 'requireAuth'> & {
|
|
21
|
+
application?: Pick<Application, 'id'>;
|
|
22
|
+
};
|
|
13
23
|
declare type UpdateProxy = CreateProxy;
|
|
14
24
|
export type { Proxy, CreateProxy, UpdateProxy };
|
|
@@ -7,7 +7,7 @@ interface Reactor extends Auditable {
|
|
|
7
7
|
name: string;
|
|
8
8
|
formula: ReactorFormula;
|
|
9
9
|
application?: Application;
|
|
10
|
-
configuration
|
|
10
|
+
configuration?: Record<string, string>;
|
|
11
11
|
}
|
|
12
12
|
declare type CreateReactor = Pick<Reactor, 'name' | 'configuration'> & {
|
|
13
13
|
formula: Pick<ReactorFormula, 'id'>;
|