@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,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadProperties = void 0;
|
|
4
|
+
const class_pipe_1 = require("@rockster/class-pipe");
|
|
5
|
+
const object_type_1 = require("../../common/interfaces/enum/object-type");
|
|
6
|
+
const get_id_property_1 = require("../../database/functions/get-id-property");
|
|
7
|
+
const loadProperties = ({ type, target, alias, entityAlias, properties, parent, paths, relation, fullPath = '', secure, initializedObjects = [], rootEntity, rootFullPath }) => {
|
|
8
|
+
// fullPath agora representa o caminho global (root até aqui)
|
|
9
|
+
const currentPath = fullPath ? `${fullPath}.${alias}` : alias;
|
|
10
|
+
;
|
|
11
|
+
const initializedObjectKey = `${currentPath}:${target.name}`;
|
|
12
|
+
if (initializedObjects.includes(initializedObjectKey))
|
|
13
|
+
return;
|
|
14
|
+
initializedObjects.push(initializedObjectKey);
|
|
15
|
+
const targetProperties = (0, class_pipe_1.getExposeProperties)(target);
|
|
16
|
+
targetProperties
|
|
17
|
+
.filter((property) => {
|
|
18
|
+
if (property.subtype) {
|
|
19
|
+
const object = core.storage.findObject(property.subtype);
|
|
20
|
+
const isEntity = object?.type === object_type_1.ObjectType.entity;
|
|
21
|
+
return !isEntity;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
})
|
|
25
|
+
.forEach((targetProperty) => {
|
|
26
|
+
const propertyKey = targetProperty.propertyKey;
|
|
27
|
+
const globalPath = `${currentPath}.${propertyKey}`;
|
|
28
|
+
let columnName;
|
|
29
|
+
const entityProperty = core
|
|
30
|
+
.storage
|
|
31
|
+
.getProperties(targetProperty.objectClass)
|
|
32
|
+
.find((p) => p.propertyKey === propertyKey);
|
|
33
|
+
if (entityProperty) {
|
|
34
|
+
columnName = entityProperty.columnName;
|
|
35
|
+
}
|
|
36
|
+
if (type === 'root' && !entityProperty) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if ((targetProperty.type === class_pipe_1.PropertyType.object && targetProperty.subtype)
|
|
40
|
+
|| targetProperty.ifChecks?.length > 0) {
|
|
41
|
+
const hasIfChecks = targetProperty.ifChecks?.length > 0;
|
|
42
|
+
const objectTypes = hasIfChecks
|
|
43
|
+
? targetProperty.ifChecks.map((ifCheck) => ifCheck.type)
|
|
44
|
+
: [targetProperty.subtype];
|
|
45
|
+
objectTypes.forEach((objectType) => {
|
|
46
|
+
(0, exports.loadProperties)({
|
|
47
|
+
type: 'embedded',
|
|
48
|
+
alias: propertyKey,
|
|
49
|
+
properties,
|
|
50
|
+
target: objectType,
|
|
51
|
+
fullPath: currentPath,
|
|
52
|
+
initializedObjects,
|
|
53
|
+
rootEntity,
|
|
54
|
+
rootFullPath: type === "embedded"
|
|
55
|
+
? rootFullPath
|
|
56
|
+
: `${currentPath}.${targetProperty.propertyKey}`,
|
|
57
|
+
parent: {
|
|
58
|
+
alias,
|
|
59
|
+
target,
|
|
60
|
+
type,
|
|
61
|
+
parent,
|
|
62
|
+
entityAlias
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
properties[globalPath] = {
|
|
69
|
+
path: {
|
|
70
|
+
target,
|
|
71
|
+
alias,
|
|
72
|
+
type,
|
|
73
|
+
relation,
|
|
74
|
+
parent,
|
|
75
|
+
secure,
|
|
76
|
+
entityAlias,
|
|
77
|
+
rootOrRelationFullPath: rootFullPath
|
|
78
|
+
},
|
|
79
|
+
isUUID: targetProperty.type === class_pipe_1.PropertyType.string
|
|
80
|
+
&& targetProperty.validatorsConfigs?.some((cfg) => cfg.type === 'isUUID') || false,
|
|
81
|
+
columnName,
|
|
82
|
+
isArray: !!targetProperty.isArray,
|
|
83
|
+
isJson: !!targetProperty.isJSON,
|
|
84
|
+
fullPath: globalPath,
|
|
85
|
+
name: propertyKey,
|
|
86
|
+
type: targetProperty.type
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (paths) {
|
|
91
|
+
const idProperty = (0, get_id_property_1.getIdProperty)(target);
|
|
92
|
+
const pathKeys = Object.keys(paths);
|
|
93
|
+
for (const pathProperty of pathKeys) {
|
|
94
|
+
const path = paths[pathProperty];
|
|
95
|
+
const linkProperty = (path.type === 'indirect'
|
|
96
|
+
? core.storage.getProperties(path.target()).find((p) => p.isRelation && p.getRelationType() === target)
|
|
97
|
+
: core.storage.getProperties(target).find((p) => p.isRelation && p.getRelationType() === path.target()));
|
|
98
|
+
if (!linkProperty) {
|
|
99
|
+
const line1 = `Unable to find linkProperty to ${path.alias}:${path.target()?.name} into query:${target.name}`;
|
|
100
|
+
const line2 = `Use @Relation(() => <target>) to define`;
|
|
101
|
+
throw new Error(`${line1}\n${line2}`);
|
|
102
|
+
}
|
|
103
|
+
const targetIdProperty = (0, get_id_property_1.getIdProperty)(path.target());
|
|
104
|
+
const condition = path.condition ?? (() => {
|
|
105
|
+
const linkName = path.linkProperty || linkProperty.columnName;
|
|
106
|
+
return path.type === "direct"
|
|
107
|
+
? `"${entityAlias}"."${linkName}" = "${path.alias}"."${targetIdProperty.columnName}"`
|
|
108
|
+
: `"${entityAlias}"."${idProperty.columnName}" = "${path.alias}"."${linkName}"`;
|
|
109
|
+
})();
|
|
110
|
+
(0, exports.loadProperties)({
|
|
111
|
+
alias: pathProperty,
|
|
112
|
+
entityAlias: path.alias,
|
|
113
|
+
properties,
|
|
114
|
+
target: path.target(),
|
|
115
|
+
type: "relation",
|
|
116
|
+
paths: path.paths,
|
|
117
|
+
secure: path.secure,
|
|
118
|
+
rootEntity,
|
|
119
|
+
relation: {
|
|
120
|
+
type: path.type,
|
|
121
|
+
mapTo: `${alias}.${pathProperty}`,
|
|
122
|
+
condition,
|
|
123
|
+
},
|
|
124
|
+
fullPath: currentPath,
|
|
125
|
+
parent: {
|
|
126
|
+
alias,
|
|
127
|
+
target,
|
|
128
|
+
type,
|
|
129
|
+
relation,
|
|
130
|
+
parent,
|
|
131
|
+
entityAlias
|
|
132
|
+
},
|
|
133
|
+
initializedObjects
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
exports.loadProperties = loadProperties;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapQueryPropertyToColumnName = void 0;
|
|
4
|
+
const mapQueryPropertyToColumnName = (queryObject, item) => {
|
|
5
|
+
const queryProperties = queryObject.properties;
|
|
6
|
+
const queryProperty = queryProperties[item];
|
|
7
|
+
switch (queryProperty.path.type) {
|
|
8
|
+
case "relation":
|
|
9
|
+
case "root":
|
|
10
|
+
return `${queryProperty.path.entityAlias}.${queryProperty.name}`;
|
|
11
|
+
case "embedded":
|
|
12
|
+
return queryProperty.path.rootOrRelationFullPath;
|
|
13
|
+
default:
|
|
14
|
+
throw new Error(`${item} not found on query`);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.mapQueryPropertyToColumnName = mapQueryPropertyToColumnName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replacePropertyKeyToColumnName: (item: string, alias: string, propertyKey: string, columnName: string) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replacePropertyKeyToColumnName = void 0;
|
|
4
|
+
const replacePropertyKeyToColumnName = (item, alias, propertyKey, columnName) => {
|
|
5
|
+
const replacedProperty = item.replace(propertyKey, columnName);
|
|
6
|
+
return !columnName.includes('_')
|
|
7
|
+
? replacedProperty
|
|
8
|
+
: item;
|
|
9
|
+
};
|
|
10
|
+
exports.replacePropertyKeyToColumnName = replacePropertyKeyToColumnName;
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./query-action-options"), exports);
|
|
18
|
+
__exportStar(require("./query-object"), exports);
|
|
19
|
+
__exportStar(require("./query"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type QueryActionOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Custom name for action
|
|
4
|
+
*/
|
|
5
|
+
name?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Default: false. Define the action is public and is not necessary to pass and userId
|
|
8
|
+
*/
|
|
9
|
+
public?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Description for docs
|
|
12
|
+
*/
|
|
13
|
+
description?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ObjectType } from "../../common";
|
|
2
|
+
import { Dictionary } from "@rockster/common";
|
|
3
|
+
import { QueryProperty } from "./query";
|
|
4
|
+
import { IObject } from "../../core";
|
|
5
|
+
import { RootPath } from "../../database";
|
|
6
|
+
export interface IQueryObject extends IObject {
|
|
7
|
+
readonly type: ObjectType.query;
|
|
8
|
+
properties: Dictionary<QueryProperty>;
|
|
9
|
+
rootPath: RootPath<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PropertyType } from "@rockster/class-pipe";
|
|
2
|
+
import { Instantiable } from "@rockster/common";
|
|
3
|
+
import { GetConditionCallback } from "../../database/interfaces/path";
|
|
4
|
+
export type OrderBy = {
|
|
5
|
+
direction: 'desc' | 'asc';
|
|
6
|
+
property: string;
|
|
7
|
+
};
|
|
8
|
+
export type Query<Entity> = {
|
|
9
|
+
select: string[];
|
|
10
|
+
filter?: string;
|
|
11
|
+
orderBy?: OrderBy[];
|
|
12
|
+
take?: number;
|
|
13
|
+
skip?: number;
|
|
14
|
+
total?: number;
|
|
15
|
+
filtered?: number;
|
|
16
|
+
data?: Entity[];
|
|
17
|
+
page?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type IQueryContent<Entity, ContextData = any> = {
|
|
20
|
+
userId?: string;
|
|
21
|
+
naviteSelect?: string[];
|
|
22
|
+
parameters?: Record<string, any>;
|
|
23
|
+
query: Query<Entity>;
|
|
24
|
+
target: Instantiable;
|
|
25
|
+
requestRef?: string;
|
|
26
|
+
context?: ContextData;
|
|
27
|
+
rootAlias?: string;
|
|
28
|
+
};
|
|
29
|
+
export type QueryRelationConfig = {
|
|
30
|
+
type: 'direct' | 'indirect';
|
|
31
|
+
mapTo?: string;
|
|
32
|
+
condition: string | GetConditionCallback<any>;
|
|
33
|
+
};
|
|
34
|
+
export type QueryPropertyType = 'root' | 'embedded' | 'relation';
|
|
35
|
+
export type QueryPath = {
|
|
36
|
+
target: Instantiable;
|
|
37
|
+
alias: string;
|
|
38
|
+
type: QueryPropertyType;
|
|
39
|
+
relation?: QueryRelationConfig;
|
|
40
|
+
parent?: QueryPath;
|
|
41
|
+
secure?: boolean;
|
|
42
|
+
entityAlias: string;
|
|
43
|
+
rootOrRelationFullPath?: string;
|
|
44
|
+
};
|
|
45
|
+
export type QueryProperty = {
|
|
46
|
+
path: QueryPath;
|
|
47
|
+
isUUID?: boolean;
|
|
48
|
+
isArray?: boolean;
|
|
49
|
+
isJson?: boolean;
|
|
50
|
+
name: string;
|
|
51
|
+
type: PropertyType;
|
|
52
|
+
fullPath: string;
|
|
53
|
+
columnName?: string;
|
|
54
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OrderBy, Query } from "../interfaces/query";
|
|
2
|
+
export declare class BaseQueryResponse<T> implements Query<T> {
|
|
3
|
+
take?: number;
|
|
4
|
+
skip?: number;
|
|
5
|
+
total?: number;
|
|
6
|
+
filtered?: number;
|
|
7
|
+
data?: T[];
|
|
8
|
+
select: string[];
|
|
9
|
+
filter?: string;
|
|
10
|
+
orderBy?: OrderBy[];
|
|
11
|
+
page?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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.BaseQueryResponse = void 0;
|
|
13
|
+
const class_pipe_1 = require("@rockster/class-pipe");
|
|
14
|
+
class BaseQueryResponse {
|
|
15
|
+
}
|
|
16
|
+
exports.BaseQueryResponse = BaseQueryResponse;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_pipe_1.Expose)(),
|
|
19
|
+
(0, class_pipe_1.IsInt)(),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], BaseQueryResponse.prototype, "take", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_pipe_1.Expose)(),
|
|
24
|
+
(0, class_pipe_1.IsInt)(),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], BaseQueryResponse.prototype, "skip", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_pipe_1.Expose)(),
|
|
29
|
+
(0, class_pipe_1.IsInt)(),
|
|
30
|
+
__metadata("design:type", Number)
|
|
31
|
+
], BaseQueryResponse.prototype, "total", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_pipe_1.Expose)(),
|
|
34
|
+
(0, class_pipe_1.IsInt)(),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], BaseQueryResponse.prototype, "filtered", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_pipe_1.Expose)(),
|
|
39
|
+
(0, class_pipe_1.IsArray)(),
|
|
40
|
+
__metadata("design:type", Array)
|
|
41
|
+
], BaseQueryResponse.prototype, "data", void 0);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ObjectNote, PropertyNote } from "@rockster/class-memory";
|
|
2
|
+
import { IControllerObject, IControllerProperty } from "../../controllers/interfaces";
|
|
3
|
+
import { ExecuteInterceptorHandle, IActionDocs, PendingAction, IRequestContext } from "../../core";
|
|
4
|
+
import { ExecutorData } from "@rockster/class-injector/interfaces";
|
|
5
|
+
import { Dictionary } from "@rockster/common";
|
|
6
|
+
export declare class QueryActionBuilder {
|
|
7
|
+
protected beforeInterceptors: Dictionary<ExecuteInterceptorHandle>;
|
|
8
|
+
protected afterInterceptors: Dictionary<ExecuteInterceptorHandle>;
|
|
9
|
+
protected beforeValidationInterceptors: Dictionary<ExecuteInterceptorHandle>;
|
|
10
|
+
create(object: ObjectNote<IControllerObject>): Promise<void>;
|
|
11
|
+
protected createDocs(object: ObjectNote<IControllerObject>, property: PropertyNote<IControllerProperty>, name: string, path: string, isSecure: boolean): IActionDocs;
|
|
12
|
+
protected onBefore(pending: PendingAction, context: IRequestContext, property: PropertyNote<IControllerProperty>): Promise<void>;
|
|
13
|
+
protected execute(pending: PendingAction, context: IRequestContext, data: ExecutorData, property: PropertyNote<IControllerProperty>): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
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.QueryActionBuilder = void 0;
|
|
10
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
11
|
+
const interfaces_1 = require("../../controllers/interfaces");
|
|
12
|
+
const core_1 = require("../../core");
|
|
13
|
+
const class_pipe_1 = require("@rockster/class-pipe");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
const constants_2 = require("../../controllers/constants");
|
|
16
|
+
const describe_query_filter_1 = require("../functions/describe-query-filter");
|
|
17
|
+
const web_socket_1 = require("../../web-socket");
|
|
18
|
+
let QueryActionBuilder = class QueryActionBuilder {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.beforeInterceptors = {};
|
|
21
|
+
this.afterInterceptors = {};
|
|
22
|
+
this.beforeValidationInterceptors = {};
|
|
23
|
+
}
|
|
24
|
+
async create(object) {
|
|
25
|
+
const data = await (0, class_injector_1.createExecutors)(object.objectClass);
|
|
26
|
+
const properties = core
|
|
27
|
+
.storage
|
|
28
|
+
.getProperties(object.objectClass)
|
|
29
|
+
.filter((property) => {
|
|
30
|
+
return property.actionType === constants_1.QUERY_ACTION_TYPE;
|
|
31
|
+
});
|
|
32
|
+
for (const property of properties) {
|
|
33
|
+
const isSecure = !property.public;
|
|
34
|
+
const name = property.name || property.propertyKey;
|
|
35
|
+
const path = (0, core_1.getActionPath)(object.alias, name);
|
|
36
|
+
this.beforeInterceptors[path] =
|
|
37
|
+
(0, core_1.createExecuteInterceptors)([core_1.commonInterceptor.onBeforeExecute], object, property);
|
|
38
|
+
this.afterInterceptors[path] =
|
|
39
|
+
(0, core_1.createExecuteInterceptors)([core_1.commonInterceptor.onAfterExecute], object, property);
|
|
40
|
+
this.beforeValidationInterceptors[path] =
|
|
41
|
+
(0, core_1.createExecuteInterceptors)([interfaces_1.requestInterceptor.onBeforeValidation], object, property);
|
|
42
|
+
(0, core_1.createAction)({
|
|
43
|
+
objectClass: object.objectClass,
|
|
44
|
+
path: path,
|
|
45
|
+
name: name,
|
|
46
|
+
secure: isSecure,
|
|
47
|
+
execute: async (action, context) => {
|
|
48
|
+
return this
|
|
49
|
+
.execute(action, context, data.executors[name], property);
|
|
50
|
+
},
|
|
51
|
+
onBefore: async (action, context) => {
|
|
52
|
+
return this
|
|
53
|
+
.onBefore(action, context, property);
|
|
54
|
+
},
|
|
55
|
+
docs: this
|
|
56
|
+
.createDocs(object, property, name, path, isSecure)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
createDocs(object, property, name, path, isSecure) {
|
|
61
|
+
const Payload = property.data;
|
|
62
|
+
const Response = property.getResponseType();
|
|
63
|
+
core.models.pushIfNotExists(Payload);
|
|
64
|
+
core.models.pushIfNotExists(Response);
|
|
65
|
+
return {
|
|
66
|
+
alias: object.alias,
|
|
67
|
+
name: name,
|
|
68
|
+
path: path,
|
|
69
|
+
description: property.description,
|
|
70
|
+
isSecure: isSecure,
|
|
71
|
+
payload: Payload.name,
|
|
72
|
+
response: Response.name
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async onBefore(pending, context, property) {
|
|
76
|
+
if (property.data) {
|
|
77
|
+
const payload = context.request[pending.requestRef];
|
|
78
|
+
await this.beforeValidationInterceptors[pending.path]({
|
|
79
|
+
action: pending,
|
|
80
|
+
context: context,
|
|
81
|
+
property: property
|
|
82
|
+
});
|
|
83
|
+
const errors = await (0, class_pipe_1.validate)(property.data, payload);
|
|
84
|
+
if (errors) {
|
|
85
|
+
errors.target = pending.requestRef;
|
|
86
|
+
throw errors;
|
|
87
|
+
}
|
|
88
|
+
const sanitized = {
|
|
89
|
+
select: payload.select,
|
|
90
|
+
filter: payload.filter,
|
|
91
|
+
orderBy: payload.orderBy,
|
|
92
|
+
skip: payload.skip || 0,
|
|
93
|
+
take: payload.take || 10,
|
|
94
|
+
page: typeof payload.page === 'boolean'
|
|
95
|
+
? payload.page
|
|
96
|
+
: true
|
|
97
|
+
};
|
|
98
|
+
const data = {};
|
|
99
|
+
Object
|
|
100
|
+
.getOwnPropertyNames(payload)
|
|
101
|
+
.filter((property) => {
|
|
102
|
+
return property.startsWith('$');
|
|
103
|
+
})
|
|
104
|
+
.forEach((property) => {
|
|
105
|
+
data[property] = payload[property];
|
|
106
|
+
});
|
|
107
|
+
const content = {
|
|
108
|
+
query: sanitized,
|
|
109
|
+
select: [],
|
|
110
|
+
target: property.data,
|
|
111
|
+
userId: context.session?.userId,
|
|
112
|
+
requestRef: pending.requestRef,
|
|
113
|
+
context: data
|
|
114
|
+
};
|
|
115
|
+
if (sanitized.filter) {
|
|
116
|
+
const data = (0, describe_query_filter_1.describeQueryFilter)(pending, property.data, sanitized, content.query.select);
|
|
117
|
+
sanitized.filter = data.translated;
|
|
118
|
+
content.parameters = data.parameters;
|
|
119
|
+
}
|
|
120
|
+
pending.annotations[constants_1.QUERY_CONTENT_KEY] = content;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async execute(pending, context, data, property) {
|
|
124
|
+
await this.beforeInterceptors[pending.path]({
|
|
125
|
+
action: pending,
|
|
126
|
+
context,
|
|
127
|
+
property
|
|
128
|
+
});
|
|
129
|
+
const response = await data.handle({
|
|
130
|
+
[constants_1.QUERY_CONTENT_KEY]: pending.annotations[constants_1.QUERY_CONTENT_KEY],
|
|
131
|
+
[constants_2.REQUEST_CONTEXT_KEY]: context,
|
|
132
|
+
[web_socket_1.WS_CLIENT_KEY]: context.wsClient
|
|
133
|
+
});
|
|
134
|
+
context.response[pending.property] = response;
|
|
135
|
+
await this.afterInterceptors[pending.path]({
|
|
136
|
+
action: pending,
|
|
137
|
+
context,
|
|
138
|
+
property
|
|
139
|
+
}, true);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
exports.QueryActionBuilder = QueryActionBuilder;
|
|
143
|
+
exports.QueryActionBuilder = QueryActionBuilder = __decorate([
|
|
144
|
+
(0, class_injector_1.Injectable)()
|
|
145
|
+
], QueryActionBuilder);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Logger } from "@rockster/logger";
|
|
2
|
+
import { Instantiable } from "@rockster/common";
|
|
3
|
+
export declare class AuthController {
|
|
4
|
+
protected logger: Logger;
|
|
5
|
+
active(target: Instantiable): Promise<void>;
|
|
6
|
+
protected validateSchema(): Promise<void>;
|
|
7
|
+
protected createController(target: Instantiable): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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.AuthController = void 0;
|
|
10
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
11
|
+
const logger_1 = require("@rockster/logger");
|
|
12
|
+
const env_1 = require("./env");
|
|
13
|
+
const security_request_1 = require("./requests/security.request");
|
|
14
|
+
const module_1 = require("../module");
|
|
15
|
+
let AuthController = class AuthController {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.logger = new logger_1.Logger('Security');
|
|
18
|
+
}
|
|
19
|
+
async active(target) {
|
|
20
|
+
if (!env_1.env.instance) {
|
|
21
|
+
await this.createController(target);
|
|
22
|
+
}
|
|
23
|
+
await this.validateSchema();
|
|
24
|
+
}
|
|
25
|
+
async validateSchema() {
|
|
26
|
+
if (!core.options.security.authorization) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const contexts = core
|
|
30
|
+
.options
|
|
31
|
+
.security
|
|
32
|
+
.authorization
|
|
33
|
+
.contexts;
|
|
34
|
+
for (const preSchemaContext of env_1.env.preSchema.contexts) {
|
|
35
|
+
const context = contexts
|
|
36
|
+
.find((context) => {
|
|
37
|
+
return context.protector() === preSchemaContext.protector();
|
|
38
|
+
});
|
|
39
|
+
if (!context) {
|
|
40
|
+
this.logger.throw(new Error(`AuthContext not found for {${preSchemaContext.protector().name}}`));
|
|
41
|
+
}
|
|
42
|
+
for (const key of preSchemaContext.keys) {
|
|
43
|
+
context
|
|
44
|
+
.keys
|
|
45
|
+
.pushIfNotExists(key, (source, target) => {
|
|
46
|
+
return source.name === target.name;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
env_1.env.schema = core
|
|
51
|
+
.options
|
|
52
|
+
.security
|
|
53
|
+
.authorization;
|
|
54
|
+
await module_1.ModuleController
|
|
55
|
+
.instance
|
|
56
|
+
.loadRequests([security_request_1.SecurityRequest]);
|
|
57
|
+
this.logger.log('Authorization successfully activated');
|
|
58
|
+
}
|
|
59
|
+
async createController(target) {
|
|
60
|
+
env_1.env.instance = await (0, class_injector_1.createInstance)(target);
|
|
61
|
+
core.isAuthEnabled = true;
|
|
62
|
+
this.logger.log('Authentication successfully activated');
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.AuthController = AuthController;
|
|
66
|
+
exports.AuthController = AuthController = __decorate([
|
|
67
|
+
(0, class_injector_1.Injectable)()
|
|
68
|
+
], AuthController);
|
|
File without changes
|
package/security/env.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProtect = void 0;
|
|
4
|
+
const env_1 = require("../env");
|
|
5
|
+
const addProtect = (target) => {
|
|
6
|
+
env_1.env.preSchema.contexts.push({
|
|
7
|
+
protector: () => target
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
exports.addProtect = addProtect;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProtected = void 0;
|
|
4
|
+
const env_1 = require("../env");
|
|
5
|
+
const addProtected = (protector, keys) => {
|
|
6
|
+
let context = env_1.env
|
|
7
|
+
.preSchema
|
|
8
|
+
.contexts
|
|
9
|
+
.find((context) => {
|
|
10
|
+
return context.protector() === protector();
|
|
11
|
+
});
|
|
12
|
+
if (!context) {
|
|
13
|
+
context = {
|
|
14
|
+
protector: protector,
|
|
15
|
+
keys: keys || []
|
|
16
|
+
};
|
|
17
|
+
env_1.env.preSchema.contexts.push(context);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
context.keys.push(...keys);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.addProtected = addProtected;
|