@clairejs/server 3.0.18 → 3.0.22

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.
Files changed (57) hide show
  1. package/README.md +491 -483
  2. package/dist/common/constants.d.ts +1 -1
  3. package/dist/database/adapter/AbstractDatabaseAdapter.d.ts +19 -19
  4. package/dist/database/adapter/AbstractQuery.d.ts +52 -52
  5. package/dist/database/adapter/DefaultSqlDatabaseAdapter.d.ts +18 -18
  6. package/dist/database/adapter/IDatabaseProvider.d.ts +4 -4
  7. package/dist/database/adapter/IQuery.d.ts +75 -75
  8. package/dist/database/adapter/IQueryProvider.d.ts +9 -9
  9. package/dist/database/adapter/aggregators.d.ts +21 -21
  10. package/dist/database/adapter/providers.d.ts +8 -8
  11. package/dist/database/decorators.d.ts +2 -2
  12. package/dist/database/migrator/AbstractDatabaseMigrator.d.ts +4 -4
  13. package/dist/database/migrator/DefaultSqlDatabaseMigrator.d.ts +28 -28
  14. package/dist/database/transaction/ITransaction.d.ts +10 -10
  15. package/dist/database/transaction/ITransactionProvider.d.ts +4 -4
  16. package/dist/database/transaction/TransactionLink.d.ts +14 -14
  17. package/dist/database/transaction/TransactionObjectMetadata.d.ts +4 -4
  18. package/dist/database/transaction/TransactionState.d.ts +5 -5
  19. package/dist/database/util/transaction-provider.d.ts +1 -1
  20. package/dist/http/common/HttpRequest.d.ts +39 -39
  21. package/dist/http/common/HttpResponse.d.ts +25 -25
  22. package/dist/http/common/RequestOptions.d.ts +9 -9
  23. package/dist/http/common/ResponseValues.d.ts +10 -10
  24. package/dist/http/common/types.d.ts +1 -1
  25. package/dist/http/controller/AbstractHttpController.d.ts +12 -12
  26. package/dist/http/controller/AbstractHttpMiddleware.d.ts +5 -5
  27. package/dist/http/controller/AbstractHttpRequestHandler.d.ts +10 -10
  28. package/dist/http/controller/ControllerMetadata.d.ts +6 -6
  29. package/dist/http/controller/CrudHttpController.d.ts +58 -58
  30. package/dist/http/controller/DefaultHttpRequestHandler.d.ts +19 -19
  31. package/dist/http/controller/EndpointMetadata.d.ts +36 -36
  32. package/dist/http/controller/HttpEndpoint.d.ts +12 -12
  33. package/dist/http/controller/ModelRepository.d.ts +36 -36
  34. package/dist/http/controller/MountedEndpointInfo.d.ts +6 -6
  35. package/dist/http/decorators.d.ts +26 -26
  36. package/dist/http/security/AbstractAccessCondition.d.ts +7 -7
  37. package/dist/http/security/AbstractHttpAuthorizationProvider.d.ts +7 -7
  38. package/dist/http/security/IPrincipal.d.ts +3 -3
  39. package/dist/http/security/access-conditions/FilterModelFieldAccessCondition.d.ts +4 -4
  40. package/dist/http/security/access-conditions/OwnedResourceAccessCondition.d.ts +5 -5
  41. package/dist/index.d.ts +38 -38
  42. package/dist/index.js +1 -1
  43. package/dist/logging/FileLogMedium.d.ts +13 -13
  44. package/dist/service/AbstractService.d.ts +9 -9
  45. package/dist/socket/AbstractServerSocket.d.ts +36 -36
  46. package/dist/socket/AbstractServerSocketManager.d.ts +19 -19
  47. package/dist/socket/AwsSocketManager.d.ts +46 -46
  48. package/dist/socket/IServerSocket.d.ts +9 -9
  49. package/dist/socket/LocalSocketManager.d.ts +23 -23
  50. package/dist/socket/ServerSocket.d.ts +14 -14
  51. package/dist/system/AbstractFileUploadHandler.d.ts +6 -6
  52. package/dist/system/ClaireServer.d.ts +10 -10
  53. package/dist/system/ExpressWrapper.d.ts +17 -17
  54. package/dist/system/IRequestHandler.d.ts +5 -5
  55. package/dist/system/LambdaWrapper.d.ts +17 -17
  56. package/dist/system/ServerGlobalStore.d.ts +5 -5
  57. package/package.json +59 -60
