@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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryContent = void 0;
|
|
4
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const QueryContent = () => {
|
|
7
|
+
return (target, propertyKey, index) => {
|
|
8
|
+
(0, class_injector_1.Inject)(constants_1.QUERY_CONTENT_KEY)(target, propertyKey, index);
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
exports.QueryContent = QueryContent;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Dictionary, Instantiable } from "@rockster/common";
|
|
2
|
+
import { IQueryContent, QueryPath } from "../interfaces/query";
|
|
3
|
+
import { SelectQueryBuilder } from "../../database/extensions/select-query-builder";
|
|
4
|
+
import { EntityManager } from "typeorm/entity-manager/EntityManager";
|
|
5
|
+
export declare const addJoin: (RootEntity: Instantiable, queryContent: IQueryContent<any>, joins: Dictionary<boolean>, queryBuilder: SelectQueryBuilder<any>, path: QueryPath, entityManager: EntityManager) => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addJoin = void 0;
|
|
4
|
+
const use_protector_1 = require("../../database/functions/use-protector");
|
|
5
|
+
const addJoin = (RootEntity, queryContent, joins, queryBuilder, path, entityManager) => {
|
|
6
|
+
if (path.type === "embedded") {
|
|
7
|
+
(0, exports.addJoin)(RootEntity, queryContent, joins, queryBuilder, path.parent, entityManager);
|
|
8
|
+
}
|
|
9
|
+
const wasAdded = joins[path.alias];
|
|
10
|
+
if (path.type === 'relation' && !wasAdded) {
|
|
11
|
+
if (path.parent) {
|
|
12
|
+
(0, exports.addJoin)(RootEntity, queryContent, joins, queryBuilder, path.parent, entityManager);
|
|
13
|
+
}
|
|
14
|
+
const protector = (0, use_protector_1.useProtector)(path.target);
|
|
15
|
+
const secure = path.secure && protector
|
|
16
|
+
? protector
|
|
17
|
+
.relationCondition({
|
|
18
|
+
userId: queryContent.userId,
|
|
19
|
+
contextParams: queryContent.context,
|
|
20
|
+
alias: path.entityAlias,
|
|
21
|
+
rootPath: RootEntity
|
|
22
|
+
})
|
|
23
|
+
: '';
|
|
24
|
+
const condition = typeof path.relation.condition === 'string'
|
|
25
|
+
? path
|
|
26
|
+
.relation
|
|
27
|
+
.condition
|
|
28
|
+
: path
|
|
29
|
+
.relation
|
|
30
|
+
.condition(queryBuilder, queryContent, entityManager);
|
|
31
|
+
path.relation.type === "direct"
|
|
32
|
+
? queryBuilder.leftJoinAndMapOne(path.relation.mapTo, path.target, path.entityAlias, condition + ` ${secure}`)
|
|
33
|
+
: queryBuilder.leftJoinAndMapMany(path.relation.mapTo, path.target, path.entityAlias, condition + ` ${secure}`);
|
|
34
|
+
joins[path.alias] = true;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.addJoin = addJoin;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { QueryInterceptHandle } from "./execute-query";
|
|
2
|
+
import { SelectQueryBuilder } from "../../database/extensions/select-query-builder";
|
|
3
|
+
import { IQueryContent } from "../interfaces/query";
|
|
4
|
+
export declare const createQueryBuilder: <Entity>(queryContent: IQueryContent<Entity>, intercept: QueryInterceptHandle<Entity>) => Promise<SelectQueryBuilder<Entity>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createQueryBuilder = void 0;
|
|
4
|
+
const use_repository_1 = require("../../database/functions/use-repository");
|
|
5
|
+
const use_protector_1 = require("../../database/functions/use-protector");
|
|
6
|
+
const add_join_1 = require("./add-join");
|
|
7
|
+
const get_column_path_1 = require("./get-column-path");
|
|
8
|
+
const get_native_select_1 = require("./get-native-select");
|
|
9
|
+
const select_query_builder_1 = require("../../database/extensions/select-query-builder");
|
|
10
|
+
const transaction_context_1 = require("../../database/contexts/transaction-context");
|
|
11
|
+
const createQueryBuilder = async (queryContent, intercept) => {
|
|
12
|
+
const object = core
|
|
13
|
+
.storage
|
|
14
|
+
.findObject(queryContent.target);
|
|
15
|
+
const RootEntity = object.rootPath.target();
|
|
16
|
+
const requestContext = transaction_context_1.transactionContextStore.getStore();
|
|
17
|
+
const entityManager = requestContext?.entityManager;
|
|
18
|
+
const repository = entityManager
|
|
19
|
+
? entityManager.getRepository(RootEntity)
|
|
20
|
+
: (0, use_repository_1.useRepository)(RootEntity);
|
|
21
|
+
const queryBuilder = new select_query_builder_1.SelectQueryBuilder(repository.createQueryBuilder(object.rootPath.alias));
|
|
22
|
+
if (intercept) {
|
|
23
|
+
await intercept(queryBuilder);
|
|
24
|
+
}
|
|
25
|
+
const rootProtector = (0, use_protector_1.useProtector)(RootEntity);
|
|
26
|
+
if (object.rootPath.secure && rootProtector) {
|
|
27
|
+
rootProtector.rootCondition({
|
|
28
|
+
rootAlias: object.rootPath.alias,
|
|
29
|
+
queryBuilder: queryBuilder,
|
|
30
|
+
userId: queryContent.userId,
|
|
31
|
+
contextParams: queryContent.context
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const joins = {};
|
|
35
|
+
const select = [...queryContent.query.select];
|
|
36
|
+
for (const name of queryContent.query.select) {
|
|
37
|
+
const property = object.properties[name];
|
|
38
|
+
(0, add_join_1.addJoin)(RootEntity, queryContent, joins, queryBuilder, property.path, entityManager);
|
|
39
|
+
switch (property.path.type) {
|
|
40
|
+
case "relation":
|
|
41
|
+
case "root":
|
|
42
|
+
(0, add_join_1.addJoin)(RootEntity, queryContent, joins, queryBuilder, property.path, entityManager);
|
|
43
|
+
break;
|
|
44
|
+
case "embedded":
|
|
45
|
+
const columnPath = (0, get_column_path_1.getColumnPath)(property.path);
|
|
46
|
+
select.pushIfNotExists(columnPath);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
queryContent.rootAlias = object.rootPath.alias;
|
|
51
|
+
queryContent.naviteSelect = (0, get_native_select_1.getNativeSelect)(queryContent.target, queryContent.query.select).distinct();
|
|
52
|
+
return queryBuilder;
|
|
53
|
+
};
|
|
54
|
+
exports.createQueryBuilder = createQueryBuilder;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DirectPath, IndirectPath, RootPath } from "../../database";
|
|
2
|
+
import { QueryActionOptions } from "../interfaces/query-action-options";
|
|
3
|
+
export declare const createQuery: <Entity>(rootPath: RootPath<Entity>) => (options?: QueryActionOptions) => (target: any, propertyKey: string) => void;
|
|
4
|
+
export declare const directPath: <Entity>(path: Omit<DirectPath<Entity>, "type">) => DirectPath<Entity>;
|
|
5
|
+
export declare const indirectPath: <Entity>(path: Omit<IndirectPath<Entity>, "type">) => IndirectPath<Entity>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.indirectPath = exports.directPath = exports.createQuery = void 0;
|
|
4
|
+
const class_pipe_1 = require("@rockster/class-pipe");
|
|
5
|
+
const database_1 = require("../../database");
|
|
6
|
+
const interfaces_1 = require("../../common/interfaces");
|
|
7
|
+
const create_new_class_1 = require("../../database/functions/create-new-class");
|
|
8
|
+
const class_injector_1 = require("@rockster/class-injector");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const base_query_response_1 = require("../models/base-query-response");
|
|
11
|
+
const load_properties_1 = require("./load-properties");
|
|
12
|
+
const aliasToName = (alias) => {
|
|
13
|
+
const firstLetter = alias[0].toUpperCase();
|
|
14
|
+
return firstLetter + alias.substring(1, alias.length);
|
|
15
|
+
};
|
|
16
|
+
const createQuery = (rootPath) => {
|
|
17
|
+
// Properties
|
|
18
|
+
const name = aliasToName(rootPath.alias);
|
|
19
|
+
const QueryRequest = (0, create_new_class_1.createNewClass)(`${name}Query`, rootPath.context
|
|
20
|
+
? rootPath.context()
|
|
21
|
+
: rootPath.contextData);
|
|
22
|
+
const QueryResponse = (0, create_new_class_1.createNewClass)(`${name}QueryResponse`, base_query_response_1.BaseQueryResponse);
|
|
23
|
+
const QueryOrderBy = (0, create_new_class_1.createNewClass)(`${QueryRequest.name}OrderBy`);
|
|
24
|
+
const Target = rootPath.target();
|
|
25
|
+
const properties = {};
|
|
26
|
+
(0, load_properties_1.loadProperties)({
|
|
27
|
+
type: 'root',
|
|
28
|
+
target: Target,
|
|
29
|
+
properties,
|
|
30
|
+
alias: rootPath.alias,
|
|
31
|
+
entityAlias: rootPath.alias,
|
|
32
|
+
paths: rootPath.paths,
|
|
33
|
+
secure: rootPath.secure,
|
|
34
|
+
rootEntity: Target
|
|
35
|
+
});
|
|
36
|
+
// Data of response
|
|
37
|
+
(0, class_pipe_1.IsType)(() => Target)(QueryResponse.prototype, 'data');
|
|
38
|
+
// Select
|
|
39
|
+
(0, class_pipe_1.IsIn)(Object.getOwnPropertyNames(properties))(QueryRequest.prototype, 'select');
|
|
40
|
+
(0, class_pipe_1.IsArray)({ min: 1 })(QueryRequest.prototype, 'select');
|
|
41
|
+
(0, class_pipe_1.IsRequired)()(QueryRequest.prototype, 'select');
|
|
42
|
+
// Take
|
|
43
|
+
(0, class_pipe_1.IsInt)()(QueryRequest.prototype, 'take');
|
|
44
|
+
(0, class_pipe_1.IsOptional)()(QueryRequest.prototype, 'take');
|
|
45
|
+
// Skip
|
|
46
|
+
(0, class_pipe_1.IsInt)()(QueryRequest.prototype, 'skip');
|
|
47
|
+
(0, class_pipe_1.IsOptional)()(QueryRequest.prototype, 'skip');
|
|
48
|
+
// OrderBy.direction
|
|
49
|
+
(0, class_pipe_1.IsIn)(Object.getOwnPropertyNames(database_1.OrderByDirection))(QueryOrderBy.prototype, 'direction');
|
|
50
|
+
(0, class_pipe_1.IsRequired)()(QueryOrderBy.prototype, 'direction');
|
|
51
|
+
// OrderBy.property
|
|
52
|
+
(0, class_pipe_1.IsIn)(Object.getOwnPropertyNames(properties))(QueryOrderBy.prototype, 'property');
|
|
53
|
+
(0, class_pipe_1.IsRequired)()(QueryOrderBy.prototype, 'property');
|
|
54
|
+
// OrderBy
|
|
55
|
+
(0, class_pipe_1.IsType)(() => QueryOrderBy)(QueryRequest.prototype, 'orderBy');
|
|
56
|
+
(0, class_pipe_1.IsArray)({ min: 1 })(QueryRequest.prototype, 'orderBy');
|
|
57
|
+
(0, class_pipe_1.IsOptional)()(QueryRequest.prototype, 'orderBy');
|
|
58
|
+
// Page
|
|
59
|
+
(0, class_pipe_1.IsBoolean)()(QueryRequest.prototype, 'page');
|
|
60
|
+
(0, class_pipe_1.IsOptional)()(QueryRequest.prototype, 'page');
|
|
61
|
+
const object = core
|
|
62
|
+
.storage
|
|
63
|
+
.createObject(QueryRequest);
|
|
64
|
+
object.properties = properties;
|
|
65
|
+
object.rootPath = rootPath;
|
|
66
|
+
return (options) => {
|
|
67
|
+
return (target, propertyKey) => {
|
|
68
|
+
const property = core
|
|
69
|
+
.storage
|
|
70
|
+
.createProperty(target, propertyKey);
|
|
71
|
+
property.type = interfaces_1.PropertyType.request;
|
|
72
|
+
property.name = options?.name || propertyKey;
|
|
73
|
+
property.public = options?.public || false;
|
|
74
|
+
property.description = options?.description;
|
|
75
|
+
property.actionType = constants_1.QUERY_ACTION_TYPE;
|
|
76
|
+
property.data = QueryRequest;
|
|
77
|
+
property.getResponseType = () => QueryResponse;
|
|
78
|
+
(0, class_injector_1.markExecutable)(target, propertyKey, property.name);
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
exports.createQuery = createQuery;
|
|
83
|
+
const directPath = (path) => {
|
|
84
|
+
return {
|
|
85
|
+
type: 'direct',
|
|
86
|
+
...path
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
exports.directPath = directPath;
|
|
90
|
+
const indirectPath = (path) => {
|
|
91
|
+
return {
|
|
92
|
+
type: 'indirect',
|
|
93
|
+
...path
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
exports.indirectPath = indirectPath;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Instantiable } from "@rockster/common";
|
|
2
|
+
import { Query } from "../interfaces/query";
|
|
3
|
+
import { PendingAction } from "../../core";
|
|
4
|
+
export declare const describeQueryFilter: <Entity>(pendingAction: PendingAction, target: Instantiable, query: Query<Entity>, select: string[]) => {
|
|
5
|
+
translated: string;
|
|
6
|
+
parameters: Record<string, any>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.describeQueryFilter = void 0;
|
|
7
|
+
const common_1 = require("@rockster/common");
|
|
8
|
+
const class_pipe_1 = require("@rockster/class-pipe");
|
|
9
|
+
const validator_1 = __importDefault(require("validator"));
|
|
10
|
+
const validOperators = {
|
|
11
|
+
like: true,
|
|
12
|
+
ilike: true,
|
|
13
|
+
'=': true,
|
|
14
|
+
'>=': true,
|
|
15
|
+
'<=': true,
|
|
16
|
+
'>': true,
|
|
17
|
+
'<': true,
|
|
18
|
+
'<>': true,
|
|
19
|
+
'is': true,
|
|
20
|
+
contains: true,
|
|
21
|
+
in: true,
|
|
22
|
+
between: true
|
|
23
|
+
};
|
|
24
|
+
const negatableOperators = {
|
|
25
|
+
like: true,
|
|
26
|
+
ilike: true,
|
|
27
|
+
contains: true,
|
|
28
|
+
in: true,
|
|
29
|
+
between: true
|
|
30
|
+
};
|
|
31
|
+
const validIsValues = {
|
|
32
|
+
'null': true,
|
|
33
|
+
'false': true,
|
|
34
|
+
'true': true,
|
|
35
|
+
'unknown': true
|
|
36
|
+
};
|
|
37
|
+
const describeQueryFilter = (pendingAction, target, query, select) => {
|
|
38
|
+
const parameters = {};
|
|
39
|
+
let paramIndex = 1;
|
|
40
|
+
let filter = query.filter.trim();
|
|
41
|
+
let lastField;
|
|
42
|
+
let expect = 'field';
|
|
43
|
+
let current = '';
|
|
44
|
+
let translated = '';
|
|
45
|
+
let isCollectingInValues = false;
|
|
46
|
+
let inValues = [];
|
|
47
|
+
let operator = '';
|
|
48
|
+
let isNegation = false;
|
|
49
|
+
const object = core.storage.findObject(target);
|
|
50
|
+
const properties = object.properties;
|
|
51
|
+
const requestRef = pendingAction.requestRef;
|
|
52
|
+
validateParentheses(filter, requestRef);
|
|
53
|
+
const nextParam = (value) => {
|
|
54
|
+
const key = `param${paramIndex++}`;
|
|
55
|
+
parameters[key] = value;
|
|
56
|
+
return `:${key}`;
|
|
57
|
+
};
|
|
58
|
+
const validate = () => {
|
|
59
|
+
if (!current)
|
|
60
|
+
return;
|
|
61
|
+
switch (expect) {
|
|
62
|
+
case 'andOr': {
|
|
63
|
+
const andOr = current.toLowerCase();
|
|
64
|
+
if (andOr !== 'and' && andOr !== 'or') {
|
|
65
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] invalidCondition [${current}]` });
|
|
66
|
+
}
|
|
67
|
+
translated += ` ${andOr} `;
|
|
68
|
+
expect = 'field';
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case 'field': {
|
|
72
|
+
expect = 'operator';
|
|
73
|
+
const [_, name, jsonb] = current.split('.');
|
|
74
|
+
const [embeddedProperty, embeddedCast] = (jsonb || '').split('::');
|
|
75
|
+
const isValidProperty = properties[current];
|
|
76
|
+
if (!isValidProperty) {
|
|
77
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] invalidField [${current}]` });
|
|
78
|
+
}
|
|
79
|
+
const fieldName = `${isValidProperty.path.entityAlias}.${isValidProperty.columnName}`;
|
|
80
|
+
select.pushIfNotExists(current);
|
|
81
|
+
lastField = {
|
|
82
|
+
property: isValidProperty,
|
|
83
|
+
name: fieldName,
|
|
84
|
+
type: isValidProperty.type
|
|
85
|
+
};
|
|
86
|
+
current = fieldName;
|
|
87
|
+
if (isValidProperty.type === class_pipe_1.PropertyType.object && jsonb) {
|
|
88
|
+
current += ` ->> '${embeddedProperty}'`;
|
|
89
|
+
if (embeddedCast === 'boolean')
|
|
90
|
+
lastField.type = class_pipe_1.PropertyType.boolean;
|
|
91
|
+
else if (embeddedCast === 'date')
|
|
92
|
+
lastField.type = class_pipe_1.PropertyType.date;
|
|
93
|
+
else if (embeddedCast === 'number')
|
|
94
|
+
lastField.type = class_pipe_1.PropertyType.numeric;
|
|
95
|
+
else
|
|
96
|
+
lastField.type = class_pipe_1.PropertyType.string;
|
|
97
|
+
}
|
|
98
|
+
translated += current;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'operator': {
|
|
102
|
+
const lower = current.toLowerCase();
|
|
103
|
+
if (lower === 'not') {
|
|
104
|
+
isNegation = true;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
operator = lower;
|
|
108
|
+
if (!validOperators[operator]) {
|
|
109
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] invalidOperator [${current}]` });
|
|
110
|
+
}
|
|
111
|
+
if (isNegation && !negatableOperators[operator]) {
|
|
112
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] invalid use of NOT with operator [${operator}]` });
|
|
113
|
+
}
|
|
114
|
+
const prefix = isNegation ? 'NOT ' : '';
|
|
115
|
+
if (operator === 'contains') {
|
|
116
|
+
translated += ` ${prefix}@>`;
|
|
117
|
+
expect = 'value';
|
|
118
|
+
}
|
|
119
|
+
else if (operator === 'is') {
|
|
120
|
+
translated += ` IS${isNegation ? ' NOT' : ''}`;
|
|
121
|
+
expect = 'isValue';
|
|
122
|
+
}
|
|
123
|
+
else if (operator === 'between') {
|
|
124
|
+
translated += ` ${prefix}BETWEEN`;
|
|
125
|
+
expect = 'betweenValue';
|
|
126
|
+
}
|
|
127
|
+
else if (operator === 'in') {
|
|
128
|
+
translated += ` ${prefix}IN`;
|
|
129
|
+
expect = 'inValue';
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
translated += ` ${prefix}${operator}`;
|
|
133
|
+
expect = 'value';
|
|
134
|
+
}
|
|
135
|
+
isNegation = false;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case 'value': {
|
|
139
|
+
const value = checkFieldValue(requestRef, lastField, current);
|
|
140
|
+
translated += ` ${nextParam(value)}`;
|
|
141
|
+
expect = 'andOr';
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case 'isValue': {
|
|
145
|
+
const value = current.toLowerCase();
|
|
146
|
+
if (!validIsValues[value]) {
|
|
147
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] invalidValue [${current}]` });
|
|
148
|
+
}
|
|
149
|
+
translated += ` ${value}`;
|
|
150
|
+
expect = 'andOr';
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case 'betweenValue': {
|
|
154
|
+
const parts = current.split(/\s+and\s+/i);
|
|
155
|
+
if (parts.length !== 2) {
|
|
156
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] invalid BETWEEN syntax [${current}]` });
|
|
157
|
+
}
|
|
158
|
+
const start = checkFieldValue(requestRef, lastField, parts[0].trim());
|
|
159
|
+
const end = checkFieldValue(requestRef, lastField, parts[1].trim());
|
|
160
|
+
translated += ` ${nextParam(start)} AND ${nextParam(end)}`;
|
|
161
|
+
expect = 'andOr';
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
current = '';
|
|
166
|
+
};
|
|
167
|
+
for (let i = 0; i < filter.length; i++) {
|
|
168
|
+
const letter = filter[i];
|
|
169
|
+
if (isCollectingInValues) {
|
|
170
|
+
if (letter === ')') {
|
|
171
|
+
if (current) {
|
|
172
|
+
inValues.push(current.trim());
|
|
173
|
+
current = '';
|
|
174
|
+
}
|
|
175
|
+
translated += ` (${inValues.map(val => {
|
|
176
|
+
const parsed = checkFieldValue(requestRef, lastField, `'${val.replace(/'/g, '')}'`);
|
|
177
|
+
return nextParam(parsed);
|
|
178
|
+
}).join(', ')})`;
|
|
179
|
+
expect = 'andOr';
|
|
180
|
+
isCollectingInValues = false;
|
|
181
|
+
inValues = [];
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (letter === ',') {
|
|
185
|
+
if (current) {
|
|
186
|
+
inValues.push(current.trim());
|
|
187
|
+
current = '';
|
|
188
|
+
}
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (letter === ' ') {
|
|
192
|
+
if (current.startsWith("'") && !current.endsWith("'")) {
|
|
193
|
+
current += letter;
|
|
194
|
+
}
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
current += letter;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
switch (letter) {
|
|
201
|
+
case '(': {
|
|
202
|
+
if (expect === 'inValue') {
|
|
203
|
+
isCollectingInValues = true;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
validate();
|
|
207
|
+
translated += letter;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
case ')': {
|
|
211
|
+
validate();
|
|
212
|
+
translated += letter;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
case ',': {
|
|
216
|
+
current += letter;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
case ' ': {
|
|
220
|
+
if (current.startsWith("'") && !current.endsWith("'")) {
|
|
221
|
+
current += letter;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
validate();
|
|
225
|
+
}
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
default: {
|
|
229
|
+
current += letter;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (current && !isCollectingInValues) {
|
|
235
|
+
validate();
|
|
236
|
+
}
|
|
237
|
+
return { translated, parameters };
|
|
238
|
+
};
|
|
239
|
+
exports.describeQueryFilter = describeQueryFilter;
|
|
240
|
+
function checkFieldValue(requestRef, field, value) {
|
|
241
|
+
const type = field.type;
|
|
242
|
+
const invalidValueError = new common_1.BadRequestError({
|
|
243
|
+
message: `${requestRef} [filter] invalidValue [${value}] for field [${field.name}]`
|
|
244
|
+
});
|
|
245
|
+
if (field.property.isArray)
|
|
246
|
+
return value;
|
|
247
|
+
switch (type) {
|
|
248
|
+
case class_pipe_1.PropertyType.date: {
|
|
249
|
+
const isDate = value.startsWith("'") && value.endsWith("'") && !isNaN(Date.parse(value.replace(/'/g, '')));
|
|
250
|
+
if (value !== 'null' && !isDate)
|
|
251
|
+
throw invalidValueError;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
case class_pipe_1.PropertyType.string: {
|
|
255
|
+
const isString = value.startsWith("'") && value.endsWith("'");
|
|
256
|
+
if (value !== 'null' && !isString)
|
|
257
|
+
throw invalidValueError;
|
|
258
|
+
if (field.property.isUUID) {
|
|
259
|
+
const toCheckValue = value.replace(/'/g, '');
|
|
260
|
+
if (!validator_1.default.isUUID(toCheckValue))
|
|
261
|
+
throw invalidValueError;
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
case class_pipe_1.PropertyType.numeric:
|
|
266
|
+
case class_pipe_1.PropertyType.integer: {
|
|
267
|
+
const number = Number(value.replace(/'/g, ''));
|
|
268
|
+
if (isNaN(number))
|
|
269
|
+
throw invalidValueError;
|
|
270
|
+
return number.toString();
|
|
271
|
+
}
|
|
272
|
+
case class_pipe_1.PropertyType.boolean: {
|
|
273
|
+
const isBoolean = ['true', 'false', 'unknown', 'null'].includes(value.toLowerCase());
|
|
274
|
+
if (!isBoolean)
|
|
275
|
+
throw invalidValueError;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
default:
|
|
279
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] invalidField [${field.name}]` });
|
|
280
|
+
}
|
|
281
|
+
return value.replace(/'/g, '');
|
|
282
|
+
}
|
|
283
|
+
;
|
|
284
|
+
function validateParentheses(filter, requestRef) {
|
|
285
|
+
let count = 0;
|
|
286
|
+
for (let i = 0; i < filter.length; i++) {
|
|
287
|
+
const ch = filter[i];
|
|
288
|
+
if (ch === '(')
|
|
289
|
+
count++;
|
|
290
|
+
else if (ch === ')') {
|
|
291
|
+
if (count === 0)
|
|
292
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] unexpected closing parenthesis at position ${i}` });
|
|
293
|
+
count--;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (count !== 0)
|
|
297
|
+
throw new common_1.BadRequestError({ message: `${requestRef} [filter] missing closing parenthesis` });
|
|
298
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectQueryBuilder } from "../../database";
|
|
2
|
+
import { IQueryContent, Query } from "../interfaces/query";
|
|
3
|
+
export type QueryInterceptHandle<Entity> = {
|
|
4
|
+
(queryBuilder: SelectQueryBuilder<Entity>): Promise<SelectQueryBuilder<Entity>> | SelectQueryBuilder<Entity>;
|
|
5
|
+
};
|
|
6
|
+
export type ExecureQueryOptions<Entity> = {
|
|
7
|
+
content: IQueryContent<Entity>;
|
|
8
|
+
preFilter?: string;
|
|
9
|
+
intercept?: QueryInterceptHandle<Entity>;
|
|
10
|
+
};
|
|
11
|
+
export declare const executeQuery: <Entity>({ content: queryContent, intercept, preFilter }: ExecureQueryOptions<Entity>) => Promise<Query<Entity>>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeQuery = void 0;
|
|
4
|
+
const create_query_builder_1 = require("./create-query-builder");
|
|
5
|
+
const class_pipe_1 = require("@rockster/class-pipe");
|
|
6
|
+
const logger_1 = require("@rockster/logger");
|
|
7
|
+
const global_1 = require("../../global");
|
|
8
|
+
const executeQuery = async ({ content: queryContent, intercept, preFilter }) => {
|
|
9
|
+
const logger = new logger_1.Logger('ExecuteQuery');
|
|
10
|
+
const query = queryContent.query;
|
|
11
|
+
const queryBuilder = await (0, create_query_builder_1.createQueryBuilder)(queryContent, intercept);
|
|
12
|
+
let page = queryContent.query.page;
|
|
13
|
+
let getWhere = 'where';
|
|
14
|
+
let filtered = 0;
|
|
15
|
+
let total;
|
|
16
|
+
const object = core
|
|
17
|
+
.storage
|
|
18
|
+
.findObject(queryContent.target);
|
|
19
|
+
if (preFilter) {
|
|
20
|
+
queryBuilder.where(preFilter);
|
|
21
|
+
getWhere = 'andWhere';
|
|
22
|
+
}
|
|
23
|
+
if (page) {
|
|
24
|
+
total = await queryBuilder.getCount();
|
|
25
|
+
queryBuilder.take(query.take);
|
|
26
|
+
queryBuilder.skip(query.skip);
|
|
27
|
+
}
|
|
28
|
+
if (query.filter) {
|
|
29
|
+
queryBuilder[getWhere](query.filter, queryContent.parameters);
|
|
30
|
+
filtered = await queryBuilder.getCount();
|
|
31
|
+
}
|
|
32
|
+
if (query.orderBy) {
|
|
33
|
+
query.orderBy.forEach((orderBy, i) => {
|
|
34
|
+
const direction = orderBy.direction.toUpperCase();
|
|
35
|
+
if (i === 0) {
|
|
36
|
+
queryBuilder.orderBy(orderBy.property, direction);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
queryBuilder.addOrderBy(orderBy.property, direction);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
queryBuilder.select(queryContent.naviteSelect);
|
|
44
|
+
queryBuilder.getVirtualSelect().forEach((virtualSelect) => {
|
|
45
|
+
queryBuilder.addSelect(virtualSelect.selection, virtualSelect.alias);
|
|
46
|
+
});
|
|
47
|
+
logger.debug(queryBuilder.getSql());
|
|
48
|
+
const items = await queryBuilder.getMany();
|
|
49
|
+
const data = await Promise.all(items.map((item) => {
|
|
50
|
+
return (0, class_pipe_1.transform)({
|
|
51
|
+
target: object.rootPath.target(),
|
|
52
|
+
values: item,
|
|
53
|
+
select: query.select,
|
|
54
|
+
fullPath: `${queryContent.rootAlias}.`,
|
|
55
|
+
groups: [global_1.actionGroups.query]
|
|
56
|
+
});
|
|
57
|
+
}));
|
|
58
|
+
return {
|
|
59
|
+
skip: page
|
|
60
|
+
? query.skip
|
|
61
|
+
: undefined,
|
|
62
|
+
take: page
|
|
63
|
+
? query.take
|
|
64
|
+
: undefined,
|
|
65
|
+
total: page
|
|
66
|
+
? total
|
|
67
|
+
: undefined,
|
|
68
|
+
filtered: query.filter
|
|
69
|
+
? filtered
|
|
70
|
+
: undefined,
|
|
71
|
+
data: data
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
exports.executeQuery = executeQuery;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getColumnPath = void 0;
|
|
4
|
+
const getColumnPath = (path, currentPath = '') => {
|
|
5
|
+
let fullPath = '';
|
|
6
|
+
if (path.type === 'embedded') {
|
|
7
|
+
fullPath = (0, exports.getColumnPath)(path.parent, path.alias);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
fullPath = `${path.alias}.${currentPath}`;
|
|
11
|
+
}
|
|
12
|
+
return fullPath;
|
|
13
|
+
};
|
|
14
|
+
exports.getColumnPath = getColumnPath;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNativeSelect = void 0;
|
|
4
|
+
const map_query_property_to_column_name_1 = require("./map-query-property-to-column-name");
|
|
5
|
+
const getNativeSelect = (target, select) => {
|
|
6
|
+
const queryObject = core.storage.findObject(target);
|
|
7
|
+
return select.map(item => (0, map_query_property_to_column_name_1.mapQueryPropertyToColumnName)(queryObject, item));
|
|
8
|
+
};
|
|
9
|
+
exports.getNativeSelect = getNativeSelect;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Dictionary, Instantiable } from "@rockster/common";
|
|
2
|
+
import { Paths } from "../../database/interfaces/path";
|
|
3
|
+
import { QueryPath, QueryProperty, QueryPropertyType, QueryRelationConfig } from "../interfaces/query";
|
|
4
|
+
export type LoadPropertiesArgs = {
|
|
5
|
+
type: QueryPropertyType;
|
|
6
|
+
target: Instantiable;
|
|
7
|
+
alias: string;
|
|
8
|
+
entityAlias?: string;
|
|
9
|
+
properties: Dictionary<QueryProperty>;
|
|
10
|
+
fullPath?: string;
|
|
11
|
+
relation?: QueryRelationConfig;
|
|
12
|
+
paths?: Paths<any>;
|
|
13
|
+
parent?: QueryPath;
|
|
14
|
+
secure?: boolean;
|
|
15
|
+
initializedObjects?: string[];
|
|
16
|
+
rootEntity: Instantiable;
|
|
17
|
+
rootFullPath?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const loadProperties: ({ type, target, alias, entityAlias, properties, parent, paths, relation, fullPath, secure, initializedObjects, rootEntity, rootFullPath }: LoadPropertiesArgs) => void;
|