taon 19.0.59 → 19.0.61
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/start.js +5 -3
- package/browser/fesm2022/taon.mjs +81 -24
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-context.d.ts +1 -6
- package/browser/lib/base-classes/base-controller.d.ts +18 -2
- package/browser/lib/base-classes/base-repository.d.ts +1 -1
- package/browser/lib/base-classes/base.d.ts +1 -6
- package/browser/lib/create-context.d.ts +2 -12
- package/browser/lib/endpoint-context.d.ts +3 -0
- package/browser/lib/index.d.ts +5 -18
- package/browser/lib/models.d.ts +6 -0
- package/browser/lib/realtime/realtime-client.d.ts +2 -2
- package/browser/package.json +1 -1
- package/lib/base-classes/base-context.d.ts +1 -6
- package/lib/base-classes/base-controller.d.ts +18 -2
- package/lib/base-classes/base-controller.js +25 -5
- package/lib/base-classes/base-controller.js.map +1 -1
- package/lib/base-classes/base-repository.d.ts +1 -1
- package/lib/base-classes/base-repository.js +12 -6
- package/lib/base-classes/base-repository.js.map +1 -1
- package/lib/base-classes/base.d.ts +1 -6
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/create-context.d.ts +2 -12
- package/lib/create-context.js +21 -11
- package/lib/create-context.js.map +1 -1
- package/lib/endpoint-context.d.ts +3 -0
- package/lib/endpoint-context.js +24 -6
- package/lib/endpoint-context.js.map +1 -1
- package/lib/env/env.angular-node-app.d.ts +3 -0
- package/lib/env/env.angular-node-app.js +5 -2
- package/lib/env/env.angular-node-app.js.map +1 -1
- package/lib/env/env.docs-webapp.d.ts +3 -0
- package/lib/env/env.docs-webapp.js +5 -2
- package/lib/env/env.docs-webapp.js.map +1 -1
- package/lib/env/env.electron-app.d.ts +3 -0
- package/lib/env/env.electron-app.js +5 -2
- package/lib/env/env.electron-app.js.map +1 -1
- package/lib/env/env.mobile-app.d.ts +3 -0
- package/lib/env/env.mobile-app.js +5 -2
- package/lib/env/env.mobile-app.js.map +1 -1
- package/lib/env/env.npm-lib-and-cli-tool.d.ts +3 -0
- package/lib/env/env.npm-lib-and-cli-tool.js +5 -2
- package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
- package/lib/env/env.vscode-plugin.d.ts +3 -0
- package/lib/env/env.vscode-plugin.js +5 -2
- package/lib/env/env.vscode-plugin.js.map +1 -1
- package/lib/index.d.ts +5 -18
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/models.d.ts +6 -0
- package/lib/models.js.map +1 -1
- package/lib/realtime/realtime-client.d.ts +2 -2
- package/lib/realtime/realtime-client.js +13 -7
- package/lib/realtime/realtime-client.js.map +1 -1
- package/lib/realtime/realtime-server.js +17 -14
- package/lib/realtime/realtime-server.js.map +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/package.json +1 -1
- package/websql/fesm2022/taon.mjs +75 -20
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-context.d.ts +1 -6
- package/websql/lib/base-classes/base-controller.d.ts +18 -2
- package/websql/lib/base-classes/base-repository.d.ts +1 -1
- package/websql/lib/base-classes/base.d.ts +1 -6
- package/websql/lib/create-context.d.ts +2 -12
- package/websql/lib/endpoint-context.d.ts +3 -0
- package/websql/lib/index.d.ts +5 -18
- package/websql/lib/models.d.ts +6 -0
- package/websql/lib/realtime/realtime-client.d.ts +2 -2
- package/websql/package.json +1 -1
package/bin/start.js
CHANGED
|
@@ -14,6 +14,11 @@ global.i0 = {
|
|
|
14
14
|
}
|
|
15
15
|
const process= require('process');
|
|
16
16
|
process.removeAllListeners('warning');
|
|
17
|
+
|
|
18
|
+
var ora = require('ora');
|
|
19
|
+
var spinner = ora();
|
|
20
|
+
global.spinner = spinner;
|
|
21
|
+
|
|
17
22
|
//#endregion
|
|
18
23
|
|
|
19
24
|
//#region resolve constants
|
|
@@ -136,10 +141,7 @@ if (procType === 'child-of-root') {
|
|
|
136
141
|
|
|
137
142
|
if (startSpinner) {
|
|
138
143
|
//#region start spinner in processs
|
|
139
|
-
var ora = require('ora');
|
|
140
|
-
var spinner = ora();
|
|
141
144
|
spinner.start();
|
|
142
|
-
global.spinner = spinner;
|
|
143
145
|
|
|
144
146
|
const child_process = require('child_process');
|
|
145
147
|
const orgArgvForChild = orgArgv.filter(a => !a.startsWith('-spinner'));
|
|
@@ -1545,9 +1545,7 @@ class RealtimeClient {
|
|
|
1545
1545
|
this.subsManagers = {};
|
|
1546
1546
|
this.core = core;
|
|
1547
1547
|
if (!core.ctx.disabledRealtime) {
|
|
1548
|
-
//#region @browser
|
|
1549
1548
|
this.init();
|
|
1550
|
-
//#endregion
|
|
1551
1549
|
}
|
|
1552
1550
|
}
|
|
1553
1551
|
//#region methods & getters / init
|
|
@@ -1561,12 +1559,12 @@ class RealtimeClient {
|
|
|
1561
1559
|
if (this.core.ctx.config.frontendHost &&
|
|
1562
1560
|
this.core.ctx.config.frontendHost !== '' &&
|
|
1563
1561
|
this.core.ctx.isRunningInsideDocker) {
|
|
1564
|
-
|
|
1562
|
+
Helpers.logInfo(`[${this.core.ctx.contextName}] USING FRONTEND HOST ${this.core.ctx.config.frontendHost}`);
|
|
1565
1563
|
nspPath.global = new URL(`${this.core.ctx.frontendHostUri.origin}${nspPath.global.pathname}`);
|
|
1566
1564
|
nspPath.realtime = new URL(`${this.core.ctx.frontendHostUri.origin}${nspPath.realtime.pathname}`);
|
|
1567
1565
|
}
|
|
1568
1566
|
else {
|
|
1569
|
-
|
|
1567
|
+
Helpers.logInfo(`[${this.core.ctx.contextName}] NOT USING FRONTEND HOST`);
|
|
1570
1568
|
}
|
|
1571
1569
|
this.core.ctx.logRealtime &&
|
|
1572
1570
|
console.info('[CLIENT] NAMESPACE GLOBAL ', nspPath.global.href + ` host: ${this.core.ctx.host}`);
|
|
@@ -1711,7 +1709,13 @@ to use socket realtime connection;
|
|
|
1711
1709
|
//#endregion
|
|
1712
1710
|
//#region methods & getters / get room id from
|
|
1713
1711
|
getUniqueIdentifierForConnection(options) {
|
|
1714
|
-
|
|
1712
|
+
let url;
|
|
1713
|
+
if (UtilsOs.isBrowser) {
|
|
1714
|
+
url = new URL(options.core.ctx.host);
|
|
1715
|
+
}
|
|
1716
|
+
else {
|
|
1717
|
+
url = new URL(options.core.ctx.remoteHost); // backend-to-backend use remote host
|
|
1718
|
+
}
|
|
1715
1719
|
return `${this.core.ctx.contextName}:${url.origin}|${options.roomName}|${options.property}|${options.customEvent}`;
|
|
1716
1720
|
}
|
|
1717
1721
|
}
|
|
@@ -1731,15 +1735,18 @@ class RealtimeServer {
|
|
|
1731
1735
|
}
|
|
1732
1736
|
//#region methods & getters / init
|
|
1733
1737
|
init() {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1738
|
+
//#region @browser
|
|
1739
|
+
if (!this.core.ctx.config.frontendHost) {
|
|
1740
|
+
console.warn(`[Taon][Realtime]
|
|
1741
|
+
|
|
1742
|
+
Frontend host is not defined
|
|
1743
|
+
REALTIME COMMUNICATION WILL NOT WORK
|
|
1744
|
+
|
|
1745
|
+
provide "frontendHost" property in your taon config
|
|
1746
|
+
|
|
1747
|
+
`);
|
|
1748
|
+
}
|
|
1749
|
+
//#endregion
|
|
1743
1750
|
/* */
|
|
1744
1751
|
/* */
|
|
1745
1752
|
/* */
|
|
@@ -2966,6 +2973,7 @@ class EndpointContext {
|
|
|
2966
2973
|
!this.config.remoteHost.startsWith('https://')) {
|
|
2967
2974
|
Helpers.throw(`[taon-config] Your 'remoteHost' must start with http:// or https://`);
|
|
2968
2975
|
}
|
|
2976
|
+
// console.log(`config for ${this.contextName}`, this.config);
|
|
2969
2977
|
//#region resolve if skipping writing server routes
|
|
2970
2978
|
//@ts-expect-error overriding readonly
|
|
2971
2979
|
this.skipWritingServerRoutes = _.isBoolean(this.config.skipWritingServerRoutes)
|
|
@@ -3002,7 +3010,9 @@ class EndpointContext {
|
|
|
3002
3010
|
// console.log(this.config)
|
|
3003
3011
|
// }
|
|
3004
3012
|
if (!this.mode && !this.config.abstract) {
|
|
3005
|
-
|
|
3013
|
+
const errMsg = `You need to provide host or remoteHost or ` +
|
|
3014
|
+
`useIpcWhenElectron (or mark it as abstract)`;
|
|
3015
|
+
Helpers.error(`[taon] Context "${this.contextName}": ${errMsg}`, false, true);
|
|
3006
3016
|
/* */
|
|
3007
3017
|
/* */
|
|
3008
3018
|
}
|
|
@@ -3178,7 +3188,10 @@ class EndpointContext {
|
|
|
3178
3188
|
//#endregion
|
|
3179
3189
|
//#region prepare realtime
|
|
3180
3190
|
if (!this.config.abstract) {
|
|
3181
|
-
this.disabledRealtime =
|
|
3191
|
+
this.disabledRealtime = this.config.disabledRealtime;
|
|
3192
|
+
/* */
|
|
3193
|
+
/* */
|
|
3194
|
+
/* */
|
|
3182
3195
|
/* */
|
|
3183
3196
|
/* */
|
|
3184
3197
|
/* */
|
|
@@ -4056,6 +4069,18 @@ class EndpointContext {
|
|
|
4056
4069
|
});
|
|
4057
4070
|
}
|
|
4058
4071
|
//#endregion
|
|
4072
|
+
async initControllersHook(allInitedEndpointContexts) {
|
|
4073
|
+
if (this.isRunOrRevertOnlyMigrationAppStart) {
|
|
4074
|
+
return;
|
|
4075
|
+
}
|
|
4076
|
+
const allControllers = this.getClassFunByArr(Models.ClassType.CONTROLLER);
|
|
4077
|
+
for (const controllerClassFn of allControllers) {
|
|
4078
|
+
const instance = this.getInstanceBy(controllerClassFn);
|
|
4079
|
+
if (_.isFunction(instance.afterAllCtxInited)) {
|
|
4080
|
+
await instance.afterAllCtxInited(allInitedEndpointContexts);
|
|
4081
|
+
}
|
|
4082
|
+
}
|
|
4083
|
+
}
|
|
4059
4084
|
async initControllers() {
|
|
4060
4085
|
if (this.isRunOrRevertOnlyMigrationAppStart) {
|
|
4061
4086
|
return;
|
|
@@ -5260,21 +5285,22 @@ const createContext = (configFn) => {
|
|
|
5260
5285
|
/* */
|
|
5261
5286
|
await endpointContextRef.initClasses();
|
|
5262
5287
|
if (endpointContextRef.databaseConfig) {
|
|
5263
|
-
|
|
5288
|
+
//#region handle websql reload data
|
|
5264
5289
|
//#region @browser
|
|
5290
|
+
let keepWebsqlDbDataAfterReload = false;
|
|
5265
5291
|
keepWebsqlDbDataAfterReload =
|
|
5266
5292
|
TaonAdminService.Instance?.keepWebsqlDbDataAfterReload;
|
|
5267
|
-
|
|
5268
|
-
if (!Helpers.isNode && keepWebsqlDbDataAfterReload) {
|
|
5293
|
+
if (keepWebsqlDbDataAfterReload) {
|
|
5269
5294
|
!UtilsOs.isRunningInCliMode() &&
|
|
5270
5295
|
Helpers.info(`[taon] Keeping websql data after reload ` +
|
|
5271
5296
|
`(context=${endpointContextRef.contextName}).`);
|
|
5272
5297
|
}
|
|
5273
5298
|
else {
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
`(context=${endpointContextRef.contextName}).`);
|
|
5299
|
+
Helpers.info(`[taon] Dropping all tables and data ` +
|
|
5300
|
+
`(context=${endpointContextRef.contextName}).`);
|
|
5277
5301
|
}
|
|
5302
|
+
//#endregion
|
|
5303
|
+
//#endregion
|
|
5278
5304
|
//#region TODO this may be usefull but for now
|
|
5279
5305
|
// 2 separate contexts are fine
|
|
5280
5306
|
// const shouldStartRemoteHost = endpointContextRef.mode !== 'remote-backend(tcp+udp)';
|
|
@@ -5288,15 +5314,20 @@ const createContext = (configFn) => {
|
|
|
5288
5314
|
// endpointContextRef.__contextForControllerInstanceAccess = endpointContextRemoteHostRef;
|
|
5289
5315
|
// }
|
|
5290
5316
|
//#endregion
|
|
5317
|
+
//#region run migrations tasks
|
|
5291
5318
|
if (endpointContextRef.onlyMigrationRun) {
|
|
5319
|
+
Helpers.log(`[taon] Running only migrations (context=${endpointContextRef.contextName}).`);
|
|
5292
5320
|
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
5293
5321
|
}
|
|
5294
5322
|
else if (endpointContextRef.onlyMigrationRevertToTimestamp) {
|
|
5323
|
+
Helpers.log(`[taon] Reverting migrations to timestamp ${endpointContextRef.onlyMigrationRevertToTimestamp} (context=${endpointContextRef.contextName}).`);
|
|
5295
5324
|
await endpointContextRef.dbMigrations.revertMigrationToTimestamp(endpointContextRef.onlyMigrationRevertToTimestamp);
|
|
5296
5325
|
}
|
|
5297
5326
|
else {
|
|
5327
|
+
Helpers.log(`[taon] Running all not applied migrations (context=${endpointContextRef.contextName}).`);
|
|
5298
5328
|
await endpointContextRef.dbMigrations.runAllNotCompletedMigrations();
|
|
5299
5329
|
}
|
|
5330
|
+
//#endregion
|
|
5300
5331
|
}
|
|
5301
5332
|
resolve(endpointContextRef);
|
|
5302
5333
|
});
|
|
@@ -5834,6 +5865,14 @@ let BaseRepository = class BaseRepository extends BaseCustomRepository {
|
|
|
5834
5865
|
/* */
|
|
5835
5866
|
/* */
|
|
5836
5867
|
/* */
|
|
5868
|
+
/* */
|
|
5869
|
+
/* */
|
|
5870
|
+
/* */
|
|
5871
|
+
/* */
|
|
5872
|
+
/* */
|
|
5873
|
+
/* */
|
|
5874
|
+
/* */
|
|
5875
|
+
/* */
|
|
5837
5876
|
return (void 0);
|
|
5838
5877
|
}
|
|
5839
5878
|
/**
|
|
@@ -6368,6 +6407,11 @@ function Body(name) {
|
|
|
6368
6407
|
/* */
|
|
6369
6408
|
/* */
|
|
6370
6409
|
let BaseController = class BaseController extends BaseInjector {
|
|
6410
|
+
/**
|
|
6411
|
+
* Hook that is called when taon app is inited
|
|
6412
|
+
* (all contexts are created and inited)
|
|
6413
|
+
*/
|
|
6414
|
+
async afterAllCtxInited(allContexts) { }
|
|
6371
6415
|
//#region upload form data to server
|
|
6372
6416
|
uploadFormDataToServer(formData) {
|
|
6373
6417
|
/* */
|
|
@@ -6391,11 +6435,24 @@ let BaseController = class BaseController extends BaseInjector {
|
|
|
6391
6435
|
/* */
|
|
6392
6436
|
/* */
|
|
6393
6437
|
/* */
|
|
6438
|
+
/* */
|
|
6439
|
+
/* */
|
|
6440
|
+
/* */
|
|
6441
|
+
/* */
|
|
6442
|
+
/* */
|
|
6394
6443
|
return (void 0);
|
|
6395
6444
|
}
|
|
6396
6445
|
//#endregion
|
|
6446
|
+
//#region after file upload hook
|
|
6447
|
+
/**
|
|
6448
|
+
* Hook after file is uploaded
|
|
6449
|
+
* through `uploadFormDataToServer` or `uploadLocalFileToServer`
|
|
6450
|
+
*/
|
|
6451
|
+
afterFileUploadAction(file) {
|
|
6452
|
+
// empty
|
|
6453
|
+
}
|
|
6397
6454
|
//#region upload local file to server
|
|
6398
|
-
async uploadLocalFileToServer(absFilePath) {
|
|
6455
|
+
async uploadLocalFileToServer(absFilePath, options) {
|
|
6399
6456
|
/* */
|
|
6400
6457
|
/* */
|
|
6401
6458
|
/* */
|
|
@@ -7034,5 +7091,5 @@ var Taon;
|
|
|
7034
7091
|
* Generated bundle index. Do not edit.
|
|
7035
7092
|
*/
|
|
7036
7093
|
|
|
7037
|
-
export { BaseContext, BaseController, BaseCustomRepository, BaseEntity, BaseMigration, BaseProvider, BaseRepository, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, EndpointContext, Models, TAON_CONTEXT, Taon, TaonAdminService, TaonEntityKeysToOmitArr, apiPrefix, createContext, inject };
|
|
7094
|
+
export { BaseContext, BaseController, BaseCustomRepository, BaseEntity, BaseFileUploadMiddleware, BaseMigration, BaseProvider, BaseRepository, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, EndpointContext, Models, TAON_CONTEXT, Taon, TaonAdminService, TaonEntityKeysToOmitArr, apiPrefix, createContext, inject };
|
|
7038
7095
|
//# sourceMappingURL=taon.mjs.map
|