@@ -1,39 +1,39 @@
1
- import { HttpMethod, SocketMethod } from "@clairejs/core";
2
- import { EndpointMetadata } from "../controller/EndpointMetadata";
3
- import { IServerSocket } from "../../socket/IServerSocket";
4
- import { IPrincipal } from "../security/IPrincipal";
5
- export declare class HttpRequest {
6
- private valueHolder;
7
- private method;
8
- private pathName;
9
- private headers;
10
- private params;
11
- private query;
12
- private body;
13
- private hash;
14
- private socket?;
15
- private authInfo?;
16
- constructor(options: {
17
- method: HttpMethod | SocketMethod;
18
- pathName: string;
19
- headers?: any;
20
- hash?: string;
21
- query?: any;
22
- params?: any;
23
- body?: any;
24
- socket?: IServerSocket;
25
- }, endpointMetadata?: EndpointMetadata);
26
- private jsonParsing;
27
- getAuthInfo(): IPrincipal | undefined;
28
- setAuthInfo(authInfo?: IPrincipal): void;
29
- getHeaders(): any;
30
- getMethod(): HttpMethod | SocketMethod;
31
- getHash(): string;
32
- getPathName(): string;
33
- getValue<T extends any>(key: string): T;
34
- setValue<T extends any>(key: string, value: T): void;
35
- getParams<T extends any>(): T;
36
- getQuery<T extends any>(): T;
37
- getBody<T extends any>(): T;
38
- getSocket(): IServerSocket;
39
- }
1
+ import { HttpMethod, SocketMethod } from "@clairejs/core";
2
+ import { EndpointMetadata } from "../controller/EndpointMetadata";
3
+ import { IServerSocket } from "../../socket/IServerSocket";
4
+ import { IPrincipal } from "../security/IPrincipal";
5
+ export declare class HttpRequest {
6
+ private valueHolder;
7
+ private method;
8
+ private pathName;
9
+ private headers;
10
+ private params;
11
+ private query;
12
+ private body;
13
+ private hash;
14
+ private socket?;
15
+ private authInfo?;
16
+ constructor(options: {
17
+ method: HttpMethod | SocketMethod;
18
+ pathName: string;
19
+ headers?: any;
20
+ hash?: string;
21
+ query?: any;
22
+ params?: any;
23
+ body?: any;
24
+ socket?: IServerSocket;
25
+ }, endpointMetadata?: EndpointMetadata);
26
+ private jsonParsing;
27
+ getAuthInfo(): IPrincipal | undefined;
28
+ setAuthInfo(authInfo?: IPrincipal): void;
29
+ getHeaders(): any;
30
+ getMethod(): HttpMethod | SocketMethod;
31
+ getHash(): string;
32
+ getPathName(): string;
33
+ getValue<T extends any>(key: string): T;
34
+ setValue<T extends any>(key: string, value: T): void;
35
+ getParams<T extends any>(): T;
36
+ getQuery<T extends any>(): T;
37
+ getBody<T extends any>(): T;
38
+ getSocket(): IServerSocket;
39
+ }
@@ -1,25 +1,25 @@
1
- /// <reference types="node" />
2
- declare type Dict = {
3
- [key: string]: string;
4
- };
5
- export declare class HttpResponse<T> {
6
- value?: T;
7
- code: number;
8
- headers: Dict;
9
- cookies: Dict;
10
- }
11
- export declare class ResponseBuilder<T> {
12
- response: HttpResponse<T>;
13
- protected constructor();
14
- status(code: number): this;
15
- header(name: string, value: string): this;
16
- cookie(name: string, value: string): this;
17
- get(): HttpResponse<T>;
18
- static json<T>(jsonValue?: T): ResponseBuilder<T>;
19
- static html(htmlValue?: string): ResponseBuilder<unknown>;
20
- static binary(buffer?: Buffer): ResponseBuilder<unknown>;
21
- static success(): HttpResponse<unknown>;
22
- static notFound(data?: any): HttpResponse<unknown>;
23
- static accessDenied(data?: any): HttpResponse<unknown>;
24
- }
25
- export {};
1
+ /// <reference types="node" />
2
+ declare type Dict = {
3
+ [key: string]: string;
4
+ };
5
+ export declare class HttpResponse<T> {
6
+ value?: T;
7
+ code: number;
8
+ headers: Dict;
9
+ cookies: Dict;
10
+ }
11
+ export declare class ResponseBuilder<T> {
12
+ response: HttpResponse<T>;
13
+ protected constructor();
14
+ status(code: number): this;
15
+ header(name: string, value: string): this;
16
+ cookie(name: string, value: string): this;
17
+ get(): HttpResponse<T>;
18
+ static json<T>(jsonValue?: T): ResponseBuilder<T>;
19
+ static html(htmlValue?: string): ResponseBuilder<unknown>;
20
+ static binary(buffer?: Buffer): ResponseBuilder<unknown>;
21
+ static success(): HttpResponse<unknown>;
22
+ static notFound(data?: any): HttpResponse<unknown>;
23
+ static accessDenied(data?: any): HttpResponse<unknown>;
24
+ }
25
+ export {};
@@ -1,9 +1,9 @@
1
- import { HttpMethod, SocketMethod } from "@clairejs/core";
2
- import { IServerSocket } from "../../socket/IServerSocket";
3
- export interface RequestOptions {
4
- method: HttpMethod | SocketMethod;
5
- rawPath: string;
6
- headers?: any;
7
- body?: any;
8
- socket?: IServerSocket;
9
- }
1
+ import { HttpMethod, SocketMethod } from "@clairejs/core";
2
+ import { IServerSocket } from "../../socket/IServerSocket";
3
+ export interface RequestOptions {
4
+ method: HttpMethod | SocketMethod;
5
+ rawPath: string;
6
+ headers?: any;
7
+ body?: any;
8
+ socket?: IServerSocket;
9
+ }
@@ -1,10 +1,10 @@
1
- export interface ResponseValues {
2
- headers?: {
3
- [key: string]: string;
4
- };
5
- body?: any;
6
- code: number;
7
- cookies?: {
8
- [key: string]: string;
9
- };
10
- }
1
+ export interface ResponseValues {
2
+ headers?: {
3
+ [key: string]: string;
4
+ };
5
+ body?: any;
6
+ code: number;
7
+ cookies?: {
8
+ [key: string]: string;
9
+ };
10
+ }
@@ -1 +1 @@
1
- export declare type RequestDataSource = "body" | "params" | "queries" | "headers" | "raw";
1
+ export declare type RequestDataSource = "body" | "params" | "queries" | "headers" | "raw";
@@ -1,12 +1,12 @@
1
- import { EndpointMetadata } from "./EndpointMetadata";
2
- import { ITransactionProvider } from "../../database/transaction/ITransactionProvider";
3
- import { IDatabaseProvider } from "../../database/adapter/IDatabaseProvider";
4
- import { AbstractDatabaseAdapter } from "../../database/adapter/AbstractDatabaseAdapter";
5
- export declare abstract class AbstractHttpController implements ITransactionProvider, IDatabaseProvider {
6
- protected readonly databaseAdapter: AbstractDatabaseAdapter;
7
- constructor(databaseAdapter: AbstractDatabaseAdapter);
8
- private isEndpoint;
9
- getCurrentDatabaseAdapter(): Promise<AbstractDatabaseAdapter>;
10
- getCurrentTransaction(): Promise<import("../../database/transaction/ITransaction").ITransaction>;
11
- getEndpointMetadata(): Readonly<EndpointMetadata>[];
12
- }
1
+ import { EndpointMetadata } from "./EndpointMetadata";
2
+ import { ITransactionProvider } from "../../database/transaction/ITransactionProvider";
3
+ import { IDatabaseProvider } from "../../database/adapter/IDatabaseProvider";
4
+ import { AbstractDatabaseAdapter } from "../../database/adapter/AbstractDatabaseAdapter";
5
+ export declare abstract class AbstractHttpController implements ITransactionProvider, IDatabaseProvider {
6
+ protected readonly databaseAdapter: AbstractDatabaseAdapter;
7
+ constructor(databaseAdapter: AbstractDatabaseAdapter);
8
+ private isEndpoint;
9
+ getCurrentDatabaseAdapter(): Promise<AbstractDatabaseAdapter>;
10
+ getCurrentTransaction(): Promise<import("../../database/transaction/ITransaction").ITransaction>;
11
+ getEndpointMetadata(): Readonly<EndpointMetadata>[];
12
+ }
@@ -1,5 +1,5 @@
1
- import { HttpRequest } from "../common/HttpRequest";
2
- import { HttpResponse } from "../common/HttpResponse";
3
- export declare abstract class AbstractHttpMiddleware {
4
- abstract intercept(request: HttpRequest): Promise<HttpResponse<any> | undefined>;
5
- }
1
+ import { HttpRequest } from "../common/HttpRequest";
2
+ import { HttpResponse } from "../common/HttpResponse";
3
+ export declare abstract class AbstractHttpMiddleware {
4
+ abstract intercept(request: HttpRequest): Promise<HttpResponse<any> | undefined>;
5
+ }
@@ -1,10 +1,10 @@
1
- import { IRequestHandler } from "../../system/IRequestHandler";
2
- import { RequestOptions } from "../common/RequestOptions";
3
- import { ResponseValues } from "../common/ResponseValues";
4
- import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
5
- import { ControllerMetadata } from "./ControllerMetadata";
6
- export declare abstract class AbstractHttpRequestHandler implements IRequestHandler {
7
- abstract getMiddleware(): Readonly<AbstractHttpMiddleware[]>;
8
- protected resolverMountPoint(controllerMetadata: ControllerMetadata, mappingUrls: string[]): string;
9
- abstract handle(options: RequestOptions): Promise<ResponseValues>;
10
- }
1
+ import { IRequestHandler } from "../../system/IRequestHandler";
2
+ import { RequestOptions } from "../common/RequestOptions";
3
+ import { ResponseValues } from "../common/ResponseValues";
4
+ import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
5
+ import { ControllerMetadata } from "./ControllerMetadata";
6
+ export declare abstract class AbstractHttpRequestHandler implements IRequestHandler {
7
+ abstract getMiddleware(): Readonly<AbstractHttpMiddleware[]>;
8
+ protected resolverMountPoint(controllerMetadata: ControllerMetadata, mappingUrls: string[]): string;
9
+ abstract handle(options: RequestOptions): Promise<ResponseValues>;
10
+ }
@@ -1,6 +1,6 @@
1
- import { ObjectMetadata } from "@clairejs/core";
2
- import { EndpointMetadata } from "./EndpointMetadata";
3
- export interface ControllerMetadata extends ObjectMetadata {
4
- fields: EndpointMetadata[];
5
- permissionGroup?: string;
6
- }
1
+ import { ObjectMetadata } from "@clairejs/core";
2
+ import { EndpointMetadata } from "./EndpointMetadata";
3
+ export interface ControllerMetadata extends ObjectMetadata {
4
+ fields: EndpointMetadata[];
5
+ permissionGroup?: string;
6
+ }
@@ -1,58 +1,58 @@
1
- import { ModelMetadata, AbstractModel, CreateManyResponseBody, GetManyResponseBody, UpdateManyResponse, Constructor } from "@clairejs/core";
2
- import { HttpRequest } from "../common/HttpRequest";
3
- import { AbstractHttpController } from "./AbstractHttpController";
4
- import { EndpointMetadata } from "./EndpointMetadata";
5
- import { AbstractDatabaseAdapter } from "../../database/adapter/AbstractDatabaseAdapter";
6
- import { HttpResponse } from "../common/HttpResponse";
7
- export declare class CrudHttpController<T extends AbstractModel> extends AbstractHttpController {
8
- protected readonly model: Constructor<T>;
9
- protected readonly databaseAdapter: AbstractDatabaseAdapter;
10
- protected readonly modelMetadata: ModelMetadata;
11
- private authProvider?;
12
- constructor(model: Constructor<T>, databaseAdapter: AbstractDatabaseAdapter);
13
- private getMountedUrl;
14
- private static queryFieldDto;
15
- private static queryOpsDto;
16
- private static projectionFieldDto;
17
- private static getBodyDtoRecordClass;
18
- private static getRequestQueryFieldFromModel;
19
- private getAuthProvider;
20
- /**
21
- * This provides endpoint metadata for mounting /POST request.
22
- */
23
- private createManyEndpoinMetadata;
24
- /**
25
- * This provides endpoint metadata for mounting /GET request.
26
- */
27
- private getManyEndpointMetadata;
28
- /**
29
- * This provides endpoint metadata for mounting /PUT request.
30
- */
31
- private updateManyEndpoinMetadata;
32
- /**
33
- * This provides endpoint metadata for mounting /DELETE request.
34
- */
35
- private deleteManyEndpoinMetadata;
36
- /**
37
- * These static function is used to provider validator class
38
- */
39
- private static getCreateManyBodyValidator;
40
- private static getCreateManyResponseValidator;
41
- private static getGetManyResponseValidator;
42
- private static getGetManyQueryValidator;
43
- private static getUpdateManyQueryValidator;
44
- private static getUpdateManyBodyValidator;
45
- private static getUpdateManyResponseValidator;
46
- static createManyBodyValidator(model: Constructor<AbstractModel>): Function;
47
- static getManyQueryValidator(model: Constructor<AbstractModel>): Function;
48
- static updateManyQueryValidator(model: Constructor<AbstractModel>): Function;
49
- static updateManyBodyValidator(model: Constructor<AbstractModel>): Function;
50
- /**
51
- * Handler functions
52
- */
53
- getEndpointMetadata(): Readonly<EndpointMetadata>[];
54
- protected createMany(req: HttpRequest): Promise<HttpResponse<CreateManyResponseBody<T>>>;
55
- protected getMany(req: HttpRequest): Promise<HttpResponse<GetManyResponseBody<T>>>;
56
- protected updateMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
57
- protected deleteMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
58
- }
1
+ import { ModelMetadata, AbstractModel, CreateManyResponseBody, GetManyResponseBody, UpdateManyResponse, Constructor } from "@clairejs/core";
2
+ import { HttpRequest } from "../common/HttpRequest";
3
+ import { AbstractHttpController } from "./AbstractHttpController";
4
+ import { EndpointMetadata } from "./EndpointMetadata";
5
+ import { AbstractDatabaseAdapter } from "../../database/adapter/AbstractDatabaseAdapter";
6
+ import { HttpResponse } from "../common/HttpResponse";
7
+ export declare class CrudHttpController<T extends AbstractModel> extends AbstractHttpController {
8
+ protected readonly model: Constructor<T>;
9
+ protected readonly databaseAdapter: AbstractDatabaseAdapter;
10
+ protected readonly modelMetadata: ModelMetadata;
11
+ private authProvider?;
12
+ constructor(model: Constructor<T>, databaseAdapter: AbstractDatabaseAdapter);
13
+ private getMountedUrl;
14
+ private static queryFieldDto;
15
+ private static queryOpsDto;
16
+ private static projectionFieldDto;
17
+ private static getBodyDtoRecordClass;
18
+ private static getRequestQueryFieldFromModel;
19
+ private getAuthProvider;
20
+ /**
21
+ * This provides endpoint metadata for mounting /POST request.
22
+ */
23
+ private createManyEndpoinMetadata;
24
+ /**
25
+ * This provides endpoint metadata for mounting /GET request.
26
+ */
27
+ private getManyEndpointMetadata;
28
+ /**
29
+ * This provides endpoint metadata for mounting /PUT request.
30
+ */
31
+ private updateManyEndpoinMetadata;
32
+ /**
33
+ * This provides endpoint metadata for mounting /DELETE request.
34
+ */
35
+ private deleteManyEndpoinMetadata;
36
+ /**
37
+ * These static function is used to provider validator class
38
+ */
39
+ private static getCreateManyBodyValidator;
40
+ private static getCreateManyResponseValidator;
41
+ private static getGetManyResponseValidator;
42
+ private static getGetManyQueryValidator;
43
+ private static getUpdateManyQueryValidator;
44
+ private static getUpdateManyBodyValidator;
45
+ private static getUpdateManyResponseValidator;
46
+ static createManyBodyValidator(model: Constructor<AbstractModel>): Function;
47
+ static getManyQueryValidator(model: Constructor<AbstractModel>): Function;
48
+ static updateManyQueryValidator(model: Constructor<AbstractModel>): Function;
49
+ static updateManyBodyValidator(model: Constructor<AbstractModel>): Function;
50
+ /**
51
+ * Handler functions
52
+ */
53
+ getEndpointMetadata(): Readonly<EndpointMetadata>[];
54
+ protected createMany(req: HttpRequest): Promise<HttpResponse<CreateManyResponseBody<T>>>;
55
+ protected getMany(req: HttpRequest): Promise<HttpResponse<GetManyResponseBody<T>>>;
56
+ protected updateMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
57
+ protected deleteMany(req: HttpRequest): Promise<HttpResponse<UpdateManyResponse<T>>>;
58
+ }
@@ -1,19 +1,19 @@
1
- import { AbstractLogger, IInit } from "@clairejs/core";
2
- import { RequestOptions } from "../common/RequestOptions";
3
- import { ResponseValues } from "../common/ResponseValues";
4
- import { AbstractHttpAuthorizationProvider } from "../security/AbstractHttpAuthorizationProvider";
5
- import { AbstractHttpRequestHandler } from "./AbstractHttpRequestHandler";
6
- import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
7
- export declare class DefaultHttpRequestHandler extends AbstractHttpRequestHandler implements IInit {
8
- private logger;
9
- private authorizationProvider;
10
- private readonly injector;
11
- private readonly middleware;
12
- private mountPoint?;
13
- private mountedEndpointInfo;
14
- constructor(logger: AbstractLogger, authorizationProvider: AbstractHttpAuthorizationProvider<any>);
15
- init(): Promise<void>;
16
- exit(): void;
17
- handle(options: RequestOptions): Promise<ResponseValues>;
18
- getMiddleware(): AbstractHttpMiddleware[];
19
- }
1
+ import { AbstractLogger, IInit } from "@clairejs/core";
2
+ import { RequestOptions } from "../common/RequestOptions";
3
+ import { ResponseValues } from "../common/ResponseValues";
4
+ import { AbstractHttpAuthorizationProvider } from "../security/AbstractHttpAuthorizationProvider";
5
+ import { AbstractHttpRequestHandler } from "./AbstractHttpRequestHandler";
6
+ import { AbstractHttpMiddleware } from "./AbstractHttpMiddleware";
7
+ export declare class DefaultHttpRequestHandler extends AbstractHttpRequestHandler implements IInit {
8
+ private logger;
9
+ private authorizationProvider;
10
+ private readonly injector;
11
+ private readonly middleware;
12
+ private mountPoint?;
13
+ private mountedEndpointInfo;
14
+ constructor(logger: AbstractLogger, authorizationProvider: AbstractHttpAuthorizationProvider<any>);
15
+ init(): Promise<void>;
16
+ exit(): void;
17
+ handle(options: RequestOptions): Promise<ResponseValues>;
18
+ getMiddleware(): AbstractHttpMiddleware[];
19
+ }
@@ -1,36 +1,36 @@
1
- import { Constructor, DtoMetadata, HttpMethod, SocketMethod, ObjectFieldMetadata } from "@clairejs/core";
2
- import { RequestDataSource } from "../common/types";
3
- import { AbstractAccessCondition } from "../security/AbstractAccessCondition";
4
- export interface EndpointMetadata extends ObjectFieldMetadata {
5
- /**
6
- * Basic HTTP information, name property is handler function name.
7
- */
8
- httpMethod: HttpMethod | SocketMethod;
9
- url: string;
10
- /**
11
- * User-friendly display name of endpoint.
12
- */
13
- displayName?: string;
14
- bodyValidationDto?: DtoMetadata;
15
- queriesValidationDto?: DtoMetadata;
16
- paramsValidationDto?: DtoMetadata;
17
- responseValidationDto?: DtoMetadata;
18
- params?: {
19
- [index: number]: {
20
- source?: RequestDataSource;
21
- diClass: Constructor<any>;
22
- };
23
- };
24
- /**
25
- * Allow public access to this endpoint.
26
- */
27
- openAccess?: boolean;
28
- /**
29
- * Metadata of access condition to allow a conditional access to the endpoint.
30
- */
31
- accessConditions?: Constructor<AbstractAccessCondition>[];
32
- /**
33
- * Group of permission of this endpoint.
34
- */
35
- permissionGroup?: string;
36
- }
1
+ import { Constructor, DtoMetadata, HttpMethod, SocketMethod, ObjectFieldMetadata } from "@clairejs/core";
2
+ import { RequestDataSource } from "../common/types";
3
+ import { AbstractAccessCondition } from "../security/AbstractAccessCondition";
4
+ export interface EndpointMetadata extends ObjectFieldMetadata {
5
+ /**
6
+ * Basic HTTP information, name property is handler function name.
7
+ */
8
+ httpMethod: HttpMethod | SocketMethod;
9
+ url: string;
10
+ /**
11
+ * User-friendly display name of endpoint.
12
+ */
13
+ displayName?: string;
14
+ bodyValidationDto?: DtoMetadata;
15
+ queriesValidationDto?: DtoMetadata;
16
+ paramsValidationDto?: DtoMetadata;
17
+ responseValidationDto?: DtoMetadata;
18
+ params?: {
19
+ [index: number]: {
20
+ source?: RequestDataSource;
21
+ diClass: Constructor<any>;
22
+ };
23
+ };
24
+ /**
25
+ * Allow public access to this endpoint.
26
+ */
27
+ openAccess?: boolean;
28
+ /**
29
+ * Metadata of access condition to allow a conditional access to the endpoint.
30
+ */
31
+ accessConditions?: Constructor<AbstractAccessCondition>[];
32
+ /**
33
+ * Group of permission of this endpoint.
34
+ */
35
+ permissionGroup?: string;
36
+ }
@@ -1,12 +1,12 @@
1
- import { HttpMethod, SocketMethod } from "@clairejs/core";
2
- import { HttpRequest } from "../common/HttpRequest";
3
- import { HttpResponse } from "../common/HttpResponse";
4
- import { AbstractHttpController } from "./AbstractHttpController";
5
- export declare class HttpEndpoint {
6
- mount?: string;
7
- httpMethod?: HttpMethod | SocketMethod;
8
- handler?: (req: HttpRequest) => Promise<HttpResponse<any>>;
9
- controller?: AbstractHttpController;
10
- handlerFunctionName?: string;
11
- getEndpointId(): string;
12
- }
1
+ import { HttpMethod, SocketMethod } from "@clairejs/core";
2
+ import { HttpRequest } from "../common/HttpRequest";
3
+ import { HttpResponse } from "../common/HttpResponse";
4
+ import { AbstractHttpController } from "./AbstractHttpController";
5
+ export declare class HttpEndpoint {
6
+ mount?: string;
7
+ httpMethod?: HttpMethod | SocketMethod;
8
+ handler?: (req: HttpRequest) => Promise<HttpResponse<any>>;
9
+ controller?: AbstractHttpController;
10
+ handlerFunctionName?: string;
11
+ getEndpointId(): string;
12
+ }
@@ -1,36 +1,36 @@
1
- import { AbstractModel, Constructor, CreateManyRequestBody, CreateManyResponseBody, GetManyQueries, GetManyResponseBody, UpdateManyBody, UpdateManyQueries, UpdateManyResponse } from "@clairejs/core";
2
- import { IQueryProvider } from "../../database/adapter/IQueryProvider";
3
- import { ITransaction } from "../../database/transaction/ITransaction";
4
- import { IPrincipal } from "../security/IPrincipal";
5
- export declare class ModelRepository<T extends AbstractModel> {
6
- readonly model: Constructor<T>;
7
- private fileUploadHandler?;
8
- private readonly modelMetadata;
9
- constructor(model: Constructor<T>);
10
- private getNestedQueries;
11
- private getUploadHandler;
12
- private getRequestQueryConditionFromQuery;
13
- protected beforeCreating(principal: IPrincipal | undefined, records: Partial<T>[]): Promise<void>;
14
- protected uriHandling(records: Partial<T>[], tx: ITransaction): Promise<void>;
15
- protected beforeReturning(records: Partial<T>[]): Promise<void>;
16
- protected project(records: Partial<T>[], projection?: (keyof T)[]): any[];
17
- createMany({ principal, body, tx, }: {
18
- principal?: IPrincipal;
19
- body: CreateManyRequestBody<T>;
20
- tx: ITransaction;
21
- }): Promise<CreateManyResponseBody<T>>;
22
- updateMany({ principal, queries, body, tx, }: {
23
- principal?: IPrincipal;
24
- queries: UpdateManyQueries<T>;
25
- body: UpdateManyBody<T>;
26
- tx: ITransaction;
27
- }): Promise<UpdateManyResponse<T>>;
28
- getMany({ queries, queryProvider, }: {
29
- queries: GetManyQueries<T>;
30
- queryProvider: IQueryProvider;
31
- }): Promise<GetManyResponseBody<T>>;
32
- deleteMany({ queries, tx, }: {
33
- queries: UpdateManyQueries<T>;
34
- tx: ITransaction;
35
- }): Promise<UpdateManyResponse<T>>;
36
- }
1
+ import { AbstractModel, Constructor, CreateManyRequestBody, CreateManyResponseBody, GetManyQueries, GetManyResponseBody, UpdateManyBody, UpdateManyQueries, UpdateManyResponse } from "@clairejs/core";
2
+ import { IQueryProvider } from "../../database/adapter/IQueryProvider";
3
+ import { ITransaction } from "../../database/transaction/ITransaction";
4
+ import { IPrincipal } from "../security/IPrincipal";
5
+ export declare class ModelRepository<T extends AbstractModel> {
6
+ readonly model: Constructor<T>;
7
+ private fileUploadHandler?;
8
+ private readonly modelMetadata;
9
+ constructor(model: Constructor<T>);
10
+ private getNestedQueries;
11
+ private getUploadHandler;
12
+ private getRequestQueryConditionFromQuery;
13
+ protected beforeCreating(principal: IPrincipal | undefined, records: Partial<T>[]): Promise<void>;
14
+ protected uriHandling(records: Partial<T>[], tx: ITransaction): Promise<void>;
15
+ protected beforeReturning(records: Partial<T>[]): Promise<void>;
16
+ protected project(records: Partial<T>[], projection?: (keyof T)[]): any[];
17
+ createMany({ principal, body, tx, }: {
18
+ principal?: IPrincipal;
19
+ body: CreateManyRequestBody<T>;
20
+ tx: ITransaction;
21
+ }): Promise<CreateManyResponseBody<T>>;
22
+ updateMany({ principal, queries, body, tx, }: {
23
+ principal?: IPrincipal;
24
+ queries: UpdateManyQueries<T>;
25
+ body: UpdateManyBody<T>;
26
+ tx: ITransaction;
27
+ }): Promise<UpdateManyResponse<T>>;
28
+ getMany({ queries, queryProvider, }: {
29
+ queries: GetManyQueries<T>;
30
+ queryProvider: IQueryProvider;
31
+ }): Promise<GetManyResponseBody<T>>;
32
+ deleteMany({ queries, tx, }: {
33
+ queries: UpdateManyQueries<T>;
34
+ tx: ITransaction;
35
+ }): Promise<UpdateManyResponse<T>>;
36
+ }
@@ -1,6 +1,6 @@
1
- import { EndpointMetadata } from "./EndpointMetadata";
2
- import { HttpEndpoint } from "./HttpEndpoint";
3
- export interface MountedEndpointInfo {
4
- endpointMetadata: EndpointMetadata;
5
- endpoint: HttpEndpoint;
6
- }
1
+ import { EndpointMetadata } from "./EndpointMetadata";
2
+ import { HttpEndpoint } from "./HttpEndpoint";
3
+ export interface MountedEndpointInfo {
4
+ endpointMetadata: EndpointMetadata;
5
+ endpoint: HttpEndpoint;
6
+ }