taon 21.0.52 → 21.0.53
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/bin/taon +5 -5
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +4 -4
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/icon-menu-taon.svg +15 -15
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-abstract-entity.js +33 -0
- package/lib-prod/base-classes/base-angular-service.js +56 -0
- package/lib-prod/base-classes/base-class.js +37 -0
- package/lib-prod/base-classes/base-context.js +21 -0
- package/lib-prod/base-classes/base-controller.js +162 -0
- package/lib-prod/base-classes/base-crud-controller.js +235 -0
- package/lib-prod/base-classes/base-custom-repository.js +20 -0
- package/lib-prod/base-classes/base-electron-service.js +0 -0
- package/lib-prod/base-classes/base-entity.js +32 -0
- package/lib-prod/base-classes/base-file-upload.middleware.js +78 -0
- package/lib-prod/base-classes/base-injector.js +202 -0
- package/lib-prod/base-classes/base-middleware.js +6 -0
- package/lib-prod/base-classes/base-migration.js +23 -0
- package/lib-prod/base-classes/base-provider.js +6 -0
- package/lib-prod/base-classes/base-repository.js +589 -0
- package/lib-prod/base-classes/base-subscriber-for-entity.js +154 -0
- package/lib-prod/base-classes/base.js +0 -0
- package/lib-prod/build-info._auto-generated_.js +14 -0
- package/lib-prod/config/controller-config.js +28 -0
- package/lib-prod/config/controller-options.js +6 -0
- package/lib-prod/config/method-config.js +9 -0
- package/lib-prod/config/param-config.js +9 -0
- package/lib-prod/constants.js +29 -0
- package/lib-prod/context-db-migrations.js +339 -0
- package/lib-prod/create-context.js +152 -0
- package/lib-prod/decorators/classes/controller-decorator.js +21 -0
- package/lib-prod/decorators/classes/entity-decorator.js +49 -0
- package/lib-prod/decorators/classes/middleware-decorator.js +26 -0
- package/lib-prod/decorators/classes/migration-decorator.js +24 -0
- package/lib-prod/decorators/classes/provider-decorator.js +25 -0
- package/lib-prod/decorators/classes/repository-decorator.js +24 -0
- package/lib-prod/decorators/classes/subscriber-decorator.js +25 -0
- package/lib-prod/decorators/decorator-abstract-opt.js +5 -0
- package/lib-prod/decorators/http/http-decorators.js +5 -0
- package/lib-prod/decorators/http/http-methods-decorators.js +144 -0
- package/lib-prod/decorators/http/http-params-decorators.js +68 -0
- package/lib-prod/dependency-injection/di-container.js +31 -0
- package/lib-prod/endpoint-context-storage.js +36 -0
- package/lib-prod/endpoint-context.js +2033 -0
- package/lib-prod/entity-process.js +214 -0
- package/lib-prod/env/env.angular-node-app.js +130 -0
- package/lib-prod/env/env.docs-webapp.js +130 -0
- package/lib-prod/env/env.electron-app.js +130 -0
- package/lib-prod/env/env.mobile-app.js +130 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -0
- package/lib-prod/env/env.vscode-plugin.js +130 -0
- package/lib-prod/env/index.js +6 -0
- package/lib-prod/express-types.js +0 -0
- package/lib-prod/formly/formly.models.js +0 -0
- package/lib-prod/formly/fromly.js +184 -0
- package/lib-prod/formly/type-from-entity.js +58 -0
- package/lib-prod/get-response-value.js +19 -0
- package/lib-prod/global-state/taon-global-state/index.js +5 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +20 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +10 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +22 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +34 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +22 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +47 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +29 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +11 -0
- package/lib-prod/global-state/taon-transaction-registry/index.js +10 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +8 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +41 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +56 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +10 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +22 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +36 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +29 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +6 -0
- package/lib-prod/helpers/class-helpers.js +195 -0
- package/lib-prod/helpers/clone-obj.js +21 -0
- package/lib-prod/helpers/taon-helpers.js +129 -0
- package/lib-prod/index._auto-generated_.js +0 -0
- package/lib-prod/index.js +231 -0
- package/lib-prod/inject.js +34 -0
- package/lib-prod/migrations/index.js +1 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -0
- package/lib-prod/models.js +109 -0
- package/lib-prod/orm/columns.js +124 -0
- package/lib-prod/orm/index.js +1 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +196 -0
- package/lib-prod/realtime/realtime-core.js +82 -0
- package/lib-prod/realtime/realtime-server.js +252 -0
- package/lib-prod/realtime/realtime-strategy/index.js +4 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +226 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +262 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +21 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +14 -0
- package/lib-prod/realtime/realtime-subs-manager.js +96 -0
- package/lib-prod/realtime/realtime.models.js +0 -0
- package/lib-prod/symbols.js +109 -0
- package/lib-prod/ui/index.js +5 -0
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +5 -0
- package/lib-prod/validators.js +74 -0
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib-prod/base-classes/base-abstract-entity.ts +0 -34
- package/lib-prod/base-classes/base-angular-service.ts +0 -107
- package/lib-prod/base-classes/base-class.ts +0 -46
- package/lib-prod/base-classes/base-context.ts +0 -21
- package/lib-prod/base-classes/base-controller.ts +0 -240
- package/lib-prod/base-classes/base-crud-controller.ts +0 -298
- package/lib-prod/base-classes/base-custom-repository.ts +0 -10
- package/lib-prod/base-classes/base-electron-service.ts +0 -60
- package/lib-prod/base-classes/base-entity.ts +0 -28
- package/lib-prod/base-classes/base-file-upload.middleware.ts +0 -92
- package/lib-prod/base-classes/base-injector.ts +0 -278
- package/lib-prod/base-classes/base-middleware.ts +0 -71
- package/lib-prod/base-classes/base-migration.ts +0 -26
- package/lib-prod/base-classes/base-provider.ts +0 -8
- package/lib-prod/base-classes/base-repository.ts +0 -942
- package/lib-prod/base-classes/base-subscriber-for-entity.ts +0 -196
- package/lib-prod/base-classes/base.ts +0 -31
- package/lib-prod/build-info._auto-generated_.ts +0 -27
- package/lib-prod/config/controller-config.ts +0 -58
- package/lib-prod/config/controller-options.ts +0 -19
- package/lib-prod/config/method-config.ts +0 -55
- package/lib-prod/config/param-config.ts +0 -16
- package/lib-prod/constants.ts +0 -63
- package/lib-prod/context-db-migrations.ts +0 -488
- package/lib-prod/create-context.ts +0 -345
- package/lib-prod/decorators/classes/controller-decorator.ts +0 -25
- package/lib-prod/decorators/classes/entity-decorator.ts +0 -57
- package/lib-prod/decorators/classes/middleware-decorator.ts +0 -29
- package/lib-prod/decorators/classes/migration-decorator.ts +0 -27
- package/lib-prod/decorators/classes/provider-decorator.ts +0 -28
- package/lib-prod/decorators/classes/repository-decorator.ts +0 -26
- package/lib-prod/decorators/classes/subscriber-decorator.ts +0 -28
- package/lib-prod/decorators/decorator-abstract-opt.ts +0 -4
- package/lib-prod/decorators/http/http-decorators.ts +0 -26
- package/lib-prod/decorators/http/http-methods-decorators.ts +0 -275
- package/lib-prod/decorators/http/http-params-decorators.ts +0 -105
- package/lib-prod/dependency-injection/di-container.ts +0 -39
- package/lib-prod/endpoint-context-storage.ts +0 -47
- package/lib-prod/endpoint-context.ts +0 -3110
- package/lib-prod/entity-process.ts +0 -286
- package/lib-prod/env/env.angular-node-app.ts +0 -66
- package/lib-prod/env/env.docs-webapp.ts +0 -66
- package/lib-prod/env/env.electron-app.ts +0 -66
- package/lib-prod/env/env.mobile-app.ts +0 -66
- package/lib-prod/env/env.npm-lib-and-cli-tool.ts +0 -66
- package/lib-prod/env/env.vscode-plugin.ts +0 -66
- package/lib-prod/env/index.ts +0 -6
- package/lib-prod/express-types.ts +0 -4
- package/lib-prod/formly/formly.models.ts +0 -7
- package/lib-prod/formly/fromly.ts +0 -261
- package/lib-prod/formly/type-from-entity.ts +0 -80
- package/lib-prod/get-response-value.ts +0 -30
- package/lib-prod/global-state/taon-global-state/index.ts +0 -6
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.ts +0 -21
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.ts +0 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.ts +0 -44
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.ts +0 -40
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.ts +0 -12
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.ts +0 -48
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.ts +0 -16
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.ts +0 -47
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.ts +0 -18
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.ts +0 -21
- package/lib-prod/global-state/taon-transaction-registry/index.ts +0 -11
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.ts +0 -23
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.ts +0 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.ts +0 -38
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.ts +0 -54
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.ts +0 -12
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.ts +0 -6
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.ts +0 -16
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.ts +0 -29
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.ts +0 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.ts +0 -9
- package/lib-prod/helpers/class-helpers.ts +0 -315
- package/lib-prod/helpers/clone-obj.ts +0 -24
- package/lib-prod/helpers/taon-helpers.ts +0 -181
- package/lib-prod/index._auto-generated_.ts +0 -5
- package/lib-prod/index.ts +0 -323
- package/lib-prod/inject.ts +0 -111
- package/lib-prod/lib-info.md +0 -8
- package/lib-prod/migrations/index.ts +0 -2
- package/lib-prod/migrations/migrations-info.md +0 -6
- package/lib-prod/migrations/migrations_index._auto-generated_.ts +0 -5
- package/lib-prod/models.ts +0 -427
- package/lib-prod/orm/columns.ts +0 -121
- package/lib-prod/orm/index.ts +0 -62
- package/lib-prod/realtime/realtime-client.ts +0 -288
- package/lib-prod/realtime/realtime-core.ts +0 -134
- package/lib-prod/realtime/realtime-server.ts +0 -398
- package/lib-prod/realtime/realtime-strategy/index.ts +0 -4
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.ts +0 -344
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.ts +0 -349
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.ts +0 -30
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.ts +0 -21
- package/lib-prod/realtime/realtime-subs-manager.ts +0 -127
- package/lib-prod/realtime/realtime.models.ts +0 -33
- package/lib-prod/symbols.ts +0 -136
- package/lib-prod/ui/index.ts +0 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.ts +0 -1
- package/lib-prod/validators.ts +0 -103
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { RestResponseWrapper } from "ng2-rest/lib-prod";
|
|
2
|
+
import { ___NS__cloneDeep, ___NS__merge } from "tnp-core/lib-prod";
|
|
3
|
+
class TaonRestResponseWrapper extends RestResponseWrapper {
|
|
4
|
+
}
|
|
5
|
+
const BaseTaonClassesNames = [
|
|
6
|
+
"BaseCrudController",
|
|
7
|
+
"BaseController",
|
|
8
|
+
"BaseAbstractEntity",
|
|
9
|
+
"BaseEntity",
|
|
10
|
+
"BaseContext",
|
|
11
|
+
"BaseCustomRepository",
|
|
12
|
+
"BaseFileUploadMiddleware",
|
|
13
|
+
"BaseMiddleware",
|
|
14
|
+
"BaseClass",
|
|
15
|
+
"BaseInjector",
|
|
16
|
+
"BaseMigration",
|
|
17
|
+
"BaseProvider",
|
|
18
|
+
"BaseRepository",
|
|
19
|
+
"BaseSubscriberForEntity",
|
|
20
|
+
"BaseCliWorkerController",
|
|
21
|
+
"PortsController",
|
|
22
|
+
"PortsContext"
|
|
23
|
+
];
|
|
24
|
+
const TaonTempDatabasesFolder = "databases";
|
|
25
|
+
const TaonTempRoutesFolder = "routes";
|
|
26
|
+
const Models__NS__DatabasesFolder = TaonTempDatabasesFolder;
|
|
27
|
+
var Models__NS__ClassType = /* @__PURE__ */ ((Models__NS__ClassType2) => {
|
|
28
|
+
Models__NS__ClassType2["ENTITY"] = "ENTITY";
|
|
29
|
+
Models__NS__ClassType2["CONTROLLER"] = "CONTROLLER";
|
|
30
|
+
Models__NS__ClassType2["REPOSITORY"] = "REPOSITORY";
|
|
31
|
+
Models__NS__ClassType2["PROVIDER"] = "PROVIDER";
|
|
32
|
+
Models__NS__ClassType2["SUBSCRIBER"] = "SUBSCRIBER";
|
|
33
|
+
Models__NS__ClassType2["MIGRATION"] = "MIGRATION";
|
|
34
|
+
Models__NS__ClassType2["MIDDLEWARE"] = "MIDDLEWARE";
|
|
35
|
+
return Models__NS__ClassType2;
|
|
36
|
+
})(Models__NS__ClassType || {});
|
|
37
|
+
const Models__NS__ClassTypeKey = {
|
|
38
|
+
["ENTITY" /* ENTITY */]: "entities",
|
|
39
|
+
["CONTROLLER" /* CONTROLLER */]: "controllers",
|
|
40
|
+
["REPOSITORY" /* REPOSITORY */]: "repositories",
|
|
41
|
+
["PROVIDER" /* PROVIDER */]: "providers",
|
|
42
|
+
["SUBSCRIBER" /* SUBSCRIBER */]: "subscribers",
|
|
43
|
+
["MIGRATION" /* MIGRATION */]: "migrations",
|
|
44
|
+
["MIDDLEWARE" /* MIDDLEWARE */]: "middlewares"
|
|
45
|
+
};
|
|
46
|
+
class Models__NS__DatabaseConfigTypeOrm {
|
|
47
|
+
/**
|
|
48
|
+
* database name
|
|
49
|
+
*/
|
|
50
|
+
database;
|
|
51
|
+
/**
|
|
52
|
+
* only for file base db: sqlite, sqljs
|
|
53
|
+
*/
|
|
54
|
+
location;
|
|
55
|
+
synchronize;
|
|
56
|
+
dropSchema;
|
|
57
|
+
type;
|
|
58
|
+
/**
|
|
59
|
+
* Persists db on disk/local-storage if serverless db
|
|
60
|
+
*/
|
|
61
|
+
autoSave;
|
|
62
|
+
/**
|
|
63
|
+
* for websql db mode
|
|
64
|
+
* true by default
|
|
65
|
+
*/
|
|
66
|
+
useLocalForage;
|
|
67
|
+
logging;
|
|
68
|
+
databasePort;
|
|
69
|
+
databaseHost;
|
|
70
|
+
databaseUsername;
|
|
71
|
+
databasePassword;
|
|
72
|
+
}
|
|
73
|
+
class Models__NS__DatabaseConfig extends Models__NS__DatabaseConfigTypeOrm {
|
|
74
|
+
/**
|
|
75
|
+
* Default value 'DROP_ALL'.
|
|
76
|
+
*
|
|
77
|
+
* Tell framework what is happening with db
|
|
78
|
+
* when context is starting.
|
|
79
|
+
*/
|
|
80
|
+
recreateMode;
|
|
81
|
+
static from(databasePartialConfig) {
|
|
82
|
+
return ___NS__merge(new Models__NS__DatabaseConfig(), databasePartialConfig);
|
|
83
|
+
}
|
|
84
|
+
get databaseConfigTypeORM() {
|
|
85
|
+
const result = ___NS__cloneDeep(this);
|
|
86
|
+
if (result.recreateMode) {
|
|
87
|
+
if (result.recreateMode === "DROP_DB+MIGRATIONS") {
|
|
88
|
+
result.synchronize = true;
|
|
89
|
+
result.dropSchema = true;
|
|
90
|
+
} else if (result.recreateMode === "PRESERVE_DATA+MIGRATIONS") {
|
|
91
|
+
result.synchronize = false;
|
|
92
|
+
result.dropSchema = false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
delete result.recreateMode;
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
BaseTaonClassesNames,
|
|
101
|
+
Models__NS__ClassType,
|
|
102
|
+
Models__NS__ClassTypeKey,
|
|
103
|
+
Models__NS__DatabaseConfig,
|
|
104
|
+
Models__NS__DatabaseConfigTypeOrm,
|
|
105
|
+
Models__NS__DatabasesFolder,
|
|
106
|
+
TaonRestResponseWrapper,
|
|
107
|
+
TaonTempDatabasesFolder,
|
|
108
|
+
TaonTempRoutesFolder
|
|
109
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Column } from "taon-typeorm/lib-prod";
|
|
2
|
+
import { ___NS__isNil } from "tnp-core/lib-prod";
|
|
3
|
+
import {
|
|
4
|
+
Repository,
|
|
5
|
+
Connection,
|
|
6
|
+
Generated as Generated2,
|
|
7
|
+
AfterInsert,
|
|
8
|
+
AfterLoad,
|
|
9
|
+
AfterRecover,
|
|
10
|
+
AfterRemove,
|
|
11
|
+
AfterSoftRemove,
|
|
12
|
+
AfterUpdate,
|
|
13
|
+
BeforeInsert,
|
|
14
|
+
BeforeRecover,
|
|
15
|
+
BeforeRemove,
|
|
16
|
+
BeforeSoftRemove,
|
|
17
|
+
BeforeUpdate,
|
|
18
|
+
TreeChildren,
|
|
19
|
+
TreeParent,
|
|
20
|
+
PrimaryGeneratedColumn,
|
|
21
|
+
PrimaryColumn,
|
|
22
|
+
Index,
|
|
23
|
+
CreateDateColumn,
|
|
24
|
+
UpdateDateColumn,
|
|
25
|
+
DeleteDateColumn,
|
|
26
|
+
Column as Column2,
|
|
27
|
+
VersionColumn,
|
|
28
|
+
VirtualColumn,
|
|
29
|
+
JoinTable,
|
|
30
|
+
JoinColumn,
|
|
31
|
+
OneToMany,
|
|
32
|
+
OneToOne,
|
|
33
|
+
ManyToMany,
|
|
34
|
+
ManyToOne
|
|
35
|
+
} from "taon-typeorm/lib-prod";
|
|
36
|
+
import { Column as Column3 } from "taon-typeorm/lib-prod";
|
|
37
|
+
import { Generated as Generated3 } from "taon-typeorm/lib-prod";
|
|
38
|
+
const StringColumn = (defaultValue = null, length = 100) => Column({
|
|
39
|
+
type: "varchar",
|
|
40
|
+
length,
|
|
41
|
+
nullable: ___NS__isNil(defaultValue),
|
|
42
|
+
default: defaultValue
|
|
43
|
+
});
|
|
44
|
+
const String100Column = (defaultValue = null) => Column({
|
|
45
|
+
type: "varchar",
|
|
46
|
+
length: 100,
|
|
47
|
+
nullable: ___NS__isNil(defaultValue),
|
|
48
|
+
default: defaultValue
|
|
49
|
+
});
|
|
50
|
+
const String20Column = (defaultValue = null) => Column({
|
|
51
|
+
type: "varchar",
|
|
52
|
+
length: 20,
|
|
53
|
+
nullable: ___NS__isNil(defaultValue),
|
|
54
|
+
default: defaultValue
|
|
55
|
+
});
|
|
56
|
+
const String45Column = (defaultValue = null) => Column({
|
|
57
|
+
type: "varchar",
|
|
58
|
+
length: 45,
|
|
59
|
+
nullable: ___NS__isNil(defaultValue),
|
|
60
|
+
default: defaultValue
|
|
61
|
+
});
|
|
62
|
+
const String500Column = (defaultValue = null) => Column({
|
|
63
|
+
type: "varchar",
|
|
64
|
+
length: 500,
|
|
65
|
+
nullable: ___NS__isNil(defaultValue),
|
|
66
|
+
default: defaultValue
|
|
67
|
+
});
|
|
68
|
+
const String200Column = (defaultValue = null) => Column({
|
|
69
|
+
type: "varchar",
|
|
70
|
+
length: 200,
|
|
71
|
+
nullable: ___NS__isNil(defaultValue),
|
|
72
|
+
default: defaultValue
|
|
73
|
+
});
|
|
74
|
+
const NumberColumn = () => Column({ type: "int", nullable: true });
|
|
75
|
+
const DecimalNumberColumn = () => Column({ type: "float", nullable: true });
|
|
76
|
+
const SimpleJsonColumn = () => Column({ type: "simple-json", nullable: true });
|
|
77
|
+
const BooleanColumn = (defaultValue) => Column({ type: "boolean", nullable: true, default: defaultValue });
|
|
78
|
+
const DateTimeColumn = (defaultValue = null) => Column({ type: "datetime", nullable: true, default: defaultValue });
|
|
79
|
+
export {
|
|
80
|
+
AfterInsert,
|
|
81
|
+
AfterLoad,
|
|
82
|
+
AfterRecover,
|
|
83
|
+
AfterRemove,
|
|
84
|
+
AfterSoftRemove,
|
|
85
|
+
AfterUpdate,
|
|
86
|
+
BeforeInsert,
|
|
87
|
+
BeforeRecover,
|
|
88
|
+
BeforeRemove,
|
|
89
|
+
BeforeSoftRemove,
|
|
90
|
+
BeforeUpdate,
|
|
91
|
+
BooleanColumn,
|
|
92
|
+
Column2 as Column,
|
|
93
|
+
Connection,
|
|
94
|
+
CreateDateColumn,
|
|
95
|
+
Column3 as CustomColumn,
|
|
96
|
+
DateTimeColumn,
|
|
97
|
+
DecimalNumberColumn,
|
|
98
|
+
DeleteDateColumn,
|
|
99
|
+
Generated2 as Generated,
|
|
100
|
+
Generated3 as GeneratedColumn,
|
|
101
|
+
Index,
|
|
102
|
+
JoinColumn,
|
|
103
|
+
JoinTable,
|
|
104
|
+
ManyToMany,
|
|
105
|
+
ManyToOne,
|
|
106
|
+
NumberColumn,
|
|
107
|
+
OneToMany,
|
|
108
|
+
OneToOne,
|
|
109
|
+
PrimaryColumn,
|
|
110
|
+
PrimaryGeneratedColumn,
|
|
111
|
+
Repository,
|
|
112
|
+
SimpleJsonColumn,
|
|
113
|
+
String100Column,
|
|
114
|
+
String200Column,
|
|
115
|
+
String20Column,
|
|
116
|
+
String45Column,
|
|
117
|
+
String500Column,
|
|
118
|
+
StringColumn,
|
|
119
|
+
TreeChildren,
|
|
120
|
+
TreeParent,
|
|
121
|
+
UpdateDateColumn,
|
|
122
|
+
VersionColumn,
|
|
123
|
+
VirtualColumn
|
|
124
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./columns";
|
package/lib-prod/package.json
CHANGED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { ___NS__isObject, ___NS__isString } from "tnp-core/lib-prod";
|
|
3
|
+
import { Helpers__NS__logInfo } from "tnp-core/lib-prod";
|
|
4
|
+
import { ClassHelpers__NS__getClassFnFromObject, ClassHelpers__NS__getName, ClassHelpers__NS__getUniqueKey } from "../helpers/class-helpers";
|
|
5
|
+
import { Symbols__NS__REALTIME } from "../symbols";
|
|
6
|
+
import { RealtimeSubsManager } from "./realtime-subs-manager";
|
|
7
|
+
class RealtimeClient {
|
|
8
|
+
constructor(core) {
|
|
9
|
+
this.core = core;
|
|
10
|
+
this.core = core;
|
|
11
|
+
if (!core.ctx.disabledRealtime) {
|
|
12
|
+
this.init();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
subsManagers = {};
|
|
16
|
+
//#region methods & getters / init
|
|
17
|
+
init() {
|
|
18
|
+
const nspPath = {
|
|
19
|
+
global: this.core.pathFor(),
|
|
20
|
+
realtime: this.core.pathFor(
|
|
21
|
+
Symbols__NS__REALTIME.NAMESPACE(this.core.ctx.contextName)
|
|
22
|
+
)
|
|
23
|
+
};
|
|
24
|
+
if (this.core.ctx.config.frontendHost && this.core.ctx.config.frontendHost !== "" && this.core.ctx.isRunningInsideDocker) {
|
|
25
|
+
this.core.ctx.logRealtime && Helpers__NS__logInfo(
|
|
26
|
+
`[${this.core.ctx.contextName}] USING FRONTEND HOST ${this.core.ctx.config.frontendHost} FOR REALTIME`
|
|
27
|
+
);
|
|
28
|
+
nspPath.global = new URL(
|
|
29
|
+
`${this.core.ctx.frontendHostUri.origin}${nspPath.global.pathname}`
|
|
30
|
+
);
|
|
31
|
+
nspPath.realtime = new URL(
|
|
32
|
+
`${this.core.ctx.frontendHostUri.origin}${nspPath.realtime.pathname}`
|
|
33
|
+
);
|
|
34
|
+
} else {
|
|
35
|
+
this.core.ctx.logRealtime && Helpers__NS__logInfo(
|
|
36
|
+
`[${this.core.ctx.contextName}] Not using frontend host for realtime`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
this.core.ctx.logRealtime && console.info(
|
|
40
|
+
"[CLIENT] NAMESPACE GLOBAL ",
|
|
41
|
+
nspPath.global.href + ` host: ${this.core.ctx.host}`
|
|
42
|
+
);
|
|
43
|
+
this.core.ctx.logRealtime && console.info(
|
|
44
|
+
"[CLIENT] NAMESPACE REALTIME",
|
|
45
|
+
nspPath.realtime.href + ` host: ${this.core.ctx.host}`
|
|
46
|
+
);
|
|
47
|
+
this.core.conectSocketFE = this.core.strategy.ioClient(
|
|
48
|
+
nspPath.global.origin,
|
|
49
|
+
{
|
|
50
|
+
path: nspPath.global.pathname
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
if (this.core.conectSocketFE.on) {
|
|
54
|
+
this.core.conectSocketFE.on("connect", () => {
|
|
55
|
+
this.core.ctx.logRealtime && console.info(
|
|
56
|
+
`[CLIENT] connected to GLOBAL namespace ${nspPath.global.pathname} of host: ${this.core.ctx.host}`
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
this.core.socketFE = this.core.strategy.ioClient(nspPath.realtime.origin, {
|
|
61
|
+
path: nspPath.realtime.pathname
|
|
62
|
+
});
|
|
63
|
+
if (this.core.socketFE.on) {
|
|
64
|
+
this.core.socketFE.on("connect", () => {
|
|
65
|
+
this.core.ctx.logRealtime && console.info(
|
|
66
|
+
`[CLIENT] connected to REALTIME namespace ${nspPath.realtime.pathname} host: ${this.core.ctx.host}`
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region methods & getters / listen changes entity
|
|
73
|
+
/**
|
|
74
|
+
* Usage:
|
|
75
|
+
* myContext.realtimeClient.listenChangesEntity(myEntityInstance);
|
|
76
|
+
*
|
|
77
|
+
*
|
|
78
|
+
* Changes trigger on backend needs to be done manually.. example code:
|
|
79
|
+
*
|
|
80
|
+
* myContext.realtimeServer.triggerEntityChanges(myEntityInstance);
|
|
81
|
+
* ...
|
|
82
|
+
*/
|
|
83
|
+
listenChangesEntity(entityClassFnOrObj, options) {
|
|
84
|
+
options = options || {};
|
|
85
|
+
if (___NS__isObject(entityClassFnOrObj)) {
|
|
86
|
+
const orgObj = entityClassFnOrObj;
|
|
87
|
+
entityClassFnOrObj = ClassHelpers__NS__getClassFnFromObject(entityClassFnOrObj);
|
|
88
|
+
const uniqueKey = ClassHelpers__NS__getUniqueKey(entityClassFnOrObj);
|
|
89
|
+
if (uniqueKey) {
|
|
90
|
+
options.idOrUniqValue = orgObj[uniqueKey];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const { property, customEvent } = options;
|
|
94
|
+
const className = !customEvent && ClassHelpers__NS__getName(entityClassFnOrObj);
|
|
95
|
+
if (___NS__isString(property)) {
|
|
96
|
+
if (property.trim() === "") {
|
|
97
|
+
throw new Error(
|
|
98
|
+
`[Taon][listenChangesEntity.. incorrect property '' for ${className}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return new Observable((observer) => {
|
|
103
|
+
if (this.core.ctx.disabledRealtime) {
|
|
104
|
+
console.error(`[Taon][realtime rxjs] remove taon config flag:
|
|
105
|
+
|
|
106
|
+
...
|
|
107
|
+
disabledRealtime: true
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
to use socket realtime connection;
|
|
111
|
+
`);
|
|
112
|
+
return () => {
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
let roomName;
|
|
116
|
+
if (customEvent) {
|
|
117
|
+
roomName = Symbols__NS__REALTIME.ROOM_NAME_CUSTOM(
|
|
118
|
+
this.core.ctx.contextName,
|
|
119
|
+
customEvent
|
|
120
|
+
);
|
|
121
|
+
} else {
|
|
122
|
+
roomName = ___NS__isString(property) ? Symbols__NS__REALTIME.ROOM_NAME_UPDATE_ENTITY_PROPERTY(
|
|
123
|
+
this.core.ctx.contextName,
|
|
124
|
+
className,
|
|
125
|
+
property,
|
|
126
|
+
options.idOrUniqValue
|
|
127
|
+
) : Symbols__NS__REALTIME.ROOM_NAME_UPDATE_ENTITY(
|
|
128
|
+
this.core.ctx.contextName,
|
|
129
|
+
className,
|
|
130
|
+
options.idOrUniqValue
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
const roomSubOptions = {
|
|
134
|
+
core: this.core,
|
|
135
|
+
property,
|
|
136
|
+
roomName,
|
|
137
|
+
customEvent
|
|
138
|
+
};
|
|
139
|
+
const subManagerId = this.getUniqueIdentifierForConnection(roomSubOptions);
|
|
140
|
+
if (!this.subsManagers[subManagerId]) {
|
|
141
|
+
this.subsManagers[subManagerId] = new RealtimeSubsManager(
|
|
142
|
+
roomSubOptions
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
const inst = this.subsManagers[subManagerId];
|
|
146
|
+
inst.add(observer);
|
|
147
|
+
inst.startListenIfNotStarted(this.core.socketFE);
|
|
148
|
+
return () => {
|
|
149
|
+
inst.remove(observer);
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region listen changes entity table
|
|
155
|
+
/**
|
|
156
|
+
* Listen changes entity table
|
|
157
|
+
* Example: for pagination, lists update ...
|
|
158
|
+
*/
|
|
159
|
+
listenChangesEntityTable(entityClassFn) {
|
|
160
|
+
const className = ClassHelpers__NS__getName(entityClassFn);
|
|
161
|
+
return this.listenChangesEntity(entityClassFn, {
|
|
162
|
+
customEvent: Symbols__NS__REALTIME.TABLE_CHANGE(
|
|
163
|
+
this.core.ctx.contextName,
|
|
164
|
+
className
|
|
165
|
+
)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region listen changes custom event
|
|
170
|
+
listenChangesCustomEvent(customEvent) {
|
|
171
|
+
return this.listenChangesEntity(void 0, {
|
|
172
|
+
customEvent
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region methods & getters / trigger custom event\
|
|
177
|
+
/**
|
|
178
|
+
* Trigger custom event on backend
|
|
179
|
+
* @param customEvent global event name
|
|
180
|
+
* @param dataToPush
|
|
181
|
+
*/
|
|
182
|
+
triggerCustomEvent(customEvent, dataToPush) {
|
|
183
|
+
this.core.socketFE.emit(customEvent, dataToPush);
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region methods & getters / get room id from
|
|
187
|
+
getUniqueIdentifierForConnection(options) {
|
|
188
|
+
let url = new URL(options.core.ctx.host);
|
|
189
|
+
let contextNameForCommunication = options.core.ctx.contextNameForCommunication;
|
|
190
|
+
return `${contextNameForCommunication}:${url.origin}|${options.roomName}|${options.property}|${options.customEvent}`;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
RealtimeClient
|
|
196
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { UtilsOs__NS__isElectron, UtilsOs__NS__isWebSQL } from "tnp-core/lib-prod";
|
|
2
|
+
import { apiPrefix } from "../constants";
|
|
3
|
+
import { RealtimeClient } from "./realtime-client";
|
|
4
|
+
import { RealtimeServer } from "./realtime-server";
|
|
5
|
+
import {
|
|
6
|
+
RealtimeStrategyIpc,
|
|
7
|
+
RealtimeStrategyMock,
|
|
8
|
+
RealtimeStrategySocketIO
|
|
9
|
+
} from "./realtime-strategy";
|
|
10
|
+
class RealtimeCore {
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region constructor
|
|
13
|
+
constructor(ctx) {
|
|
14
|
+
this.ctx = ctx;
|
|
15
|
+
this.ctx = ctx;
|
|
16
|
+
this.strategy = this.resolveStrategy();
|
|
17
|
+
if (UtilsOs__NS__isWebSQL) {
|
|
18
|
+
this.server = new RealtimeServer(this);
|
|
19
|
+
this.client = new RealtimeClient(this);
|
|
20
|
+
} else {
|
|
21
|
+
this.client = new RealtimeClient(this);
|
|
22
|
+
this.server = new RealtimeServer(this);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//#region fields
|
|
26
|
+
allHttpMethods = [
|
|
27
|
+
"GET",
|
|
28
|
+
"POST",
|
|
29
|
+
"PUT",
|
|
30
|
+
"DELETE",
|
|
31
|
+
"PATCH",
|
|
32
|
+
"OPTIONS",
|
|
33
|
+
"HEAD"
|
|
34
|
+
];
|
|
35
|
+
client;
|
|
36
|
+
server;
|
|
37
|
+
strategy;
|
|
38
|
+
/**
|
|
39
|
+
* global FE socket - only for established connection
|
|
40
|
+
*/
|
|
41
|
+
conectSocketFE;
|
|
42
|
+
/**
|
|
43
|
+
* socket for namespaces and rooms
|
|
44
|
+
*/
|
|
45
|
+
socketFE;
|
|
46
|
+
/**
|
|
47
|
+
* global BE socket - only for established connection
|
|
48
|
+
*/
|
|
49
|
+
connectSocketBE;
|
|
50
|
+
/**
|
|
51
|
+
* socket for namespaces and rooms
|
|
52
|
+
*/
|
|
53
|
+
socketBE;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region methods & getters / resovle staraegy
|
|
56
|
+
resolveStrategy() {
|
|
57
|
+
if (this.ctx.mode === "backend-frontend(websql)" || this.ctx.mode === "backend-frontend(websql-electron)") {
|
|
58
|
+
return new RealtimeStrategyMock(this.ctx);
|
|
59
|
+
}
|
|
60
|
+
if (this.ctx.mode === "backend-frontend(ipc-electron)") {
|
|
61
|
+
return new RealtimeStrategyIpc(this.ctx);
|
|
62
|
+
}
|
|
63
|
+
return new RealtimeStrategySocketIO(this.ctx);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region path for
|
|
67
|
+
pathFor(namespace) {
|
|
68
|
+
let nsp = namespace ? namespace : "";
|
|
69
|
+
nsp = nsp === "/" ? "" : nsp;
|
|
70
|
+
const contextNameForCommunication = this.ctx.contextNameForCommunication;
|
|
71
|
+
let prefix = `${apiPrefix}/${contextNameForCommunication}/udp`;
|
|
72
|
+
if (UtilsOs__NS__isElectron) {
|
|
73
|
+
prefix = ``;
|
|
74
|
+
}
|
|
75
|
+
const href = `${this.ctx.uriOrigin}${this.ctx.uriPathnameOrNothingIfRoot}/${prefix}${prefix && nsp ? "-" + nsp : nsp}`;
|
|
76
|
+
return new URL(href);
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
RealtimeCore
|
|
82
|
+
};
|