@basis-theory/basis-theory-js 1.59.1 → 1.61.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 +3 -1
- package/BasisTheory.js +11 -0
- package/applications/BasisTheoryApplications.d.ts +1 -1
- package/common/constants.js +2 -1
- package/package.json +1 -1
- package/sessions/BasisTheorySessions.d.ts +9 -0
- package/sessions/BasisTheorySessions.js +37 -0
- package/sessions/index.d.ts +1 -0
- package/sessions/index.js +13 -0
- package/types/models/applications.d.ts +4 -5
- package/types/models/applications.js +1 -1
- package/types/sdk/sdk.d.ts +2 -1
- package/types/sdk/services/index.d.ts +1 -0
- package/types/sdk/services/index.js +13 -0
- package/types/sdk/services/sessions.d.ts +18 -0
- package/types/sdk/services/sessions.js +1 -0
package/BasisTheory.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BasisTheoryElements, CardElement, CardNumberElement, CardExpirationDateElement, CardVerificationCodeElement, CreateCardElementOptions, CreateCardNumberElementOptions, CreateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, CreateTextElementOptions, TextElement, TokenizeData as ElementsTokenizeData, Tokens as ElementsTokens } from './types/elements';
|
|
2
2
|
import type { TokenizeData } from './types/models';
|
|
3
|
-
import type { Applications, BasisTheory as IBasisTheory, BasisTheoryInit, Logs, Permissions, ReactorFormulas, Reactors, RequestOptions, Tenants, Tokens, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, Proxies, Proxy } from './types/sdk';
|
|
3
|
+
import type { Applications, BasisTheory as IBasisTheory, BasisTheoryInit, Logs, Permissions, ReactorFormulas, Reactors, RequestOptions, Tenants, Tokens, BasisTheoryInitOptions, BasisTheoryInitOptionsWithElements, BasisTheoryInitOptionsWithoutElements, Proxies, Proxy, Sessions } from './types/sdk';
|
|
4
4
|
export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, BasisTheoryElements {
|
|
5
5
|
private _initStatus;
|
|
6
6
|
private _initOptions?;
|
|
@@ -15,6 +15,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
15
15
|
private _permissions?;
|
|
16
16
|
private _proxies?;
|
|
17
17
|
private _proxy?;
|
|
18
|
+
private _sessions?;
|
|
18
19
|
init(apiKey: string | undefined, options?: BasisTheoryInitOptionsWithoutElements): Promise<IBasisTheory>;
|
|
19
20
|
init(apiKey: string | undefined, options: BasisTheoryInitOptionsWithElements): Promise<IBasisTheory & BasisTheoryElements>;
|
|
20
21
|
createElement(type: 'card', options?: CreateCardElementOptions): CardElement;
|
|
@@ -34,6 +35,7 @@ export declare class BasisTheory implements BasisTheoryInit, IBasisTheory, Basis
|
|
|
34
35
|
get permissions(): Permissions;
|
|
35
36
|
get proxies(): Proxies;
|
|
36
37
|
get proxy(): Proxy;
|
|
38
|
+
get sessions(): Sessions;
|
|
37
39
|
/**
|
|
38
40
|
* @deprecated
|
|
39
41
|
*/
|
package/BasisTheory.js
CHANGED
|
@@ -23,6 +23,8 @@ var _reactorFormulas = require("./reactor-formulas");
|
|
|
23
23
|
|
|
24
24
|
var _reactors = require("./reactors");
|
|
25
25
|
|
|
26
|
+
var _sessions = require("./sessions");
|
|
27
|
+
|
|
26
28
|
var _tenants = require("./tenants");
|
|
27
29
|
|
|
28
30
|
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; }
|
|
@@ -121,6 +123,11 @@ class BasisTheory {
|
|
|
121
123
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.proxy, baseUrl).toString(),
|
|
122
124
|
appInfo
|
|
123
125
|
});
|
|
126
|
+
this._sessions = new _sessions.BasisTheorySessions({
|
|
127
|
+
apiKey,
|
|
128
|
+
baseURL: new URL(_common.CLIENT_BASE_PATHS.sessions, baseUrl).toString(),
|
|
129
|
+
appInfo
|
|
130
|
+
});
|
|
124
131
|
this._initStatus = 'done';
|
|
125
132
|
} catch (error) {
|
|
126
133
|
this._initStatus = 'error';
|
|
@@ -198,6 +205,10 @@ class BasisTheory {
|
|
|
198
205
|
get proxy() {
|
|
199
206
|
return (0, _common.assertInit)(this._proxy);
|
|
200
207
|
}
|
|
208
|
+
|
|
209
|
+
get sessions() {
|
|
210
|
+
return (0, _common.assertInit)(this._sessions);
|
|
211
|
+
}
|
|
201
212
|
/* eslint-enable accessor-pairs */
|
|
202
213
|
|
|
203
214
|
/**
|
|
@@ -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, Pick<Application, "type" | "expiresAt" | "name" | "permissions" | "rules"
|
|
13
|
+
} & (new (...args: any[]) => import("../types/sdk/services/shared").Create<Application, Pick<Application, "type" | "expiresAt" | "name" | "permissions" | "rules">>) & (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">>) & (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/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BasisTheoryService } from '../service';
|
|
2
|
+
import type { BasisTheoryServiceOptions } from '../service';
|
|
3
|
+
import type { RequestOptions } from '../types/sdk';
|
|
4
|
+
import type { CreateSessionResponse, AuthorizeSessionRequest, Sessions } from '../types/sdk/services/sessions';
|
|
5
|
+
export declare class BasisTheorySessions extends BasisTheoryService implements Sessions {
|
|
6
|
+
constructor(options: BasisTheoryServiceOptions);
|
|
7
|
+
create(options?: RequestOptions): Promise<CreateSessionResponse>;
|
|
8
|
+
authorize(authorizeSessionRequest: AuthorizeSessionRequest, options?: RequestOptions): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BasisTheorySessions = void 0;
|
|
7
|
+
|
|
8
|
+
var _common = require("./../common");
|
|
9
|
+
|
|
10
|
+
var _utils = require("./../common/utils");
|
|
11
|
+
|
|
12
|
+
var _service = require("./../service");
|
|
13
|
+
|
|
14
|
+
class BasisTheorySessions 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(options = {}) {
|
|
26
|
+
const url = `/sessions`;
|
|
27
|
+
return this.client.post(url, undefined, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
authorize(authorizeSessionRequest, options = {}) {
|
|
31
|
+
const url = `/sessions/authorize`;
|
|
32
|
+
return this.client.post(url, authorizeSessionRequest, (0, _common.createRequestConfig)(options)).then(_utils.dataExtractor);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.BasisTheorySessions = BasisTheorySessions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BasisTheorySessions } from './BasisTheorySessions';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BasisTheorySessions", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _BasisTheorySessions.BasisTheorySessions;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _BasisTheorySessions = require("./BasisTheorySessions");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Auditable } from './shared';
|
|
2
|
-
declare const APPLICATION_TYPES: readonly ["private", "public", "management"
|
|
2
|
+
declare const APPLICATION_TYPES: readonly ["private", "public", "management"];
|
|
3
3
|
declare const TRANSFORM_TYPES: readonly ["mask", "redact", "reveal"];
|
|
4
4
|
declare type ApplicationType = typeof APPLICATION_TYPES[number];
|
|
5
5
|
declare type TransformType = typeof TRANSFORM_TYPES[number];
|
|
@@ -11,7 +11,6 @@ interface Application extends Auditable {
|
|
|
11
11
|
type: ApplicationType;
|
|
12
12
|
permissions?: string[];
|
|
13
13
|
rules?: AccessRule[];
|
|
14
|
-
canCreateExpiringApplications?: boolean;
|
|
15
14
|
expiresAt?: string;
|
|
16
15
|
}
|
|
17
16
|
interface AccessRule {
|
|
@@ -27,7 +26,7 @@ declare type Condition = {
|
|
|
27
26
|
operator: string;
|
|
28
27
|
value: string;
|
|
29
28
|
};
|
|
30
|
-
declare type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | '
|
|
31
|
-
declare type UpdateApplication = Pick<Application, 'name' | 'permissions' | 'rules'
|
|
29
|
+
declare type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | 'expiresAt'>;
|
|
30
|
+
declare type UpdateApplication = Pick<Application, 'name' | 'permissions' | 'rules'>;
|
|
32
31
|
export type { ApplicationType, Application, CreateApplication, TransformType, UpdateApplication, };
|
|
33
|
-
export { APPLICATION_TYPES, TRANSFORM_TYPES };
|
|
32
|
+
export { APPLICATION_TYPES, TRANSFORM_TYPES, AccessRule };
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TRANSFORM_TYPES = exports.APPLICATION_TYPES = void 0;
|
|
7
|
-
const APPLICATION_TYPES = ['private', 'public', 'management'
|
|
7
|
+
const APPLICATION_TYPES = ['private', 'public', 'management'];
|
|
8
8
|
exports.APPLICATION_TYPES = APPLICATION_TYPES;
|
|
9
9
|
const TRANSFORM_TYPES = ['mask', 'redact', 'reveal'];
|
|
10
10
|
exports.TRANSFORM_TYPES = TRANSFORM_TYPES;
|
package/types/sdk/sdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BasisTheoryElements } from '../../types/elements';
|
|
2
|
-
import type { Tokens, Tokenize, Applications, Tenants, Logs, ReactorFormulas, Reactors, Permissions, Proxies, Proxy } from './services';
|
|
2
|
+
import type { Tokens, Tokenize, Applications, Tenants, Logs, ReactorFormulas, Reactors, Permissions, Proxies, Proxy, Sessions } from './services';
|
|
3
3
|
interface ApplicationInfo {
|
|
4
4
|
name?: string;
|
|
5
5
|
version?: string;
|
|
@@ -30,6 +30,7 @@ interface BasisTheory extends Tokenize {
|
|
|
30
30
|
permissions: Permissions;
|
|
31
31
|
proxies: Proxies;
|
|
32
32
|
proxy: Proxy;
|
|
33
|
+
sessions: Sessions;
|
|
33
34
|
}
|
|
34
35
|
interface ClientUserAgent {
|
|
35
36
|
client: string;
|
|
@@ -145,4 +145,17 @@ Object.keys(_proxy).forEach(function (key) {
|
|
|
145
145
|
return _proxy[key];
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
var _sessions = require("./sessions");
|
|
151
|
+
|
|
152
|
+
Object.keys(_sessions).forEach(function (key) {
|
|
153
|
+
if (key === "default" || key === "__esModule") return;
|
|
154
|
+
if (key in exports && exports[key] === _sessions[key]) return;
|
|
155
|
+
Object.defineProperty(exports, key, {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function () {
|
|
158
|
+
return _sessions[key];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
148
161
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RequestOptions } from '../../../types/sdk';
|
|
2
|
+
import { AccessRule } from '../../models/applications';
|
|
3
|
+
declare type AuthorizeSessionRequest = {
|
|
4
|
+
nonce: string;
|
|
5
|
+
expiresAt?: string;
|
|
6
|
+
permissions?: string[];
|
|
7
|
+
rules?: AccessRule[];
|
|
8
|
+
};
|
|
9
|
+
declare type CreateSessionResponse = {
|
|
10
|
+
sessionKey: string;
|
|
11
|
+
nonce: string;
|
|
12
|
+
expiresAt: string;
|
|
13
|
+
};
|
|
14
|
+
interface Sessions {
|
|
15
|
+
create(options?: RequestOptions): Promise<CreateSessionResponse>;
|
|
16
|
+
authorize(authorizeSessionRequest: AuthorizeSessionRequest, options?: RequestOptions): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export { AuthorizeSessionRequest, CreateSessionResponse, Sessions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|