taon 21.0.17 → 21.0.28
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/README.md +11 -2
- package/browser/fesm2022/taon-browser.mjs +1191 -1026
- package/browser/fesm2022/taon-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/taon-browser.d.ts +14 -9
- package/browser-prod/README.md +24 -0
- package/browser-prod/fesm2022/taon-browser.mjs +8367 -0
- package/browser-prod/fesm2022/taon-browser.mjs.map +1 -0
- package/browser-prod/types/taon-browser.d.ts +2178 -0
- package/icon-menu-taon.svg +15 -15
- package/lib/base-classes/base-context.js +4 -0
- package/lib/base-classes/base-context.js.map +1 -1
- package/lib/base-classes/base-repository.d.ts +1 -0
- package/lib/base-classes/base-repository.js +27 -8
- package/lib/base-classes/base-repository.js.map +1 -1
- package/lib/build-info._auto-generated_.d.ts +5 -1
- package/lib/build-info._auto-generated_.js +6 -2
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/decorators/classes/middleware-decorator.d.ts +1 -0
- package/lib/decorators/classes/middleware-decorator.js +1 -0
- package/lib/decorators/classes/middleware-decorator.js.map +1 -1
- package/lib/decorators/classes/subscriber-decorator.d.ts +1 -1
- package/lib/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib/endpoint-context.d.ts +0 -4
- package/lib/endpoint-context.js +0 -18
- package/lib/endpoint-context.js.map +1 -1
- package/lib/env/env.angular-node-app.d.ts +30 -30
- package/lib/env/env.angular-node-app.js +32 -32
- package/lib/env/env.angular-node-app.js.map +1 -1
- package/lib/env/env.docs-webapp.d.ts +30 -30
- package/lib/env/env.docs-webapp.js +32 -32
- package/lib/env/env.docs-webapp.js.map +1 -1
- package/lib/env/env.electron-app.d.ts +30 -30
- package/lib/env/env.electron-app.js +32 -32
- package/lib/env/env.electron-app.js.map +1 -1
- package/lib/env/env.mobile-app.d.ts +30 -30
- package/lib/env/env.mobile-app.js +32 -32
- package/lib/env/env.mobile-app.js.map +1 -1
- package/lib/env/env.npm-lib-and-cli-tool.d.ts +30 -30
- package/lib/env/env.npm-lib-and-cli-tool.js +32 -32
- package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
- package/lib/env/env.vscode-plugin.d.ts +30 -30
- package/lib/env/env.vscode-plugin.js +32 -32
- package/lib/env/env.vscode-plugin.js.map +1 -1
- package/lib/formly/type-from-entity.js +9 -9
- package/lib/formly/type-from-entity.js.map +1 -1
- package/lib/global-state/taon-global-state/index.d.ts +6 -0
- package/lib/global-state/taon-global-state/index.js +23 -0
- package/lib/global-state/taon-global-state/index.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state-api.service.d.ts +7 -0
- package/lib/global-state/taon-global-state/taon-global-state.abstract.context.d.ts +19 -0
- package/lib/global-state/taon-global-state/taon-global-state.abstract.context.js +23 -0
- package/lib/global-state/taon-global-state/taon-global-state.abstract.context.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.constants.d.ts +2 -0
- package/lib/global-state/taon-global-state/taon-global-state.constants.js +11 -0
- package/lib/global-state/taon-global-state/taon-global-state.constants.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.controller.d.ts +11 -0
- package/lib/global-state/taon-global-state/taon-global-state.controller.js +62 -0
- package/lib/global-state/taon-global-state/taon-global-state.controller.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.entity.d.ts +7 -0
- package/lib/global-state/taon-global-state/taon-global-state.entity.js +64 -0
- package/lib/global-state/taon-global-state/taon-global-state.entity.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.middleware.d.ts +3 -0
- package/lib/global-state/taon-global-state/taon-global-state.middleware.js +22 -0
- package/lib/global-state/taon-global-state/taon-global-state.middleware.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.models.d.ts +28 -0
- package/lib/global-state/taon-global-state/taon-global-state.models.js +48 -0
- package/lib/global-state/taon-global-state/taon-global-state.models.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.provider.d.ts +3 -0
- package/lib/global-state/taon-global-state/taon-global-state.provider.js +22 -0
- package/lib/global-state/taon-global-state/taon-global-state.provider.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.repository.d.ts +9 -0
- package/lib/global-state/taon-global-state/taon-global-state.repository.js +53 -0
- package/lib/global-state/taon-global-state/taon-global-state.repository.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.subscriber.d.ts +7 -0
- package/lib/global-state/taon-global-state/taon-global-state.subscriber.js +29 -0
- package/lib/global-state/taon-global-state/taon-global-state.subscriber.js.map +1 -0
- package/lib/global-state/taon-global-state/taon-global-state.utils.d.ts +4 -0
- package/lib/global-state/taon-global-state/taon-global-state.utils.js +16 -0
- package/lib/global-state/taon-global-state/taon-global-state.utils.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/index.d.ts +11 -0
- package/lib/global-state/taon-transaction-registry/index.js +28 -0
- package/lib/global-state/taon-transaction-registry/index.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry-api.service.d.ts +7 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.d.ts +19 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +25 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.constants.d.ts +2 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +9 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.constants.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.controller.d.ts +9 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +52 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.controller.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.entity.d.ts +12 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +77 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.entity.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.middleware.d.ts +3 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +22 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.models.d.ts +6 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.models.js +11 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.models.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.provider.d.ts +3 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +22 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.provider.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.repository.d.ts +9 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +38 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.repository.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.d.ts +7 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +29 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js.map +1 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.utils.d.ts +4 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +11 -0
- package/lib/global-state/taon-transaction-registry/taon-transaction-registry.utils.js.map +1 -0
- package/lib/index._auto-generated_.js +1 -1
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +18 -5
- package/lib/index.js.map +1 -1
- package/lib/orm/columns.d.ts +5 -1
- package/lib/orm/columns.js +12 -2
- package/lib/orm/columns.js.map +1 -1
- package/lib/realtime/realtime-subs-manager.js +1 -10
- package/lib/realtime/realtime-subs-manager.js.map +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.d.ts +7 -0
- package/lib-prod/base-classes/base-abstract-entity.js +42 -0
- package/lib-prod/base-classes/base-abstract-entity.js.map +1 -0
- package/lib-prod/base-classes/base-angular-service.d.ts +27 -0
- package/lib-prod/base-classes/base-angular-service.js +89 -0
- package/lib-prod/base-classes/base-angular-service.js.map +1 -0
- package/lib-prod/base-classes/base-class.d.ts +15 -0
- package/lib-prod/base-classes/base-class.js +40 -0
- package/lib-prod/base-classes/base-class.js.map +1 -0
- package/lib-prod/base-classes/base-context.d.ts +20 -0
- package/lib-prod/base-classes/base-context.js +23 -0
- package/lib-prod/base-classes/base-context.js.map +1 -0
- package/lib-prod/base-classes/base-controller.d.ts +83 -0
- package/lib-prod/base-classes/base-controller.js +173 -0
- package/lib-prod/base-classes/base-controller.js.map +1 -0
- package/lib-prod/base-classes/base-crud-controller.d.ts +28 -0
- package/lib-prod/base-classes/base-crud-controller.js +319 -0
- package/lib-prod/base-classes/base-crud-controller.js.map +1 -0
- package/lib-prod/base-classes/base-custom-repository.d.ts +3 -0
- package/lib-prod/base-classes/base-custom-repository.js +19 -0
- package/lib-prod/base-classes/base-custom-repository.js.map +1 -0
- package/lib-prod/base-classes/base-electron-service.d.ts +0 -0
- package/lib-prod/base-classes/base-electron-service.js +50 -0
- package/lib-prod/base-classes/base-electron-service.js.map +1 -0
- package/lib-prod/base-classes/base-entity.d.ts +16 -0
- package/lib-prod/base-classes/base-entity.js +32 -0
- package/lib-prod/base-classes/base-entity.js.map +1 -0
- package/lib-prod/base-classes/base-file-upload.middleware.d.ts +14 -0
- package/lib-prod/base-classes/base-file-upload.middleware.js +85 -0
- package/lib-prod/base-classes/base-file-upload.middleware.js.map +1 -0
- package/lib-prod/base-classes/base-injector.d.ts +67 -0
- package/lib-prod/base-classes/base-injector.js +198 -0
- package/lib-prod/base-classes/base-injector.js.map +1 -0
- package/lib-prod/base-classes/base-middleware.d.ts +38 -0
- package/lib-prod/base-classes/base-middleware.js +14 -0
- package/lib-prod/base-classes/base-middleware.js.map +1 -0
- package/lib-prod/base-classes/base-migration.d.ts +11 -0
- package/lib-prod/base-classes/base-migration.js +25 -0
- package/lib-prod/base-classes/base-migration.js.map +1 -0
- package/lib-prod/base-classes/base-provider.d.ts +8 -0
- package/lib-prod/base-classes/base-provider.js +13 -0
- package/lib-prod/base-classes/base-provider.js.map +1 -0
- package/lib-prod/base-classes/base-repository.d.ts +272 -0
- package/lib-prod/base-classes/base-repository.js +634 -0
- package/lib-prod/base-classes/base-repository.js.map +1 -0
- package/lib-prod/base-classes/base-subscriber-for-entity.d.ts +81 -0
- package/lib-prod/base-classes/base-subscriber-for-entity.js +155 -0
- package/lib-prod/base-classes/base-subscriber-for-entity.js.map +1 -0
- package/lib-prod/base-classes/base.d.ts +1 -0
- package/lib-prod/base-classes/base.js +20 -0
- package/lib-prod/base-classes/base.js.map +1 -0
- package/lib-prod/build-info._auto-generated_.d.ts +24 -0
- package/lib-prod/build-info._auto-generated_.js +30 -0
- package/lib-prod/build-info._auto-generated_.js.map +1 -0
- package/lib-prod/config/controller-config.d.ts +21 -0
- package/lib-prod/config/controller-config.js +34 -0
- package/lib-prod/config/controller-config.js.map +1 -0
- package/lib-prod/config/controller-options.d.ts +16 -0
- package/lib-prod/config/controller-options.js +8 -0
- package/lib-prod/config/controller-options.js.map +1 -0
- package/lib-prod/config/method-config.d.ts +39 -0
- package/lib-prod/config/method-config.js +12 -0
- package/lib-prod/config/method-config.js.map +1 -0
- package/lib-prod/config/param-config.d.ts +8 -0
- package/lib-prod/config/param-config.js +8 -0
- package/lib-prod/config/param-config.js.map +1 -0
- package/lib-prod/constants.d.ts +9 -0
- package/lib-prod/constants.js +32 -0
- package/lib-prod/constants.js.map +1 -0
- package/lib-prod/context-db-migrations.d.ts +17 -0
- package/lib-prod/context-db-migrations.js +349 -0
- package/lib-prod/context-db-migrations.js.map +1 -0
- package/lib-prod/create-context.d.ts +78 -0
- package/lib-prod/create-context.js +223 -0
- package/lib-prod/create-context.js.map +1 -0
- package/lib-prod/decorators/classes/controller-decorator.d.ts +5 -0
- package/lib-prod/decorators/classes/controller-decorator.js +21 -0
- package/lib-prod/decorators/classes/controller-decorator.js.map +1 -0
- package/lib-prod/decorators/classes/entity-decorator.d.ts +19 -0
- package/lib-prod/decorators/classes/entity-decorator.js +43 -0
- package/lib-prod/decorators/classes/entity-decorator.js.map +1 -0
- package/lib-prod/decorators/classes/middleware-decorator.d.ts +8 -0
- package/lib-prod/decorators/classes/middleware-decorator.js +22 -0
- package/lib-prod/decorators/classes/middleware-decorator.js.map +1 -0
- package/lib-prod/decorators/classes/migration-decorator.d.ts +7 -0
- package/lib-prod/decorators/classes/migration-decorator.js +21 -0
- package/lib-prod/decorators/classes/migration-decorator.js.map +1 -0
- package/lib-prod/decorators/classes/provider-decorator.d.ts +7 -0
- package/lib-prod/decorators/classes/provider-decorator.js +21 -0
- package/lib-prod/decorators/classes/provider-decorator.js.map +1 -0
- package/lib-prod/decorators/classes/repository-decorator.d.ts +7 -0
- package/lib-prod/decorators/classes/repository-decorator.js +21 -0
- package/lib-prod/decorators/classes/repository-decorator.js.map +1 -0
- package/lib-prod/decorators/classes/subscriber-decorator.d.ts +8 -0
- package/lib-prod/decorators/classes/subscriber-decorator.js +22 -0
- package/lib-prod/decorators/classes/subscriber-decorator.js.map +1 -0
- package/lib-prod/decorators/decorator-abstract-opt.d.ts +3 -0
- package/lib-prod/decorators/decorator-abstract-opt.js +7 -0
- package/lib-prod/decorators/decorator-abstract-opt.js.map +1 -0
- package/lib-prod/decorators/http/http-decorators.d.ts +2 -0
- package/lib-prod/decorators/http/http-decorators.js +24 -0
- package/lib-prod/decorators/http/http-decorators.js.map +1 -0
- package/lib-prod/decorators/http/http-methods-decorators.d.ts +70 -0
- package/lib-prod/decorators/http/http-methods-decorators.js +112 -0
- package/lib-prod/decorators/http/http-methods-decorators.js.map +1 -0
- package/lib-prod/decorators/http/http-params-decorators.d.ts +8 -0
- package/lib-prod/decorators/http/http-params-decorators.js +50 -0
- package/lib-prod/decorators/http/http-params-decorators.js.map +1 -0
- package/lib-prod/dependency-injection/di-container.d.ts +5 -0
- package/lib-prod/dependency-injection/di-container.js +35 -0
- package/lib-prod/dependency-injection/di-container.js.map +1 -0
- package/lib-prod/endpoint-context-storage.d.ts +11 -0
- package/lib-prod/endpoint-context-storage.js +38 -0
- package/lib-prod/endpoint-context-storage.js.map +1 -0
- package/lib-prod/endpoint-context.d.ts +196 -0
- package/lib-prod/endpoint-context.js +2416 -0
- package/lib-prod/endpoint-context.js.map +1 -0
- package/lib-prod/entity-process.d.ts +39 -0
- package/lib-prod/entity-process.js +242 -0
- package/lib-prod/entity-process.js.map +1 -0
- package/lib-prod/env/env.angular-node-app.d.ts +64 -0
- package/lib-prod/env/env.angular-node-app.js +71 -0
- package/lib-prod/env/env.angular-node-app.js.map +1 -0
- package/lib-prod/env/env.docs-webapp.d.ts +64 -0
- package/lib-prod/env/env.docs-webapp.js +71 -0
- package/lib-prod/env/env.docs-webapp.js.map +1 -0
- package/lib-prod/env/env.electron-app.d.ts +64 -0
- package/lib-prod/env/env.electron-app.js +71 -0
- package/lib-prod/env/env.electron-app.js.map +1 -0
- package/lib-prod/env/env.mobile-app.d.ts +64 -0
- package/lib-prod/env/env.mobile-app.js +71 -0
- package/lib-prod/env/env.mobile-app.js.map +1 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +64 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +71 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +1 -0
- package/lib-prod/env/env.vscode-plugin.d.ts +64 -0
- package/lib-prod/env/env.vscode-plugin.js +71 -0
- package/lib-prod/env/env.vscode-plugin.js.map +1 -0
- package/lib-prod/env/index.d.ts +6 -0
- package/lib-prod/env/index.js +23 -0
- package/lib-prod/env/index.js.map +1 -0
- package/lib-prod/express-types.d.ts +1 -0
- package/lib-prod/express-types.js +3 -0
- package/lib-prod/express-types.js.map +1 -0
- package/lib-prod/formly/formly.models.d.ts +1 -0
- package/lib-prod/formly/formly.models.js +3 -0
- package/lib-prod/formly/formly.models.js.map +1 -0
- package/lib-prod/formly/fromly.d.ts +16 -0
- package/lib-prod/formly/fromly.js +209 -0
- package/lib-prod/formly/fromly.js.map +1 -0
- package/lib-prod/formly/type-from-entity.d.ts +20 -0
- package/lib-prod/formly/type-from-entity.js +60 -0
- package/lib-prod/formly/type-from-entity.js.map +1 -0
- package/lib-prod/get-response-value.d.ts +6 -0
- package/lib-prod/get-response-value.js +27 -0
- package/lib-prod/get-response-value.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/index.d.ts +5 -0
- package/lib-prod/global-state/taon-global-state/index.js +23 -0
- package/lib-prod/global-state/taon-global-state/index.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.d.ts +19 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +23 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.d.ts +2 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +11 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.d.ts +11 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +62 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.d.ts +7 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +64 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.d.ts +3 -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.middleware.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.d.ts +28 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +48 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.d.ts +3 -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.provider.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.d.ts +9 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +53 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.d.ts +7 -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.subscriber.js.map +1 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.d.ts +4 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +16 -0
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/index.d.ts +10 -0
- package/lib-prod/global-state/taon-transaction-registry/index.js +28 -0
- package/lib-prod/global-state/taon-transaction-registry/index.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.d.ts +19 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +25 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.d.ts +2 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +9 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.d.ts +9 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +52 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.d.ts +12 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +77 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.d.ts +3 -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.middleware.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.d.ts +6 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +11 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.d.ts +3 -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.provider.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.d.ts +9 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +38 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.d.ts +7 -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.subscriber.js.map +1 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.d.ts +4 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +11 -0
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js.map +1 -0
- package/lib-prod/helpers/class-helpers.d.ts +24 -0
- package/lib-prod/helpers/class-helpers.js +233 -0
- package/lib-prod/helpers/class-helpers.js.map +1 -0
- package/lib-prod/helpers/clone-obj.d.ts +1 -0
- package/lib-prod/helpers/clone-obj.js +22 -0
- package/lib-prod/helpers/clone-obj.js.map +1 -0
- package/lib-prod/helpers/taon-helpers.d.ts +18 -0
- package/lib-prod/helpers/taon-helpers.js +152 -0
- package/lib-prod/helpers/taon-helpers.js.map +1 -0
- package/lib-prod/index._auto-generated_.d.ts +0 -0
- package/lib-prod/index._auto-generated_.js +6 -0
- package/lib-prod/index._auto-generated_.js.map +1 -0
- package/lib-prod/index.d.ts +234 -0
- package/lib-prod/index.js +272 -0
- package/lib-prod/index.js.map +1 -0
- package/lib-prod/inject.d.ts +4 -0
- package/lib-prod/inject.js +94 -0
- package/lib-prod/inject.js.map +1 -0
- package/lib-prod/models.d.ts +260 -0
- package/lib-prod/models.js +125 -0
- package/lib-prod/models.js.map +1 -0
- package/lib-prod/orm/columns.d.ts +32 -0
- package/lib-prod/orm/columns.js +112 -0
- package/lib-prod/orm/columns.js.map +1 -0
- package/lib-prod/orm/index.d.ts +1 -0
- package/lib-prod/orm/index.js +73 -0
- package/lib-prod/orm/index.js.map +1 -0
- package/lib-prod/realtime/realtime-client.d.ts +41 -0
- package/lib-prod/realtime/realtime-client.js +204 -0
- package/lib-prod/realtime/realtime-client.js.map +1 -0
- package/lib-prod/realtime/realtime-core.d.ts +40 -0
- package/lib-prod/realtime/realtime-core.js +106 -0
- package/lib-prod/realtime/realtime-core.js.map +1 -0
- package/lib-prod/realtime/realtime-server.d.ts +43 -0
- package/lib-prod/realtime/realtime-server.js +243 -0
- package/lib-prod/realtime/realtime-server.js.map +1 -0
- package/lib-prod/realtime/realtime-strategy/index.d.ts +4 -0
- package/lib-prod/realtime/realtime-strategy/index.js +21 -0
- package/lib-prod/realtime/realtime-strategy/index.js.map +1 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +80 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +297 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.d.ts +14 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +303 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +16 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +33 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.d.ts +11 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +17 -0
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js.map +1 -0
- package/lib-prod/realtime/realtime-subs-manager.d.ts +14 -0
- package/lib-prod/realtime/realtime-subs-manager.js +94 -0
- package/lib-prod/realtime/realtime-subs-manager.js.map +1 -0
- package/lib-prod/realtime/realtime.models.d.ts +27 -0
- package/lib-prod/realtime/realtime.models.js +3 -0
- package/lib-prod/realtime/realtime.models.js.map +1 -0
- package/lib-prod/symbols.d.ts +65 -0
- package/lib-prod/symbols.js +110 -0
- package/lib-prod/symbols.js.map +1 -0
- package/lib-prod/ui/index.d.ts +1 -0
- package/lib-prod/ui/index.js +5 -0
- package/lib-prod/ui/index.js.map +1 -0
- package/lib-prod/ui/taon-admin-mode-configuration/index.d.ts +1 -0
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +5 -0
- package/lib-prod/ui/taon-admin-mode-configuration/index.js.map +1 -0
- package/lib-prod/validators.d.ts +7 -0
- package/lib-prod/validators.js +85 -0
- package/lib-prod/validators.js.map +1 -0
- package/package.json +22 -6
- package/websql/fesm2022/taon-websql.mjs +1405 -1152
- package/websql/fesm2022/taon-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/taon-websql.d.ts +14 -9
- package/websql-prod/README.md +24 -0
- package/websql-prod/fesm2022/taon-websql.mjs +8198 -0
- package/websql-prod/fesm2022/taon-websql.mjs.map +1 -0
- package/websql-prod/types/taon-websql.d.ts +2187 -0
|
@@ -14,7 +14,7 @@ import { SYMBOL, CLASS } from 'typescript-class-helpers/browser';
|
|
|
14
14
|
import * as JSON5 from 'json5';
|
|
15
15
|
import { io } from 'socket.io-client';
|
|
16
16
|
import { isPlatformServer, isPlatformBrowser } from '@angular/common';
|
|
17
|
-
import { __decorate,
|
|
17
|
+
import { __decorate, __param, __metadata } from 'tslib';
|
|
18
18
|
import * as i1 from '@ngx-formly/core';
|
|
19
19
|
import { FieldWrapper, FieldArrayType } from '@ngx-formly/core';
|
|
20
20
|
|
|
@@ -1313,20 +1313,11 @@ class RealtimeSubsManager {
|
|
|
1313
1313
|
//#region methods & getters / update
|
|
1314
1314
|
update(data) {
|
|
1315
1315
|
// log.data(`realtime update!!!!! observers=${this.observers?.length} `)
|
|
1316
|
-
const ngZone = this.options.core.ctx.ngZone;
|
|
1317
1316
|
// console.log('updating', data);
|
|
1318
|
-
// console.log('ngzone', ngZone);
|
|
1319
1317
|
this.observers.forEach(observer => {
|
|
1320
1318
|
// console.log(`observer closed: ${observer.closed}`,observer);
|
|
1321
1319
|
if (!observer.closed) {
|
|
1322
|
-
|
|
1323
|
-
ngZone.run(() => {
|
|
1324
|
-
observer.next(data);
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1327
|
-
else {
|
|
1328
|
-
observer.next(data);
|
|
1329
|
-
}
|
|
1320
|
+
observer.next(data);
|
|
1330
1321
|
}
|
|
1331
1322
|
});
|
|
1332
1323
|
}
|
|
@@ -2542,15 +2533,10 @@ class RealtimeCore {
|
|
|
2542
2533
|
}
|
|
2543
2534
|
}
|
|
2544
2535
|
|
|
2536
|
+
/* */
|
|
2537
|
+
/* */
|
|
2545
2538
|
//#endregion
|
|
2546
2539
|
class EndpointContext {
|
|
2547
|
-
//#endregion
|
|
2548
|
-
//#region @browser
|
|
2549
|
-
static initNgZone(ngZone) {
|
|
2550
|
-
//#region @browser
|
|
2551
|
-
this.ngZone = ngZone;
|
|
2552
|
-
//#endregion
|
|
2553
|
-
}
|
|
2554
2540
|
//#endregion
|
|
2555
2541
|
//#region fields / typeorm repositories
|
|
2556
2542
|
/* */
|
|
@@ -2618,8 +2604,6 @@ class EndpointContext {
|
|
|
2618
2604
|
this.originalConfig = originalConfig;
|
|
2619
2605
|
this.configFn = configFn;
|
|
2620
2606
|
this.cloneOptions = cloneOptions;
|
|
2621
|
-
//#endregion
|
|
2622
|
-
//#endregion
|
|
2623
2607
|
//#region fields
|
|
2624
2608
|
//#region fields / use mariadb mysql in docker
|
|
2625
2609
|
/**
|
|
@@ -3217,14 +3201,6 @@ class EndpointContext {
|
|
|
3217
3201
|
return (void 0);
|
|
3218
3202
|
}
|
|
3219
3203
|
//#endregion
|
|
3220
|
-
//#region methods & getters / ng zone
|
|
3221
|
-
get ngZone() {
|
|
3222
|
-
//#region @browser
|
|
3223
|
-
return EndpointContext.ngZone;
|
|
3224
|
-
//#endregion
|
|
3225
|
-
return;
|
|
3226
|
-
}
|
|
3227
|
-
//#endregion
|
|
3228
3204
|
//#region methods & getters / start server
|
|
3229
3205
|
async startServer() {
|
|
3230
3206
|
/* */
|
|
@@ -5792,13 +5768,204 @@ class TaonBaseAngularService {
|
|
|
5792
5768
|
return currentContext ? currentContext.getClass(ctor) : void 0;
|
|
5793
5769
|
});
|
|
5794
5770
|
}
|
|
5795
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.
|
|
5796
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.
|
|
5771
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TaonBaseAngularService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5772
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TaonBaseAngularService }); }
|
|
5797
5773
|
}
|
|
5798
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.
|
|
5774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TaonBaseAngularService, decorators: [{
|
|
5799
5775
|
type: Injectable
|
|
5800
5776
|
}], ctorParameters: () => [] });
|
|
5801
5777
|
|
|
5778
|
+
/**
|
|
5779
|
+
* Entity decorator
|
|
5780
|
+
*/
|
|
5781
|
+
function TaonEntity(options) {
|
|
5782
|
+
return function (constructor) {
|
|
5783
|
+
options = options || {};
|
|
5784
|
+
options.uniqueKeyProp = options.uniqueKeyProp || 'id';
|
|
5785
|
+
ClassHelpers.setName(constructor, options?.className);
|
|
5786
|
+
Mapping.DefaultModelWithMapping(options?.defaultModelValues || {}, _.merge(options?.defaultModelMapping || {}, (options?.defaultModelMappingDeep || {})))(constructor);
|
|
5787
|
+
// TODO when entit metadata generator read use this
|
|
5788
|
+
Mapping.DefaultModelWithMapping(void 0, {})(constructor);
|
|
5789
|
+
Reflect.defineMetadata(Symbols.metadata.options.entity, options, constructor);
|
|
5790
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
5791
|
+
/* */
|
|
5792
|
+
/* */
|
|
5793
|
+
CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
|
|
5794
|
+
};
|
|
5795
|
+
}
|
|
5796
|
+
class TaonEntityOptions extends DecoratorAbstractOpt {
|
|
5797
|
+
}
|
|
5798
|
+
|
|
5799
|
+
//#region imports
|
|
5800
|
+
//#endregion
|
|
5801
|
+
let TAON_GLOBAL_STATE = class TAON_GLOBAL_STATE extends TaonBaseAbstractEntity {
|
|
5802
|
+
};
|
|
5803
|
+
TAON_GLOBAL_STATE = __decorate([
|
|
5804
|
+
TaonEntity({
|
|
5805
|
+
className: 'TAON_GLOBAL_STATE',
|
|
5806
|
+
createTable: true,
|
|
5807
|
+
})
|
|
5808
|
+
], TAON_GLOBAL_STATE);
|
|
5809
|
+
|
|
5810
|
+
/**
|
|
5811
|
+
* Controller decorator
|
|
5812
|
+
*/
|
|
5813
|
+
function TaonController(options) {
|
|
5814
|
+
return function (constructor) {
|
|
5815
|
+
ClassHelpers.setName(constructor, options?.className);
|
|
5816
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
5817
|
+
const cfg = ClassHelpers.ensureClassConfig(constructor);
|
|
5818
|
+
options = options || {};
|
|
5819
|
+
cfg.className = options.className || constructor.name;
|
|
5820
|
+
cfg.path = options.path || '';
|
|
5821
|
+
cfg.realtime = options.realtime;
|
|
5822
|
+
cfg.middlewares = options.middlewares;
|
|
5823
|
+
};
|
|
5824
|
+
}
|
|
5825
|
+
|
|
5826
|
+
const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
|
|
5827
|
+
const methodConfig = ClassHelpers.ensureMethodConfig(target, propertyKey);
|
|
5828
|
+
let options;
|
|
5829
|
+
if (typeof pathOrOptions === 'object') {
|
|
5830
|
+
options = pathOrOptions;
|
|
5831
|
+
pathOrOptions = options.path;
|
|
5832
|
+
pathIsGlobal = !!options.pathIsGlobal;
|
|
5833
|
+
path = options.path;
|
|
5834
|
+
}
|
|
5835
|
+
else {
|
|
5836
|
+
options = { pathOrOptions, pathIsGlobal };
|
|
5837
|
+
}
|
|
5838
|
+
const { overrideContentType, overrideResponseType, overrideExpressSendAsHtml, middlewares, } = options;
|
|
5839
|
+
methodConfig.methodName = propertyKey;
|
|
5840
|
+
methodConfig.middlewares = middlewares;
|
|
5841
|
+
methodConfig.type = method;
|
|
5842
|
+
if (!path) {
|
|
5843
|
+
let paramsPathConcatedPath = '';
|
|
5844
|
+
for (const key in methodConfig.parameters) {
|
|
5845
|
+
if (methodConfig.parameters.hasOwnProperty(key)) {
|
|
5846
|
+
const element = methodConfig.parameters[key];
|
|
5847
|
+
if (element.paramType === 'Path' &&
|
|
5848
|
+
_.isString(element.paramName) &&
|
|
5849
|
+
element.paramName.trim().length > 0) {
|
|
5850
|
+
paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5853
|
+
}
|
|
5854
|
+
methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
|
|
5855
|
+
}
|
|
5856
|
+
else {
|
|
5857
|
+
methodConfig.path = path;
|
|
5858
|
+
}
|
|
5859
|
+
methodConfig.descriptor = descriptor;
|
|
5860
|
+
methodConfig.global = pathIsGlobal;
|
|
5861
|
+
methodConfig.contentType = overrideContentType;
|
|
5862
|
+
methodConfig.responseType = overrideResponseType;
|
|
5863
|
+
methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
|
|
5864
|
+
};
|
|
5865
|
+
function GET(pathOrOptions, pathIsGlobal = false) {
|
|
5866
|
+
return function (target, propertyKey, descriptor) {
|
|
5867
|
+
metaReq('get', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
5868
|
+
};
|
|
5869
|
+
}
|
|
5870
|
+
/**
|
|
5871
|
+
* Method for sending html website from text
|
|
5872
|
+
* Example
|
|
5873
|
+
*
|
|
5874
|
+
* ```ts
|
|
5875
|
+
* ...
|
|
5876
|
+
* // in your taon controller
|
|
5877
|
+
* ..Taon.Http.HTML()
|
|
5878
|
+
* sendHtmlDummyWebsite(): Taon.ResponseHtml {
|
|
5879
|
+
* return `
|
|
5880
|
+
<html>
|
|
5881
|
+
<head>
|
|
5882
|
+
<title>Dummy website</title>
|
|
5883
|
+
</head>
|
|
5884
|
+
<body>
|
|
5885
|
+
<h1>This is dummy website</h1>
|
|
5886
|
+
<p>Served as HTML string from Taon controller method</p>
|
|
5887
|
+
</body>
|
|
5888
|
+
</html>
|
|
5889
|
+
* `; *
|
|
5890
|
+
* }
|
|
5891
|
+
* ...
|
|
5892
|
+
* ```
|
|
5893
|
+
*/
|
|
5894
|
+
function HTML(pathOrOptions) {
|
|
5895
|
+
return function (target, propertyKey, descriptor) {
|
|
5896
|
+
const opt = pathOrOptions;
|
|
5897
|
+
opt.overrideExpressSendAsHtml = true;
|
|
5898
|
+
metaReq('get', opt, target, propertyKey, descriptor, pathOrOptions, opt.pathIsGlobal);
|
|
5899
|
+
};
|
|
5900
|
+
}
|
|
5901
|
+
function HEAD(pathOrOptions, pathIsGlobal = false) {
|
|
5902
|
+
return function (target, propertyKey, descriptor) {
|
|
5903
|
+
metaReq('head', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
5904
|
+
};
|
|
5905
|
+
}
|
|
5906
|
+
function POST(pathOrOptions, pathIsGlobal = false) {
|
|
5907
|
+
return function (target, propertyKey, descriptor) {
|
|
5908
|
+
metaReq('post', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
5909
|
+
};
|
|
5910
|
+
}
|
|
5911
|
+
function PUT(pathOrOptions, pathIsGlobal = false) {
|
|
5912
|
+
return function (target, propertyKey, descriptor) {
|
|
5913
|
+
metaReq('put', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
5914
|
+
};
|
|
5915
|
+
}
|
|
5916
|
+
function PATCH(pathOrOptions, pathIsGlobal = false) {
|
|
5917
|
+
return function (target, propertyKey, descriptor) {
|
|
5918
|
+
metaReq('patch', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
5919
|
+
};
|
|
5920
|
+
}
|
|
5921
|
+
function DELETE(pathOrOptions, pathIsGlobal = false) {
|
|
5922
|
+
return function (target, propertyKey, descriptor) {
|
|
5923
|
+
metaReq('delete', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
5924
|
+
};
|
|
5925
|
+
}
|
|
5926
|
+
|
|
5927
|
+
function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
|
|
5928
|
+
const methodCfg = ClassHelpers.ensureMethodConfig(target, propertyKey);
|
|
5929
|
+
const nameKey = name ? name : param;
|
|
5930
|
+
// const key = name || `${param}_${parameterIndex}`;
|
|
5931
|
+
methodCfg.parameters[nameKey] = {
|
|
5932
|
+
index: parameterIndex,
|
|
5933
|
+
paramName: name,
|
|
5934
|
+
paramType: param,
|
|
5935
|
+
defaultType: defaultValue,
|
|
5936
|
+
expireInSeconds: expire,
|
|
5937
|
+
};
|
|
5938
|
+
// console.log('params updated', methodConfig);
|
|
5939
|
+
}
|
|
5940
|
+
/**
|
|
5941
|
+
* @deprecated use Taon.Http.Param.Path (is more safe and cleaner)
|
|
5942
|
+
*/
|
|
5943
|
+
function Path(name) {
|
|
5944
|
+
return function (target, propertyKey, parameterIndex) {
|
|
5945
|
+
metaParam('Path', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
5946
|
+
};
|
|
5947
|
+
}
|
|
5948
|
+
function Query(name) {
|
|
5949
|
+
return function (target, propertyKey, parameterIndex) {
|
|
5950
|
+
metaParam('Query', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
5951
|
+
};
|
|
5952
|
+
}
|
|
5953
|
+
function Cookie(name, expireInSecond = 3600) {
|
|
5954
|
+
return function (target, propertyKey, parameterIndex) {
|
|
5955
|
+
metaParam('Cookie', name, expireInSecond, {}, target, propertyKey, parameterIndex);
|
|
5956
|
+
};
|
|
5957
|
+
}
|
|
5958
|
+
function Header(name) {
|
|
5959
|
+
return function (target, propertyKey, parameterIndex) {
|
|
5960
|
+
metaParam('Header', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
5961
|
+
};
|
|
5962
|
+
}
|
|
5963
|
+
function Body(name) {
|
|
5964
|
+
return function (target, propertyKey, parameterIndex) {
|
|
5965
|
+
metaParam('Body', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
5966
|
+
};
|
|
5967
|
+
}
|
|
5968
|
+
|
|
5802
5969
|
/**
|
|
5803
5970
|
* Provider decorator
|
|
5804
5971
|
*/
|
|
@@ -6073,43 +6240,14 @@ TaonBaseFileUploadMiddleware = __decorate([
|
|
|
6073
6240
|
})
|
|
6074
6241
|
], TaonBaseFileUploadMiddleware);
|
|
6075
6242
|
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
};
|
|
6085
|
-
}
|
|
6086
|
-
class TaonRepositoryOptions extends DecoratorAbstractOpt {
|
|
6087
|
-
}
|
|
6088
|
-
|
|
6089
|
-
//#endregion
|
|
6090
|
-
let TaonBaseCustomRepository = class TaonBaseCustomRepository extends TaonBaseInjector {
|
|
6091
|
-
};
|
|
6092
|
-
TaonBaseCustomRepository = __decorate([
|
|
6093
|
-
TaonRepository({ className: 'TaonBaseCustomRepository' })
|
|
6094
|
-
], TaonBaseCustomRepository);
|
|
6095
|
-
|
|
6096
|
-
//#endregion
|
|
6097
|
-
const INDEX_KEYS_NO_FOR_UPDATE = ['id'];
|
|
6098
|
-
const REPOS_CACHE = Symbol('repository cache inside instance');
|
|
6099
|
-
let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomRepository {
|
|
6100
|
-
constructor(
|
|
6101
|
-
// Injected through TaonBaseCrudController
|
|
6102
|
-
__entityClassResolveFn) {
|
|
6103
|
-
super();
|
|
6104
|
-
this.allowedTypesToUpdate = ['simple-json', 'simple-array', 'json'];
|
|
6105
|
-
// @ts-ignore
|
|
6106
|
-
this.entityClassResolveFn = __entityClassResolveFn;
|
|
6107
|
-
}
|
|
6108
|
-
get dbQuery() {
|
|
6109
|
-
/* */
|
|
6110
|
-
/* */
|
|
6111
|
-
/* */
|
|
6112
|
-
/* */
|
|
6243
|
+
let TaonBaseController = class TaonBaseController extends TaonBaseInjector {
|
|
6244
|
+
/**
|
|
6245
|
+
* Hook that is called when taon app is inited
|
|
6246
|
+
* (all contexts are created and inited)
|
|
6247
|
+
*/
|
|
6248
|
+
async afterAllCtxInited(options) { }
|
|
6249
|
+
//#region upload form data to server
|
|
6250
|
+
uploadFormDataToServer(formData, queryParams) {
|
|
6113
6251
|
/* */
|
|
6114
6252
|
/* */
|
|
6115
6253
|
/* */
|
|
@@ -6125,18 +6263,7 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6125
6263
|
/* */
|
|
6126
6264
|
/* */
|
|
6127
6265
|
/* */
|
|
6128
|
-
return (void 0);
|
|
6129
|
-
}
|
|
6130
|
-
//#endregion
|
|
6131
|
-
//#region connection
|
|
6132
|
-
get connection() {
|
|
6133
6266
|
/* */
|
|
6134
|
-
/* */
|
|
6135
|
-
return (void 0);
|
|
6136
|
-
}
|
|
6137
|
-
//#endregion
|
|
6138
|
-
//#region repository
|
|
6139
|
-
get repository() {
|
|
6140
6267
|
/* */
|
|
6141
6268
|
/* */
|
|
6142
6269
|
/* */
|
|
@@ -6149,51 +6276,162 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6149
6276
|
/* */
|
|
6150
6277
|
return (void 0);
|
|
6151
6278
|
}
|
|
6279
|
+
//#endregion
|
|
6280
|
+
//#region after file upload hook
|
|
6152
6281
|
/**
|
|
6153
|
-
*
|
|
6282
|
+
* Hook after file is uploaded
|
|
6283
|
+
* through `uploadFormDataToServer` or `uploadLocalFileToServer`
|
|
6154
6284
|
*/
|
|
6155
|
-
|
|
6285
|
+
afterFileUploadAction(file, queryParams) {
|
|
6286
|
+
// empty
|
|
6287
|
+
}
|
|
6288
|
+
//#region upload local file to server
|
|
6289
|
+
async uploadLocalFileToServer(absFilePath, options, queryParams) {
|
|
6290
|
+
/* */
|
|
6291
|
+
/* */
|
|
6292
|
+
/* */
|
|
6293
|
+
/* */
|
|
6294
|
+
/* */
|
|
6295
|
+
/* */
|
|
6296
|
+
/* */
|
|
6297
|
+
/* */
|
|
6156
6298
|
/* */
|
|
6157
6299
|
/* */
|
|
6158
|
-
return (void 0);
|
|
6159
|
-
}
|
|
6160
|
-
/**
|
|
6161
|
-
* alias to repository
|
|
6162
|
-
*/
|
|
6163
|
-
get repo() {
|
|
6164
6300
|
/* */
|
|
6165
6301
|
/* */
|
|
6166
|
-
return (void 0);
|
|
6167
|
-
}
|
|
6168
|
-
get repositoryExists() {
|
|
6169
6302
|
/* */
|
|
6170
6303
|
/* */
|
|
6171
6304
|
return (void 0);
|
|
6172
6305
|
}
|
|
6173
6306
|
//#endregion
|
|
6174
|
-
|
|
6307
|
+
// async check() {
|
|
6308
|
+
// await this._waitForProperStatusChange({
|
|
6309
|
+
// request: () => this.uploadFormDataToServer(void 0, void 0).request(),
|
|
6310
|
+
// statusCheck: resp => resp.body.json[0].ok,
|
|
6311
|
+
// });
|
|
6312
|
+
// }
|
|
6175
6313
|
/**
|
|
6176
|
-
*
|
|
6177
|
-
*
|
|
6314
|
+
* Easy way to wait for status change with http (1s default) pooling.
|
|
6315
|
+
*
|
|
6316
|
+
* example (in sub class):
|
|
6317
|
+
* ```ts
|
|
6318
|
+
async check() {
|
|
6319
|
+
await this.waitForProperStatusChange({
|
|
6320
|
+
request: () => this.uploadFormDataToServer(void 0, void 0).request(),
|
|
6321
|
+
statusCheck: resp => resp.body.json[0].ok,
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
* ```
|
|
6178
6325
|
*/
|
|
6179
|
-
|
|
6180
|
-
|
|
6326
|
+
async _waitForProperStatusChange(options) {
|
|
6327
|
+
const poolingInterval = options.poolingInterval || 1000;
|
|
6328
|
+
const taonRequest = options.request;
|
|
6329
|
+
let maxTries = options.maxTries || Number.POSITIVE_INFINITY;
|
|
6330
|
+
let i = 0;
|
|
6331
|
+
let httpErrorsCount = 0;
|
|
6332
|
+
while (true) {
|
|
6333
|
+
await UtilsTerminal.waitMilliseconds(poolingInterval);
|
|
6334
|
+
try {
|
|
6335
|
+
const resp = await taonRequest({
|
|
6336
|
+
reqIndexNum: i,
|
|
6337
|
+
httpErrorsCount,
|
|
6338
|
+
});
|
|
6339
|
+
if (options.statusCheck && options.statusCheck(resp)) {
|
|
6340
|
+
return;
|
|
6341
|
+
}
|
|
6342
|
+
}
|
|
6343
|
+
catch (error) {
|
|
6344
|
+
httpErrorsCount++;
|
|
6345
|
+
if (options.loopRequestsOnBackendError) {
|
|
6346
|
+
const isProperTaonError = error instanceof HttpResponseError &&
|
|
6347
|
+
error.body.json[CoreModels.TaonHttpErrorCustomProp];
|
|
6348
|
+
const isHttpError = error instanceof HttpResponseError && !isProperTaonError;
|
|
6349
|
+
const isUnknownError = !(error instanceof HttpResponseError);
|
|
6350
|
+
const resBool = await options.loopRequestsOnBackendError({
|
|
6351
|
+
taonError: isProperTaonError ? error : void 0,
|
|
6352
|
+
unknownHttpError: isHttpError ? error : void 0,
|
|
6353
|
+
unknownError: isUnknownError ? error : void 0,
|
|
6354
|
+
reqIndexNum: i,
|
|
6355
|
+
httpErrorsCount,
|
|
6356
|
+
});
|
|
6357
|
+
if (resBool) {
|
|
6358
|
+
i++;
|
|
6359
|
+
continue;
|
|
6360
|
+
}
|
|
6361
|
+
else {
|
|
6362
|
+
return;
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
if (httpErrorsCount >
|
|
6366
|
+
(options.allowedHttpErrors || Number.POSITIVE_INFINITY)) {
|
|
6367
|
+
throw new Error(`Too many http errors (${httpErrorsCount}) for "${options.actionName}".`);
|
|
6368
|
+
}
|
|
6369
|
+
}
|
|
6370
|
+
if (i++ > maxTries) {
|
|
6371
|
+
throw new Error(`Timeout waiting for "${options.actionName}" to be finished. Waited for ${maxTries} seconds`);
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6181
6374
|
}
|
|
6375
|
+
};
|
|
6376
|
+
__decorate([
|
|
6377
|
+
POST({
|
|
6378
|
+
overrideContentType: 'multipart/form-data',
|
|
6379
|
+
middlewares: ({ parentMiddlewares }) => ({
|
|
6380
|
+
...parentMiddlewares,
|
|
6381
|
+
TaonBaseFileUploadMiddleware,
|
|
6382
|
+
}),
|
|
6383
|
+
}),
|
|
6384
|
+
__param(0, Body()),
|
|
6385
|
+
__param(1, Query()),
|
|
6386
|
+
__metadata("design:type", Function),
|
|
6387
|
+
__metadata("design:paramtypes", [FormData, Object]),
|
|
6388
|
+
__metadata("design:returntype", Object)
|
|
6389
|
+
], TaonBaseController.prototype, "uploadFormDataToServer", null);
|
|
6390
|
+
TaonBaseController = __decorate([
|
|
6391
|
+
TaonController({
|
|
6392
|
+
className: 'TaonBaseController',
|
|
6393
|
+
})
|
|
6394
|
+
], TaonBaseController);
|
|
6395
|
+
|
|
6396
|
+
//#endregion
|
|
6397
|
+
/**
|
|
6398
|
+
* Please override property entityClassFn with entity class.
|
|
6399
|
+
*/
|
|
6400
|
+
let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseController {
|
|
6182
6401
|
//#endregion
|
|
6183
|
-
//#region
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6402
|
+
//#region init
|
|
6403
|
+
async _() {
|
|
6404
|
+
if (!_.isFunction(this.entityClassResolveFn)) {
|
|
6405
|
+
Helpers.warn(`Skipping initing CRUD controller ${ClassHelpers.getName(this)} because entityClassResolveFn is not provided.`);
|
|
6406
|
+
return;
|
|
6407
|
+
}
|
|
6408
|
+
let entityClassFn = this.entityClassResolveFn();
|
|
6409
|
+
this.db = this.injectRepo(entityClassFn);
|
|
6410
|
+
if (entityClassFn) {
|
|
6411
|
+
const configEntity = Reflect.getMetadata(Symbols.metadata.options.entity, ClassHelpers.getClassFnFromObject(this));
|
|
6412
|
+
if (configEntity?.createTable === false) {
|
|
6413
|
+
Helpers.warn(`Table for entity ${ClassHelpers.getName(entityClassFn)} will not be created. Crud will not work properly.`);
|
|
6414
|
+
}
|
|
6415
|
+
}
|
|
6416
|
+
else {
|
|
6417
|
+
Helpers.error(`Entity class not provided for controller ${ClassHelpers.getName(this)}.
|
|
6418
|
+
|
|
6419
|
+
Please provide entity as class property entityClassFn:
|
|
6420
|
+
|
|
6421
|
+
class ${ClassHelpers.getName(this)} extends TaonBaseCrudController<Entity> {
|
|
6422
|
+
// ...
|
|
6423
|
+
entityClassResolveFn = ()=> MyEntityClass;
|
|
6424
|
+
// ...
|
|
6425
|
+
}
|
|
6426
|
+
|
|
6427
|
+
`);
|
|
6428
|
+
}
|
|
6429
|
+
await super._();
|
|
6189
6430
|
}
|
|
6190
6431
|
//#endregion
|
|
6191
|
-
//#region
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
* If entity does not exist in the database then inserts, otherwise updates.
|
|
6195
|
-
*/
|
|
6196
|
-
async save(item, options) {
|
|
6432
|
+
//#region bufferd changes
|
|
6433
|
+
bufforedChanges(id, property, alreadyLength) {
|
|
6434
|
+
/* */
|
|
6197
6435
|
/* */
|
|
6198
6436
|
/* */
|
|
6199
6437
|
/* */
|
|
@@ -6210,14 +6448,9 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6210
6448
|
/* */
|
|
6211
6449
|
return (void 0);
|
|
6212
6450
|
}
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
*/
|
|
6217
|
-
create(plainEntityLikeOrPlainEntityLikes) {
|
|
6218
|
-
return this.repo.create(plainEntityLikeOrPlainEntityLikes);
|
|
6219
|
-
}
|
|
6220
|
-
async bulkSave(items, options) {
|
|
6451
|
+
//#endregion
|
|
6452
|
+
//#region pagintation
|
|
6453
|
+
pagination(pageNumber = 1, pageSize = 10, search = '') {
|
|
6221
6454
|
/* */
|
|
6222
6455
|
/* */
|
|
6223
6456
|
/* */
|
|
@@ -6227,82 +6460,6 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6227
6460
|
/* */
|
|
6228
6461
|
/* */
|
|
6229
6462
|
/* */
|
|
6230
|
-
return (void 0);
|
|
6231
|
-
}
|
|
6232
|
-
/**
|
|
6233
|
-
* @deprecated use bulkSave instead
|
|
6234
|
-
*/
|
|
6235
|
-
async bulkCreate(items, options) {
|
|
6236
|
-
return this.bulkSave(items, options);
|
|
6237
|
-
}
|
|
6238
|
-
//#region old typeorm version
|
|
6239
|
-
/**
|
|
6240
|
-
* Saves all given entities in the database.
|
|
6241
|
-
* If entities do not exist in the database then inserts, otherwise updates.
|
|
6242
|
-
*/
|
|
6243
|
-
// save<T extends DeepPartial<Entity>>(
|
|
6244
|
-
// entities: T[],
|
|
6245
|
-
// options: SaveOptions & {
|
|
6246
|
-
// reload: false;
|
|
6247
|
-
// },
|
|
6248
|
-
// ): Promise<T[]>;
|
|
6249
|
-
// /**
|
|
6250
|
-
// * Saves all given entities in the database.
|
|
6251
|
-
// * If entities do not exist in the database then inserts, otherwise updates.
|
|
6252
|
-
// */
|
|
6253
|
-
// save<T extends DeepPartial<Entity>>(
|
|
6254
|
-
// entities: T[],
|
|
6255
|
-
// options?: SaveOptions,
|
|
6256
|
-
// ): Promise<(T & Entity)[]>;
|
|
6257
|
-
// /**
|
|
6258
|
-
// * Saves a given entity in the database.
|
|
6259
|
-
// * If entity does not exist in the database then inserts, otherwise updates.
|
|
6260
|
-
// */
|
|
6261
|
-
// save<T extends DeepPartial<Entity>>(
|
|
6262
|
-
// entity: T,
|
|
6263
|
-
// options: SaveOptions & {
|
|
6264
|
-
// reload: false;
|
|
6265
|
-
// },
|
|
6266
|
-
// ): Promise<T>;
|
|
6267
|
-
// /**
|
|
6268
|
-
// * Saves a given entity in the database.
|
|
6269
|
-
// * If entity does not exist in the database then inserts, otherwise updates.
|
|
6270
|
-
// */
|
|
6271
|
-
// save<T extends DeepPartial<Entity>>(
|
|
6272
|
-
// entity: T,
|
|
6273
|
-
// options?: SaveOptions,
|
|
6274
|
-
// ): Promise<T & Entity> {
|
|
6275
|
-
// return this.repo.save(entity, options);
|
|
6276
|
-
// }
|
|
6277
|
-
//#endregion
|
|
6278
|
-
//#endregion
|
|
6279
|
-
//#region crud operations / typeorm / merge
|
|
6280
|
-
/**
|
|
6281
|
-
* Merges multiple entities (or entity-like objects) into a given entity.
|
|
6282
|
-
*/
|
|
6283
|
-
merge(mergeIntoEntity, ...entityLikes) {
|
|
6284
|
-
return this.repo.merge(mergeIntoEntity, ...entityLikes);
|
|
6285
|
-
}
|
|
6286
|
-
//#endregion
|
|
6287
|
-
//#region crud operations / typeorm / preload
|
|
6288
|
-
/**
|
|
6289
|
-
* Creates a new entity from the given plain javascript object. If entity already exist in the database, then
|
|
6290
|
-
* it loads it (and everything related to it), replaces all values with the new ones from the given object
|
|
6291
|
-
* and returns this new entity. This new entity is actually a loaded from the db entity with all properties
|
|
6292
|
-
* replaced from the new object.
|
|
6293
|
-
*
|
|
6294
|
-
* Note that given entity-like object must have an entity id / primary key to find entity by.
|
|
6295
|
-
* Returns undefined if entity with given id was not found.
|
|
6296
|
-
*/
|
|
6297
|
-
preload(entityLike) {
|
|
6298
|
-
return this.repo.preload(entityLike);
|
|
6299
|
-
}
|
|
6300
|
-
//#endregion
|
|
6301
|
-
//#region crud operations / typeorm / remove (delete) & bulk remove (delete)
|
|
6302
|
-
/**
|
|
6303
|
-
* Removes a given entities from the database.
|
|
6304
|
-
*/
|
|
6305
|
-
async remove(idOrEntity) {
|
|
6306
6463
|
/* */
|
|
6307
6464
|
/* */
|
|
6308
6465
|
/* */
|
|
@@ -6324,27 +6481,54 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6324
6481
|
/* */
|
|
6325
6482
|
/* */
|
|
6326
6483
|
/* */
|
|
6327
|
-
|
|
6484
|
+
/* */
|
|
6485
|
+
/* */
|
|
6486
|
+
/* */
|
|
6487
|
+
/* */
|
|
6488
|
+
/* */
|
|
6489
|
+
/* */
|
|
6490
|
+
/* */
|
|
6491
|
+
/* */
|
|
6492
|
+
return (void 0);
|
|
6328
6493
|
}
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6494
|
+
//#endregion
|
|
6495
|
+
//#region get all
|
|
6496
|
+
getAll() {
|
|
6497
|
+
/* */
|
|
6498
|
+
/* */
|
|
6499
|
+
/* */
|
|
6500
|
+
/* */
|
|
6501
|
+
/* */
|
|
6502
|
+
/* */
|
|
6503
|
+
/* */
|
|
6504
|
+
/* */
|
|
6505
|
+
/* */
|
|
6506
|
+
return (void 0);
|
|
6334
6507
|
}
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6508
|
+
//#endregion
|
|
6509
|
+
//#region get by id
|
|
6510
|
+
getBy(id) {
|
|
6511
|
+
/* */
|
|
6512
|
+
/* */
|
|
6513
|
+
/* */
|
|
6514
|
+
/* */
|
|
6515
|
+
/* */
|
|
6516
|
+
return (void 0);
|
|
6340
6517
|
}
|
|
6341
|
-
|
|
6518
|
+
//#endregion
|
|
6519
|
+
//#region update by id
|
|
6520
|
+
updateById(id, item) {
|
|
6342
6521
|
/* */
|
|
6343
6522
|
/* */
|
|
6344
6523
|
/* */
|
|
6345
6524
|
/* */
|
|
6346
6525
|
/* */
|
|
6347
6526
|
/* */
|
|
6527
|
+
return (void 0);
|
|
6528
|
+
}
|
|
6529
|
+
//#endregion
|
|
6530
|
+
//#region patch by id
|
|
6531
|
+
patchById(id, item) {
|
|
6348
6532
|
/* */
|
|
6349
6533
|
/* */
|
|
6350
6534
|
/* */
|
|
@@ -6353,51 +6537,194 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6353
6537
|
/* */
|
|
6354
6538
|
return (void 0);
|
|
6355
6539
|
}
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6540
|
+
//#endregion
|
|
6541
|
+
//#region bulk update
|
|
6542
|
+
bulkUpdate(items) {
|
|
6543
|
+
/* */
|
|
6544
|
+
/* */
|
|
6545
|
+
/* */
|
|
6546
|
+
/* */
|
|
6547
|
+
/* */
|
|
6548
|
+
/* */
|
|
6549
|
+
/* */
|
|
6550
|
+
/* */
|
|
6551
|
+
return (void 0);
|
|
6364
6552
|
}
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6553
|
+
//#endregion
|
|
6554
|
+
//#region delete by id
|
|
6555
|
+
deleteById(id) {
|
|
6556
|
+
/* */
|
|
6557
|
+
/* */
|
|
6558
|
+
/* */
|
|
6559
|
+
/* */
|
|
6560
|
+
/* */
|
|
6561
|
+
return (void 0);
|
|
6370
6562
|
}
|
|
6371
6563
|
//#endregion
|
|
6372
|
-
//#region
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
return this.repo.insert(entity);
|
|
6564
|
+
//#region bulk delete
|
|
6565
|
+
bulkDelete(ids) {
|
|
6566
|
+
/* */
|
|
6567
|
+
/* */
|
|
6568
|
+
/* */
|
|
6569
|
+
/* */
|
|
6570
|
+
/* */
|
|
6571
|
+
return (void 0);
|
|
6381
6572
|
}
|
|
6382
6573
|
//#endregion
|
|
6383
|
-
//#region
|
|
6384
|
-
|
|
6574
|
+
//#region bulk delete
|
|
6575
|
+
clearTable() {
|
|
6576
|
+
/* */
|
|
6385
6577
|
/* */
|
|
6386
6578
|
/* */
|
|
6387
6579
|
/* */
|
|
6388
6580
|
return (void 0);
|
|
6389
6581
|
}
|
|
6390
|
-
|
|
6582
|
+
//#endregion
|
|
6583
|
+
//#region create
|
|
6584
|
+
save(item) {
|
|
6391
6585
|
/* */
|
|
6392
6586
|
/* */
|
|
6393
6587
|
/* */
|
|
6394
6588
|
/* */
|
|
6395
6589
|
/* */
|
|
6590
|
+
return (void 0);
|
|
6591
|
+
}
|
|
6592
|
+
//#endregion
|
|
6593
|
+
//#region bulk create
|
|
6594
|
+
bulkCreate(items) {
|
|
6396
6595
|
/* */
|
|
6397
6596
|
/* */
|
|
6398
6597
|
/* */
|
|
6399
6598
|
/* */
|
|
6400
6599
|
/* */
|
|
6600
|
+
return (void 0);
|
|
6601
|
+
}
|
|
6602
|
+
};
|
|
6603
|
+
__decorate([
|
|
6604
|
+
GET(),
|
|
6605
|
+
__param(0, Query(`id`)),
|
|
6606
|
+
__param(1, Query(`property`)),
|
|
6607
|
+
__param(2, Query('alreadyLength')),
|
|
6608
|
+
__metadata("design:type", Function),
|
|
6609
|
+
__metadata("design:paramtypes", [Object, String, Number]),
|
|
6610
|
+
__metadata("design:returntype", Object)
|
|
6611
|
+
], TaonBaseCrudController.prototype, "bufforedChanges", null);
|
|
6612
|
+
__decorate([
|
|
6613
|
+
GET(),
|
|
6614
|
+
__param(0, Query('pageNumber')),
|
|
6615
|
+
__param(1, Query('pageSize')),
|
|
6616
|
+
__param(2, Query('search')),
|
|
6617
|
+
__metadata("design:type", Function),
|
|
6618
|
+
__metadata("design:paramtypes", [Number, Number, String]),
|
|
6619
|
+
__metadata("design:returntype", Object)
|
|
6620
|
+
], TaonBaseCrudController.prototype, "pagination", null);
|
|
6621
|
+
__decorate([
|
|
6622
|
+
GET(),
|
|
6623
|
+
__metadata("design:type", Function),
|
|
6624
|
+
__metadata("design:paramtypes", []),
|
|
6625
|
+
__metadata("design:returntype", Object)
|
|
6626
|
+
], TaonBaseCrudController.prototype, "getAll", null);
|
|
6627
|
+
__decorate([
|
|
6628
|
+
GET(),
|
|
6629
|
+
__param(0, Query(`id`)),
|
|
6630
|
+
__metadata("design:type", Function),
|
|
6631
|
+
__metadata("design:paramtypes", [Object]),
|
|
6632
|
+
__metadata("design:returntype", Object)
|
|
6633
|
+
], TaonBaseCrudController.prototype, "getBy", null);
|
|
6634
|
+
__decorate([
|
|
6635
|
+
PUT(),
|
|
6636
|
+
__param(0, Query(`id`)),
|
|
6637
|
+
__param(1, Body()),
|
|
6638
|
+
__metadata("design:type", Function),
|
|
6639
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
6640
|
+
__metadata("design:returntype", Object)
|
|
6641
|
+
], TaonBaseCrudController.prototype, "updateById", null);
|
|
6642
|
+
__decorate([
|
|
6643
|
+
PATCH(),
|
|
6644
|
+
__param(0, Query(`id`)),
|
|
6645
|
+
__param(1, Body()),
|
|
6646
|
+
__metadata("design:type", Function),
|
|
6647
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
6648
|
+
__metadata("design:returntype", Object)
|
|
6649
|
+
], TaonBaseCrudController.prototype, "patchById", null);
|
|
6650
|
+
__decorate([
|
|
6651
|
+
PUT(),
|
|
6652
|
+
__param(0, Body()),
|
|
6653
|
+
__metadata("design:type", Function),
|
|
6654
|
+
__metadata("design:paramtypes", [Array]),
|
|
6655
|
+
__metadata("design:returntype", Object)
|
|
6656
|
+
], TaonBaseCrudController.prototype, "bulkUpdate", null);
|
|
6657
|
+
__decorate([
|
|
6658
|
+
DELETE(),
|
|
6659
|
+
__param(0, Query(`id`)),
|
|
6660
|
+
__metadata("design:type", Function),
|
|
6661
|
+
__metadata("design:paramtypes", [Object]),
|
|
6662
|
+
__metadata("design:returntype", Object)
|
|
6663
|
+
], TaonBaseCrudController.prototype, "deleteById", null);
|
|
6664
|
+
__decorate([
|
|
6665
|
+
DELETE(),
|
|
6666
|
+
__param(0, Query(`ids`)),
|
|
6667
|
+
__metadata("design:type", Function),
|
|
6668
|
+
__metadata("design:paramtypes", [Array]),
|
|
6669
|
+
__metadata("design:returntype", Object)
|
|
6670
|
+
], TaonBaseCrudController.prototype, "bulkDelete", null);
|
|
6671
|
+
__decorate([
|
|
6672
|
+
DELETE(),
|
|
6673
|
+
__metadata("design:type", Function),
|
|
6674
|
+
__metadata("design:paramtypes", []),
|
|
6675
|
+
__metadata("design:returntype", Object)
|
|
6676
|
+
], TaonBaseCrudController.prototype, "clearTable", null);
|
|
6677
|
+
__decorate([
|
|
6678
|
+
POST(),
|
|
6679
|
+
__param(0, Body()),
|
|
6680
|
+
__metadata("design:type", Function),
|
|
6681
|
+
__metadata("design:paramtypes", [Object]),
|
|
6682
|
+
__metadata("design:returntype", Object)
|
|
6683
|
+
], TaonBaseCrudController.prototype, "save", null);
|
|
6684
|
+
__decorate([
|
|
6685
|
+
POST(),
|
|
6686
|
+
__param(0, Body()),
|
|
6687
|
+
__metadata("design:type", Function),
|
|
6688
|
+
__metadata("design:paramtypes", [Object]),
|
|
6689
|
+
__metadata("design:returntype", Object)
|
|
6690
|
+
], TaonBaseCrudController.prototype, "bulkCreate", null);
|
|
6691
|
+
TaonBaseCrudController = __decorate([
|
|
6692
|
+
TaonController({ className: 'TaonBaseCrudController' })
|
|
6693
|
+
], TaonBaseCrudController);
|
|
6694
|
+
|
|
6695
|
+
/**
|
|
6696
|
+
* Repository decorator
|
|
6697
|
+
*/
|
|
6698
|
+
function TaonRepository(options) {
|
|
6699
|
+
return function (constructor) {
|
|
6700
|
+
Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
|
|
6701
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
6702
|
+
ClassHelpers.setName(constructor, options?.className);
|
|
6703
|
+
};
|
|
6704
|
+
}
|
|
6705
|
+
class TaonRepositoryOptions extends DecoratorAbstractOpt {
|
|
6706
|
+
}
|
|
6707
|
+
|
|
6708
|
+
//#endregion
|
|
6709
|
+
let TaonBaseCustomRepository = class TaonBaseCustomRepository extends TaonBaseInjector {
|
|
6710
|
+
};
|
|
6711
|
+
TaonBaseCustomRepository = __decorate([
|
|
6712
|
+
TaonRepository({ className: 'TaonBaseCustomRepository' })
|
|
6713
|
+
], TaonBaseCustomRepository);
|
|
6714
|
+
|
|
6715
|
+
//#endregion
|
|
6716
|
+
const INDEX_KEYS_NO_FOR_UPDATE = ['id'];
|
|
6717
|
+
let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomRepository {
|
|
6718
|
+
constructor(
|
|
6719
|
+
// Injected through TaonBaseCrudController
|
|
6720
|
+
__entityClassResolveFn) {
|
|
6721
|
+
super();
|
|
6722
|
+
this.REPOS_CACHE_KEY = Symbol('repository cache inside instance');
|
|
6723
|
+
this.allowedTypesToUpdate = ['simple-json', 'simple-array', 'json'];
|
|
6724
|
+
// @ts-ignore
|
|
6725
|
+
this.entityClassResolveFn = __entityClassResolveFn;
|
|
6726
|
+
}
|
|
6727
|
+
get dbQuery() {
|
|
6401
6728
|
/* */
|
|
6402
6729
|
/* */
|
|
6403
6730
|
/* */
|
|
@@ -6417,8 +6744,18 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6417
6744
|
/* */
|
|
6418
6745
|
/* */
|
|
6419
6746
|
/* */
|
|
6747
|
+
return (void 0);
|
|
6748
|
+
}
|
|
6749
|
+
//#endregion
|
|
6750
|
+
//#region connection
|
|
6751
|
+
get connection() {
|
|
6420
6752
|
/* */
|
|
6421
6753
|
/* */
|
|
6754
|
+
return (void 0);
|
|
6755
|
+
}
|
|
6756
|
+
//#endregion
|
|
6757
|
+
//#region repository
|
|
6758
|
+
get repository() {
|
|
6422
6759
|
/* */
|
|
6423
6760
|
/* */
|
|
6424
6761
|
/* */
|
|
@@ -6432,9 +6769,6 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6432
6769
|
/* */
|
|
6433
6770
|
/* */
|
|
6434
6771
|
/* */
|
|
6435
|
-
return (void 0);
|
|
6436
|
-
}
|
|
6437
|
-
async bulkUpdate(items) {
|
|
6438
6772
|
/* */
|
|
6439
6773
|
/* */
|
|
6440
6774
|
/* */
|
|
@@ -6444,246 +6778,289 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6444
6778
|
/* */
|
|
6445
6779
|
/* */
|
|
6446
6780
|
/* */
|
|
6447
|
-
|
|
6781
|
+
/* */
|
|
6782
|
+
/* */
|
|
6783
|
+
/* */
|
|
6784
|
+
/* */
|
|
6785
|
+
/* */
|
|
6786
|
+
/* */
|
|
6787
|
+
/* */
|
|
6788
|
+
return (void 0);
|
|
6448
6789
|
}
|
|
6449
|
-
//#region tpeorm update version
|
|
6450
|
-
// this version suck and will not return update entity
|
|
6451
|
-
// /**
|
|
6452
|
-
// * Updates entity partially. Entity can be found by a given conditions.
|
|
6453
|
-
// * Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
6454
|
-
// * Executes fast and efficient UPDATE query.
|
|
6455
|
-
// * Does not check if entity exist in the database.
|
|
6456
|
-
// */
|
|
6457
|
-
// update(
|
|
6458
|
-
// criteria:
|
|
6459
|
-
// | string
|
|
6460
|
-
// | string[]
|
|
6461
|
-
// | number
|
|
6462
|
-
// | number[]
|
|
6463
|
-
// | Date
|
|
6464
|
-
// | Date[]
|
|
6465
|
-
// | ObjectID
|
|
6466
|
-
// | ObjectID[]
|
|
6467
|
-
// | FindOptionsWhere<Entity>,
|
|
6468
|
-
// partialEntity: QueryDeepPartialEntity<Entity>,
|
|
6469
|
-
// ): Promise<UpdateResult> {
|
|
6470
|
-
// return this.repo.update(criteria, partialEntity);
|
|
6471
|
-
// }
|
|
6472
|
-
//#endregion
|
|
6473
|
-
//#endregion
|
|
6474
|
-
//#region crud operations / typeorm / upsert
|
|
6475
6790
|
/**
|
|
6476
|
-
*
|
|
6477
|
-
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
6478
|
-
* Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
|
|
6791
|
+
* target for repository
|
|
6479
6792
|
*/
|
|
6480
|
-
|
|
6481
|
-
|
|
6793
|
+
get target() {
|
|
6794
|
+
/* */
|
|
6795
|
+
/* */
|
|
6796
|
+
return (void 0);
|
|
6482
6797
|
}
|
|
6483
|
-
//#endregion
|
|
6484
|
-
//#region crud operations / typeorm / soft delete
|
|
6485
6798
|
/**
|
|
6486
|
-
*
|
|
6487
|
-
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
6488
|
-
* Executes fast and efficient SOFT-DELETE query.
|
|
6489
|
-
* Does not check if entity exist in the database.
|
|
6799
|
+
* alias to repository
|
|
6490
6800
|
*/
|
|
6491
|
-
|
|
6492
|
-
|
|
6801
|
+
get repo() {
|
|
6802
|
+
/* */
|
|
6803
|
+
/* */
|
|
6804
|
+
return (void 0);
|
|
6493
6805
|
}
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
6499
|
-
* Executes fast and efficient SOFT-DELETE query.
|
|
6500
|
-
* Does not check if entity exist in the database.
|
|
6501
|
-
*/
|
|
6502
|
-
restore(criteria) {
|
|
6503
|
-
return this.repo.restore(criteria);
|
|
6806
|
+
get repositoryExists() {
|
|
6807
|
+
/* */
|
|
6808
|
+
/* */
|
|
6809
|
+
return (void 0);
|
|
6504
6810
|
}
|
|
6505
6811
|
//#endregion
|
|
6506
|
-
//#region crud operations / typeorm /
|
|
6812
|
+
//#region crud operations / typeorm / has id
|
|
6507
6813
|
/**
|
|
6508
|
-
*
|
|
6509
|
-
*
|
|
6814
|
+
* Checks if entity has an id.
|
|
6815
|
+
* If entity composite compose ids, it will check them all.
|
|
6510
6816
|
*/
|
|
6511
|
-
|
|
6512
|
-
return this.repo.
|
|
6817
|
+
hasId(entity) {
|
|
6818
|
+
return this.repo.hasId(entity);
|
|
6513
6819
|
}
|
|
6514
6820
|
//#endregion
|
|
6515
|
-
//#region crud operations / typeorm /
|
|
6821
|
+
//#region crud operations / typeorm / get id
|
|
6516
6822
|
/**
|
|
6517
|
-
*
|
|
6518
|
-
* Useful for pagination.
|
|
6823
|
+
* Gets entity mixed id.
|
|
6519
6824
|
*/
|
|
6520
|
-
|
|
6521
|
-
return this.repo.
|
|
6825
|
+
getId(entity) {
|
|
6826
|
+
return this.repo.getId(entity);
|
|
6522
6827
|
}
|
|
6523
6828
|
//#endregion
|
|
6524
|
-
//#region crud operations / typeorm /
|
|
6829
|
+
//#region crud operations / typeorm / create & bulk create
|
|
6525
6830
|
/**
|
|
6526
|
-
|
|
6831
|
+
Saves a given entity in the database.
|
|
6832
|
+
* If entity does not exist in the database then inserts, otherwise updates.
|
|
6527
6833
|
*/
|
|
6528
|
-
|
|
6529
|
-
|
|
6834
|
+
async save(item, options) {
|
|
6835
|
+
/* */
|
|
6836
|
+
/* */
|
|
6837
|
+
/* */
|
|
6838
|
+
/* */
|
|
6839
|
+
/* */
|
|
6840
|
+
/* */
|
|
6841
|
+
/* */
|
|
6842
|
+
/* */
|
|
6843
|
+
/* */
|
|
6844
|
+
/* */
|
|
6845
|
+
/* */
|
|
6846
|
+
/* */
|
|
6847
|
+
/* */
|
|
6848
|
+
/* */
|
|
6849
|
+
return (void 0);
|
|
6530
6850
|
}
|
|
6531
|
-
//#endregion
|
|
6532
|
-
//#region crud operations / typeorm / find by
|
|
6533
6851
|
/**
|
|
6534
|
-
*
|
|
6852
|
+
* Creates a new entity instance or instances.
|
|
6853
|
+
* Can copy properties from the given object into new entities.
|
|
6535
6854
|
*/
|
|
6536
|
-
|
|
6537
|
-
return this.repo.
|
|
6855
|
+
create(plainEntityLikeOrPlainEntityLikes) {
|
|
6856
|
+
return this.repo.create(plainEntityLikeOrPlainEntityLikes);
|
|
6538
6857
|
}
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
// }
|
|
6551
|
-
//
|
|
6552
|
-
/**
|
|
6553
|
-
* Finds entities that match given find options.
|
|
6554
|
-
* Also counts all entities that match given conditions,
|
|
6555
|
-
* but ignores pagination settings (from and take options).
|
|
6556
|
-
*/
|
|
6557
|
-
findAndCount(options) {
|
|
6558
|
-
return this.repo.findAndCount(options);
|
|
6858
|
+
async bulkSave(items, options) {
|
|
6859
|
+
/* */
|
|
6860
|
+
/* */
|
|
6861
|
+
/* */
|
|
6862
|
+
/* */
|
|
6863
|
+
/* */
|
|
6864
|
+
/* */
|
|
6865
|
+
/* */
|
|
6866
|
+
/* */
|
|
6867
|
+
/* */
|
|
6868
|
+
return (void 0);
|
|
6559
6869
|
}
|
|
6560
|
-
//#endregion
|
|
6561
|
-
//#region crud operations / typeorm / find and count by
|
|
6562
6870
|
/**
|
|
6563
|
-
*
|
|
6564
|
-
* Also counts all entities that match given conditions,
|
|
6565
|
-
* but ignores pagination settings (from and take options).
|
|
6871
|
+
* @deprecated use bulkSave instead
|
|
6566
6872
|
*/
|
|
6567
|
-
|
|
6568
|
-
return this.
|
|
6873
|
+
async bulkCreate(items, options) {
|
|
6874
|
+
return this.bulkSave(items, options);
|
|
6569
6875
|
}
|
|
6570
|
-
//#
|
|
6571
|
-
//#region crud operations / typeorm / find by ids
|
|
6876
|
+
//#region old typeorm version
|
|
6572
6877
|
/**
|
|
6573
|
-
*
|
|
6574
|
-
*
|
|
6575
|
-
*
|
|
6576
|
-
* @deprecated use `findBy` method instead in conjunction with `In` operator, for example:
|
|
6577
|
-
*
|
|
6578
|
-
* .findBy({
|
|
6579
|
-
* id: In([1, 2, 3])
|
|
6580
|
-
* })
|
|
6878
|
+
* Saves all given entities in the database.
|
|
6879
|
+
* If entities do not exist in the database then inserts, otherwise updates.
|
|
6581
6880
|
*/
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6881
|
+
// save<T extends DeepPartial<Entity>>(
|
|
6882
|
+
// entities: T[],
|
|
6883
|
+
// options: SaveOptions & {
|
|
6884
|
+
// reload: false;
|
|
6885
|
+
// },
|
|
6886
|
+
// ): Promise<T[]>;
|
|
6887
|
+
// /**
|
|
6888
|
+
// * Saves all given entities in the database.
|
|
6889
|
+
// * If entities do not exist in the database then inserts, otherwise updates.
|
|
6890
|
+
// */
|
|
6891
|
+
// save<T extends DeepPartial<Entity>>(
|
|
6892
|
+
// entities: T[],
|
|
6893
|
+
// options?: SaveOptions,
|
|
6894
|
+
// ): Promise<(T & Entity)[]>;
|
|
6895
|
+
// /**
|
|
6896
|
+
// * Saves a given entity in the database.
|
|
6897
|
+
// * If entity does not exist in the database then inserts, otherwise updates.
|
|
6898
|
+
// */
|
|
6899
|
+
// save<T extends DeepPartial<Entity>>(
|
|
6900
|
+
// entity: T,
|
|
6901
|
+
// options: SaveOptions & {
|
|
6902
|
+
// reload: false;
|
|
6903
|
+
// },
|
|
6904
|
+
// ): Promise<T>;
|
|
6905
|
+
// /**
|
|
6906
|
+
// * Saves a given entity in the database.
|
|
6907
|
+
// * If entity does not exist in the database then inserts, otherwise updates.
|
|
6908
|
+
// */
|
|
6909
|
+
// save<T extends DeepPartial<Entity>>(
|
|
6910
|
+
// entity: T,
|
|
6911
|
+
// options?: SaveOptions,
|
|
6912
|
+
// ): Promise<T & Entity> {
|
|
6913
|
+
// return this.repo.save(entity, options);
|
|
6914
|
+
// }
|
|
6585
6915
|
//#endregion
|
|
6586
|
-
//#region crud operations / typeorm / find one
|
|
6587
|
-
/**
|
|
6588
|
-
* Finds first entity by a given find options.
|
|
6589
|
-
* If entity was not found in the database - returns null.
|
|
6590
|
-
*/
|
|
6591
|
-
findOne(options) {
|
|
6592
|
-
return this.repo.findOne(options);
|
|
6593
|
-
}
|
|
6594
6916
|
//#endregion
|
|
6595
|
-
//#region crud operations / typeorm /
|
|
6917
|
+
//#region crud operations / typeorm / merge
|
|
6596
6918
|
/**
|
|
6597
|
-
*
|
|
6598
|
-
* If entity was not found in the database - returns null.
|
|
6919
|
+
* Merges multiple entities (or entity-like objects) into a given entity.
|
|
6599
6920
|
*/
|
|
6600
|
-
|
|
6601
|
-
return this.repo.
|
|
6921
|
+
merge(mergeIntoEntity, ...entityLikes) {
|
|
6922
|
+
return this.repo.merge(mergeIntoEntity, ...entityLikes);
|
|
6602
6923
|
}
|
|
6603
6924
|
//#endregion
|
|
6604
|
-
//#region crud operations / typeorm /
|
|
6925
|
+
//#region crud operations / typeorm / preload
|
|
6605
6926
|
/**
|
|
6606
|
-
*
|
|
6607
|
-
*
|
|
6608
|
-
*
|
|
6609
|
-
*
|
|
6927
|
+
* Creates a new entity from the given plain javascript object. If entity already exist in the database, then
|
|
6928
|
+
* it loads it (and everything related to it), replaces all values with the new ones from the given object
|
|
6929
|
+
* and returns this new entity. This new entity is actually a loaded from the db entity with all properties
|
|
6930
|
+
* replaced from the new object.
|
|
6610
6931
|
*
|
|
6611
|
-
* .
|
|
6612
|
-
*
|
|
6613
|
-
* })
|
|
6932
|
+
* Note that given entity-like object must have an entity id / primary key to find entity by.
|
|
6933
|
+
* Returns undefined if entity with given id was not found.
|
|
6614
6934
|
*/
|
|
6615
|
-
|
|
6616
|
-
return this.repo.
|
|
6935
|
+
preload(entityLike) {
|
|
6936
|
+
return this.repo.preload(entityLike);
|
|
6617
6937
|
}
|
|
6618
6938
|
//#endregion
|
|
6619
|
-
//#region crud operations / typeorm /
|
|
6939
|
+
//#region crud operations / typeorm / remove (delete) & bulk remove (delete)
|
|
6620
6940
|
/**
|
|
6621
|
-
*
|
|
6622
|
-
* If entity was not found in the database - rejects with error.
|
|
6941
|
+
* Removes a given entities from the database.
|
|
6623
6942
|
*/
|
|
6624
|
-
|
|
6625
|
-
|
|
6943
|
+
async remove(idOrEntity) {
|
|
6944
|
+
/* */
|
|
6945
|
+
/* */
|
|
6946
|
+
/* */
|
|
6947
|
+
/* */
|
|
6948
|
+
/* */
|
|
6949
|
+
/* */
|
|
6950
|
+
/* */
|
|
6951
|
+
/* */
|
|
6952
|
+
/* */
|
|
6953
|
+
/* */
|
|
6954
|
+
/* */
|
|
6955
|
+
/* */
|
|
6956
|
+
/* */
|
|
6957
|
+
/* */
|
|
6958
|
+
/* */
|
|
6959
|
+
/* */
|
|
6960
|
+
/* */
|
|
6961
|
+
/* */
|
|
6962
|
+
/* */
|
|
6963
|
+
/* */
|
|
6964
|
+
/* */
|
|
6965
|
+
/* */
|
|
6966
|
+
return (void 0);
|
|
6626
6967
|
}
|
|
6627
|
-
//#endregion
|
|
6628
|
-
//#region crud operations / typeorm / find one by or fail
|
|
6629
6968
|
/**
|
|
6630
|
-
*
|
|
6631
|
-
* If entity was not found in the database - rejects with error.
|
|
6969
|
+
* alias to remove
|
|
6632
6970
|
*/
|
|
6633
|
-
|
|
6634
|
-
return this.
|
|
6971
|
+
async delete(idOrEntity) {
|
|
6972
|
+
return this.remove(idOrEntity);
|
|
6635
6973
|
}
|
|
6636
|
-
//#endregion
|
|
6637
|
-
//#region crud operations / typeorm / query
|
|
6638
6974
|
/**
|
|
6639
|
-
*
|
|
6640
|
-
* Raw query execution is supported only by relational databases (MongoDB is not supported).
|
|
6975
|
+
* alias to removeById
|
|
6641
6976
|
*/
|
|
6642
|
-
|
|
6643
|
-
return this.
|
|
6977
|
+
async deleteById(id) {
|
|
6978
|
+
return this.remove(id);
|
|
6644
6979
|
}
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6980
|
+
async bulkRemove(idsOrEntities) {
|
|
6981
|
+
/* */
|
|
6982
|
+
/* */
|
|
6983
|
+
/* */
|
|
6984
|
+
/* */
|
|
6985
|
+
/* */
|
|
6986
|
+
/* */
|
|
6987
|
+
/* */
|
|
6988
|
+
/* */
|
|
6989
|
+
/* */
|
|
6990
|
+
/* */
|
|
6991
|
+
/* */
|
|
6992
|
+
/* */
|
|
6993
|
+
return (void 0);
|
|
6994
|
+
}
|
|
6995
|
+
async bulkDelete(ids) {
|
|
6996
|
+
return this.bulkRemove(ids);
|
|
6653
6997
|
}
|
|
6654
|
-
//#endregion
|
|
6655
|
-
//#region crud operations / typeorm / clear
|
|
6656
6998
|
/**
|
|
6657
|
-
*
|
|
6658
|
-
*
|
|
6659
|
-
* Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
|
|
6660
|
-
* @see https://stackoverflow.com/a/5972738/925151
|
|
6999
|
+
* Records the delete date of a given entity.
|
|
6661
7000
|
*/
|
|
6662
|
-
|
|
6663
|
-
return this.repo.
|
|
7001
|
+
softRemove(entity, options) {
|
|
7002
|
+
return this.repo.softRemove(entity, options);
|
|
6664
7003
|
}
|
|
6665
|
-
//#endregion
|
|
6666
|
-
//#region crud operations / typeorm / increment
|
|
6667
7004
|
/**
|
|
6668
|
-
*
|
|
7005
|
+
* Recovers a given entity in the database.
|
|
6669
7006
|
*/
|
|
6670
|
-
|
|
6671
|
-
return this.repo.
|
|
7007
|
+
recover(entity, options) {
|
|
7008
|
+
return this.repo.recover(entity, options);
|
|
6672
7009
|
}
|
|
6673
7010
|
//#endregion
|
|
6674
|
-
//#region crud operations / typeorm /
|
|
7011
|
+
//#region crud operations / typeorm / insert
|
|
6675
7012
|
/**
|
|
6676
|
-
*
|
|
7013
|
+
* Inserts a given entity into the database.
|
|
7014
|
+
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
7015
|
+
* Executes fast and efficient INSERT query.
|
|
7016
|
+
* Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
|
|
6677
7017
|
*/
|
|
6678
|
-
|
|
6679
|
-
|
|
7018
|
+
insert(entity) {
|
|
7019
|
+
// debugger;
|
|
7020
|
+
return this.repo.insert(entity);
|
|
6680
7021
|
}
|
|
6681
7022
|
//#endregion
|
|
6682
|
-
//#region crud operations /
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
7023
|
+
//#region crud operations / typeorm / update & build update
|
|
7024
|
+
async update(item) {
|
|
7025
|
+
/* */
|
|
7026
|
+
/* */
|
|
7027
|
+
/* */
|
|
7028
|
+
return (void 0);
|
|
7029
|
+
}
|
|
7030
|
+
async updateById(id, item) {
|
|
7031
|
+
/* */
|
|
7032
|
+
/* */
|
|
7033
|
+
/* */
|
|
7034
|
+
/* */
|
|
7035
|
+
/* */
|
|
7036
|
+
/* */
|
|
7037
|
+
/* */
|
|
7038
|
+
/* */
|
|
7039
|
+
/* */
|
|
7040
|
+
/* */
|
|
7041
|
+
/* */
|
|
7042
|
+
/* */
|
|
7043
|
+
/* */
|
|
7044
|
+
/* */
|
|
7045
|
+
/* */
|
|
7046
|
+
/* */
|
|
7047
|
+
/* */
|
|
7048
|
+
/* */
|
|
7049
|
+
/* */
|
|
7050
|
+
/* */
|
|
7051
|
+
/* */
|
|
7052
|
+
/* */
|
|
7053
|
+
/* */
|
|
7054
|
+
/* */
|
|
7055
|
+
/* */
|
|
7056
|
+
/* */
|
|
7057
|
+
/* */
|
|
7058
|
+
/* */
|
|
7059
|
+
/* */
|
|
7060
|
+
/* */
|
|
7061
|
+
/* */
|
|
7062
|
+
/* */
|
|
7063
|
+
/* */
|
|
6687
7064
|
/* */
|
|
6688
7065
|
/* */
|
|
6689
7066
|
/* */
|
|
@@ -6697,9 +7074,10 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6697
7074
|
/* */
|
|
6698
7075
|
return (void 0);
|
|
6699
7076
|
}
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
7077
|
+
async bulkUpdate(items) {
|
|
7078
|
+
/* */
|
|
7079
|
+
/* */
|
|
7080
|
+
/* */
|
|
6703
7081
|
/* */
|
|
6704
7082
|
/* */
|
|
6705
7083
|
/* */
|
|
@@ -6708,488 +7086,247 @@ let TaonBaseRepository = class TaonBaseRepository extends TaonBaseCustomReposito
|
|
|
6708
7086
|
/* */
|
|
6709
7087
|
return (void 0);
|
|
6710
7088
|
}
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
cfg.path = options.path || '';
|
|
6745
|
-
cfg.realtime = options.realtime;
|
|
6746
|
-
cfg.middlewares = options.middlewares;
|
|
6747
|
-
};
|
|
6748
|
-
}
|
|
6749
|
-
|
|
6750
|
-
const metaReq = (method, path, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal) => {
|
|
6751
|
-
const methodConfig = ClassHelpers.ensureMethodConfig(target, propertyKey);
|
|
6752
|
-
let options;
|
|
6753
|
-
if (typeof pathOrOptions === 'object') {
|
|
6754
|
-
options = pathOrOptions;
|
|
6755
|
-
pathOrOptions = options.path;
|
|
6756
|
-
pathIsGlobal = !!options.pathIsGlobal;
|
|
6757
|
-
path = options.path;
|
|
7089
|
+
//#region tpeorm update version
|
|
7090
|
+
// this version suck and will not return update entity
|
|
7091
|
+
// /**
|
|
7092
|
+
// * Updates entity partially. Entity can be found by a given conditions.
|
|
7093
|
+
// * Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
7094
|
+
// * Executes fast and efficient UPDATE query.
|
|
7095
|
+
// * Does not check if entity exist in the database.
|
|
7096
|
+
// */
|
|
7097
|
+
// update(
|
|
7098
|
+
// criteria:
|
|
7099
|
+
// | string
|
|
7100
|
+
// | string[]
|
|
7101
|
+
// | number
|
|
7102
|
+
// | number[]
|
|
7103
|
+
// | Date
|
|
7104
|
+
// | Date[]
|
|
7105
|
+
// | ObjectID
|
|
7106
|
+
// | ObjectID[]
|
|
7107
|
+
// | FindOptionsWhere<Entity>,
|
|
7108
|
+
// partialEntity: QueryDeepPartialEntity<Entity>,
|
|
7109
|
+
// ): Promise<UpdateResult> {
|
|
7110
|
+
// return this.repo.update(criteria, partialEntity);
|
|
7111
|
+
// }
|
|
7112
|
+
//#endregion
|
|
7113
|
+
//#endregion
|
|
7114
|
+
//#region crud operations / typeorm / upsert
|
|
7115
|
+
/**
|
|
7116
|
+
* Inserts a given entity into the database, unless a unique constraint conflicts then updates the entity
|
|
7117
|
+
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
7118
|
+
* Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
|
|
7119
|
+
*/
|
|
7120
|
+
upsert(entityOrEntities, conflictPathsOrOptions) {
|
|
7121
|
+
return this.repo.upsert(entityOrEntities, conflictPathsOrOptions);
|
|
6758
7122
|
}
|
|
6759
|
-
|
|
6760
|
-
|
|
7123
|
+
//#endregion
|
|
7124
|
+
//#region crud operations / typeorm / soft delete
|
|
7125
|
+
/**
|
|
7126
|
+
* Records the delete date of entities by a given criteria.
|
|
7127
|
+
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
7128
|
+
* Executes fast and efficient SOFT-DELETE query.
|
|
7129
|
+
* Does not check if entity exist in the database.
|
|
7130
|
+
*/
|
|
7131
|
+
softDelete(criteria) {
|
|
7132
|
+
return this.repo.softDelete(criteria);
|
|
6761
7133
|
}
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
_.isString(element.paramName) &&
|
|
6773
|
-
element.paramName.trim().length > 0) {
|
|
6774
|
-
paramsPathConcatedPath += `/${element.paramName}/:${element.paramName}`;
|
|
6775
|
-
}
|
|
6776
|
-
}
|
|
6777
|
-
}
|
|
6778
|
-
methodConfig.path = `/${propertyKey}${paramsPathConcatedPath}`;
|
|
7134
|
+
//#endregion
|
|
7135
|
+
//#region crud operations / typeorm / restore
|
|
7136
|
+
/**
|
|
7137
|
+
* Restores entities by a given criteria.
|
|
7138
|
+
* Unlike save method executes a primitive operation without cascades, relations and other operations included.
|
|
7139
|
+
* Executes fast and efficient SOFT-DELETE query.
|
|
7140
|
+
* Does not check if entity exist in the database.
|
|
7141
|
+
*/
|
|
7142
|
+
restore(criteria) {
|
|
7143
|
+
return this.repo.restore(criteria);
|
|
6779
7144
|
}
|
|
6780
|
-
|
|
6781
|
-
|
|
7145
|
+
//#endregion
|
|
7146
|
+
//#region crud operations / typeorm / count
|
|
7147
|
+
/**
|
|
7148
|
+
* Counts entities that match given options.
|
|
7149
|
+
* Useful for pagination.
|
|
7150
|
+
*/
|
|
7151
|
+
count(options) {
|
|
7152
|
+
return this.repo.count(options);
|
|
6782
7153
|
}
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
methodConfig.contentType = overrideContentType;
|
|
6786
|
-
methodConfig.responseType = overrideResponseType;
|
|
6787
|
-
methodConfig.overrideExpressSendAsHtml = overrideExpressSendAsHtml;
|
|
6788
|
-
};
|
|
6789
|
-
function GET(pathOrOptions, pathIsGlobal = false) {
|
|
6790
|
-
return function (target, propertyKey, descriptor) {
|
|
6791
|
-
metaReq('get', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
6792
|
-
};
|
|
6793
|
-
}
|
|
6794
|
-
/**
|
|
6795
|
-
* Method for sending html website from text
|
|
6796
|
-
* Example
|
|
6797
|
-
*
|
|
6798
|
-
* ```ts
|
|
6799
|
-
* ...
|
|
6800
|
-
* // in your taon controller
|
|
6801
|
-
* ..Taon.Http.HTML()
|
|
6802
|
-
* sendHtmlDummyWebsite(): Taon.ResponseHtml {
|
|
6803
|
-
* return `
|
|
6804
|
-
<html>
|
|
6805
|
-
<head>
|
|
6806
|
-
<title>Dummy website</title>
|
|
6807
|
-
</head>
|
|
6808
|
-
<body>
|
|
6809
|
-
<h1>This is dummy website</h1>
|
|
6810
|
-
<p>Served as HTML string from Taon controller method</p>
|
|
6811
|
-
</body>
|
|
6812
|
-
</html>
|
|
6813
|
-
* `; *
|
|
6814
|
-
* }
|
|
6815
|
-
* ...
|
|
6816
|
-
* ```
|
|
6817
|
-
*/
|
|
6818
|
-
function HTML(pathOrOptions) {
|
|
6819
|
-
return function (target, propertyKey, descriptor) {
|
|
6820
|
-
const opt = pathOrOptions;
|
|
6821
|
-
opt.overrideExpressSendAsHtml = true;
|
|
6822
|
-
metaReq('get', opt, target, propertyKey, descriptor, pathOrOptions, opt.pathIsGlobal);
|
|
6823
|
-
};
|
|
6824
|
-
}
|
|
6825
|
-
function HEAD(pathOrOptions, pathIsGlobal = false) {
|
|
6826
|
-
return function (target, propertyKey, descriptor) {
|
|
6827
|
-
metaReq('head', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
6828
|
-
};
|
|
6829
|
-
}
|
|
6830
|
-
function POST(pathOrOptions, pathIsGlobal = false) {
|
|
6831
|
-
return function (target, propertyKey, descriptor) {
|
|
6832
|
-
metaReq('post', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
6833
|
-
};
|
|
6834
|
-
}
|
|
6835
|
-
function PUT(pathOrOptions, pathIsGlobal = false) {
|
|
6836
|
-
return function (target, propertyKey, descriptor) {
|
|
6837
|
-
metaReq('put', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
6838
|
-
};
|
|
6839
|
-
}
|
|
6840
|
-
function PATCH(pathOrOptions, pathIsGlobal = false) {
|
|
6841
|
-
return function (target, propertyKey, descriptor) {
|
|
6842
|
-
metaReq('patch', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
6843
|
-
};
|
|
6844
|
-
}
|
|
6845
|
-
function DELETE(pathOrOptions, pathIsGlobal = false) {
|
|
6846
|
-
return function (target, propertyKey, descriptor) {
|
|
6847
|
-
metaReq('delete', pathOrOptions, target, propertyKey, descriptor, pathOrOptions, pathIsGlobal);
|
|
6848
|
-
};
|
|
6849
|
-
}
|
|
6850
|
-
|
|
6851
|
-
function metaParam(param, name, expire, defaultValue = undefined, target, propertyKey, parameterIndex) {
|
|
6852
|
-
const methodCfg = ClassHelpers.ensureMethodConfig(target, propertyKey);
|
|
6853
|
-
const nameKey = name ? name : param;
|
|
6854
|
-
// const key = name || `${param}_${parameterIndex}`;
|
|
6855
|
-
methodCfg.parameters[nameKey] = {
|
|
6856
|
-
index: parameterIndex,
|
|
6857
|
-
paramName: name,
|
|
6858
|
-
paramType: param,
|
|
6859
|
-
defaultType: defaultValue,
|
|
6860
|
-
expireInSeconds: expire,
|
|
6861
|
-
};
|
|
6862
|
-
// console.log('params updated', methodConfig);
|
|
6863
|
-
}
|
|
6864
|
-
/**
|
|
6865
|
-
* @deprecated use Taon.Http.Param.Path (is more safe and cleaner)
|
|
6866
|
-
*/
|
|
6867
|
-
function Path(name) {
|
|
6868
|
-
return function (target, propertyKey, parameterIndex) {
|
|
6869
|
-
metaParam('Path', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
6870
|
-
};
|
|
6871
|
-
}
|
|
6872
|
-
function Query(name) {
|
|
6873
|
-
return function (target, propertyKey, parameterIndex) {
|
|
6874
|
-
metaParam('Query', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
6875
|
-
};
|
|
6876
|
-
}
|
|
6877
|
-
function Cookie(name, expireInSecond = 3600) {
|
|
6878
|
-
return function (target, propertyKey, parameterIndex) {
|
|
6879
|
-
metaParam('Cookie', name, expireInSecond, {}, target, propertyKey, parameterIndex);
|
|
6880
|
-
};
|
|
6881
|
-
}
|
|
6882
|
-
function Header(name) {
|
|
6883
|
-
return function (target, propertyKey, parameterIndex) {
|
|
6884
|
-
metaParam('Header', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
6885
|
-
};
|
|
6886
|
-
}
|
|
6887
|
-
function Body(name) {
|
|
6888
|
-
return function (target, propertyKey, parameterIndex) {
|
|
6889
|
-
metaParam('Body', name, undefined, {}, target, propertyKey, parameterIndex);
|
|
6890
|
-
};
|
|
6891
|
-
}
|
|
6892
|
-
|
|
6893
|
-
let TaonBaseController = class TaonBaseController extends TaonBaseInjector {
|
|
7154
|
+
//#endregion
|
|
7155
|
+
//#region crud operations / typeorm / count by
|
|
6894
7156
|
/**
|
|
6895
|
-
*
|
|
6896
|
-
*
|
|
7157
|
+
* Counts entities that match given conditions.
|
|
7158
|
+
* Useful for pagination.
|
|
6897
7159
|
*/
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
uploadFormDataToServer(formData, queryParams) {
|
|
6901
|
-
/* */
|
|
6902
|
-
/* */
|
|
6903
|
-
/* */
|
|
6904
|
-
/* */
|
|
6905
|
-
/* */
|
|
6906
|
-
/* */
|
|
6907
|
-
/* */
|
|
6908
|
-
/* */
|
|
6909
|
-
/* */
|
|
6910
|
-
/* */
|
|
6911
|
-
/* */
|
|
6912
|
-
/* */
|
|
6913
|
-
/* */
|
|
6914
|
-
/* */
|
|
6915
|
-
/* */
|
|
6916
|
-
/* */
|
|
6917
|
-
/* */
|
|
6918
|
-
/* */
|
|
6919
|
-
/* */
|
|
6920
|
-
/* */
|
|
6921
|
-
/* */
|
|
6922
|
-
/* */
|
|
6923
|
-
/* */
|
|
6924
|
-
/* */
|
|
6925
|
-
/* */
|
|
6926
|
-
/* */
|
|
6927
|
-
return (void 0);
|
|
7160
|
+
countBy(where) {
|
|
7161
|
+
return this.repo.countBy(where);
|
|
6928
7162
|
}
|
|
6929
7163
|
//#endregion
|
|
6930
|
-
//#region
|
|
7164
|
+
//#region crud operations / typeorm / find
|
|
6931
7165
|
/**
|
|
6932
|
-
*
|
|
6933
|
-
* through `uploadFormDataToServer` or `uploadLocalFileToServer`
|
|
7166
|
+
* Finds entities that match given find options.
|
|
6934
7167
|
*/
|
|
6935
|
-
|
|
6936
|
-
|
|
7168
|
+
find(options) {
|
|
7169
|
+
return this.repo.find(options);
|
|
6937
7170
|
}
|
|
6938
|
-
//#
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
/* */
|
|
6946
|
-
/* */
|
|
6947
|
-
/* */
|
|
6948
|
-
/* */
|
|
6949
|
-
/* */
|
|
6950
|
-
/* */
|
|
6951
|
-
/* */
|
|
6952
|
-
/* */
|
|
6953
|
-
/* */
|
|
6954
|
-
return (void 0);
|
|
7171
|
+
//#endregion
|
|
7172
|
+
//#region crud operations / typeorm / find by
|
|
7173
|
+
/**
|
|
7174
|
+
* Finds entities that match given find options.
|
|
7175
|
+
*/
|
|
7176
|
+
findBy(where) {
|
|
7177
|
+
return this.repo.findBy(where);
|
|
6955
7178
|
}
|
|
6956
7179
|
//#endregion
|
|
6957
|
-
|
|
6958
|
-
//
|
|
6959
|
-
//
|
|
6960
|
-
//
|
|
6961
|
-
// }
|
|
7180
|
+
//#region crud operations / typeorm / find and count
|
|
7181
|
+
// async findAndCount(options: { take: number; skip: number }) {
|
|
7182
|
+
// const { take, skip } = options;
|
|
7183
|
+
// const [result, total] = await this.repo.findAndCount({
|
|
7184
|
+
// // where: { name: Like('%' + keyword + '%') },
|
|
7185
|
+
// // order: { name: "DESC" },
|
|
7186
|
+
// take: take,
|
|
7187
|
+
// skip: skip,
|
|
7188
|
+
// });
|
|
7189
|
+
// return { result, total };
|
|
6962
7190
|
// }
|
|
7191
|
+
//
|
|
6963
7192
|
/**
|
|
6964
|
-
*
|
|
7193
|
+
* Finds entities that match given find options.
|
|
7194
|
+
* Also counts all entities that match given conditions,
|
|
7195
|
+
* but ignores pagination settings (from and take options).
|
|
7196
|
+
*/
|
|
7197
|
+
findAndCount(options) {
|
|
7198
|
+
return this.repo.findAndCount(options);
|
|
7199
|
+
}
|
|
7200
|
+
//#endregion
|
|
7201
|
+
//#region crud operations / typeorm / find and count by
|
|
7202
|
+
/**
|
|
7203
|
+
* Finds entities that match given WHERE conditions.
|
|
7204
|
+
* Also counts all entities that match given conditions,
|
|
7205
|
+
* but ignores pagination settings (from and take options).
|
|
7206
|
+
*/
|
|
7207
|
+
findAndCountBy(where) {
|
|
7208
|
+
return this.repo.findAndCountBy(where);
|
|
7209
|
+
}
|
|
7210
|
+
//#endregion
|
|
7211
|
+
//#region crud operations / typeorm / find by ids
|
|
7212
|
+
/**
|
|
7213
|
+
* Finds entities with ids.
|
|
7214
|
+
* Optionally find options or conditions can be applied.
|
|
6965
7215
|
*
|
|
6966
|
-
*
|
|
6967
|
-
*
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
statusCheck: resp => resp.body.json[0].ok,
|
|
6972
|
-
});
|
|
6973
|
-
}
|
|
6974
|
-
* ```
|
|
7216
|
+
* @deprecated use `findBy` method instead in conjunction with `In` operator, for example:
|
|
7217
|
+
*
|
|
7218
|
+
* .findBy({
|
|
7219
|
+
* id: In([1, 2, 3])
|
|
7220
|
+
* })
|
|
6975
7221
|
*/
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
httpErrorsCount,
|
|
6988
|
-
});
|
|
6989
|
-
if (options.statusCheck && options.statusCheck(resp)) {
|
|
6990
|
-
return;
|
|
6991
|
-
}
|
|
6992
|
-
}
|
|
6993
|
-
catch (error) {
|
|
6994
|
-
httpErrorsCount++;
|
|
6995
|
-
if (options.loopRequestsOnBackendError) {
|
|
6996
|
-
const isProperTaonError = error instanceof HttpResponseError &&
|
|
6997
|
-
error.body.json[CoreModels.TaonHttpErrorCustomProp];
|
|
6998
|
-
const isHttpError = error instanceof HttpResponseError && !isProperTaonError;
|
|
6999
|
-
const isUnknownError = !(error instanceof HttpResponseError);
|
|
7000
|
-
const resBool = await options.loopRequestsOnBackendError({
|
|
7001
|
-
taonError: isProperTaonError ? error : void 0,
|
|
7002
|
-
unknownHttpError: isHttpError ? error : void 0,
|
|
7003
|
-
unknownError: isUnknownError ? error : void 0,
|
|
7004
|
-
reqIndexNum: i,
|
|
7005
|
-
httpErrorsCount,
|
|
7006
|
-
});
|
|
7007
|
-
if (resBool) {
|
|
7008
|
-
i++;
|
|
7009
|
-
continue;
|
|
7010
|
-
}
|
|
7011
|
-
else {
|
|
7012
|
-
return;
|
|
7013
|
-
}
|
|
7014
|
-
}
|
|
7015
|
-
if (httpErrorsCount >
|
|
7016
|
-
(options.allowedHttpErrors || Number.POSITIVE_INFINITY)) {
|
|
7017
|
-
throw new Error(`Too many http errors (${httpErrorsCount}) for "${options.actionName}".`);
|
|
7018
|
-
}
|
|
7019
|
-
}
|
|
7020
|
-
if (i++ > maxTries) {
|
|
7021
|
-
throw new Error(`Timeout waiting for "${options.actionName}" to be finished. Waited for ${maxTries} seconds`);
|
|
7022
|
-
}
|
|
7023
|
-
}
|
|
7222
|
+
findByIds(ids) {
|
|
7223
|
+
return this.repo.findByIds(ids);
|
|
7224
|
+
}
|
|
7225
|
+
//#endregion
|
|
7226
|
+
//#region crud operations / typeorm / find one
|
|
7227
|
+
/**
|
|
7228
|
+
* Finds first entity by a given find options.
|
|
7229
|
+
* If entity was not found in the database - returns null.
|
|
7230
|
+
*/
|
|
7231
|
+
findOne(options) {
|
|
7232
|
+
return this.repo.findOne(options);
|
|
7024
7233
|
}
|
|
7025
|
-
};
|
|
7026
|
-
__decorate([
|
|
7027
|
-
POST({
|
|
7028
|
-
overrideContentType: 'multipart/form-data',
|
|
7029
|
-
middlewares: ({ parentMiddlewares }) => ({
|
|
7030
|
-
...parentMiddlewares,
|
|
7031
|
-
TaonBaseFileUploadMiddleware,
|
|
7032
|
-
}),
|
|
7033
|
-
}),
|
|
7034
|
-
__param(0, Body()),
|
|
7035
|
-
__param(1, Query()),
|
|
7036
|
-
__metadata("design:type", Function),
|
|
7037
|
-
__metadata("design:paramtypes", [FormData, Object]),
|
|
7038
|
-
__metadata("design:returntype", Object)
|
|
7039
|
-
], TaonBaseController.prototype, "uploadFormDataToServer", null);
|
|
7040
|
-
TaonBaseController = __decorate([
|
|
7041
|
-
TaonController({
|
|
7042
|
-
className: 'TaonBaseController',
|
|
7043
|
-
})
|
|
7044
|
-
], TaonBaseController);
|
|
7045
|
-
|
|
7046
|
-
//#endregion
|
|
7047
|
-
/**
|
|
7048
|
-
* Please override property entityClassFn with entity class.
|
|
7049
|
-
*/
|
|
7050
|
-
let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseController {
|
|
7051
7234
|
//#endregion
|
|
7052
|
-
//#region
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
this.db = this.injectRepo(entityClassFn);
|
|
7060
|
-
if (entityClassFn) {
|
|
7061
|
-
const configEntity = Reflect.getMetadata(Symbols.metadata.options.entity, ClassHelpers.getClassFnFromObject(this));
|
|
7062
|
-
if (configEntity?.createTable === false) {
|
|
7063
|
-
Helpers.warn(`Table for entity ${ClassHelpers.getName(entityClassFn)} will not be created. Crud will not work properly.`);
|
|
7064
|
-
}
|
|
7065
|
-
}
|
|
7066
|
-
else {
|
|
7067
|
-
Helpers.error(`Entity class not provided for controller ${ClassHelpers.getName(this)}.
|
|
7068
|
-
|
|
7069
|
-
Please provide entity as class property entityClassFn:
|
|
7070
|
-
|
|
7071
|
-
class ${ClassHelpers.getName(this)} extends TaonBaseCrudController<Entity> {
|
|
7072
|
-
// ...
|
|
7073
|
-
entityClassResolveFn = ()=> MyEntityClass;
|
|
7074
|
-
// ...
|
|
7075
|
-
}
|
|
7076
|
-
|
|
7077
|
-
`);
|
|
7078
|
-
}
|
|
7079
|
-
await super._();
|
|
7235
|
+
//#region crud operations / typeorm / find one by
|
|
7236
|
+
/**
|
|
7237
|
+
* Finds first entity that matches given where condition.
|
|
7238
|
+
* If entity was not found in the database - returns null.
|
|
7239
|
+
*/
|
|
7240
|
+
findOneBy(where) {
|
|
7241
|
+
return this.repo.findOneBy(where);
|
|
7080
7242
|
}
|
|
7081
7243
|
//#endregion
|
|
7082
|
-
//#region
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
/* */
|
|
7096
|
-
/* */
|
|
7097
|
-
/* */
|
|
7098
|
-
/* */
|
|
7099
|
-
return (void 0);
|
|
7244
|
+
//#region crud operations / typeorm / find one or fail
|
|
7245
|
+
/**
|
|
7246
|
+
* Finds first entity that matches given id.
|
|
7247
|
+
* If entity was not found in the database - returns null.
|
|
7248
|
+
*
|
|
7249
|
+
* @deprecated use `findOneBy` method instead in conjunction with `In` operator, for example:
|
|
7250
|
+
*
|
|
7251
|
+
* .findOneBy({
|
|
7252
|
+
* id: 1 // where "id" is your primary column name
|
|
7253
|
+
* })
|
|
7254
|
+
*/
|
|
7255
|
+
findOneById(id) {
|
|
7256
|
+
return this.repo.findOneById(id);
|
|
7100
7257
|
}
|
|
7101
7258
|
//#endregion
|
|
7102
|
-
//#region
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
/* */
|
|
7110
|
-
/* */
|
|
7111
|
-
/* */
|
|
7112
|
-
/* */
|
|
7113
|
-
/* */
|
|
7114
|
-
/* */
|
|
7115
|
-
/* */
|
|
7116
|
-
/* */
|
|
7117
|
-
/* */
|
|
7118
|
-
/* */
|
|
7119
|
-
/* */
|
|
7120
|
-
/* */
|
|
7121
|
-
/* */
|
|
7122
|
-
/* */
|
|
7123
|
-
/* */
|
|
7124
|
-
/* */
|
|
7125
|
-
/* */
|
|
7126
|
-
/* */
|
|
7127
|
-
/* */
|
|
7128
|
-
/* */
|
|
7129
|
-
/* */
|
|
7130
|
-
/* */
|
|
7131
|
-
/* */
|
|
7132
|
-
/* */
|
|
7133
|
-
/* */
|
|
7134
|
-
/* */
|
|
7135
|
-
/* */
|
|
7136
|
-
/* */
|
|
7137
|
-
/* */
|
|
7138
|
-
/* */
|
|
7139
|
-
/* */
|
|
7140
|
-
/* */
|
|
7141
|
-
/* */
|
|
7142
|
-
return (void 0);
|
|
7259
|
+
//#region crud operations / typeorm / find one or fail
|
|
7260
|
+
/**
|
|
7261
|
+
* Finds first entity by a given find options.
|
|
7262
|
+
* If entity was not found in the database - rejects with error.
|
|
7263
|
+
*/
|
|
7264
|
+
findOneOrFail(options) {
|
|
7265
|
+
return this.repo.findOneOrFail(options);
|
|
7143
7266
|
}
|
|
7144
7267
|
//#endregion
|
|
7145
|
-
//#region
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
/* */
|
|
7153
|
-
/* */
|
|
7154
|
-
/* */
|
|
7155
|
-
/* */
|
|
7156
|
-
return (void 0);
|
|
7268
|
+
//#region crud operations / typeorm / find one by or fail
|
|
7269
|
+
/**
|
|
7270
|
+
* Finds first entity that matches given where condition.
|
|
7271
|
+
* If entity was not found in the database - rejects with error.
|
|
7272
|
+
*/
|
|
7273
|
+
findOneByOrFail(where) {
|
|
7274
|
+
return this.repo.findOneByOrFail(where);
|
|
7157
7275
|
}
|
|
7158
7276
|
//#endregion
|
|
7159
|
-
//#region
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
return (void 0);
|
|
7277
|
+
//#region crud operations / typeorm / query
|
|
7278
|
+
/**
|
|
7279
|
+
* Executes a raw SQL query and returns a raw database results.
|
|
7280
|
+
* Raw query execution is supported only by relational databases (MongoDB is not supported).
|
|
7281
|
+
*/
|
|
7282
|
+
query(query, parameters) {
|
|
7283
|
+
return this.repo.query(query, parameters);
|
|
7167
7284
|
}
|
|
7168
7285
|
//#endregion
|
|
7169
|
-
//#region
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
/* */
|
|
7177
|
-
return (void 0);
|
|
7286
|
+
//#region crud operations / typeorm / query
|
|
7287
|
+
/**
|
|
7288
|
+
* Executes a raw SQL query and returns a raw database results.
|
|
7289
|
+
* Raw query execution is supported only by relational databases (MongoDB is not supported).
|
|
7290
|
+
*/
|
|
7291
|
+
createQueryBuilder(alias, queryRunner) {
|
|
7292
|
+
return this.repo.createQueryBuilder(alias, queryRunner);
|
|
7178
7293
|
}
|
|
7179
7294
|
//#endregion
|
|
7180
|
-
//#region
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7295
|
+
//#region crud operations / typeorm / clear
|
|
7296
|
+
/**
|
|
7297
|
+
* Clears all the data from the given table/collection (truncates/drops it).
|
|
7298
|
+
*
|
|
7299
|
+
* Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
|
|
7300
|
+
* @see https://stackoverflow.com/a/5972738/925151
|
|
7301
|
+
*/
|
|
7302
|
+
clear() {
|
|
7303
|
+
return this.repo.clear();
|
|
7304
|
+
}
|
|
7305
|
+
//#endregion
|
|
7306
|
+
//#region crud operations / typeorm / increment
|
|
7307
|
+
/**
|
|
7308
|
+
* Increments some column by provided value of the entities matched given conditions.
|
|
7309
|
+
*/
|
|
7310
|
+
increment(conditions, propertyPath, value) {
|
|
7311
|
+
return this.repo.increment(conditions, propertyPath, value);
|
|
7312
|
+
}
|
|
7313
|
+
//#endregion
|
|
7314
|
+
//#region crud operations / typeorm / decrement
|
|
7315
|
+
/**
|
|
7316
|
+
* Decrements some column by provided value of the entities matched given conditions.
|
|
7317
|
+
*/
|
|
7318
|
+
decrement(conditions, propertyPath, value) {
|
|
7319
|
+
return this.repo.decrement(conditions, propertyPath, value);
|
|
7320
|
+
}
|
|
7321
|
+
//#endregion
|
|
7322
|
+
//#region crud operations / get all
|
|
7323
|
+
/**
|
|
7324
|
+
* @deprecated use findAndCount instead
|
|
7325
|
+
*/
|
|
7326
|
+
async getAll() {
|
|
7185
7327
|
/* */
|
|
7186
7328
|
/* */
|
|
7187
7329
|
/* */
|
|
7188
|
-
return (void 0);
|
|
7189
|
-
}
|
|
7190
|
-
//#endregion
|
|
7191
|
-
//#region bulk update
|
|
7192
|
-
bulkUpdate(items) {
|
|
7193
7330
|
/* */
|
|
7194
7331
|
/* */
|
|
7195
7332
|
/* */
|
|
@@ -7201,8 +7338,9 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
|
|
|
7201
7338
|
return (void 0);
|
|
7202
7339
|
}
|
|
7203
7340
|
//#endregion
|
|
7204
|
-
//#region
|
|
7205
|
-
|
|
7341
|
+
//#region crud operations / get by id
|
|
7342
|
+
async getBy(id) {
|
|
7343
|
+
/* */
|
|
7206
7344
|
/* */
|
|
7207
7345
|
/* */
|
|
7208
7346
|
/* */
|
|
@@ -7210,9 +7348,20 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
|
|
|
7210
7348
|
/* */
|
|
7211
7349
|
return (void 0);
|
|
7212
7350
|
}
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7351
|
+
};
|
|
7352
|
+
TaonBaseRepository = __decorate([
|
|
7353
|
+
TaonRepository({ className: 'TaonBaseRepository' }),
|
|
7354
|
+
__metadata("design:paramtypes", [Function])
|
|
7355
|
+
], TaonBaseRepository);
|
|
7356
|
+
|
|
7357
|
+
//#region imports
|
|
7358
|
+
//#endregion
|
|
7359
|
+
let TaonGlobalStateRepository = class TaonGlobalStateRepository extends TaonBaseRepository {
|
|
7360
|
+
constructor() {
|
|
7361
|
+
super(...arguments);
|
|
7362
|
+
this.entityClassResolveFn = () => TAON_GLOBAL_STATE;
|
|
7363
|
+
}
|
|
7364
|
+
async getLastStatus() {
|
|
7216
7365
|
/* */
|
|
7217
7366
|
/* */
|
|
7218
7367
|
/* */
|
|
@@ -7220,18 +7369,9 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
|
|
|
7220
7369
|
/* */
|
|
7221
7370
|
return (void 0);
|
|
7222
7371
|
}
|
|
7223
|
-
|
|
7224
|
-
//#region bulk delete
|
|
7225
|
-
clearTable() {
|
|
7372
|
+
async setDraining(secondsBeforeReadonly = 0) {
|
|
7226
7373
|
/* */
|
|
7227
7374
|
/* */
|
|
7228
|
-
/* */
|
|
7229
|
-
/* */
|
|
7230
|
-
return (void 0);
|
|
7231
|
-
}
|
|
7232
|
-
//#endregion
|
|
7233
|
-
//#region create
|
|
7234
|
-
save(item) {
|
|
7235
7375
|
/* */
|
|
7236
7376
|
/* */
|
|
7237
7377
|
/* */
|
|
@@ -7239,9 +7379,8 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
|
|
|
7239
7379
|
/* */
|
|
7240
7380
|
return (void 0);
|
|
7241
7381
|
}
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
bulkCreate(items) {
|
|
7382
|
+
async transitionTo(next) {
|
|
7383
|
+
/* */
|
|
7245
7384
|
/* */
|
|
7246
7385
|
/* */
|
|
7247
7386
|
/* */
|
|
@@ -7250,115 +7389,52 @@ let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseContro
|
|
|
7250
7389
|
return (void 0);
|
|
7251
7390
|
}
|
|
7252
7391
|
};
|
|
7392
|
+
TaonGlobalStateRepository = __decorate([
|
|
7393
|
+
TaonRepository({
|
|
7394
|
+
className: 'TaonGlobalStateRepository',
|
|
7395
|
+
})
|
|
7396
|
+
], TaonGlobalStateRepository);
|
|
7397
|
+
|
|
7398
|
+
//#region imports
|
|
7399
|
+
//#endregion
|
|
7400
|
+
let TaonGlobalStateController = class TaonGlobalStateController extends TaonBaseCrudController {
|
|
7401
|
+
constructor() {
|
|
7402
|
+
super(...arguments);
|
|
7403
|
+
this.entityClassResolveFn = () => TAON_GLOBAL_STATE;
|
|
7404
|
+
this.taonGlobalStateRepository = this.injectCustomRepo(TaonGlobalStateRepository);
|
|
7405
|
+
}
|
|
7406
|
+
getStatus() {
|
|
7407
|
+
return async () => {
|
|
7408
|
+
/* */
|
|
7409
|
+
/* */
|
|
7410
|
+
/* */
|
|
7411
|
+
return (void 0);
|
|
7412
|
+
};
|
|
7413
|
+
}
|
|
7414
|
+
setDraining(secondsBeforeReadonly = 0) {
|
|
7415
|
+
return async () => {
|
|
7416
|
+
await this.taonGlobalStateRepository.setDraining(secondsBeforeReadonly);
|
|
7417
|
+
};
|
|
7418
|
+
}
|
|
7419
|
+
};
|
|
7253
7420
|
__decorate([
|
|
7254
7421
|
GET(),
|
|
7255
|
-
__param(0, Query(`id`)),
|
|
7256
|
-
__param(1, Query(`property`)),
|
|
7257
|
-
__param(2, Query('alreadyLength')),
|
|
7258
|
-
__metadata("design:type", Function),
|
|
7259
|
-
__metadata("design:paramtypes", [Object, String, Number]),
|
|
7260
|
-
__metadata("design:returntype", Object)
|
|
7261
|
-
], TaonBaseCrudController.prototype, "bufforedChanges", null);
|
|
7262
|
-
__decorate([
|
|
7263
|
-
GET(),
|
|
7264
|
-
__param(0, Query('pageNumber')),
|
|
7265
|
-
__param(1, Query('pageSize')),
|
|
7266
|
-
__param(2, Query('search')),
|
|
7267
|
-
__metadata("design:type", Function),
|
|
7268
|
-
__metadata("design:paramtypes", [Number, Number, String]),
|
|
7269
|
-
__metadata("design:returntype", Object)
|
|
7270
|
-
], TaonBaseCrudController.prototype, "pagination", null);
|
|
7271
|
-
__decorate([
|
|
7272
|
-
GET(),
|
|
7273
|
-
__metadata("design:type", Function),
|
|
7274
|
-
__metadata("design:paramtypes", []),
|
|
7275
|
-
__metadata("design:returntype", Object)
|
|
7276
|
-
], TaonBaseCrudController.prototype, "getAll", null);
|
|
7277
|
-
__decorate([
|
|
7278
|
-
GET(),
|
|
7279
|
-
__param(0, Query(`id`)),
|
|
7280
|
-
__metadata("design:type", Function),
|
|
7281
|
-
__metadata("design:paramtypes", [Object]),
|
|
7282
|
-
__metadata("design:returntype", Object)
|
|
7283
|
-
], TaonBaseCrudController.prototype, "getBy", null);
|
|
7284
|
-
__decorate([
|
|
7285
|
-
PUT(),
|
|
7286
|
-
__param(0, Query(`id`)),
|
|
7287
|
-
__param(1, Body()),
|
|
7288
|
-
__metadata("design:type", Function),
|
|
7289
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
7290
|
-
__metadata("design:returntype", Object)
|
|
7291
|
-
], TaonBaseCrudController.prototype, "updateById", null);
|
|
7292
|
-
__decorate([
|
|
7293
|
-
PATCH(),
|
|
7294
|
-
__param(0, Query(`id`)),
|
|
7295
|
-
__param(1, Body()),
|
|
7296
|
-
__metadata("design:type", Function),
|
|
7297
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
7298
|
-
__metadata("design:returntype", Object)
|
|
7299
|
-
], TaonBaseCrudController.prototype, "patchById", null);
|
|
7300
|
-
__decorate([
|
|
7301
|
-
PUT(),
|
|
7302
|
-
__param(0, Body()),
|
|
7303
|
-
__metadata("design:type", Function),
|
|
7304
|
-
__metadata("design:paramtypes", [Array]),
|
|
7305
|
-
__metadata("design:returntype", Object)
|
|
7306
|
-
], TaonBaseCrudController.prototype, "bulkUpdate", null);
|
|
7307
|
-
__decorate([
|
|
7308
|
-
DELETE(),
|
|
7309
|
-
__param(0, Query(`id`)),
|
|
7310
|
-
__metadata("design:type", Function),
|
|
7311
|
-
__metadata("design:paramtypes", [Object]),
|
|
7312
|
-
__metadata("design:returntype", Object)
|
|
7313
|
-
], TaonBaseCrudController.prototype, "deleteById", null);
|
|
7314
|
-
__decorate([
|
|
7315
|
-
DELETE(),
|
|
7316
|
-
__param(0, Query(`ids`)),
|
|
7317
|
-
__metadata("design:type", Function),
|
|
7318
|
-
__metadata("design:paramtypes", [Array]),
|
|
7319
|
-
__metadata("design:returntype", Object)
|
|
7320
|
-
], TaonBaseCrudController.prototype, "bulkDelete", null);
|
|
7321
|
-
__decorate([
|
|
7322
|
-
DELETE(),
|
|
7323
7422
|
__metadata("design:type", Function),
|
|
7324
7423
|
__metadata("design:paramtypes", []),
|
|
7325
7424
|
__metadata("design:returntype", Object)
|
|
7326
|
-
],
|
|
7327
|
-
__decorate([
|
|
7328
|
-
POST(),
|
|
7329
|
-
__param(0, Body()),
|
|
7330
|
-
__metadata("design:type", Function),
|
|
7331
|
-
__metadata("design:paramtypes", [Object]),
|
|
7332
|
-
__metadata("design:returntype", Object)
|
|
7333
|
-
], TaonBaseCrudController.prototype, "save", null);
|
|
7425
|
+
], TaonGlobalStateController.prototype, "getStatus", null);
|
|
7334
7426
|
__decorate([
|
|
7335
7427
|
POST(),
|
|
7336
|
-
__param(0,
|
|
7428
|
+
__param(0, Query('secondsBeforeReadonly')),
|
|
7337
7429
|
__metadata("design:type", Function),
|
|
7338
7430
|
__metadata("design:paramtypes", [Object]),
|
|
7339
7431
|
__metadata("design:returntype", Object)
|
|
7340
|
-
],
|
|
7341
|
-
|
|
7342
|
-
TaonController({
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
/**
|
|
7347
|
-
* by default is READY to run
|
|
7348
|
-
*/
|
|
7349
|
-
isReadyToRun() {
|
|
7350
|
-
return true;
|
|
7351
|
-
}
|
|
7352
|
-
getDescription() {
|
|
7353
|
-
return _.startCase(ClassHelpers.getName(this));
|
|
7354
|
-
}
|
|
7355
|
-
async up(queryRunner) {
|
|
7356
|
-
console.log(`[TaonBaseMigration] Running migration UP "${ClassHelpers.getName(this)}"`);
|
|
7357
|
-
}
|
|
7358
|
-
async down(queryRunner) {
|
|
7359
|
-
console.log(`[TaonBaseMigration] Running migration DOWN "${ClassHelpers.getName(this)}"`);
|
|
7360
|
-
}
|
|
7361
|
-
}
|
|
7432
|
+
], TaonGlobalStateController.prototype, "setDraining", null);
|
|
7433
|
+
TaonGlobalStateController = __decorate([
|
|
7434
|
+
TaonController({
|
|
7435
|
+
className: 'TaonGlobalStateController',
|
|
7436
|
+
})
|
|
7437
|
+
], TaonGlobalStateController);
|
|
7362
7438
|
|
|
7363
7439
|
/**
|
|
7364
7440
|
* TODO
|
|
@@ -7368,6 +7444,39 @@ class TaonBaseMigration extends TaonBaseInjector {
|
|
|
7368
7444
|
class TaonBaseProvider extends TaonBaseInjector {
|
|
7369
7445
|
}
|
|
7370
7446
|
|
|
7447
|
+
/**
|
|
7448
|
+
* Provider decorator
|
|
7449
|
+
*/
|
|
7450
|
+
function TaonProvider(options) {
|
|
7451
|
+
return function (constructor) {
|
|
7452
|
+
Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
|
|
7453
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
7454
|
+
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
7455
|
+
};
|
|
7456
|
+
}
|
|
7457
|
+
class TaonProviderOptions extends DecoratorAbstractOpt {
|
|
7458
|
+
}
|
|
7459
|
+
|
|
7460
|
+
//#region imports
|
|
7461
|
+
//#endregion
|
|
7462
|
+
let TaonGlobalStateProvider = class TaonGlobalStateProvider extends TaonBaseProvider {
|
|
7463
|
+
};
|
|
7464
|
+
TaonGlobalStateProvider = __decorate([
|
|
7465
|
+
TaonProvider({
|
|
7466
|
+
className: 'TaonGlobalStateProvider',
|
|
7467
|
+
})
|
|
7468
|
+
], TaonGlobalStateProvider);
|
|
7469
|
+
|
|
7470
|
+
//#region imports
|
|
7471
|
+
//#endregion
|
|
7472
|
+
let TaonGlobalStateMiddleware = class TaonGlobalStateMiddleware extends TaonBaseMiddleware {
|
|
7473
|
+
};
|
|
7474
|
+
TaonGlobalStateMiddleware = __decorate([
|
|
7475
|
+
TaonMiddleware({
|
|
7476
|
+
className: 'TaonGlobalStateMiddleware',
|
|
7477
|
+
})
|
|
7478
|
+
], TaonGlobalStateMiddleware);
|
|
7479
|
+
|
|
7371
7480
|
/**
|
|
7372
7481
|
* Subscriber decorator
|
|
7373
7482
|
*/
|
|
@@ -7524,6 +7633,75 @@ TaonBaseSubscriberForEntity = __decorate([
|
|
|
7524
7633
|
})
|
|
7525
7634
|
], TaonBaseSubscriberForEntity);
|
|
7526
7635
|
|
|
7636
|
+
//#region imports
|
|
7637
|
+
//#endregion
|
|
7638
|
+
let TaonGlobalStateSubscriber = class TaonGlobalStateSubscriber extends TaonBaseSubscriberForEntity {
|
|
7639
|
+
constructor() {
|
|
7640
|
+
super(...arguments);
|
|
7641
|
+
this.taonGlobalStateProvider = this.injectProvider(TaonGlobalStateProvider);
|
|
7642
|
+
}
|
|
7643
|
+
listenTo() {
|
|
7644
|
+
return TAON_GLOBAL_STATE;
|
|
7645
|
+
}
|
|
7646
|
+
};
|
|
7647
|
+
TaonGlobalStateSubscriber = __decorate([
|
|
7648
|
+
TaonSubscriber({
|
|
7649
|
+
className: 'TaonGlobalStateSubscriber',
|
|
7650
|
+
// allowedEvents: ['afterUpdate'],
|
|
7651
|
+
})
|
|
7652
|
+
], TaonGlobalStateSubscriber);
|
|
7653
|
+
|
|
7654
|
+
//#region imports
|
|
7655
|
+
//#endregion
|
|
7656
|
+
const TaonGlobalStateContext = createContext(() => ({
|
|
7657
|
+
contextName: 'TaonGlobalStateContext',
|
|
7658
|
+
abstract: true,
|
|
7659
|
+
entities: { TAON_GLOBAL_STATE },
|
|
7660
|
+
controllers: { TaonGlobalStateController },
|
|
7661
|
+
repositories: { TaonGlobalStateRepository },
|
|
7662
|
+
providers: { TaonGlobalStateProvider },
|
|
7663
|
+
middlewares: { TaonGlobalStateMiddleware },
|
|
7664
|
+
subscribers: { TaonGlobalStateSubscriber },
|
|
7665
|
+
}));
|
|
7666
|
+
|
|
7667
|
+
const TaonBaseContext = createContext(() => ({
|
|
7668
|
+
contextName: 'TaonBaseContext',
|
|
7669
|
+
abstract: true,
|
|
7670
|
+
contexts: {
|
|
7671
|
+
TaonGlobalStateContext,
|
|
7672
|
+
},
|
|
7673
|
+
middlewares: {
|
|
7674
|
+
TaonBaseFileUploadMiddleware,
|
|
7675
|
+
},
|
|
7676
|
+
repositories: {
|
|
7677
|
+
// @ts-ignore
|
|
7678
|
+
TaonBaseRepository,
|
|
7679
|
+
},
|
|
7680
|
+
}));
|
|
7681
|
+
|
|
7682
|
+
var baseContext = /*#__PURE__*/Object.freeze({
|
|
7683
|
+
__proto__: null,
|
|
7684
|
+
TaonBaseContext: TaonBaseContext
|
|
7685
|
+
});
|
|
7686
|
+
|
|
7687
|
+
class TaonBaseMigration extends TaonBaseInjector {
|
|
7688
|
+
/**
|
|
7689
|
+
* by default is READY to run
|
|
7690
|
+
*/
|
|
7691
|
+
isReadyToRun() {
|
|
7692
|
+
return true;
|
|
7693
|
+
}
|
|
7694
|
+
getDescription() {
|
|
7695
|
+
return _.startCase(ClassHelpers.getName(this));
|
|
7696
|
+
}
|
|
7697
|
+
async up(queryRunner) {
|
|
7698
|
+
console.log(`[TaonBaseMigration] Running migration UP "${ClassHelpers.getName(this)}"`);
|
|
7699
|
+
}
|
|
7700
|
+
async down(queryRunner) {
|
|
7701
|
+
console.log(`[TaonBaseMigration] Running migration DOWN "${ClassHelpers.getName(this)}"`);
|
|
7702
|
+
}
|
|
7703
|
+
}
|
|
7704
|
+
|
|
7527
7705
|
//#region models / method config
|
|
7528
7706
|
/**
|
|
7529
7707
|
* @link './decorators/http/http-methods-decorators.ts' TaonHttpDecoratorOptions
|
|
@@ -7537,8 +7715,8 @@ class ParamConfig {
|
|
|
7537
7715
|
}
|
|
7538
7716
|
|
|
7539
7717
|
class FormlyHorizontalWrapper extends FieldWrapper {
|
|
7540
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.
|
|
7541
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.
|
|
7718
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: FormlyHorizontalWrapper, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
7719
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.9", type: FormlyHorizontalWrapper, isStandalone: false, selector: "formly-horizontal-wrapper", viewQueries: [{ propertyName: "fieldComponent", first: true, predicate: ["fieldComponent"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: `
|
|
7542
7720
|
<div class="form-group row">
|
|
7543
7721
|
<label
|
|
7544
7722
|
[attr.for]="id"
|
|
@@ -7555,7 +7733,7 @@ class FormlyHorizontalWrapper extends FieldWrapper {
|
|
|
7555
7733
|
</div>
|
|
7556
7734
|
`, isInline: true, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px dotted gray}\n"] }); }
|
|
7557
7735
|
}
|
|
7558
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.
|
|
7736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: FormlyHorizontalWrapper, decorators: [{
|
|
7559
7737
|
type: Component,
|
|
7560
7738
|
args: [{ selector: 'formly-horizontal-wrapper', standalone: false, template: `
|
|
7561
7739
|
<div class="form-group row">
|
|
@@ -7600,8 +7778,8 @@ class RepeatTypeComponent extends FieldArrayType {
|
|
|
7600
7778
|
// @ts-ignore
|
|
7601
7779
|
super(builder);
|
|
7602
7780
|
}
|
|
7603
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.
|
|
7604
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.
|
|
7781
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: RepeatTypeComponent, deps: [{ token: i1.FormlyFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7782
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.9", type: RepeatTypeComponent, isStandalone: false, selector: "formly-repeat-section", usesInheritance: true, ngImport: i0, template: `
|
|
7605
7783
|
<div *ngIf="field.fieldGroup && field.fieldGroup.length === 0">
|
|
7606
7784
|
Press button to add new element...
|
|
7607
7785
|
</div>
|
|
@@ -7633,7 +7811,7 @@ class RepeatTypeComponent extends FieldArrayType {
|
|
|
7633
7811
|
</div>
|
|
7634
7812
|
`, isInline: true, styles: [":host{display:block;padding:5px;margin-bottom:5px;border:1px solid gray}formly-group{display:block;border:1px dashed gray;margin-bottom:5px;padding:5px}.taon-formly-array{padding:5px;background:#fff}\n"] }); }
|
|
7635
7813
|
}
|
|
7636
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.
|
|
7814
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: RepeatTypeComponent, decorators: [{
|
|
7637
7815
|
type: Component,
|
|
7638
7816
|
args: [{ selector: 'formly-repeat-section', standalone: false, template: `
|
|
7639
7817
|
<div *ngIf="field.fieldGroup && field.fieldGroup.length === 0">
|
|
@@ -7939,7 +8117,16 @@ const String100Column = (defaultValue = null) => Column({
|
|
|
7939
8117
|
default: defaultValue,
|
|
7940
8118
|
});
|
|
7941
8119
|
/**
|
|
7942
|
-
*
|
|
8120
|
+
* 20 characters varchar
|
|
8121
|
+
*/
|
|
8122
|
+
const String20Column = (defaultValue = null) => Column({
|
|
8123
|
+
type: 'varchar',
|
|
8124
|
+
length: 20,
|
|
8125
|
+
nullable: _.isNil(defaultValue),
|
|
8126
|
+
default: defaultValue,
|
|
8127
|
+
});
|
|
8128
|
+
/**
|
|
8129
|
+
* 45 characters varchar
|
|
7943
8130
|
*/
|
|
7944
8131
|
const String45Column = (defaultValue = null) => Column({
|
|
7945
8132
|
type: 'varchar',
|
|
@@ -7971,27 +8158,6 @@ const SimpleJsonColumn = () => Column({ type: 'simple-json', nullable: true });
|
|
|
7971
8158
|
const BooleanColumn = (defaultValue) => Column({ type: 'boolean', nullable: true, default: defaultValue });
|
|
7972
8159
|
const DateTimeColumn = (defaultValue = null) => Column({ type: 'datetime', nullable: true, default: defaultValue });
|
|
7973
8160
|
|
|
7974
|
-
/**
|
|
7975
|
-
* Entity decorator
|
|
7976
|
-
*/
|
|
7977
|
-
function TaonEntity(options) {
|
|
7978
|
-
return function (constructor) {
|
|
7979
|
-
options = options || {};
|
|
7980
|
-
options.uniqueKeyProp = options.uniqueKeyProp || 'id';
|
|
7981
|
-
ClassHelpers.setName(constructor, options?.className);
|
|
7982
|
-
Mapping.DefaultModelWithMapping(options?.defaultModelValues || {}, _.merge(options?.defaultModelMapping || {}, (options?.defaultModelMappingDeep || {})))(constructor);
|
|
7983
|
-
// TODO when entit metadata generator read use this
|
|
7984
|
-
Mapping.DefaultModelWithMapping(void 0, {})(constructor);
|
|
7985
|
-
Reflect.defineMetadata(Symbols.metadata.options.entity, options, constructor);
|
|
7986
|
-
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
7987
|
-
/* */
|
|
7988
|
-
/* */
|
|
7989
|
-
CLASS.setName(constructor, options?.className); // TODO QUICK_FIX for ng2-rest
|
|
7990
|
-
};
|
|
7991
|
-
}
|
|
7992
|
-
class TaonEntityOptions extends DecoratorAbstractOpt {
|
|
7993
|
-
}
|
|
7994
|
-
|
|
7995
8161
|
/**
|
|
7996
8162
|
* Migration decorator
|
|
7997
8163
|
*/
|
|
@@ -8005,22 +8171,26 @@ function TaonMigration(options) {
|
|
|
8005
8171
|
class TaonMigrationOptions extends DecoratorAbstractOpt {
|
|
8006
8172
|
}
|
|
8007
8173
|
|
|
8008
|
-
/**
|
|
8009
|
-
* Provider decorator
|
|
8010
|
-
*/
|
|
8011
|
-
function TaonProvider(options) {
|
|
8012
|
-
return function (constructor) {
|
|
8013
|
-
Reflect.defineMetadata(Symbols.metadata.options.provider, options, constructor);
|
|
8014
|
-
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
8015
|
-
ClassHelpers.setName(constructor, options?.className || constructor.name);
|
|
8016
|
-
};
|
|
8017
|
-
}
|
|
8018
|
-
class TaonProviderOptions extends DecoratorAbstractOpt {
|
|
8019
|
-
}
|
|
8020
|
-
|
|
8021
8174
|
// TODO export all things
|
|
8022
8175
|
var Taon;
|
|
8023
8176
|
(function (Taon) {
|
|
8177
|
+
/**
|
|
8178
|
+
* Remove global taon loader from env.ts [loading.preAngularBootstrap]
|
|
8179
|
+
*/
|
|
8180
|
+
Taon.removeLoader = (afterMS = 0) => {
|
|
8181
|
+
return new Promise((resolve) => {
|
|
8182
|
+
setTimeout(() => {
|
|
8183
|
+
globalThis?.window?.document
|
|
8184
|
+
?.getElementById('taonpreloadertoremove')
|
|
8185
|
+
?.remove();
|
|
8186
|
+
const body = globalThis?.window?.document?.body;
|
|
8187
|
+
if (body && body.style) {
|
|
8188
|
+
body.style.backgroundColor = '';
|
|
8189
|
+
}
|
|
8190
|
+
resolve();
|
|
8191
|
+
}, afterMS);
|
|
8192
|
+
});
|
|
8193
|
+
};
|
|
8024
8194
|
Taon.error = (opt) => {
|
|
8025
8195
|
throw () => {
|
|
8026
8196
|
if (typeof opt === 'string') {
|
|
@@ -8051,11 +8221,6 @@ var Taon;
|
|
|
8051
8221
|
Taon.createContext = createContext;
|
|
8052
8222
|
Taon.createContextTemplate = createContextTemplate;
|
|
8053
8223
|
Taon.inject = inject;
|
|
8054
|
-
//#region @browser
|
|
8055
|
-
Taon.initNgZone = (ngZone) => {
|
|
8056
|
-
EndpointContext.initNgZone(ngZone);
|
|
8057
|
-
};
|
|
8058
|
-
//#endregion
|
|
8059
8224
|
Taon.symbols = Symbols;
|
|
8060
8225
|
/**
|
|
8061
8226
|
* @deprecated
|
|
@@ -8190,7 +8355,7 @@ const TAON_FLATTEN_MAPPING = {
|
|
|
8190
8355
|
// Optional: if your old code had Stor.proper... (typo)
|
|
8191
8356
|
'Stor.proper.in.localstorage': 'StorPropertyInLocalStorage',
|
|
8192
8357
|
'Stor.proper.in.indexedb': 'StorPropertyInIndexedDb',
|
|
8193
|
-
}
|
|
8358
|
+
},
|
|
8194
8359
|
};
|
|
8195
8360
|
//#endregion
|
|
8196
8361
|
|
|
@@ -8198,5 +8363,5 @@ const TAON_FLATTEN_MAPPING = {
|
|
|
8198
8363
|
* Generated bundle index. Do not edit.
|
|
8199
8364
|
*/
|
|
8200
8365
|
|
|
8201
|
-
export { BaseTaonClassesNames, Body, BooleanColumn, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, ContextDbMigrations, ContextsEndpointStorage, ControllerConfig, Cookie, DELETE, DITaonContainer, DateTimeColumn, DecimalNumberColumn, DecoratorAbstractOpt, EndpointContext, EntityProcess, FormlyHorizontalWrapper, GET, HEAD, HTML, Header, MethodConfig, MockNamespaceIpc, MockServerIpc, MockSocketIpc, Models, NumberColumn, PATCH, POST, PUT, ParamConfig, Path, Query, RealtimeClient, RealtimeCore, RealtimeServer, RealtimeStrategy, RealtimeStrategyIpc, RealtimeStrategyMock, RealtimeStrategySocketIO, RealtimeSubsManager, RegisterComponentType, RegisterComponentTypeForEntity, RepeatTypeComponent, SimpleJsonColumn, String100Column, String200Column, String45Column, String500Column, StringColumn, Symbols, TAON_CONTEXT, TAON_FLATTEN_MAPPING, Taon, TaonAdminService, TaonBaseAbstractEntity, TaonBaseAngularService, TaonBaseClass, TaonBaseContext, TaonBaseController, TaonBaseCrudController, TaonBaseCustomRepository, TaonBaseEntity, TaonBaseFileUploadMiddleware, TaonBaseInjector, TaonBaseMiddleware, TaonBaseMigration, TaonBaseProvider, TaonBaseRepository, TaonBaseSubscriberForEntity, TaonController, TaonControllerOptions, TaonEntity, TaonEntityKeysToOmitArr, TaonEntityOptions, TaonHelpers, TaonMiddleware, TaonMiddlewareOptions, TaonMigration, TaonMigrationOptions, TaonProvider, TaonProviderOptions, TaonRepository, TaonRepositoryOptions, TaonRestResponseWrapper, TaonSubscriber, TaonSubscriberOptions, TaonTempDatabasesFolder, TaonTempRoutesFolder, Validators, apiPrefix, cloneObj, controllerConfigFrom, createContext, createContextTemplate, findTypeForEntity, getFromlyConfigFor, getRegisteredComponents, getResponseValue, getTransformFunction, inject, singleTransform, typeFromEntity, typeFromName };
|
|
8366
|
+
export { BaseTaonClassesNames, Body, BooleanColumn, CURRENT_HOST_BACKEND_PORT, CURRENT_HOST_URL, ClassHelpers, ContextDbMigrations, ContextsEndpointStorage, ControllerConfig, Cookie, DELETE, DITaonContainer, DateTimeColumn, DecimalNumberColumn, DecoratorAbstractOpt, EndpointContext, EntityProcess, FormlyHorizontalWrapper, GET, HEAD, HTML, Header, MethodConfig, MockNamespaceIpc, MockServerIpc, MockSocketIpc, Models, NumberColumn, PATCH, POST, PUT, ParamConfig, Path, Query, RealtimeClient, RealtimeCore, RealtimeServer, RealtimeStrategy, RealtimeStrategyIpc, RealtimeStrategyMock, RealtimeStrategySocketIO, RealtimeSubsManager, RegisterComponentType, RegisterComponentTypeForEntity, RepeatTypeComponent, SimpleJsonColumn, String100Column, String200Column, String20Column, String45Column, String500Column, StringColumn, Symbols, TAON_CONTEXT, TAON_FLATTEN_MAPPING, Taon, TaonAdminService, TaonBaseAbstractEntity, TaonBaseAngularService, TaonBaseClass, TaonBaseContext, TaonBaseController, TaonBaseCrudController, TaonBaseCustomRepository, TaonBaseEntity, TaonBaseFileUploadMiddleware, TaonBaseInjector, TaonBaseMiddleware, TaonBaseMigration, TaonBaseProvider, TaonBaseRepository, TaonBaseSubscriberForEntity, TaonController, TaonControllerOptions, TaonEntity, TaonEntityKeysToOmitArr, TaonEntityOptions, TaonHelpers, TaonMiddleware, TaonMiddlewareOptions, TaonMigration, TaonMigrationOptions, TaonProvider, TaonProviderOptions, TaonRepository, TaonRepositoryOptions, TaonRestResponseWrapper, TaonSubscriber, TaonSubscriberOptions, TaonTempDatabasesFolder, TaonTempRoutesFolder, Validators, apiPrefix, cloneObj, controllerConfigFrom, createContext, createContextTemplate, findTypeForEntity, getFromlyConfigFor, getRegisteredComponents, getResponseValue, getTransformFunction, inject, singleTransform, typeFromEntity, typeFromName };
|
|
8202
8367
|
//# sourceMappingURL=taon-browser.mjs.map
|