api-machine 1.2.1 → 1.3.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/authentication/auth-flow.d.ts +13 -0
- package/authentication/auth-flow.js +3 -0
- package/authentication/auth-flow.js.map +1 -0
- package/authentication/auth-step.d.ts +0 -0
- package/authentication/auth-step.js +2 -0
- package/authentication/auth-step.js.map +1 -0
- package/authentication/authentication-scheme.d.ts +52 -5
- package/authentication/authentication-scheme.js +64 -1
- package/authentication/authentication-scheme.js.map +1 -1
- package/authentication/index.d.ts +2 -2
- package/authentication/index.js +3 -2
- package/authentication/index.js.map +1 -1
- package/authentication/middleware/bearer-authentication.d.ts +6 -3
- package/authentication/middleware/bearer-authentication.js +8 -38
- package/authentication/middleware/bearer-authentication.js.map +1 -1
- package/authentication/schemes/bearer-authentication-scheme.d.ts +24 -10
- package/authentication/schemes/bearer-authentication-scheme.js +51 -11
- package/authentication/schemes/bearer-authentication-scheme.js.map +1 -1
- package/di/container.d.ts +31 -0
- package/di/container.js +57 -0
- package/di/container.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +2 -1
- package/router/base.d.ts +8 -4
- package/router/base.js +15 -10
- package/router/base.js.map +1 -1
- package/router/endpoint.d.ts +1 -3
- package/router/endpoint.js +1 -0
- package/router/endpoint.js.map +1 -1
- package/router/router.js +3 -1
- package/router/router.js.map +1 -1
- package/router/validation-middleware.d.ts +1 -1
- package/server/server.d.ts +6 -0
- package/server/server.js +10 -0
- package/server/server.js.map +1 -1
- package/session/drivers/in-memory-session-driver.d.ts +22 -0
- package/session/drivers/in-memory-session-driver.js +46 -0
- package/session/drivers/in-memory-session-driver.js.map +1 -0
- package/session/drivers/index.d.ts +1 -0
- package/session/drivers/index.js +6 -0
- package/session/drivers/index.js.map +1 -0
- package/session/index.d.ts +3 -0
- package/session/index.js +8 -0
- package/session/index.js.map +1 -0
- package/session/session-driver.d.ts +10 -0
- package/session/session-driver.js +7 -0
- package/session/session-driver.js.map +1 -0
- package/session/session.d.ts +3 -0
- package/session/session.js +3 -0
- package/session/session.js.map +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApiEndpoint } from '../router';
|
|
2
|
+
/**
|
|
3
|
+
* A named collection of authentication steps
|
|
4
|
+
* Each step is identified by a key
|
|
5
|
+
* (e.g., 'challenge', 'authorization', 'tokenExchange')
|
|
6
|
+
*
|
|
7
|
+
* Steps are classes extending BaseApiEndpoint
|
|
8
|
+
* This allows each step to use endpoint features like validation and middleware
|
|
9
|
+
*
|
|
10
|
+
* The flow represents the entire authentication process
|
|
11
|
+
* Steps are executed in the order they're defined
|
|
12
|
+
*/
|
|
13
|
+
export type AuthFlow = Record<string, ApiEndpoint>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-flow.js","sourceRoot":"","sources":["../../../src/authentication/auth-flow.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-step.js","sourceRoot":"","sources":["../../../src/authentication/auth-step.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { RequestHandler } from 'express';
|
|
2
2
|
import { SecuritySchemeObject, SecurityRequirementObject } from 'auto-oas/oas/v3.1';
|
|
3
|
+
import { ApiRequest, BaseApiRouter } from '../router';
|
|
4
|
+
import { SessionDriver } from '../session/session-driver';
|
|
5
|
+
import { AuthFlow } from './auth-flow';
|
|
6
|
+
import { ApiRoute } from '../router/base';
|
|
7
|
+
export interface AuthenticationSchemeOptions {
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* Abstract base class for authentication schemes
|
|
5
11
|
* Extend this class to create custom authentication schemes that integrate
|
|
6
12
|
* with both Express middleware and OpenAPI specification generation
|
|
7
13
|
*/
|
|
8
14
|
export declare abstract class AuthenticationScheme {
|
|
15
|
+
constructor(options?: AuthenticationSchemeOptions);
|
|
9
16
|
/**
|
|
10
17
|
* Unique name for this authentication scheme
|
|
11
18
|
* This will be used as the key in OpenAPI securitySchemes
|
|
12
19
|
*/
|
|
13
20
|
abstract readonly schemeName: string;
|
|
14
|
-
/**
|
|
15
|
-
* The type of security scheme as defined by OpenAPI
|
|
16
|
-
*/
|
|
17
|
-
abstract readonly type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect';
|
|
18
21
|
/**
|
|
19
22
|
* Generate the OpenAPI security scheme object
|
|
20
23
|
* This will be added to components.securitySchemes in the OpenAPI spec
|
|
@@ -28,11 +31,55 @@ export declare abstract class AuthenticationScheme {
|
|
|
28
31
|
* @returns SecurityRequirementObject compliant with OpenAPI 3.1
|
|
29
32
|
*/
|
|
30
33
|
getSecurityRequirement(): SecurityRequirementObject;
|
|
34
|
+
/**
|
|
35
|
+
* Get the Express middleware for this authentication scheme
|
|
36
|
+
* For InlineAuthenticationScheme: runs endpoint
|
|
37
|
+
* For SessionAuthenticationScheme: verifies session
|
|
38
|
+
*
|
|
39
|
+
* @returns Express RequestHandler middleware
|
|
40
|
+
*/
|
|
41
|
+
abstract getMiddleware(): RequestHandler;
|
|
42
|
+
}
|
|
43
|
+
export declare abstract class InlineAuthenticationScheme extends AuthenticationScheme {
|
|
44
|
+
abstract getCredentials(request: ApiRequest): unknown;
|
|
45
|
+
abstract authenticate(options: {
|
|
46
|
+
credentials: unknown;
|
|
47
|
+
request: ApiRequest;
|
|
48
|
+
}): Promise<void>;
|
|
31
49
|
/**
|
|
32
50
|
* Generate the Express middleware that enforces this authentication
|
|
33
51
|
* The middleware should validate the authentication and throw appropriate
|
|
34
52
|
* HTTPError instances if authentication fails
|
|
35
53
|
* @returns Express RequestHandler middleware
|
|
36
54
|
*/
|
|
37
|
-
|
|
55
|
+
getMiddleware(): RequestHandler;
|
|
56
|
+
}
|
|
57
|
+
export declare abstract class SessionAuthenticationScheme extends AuthenticationScheme {
|
|
58
|
+
protected sessionDriver: SessionDriver;
|
|
59
|
+
constructor(options: {
|
|
60
|
+
sessionDriver: SessionDriver;
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Get the authentication flow for this scheme
|
|
64
|
+
* An AuthFlow is a named collection of steps
|
|
65
|
+
* (e.g., { challenge, authorization, tokenExchange })
|
|
66
|
+
*
|
|
67
|
+
* @returns AuthFlow defining all steps in the authentication process
|
|
68
|
+
*/
|
|
69
|
+
abstract getAuthFlow(): AuthFlow;
|
|
70
|
+
/**
|
|
71
|
+
* Get all endpoints defined in the AuthFlow
|
|
72
|
+
*
|
|
73
|
+
* @returns ApiRoute array of all auth step endpoints
|
|
74
|
+
*/
|
|
75
|
+
getEndpoints(): Array<ApiRoute>;
|
|
76
|
+
/**
|
|
77
|
+
* Generate a router that exposes all auth steps as API endpoints
|
|
78
|
+
* Each step in the AuthFlow becomes a route in the router
|
|
79
|
+
*
|
|
80
|
+
* @param basePath - Optional base path for the router (default: empty)
|
|
81
|
+
* @returns Router with all auth steps as endpoints
|
|
82
|
+
*/
|
|
83
|
+
getAuthRouter(basePath?: string): BaseApiRouter;
|
|
84
|
+
getMiddleware(): RequestHandler;
|
|
38
85
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthenticationScheme = void 0;
|
|
3
|
+
exports.SessionAuthenticationScheme = exports.InlineAuthenticationScheme = exports.AuthenticationScheme = void 0;
|
|
4
|
+
const router_1 = require("../router");
|
|
4
5
|
/**
|
|
5
6
|
* Abstract base class for authentication schemes
|
|
6
7
|
* Extend this class to create custom authentication schemes that integrate
|
|
7
8
|
* with both Express middleware and OpenAPI specification generation
|
|
8
9
|
*/
|
|
9
10
|
class AuthenticationScheme {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
+
constructor(options = {}) { }
|
|
10
13
|
/**
|
|
11
14
|
* Generate the OpenAPI security requirement
|
|
12
15
|
* This defines which security scheme is required for an operation
|
|
@@ -18,4 +21,64 @@ class AuthenticationScheme {
|
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
exports.AuthenticationScheme = AuthenticationScheme;
|
|
24
|
+
class InlineAuthenticationScheme extends AuthenticationScheme {
|
|
25
|
+
/**
|
|
26
|
+
* Generate the Express middleware that enforces this authentication
|
|
27
|
+
* The middleware should validate the authentication and throw appropriate
|
|
28
|
+
* HTTPError instances if authentication fails
|
|
29
|
+
* @returns Express RequestHandler middleware
|
|
30
|
+
*/
|
|
31
|
+
getMiddleware() {
|
|
32
|
+
return async (request, response, next) => {
|
|
33
|
+
const credentials = this.getCredentials(request);
|
|
34
|
+
await this.authenticate({ credentials, request });
|
|
35
|
+
request.authenticated = true;
|
|
36
|
+
return next();
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.InlineAuthenticationScheme = InlineAuthenticationScheme;
|
|
41
|
+
class SessionAuthenticationScheme extends AuthenticationScheme {
|
|
42
|
+
sessionDriver;
|
|
43
|
+
constructor(options) {
|
|
44
|
+
super();
|
|
45
|
+
this.sessionDriver = options.sessionDriver;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get all endpoints defined in the AuthFlow
|
|
49
|
+
*
|
|
50
|
+
* @returns ApiRoute array of all auth step endpoints
|
|
51
|
+
*/
|
|
52
|
+
getEndpoints() {
|
|
53
|
+
const flow = this.getAuthFlow();
|
|
54
|
+
return Object.values(flow);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generate a router that exposes all auth steps as API endpoints
|
|
58
|
+
* Each step in the AuthFlow becomes a route in the router
|
|
59
|
+
*
|
|
60
|
+
* @param basePath - Optional base path for the router (default: empty)
|
|
61
|
+
* @returns Router with all auth steps as endpoints
|
|
62
|
+
*/
|
|
63
|
+
getAuthRouter(basePath = '') {
|
|
64
|
+
const endpoints = this.getEndpoints();
|
|
65
|
+
return new (class extends router_1.BaseApiRouter {
|
|
66
|
+
path = basePath;
|
|
67
|
+
async routes() {
|
|
68
|
+
return endpoints;
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
}
|
|
72
|
+
getMiddleware() {
|
|
73
|
+
return async (request, response, next) => {
|
|
74
|
+
await this.sessionDriver.checkSession({
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
sessionId: request.sessionId,
|
|
77
|
+
});
|
|
78
|
+
request.authenticated = true;
|
|
79
|
+
return next();
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.SessionAuthenticationScheme = SessionAuthenticationScheme;
|
|
21
84
|
//# sourceMappingURL=authentication-scheme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-scheme.js","sourceRoot":"","sources":["../../../src/authentication/authentication-scheme.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"authentication-scheme.js","sourceRoot":"","sources":["../../../src/authentication/authentication-scheme.ts"],"names":[],"mappings":";;;AAKA,sCAKmB;AASnB;;;;GAIG;AACH,MAAsB,oBAAoB;IACzC,6DAA6D;IAC7D,YAAmB,UAAuC,EAAE,IAAG,CAAC;IAehE;;;;;OAKG;IACI,sBAAsB;QAC5B,OAAO,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;IAClC,CAAC;CAUD;AAnCD,oDAmCC;AAED,MAAsB,0BAA2B,SAAQ,oBAAoB;IAO5E;;;;;OAKG;IACI,aAAa;QACnB,OAAO,KAAK,EACX,OAA6B,EAC7B,QAAqB,EACrB,IAAqB,EACpB,EAAE;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;YAElD,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;YAE7B,OAAO,IAAI,EAAE,CAAC;QACf,CAAC,CAAC;IACH,CAAC;CACD;AA3BD,gEA2BC;AAED,MAAsB,2BAA4B,SAAQ,oBAAoB;IACnE,aAAa,CAAgB;IAEvC,YAAmB,OAAyC;QAC3D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC5C,CAAC;IAWD;;;;OAIG;IACI,YAAY;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACI,aAAa,CAAC,QAAQ,GAAG,EAAE;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAEtC,OAAO,IAAI,CAAC,KAAM,SAAQ,sBAAa;YAC7B,IAAI,GAAG,QAAQ,CAAC;YAEzB,KAAK,CAAC,MAAM;gBACX,OAAO,SAAS,CAAC;YAClB,CAAC;SACD,CAAC,EAAE,CAAC;IACN,CAAC;IAEM,aAAa;QACnB,OAAO,KAAK,EACX,OAA6B,EAC7B,QAAqB,EACrB,IAAqB,EACpB,EAAE;YACH,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;gBACrC,8DAA8D;gBAC9D,SAAS,EAAG,OAAe,CAAC,SAAS;aACrC,CAAC,CAAC;YAEH,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;YAC7B,OAAO,IAAI,EAAE,CAAC;QACf,CAAC,CAAC;IACH,CAAC;CACD;AA7DD,kEA6DC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { AuthenticatedRequest } from './authenticated-request';
|
|
2
|
-
export { AuthenticationScheme } from './authentication-scheme';
|
|
3
|
-
export
|
|
2
|
+
export { AuthenticationScheme, InlineAuthenticationScheme, SessionAuthenticationScheme, } from './authentication-scheme';
|
|
3
|
+
export { AuthFlow } from './auth-flow';
|
|
4
4
|
export * from './schemes';
|
package/authentication/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthenticationScheme = void 0;
|
|
3
|
+
exports.SessionAuthenticationScheme = exports.InlineAuthenticationScheme = exports.AuthenticationScheme = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var authentication_scheme_1 = require("./authentication-scheme");
|
|
6
6
|
Object.defineProperty(exports, "AuthenticationScheme", { enumerable: true, get: function () { return authentication_scheme_1.AuthenticationScheme; } });
|
|
7
|
-
|
|
7
|
+
Object.defineProperty(exports, "InlineAuthenticationScheme", { enumerable: true, get: function () { return authentication_scheme_1.InlineAuthenticationScheme; } });
|
|
8
|
+
Object.defineProperty(exports, "SessionAuthenticationScheme", { enumerable: true, get: function () { return authentication_scheme_1.SessionAuthenticationScheme; } });
|
|
8
9
|
tslib_1.__exportStar(require("./schemes"), exports);
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authentication/index.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authentication/index.ts"],"names":[],"mappings":";;;;AACA,iEAIiC;AAHhC,6HAAA,oBAAoB,OAAA;AACpB,mIAAA,0BAA0B,OAAA;AAC1B,oIAAA,2BAA2B,OAAA;AAG5B,oDAA0B"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { Response, NextFunction } from 'express';
|
|
2
|
-
import { AuthenticatedRequest } from '../authenticated-request';
|
|
3
1
|
import { LogInterface } from '../../log';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use BearerAuthenticationScheme instead
|
|
4
|
+
*/
|
|
4
5
|
export interface BearerAuthenticationMiddlewareOptions {
|
|
5
6
|
checkToken: (token: string) => Promise<boolean>;
|
|
6
7
|
log?: LogInterface;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
10
|
+
* @deprecated Use BearerAuthenticationScheme instead
|
|
11
|
+
*
|
|
9
12
|
* Bearer token authentication middleware
|
|
10
13
|
* Validates the Authorization header against the configured bearer token
|
|
11
14
|
*/
|
|
12
|
-
export declare function bearerAuthenticationMiddleware(options: BearerAuthenticationMiddlewareOptions): (
|
|
15
|
+
export declare function bearerAuthenticationMiddleware(options: BearerAuthenticationMiddlewareOptions): import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
@@ -1,49 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bearerAuthenticationMiddleware = void 0;
|
|
4
|
-
const
|
|
5
|
-
const valsan_1 = require("valsan");
|
|
4
|
+
const __1 = require("../..");
|
|
6
5
|
/**
|
|
6
|
+
* @deprecated Use BearerAuthenticationScheme instead
|
|
7
|
+
*
|
|
7
8
|
* Bearer token authentication middleware
|
|
8
9
|
* Validates the Authorization header against the configured bearer token
|
|
9
10
|
*/
|
|
10
11
|
function bearerAuthenticationMiddleware(options) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
' - No token provided');
|
|
17
|
-
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
18
|
-
scheme: 'Bearer',
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const validationResult = await new valsan_1.BearerTokenValSan().run(authHeader);
|
|
22
|
-
let token;
|
|
23
|
-
if (validationResult.success) {
|
|
24
|
-
token = validationResult.data;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
options.log?.warn('Unauthorized access attempt from ' +
|
|
28
|
-
req.ip +
|
|
29
|
-
' - Invalid token format', JSON.stringify(validationResult.errors, null, 2));
|
|
30
|
-
throw new error_1.UnauthorizedError('Bearer token is empty or invalid', {
|
|
31
|
-
scheme: 'Bearer',
|
|
32
|
-
details: validationResult.errors,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (!(await options.checkToken(token))) {
|
|
36
|
-
options.log?.warn('Unauthorized access attempt from ' +
|
|
37
|
-
req.ip +
|
|
38
|
-
' - Check token failed');
|
|
39
|
-
throw new error_1.UnauthorizedError('Bearer token check failed', {
|
|
40
|
-
scheme: 'Bearer',
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
req.authenticated = true;
|
|
44
|
-
next();
|
|
45
|
-
return;
|
|
46
|
-
};
|
|
12
|
+
const scheme = new __1.BearerAuthenticationScheme({
|
|
13
|
+
checkToken: options.checkToken,
|
|
14
|
+
log: options.log,
|
|
15
|
+
});
|
|
16
|
+
return scheme.getMiddleware();
|
|
47
17
|
}
|
|
48
18
|
exports.bearerAuthenticationMiddleware = bearerAuthenticationMiddleware;
|
|
49
19
|
//# sourceMappingURL=bearer-authentication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bearer-authentication.js","sourceRoot":"","sources":["../../../../src/authentication/middleware/bearer-authentication.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"bearer-authentication.js","sourceRoot":"","sources":["../../../../src/authentication/middleware/bearer-authentication.ts"],"names":[],"mappings":";;;AACA,6BAAmD;AAUnD;;;;;GAKG;AACH,SAAgB,8BAA8B,CAC7C,OAA8C;IAE9C,MAAM,MAAM,GAAG,IAAI,8BAA0B,CAAC;QAC7C,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,GAAG,EAAE,OAAO,CAAC,GAAG;KAChB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,aAAa,EAAE,CAAC;AAC/B,CAAC;AATD,wEASC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthenticationScheme } from '../authentication-scheme';
|
|
1
|
+
import { AuthenticationSchemeOptions, InlineAuthenticationScheme } from '../authentication-scheme';
|
|
3
2
|
import { SecuritySchemeObject } from 'auto-oas/oas/v3.1';
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { LogInterface } from '../../log';
|
|
4
|
+
import { ApiRequest } from '../../router';
|
|
5
|
+
export type CheckTokenFunction = (token: string) => Promise<boolean>;
|
|
6
|
+
export interface BearerAuthenticationSchemeOptions extends AuthenticationSchemeOptions {
|
|
6
7
|
/**
|
|
7
8
|
* The name of the security scheme in OpenAPI
|
|
8
9
|
* @default 'BearerAuth'
|
|
@@ -19,19 +20,32 @@ export interface BearerAuthenticationSchemeOptions extends BearerAuthenticationM
|
|
|
19
20
|
* Appears in the OpenAPI documentation
|
|
20
21
|
*/
|
|
21
22
|
description?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Function to validate the bearer token
|
|
25
|
+
* Should return true if the token is valid, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
checkToken: CheckTokenFunction;
|
|
28
|
+
/**
|
|
29
|
+
* Optional logger for security events
|
|
30
|
+
*/
|
|
31
|
+
log?: LogInterface;
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Bearer token authentication scheme
|
|
25
35
|
* Validates the Authorization header with Bearer token
|
|
26
36
|
* Automatically generates OpenAPI security scheme documentation
|
|
27
37
|
*/
|
|
28
|
-
export declare class BearerAuthenticationScheme extends
|
|
29
|
-
readonly type: "http";
|
|
38
|
+
export declare class BearerAuthenticationScheme extends InlineAuthenticationScheme {
|
|
30
39
|
readonly schemeName: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
protected readonly bearerFormat: string;
|
|
41
|
+
protected readonly description?: string;
|
|
42
|
+
protected readonly checkToken: CheckTokenFunction;
|
|
43
|
+
protected readonly log?: LogInterface;
|
|
34
44
|
constructor(options: BearerAuthenticationSchemeOptions);
|
|
35
45
|
getSecurityScheme(): SecuritySchemeObject;
|
|
36
|
-
|
|
46
|
+
getCredentials(request: ApiRequest): unknown;
|
|
47
|
+
authenticate(options: {
|
|
48
|
+
credentials: string;
|
|
49
|
+
request: ApiRequest;
|
|
50
|
+
}): Promise<void>;
|
|
37
51
|
}
|
|
@@ -2,27 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BearerAuthenticationScheme = void 0;
|
|
4
4
|
const authentication_scheme_1 = require("../authentication-scheme");
|
|
5
|
-
const
|
|
5
|
+
const error_1 = require("../../error");
|
|
6
|
+
const primitives_1 = require("valsan/primitives");
|
|
6
7
|
/**
|
|
7
8
|
* Bearer token authentication scheme
|
|
8
9
|
* Validates the Authorization header with Bearer token
|
|
9
10
|
* Automatically generates OpenAPI security scheme documentation
|
|
10
11
|
*/
|
|
11
|
-
class BearerAuthenticationScheme extends authentication_scheme_1.
|
|
12
|
-
type = 'http';
|
|
12
|
+
class BearerAuthenticationScheme extends authentication_scheme_1.InlineAuthenticationScheme {
|
|
13
13
|
schemeName;
|
|
14
14
|
bearerFormat;
|
|
15
15
|
description;
|
|
16
|
-
|
|
16
|
+
checkToken;
|
|
17
|
+
log;
|
|
17
18
|
constructor(options) {
|
|
18
|
-
super();
|
|
19
|
+
super(options);
|
|
19
20
|
this.schemeName = options.schemeName || 'BearerAuth';
|
|
20
21
|
this.bearerFormat = options.bearerFormat || 'JWT';
|
|
21
22
|
this.description = options.description;
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
log: options.log,
|
|
25
|
-
};
|
|
23
|
+
this.checkToken = options.checkToken;
|
|
24
|
+
this.log = options.log;
|
|
26
25
|
}
|
|
27
26
|
getSecurityScheme() {
|
|
28
27
|
const scheme = {
|
|
@@ -35,8 +34,49 @@ class BearerAuthenticationScheme extends authentication_scheme_1.AuthenticationS
|
|
|
35
34
|
}
|
|
36
35
|
return scheme;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
getCredentials(request) {
|
|
38
|
+
const authHeader = request.headers['authorization'] ||
|
|
39
|
+
request.headers['Authorization'];
|
|
40
|
+
if (!authHeader) {
|
|
41
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
42
|
+
request.ip +
|
|
43
|
+
' - No token provided';
|
|
44
|
+
this.log?.warn(msg);
|
|
45
|
+
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
46
|
+
scheme: 'Bearer',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return authHeader;
|
|
50
|
+
}
|
|
51
|
+
async authenticate(options) {
|
|
52
|
+
const { credentials, request } = options;
|
|
53
|
+
if (!credentials) {
|
|
54
|
+
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
55
|
+
scheme: 'Bearer',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const validationResult = await new primitives_1.BearerTokenValSan().run(credentials);
|
|
59
|
+
if (!validationResult.success || !validationResult.data) {
|
|
60
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
61
|
+
request.ip +
|
|
62
|
+
' - Invalid token format';
|
|
63
|
+
const details = JSON.stringify(validationResult.errors, null, 2);
|
|
64
|
+
this.log?.warn(msg, details);
|
|
65
|
+
throw new error_1.UnauthorizedError('Bearer token is empty or invalid', {
|
|
66
|
+
scheme: 'Bearer',
|
|
67
|
+
details: validationResult.errors,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (!(await this.checkToken(validationResult.data))) {
|
|
71
|
+
// eslint-disable-next-line max-len
|
|
72
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
73
|
+
request.ip +
|
|
74
|
+
' - Check token failed';
|
|
75
|
+
this.log?.warn(msg);
|
|
76
|
+
throw new error_1.UnauthorizedError('Bearer token check failed', {
|
|
77
|
+
scheme: 'Bearer',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
40
80
|
}
|
|
41
81
|
}
|
|
42
82
|
exports.BearerAuthenticationScheme = BearerAuthenticationScheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bearer-authentication-scheme.js","sourceRoot":"","sources":["../../../../src/authentication/schemes/bearer-authentication-scheme.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bearer-authentication-scheme.js","sourceRoot":"","sources":["../../../../src/authentication/schemes/bearer-authentication-scheme.ts"],"names":[],"mappings":";;;AAAA,oEAGkC;AAElC,uCAAgD;AAChD,kDAAsD;AAuCtD;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,kDAA0B;IACzD,UAAU,CAAS;IAEhB,YAAY,CAAS;IACrB,WAAW,CAAU;IACrB,UAAU,CAAqB;IAC/B,GAAG,CAAgB;IAEtC,YAAY,OAA0C;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,KAAK,CAAC;QAClD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IACxB,CAAC;IAEM,iBAAiB;QACvB,MAAM,MAAM,GAAyB;YACpC,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,QAAQ;YAChB,YAAY,EAAE,IAAI,CAAC,YAAY;SAC/B,CAAC;QAEF,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACvC,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEe,cAAc,CAAC,OAAmB;QACjD,MAAM,UAAU,GACf,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC;YAChC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAElC,IAAI,CAAC,UAAU,EAAE,CAAC;YACjB,MAAM,GAAG,GACR,mCAAmC;gBACnC,OAAO,CAAC,EAAE;gBACV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,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAEpB,MAAM,IAAI,yBAAiB,CAAC,2BAA2B,EAAE;gBACxD,MAAM,EAAE,QAAQ;aAChB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD;AA5FD,gEA4FC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare class DependencyContainer {
|
|
2
|
+
protected dependencies: Map<string, any>;
|
|
3
|
+
protected parent?: DependencyContainer;
|
|
4
|
+
constructor(parent?: DependencyContainer);
|
|
5
|
+
/**
|
|
6
|
+
* Register a dependency
|
|
7
|
+
* @param key The key to register the dependency under
|
|
8
|
+
* @param value The dependency value
|
|
9
|
+
*/
|
|
10
|
+
register<T>(key: string, value: T): void;
|
|
11
|
+
/**
|
|
12
|
+
* Get a dependency, searching up the parent chain if not found locally
|
|
13
|
+
* @param key The key of the dependency to retrieve
|
|
14
|
+
* @returns The dependency value, or undefined if not found
|
|
15
|
+
*/
|
|
16
|
+
get<T>(key: string): T | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a dependency exists in the container or its parents
|
|
19
|
+
* @param key The key to check
|
|
20
|
+
*/
|
|
21
|
+
has(key: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Create a child container that inherits from this one
|
|
24
|
+
*/
|
|
25
|
+
createChild(): DependencyContainer;
|
|
26
|
+
/**
|
|
27
|
+
* Set the parent container
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
setParent(parent: DependencyContainer): void;
|
|
31
|
+
}
|
package/di/container.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DependencyContainer = void 0;
|
|
4
|
+
class DependencyContainer {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
dependencies = new Map();
|
|
7
|
+
// eslint-disable-next-line no-use-before-define
|
|
8
|
+
parent;
|
|
9
|
+
// eslint-disable-next-line no-use-before-define
|
|
10
|
+
constructor(parent) {
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Register a dependency
|
|
15
|
+
* @param key The key to register the dependency under
|
|
16
|
+
* @param value The dependency value
|
|
17
|
+
*/
|
|
18
|
+
register(key, value) {
|
|
19
|
+
this.dependencies.set(key, value);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get a dependency, searching up the parent chain if not found locally
|
|
23
|
+
* @param key The key of the dependency to retrieve
|
|
24
|
+
* @returns The dependency value, or undefined if not found
|
|
25
|
+
*/
|
|
26
|
+
get(key) {
|
|
27
|
+
if (this.dependencies.has(key)) {
|
|
28
|
+
return this.dependencies.get(key);
|
|
29
|
+
}
|
|
30
|
+
if (this.parent) {
|
|
31
|
+
return this.parent.get(key);
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if a dependency exists in the container or its parents
|
|
37
|
+
* @param key The key to check
|
|
38
|
+
*/
|
|
39
|
+
has(key) {
|
|
40
|
+
return this.dependencies.has(key) || (this.parent?.has(key) ?? false);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a child container that inherits from this one
|
|
44
|
+
*/
|
|
45
|
+
createChild() {
|
|
46
|
+
return new DependencyContainer(this);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Set the parent container
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
setParent(parent) {
|
|
53
|
+
this.parent = parent;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.DependencyContainer = DependencyContainer;
|
|
57
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../../src/di/container.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAC/B,8DAA8D;IACpD,YAAY,GAAqB,IAAI,GAAG,EAAE,CAAC;IACrD,gDAAgD;IACtC,MAAM,CAAuB;IAEvC,gDAAgD;IAChD,YAAY,MAA4B;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAI,GAAW,EAAE,KAAQ;QACvC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAI,GAAW;QACxB,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAM,CAAC;QACxC,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,GAAG,CAAC,GAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,WAAW;QACjB,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,MAA2B;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD;AA3DD,kDA2DC"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -5,4 +5,5 @@ tslib_1.__exportStar(require("./router"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("./server"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./error"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./authentication"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./session"), exports);
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB;AACxB,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB;AACxB,2DAAiC;AACjC,oDAA0B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "api-machine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "api-machine",
|
|
5
5
|
"typescript-template": {
|
|
6
6
|
"base": "1.0.1",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"auto-oas": "^1.3.0",
|
|
13
13
|
"cors": "^2.8.5",
|
|
14
14
|
"express": "^5.1.0",
|
|
15
|
+
"hidi": "^2.2.0",
|
|
15
16
|
"swagger-ui-express": "^5.0.1",
|
|
16
17
|
"valsan": "^2.3.0"
|
|
17
18
|
},
|
package/router/base.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { Router as ExpressRouter, RequestHandler } from 'express';
|
|
2
2
|
import { AuthenticationScheme } from '../authentication/authentication-scheme';
|
|
3
|
+
import { DependencyContainer } from 'hidi';
|
|
3
4
|
export declare abstract class BaseApiRoute {
|
|
4
5
|
path: string;
|
|
5
6
|
fullPath: string;
|
|
6
7
|
name: string;
|
|
7
8
|
description?: string;
|
|
8
9
|
routeType: 'router' | 'endpoint';
|
|
10
|
+
/**
|
|
11
|
+
* Dependency container for this route
|
|
12
|
+
*/
|
|
13
|
+
container: DependencyContainer;
|
|
9
14
|
/**
|
|
10
15
|
* Optional array of Express middleware to apply
|
|
11
16
|
*/
|
|
@@ -21,7 +26,8 @@ export declare abstract class BaseApiRoute {
|
|
|
21
26
|
* @internal
|
|
22
27
|
*/
|
|
23
28
|
parentRoute?: BaseApiRoute;
|
|
24
|
-
|
|
29
|
+
register(_parentRouter: ExpressRouter, _parentPath: string): Promise<void>;
|
|
30
|
+
inject(): void;
|
|
25
31
|
getName(): string;
|
|
26
32
|
registerRoutePath(parentPath: string): void;
|
|
27
33
|
/**
|
|
@@ -31,6 +37,4 @@ export declare abstract class BaseApiRoute {
|
|
|
31
37
|
*/
|
|
32
38
|
getEffectiveAuthentication(): AuthenticationScheme | undefined | null;
|
|
33
39
|
}
|
|
34
|
-
export type ApiRoute =
|
|
35
|
-
new (): BaseApiRoute;
|
|
36
|
-
};
|
|
40
|
+
export type ApiRoute = new (...params: ConstructorParameters<typeof BaseApiRoute>) => BaseApiRoute;
|
package/router/base.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseApiRoute = void 0;
|
|
4
|
+
const hidi_1 = require("hidi");
|
|
4
5
|
class BaseApiRoute {
|
|
5
6
|
path;
|
|
6
7
|
fullPath;
|
|
7
8
|
name;
|
|
8
9
|
description;
|
|
9
10
|
routeType;
|
|
11
|
+
/**
|
|
12
|
+
* Dependency container for this route
|
|
13
|
+
*/
|
|
14
|
+
container = new hidi_1.DependencyContainer();
|
|
10
15
|
/**
|
|
11
16
|
* Optional array of Express middleware to apply
|
|
12
17
|
*/
|
|
@@ -23,6 +28,15 @@ class BaseApiRoute {
|
|
|
23
28
|
*/
|
|
24
29
|
// eslint-disable-next-line no-use-before-define
|
|
25
30
|
parentRoute;
|
|
31
|
+
async register(_parentRouter, _parentPath) {
|
|
32
|
+
if (this.authentication !== undefined) {
|
|
33
|
+
this.container.register('auth', this.authentication);
|
|
34
|
+
}
|
|
35
|
+
this.inject();
|
|
36
|
+
}
|
|
37
|
+
inject() {
|
|
38
|
+
// Override in subclasses to register dependencies
|
|
39
|
+
}
|
|
26
40
|
getName() {
|
|
27
41
|
return this.name || this.constructor.name;
|
|
28
42
|
}
|
|
@@ -44,16 +58,7 @@ class BaseApiRoute {
|
|
|
44
58
|
* @returns The authentication scheme to use, or undefined if public
|
|
45
59
|
*/
|
|
46
60
|
getEffectiveAuthentication() {
|
|
47
|
-
|
|
48
|
-
if (this.authentication !== undefined) {
|
|
49
|
-
return this.authentication;
|
|
50
|
-
}
|
|
51
|
-
// Otherwise, cascade to parent
|
|
52
|
-
if (this.parentRoute) {
|
|
53
|
-
return this.parentRoute.getEffectiveAuthentication();
|
|
54
|
-
}
|
|
55
|
-
// No authentication at any level
|
|
56
|
-
return undefined;
|
|
61
|
+
return this.container.get('auth');
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
exports.BaseApiRoute = BaseApiRoute;
|
package/router/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/router/base.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/router/base.ts"],"names":[],"mappings":";;;AAEA,+BAA2C;AAE3C,MAAsB,YAAY;IAC1B,IAAI,CAAS;IACb,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,WAAW,CAAU;IACrB,SAAS,CAAwB;IAExC;;OAEG;IACI,SAAS,GAAwB,IAAI,0BAAmB,EAAE,CAAC;IAElE;;OAEG;IACI,UAAU,GAAqB,EAAE,CAAC;IAEzC;;;;OAIG;IACI,cAAc,CAA+B;IAEpD;;;OAGG;IACH,gDAAgD;IACzC,WAAW,CAAgB;IAE3B,KAAK,CAAC,QAAQ,CACpB,aAA4B,EAC5B,WAAmB;QAEnB,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YACvC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAEM,MAAM;QACZ,kDAAkD;IACnD,CAAC;IAEM,OAAO;QACb,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC3C,CAAC;IAEM,iBAAiB,CAAC,UAAkB;QAC1C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QAChB,CAAC;aACI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;QAC7B,CAAC;QAED,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,0BAA0B;QAIhC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACD;AA5ED,oCA4EC"}
|
package/router/endpoint.d.ts
CHANGED
|
@@ -43,6 +43,4 @@ export declare abstract class BaseApiEndpoint extends BaseApiRoute {
|
|
|
43
43
|
abstract handle(request: ApiRequest, response: ApiResponse, next: ApiNextFunction): Promise<ApiResponseData>;
|
|
44
44
|
checkRequest(request: ApiRequest): Promise<void>;
|
|
45
45
|
}
|
|
46
|
-
export type ApiEndpoint =
|
|
47
|
-
new (): BaseApiEndpoint;
|
|
48
|
-
};
|
|
46
|
+
export type ApiEndpoint = new (...params: ConstructorParameters<typeof BaseApiEndpoint>) => BaseApiEndpoint;
|
package/router/endpoint.js
CHANGED
|
@@ -44,6 +44,7 @@ class BaseApiEndpoint extends base_1.BaseApiRoute {
|
|
|
44
44
|
return this.tag || this.constructor.name.replace(/Endpoint$/, '');
|
|
45
45
|
}
|
|
46
46
|
async register(parentRouter, parentPath) {
|
|
47
|
+
await super.register(parentRouter, parentPath);
|
|
47
48
|
if (!this.name) {
|
|
48
49
|
this.name = this.constructor.name.replace(/Endpoint$/, '');
|
|
49
50
|
}
|
package/router/endpoint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../../src/router/endpoint.ts"],"names":[],"mappings":";;;AASA,iCAAsC;AACtC,mEAA0D;AAC1D,oCAAgF;AAUhF,IAAY,cAMX;AAND,WAAY,cAAc;IACzB,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,6BAAW,CAAA;IACX,mCAAiB,CAAA;IACjB,iCAAe,CAAA;AAChB,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB;AAED,MAAsB,eAAgB,SAAQ,mBAAY;IAChD,SAAS,GAAG,UAAmB,CAAC;IAChC,IAAI,GAAG,EAAE,CAAC;IACZ,GAAG,CAAU;IACb,MAAM,GAAmB,cAAc,CAAC,GAAG,CAAC;IAC5C,UAAU,GAAW,GAAG,CAAC;IAEzB,IAAI,CAAkC;IAC7C,8DAA8D;IACvD,WAAW,CAAO;IAElB,KAAK,CAAkC;IAC9C,8DAA8D;IACvD,YAAY,CAAO;IAEnB,MAAM,CAAkC;IAC/C,8DAA8D;IACvD,aAAa,CAAO;IAEpB,OAAO,CAAkC;IAChD,8DAA8D;IACvD,cAAc,CAAO;IAErB,QAAQ,CAAgD;IAC/D,8DAA8D;IACvD,eAAe,CAAO;IAEtB,SAAS;QACf,OAAO;YACN,KAAK,EAAE,IAAI,uBAAe,EAAE;YAC5B,UAAU,EAAE,IAAI,gCAAwB,EAAE;SAC1C,CAAC;IACH,CAAC;IAEM,MAAM;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ACrB,IAAqB;QAErB,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAExD,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAQM,KAAK,CAAC,YAAY,CAAC,OAAmB;QAC5C,wDAAwD;QACxD,6BAA6B;QAC7B,MAAM,IAAA,uCAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACD;AAjGD,0CAiGC"}
|
package/router/router.js
CHANGED
|
@@ -13,6 +13,7 @@ class BaseApiRouter extends base_1.BaseApiRoute {
|
|
|
13
13
|
return this.name || this.constructor.name.replace(/Router$/, '');
|
|
14
14
|
}
|
|
15
15
|
async register(parent, parentPath) {
|
|
16
|
+
await super.register(parent, parentPath);
|
|
16
17
|
this.router = (0, express_1.Router)();
|
|
17
18
|
this.registerRoutePath(parentPath);
|
|
18
19
|
// Collect non-authentication middleware
|
|
@@ -32,7 +33,8 @@ class BaseApiRouter extends base_1.BaseApiRoute {
|
|
|
32
33
|
// First pass: register all endpoints and track their methods
|
|
33
34
|
for (const route of routes) {
|
|
34
35
|
const instance = new route();
|
|
35
|
-
// Set parent
|
|
36
|
+
// Set parent for auth and dependency cascading
|
|
37
|
+
instance.container.setParent(this.container);
|
|
36
38
|
instance.parentRoute = this;
|
|
37
39
|
if (instance.routeType === 'endpoint') {
|
|
38
40
|
instance.tag = tag;
|
package/router/router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../src/router/router.ts"],"names":[],"mappings":";;;AAAA,qCAAkD;AAClD,iCAAgD;AAChD,yCAA6D;AAE7D,MAAsB,aAAc,SAAQ,mBAAY;IAC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C,gBAAgB,EAAE,IAAI,EAAE,EAAE;YAC9C,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC7B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;oBACnC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;wBACtC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;4BACpB,KAAK,EAAE,oBAAoB;4BAC3B,OAAO,EAAE,UAAU,GAAG,CAAC,MAAM,cAAc;yBAC3C,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,QAAsB;QACtD,MAAM,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;CACD;AAxFD,sCAwFC"}
|
|
@@ -4,7 +4,7 @@ import { ApiRequest, BaseApiEndpoint } from './endpoint';
|
|
|
4
4
|
* Runs a valsan ObjectValSan on a value,
|
|
5
5
|
* throws with error details if validation fails.
|
|
6
6
|
*/
|
|
7
|
-
export declare function runSanitizer(sanitizer: ObjectSanitizer | ObjectValSan | ArrayValSan, value: any): Promise<Record<string, unknown> |
|
|
7
|
+
export declare function runSanitizer(sanitizer: ObjectSanitizer | ObjectValSan | ArrayValSan, value: any): Promise<unknown[] | Record<string, unknown> | undefined>;
|
|
8
8
|
/**
|
|
9
9
|
* Validates and sanitizes request parts
|
|
10
10
|
* (body, query, params, headers) if the
|
package/server/server.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import http from 'http';
|
|
4
|
+
import { DependencyContainer } from 'hidi';
|
|
4
5
|
import { RestServerOptions } from './server-options';
|
|
5
6
|
import { ApiRouter, BaseApiRouter } from '../router';
|
|
6
7
|
import { AuthenticationScheme } from '../authentication/authentication-scheme';
|
|
@@ -11,6 +12,10 @@ export declare abstract class RestServer {
|
|
|
11
12
|
version: string;
|
|
12
13
|
router: ApiRouter;
|
|
13
14
|
routerInstance: BaseApiRouter;
|
|
15
|
+
/**
|
|
16
|
+
* Dependency container for the server
|
|
17
|
+
*/
|
|
18
|
+
container: DependencyContainer;
|
|
14
19
|
readonly port: number;
|
|
15
20
|
readonly maxPayloadSizeMB: number;
|
|
16
21
|
readonly maxUrlEncodedSizeMB: number;
|
|
@@ -23,6 +28,7 @@ export declare abstract class RestServer {
|
|
|
23
28
|
constructor(options: Partial<RestServerOptions>);
|
|
24
29
|
start(): Promise<void>;
|
|
25
30
|
stop(): Promise<void>;
|
|
31
|
+
inject(): Promise<void>;
|
|
26
32
|
protected createRouter(): Promise<void>;
|
|
27
33
|
protected registerAuthentication(): Promise<void>;
|
|
28
34
|
protected registerRoutes(): Promise<void>;
|
package/server/server.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.RestServer = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const express_1 = tslib_1.__importDefault(require("express"));
|
|
6
6
|
const cors_1 = tslib_1.__importDefault(require("cors"));
|
|
7
|
+
const hidi_1 = require("hidi");
|
|
7
8
|
const server_options_1 = require("./server-options");
|
|
8
9
|
const error_1 = require("../error");
|
|
9
10
|
const routes_1 = require("../oas/routes");
|
|
@@ -13,6 +14,10 @@ class RestServer {
|
|
|
13
14
|
version = '';
|
|
14
15
|
router;
|
|
15
16
|
routerInstance;
|
|
17
|
+
/**
|
|
18
|
+
* Dependency container for the server
|
|
19
|
+
*/
|
|
20
|
+
container = new hidi_1.DependencyContainer();
|
|
16
21
|
port;
|
|
17
22
|
maxPayloadSizeMB;
|
|
18
23
|
maxUrlEncodedSizeMB;
|
|
@@ -36,6 +41,7 @@ class RestServer {
|
|
|
36
41
|
this.authentication = options.authentication;
|
|
37
42
|
}
|
|
38
43
|
async start() {
|
|
44
|
+
await this.inject();
|
|
39
45
|
await this.setupExpress();
|
|
40
46
|
await this.createRouter();
|
|
41
47
|
await this.registerAuthentication();
|
|
@@ -50,8 +56,12 @@ class RestServer {
|
|
|
50
56
|
this.listener.close();
|
|
51
57
|
}
|
|
52
58
|
}
|
|
59
|
+
async inject() {
|
|
60
|
+
// Register dependencies
|
|
61
|
+
}
|
|
53
62
|
async createRouter() {
|
|
54
63
|
this.routerInstance = new this.router();
|
|
64
|
+
this.routerInstance.container.setParent(this.container);
|
|
55
65
|
}
|
|
56
66
|
async registerAuthentication() {
|
|
57
67
|
// Set server authentication on router instance if not already set
|
package/server/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":";;;;AAAA,8DAA8B;AAC9B,wDAAwB;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":";;;;AAAA,8DAA8B;AAC9B,wDAAwB;AAExB,+BAA2C;AAE3C,qDAA+E;AAE/E,oCAAmE;AAInE,0CAA0C;AAE1C,MAAsB,UAAU;IACxB,IAAI,GAAG,YAAY,CAAC;IACpB,WAAW,GAAG,iBAAiB,CAAC;IAChC,OAAO,GAAG,EAAE,CAAC;IAEb,MAAM,CAAY;IAClB,cAAc,CAAgB;IAErC;;OAEG;IACI,SAAS,GAAwB,IAAI,0BAAmB,EAAE,CAAC;IAElD,IAAI,CAAS;IACb,gBAAgB,CAAS;IACzB,mBAAmB,CAAS;IAC5B,eAAe,CAAuC;IAC/D,cAAc,GAAG,KAAK,CAAC;IACvB,cAAc,CAAwB;IAEnC,GAAG,CAAkB;IACrB,QAAQ,CAAc;IACtB,GAAG,CAAe;IAE5B,YAAY,OAAmC;QAC9C,OAAO,GAAG,EAAE,GAAG,yCAA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AAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAgB;gBAC/C,KAAK,EAAE,qBAAqB;gBAC5B,OAAO,EAAE,uBAAuB;gBAChC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,OAAO,EAAE,EAAE;aACX,CAAC,CAAC;QACJ,CAAC,CACD,CAAC;IACH,CAAC;IAES,KAAK,CAAC,cAAc;QAC7B,MAAM,IAAI,OAAO,CAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC5D,IAAI,KAAK,EAAE,CAAC;oBACX,MAAM,CAAC,KAAK,CAAC,CAAC;oBACd,OAAO;gBACR,CAAC;gBAED,MAAM,EAAE,CAAC;YACV,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAvOD,gCAuOC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SessionDriver, SessionRequest } from '../session-driver';
|
|
2
|
+
import { Session } from '../session';
|
|
3
|
+
/**
|
|
4
|
+
* In-memory session driver implementation for development and testing
|
|
5
|
+
*/
|
|
6
|
+
export declare class InMemorySessionDriver extends SessionDriver {
|
|
7
|
+
protected sessions: Map<string, Session>;
|
|
8
|
+
/**
|
|
9
|
+
* Register a session
|
|
10
|
+
*/
|
|
11
|
+
createSession(session: Session): void;
|
|
12
|
+
/**
|
|
13
|
+
* Clear all sessions
|
|
14
|
+
*/
|
|
15
|
+
clear(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Get the number of registered sessions
|
|
18
|
+
*/
|
|
19
|
+
getSessionCount(): number;
|
|
20
|
+
getSession(request: SessionRequest): Promise<Session>;
|
|
21
|
+
checkSession(request: SessionRequest): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemorySessionDriver = void 0;
|
|
4
|
+
const session_driver_1 = require("../session-driver");
|
|
5
|
+
/**
|
|
6
|
+
* In-memory session driver implementation for development and testing
|
|
7
|
+
*/
|
|
8
|
+
class InMemorySessionDriver extends session_driver_1.SessionDriver {
|
|
9
|
+
sessions = new Map();
|
|
10
|
+
/**
|
|
11
|
+
* Register a session
|
|
12
|
+
*/
|
|
13
|
+
createSession(session) {
|
|
14
|
+
this.sessions.set(session.id, session);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Clear all sessions
|
|
18
|
+
*/
|
|
19
|
+
clear() {
|
|
20
|
+
this.sessions.clear();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the number of registered sessions
|
|
24
|
+
*/
|
|
25
|
+
getSessionCount() {
|
|
26
|
+
return this.sessions.size;
|
|
27
|
+
}
|
|
28
|
+
async getSession(request) {
|
|
29
|
+
const sessionId = request.sessionId || 'default-session';
|
|
30
|
+
const session = this.sessions.get(sessionId) || {
|
|
31
|
+
id: sessionId,
|
|
32
|
+
};
|
|
33
|
+
return session;
|
|
34
|
+
}
|
|
35
|
+
async checkSession(request) {
|
|
36
|
+
const sessionId = request.sessionId;
|
|
37
|
+
if (!sessionId) {
|
|
38
|
+
throw new Error('No session ID provided');
|
|
39
|
+
}
|
|
40
|
+
if (!this.sessions.has(sessionId)) {
|
|
41
|
+
throw new Error('Session not found');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.InMemorySessionDriver = InMemorySessionDriver;
|
|
46
|
+
//# sourceMappingURL=in-memory-session-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory-session-driver.js","sourceRoot":"","sources":["../../../../src/session/drivers/in-memory-session-driver.ts"],"names":[],"mappings":";;;AAAA,sDAAkE;AAGlE;;GAEG;AACH,MAAa,qBAAsB,SAAQ,8BAAa;IAC7C,QAAQ,GAAyB,IAAI,GAAG,EAAE,CAAC;IAErD;;OAEG;IACI,aAAa,CAAC,OAAgB;QACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACI,KAAK;QACX,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,eAAe;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAuB;QACvC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAC;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI;YAC/C,EAAE,EAAE,SAAS;SACb,CAAC;QAEF,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAuB;QACzC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACpC,IAAI,CAAC,SAAS,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACtC,CAAC;IACF,CAAC;CACD;AA3CD,sDA2CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InMemorySessionDriver } from './in-memory-session-driver';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemorySessionDriver = void 0;
|
|
4
|
+
var in_memory_session_driver_1 = require("./in-memory-session-driver");
|
|
5
|
+
Object.defineProperty(exports, "InMemorySessionDriver", { enumerable: true, get: function () { return in_memory_session_driver_1.InMemorySessionDriver; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/session/drivers/index.ts"],"names":[],"mappings":";;;AAAA,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA"}
|
package/session/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemorySessionDriver = exports.SessionDriver = void 0;
|
|
4
|
+
var session_driver_1 = require("./session-driver");
|
|
5
|
+
Object.defineProperty(exports, "SessionDriver", { enumerable: true, get: function () { return session_driver_1.SessionDriver; } });
|
|
6
|
+
var drivers_1 = require("./drivers");
|
|
7
|
+
Object.defineProperty(exports, "InMemorySessionDriver", { enumerable: true, get: function () { return drivers_1.InMemorySessionDriver; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/session/index.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,qCAAkD;AAAzC,gHAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Session } from './session';
|
|
2
|
+
export interface SessionRequest {
|
|
3
|
+
sessionId?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare abstract class SessionDriver {
|
|
6
|
+
abstract createSession(session: Session): void;
|
|
7
|
+
abstract clear(): void;
|
|
8
|
+
abstract getSession(options: SessionRequest): Promise<Session>;
|
|
9
|
+
abstract checkSession(options: SessionRequest): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-driver.js","sourceRoot":"","sources":["../../../src/session/session-driver.ts"],"names":[],"mappings":";;;AAMA,MAAsB,aAAa;CAKlC;AALD,sCAKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/session/session.ts"],"names":[],"mappings":""}
|