taon 21.0.44 → 21.0.45
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 +8 -211
- package/bin/taon +1 -2
- package/bin/taon-debug +1 -1
- package/bin/taon-debug-brk +1 -2
- package/browser/package.json +1 -1
- package/browser/types/taon-browser.d.ts +3 -3
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/taon-browser.d.ts +3 -3
- 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.ts +34 -0
- package/lib-prod/base-classes/base-angular-service.ts +107 -0
- package/lib-prod/base-classes/base-class.ts +46 -0
- package/lib-prod/base-classes/base-context.ts +21 -0
- package/lib-prod/base-classes/base-controller.ts +240 -0
- package/lib-prod/base-classes/base-crud-controller.ts +298 -0
- package/lib-prod/base-classes/base-custom-repository.ts +10 -0
- package/lib-prod/base-classes/{base-electron-service.js → base-electron-service.ts} +12 -2
- package/lib-prod/base-classes/base-entity.ts +28 -0
- package/lib-prod/base-classes/base-file-upload.middleware.ts +92 -0
- package/lib-prod/base-classes/base-injector.ts +278 -0
- package/lib-prod/base-classes/base-middleware.ts +71 -0
- package/lib-prod/base-classes/base-migration.ts +26 -0
- package/lib-prod/base-classes/{base-provider.d.ts → base-provider.ts} +2 -2
- package/lib-prod/base-classes/base-repository.ts +942 -0
- package/lib-prod/base-classes/base-subscriber-for-entity.ts +196 -0
- package/lib-prod/base-classes/{base.js → base.ts} +15 -4
- package/lib-prod/{build-info._auto-generated_.d.ts → build-info._auto-generated_.ts} +9 -6
- package/lib-prod/config/controller-config.ts +58 -0
- package/lib-prod/config/controller-options.ts +19 -0
- package/lib-prod/config/method-config.ts +55 -0
- package/lib-prod/config/param-config.ts +16 -0
- package/lib-prod/constants.ts +63 -0
- package/lib-prod/context-db-migrations.ts +488 -0
- package/lib-prod/create-context.ts +345 -0
- package/lib-prod/decorators/classes/controller-decorator.ts +25 -0
- package/lib-prod/decorators/classes/entity-decorator.ts +57 -0
- package/lib-prod/decorators/classes/middleware-decorator.ts +29 -0
- package/lib-prod/decorators/classes/migration-decorator.ts +27 -0
- package/lib-prod/decorators/classes/provider-decorator.ts +28 -0
- package/lib-prod/decorators/classes/repository-decorator.ts +26 -0
- package/lib-prod/decorators/classes/subscriber-decorator.ts +28 -0
- package/lib-prod/decorators/decorator-abstract-opt.ts +4 -0
- package/lib-prod/decorators/http/http-decorators.ts +26 -0
- package/lib-prod/decorators/http/http-methods-decorators.ts +275 -0
- package/lib-prod/decorators/http/http-params-decorators.ts +105 -0
- package/lib-prod/dependency-injection/di-container.ts +39 -0
- package/lib-prod/endpoint-context-storage.ts +47 -0
- package/lib-prod/endpoint-context.ts +3100 -0
- package/lib-prod/entity-process.ts +283 -0
- package/lib-prod/env/env.angular-node-app.ts +66 -0
- package/lib-prod/env/env.docs-webapp.ts +66 -0
- package/lib-prod/env/env.electron-app.ts +66 -0
- package/lib-prod/env/env.mobile-app.ts +66 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.ts +66 -0
- package/lib-prod/env/env.vscode-plugin.ts +66 -0
- package/lib-prod/express-types.ts +4 -0
- package/lib-prod/formly/formly.models.ts +7 -0
- package/lib-prod/formly/fromly.ts +261 -0
- package/lib-prod/formly/type-from-entity.ts +80 -0
- package/lib-prod/get-response-value.ts +30 -0
- package/lib-prod/global-state/taon-global-state/{index.d.ts → index.ts} +2 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.ts +21 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.ts +9 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.ts +44 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.ts +40 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.ts +12 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.ts +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.ts +16 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.ts +47 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.ts +18 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.ts +21 -0
- package/lib-prod/global-state/taon-transaction-registry/{index.d.ts → index.ts} +2 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.ts +23 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.ts +7 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.ts +38 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.ts +54 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.ts +12 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.ts +6 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.ts +16 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.ts +29 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.ts +20 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.ts +9 -0
- package/lib-prod/helpers/class-helpers.ts +315 -0
- package/lib-prod/helpers/clone-obj.ts +24 -0
- package/lib-prod/helpers/taon-helpers.ts +181 -0
- package/lib-prod/{index._auto-generated_.js → index._auto-generated_.ts} +0 -1
- package/lib-prod/index.ts +323 -0
- package/lib-prod/{inject.js → inject.ts} +57 -40
- package/lib-prod/lib-info.md +8 -0
- package/lib-prod/migrations/index.ts +2 -0
- package/lib-prod/migrations/migrations-info.md +6 -0
- package/lib-prod/migrations/{migrations_index._auto-generated_.js → migrations_index._auto-generated_.ts} +2 -1
- package/lib-prod/models.ts +427 -0
- package/lib-prod/orm/columns.ts +121 -0
- package/lib-prod/orm/index.ts +62 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.ts +288 -0
- package/lib-prod/realtime/realtime-core.ts +134 -0
- package/lib-prod/realtime/realtime-server.ts +398 -0
- package/lib-prod/realtime/realtime-strategy/{index.d.ts → index.ts} +1 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.ts +344 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.ts +349 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.ts +30 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.ts +21 -0
- package/lib-prod/realtime/realtime-subs-manager.ts +127 -0
- package/lib-prod/realtime/{realtime.models.d.ts → realtime.models.ts} +13 -5
- package/lib-prod/symbols.ts +136 -0
- package/lib-prod/ui/index.ts +1 -0
- package/lib-prod/ui/taon-admin-mode-configuration/index.ts +1 -0
- package/lib-prod/validators.ts +103 -0
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql/types/taon-websql.d.ts +3 -3
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/taon-websql.d.ts +3 -3
- package/lib-prod/base-classes/base-abstract-entity.d.ts +0 -7
- package/lib-prod/base-classes/base-abstract-entity.js +0 -42
- package/lib-prod/base-classes/base-abstract-entity.js.map +0 -1
- package/lib-prod/base-classes/base-angular-service.d.ts +0 -27
- package/lib-prod/base-classes/base-angular-service.js +0 -89
- package/lib-prod/base-classes/base-angular-service.js.map +0 -1
- package/lib-prod/base-classes/base-class.d.ts +0 -15
- package/lib-prod/base-classes/base-class.js +0 -40
- package/lib-prod/base-classes/base-class.js.map +0 -1
- package/lib-prod/base-classes/base-context.d.ts +0 -20
- package/lib-prod/base-classes/base-context.js +0 -23
- package/lib-prod/base-classes/base-context.js.map +0 -1
- package/lib-prod/base-classes/base-controller.d.ts +0 -84
- package/lib-prod/base-classes/base-controller.js +0 -173
- package/lib-prod/base-classes/base-controller.js.map +0 -1
- package/lib-prod/base-classes/base-crud-controller.d.ts +0 -28
- package/lib-prod/base-classes/base-crud-controller.js +0 -318
- package/lib-prod/base-classes/base-crud-controller.js.map +0 -1
- package/lib-prod/base-classes/base-custom-repository.d.ts +0 -3
- package/lib-prod/base-classes/base-custom-repository.js +0 -19
- package/lib-prod/base-classes/base-custom-repository.js.map +0 -1
- package/lib-prod/base-classes/base-electron-service.d.ts +0 -0
- package/lib-prod/base-classes/base-electron-service.js.map +0 -1
- package/lib-prod/base-classes/base-entity.d.ts +0 -16
- package/lib-prod/base-classes/base-entity.js +0 -32
- package/lib-prod/base-classes/base-entity.js.map +0 -1
- package/lib-prod/base-classes/base-file-upload.middleware.d.ts +0 -14
- package/lib-prod/base-classes/base-file-upload.middleware.js +0 -85
- package/lib-prod/base-classes/base-file-upload.middleware.js.map +0 -1
- package/lib-prod/base-classes/base-injector.d.ts +0 -67
- package/lib-prod/base-classes/base-injector.js +0 -198
- package/lib-prod/base-classes/base-injector.js.map +0 -1
- package/lib-prod/base-classes/base-middleware.d.ts +0 -38
- package/lib-prod/base-classes/base-middleware.js +0 -14
- package/lib-prod/base-classes/base-middleware.js.map +0 -1
- package/lib-prod/base-classes/base-migration.d.ts +0 -11
- package/lib-prod/base-classes/base-migration.js +0 -25
- package/lib-prod/base-classes/base-migration.js.map +0 -1
- package/lib-prod/base-classes/base-provider.js +0 -13
- package/lib-prod/base-classes/base-provider.js.map +0 -1
- package/lib-prod/base-classes/base-repository.d.ts +0 -272
- package/lib-prod/base-classes/base-repository.js +0 -634
- package/lib-prod/base-classes/base-repository.js.map +0 -1
- package/lib-prod/base-classes/base-subscriber-for-entity.d.ts +0 -81
- package/lib-prod/base-classes/base-subscriber-for-entity.js +0 -155
- package/lib-prod/base-classes/base-subscriber-for-entity.js.map +0 -1
- package/lib-prod/base-classes/base.d.ts +0 -1
- package/lib-prod/base-classes/base.js.map +0 -1
- package/lib-prod/build-info._auto-generated_.js +0 -30
- package/lib-prod/build-info._auto-generated_.js.map +0 -1
- package/lib-prod/config/controller-config.d.ts +0 -21
- package/lib-prod/config/controller-config.js +0 -34
- package/lib-prod/config/controller-config.js.map +0 -1
- package/lib-prod/config/controller-options.d.ts +0 -16
- package/lib-prod/config/controller-options.js +0 -8
- package/lib-prod/config/controller-options.js.map +0 -1
- package/lib-prod/config/method-config.d.ts +0 -39
- package/lib-prod/config/method-config.js +0 -12
- package/lib-prod/config/method-config.js.map +0 -1
- package/lib-prod/config/param-config.d.ts +0 -8
- package/lib-prod/config/param-config.js +0 -8
- package/lib-prod/config/param-config.js.map +0 -1
- package/lib-prod/constants.d.ts +0 -9
- package/lib-prod/constants.js +0 -32
- package/lib-prod/constants.js.map +0 -1
- package/lib-prod/context-db-migrations.d.ts +0 -17
- package/lib-prod/context-db-migrations.js +0 -349
- package/lib-prod/context-db-migrations.js.map +0 -1
- package/lib-prod/create-context.d.ts +0 -78
- package/lib-prod/create-context.js +0 -223
- package/lib-prod/create-context.js.map +0 -1
- package/lib-prod/decorators/classes/controller-decorator.d.ts +0 -5
- package/lib-prod/decorators/classes/controller-decorator.js +0 -21
- package/lib-prod/decorators/classes/controller-decorator.js.map +0 -1
- package/lib-prod/decorators/classes/entity-decorator.d.ts +0 -19
- package/lib-prod/decorators/classes/entity-decorator.js +0 -43
- package/lib-prod/decorators/classes/entity-decorator.js.map +0 -1
- package/lib-prod/decorators/classes/middleware-decorator.d.ts +0 -8
- package/lib-prod/decorators/classes/middleware-decorator.js +0 -22
- package/lib-prod/decorators/classes/middleware-decorator.js.map +0 -1
- package/lib-prod/decorators/classes/migration-decorator.d.ts +0 -7
- package/lib-prod/decorators/classes/migration-decorator.js +0 -21
- package/lib-prod/decorators/classes/migration-decorator.js.map +0 -1
- package/lib-prod/decorators/classes/provider-decorator.d.ts +0 -7
- package/lib-prod/decorators/classes/provider-decorator.js +0 -21
- package/lib-prod/decorators/classes/provider-decorator.js.map +0 -1
- package/lib-prod/decorators/classes/repository-decorator.d.ts +0 -7
- package/lib-prod/decorators/classes/repository-decorator.js +0 -21
- package/lib-prod/decorators/classes/repository-decorator.js.map +0 -1
- package/lib-prod/decorators/classes/subscriber-decorator.d.ts +0 -8
- package/lib-prod/decorators/classes/subscriber-decorator.js +0 -22
- package/lib-prod/decorators/classes/subscriber-decorator.js.map +0 -1
- package/lib-prod/decorators/decorator-abstract-opt.d.ts +0 -3
- package/lib-prod/decorators/decorator-abstract-opt.js +0 -7
- package/lib-prod/decorators/decorator-abstract-opt.js.map +0 -1
- package/lib-prod/decorators/http/http-decorators.d.ts +0 -3
- package/lib-prod/decorators/http/http-decorators.js +0 -24
- package/lib-prod/decorators/http/http-decorators.js.map +0 -1
- package/lib-prod/decorators/http/http-methods-decorators.d.ts +0 -70
- package/lib-prod/decorators/http/http-methods-decorators.js +0 -112
- package/lib-prod/decorators/http/http-methods-decorators.js.map +0 -1
- package/lib-prod/decorators/http/http-params-decorators.d.ts +0 -8
- package/lib-prod/decorators/http/http-params-decorators.js +0 -50
- package/lib-prod/decorators/http/http-params-decorators.js.map +0 -1
- package/lib-prod/dependency-injection/di-container.d.ts +0 -5
- package/lib-prod/dependency-injection/di-container.js +0 -35
- package/lib-prod/dependency-injection/di-container.js.map +0 -1
- package/lib-prod/endpoint-context-storage.d.ts +0 -11
- package/lib-prod/endpoint-context-storage.js +0 -38
- package/lib-prod/endpoint-context-storage.js.map +0 -1
- package/lib-prod/endpoint-context.d.ts +0 -197
- package/lib-prod/endpoint-context.js +0 -2416
- package/lib-prod/endpoint-context.js.map +0 -1
- package/lib-prod/entity-process.d.ts +0 -39
- package/lib-prod/entity-process.js +0 -242
- package/lib-prod/entity-process.js.map +0 -1
- package/lib-prod/env/env.angular-node-app.d.ts +0 -64
- package/lib-prod/env/env.angular-node-app.js +0 -71
- package/lib-prod/env/env.angular-node-app.js.map +0 -1
- package/lib-prod/env/env.docs-webapp.d.ts +0 -64
- package/lib-prod/env/env.docs-webapp.js +0 -71
- package/lib-prod/env/env.docs-webapp.js.map +0 -1
- package/lib-prod/env/env.electron-app.d.ts +0 -64
- package/lib-prod/env/env.electron-app.js +0 -71
- package/lib-prod/env/env.electron-app.js.map +0 -1
- package/lib-prod/env/env.mobile-app.d.ts +0 -64
- package/lib-prod/env/env.mobile-app.js +0 -71
- package/lib-prod/env/env.mobile-app.js.map +0 -1
- package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +0 -64
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +0 -71
- package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +0 -1
- package/lib-prod/env/env.vscode-plugin.d.ts +0 -64
- package/lib-prod/env/env.vscode-plugin.js +0 -71
- package/lib-prod/env/env.vscode-plugin.js.map +0 -1
- package/lib-prod/env/index.js +0 -23
- package/lib-prod/env/index.js.map +0 -1
- package/lib-prod/express-types.d.ts +0 -1
- package/lib-prod/express-types.js +0 -3
- package/lib-prod/express-types.js.map +0 -1
- package/lib-prod/formly/formly.models.d.ts +0 -1
- package/lib-prod/formly/formly.models.js +0 -3
- package/lib-prod/formly/formly.models.js.map +0 -1
- package/lib-prod/formly/fromly.d.ts +0 -16
- package/lib-prod/formly/fromly.js +0 -209
- package/lib-prod/formly/fromly.js.map +0 -1
- package/lib-prod/formly/type-from-entity.d.ts +0 -20
- package/lib-prod/formly/type-from-entity.js +0 -60
- package/lib-prod/formly/type-from-entity.js.map +0 -1
- package/lib-prod/get-response-value.d.ts +0 -6
- package/lib-prod/get-response-value.js +0 -27
- package/lib-prod/get-response-value.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/index.js +0 -23
- package/lib-prod/global-state/taon-global-state/index.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.d.ts +0 -19
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +0 -23
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.d.ts +0 -2
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +0 -11
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.d.ts +0 -11
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +0 -61
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.d.ts +0 -7
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +0 -64
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.d.ts +0 -3
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +0 -22
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.d.ts +0 -28
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +0 -48
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.d.ts +0 -3
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +0 -22
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.d.ts +0 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +0 -53
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.d.ts +0 -7
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +0 -29
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js.map +0 -1
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.d.ts +0 -2
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +0 -16
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/index.js +0 -28
- package/lib-prod/global-state/taon-transaction-registry/index.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.d.ts +0 -19
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +0 -25
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.d.ts +0 -2
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +0 -9
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.d.ts +0 -9
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +0 -51
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.d.ts +0 -12
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +0 -77
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.d.ts +0 -3
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +0 -22
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.d.ts +0 -6
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +0 -11
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.d.ts +0 -3
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +0 -22
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.d.ts +0 -9
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +0 -38
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.d.ts +0 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +0 -29
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js.map +0 -1
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.d.ts +0 -2
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +0 -9
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js.map +0 -1
- package/lib-prod/helpers/class-helpers.d.ts +0 -22
- package/lib-prod/helpers/class-helpers.js +0 -246
- package/lib-prod/helpers/class-helpers.js.map +0 -1
- package/lib-prod/helpers/clone-obj.d.ts +0 -1
- package/lib-prod/helpers/clone-obj.js +0 -22
- package/lib-prod/helpers/clone-obj.js.map +0 -1
- package/lib-prod/helpers/taon-helpers.d.ts +0 -16
- package/lib-prod/helpers/taon-helpers.js +0 -162
- package/lib-prod/helpers/taon-helpers.js.map +0 -1
- package/lib-prod/index._auto-generated_.d.ts +0 -0
- package/lib-prod/index._auto-generated_.js.map +0 -1
- package/lib-prod/index.d.ts +0 -230
- package/lib-prod/index.js +0 -273
- package/lib-prod/index.js.map +0 -1
- package/lib-prod/inject.d.ts +0 -4
- package/lib-prod/inject.js.map +0 -1
- package/lib-prod/migrations/index.d.ts +0 -1
- package/lib-prod/migrations/index.js +0 -19
- package/lib-prod/migrations/index.js.map +0 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js.map +0 -1
- package/lib-prod/models.d.ts +0 -255
- package/lib-prod/models.js +0 -117
- package/lib-prod/models.js.map +0 -1
- package/lib-prod/orm/columns.d.ts +0 -32
- package/lib-prod/orm/columns.js +0 -112
- package/lib-prod/orm/columns.js.map +0 -1
- package/lib-prod/orm/index.d.ts +0 -1
- package/lib-prod/orm/index.js +0 -73
- package/lib-prod/orm/index.js.map +0 -1
- package/lib-prod/realtime/realtime-client.d.ts +0 -41
- package/lib-prod/realtime/realtime-client.js +0 -204
- package/lib-prod/realtime/realtime-client.js.map +0 -1
- package/lib-prod/realtime/realtime-core.d.ts +0 -40
- package/lib-prod/realtime/realtime-core.js +0 -106
- package/lib-prod/realtime/realtime-core.js.map +0 -1
- package/lib-prod/realtime/realtime-server.d.ts +0 -43
- package/lib-prod/realtime/realtime-server.js +0 -243
- package/lib-prod/realtime/realtime-server.js.map +0 -1
- package/lib-prod/realtime/realtime-strategy/index.js +0 -21
- package/lib-prod/realtime/realtime-strategy/index.js.map +0 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +0 -80
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +0 -297
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js.map +0 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.d.ts +0 -14
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +0 -303
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js.map +0 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +0 -16
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +0 -33
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +0 -1
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.d.ts +0 -11
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +0 -17
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js.map +0 -1
- package/lib-prod/realtime/realtime-subs-manager.d.ts +0 -14
- package/lib-prod/realtime/realtime-subs-manager.js +0 -94
- package/lib-prod/realtime/realtime-subs-manager.js.map +0 -1
- package/lib-prod/realtime/realtime.models.js +0 -4
- package/lib-prod/realtime/realtime.models.js.map +0 -1
- package/lib-prod/symbols.d.ts +0 -63
- package/lib-prod/symbols.js +0 -109
- package/lib-prod/symbols.js.map +0 -1
- package/lib-prod/ui/index.d.ts +0 -1
- package/lib-prod/ui/index.js +0 -5
- package/lib-prod/ui/index.js.map +0 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.d.ts +0 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +0 -5
- package/lib-prod/ui/taon-admin-mode-configuration/index.js.map +0 -1
- package/lib-prod/validators.d.ts +0 -5
- package/lib-prod/validators.js +0 -88
- package/lib-prod/validators.js.map +0 -1
- /package/lib-prod/env/{index.d.ts → index.ts} +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
//#region imports
|
|
2
|
+
/* */
|
|
3
|
+
import type * as Electron from 'electron';
|
|
4
|
+
import { ipcMain } from 'electron'; // @backend
|
|
5
|
+
import { Server, ServerOptions } from 'socket.io';
|
|
6
|
+
import type { io, ManagerOptions, SocketOptions } from 'socket.io-client';
|
|
7
|
+
|
|
8
|
+
import { EndpointContext } from '../../endpoint-context';
|
|
9
|
+
import { Symbols__NS__classMethodsNames, Symbols__NS__classNameStaticProperty, Symbols__NS__ctxInClassOrClassObj, Symbols__NS__fullClassNameStaticProperty, Symbols__NS__metadata, Symbols__NS__old, Symbols__NS__orignalClass, Symbols__NS__orignalClassClonesObj, Symbols__NS__REALTIME } from '../../symbols';
|
|
10
|
+
import { RealtimeModels__NS__ChangeOption, RealtimeModels__NS__EventHandler, RealtimeModels__NS__SubsManagerOpt } from '../realtime.models';
|
|
11
|
+
|
|
12
|
+
import { RealtimeStrategy } from './realtime-strategy';
|
|
13
|
+
//#endregion
|
|
14
|
+
|
|
15
|
+
//#region mock server ipc
|
|
16
|
+
export class MockServerIpc {
|
|
17
|
+
static serverByContextName = new Map<string, MockServerIpc>();
|
|
18
|
+
|
|
19
|
+
static from(contextName: string): MockServerIpc {
|
|
20
|
+
if (!MockServerIpc.serverByContextName.has(contextName)) {
|
|
21
|
+
MockServerIpc.serverByContextName.set(
|
|
22
|
+
contextName,
|
|
23
|
+
new MockServerIpc(contextName),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return MockServerIpc.serverByContextName.get(contextName);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
namespacesByName = new Map<string, MockNamespaceIpc>();
|
|
30
|
+
|
|
31
|
+
//#region constructor
|
|
32
|
+
constructor(public contextName: string) {
|
|
33
|
+
MockServerIpc.serverByContextName.set(contextName, this);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
|
|
37
|
+
//#region of
|
|
38
|
+
of(namespace: string): MockNamespaceIpc {
|
|
39
|
+
if (!this.namespacesByName.has(namespace)) {
|
|
40
|
+
this.namespacesByName.set(
|
|
41
|
+
namespace,
|
|
42
|
+
new MockNamespaceIpc(namespace, this),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return this.namespacesByName.get(namespace);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
|
|
51
|
+
//#region mock namespace ipc
|
|
52
|
+
export class MockNamespaceIpc {
|
|
53
|
+
//#region fields & getters
|
|
54
|
+
electronClients = new Set<Electron.WebContents>();
|
|
55
|
+
roomsByRoomName: {
|
|
56
|
+
[roomName: string]: Set<Electron.WebContents>;
|
|
57
|
+
} = {};
|
|
58
|
+
|
|
59
|
+
private namespaceEventHandlers: {
|
|
60
|
+
[eventName: string]: Set<RealtimeModels__NS__EventHandler>;
|
|
61
|
+
} = {};
|
|
62
|
+
//#endregion
|
|
63
|
+
|
|
64
|
+
//#region constructor
|
|
65
|
+
constructor(
|
|
66
|
+
/**
|
|
67
|
+
* Namespace name
|
|
68
|
+
*/
|
|
69
|
+
public name: string,
|
|
70
|
+
public server: MockServerIpc,
|
|
71
|
+
) {}
|
|
72
|
+
//#endregion
|
|
73
|
+
|
|
74
|
+
//#region on
|
|
75
|
+
on(eventName: string, callback: RealtimeModels__NS__EventHandler) {
|
|
76
|
+
//#region @backendFunc
|
|
77
|
+
const listenKey = `(${this.name}) "${eventName}"`;
|
|
78
|
+
|
|
79
|
+
if (!this.namespaceEventHandlers[eventName]) {
|
|
80
|
+
this.namespaceEventHandlers[eventName] = new Set();
|
|
81
|
+
}
|
|
82
|
+
this.namespaceEventHandlers[eventName].add(callback);
|
|
83
|
+
|
|
84
|
+
ipcMain.on(listenKey, (eventElectron, ...args) => {
|
|
85
|
+
this.electronClients.add(eventElectron.sender);
|
|
86
|
+
|
|
87
|
+
const connectionListener = `(${this.name}) "connection"`;
|
|
88
|
+
if (connectionListener === listenKey) {
|
|
89
|
+
callback(this, ...args);
|
|
90
|
+
} else {
|
|
91
|
+
if (eventName.includes(`:${Symbols__NS__REALTIME.KEYroomSubscribe}`)) {
|
|
92
|
+
const roomName = args[0];
|
|
93
|
+
this.join(eventElectron.sender, roomName);
|
|
94
|
+
} else if (
|
|
95
|
+
eventName.includes(`:${Symbols__NS__REALTIME.KEYroomUnsubscribe}`)
|
|
96
|
+
) {
|
|
97
|
+
const roomName = args[0];
|
|
98
|
+
this.leave(eventElectron.sender, roomName);
|
|
99
|
+
} else {
|
|
100
|
+
callback(...args);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
// this.emit(listenKey); // QUICK_FIX
|
|
105
|
+
//#endregion
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
|
|
109
|
+
//#region off
|
|
110
|
+
off(event: string, callback?: RealtimeModels__NS__EventHandler) {
|
|
111
|
+
//#region @backendFunc
|
|
112
|
+
if (!this.namespaceEventHandlers[event]) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (callback) {
|
|
117
|
+
this.namespaceEventHandlers[event].delete(callback);
|
|
118
|
+
} else {
|
|
119
|
+
delete this.namespaceEventHandlers[event];
|
|
120
|
+
}
|
|
121
|
+
const removeKey = `(${this.name}) "${event}"`;
|
|
122
|
+
ipcMain.removeListener(removeKey, callback);
|
|
123
|
+
//#endregion
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
|
|
127
|
+
//#region emit
|
|
128
|
+
emit(eventName: string, ...args: any[]) {
|
|
129
|
+
//#region @backendFunc
|
|
130
|
+
const sendEventKey = `(${this.name}) "${eventName}"`;
|
|
131
|
+
for (const webContents of this.electronClients) {
|
|
132
|
+
webContents.send(sendEventKey, ...args);
|
|
133
|
+
}
|
|
134
|
+
// const allWindows = Electron.BrowserWindow.getAllWindows();
|
|
135
|
+
// allWindows.forEach((win, index) => {
|
|
136
|
+
// win.webContents.send(sendEventKey, ...args);
|
|
137
|
+
// });
|
|
138
|
+
//#endregion
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
|
|
142
|
+
//#region to
|
|
143
|
+
to(roomName: string) {
|
|
144
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
145
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, true);
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
|
|
149
|
+
//#region in
|
|
150
|
+
in(roomName: string) {
|
|
151
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
152
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, false);
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
|
|
156
|
+
//#region join
|
|
157
|
+
join(webContents: Electron.WebContents, roomName: string) {
|
|
158
|
+
if (!this.roomsByRoomName[roomName]) {
|
|
159
|
+
this.roomsByRoomName[roomName] = new Set();
|
|
160
|
+
}
|
|
161
|
+
this.roomsByRoomName[roomName].add(webContents);
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
|
|
165
|
+
//#region leave
|
|
166
|
+
leave(webContents: Electron.WebContents, roomName: string) {
|
|
167
|
+
if (this.roomsByRoomName[roomName]) {
|
|
168
|
+
this.roomsByRoomName[roomName].delete(webContents);
|
|
169
|
+
if (this.roomsByRoomName[roomName].size === 0) {
|
|
170
|
+
delete this.roomsByRoomName[roomName];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
|
|
176
|
+
//#region path
|
|
177
|
+
path() {
|
|
178
|
+
return this.name;
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
|
|
182
|
+
//#region get nsp
|
|
183
|
+
get nsp() {
|
|
184
|
+
const self = this;
|
|
185
|
+
return {
|
|
186
|
+
get name() {
|
|
187
|
+
return self.name;
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
|
|
196
|
+
//#region room emitter ipc
|
|
197
|
+
class RoomEmitterIpc {
|
|
198
|
+
//#region constructor
|
|
199
|
+
constructor(
|
|
200
|
+
private electronClients: Set<Electron.WebContents>,
|
|
201
|
+
/**
|
|
202
|
+
* namespace name
|
|
203
|
+
*/
|
|
204
|
+
private name: string,
|
|
205
|
+
private includeSender: boolean = false,
|
|
206
|
+
private sender: MockSocketIpc = null, // TODO QUICK FIX how to include sender
|
|
207
|
+
) {}
|
|
208
|
+
//#endregion
|
|
209
|
+
|
|
210
|
+
//#region emit in room
|
|
211
|
+
emit(eventName: string, ...args: any[]): void {
|
|
212
|
+
const emitEvent = `(${this.name}) "${eventName}"`;
|
|
213
|
+
this.electronClients?.forEach(webContents => {
|
|
214
|
+
webContents.send(emitEvent, ...args);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
|
|
221
|
+
//#region mock socket ipc
|
|
222
|
+
export class MockSocketIpc {
|
|
223
|
+
//#region fields & getters
|
|
224
|
+
|
|
225
|
+
//#region fields & getters / ipc renderer
|
|
226
|
+
/* */
|
|
227
|
+
/* */
|
|
228
|
+
|
|
229
|
+
//#endregion
|
|
230
|
+
|
|
231
|
+
//#region fields & getters / event handlers by name
|
|
232
|
+
private socketEventHandlers = {} as {
|
|
233
|
+
[eventName: string]: Set<RealtimeModels__NS__EventHandler>;
|
|
234
|
+
};
|
|
235
|
+
//#endregion
|
|
236
|
+
|
|
237
|
+
//#region fields & getters / name
|
|
238
|
+
get name() {
|
|
239
|
+
return this.namespaceName;
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
|
|
243
|
+
//#endregion
|
|
244
|
+
|
|
245
|
+
//#region constructor
|
|
246
|
+
/**
|
|
247
|
+
* @param namespaceName instead url for ipc
|
|
248
|
+
*/
|
|
249
|
+
constructor(public namespaceName: string) {
|
|
250
|
+
/* */
|
|
251
|
+
/* */
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
|
|
256
|
+
//#region on
|
|
257
|
+
on(eventName: string, callback: (event: any, ...args: any[]) => void) {
|
|
258
|
+
/* */
|
|
259
|
+
/* */
|
|
260
|
+
/* */
|
|
261
|
+
/* */
|
|
262
|
+
/* */
|
|
263
|
+
/* */
|
|
264
|
+
/* */
|
|
265
|
+
/* */
|
|
266
|
+
/* */
|
|
267
|
+
/* */
|
|
268
|
+
/* */
|
|
269
|
+
/* */
|
|
270
|
+
/* */
|
|
271
|
+
/* */
|
|
272
|
+
/* */
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
|
|
277
|
+
//#region off
|
|
278
|
+
off(event: string, callback?: (event: any, ...args: any[]) => void) {
|
|
279
|
+
/* */
|
|
280
|
+
/* */
|
|
281
|
+
/* */
|
|
282
|
+
/* */
|
|
283
|
+
/* */
|
|
284
|
+
/* */
|
|
285
|
+
/* */
|
|
286
|
+
/* */
|
|
287
|
+
/* */
|
|
288
|
+
/* */
|
|
289
|
+
/* */
|
|
290
|
+
/* */
|
|
291
|
+
/* */
|
|
292
|
+
/* */
|
|
293
|
+
/* */
|
|
294
|
+
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
|
|
298
|
+
//#region emit
|
|
299
|
+
emit(event: string, ...args: any[]) {
|
|
300
|
+
/* */
|
|
301
|
+
/* */
|
|
302
|
+
/* */
|
|
303
|
+
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
}
|
|
307
|
+
//#endregion
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Purpose:
|
|
311
|
+
* - backend-browser communication between 2 processes in electron mode
|
|
312
|
+
*/
|
|
313
|
+
export class RealtimeStrategyIpc extends RealtimeStrategy {
|
|
314
|
+
//#region to string
|
|
315
|
+
toString(): string {
|
|
316
|
+
return 'ipc';
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
319
|
+
|
|
320
|
+
//#region constructor
|
|
321
|
+
constructor(protected ctx: EndpointContext) {
|
|
322
|
+
super(ctx);
|
|
323
|
+
}
|
|
324
|
+
//#endregion
|
|
325
|
+
|
|
326
|
+
//#region server & io
|
|
327
|
+
ioServer(__: string, opt: ServerOptions) {
|
|
328
|
+
const namespace = opt?.path || '/';
|
|
329
|
+
const server = MockServerIpc.from(this.ctx.contextName);
|
|
330
|
+
return server.of(namespace) as any;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
get ioClient() {
|
|
334
|
+
const clientIo = (
|
|
335
|
+
__: string,
|
|
336
|
+
opt?: Partial<ManagerOptions & SocketOptions>,
|
|
337
|
+
): MockSocketIpc => {
|
|
338
|
+
const namespace = opt?.path || '/';
|
|
339
|
+
return new MockSocketIpc(namespace);
|
|
340
|
+
};
|
|
341
|
+
return clientIo as any;
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
//#region imports
|
|
2
|
+
import type { EndpointContext } from '../../endpoint-context';
|
|
3
|
+
import { RealtimeStrategy } from './realtime-strategy';
|
|
4
|
+
import { Symbols__NS__classMethodsNames, Symbols__NS__classNameStaticProperty, Symbols__NS__ctxInClassOrClassObj, Symbols__NS__fullClassNameStaticProperty, Symbols__NS__metadata, Symbols__NS__old, Symbols__NS__orignalClass, Symbols__NS__orignalClassClonesObj, Symbols__NS__REALTIME } from '../../symbols';
|
|
5
|
+
import { ManagerOptions, SocketOptions } from 'socket.io-client';
|
|
6
|
+
import { RealtimeModels__NS__ChangeOption, RealtimeModels__NS__EventHandler, RealtimeModels__NS__SubsManagerOpt } from '../realtime.models';
|
|
7
|
+
import { ServerOptions } from 'socket.io';
|
|
8
|
+
//#endregion
|
|
9
|
+
|
|
10
|
+
//#region mock server
|
|
11
|
+
class MockServer {
|
|
12
|
+
static serverByUrl = new Map<string, MockServer>();
|
|
13
|
+
static from(url: string): MockServer {
|
|
14
|
+
if (!MockServer.serverByUrl.has(url)) {
|
|
15
|
+
MockServer.serverByUrl.set(url, new MockServer(url));
|
|
16
|
+
}
|
|
17
|
+
return MockServer.serverByUrl.get(url);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get allServers() {
|
|
21
|
+
return Array.from(MockServer.serverByUrl.values());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
namespacesByName = new Map<string, MockNamespace>();
|
|
25
|
+
|
|
26
|
+
//#region constructor
|
|
27
|
+
constructor(public url: string) {
|
|
28
|
+
MockServer.serverByUrl.set(url, this);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
|
|
32
|
+
//#region of
|
|
33
|
+
of(namespace: string): MockNamespace {
|
|
34
|
+
if (!this.namespacesByName.has(namespace)) {
|
|
35
|
+
this.namespacesByName.set(namespace, new MockNamespace(namespace, this));
|
|
36
|
+
}
|
|
37
|
+
return this.namespacesByName.get(namespace);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
|
|
41
|
+
//#region path
|
|
42
|
+
path() {
|
|
43
|
+
return this.url;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
|
|
49
|
+
//#region mock namespace
|
|
50
|
+
class MockNamespace {
|
|
51
|
+
/**
|
|
52
|
+
* All sockets connected to this namespace
|
|
53
|
+
*/
|
|
54
|
+
public readonly allSocketsForNamespace = new Set<MockSocket>();
|
|
55
|
+
/**
|
|
56
|
+
* Rooms and their sockets
|
|
57
|
+
*/
|
|
58
|
+
private socketByRoomName: {
|
|
59
|
+
[roomName: string]: Set<MockSocket>;
|
|
60
|
+
} = {};
|
|
61
|
+
/**
|
|
62
|
+
* Event handlers for this namespace
|
|
63
|
+
*/
|
|
64
|
+
public namespaceEventHandlers: {
|
|
65
|
+
[eventName: string]: Set<RealtimeModels__NS__EventHandler>;
|
|
66
|
+
} = {};
|
|
67
|
+
|
|
68
|
+
//#region constructor
|
|
69
|
+
constructor(
|
|
70
|
+
/**
|
|
71
|
+
* unique namespace name
|
|
72
|
+
*/
|
|
73
|
+
public name: string,
|
|
74
|
+
public server: MockServer,
|
|
75
|
+
) {}
|
|
76
|
+
//#endregion
|
|
77
|
+
|
|
78
|
+
//#region on
|
|
79
|
+
on(eventName: string, handler: RealtimeModels__NS__EventHandler): void {
|
|
80
|
+
// console.log(`ON EVNET event "${eventName}"`);
|
|
81
|
+
if (!this.namespaceEventHandlers[eventName]) {
|
|
82
|
+
this.namespaceEventHandlers[eventName] =
|
|
83
|
+
new Set<RealtimeModels__NS__EventHandler>();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!this.namespaceEventHandlers[eventName].has(handler)) {
|
|
87
|
+
this.namespaceEventHandlers[eventName].add(handler);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// QUICK_FIX Emit connection event for backend
|
|
91
|
+
// TODO make it in emit
|
|
92
|
+
if (eventName === 'connection') {
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
this.emit('connection', this);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
|
|
100
|
+
//#region emit
|
|
101
|
+
emit(event: string, ...args: any[]): void {
|
|
102
|
+
this.allSocketsForNamespace?.forEach(socket => {
|
|
103
|
+
socket.emit(event, ...args);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
|
|
108
|
+
//#region connect
|
|
109
|
+
connect(socket: MockSocket): void {
|
|
110
|
+
this.allSocketsForNamespace.add(socket);
|
|
111
|
+
socket.namespaceInstance = this;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
|
|
115
|
+
//#region to
|
|
116
|
+
to(roomName: string): RoomEmitter {
|
|
117
|
+
const socketsInRoom = this.socketByRoomName[roomName];
|
|
118
|
+
return new RoomEmitter(socketsInRoom, true);
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
|
|
122
|
+
//#region to room
|
|
123
|
+
in(roomName: string): RoomEmitter {
|
|
124
|
+
const socketsInRoom = this.socketByRoomName[roomName];
|
|
125
|
+
return new RoomEmitter(socketsInRoom, false);
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
|
|
129
|
+
//#region join room
|
|
130
|
+
joinRoom(roomName: string, socket: MockSocket): void {
|
|
131
|
+
if (!this.socketByRoomName[roomName]) {
|
|
132
|
+
this.socketByRoomName[roomName] = new Set<MockSocket>();
|
|
133
|
+
}
|
|
134
|
+
this.socketByRoomName[roomName].add(socket);
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
|
|
138
|
+
//#region leave room
|
|
139
|
+
leaveRoom(roomName: string, socket: MockSocket): void {
|
|
140
|
+
const roomSockets = this.socketByRoomName[roomName];
|
|
141
|
+
if (roomSockets) {
|
|
142
|
+
this.socketByRoomName[roomName].delete(socket);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
|
|
147
|
+
//#region nsp + name
|
|
148
|
+
get nsp() {
|
|
149
|
+
const self = this;
|
|
150
|
+
return {
|
|
151
|
+
get name() {
|
|
152
|
+
return self.name;
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
|
|
158
|
+
path() {
|
|
159
|
+
return this.name;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
|
|
164
|
+
//#region room emitter
|
|
165
|
+
class RoomEmitter {
|
|
166
|
+
//#region constructor
|
|
167
|
+
constructor(
|
|
168
|
+
private sockets: Set<MockSocket>,
|
|
169
|
+
private includeSender: boolean = false,
|
|
170
|
+
private sender: MockSocket = null, // TODO QUICK FIX how to include sender
|
|
171
|
+
) {}
|
|
172
|
+
//#endregion
|
|
173
|
+
|
|
174
|
+
//#region emit in room
|
|
175
|
+
emit(event: string, ...args: any[]): void {
|
|
176
|
+
// console.log(
|
|
177
|
+
// `emit room emiter ${event} , this.sockets ${this.sockets.length}`,
|
|
178
|
+
// );
|
|
179
|
+
this.sockets?.forEach(socket => {
|
|
180
|
+
// console.log(`emit event ${event} to socket ${socket.id}`);
|
|
181
|
+
if (this.includeSender || socket !== this.sender) {
|
|
182
|
+
socket.emit(event, ...args);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
|
|
190
|
+
//#region mock socket
|
|
191
|
+
class MockSocket {
|
|
192
|
+
public namespaceInstance: MockNamespace;
|
|
193
|
+
private socketEventHandlers = {} as {
|
|
194
|
+
[eventName: string]: Set<RealtimeModels__NS__EventHandler>;
|
|
195
|
+
};
|
|
196
|
+
get id() {
|
|
197
|
+
return this.nsp.name;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
//#region constructor
|
|
201
|
+
constructor(
|
|
202
|
+
public url: string,
|
|
203
|
+
opts?: Partial<ManagerOptions & SocketOptions>,
|
|
204
|
+
) {
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
const [baseUrl, namespace] = [url, opts.path || '/'];
|
|
207
|
+
// console.log({ url, baseUrl, namespace });
|
|
208
|
+
const namespaceName = namespace || '/';
|
|
209
|
+
|
|
210
|
+
// Look up the server instance from the registry
|
|
211
|
+
const server = MockServer.from(url);
|
|
212
|
+
|
|
213
|
+
const ns = server.of(namespaceName);
|
|
214
|
+
ns.connect(this);
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
|
|
218
|
+
//#region nsp + name
|
|
219
|
+
get nsp() {
|
|
220
|
+
const self = this;
|
|
221
|
+
return {
|
|
222
|
+
get name() {
|
|
223
|
+
return self.namespaceInstance?.name;
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
|
|
229
|
+
//#region path
|
|
230
|
+
path() {
|
|
231
|
+
return this.namespaceInstance?.name;
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
|
|
235
|
+
//#region on
|
|
236
|
+
on(eventName: string, handler: RealtimeModels__NS__EventHandler): void {
|
|
237
|
+
if (!this.socketEventHandlers[eventName]) {
|
|
238
|
+
this.socketEventHandlers[eventName] =
|
|
239
|
+
new Set<RealtimeModels__NS__EventHandler>();
|
|
240
|
+
}
|
|
241
|
+
this.socketEventHandlers[eventName].add(handler);
|
|
242
|
+
|
|
243
|
+
// QUICK_FIX client initing itself
|
|
244
|
+
if (eventName === 'connect') {
|
|
245
|
+
setTimeout(() => {
|
|
246
|
+
this.emit('connect');
|
|
247
|
+
// this.namespaceInstance.emit('connection', this); @UNCOMMNENT
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
|
|
253
|
+
//#region emit
|
|
254
|
+
emit(eventName: string, ...args: any[]): void {
|
|
255
|
+
eventName = eventName || '';
|
|
256
|
+
|
|
257
|
+
if (eventName.includes(`:${Symbols__NS__REALTIME.KEYroomSubscribe}`)) {
|
|
258
|
+
const room = args[0];
|
|
259
|
+
this.join(room);
|
|
260
|
+
} else if (eventName.includes(`:${Symbols__NS__REALTIME.KEYroomUnsubscribe}`)) {
|
|
261
|
+
const room = args[0];
|
|
262
|
+
this.leave(room);
|
|
263
|
+
} else {
|
|
264
|
+
// console.log('try to emit event (to server)', event);
|
|
265
|
+
if (this.namespaceInstance) {
|
|
266
|
+
const namespaceEventHandlers =
|
|
267
|
+
this.namespaceInstance.namespaceEventHandlers[eventName] || [];
|
|
268
|
+
|
|
269
|
+
// emit to namespace events
|
|
270
|
+
for (const namespaceEventHandler of namespaceEventHandlers) {
|
|
271
|
+
if (namespaceEventHandler) {
|
|
272
|
+
namespaceEventHandler(...args);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const allSocketsForNamespaceExceptCurrent = Array.from(
|
|
277
|
+
this.namespaceInstance.allSocketsForNamespace.values(),
|
|
278
|
+
).filter(socket => socket !== this);
|
|
279
|
+
|
|
280
|
+
// emit to all sockets in namespace
|
|
281
|
+
for (const socket of allSocketsForNamespaceExceptCurrent) {
|
|
282
|
+
const socketEventHandlers = socket.socketEventHandlers[eventName];
|
|
283
|
+
for (const socketEventHandler of socketEventHandlers) {
|
|
284
|
+
if (socketEventHandler) {
|
|
285
|
+
socketEventHandler(...args);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Emit to current socket
|
|
291
|
+
const socketEventHandlers = this.socketEventHandlers[eventName] || [];
|
|
292
|
+
for (const clientHandler of socketEventHandlers) {
|
|
293
|
+
if (clientHandler) {
|
|
294
|
+
clientHandler(...args);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
|
|
302
|
+
//#region join room
|
|
303
|
+
join(roomName: string): void {
|
|
304
|
+
this.namespaceInstance.joinRoom(roomName, this);
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
|
|
308
|
+
//#region leave room
|
|
309
|
+
leave(roomName: string): void {
|
|
310
|
+
this.namespaceInstance.leaveRoom(roomName, this);
|
|
311
|
+
}
|
|
312
|
+
//#endregion
|
|
313
|
+
}
|
|
314
|
+
//#endregion
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Purpose:
|
|
318
|
+
* - browser-browser communication mock (in websql mode)
|
|
319
|
+
*/
|
|
320
|
+
export class RealtimeStrategyMock extends RealtimeStrategy {
|
|
321
|
+
//#region toString
|
|
322
|
+
toString(): string {
|
|
323
|
+
return 'mock';
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
|
|
327
|
+
//#region constructor
|
|
328
|
+
constructor(protected ctx: EndpointContext) {
|
|
329
|
+
super(ctx);
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
|
|
333
|
+
//#region server & io
|
|
334
|
+
ioServer(url: string, opt: ServerOptions) {
|
|
335
|
+
const server = MockServer.from(url || this.ctx.uriOrigin);
|
|
336
|
+
return server.of(opt?.path || '/') as any;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
get ioClient() {
|
|
340
|
+
const clientIo = (
|
|
341
|
+
uri: string,
|
|
342
|
+
opts?: Partial<ManagerOptions & SocketOptions>,
|
|
343
|
+
): MockSocket => {
|
|
344
|
+
return new MockSocket(uri || this.ctx.uriOrigin, opts as any);
|
|
345
|
+
};
|
|
346
|
+
return clientIo as any;
|
|
347
|
+
}
|
|
348
|
+
//#endregion
|
|
349
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EndpointContext } from '../../endpoint-context';
|
|
2
|
+
import { RealtimeStrategy } from './realtime-strategy';
|
|
3
|
+
//#region @backend
|
|
4
|
+
import { Server, ServerOptions } from 'socket.io';
|
|
5
|
+
//#endregion
|
|
6
|
+
import { io, ManagerOptions, Socket, SocketOptions } from 'socket.io-client';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Purpose:
|
|
10
|
+
* - backend-browser communication
|
|
11
|
+
* - backend-backend communication
|
|
12
|
+
*/
|
|
13
|
+
export class RealtimeStrategySocketIO extends RealtimeStrategy {
|
|
14
|
+
toString(): string {
|
|
15
|
+
return 'socket-io';
|
|
16
|
+
}
|
|
17
|
+
constructor(protected ctx: EndpointContext) {
|
|
18
|
+
super(ctx);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ioServer(...args) {
|
|
22
|
+
//#region @backendFunc
|
|
23
|
+
return new Server(...args);
|
|
24
|
+
//#endregion
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get ioClient() {
|
|
28
|
+
return io;
|
|
29
|
+
}
|
|
30
|
+
}
|