@basis-theory/basis-theory-js 1.59.0 → 1.60.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 +12 -3
- package/common/constants.js +2 -1
- package/elements/services/index.d.ts +1 -0
- package/elements/services/index.js +13 -0
- 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 +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
|
@@ -19,12 +19,12 @@ var _permissions = require("./permissions");
|
|
|
19
19
|
|
|
20
20
|
var _proxies = require("./proxies");
|
|
21
21
|
|
|
22
|
-
var _proxy = require("./proxy");
|
|
23
|
-
|
|
24
22
|
var _reactorFormulas = require("./reactor-formulas");
|
|
25
23
|
|
|
26
24
|
var _reactors = require("./reactors");
|
|
27
25
|
|
|
26
|
+
var _sessions = require("./sessions");
|
|
27
|
+
|
|
28
28
|
var _tenants = require("./tenants");
|
|
29
29
|
|
|
30
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; }
|
|
@@ -118,11 +118,16 @@ class BasisTheory {
|
|
|
118
118
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.proxies, baseUrl).toString(),
|
|
119
119
|
appInfo
|
|
120
120
|
});
|
|
121
|
-
this._proxy = new
|
|
121
|
+
this._proxy = new ((0, _elements.delegateProxy)(this._elements))({
|
|
122
122
|
apiKey,
|
|
123
123
|
baseURL: new URL(_common.CLIENT_BASE_PATHS.proxy, baseUrl).toString(),
|
|
124
124
|
appInfo
|
|
125
125
|
});
|
|
126
|
+
this._sessions = new _sessions.BasisTheorySessions({
|
|
127
|
+
apiKey,
|
|
128
|
+
baseURL: new URL(_common.CLIENT_BASE_PATHS.sessions, baseUrl).toString(),
|
|
129
|
+
appInfo
|
|
130
|
+
});
|
|
126
131
|
this._initStatus = 'done';
|
|
127
132
|
} catch (error) {
|
|
128
133
|
this._initStatus = 'error';
|
|
@@ -200,6 +205,10 @@ class BasisTheory {
|
|
|
200
205
|
get proxy() {
|
|
201
206
|
return (0, _common.assertInit)(this._proxy);
|
|
202
207
|
}
|
|
208
|
+
|
|
209
|
+
get sessions() {
|
|
210
|
+
return (0, _common.assertInit)(this._sessions);
|
|
211
|
+
}
|
|
203
212
|
/* eslint-enable accessor-pairs */
|
|
204
213
|
|
|
205
214
|
/**
|
package/common/constants.js
CHANGED
|
@@ -28,4 +28,17 @@ Object.keys(_tokens).forEach(function (key) {
|
|
|
28
28
|
return _tokens[key];
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _proxy = require("./proxy");
|
|
34
|
+
|
|
35
|
+
Object.keys(_proxy).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _proxy[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _proxy[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
31
44
|
});
|
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");
|
|
@@ -30,4 +30,4 @@ declare type Condition = {
|
|
|
30
30
|
declare type CreateApplication = Pick<Application, 'name' | 'type' | 'permissions' | 'rules' | 'canCreateExpiringApplications' | 'expiresAt'>;
|
|
31
31
|
declare type UpdateApplication = Pick<Application, 'name' | 'permissions' | 'rules' | 'canCreateExpiringApplications'>;
|
|
32
32
|
export type { ApplicationType, Application, CreateApplication, TransformType, UpdateApplication, };
|
|
33
|
-
export { APPLICATION_TYPES, TRANSFORM_TYPES };
|
|
33
|
+
export { APPLICATION_TYPES, TRANSFORM_TYPES, AccessRule };
|
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";
|