@clairejs/server 3.11.8 → 3.11.9
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/.prettierrc +8 -8
- package/README.md +768 -767
- package/dist/common/FileOperation.d.ts +5 -5
- package/dist/common/ServerModelMetadata.d.ts +10 -10
- package/dist/common/auth/AbstractPrincipalResolver.d.ts +4 -4
- package/dist/common/auth/IPrincipal.d.ts +4 -4
- package/dist/common/constants.d.ts +1 -1
- package/dist/common/request/EndpointMetadata.d.ts +40 -40
- package/dist/common/request/HttpData.d.ts +1 -1
- package/dist/common/request/HttpEndpoint.d.ts +8 -8
- package/dist/common/request/JobData.d.ts +1 -1
- package/dist/common/request/MountedEndpointInfo.d.ts +6 -6
- package/dist/common/request/RequestOptions.d.ts +8 -8
- package/dist/common/request/SocketData.d.ts +1 -1
- package/dist/common/request/types.d.ts +1 -1
- package/dist/controllers/FileManageController.d.ts +13 -13
- package/dist/controllers/FileUploadController.d.ts +13 -13
- package/dist/controllers/dto/permissions.d.ts +20 -20
- package/dist/controllers/dto/system.d.ts +12 -12
- package/dist/controllers/dto/upload.d.ts +40 -40
- package/dist/controllers/models/SystemSetting.d.ts +5 -5
- package/dist/http/auth/AbstractHttpAuthorizationProvider.d.ts +9 -9
- package/dist/http/auth/AbstractRbacAuthProvider.d.ts +18 -18
- package/dist/http/auth/RedisRbacAuthProvider.d.ts +24 -24
- package/dist/http/auth/SocketRbacAuthProvider.d.ts +25 -25
- package/dist/http/auth/rbac.d.ts +34 -34
- package/dist/http/common/HttpRequest.d.ts +40 -40
- package/dist/http/common/HttpResponse.d.ts +34 -34
- package/dist/http/controller/AbstractHttpController.d.ts +9 -9
- package/dist/http/controller/AbstractHttpMiddleware.d.ts +10 -10
- package/dist/http/controller/AbstractHttpRequestHandler.d.ts +18 -18
- package/dist/http/controller/ControllerMetadata.d.ts +6 -6
- package/dist/http/controller/CrudHttpController.d.ts +41 -41
- package/dist/http/controller/DefaultHttpRequestHandler.d.ts +21 -21
- package/dist/http/decorators.d.ts +35 -35
- package/dist/http/file-upload/AbstractFileUploadHandler.d.ts +6 -6
- package/dist/http/file-upload/FileUploadHandler.d.ts +10 -10
- package/dist/http/file-upload/types.d.ts +3 -3
- package/dist/http/repository/AbstractRepository.d.ts +10 -10
- package/dist/http/repository/DtoRepository.d.ts +58 -58
- package/dist/http/repository/ICrudRepository.d.ts +27 -27
- package/dist/http/repository/ModelRepository.d.ts +37 -37
- package/dist/http/security/AbstractAccessCondition.d.ts +7 -7
- package/dist/http/security/access-conditions/DtoFieldValidation.d.ts +4 -4
- package/dist/http/security/access-conditions/FilterModelFieldAccessCondition.d.ts +4 -4
- package/dist/http/security/access-conditions/MaximumQueryLimit.d.ts +8 -8
- package/dist/http/security/cors.d.ts +6 -6
- package/dist/index.d.ts +71 -71
- package/dist/index.js +1 -1
- package/dist/job/AbstractJobController.d.ts +4 -4
- package/dist/job/AbstractJobRepository.d.ts +17 -17
- package/dist/job/AbstractJobScheduler.d.ts +38 -38
- package/dist/job/AwsJobScheduler.d.ts +48 -48
- package/dist/job/LocalJobScheduler.d.ts +88 -88
- package/dist/job/decorators.d.ts +5 -5
- package/dist/job/interfaces.d.ts +50 -50
- package/dist/logging/FileLogMedium.d.ts +13 -13
- package/dist/services/AbstractCacheService.d.ts +22 -22
- package/dist/services/AbstractFileService.d.ts +11 -11
- package/dist/services/AbstractMailService.d.ts +31 -31
- package/dist/services/AbstractService.d.ts +7 -7
- package/dist/services/AbstractSmsService.d.ts +25 -25
- package/dist/services/LocalFileService.d.ts +17 -17
- package/dist/services/ProxyFileService.d.ts +16 -16
- package/dist/services/RedisCacheService.d.ts +25 -25
- package/dist/services/S3FileService.d.ts +31 -31
- package/dist/services/SystemService.d.ts +15 -15
- package/dist/socket/AbstractServerSocket.d.ts +18 -18
- package/dist/socket/AbstractServerSocketManager.d.ts +46 -46
- package/dist/socket/AbstractSocketConnectionHandler.d.ts +6 -6
- package/dist/socket/AbstractSocketController.d.ts +14 -14
- package/dist/socket/AwsSocketManager.d.ts +30 -30
- package/dist/socket/IServerSocket.d.ts +16 -16
- package/dist/socket/LocalSocketManager.d.ts +47 -47
- package/dist/system/ClaireServer.d.ts +13 -13
- package/dist/system/ExpressWrapper.d.ts +19 -19
- package/dist/system/LambdaWrapper.d.ts +25 -25
- package/dist/system/ServerGlobalStore.d.ts +8 -8
- package/dist/system/errors.d.ts +14 -14
- package/dist/system/lamba-request-mapper.d.ts +2 -2
- package/dist/system/locale/LocaleEntry.d.ts +3 -3
- package/dist/system/locale/LocaleTranslation.d.ts +6 -6
- package/dist/system/locale/decorators.d.ts +2 -2
- package/package.json +66 -66
package/dist/http/auth/rbac.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export interface RbacRolePolicy {
|
|
2
|
-
roleId: number;
|
|
3
|
-
policyId: number;
|
|
4
|
-
}
|
|
5
|
-
export interface RbacRole {
|
|
6
|
-
roleId: number;
|
|
7
|
-
isSuperRole: boolean;
|
|
8
|
-
isAnonymousRole: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface RbacPolicyPermissionCondition {
|
|
11
|
-
policyPermissionId: number;
|
|
12
|
-
conditionName: string;
|
|
13
|
-
conditionValue: string;
|
|
14
|
-
}
|
|
15
|
-
export interface RbacPolicyPermission {
|
|
16
|
-
id: number;
|
|
17
|
-
policyId: number;
|
|
18
|
-
permission: string;
|
|
19
|
-
}
|
|
20
|
-
export interface RbacPolicy {
|
|
21
|
-
policyId: number;
|
|
22
|
-
isUserDefined: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface PrincipalRole {
|
|
25
|
-
principalId: number;
|
|
26
|
-
roleIds: number[];
|
|
27
|
-
}
|
|
28
|
-
export interface RbacCache {
|
|
29
|
-
roles?: RbacRole[];
|
|
30
|
-
policies?: RbacPolicy[];
|
|
31
|
-
rolePolicies?: RbacRolePolicy[];
|
|
32
|
-
policyPermissions?: RbacPolicyPermission[];
|
|
33
|
-
policyPermissionConditions?: RbacPolicyPermissionCondition[];
|
|
34
|
-
}
|
|
1
|
+
export interface RbacRolePolicy {
|
|
2
|
+
roleId: number;
|
|
3
|
+
policyId: number;
|
|
4
|
+
}
|
|
5
|
+
export interface RbacRole {
|
|
6
|
+
roleId: number;
|
|
7
|
+
isSuperRole: boolean;
|
|
8
|
+
isAnonymousRole: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface RbacPolicyPermissionCondition {
|
|
11
|
+
policyPermissionId: number;
|
|
12
|
+
conditionName: string;
|
|
13
|
+
conditionValue: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RbacPolicyPermission {
|
|
16
|
+
id: number;
|
|
17
|
+
policyId: number;
|
|
18
|
+
permission: string;
|
|
19
|
+
}
|
|
20
|
+
export interface RbacPolicy {
|
|
21
|
+
policyId: number;
|
|
22
|
+
isUserDefined: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface PrincipalRole {
|
|
25
|
+
principalId: number;
|
|
26
|
+
roleIds: number[];
|
|
27
|
+
}
|
|
28
|
+
export interface RbacCache {
|
|
29
|
+
roles?: RbacRole[];
|
|
30
|
+
policies?: RbacPolicy[];
|
|
31
|
+
rolePolicies?: RbacRolePolicy[];
|
|
32
|
+
policyPermissions?: RbacPolicyPermission[];
|
|
33
|
+
policyPermissionConditions?: RbacPolicyPermissionCondition[];
|
|
34
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { HttpMethod, SocketMethod } from "@clairejs/core";
|
|
2
|
-
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
3
|
-
import { IServerSocket } from "../../socket/IServerSocket";
|
|
4
|
-
import { IPrincipal } from "../../common/auth/IPrincipal";
|
|
5
|
-
export declare class HttpRequest {
|
|
6
|
-
private valueHolder;
|
|
7
|
-
private method;
|
|
8
|
-
private pathName;
|
|
9
|
-
private headers;
|
|
10
|
-
private cookies;
|
|
11
|
-
private params;
|
|
12
|
-
private query;
|
|
13
|
-
private body;
|
|
14
|
-
private hash;
|
|
15
|
-
private authInfo?;
|
|
16
|
-
constructor(options: {
|
|
17
|
-
method: HttpMethod | SocketMethod;
|
|
18
|
-
pathName: string;
|
|
19
|
-
headers?: object;
|
|
20
|
-
hash?: string;
|
|
21
|
-
query?: object;
|
|
22
|
-
params?: object;
|
|
23
|
-
cookies?: object;
|
|
24
|
-
body?: any;
|
|
25
|
-
socket?: IServerSocket;
|
|
26
|
-
}, endpointMetadata?: EndpointMetadata);
|
|
27
|
-
private jsonParsing;
|
|
28
|
-
getAuthInfo(): IPrincipal | undefined;
|
|
29
|
-
setAuthInfo(authInfo?: IPrincipal): void;
|
|
30
|
-
getHeaders(): any;
|
|
31
|
-
getMethod(): HttpMethod | SocketMethod;
|
|
32
|
-
getHash(): string;
|
|
33
|
-
getPathName(): string;
|
|
34
|
-
getValue<T extends any>(key: string): T;
|
|
35
|
-
setValue<T extends any>(key: string, value: T): void;
|
|
36
|
-
getParams<T extends any>(): T;
|
|
37
|
-
getQuery<T extends any>(): T;
|
|
38
|
-
getCookies<T extends any>(): T;
|
|
39
|
-
getBody<T extends any>(): T;
|
|
40
|
-
}
|
|
1
|
+
import { HttpMethod, SocketMethod } from "@clairejs/core";
|
|
2
|
+
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
3
|
+
import { IServerSocket } from "../../socket/IServerSocket";
|
|
4
|
+
import { IPrincipal } from "../../common/auth/IPrincipal";
|
|
5
|
+
export declare class HttpRequest {
|
|
6
|
+
private valueHolder;
|
|
7
|
+
private method;
|
|
8
|
+
private pathName;
|
|
9
|
+
private headers;
|
|
10
|
+
private cookies;
|
|
11
|
+
private params;
|
|
12
|
+
private query;
|
|
13
|
+
private body;
|
|
14
|
+
private hash;
|
|
15
|
+
private authInfo?;
|
|
16
|
+
constructor(options: {
|
|
17
|
+
method: HttpMethod | SocketMethod;
|
|
18
|
+
pathName: string;
|
|
19
|
+
headers?: object;
|
|
20
|
+
hash?: string;
|
|
21
|
+
query?: object;
|
|
22
|
+
params?: object;
|
|
23
|
+
cookies?: object;
|
|
24
|
+
body?: any;
|
|
25
|
+
socket?: IServerSocket;
|
|
26
|
+
}, endpointMetadata?: EndpointMetadata);
|
|
27
|
+
private jsonParsing;
|
|
28
|
+
getAuthInfo(): IPrincipal | undefined;
|
|
29
|
+
setAuthInfo(authInfo?: IPrincipal): void;
|
|
30
|
+
getHeaders(): any;
|
|
31
|
+
getMethod(): HttpMethod | SocketMethod;
|
|
32
|
+
getHash(): string;
|
|
33
|
+
getPathName(): string;
|
|
34
|
+
getValue<T extends any>(key: string): T;
|
|
35
|
+
setValue<T extends any>(key: string, value: T): void;
|
|
36
|
+
getParams<T extends any>(): T;
|
|
37
|
+
getQuery<T extends any>(): T;
|
|
38
|
+
getCookies<T extends any>(): T;
|
|
39
|
+
getBody<T extends any>(): T;
|
|
40
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export interface CookieOptions {
|
|
3
|
-
maxAge?: number | undefined;
|
|
4
|
-
expires?: Date | undefined;
|
|
5
|
-
httpOnly?: boolean | undefined;
|
|
6
|
-
path?: string | undefined;
|
|
7
|
-
domain?: string | undefined;
|
|
8
|
-
secure?: boolean | undefined;
|
|
9
|
-
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
|
10
|
-
}
|
|
11
|
-
export interface CookieValue {
|
|
12
|
-
value: string;
|
|
13
|
-
options?: CookieOptions;
|
|
14
|
-
}
|
|
15
|
-
export declare class HttpResponse<T> {
|
|
16
|
-
value?: T;
|
|
17
|
-
code?: number;
|
|
18
|
-
headers: Record<string, string>;
|
|
19
|
-
cookies: Record<string, CookieValue>;
|
|
20
|
-
}
|
|
21
|
-
export declare class ResponseBuilder<T> {
|
|
22
|
-
response: HttpResponse<T>;
|
|
23
|
-
protected constructor();
|
|
24
|
-
status(code: number): this;
|
|
25
|
-
header(name: string, value: string): this;
|
|
26
|
-
cookie(name: string, value: string, options?: CookieOptions): this;
|
|
27
|
-
get(): HttpResponse<T>;
|
|
28
|
-
static json<T>(jsonValue?: T): ResponseBuilder<T>;
|
|
29
|
-
static html(htmlValue?: string): ResponseBuilder<unknown>;
|
|
30
|
-
static binary(buffer?: Buffer): ResponseBuilder<unknown>;
|
|
31
|
-
static success(): HttpResponse<unknown>;
|
|
32
|
-
static notFound(data?: any): HttpResponse<unknown>;
|
|
33
|
-
static accessDenied(data?: any): HttpResponse<unknown>;
|
|
34
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export interface CookieOptions {
|
|
3
|
+
maxAge?: number | undefined;
|
|
4
|
+
expires?: Date | undefined;
|
|
5
|
+
httpOnly?: boolean | undefined;
|
|
6
|
+
path?: string | undefined;
|
|
7
|
+
domain?: string | undefined;
|
|
8
|
+
secure?: boolean | undefined;
|
|
9
|
+
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface CookieValue {
|
|
12
|
+
value: string;
|
|
13
|
+
options?: CookieOptions;
|
|
14
|
+
}
|
|
15
|
+
export declare class HttpResponse<T> {
|
|
16
|
+
value?: T;
|
|
17
|
+
code?: number;
|
|
18
|
+
headers: Record<string, string>;
|
|
19
|
+
cookies: Record<string, CookieValue>;
|
|
20
|
+
}
|
|
21
|
+
export declare class ResponseBuilder<T> {
|
|
22
|
+
response: HttpResponse<T>;
|
|
23
|
+
protected constructor();
|
|
24
|
+
status(code: number): this;
|
|
25
|
+
header(name: string, value: string): this;
|
|
26
|
+
cookie(name: string, value: string, options?: CookieOptions): this;
|
|
27
|
+
get(): HttpResponse<T>;
|
|
28
|
+
static json<T>(jsonValue?: T): ResponseBuilder<T>;
|
|
29
|
+
static html(htmlValue?: string): ResponseBuilder<unknown>;
|
|
30
|
+
static binary(buffer?: Buffer): ResponseBuilder<unknown>;
|
|
31
|
+
static success(): HttpResponse<unknown>;
|
|
32
|
+
static notFound(data?: any): HttpResponse<unknown>;
|
|
33
|
+
static accessDenied(data?: any): HttpResponse<unknown>;
|
|
34
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
2
|
-
import { ITransactionFactory, ITransactionProvider } from "@clairejs/orm";
|
|
3
|
-
export declare abstract class AbstractHttpController implements ITransactionProvider, ITransactionFactory {
|
|
4
|
-
protected readonly databaseAdapter: ITransactionFactory;
|
|
5
|
-
constructor(databaseAdapter: ITransactionFactory);
|
|
6
|
-
createTransaction(): Promise<import("@clairejs/orm").ITransaction>;
|
|
7
|
-
getCurrentTransaction(): Promise<import("@clairejs/orm").ITransaction>;
|
|
8
|
-
getEndpointMetadata(): Readonly<EndpointMetadata>[];
|
|
9
|
-
}
|
|
1
|
+
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
2
|
+
import { ITransactionFactory, ITransactionProvider } from "@clairejs/orm";
|
|
3
|
+
export declare abstract class AbstractHttpController implements ITransactionProvider, ITransactionFactory {
|
|
4
|
+
protected readonly databaseAdapter: ITransactionFactory;
|
|
5
|
+
constructor(databaseAdapter: ITransactionFactory);
|
|
6
|
+
createTransaction(): Promise<import("@clairejs/orm").ITransaction>;
|
|
7
|
+
getCurrentTransaction(): Promise<import("@clairejs/orm").ITransaction>;
|
|
8
|
+
getEndpointMetadata(): Readonly<EndpointMetadata>[];
|
|
9
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { HttpRequest } from "../common/HttpRequest";
|
|
2
|
-
import { HttpResponse } from "../common/HttpResponse";
|
|
3
|
-
export declare abstract class AbstractHttpMiddleware {
|
|
4
|
-
/**
|
|
5
|
-
* Return true to proceed to next middleware and controller, return false to immediately break and returning current response
|
|
6
|
-
* @param request the http request
|
|
7
|
-
* @param response the http response
|
|
8
|
-
*/
|
|
9
|
-
abstract intercept(request: HttpRequest, response: HttpResponse<any>): Promise<boolean>;
|
|
10
|
-
}
|
|
1
|
+
import { HttpRequest } from "../common/HttpRequest";
|
|
2
|
+
import { HttpResponse } from "../common/HttpResponse";
|
|
3
|
+
export declare abstract class AbstractHttpMiddleware {
|
|
4
|
+
/**
|
|
5
|
+
* Return true to proceed to next middleware and controller, return false to immediately break and returning current response
|
|
6
|
+
* @param request the http request
|
|
7
|
+
* @param response the http response
|
|
8
|
+
*/
|
|
9
|
+
abstract intercept(request: HttpRequest, response: HttpResponse<any>): Promise<boolean>;
|
|
10
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { AbstractLogger } from "@clairejs/core";
|
|
2
|
-
import { HttpData } from "../../common/request/HttpData";
|
|
3
|
-
import { MountedEndpointInfo } from "../../common/request/MountedEndpointInfo";
|
|
4
|
-
import { HttpResponse } from "../common/HttpResponse";
|
|
5
|
-
import { CorsConfig } from "../security/cors";
|
|
6
|
-
import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
|
|
7
|
-
import { ControllerMetadata } from "./ControllerMetadata";
|
|
8
|
-
export declare abstract class AbstractHttpRequestHandler {
|
|
9
|
-
readonly mountPoint: string;
|
|
10
|
-
readonly logger: AbstractLogger;
|
|
11
|
-
private mountedEndpointInfo?;
|
|
12
|
-
corsConfig?: CorsConfig;
|
|
13
|
-
constructor(mountPoint: string, logger: AbstractLogger);
|
|
14
|
-
protected resolverMountPoint(controllerMetadata: ControllerMetadata, mappingUrls: string[]): string;
|
|
15
|
-
getMountedEndpointInfo(): Promise<MountedEndpointInfo[]>;
|
|
16
|
-
abstract getMiddleware(): Promise<AbstractHttpMiddleware[]>;
|
|
17
|
-
abstract handle(httpData: HttpData): Promise<HttpResponse<any>>;
|
|
18
|
-
}
|
|
1
|
+
import { AbstractLogger } from "@clairejs/core";
|
|
2
|
+
import { HttpData } from "../../common/request/HttpData";
|
|
3
|
+
import { MountedEndpointInfo } from "../../common/request/MountedEndpointInfo";
|
|
4
|
+
import { HttpResponse } from "../common/HttpResponse";
|
|
5
|
+
import { CorsConfig } from "../security/cors";
|
|
6
|
+
import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
|
|
7
|
+
import { ControllerMetadata } from "./ControllerMetadata";
|
|
8
|
+
export declare abstract class AbstractHttpRequestHandler {
|
|
9
|
+
readonly mountPoint: string;
|
|
10
|
+
readonly logger: AbstractLogger;
|
|
11
|
+
private mountedEndpointInfo?;
|
|
12
|
+
corsConfig?: CorsConfig;
|
|
13
|
+
constructor(mountPoint: string, logger: AbstractLogger);
|
|
14
|
+
protected resolverMountPoint(controllerMetadata: ControllerMetadata, mappingUrls: string[]): string;
|
|
15
|
+
getMountedEndpointInfo(): Promise<MountedEndpointInfo[]>;
|
|
16
|
+
abstract getMiddleware(): Promise<AbstractHttpMiddleware[]>;
|
|
17
|
+
abstract handle(httpData: HttpData): Promise<HttpResponse<any>>;
|
|
18
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ObjectMetadata } from "@clairejs/core";
|
|
2
|
-
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
3
|
-
export interface ControllerMetadata extends ObjectMetadata {
|
|
4
|
-
fields: EndpointMetadata[];
|
|
5
|
-
permissionGroup?: string;
|
|
6
|
-
}
|
|
1
|
+
import { ObjectMetadata } from "@clairejs/core";
|
|
2
|
+
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
3
|
+
export interface ControllerMetadata extends ObjectMetadata {
|
|
4
|
+
fields: EndpointMetadata[];
|
|
5
|
+
permissionGroup?: string;
|
|
6
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { DtoMetadata, CreateManyResponseBody, GetManyResponseBody, UpdateManyResponse, Identifiable, Constructor } from "@clairejs/core";
|
|
2
|
-
import { IQueryProvider, ITransactionFactory } from "@clairejs/orm";
|
|
3
|
-
import { HttpRequest } from "../common/HttpRequest";
|
|
4
|
-
import { AbstractHttpController } from "./AbstractHttpController";
|
|
5
|
-
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
6
|
-
import { HttpResponse } from "../common/HttpResponse";
|
|
7
|
-
import { ICrudRepository } from "../repository/ICrudRepository";
|
|
8
|
-
export declare class CrudHttpController<T extends Identifiable> extends AbstractHttpController {
|
|
9
|
-
protected readonly model: Constructor<T>;
|
|
10
|
-
protected readonly crudRepository: ICrudRepository<T>;
|
|
11
|
-
protected readonly databaseAdapter: ITransactionFactory & IQueryProvider;
|
|
12
|
-
protected readonly modelMetadata: DtoMetadata;
|
|
13
|
-
private authProvider?;
|
|
14
|
-
constructor(model: Constructor<T>, crudRepository: ICrudRepository<T>, databaseAdapter: ITransactionFactory & IQueryProvider);
|
|
15
|
-
protected getMountedUrl(): string;
|
|
16
|
-
private getAuthProvider;
|
|
17
|
-
/**
|
|
18
|
-
* This provides endpoint metadata for mounting /POST request.
|
|
19
|
-
*/
|
|
20
|
-
private createManyEndpoinMetadata;
|
|
21
|
-
/**
|
|
22
|
-
* This provides endpoint metadata for mounting /GET request.
|
|
23
|
-
*/
|
|
24
|
-
private getManyEndpointMetadata;
|
|
25
|
-
/**
|
|
26
|
-
* This provides endpoint metadata for mounting /PUT request.
|
|
27
|
-
*/
|
|
28
|
-
private updateManyEndpoinMetadata;
|
|
29
|
-
/**
|
|
30
|
-
* This provides endpoint metadata for mounting /DELETE request.
|
|
31
|
-
*/
|
|
32
|
-
private deleteManyEndpoinMetadata;
|
|
33
|
-
/**
|
|
34
|
-
* Handler functions
|
|
35
|
-
*/
|
|
36
|
-
getEndpointMetadata(): Readonly<EndpointMetadata>[];
|
|
37
|
-
protected createMany(req: HttpRequest): Promise<HttpResponse<CreateManyResponseBody<T>>>;
|
|
38
|
-
protected getMany(req: HttpRequest): Promise<HttpResponse<GetManyResponseBody<T>>>;
|
|
39
|
-
protected updateMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
|
|
40
|
-
protected deleteMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
|
|
41
|
-
}
|
|
1
|
+
import { DtoMetadata, CreateManyResponseBody, GetManyResponseBody, UpdateManyResponse, Identifiable, Constructor } from "@clairejs/core";
|
|
2
|
+
import { IQueryProvider, ITransactionFactory } from "@clairejs/orm";
|
|
3
|
+
import { HttpRequest } from "../common/HttpRequest";
|
|
4
|
+
import { AbstractHttpController } from "./AbstractHttpController";
|
|
5
|
+
import { EndpointMetadata } from "../../common/request/EndpointMetadata";
|
|
6
|
+
import { HttpResponse } from "../common/HttpResponse";
|
|
7
|
+
import { ICrudRepository } from "../repository/ICrudRepository";
|
|
8
|
+
export declare class CrudHttpController<T extends Identifiable> extends AbstractHttpController {
|
|
9
|
+
protected readonly model: Constructor<T>;
|
|
10
|
+
protected readonly crudRepository: ICrudRepository<T>;
|
|
11
|
+
protected readonly databaseAdapter: ITransactionFactory & IQueryProvider;
|
|
12
|
+
protected readonly modelMetadata: DtoMetadata;
|
|
13
|
+
private authProvider?;
|
|
14
|
+
constructor(model: Constructor<T>, crudRepository: ICrudRepository<T>, databaseAdapter: ITransactionFactory & IQueryProvider);
|
|
15
|
+
protected getMountedUrl(): string;
|
|
16
|
+
private getAuthProvider;
|
|
17
|
+
/**
|
|
18
|
+
* This provides endpoint metadata for mounting /POST request.
|
|
19
|
+
*/
|
|
20
|
+
private createManyEndpoinMetadata;
|
|
21
|
+
/**
|
|
22
|
+
* This provides endpoint metadata for mounting /GET request.
|
|
23
|
+
*/
|
|
24
|
+
private getManyEndpointMetadata;
|
|
25
|
+
/**
|
|
26
|
+
* This provides endpoint metadata for mounting /PUT request.
|
|
27
|
+
*/
|
|
28
|
+
private updateManyEndpoinMetadata;
|
|
29
|
+
/**
|
|
30
|
+
* This provides endpoint metadata for mounting /DELETE request.
|
|
31
|
+
*/
|
|
32
|
+
private deleteManyEndpoinMetadata;
|
|
33
|
+
/**
|
|
34
|
+
* Handler functions
|
|
35
|
+
*/
|
|
36
|
+
getEndpointMetadata(): Readonly<EndpointMetadata>[];
|
|
37
|
+
protected createMany(req: HttpRequest): Promise<HttpResponse<CreateManyResponseBody<T>>>;
|
|
38
|
+
protected getMany(req: HttpRequest): Promise<HttpResponse<GetManyResponseBody<T>>>;
|
|
39
|
+
protected updateMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
|
|
40
|
+
protected deleteMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
|
|
41
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { AbstractLogger } from "@clairejs/core";
|
|
2
|
-
import { HttpResponse } from "../common/HttpResponse";
|
|
3
|
-
import { HttpRequest } from "../common/HttpRequest";
|
|
4
|
-
import { AbstractHttpAuthorizationProvider } from "../auth/AbstractHttpAuthorizationProvider";
|
|
5
|
-
import { MountedEndpointInfo } from "../../common/request/MountedEndpointInfo";
|
|
6
|
-
import { AbstractHttpRequestHandler } from "./AbstractHttpRequestHandler";
|
|
7
|
-
import { IPrincipal } from "../../common/auth/IPrincipal";
|
|
8
|
-
import { HttpData } from "../../common/request/HttpData";
|
|
9
|
-
import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
|
|
10
|
-
export declare class DefaultHttpRequestHandler extends AbstractHttpRequestHandler {
|
|
11
|
-
readonly logger: AbstractLogger;
|
|
12
|
-
readonly authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>;
|
|
13
|
-
private _middleware;
|
|
14
|
-
constructor(logger: AbstractLogger, authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>);
|
|
15
|
-
protected accessControl(endpoint: MountedEndpointInfo, req: HttpRequest): Promise<void>;
|
|
16
|
-
protected handleRequest(endpoint: MountedEndpointInfo, req: HttpRequest): Promise<HttpResponse<any>>;
|
|
17
|
-
exit(): void;
|
|
18
|
-
private getResponse;
|
|
19
|
-
handle(httpData: HttpData): Promise<HttpResponse<any>>;
|
|
20
|
-
getMiddleware(): Promise<AbstractHttpMiddleware[]>;
|
|
21
|
-
}
|
|
1
|
+
import { AbstractLogger } from "@clairejs/core";
|
|
2
|
+
import { HttpResponse } from "../common/HttpResponse";
|
|
3
|
+
import { HttpRequest } from "../common/HttpRequest";
|
|
4
|
+
import { AbstractHttpAuthorizationProvider } from "../auth/AbstractHttpAuthorizationProvider";
|
|
5
|
+
import { MountedEndpointInfo } from "../../common/request/MountedEndpointInfo";
|
|
6
|
+
import { AbstractHttpRequestHandler } from "./AbstractHttpRequestHandler";
|
|
7
|
+
import { IPrincipal } from "../../common/auth/IPrincipal";
|
|
8
|
+
import { HttpData } from "../../common/request/HttpData";
|
|
9
|
+
import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
|
|
10
|
+
export declare class DefaultHttpRequestHandler extends AbstractHttpRequestHandler {
|
|
11
|
+
readonly logger: AbstractLogger;
|
|
12
|
+
readonly authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>;
|
|
13
|
+
private _middleware;
|
|
14
|
+
constructor(logger: AbstractLogger, authorizationProvider: AbstractHttpAuthorizationProvider<IPrincipal>);
|
|
15
|
+
protected accessControl(endpoint: MountedEndpointInfo, req: HttpRequest): Promise<void>;
|
|
16
|
+
protected handleRequest(endpoint: MountedEndpointInfo, req: HttpRequest): Promise<HttpResponse<any>>;
|
|
17
|
+
exit(): void;
|
|
18
|
+
private getResponse;
|
|
19
|
+
handle(httpData: HttpData): Promise<HttpResponse<any>>;
|
|
20
|
+
getMiddleware(): Promise<AbstractHttpMiddleware[]>;
|
|
21
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { HttpMethod, Constructor, AbstractModel } from "@clairejs/core";
|
|
2
|
-
import { AbstractHttpController } from "./controller/AbstractHttpController";
|
|
3
|
-
import { AbstractAccessCondition } from "./security/AbstractAccessCondition";
|
|
4
|
-
import { HttpResponse } from "./common/HttpResponse";
|
|
5
|
-
import { UriMapperHandler } from "./file-upload/types";
|
|
6
|
-
import { IPrincipal } from "../common/auth/IPrincipal";
|
|
7
|
-
declare type HttpFunctionMethod<T> = (...args: any[]) => Promise<HttpResponse<T>>;
|
|
8
|
-
export declare const Controller: (config?: {
|
|
9
|
-
permissionGroup?: string | undefined;
|
|
10
|
-
} | undefined) => <T extends AbstractHttpController>(constructor: Constructor<T>) => void;
|
|
11
|
-
export declare const ApiDescription: (description: string) => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
12
|
-
export declare const Endpoint: (config: {
|
|
13
|
-
method: HttpMethod;
|
|
14
|
-
url: string;
|
|
15
|
-
}) => (prototype: any, propertyKey: string) => void;
|
|
16
|
-
export declare const Post: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
17
|
-
export declare const Put: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
18
|
-
export declare const Del: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
19
|
-
export declare const Get: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
20
|
-
export declare const ApiResponse: <T>(responseClass: Constructor<T>) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<T>>) => void;
|
|
21
|
-
export declare const OpenAccess: () => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
22
|
-
export declare const TfaRequired: () => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
23
|
-
export declare const AccessCondition: (conditions: Constructor<AbstractAccessCondition>[]) => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
24
|
-
export declare const Body: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
25
|
-
export declare const Params: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
26
|
-
export declare const Queries: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
27
|
-
export declare const Headers: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
28
|
-
export declare const Socket: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
29
|
-
export declare const Raw: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
30
|
-
export declare const UriMapper: <T extends AbstractModel>(mapper: UriMapperHandler<T>) => (prototype: T, propertyKey: keyof T) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Current User decorator only has effect when being used with ICrudRepository.
|
|
33
|
-
* */
|
|
34
|
-
export declare const CurrentUser: <T extends IPrincipal>(resolver: (principal: T) => any) => (prototype: any, propertyKey: string) => void;
|
|
35
|
-
export {};
|
|
1
|
+
import { HttpMethod, Constructor, AbstractModel } from "@clairejs/core";
|
|
2
|
+
import { AbstractHttpController } from "./controller/AbstractHttpController";
|
|
3
|
+
import { AbstractAccessCondition } from "./security/AbstractAccessCondition";
|
|
4
|
+
import { HttpResponse } from "./common/HttpResponse";
|
|
5
|
+
import { UriMapperHandler } from "./file-upload/types";
|
|
6
|
+
import { IPrincipal } from "../common/auth/IPrincipal";
|
|
7
|
+
declare type HttpFunctionMethod<T> = (...args: any[]) => Promise<HttpResponse<T>>;
|
|
8
|
+
export declare const Controller: (config?: {
|
|
9
|
+
permissionGroup?: string | undefined;
|
|
10
|
+
} | undefined) => <T extends AbstractHttpController>(constructor: Constructor<T>) => void;
|
|
11
|
+
export declare const ApiDescription: (description: string) => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
12
|
+
export declare const Endpoint: (config: {
|
|
13
|
+
method: HttpMethod;
|
|
14
|
+
url: string;
|
|
15
|
+
}) => (prototype: any, propertyKey: string) => void;
|
|
16
|
+
export declare const Post: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
17
|
+
export declare const Put: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
18
|
+
export declare const Del: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
19
|
+
export declare const Get: (url: string) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<any>>) => void;
|
|
20
|
+
export declare const ApiResponse: <T>(responseClass: Constructor<T>) => (prototype: AbstractHttpController, propertyKey: string, _descriptor: TypedPropertyDescriptor<HttpFunctionMethod<T>>) => void;
|
|
21
|
+
export declare const OpenAccess: () => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
22
|
+
export declare const TfaRequired: () => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
23
|
+
export declare const AccessCondition: (conditions: Constructor<AbstractAccessCondition>[]) => (prototype: AbstractHttpController, propertyKey: string) => void;
|
|
24
|
+
export declare const Body: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
25
|
+
export declare const Params: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
26
|
+
export declare const Queries: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
27
|
+
export declare const Headers: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
28
|
+
export declare const Socket: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
29
|
+
export declare const Raw: () => (prototype: AbstractHttpController, propertyKey: string, paramIndex: number) => void;
|
|
30
|
+
export declare const UriMapper: <T extends AbstractModel>(mapper: UriMapperHandler<T>) => (prototype: T, propertyKey: keyof T) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Current User decorator only has effect when being used with ICrudRepository.
|
|
33
|
+
* */
|
|
34
|
+
export declare const CurrentUser: <T extends IPrincipal>(resolver: (principal: T) => any) => (prototype: any, propertyKey: string) => void;
|
|
35
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare abstract class AbstractFileUploadHandler {
|
|
2
|
-
abstract moveFile(fromUri: string, toUri: string): Promise<void>;
|
|
3
|
-
abstract removeFile(uri: string): Promise<void>;
|
|
4
|
-
abstract resolvePublicUrl(uri: string): Promise<string>;
|
|
5
|
-
abstract resolvePrivateUrl(uri: string): Promise<string>;
|
|
6
|
-
}
|
|
1
|
+
export declare abstract class AbstractFileUploadHandler {
|
|
2
|
+
abstract moveFile(fromUri: string, toUri: string): Promise<void>;
|
|
3
|
+
abstract removeFile(uri: string): Promise<void>;
|
|
4
|
+
abstract resolvePublicUrl(uri: string): Promise<string>;
|
|
5
|
+
abstract resolvePrivateUrl(uri: string): Promise<string>;
|
|
6
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AbstractFileService } from "../../services/AbstractFileService";
|
|
2
|
-
import { AbstractFileUploadHandler } from "./AbstractFileUploadHandler";
|
|
3
|
-
export declare class FileUploadHandler extends AbstractFileUploadHandler {
|
|
4
|
-
readonly fileService: AbstractFileService;
|
|
5
|
-
constructor(fileService: AbstractFileService);
|
|
6
|
-
moveFile(fromURI: string, toURI: string): Promise<void>;
|
|
7
|
-
removeFile(uri: string): Promise<void>;
|
|
8
|
-
resolvePublicUrl(uri: string): Promise<string>;
|
|
9
|
-
resolvePrivateUrl(uri: string): Promise<string>;
|
|
10
|
-
}
|
|
1
|
+
import { AbstractFileService } from "../../services/AbstractFileService";
|
|
2
|
+
import { AbstractFileUploadHandler } from "./AbstractFileUploadHandler";
|
|
3
|
+
export declare class FileUploadHandler extends AbstractFileUploadHandler {
|
|
4
|
+
readonly fileService: AbstractFileService;
|
|
5
|
+
constructor(fileService: AbstractFileService);
|
|
6
|
+
moveFile(fromURI: string, toURI: string): Promise<void>;
|
|
7
|
+
removeFile(uri: string): Promise<void>;
|
|
8
|
+
resolvePublicUrl(uri: string): Promise<string>;
|
|
9
|
+
resolvePrivateUrl(uri: string): Promise<string>;
|
|
10
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AbstractModel } from "@clairejs/core";
|
|
2
|
-
import { IQueryProvider } from "@clairejs/orm";
|
|
3
|
-
export declare type UriMapperHandler<T extends AbstractModel> = (queryProvider: IQueryProvider, record: T, tmpUri: string) => Promise<string>;
|
|
1
|
+
import { AbstractModel } from "@clairejs/core";
|
|
2
|
+
import { IQueryProvider } from "@clairejs/orm";
|
|
3
|
+
export declare type UriMapperHandler<T extends AbstractModel> = (queryProvider: IQueryProvider, record: T, tmpUri: string) => Promise<string>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Constructor, DeepPartial, Identifiable } from "@clairejs/core";
|
|
2
|
-
import { ServerModelMetadata } from "../../common/ServerModelMetadata";
|
|
3
|
-
import { IPrincipal } from "../../common/auth/IPrincipal";
|
|
4
|
-
export declare abstract class AbstractRepository<T extends Identifiable> {
|
|
5
|
-
readonly model: Constructor<T>;
|
|
6
|
-
protected readonly modelMetadata: ServerModelMetadata;
|
|
7
|
-
constructor(model: Constructor<T>);
|
|
8
|
-
protected beforeCreating(principal: IPrincipal | undefined, records: DeepPartial<T>[]): Promise<void>;
|
|
9
|
-
protected project(records: Partial<T>[], projection?: (keyof T)[]): any[];
|
|
10
|
-
}
|
|
1
|
+
import { Constructor, DeepPartial, Identifiable } from "@clairejs/core";
|
|
2
|
+
import { ServerModelMetadata } from "../../common/ServerModelMetadata";
|
|
3
|
+
import { IPrincipal } from "../../common/auth/IPrincipal";
|
|
4
|
+
export declare abstract class AbstractRepository<T extends Identifiable> {
|
|
5
|
+
readonly model: Constructor<T>;
|
|
6
|
+
protected readonly modelMetadata: ServerModelMetadata;
|
|
7
|
+
constructor(model: Constructor<T>);
|
|
8
|
+
protected beforeCreating(principal: IPrincipal | undefined, records: DeepPartial<T>[]): Promise<void>;
|
|
9
|
+
protected project(records: Partial<T>[], projection?: (keyof T)[]): any[];
|
|
10
|
+
}
|