taon 19.0.28 → 19.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +5 -21
  2. package/browser/fesm2022/taon.mjs +100 -91
  3. package/browser/fesm2022/taon.mjs.map +1 -1
  4. package/browser/lib/base-classes/base-angular-service.d.ts +1 -0
  5. package/browser/package.json +1 -1
  6. package/client/package.json +1 -1
  7. package/lib/base-classes/base-angular-service.d.ts +1 -0
  8. package/lib/base-classes/base-angular-service.js +9 -0
  9. package/lib/base-classes/base-angular-service.js.map +1 -1
  10. package/lib/build-info._auto-generated_.d.ts +1 -1
  11. package/lib/build-info._auto-generated_.js +1 -1
  12. package/lib/endpoint-context.js +1 -1
  13. package/lib/endpoint-context.js.map +1 -1
  14. package/lib/env/env.angular-node-app.d.ts +13 -0
  15. package/lib/env/env.angular-node-app.js +19 -0
  16. package/lib/env/env.angular-node-app.js.map +1 -0
  17. package/lib/env/env.electron-app.d.ts +13 -0
  18. package/lib/env/env.electron-app.js +19 -0
  19. package/lib/env/env.electron-app.js.map +1 -0
  20. package/lib/env/env.mobile-app.d.ts +13 -0
  21. package/lib/env/env.mobile-app.js +19 -0
  22. package/lib/env/env.mobile-app.js.map +1 -0
  23. package/lib/env/env.npm-lib-and-cli-tool.d.ts +13 -0
  24. package/lib/env/env.npm-lib-and-cli-tool.js +19 -0
  25. package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -0
  26. package/lib/env/env.vscode-plugin.d.ts +13 -0
  27. package/lib/env/env.vscode-plugin.js +19 -0
  28. package/lib/env/env.vscode-plugin.js.map +1 -0
  29. package/lib/env/index.d.ts +5 -0
  30. package/lib/env/index.js +22 -0
  31. package/lib/env/index.js.map +1 -0
  32. package/lib/ui/index.js +2 -2
  33. package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
  34. package/package.json +1 -1
  35. package/tmp-environment.json +3 -3
  36. package/websql/fesm2022/taon.mjs +100 -91
  37. package/websql/fesm2022/taon.mjs.map +1 -1
  38. package/websql/lib/base-classes/base-angular-service.d.ts +1 -0
  39. package/websql/package.json +1 -1
  40. package/client/README.md +0 -24
  41. package/client/fesm2022/taon.mjs +0 -6445
  42. package/client/fesm2022/taon.mjs.map +0 -1
  43. package/client/index.d.ts +0 -6
  44. package/client/lib/base-classes/base-abstract-entity.d.ts +0 -8
  45. package/client/lib/base-classes/base-angular-service.d.ts +0 -20
  46. package/client/lib/base-classes/base-class.d.ts +0 -9
  47. package/client/lib/base-classes/base-context.d.ts +0 -27
  48. package/client/lib/base-classes/base-controller.d.ts +0 -10
  49. package/client/lib/base-classes/base-crud-controller.d.ts +0 -28
  50. package/client/lib/base-classes/base-custom-repository.d.ts +0 -4
  51. package/client/lib/base-classes/base-entity.d.ts +0 -17
  52. package/client/lib/base-classes/base-injector.d.ts +0 -69
  53. package/client/lib/base-classes/base-migration.d.ts +0 -12
  54. package/client/lib/base-classes/base-provider.d.ts +0 -9
  55. package/client/lib/base-classes/base-repository.d.ts +0 -264
  56. package/client/lib/base-classes/base-subscriber-for-entity.d.ts +0 -82
  57. package/client/lib/base-classes/base.d.ts +0 -51
  58. package/client/lib/constants.d.ts +0 -8
  59. package/client/lib/context-db-migrations.d.ts +0 -18
  60. package/client/lib/create-context.d.ts +0 -86
  61. package/client/lib/decorators/classes/controller-decorator.d.ts +0 -16
  62. package/client/lib/decorators/classes/entity-decorator.d.ts +0 -20
  63. package/client/lib/decorators/classes/migration-decorator.d.ts +0 -8
  64. package/client/lib/decorators/classes/provider-decorator.d.ts +0 -8
  65. package/client/lib/decorators/classes/repository-decorator.d.ts +0 -8
  66. package/client/lib/decorators/classes/subscriber-decorator.d.ts +0 -9
  67. package/client/lib/decorators/http/http-decorators.d.ts +0 -20
  68. package/client/lib/decorators/http/http-methods-decorators.d.ts +0 -24
  69. package/client/lib/decorators/http/http-params-decorators.d.ts +0 -6
  70. package/client/lib/dependency-injection/di-container.d.ts +0 -6
  71. package/client/lib/endpoint-context.d.ts +0 -133
  72. package/client/lib/entity-process.d.ts +0 -40
  73. package/client/lib/env.d.ts +0 -3
  74. package/client/lib/get-response-value.d.ts +0 -7
  75. package/client/lib/helpers/class-helpers.d.ts +0 -19
  76. package/client/lib/helpers/taon-helpers.d.ts +0 -17
  77. package/client/lib/index.d.ts +0 -136
  78. package/client/lib/inject.d.ts +0 -5
  79. package/client/lib/models.d.ts +0 -212
  80. package/client/lib/orm.d.ts +0 -3
  81. package/client/lib/realtime/realtime-client.d.ts +0 -38
  82. package/client/lib/realtime/realtime-core.d.ts +0 -41
  83. package/client/lib/realtime/realtime-server.d.ts +0 -19
  84. package/client/lib/realtime/realtime-strategy/index.d.ts +0 -5
  85. package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +0 -82
  86. package/client/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +0 -15
  87. package/client/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +0 -16
  88. package/client/lib/realtime/realtime-strategy/realtime-strategy.d.ts +0 -12
  89. package/client/lib/realtime/realtime-subs-manager.d.ts +0 -15
  90. package/client/lib/realtime/realtime.models.d.ts +0 -15
  91. package/client/lib/symbols.d.ts +0 -68
  92. package/client/lib/ui/index.d.ts +0 -2
  93. package/client/lib/ui/taon-admin-mode-configuration/index.d.ts +0 -2
  94. package/client/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +0 -22
  95. package/client/lib/validators.d.ts +0 -8
  96. package/client/public-api.d.ts +0 -2
