taon 19.0.55 → 19.0.58
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/README.md +160 -160
- package/bin/start.js +279 -279
- package/bin/taon +6 -6
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +5 -5
- package/browser/README.md +24 -24
- package/browser/fesm2022/taon.mjs +299 -201
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-angular-service.d.ts +16 -0
- package/browser/lib/base-classes/base-context.d.ts +0 -9
- package/browser/lib/base-classes/base-controller.d.ts +1 -1
- package/browser/lib/base-classes/base-file-upload.middleware.d.ts +2 -2
- package/browser/lib/base-classes/base-middleware.d.ts +3 -3
- package/browser/lib/base-classes/base.d.ts +0 -9
- package/browser/lib/config/controller-config.d.ts +22 -0
- package/browser/lib/{decorators/classes → config}/controller-options.d.ts +6 -1
- package/browser/lib/config/method-config.d.ts +39 -0
- package/browser/lib/config/param-config.d.ts +9 -0
- package/browser/lib/constants.d.ts +2 -1
- package/browser/lib/create-context.d.ts +2 -20
- package/browser/lib/decorators/classes/controller-decorator.d.ts +1 -1
- package/browser/lib/decorators/http/http-methods-decorators.d.ts +14 -1
- package/browser/lib/endpoint-context.d.ts +3 -1
- package/browser/lib/helpers/class-helpers.d.ts +5 -2
- package/browser/lib/helpers/clone-obj.d.ts +2 -0
- package/browser/lib/helpers/taon-helpers.d.ts +5 -5
- package/browser/lib/index.d.ts +1 -28
- package/browser/lib/models.d.ts +0 -31
- package/browser/lib/symbols.d.ts +0 -2
- package/browser/lib/validators.d.ts +2 -2
- package/browser/package.json +1 -1
- package/lib/base-classes/base-angular-service.d.ts +16 -0
- package/lib/base-classes/base-angular-service.js +32 -0
- package/lib/base-classes/base-angular-service.js.map +1 -1
- package/lib/base-classes/base-class.js +2 -16
- package/lib/base-classes/base-class.js.map +1 -1
- package/lib/base-classes/base-context.d.ts +0 -9
- package/lib/base-classes/base-controller.d.ts +1 -1
- package/lib/base-classes/base-controller.js +4 -1
- package/lib/base-classes/base-controller.js.map +1 -1
- package/lib/base-classes/base-file-upload.middleware.d.ts +2 -2
- package/lib/base-classes/base-file-upload.middleware.js.map +1 -1
- package/lib/base-classes/base-middleware.d.ts +3 -3
- package/lib/base-classes/base.d.ts +0 -9
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/config/controller-config.d.ts +21 -0
- package/lib/config/controller-config.js +34 -0
- package/lib/config/controller-config.js.map +1 -0
- package/lib/config/controller-options.d.ts +16 -0
- package/lib/config/controller-options.js +8 -0
- package/lib/config/controller-options.js.map +1 -0
- package/lib/config/method-config.d.ts +38 -0
- package/lib/config/method-config.js +12 -0
- package/lib/config/method-config.js.map +1 -0
- package/lib/config/param-config.d.ts +8 -0
- package/lib/config/param-config.js +8 -0
- package/lib/config/param-config.js.map +1 -0
- package/lib/constants.d.ts +2 -1
- package/lib/constants.js +6 -1
- package/lib/constants.js.map +1 -1
- package/lib/create-context.d.ts +2 -20
- package/lib/create-context.js +1 -44
- package/lib/create-context.js.map +1 -1
- package/lib/decorators/classes/controller-config.d.ts +11 -0
- package/lib/decorators/classes/controller-config.js +10 -0
- package/lib/decorators/classes/controller-config.js.map +1 -1
- package/lib/decorators/classes/controller-decorator.d.ts +1 -1
- package/lib/decorators/classes/controller-decorator.js +6 -1
- package/lib/decorators/classes/controller-decorator.js.map +1 -1
- package/lib/decorators/classes/controller-options.d.ts +5 -0
- package/lib/decorators/classes/controller-options.js +4 -0
- package/lib/decorators/classes/controller-options.js.map +1 -1
- package/lib/decorators/classes/middleware-decorator.js.map +1 -1
- package/lib/decorators/classes/provider-decorator.js.map +1 -1
- package/lib/decorators/decorator-abstract-opt.js +0 -1
- package/lib/decorators/decorator-abstract-opt.js.map +1 -1
- package/lib/decorators/http/http-methods-decorators.d.ts +14 -1
- package/lib/decorators/http/http-methods-decorators.js +3 -10
- package/lib/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib/decorators/http/http-params-decorators.js +10 -16
- package/lib/decorators/http/http-params-decorators.js.map +1 -1
- package/lib/endpoint-context.d.ts +3 -1
- package/lib/endpoint-context.js +241 -143
- package/lib/endpoint-context.js.map +1 -1
- package/lib/helpers/class-helpers.d.ts +5 -2
- package/lib/helpers/class-helpers.js +47 -35
- package/lib/helpers/class-helpers.js.map +1 -1
- package/lib/helpers/clone-obj.d.ts +1 -0
- package/lib/helpers/clone-obj.js +22 -0
- package/lib/helpers/clone-obj.js.map +1 -0
- package/lib/helpers/taon-helpers.d.ts +5 -5
- package/lib/helpers/taon-helpers.js.map +1 -1
- package/lib/index.d.ts +1 -28
- package/lib/models.d.ts +0 -31
- package/lib/models.js +0 -33
- package/lib/models.js.map +1 -1
- package/lib/symbols.d.ts +0 -2
- package/lib/symbols.js +5 -7
- package/lib/symbols.js.map +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib/validators.d.ts +2 -2
- package/lib/validators.js.map +1 -1
- package/package.json +1 -1
- package/scss/vars.scss +6 -6
- package/websql/README.md +24 -24
- package/websql/fesm2022/taon.mjs +300 -202
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-angular-service.d.ts +16 -0
- package/websql/lib/base-classes/base-context.d.ts +0 -9
- package/websql/lib/base-classes/base-controller.d.ts +1 -1
- package/websql/lib/base-classes/base-file-upload.middleware.d.ts +2 -2
- package/websql/lib/base-classes/base-middleware.d.ts +3 -3
- package/websql/lib/base-classes/base.d.ts +0 -9
- package/websql/lib/config/controller-config.d.ts +22 -0
- package/websql/lib/{decorators/classes → config}/controller-options.d.ts +6 -1
- package/websql/lib/config/method-config.d.ts +39 -0
- package/websql/lib/config/param-config.d.ts +9 -0
- package/websql/lib/constants.d.ts +2 -1
- package/websql/lib/create-context.d.ts +2 -20
- package/websql/lib/decorators/classes/controller-decorator.d.ts +1 -1
- package/websql/lib/decorators/http/http-methods-decorators.d.ts +14 -1
- package/websql/lib/endpoint-context.d.ts +3 -1
- package/websql/lib/helpers/class-helpers.d.ts +5 -2
- package/websql/lib/helpers/clone-obj.d.ts +2 -0
- package/websql/lib/helpers/taon-helpers.d.ts +5 -5
- package/websql/lib/index.d.ts +1 -28
- package/websql/lib/models.d.ts +0 -31
- package/websql/lib/symbols.d.ts +0 -2
- package/websql/lib/validators.d.ts +2 -2
- package/websql/package.json +1 -1
- package/browser/lib/decorators/classes/controller-config.d.ts +0 -10
- package/lib/env.d.ts +0 -2
- package/lib/env.js +0 -7
- package/lib/env.js.map +0 -1
- package/lib/storage.d.ts +0 -1
- package/lib/storage.js +0 -6
- package/lib/storage.js.map +0 -1
- package/websql/lib/decorators/classes/controller-config.d.ts +0 -10
|
@@ -7,7 +7,23 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare abstract class BaseAngularsService {
|
|
9
9
|
protected readonly currentContext: TaonContext;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
* current context host backend port (for localhost backend)
|
|
13
|
+
*/
|
|
14
|
+
protected readonly CURRENT_HOST_BACKEND_PORT: number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated
|
|
17
|
+
* current context host URL (for localhost backend)
|
|
18
|
+
*/
|
|
19
|
+
protected readonly CURRENT_HOST_URL: string | undefined;
|
|
10
20
|
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated
|
|
23
|
+
* Returns the host URL for the backend service
|
|
24
|
+
* that is running on localhost (normal NodeJS/ExpressJS mode).
|
|
25
|
+
*/
|
|
26
|
+
get host(): string;
|
|
11
27
|
injectController<T>(ctor: new (...args: any[]) => T,
|
|
12
28
|
/**
|
|
13
29
|
* optional override context
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
declare const BaseContext: {
|
|
3
|
-
types: {
|
|
4
|
-
readonly controllers: any;
|
|
5
|
-
readonly repositories: any;
|
|
6
|
-
readonly providers: any;
|
|
7
|
-
readonly subscribers: any;
|
|
8
|
-
readonly migrations: any;
|
|
9
|
-
readonly middlewares: any;
|
|
10
|
-
};
|
|
11
|
-
readonly contexts: any;
|
|
12
3
|
readonly contextName: string;
|
|
13
4
|
readonly appId: string;
|
|
14
5
|
__ref(): Promise<import("taon/websql").EndpointContext>;
|
|
@@ -9,7 +9,7 @@ export interface MulterFileUploadResponse {
|
|
|
9
9
|
size: number;
|
|
10
10
|
mimetype: string;
|
|
11
11
|
}
|
|
12
|
-
export declare class BaseController extends BaseInjector {
|
|
12
|
+
export declare class BaseController<T = any> extends BaseInjector {
|
|
13
13
|
uploadFormDataToServer(formData: FormData): Models.Http.Response<MulterFileUploadResponse[]>;
|
|
14
14
|
uploadLocalFileToServer(absFilePath: string): Promise<MulterFileUploadResponse[]>;
|
|
15
15
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import * as multer from 'multer';
|
|
4
4
|
import { TaonServerMiddlewareInterceptOptions } from 'ng2-rest/websql';
|
|
5
|
-
import { BaseMiddleware,
|
|
5
|
+
import { BaseMiddleware, TaonAdditionalMiddlewareMethodInfo } from './base-middleware';
|
|
6
6
|
/**
|
|
7
7
|
* Configurable file upload middleware (multer based)
|
|
8
8
|
*/
|
|
9
9
|
export declare class BaseFileUploadMiddleware extends BaseMiddleware {
|
|
10
|
-
interceptServerMethod({ req, res, next }: TaonServerMiddlewareInterceptOptions, { methodName, expressPath }:
|
|
10
|
+
interceptServerMethod({ req, res, next }: TaonServerMiddlewareInterceptOptions, { methodName, expressPath }: TaonAdditionalMiddlewareMethodInfo): Promise<void>;
|
|
11
11
|
uploadDir(): string;
|
|
12
12
|
storage(): multer.StorageEngine;
|
|
13
13
|
upload(): multer.Multer;
|
|
@@ -11,7 +11,7 @@ import { BaseInjector } from './base-injector';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare abstract class BaseMiddleware extends BaseInjector {
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface TaonAdditionalMiddlewareMethodInfo {
|
|
15
15
|
methodName: string;
|
|
16
16
|
expressPath: string;
|
|
17
17
|
httpRequestType: CoreModels.HttpMethod;
|
|
@@ -30,10 +30,10 @@ export interface BaseMiddleware {
|
|
|
30
30
|
/**
|
|
31
31
|
* Specyfic controller method interceptor
|
|
32
32
|
*/
|
|
33
|
-
interceptServerMethod({ req, res, next }: TaonServerMiddlewareInterceptOptions, { methodName, expressPath, httpRequestType }:
|
|
33
|
+
interceptServerMethod({ req, res, next }: TaonServerMiddlewareInterceptOptions, { methodName, expressPath, httpRequestType }: TaonAdditionalMiddlewareMethodInfo): Promise<void> | void;
|
|
34
34
|
/**
|
|
35
35
|
* Controller method frontned interceptor
|
|
36
36
|
* TODO not needed ?
|
|
37
37
|
*/
|
|
38
|
-
interceptClientMethod({ req, next }: TaonClientMiddlewareInterceptOptions, { methodName, expressPath, httpRequestType }:
|
|
38
|
+
interceptClientMethod({ req, next }: TaonClientMiddlewareInterceptOptions, { methodName, expressPath, httpRequestType }: TaonAdditionalMiddlewareMethodInfo): Observable<AxiosResponse<any>>;
|
|
39
39
|
}
|
|
@@ -26,15 +26,6 @@ export declare namespace Base {
|
|
|
26
26
|
export import Middleware = baseMiddleware.BaseMiddleware;
|
|
27
27
|
export import AngularService = baseService.BaseAngularsService;
|
|
28
28
|
const Context: {
|
|
29
|
-
types: {
|
|
30
|
-
readonly controllers: any;
|
|
31
|
-
readonly repositories: any;
|
|
32
|
-
readonly providers: any;
|
|
33
|
-
readonly subscribers: any;
|
|
34
|
-
readonly migrations: any;
|
|
35
|
-
readonly middlewares: any;
|
|
36
|
-
};
|
|
37
|
-
readonly contexts: any;
|
|
38
29
|
readonly contextName: string;
|
|
39
30
|
readonly appId: string;
|
|
40
31
|
__ref(): Promise<import("taon/websql").EndpointContext>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { TaonMiddlewareInheritanceObj } from '../decorators/http/http-methods-decorators';
|
|
3
|
+
import { TaonControllerOptions } from './controller-options';
|
|
4
|
+
import { MethodConfig } from './method-config';
|
|
5
|
+
export declare class ControllerConfig extends TaonControllerOptions {
|
|
6
|
+
methods: {
|
|
7
|
+
[methodName: string]: Partial<MethodConfig>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Calculated path from parents controllers
|
|
11
|
+
*/
|
|
12
|
+
calculatedPath?: string;
|
|
13
|
+
/**
|
|
14
|
+
* a way to transform entity before sending to browser
|
|
15
|
+
*/
|
|
16
|
+
browserTransformFn?: (entity: any) => any;
|
|
17
|
+
/**
|
|
18
|
+
* Calculated middlewares object from parents controllers
|
|
19
|
+
*/
|
|
20
|
+
calculatedMiddlewaresControllerObj?: TaonMiddlewareInheritanceObj;
|
|
21
|
+
}
|
|
22
|
+
export declare const controllerConfigFrom: (partial: Partial<ControllerConfig>) => ControllerConfig;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { DecoratorAbstractOpt } from '../decorator-abstract-opt';
|
|
2
|
+
import { DecoratorAbstractOpt } from '../decorators/decorator-abstract-opt';
|
|
3
|
+
import type { TaonMiddlewareFunction } from '../decorators/http/http-methods-decorators';
|
|
3
4
|
export declare class TaonControllerOptions<ControllerClass = any> extends DecoratorAbstractOpt {
|
|
4
5
|
/**
|
|
5
6
|
* typeorm realtime subscribtion // TODO disabled for now, does not make sense ?s
|
|
@@ -9,4 +10,8 @@ export declare class TaonControllerOptions<ControllerClass = any> extends Decora
|
|
|
9
10
|
* override default path for controller api
|
|
10
11
|
*/
|
|
11
12
|
path?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Middlewares to be applied to all methods in the controller
|
|
15
|
+
*/
|
|
16
|
+
middlewares?: TaonMiddlewareFunction;
|
|
12
17
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { CoreModels } from 'tnp-core/websql';
|
|
3
|
+
import type { BaseMiddleware } from '../base-classes/base-middleware';
|
|
4
|
+
import type { TaonHttpDecoratorOptions, TaonMiddlewareFunction, TaonMiddlewareInheritanceObj } from '../decorators/http/http-methods-decorators';
|
|
5
|
+
import { ParamConfig } from './param-config';
|
|
6
|
+
/**
|
|
7
|
+
* @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
|
|
8
|
+
*/
|
|
9
|
+
export declare class MethodConfig implements Pick<TaonHttpDecoratorOptions, 'path' | 'middlewares'> {
|
|
10
|
+
methodName: string;
|
|
11
|
+
global?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* override default content type
|
|
14
|
+
*/
|
|
15
|
+
contentType?: any;
|
|
16
|
+
/**
|
|
17
|
+
* override default axiso response type
|
|
18
|
+
*/
|
|
19
|
+
responseType?: any;
|
|
20
|
+
path: string;
|
|
21
|
+
descriptor: PropertyDescriptor;
|
|
22
|
+
type: CoreModels.HttpMethod;
|
|
23
|
+
parameters: {
|
|
24
|
+
[paramName: string]: Partial<ParamConfig>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Middlewares from controller method options
|
|
28
|
+
*/
|
|
29
|
+
middlewares?: TaonMiddlewareFunction;
|
|
30
|
+
/**
|
|
31
|
+
* Calculated middlewares object from parents controllers
|
|
32
|
+
*/
|
|
33
|
+
calculatedMiddlewaresMethodObj?: TaonMiddlewareInheritanceObj;
|
|
34
|
+
/**
|
|
35
|
+
* Middlewares array in proper order and ready to be used in
|
|
36
|
+
* express or in axios interceptors.
|
|
37
|
+
*/
|
|
38
|
+
calculatedMiddlewares: (typeof BaseMiddleware)[];
|
|
39
|
+
}
|
|
@@ -5,5 +5,6 @@ import { InjectionToken } from '@angular/core';
|
|
|
5
5
|
import type { TaonContext } from './create-context';
|
|
6
6
|
declare let TAON_CONTEXT: InjectionToken<TaonContext>;
|
|
7
7
|
declare let CURRENT_HOST_BACKEND_PORT: InjectionToken<number>;
|
|
8
|
-
|
|
8
|
+
declare let CURRENT_HOST_URL: InjectionToken<string>;
|
|
9
|
+
export { TAON_CONTEXT, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL };
|
|
9
10
|
export declare const apiPrefix = "api";
|
|
@@ -7,15 +7,6 @@ import { Models } from './models';
|
|
|
7
7
|
* create context with specific configuration.
|
|
8
8
|
*/
|
|
9
9
|
export declare const createContextTemplate: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARE extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARE>) => () => {
|
|
10
|
-
types: {
|
|
11
|
-
readonly controllers: any;
|
|
12
|
-
readonly repositories: any;
|
|
13
|
-
readonly providers: any;
|
|
14
|
-
readonly subscribers: any;
|
|
15
|
-
readonly migrations: any;
|
|
16
|
-
readonly middlewares: any;
|
|
17
|
-
};
|
|
18
|
-
readonly contexts: any;
|
|
19
10
|
readonly contextName: string;
|
|
20
11
|
readonly appId: string;
|
|
21
12
|
/**
|
|
@@ -42,7 +33,7 @@ export declare const createContextTemplate: <CTX extends Record<string, object>,
|
|
|
42
33
|
}) => Promise<EndpointContext>;
|
|
43
34
|
/**
|
|
44
35
|
* realtime communication with server
|
|
45
|
-
*
|
|
36
|
+
* TCP(upgrade) socket.io (or ipc) based.
|
|
46
37
|
*/
|
|
47
38
|
readonly realtime: {
|
|
48
39
|
readonly client: import("./realtime/realtime-client").RealtimeClient;
|
|
@@ -54,15 +45,6 @@ export declare const createContextTemplate: <CTX extends Record<string, object>,
|
|
|
54
45
|
* - contextName
|
|
55
46
|
*/
|
|
56
47
|
export declare const createContext: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARES extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARES>) => {
|
|
57
|
-
types: {
|
|
58
|
-
readonly controllers: any;
|
|
59
|
-
readonly repositories: any;
|
|
60
|
-
readonly providers: any;
|
|
61
|
-
readonly subscribers: any;
|
|
62
|
-
readonly migrations: any;
|
|
63
|
-
readonly middlewares: any;
|
|
64
|
-
};
|
|
65
|
-
readonly contexts: any;
|
|
66
48
|
readonly contextName: string;
|
|
67
49
|
readonly appId: string;
|
|
68
50
|
/**
|
|
@@ -89,7 +71,7 @@ export declare const createContext: <CTX extends Record<string, object>, CTRL ex
|
|
|
89
71
|
}) => Promise<EndpointContext>;
|
|
90
72
|
/**
|
|
91
73
|
* realtime communication with server
|
|
92
|
-
*
|
|
74
|
+
* TCP(upgrade) socket.io (or ipc) based.
|
|
93
75
|
*/
|
|
94
76
|
readonly realtime: {
|
|
95
77
|
readonly client: import("./realtime/realtime-client").RealtimeClient;
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
import { Models as ModelsNg2Rest } from 'ng2-rest/websql';
|
|
3
3
|
import { CoreModels } from 'tnp-core/websql';
|
|
4
4
|
import { BaseMiddleware } from '../../base-classes/base-middleware';
|
|
5
|
+
export type TaonMiddlewareInheritanceObj = {
|
|
6
|
+
[parentMiddlewaresName: string]: typeof BaseMiddleware;
|
|
7
|
+
};
|
|
8
|
+
export type TaonMiddlewareFunction = (options: {
|
|
9
|
+
/**
|
|
10
|
+
* middlewares inherited from parent class
|
|
11
|
+
*/
|
|
12
|
+
parentMiddlewares: TaonMiddlewareInheritanceObj;
|
|
13
|
+
/**
|
|
14
|
+
* Get real class name - needed when code is minified
|
|
15
|
+
*/
|
|
16
|
+
className: (middlewareClass: Function) => string;
|
|
17
|
+
}) => TaonMiddlewareInheritanceObj;
|
|
5
18
|
export interface TaonHttpDecoratorOptions {
|
|
6
19
|
/**
|
|
7
20
|
* @deprecated don't use in production - keep stuff encapsulated
|
|
@@ -17,7 +30,7 @@ export interface TaonHttpDecoratorOptions {
|
|
|
17
30
|
pathIsGlobal?: boolean;
|
|
18
31
|
overrideContentType?: CoreModels.ContentType;
|
|
19
32
|
overrideResponseType?: ModelsNg2Rest.ResponseTypeAxios;
|
|
20
|
-
middlewares?:
|
|
33
|
+
middlewares?: TaonMiddlewareFunction;
|
|
21
34
|
}
|
|
22
35
|
export declare function GET(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
23
36
|
export declare function HEAD(pathOrOptions?: string | TaonHttpDecoratorOptions, pathIsGlobal?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -109,7 +109,6 @@ export declare class EndpointContext {
|
|
|
109
109
|
isActiveOn(classInstance: object): boolean;
|
|
110
110
|
get frontendHostUri(): URL;
|
|
111
111
|
get uri(): URL;
|
|
112
|
-
get uriPort(): string | undefined;
|
|
113
112
|
get uriProtocol(): string | undefined;
|
|
114
113
|
/**
|
|
115
114
|
* Examples
|
|
@@ -130,6 +129,7 @@ export declare class EndpointContext {
|
|
|
130
129
|
* https://localhost/path/to/ -> '/path/to/somewhere' # remove last slash
|
|
131
130
|
*/
|
|
132
131
|
get uriPathnameOrNothingIfRoot(): string;
|
|
132
|
+
get uriPort(): string | undefined;
|
|
133
133
|
/**
|
|
134
134
|
* Port from uri as number
|
|
135
135
|
* @returns {Number | undefined}
|
|
@@ -155,6 +155,8 @@ export declare class EndpointContext {
|
|
|
155
155
|
initEntities(): Promise<void>;
|
|
156
156
|
destroy(): Promise<void>;
|
|
157
157
|
initDatabaseConnection(): Promise<void>;
|
|
158
|
+
private updateCalculatedPathsForControllers;
|
|
159
|
+
private mergeControllerMethodsConfigs;
|
|
158
160
|
initControllers(): Promise<void>;
|
|
159
161
|
writeActiveRoutes(): void;
|
|
160
162
|
get middlewares(): Models.MiddlewareType[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { ControllerConfig } from '../
|
|
2
|
+
import { ControllerConfig } from '../config/controller-config';
|
|
3
|
+
import { MethodConfig } from '../config/method-config';
|
|
3
4
|
export declare namespace ClassHelpers {
|
|
4
5
|
/**
|
|
5
6
|
* TODO - repalce in every place when getting class fn from object
|
|
@@ -12,11 +13,13 @@ export declare namespace ClassHelpers {
|
|
|
12
13
|
const isContextClassObject: (obj: any) => boolean;
|
|
13
14
|
const setName: (target: Function, className: string) => void;
|
|
14
15
|
const hasParentClassWithName: (target: Function, className: string, targets?: any[]) => boolean;
|
|
15
|
-
const getControllerConfig: (target: Function) => ControllerConfig | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Express async handler for middleware functions.
|
|
18
18
|
*/
|
|
19
19
|
const asyncHandler: (fn: any) => (req: any, res: any, next: any) => void;
|
|
20
20
|
const getMethodsNames: (classOrClassInstance: any, allMethodsNames?: any[]) => string[];
|
|
21
21
|
const getControllerConfigs: (target: Function, configs?: ControllerConfig[], callerTarget?: Function) => ControllerConfig[];
|
|
22
|
+
const ensureClassConfig: (target: Function) => Partial<ControllerConfig>;
|
|
23
|
+
const ensureMethodConfig: (target: any, propertyKey: string | symbol) => Partial<MethodConfig>;
|
|
24
|
+
const getClassConfig: (constructor: Function) => Partial<ControllerConfig> | undefined;
|
|
22
25
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import type { ControllerConfig } from '../
|
|
3
|
-
import {
|
|
2
|
+
import type { ControllerConfig } from '../config/controller-config';
|
|
3
|
+
import { MethodConfig } from '../config/method-config';
|
|
4
4
|
export declare namespace TaonHelpers {
|
|
5
5
|
const fillUpTo: (s: string, nCharacters: number) => string;
|
|
6
6
|
const isGoodPath: (p: string) => boolean;
|
|
7
7
|
const tryTransformParam: (param: any) => any;
|
|
8
|
-
const getExpressPath: (c: ControllerConfig, pathOrClassConfig:
|
|
8
|
+
const getExpressPath: (c: ControllerConfig, pathOrClassConfig: Partial<MethodConfig>) => string;
|
|
9
9
|
const defaultType: (value: any) => {};
|
|
10
10
|
const parseJSONwithStringJSONs: (object: Object, waring?: boolean) => Object;
|
|
11
11
|
const isPlainFileOrFolder: (filePath: any) => boolean;
|
|
12
|
-
const ipcKeyNameResponse: (target: Function, methodConfig:
|
|
13
|
-
const ipcKeyNameRequest: (target: Function, methodConfig:
|
|
12
|
+
const ipcKeyNameResponse: (target: Function, methodConfig: Partial<MethodConfig>, expressPath: string) => string;
|
|
13
|
+
const ipcKeyNameRequest: (target: Function, methodConfig: Partial<MethodConfig>, expressPath: string) => string;
|
|
14
14
|
const websqlMocks: (headers: any) => {
|
|
15
15
|
request: Express.Request;
|
|
16
16
|
response: Express.Response;
|
package/websql/lib/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export { BaseProvider } from './base-classes/base-provider';
|
|
|
23
23
|
export { BaseEntity } from './base-classes/base-entity';
|
|
24
24
|
export { BaseContext } from './base-classes/base-context';
|
|
25
25
|
export { BaseMigration } from './base-classes/base-migration';
|
|
26
|
-
export {
|
|
26
|
+
export { TaonAdditionalMiddlewareMethodInfo } from './base-classes/base-middleware';
|
|
27
27
|
export { createContext, TaonContext } from './create-context';
|
|
28
28
|
export { inject } from './inject';
|
|
29
29
|
export { Models } from './models';
|
|
@@ -52,15 +52,6 @@ export declare namespace Taon {
|
|
|
52
52
|
const isWebSQL: boolean;
|
|
53
53
|
const isElectron: boolean;
|
|
54
54
|
const createContext: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARES extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => models.Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARES>) => {
|
|
55
|
-
types: {
|
|
56
|
-
readonly controllers: any;
|
|
57
|
-
readonly repositories: any;
|
|
58
|
-
readonly providers: any;
|
|
59
|
-
readonly subscribers: any;
|
|
60
|
-
readonly migrations: any;
|
|
61
|
-
readonly middlewares: any;
|
|
62
|
-
};
|
|
63
|
-
readonly contexts: any;
|
|
64
55
|
readonly contextName: string;
|
|
65
56
|
readonly appId: string;
|
|
66
57
|
__ref(): Promise<endpointContext.EndpointContext>;
|
|
@@ -79,15 +70,6 @@ export declare namespace Taon {
|
|
|
79
70
|
};
|
|
80
71
|
};
|
|
81
72
|
const createContextTemplate: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>, MIDDLEWARE extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => models.Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION, MIDDLEWARE>) => () => {
|
|
82
|
-
types: {
|
|
83
|
-
readonly controllers: any;
|
|
84
|
-
readonly repositories: any;
|
|
85
|
-
readonly providers: any;
|
|
86
|
-
readonly subscribers: any;
|
|
87
|
-
readonly migrations: any;
|
|
88
|
-
readonly middlewares: any;
|
|
89
|
-
};
|
|
90
|
-
readonly contexts: any;
|
|
91
73
|
readonly contextName: string;
|
|
92
74
|
readonly appId: string;
|
|
93
75
|
__ref(): Promise<endpointContext.EndpointContext>;
|
|
@@ -117,15 +99,6 @@ export declare namespace Taon {
|
|
|
117
99
|
entities: Function[];
|
|
118
100
|
controllers: Function[];
|
|
119
101
|
}) => Promise<{
|
|
120
|
-
types: {
|
|
121
|
-
readonly controllers: any;
|
|
122
|
-
readonly repositories: any;
|
|
123
|
-
readonly providers: any;
|
|
124
|
-
readonly subscribers: any;
|
|
125
|
-
readonly migrations: any;
|
|
126
|
-
readonly middlewares: any;
|
|
127
|
-
};
|
|
128
|
-
readonly contexts: any;
|
|
129
102
|
readonly contextName: string;
|
|
130
103
|
readonly appId: string;
|
|
131
104
|
__ref(): Promise<endpointContext.EndpointContext>;
|
package/websql/lib/models.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ import type { RequestHandler } from 'express';
|
|
|
3
3
|
import { Response as ExpressResponse, Request as ExpressRequest } from 'express';
|
|
4
4
|
import { Models as ModelsNg2Rest } from 'ng2-rest/websql';
|
|
5
5
|
import { CoreModels } from 'tnp-core/websql';
|
|
6
|
-
import type { BaseMiddleware } from './base-classes/base-middleware';
|
|
7
|
-
import type { TaonHttpDecoratorOptions } from './decorators/http/http-methods-decorators';
|
|
8
6
|
export declare namespace Models {
|
|
9
7
|
type FrameworkMode = 'backend-frontend(tcp+udp)' | 'remote-backend(tcp+udp)' | 'backend-frontend(ipc-electron)' | 'backend-frontend(websql-electron)' | 'backend-frontend(websql)';
|
|
10
8
|
enum ClassType {
|
|
@@ -213,35 +211,6 @@ export declare namespace Models {
|
|
|
213
211
|
*/
|
|
214
212
|
cwd?: string;
|
|
215
213
|
}
|
|
216
|
-
class ParamConfig {
|
|
217
|
-
paramName: string;
|
|
218
|
-
paramType: CoreModels.ParamType;
|
|
219
|
-
index: number;
|
|
220
|
-
defaultType: any;
|
|
221
|
-
expireInSeconds?: number;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
|
|
225
|
-
*/
|
|
226
|
-
class MethodConfig implements Pick<TaonHttpDecoratorOptions, 'path' | 'middlewares'> {
|
|
227
|
-
methodName: string;
|
|
228
|
-
global?: boolean;
|
|
229
|
-
/**
|
|
230
|
-
* override default content type
|
|
231
|
-
*/
|
|
232
|
-
contentType?: any;
|
|
233
|
-
/**
|
|
234
|
-
* override default axiso response type
|
|
235
|
-
*/
|
|
236
|
-
responseType?: any;
|
|
237
|
-
path: string;
|
|
238
|
-
descriptor: PropertyDescriptor;
|
|
239
|
-
type: CoreModels.HttpMethod;
|
|
240
|
-
parameters: {
|
|
241
|
-
[paramName: string]: ParamConfig;
|
|
242
|
-
};
|
|
243
|
-
middlewares?: (typeof BaseMiddleware)[];
|
|
244
|
-
}
|
|
245
214
|
namespace Http {
|
|
246
215
|
export import Rest = ModelsNg2Rest;
|
|
247
216
|
type ContextENDPOINT = {
|
package/websql/lib/symbols.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import {
|
|
2
|
+
import { MethodConfig } from './config/method-config';
|
|
3
3
|
export declare namespace Validators {
|
|
4
4
|
const classNameVlidation: (className: any, target: Function) => any;
|
|
5
|
-
const checkIfMethodsWithReponseTYpeAlowed: (methods:
|
|
5
|
+
const checkIfMethodsWithReponseTYpeAlowed: (methods: MethodConfig[], current: MethodConfig) => void;
|
|
6
6
|
const validateClassFunctions: (controllers: any[], entities: any[], proviers: any[], repositories: any[]) => void;
|
|
7
7
|
const preventUndefinedModel: (model: any, id: any) => void;
|
|
8
8
|
}
|
package/websql/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { Models } from '../../models';
|
|
3
|
-
import { TaonControllerOptions } from './controller-options';
|
|
4
|
-
export declare class ControllerConfig extends TaonControllerOptions {
|
|
5
|
-
methods: {
|
|
6
|
-
[methodName: string]: Models.MethodConfig;
|
|
7
|
-
};
|
|
8
|
-
calculatedPath?: string;
|
|
9
|
-
browserTransformFn?: (entity: any) => any;
|
|
10
|
-
}
|
package/lib/env.d.ts
DELETED
package/lib/env.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENV = void 0;
|
|
4
|
-
const lib_1 = require("tnp-core/lib");
|
|
5
|
-
const ENV = lib_1.Helpers.isBrowser ? window['ENV'] : global['ENV'];
|
|
6
|
-
exports.ENV = ENV;
|
|
7
|
-
//# sourceMappingURL=env.js.map
|
package/lib/env.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,sCAAuC;AAEvC,MAAM,GAAG,GAAG,aAAO,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAErD,kBAAG"}
|
package/lib/storage.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const globalPublicStorage: typeof globalThis;
|
package/lib/storage.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.globalPublicStorage = void 0;
|
|
4
|
-
const lib_1 = require("tnp-core/lib");
|
|
5
|
-
exports.globalPublicStorage = lib_1.Helpers.isBrowser ? window : global;
|
|
6
|
-
//# sourceMappingURL=storage.js.map
|
package/lib/storage.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,sCAAuC;AAE1B,QAAA,mBAAmB,GAAG,aAAO,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { Models } from '../../models';
|
|
3
|
-
import { TaonControllerOptions } from './controller-options';
|
|
4
|
-
export declare class ControllerConfig extends TaonControllerOptions {
|
|
5
|
-
methods: {
|
|
6
|
-
[methodName: string]: Models.MethodConfig;
|
|
7
|
-
};
|
|
8
|
-
calculatedPath?: string;
|
|
9
|
-
browserTransformFn?: (entity: any) => any;
|
|
10
|
-
}
|