taon 18.0.19 → 18.0.21
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 +114 -118
- package/assets/shared/logo-header-admin-mode.png +0 -0
- package/assets/shared/shared_folder_info.txt +1 -1
- package/bin/start.js +279 -279
- package/bin/taon +6 -6
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +5 -5
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/base-classes/base-abstract-entity.mjs +1 -1
- package/browser/esm2022/lib/base-classes/base-class.mjs +2 -2
- package/browser/esm2022/lib/base-classes/base-controller.mjs +3 -2
- package/browser/esm2022/lib/base-classes/base-crud-controller.mjs +1 -1
- package/browser/esm2022/lib/base-classes/base-migration.mjs +23 -0
- package/browser/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +20 -20
- package/browser/esm2022/lib/base-classes/base.mjs +5 -3
- package/browser/esm2022/lib/context-db-migrations.mjs +410 -0
- package/browser/esm2022/lib/create-context.mjs +22 -8
- package/browser/esm2022/lib/decorators/classes/controller-decorator.mjs +4 -1
- package/browser/esm2022/lib/decorators/classes/entity-decorator.mjs +4 -1
- package/browser/esm2022/lib/decorators/classes/migration-decorator.mjs +18 -0
- package/browser/esm2022/lib/decorators/classes/provider-decorator.mjs +4 -1
- package/browser/esm2022/lib/decorators/classes/repository-decorator.mjs +4 -1
- package/browser/esm2022/lib/decorators/classes/subscriber-decorator.mjs +5 -2
- package/browser/esm2022/lib/decorators/http/http-methods-decorators.mjs +1 -1
- package/browser/esm2022/lib/endpoint-context.mjs +105 -59
- package/browser/esm2022/lib/entity-process.mjs +1 -10
- package/browser/esm2022/lib/get-response-value.mjs +1 -15
- package/browser/esm2022/lib/index.mjs +4 -1
- package/browser/esm2022/lib/inject.mjs +1 -1
- package/browser/esm2022/lib/models.mjs +30 -1
- package/browser/esm2022/lib/symbols.mjs +2 -1
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/index.mjs +1 -3
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +55 -37
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin.service.mjs +17 -21
- package/browser/esm2022/lib/ui/taon-notifications/taon-notifications.module.mjs +1 -1
- package/browser/esm2022/lib/ui/taon-progress-bar/taon-progress-bar.component.mjs +1 -1
- package/browser/esm2022/lib/ui/taon-table/taon-table.component.mjs +1 -2
- package/browser/fesm2022/taon.mjs +701 -449
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-abstract-entity.d.ts +2 -1
- package/browser/lib/base-classes/base-class.d.ts +1 -1
- package/browser/lib/base-classes/base-context.d.ts +3 -0
- package/browser/lib/base-classes/base-controller.d.ts +2 -1
- package/browser/lib/base-classes/base-crud-controller.d.ts +1 -1
- package/browser/lib/base-classes/base-migration.d.ts +12 -0
- package/browser/lib/base-classes/base.d.ts +8 -2
- package/browser/lib/context-db-migrations.d.ts +17 -0
- package/browser/lib/create-context.d.ts +7 -4
- package/browser/lib/decorators/classes/controller-decorator.d.ts +3 -0
- package/browser/lib/decorators/classes/entity-decorator.d.ts +3 -0
- package/browser/lib/decorators/classes/migration-decorator.d.ts +8 -0
- package/browser/lib/decorators/classes/provider-decorator.d.ts +3 -0
- package/browser/lib/decorators/classes/repository-decorator.d.ts +3 -0
- package/browser/lib/decorators/classes/subscriber-decorator.d.ts +3 -0
- package/browser/lib/decorators/http/http-methods-decorators.d.ts +9 -0
- package/browser/lib/endpoint-context.d.ts +14 -7
- package/browser/lib/index.d.ts +14 -1
- package/browser/lib/models.d.ts +45 -22
- package/browser/lib/symbols.d.ts +1 -0
- package/browser/lib/ui/taon-admin-mode-configuration/index.d.ts +1 -3
- package/browser/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +5 -8
- package/browser/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +8 -8
- package/client/README.md +24 -24
- package/client/esm2022/lib/base-classes/base-abstract-entity.mjs +1 -1
- package/client/esm2022/lib/base-classes/base-class.mjs +2 -2
- package/client/esm2022/lib/base-classes/base-controller.mjs +3 -2
- package/client/esm2022/lib/base-classes/base-crud-controller.mjs +1 -1
- package/client/esm2022/lib/base-classes/base-migration.mjs +23 -0
- package/client/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +20 -20
- package/client/esm2022/lib/base-classes/base.mjs +5 -3
- package/client/esm2022/lib/context-db-migrations.mjs +410 -0
- package/client/esm2022/lib/create-context.mjs +22 -8
- package/client/esm2022/lib/decorators/classes/controller-decorator.mjs +4 -1
- package/client/esm2022/lib/decorators/classes/entity-decorator.mjs +4 -1
- package/client/esm2022/lib/decorators/classes/migration-decorator.mjs +18 -0
- package/client/esm2022/lib/decorators/classes/provider-decorator.mjs +4 -1
- package/client/esm2022/lib/decorators/classes/repository-decorator.mjs +4 -1
- package/client/esm2022/lib/decorators/classes/subscriber-decorator.mjs +5 -2
- package/client/esm2022/lib/decorators/http/http-methods-decorators.mjs +1 -1
- package/client/esm2022/lib/endpoint-context.mjs +105 -59
- package/client/esm2022/lib/entity-process.mjs +1 -10
- package/client/esm2022/lib/get-response-value.mjs +1 -15
- package/client/esm2022/lib/index.mjs +4 -1
- package/client/esm2022/lib/inject.mjs +1 -1
- package/client/esm2022/lib/models.mjs +30 -1
- package/client/esm2022/lib/symbols.mjs +2 -1
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/index.mjs +1 -3
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +55 -37
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin.service.mjs +17 -21
- package/client/esm2022/lib/ui/taon-notifications/taon-notifications.module.mjs +1 -1
- package/client/esm2022/lib/ui/taon-progress-bar/taon-progress-bar.component.mjs +1 -1
- package/client/esm2022/lib/ui/taon-table/taon-table.component.mjs +1 -2
- package/client/fesm2022/taon.mjs +701 -449
- package/client/fesm2022/taon.mjs.map +1 -1
- package/client/lib/base-classes/base-abstract-entity.d.ts +2 -1
- package/client/lib/base-classes/base-class.d.ts +1 -1
- package/client/lib/base-classes/base-context.d.ts +3 -0
- package/client/lib/base-classes/base-controller.d.ts +2 -1
- package/client/lib/base-classes/base-crud-controller.d.ts +1 -1
- package/client/lib/base-classes/base-migration.d.ts +12 -0
- package/client/lib/base-classes/base.d.ts +8 -2
- package/client/lib/context-db-migrations.d.ts +17 -0
- package/client/lib/create-context.d.ts +7 -4
- package/client/lib/decorators/classes/controller-decorator.d.ts +3 -0
- package/client/lib/decorators/classes/entity-decorator.d.ts +3 -0
- package/client/lib/decorators/classes/migration-decorator.d.ts +8 -0
- package/client/lib/decorators/classes/provider-decorator.d.ts +3 -0
- package/client/lib/decorators/classes/repository-decorator.d.ts +3 -0
- package/client/lib/decorators/classes/subscriber-decorator.d.ts +3 -0
- package/client/lib/decorators/http/http-methods-decorators.d.ts +9 -0
- package/client/lib/endpoint-context.d.ts +14 -7
- package/client/lib/index.d.ts +14 -1
- package/client/lib/models.d.ts +45 -22
- package/client/lib/symbols.d.ts +1 -0
- package/client/lib/ui/taon-admin-mode-configuration/index.d.ts +1 -3
- package/client/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +5 -8
- package/client/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +8 -8
- package/lib/base-classes/base-abstract-entity.d.ts +1 -0
- package/lib/base-classes/base-class.d.ts +1 -1
- package/lib/base-classes/base-class.js +1 -1
- package/lib/base-classes/base-context.d.ts +3 -0
- package/lib/base-classes/base-controller.d.ts +2 -1
- package/lib/base-classes/base-controller.js +2 -1
- package/lib/base-classes/base-controller.js.map +1 -1
- package/lib/base-classes/base-crud-controller.d.ts +1 -1
- package/lib/base-classes/base-migration.d.ts +11 -0
- package/lib/base-classes/base-migration.js +41 -0
- package/lib/base-classes/base-migration.js.map +1 -0
- package/lib/base-classes/base-repository.js +4 -4
- package/lib/base-classes/base-repository.js.map +1 -1
- package/lib/base-classes/base-subscriber-for-entity.js +19 -19
- package/lib/base-classes/base-subscriber-for-entity.js.map +1 -1
- package/lib/base-classes/base.d.ts +8 -2
- package/lib/base-classes/base.js +4 -2
- package/lib/base-classes/base.js.map +1 -1
- package/lib/context-db-migrations.d.ts +16 -0
- package/lib/context-db-migrations.js +585 -0
- package/lib/context-db-migrations.js.map +1 -0
- package/lib/create-context.d.ts +7 -4
- package/lib/create-context.js +34 -12
- package/lib/create-context.js.map +1 -1
- package/lib/decorators/classes/controller-decorator.d.ts +3 -0
- package/lib/decorators/classes/controller-decorator.js +3 -0
- package/lib/decorators/classes/controller-decorator.js.map +1 -1
- package/lib/decorators/classes/entity-decorator.d.ts +3 -0
- package/lib/decorators/classes/entity-decorator.js +3 -0
- package/lib/decorators/classes/entity-decorator.js.map +1 -1
- package/lib/decorators/classes/migration-decorator.d.ts +7 -0
- package/lib/decorators/classes/migration-decorator.js +27 -0
- package/lib/decorators/classes/migration-decorator.js.map +1 -0
- package/lib/decorators/classes/provider-decorator.d.ts +3 -0
- package/lib/decorators/classes/provider-decorator.js +3 -0
- package/lib/decorators/classes/provider-decorator.js.map +1 -1
- package/lib/decorators/classes/repository-decorator.d.ts +3 -0
- package/lib/decorators/classes/repository-decorator.js +3 -0
- package/lib/decorators/classes/repository-decorator.js.map +1 -1
- package/lib/decorators/classes/subscriber-decorator.d.ts +3 -0
- package/lib/decorators/classes/subscriber-decorator.js +4 -1
- package/lib/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib/decorators/http/http-methods-decorators.d.ts +9 -0
- package/lib/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib/endpoint-context.d.ts +14 -7
- package/lib/endpoint-context.js +265 -220
- package/lib/endpoint-context.js.map +1 -1
- package/lib/entity-process.js +0 -9
- package/lib/entity-process.js.map +1 -1
- package/lib/get-response-value.js +14 -37
- package/lib/get-response-value.js.map +1 -1
- package/lib/index.d.ts +14 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/inject.js +0 -2
- package/lib/inject.js.map +1 -1
- package/lib/models.d.ts +45 -23
- package/lib/models.js +45 -0
- package/lib/models.js.map +1 -1
- package/lib/symbols.d.ts +1 -0
- package/lib/symbols.js +1 -0
- package/lib/symbols.js.map +1 -1
- package/lib/ui/directives/index.js +2 -2
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.d.ts +1 -3
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +4 -7
- package/lib/ui/taon-admin-mode-configuration/{models/taon-admin-mode-tabs.js → taon-admin.models.js} +1 -1
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js.map +1 -0
- package/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +6 -6
- package/lib/ui/taon-github-fork-me-corner/index.js +2 -2
- package/lib/ui/taon-github-fork-me-ribbon/index.js +2 -2
- package/lib/ui/taon-notifications/taon-notifications.models.js +2 -2
- package/lib/ui/taon-progress-bar/index.js +2 -2
- package/lib/ui/taon-session-passcode/index.js +2 -2
- package/lib/ui/taon-table/index.js +2 -2
- package/migrations/index.d.ts +1 -0
- package/migrations/index.js +6 -0
- package/migrations/index.js.map +1 -0
- package/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/migrations/migrations_index._auto-generated_.js +4 -0
- package/migrations/migrations_index._auto-generated_.js.map +1 -0
- package/package.json +7 -7
- package/taon.jsonc +47 -47
- package/tmp-environment.json +39 -31
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/base-classes/base-abstract-entity.mjs +1 -1
- package/websql/esm2022/lib/base-classes/base-class.mjs +2 -2
- package/websql/esm2022/lib/base-classes/base-controller.mjs +3 -2
- package/websql/esm2022/lib/base-classes/base-crud-controller.mjs +1 -1
- package/websql/esm2022/lib/base-classes/base-migration.mjs +23 -0
- package/websql/esm2022/lib/base-classes/base-repository.mjs +5 -5
- package/websql/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +20 -20
- package/websql/esm2022/lib/base-classes/base.mjs +5 -3
- package/websql/esm2022/lib/context-db-migrations.mjs +269 -0
- package/websql/esm2022/lib/create-context.mjs +22 -8
- package/websql/esm2022/lib/decorators/classes/controller-decorator.mjs +4 -1
- package/websql/esm2022/lib/decorators/classes/entity-decorator.mjs +4 -1
- package/websql/esm2022/lib/decorators/classes/migration-decorator.mjs +18 -0
- package/websql/esm2022/lib/decorators/classes/provider-decorator.mjs +4 -1
- package/websql/esm2022/lib/decorators/classes/repository-decorator.mjs +4 -1
- package/websql/esm2022/lib/decorators/classes/subscriber-decorator.mjs +5 -2
- package/websql/esm2022/lib/decorators/http/http-methods-decorators.mjs +1 -1
- package/websql/esm2022/lib/endpoint-context.mjs +139 -95
- package/websql/esm2022/lib/entity-process.mjs +1 -10
- package/websql/esm2022/lib/get-response-value.mjs +4 -24
- package/websql/esm2022/lib/index.mjs +4 -1
- package/websql/esm2022/lib/inject.mjs +1 -1
- package/websql/esm2022/lib/models.mjs +28 -1
- package/websql/esm2022/lib/symbols.mjs +2 -1
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/index.mjs +1 -3
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +55 -37
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin.service.mjs +17 -21
- package/websql/esm2022/lib/ui/taon-notifications/taon-notifications.module.mjs +1 -1
- package/websql/esm2022/lib/ui/taon-progress-bar/taon-progress-bar.component.mjs +1 -1
- package/websql/esm2022/lib/ui/taon-table/taon-table.component.mjs +1 -2
- package/websql/fesm2022/taon.mjs +594 -497
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-abstract-entity.d.ts +2 -1
- package/websql/lib/base-classes/base-class.d.ts +1 -1
- package/websql/lib/base-classes/base-context.d.ts +3 -0
- package/websql/lib/base-classes/base-controller.d.ts +2 -1
- package/websql/lib/base-classes/base-crud-controller.d.ts +1 -1
- package/websql/lib/base-classes/base-migration.d.ts +12 -0
- package/websql/lib/base-classes/base.d.ts +8 -2
- package/websql/lib/context-db-migrations.d.ts +17 -0
- package/websql/lib/create-context.d.ts +7 -4
- package/websql/lib/decorators/classes/controller-decorator.d.ts +3 -0
- package/websql/lib/decorators/classes/entity-decorator.d.ts +3 -0
- package/websql/lib/decorators/classes/migration-decorator.d.ts +8 -0
- package/websql/lib/decorators/classes/provider-decorator.d.ts +3 -0
- package/websql/lib/decorators/classes/repository-decorator.d.ts +3 -0
- package/websql/lib/decorators/classes/subscriber-decorator.d.ts +3 -0
- package/websql/lib/decorators/http/http-methods-decorators.d.ts +9 -0
- package/websql/lib/endpoint-context.d.ts +14 -7
- package/websql/lib/index.d.ts +14 -1
- package/websql/lib/models.d.ts +45 -23
- package/websql/lib/symbols.d.ts +1 -0
- package/websql/lib/ui/taon-admin-mode-configuration/index.d.ts +1 -3
- package/websql/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +5 -8
- package/websql/lib/ui/taon-admin-mode-configuration/taon-admin.service.d.ts +8 -8
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.mjs +0 -5
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.mjs +0 -115
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.mjs +0 -50
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.mjs +0 -5
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.mjs +0 -61
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.mjs +0 -21
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.mjs +0 -4
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.mjs +0 -32
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.mjs +0 -54
- package/browser/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +0 -3
- package/browser/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +0 -33
- package/browser/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +0 -16
- package/browser/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +0 -3
- package/browser/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +0 -17
- package/browser/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +0 -10
- package/browser/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +0 -6
- package/browser/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +0 -18
- package/browser/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +0 -17
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.mjs +0 -5
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.mjs +0 -115
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.mjs +0 -50
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.mjs +0 -5
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.mjs +0 -61
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.mjs +0 -21
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.mjs +0 -4
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.mjs +0 -32
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.mjs +0 -54
- package/client/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +0 -3
- package/client/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +0 -33
- package/client/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +0 -16
- package/client/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +0 -3
- package/client/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +0 -17
- package/client/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +0 -10
- package/client/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +0 -6
- package/client/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +0 -18
- package/client/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +0 -17
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +0 -29
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.d.ts +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/taon-db-admin.component.d.ts +0 -8
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +0 -13
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +0 -14
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +0 -2
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.mjs +0 -5
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.mjs +0 -115
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.mjs +0 -50
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.mjs +0 -5
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.mjs +0 -61
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.mjs +0 -21
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.mjs +0 -4
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.mjs +0 -32
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.mjs +0 -54
- package/websql/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +0 -3
- package/websql/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +0 -33
- package/websql/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +0 -16
- package/websql/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +0 -3
- package/websql/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +0 -17
- package/websql/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +0 -10
- package/websql/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +0 -6
- package/websql/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +0 -18
- package/websql/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +0 -17
- /package/lib/ui/taon-admin-mode-configuration/{models/taon-admin-mode-tabs.d.ts → taon-admin.models.d.ts} +0 -0
package/lib/endpoint-context.js
CHANGED
|
@@ -21,15 +21,16 @@ var tnp_core_1 = require("tnp-core");
|
|
|
21
21
|
//#endregion
|
|
22
22
|
/* */
|
|
23
23
|
/* */
|
|
24
|
+
var tnp_core_2 = require("tnp-core");
|
|
24
25
|
var models_1 = require("./models");
|
|
25
26
|
var class_helpers_1 = require("./helpers/class-helpers");
|
|
26
27
|
var symbols_1 = require("./symbols");
|
|
27
|
-
var
|
|
28
|
+
var tnp_core_3 = require("tnp-core");
|
|
28
29
|
var di_container_1 = require("./dependency-injection/di-container");
|
|
29
30
|
var taon_helpers_1 = require("./helpers/taon-helpers");
|
|
30
31
|
var ng2_rest_1 = require("ng2-rest");
|
|
31
32
|
var json10_1 = require("json10");
|
|
32
|
-
var
|
|
33
|
+
var tnp_core_4 = require("tnp-core");
|
|
33
34
|
var rxjs_1 = require("rxjs");
|
|
34
35
|
var entity_process_1 = require("./entity-process");
|
|
35
36
|
var get_response_value_1 = require("./get-response-value");
|
|
@@ -37,6 +38,7 @@ var axios_1 = require("axios");
|
|
|
37
38
|
var taon_typeorm_3 = require("taon-typeorm");
|
|
38
39
|
var env_1 = require("./env");
|
|
39
40
|
var realtime_core_1 = require("./realtime/realtime-core");
|
|
41
|
+
var context_db_migrations_1 = require("./context-db-migrations");
|
|
40
42
|
//#endregion
|
|
41
43
|
var EndpointContext = /** @class */ (function () {
|
|
42
44
|
//#endregion
|
|
@@ -63,6 +65,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
63
65
|
*/
|
|
64
66
|
this.inited = false;
|
|
65
67
|
//#endregion
|
|
68
|
+
this.dbMigrations = new context_db_migrations_1.ContextDbMigrations(this);
|
|
66
69
|
this.localInstaceObjSymbol = Symbol('localInstaceObjSymbol');
|
|
67
70
|
//#region fields / all instances of classes from context
|
|
68
71
|
/**
|
|
@@ -86,14 +89,20 @@ var EndpointContext = /** @class */ (function () {
|
|
|
86
89
|
models_1.Models.ClassType.PROVIDER,
|
|
87
90
|
models_1.Models.ClassType.REPOSITORY,
|
|
88
91
|
models_1.Models.ClassType.SUBSCRIBER,
|
|
92
|
+
models_1.Models.ClassType.MIGRATION,
|
|
89
93
|
];
|
|
90
94
|
//#endregion
|
|
91
95
|
this.allTypesfromContexts = tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(this.injectableTypesfromContexts), false), [
|
|
92
96
|
models_1.Models.ClassType.ENTITY,
|
|
93
97
|
], false);
|
|
98
|
+
// public __contextForControllerInstanceAccess?: EndpointContext;
|
|
94
99
|
//#region fields / express app
|
|
95
100
|
this.expressApp = {};
|
|
96
101
|
//#endregion
|
|
102
|
+
//#region fields / only migration start
|
|
103
|
+
this.onlyMigrationRun = false;
|
|
104
|
+
this.onlyMigrationRevertToTimestamp = undefined;
|
|
105
|
+
//#endregion
|
|
97
106
|
//#region fields / entities triggers
|
|
98
107
|
this.entitiesTriggers = {};
|
|
99
108
|
//#endregion
|
|
@@ -191,7 +200,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
191
200
|
var key = _d.value;
|
|
192
201
|
var BaseClass_1 = classesInput[key];
|
|
193
202
|
if (!BaseClass_1) {
|
|
194
|
-
|
|
203
|
+
tnp_core_3.Helpers.error("Class ".concat(key, " is not defined in context ").concat(ctx.contextName, "\n\n Please check if you have correct import in context file\n\n "));
|
|
195
204
|
}
|
|
196
205
|
var className = Reflect.getMetadata(symbols_1.Symbols.metadata.className, BaseClass_1);
|
|
197
206
|
// console.log('Metadata className', className, BaseClass);
|
|
@@ -227,6 +236,13 @@ var EndpointContext = /** @class */ (function () {
|
|
|
227
236
|
/* */
|
|
228
237
|
/* */
|
|
229
238
|
};
|
|
239
|
+
Object.defineProperty(EndpointContext.prototype, "isRunOrRevertOnlyMigrationAppStart", {
|
|
240
|
+
get: function () {
|
|
241
|
+
return !!(this.onlyMigrationRun || this.onlyMigrationRevertToTimestamp);
|
|
242
|
+
},
|
|
243
|
+
enumerable: false,
|
|
244
|
+
configurable: true
|
|
245
|
+
});
|
|
230
246
|
Object.defineProperty(EndpointContext.prototype, "realtimeClient", {
|
|
231
247
|
get: function () {
|
|
232
248
|
return this.realtime.client;
|
|
@@ -246,7 +262,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
246
262
|
//#region fields / logs
|
|
247
263
|
get: function () {
|
|
248
264
|
var _a, _b;
|
|
249
|
-
if (
|
|
265
|
+
if (tnp_core_3._.isObject((_a = this.config) === null || _a === void 0 ? void 0 : _a.logs)) {
|
|
250
266
|
return !!this.config.logs.http;
|
|
251
267
|
}
|
|
252
268
|
return ((_b = this.config) === null || _b === void 0 ? void 0 : _b.logs) === true;
|
|
@@ -257,7 +273,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
257
273
|
Object.defineProperty(EndpointContext.prototype, "logRealtime", {
|
|
258
274
|
get: function () {
|
|
259
275
|
var _a, _b;
|
|
260
|
-
if (
|
|
276
|
+
if (tnp_core_3._.isObject((_a = this.config) === null || _a === void 0 ? void 0 : _a.logs)) {
|
|
261
277
|
return !!this.config.logs.realtime;
|
|
262
278
|
}
|
|
263
279
|
return ((_b = this.config) === null || _b === void 0 ? void 0 : _b.logs) === true;
|
|
@@ -268,7 +284,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
268
284
|
Object.defineProperty(EndpointContext.prototype, "logFramework", {
|
|
269
285
|
get: function () {
|
|
270
286
|
var _a, _b;
|
|
271
|
-
if (
|
|
287
|
+
if (tnp_core_3._.isObject((_a = this.config) === null || _a === void 0 ? void 0 : _a.logs)) {
|
|
272
288
|
return !!this.config.logs.framework;
|
|
273
289
|
}
|
|
274
290
|
return ((_b = this.config) === null || _b === void 0 ? void 0 : _b.logs) === true;
|
|
@@ -279,7 +295,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
279
295
|
Object.defineProperty(EndpointContext.prototype, "logDb", {
|
|
280
296
|
get: function () {
|
|
281
297
|
var _a, _b;
|
|
282
|
-
if (
|
|
298
|
+
if (tnp_core_3._.isObject((_a = this.config) === null || _a === void 0 ? void 0 : _a.logs)) {
|
|
283
299
|
return !!this.config.logs.db;
|
|
284
300
|
}
|
|
285
301
|
return ((_b = this.config) === null || _b === void 0 ? void 0 : _b.logs) === true;
|
|
@@ -287,58 +303,60 @@ var EndpointContext = /** @class */ (function () {
|
|
|
287
303
|
enumerable: false,
|
|
288
304
|
configurable: true
|
|
289
305
|
});
|
|
306
|
+
Object.defineProperty(EndpointContext.prototype, "logMigrations", {
|
|
307
|
+
get: function () {
|
|
308
|
+
var _a, _b;
|
|
309
|
+
if (tnp_core_3._.isObject((_a = this.config) === null || _a === void 0 ? void 0 : _a.logs)) {
|
|
310
|
+
return !!this.config.logs.migrations;
|
|
311
|
+
}
|
|
312
|
+
return ((_b = this.config) === null || _b === void 0 ? void 0 : _b.logs) === true;
|
|
313
|
+
},
|
|
314
|
+
enumerable: false,
|
|
315
|
+
configurable: true
|
|
316
|
+
});
|
|
290
317
|
//#endregion
|
|
291
318
|
//#region methods & getters / init
|
|
292
319
|
EndpointContext.prototype.init = function (options) {
|
|
293
320
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
294
|
-
var _a, initFromRecrusiveContextResovle, overrideHost, overrideRemoteHost, oneHour, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, classTypeName,
|
|
295
|
-
var e_3,
|
|
321
|
+
var _a, initFromRecrusiveContextResovle, overrideHost, overrideRemoteHost, onlyMigrationRun, onlyMigrationRevertToTimestamp, oneHour, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, classTypeName, _r, _s, classTypeName, e_2_1;
|
|
322
|
+
var e_3, _t, e_2, _u;
|
|
296
323
|
var _this = this;
|
|
297
|
-
var
|
|
298
|
-
return tslib_1.__generator(this, function (
|
|
299
|
-
switch (
|
|
324
|
+
var _v, _w;
|
|
325
|
+
return tslib_1.__generator(this, function (_x) {
|
|
326
|
+
switch (_x.label) {
|
|
300
327
|
case 0:
|
|
301
|
-
_a = options || {}, initFromRecrusiveContextResovle = _a.initFromRecrusiveContextResovle, overrideHost = _a.overrideHost, overrideRemoteHost = _a.overrideRemoteHost;
|
|
328
|
+
_a = options || {}, initFromRecrusiveContextResovle = _a.initFromRecrusiveContextResovle, overrideHost = _a.overrideHost, overrideRemoteHost = _a.overrideRemoteHost, onlyMigrationRun = _a.onlyMigrationRun, onlyMigrationRevertToTimestamp = _a.onlyMigrationRevertToTimestamp;
|
|
302
329
|
this.inited = true;
|
|
330
|
+
// @ts-ignore
|
|
331
|
+
this.onlyMigrationRun = onlyMigrationRun;
|
|
332
|
+
// @ts-ignore
|
|
333
|
+
this.onlyMigrationRevertToTimestamp = onlyMigrationRevertToTimestamp;
|
|
303
334
|
this.config = this.configFn(env_1.ENV);
|
|
335
|
+
if (tnp_core_3._.isObject(this.config.database)) {
|
|
336
|
+
this.config.database = models_1.Models.DatabaseConfig.from(this.config.database).databaseConfigTypeORM;
|
|
337
|
+
}
|
|
304
338
|
if (overrideHost && overrideRemoteHost) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
339
|
+
tnp_core_3.Helpers.throw("[taon-config] You can't have overrideHost and overrideRemoteHost at the same time");
|
|
340
|
+
}
|
|
341
|
+
this.config.host = !tnp_core_3._.isUndefined(overrideHost)
|
|
342
|
+
? overrideHost
|
|
343
|
+
: this.config.host;
|
|
344
|
+
this.config.remoteHost = !tnp_core_3._.isUndefined(overrideRemoteHost)
|
|
345
|
+
? overrideRemoteHost
|
|
346
|
+
: this.config.remoteHost;
|
|
347
|
+
this.config.host = this.host === null ? void 0 : this.host;
|
|
348
|
+
this.config.remoteHost =
|
|
349
|
+
this.remoteHost === null ? void 0 : this.remoteHost;
|
|
350
|
+
if (this.config.host &&
|
|
351
|
+
!this.config.host.startsWith('http://') &&
|
|
352
|
+
!this.config.host.startsWith('https://')) {
|
|
353
|
+
tnp_core_3.Helpers.throw("[taon-config] Your 'host' must start with http:// or https://");
|
|
354
|
+
}
|
|
355
|
+
if (this.config.remoteHost &&
|
|
356
|
+
!this.config.remoteHost.startsWith('http://') &&
|
|
357
|
+
!this.config.remoteHost.startsWith('https://')) {
|
|
358
|
+
tnp_core_3.Helpers.throw("[taon-config] Your 'remoteHost' must start with http:// or https://");
|
|
312
359
|
}
|
|
313
|
-
this.config.host = overrideHost ? overrideHost : this.config.host;
|
|
314
|
-
this.config.remoteHost = overrideRemoteHost ? overrideRemoteHost : this.config.remoteHost;
|
|
315
|
-
// console.log(
|
|
316
|
-
// `[${
|
|
317
|
-
// this.contextName
|
|
318
|
-
// }] init context... from resolve: ${!!initFromRecrusiveContextResovle}`,
|
|
319
|
-
// );
|
|
320
|
-
//#region debug config
|
|
321
|
-
// console.log(
|
|
322
|
-
// `[taon][${this.config.contextName}] - resolve config from fn`,
|
|
323
|
-
// {
|
|
324
|
-
// config: this.config,
|
|
325
|
-
// },
|
|
326
|
-
// );
|
|
327
|
-
// for (const ctrlName of Object.keys(config.controllers || {})) {
|
|
328
|
-
// console.log(`${ctrlName} = ${!!config.controllers[ctrlName]}`);
|
|
329
|
-
// }
|
|
330
|
-
// for (const entityName of Object.keys(config.entities || {})) {
|
|
331
|
-
// console.log(`${entityName} = ${!!config.entities[entityName]}`);
|
|
332
|
-
// }
|
|
333
|
-
// for (const providersName of Object.keys(config.providers || {})) {
|
|
334
|
-
// console.log(`${providersName} = ${!!config.providers[providersName]}`);
|
|
335
|
-
// }
|
|
336
|
-
// for (const repositoryName of Object.keys(config.repositories || {})) {
|
|
337
|
-
// console.log(
|
|
338
|
-
// `${repositoryName} = ${!!config.repositories[repositoryName]}`,
|
|
339
|
-
// );
|
|
340
|
-
// }
|
|
341
|
-
//#endregion
|
|
342
360
|
//#region resolve mode
|
|
343
361
|
if (this.config.host) {
|
|
344
362
|
this.mode = 'backend-frontend(tcp+udp)';
|
|
@@ -347,12 +365,12 @@ var EndpointContext = /** @class */ (function () {
|
|
|
347
365
|
}
|
|
348
366
|
if (this.config.remoteHost) {
|
|
349
367
|
if (this.config.host) {
|
|
350
|
-
|
|
368
|
+
tnp_core_3.Helpers.throw("[taon] You can't have remoteHost and host at the same time");
|
|
351
369
|
}
|
|
352
370
|
this.mode = 'remote-backend(tcp+udp)';
|
|
353
371
|
}
|
|
354
|
-
if (this.config.useIpcWhenElectron &&
|
|
355
|
-
if (
|
|
372
|
+
if (this.config.useIpcWhenElectron && tnp_core_3.Helpers.isElectron) {
|
|
373
|
+
if (tnp_core_3.Helpers.isWebSQL) {
|
|
356
374
|
this.mode = 'backend-frontend(websql-electron)';
|
|
357
375
|
}
|
|
358
376
|
else {
|
|
@@ -360,7 +378,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
360
378
|
}
|
|
361
379
|
}
|
|
362
380
|
if (!this.mode && !this.config.abstract) {
|
|
363
|
-
|
|
381
|
+
tnp_core_3.Helpers.error("[taon] Context \"".concat(this.contextName, "\": You need to provide host or remoteHost or useIpcWhenElectron"), false, true);
|
|
364
382
|
//#region @backend
|
|
365
383
|
process.exit(1);
|
|
366
384
|
//#endregion
|
|
@@ -370,13 +388,13 @@ var EndpointContext = /** @class */ (function () {
|
|
|
370
388
|
if (this.config.database === true) {
|
|
371
389
|
this.databaseConfig = this.getAutoGeneratedConfig();
|
|
372
390
|
}
|
|
373
|
-
else if (
|
|
374
|
-
this.databaseConfig =
|
|
391
|
+
else if (tnp_core_3._.isObject(this.config.database)) {
|
|
392
|
+
this.databaseConfig = tnp_core_3._.merge(this.getAutoGeneratedConfig(), tnp_core_3._.cloneDeep(this.config.database));
|
|
375
393
|
}
|
|
376
394
|
//#endregion
|
|
377
395
|
//#region resolve session
|
|
378
396
|
if (this.config.session) {
|
|
379
|
-
this.session =
|
|
397
|
+
this.session = tnp_core_3._.cloneDeep(this.config.session);
|
|
380
398
|
oneHour = 1000 * 60 * 60 * 1;
|
|
381
399
|
if (!this.session.cookieMaxAge) {
|
|
382
400
|
this.session.cookieMaxAge = oneHour;
|
|
@@ -392,35 +410,41 @@ var EndpointContext = /** @class */ (function () {
|
|
|
392
410
|
this.config.repositories = this.config.repositories || {};
|
|
393
411
|
this.config.providers = this.config.providers || {};
|
|
394
412
|
this.config.subscribers = this.config.subscribers || {};
|
|
413
|
+
this.config.migrations = this.config.migrations || {};
|
|
395
414
|
_b = this.config;
|
|
396
415
|
_c = [{}];
|
|
397
416
|
return [4 /*yield*/, this.getRecrusiveClassesfromContextsObj(models_1.Models.ClassType.ENTITY)];
|
|
398
417
|
case 1:
|
|
399
|
-
_b.entities = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _c.concat([(
|
|
418
|
+
_b.entities = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _c.concat([(_x.sent())])), this.config.entities]);
|
|
400
419
|
_d = this.config;
|
|
401
420
|
_e = [{}];
|
|
402
421
|
return [4 /*yield*/, this.getRecrusiveClassesfromContextsObj(models_1.Models.ClassType.CONTROLLER)];
|
|
403
422
|
case 2:
|
|
404
|
-
_d.controllers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _e.concat([(
|
|
423
|
+
_d.controllers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _e.concat([(_x.sent())])), this.config.controllers]);
|
|
405
424
|
_f = this.config;
|
|
406
425
|
_g = [{}];
|
|
407
426
|
return [4 /*yield*/, this.getRecrusiveClassesfromContextsObj(models_1.Models.ClassType.PROVIDER)];
|
|
408
427
|
case 3:
|
|
409
|
-
_f.providers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _g.concat([(
|
|
428
|
+
_f.providers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _g.concat([(_x.sent())])), this.config.providers]);
|
|
410
429
|
_h = this.config;
|
|
411
430
|
_j = [{}];
|
|
412
431
|
return [4 /*yield*/, this.getRecrusiveClassesfromContextsObj(models_1.Models.ClassType.SUBSCRIBER)];
|
|
413
432
|
case 4:
|
|
414
|
-
_h.subscribers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _j.concat([(
|
|
433
|
+
_h.subscribers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _j.concat([(_x.sent())])), this.config.subscribers]);
|
|
415
434
|
_k = this.config;
|
|
416
435
|
_l = [{}];
|
|
417
436
|
return [4 /*yield*/, this.getRecrusiveClassesfromContextsObj(models_1.Models.ClassType.REPOSITORY)];
|
|
418
437
|
case 5:
|
|
419
|
-
_k.repositories = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _l.concat([(
|
|
438
|
+
_k.repositories = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _l.concat([(_x.sent())])), this.config.repositories]);
|
|
439
|
+
_m = this.config;
|
|
440
|
+
_o = [{}];
|
|
441
|
+
return [4 /*yield*/, this.getRecrusiveClassesfromContextsObj(models_1.Models.ClassType.MIGRATION)];
|
|
442
|
+
case 6:
|
|
443
|
+
_m.migrations = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _o.concat([(_x.sent())])), this.config.migrations]);
|
|
420
444
|
// console.log(this.config);
|
|
421
445
|
// debugger;
|
|
422
446
|
//#endregion
|
|
423
|
-
//#region prepare classes instances/
|
|
447
|
+
//#region prepare classes instances/functions clones
|
|
424
448
|
this.config.controllers = this.cloneClassesObjWithNewMetadata({
|
|
425
449
|
classesInput: this.config.controllers,
|
|
426
450
|
config: this.config,
|
|
@@ -445,11 +469,17 @@ var EndpointContext = /** @class */ (function () {
|
|
|
445
469
|
ctx: this,
|
|
446
470
|
classType: models_1.Models.ClassType.SUBSCRIBER,
|
|
447
471
|
});
|
|
472
|
+
this.config.migrations = this.cloneClassesObjWithNewMetadata({
|
|
473
|
+
classesInput: this.config.migrations,
|
|
474
|
+
config: this.config,
|
|
475
|
+
ctx: this,
|
|
476
|
+
classType: models_1.Models.ClassType.MIGRATION,
|
|
477
|
+
});
|
|
448
478
|
try {
|
|
449
479
|
//#endregion
|
|
450
480
|
//#region prepare instances
|
|
451
|
-
for (
|
|
452
|
-
classTypeName =
|
|
481
|
+
for (_p = tslib_1.__values(this.injectableTypesfromContexts), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
482
|
+
classTypeName = _q.value;
|
|
453
483
|
this.classInstancesByNameObj[classTypeName] = {};
|
|
454
484
|
this.objWithClassesInstancesArr[classTypeName] = [];
|
|
455
485
|
}
|
|
@@ -457,81 +487,83 @@ var EndpointContext = /** @class */ (function () {
|
|
|
457
487
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
458
488
|
finally {
|
|
459
489
|
try {
|
|
460
|
-
if (
|
|
490
|
+
if (_q && !_q.done && (_t = _p.return)) _t.call(_p);
|
|
461
491
|
}
|
|
462
492
|
finally { if (e_3) throw e_3.error; }
|
|
463
493
|
}
|
|
464
|
-
|
|
465
|
-
case 6:
|
|
466
|
-
_v.trys.push([6, 11, 12, 13]);
|
|
467
|
-
_p = tslib_1.__values(this.injectableTypesfromContexts), _q = _p.next();
|
|
468
|
-
_v.label = 7;
|
|
494
|
+
_x.label = 7;
|
|
469
495
|
case 7:
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
496
|
+
_x.trys.push([7, 12, 13, 14]);
|
|
497
|
+
_r = tslib_1.__values(this.injectableTypesfromContexts), _s = _r.next();
|
|
498
|
+
_x.label = 8;
|
|
473
499
|
case 8:
|
|
474
|
-
|
|
475
|
-
|
|
500
|
+
if (!!_s.done) return [3 /*break*/, 11];
|
|
501
|
+
classTypeName = _s.value;
|
|
502
|
+
return [4 /*yield*/, this.createInstances(this.config[models_1.Models.ClassTypeKey[classTypeName]], classTypeName)];
|
|
476
503
|
case 9:
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
case 10:
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
return [3 /*break*/, 13];
|
|
504
|
+
_x.sent();
|
|
505
|
+
_x.label = 10;
|
|
506
|
+
case 10:
|
|
507
|
+
_s = _r.next();
|
|
508
|
+
return [3 /*break*/, 8];
|
|
509
|
+
case 11: return [3 /*break*/, 14];
|
|
484
510
|
case 12:
|
|
511
|
+
e_2_1 = _x.sent();
|
|
512
|
+
e_2 = { error: e_2_1 };
|
|
513
|
+
return [3 /*break*/, 14];
|
|
514
|
+
case 13:
|
|
485
515
|
try {
|
|
486
|
-
if (
|
|
516
|
+
if (_s && !_s.done && (_u = _r.return)) _u.call(_r);
|
|
487
517
|
}
|
|
488
518
|
finally { if (e_2) throw e_2.error; }
|
|
489
519
|
return [7 /*endfinally*/];
|
|
490
|
-
case
|
|
520
|
+
case 14:
|
|
491
521
|
//#endregion
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
522
|
+
if (!this.isRunOrRevertOnlyMigrationAppStart) {
|
|
523
|
+
//#region prepares server
|
|
524
|
+
if (this.mode === 'backend-frontend(tcp+udp)' && !this.config.abstract) {
|
|
525
|
+
//#region @backend
|
|
526
|
+
this.expressApp = express();
|
|
527
|
+
this.initMiddlewares();
|
|
528
|
+
this.serverTcpUdp = this.isHttpServer
|
|
529
|
+
? new tnp_core_1.https.Server({
|
|
530
|
+
key: (_v = this.config.https) === null || _v === void 0 ? void 0 : _v.key,
|
|
531
|
+
cert: (_w = this.config.https) === null || _w === void 0 ? void 0 : _w.cert,
|
|
532
|
+
}, this.expressApp)
|
|
533
|
+
: new tnp_core_1.http.Server(this.expressApp);
|
|
534
|
+
this.publicAssets.forEach(function (asset) {
|
|
535
|
+
_this.expressApp.use(asset.serverPath, express.static(asset.locationOnDisk));
|
|
536
|
+
});
|
|
537
|
+
//#endregion
|
|
538
|
+
}
|
|
506
539
|
//#endregion
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
540
|
+
//#region prepare realtime
|
|
541
|
+
if (!this.config.abstract) {
|
|
542
|
+
this.disabledRealtime = !!this.config.disabledRealtime;
|
|
543
|
+
//#region @backend
|
|
544
|
+
if (tnp_core_3.Helpers.isRunningIn.cliMode()) {
|
|
545
|
+
// TODO for now...
|
|
546
|
+
this.disabledRealtime = true;
|
|
547
|
+
}
|
|
548
|
+
//#endregion
|
|
549
|
+
this.realtime = new realtime_core_1.RealtimeCore(this);
|
|
516
550
|
}
|
|
517
551
|
//#endregion
|
|
518
|
-
this.realtime = new realtime_core_1.RealtimeCore(this);
|
|
519
552
|
}
|
|
520
|
-
//#endregion
|
|
521
553
|
//#region show context info
|
|
522
554
|
// console.log({ ref })
|
|
523
555
|
if (this.config.abstract) {
|
|
524
556
|
this.logFramework &&
|
|
525
|
-
|
|
557
|
+
tnp_core_3.Helpers.info("[taon] Create abstract context: ".concat(this.config.contextName));
|
|
526
558
|
}
|
|
527
559
|
else {
|
|
528
560
|
if (this.config.remoteHost) {
|
|
529
561
|
this.logFramework &&
|
|
530
|
-
|
|
562
|
+
tnp_core_3.Helpers.info("[taon] Create context for remote host: ".concat(this.config.remoteHost));
|
|
531
563
|
}
|
|
532
564
|
else {
|
|
533
565
|
this.logFramework &&
|
|
534
|
-
|
|
566
|
+
tnp_core_3.Helpers.info("[taon] Create context for host: ".concat(this.config.host));
|
|
535
567
|
}
|
|
536
568
|
}
|
|
537
569
|
//#endregion
|
|
@@ -548,81 +580,67 @@ var EndpointContext = /** @class */ (function () {
|
|
|
548
580
|
//#region methods & getters / get auto generated config
|
|
549
581
|
EndpointContext.prototype.getAutoGeneratedConfig = function () {
|
|
550
582
|
//#region @websqlFunc
|
|
551
|
-
var databaseConfig;
|
|
552
|
-
if (tnp_core_2.
|
|
553
|
-
|
|
583
|
+
var databaseConfig = models_1.Models.DatabaseConfig.from({});
|
|
584
|
+
if (tnp_core_2.UtilsOs.isRunningInDocker()) {
|
|
585
|
+
tnp_core_3.Helpers.info('Running in docker, using in mysql database');
|
|
554
586
|
// TODO auto resolve database config in docker
|
|
555
|
-
databaseConfig = {
|
|
556
|
-
database: "
|
|
587
|
+
databaseConfig = models_1.Models.DatabaseConfig.from({
|
|
588
|
+
database: "db-".concat(this.contextName, ".sqlite"),
|
|
557
589
|
type: 'mysql',
|
|
558
|
-
|
|
559
|
-
synchronize: true,
|
|
560
|
-
dropSchema: true,
|
|
590
|
+
recreateMode: 'PRESERVE_DATA+MIGRATIONS',
|
|
561
591
|
logging: this.logDb,
|
|
562
592
|
databasePort: 3306,
|
|
563
593
|
databaseHost: 'localhost',
|
|
564
594
|
databaseUsername: 'root',
|
|
565
595
|
databasePassword: 'admin',
|
|
566
|
-
};
|
|
596
|
+
});
|
|
567
597
|
}
|
|
568
598
|
else {
|
|
569
599
|
this.logFramework &&
|
|
570
|
-
|
|
600
|
+
tnp_core_3.Helpers.info("[taon][database] Automatically resolving database config for mode ".concat(this.mode));
|
|
571
601
|
switch (this.mode) {
|
|
572
602
|
//#region resolve database config for mode backend-frontend(tcp+udp)
|
|
573
603
|
case 'backend-frontend(ipc-electron)':
|
|
574
|
-
|
|
575
|
-
location: "
|
|
604
|
+
databaseConfig = models_1.Models.DatabaseConfig.from({
|
|
605
|
+
location: "db-".concat(this.contextName, ".sqlite"),
|
|
576
606
|
type: 'sqljs',
|
|
577
|
-
|
|
578
|
-
synchronize: true,
|
|
579
|
-
dropSchema: true,
|
|
607
|
+
recreateMode: 'DROP_DB+MIGRATIONS',
|
|
580
608
|
logging: this.logDb,
|
|
581
|
-
};
|
|
609
|
+
});
|
|
582
610
|
break;
|
|
583
611
|
//#endregion
|
|
584
612
|
//#region resolve database config for mode backend-frontend(websql)
|
|
585
613
|
case 'backend-frontend(websql-electron)':
|
|
586
614
|
case 'backend-frontend(websql)':
|
|
587
|
-
databaseConfig = {
|
|
588
|
-
location: "tmp-db-".concat(tnp_core_2._.kebabCase(this.contextName), ".sqljs"),
|
|
589
|
-
type: 'sqljs',
|
|
590
|
-
useLocalForage: true, // !!window['localforage'], // TODO this need to be checked in runtime
|
|
591
|
-
autoSave: true,
|
|
592
|
-
synchronize: true,
|
|
593
|
-
dropSchema: true,
|
|
594
|
-
logging: this.logDb,
|
|
595
|
-
};
|
|
596
615
|
var keepWebsqlDbDataAfterReload = false;
|
|
597
616
|
/* */
|
|
598
617
|
/* */
|
|
599
618
|
/* */
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
619
|
+
databaseConfig = databaseConfig = models_1.Models.DatabaseConfig.from({
|
|
620
|
+
location: "db-".concat(this.contextName, ".sqlite"),
|
|
621
|
+
type: 'sqljs',
|
|
622
|
+
useLocalForage: true, // !!window['localforage'], // TODO this need to be checked in runtime
|
|
623
|
+
recreateMode: keepWebsqlDbDataAfterReload
|
|
624
|
+
? 'PRESERVE_DATA+MIGRATIONS'
|
|
625
|
+
: 'DROP_DB+MIGRATIONS',
|
|
626
|
+
logging: this.logDb,
|
|
627
|
+
});
|
|
608
628
|
break;
|
|
609
629
|
//#endregion
|
|
610
630
|
//#region resolve database config for mode backend-frontend(tcp+udp)
|
|
611
631
|
case 'backend-frontend(tcp+udp)':
|
|
612
|
-
databaseConfig = {
|
|
613
|
-
database: "context-db-".concat(
|
|
614
|
-
location: "
|
|
632
|
+
databaseConfig = models_1.Models.DatabaseConfig.from({
|
|
633
|
+
database: "context-db-".concat(this.contextName),
|
|
634
|
+
location: "db-".concat(this.contextName, ".sqlite"),
|
|
615
635
|
type: 'sqljs',
|
|
616
|
-
|
|
617
|
-
synchronize: true,
|
|
618
|
-
dropSchema: true,
|
|
636
|
+
recreateMode: 'DROP_DB+MIGRATIONS',
|
|
619
637
|
logging: this.logDb,
|
|
620
|
-
};
|
|
638
|
+
});
|
|
621
639
|
break;
|
|
622
640
|
//#endregion
|
|
623
641
|
}
|
|
624
642
|
}
|
|
625
|
-
return databaseConfig;
|
|
643
|
+
return databaseConfig.databaseConfigTypeORM;
|
|
626
644
|
//#endregion
|
|
627
645
|
};
|
|
628
646
|
Object.defineProperty(EndpointContext.prototype, "ngZone", {
|
|
@@ -641,18 +659,18 @@ var EndpointContext = /** @class */ (function () {
|
|
|
641
659
|
EndpointContext.prototype.startServer = function () {
|
|
642
660
|
var _this = this;
|
|
643
661
|
//#region @backendFunc
|
|
644
|
-
if (this.remoteHost) {
|
|
662
|
+
if (this.remoteHost || this.isRunOrRevertOnlyMigrationAppStart) {
|
|
645
663
|
return;
|
|
646
664
|
}
|
|
647
665
|
if (this.mode === 'backend-frontend(tcp+udp)') {
|
|
648
666
|
// this.displayRoutes(this.expressApp);
|
|
649
667
|
this.serverTcpUdp.listen(Number(this.uri.port), function () {
|
|
650
|
-
|
|
668
|
+
tnp_core_3.Helpers.log("[taon][express-server]listening on port: ".concat(_this.uri.port, ", hostname: ").concat(_this.uri.pathname, ",\n address: ").concat(_this.uri.protocol, "//localhost:").concat(_this.uri.port).concat(_this.uri.pathname, "\n env: ").concat(_this.expressApp.settings.env, "\n "));
|
|
651
669
|
});
|
|
652
670
|
}
|
|
653
671
|
else {
|
|
654
672
|
this.logFramework &&
|
|
655
|
-
|
|
673
|
+
tnp_core_3.Helpers.info('Ipc communication enable instead tcp/upd');
|
|
656
674
|
}
|
|
657
675
|
//#endregion
|
|
658
676
|
};
|
|
@@ -828,14 +846,29 @@ var EndpointContext = /** @class */ (function () {
|
|
|
828
846
|
* alias for inject
|
|
829
847
|
*/
|
|
830
848
|
EndpointContext.prototype.getInstanceBy = function (ctor) {
|
|
849
|
+
// if (!!this.__contextForControllerInstanceAccess) {
|
|
850
|
+
// const className = ClassHelpers.getName(ctor);
|
|
851
|
+
// const allControllers = this.getClassFunByArr(Models.ClassType.CONTROLLER);
|
|
852
|
+
// // TODO QUICK_FIX cache controllers
|
|
853
|
+
// for (const ctrl of allControllers) {
|
|
854
|
+
// if (ClassHelpers.getName(ctrl) === className) {
|
|
855
|
+
// // console.log('injecting from contextForControllerInstanceAcesss', className);
|
|
856
|
+
// return this.__contextForControllerInstanceAccess.inject(ctor, {
|
|
857
|
+
// localInstance: false,
|
|
858
|
+
// });
|
|
859
|
+
// }
|
|
860
|
+
// }
|
|
861
|
+
// }
|
|
831
862
|
return this.inject(ctor, { localInstance: false });
|
|
832
863
|
};
|
|
833
864
|
//#endregion
|
|
865
|
+
//#region methods & getters / check if context initialized
|
|
834
866
|
EndpointContext.prototype.checkIfContextInitialized = function () {
|
|
835
|
-
if (
|
|
867
|
+
if (tnp_core_3._.isUndefined(this.config)) {
|
|
836
868
|
throw new Error("Please check if your context has been initialized.\n\n // ...\n await Context.initialize();\n // ...\n\n\n ");
|
|
837
869
|
}
|
|
838
870
|
};
|
|
871
|
+
//#endregion
|
|
839
872
|
//#region methods & getters / get class function by class type name
|
|
840
873
|
EndpointContext.prototype.getClassFunBy = function (classType) {
|
|
841
874
|
this.checkIfContextInitialized();
|
|
@@ -850,6 +883,8 @@ var EndpointContext = /** @class */ (function () {
|
|
|
850
883
|
return this.config.repositories;
|
|
851
884
|
case models_1.Models.ClassType.SUBSCRIBER:
|
|
852
885
|
return this.config.subscribers;
|
|
886
|
+
case models_1.Models.ClassType.MIGRATION:
|
|
887
|
+
return this.config.migrations;
|
|
853
888
|
}
|
|
854
889
|
};
|
|
855
890
|
EndpointContext.prototype.isCLassType = function (classType, classFn) {
|
|
@@ -930,7 +965,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
930
965
|
return tslib_1.__generator(this, function (_b) {
|
|
931
966
|
switch (_b.label) {
|
|
932
967
|
case 0:
|
|
933
|
-
if (this.remoteHost) {
|
|
968
|
+
if (this.remoteHost || Object.keys(this.config.migrations).length > 0) {
|
|
934
969
|
return [2 /*return*/];
|
|
935
970
|
}
|
|
936
971
|
controllers = this.getClassesInstancesArrBy(models_1.Models.ClassType.CONTROLLER);
|
|
@@ -942,8 +977,8 @@ var EndpointContext = /** @class */ (function () {
|
|
|
942
977
|
case 2:
|
|
943
978
|
if (!!controllers_1_1.done) return [3 /*break*/, 5];
|
|
944
979
|
ctrl = controllers_1_1.value;
|
|
945
|
-
if (!
|
|
946
|
-
return [4 /*yield*/,
|
|
980
|
+
if (!tnp_core_3._.isFunction(ctrl.initExampleDbData)) return [3 /*break*/, 4];
|
|
981
|
+
return [4 /*yield*/, tnp_core_3.Helpers.runSyncOrAsync({
|
|
947
982
|
functionFn: ctrl.initExampleDbData,
|
|
948
983
|
context: ctrl,
|
|
949
984
|
})];
|
|
@@ -987,6 +1022,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
987
1022
|
models_1.Models.ClassType.REPOSITORY,
|
|
988
1023
|
models_1.Models.ClassType.CONTROLLER,
|
|
989
1024
|
models_1.Models.ClassType.ENTITY,
|
|
1025
|
+
models_1.Models.ClassType.MIGRATION,
|
|
990
1026
|
]), _b = _a.next();
|
|
991
1027
|
_o.label = 2;
|
|
992
1028
|
case 2:
|
|
@@ -1000,8 +1036,8 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1000
1036
|
case 4:
|
|
1001
1037
|
if (!!_d.done) return [3 /*break*/, 7];
|
|
1002
1038
|
classFun = _d.value;
|
|
1003
|
-
if (!
|
|
1004
|
-
return [4 /*yield*/,
|
|
1039
|
+
if (!tnp_core_3._.isFunction(classFun._)) return [3 /*break*/, 6];
|
|
1040
|
+
return [4 /*yield*/, tnp_core_3.Helpers.runSyncOrAsync({
|
|
1005
1041
|
functionFn: classFun._,
|
|
1006
1042
|
context: classFun,
|
|
1007
1043
|
})];
|
|
@@ -1042,6 +1078,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1042
1078
|
models_1.Models.ClassType.PROVIDER,
|
|
1043
1079
|
models_1.Models.ClassType.REPOSITORY,
|
|
1044
1080
|
models_1.Models.ClassType.CONTROLLER,
|
|
1081
|
+
models_1.Models.ClassType.MIGRATION,
|
|
1045
1082
|
]), _f = _e.next();
|
|
1046
1083
|
_o.label = 15;
|
|
1047
1084
|
case 15:
|
|
@@ -1055,8 +1092,8 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1055
1092
|
case 17:
|
|
1056
1093
|
if (!!_h.done) return [3 /*break*/, 20];
|
|
1057
1094
|
ctrl = _h.value;
|
|
1058
|
-
if (!
|
|
1059
|
-
return [4 /*yield*/,
|
|
1095
|
+
if (!tnp_core_3._.isFunction(ctrl._)) return [3 /*break*/, 19];
|
|
1096
|
+
return [4 /*yield*/, tnp_core_3.Helpers.runSyncOrAsync({
|
|
1060
1097
|
functionFn: ctrl._,
|
|
1061
1098
|
context: ctrl,
|
|
1062
1099
|
})];
|
|
@@ -1232,11 +1269,11 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1232
1269
|
for (entities_1 = tslib_1.__values(entities), entities_1_1 = entities_1.next(); !entities_1_1.done; entities_1_1 = entities_1.next()) {
|
|
1233
1270
|
entity = entities_1_1.value;
|
|
1234
1271
|
options = Reflect.getMetadata(symbols_1.Symbols.metadata.options.entity, entity);
|
|
1235
|
-
createTable =
|
|
1272
|
+
createTable = tnp_core_3._.isUndefined(options.createTable)
|
|
1236
1273
|
? true
|
|
1237
1274
|
: options.createTable;
|
|
1238
1275
|
nameForEntity = class_helpers_1.ClassHelpers.getName(entity);
|
|
1239
|
-
if (
|
|
1276
|
+
if (tnp_core_3._.isUndefined(options.createTable) ? true : options.createTable) {
|
|
1240
1277
|
this.logDb &&
|
|
1241
1278
|
console.info("[taon][typeorm] create table for entity \"".concat(nameForEntity, "\" ? '").concat(createTable, "'"));
|
|
1242
1279
|
// console.log('TypeormEntity', { TypeormEntity });
|
|
@@ -1264,23 +1301,19 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1264
1301
|
EndpointContext.prototype.initDatabaseConnection = function () {
|
|
1265
1302
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1266
1303
|
var entities, subscribers, dataSourceDbConfig, connection, error_1;
|
|
1267
|
-
var _a, _b
|
|
1268
|
-
return tslib_1.__generator(this, function (
|
|
1269
|
-
switch (
|
|
1304
|
+
var _a, _b;
|
|
1305
|
+
return tslib_1.__generator(this, function (_c) {
|
|
1306
|
+
switch (_c.label) {
|
|
1270
1307
|
case 0:
|
|
1271
1308
|
//#region @websqlFunc
|
|
1272
1309
|
if (this.remoteHost) {
|
|
1273
1310
|
return [2 /*return*/];
|
|
1274
1311
|
}
|
|
1275
|
-
entities =
|
|
1276
|
-
? this.config.override.entities
|
|
1277
|
-
: this.getClassFunByArr(models_1.Models.ClassType.ENTITY)).map(function (entityFn) {
|
|
1312
|
+
entities = this.getClassFunByArr(models_1.Models.ClassType.ENTITY).map(function (entityFn) {
|
|
1278
1313
|
return class_helpers_1.ClassHelpers.getOrginalClass(entityFn);
|
|
1279
1314
|
});
|
|
1280
|
-
subscribers =
|
|
1281
|
-
|
|
1282
|
-
: this.getClassFunByArr(models_1.Models.ClassType.SUBSCRIBER);
|
|
1283
|
-
dataSourceDbConfig = tnp_core_2._.isObject(this.databaseConfig)
|
|
1315
|
+
subscribers = this.getClassFunByArr(models_1.Models.ClassType.SUBSCRIBER);
|
|
1316
|
+
dataSourceDbConfig = tnp_core_3._.isObject(this.databaseConfig)
|
|
1284
1317
|
? {
|
|
1285
1318
|
type: this.databaseConfig.type,
|
|
1286
1319
|
port: this.databaseConfig.databasePort,
|
|
@@ -1289,11 +1322,18 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1289
1322
|
username: this.databaseConfig.databaseUsername,
|
|
1290
1323
|
password: this.databaseConfig.databasePassword,
|
|
1291
1324
|
useLocalForage: this.databaseConfig.useLocalForage,
|
|
1325
|
+
// I am not using typeorm migration system
|
|
1292
1326
|
entities: entities,
|
|
1293
1327
|
subscribers: subscribers,
|
|
1294
|
-
synchronize: this.
|
|
1295
|
-
|
|
1296
|
-
|
|
1328
|
+
synchronize: this.isRunOrRevertOnlyMigrationAppStart
|
|
1329
|
+
? false
|
|
1330
|
+
: this.databaseConfig.synchronize,
|
|
1331
|
+
autoSave: !tnp_core_3._.isNil(this.databaseConfig.autoSave)
|
|
1332
|
+
? this.databaseConfig.autoSave
|
|
1333
|
+
: !tnp_core_2.UtilsOs.isRunningInDocker(), // in docker I am using mysql or posgress
|
|
1334
|
+
dropSchema: this.isRunOrRevertOnlyMigrationAppStart
|
|
1335
|
+
? false
|
|
1336
|
+
: this.databaseConfig.dropSchema,
|
|
1297
1337
|
logging: !!this.databaseConfig.logging,
|
|
1298
1338
|
location: this.databaseConfig.location,
|
|
1299
1339
|
}
|
|
@@ -1304,34 +1344,36 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1304
1344
|
if (!(this.modeAllowsDatabaseCreation && this.databaseConfig)) return [3 /*break*/, 5];
|
|
1305
1345
|
this.logDb &&
|
|
1306
1346
|
this.logFramework &&
|
|
1307
|
-
|
|
1308
|
-
|
|
1347
|
+
tnp_core_3.Helpers.info('[taon][database] prepare typeorm connection...');
|
|
1348
|
+
_c.label = 1;
|
|
1309
1349
|
case 1:
|
|
1310
|
-
|
|
1350
|
+
_c.trys.push([1, 3, , 4]);
|
|
1311
1351
|
connection = new taon_typeorm_3.DataSource(dataSourceDbConfig);
|
|
1312
1352
|
this.connection = connection;
|
|
1313
1353
|
return [4 /*yield*/, this.connection.initialize()];
|
|
1314
1354
|
case 2:
|
|
1315
|
-
|
|
1355
|
+
_c.sent();
|
|
1316
1356
|
return [3 /*break*/, 4];
|
|
1317
1357
|
case 3:
|
|
1318
|
-
error_1 =
|
|
1358
|
+
error_1 = _c.sent();
|
|
1319
1359
|
console.error((error_1 === null || error_1 === void 0 ? void 0 : error_1.message) || error_1);
|
|
1320
1360
|
return [3 /*break*/, 4];
|
|
1321
1361
|
case 4:
|
|
1322
|
-
if (!((
|
|
1362
|
+
if (!((_a = this.connection) === null || _a === void 0 ? void 0 : _a.isInitialized)) {
|
|
1323
1363
|
console.log('WRONG CONFIG', dataSourceDbConfig);
|
|
1324
1364
|
throw new Error("Something wrong with connection init in ".concat(this.mode));
|
|
1325
1365
|
//#region @backend
|
|
1326
1366
|
process.exit(1);
|
|
1327
1367
|
//#endregion
|
|
1328
1368
|
}
|
|
1329
|
-
(this.logDb || this.logFramework)
|
|
1330
|
-
console.info("\n\n CONTECTION OK for ".concat(this.contextName, " - ").concat(this.mode, "\n\n [taon][typeorm] db prepration done.. db initialize=").concat((
|
|
1369
|
+
if (this.logDb || this.logFramework) {
|
|
1370
|
+
console.info("\n\n CONTECTION OK for ".concat(this.contextName, " - ").concat(this.mode, "\n\n [taon][typeorm] db prepration done.. db initialize=").concat((_b = this.connection) === null || _b === void 0 ? void 0 : _b.isInitialized, "\n\n\n "), dataSourceDbConfig, { 'this.connection': !!this.connection });
|
|
1371
|
+
console.log("Database file location: ".concat(this.connection.options.database));
|
|
1372
|
+
}
|
|
1331
1373
|
return [3 /*break*/, 6];
|
|
1332
1374
|
case 5:
|
|
1333
|
-
|
|
1334
|
-
|
|
1375
|
+
tnp_core_3.Helpers.info("[taon][typeorm] Not initing db for mode ".concat(this.mode));
|
|
1376
|
+
_c.label = 6;
|
|
1335
1377
|
case 6: return [2 /*return*/];
|
|
1336
1378
|
}
|
|
1337
1379
|
});
|
|
@@ -1339,9 +1381,12 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1339
1381
|
};
|
|
1340
1382
|
//#endregion
|
|
1341
1383
|
//#region methods & getters / initialize metadata
|
|
1342
|
-
EndpointContext.prototype.
|
|
1384
|
+
EndpointContext.prototype.initControllers = function () {
|
|
1343
1385
|
var e_14, _a;
|
|
1344
1386
|
var _this = this;
|
|
1387
|
+
if (this.isRunOrRevertOnlyMigrationAppStart) {
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1345
1390
|
var allControllers = this.getClassFunByArr(models_1.Models.ClassType.CONTROLLER);
|
|
1346
1391
|
var _loop_1 = function (controllerClassFn) {
|
|
1347
1392
|
controllerClassFn[symbols_1.Symbols.classMethodsNames] =
|
|
@@ -1349,7 +1394,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1349
1394
|
var configs = class_helpers_1.ClassHelpers.getControllerConfigs(controllerClassFn);
|
|
1350
1395
|
// console.log(`Class config for ${ClassHelpers.getName(controllerClassFn)}`, configs)
|
|
1351
1396
|
var classConfig = configs[0];
|
|
1352
|
-
var parentscalculatedPath =
|
|
1397
|
+
var parentscalculatedPath = tnp_core_3._.slice(configs, 1)
|
|
1353
1398
|
.reverse()
|
|
1354
1399
|
.map(function (bc) {
|
|
1355
1400
|
if (taon_helpers_1.TaonHelpers.isGoodPath(bc.path)) {
|
|
@@ -1367,13 +1412,13 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1367
1412
|
.replace(/\/\//g, '/')
|
|
1368
1413
|
.split('/')
|
|
1369
1414
|
.reduce(function (acc, bc) {
|
|
1370
|
-
return
|
|
1415
|
+
return tnp_core_3._.last(acc) === bc ? acc : tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(acc), false), [bc], false);
|
|
1371
1416
|
}, [])
|
|
1372
1417
|
.join('/');
|
|
1373
1418
|
}
|
|
1374
|
-
|
|
1419
|
+
tnp_core_3._.slice(configs, 1).forEach(function (bc) {
|
|
1375
1420
|
var alreadyIs = classConfig.methods;
|
|
1376
|
-
var toMerge =
|
|
1421
|
+
var toMerge = tnp_core_3._.cloneDeep(bc.methods);
|
|
1377
1422
|
for (var key in toMerge) {
|
|
1378
1423
|
if (toMerge.hasOwnProperty(key) && !alreadyIs[key]) {
|
|
1379
1424
|
var element = toMerge[key];
|
|
@@ -1382,7 +1427,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1382
1427
|
}
|
|
1383
1428
|
});
|
|
1384
1429
|
//#region @backend
|
|
1385
|
-
if (!
|
|
1430
|
+
if (!tnp_core_3.Helpers.isRunningIn.cliMode()) {
|
|
1386
1431
|
//#endregion
|
|
1387
1432
|
this_1.logHttp &&
|
|
1388
1433
|
console.groupCollapsed("[taon][express-server] routes [".concat(classConfig.className, "]"));
|
|
@@ -1399,7 +1444,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1399
1444
|
? "/".concat((_a = methodConfig.path) === null || _a === void 0 ? void 0 : _a.replace(/\//, ''))
|
|
1400
1445
|
: taon_helpers_1.TaonHelpers.getExpressPath(classConfig, methodConfig);
|
|
1401
1446
|
// console.log({ expressPath })
|
|
1402
|
-
if (
|
|
1447
|
+
if (tnp_core_3.Helpers.isNode || tnp_core_3.Helpers.isWebSQL) {
|
|
1403
1448
|
//#region @websql
|
|
1404
1449
|
var _b = _this.initServer(type, methodConfig, classConfig, expressPath, controllerClassFn), routePath = _b.routePath, method = _b.method;
|
|
1405
1450
|
_this.activeRoutes.push({
|
|
@@ -1408,7 +1453,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1408
1453
|
});
|
|
1409
1454
|
//#endregion
|
|
1410
1455
|
}
|
|
1411
|
-
var shouldInitClient =
|
|
1456
|
+
var shouldInitClient = tnp_core_3.Helpers.isBrowser || _this.remoteHost || tnp_core_3.Helpers.isWebSQL;
|
|
1412
1457
|
// console.log('shouldInitClient', shouldInitClient);
|
|
1413
1458
|
if (shouldInitClient) {
|
|
1414
1459
|
// console.log(
|
|
@@ -1422,7 +1467,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1422
1467
|
}
|
|
1423
1468
|
});
|
|
1424
1469
|
//#region @backend
|
|
1425
|
-
if (!
|
|
1470
|
+
if (!tnp_core_3.Helpers.isRunningIn.cliMode()) {
|
|
1426
1471
|
//#endregion
|
|
1427
1472
|
this_1.logHttp && console.groupEnd();
|
|
1428
1473
|
//#region @backend
|
|
@@ -1448,7 +1493,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1448
1493
|
//#region methods & getters / write active routes
|
|
1449
1494
|
EndpointContext.prototype.writeActiveRoutes = function () {
|
|
1450
1495
|
var _this = this;
|
|
1451
|
-
if (this.remoteHost) {
|
|
1496
|
+
if (this.remoteHost || this.isRunOrRevertOnlyMigrationAppStart) {
|
|
1452
1497
|
return;
|
|
1453
1498
|
}
|
|
1454
1499
|
var contexts = [this];
|
|
@@ -1462,11 +1507,11 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1462
1507
|
// .fillUpTo(10)}${context.uri.href.replace(/\/$/, '')}${routePath}`
|
|
1463
1508
|
});
|
|
1464
1509
|
var routes = tslib_1.__spreadArray(tslib_1.__spreadArray([], ['', "---------- FOR HOST ".concat(this.uri.href, " ----------")], false), tslib_1.__read(troutes), false);
|
|
1465
|
-
var fileName =
|
|
1510
|
+
var fileName = tnp_core_4.path.join(
|
|
1466
1511
|
//#region @backend
|
|
1467
1512
|
process.cwd(),
|
|
1468
1513
|
//#endregion
|
|
1469
|
-
"tmp-routes-".concat(
|
|
1514
|
+
"tmp-routes-".concat(tnp_core_3._.kebabCase(this.config.contextName), ".json"));
|
|
1470
1515
|
this.logFramework && console.log("[taon] routes file: ".concat(fileName, " "));
|
|
1471
1516
|
// Helpers.log(JSON.stringify(routes, null, 4))
|
|
1472
1517
|
//#region @backend
|
|
@@ -1509,7 +1554,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1509
1554
|
app.use(methodOverride());
|
|
1510
1555
|
app.use(cookieParser());
|
|
1511
1556
|
if (this.session) {
|
|
1512
|
-
|
|
1557
|
+
tnp_core_3.Helpers.info('[taon][express-server] session enabled for this context ' +
|
|
1513
1558
|
this.contextName);
|
|
1514
1559
|
var cookieMaxAge = this.session.cookieMaxAge;
|
|
1515
1560
|
var frontendHost = this.config.frontendHost;
|
|
@@ -1531,7 +1576,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1531
1576
|
else {
|
|
1532
1577
|
// if(this.config?.serverLogs) {
|
|
1533
1578
|
this.logHttp &&
|
|
1534
|
-
|
|
1579
|
+
tnp_core_3.Helpers.info("[taon][express-server] session not enabled for this context '".concat(this.contextName, "'"));
|
|
1535
1580
|
// }
|
|
1536
1581
|
app.use(cors({
|
|
1537
1582
|
// origin: "http://localhost:5555",
|
|
@@ -1617,10 +1662,10 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1617
1662
|
expressPath = expressPath.replace(/\/\//g, '/');
|
|
1618
1663
|
// console.log(`BACKEND: expressPath: ${ expressPath } `)
|
|
1619
1664
|
//#endregion
|
|
1620
|
-
if (
|
|
1665
|
+
if (tnp_core_3.Helpers.isElectron) {
|
|
1621
1666
|
//#region @backend
|
|
1622
1667
|
var ipcKeyName = taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath);
|
|
1623
|
-
|
|
1668
|
+
tnp_core_3.Helpers.ipcMain.on(ipcKeyName, function (event, paramsFromBrowser) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
1624
1669
|
var responseJsonData;
|
|
1625
1670
|
return tslib_1.__generator(this, function (_a) {
|
|
1626
1671
|
switch (_a.label) {
|
|
@@ -1641,7 +1686,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1641
1686
|
if (!this.remoteHost) {
|
|
1642
1687
|
//#region apply dummy websql express routers
|
|
1643
1688
|
//#region @websql
|
|
1644
|
-
if (
|
|
1689
|
+
if (tnp_core_3.Helpers.isWebSQL) {
|
|
1645
1690
|
if (!this.expressApp[type.toLowerCase()]) {
|
|
1646
1691
|
this.expressApp[type.toLowerCase()] = function () { };
|
|
1647
1692
|
}
|
|
@@ -1703,7 +1748,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1703
1748
|
try {
|
|
1704
1749
|
var entityForParam = JSON.parse(req.headers["".concat(symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS).concat(queryParamName, " ")]);
|
|
1705
1750
|
var beforeTransofrm = tQuery[queryParamName];
|
|
1706
|
-
if (
|
|
1751
|
+
if (tnp_core_3._.isString(beforeTransofrm)) {
|
|
1707
1752
|
try {
|
|
1708
1753
|
var paresed = taon_helpers_1.TaonHelpers.tryTransformParam(beforeTransofrm);
|
|
1709
1754
|
beforeTransofrm = paresed;
|
|
@@ -1769,7 +1814,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1769
1814
|
res.end(file);
|
|
1770
1815
|
return [3 /*break*/, 7];
|
|
1771
1816
|
case 4:
|
|
1772
|
-
if (!(
|
|
1817
|
+
if (!(tnp_core_3._.isString(result) &&
|
|
1773
1818
|
methodConfig.responseType ===
|
|
1774
1819
|
'blob')) return [3 /*break*/, 5];
|
|
1775
1820
|
img_base64 = result;
|
|
@@ -1796,27 +1841,27 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1796
1841
|
case 8:
|
|
1797
1842
|
error_2 = _d.sent();
|
|
1798
1843
|
//#region process error
|
|
1799
|
-
if (
|
|
1844
|
+
if (tnp_core_3._.isString(error_2)) {
|
|
1800
1845
|
res.status(400).send(json10_1.JSON10.stringify({
|
|
1801
1846
|
message: "\n Error inside: ".concat(req.path, "\n\n ").concat(error_2, "\n\n"),
|
|
1802
1847
|
}));
|
|
1803
1848
|
}
|
|
1804
1849
|
else if (error_2 instanceof models_1.Models.Http.Errors) {
|
|
1805
|
-
|
|
1850
|
+
tnp_core_3.Helpers.error(error_2, true, false);
|
|
1806
1851
|
err = error_2;
|
|
1807
1852
|
res.status(400).send(json10_1.JSON10.stringify(err));
|
|
1808
1853
|
}
|
|
1809
1854
|
else if (error_2 instanceof Error) {
|
|
1810
1855
|
err = error_2;
|
|
1811
|
-
|
|
1856
|
+
tnp_core_3.Helpers.error(error_2, true, false);
|
|
1812
1857
|
res.status(400).send(json10_1.JSON10.stringify({
|
|
1813
1858
|
stack: err.stack,
|
|
1814
1859
|
message: err.message,
|
|
1815
1860
|
}));
|
|
1816
1861
|
}
|
|
1817
1862
|
else {
|
|
1818
|
-
|
|
1819
|
-
|
|
1863
|
+
tnp_core_3.Helpers.log(error_2);
|
|
1864
|
+
tnp_core_3.Helpers.error("[Taon] Bad result isomorphic method: ".concat(error_2, " "), true, false);
|
|
1820
1865
|
res.status(400).send(json10_1.JSON10.stringify(error_2));
|
|
1821
1866
|
}
|
|
1822
1867
|
return [3 /*break*/, 9];
|
|
@@ -1845,18 +1890,18 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1845
1890
|
// console.log('INITING', methodConfig); // TODO inject in static
|
|
1846
1891
|
//#region resolve storage
|
|
1847
1892
|
var storage;
|
|
1848
|
-
if (
|
|
1893
|
+
if (tnp_core_3.Helpers.isBrowser) {
|
|
1849
1894
|
storage = window;
|
|
1850
1895
|
}
|
|
1851
1896
|
//#region @backend
|
|
1852
|
-
if (
|
|
1897
|
+
if (tnp_core_3.Helpers.isNode) {
|
|
1853
1898
|
storage = global;
|
|
1854
1899
|
}
|
|
1855
1900
|
//#endregion
|
|
1856
1901
|
//#endregion
|
|
1857
1902
|
var orgMethods = target.prototype[methodConfig.methodName];
|
|
1858
1903
|
//#region handle electron ipc request
|
|
1859
|
-
if (
|
|
1904
|
+
if (tnp_core_3.Helpers.isElectron) {
|
|
1860
1905
|
target.prototype[methodConfig.methodName] = function () {
|
|
1861
1906
|
var _this = this;
|
|
1862
1907
|
var args = [];
|
|
@@ -1868,7 +1913,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1868
1913
|
return tslib_1.__generator(this, function (_b) {
|
|
1869
1914
|
headers = {};
|
|
1870
1915
|
_a = taon_helpers_1.TaonHelpers.websqlMocks(headers), request = _a.request, response = _a.response;
|
|
1871
|
-
|
|
1916
|
+
tnp_core_3.Helpers.ipcRenderer.once(taon_helpers_1.TaonHelpers.ipcKeyNameResponse(target, methodConfig, expressPath), function (event, responseData) {
|
|
1872
1917
|
var res = responseData;
|
|
1873
1918
|
console.log({ responseData: responseData });
|
|
1874
1919
|
try {
|
|
@@ -1879,7 +1924,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1879
1924
|
method: methodConfig.type,
|
|
1880
1925
|
url: "".concat(ctx.uri.origin).concat('' // TODO express path
|
|
1881
1926
|
).concat(methodConfig.path, " "),
|
|
1882
|
-
},
|
|
1927
|
+
}, tnp_core_3.Helpers.isBlob(body_1) || tnp_core_3._.isString(body_1)
|
|
1883
1928
|
? body_1
|
|
1884
1929
|
: JSON.stringify(body_1), ng2_rest_1.RestHeaders.from(headers), void 0, function () { return body_1; });
|
|
1885
1930
|
resolve(res);
|
|
@@ -1889,7 +1934,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
1889
1934
|
reject(error);
|
|
1890
1935
|
}
|
|
1891
1936
|
});
|
|
1892
|
-
|
|
1937
|
+
tnp_core_3.Helpers.ipcRenderer.send(taon_helpers_1.TaonHelpers.ipcKeyNameRequest(target, methodConfig, expressPath), args);
|
|
1893
1938
|
return [2 /*return*/];
|
|
1894
1939
|
});
|
|
1895
1940
|
}); });
|
|
@@ -2118,7 +2163,7 @@ var EndpointContext = /** @class */ (function () {
|
|
|
2118
2163
|
if (mapping) {
|
|
2119
2164
|
rest.headers.set(symbols_1.Symbols.old.MAPPING_CONFIG_HEADER_QUERY_PARAMS, JSON.stringify(mapping));
|
|
2120
2165
|
}
|
|
2121
|
-
queryParams =
|
|
2166
|
+
queryParams = tnp_core_3._.cloneDeep(param);
|
|
2122
2167
|
}
|
|
2123
2168
|
}
|
|
2124
2169
|
if (currentParam.paramType === 'Header') {
|