package/README.md CHANGED
@@ -128,12 +128,8 @@ rm -rf ~/.taon # taon local packages repository
128
128
  Installation happens when you first time use taon
129
129
  ```jsonc
130
130
  [
131
- // tool for minifying js (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
132
- { name: 'ncc', version: '0.36.0', installName: '@vercel/ncc' },
133
131
  // zip extractor.. no needed anymore (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
134
- { name: 'extract-zip', version: '1.6.7' },
135
- // copy catalogs (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
136
- { name: 'cpr' },
132
+ { name: 'extract-zip', version: '1.6.7' },
137
133
  // check version of your nodejs
138
134
  { name: 'check-node-version' },
139
135
  // alternative not npx ( it wil not download package from npm if is not installed )
@@ -142,12 +138,6 @@ Installation happens when you first time use taon
142
138
  { name: 'rimraf', version: '3.0.2' },
143
139
  //handy for recreating catalogs
144
140
  { name: 'mkdirp' },
145
- // rename files in build (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
146
- { name: 'renamer', version: '2.0.1' },
147
- // run/watch node server (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
148
- { name: 'nodemon' },
149
- // check circural deps (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
150
- { name: 'madge' },
151
141
  // package manager
152
142
  { name: 'yarn' },
153
143
  // https server with --base-href
@@ -156,21 +146,15 @@ Installation happens when you first time use taon
156
146
  { name: 'prettier' },
157
147
  // process killer
158
148
  { name: 'fkill', installName: 'fkill-cli' },
159
- // for unit tests runner (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
149
+ // for unit tests runner
160
150
  { name: 'mocha' },
161
151
  // for unit tests runner
162
152
  { name: 'jest' },
163
- // run ts code directly (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
153
+ // run ts like js
164
154
  { name: 'ts-node' },
165
155
  // oficial vsce package striped out from some restrictions
166
156
  { name: 'taon-vsce' },
167
- // analyze you final bundle (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
168
- { name: 'webpack-bundle-analyzer' },
169
- // strip types from TypeScript
170
- { name: 'babel', installName: 'babel-cli' },
171
- // create js bundle that are not human readable (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
172
- { name: 'javascript-obfuscator', version: '4' },
173
- // minify js (WILL BE REMOVED SOON FROM GLOBAL DEPSS)
174
- { name: 'uglifyjs', installName: 'uglify-js' },
157
+ // analyze you final bundle
158
+ { name: 'webpack-bundle-analyzer' }
175
159
  ]
176
160
  ```
@@ -761,6 +761,95 @@ let CURRENT_HOST_BACKEND_PORT;
761
761
  //#region @browser
762
762
  CURRENT_HOST_BACKEND_PORT = new InjectionToken('CURRENT_HOST_BACKEND_PORT');
763
763
 
