@rockster/core 0.0.1
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/cache/cache-cleaner.d.ts +7 -0
- package/cache/cache-cleaner.js +28 -0
- package/cache/cache.controller.d.ts +10 -0
- package/cache/cache.controller.js +53 -0
- package/cache/constants.d.ts +5 -0
- package/cache/constants.js +6 -0
- package/cache/decorators/index.d.ts +2 -0
- package/cache/decorators/index.js +18 -0
- package/cache/decorators/inject-cache.decorator.d.ts +1 -0
- package/cache/decorators/inject-cache.decorator.js +14 -0
- package/cache/decorators/key-value.d.ts +2 -0
- package/cache/decorators/key-value.js +40 -0
- package/cache/functions/get-cache.d.ts +1 -0
- package/cache/functions/get-cache.js +8 -0
- package/cache/functions/get-key.-handle.d.ts +2 -0
- package/cache/functions/get-key.-handle.js +23 -0
- package/cache/index.d.ts +3 -0
- package/cache/index.js +19 -0
- package/cache/interfaces/cache-instance.d.ts +4 -0
- package/cache/interfaces/cache-instance.js +2 -0
- package/cache/interfaces/cache-key-options.d.ts +6 -0
- package/cache/interfaces/cache-key-options.js +2 -0
- package/cache/interfaces/cache-options.d.ts +12 -0
- package/cache/interfaces/cache-options.js +2 -0
- package/cache/interfaces/get-key-value-handle.d.ts +1 -0
- package/cache/interfaces/get-key-value-handle.js +2 -0
- package/cache/interfaces/index.d.ts +4 -0
- package/cache/interfaces/index.js +20 -0
- package/command/constants.d.ts +4 -0
- package/command/constants.js +7 -0
- package/command/decorators/index.d.ts +6 -0
- package/command/decorators/index.js +22 -0
- package/command/decorators/only-modify.decorator.d.ts +1 -0
- package/command/decorators/only-modify.decorator.js +14 -0
- package/command/decorators/post-action.decorator.d.ts +2 -0
- package/command/decorators/post-action.decorator.js +26 -0
- package/command/decorators/post-content.decorator.d.ts +1 -0
- package/command/decorators/post-content.decorator.js +11 -0
- package/command/decorators/read-only.decorator.d.ts +1 -0
- package/command/decorators/read-only.decorator.js +14 -0
- package/command/decorators/remove-action.decorator.d.ts +2 -0
- package/command/decorators/remove-action.decorator.js +27 -0
- package/command/decorators/remove-content.decorator.d.ts +1 -0
- package/command/decorators/remove-content.decorator.js +11 -0
- package/command/functions/execute-post.d.ts +2 -0
- package/command/functions/execute-post.js +50 -0
- package/command/functions/execute-remove.d.ts +4 -0
- package/command/functions/execute-remove.js +50 -0
- package/command/interfaces/command-property.d.ts +7 -0
- package/command/interfaces/command-property.js +2 -0
- package/command/interfaces/index.d.ts +5 -0
- package/command/interfaces/index.js +21 -0
- package/command/interfaces/post-action-options.d.ts +23 -0
- package/command/interfaces/post-action-options.js +2 -0
- package/command/interfaces/post-content.d.ts +8 -0
- package/command/interfaces/post-content.js +2 -0
- package/command/interfaces/remove-aciton-options.d.ts +23 -0
- package/command/interfaces/remove-aciton-options.js +2 -0
- package/command/interfaces/remove-content.d.ts +5 -0
- package/command/interfaces/remove-content.js +2 -0
- package/command/services/post-action-builder.d.ts +19 -0
- package/command/services/post-action-builder.js +219 -0
- package/command/services/remove-action-builder.d.ts +14 -0
- package/command/services/remove-action-builder.js +165 -0
- package/command/utils/deep-merge-keep-undefined.d.ts +1 -0
- package/command/utils/deep-merge-keep-undefined.js +18 -0
- package/common/entities/base-entity.d.ts +7 -0
- package/common/entities/base-entity.js +47 -0
- package/common/index.d.ts +1 -0
- package/common/index.js +17 -0
- package/common/interfaces/enum/index.d.ts +3 -0
- package/common/interfaces/enum/index.js +19 -0
- package/common/interfaces/enum/object-type.d.ts +12 -0
- package/common/interfaces/enum/object-type.js +16 -0
- package/common/interfaces/enum/property-type.d.ts +7 -0
- package/common/interfaces/enum/property-type.js +11 -0
- package/common/interfaces/enum/request-status.d.ts +3 -0
- package/common/interfaces/enum/request-status.js +7 -0
- package/common/interfaces/get-type-callback.d.ts +2 -0
- package/common/interfaces/get-type-callback.js +2 -0
- package/common/interfaces/index.d.ts +2 -0
- package/common/interfaces/index.js +18 -0
- package/common/models/executed-response.d.ts +3 -0
- package/common/models/executed-response.js +22 -0
- package/controllers/constants.d.ts +11 -0
- package/controllers/constants.js +14 -0
- package/controllers/controller.controller.d.ts +19 -0
- package/controllers/controller.controller.js +50 -0
- package/controllers/decorators/actions/action-content.decorator.d.ts +2 -0
- package/controllers/decorators/actions/action-content.decorator.js +20 -0
- package/controllers/decorators/actions/action.decorator.d.ts +2 -0
- package/controllers/decorators/actions/action.decorator.js +28 -0
- package/controllers/decorators/actions/index.d.ts +2 -0
- package/controllers/decorators/actions/index.js +18 -0
- package/controllers/decorators/controller.decorator.d.ts +3 -0
- package/controllers/decorators/controller.decorator.js +32 -0
- package/controllers/decorators/http-methods/custom-response.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/custom-response.decorator.js +14 -0
- package/controllers/decorators/http-methods/delete.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/delete.decorator.js +16 -0
- package/controllers/decorators/http-methods/from-body.decorator.d.ts +3 -0
- package/controllers/decorators/http-methods/from-body.decorator.js +24 -0
- package/controllers/decorators/http-methods/from-headers.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/from-headers.decorator.js +21 -0
- package/controllers/decorators/http-methods/from-params.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/from-params.decorator.js +21 -0
- package/controllers/decorators/http-methods/from-query.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/from-query.decorator.js +21 -0
- package/controllers/decorators/http-methods/get.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/get.decorator.js +16 -0
- package/controllers/decorators/http-methods/http-req.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/http-req.decorator.js +10 -0
- package/controllers/decorators/http-methods/index.d.ts +12 -0
- package/controllers/decorators/http-methods/index.js +28 -0
- package/controllers/decorators/http-methods/patch.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/patch.decorator.js +16 -0
- package/controllers/decorators/http-methods/post.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/post.decorator.js +16 -0
- package/controllers/decorators/http-methods/put.decorator.d.ts +1 -0
- package/controllers/decorators/http-methods/put.decorator.js +16 -0
- package/controllers/decorators/http-methods/response-type.decorator.d.ts +6 -0
- package/controllers/decorators/http-methods/response-type.decorator.js +19 -0
- package/controllers/decorators/index.d.ts +5 -0
- package/controllers/decorators/index.js +21 -0
- package/controllers/decorators/no-auth.decorator.d.ts +1 -0
- package/controllers/decorators/no-auth.decorator.js +11 -0
- package/controllers/decorators/request-context.decorator.d.ts +1 -0
- package/controllers/decorators/request-context.decorator.js +11 -0
- package/controllers/decorators/session.decorator.d.ts +1 -0
- package/controllers/decorators/session.decorator.js +10 -0
- package/controllers/index.d.ts +2 -0
- package/controllers/index.js +18 -0
- package/controllers/interfaces/action-options.d.ts +31 -0
- package/controllers/interfaces/action-options.js +2 -0
- package/controllers/interfaces/content-options.d.ts +5 -0
- package/controllers/interfaces/content-options.js +2 -0
- package/controllers/interfaces/controller-object.d.ts +7 -0
- package/controllers/interfaces/controller-object.js +2 -0
- package/controllers/interfaces/controller-options.d.ts +4 -0
- package/controllers/interfaces/controller-options.js +2 -0
- package/controllers/interfaces/controller-property.d.ts +34 -0
- package/controllers/interfaces/controller-property.js +2 -0
- package/controllers/interfaces/enum/index.d.ts +1 -0
- package/controllers/interfaces/enum/index.js +17 -0
- package/controllers/interfaces/enum/request-interceptor.d.ts +3 -0
- package/controllers/interfaces/enum/request-interceptor.js +6 -0
- package/controllers/interfaces/get-only-data.d.ts +3 -0
- package/controllers/interfaces/get-only-data.js +2 -0
- package/controllers/interfaces/index.d.ts +9 -0
- package/controllers/interfaces/index.js +25 -0
- package/controllers/interfaces/on-before-validation-data.d.ts +4 -0
- package/controllers/interfaces/on-before-validation-data.js +2 -0
- package/controllers/interfaces/response-options.d.ts +5 -0
- package/controllers/interfaces/response-options.js +3 -0
- package/controllers/services/default-action-builder.d.ts +14 -0
- package/controllers/services/default-action-builder.js +166 -0
- package/controllers/services/restful-action-builder.d.ts +11 -0
- package/controllers/services/restful-action-builder.js +132 -0
- package/core/core.controller.d.ts +41 -0
- package/core/core.controller.js +208 -0
- package/core/functions/bootstrap.d.ts +3 -0
- package/core/functions/bootstrap.js +13 -0
- package/core/functions/create-action.d.ts +2 -0
- package/core/functions/create-action.js +18 -0
- package/core/functions/create-interceptor.d.ts +12 -0
- package/core/functions/create-interceptor.js +76 -0
- package/core/functions/format-message.d.ts +2 -0
- package/core/functions/format-message.js +7 -0
- package/core/functions/get-action-path.d.ts +1 -0
- package/core/functions/get-action-path.js +7 -0
- package/core/functions/get-env.d.ts +11 -0
- package/core/functions/get-env.js +19 -0
- package/core/functions/get-node-key.d.ts +1 -0
- package/core/functions/get-node-key.js +7 -0
- package/core/functions/get-other-types.d.ts +2 -0
- package/core/functions/get-other-types.js +19 -0
- package/core/index.d.ts +10 -0
- package/core/index.js +26 -0
- package/core/interfaces/action-def.d.ts +16 -0
- package/core/interfaces/action-def.js +2 -0
- package/core/interfaces/action-docs.d.ts +10 -0
- package/core/interfaces/action-docs.js +2 -0
- package/core/interfaces/core-options.d.ts +32 -0
- package/core/interfaces/core-options.js +2 -0
- package/core/interfaces/docs-options.d.ts +3 -0
- package/core/interfaces/docs-options.js +2 -0
- package/core/interfaces/enum/connect-type.d.ts +4 -0
- package/core/interfaces/enum/connect-type.js +8 -0
- package/core/interfaces/enum/index.d.ts +1 -0
- package/core/interfaces/enum/index.js +17 -0
- package/core/interfaces/format-message-options.d.ts +6 -0
- package/core/interfaces/format-message-options.js +2 -0
- package/core/interfaces/forms-options.d.ts +3 -0
- package/core/interfaces/forms-options.js +2 -0
- package/core/interfaces/index.d.ts +23 -0
- package/core/interfaces/index.js +39 -0
- package/core/interfaces/interceptor.d.ts +38 -0
- package/core/interfaces/interceptor.js +7 -0
- package/core/interfaces/locale-options.d.ts +5 -0
- package/core/interfaces/locale-options.js +2 -0
- package/core/interfaces/mapper.d.ts +3 -0
- package/core/interfaces/mapper.js +2 -0
- package/core/interfaces/object-docs.d.ts +5 -0
- package/core/interfaces/object-docs.js +3 -0
- package/core/interfaces/object.d.ts +15 -0
- package/core/interfaces/object.js +2 -0
- package/core/interfaces/pending-action.d.ts +10 -0
- package/core/interfaces/pending-action.js +2 -0
- package/core/interfaces/property-docs.d.ts +5 -0
- package/core/interfaces/property-docs.js +2 -0
- package/core/interfaces/property.d.ts +9 -0
- package/core/interfaces/property.js +2 -0
- package/core/interfaces/request-callback-handle.d.ts +3 -0
- package/core/interfaces/request-callback-handle.js +2 -0
- package/core/interfaces/request-callback.d.ts +4 -0
- package/core/interfaces/request-callback.js +2 -0
- package/core/interfaces/request-callbacks.d.ts +5 -0
- package/core/interfaces/request-callbacks.js +2 -0
- package/core/interfaces/request-context.d.ts +28 -0
- package/core/interfaces/request-context.js +2 -0
- package/core/interfaces/request-data.d.ts +6 -0
- package/core/interfaces/request-data.js +2 -0
- package/core/interfaces/router-options.d.ts +5 -0
- package/core/interfaces/router-options.js +2 -0
- package/core/interfaces/sanitizer.d.ts +4 -0
- package/core/interfaces/sanitizer.js +2 -0
- package/core/interfaces/storage-options.d.ts +6 -0
- package/core/interfaces/storage-options.js +2 -0
- package/core/interfaces/translations-options.d.ts +7 -0
- package/core/interfaces/translations-options.js +2 -0
- package/core/interfaces/transport-options.d.ts +3 -0
- package/core/interfaces/transport-options.js +2 -0
- package/core/services/context-builder.d.ts +15 -0
- package/core/services/context-builder.js +91 -0
- package/core/services/locale-service.d.ts +13 -0
- package/core/services/locale-service.js +71 -0
- package/core/services/node-control.service.d.ts +5 -0
- package/core/services/node-control.service.js +46 -0
- package/core/services/object-loader.d.ts +10 -0
- package/core/services/object-loader.js +27 -0
- package/core/services/request-executor.d.ts +9 -0
- package/core/services/request-executor.js +108 -0
- package/core/services/request-router.d.ts +15 -0
- package/core/services/request-router.js +127 -0
- package/database/contexts/index.d.ts +1 -0
- package/database/contexts/index.js +17 -0
- package/database/contexts/transaction-context.d.ts +6 -0
- package/database/contexts/transaction-context.js +5 -0
- package/database/database.controller.d.ts +20 -0
- package/database/database.controller.js +92 -0
- package/database/decorators/column.decorator.d.ts +72 -0
- package/database/decorators/column.decorator.js +9 -0
- package/database/decorators/entity.decorator.d.ts +2 -0
- package/database/decorators/entity.decorator.js +10 -0
- package/database/decorators/id-generated.decorator.d.ts +30 -0
- package/database/decorators/id-generated.decorator.js +76 -0
- package/database/decorators/id.decorator.d.ts +13 -0
- package/database/decorators/id.decorator.js +27 -0
- package/database/decorators/index.d.ts +13 -0
- package/database/decorators/index.js +29 -0
- package/database/decorators/inject-data-source.decorator.d.ts +1 -0
- package/database/decorators/inject-data-source.decorator.js +13 -0
- package/database/decorators/inject-repository.decorator.d.ts +2 -0
- package/database/decorators/inject-repository.decorator.js +17 -0
- package/database/decorators/protect-context-column.decorator.d.ts +3 -0
- package/database/decorators/protect-context-column.decorator.js +11 -0
- package/database/decorators/protect-entity.decorator.d.ts +4 -0
- package/database/decorators/protect-entity.decorator.js +12 -0
- package/database/decorators/protect-key-column.decorator.d.ts +2 -0
- package/database/decorators/protect-key-column.decorator.js +11 -0
- package/database/decorators/protect-target-column.decorator.d.ts +3 -0
- package/database/decorators/protect-target-column.decorator.js +11 -0
- package/database/decorators/protected-entity.decorator.d.ts +8 -0
- package/database/decorators/protected-entity.decorator.js +25 -0
- package/database/decorators/relation.decorator.d.ts +3 -0
- package/database/decorators/relation.decorator.js +13 -0
- package/database/decorators/virtual-column.decorator.d.ts +4 -0
- package/database/decorators/virtual-column.decorator.js +16 -0
- package/database/environment.d.ts +21 -0
- package/database/environment.js +25 -0
- package/database/exports/index.d.ts +1 -0
- package/database/exports/index.js +17 -0
- package/database/exports/typeorm.d.ts +1 -0
- package/database/exports/typeorm.js +9 -0
- package/database/extensions/select-query-builder.d.ts +11 -0
- package/database/extensions/select-query-builder.js +21 -0
- package/database/functions/column-decorator.d.ts +6 -0
- package/database/functions/column-decorator.js +31 -0
- package/database/functions/create-entity.d.ts +7 -0
- package/database/functions/create-entity.js +51 -0
- package/database/functions/create-new-class.d.ts +1 -0
- package/database/functions/create-new-class.js +16 -0
- package/database/functions/entity-decorator.d.ts +3 -0
- package/database/functions/entity-decorator.js +29 -0
- package/database/functions/execute-if-not-exists-column.d.ts +3 -0
- package/database/functions/execute-if-not-exists-column.js +16 -0
- package/database/functions/execute-if-not-exists-table.d.ts +3 -0
- package/database/functions/execute-if-not-exists-table.js +14 -0
- package/database/functions/find-relation.d.ts +3 -0
- package/database/functions/find-relation.js +43 -0
- package/database/functions/generate-id.d.ts +2 -0
- package/database/functions/generate-id.js +14 -0
- package/database/functions/get-column-type.d.ts +3 -0
- package/database/functions/get-column-type.js +18 -0
- package/database/functions/get-id-property.d.ts +3 -0
- package/database/functions/get-id-property.js +14 -0
- package/database/functions/get-name-by-strategy.d.ts +6 -0
- package/database/functions/get-name-by-strategy.js +9 -0
- package/database/functions/get-primitive-type.d.ts +3 -0
- package/database/functions/get-primitive-type.js +8 -0
- package/database/functions/get-relations.d.ts +2 -0
- package/database/functions/get-relations.js +12 -0
- package/database/functions/has-update.d.ts +2 -0
- package/database/functions/has-update.js +7 -0
- package/database/functions/inject-repository-handle.d.ts +2 -0
- package/database/functions/inject-repository-handle.js +36 -0
- package/database/functions/object-to-jsonb.d.ts +1 -0
- package/database/functions/object-to-jsonb.js +36 -0
- package/database/functions/register-column.d.ts +7 -0
- package/database/functions/register-column.js +16 -0
- package/database/functions/register-entity.d.ts +5 -0
- package/database/functions/register-entity.js +8 -0
- package/database/functions/register-generated-id.d.ts +6 -0
- package/database/functions/register-generated-id.js +8 -0
- package/database/functions/register-id.d.ts +7 -0
- package/database/functions/register-id.js +8 -0
- package/database/functions/register-relation.d.ts +8 -0
- package/database/functions/register-relation.js +12 -0
- package/database/functions/relation-decorator.d.ts +4 -0
- package/database/functions/relation-decorator.js +74 -0
- package/database/functions/use-protector.d.ts +2 -0
- package/database/functions/use-protector.js +10 -0
- package/database/functions/use-repository.d.ts +2 -0
- package/database/functions/use-repository.js +10 -0
- package/database/functions/use-transaction.d.ts +1 -0
- package/database/functions/use-transaction.js +12 -0
- package/database/index.d.ts +16 -0
- package/database/index.js +32 -0
- package/database/interfaces/base-columns-name-override.d.ts +6 -0
- package/database/interfaces/base-columns-name-override.js +2 -0
- package/database/interfaces/column-def.d.ts +26 -0
- package/database/interfaces/column-def.js +2 -0
- package/database/interfaces/connection.options.d.ts +15 -0
- package/database/interfaces/connection.options.js +2 -0
- package/database/interfaces/direact-alias.d.ts +1 -0
- package/database/interfaces/direact-alias.js +2 -0
- package/database/interfaces/entity-object.d.ts +15 -0
- package/database/interfaces/entity-object.js +2 -0
- package/database/interfaces/entity-options.d.ts +15 -0
- package/database/interfaces/entity-options.js +2 -0
- package/database/interfaces/entity-property.d.ts +19 -0
- package/database/interfaces/entity-property.js +2 -0
- package/database/interfaces/enum/column-def-type.d.ts +5 -0
- package/database/interfaces/enum/column-def-type.js +9 -0
- package/database/interfaces/enum/index.d.ts +5 -0
- package/database/interfaces/enum/index.js +21 -0
- package/database/interfaces/enum/naming-strategy-type.d.ts +5 -0
- package/database/interfaces/enum/naming-strategy-type.js +9 -0
- package/database/interfaces/enum/nano-id-alphabet-type.d.ts +14 -0
- package/database/interfaces/enum/nano-id-alphabet-type.js +18 -0
- package/database/interfaces/enum/order-by-direction.d.ts +4 -0
- package/database/interfaces/enum/order-by-direction.js +8 -0
- package/database/interfaces/enum/primary-strategy-type.d.ts +5 -0
- package/database/interfaces/enum/primary-strategy-type.js +9 -0
- package/database/interfaces/enum/relation-path-type.d.ts +4 -0
- package/database/interfaces/enum/relation-path-type.js +8 -0
- package/database/interfaces/execute-callback.d.ts +3 -0
- package/database/interfaces/execute-callback.js +2 -0
- package/database/interfaces/id-column-def.d.ts +6 -0
- package/database/interfaces/id-column-def.js +2 -0
- package/database/interfaces/index.d.ts +17 -0
- package/database/interfaces/index.js +33 -0
- package/database/interfaces/inverse-alias.d.ts +5 -0
- package/database/interfaces/inverse-alias.js +2 -0
- package/database/interfaces/nano-id-column-options.d.ts +12 -0
- package/database/interfaces/nano-id-column-options.js +2 -0
- package/database/interfaces/path.d.ts +43 -0
- package/database/interfaces/path.js +2 -0
- package/database/interfaces/protector.d.ts +51 -0
- package/database/interfaces/protector.js +2 -0
- package/database/interfaces/register-one-to-many-handle.d.ts +3 -0
- package/database/interfaces/register-one-to-many-handle.js +2 -0
- package/database/interfaces/register-one-to-many.d.ts +6 -0
- package/database/interfaces/register-one-to-many.js +2 -0
- package/database/interfaces/relation-def.d.ts +8 -0
- package/database/interfaces/relation-def.js +2 -0
- package/database/interfaces/relation-path.d.ts +10 -0
- package/database/interfaces/relation-path.js +2 -0
- package/database/interfaces/relation.options.d.ts +9 -0
- package/database/interfaces/relation.options.js +2 -0
- package/database/interfaces/repository.d.ts +8 -0
- package/database/interfaces/repository.js +2 -0
- package/database/migrations/1737637321043-UUIDVarcharMigration.d.ts +5 -0
- package/database/migrations/1737637321043-UUIDVarcharMigration.js +81 -0
- package/database/migrations/use-uuid-varchar-migration.d.ts +2 -0
- package/database/migrations/use-uuid-varchar-migration.js +10 -0
- package/database/services/paths-builder.d.ts +12 -0
- package/database/services/paths-builder.js +82 -0
- package/database/services/protect-builder.d.ts +59 -0
- package/database/services/protect-builder.js +523 -0
- package/database/services/repository.service.d.ts +14 -0
- package/database/services/repository.service.js +75 -0
- package/forms/entities/form.d.ts +8 -0
- package/forms/entities/form.js +61 -0
- package/forms/entities/property.d.ts +7 -0
- package/forms/entities/property.js +51 -0
- package/forms/forms.controller.d.ts +8 -0
- package/forms/forms.controller.js +59 -0
- package/forms/interfaces/form-item.d.ts +5 -0
- package/forms/interfaces/form-item.js +2 -0
- package/forms/interfaces/form.d.ts +8 -0
- package/forms/interfaces/form.js +2 -0
- package/forms/interfaces/property.d.ts +6 -0
- package/forms/interfaces/property.js +2 -0
- package/forms/migrations/1725969116484-CreateFormsTables.d.ts +5 -0
- package/forms/migrations/1725969116484-CreateFormsTables.js +38 -0
- package/forms/models/form-load.request.d.ts +3 -0
- package/forms/models/form-load.request.js +21 -0
- package/forms/queries/form.query.d.ts +1 -0
- package/forms/queries/form.query.js +9 -0
- package/forms/queries/property.query.d.ts +1 -0
- package/forms/queries/property.query.js +9 -0
- package/forms/requests/form.request.d.ts +14 -0
- package/forms/requests/form.request.js +83 -0
- package/forms/requests/property.request.d.ts +8 -0
- package/forms/requests/property.request.js +65 -0
- package/forms/services/form.service.d.ts +20 -0
- package/forms/services/form.service.js +64 -0
- package/forms/services/property.service.d.ts +6 -0
- package/forms/services/property.service.js +30 -0
- package/forms/utils/build-form-validator.d.ts +11 -0
- package/forms/utils/build-form-validator.js +30 -0
- package/forms/utils/get-form-items.d.ts +2 -0
- package/forms/utils/get-form-items.js +20 -0
- package/global.d.ts +52 -0
- package/global.js +50 -0
- package/http/http.controller.d.ts +25 -0
- package/http/http.controller.js +137 -0
- package/http/index.d.ts +2 -0
- package/http/index.js +18 -0
- package/http/interfaces/csrf.options.d.ts +11 -0
- package/http/interfaces/csrf.options.js +2 -0
- package/http/interfaces/http-request.d.ts +6 -0
- package/http/interfaces/http-request.js +2 -0
- package/http/interfaces/http-response.d.ts +4 -0
- package/http/interfaces/http-response.js +3 -0
- package/http/interfaces/http-settings.d.ts +13 -0
- package/http/interfaces/http-settings.js +2 -0
- package/http/interfaces/http-use.d.ts +6 -0
- package/http/interfaces/http-use.js +2 -0
- package/http/interfaces/index.d.ts +6 -0
- package/http/interfaces/index.js +22 -0
- package/http/interfaces/route.d.ts +10 -0
- package/http/interfaces/route.js +2 -0
- package/index.d.ts +44 -0
- package/index.js +65 -0
- package/jobs/constants.d.ts +2 -0
- package/jobs/constants.js +4 -0
- package/jobs/decorators/index.d.ts +1 -0
- package/jobs/decorators/index.js +17 -0
- package/jobs/decorators/job.decorator.d.ts +11 -0
- package/jobs/decorators/job.decorator.js +26 -0
- package/jobs/interfaces/index.d.ts +3 -0
- package/jobs/interfaces/index.js +19 -0
- package/jobs/interfaces/job-data.d.ts +13 -0
- package/jobs/interfaces/job-data.js +2 -0
- package/jobs/interfaces/job-executor.d.ts +3 -0
- package/jobs/interfaces/job-executor.js +2 -0
- package/jobs/interfaces/job-object.d.ts +6 -0
- package/jobs/interfaces/job-object.js +2 -0
- package/jobs/interfaces/job.options.d.ts +1 -0
- package/jobs/interfaces/job.options.js +2 -0
- package/jobs/jobs.controller.d.ts +18 -0
- package/jobs/jobs.controller.js +122 -0
- package/module/decorators/index.d.ts +4 -0
- package/module/decorators/index.js +20 -0
- package/module/decorators/module.decorator.d.ts +2 -0
- package/module/decorators/module.decorator.js +16 -0
- package/module/decorators/on-after-app-start.d.ts +1 -0
- package/module/decorators/on-after-app-start.js +11 -0
- package/module/decorators/on-after-database-init.d.ts +1 -0
- package/module/decorators/on-after-database-init.js +11 -0
- package/module/decorators/on-module-init.d.ts +1 -0
- package/module/decorators/on-module-init.js +11 -0
- package/module/index.d.ts +3 -0
- package/module/index.js +19 -0
- package/module/interfaces/index.d.ts +3 -0
- package/module/interfaces/index.js +19 -0
- package/module/interfaces/module-events.d.ts +5 -0
- package/module/interfaces/module-events.js +2 -0
- package/module/interfaces/module-object.d.ts +7 -0
- package/module/interfaces/module-object.js +2 -0
- package/module/interfaces/module-options.d.ts +8 -0
- package/module/interfaces/module-options.js +2 -0
- package/module/module.controller.d.ts +31 -0
- package/module/module.controller.js +159 -0
- package/package.json +70 -0
- package/query/constants.d.ts +2 -0
- package/query/constants.js +5 -0
- package/query/decorators/index.d.ts +1 -0
- package/query/decorators/index.js +17 -0
- package/query/decorators/query-content.decorator.d.ts +1 -0
- package/query/decorators/query-content.decorator.js +11 -0
- package/query/functions/add-join.d.ts +5 -0
- package/query/functions/add-join.js +37 -0
- package/query/functions/create-query-builder.d.ts +4 -0
- package/query/functions/create-query-builder.js +54 -0
- package/query/functions/create-query.d.ts +5 -0
- package/query/functions/create-query.js +96 -0
- package/query/functions/describe-query-filter.d.ts +7 -0
- package/query/functions/describe-query-filter.js +298 -0
- package/query/functions/execute-query.d.ts +11 -0
- package/query/functions/execute-query.js +74 -0
- package/query/functions/get-column-path.d.ts +2 -0
- package/query/functions/get-column-path.js +14 -0
- package/query/functions/get-native-select.d.ts +2 -0
- package/query/functions/get-native-select.js +9 -0
- package/query/functions/load-properties.d.ts +19 -0
- package/query/functions/load-properties.js +138 -0
- package/query/functions/map-query-property-to-column-name.d.ts +3 -0
- package/query/functions/map-query-property-to-column-name.js +17 -0
- package/query/functions/replace-property-key-to-column-name.d.ts +1 -0
- package/query/functions/replace-property-key-to-column-name.js +10 -0
- package/query/interfaces/index.d.ts +3 -0
- package/query/interfaces/index.js +19 -0
- package/query/interfaces/query-action-options.d.ts +14 -0
- package/query/interfaces/query-action-options.js +2 -0
- package/query/interfaces/query-object.d.ts +10 -0
- package/query/interfaces/query-object.js +2 -0
- package/query/interfaces/query.d.ts +54 -0
- package/query/interfaces/query.js +2 -0
- package/query/models/base-query-response.d.ts +12 -0
- package/query/models/base-query-response.js +41 -0
- package/query/services/query-action-builder.d.ts +14 -0
- package/query/services/query-action-builder.js +145 -0
- package/security/auth.controller.d.ts +8 -0
- package/security/auth.controller.js +68 -0
- package/security/constants.d.ts +0 -0
- package/security/constants.js +2 -0
- package/security/env.d.ts +7 -0
- package/security/env.js +8 -0
- package/security/functions/add-protect.d.ts +2 -0
- package/security/functions/add-protect.js +10 -0
- package/security/functions/add-protected.d.ts +3 -0
- package/security/functions/add-protected.js +23 -0
- package/security/functions/create-authorization.d.ts +2 -0
- package/security/functions/create-authorization.js +12 -0
- package/security/functions/find-auth-context.d.ts +3 -0
- package/security/functions/find-auth-context.js +25 -0
- package/security/functions/is-auth-enabled.d.ts +1 -0
- package/security/functions/is-auth-enabled.js +7 -0
- package/security/functions/use-auth.d.ts +1 -0
- package/security/functions/use-auth.js +8 -0
- package/security/index.d.ts +3 -0
- package/security/index.js +19 -0
- package/security/interceptors/index.d.ts +1 -0
- package/security/interceptors/index.js +17 -0
- package/security/interceptors/is-authorized.interceptor.d.ts +2 -0
- package/security/interceptors/is-authorized.interceptor.js +34 -0
- package/security/interfaces/auth-controller.d.ts +7 -0
- package/security/interfaces/auth-controller.js +2 -0
- package/security/interfaces/auth-object.d.ts +6 -0
- package/security/interfaces/auth-object.js +2 -0
- package/security/interfaces/auth-property.d.ts +4 -0
- package/security/interfaces/auth-property.js +2 -0
- package/security/interfaces/authorization-schema.d.ts +26 -0
- package/security/interfaces/authorization-schema.js +2 -0
- package/security/interfaces/index.d.ts +6 -0
- package/security/interfaces/index.js +22 -0
- package/security/interfaces/security-options.d.ts +8 -0
- package/security/interfaces/security-options.js +2 -0
- package/security/interfaces/ssl-certificate.d.ts +4 -0
- package/security/interfaces/ssl-certificate.js +2 -0
- package/security/models/auth-context-data.d.ts +4 -0
- package/security/models/auth-context-data.js +25 -0
- package/security/models/auth-context.d.ts +9 -0
- package/security/models/auth-context.js +48 -0
- package/security/models/auth-key.d.ts +7 -0
- package/security/models/auth-key.js +36 -0
- package/security/models/get-user-permissions-payload.d.ts +4 -0
- package/security/models/get-user-permissions-payload.js +21 -0
- package/security/models/get-user-permissions-response.d.ts +3 -0
- package/security/models/get-user-permissions-response.js +22 -0
- package/security/models/set-user-permissions-payload.d.ts +5 -0
- package/security/models/set-user-permissions-payload.js +26 -0
- package/security/requests/security.request.d.ts +14 -0
- package/security/requests/security.request.js +75 -0
- package/security/services/authorization.service.d.ts +11 -0
- package/security/services/authorization.service.js +60 -0
- package/storage/entities/metadata.entity.d.ts +19 -0
- package/storage/entities/metadata.entity.js +86 -0
- package/storage/entities/storage.entity.d.ts +6 -0
- package/storage/entities/storage.entity.js +32 -0
- package/storage/env.d.ts +9 -0
- package/storage/env.js +9 -0
- package/storage/functions/index.d.ts +1 -0
- package/storage/functions/index.js +17 -0
- package/storage/functions/set-storage-settings.d.ts +2 -0
- package/storage/functions/set-storage-settings.js +13 -0
- package/storage/index.d.ts +2 -0
- package/storage/index.js +18 -0
- package/storage/interfaces/directory-metadata.d.ts +6 -0
- package/storage/interfaces/directory-metadata.js +2 -0
- package/storage/interfaces/enum/gcp-credentials-type.d.ts +3 -0
- package/storage/interfaces/enum/gcp-credentials-type.js +7 -0
- package/storage/interfaces/enum/index.d.ts +3 -0
- package/storage/interfaces/enum/index.js +19 -0
- package/storage/interfaces/enum/metadata-type.d.ts +4 -0
- package/storage/interfaces/enum/metadata-type.js +8 -0
- package/storage/interfaces/enum/storage-type.d.ts +3 -0
- package/storage/interfaces/enum/storage-type.js +7 -0
- package/storage/interfaces/file-metadata.d.ts +12 -0
- package/storage/interfaces/file-metadata.js +2 -0
- package/storage/interfaces/index.d.ts +7 -0
- package/storage/interfaces/index.js +23 -0
- package/storage/interfaces/metadata.d.ts +18 -0
- package/storage/interfaces/metadata.js +2 -0
- package/storage/interfaces/storage-controller.d.ts +13 -0
- package/storage/interfaces/storage-controller.js +2 -0
- package/storage/interfaces/storage-settings.d.ts +16 -0
- package/storage/interfaces/storage-settings.js +2 -0
- package/storage/interfaces/storage.d.ts +7 -0
- package/storage/interfaces/storage.js +2 -0
- package/storage/services/routes.service.d.ts +31 -0
- package/storage/services/routes.service.js +384 -0
- package/storage/services/storage.service.d.ts +10 -0
- package/storage/services/storage.service.js +92 -0
- package/storage/storage.controller.d.ts +10 -0
- package/storage/storage.controller.js +49 -0
- package/tasks/constants.d.ts +12 -0
- package/tasks/constants.js +21 -0
- package/tasks/decorators/index.d.ts +1 -0
- package/tasks/decorators/index.js +17 -0
- package/tasks/decorators/task.decorator.d.ts +2 -0
- package/tasks/decorators/task.decorator.js +45 -0
- package/tasks/functions/create-task-message-find.d.ts +3 -0
- package/tasks/functions/create-task-message-find.js +23 -0
- package/tasks/functions/create-task-message-model.d.ts +3 -0
- package/tasks/functions/create-task-message-model.js +11 -0
- package/tasks/functions/create-task-message-receptor.d.ts +3 -0
- package/tasks/functions/create-task-message-receptor.js +23 -0
- package/tasks/functions/create-task-message-retry.d.ts +3 -0
- package/tasks/functions/create-task-message-retry.js +22 -0
- package/tasks/functions/create-task-message-schema.d.ts +182 -0
- package/tasks/functions/create-task-message-schema.js +20 -0
- package/tasks/functions/create-task-message-trigger.d.ts +2 -0
- package/tasks/functions/create-task-message-trigger.js +18 -0
- package/tasks/functions/create-task-naming.d.ts +2 -0
- package/tasks/functions/create-task-naming.js +31 -0
- package/tasks/functions/generate-entity-id.d.ts +1 -0
- package/tasks/functions/generate-entity-id.js +5 -0
- package/tasks/functions/get-check-table-exists-script.d.ts +1 -0
- package/tasks/functions/get-check-table-exists-script.js +12 -0
- package/tasks/functions/get-create-table-partition-script.d.ts +2 -0
- package/tasks/functions/get-create-table-partition-script.js +10 -0
- package/tasks/functions/get-create-table-script.d.ts +1 -0
- package/tasks/functions/get-create-table-script.js +22 -0
- package/tasks/functions/get-database-connection-name.d.ts +1 -0
- package/tasks/functions/get-database-connection-name.js +8 -0
- package/tasks/functions/get-database-uri.d.ts +1 -0
- package/tasks/functions/get-database-uri.js +8 -0
- package/tasks/functions/get-partitions-of-table-script.d.ts +1 -0
- package/tasks/functions/get-partitions-of-table-script.js +10 -0
- package/tasks/functions/get-pending-task-script.d.ts +2 -0
- package/tasks/functions/get-pending-task-script.js +19 -0
- package/tasks/functions/parse-task-message-search.d.ts +20 -0
- package/tasks/functions/parse-task-message-search.js +62 -0
- package/tasks/functions/throw-task-error.d.ts +1 -0
- package/tasks/functions/throw-task-error.js +7 -0
- package/tasks/index.d.ts +3 -0
- package/tasks/index.js +19 -0
- package/tasks/interfaces/index.d.ts +6 -0
- package/tasks/interfaces/index.js +22 -0
- package/tasks/interfaces/task-naming.d.ts +11 -0
- package/tasks/interfaces/task-naming.js +2 -0
- package/tasks/interfaces/task-object.d.ts +17 -0
- package/tasks/interfaces/task-object.js +2 -0
- package/tasks/interfaces/task-post-intercept.d.ts +8 -0
- package/tasks/interfaces/task-post-intercept.js +2 -0
- package/tasks/interfaces/task-runner.d.ts +6 -0
- package/tasks/interfaces/task-runner.js +2 -0
- package/tasks/interfaces/task-search-intercept.d.ts +4 -0
- package/tasks/interfaces/task-search-intercept.js +2 -0
- package/tasks/interfaces/task-settings.d.ts +15 -0
- package/tasks/interfaces/task-settings.js +2 -0
- package/tasks/models/task-error.d.ts +8 -0
- package/tasks/models/task-error.js +40 -0
- package/tasks/models/task-message-find.d.ts +3 -0
- package/tasks/models/task-message-find.js +21 -0
- package/tasks/models/task-message.d.ts +13 -0
- package/tasks/models/task-message.js +57 -0
- package/tasks/requests/task.request.d.ts +17 -0
- package/tasks/requests/task.request.js +71 -0
- package/tasks/services/task-manager.service.d.ts +10 -0
- package/tasks/services/task-manager.service.js +60 -0
- package/tasks/services/task-runner.service.d.ts +16 -0
- package/tasks/services/task-runner.service.js +88 -0
- package/tasks/tasks.controller.d.ts +19 -0
- package/tasks/tasks.controller.js +75 -0
- package/translations/entities/translation-config.entity.d.ts +9 -0
- package/translations/entities/translation-config.entity.js +65 -0
- package/translations/entities/translation-values.entity.d.ts +10 -0
- package/translations/entities/translation-values.entity.js +53 -0
- package/translations/env.d.ts +2 -0
- package/translations/env.js +7 -0
- package/translations/functions/check-can-use.d.ts +1 -0
- package/translations/functions/check-can-use.js +10 -0
- package/translations/functions/create-translation-config.d.ts +3 -0
- package/translations/functions/create-translation-config.js +19 -0
- package/translations/functions/create-translation-values.d.ts +3 -0
- package/translations/functions/create-translation-values.js +22 -0
- package/translations/functions/get-translation-config.d.ts +3 -0
- package/translations/functions/get-translation-config.js +14 -0
- package/translations/interfaces/translation-config.d.ts +8 -0
- package/translations/interfaces/translation-config.js +2 -0
- package/translations/interfaces/translation-values.d.ts +9 -0
- package/translations/interfaces/translation-values.js +2 -0
- package/translations/interfaces/translator-handle.d.ts +4 -0
- package/translations/interfaces/translator-handle.js +2 -0
- package/translations/migrations/1723760669185-CreateTranslationTables.d.ts +5 -0
- package/translations/migrations/1723760669185-CreateTranslationTables.js +43 -0
- package/translations/models/get-values.request.d.ts +5 -0
- package/translations/models/get-values.request.js +25 -0
- package/translations/models/get-values.response.d.ts +4 -0
- package/translations/models/get-values.response.js +20 -0
- package/translations/queries/translation-config.query.d.ts +1 -0
- package/translations/queries/translation-config.query.js +9 -0
- package/translations/queries/translation-values.query.d.ts +1 -0
- package/translations/queries/translation-values.query.js +16 -0
- package/translations/requests/translation.request.d.ts +16 -0
- package/translations/requests/translation.request.js +99 -0
- package/translations/services/translations.service.d.ts +11 -0
- package/translations/services/translations.service.js +56 -0
- package/translations/services/translator.service.d.ts +11 -0
- package/translations/services/translator.service.js +56 -0
- package/translations/translations.controller.d.ts +8 -0
- package/translations/translations.controller.js +57 -0
- package/transport/entities/transport-client.d.ts +12 -0
- package/transport/entities/transport-client.js +67 -0
- package/transport/entities/transport-gateway-status.d.ts +9 -0
- package/transport/entities/transport-gateway-status.js +51 -0
- package/transport/entities/transport-gateway.d.ts +6 -0
- package/transport/entities/transport-gateway.js +35 -0
- package/transport/environment.d.ts +4 -0
- package/transport/environment.js +6 -0
- package/transport/index.d.ts +2 -0
- package/transport/index.js +18 -0
- package/transport/interfaces/index.d.ts +1 -0
- package/transport/interfaces/index.js +17 -0
- package/transport/interfaces/transport-module-options.d.ts +14 -0
- package/transport/interfaces/transport-module-options.js +8 -0
- package/transport/transport.module.d.ts +5 -0
- package/transport/transport.module.js +38 -0
- package/web-socket/constants.d.ts +1 -0
- package/web-socket/constants.js +4 -0
- package/web-socket/functions/encode-message.d.ts +2 -0
- package/web-socket/functions/encode-message.js +14 -0
- package/web-socket/functions/get-fake-http-context.d.ts +26 -0
- package/web-socket/functions/get-fake-http-context.js +55 -0
- package/web-socket/functions/get-ip-address.d.ts +1 -0
- package/web-socket/functions/get-ip-address.js +23 -0
- package/web-socket/functions/parse-message.d.ts +1 -0
- package/web-socket/functions/parse-message.js +10 -0
- package/web-socket/index.d.ts +5 -0
- package/web-socket/index.js +21 -0
- package/web-socket/interfaces/client.d.ts +15 -0
- package/web-socket/interfaces/client.js +2 -0
- package/web-socket/interfaces/enum/client-type.d.ts +4 -0
- package/web-socket/interfaces/enum/client-type.js +8 -0
- package/web-socket/interfaces/enum/index.d.ts +3 -0
- package/web-socket/interfaces/enum/index.js +19 -0
- package/web-socket/interfaces/enum/message-type.d.ts +6 -0
- package/web-socket/interfaces/enum/message-type.js +10 -0
- package/web-socket/interfaces/enum/ws-connection-type.d.ts +4 -0
- package/web-socket/interfaces/enum/ws-connection-type.js +8 -0
- package/web-socket/interfaces/index.d.ts +4 -0
- package/web-socket/interfaces/index.js +20 -0
- package/web-socket/interfaces/message.d.ts +30 -0
- package/web-socket/interfaces/message.js +2 -0
- package/web-socket/interfaces/ws-connection.d.ts +4 -0
- package/web-socket/interfaces/ws-connection.js +2 -0
- package/web-socket/web-socket.controller.d.ts +25 -0
- package/web-socket/web-socket.controller.js +184 -0
- package/workers/functions/decode-message.d.ts +2 -0
- package/workers/functions/decode-message.js +7 -0
- package/workers/functions/dispatch-task.d.ts +2 -0
- package/workers/functions/dispatch-task.js +23 -0
- package/workers/functions/encode-message.d.ts +2 -0
- package/workers/functions/encode-message.js +7 -0
- package/workers/interfaces/enum/index.d.ts +1 -0
- package/workers/interfaces/enum/index.js +17 -0
- package/workers/interfaces/enum/worker-message-type.d.ts +6 -0
- package/workers/interfaces/enum/worker-message-type.js +10 -0
- package/workers/interfaces/index.d.ts +3 -0
- package/workers/interfaces/index.js +19 -0
- package/workers/interfaces/worker-data.d.ts +9 -0
- package/workers/interfaces/worker-data.js +2 -0
- package/workers/interfaces/worker-message.d.ts +20 -0
- package/workers/interfaces/worker-message.js +2 -0
- package/workers/workers.controller.d.ts +6 -0
- package/workers/workers.controller.js +72 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var LocaleService_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.LocaleService = void 0;
|
|
14
|
+
const intl_1 = require("@formatjs/intl");
|
|
15
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
16
|
+
const common_1 = require("@rockster/common");
|
|
17
|
+
const logger_1 = require("@rockster/logger");
|
|
18
|
+
const path_1 = require("path");
|
|
19
|
+
let LocaleService = LocaleService_1 = class LocaleService {
|
|
20
|
+
get default() {
|
|
21
|
+
return LocaleService_1._default;
|
|
22
|
+
}
|
|
23
|
+
get cache() {
|
|
24
|
+
return LocaleService_1._cache;
|
|
25
|
+
}
|
|
26
|
+
get memory() {
|
|
27
|
+
return LocaleService_1._memory;
|
|
28
|
+
}
|
|
29
|
+
init() {
|
|
30
|
+
if (!core.options.locale) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const logger = new logger_1.Logger('Locale');
|
|
34
|
+
const options = core.options.locale;
|
|
35
|
+
const directory = options.directory;
|
|
36
|
+
const localeFiles = tryReadDir(directory);
|
|
37
|
+
LocaleService_1._default = options.default;
|
|
38
|
+
for (const localeFile of localeFiles) {
|
|
39
|
+
const filePath = (0, path_1.join)(directory, localeFile);
|
|
40
|
+
const messages = require(filePath);
|
|
41
|
+
const [name] = localeFile.split('.');
|
|
42
|
+
const locale = common_1.Locale[name.replace('-', '')];
|
|
43
|
+
if (!locale) {
|
|
44
|
+
logger.throw(new Error(`${name} is not a valid locale`));
|
|
45
|
+
}
|
|
46
|
+
const config = {
|
|
47
|
+
locale,
|
|
48
|
+
messages,
|
|
49
|
+
onError: () => { }
|
|
50
|
+
};
|
|
51
|
+
this.memory[locale] = (0, intl_1.createIntl)(config, this.cache);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
formatMessage({ locale, messageKey, replaces }) {
|
|
55
|
+
const intl = this.memory[locale || this.default] ||
|
|
56
|
+
this.memory[this.default];
|
|
57
|
+
return intl.formatMessage({ id: messageKey }, replaces);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.LocaleService = LocaleService;
|
|
61
|
+
LocaleService._cache = (0, intl_1.createIntlCache)();
|
|
62
|
+
LocaleService._memory = {};
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_injector_1.OnCreate)(),
|
|
65
|
+
__metadata("design:type", Function),
|
|
66
|
+
__metadata("design:paramtypes", []),
|
|
67
|
+
__metadata("design:returntype", void 0)
|
|
68
|
+
], LocaleService.prototype, "init", null);
|
|
69
|
+
exports.LocaleService = LocaleService = LocaleService_1 = __decorate([
|
|
70
|
+
(0, class_injector_1.Injectable)()
|
|
71
|
+
], LocaleService);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.NodeControlService = void 0;
|
|
13
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
14
|
+
const get_ip_address_1 = require("../../web-socket/functions/get-ip-address");
|
|
15
|
+
const crypto_1 = require("crypto");
|
|
16
|
+
const uuid_1 = require("uuid");
|
|
17
|
+
const cache_1 = require("../../cache");
|
|
18
|
+
let NodeControlService = class NodeControlService {
|
|
19
|
+
async registerNode() {
|
|
20
|
+
const address = (0, get_ip_address_1.getIpAddress)();
|
|
21
|
+
const port = core.options.port;
|
|
22
|
+
const url = `${address}:${port}`;
|
|
23
|
+
const privateKey = (0, crypto_1.createHmac)('sha256', (0, uuid_1.v4)()).digest('hex');
|
|
24
|
+
const key = `ROCKET:NODE:${core.options.name}:${url}`;
|
|
25
|
+
core.privateKey = privateKey;
|
|
26
|
+
core.nodeKey = key;
|
|
27
|
+
await this.cache.set(key, JSON.stringify({
|
|
28
|
+
address: address,
|
|
29
|
+
port: port,
|
|
30
|
+
url: url,
|
|
31
|
+
privateKey: privateKey,
|
|
32
|
+
}));
|
|
33
|
+
await this.cache.expire(key, 600);
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
this.registerNode();
|
|
36
|
+
}, 600000);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.NodeControlService = NodeControlService;
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, cache_1.InjectCache)(),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], NodeControlService.prototype, "cache", void 0);
|
|
44
|
+
exports.NodeControlService = NodeControlService = __decorate([
|
|
45
|
+
(0, class_injector_1.Injectable)()
|
|
46
|
+
], NodeControlService);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Instantiable } from "@rockster/common";
|
|
2
|
+
import { ObjectNote } from "@rockster/class-memory";
|
|
3
|
+
import { Object } from "../interfaces";
|
|
4
|
+
import { ObjectType } from "../../common";
|
|
5
|
+
export declare abstract class ObjectLoader<T extends Object> {
|
|
6
|
+
protected abstract objects: ObjectNote<T>[];
|
|
7
|
+
abstract build(targets: Instantiable[]): Promise<void> | void;
|
|
8
|
+
protected load(current: ObjectNote<Object>[], type: ObjectType, targets: Instantiable[]): ObjectNote<Object>[];
|
|
9
|
+
protected each(callback: (object: ObjectNote<T>) => Promise<void>): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectLoader = void 0;
|
|
4
|
+
class ObjectLoader {
|
|
5
|
+
load(current, type, targets) {
|
|
6
|
+
for (const target of targets) {
|
|
7
|
+
const object = core
|
|
8
|
+
.storage
|
|
9
|
+
.findObject(target);
|
|
10
|
+
if (object?.type === type) {
|
|
11
|
+
const compare = (source, target) => (source.objectClass === target.objectClass);
|
|
12
|
+
current.pushIfNotExists(object, compare);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return current;
|
|
16
|
+
}
|
|
17
|
+
async each(callback) {
|
|
18
|
+
for (const object of this.objects) {
|
|
19
|
+
if (object.initialized) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
await callback(object);
|
|
23
|
+
object.initialized = true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ObjectLoader = ObjectLoader;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PendingAction, IRequestContext } from "../interfaces";
|
|
2
|
+
export declare class RequestExecutor {
|
|
3
|
+
executeByDataSource(context: IRequestContext): Promise<import("@rockster/common").Dictionary<any>>;
|
|
4
|
+
executeByTransaction(context: IRequestContext): Promise<import("@rockster/common").Dictionary<any>>;
|
|
5
|
+
protected executeBefore(context: IRequestContext): Promise<void>;
|
|
6
|
+
protected executeActions(context: IRequestContext): Promise<void>;
|
|
7
|
+
protected executeSuccessCallbacks(context: IRequestContext): Promise<void>;
|
|
8
|
+
protected executeErrorCallbacks(error: Error, pending: PendingAction, context: IRequestContext): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RequestExecutor = void 0;
|
|
10
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
11
|
+
const transaction_context_1 = require("../../database/contexts/transaction-context");
|
|
12
|
+
let RequestExecutor = class RequestExecutor {
|
|
13
|
+
async executeByDataSource(context) {
|
|
14
|
+
for (const pending of context.pendings) {
|
|
15
|
+
try {
|
|
16
|
+
await pending.action.onBefore(pending, context);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
error.requestRef = pending.requestRef;
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
for (const pending of context.pendings) {
|
|
24
|
+
try {
|
|
25
|
+
await pending.action.execute(pending, context);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
error.requestRef = pending.requestRef;
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return context.response;
|
|
33
|
+
}
|
|
34
|
+
async executeByTransaction(context) {
|
|
35
|
+
await this.executeBefore(context);
|
|
36
|
+
await this.executeActions(context);
|
|
37
|
+
await this.executeSuccessCallbacks(context);
|
|
38
|
+
return context.response;
|
|
39
|
+
}
|
|
40
|
+
async executeBefore(context) {
|
|
41
|
+
for (const pending of context.pendings) {
|
|
42
|
+
try {
|
|
43
|
+
await pending.action.onBefore(pending, context);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
error.requestRef = pending.requestRef;
|
|
47
|
+
await this
|
|
48
|
+
.executeErrorCallbacks(error, pending, context);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async executeActions(context) {
|
|
54
|
+
let actionError;
|
|
55
|
+
const dataSource = core.database.dataSource;
|
|
56
|
+
const queryRunner = dataSource.createQueryRunner();
|
|
57
|
+
const entityManager = queryRunner.manager;
|
|
58
|
+
context.entityManager = entityManager;
|
|
59
|
+
await transaction_context_1.transactionContextStore.run({ entityManager }, async () => {
|
|
60
|
+
try {
|
|
61
|
+
await queryRunner.connect();
|
|
62
|
+
await queryRunner.startTransaction();
|
|
63
|
+
for (const pending of context.pendings) {
|
|
64
|
+
try {
|
|
65
|
+
await pending.action.execute(pending, context);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
error.requestRef = pending.requestRef;
|
|
69
|
+
actionError = error;
|
|
70
|
+
await this
|
|
71
|
+
.executeErrorCallbacks(error, pending, context);
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
await queryRunner.commitTransaction();
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
await queryRunner.rollbackTransaction();
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
await queryRunner.release();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
if (actionError) {
|
|
85
|
+
throw actionError;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async executeSuccessCallbacks(context) {
|
|
89
|
+
for (const callback of context.callbacks.success) {
|
|
90
|
+
await callback.handle();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async executeErrorCallbacks(error, pending, context) {
|
|
94
|
+
const callbacks = context
|
|
95
|
+
.callbacks
|
|
96
|
+
.error
|
|
97
|
+
.filter((callback) => {
|
|
98
|
+
return callback.name === pending.path;
|
|
99
|
+
});
|
|
100
|
+
for (const callback of callbacks) {
|
|
101
|
+
await callback.handle(error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
exports.RequestExecutor = RequestExecutor;
|
|
106
|
+
exports.RequestExecutor = RequestExecutor = __decorate([
|
|
107
|
+
(0, class_injector_1.Injectable)()
|
|
108
|
+
], RequestExecutor);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpController } from "../../http";
|
|
2
|
+
import { RequestExecutor } from "./request-executor";
|
|
3
|
+
import { ContextBuilder } from "./context-builder";
|
|
4
|
+
import { Logger } from "@rockster/logger";
|
|
5
|
+
export declare class RequestRouter {
|
|
6
|
+
protected contextBuilder: ContextBuilder;
|
|
7
|
+
protected requestExecutor: RequestExecutor;
|
|
8
|
+
protected requestPath: string;
|
|
9
|
+
protected docsPath: string;
|
|
10
|
+
protected logger: Logger;
|
|
11
|
+
constructor(contextBuilder: ContextBuilder, requestExecutor: RequestExecutor);
|
|
12
|
+
start(http: HttpController): void;
|
|
13
|
+
protected postRequest(http: HttpController): void;
|
|
14
|
+
protected getDocs(http: HttpController): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RequestRouter = void 0;
|
|
13
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
14
|
+
const security_1 = require("../../security");
|
|
15
|
+
const request_executor_1 = require("./request-executor");
|
|
16
|
+
const context_builder_1 = require("./context-builder");
|
|
17
|
+
const logger_1 = require("@rockster/logger");
|
|
18
|
+
const database_1 = require("../../database");
|
|
19
|
+
const use_auth_1 = require("../../security/functions/use-auth");
|
|
20
|
+
const class_pipe_1 = require("@rockster/class-pipe");
|
|
21
|
+
const common_1 = require("@rockster/common");
|
|
22
|
+
let RequestRouter = class RequestRouter {
|
|
23
|
+
constructor(contextBuilder, requestExecutor) {
|
|
24
|
+
this.contextBuilder = contextBuilder;
|
|
25
|
+
this.requestExecutor = requestExecutor;
|
|
26
|
+
this.requestPath = '/request';
|
|
27
|
+
this.docsPath = '/docs';
|
|
28
|
+
this.logger = new logger_1.Logger('Docs');
|
|
29
|
+
}
|
|
30
|
+
start(http) {
|
|
31
|
+
this.postRequest(http);
|
|
32
|
+
this.getDocs(http);
|
|
33
|
+
}
|
|
34
|
+
postRequest(http) {
|
|
35
|
+
const method = common_1.HttpMethod.post;
|
|
36
|
+
const transaction = (0, database_1.useTransaction)();
|
|
37
|
+
const execute = transaction
|
|
38
|
+
? this
|
|
39
|
+
.requestExecutor
|
|
40
|
+
.executeByTransaction
|
|
41
|
+
.bind(this.requestExecutor)
|
|
42
|
+
: this
|
|
43
|
+
.requestExecutor
|
|
44
|
+
.executeByDataSource
|
|
45
|
+
.bind(this.requestExecutor);
|
|
46
|
+
http.addRoute(method, this.requestPath, async (req, res) => {
|
|
47
|
+
try {
|
|
48
|
+
const requestContext = this
|
|
49
|
+
.contextBuilder
|
|
50
|
+
.build({
|
|
51
|
+
body: req.body,
|
|
52
|
+
headers: req.headers,
|
|
53
|
+
httpRequest: req
|
|
54
|
+
});
|
|
55
|
+
if (requestContext.isAuthenticated && (0, security_1.isAuthEnabled)() && !req.isWs) {
|
|
56
|
+
requestContext.session = await (0, use_auth_1.useAuth)().httpInterceptor(req);
|
|
57
|
+
}
|
|
58
|
+
if (req.isWs) {
|
|
59
|
+
requestContext.session = req.session;
|
|
60
|
+
}
|
|
61
|
+
const result = await execute(requestContext);
|
|
62
|
+
res.status(common_1.HttpStatus.ok).json(result);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
const code = error.httpCode || common_1.HttpStatus.internalServerError;
|
|
66
|
+
const body = code === common_1.HttpStatus.internalServerError ? null : error;
|
|
67
|
+
res.status(code).json(body);
|
|
68
|
+
core.options?.onRequestError?.apply(this, [error]);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
getDocs(http) {
|
|
73
|
+
const method = common_1.HttpMethod.get;
|
|
74
|
+
const actions = core
|
|
75
|
+
.actions
|
|
76
|
+
.filter((action) => {
|
|
77
|
+
return action.docs;
|
|
78
|
+
})
|
|
79
|
+
.map((action) => {
|
|
80
|
+
return action.docs;
|
|
81
|
+
});
|
|
82
|
+
const models = core.models.map((model) => {
|
|
83
|
+
const objectDocs = (0, class_pipe_1.getDocs)(model);
|
|
84
|
+
objectDocs.properties.forEach((propertyDocs) => {
|
|
85
|
+
const propertyNote = core
|
|
86
|
+
.storage
|
|
87
|
+
.findProperty(model, propertyDocs.name);
|
|
88
|
+
propertyDocs.onlyModify = propertyNote?.onlyModify;
|
|
89
|
+
propertyDocs.readOnly = propertyNote?.readOnly;
|
|
90
|
+
});
|
|
91
|
+
return objectDocs;
|
|
92
|
+
});
|
|
93
|
+
if (core.options.docs) {
|
|
94
|
+
if (core.options.docs.public) {
|
|
95
|
+
http.addRoute(method, this.docsPath, (req, res) => {
|
|
96
|
+
res.status(common_1.HttpStatus.ok).json({
|
|
97
|
+
actions,
|
|
98
|
+
models
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
http.addRoute(method, this.docsPath, async (req, res) => {
|
|
104
|
+
try {
|
|
105
|
+
await (0, use_auth_1.useAuth)().httpInterceptor(req);
|
|
106
|
+
res.status(common_1.HttpStatus.ok).json({
|
|
107
|
+
actions,
|
|
108
|
+
models
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const code = error.httpCode ||
|
|
113
|
+
common_1.HttpStatus.internalServerError;
|
|
114
|
+
res.status(code).json(error);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
this.logger.log('Enabled');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
exports.RequestRouter = RequestRouter;
|
|
123
|
+
exports.RequestRouter = RequestRouter = __decorate([
|
|
124
|
+
(0, class_injector_1.Injectable)(),
|
|
125
|
+
__metadata("design:paramtypes", [context_builder_1.ContextBuilder,
|
|
126
|
+
request_executor_1.RequestExecutor])
|
|
127
|
+
], RequestRouter);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './transaction-context';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./transaction-context"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Instantiable } from "@rockster/common";
|
|
2
|
+
import { DataSource } from "typeorm";
|
|
3
|
+
import { ObjectNote } from "@rockster/class-memory";
|
|
4
|
+
import { ObjectLoader } from "../core";
|
|
5
|
+
import { IEntityObject } from "./interfaces";
|
|
6
|
+
import { PathsBuilder } from "./services/paths-builder";
|
|
7
|
+
import { ProtectBuilder } from "./services/protect-builder";
|
|
8
|
+
export declare class DatabaseController extends ObjectLoader<IEntityObject> {
|
|
9
|
+
protected pathsBuilder: PathsBuilder;
|
|
10
|
+
protected protectBuilder: ProtectBuilder;
|
|
11
|
+
static _objects: ObjectNote<IEntityObject>[];
|
|
12
|
+
static _dataSource: DataSource;
|
|
13
|
+
protected get objects(): ObjectNote<IEntityObject>[];
|
|
14
|
+
get dataSource(): DataSource;
|
|
15
|
+
protected set dataSource(value: DataSource);
|
|
16
|
+
constructor(pathsBuilder: PathsBuilder, protectBuilder: ProtectBuilder);
|
|
17
|
+
addMigrations(migrations: (string | Function)[]): Promise<void>;
|
|
18
|
+
build(targets: Instantiable[]): Promise<void>;
|
|
19
|
+
initialize(): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var DatabaseController_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.DatabaseController = void 0;
|
|
14
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
const logger_1 = require("@rockster/logger");
|
|
17
|
+
const core_1 = require("../core");
|
|
18
|
+
const common_1 = require("../common");
|
|
19
|
+
const paths_builder_1 = require("./services/paths-builder");
|
|
20
|
+
const protect_builder_1 = require("./services/protect-builder");
|
|
21
|
+
const environment_1 = require("./environment");
|
|
22
|
+
const typeorm_naming_strategies_1 = require("typeorm-naming-strategies");
|
|
23
|
+
let DatabaseController = DatabaseController_1 = class DatabaseController extends core_1.ObjectLoader {
|
|
24
|
+
get objects() {
|
|
25
|
+
return DatabaseController_1._objects;
|
|
26
|
+
}
|
|
27
|
+
get dataSource() {
|
|
28
|
+
return DatabaseController_1._dataSource;
|
|
29
|
+
}
|
|
30
|
+
set dataSource(value) {
|
|
31
|
+
DatabaseController_1._dataSource = value;
|
|
32
|
+
}
|
|
33
|
+
constructor(pathsBuilder, protectBuilder) {
|
|
34
|
+
super();
|
|
35
|
+
this.pathsBuilder = pathsBuilder;
|
|
36
|
+
this.protectBuilder = protectBuilder;
|
|
37
|
+
}
|
|
38
|
+
async addMigrations(migrations) {
|
|
39
|
+
if (!core.options?.database.migrations) {
|
|
40
|
+
core.options.database = {
|
|
41
|
+
...core.options.database,
|
|
42
|
+
migrations: []
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
migrations.forEach((migration) => {
|
|
46
|
+
const migrations = core
|
|
47
|
+
.options
|
|
48
|
+
.database
|
|
49
|
+
.migrations;
|
|
50
|
+
migrations.push(migration);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async build(targets) {
|
|
54
|
+
super.load(this.objects, common_1.ObjectType.entity, targets);
|
|
55
|
+
await this.each(async (object) => {
|
|
56
|
+
await this.pathsBuilder.build(object);
|
|
57
|
+
await this.protectBuilder.build(object);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async initialize() {
|
|
61
|
+
if (this.dataSource) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
environment_1.environment
|
|
65
|
+
.oneToManyRegistrations
|
|
66
|
+
.forEach((value) => {
|
|
67
|
+
value.handle();
|
|
68
|
+
});
|
|
69
|
+
const logger = new logger_1.Logger('Database');
|
|
70
|
+
this.dataSource =
|
|
71
|
+
new typeorm_1.DataSource({
|
|
72
|
+
type: 'postgres',
|
|
73
|
+
...core.options.database,
|
|
74
|
+
namingStrategy: new typeorm_naming_strategies_1.SnakeNamingStrategy(),
|
|
75
|
+
entities: this
|
|
76
|
+
.objects
|
|
77
|
+
.map((entity) => {
|
|
78
|
+
return entity.objectClass;
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
await this.dataSource.initialize();
|
|
82
|
+
core.database = this;
|
|
83
|
+
logger.log('Successfully connected');
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.DatabaseController = DatabaseController;
|
|
87
|
+
DatabaseController._objects = [];
|
|
88
|
+
exports.DatabaseController = DatabaseController = DatabaseController_1 = __decorate([
|
|
89
|
+
(0, class_injector_1.Injectable)(),
|
|
90
|
+
__metadata("design:paramtypes", [paths_builder_1.PathsBuilder,
|
|
91
|
+
protect_builder_1.ProtectBuilder])
|
|
92
|
+
], DatabaseController);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ColumnOptions } from "typeorm";
|
|
2
|
+
import { ColumnCommonOptions } from "typeorm/decorator/options/ColumnCommonOptions";
|
|
3
|
+
import { ColumnEmbeddedOptions } from "typeorm/decorator/options/ColumnEmbeddedOptions";
|
|
4
|
+
import { ColumnEnumOptions } from "typeorm/decorator/options/ColumnEnumOptions";
|
|
5
|
+
import { ColumnHstoreOptions } from "typeorm/decorator/options/ColumnHstoreOptions";
|
|
6
|
+
import { ColumnNumericOptions } from "typeorm/decorator/options/ColumnNumericOptions";
|
|
7
|
+
import { ColumnWithLengthOptions } from "typeorm/decorator/options/ColumnWithLengthOptions";
|
|
8
|
+
import { SpatialColumnOptions } from "typeorm/decorator/options/SpatialColumnOptions";
|
|
9
|
+
import { SimpleColumnType, SpatialColumnType, WithLengthColumnType, WithPrecisionColumnType } from "typeorm/driver/types/ColumnTypes";
|
|
10
|
+
/**
|
|
11
|
+
* Column decorator is used to mark a specific class property as a table column. Only properties decorated with this
|
|
12
|
+
* decorator will be persisted to the database when entity be saved.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Column(): any;
|
|
15
|
+
/**
|
|
16
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
17
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Column(options: ColumnOptions): any;
|
|
20
|
+
/**
|
|
21
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
22
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Column(type: SimpleColumnType, options?: ColumnCommonOptions): any;
|
|
25
|
+
/**
|
|
26
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
27
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Column(type: SpatialColumnType, options?: ColumnCommonOptions & SpatialColumnOptions): any;
|
|
30
|
+
/**
|
|
31
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
32
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
33
|
+
*/
|
|
34
|
+
export declare function Column(type: WithLengthColumnType, options?: ColumnCommonOptions & ColumnWithLengthOptions): any;
|
|
35
|
+
/**
|
|
36
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
37
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
41
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
42
|
+
*/
|
|
43
|
+
export declare function Column(type: WithPrecisionColumnType, options?: ColumnCommonOptions & ColumnNumericOptions): any;
|
|
44
|
+
/**
|
|
45
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
46
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
47
|
+
*/
|
|
48
|
+
export declare function Column(type: "enum", options?: ColumnCommonOptions & ColumnEnumOptions): any;
|
|
49
|
+
/**
|
|
50
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
51
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
52
|
+
*/
|
|
53
|
+
export declare function Column(type: "simple-enum", options?: ColumnCommonOptions & ColumnEnumOptions): any;
|
|
54
|
+
/**
|
|
55
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
56
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
57
|
+
*/
|
|
58
|
+
export declare function Column(type: "set", options?: ColumnCommonOptions & ColumnEnumOptions): any;
|
|
59
|
+
/**
|
|
60
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
61
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
62
|
+
*/
|
|
63
|
+
export declare function Column(type: "hstore", options?: ColumnCommonOptions & ColumnHstoreOptions): any;
|
|
64
|
+
/**
|
|
65
|
+
* Column decorator is used to mark a specific class property as a table column.
|
|
66
|
+
* Only properties decorated with this decorator will be persisted to the database when entity be saved.
|
|
67
|
+
*
|
|
68
|
+
* Property in entity can be marked as Embedded, and on persist all columns from the embedded are mapped to the
|
|
69
|
+
* single table of the entity where Embedded is used. And on hydration all columns which supposed to be in the
|
|
70
|
+
* embedded will be mapped to it from the single table.
|
|
71
|
+
*/
|
|
72
|
+
export declare function Column(type: (type?: any) => Function, options?: ColumnEmbeddedOptions): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Column = Column;
|
|
4
|
+
const column_decorator_1 = require("../functions/column-decorator");
|
|
5
|
+
function Column(type, options) {
|
|
6
|
+
return (target, propertyKey) => {
|
|
7
|
+
(0, column_decorator_1.columnDecorator)(target, propertyKey, type, options);
|
|
8
|
+
};
|
|
9
|
+
}
|