taon 19.0.1 → 19.0.2
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/fesm2022/taon.mjs +32 -2
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-context.d.ts +3 -3
- package/browser/lib/base-classes/base.d.ts +3 -3
- package/browser/lib/create-context.d.ts +41 -0
- package/browser/lib/endpoint-context.d.ts +7 -1
- package/browser/lib/index.d.ts +26 -0
- package/client/fesm2022/taon.mjs +32 -2
- package/client/fesm2022/taon.mjs.map +1 -1
- package/client/lib/base-classes/base-context.d.ts +3 -3
- package/client/lib/base-classes/base.d.ts +3 -3
- package/client/lib/create-context.d.ts +41 -0
- package/client/lib/endpoint-context.d.ts +7 -1
- package/client/lib/index.d.ts +26 -0
- package/lib/base-classes/base-context.d.ts +3 -3
- package/lib/base-classes/base.d.ts +3 -3
- package/lib/create-context.d.ts +41 -0
- package/lib/create-context.js +10 -3
- package/lib/create-context.js.map +1 -1
- package/lib/endpoint-context.d.ts +6 -0
- package/lib/endpoint-context.js +26 -0
- package/lib/endpoint-context.js.map +1 -1
- package/lib/index.d.ts +26 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/ui/directives/index.js +2 -2
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib/ui/taon-github-fork-me-corner/index.js +2 -2
- package/lib/ui/taon-github-fork-me-ribbon/index.js +2 -2
- package/lib/ui/taon-notifications/taon-notifications.models.js +2 -2
- package/lib/ui/taon-progress-bar/index.js +2 -2
- package/lib/ui/taon-session-passcode/index.js +2 -2
- package/lib/ui/taon-table/index.js +2 -2
- package/package.json +1 -1
- package/tmp-environment.json +2 -2
- package/websql/fesm2022/taon.mjs +29 -2
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-context.d.ts +3 -3
- package/websql/lib/base-classes/base.d.ts +3 -3
- package/websql/lib/create-context.d.ts +41 -0
- package/websql/lib/endpoint-context.d.ts +6 -0
- package/websql/lib/index.d.ts +26 -0
- package/lib/base-classes/base-subscriber.d.ts +0 -4
- package/lib/base-classes/base-subscriber.js +0 -25
- package/lib/base-classes/base-subscriber.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.js +0 -214
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.d.ts +0 -0
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js +0 -5
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +0 -22
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js +0 -139
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js +0 -68
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js +0 -56
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js +0 -50
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +0 -2
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js +0 -6
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js +0 -54
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +0 -17
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js +0 -52
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js +0 -39
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js +0 -46
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js.map +0 -1
- package/lib/ui/directives/firedev-inject-html.directive.d.ts +0 -6
- package/lib/ui/directives/firedev-long-press.directive.d.ts +0 -22
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +0 -29
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.d.ts +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/taon-db-admin.component.d.ts +0 -8
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +0 -13
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +0 -5
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js +0 -3
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +0 -14
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +0 -2
- package/lib/ui/toan-full-material.module.d.ts +0 -2
- package/taon.jsonc +0 -40
|
@@ -9,8 +9,8 @@ declare const BaseContext: {
|
|
|
9
9
|
};
|
|
10
10
|
readonly contexts: CTX;
|
|
11
11
|
readonly contextName: string;
|
|
12
|
-
__ref(): Promise<import("
|
|
13
|
-
readonly __refSync: import("
|
|
12
|
+
__ref(): Promise<import("taon/browser").EndpointContext>;
|
|
13
|
+
readonly __refSync: import("taon/browser").EndpointContext;
|
|
14
14
|
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
15
15
|
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
16
16
|
initialize: (overrideOptions?: {
|
|
@@ -18,7 +18,7 @@ declare const BaseContext: {
|
|
|
18
18
|
overrideRemoteHost?: string;
|
|
19
19
|
onlyMigrationRun?: boolean;
|
|
20
20
|
onlyMigrationRevertToTimestamp?: number;
|
|
21
|
-
}) => Promise<import("
|
|
21
|
+
}) => Promise<import("taon/browser").EndpointContext>;
|
|
22
22
|
readonly realtime: {
|
|
23
23
|
readonly client: import("../realtime/realtime-client").RealtimeClient;
|
|
24
24
|
readonly server: import("../realtime/realtime-server").RealtimeServer;
|
|
@@ -29,8 +29,8 @@ export declare namespace Base {
|
|
|
29
29
|
};
|
|
30
30
|
readonly contexts: CTX;
|
|
31
31
|
readonly contextName: string;
|
|
32
|
-
__ref(): Promise<import("
|
|
33
|
-
readonly __refSync: import("
|
|
32
|
+
__ref(): Promise<import("taon/browser").EndpointContext>;
|
|
33
|
+
readonly __refSync: import("taon/browser").EndpointContext;
|
|
34
34
|
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
35
35
|
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
36
36
|
initialize: (overrideOptions?: {
|
|
@@ -38,7 +38,7 @@ export declare namespace Base {
|
|
|
38
38
|
overrideRemoteHost?: string;
|
|
39
39
|
onlyMigrationRun?: boolean;
|
|
40
40
|
onlyMigrationRevertToTimestamp?: number;
|
|
41
|
-
}) => Promise<import("
|
|
41
|
+
}) => Promise<import("taon/browser").EndpointContext>;
|
|
42
42
|
readonly realtime: {
|
|
43
43
|
readonly client: import("../realtime/realtime-client").RealtimeClient;
|
|
44
44
|
readonly server: import("../realtime/realtime-server").RealtimeServer;
|
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { EndpointContext } from './endpoint-context';
|
|
3
3
|
import { Models } from './models';
|
|
4
|
+
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>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => () => {
|
|
5
|
+
types: {
|
|
6
|
+
readonly controllers: CTRL_1;
|
|
7
|
+
readonly repositories: REPO_1;
|
|
8
|
+
readonly providers: PROVIDER_1;
|
|
9
|
+
readonly subscribers: SUBSCRIBER_1;
|
|
10
|
+
readonly migrations: MIGRATION_1;
|
|
11
|
+
};
|
|
12
|
+
readonly contexts: CTX_1;
|
|
13
|
+
readonly contextName: string;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* - get reference to internal context
|
|
17
|
+
*/
|
|
18
|
+
__ref(): Promise<EndpointContext>;
|
|
19
|
+
/**
|
|
20
|
+
* only for internal use
|
|
21
|
+
* @deprecated
|
|
22
|
+
*/
|
|
23
|
+
readonly __refSync: EndpointContext;
|
|
24
|
+
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
25
|
+
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
26
|
+
/**
|
|
27
|
+
* - create controller instances for context
|
|
28
|
+
* - init database (if enable) + migation scripts
|
|
29
|
+
*/
|
|
30
|
+
initialize: (overrideOptions?: {
|
|
31
|
+
overrideHost?: string;
|
|
32
|
+
overrideRemoteHost?: string;
|
|
33
|
+
onlyMigrationRun?: boolean;
|
|
34
|
+
onlyMigrationRevertToTimestamp?: number;
|
|
35
|
+
}) => Promise<EndpointContext>;
|
|
36
|
+
/**
|
|
37
|
+
* realtime communication with server
|
|
38
|
+
* Udp socket.io (or ipc) based.
|
|
39
|
+
*/
|
|
40
|
+
readonly realtime: {
|
|
41
|
+
readonly client: import("./realtime/realtime-client").RealtimeClient;
|
|
42
|
+
readonly server: import("./realtime/realtime-server").RealtimeServer;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
4
45
|
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>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => {
|
|
5
46
|
types: {
|
|
6
47
|
readonly controllers: CTRL;
|
|
@@ -98,6 +98,11 @@ export declare class EndpointContext {
|
|
|
98
98
|
initClasses(): Promise<void>;
|
|
99
99
|
isActiveOn(classInstance: object): boolean;
|
|
100
100
|
get uri(): URL;
|
|
101
|
+
/**
|
|
102
|
+
* Port from uri as number
|
|
103
|
+
* @returns {Number | undefined}
|
|
104
|
+
*/
|
|
105
|
+
get port(): Number | undefined;
|
|
101
106
|
get isHttpServer(): boolean;
|
|
102
107
|
/**
|
|
103
108
|
* ipc/udp needs this
|
|
@@ -113,7 +118,8 @@ export declare class EndpointContext {
|
|
|
113
118
|
get orgin(): string;
|
|
114
119
|
initSubscribers(): Promise<any>;
|
|
115
120
|
initEntities(): Promise<void>;
|
|
116
|
-
|
|
121
|
+
destroy(): Promise<void>;
|
|
122
|
+
initDatabaseConnection(): Promise<void>;
|
|
117
123
|
initControllers(): void;
|
|
118
124
|
writeActiveRoutes(): void;
|
|
119
125
|
get middlewares(): Models.MiddlewareType[];
|
package/client/lib/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import * as endpointContext from './endpoint-context';
|
|
|
14
14
|
import * as allSymbols from './symbols';
|
|
15
15
|
import { NgZone } from '@angular/core';
|
|
16
16
|
export * from './ui';
|
|
17
|
+
export { EndpointContext } from './endpoint-context';
|
|
17
18
|
export { BaseRepository } from './base-classes/base-repository';
|
|
18
19
|
export { BaseController } from './base-classes/base-controller';
|
|
19
20
|
export { BaseProvider } from './base-classes/base-provider';
|
|
@@ -70,6 +71,31 @@ export declare namespace Taon {
|
|
|
70
71
|
readonly server: import("./realtime/realtime-server").RealtimeServer;
|
|
71
72
|
};
|
|
72
73
|
};
|
|
74
|
+
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>>(configFn: (env: any) => models.Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => () => {
|
|
75
|
+
types: {
|
|
76
|
+
readonly controllers: CTRL_1;
|
|
77
|
+
readonly repositories: REPO_1;
|
|
78
|
+
readonly providers: PROVIDER_1;
|
|
79
|
+
readonly subscribers: SUBSCRIBER_1;
|
|
80
|
+
readonly migrations: MIGRATION_1;
|
|
81
|
+
};
|
|
82
|
+
readonly contexts: CTX_1;
|
|
83
|
+
readonly contextName: string;
|
|
84
|
+
__ref(): Promise<endpointContext.EndpointContext>;
|
|
85
|
+
readonly __refSync: endpointContext.EndpointContext;
|
|
86
|
+
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
87
|
+
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
88
|
+
initialize: (overrideOptions?: {
|
|
89
|
+
overrideHost?: string;
|
|
90
|
+
overrideRemoteHost?: string;
|
|
91
|
+
onlyMigrationRun?: boolean;
|
|
92
|
+
onlyMigrationRevertToTimestamp?: number;
|
|
93
|
+
}) => Promise<endpointContext.EndpointContext>;
|
|
94
|
+
readonly realtime: {
|
|
95
|
+
readonly client: import("./realtime/realtime-client").RealtimeClient;
|
|
96
|
+
readonly server: import("./realtime/realtime-server").RealtimeServer;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
73
99
|
const inject: <T>(entity: () => new (...args: any[]) => T) => T;
|
|
74
100
|
const initNgZone: (ngZone: NgZone) => void;
|
|
75
101
|
const symbols: typeof allSymbols.Symbols;
|
|
@@ -8,8 +8,8 @@ declare const BaseContext: {
|
|
|
8
8
|
};
|
|
9
9
|
readonly contexts: CTX;
|
|
10
10
|
readonly contextName: string;
|
|
11
|
-
__ref(): Promise<import("
|
|
12
|
-
readonly __refSync: import("
|
|
11
|
+
__ref(): Promise<import("..").EndpointContext>;
|
|
12
|
+
readonly __refSync: import("..").EndpointContext;
|
|
13
13
|
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
14
14
|
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
15
15
|
initialize: (overrideOptions?: {
|
|
@@ -17,7 +17,7 @@ declare const BaseContext: {
|
|
|
17
17
|
overrideRemoteHost?: string;
|
|
18
18
|
onlyMigrationRun?: boolean;
|
|
19
19
|
onlyMigrationRevertToTimestamp?: number;
|
|
20
|
-
}) => Promise<import("
|
|
20
|
+
}) => Promise<import("..").EndpointContext>;
|
|
21
21
|
readonly realtime: {
|
|
22
22
|
readonly client: import("../realtime/realtime-client").RealtimeClient;
|
|
23
23
|
readonly server: import("../realtime/realtime-server").RealtimeServer;
|
|
@@ -28,8 +28,8 @@ export declare namespace Base {
|
|
|
28
28
|
};
|
|
29
29
|
readonly contexts: CTX;
|
|
30
30
|
readonly contextName: string;
|
|
31
|
-
__ref(): Promise<import("
|
|
32
|
-
readonly __refSync: import("
|
|
31
|
+
__ref(): Promise<import("..").EndpointContext>;
|
|
32
|
+
readonly __refSync: import("..").EndpointContext;
|
|
33
33
|
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
34
34
|
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
35
35
|
initialize: (overrideOptions?: {
|
|
@@ -37,7 +37,7 @@ export declare namespace Base {
|
|
|
37
37
|
overrideRemoteHost?: string;
|
|
38
38
|
onlyMigrationRun?: boolean;
|
|
39
39
|
onlyMigrationRevertToTimestamp?: number;
|
|
40
|
-
}) => Promise<import("
|
|
40
|
+
}) => Promise<import("..").EndpointContext>;
|
|
41
41
|
readonly realtime: {
|
|
42
42
|
readonly client: import("../realtime/realtime-client").RealtimeClient;
|
|
43
43
|
readonly server: import("../realtime/realtime-server").RealtimeServer;
|
package/lib/create-context.d.ts
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
import { EndpointContext } from './endpoint-context';
|
|
2
2
|
import { Models } from './models';
|
|
3
|
+
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>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => () => {
|
|
4
|
+
types: {
|
|
5
|
+
readonly controllers: CTRL_1;
|
|
6
|
+
readonly repositories: REPO_1;
|
|
7
|
+
readonly providers: PROVIDER_1;
|
|
8
|
+
readonly subscribers: SUBSCRIBER_1;
|
|
9
|
+
readonly migrations: MIGRATION_1;
|
|
10
|
+
};
|
|
11
|
+
readonly contexts: CTX_1;
|
|
12
|
+
readonly contextName: string;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* - get reference to internal context
|
|
16
|
+
*/
|
|
17
|
+
__ref(): Promise<EndpointContext>;
|
|
18
|
+
/**
|
|
19
|
+
* only for internal use
|
|
20
|
+
* @deprecated
|
|
21
|
+
*/
|
|
22
|
+
readonly __refSync: EndpointContext;
|
|
23
|
+
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
24
|
+
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
25
|
+
/**
|
|
26
|
+
* - create controller instances for context
|
|
27
|
+
* - init database (if enable) + migation scripts
|
|
28
|
+
*/
|
|
29
|
+
initialize: (overrideOptions?: {
|
|
30
|
+
overrideHost?: string;
|
|
31
|
+
overrideRemoteHost?: string;
|
|
32
|
+
onlyMigrationRun?: boolean;
|
|
33
|
+
onlyMigrationRevertToTimestamp?: number;
|
|
34
|
+
}) => Promise<EndpointContext>;
|
|
35
|
+
/**
|
|
36
|
+
* realtime communication with server
|
|
37
|
+
* Udp socket.io (or ipc) based.
|
|
38
|
+
*/
|
|
39
|
+
readonly realtime: {
|
|
40
|
+
readonly client: import("./realtime/realtime-client").RealtimeClient;
|
|
41
|
+
readonly server: import("./realtime/realtime-server").RealtimeServer;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
3
44
|
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>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => {
|
|
4
45
|
types: {
|
|
5
46
|
readonly controllers: CTRL;
|
package/lib/create-context.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createContext = void 0;
|
|
3
|
+
exports.createContext = exports.createContextTemplate = void 0;
|
|
4
4
|
//#region imports
|
|
5
5
|
const tnp_core_1 = require("tnp-core");
|
|
6
6
|
const endpoint_context_1 = require("./endpoint-context");
|
|
@@ -10,6 +10,12 @@ const env_1 = require("./env");
|
|
|
10
10
|
// import { Symbols } from './symbols';
|
|
11
11
|
// import { Taon } from '../lib/src';
|
|
12
12
|
//#endregion
|
|
13
|
+
const createContextTemplate = (configFn) => {
|
|
14
|
+
return () => {
|
|
15
|
+
return (0, exports.createContext)(configFn);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.createContextTemplate = createContextTemplate;
|
|
13
19
|
const createContext = (configFn) => {
|
|
14
20
|
let config = configFn(env_1.ENV);
|
|
15
21
|
const endpointContextRef = new endpoint_context_1.EndpointContext(config, configFn);
|
|
@@ -107,6 +113,7 @@ const createContext = (configFn) => {
|
|
|
107
113
|
*/
|
|
108
114
|
initialize: async (overrideOptions) => {
|
|
109
115
|
return await new Promise(async (resolve, reject) => {
|
|
116
|
+
//#region init in set timeout
|
|
110
117
|
setTimeout(async () => {
|
|
111
118
|
await endpointContextRef.init({
|
|
112
119
|
...overrideOptions,
|
|
@@ -144,7 +151,7 @@ const createContext = (configFn) => {
|
|
|
144
151
|
`(context=${endpointContextRef.contextName}).`);
|
|
145
152
|
await endpointContextRef.reinitControllers();
|
|
146
153
|
}
|
|
147
|
-
|
|
154
|
+
//#region TODO this may be usefull but for now
|
|
148
155
|
// 2 separate contexts are fine
|
|
149
156
|
// const shouldStartRemoteHost = endpointContextRef.mode !== 'remote-backend(tcp+udp)';
|
|
150
157
|
// if(shouldStartRemoteHost) {
|
|
@@ -168,9 +175,9 @@ const createContext = (configFn) => {
|
|
|
168
175
|
}
|
|
169
176
|
resolve(endpointContextRef);
|
|
170
177
|
});
|
|
178
|
+
//#endregion
|
|
171
179
|
});
|
|
172
180
|
},
|
|
173
|
-
//#endregion
|
|
174
181
|
/**
|
|
175
182
|
* realtime communication with server
|
|
176
183
|
* Udp socket.io (or ipc) based.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-context.js","sourceRoot":"","sources":["c:/Users/darek/projects/npm/taon-dev/taon/src/lib/create-context.ts"],"names":[],"mappings":";;;AAAA,iBAAiB;AACjB,uCAA4C;AAC5C,yDAAqD;AAGrD,+BAA4B;AAC5B,KAAK;AACL,KAAK;AAGL,uCAAuC;AACvC,qCAAqC;AACrC,YAAY;AAEL,MAAM,aAAa,GAAG,CAW3B,QAUC,EACD,EAAE;IACF,IAAI,MAAM,GAAG,QAAQ,CAAC,SAAG,CAAC,CAAC;IAE3B,MAAM,kBAAkB,GAAG,IAAI,kCAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEjE,MAAM,GAAG,GAAG;QACV,eAAe;QACf,KAAK,EAAE;YACL,qBAAqB;YACrB,mBAAmB;YACnB,4BAA4B;YAC5B,KAAK;YACL,4CAA4C;YAC5C,mDAAmD;YACnD,2CAA2C;YAC3C,2CAA2C;YAC3C,oEAAoE;YACpE,0DAA0D;YAC1D,4CAA4C;YAC5C,+CAA+C;YAC/C,8BAA8B;YAC9B,QAAQ;YACR,MAAM;YACN,qEAAqE;YACrE,KAAK;YACL,YAAY;YACZ,IAAI,WAAW;gBACb,OAAO,MAAM,CAAC,WAAW,CAAC;YAC5B,CAAC;YACD,IAAI,YAAY;gBACd,OAAO,MAAM,CAAC,YAAY,CAAC;YAC7B,CAAC;YACD,IAAI,SAAS;gBACX,OAAO,MAAM,CAAC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AAM,kBAAkB,CAAC,YAAY,CAAC,4BAA4B,EAAE,CAAC;oBACvE,CAAC;yBAAM,IAAI,kBAAkB,CAAC,8BAA8B,EAAE,CAAC;wBAC7D,MAAM,kBAAkB,CAAC,YAAY,CAAC,0BAA0B,CAC9D,kBAAkB,CAAC,8BAA8B,CAClD,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,MAAM,kBAAkB,CAAC,YAAY,CAAC,4BAA4B,EAAE,CAAC;oBACvE,CAAC;oBAED,OAAO,CAAC,kBAAkB,CAAC,CAAC;gBAC9B,CAAC,CAAC,CAAC;gBACH,YAAY;YACd,CAAC,CAAC,CAAC;QACL,CAAC;QACD;;;WAGG;QACH,IAAI,QAAQ;YACV,OAAO;gBACL,IAAI,MAAM;oBACR,OAAO,kBAAkB,CAAC,cAAc,CAAC;gBAC3C,CAAC;gBACD,IAAI,MAAM;oBACR,OAAO,kBAAkB,CAAC,cAAc,CAAC;gBAC3C,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AA9NW,QAAA,aAAa,iBA8NxB;AACF,YAAY"}
|
|
@@ -98,6 +98,11 @@ export declare class EndpointContext {
|
|
|
98
98
|
initClasses(): Promise<void>;
|
|
99
99
|
isActiveOn(classInstance: object): boolean;
|
|
100
100
|
get uri(): URL;
|
|
101
|
+
/**
|
|
102
|
+
* Port from uri as number
|
|
103
|
+
* @returns {Number | undefined}
|
|
104
|
+
*/
|
|
105
|
+
get port(): Number | undefined;
|
|
101
106
|
get isHttpServer(): boolean;
|
|
102
107
|
/**
|
|
103
108
|
* ipc/udp needs this
|
|
@@ -113,6 +118,7 @@ export declare class EndpointContext {
|
|
|
113
118
|
get orgin(): string;
|
|
114
119
|
initSubscribers(): Promise<void>;
|
|
115
120
|
initEntities(): Promise<void>;
|
|
121
|
+
destroy(): Promise<void>;
|
|
116
122
|
initDatabaseConnection(): Promise<void>;
|
|
117
123
|
initControllers(): void;
|
|
118
124
|
writeActiveRoutes(): void;
|
package/lib/endpoint-context.js
CHANGED
|
@@ -911,6 +911,13 @@ class EndpointContext {
|
|
|
911
911
|
return url;
|
|
912
912
|
}
|
|
913
913
|
//#endregion
|
|
914
|
+
/**
|
|
915
|
+
* Port from uri as number
|
|
916
|
+
* @returns {Number | undefined}
|
|
917
|
+
*/
|
|
918
|
+
get port() {
|
|
919
|
+
return this.uri?.port ? Number(this.uri.port) : undefined;
|
|
920
|
+
}
|
|
914
921
|
//#region methods & getters / is https server
|
|
915
922
|
get isHttpServer() {
|
|
916
923
|
return this.uri.protocol === 'https:';
|
|
@@ -992,6 +999,25 @@ class EndpointContext {
|
|
|
992
999
|
//#endregion
|
|
993
1000
|
}
|
|
994
1001
|
//#endregion
|
|
1002
|
+
//#region methods & getters / destroy
|
|
1003
|
+
async destroy() {
|
|
1004
|
+
//#region @websqlFunc
|
|
1005
|
+
if (this.connection) {
|
|
1006
|
+
await this.connection?.destroy();
|
|
1007
|
+
delete this.connection;
|
|
1008
|
+
}
|
|
1009
|
+
if (this.serverTcpUdp) {
|
|
1010
|
+
await new Promise(resolve => {
|
|
1011
|
+
this.serverTcpUdp?.close(() => {
|
|
1012
|
+
resolve(true);
|
|
1013
|
+
});
|
|
1014
|
+
});
|
|
1015
|
+
delete this.serverTcpUdp;
|
|
1016
|
+
}
|
|
1017
|
+
delete this.expressApp;
|
|
1018
|
+
//#endregion
|
|
1019
|
+
}
|
|
1020
|
+
//#endregion
|
|
995
1021
|
//#region methods & getters / init connection
|
|
996
1022
|
async initDatabaseConnection() {
|
|
997
1023
|
//#region @websqlFunc
|