764
+ const inject = (entity) => {
765
+ return new Proxy({}, {
766
+ get: (_, propName) => {
767
+ if (propName === 'hasOwnProperty') {
768
+ return () => false;
769
+ }
770
+ const ctor = entity();
771
+ const contextFromClass = ctor[Symbols.ctxInClassOrClassObj];
772
+ const resultContext = contextFromClass;
773
+ if (resultContext) {
774
+ let instance = resultContext.inject(ctor, {
775
+ parentInstanceThatWillGetInjectedStuff: this,
776
+ });
777
+ // console.log('instance', instance);
778
+ if (propName === 'getOriginalPrototype') {
779
+ return () => Object.getPrototypeOf(instance);
780
+ }
781
+ if (propName === 'getOriginalConstructor') {
782
+ return () => instance.constructor;
783
+ }
784
+ const methods = ctor[Symbols.classMethodsNames] || [];
785
+ const isMethods = methods.includes(propName);
786
+ const methodOrProperty = isMethods
787
+ ? instance[propName].bind(instance)
788
+ : instance[propName];
789
+ // console.log(
790
+ // `methodOrProperty from proxy ${propName?.toString()} = isMethods:${isMethods}`,
791
+ // methods,
792
+ // );
793
+ return methodOrProperty;
794
+ }
795
+ },
796
+ });
797
+ };
798
+ // export const injectController = inject;
799
+ // export type SubscriptionEvent<T> = {
800
+ // name: keyof T;
801
+ // data: any;
802
+ // };
803
+ /**
804
+ * TODO
805
+ */
806
+ // export const injectEntityEvents = <T>(
807
+ // subscriberClassResolveFn: () => new (...args: any[]) => T,
808
+ // eventName?: keyof Omit<EntitySubscriberInterface,'listenTo'> ,
809
+ // ): Observable<SubscriptionEvent<T>> => {
810
+ // const eventsSrc = new Subject<SubscriptionEvent<T>>();
811
+ // const obs = eventsSrc.asObservable();
812
+ // let isFirstSubscription = true;
813
+ // const proxyObservable = new Proxy(obs, {
814
+ // get(target, prop, receiver) {
815
+ // if (prop === 'subscribe') {
816
+ // return (...args: any[]) => {
817
+ // if (isFirstSubscription) {
818
+ // isFirstSubscription = false;
819
+ // const subscriberClassFN: typeof BaseClass =
820
+ // subscriberClassResolveFn() as any;
821
+ // const ctx = subscriberClassFN[
822
+ // Symbols.ctxInClassOrClassObj
823
+ // ] as EndpointContext;
824
+ // if (!ctx) {
825
+ // throw new Error(
826
+ // `You are trying to inject class without context. Use context like this:
827
+ // class MyClassSubscriber extends BaseSubscriber {
828
+ // ${eventName as any}() {
829
+ // \/\/ your code here
830
+ // }
831
+ // }
832
+ // Taon.injectSubscriberEvents( MyContext.getInstance(()=> MyClassSubscriber), '${eventName as any}' )
833
+ // `,
834
+ // );
835
+ // }
836
+ // const subscriberInstance = ctx.getInstanceBy(subscriberClassFN);
837
+ // // subscriberInstance TODO @LAST subscriber event from instance
838
+ // // const entity = subscriberClassFN.prototype.listenTo();
839
+ // console.log('First subscription, you can access arguments here:', {
840
+ // subscriberClassFN,
841
+ // eventName,
842
+ // });
843
+ // }
844
+ // return target.subscribe(...args);
845
+ // };
846
+ // }
847
+ // return Reflect.get(target, prop, receiver);
848
+ // },
849
+ // });
850
+ // return proxyObservable as Observable<SubscriptionEvent<T>>;
851
+ // };
852
+
764
853
  /**
765
854
  * TODO prevent calling methods when not initialized
766
855
  * with init(ctx)
@@ -772,7 +861,9 @@ class BaseAngularsService {
772
861
  //#region @browser
773
862
  this.currentContext = inject$1(TAON_CONTEXT);
774
863
  //#region @browser
775
- this.CURRENT_HOST_BACKEND_PORT = inject$1(CURRENT_HOST_BACKEND_PORT);
864
+ this.CURRENT_HOST_BACKEND_PORT = inject$1(CURRENT_HOST_BACKEND_PORT, {
865
+ optional: true,
866
+ });
776
867
  // #endregion
777
868
  }
778
869
  /**
@@ -783,6 +874,13 @@ class BaseAngularsService {
783
874
  get host() {
784
875
  return `http://localhost:${this.CURRENT_HOST_BACKEND_PORT}`;
785
876
  }
877
+ injectController(ctor) {
878
+ let currentContext;
879
+ //#region @browser
880
+ currentContext = this.currentContext;
881
+ //#endregion
882
+ return inject(() => currentContext.getClass(ctor));
883
+ }
786
884
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BaseAngularsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
787
885
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BaseAngularsService }); }
788
886
  }
@@ -4197,7 +4295,7 @@ class EndpointContext {
4197
4295
  const orgMethods = target.prototype[methodConfig.methodName];
4198
4296
  //#region handle electron ipc request
4199
4297
  if (Helpers.isElectron) {
4200
- const { ipcRenderer } = await import('electron');
4298
+ const ipcRenderer = window.require('electron').ipcRenderer;
4201
4299
  target.prototype[methodConfig.methodName] = function (...args) {
4202
4300
  const received = new Promise(async (resolve, reject) => {
4203
4301
  const headers = {};
@@ -6299,95 +6397,6 @@ var Http;
6299
6397
  })(Param = Http.Param || (Http.Param = {}));
6300
6398
  })(Http || (Http = {}));
6301
6399
 
6302
- const inject = (entity) => {
6303
- return new Proxy({}, {
6304
- get: (_, propName) => {
6305
- if (propName === 'hasOwnProperty') {
6306
- return () => false;
6307
- }
6308
- const ctor = entity();
6309
- const contextFromClass = ctor[Symbols.ctxInClassOrClassObj];
6310
- const resultContext = contextFromClass;
6311
- if (resultContext) {
6312
- let instance = resultContext.inject(ctor, {
6313
- parentInstanceThatWillGetInjectedStuff: this,
6314
- });
6315
- // console.log('instance', instance);
6316
- if (propName === 'getOriginalPrototype') {
6317
- return () => Object.getPrototypeOf(instance);
6318
- }
6319
- if (propName === 'getOriginalConstructor') {
6320
- return () => instance.constructor;
6321
- }
6322
- const methods = ctor[Symbols.classMethodsNames] || [];
6323
- const isMethods = methods.includes(propName);
6324
- const methodOrProperty = isMethods
6325
- ? instance[propName].bind(instance)
6326
- : instance[propName];
6327
- // console.log(
6328
- // `methodOrProperty from proxy ${propName?.toString()} = isMethods:${isMethods}`,
6329
- // methods,
6330
- // );
6331
- return methodOrProperty;
6332
- }
6333
- },
6334
- });
6335
- };
6336
- // export const injectController = inject;
6337
- // export type SubscriptionEvent<T> = {
6338
- // name: keyof T;
6339
- // data: any;
6340
- // };
6341
- /**
6342
- * TODO
6343
- */
6344
- // export const injectEntityEvents = <T>(
6345
- // subscriberClassResolveFn: () => new (...args: any[]) => T,
6346
- // eventName?: keyof Omit<EntitySubscriberInterface,'listenTo'> ,
6347
- // ): Observable<SubscriptionEvent<T>> => {
6348
- // const eventsSrc = new Subject<SubscriptionEvent<T>>();
6349
- // const obs = eventsSrc.asObservable();
6350
- // let isFirstSubscription = true;
6351
- // const proxyObservable = new Proxy(obs, {
6352
- // get(target, prop, receiver) {
6353
- // if (prop === 'subscribe') {
6354
- // return (...args: any[]) => {
6355
- // if (isFirstSubscription) {
6356
- // isFirstSubscription = false;
6357
- // const subscriberClassFN: typeof BaseClass =
6358
- // subscriberClassResolveFn() as any;
6359
- // const ctx = subscriberClassFN[
6360
- // Symbols.ctxInClassOrClassObj
6361
- // ] as EndpointContext;
6362
- // if (!ctx) {
6363
- // throw new Error(
6364
- // `You are trying to inject class without context. Use context like this:
6365
- // class MyClassSubscriber extends BaseSubscriber {
6366
- // ${eventName as any}() {
6367
- // \/\/ your code here
6368
- // }
6369
- // }
6370
- // Taon.injectSubscriberEvents( MyContext.getInstance(()=> MyClassSubscriber), '${eventName as any}' )
6371
- // `,
6372
- // );
6373
- // }
6374
- // const subscriberInstance = ctx.getInstanceBy(subscriberClassFN);
6375
- // // subscriberInstance TODO @LAST subscriber event from instance
6376
- // // const entity = subscriberClassFN.prototype.listenTo();
6377
- // console.log('First subscription, you can access arguments here:', {
6378
- // subscriberClassFN,
6379
- // eventName,
6380
- // });
6381
- // }
6382
- // return target.subscribe(...args);
6383
- // };
6384
- // }
6385
- // return Reflect.get(target, prop, receiver);
6386
- // },
6387
- // });
6388
- // return proxyObservable as Observable<SubscriptionEvent<T>>;
6389
- // };
6390
-
6391
6400
  // TODO export all things
6392
6401
  var Taon;
6393
6402
  (function (Taon) {