@venizia/ignis 0.0.7-9 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -50
- package/dist/base/applications/abstract.d.ts.map +1 -1
- package/dist/base/applications/abstract.js +0 -8
- package/dist/base/applications/abstract.js.map +1 -1
- package/dist/base/applications/base.d.ts.map +1 -1
- package/dist/base/applications/base.js +0 -17
- package/dist/base/applications/base.js.map +1 -1
- package/dist/base/applications/types.d.ts.map +1 -1
- package/dist/base/applications/types.js.map +1 -1
- package/dist/base/components/base.d.ts.map +1 -1
- package/dist/base/components/base.js +0 -2
- package/dist/base/components/base.js.map +1 -1
- package/dist/base/controllers/abstract.d.ts +10 -124
- package/dist/base/controllers/abstract.d.ts.map +1 -1
- package/dist/base/controllers/abstract.js +6 -82
- package/dist/base/controllers/abstract.js.map +1 -1
- package/dist/base/controllers/base.d.ts +5 -113
- package/dist/base/controllers/base.d.ts.map +1 -1
- package/dist/base/controllers/base.js +5 -113
- package/dist/base/controllers/base.js.map +1 -1
- package/dist/base/controllers/common/constants.d.ts +1 -16
- package/dist/base/controllers/common/constants.d.ts.map +1 -1
- package/dist/base/controllers/common/constants.js +1 -20
- package/dist/base/controllers/common/constants.js.map +1 -1
- package/dist/base/controllers/common/types.d.ts +16 -167
- package/dist/base/controllers/common/types.d.ts.map +1 -1
- package/dist/base/controllers/common/types.js +1 -4
- package/dist/base/controllers/common/types.js.map +1 -1
- package/dist/base/controllers/factory/controller.d.ts +17 -198
- package/dist/base/controllers/factory/controller.d.ts.map +1 -1
- package/dist/base/controllers/factory/controller.js +13 -140
- package/dist/base/controllers/factory/controller.js.map +1 -1
- package/dist/base/controllers/factory/definition.d.ts +2 -7
- package/dist/base/controllers/factory/definition.d.ts.map +1 -1
- package/dist/base/controllers/factory/definition.js +4 -30
- package/dist/base/controllers/factory/definition.js.map +1 -1
- package/dist/base/datasources/base.d.ts +2 -31
- package/dist/base/datasources/base.d.ts.map +1 -1
- package/dist/base/datasources/base.js +2 -39
- package/dist/base/datasources/base.js.map +1 -1
- package/dist/base/datasources/common/types.d.ts +2 -4
- package/dist/base/datasources/common/types.d.ts.map +1 -1
- package/dist/base/datasources/common/types.js +1 -8
- package/dist/base/datasources/common/types.js.map +1 -1
- package/dist/base/metadata/injectors.d.ts +1 -30
- package/dist/base/metadata/injectors.d.ts.map +1 -1
- package/dist/base/metadata/injectors.js +1 -30
- package/dist/base/metadata/injectors.js.map +1 -1
- package/dist/base/metadata/persistents.d.ts +3 -63
- package/dist/base/metadata/persistents.d.ts.map +1 -1
- package/dist/base/metadata/persistents.js +11 -88
- package/dist/base/metadata/persistents.js.map +1 -1
- package/dist/base/metadata/routes.d.ts +1 -24
- package/dist/base/metadata/routes.d.ts.map +1 -1
- package/dist/base/metadata/routes.js +1 -27
- package/dist/base/metadata/routes.js.map +1 -1
- package/dist/base/middlewares/app-error.middleware.d.ts +1 -10
- package/dist/base/middlewares/app-error.middleware.d.ts.map +1 -1
- package/dist/base/middlewares/app-error.middleware.js +2 -14
- package/dist/base/middlewares/app-error.middleware.js.map +1 -1
- package/dist/base/middlewares/emoji-favicon.middleware.d.ts +1 -7
- package/dist/base/middlewares/emoji-favicon.middleware.d.ts.map +1 -1
- package/dist/base/middlewares/emoji-favicon.middleware.js +1 -7
- package/dist/base/middlewares/emoji-favicon.middleware.js.map +1 -1
- package/dist/base/middlewares/not-found.middleware.d.ts +1 -8
- package/dist/base/middlewares/not-found.middleware.d.ts.map +1 -1
- package/dist/base/middlewares/not-found.middleware.js +1 -8
- package/dist/base/middlewares/not-found.middleware.js.map +1 -1
- package/dist/base/middlewares/request-spy.middleware.d.ts +3 -19
- package/dist/base/middlewares/request-spy.middleware.d.ts.map +1 -1
- package/dist/base/middlewares/request-spy.middleware.js +3 -23
- package/dist/base/middlewares/request-spy.middleware.js.map +1 -1
- package/dist/base/mixins/component.mixin.d.ts.map +1 -1
- package/dist/base/mixins/controller.mixin.d.ts.map +1 -1
- package/dist/base/mixins/repository.mixin.d.ts.map +1 -1
- package/dist/base/mixins/service.mixin.d.ts.map +1 -1
- package/dist/base/models/base.d.ts +4 -21
- package/dist/base/models/base.d.ts.map +1 -1
- package/dist/base/models/base.js +1 -11
- package/dist/base/models/base.js.map +1 -1
- package/dist/base/models/common/types.d.ts.map +1 -1
- package/dist/base/models/common/types.js +0 -2
- package/dist/base/models/common/types.js.map +1 -1
- package/dist/base/models/enrichers/id.enricher.d.ts.map +1 -1
- package/dist/base/models/enrichers/id.enricher.js.map +1 -1
- package/dist/base/models/enrichers/user-audit.enricher.d.ts.map +1 -1
- package/dist/base/models/enrichers/user-audit.enricher.js +1 -6
- package/dist/base/models/enrichers/user-audit.enricher.js.map +1 -1
- package/dist/base/repositories/common/constants.d.ts +5 -59
- package/dist/base/repositories/common/constants.d.ts.map +1 -1
- package/dist/base/repositories/common/constants.js +3 -51
- package/dist/base/repositories/common/constants.js.map +1 -1
- package/dist/base/repositories/common/shared.d.ts +1 -13
- package/dist/base/repositories/common/shared.d.ts.map +1 -1
- package/dist/base/repositories/common/shared.js +2 -19
- package/dist/base/repositories/common/shared.js.map +1 -1
- package/dist/base/repositories/common/types.d.ts +32 -461
- package/dist/base/repositories/common/types.d.ts.map +1 -1
- package/dist/base/repositories/common/types.js +13 -159
- package/dist/base/repositories/common/types.js.map +1 -1
- package/dist/base/repositories/core/abstract.d.ts +10 -204
- package/dist/base/repositories/core/abstract.d.ts.map +1 -1
- package/dist/base/repositories/core/abstract.js +6 -126
- package/dist/base/repositories/core/abstract.js.map +1 -1
- package/dist/base/repositories/core/default-crud.d.ts +1 -36
- package/dist/base/repositories/core/default-crud.d.ts.map +1 -1
- package/dist/base/repositories/core/default-crud.js +1 -36
- package/dist/base/repositories/core/default-crud.js.map +1 -1
- package/dist/base/repositories/core/index.d.ts +1 -0
- package/dist/base/repositories/core/index.d.ts.map +1 -1
- package/dist/base/repositories/core/index.js +1 -0
- package/dist/base/repositories/core/index.js.map +1 -1
- package/dist/base/repositories/core/persistable.d.ts +2 -71
- package/dist/base/repositories/core/persistable.d.ts.map +1 -1
- package/dist/base/repositories/core/persistable.js +2 -100
- package/dist/base/repositories/core/persistable.js.map +1 -1
- package/dist/base/repositories/core/readable.d.ts +12 -127
- package/dist/base/repositories/core/readable.d.ts.map +1 -1
- package/dist/base/repositories/core/readable.js +8 -124
- package/dist/base/repositories/core/readable.js.map +1 -1
- package/dist/base/repositories/core/soft-deletable.d.ts +140 -0
- package/dist/base/repositories/core/soft-deletable.d.ts.map +1 -0
- package/dist/base/repositories/core/soft-deletable.js +99 -0
- package/dist/base/repositories/core/soft-deletable.js.map +1 -0
- package/dist/base/repositories/mixins/default-filter.d.ts +3 -49
- package/dist/base/repositories/mixins/default-filter.d.ts.map +1 -1
- package/dist/base/repositories/mixins/default-filter.js +3 -57
- package/dist/base/repositories/mixins/default-filter.js.map +1 -1
- package/dist/base/repositories/mixins/fields-visibility.d.ts +3 -59
- package/dist/base/repositories/mixins/fields-visibility.d.ts.map +1 -1
- package/dist/base/repositories/mixins/fields-visibility.js +3 -67
- package/dist/base/repositories/mixins/fields-visibility.js.map +1 -1
- package/dist/base/repositories/operators/filter.d.ts +10 -115
- package/dist/base/repositories/operators/filter.d.ts.map +1 -1
- package/dist/base/repositories/operators/filter.js +13 -154
- package/dist/base/repositories/operators/filter.js.map +1 -1
- package/dist/base/repositories/operators/json-utils.d.ts +5 -38
- package/dist/base/repositories/operators/json-utils.d.ts.map +1 -1
- package/dist/base/repositories/operators/json-utils.js +5 -47
- package/dist/base/repositories/operators/json-utils.js.map +1 -1
- package/dist/base/repositories/operators/query.d.ts +3 -56
- package/dist/base/repositories/operators/query.d.ts.map +1 -1
- package/dist/base/repositories/operators/query.js +11 -106
- package/dist/base/repositories/operators/query.js.map +1 -1
- package/dist/base/repositories/operators/relation.d.ts +1 -33
- package/dist/base/repositories/operators/relation.d.ts.map +1 -1
- package/dist/base/repositories/operators/relation.js +1 -36
- package/dist/base/repositories/operators/relation.js.map +1 -1
- package/dist/base/repositories/operators/update.d.ts +7 -72
- package/dist/base/repositories/operators/update.d.ts.map +1 -1
- package/dist/base/repositories/operators/update.js +6 -91
- package/dist/base/repositories/operators/update.js.map +1 -1
- package/dist/base/services/types.d.ts.map +1 -1
- package/dist/common/bindings.d.ts +2 -17
- package/dist/common/bindings.d.ts.map +1 -1
- package/dist/common/bindings.js +2 -14
- package/dist/common/bindings.js.map +1 -1
- package/dist/common/constants.d.ts +1 -3
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/common/constants.js +1 -4
- package/dist/common/constants.js.map +1 -1
- package/dist/common/environments.d.ts +1 -4
- package/dist/common/environments.d.ts.map +1 -1
- package/dist/common/environments.js +1 -4
- package/dist/common/environments.js.map +1 -1
- package/dist/common/statuses.d.ts +6 -19
- package/dist/common/statuses.d.ts.map +1 -1
- package/dist/common/statuses.js +6 -27
- package/dist/common/statuses.js.map +1 -1
- package/dist/components/auth/authenticate/common/codecs.d.ts +11 -0
- package/dist/components/auth/authenticate/common/codecs.d.ts.map +1 -0
- package/dist/components/auth/authenticate/common/codecs.js +28 -0
- package/dist/components/auth/authenticate/common/codecs.js.map +1 -0
- package/dist/components/auth/authenticate/common/constants.d.ts +28 -4
- package/dist/components/auth/authenticate/common/constants.d.ts.map +1 -1
- package/dist/components/auth/authenticate/common/constants.js +37 -9
- package/dist/components/auth/authenticate/common/constants.js.map +1 -1
- package/dist/components/auth/authenticate/common/index.d.ts +1 -0
- package/dist/components/auth/authenticate/common/index.d.ts.map +1 -1
- package/dist/components/auth/authenticate/common/index.js +1 -0
- package/dist/components/auth/authenticate/common/index.js.map +1 -1
- package/dist/components/auth/authenticate/common/keys.d.ts +1 -0
- package/dist/components/auth/authenticate/common/keys.d.ts.map +1 -1
- package/dist/components/auth/authenticate/common/keys.js +1 -0
- package/dist/components/auth/authenticate/common/keys.js.map +1 -1
- package/dist/components/auth/authenticate/common/types.d.ts +55 -27
- package/dist/components/auth/authenticate/common/types.d.ts.map +1 -1
- package/dist/components/auth/authenticate/component.d.ts +2 -1
- package/dist/components/auth/authenticate/component.d.ts.map +1 -1
- package/dist/components/auth/authenticate/component.js +101 -45
- package/dist/components/auth/authenticate/component.js.map +1 -1
- package/dist/components/auth/authenticate/controllers/index.d.ts +1 -0
- package/dist/components/auth/authenticate/controllers/index.d.ts.map +1 -1
- package/dist/components/auth/authenticate/controllers/index.js +1 -0
- package/dist/components/auth/authenticate/controllers/index.js.map +1 -1
- package/dist/components/auth/authenticate/controllers/jwks/controller.d.ts +9 -0
- package/dist/components/auth/authenticate/controllers/jwks/controller.d.ts.map +1 -0
- package/dist/components/auth/authenticate/controllers/jwks/controller.js +54 -0
- package/dist/components/auth/authenticate/controllers/jwks/controller.js.map +1 -0
- package/dist/components/auth/authenticate/controllers/jwks/definitions.d.ts +66 -0
- package/dist/components/auth/authenticate/controllers/jwks/definitions.d.ts.map +1 -0
- package/dist/components/auth/authenticate/controllers/jwks/definitions.js +32 -0
- package/dist/components/auth/authenticate/controllers/jwks/definitions.js.map +1 -0
- package/dist/components/auth/authenticate/controllers/jwks/index.d.ts +2 -0
- package/dist/components/auth/authenticate/controllers/jwks/index.d.ts.map +1 -0
- package/dist/components/auth/authenticate/controllers/jwks/index.js +18 -0
- package/dist/components/auth/authenticate/controllers/jwks/index.js.map +1 -0
- package/dist/components/auth/authenticate/middlewares/authenticate.middleware.d.ts.map +1 -1
- package/dist/components/auth/authenticate/middlewares/authenticate.middleware.js +0 -2
- package/dist/components/auth/authenticate/middlewares/authenticate.middleware.js.map +1 -1
- package/dist/components/auth/authenticate/providers/authentication.provider.d.ts.map +1 -1
- package/dist/components/auth/authenticate/providers/authentication.provider.js +0 -7
- package/dist/components/auth/authenticate/providers/authentication.provider.js.map +1 -1
- package/dist/components/auth/authenticate/services/basic/index.d.ts +2 -0
- package/dist/components/auth/authenticate/services/basic/index.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/basic/index.js +18 -0
- package/dist/components/auth/authenticate/services/basic/index.js.map +1 -0
- package/dist/components/auth/authenticate/services/basic/service.d.ts +24 -0
- package/dist/components/auth/authenticate/services/basic/service.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/{basic-token.service.js → basic/service.js} +7 -45
- package/dist/components/auth/authenticate/services/basic/service.js.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/abstract.service.d.ts +52 -0
- package/dist/components/auth/authenticate/services/bearer/abstract.service.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/abstract.service.js +177 -0
- package/dist/components/auth/authenticate/services/bearer/abstract.service.js.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/index.d.ts +4 -0
- package/dist/components/auth/authenticate/services/bearer/index.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/index.js +20 -0
- package/dist/components/auth/authenticate/services/bearer/index.js.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/abstract.service.d.ts +16 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/abstract.service.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/abstract.service.js +32 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/abstract.service.js.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/index.d.ts +4 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/index.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/index.js +20 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/index.js.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +46 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.js +168 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/issuer.service.js.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/verifier.service.d.ts +18 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/verifier.service.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/verifier.service.js +73 -0
- package/dist/components/auth/authenticate/services/bearer/jwks/verifier.service.js.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jws.service.d.ts +19 -0
- package/dist/components/auth/authenticate/services/bearer/jws.service.d.ts.map +1 -0
- package/dist/components/auth/authenticate/services/bearer/jws.service.js +76 -0
- package/dist/components/auth/authenticate/services/bearer/jws.service.js.map +1 -0
- package/dist/components/auth/authenticate/services/index.d.ts +2 -2
- package/dist/components/auth/authenticate/services/index.d.ts.map +1 -1
- package/dist/components/auth/authenticate/services/index.js +2 -2
- package/dist/components/auth/authenticate/services/index.js.map +1 -1
- package/dist/components/auth/authenticate/strategies/basic.strategy.d.ts +1 -22
- package/dist/components/auth/authenticate/strategies/basic.strategy.d.ts.map +1 -1
- package/dist/components/auth/authenticate/strategies/basic.strategy.js +1 -22
- package/dist/components/auth/authenticate/strategies/basic.strategy.js.map +1 -1
- package/dist/components/auth/authenticate/strategies/index.d.ts +2 -1
- package/dist/components/auth/authenticate/strategies/index.d.ts.map +1 -1
- package/dist/components/auth/authenticate/strategies/index.js +2 -1
- package/dist/components/auth/authenticate/strategies/index.js.map +1 -1
- package/dist/components/auth/authenticate/strategies/jwks.strategy.d.ts +21 -0
- package/dist/components/auth/authenticate/strategies/jwks.strategy.d.ts.map +1 -0
- package/dist/components/auth/authenticate/strategies/jwks.strategy.js +68 -0
- package/dist/components/auth/authenticate/strategies/jwks.strategy.js.map +1 -0
- package/dist/components/auth/authenticate/strategies/{jwt.strategy.d.ts → jws.strategy.d.ts} +5 -4
- package/dist/components/auth/authenticate/strategies/jws.strategy.d.ts.map +1 -0
- package/dist/components/auth/authenticate/strategies/{jwt.strategy.js → jws.strategy.js} +11 -10
- package/dist/components/auth/authenticate/strategies/jws.strategy.js.map +1 -0
- package/dist/components/auth/authenticate/strategies/strategy-registry.d.ts.map +1 -1
- package/dist/components/auth/authenticate/strategies/strategy-registry.js +0 -5
- package/dist/components/auth/authenticate/strategies/strategy-registry.js.map +1 -1
- package/dist/components/auth/authorize/adapters/base-filtered.d.ts.map +1 -1
- package/dist/components/auth/authorize/adapters/base-filtered.js +0 -8
- package/dist/components/auth/authorize/adapters/base-filtered.js.map +1 -1
- package/dist/components/auth/authorize/adapters/drizzle-casbin.d.ts +2 -1
- package/dist/components/auth/authorize/adapters/drizzle-casbin.d.ts.map +1 -1
- package/dist/components/auth/authorize/adapters/drizzle-casbin.js +4 -5
- package/dist/components/auth/authorize/adapters/drizzle-casbin.js.map +1 -1
- package/dist/components/auth/authorize/common/constants.d.ts.map +1 -1
- package/dist/components/auth/authorize/common/constants.js +0 -8
- package/dist/components/auth/authorize/common/constants.js.map +1 -1
- package/dist/components/auth/authorize/common/types.d.ts +2 -32
- package/dist/components/auth/authorize/common/types.d.ts.map +1 -1
- package/dist/components/auth/authorize/component.d.ts.map +1 -1
- package/dist/components/auth/authorize/component.js +0 -2
- package/dist/components/auth/authorize/component.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.js +0 -10
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/enforcer-registry.d.ts +1 -0
- package/dist/components/auth/authorize/enforcers/enforcer-registry.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/enforcer-registry.js +3 -7
- package/dist/components/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
- package/dist/components/auth/authorize/middlewares/authorize.middleware.d.ts.map +1 -1
- package/dist/components/auth/authorize/middlewares/authorize.middleware.js +0 -2
- package/dist/components/auth/authorize/middlewares/authorize.middleware.js.map +1 -1
- package/dist/components/auth/authorize/models/abilities/string-action.model.d.ts.map +1 -1
- package/dist/components/auth/authorize/models/abilities/string-action.model.js +0 -1
- package/dist/components/auth/authorize/models/abilities/string-action.model.js.map +1 -1
- package/dist/components/auth/authorize/models/abilities/string-resource.model.d.ts.map +1 -1
- package/dist/components/auth/authorize/models/abilities/string-resource.model.js +0 -1
- package/dist/components/auth/authorize/models/abilities/string-resource.model.js.map +1 -1
- package/dist/components/auth/authorize/models/authorization-role.model.d.ts.map +1 -1
- package/dist/components/auth/authorize/models/authorization-role.model.js +0 -1
- package/dist/components/auth/authorize/models/authorization-role.model.js.map +1 -1
- package/dist/components/auth/authorize/providers/authorization.provider.d.ts.map +1 -1
- package/dist/components/auth/authorize/providers/authorization.provider.js +5 -6
- package/dist/components/auth/authorize/providers/authorization.provider.js.map +1 -1
- package/dist/components/auth/base/abstract-auth-registry.d.ts.map +1 -1
- package/dist/components/auth/base/abstract-auth-registry.js +0 -3
- package/dist/components/auth/base/abstract-auth-registry.js.map +1 -1
- package/dist/components/auth/context-variables.d.ts.map +1 -1
- package/dist/components/auth/models/entities/permission.model.d.ts.map +1 -1
- package/dist/components/auth/models/entities/permission.model.js.map +1 -1
- package/dist/components/auth/models/entities/policy-definition.model.d.ts.map +1 -1
- package/dist/components/auth/models/entities/policy-definition.model.js.map +1 -1
- package/dist/components/auth/models/entities/role.model.d.ts.map +1 -1
- package/dist/components/auth/models/entities/role.model.js +0 -1
- package/dist/components/auth/models/entities/role.model.js.map +1 -1
- package/dist/components/auth/models/entities/user.model.d.ts.map +1 -1
- package/dist/components/auth/models/entities/user.model.js +0 -1
- package/dist/components/auth/models/entities/user.model.js.map +1 -1
- package/dist/components/health-check/controller.d.ts.map +1 -1
- package/dist/components/health-check/controller.js +0 -1
- package/dist/components/health-check/controller.js.map +1 -1
- package/dist/components/mail/common/types.d.ts +1 -1
- package/dist/components/mail/common/types.d.ts.map +1 -1
- package/dist/components/mail/component.d.ts.map +1 -1
- package/dist/components/mail/component.js +2 -7
- package/dist/components/mail/component.js.map +1 -1
- package/dist/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +2 -1
- package/dist/components/mail/helpers/executors/bull-mq-executor.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/executors/bull-mq-executor.helper.js +7 -7
- package/dist/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
- package/dist/components/mail/helpers/executors/direct-executor.helper.d.ts +1 -1
- package/dist/components/mail/helpers/executors/direct-executor.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/executors/direct-executor.helper.js +3 -3
- package/dist/components/mail/helpers/executors/direct-executor.helper.js.map +1 -1
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +1 -1
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js +4 -4
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
- package/dist/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +1 -1
- package/dist/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/transporters/mailgun-transporter.helper.js +3 -3
- package/dist/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
- package/dist/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +1 -1
- package/dist/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/transporters/nodemail-transporter.helper.js +3 -3
- package/dist/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
- package/dist/components/mail/providers/mail-queue-executor.provider.d.ts.map +1 -1
- package/dist/components/mail/providers/mail-queue-executor.provider.js +8 -8
- package/dist/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
- package/dist/components/mail/providers/mail-transporter.provider.d.ts.map +1 -1
- package/dist/components/mail/providers/mail-transporter.provider.js +6 -6
- package/dist/components/mail/providers/mail-transporter.provider.js.map +1 -1
- package/dist/components/mail/services/mail.service.d.ts +1 -1
- package/dist/components/mail/services/mail.service.d.ts.map +1 -1
- package/dist/components/mail/services/mail.service.js +9 -9
- package/dist/components/mail/services/mail.service.js.map +1 -1
- package/dist/components/mail/services/template.service.d.ts +1 -1
- package/dist/components/mail/services/template.service.d.ts.map +1 -1
- package/dist/components/mail/services/template.service.js +4 -4
- package/dist/components/mail/services/template.service.js.map +1 -1
- package/dist/components/mail/utilities/type.utility.d.ts +1 -1
- package/dist/components/mail/utilities/type.utility.d.ts.map +1 -1
- package/dist/components/socket-io/component.d.ts.map +1 -1
- package/dist/components/socket-io/component.js +0 -4
- package/dist/components/socket-io/component.js.map +1 -1
- package/dist/components/static-asset/common/constants.d.ts +1 -0
- package/dist/components/static-asset/common/constants.d.ts.map +1 -1
- package/dist/components/static-asset/common/constants.js +2 -1
- package/dist/components/static-asset/common/constants.js.map +1 -1
- package/dist/components/static-asset/common/types.d.ts +43 -1
- package/dist/components/static-asset/common/types.d.ts.map +1 -1
- package/dist/components/static-asset/controller/base.definition.d.ts +81 -80
- package/dist/components/static-asset/controller/base.definition.d.ts.map +1 -1
- package/dist/components/static-asset/controller/base.definition.js +1 -2
- package/dist/components/static-asset/controller/base.definition.js.map +1 -1
- package/dist/components/static-asset/controller/factory.d.ts +2 -6
- package/dist/components/static-asset/controller/factory.d.ts.map +1 -1
- package/dist/components/static-asset/controller/factory.js +41 -42
- package/dist/components/static-asset/controller/factory.js.map +1 -1
- package/dist/components/static-asset/models/base.model.d.ts +49 -19
- package/dist/components/static-asset/models/base.model.d.ts.map +1 -1
- package/dist/components/static-asset/models/base.model.js +3 -7
- package/dist/components/static-asset/models/base.model.js.map +1 -1
- package/dist/components/swagger/ui-factory.d.ts.map +1 -1
- package/dist/components/swagger/ui-factory.js +0 -2
- package/dist/components/swagger/ui-factory.js.map +1 -1
- package/dist/components/websocket/component.d.ts.map +1 -1
- package/dist/components/websocket/component.js +0 -3
- package/dist/components/websocket/component.js.map +1 -1
- package/dist/helpers/base-helper.d.ts +2 -0
- package/dist/helpers/base-helper.d.ts.map +1 -0
- package/dist/helpers/base-helper.js +6 -0
- package/dist/helpers/base-helper.js.map +1 -0
- package/dist/helpers/index.d.ts +2 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/inversion/common/keys.d.ts.map +1 -1
- package/dist/helpers/inversion/common/keys.js +0 -2
- package/dist/helpers/inversion/common/keys.js.map +1 -1
- package/dist/helpers/inversion/common/types.d.ts +18 -56
- package/dist/helpers/inversion/common/types.d.ts.map +1 -1
- package/dist/helpers/inversion/container.d.ts.map +1 -1
- package/dist/helpers/inversion/container.js +0 -1
- package/dist/helpers/inversion/container.js.map +1 -1
- package/dist/helpers/inversion/index.d.ts +1 -1
- package/dist/helpers/inversion/index.d.ts.map +1 -1
- package/dist/helpers/inversion/index.js +5 -1
- package/dist/helpers/inversion/index.js.map +1 -1
- package/dist/helpers/inversion/mixins/controller.mixin.d.ts.map +1 -1
- package/dist/helpers/inversion/mixins/controller.mixin.js +0 -3
- package/dist/helpers/inversion/mixins/controller.mixin.js.map +1 -1
- package/dist/helpers/inversion/mixins/datasource.mixin.d.ts.map +1 -1
- package/dist/helpers/inversion/mixins/datasource.mixin.js +0 -3
- package/dist/helpers/inversion/mixins/datasource.mixin.js.map +1 -1
- package/dist/helpers/inversion/mixins/model.mixin.d.ts +29 -1
- package/dist/helpers/inversion/mixins/model.mixin.d.ts.map +1 -1
- package/dist/helpers/inversion/mixins/model.mixin.js +66 -2
- package/dist/helpers/inversion/mixins/model.mixin.js.map +1 -1
- package/dist/helpers/inversion/mixins/repository.mixin.d.ts.map +1 -1
- package/dist/helpers/inversion/mixins/repository.mixin.js +0 -2
- package/dist/helpers/inversion/mixins/repository.mixin.js.map +1 -1
- package/dist/helpers/inversion/registry.d.ts +22 -0
- package/dist/helpers/inversion/registry.d.ts.map +1 -1
- package/dist/utilities/jsx.utility.d.ts +2 -16
- package/dist/utilities/jsx.utility.d.ts.map +1 -1
- package/dist/utilities/jsx.utility.js +2 -16
- package/dist/utilities/jsx.utility.js.map +1 -1
- package/dist/utilities/schema.utility.d.ts.map +1 -1
- package/dist/utilities/schema.utility.js +0 -2
- package/dist/utilities/schema.utility.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/auth/authenticate/services/basic-token.service.d.ts +0 -60
- package/dist/components/auth/authenticate/services/basic-token.service.d.ts.map +0 -1
- package/dist/components/auth/authenticate/services/basic-token.service.js.map +0 -1
- package/dist/components/auth/authenticate/services/jwt-token.service.d.ts +0 -34
- package/dist/components/auth/authenticate/services/jwt-token.service.d.ts.map +0 -1
- package/dist/components/auth/authenticate/services/jwt-token.service.js +0 -218
- package/dist/components/auth/authenticate/services/jwt-token.service.js.map +0 -1
- package/dist/components/auth/authenticate/strategies/jwt.strategy.d.ts.map +0 -1
- package/dist/components/auth/authenticate/strategies/jwt.strategy.js.map +0 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoftDeletableRepository = void 0;
|
|
4
|
+
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
5
|
+
const default_crud_1 = require("./default-crud");
|
|
6
|
+
/**
|
|
7
|
+
* Soft-deletable repository that overrides delete operations to set deletedAt timestamp
|
|
8
|
+
* instead of physically removing records from the database.
|
|
9
|
+
*
|
|
10
|
+
* Models using this repository should:
|
|
11
|
+
* - Have a `deletedAt` column (Date | null)
|
|
12
|
+
* - Set `defaultFilter: { where: { deletedAt: null } }` in @model settings
|
|
13
|
+
* - Include `deletedAt` in `hiddenProperties` if you don't want to expose it
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* @model({
|
|
18
|
+
* settings: {
|
|
19
|
+
* hiddenProperties: ['deletedAt'],
|
|
20
|
+
* defaultFilter: { where: { deletedAt: null } },
|
|
21
|
+
* },
|
|
22
|
+
* })
|
|
23
|
+
* export class Category extends BaseEntity<typeof Category.schema> {
|
|
24
|
+
* static schema = pgTable('Category', {
|
|
25
|
+
* ...withTimestamps(),
|
|
26
|
+
* ...withSoftDelete(),
|
|
27
|
+
* });
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* @repository({ dataSource: PostgresDataSource, model: Category })
|
|
31
|
+
* export class CategoryRepository extends SoftDeletableRepository<typeof Category.schema> {}
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
class SoftDeletableRepository extends default_crud_1.DefaultCRUDRepository {
|
|
35
|
+
async findById(opts) {
|
|
36
|
+
const result = await super.findById(opts);
|
|
37
|
+
if (opts.options?.isStrict && !result) {
|
|
38
|
+
throw (0, ignis_helpers_1.getError)({
|
|
39
|
+
message: `[${this.constructor.name}][findById] Entity with id ${opts.id} not found`,
|
|
40
|
+
statusCode: ignis_helpers_1.HTTP.ResultCodes.RS_4.NotFound,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
async deleteById(opts) {
|
|
46
|
+
if (opts.options?.shouldHardDelete) {
|
|
47
|
+
return super.deleteById(opts);
|
|
48
|
+
}
|
|
49
|
+
return this.updateById({
|
|
50
|
+
id: opts.id,
|
|
51
|
+
data: { deletedAt: new Date() },
|
|
52
|
+
options: opts.options,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
deleteAll(opts) {
|
|
56
|
+
if (opts.options?.shouldHardDelete) {
|
|
57
|
+
return super.deleteAll(opts);
|
|
58
|
+
}
|
|
59
|
+
return this.updateAll({
|
|
60
|
+
where: opts.where ?? {},
|
|
61
|
+
data: { deletedAt: new Date() },
|
|
62
|
+
options: opts.options,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
deleteBy(opts) {
|
|
66
|
+
if (opts.options?.shouldHardDelete) {
|
|
67
|
+
return super.deleteBy(opts);
|
|
68
|
+
}
|
|
69
|
+
return this.updateAll({
|
|
70
|
+
where: opts.where,
|
|
71
|
+
data: { deletedAt: new Date() },
|
|
72
|
+
options: opts.options,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Restore Operations
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
async restoreById(opts) {
|
|
79
|
+
const { shouldReturn = true, ...restOptions } = opts.options ?? {};
|
|
80
|
+
return this.updateById({
|
|
81
|
+
id: opts.id,
|
|
82
|
+
data: { deletedAt: null },
|
|
83
|
+
options: { ...restOptions, shouldReturn, shouldSkipDefaultFilter: true },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async restoreAll(opts) {
|
|
87
|
+
const { shouldReturn = true, force, ...restOptions } = opts.options ?? {};
|
|
88
|
+
return this.updateAll({
|
|
89
|
+
where: opts.where ?? {},
|
|
90
|
+
data: { deletedAt: null },
|
|
91
|
+
options: { ...restOptions, shouldReturn, force, shouldSkipDefaultFilter: true },
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async restoreBy(opts) {
|
|
95
|
+
return this.restoreAll(opts);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.SoftDeletableRepository = SoftDeletableRepository;
|
|
99
|
+
//# sourceMappingURL=soft-deletable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soft-deletable.js","sourceRoot":"","sources":["../../../../src/base/repositories/core/soft-deletable.ts"],"names":[],"mappings":";;;AACA,0DAAmE;AAGnE,iDAAuD;AAUvD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,uBAKX,SAAQ,oCAA4E;IAe3E,KAAK,CAAC,QAAQ,CAAiB,IAIvC;QACC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QAE7C,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YACtC,MAAM,IAAA,wBAAQ,EAAC;gBACb,OAAO,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,8BAA8B,IAAI,CAAC,EAAE,YAAY;gBACnF,UAAU,EAAE,oBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;aAC3C,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAcQ,KAAK,CAAC,UAAU,CAAiB,IAGzC;QACC,IAAI,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAI;YACxB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAuC;YACpE,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAUQ,SAAS,CAAiB,IAOlC;QACC,IAAI,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC,SAAS,CAAI,IAAI,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAI;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;YACvB,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAuC;YACpE,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAUQ,QAAQ,CAAiB,IAOjC;QACC,IAAI,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAI;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAuC;YACpE,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAED,8EAA8E;IAC9E,qBAAqB;IACrB,8EAA8E;IAE9E,KAAK,CAAC,WAAW,CAAiB,IAGjC;QACC,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC,UAAU,CAAI;YACxB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAuC;YAC9D,OAAO,EAAE,EAAE,GAAG,WAAW,EAAE,YAAY,EAAE,uBAAuB,EAAE,IAAI,EAAS;SAChF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAiB,IAGhC;QACC,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC,SAAS,CAAI;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;YACvB,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAuC;YAC9D,OAAO,EAAE,EAAE,GAAG,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAS;SACvF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAiB,IAG/B;QACC,OAAO,IAAI,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAxJD,0DAwJC"}
|
|
@@ -2,61 +2,15 @@ import { BaseEntity, TTableSchemaWithId } from '../../../base/models';
|
|
|
2
2
|
import { TMixinTarget } from '@venizia/ignis-helpers';
|
|
3
3
|
import { TFilter } from '../common';
|
|
4
4
|
import { FilterBuilder } from '../operators';
|
|
5
|
-
/**
|
|
6
|
-
* Mixin that adds default filter support to repositories.
|
|
7
|
-
*
|
|
8
|
-
* This mixin provides functionality to:
|
|
9
|
-
* - Retrieve default filters defined in model metadata
|
|
10
|
-
* - Automatically apply default filters to user queries
|
|
11
|
-
* - Allow bypassing default filters when needed
|
|
12
|
-
*
|
|
13
|
-
* Common use cases include soft delete filters (e.g., `{ where: { isDeleted: false } }`)
|
|
14
|
-
* that are automatically applied to all queries.
|
|
15
|
-
*
|
|
16
|
-
* @template T - The base class type to extend
|
|
17
|
-
* @param baseClass - The base class to mix into
|
|
18
|
-
* @returns The mixed class with default filter support
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* // In model metadata
|
|
23
|
-
* @model({ settings: { defaultFilter: { where: { isDeleted: false } } } })
|
|
24
|
-
* export class User extends BaseEntity<typeof UserSchema> { ... }
|
|
25
|
-
*
|
|
26
|
-
* // Default filter is automatically applied
|
|
27
|
-
* const activeUsers = await userRepo.find({ filter: {} });
|
|
28
|
-
* // SQL: SELECT * FROM users WHERE is_deleted = false
|
|
29
|
-
*
|
|
30
|
-
* // Bypass default filter when needed
|
|
31
|
-
* const allUsers = await userRepo.find({
|
|
32
|
-
* filter: {},
|
|
33
|
-
* options: { shouldSkipDefaultFilter: true }
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
5
|
+
/** Mixin that auto-applies default filters from model metadata (e.g., soft delete). */
|
|
37
6
|
export declare const DefaultFilterMixin: <T extends TMixinTarget<object>>(baseClass: T) => (abstract new (...args: any[]) => {
|
|
38
|
-
/** Cached default filter. Null until first access, undefined if no default filter. */
|
|
39
7
|
_defaultFilter: TFilter | null | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Abstract methods - must be implemented by the class using this mixin.
|
|
42
|
-
*/
|
|
43
8
|
getEntity(): BaseEntity<TTableSchemaWithId>;
|
|
44
9
|
get filterBuilder(): FilterBuilder;
|
|
45
|
-
/**
|
|
46
|
-
* Gets default filter from model metadata.
|
|
47
|
-
* Cached for performance - computed once per repository instance.
|
|
48
|
-
*
|
|
49
|
-
* @returns The default filter or undefined if not configured
|
|
50
|
-
*/
|
|
10
|
+
/** Gets default filter from model metadata. Cached after first access. */
|
|
51
11
|
getDefaultFilter(): TFilter | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Check if this entity has default filter configured.
|
|
54
|
-
*/
|
|
55
12
|
hasDefaultFilter(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Apply default filter to user-provided filter.
|
|
58
|
-
* Returns merged filter or user filter if shouldSkipDefaultFilter is true.
|
|
59
|
-
*/
|
|
13
|
+
/** Merges default filter with user filter. Skippable via shouldSkipDefaultFilter. */
|
|
60
14
|
applyDefaultFilter<DataObject = any>(opts: {
|
|
61
15
|
userFilter?: TFilter<DataObject>;
|
|
62
16
|
shouldSkipDefaultFilter?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-filter.d.ts","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/default-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"default-filter.d.ts","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/default-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;oBAE3D,OAAO,GAAG,IAAI,GAAG,SAAS;iBAEpB,UAAU,CAAC,kBAAkB,CAAC;yBACtB,aAAa;IAE3C,0EAA0E;;wBActD,OAAO;IAK3B,qFAAqF;uBAClE,UAAU,cAAc;QACzC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;KACnC,GAAG,OAAO,CAAC,UAAU,CAAC;MAiB1B,CAAC"}
|
|
@@ -2,59 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultFilterMixin = void 0;
|
|
4
4
|
const inversion_1 = require("../../../helpers/inversion");
|
|
5
|
-
|
|
6
|
-
// Default Filter Mixin
|
|
7
|
-
// -----------------------------------------------------------------------------
|
|
8
|
-
/**
|
|
9
|
-
* Mixin that adds default filter support to repositories.
|
|
10
|
-
*
|
|
11
|
-
* This mixin provides functionality to:
|
|
12
|
-
* - Retrieve default filters defined in model metadata
|
|
13
|
-
* - Automatically apply default filters to user queries
|
|
14
|
-
* - Allow bypassing default filters when needed
|
|
15
|
-
*
|
|
16
|
-
* Common use cases include soft delete filters (e.g., `{ where: { isDeleted: false } }`)
|
|
17
|
-
* that are automatically applied to all queries.
|
|
18
|
-
*
|
|
19
|
-
* @template T - The base class type to extend
|
|
20
|
-
* @param baseClass - The base class to mix into
|
|
21
|
-
* @returns The mixed class with default filter support
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* // In model metadata
|
|
26
|
-
* @model({ settings: { defaultFilter: { where: { isDeleted: false } } } })
|
|
27
|
-
* export class User extends BaseEntity<typeof UserSchema> { ... }
|
|
28
|
-
*
|
|
29
|
-
* // Default filter is automatically applied
|
|
30
|
-
* const activeUsers = await userRepo.find({ filter: {} });
|
|
31
|
-
* // SQL: SELECT * FROM users WHERE is_deleted = false
|
|
32
|
-
*
|
|
33
|
-
* // Bypass default filter when needed
|
|
34
|
-
* const allUsers = await userRepo.find({
|
|
35
|
-
* filter: {},
|
|
36
|
-
* options: { shouldSkipDefaultFilter: true }
|
|
37
|
-
* });
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
5
|
+
/** Mixin that auto-applies default filters from model metadata (e.g., soft delete). */
|
|
40
6
|
const DefaultFilterMixin = (baseClass) => {
|
|
41
7
|
class Mixed extends baseClass {
|
|
42
8
|
constructor() {
|
|
43
9
|
super(...arguments);
|
|
44
|
-
/** Cached default filter. Null until first access, undefined if no default filter. */
|
|
45
10
|
this._defaultFilter = null;
|
|
46
11
|
}
|
|
47
|
-
|
|
48
|
-
// Default Filter
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
/**
|
|
51
|
-
* Gets default filter from model metadata.
|
|
52
|
-
* Cached for performance - computed once per repository instance.
|
|
53
|
-
*
|
|
54
|
-
* @returns The default filter or undefined if not configured
|
|
55
|
-
*/
|
|
12
|
+
/** Gets default filter from model metadata. Cached after first access. */
|
|
56
13
|
getDefaultFilter() {
|
|
57
|
-
// null = not computed yet, undefined = computed as "no default filter"
|
|
58
14
|
if (this._defaultFilter !== null) {
|
|
59
15
|
return this._defaultFilter;
|
|
60
16
|
}
|
|
@@ -64,30 +20,20 @@ const DefaultFilterMixin = (baseClass) => {
|
|
|
64
20
|
this._defaultFilter = defaultFilter;
|
|
65
21
|
return this._defaultFilter;
|
|
66
22
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Check if this entity has default filter configured.
|
|
69
|
-
*/
|
|
70
23
|
hasDefaultFilter() {
|
|
71
24
|
const defaultFilter = this.getDefaultFilter();
|
|
72
25
|
return defaultFilter !== undefined && Object.keys(defaultFilter).length > 0;
|
|
73
26
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Apply default filter to user-provided filter.
|
|
76
|
-
* Returns merged filter or user filter if shouldSkipDefaultFilter is true.
|
|
77
|
-
*/
|
|
27
|
+
/** Merges default filter with user filter. Skippable via shouldSkipDefaultFilter. */
|
|
78
28
|
applyDefaultFilter(opts) {
|
|
79
29
|
const { userFilter, shouldSkipDefaultFilter } = opts;
|
|
80
|
-
// Skip default filter if explicitly requested
|
|
81
30
|
if (shouldSkipDefaultFilter) {
|
|
82
31
|
return userFilter ?? {};
|
|
83
32
|
}
|
|
84
|
-
// Get default filter from model metadata
|
|
85
33
|
const defaultFilter = this.getDefaultFilter();
|
|
86
|
-
// No default filter configured - return user filter
|
|
87
34
|
if (!defaultFilter) {
|
|
88
35
|
return userFilter ?? {};
|
|
89
36
|
}
|
|
90
|
-
// Merge default filter with user filter
|
|
91
37
|
return this.filterBuilder.mergeFilter({ defaultFilter, userFilter });
|
|
92
38
|
}
|
|
93
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-filter.js","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/default-filter.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AAKvD,
|
|
1
|
+
{"version":3,"file":"default-filter.js","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/default-filter.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AAKvD,uFAAuF;AAChF,MAAM,kBAAkB,GAAG,CAAiC,SAAY,EAAE,EAAE;IACjF,MAAe,KAAM,SAAQ,SAAS;QAAtC;;YACE,mBAAc,GAA+B,IAAI,CAAC;QA0CpD,CAAC;QArCC,0EAA0E;QAC1E,gBAAgB;YACd,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;gBACjC,OAAO,IAAI,CAAC,cAAc,CAAC;YAC7B,CAAC;YAED,MAAM,QAAQ,GAAG,4BAAgB,CAAC,WAAW,EAAE,CAAC;YAChD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3E,MAAM,aAAa,GAAG,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC;YAEpE,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;YACpC,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QAED,gBAAgB;YACd,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC9C,OAAO,aAAa,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9E,CAAC;QAED,qFAAqF;QACrF,kBAAkB,CAAmB,IAGpC;YACC,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC;YAErD,IAAI,uBAAuB,EAAE,CAAC;gBAC5B,OAAO,UAAU,IAAI,EAAE,CAAC;YAC1B,CAAC;YAED,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC9C,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,OAAO,UAAU,IAAI,EAAE,CAAC;YAC1B,CAAC;YAED,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;QACvE,CAAC;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AA/CW,QAAA,kBAAkB,sBA+C7B"}
|
|
@@ -1,74 +1,18 @@
|
|
|
1
1
|
import { BaseEntity, TTableSchemaWithId } from '../../../base/models';
|
|
2
2
|
import { TMixinTarget } from '@venizia/ignis-helpers';
|
|
3
|
-
/**
|
|
4
|
-
* Mixin that adds hidden/visible property management to repositories.
|
|
5
|
-
*
|
|
6
|
-
* This mixin provides functionality to:
|
|
7
|
-
* - Track hidden properties defined in model metadata
|
|
8
|
-
* - Generate visible properties for Drizzle select/returning operations
|
|
9
|
-
* - Cache computed properties for performance
|
|
10
|
-
*
|
|
11
|
-
* Hidden properties are automatically excluded from query results at the SQL level,
|
|
12
|
-
* preventing sensitive data (like passwords) from being returned.
|
|
13
|
-
*
|
|
14
|
-
* @template T - The base class type to extend
|
|
15
|
-
* @param baseClass - The base class to mix into
|
|
16
|
-
* @returns The mixed class with fields visibility support
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* // In model metadata
|
|
21
|
-
* @model({ settings: { hiddenProperties: ['password', 'secretToken'] } })
|
|
22
|
-
* export class User extends BaseEntity<typeof UserSchema> { ... }
|
|
23
|
-
*
|
|
24
|
-
* // In repository, hidden fields are automatically excluded
|
|
25
|
-
* const users = await userRepo.find({ filter: {} });
|
|
26
|
-
* // users won't include 'password' or 'secretToken' fields
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
3
|
+
/** Mixin that excludes hidden properties from query results at SQL level. */
|
|
29
4
|
export declare const FieldsVisibilityMixin: <T extends TMixinTarget<object>>(baseClass: T) => (abstract new (...args: any[]) => {
|
|
30
|
-
/** Cached set of hidden property names. Null until first access. */
|
|
31
5
|
_hiddenProperties: Set<string> | null;
|
|
32
|
-
/** Cached visible properties object. Null until first access, undefined if no hidden props. */
|
|
33
6
|
_visibleProperties: Record<string, any> | null | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Abstract method - must be implemented by the class using this mixin.
|
|
36
|
-
* @returns The entity instance for this repository
|
|
37
|
-
*/
|
|
38
7
|
getEntity(): BaseEntity<TTableSchemaWithId>;
|
|
39
|
-
/**
|
|
40
|
-
* Gets the set of hidden property names.
|
|
41
|
-
* Auto-resolves from model metadata on first access.
|
|
42
|
-
*/
|
|
43
8
|
get hiddenProperties(): Set<string>;
|
|
44
|
-
/** Sets the hidden properties set. */
|
|
45
9
|
set hiddenProperties(value: Set<string>);
|
|
46
|
-
/**
|
|
47
|
-
* Gets hidden properties from model metadata.
|
|
48
|
-
* Cached for performance - computed once per repository instance.
|
|
49
|
-
*
|
|
50
|
-
* @returns Set of hidden property names
|
|
51
|
-
*/
|
|
10
|
+
/** Gets hidden properties from model metadata. Cached after first access. */
|
|
52
11
|
getHiddenProperties(): Set<string>;
|
|
53
|
-
/**
|
|
54
|
-
* Checks if this entity has hidden properties configured.
|
|
55
|
-
*
|
|
56
|
-
* @returns True if there are hidden properties
|
|
57
|
-
*/
|
|
58
12
|
hasHiddenProperties(): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Gets visible properties object.
|
|
61
|
-
* Auto-resolves from schema excluding hidden properties.
|
|
62
|
-
*/
|
|
63
13
|
get visibleProperties(): Record<string, any> | undefined;
|
|
64
14
|
set visibleProperties(value: Record<string, any> | undefined);
|
|
65
|
-
/**
|
|
66
|
-
* Get visible properties object for Drizzle select/returning.
|
|
67
|
-
* Excludes hidden properties. Cached for performance.
|
|
68
|
-
*
|
|
69
|
-
* @returns Column object for Drizzle (e.g., { id: schema.id, email: schema.email })
|
|
70
|
-
* or undefined if no hidden properties (use default select all behavior)
|
|
71
|
-
*/
|
|
15
|
+
/** Gets visible properties for Drizzle select/returning. Undefined if no hidden props. Cached. */
|
|
72
16
|
getVisibleProperties(): Record<string, any> | undefined;
|
|
73
17
|
}) & T;
|
|
74
18
|
//# sourceMappingURL=fields-visibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields-visibility.d.ts","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/fields-visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"fields-visibility.d.ts","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/fields-visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;uBAE3D,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI;wBACjB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS;iBAEpC,UAAU,CAAC,kBAAkB,CAAC;4BAE5B,GAAG,CAAC,MAAM,CAAC;gCAIP,GAAG,CAAC,MAAM,CAAC;IAIvC,6EAA6E;2BACtD,GAAG,CAAC,MAAM,CAAC;2BAaX,OAAO;6BAGL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS;iCAI3B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS;IAI5D,kGAAkG;4BAC1E,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS;MA4B1D,CAAC"}
|
|
@@ -3,64 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FieldsVisibilityMixin = void 0;
|
|
4
4
|
const inversion_1 = require("../../../helpers/inversion");
|
|
5
5
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
|
-
|
|
7
|
-
// Fields Visibility Mixin
|
|
8
|
-
// -----------------------------------------------------------------------------
|
|
9
|
-
/**
|
|
10
|
-
* Mixin that adds hidden/visible property management to repositories.
|
|
11
|
-
*
|
|
12
|
-
* This mixin provides functionality to:
|
|
13
|
-
* - Track hidden properties defined in model metadata
|
|
14
|
-
* - Generate visible properties for Drizzle select/returning operations
|
|
15
|
-
* - Cache computed properties for performance
|
|
16
|
-
*
|
|
17
|
-
* Hidden properties are automatically excluded from query results at the SQL level,
|
|
18
|
-
* preventing sensitive data (like passwords) from being returned.
|
|
19
|
-
*
|
|
20
|
-
* @template T - The base class type to extend
|
|
21
|
-
* @param baseClass - The base class to mix into
|
|
22
|
-
* @returns The mixed class with fields visibility support
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* // In model metadata
|
|
27
|
-
* @model({ settings: { hiddenProperties: ['password', 'secretToken'] } })
|
|
28
|
-
* export class User extends BaseEntity<typeof UserSchema> { ... }
|
|
29
|
-
*
|
|
30
|
-
* // In repository, hidden fields are automatically excluded
|
|
31
|
-
* const users = await userRepo.find({ filter: {} });
|
|
32
|
-
* // users won't include 'password' or 'secretToken' fields
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
6
|
+
/** Mixin that excludes hidden properties from query results at SQL level. */
|
|
35
7
|
const FieldsVisibilityMixin = (baseClass) => {
|
|
36
8
|
class Mixed extends baseClass {
|
|
37
9
|
constructor() {
|
|
38
10
|
super(...arguments);
|
|
39
|
-
/** Cached set of hidden property names. Null until first access. */
|
|
40
11
|
this._hiddenProperties = null;
|
|
41
|
-
/** Cached visible properties object. Null until first access, undefined if no hidden props. */
|
|
42
12
|
this._visibleProperties = null;
|
|
43
13
|
}
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
// Hidden Properties
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
/**
|
|
48
|
-
* Gets the set of hidden property names.
|
|
49
|
-
* Auto-resolves from model metadata on first access.
|
|
50
|
-
*/
|
|
51
14
|
get hiddenProperties() {
|
|
52
15
|
return this.getHiddenProperties();
|
|
53
16
|
}
|
|
54
|
-
/** Sets the hidden properties set. */
|
|
55
17
|
set hiddenProperties(value) {
|
|
56
18
|
this._hiddenProperties = value;
|
|
57
19
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Gets hidden properties from model metadata.
|
|
60
|
-
* Cached for performance - computed once per repository instance.
|
|
61
|
-
*
|
|
62
|
-
* @returns Set of hidden property names
|
|
63
|
-
*/
|
|
20
|
+
/** Gets hidden properties from model metadata. Cached after first access. */
|
|
64
21
|
getHiddenProperties() {
|
|
65
22
|
if (this._hiddenProperties !== null) {
|
|
66
23
|
return this._hiddenProperties;
|
|
@@ -71,46 +28,25 @@ const FieldsVisibilityMixin = (baseClass) => {
|
|
|
71
28
|
this._hiddenProperties = new Set(hiddenProps);
|
|
72
29
|
return this._hiddenProperties;
|
|
73
30
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Checks if this entity has hidden properties configured.
|
|
76
|
-
*
|
|
77
|
-
* @returns True if there are hidden properties
|
|
78
|
-
*/
|
|
79
31
|
hasHiddenProperties() {
|
|
80
32
|
return this.getHiddenProperties().size > 0;
|
|
81
33
|
}
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
// Visible Properties
|
|
84
|
-
// ---------------------------------------------------------------------------
|
|
85
|
-
/**
|
|
86
|
-
* Gets visible properties object.
|
|
87
|
-
* Auto-resolves from schema excluding hidden properties.
|
|
88
|
-
*/
|
|
89
34
|
get visibleProperties() {
|
|
90
35
|
return this.getVisibleProperties();
|
|
91
36
|
}
|
|
92
37
|
set visibleProperties(value) {
|
|
93
38
|
this._visibleProperties = value;
|
|
94
39
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Get visible properties object for Drizzle select/returning.
|
|
97
|
-
* Excludes hidden properties. Cached for performance.
|
|
98
|
-
*
|
|
99
|
-
* @returns Column object for Drizzle (e.g., { id: schema.id, email: schema.email })
|
|
100
|
-
* or undefined if no hidden properties (use default select all behavior)
|
|
101
|
-
*/
|
|
40
|
+
/** Gets visible properties for Drizzle select/returning. Undefined if no hidden props. Cached. */
|
|
102
41
|
getVisibleProperties() {
|
|
103
|
-
// null = not computed yet, undefined = computed as "no hidden properties"
|
|
104
42
|
if (this._visibleProperties !== null) {
|
|
105
43
|
return this._visibleProperties;
|
|
106
44
|
}
|
|
107
45
|
const hiddenProps = this.getHiddenProperties();
|
|
108
|
-
// If no hidden properties, cache and return undefined (signal to use default behavior)
|
|
109
46
|
if (hiddenProps.size === 0) {
|
|
110
47
|
this._visibleProperties = undefined;
|
|
111
48
|
return undefined;
|
|
112
49
|
}
|
|
113
|
-
// Build columns object excluding hidden properties
|
|
114
50
|
const schema = this.getEntity().schema;
|
|
115
51
|
const columns = (0, drizzle_orm_1.getTableColumns)(schema);
|
|
116
52
|
const visibleProperties = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields-visibility.js","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/fields-visibility.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AAEvD,6CAA8C;AAE9C,
|
|
1
|
+
{"version":3,"file":"fields-visibility.js","sourceRoot":"","sources":["../../../../src/base/repositories/mixins/fields-visibility.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AAEvD,6CAA8C;AAE9C,6EAA6E;AACtE,MAAM,qBAAqB,GAAG,CAAiC,SAAY,EAAE,EAAE;IACpF,MAAe,KAAM,SAAQ,SAAS;QAAtC;;YACE,sBAAiB,GAAuB,IAAI,CAAC;YAC7C,uBAAkB,GAA2C,IAAI,CAAC;QA+DpE,CAAC;QA3DC,IAAI,gBAAgB;YAClB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACpC,CAAC;QAED,IAAI,gBAAgB,CAAC,KAAkB;YACrC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QACjC,CAAC;QAED,6EAA6E;QAC7E,mBAAmB;YACjB,IAAI,IAAI,CAAC,iBAAiB,KAAK,IAAI,EAAE,CAAC;gBACpC,OAAO,IAAI,CAAC,iBAAiB,CAAC;YAChC,CAAC;YAED,MAAM,QAAQ,GAAG,4BAAgB,CAAC,WAAW,EAAE,CAAC;YAChD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3E,MAAM,WAAW,GAAG,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,IAAI,EAAE,CAAC;YAE3E,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAChC,CAAC;QAED,mBAAmB;YACjB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,iBAAiB;YACnB,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC;QACrC,CAAC;QAED,IAAI,iBAAiB,CAAC,KAAsC;YAC1D,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAClC,CAAC;QAED,kGAAkG;QAClG,oBAAoB;YAClB,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC,kBAAkB,CAAC;YACjC,CAAC;YAED,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAE/C,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBAC3B,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;gBACpC,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;YACvC,MAAM,OAAO,GAAG,IAAA,6BAAe,EAAC,MAAM,CAAC,CAAC;YACxC,MAAM,iBAAiB,GAAwB,EAAE,CAAC;YAElD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;gBAC1B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC1B,iBAAiB,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC;YAED,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;YAC5C,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACjC,CAAC;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AArEW,QAAA,qBAAqB,yBAqEhC"}
|
|
@@ -2,154 +2,49 @@ import { TTableObject, TTableSchemaWithId } from '../../../base/models';
|
|
|
2
2
|
import { BaseHelper } from '@venizia/ignis-helpers';
|
|
3
3
|
import { type SQL } from 'drizzle-orm';
|
|
4
4
|
import { TDrizzleQueryOptions, TFields, TFilter, TInclusion, TRelationConfig, TWhere } from '../common';
|
|
5
|
-
/**
|
|
6
|
-
* Converts filter objects into Drizzle ORM query options.
|
|
7
|
-
*
|
|
8
|
-
* The FilterBuilder handles:
|
|
9
|
-
* - Where clause conversion with support for operators and JSON paths
|
|
10
|
-
* - Field selection (columns)
|
|
11
|
-
* - Ordering/sorting with JSON path support
|
|
12
|
-
* - Relation inclusion with nested filtering
|
|
13
|
-
* - Hidden property exclusion
|
|
14
|
-
* - Default filter merging
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const builder = new FilterBuilder();
|
|
19
|
-
*
|
|
20
|
-
* // Build query options from filter
|
|
21
|
-
* const options = builder.build({
|
|
22
|
-
* tableName: 'users',
|
|
23
|
-
* schema: UserSchema,
|
|
24
|
-
* filter: {
|
|
25
|
-
* where: { status: 'active', age: { gte: 18 } },
|
|
26
|
-
* order: ['createdAt DESC'],
|
|
27
|
-
* limit: 10
|
|
28
|
-
* }
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
5
|
+
/** Converts filter objects into Drizzle ORM query options (where, order, columns, relations). */
|
|
32
6
|
export declare class FilterBuilder extends BaseHelper {
|
|
33
|
-
/** Creates a new FilterBuilder instance. */
|
|
34
7
|
constructor();
|
|
35
|
-
/**
|
|
36
|
-
* Merges a default filter with a user-provided filter.
|
|
37
|
-
*
|
|
38
|
-
* **Merge Strategy:**
|
|
39
|
-
* - `where`: Deep merge (user values override matching keys)
|
|
40
|
-
* - All other fields: User completely replaces default (if provided)
|
|
41
|
-
*
|
|
42
|
-
* @template T - The entity type
|
|
43
|
-
* @param opts - Merge options
|
|
44
|
-
* @param opts.defaultFilter - The default filter to apply
|
|
45
|
-
* @param opts.userFilter - The user-provided filter
|
|
46
|
-
* @returns The merged filter
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* const merged = builder.mergeFilter({
|
|
51
|
-
* defaultFilter: { where: { isDeleted: false }, limit: 100 },
|
|
52
|
-
* userFilter: { where: { status: 'active' }, limit: 10 }
|
|
53
|
-
* });
|
|
54
|
-
* // Result: { where: { isDeleted: false, status: 'active' }, limit: 10 }
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
8
|
+
/** Merges default filter with user filter. Where is deep-merged; other fields user-wins. */
|
|
57
9
|
mergeFilter<T = any>(opts: {
|
|
58
10
|
defaultFilter?: TFilter<T>;
|
|
59
11
|
userFilter?: TFilter<T>;
|
|
60
12
|
}): TFilter<T>;
|
|
61
|
-
/**
|
|
62
|
-
* Resolves hidden properties for a schema from MetadataRegistry.
|
|
63
|
-
*
|
|
64
|
-
* @param opts - Options containing the schema
|
|
65
|
-
* @returns Set of property names that should be hidden
|
|
66
|
-
*/
|
|
13
|
+
/** Resolves hidden properties for a schema from MetadataRegistry. */
|
|
67
14
|
resolveHiddenProperties(opts: {
|
|
68
15
|
schema: TTableSchemaWithId;
|
|
69
16
|
}): Set<string>;
|
|
70
|
-
/**
|
|
71
|
-
* Resolves default filter for a schema from MetadataRegistry.
|
|
72
|
-
*
|
|
73
|
-
* @param opts - Options containing the schema
|
|
74
|
-
* @returns The default filter or undefined if not configured
|
|
75
|
-
*/
|
|
17
|
+
/** Resolves default filter for a schema from MetadataRegistry. */
|
|
76
18
|
resolveDefaultFilter(opts: {
|
|
77
19
|
schema: TTableSchemaWithId;
|
|
78
20
|
}): TFilter | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* Resolves relation configurations for a schema from MetadataRegistry.
|
|
81
|
-
*
|
|
82
|
-
* @param opts - Options containing the schema
|
|
83
|
-
* @returns Record mapping relation names to their configurations
|
|
84
|
-
*/
|
|
21
|
+
/** Resolves relation configurations for a schema from MetadataRegistry. */
|
|
85
22
|
resolveRelations(opts: {
|
|
86
23
|
schema: TTableSchemaWithId;
|
|
87
24
|
}): Record<string, TRelationConfig>;
|
|
88
|
-
/**
|
|
89
|
-
* Builds Drizzle query options from a filter object.
|
|
90
|
-
*
|
|
91
|
-
* @template Schema - The table schema type
|
|
92
|
-
* @param opts - Build options
|
|
93
|
-
* @param opts.tableName - Name of the table for error messages
|
|
94
|
-
* @param opts.schema - The Drizzle table schema
|
|
95
|
-
* @param opts.filter - The filter to convert
|
|
96
|
-
* @returns Drizzle-compatible query options
|
|
97
|
-
*/
|
|
25
|
+
/** Builds Drizzle query options from a filter object. */
|
|
98
26
|
build<Schema extends TTableSchemaWithId>(opts: {
|
|
99
27
|
tableName: string;
|
|
100
28
|
schema: Schema;
|
|
101
29
|
filter: TFilter<TTableObject<Schema>>;
|
|
102
30
|
}): TDrizzleQueryOptions;
|
|
103
|
-
/**
|
|
104
|
-
* Converts fields selection to Drizzle columns format.
|
|
105
|
-
*
|
|
106
|
-
* @param opts - Options containing fields selection
|
|
107
|
-
* @returns Record of column names to boolean (true = include)
|
|
108
|
-
*/
|
|
31
|
+
/** Converts fields selection to Drizzle columns format. */
|
|
109
32
|
toColumns(opts: {
|
|
110
33
|
fields: TFields;
|
|
111
34
|
}): Record<string, boolean>;
|
|
112
|
-
/**
|
|
113
|
-
* Converts a where clause to a Drizzle SQL condition.
|
|
114
|
-
* Supports regular columns, JSON paths, operators, and logical groups (AND/OR).
|
|
115
|
-
*
|
|
116
|
-
* @template Schema - The table schema type
|
|
117
|
-
* @param opts - Conversion options
|
|
118
|
-
* @param opts.tableName - Name of the table for error messages
|
|
119
|
-
* @param opts.schema - The Drizzle table schema
|
|
120
|
-
* @param opts.where - The where clause to convert
|
|
121
|
-
* @returns SQL condition or undefined if no conditions
|
|
122
|
-
*/
|
|
35
|
+
/** Converts a where clause to a Drizzle SQL condition (supports operators, JSON paths, AND/OR). */
|
|
123
36
|
toWhere<Schema extends TTableSchemaWithId>(opts: {
|
|
124
37
|
tableName: string;
|
|
125
38
|
schema: Schema;
|
|
126
39
|
where: TWhere<TTableObject<Schema>>;
|
|
127
40
|
}): SQL | undefined;
|
|
128
|
-
/**
|
|
129
|
-
* Converts an order clause to Drizzle SQL order expressions.
|
|
130
|
-
* Supports regular columns and JSON paths.
|
|
131
|
-
*
|
|
132
|
-
* @template Schema - The table schema type
|
|
133
|
-
* @param opts - Conversion options
|
|
134
|
-
* @param opts.tableName - Name of the table for error messages
|
|
135
|
-
* @param opts.schema - The Drizzle table schema
|
|
136
|
-
* @param opts.order - Array of order strings (e.g., ['createdAt DESC', 'name ASC'])
|
|
137
|
-
* @returns Array of SQL order expressions
|
|
138
|
-
*/
|
|
41
|
+
/** Converts order strings to Drizzle SQL order expressions (supports JSON paths). */
|
|
139
42
|
toOrderBy<Schema extends TTableSchemaWithId>(opts: {
|
|
140
43
|
tableName: string;
|
|
141
44
|
schema: Schema;
|
|
142
45
|
order: string[];
|
|
143
46
|
}): SQL[];
|
|
144
|
-
/**
|
|
145
|
-
* Converts an include clause to Drizzle 'with' options for relation loading.
|
|
146
|
-
* Handles nested filtering, default filter application, and hidden property exclusion.
|
|
147
|
-
*
|
|
148
|
-
* @param opts - Conversion options
|
|
149
|
-
* @param opts.include - Array of inclusion configurations
|
|
150
|
-
* @param opts.relations - Map of relation names to their configurations
|
|
151
|
-
* @returns Record mapping relation names to query options or true
|
|
152
|
-
*/
|
|
47
|
+
/** Converts include clause to Drizzle 'with' options with nested filtering and hidden prop exclusion. */
|
|
153
48
|
toInclude(opts: {
|
|
154
49
|
include: TInclusion[];
|
|
155
50
|
relations: {
|