@venizia/ignis 0.0.7-8 → 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 +2757 -28
- 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 +26 -207
- 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 +11 -16
- 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 +56 -34
- package/dist/components/auth/authenticate/common/types.d.ts.map +1 -1
- package/dist/components/auth/authenticate/component.d.ts +3 -16
- package/dist/components/auth/authenticate/component.d.ts.map +1 -1
- package/dist/components/auth/authenticate/component.js +105 -73
- package/dist/components/auth/authenticate/component.js.map +1 -1
- package/dist/components/auth/authenticate/controllers/factory.d.ts.map +1 -1
- package/dist/components/auth/authenticate/controllers/factory.js +2 -2
- package/dist/components/auth/authenticate/controllers/factory.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 +9 -23
- 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} +18 -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 +73 -0
- package/dist/components/auth/authorize/adapters/base-filtered.d.ts.map +1 -0
- package/dist/components/auth/authorize/adapters/base-filtered.js +90 -0
- package/dist/components/auth/authorize/adapters/base-filtered.js.map +1 -0
- package/dist/components/auth/authorize/adapters/drizzle-casbin.d.ts +40 -0
- package/dist/components/auth/authorize/adapters/drizzle-casbin.d.ts.map +1 -0
- package/dist/components/auth/authorize/adapters/drizzle-casbin.js +99 -0
- package/dist/components/auth/authorize/adapters/drizzle-casbin.js.map +1 -0
- package/dist/components/auth/authorize/adapters/index.d.ts +3 -0
- package/dist/components/auth/authorize/adapters/index.d.ts.map +1 -0
- package/dist/components/auth/authorize/adapters/index.js +19 -0
- package/dist/components/auth/authorize/adapters/index.js.map +1 -0
- package/dist/components/auth/authorize/common/constants.d.ts +37 -4
- package/dist/components/auth/authorize/common/constants.d.ts.map +1 -1
- package/dist/components/auth/authorize/common/constants.js +61 -9
- package/dist/components/auth/authorize/common/constants.js.map +1 -1
- package/dist/components/auth/authorize/common/keys.d.ts +1 -2
- package/dist/components/auth/authorize/common/keys.d.ts.map +1 -1
- package/dist/components/auth/authorize/common/keys.js +3 -2
- package/dist/components/auth/authorize/common/keys.js.map +1 -1
- package/dist/components/auth/authorize/common/types.d.ts +78 -98
- package/dist/components/auth/authorize/common/types.d.ts.map +1 -1
- package/dist/components/auth/authorize/component.d.ts +1 -0
- package/dist/components/auth/authorize/component.d.ts.map +1 -1
- package/dist/components/auth/authorize/component.js +12 -34
- package/dist/components/auth/authorize/component.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.d.ts +45 -11
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.js +198 -39
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/enforcer-registry.d.ts +12 -6
- package/dist/components/auth/authorize/enforcers/enforcer-registry.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/enforcer-registry.js +30 -14
- package/dist/components/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/index.d.ts +0 -1
- package/dist/components/auth/authorize/enforcers/index.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/index.js +0 -1
- package/dist/components/auth/authorize/enforcers/index.js.map +1 -1
- package/dist/components/auth/authorize/index.d.ts +1 -0
- package/dist/components/auth/authorize/index.d.ts.map +1 -1
- package/dist/components/auth/authorize/index.js +1 -0
- package/dist/components/auth/authorize/index.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/index.d.ts +3 -0
- package/dist/components/auth/authorize/models/abilities/index.d.ts.map +1 -0
- package/dist/components/auth/authorize/models/abilities/index.js +19 -0
- package/dist/components/auth/authorize/models/abilities/index.js.map +1 -0
- package/dist/components/auth/authorize/models/abilities/string-action.model.d.ts +14 -0
- package/dist/components/auth/authorize/models/abilities/string-action.model.d.ts.map +1 -0
- package/dist/components/auth/authorize/models/abilities/string-action.model.js +23 -0
- package/dist/components/auth/authorize/models/abilities/string-action.model.js.map +1 -0
- package/dist/components/auth/authorize/models/abilities/string-resource.model.d.ts +13 -0
- package/dist/components/auth/authorize/models/abilities/string-resource.model.d.ts.map +1 -0
- package/dist/components/auth/authorize/models/abilities/string-resource.model.js +19 -0
- package/dist/components/auth/authorize/models/abilities/string-resource.model.js.map +1 -0
- 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/models/index.d.ts +1 -0
- package/dist/components/auth/authorize/models/index.d.ts.map +1 -1
- package/dist/components/auth/authorize/models/index.js +1 -0
- package/dist/components/auth/authorize/models/index.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 +48 -43
- package/dist/components/auth/authorize/providers/authorization.provider.js.map +1 -1
- package/dist/components/auth/base/abstract-auth-registry.d.ts +1 -0
- package/dist/components/auth/base/abstract-auth-registry.d.ts.map +1 -1
- package/dist/components/auth/base/abstract-auth-registry.js +3 -3
- package/dist/components/auth/base/abstract-auth-registry.js.map +1 -1
- package/dist/components/auth/context-variables.d.ts +14 -0
- package/dist/components/auth/context-variables.d.ts.map +1 -0
- package/dist/components/auth/context-variables.js +3 -0
- package/dist/components/auth/context-variables.js.map +1 -0
- package/dist/components/auth/index.d.ts +1 -0
- package/dist/components/auth/index.d.ts.map +1 -1
- package/dist/components/auth/index.js +1 -0
- package/dist/components/auth/index.js.map +1 -1
- package/dist/components/auth/models/entities/index.d.ts +1 -2
- package/dist/components/auth/models/entities/index.d.ts.map +1 -1
- package/dist/components/auth/models/entities/index.js +1 -2
- package/dist/components/auth/models/entities/index.js.map +1 -1
- package/dist/components/auth/models/entities/permission.model.d.ts +0 -1
- package/dist/components/auth/models/entities/permission.model.d.ts.map +1 -1
- package/dist/components/auth/models/entities/permission.model.js +0 -2
- package/dist/components/auth/models/entities/permission.model.js.map +1 -1
- package/dist/components/auth/models/entities/policy-definition.model.d.ts +24 -0
- package/dist/components/auth/models/entities/policy-definition.model.d.ts.map +1 -0
- package/dist/components/auth/models/entities/policy-definition.model.js +39 -0
- package/dist/components/auth/models/entities/policy-definition.model.js.map +1 -0
- package/dist/components/auth/models/entities/role.model.d.ts +3 -1
- package/dist/components/auth/models/entities/role.model.d.ts.map +1 -1
- package/dist/components/auth/models/entities/role.model.js +4 -2
- package/dist/components/auth/models/entities/role.model.js.map +1 -1
- package/dist/components/auth/models/entities/user.model.d.ts +4 -2
- package/dist/components/auth/models/entities/user.model.d.ts.map +1 -1
- package/dist/components/auth/models/entities/user.model.js +5 -4
- 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 +97 -71
- 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
- package/dist/components/auth/authorize/enforcers/default.enforcer.d.ts +0 -37
- package/dist/components/auth/authorize/enforcers/default.enforcer.d.ts.map +0 -1
- package/dist/components/auth/authorize/enforcers/default.enforcer.js +0 -125
- package/dist/components/auth/authorize/enforcers/default.enforcer.js.map +0 -1
- package/dist/components/auth/models/entities/permission-mapping.model.d.ts +0 -26
- package/dist/components/auth/models/entities/permission-mapping.model.d.ts.map +0 -1
- package/dist/components/auth/models/entities/permission-mapping.model.js +0 -33
- package/dist/components/auth/models/entities/permission-mapping.model.js.map +0 -1
- package/dist/components/auth/models/entities/user-role.model.d.ts +0 -17
- package/dist/components/auth/models/entities/user-role.model.d.ts.map +0 -1
- package/dist/components/auth/models/entities/user-role.model.js +0 -34
- package/dist/components/auth/models/entities/user-role.model.js.map +0 -1
|
@@ -6,10 +6,7 @@ import { createRoute, Hook, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
|
6
6
|
import { IConfigurable, ValueOrPromise } from '@venizia/ignis-helpers';
|
|
7
7
|
import type { TypedResponse } from 'hono';
|
|
8
8
|
import { Context, Env, Schema } from 'hono';
|
|
9
|
-
/**
|
|
10
|
-
* Typed validation results for route handlers.
|
|
11
|
-
* Use with {@link TContext} to define handler parameter types without heavy inference.
|
|
12
|
-
*/
|
|
9
|
+
/** Typed validation results for route handlers. */
|
|
13
10
|
export interface IValidRequestProps<JsonType = unknown, QueryType = unknown, ParamType = unknown, HeaderType = unknown, CookieType = unknown, FormType = unknown> {
|
|
14
11
|
json?: JsonType;
|
|
15
12
|
query?: QueryType;
|
|
@@ -18,77 +15,30 @@ export interface IValidRequestProps<JsonType = unknown, QueryType = unknown, Par
|
|
|
18
15
|
cookie?: CookieType;
|
|
19
16
|
form?: FormType;
|
|
20
17
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Lightweight typed context that bypasses RouteHandler inference.
|
|
23
|
-
*
|
|
24
|
-
* Use `valid<T>('target')` for explicit typing of validated request data.
|
|
25
|
-
*
|
|
26
|
-
* @typeParam RouteEnv - Hono environment type
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* async createUser(opts: { context: TTypedContext }) {
|
|
31
|
-
* const body = opts.context.req.valid<{ name: string; email: string }>('json');
|
|
32
|
-
* const query = opts.context.req.valid<{ dryRun?: boolean }>('query');
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
18
|
+
/** Lightweight typed context that bypasses RouteHandler inference. */
|
|
36
19
|
export type TContext<RouteEnv extends Env = Env, ValidTargetKey extends string = string> = Omit<Context<RouteEnv>, 'req'> & {
|
|
37
20
|
req: Omit<Context<RouteEnv>['req'], 'valid'> & {
|
|
38
21
|
valid<T = unknown>(target: ValidTargetKey): T;
|
|
39
22
|
};
|
|
40
23
|
};
|
|
41
24
|
export type TRouteContext<RouteEnv extends Env = Env> = TContext<RouteEnv, keyof IValidRequestProps>;
|
|
42
|
-
/**
|
|
43
|
-
* Type assertion function to cast middleware context to TContext.
|
|
44
|
-
* Safe at runtime because TContext is structurally identical to Context.
|
|
45
|
-
*/
|
|
25
|
+
/** Casts middleware context to TContext (safe -- structurally identical to Context). */
|
|
46
26
|
export declare const asTypedContext: <E extends Env>(context: unknown) => TContext<E, string>;
|
|
47
|
-
/**
|
|
48
|
-
* Lightweight handler type for route handlers.
|
|
49
|
-
* Uses TTypedContext to avoid heavy RouteHandler inference.
|
|
50
|
-
*/
|
|
27
|
+
/** Lightweight handler type using TTypedContext to avoid heavy RouteHandler inference. */
|
|
51
28
|
export type TRouteHandler<ResponseType = unknown, RouteEnv extends Env = Env> = (context: TRouteContext<RouteEnv>) => ValueOrPromise<Response | TypedResponse<ResponseType>>;
|
|
52
|
-
/**
|
|
53
|
-
* Represents a registered route with its configuration and router instance.
|
|
54
|
-
*
|
|
55
|
-
* Returned by {@link IController.bindRoute} and {@link IController.defineRoute}
|
|
56
|
-
* after a route is registered with the router.
|
|
57
|
-
*
|
|
58
|
-
* @typeParam RouteConfig - The route configuration type
|
|
59
|
-
* @typeParam RouteEnv - Hono environment type
|
|
60
|
-
* @typeParam RouteSchema - Combined schema type for all routes
|
|
61
|
-
* @typeParam BasePath - Base path prefix for the router
|
|
62
|
-
*/
|
|
29
|
+
/** Registered route with its configuration and router instance. */
|
|
63
30
|
export interface IDefineRouteOptions<RouteConfig extends HonoRouteConfig, RouteEnv extends Env = Env, RouteSchema extends Schema = {}, BasePath extends string = '/'> {
|
|
64
31
|
configs: ReturnType<typeof createRoute<string, RouteConfig>>;
|
|
65
32
|
route: OpenAPIHono<RouteEnv, RouteSchema, BasePath>;
|
|
66
33
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Fluent binding options for registering a route handler.
|
|
69
|
-
*
|
|
70
|
-
* Enables a two-step binding pattern:
|
|
71
|
-
* ```typescript
|
|
72
|
-
* controller.bindRoute({ configs }).to({ handler });
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* @typeParam RouteConfig - The route configuration type
|
|
76
|
-
* @typeParam RouteEnv - Hono environment type
|
|
77
|
-
* @typeParam RouteSchema - Combined schema type
|
|
78
|
-
* @typeParam BasePath - Base path prefix
|
|
79
|
-
*/
|
|
34
|
+
/** Fluent binding for two-step route registration: bindRoute({ configs }).to({ handler }). */
|
|
80
35
|
export interface IBindRouteOptions<RouteConfig extends HonoRouteConfig, RouteEnv extends Env = Env, RouteSchema extends Schema = {}, BasePath extends string = '/'> {
|
|
81
36
|
configs: RouteConfig;
|
|
82
37
|
to: <ReponseType = unknown>(opts: {
|
|
83
38
|
handler: TRouteHandler<ReponseType, RouteEnv>;
|
|
84
39
|
}) => IDefineRouteOptions<RouteConfig, RouteEnv, RouteSchema, BasePath>;
|
|
85
40
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Route configuration extended with authentication and authorization.
|
|
88
|
-
*
|
|
89
|
-
* Adds optional `authenticate` and `authorize` fields to standard route config
|
|
90
|
-
* for declarative auth configuration on individual routes.
|
|
91
|
-
*/
|
|
41
|
+
/** Route configuration extended with optional authenticate and authorize fields. */
|
|
92
42
|
export interface IAuthRouteConfig extends HonoRouteConfig {
|
|
93
43
|
authenticate?: {
|
|
94
44
|
strategies?: TAuthStrategy[];
|
|
@@ -96,93 +46,28 @@ export interface IAuthRouteConfig extends HonoRouteConfig {
|
|
|
96
46
|
};
|
|
97
47
|
authorize?: IAuthorizationSpec | IAuthorizationSpec[];
|
|
98
48
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Base controller interface defining the contract for all controllers.
|
|
101
|
-
*
|
|
102
|
-
* Controllers are responsible for:
|
|
103
|
-
* - Defining HTTP routes and their handlers
|
|
104
|
-
* - Validating request/response schemas via OpenAPI
|
|
105
|
-
* - Applying authentication middleware
|
|
106
|
-
* - Returning the configured router for mounting
|
|
107
|
-
*
|
|
108
|
-
* @typeParam RouteEnv - Hono environment for context variables (e.g., user, db)
|
|
109
|
-
* @typeParam RouteSchema - Combined schema type for all routes
|
|
110
|
-
* @typeParam BasePath - Base path prefix for the router
|
|
111
|
-
* @typeParam ConfigurableOptions - Options passed during controller configuration
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* class UserController extends BaseController implements IController {
|
|
116
|
-
* binding() {
|
|
117
|
-
* this.defineRoute({
|
|
118
|
-
* configs: { path: '/', method: 'get', ... },
|
|
119
|
-
* handler: (c) => c.json({ users: [] })
|
|
120
|
-
* });
|
|
121
|
-
* }
|
|
122
|
-
* }
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
49
|
+
/** Base controller interface defining route registration and configuration contract. */
|
|
125
50
|
export interface IController<RouteEnv extends Env = Env, RouteSchema extends Schema = {}, BasePath extends string = '/', ConfigurableOptions extends object = {}> extends IConfigurable<ConfigurableOptions, OpenAPIHono<RouteEnv, RouteSchema, BasePath>> {
|
|
126
|
-
/** The OpenAPIHono router instance for this controller */
|
|
127
51
|
router: OpenAPIHono<RouteEnv, RouteSchema, BasePath>;
|
|
128
|
-
/**
|
|
129
|
-
* Creates a fluent binding for registering a route.
|
|
130
|
-
*
|
|
131
|
-
* Use this when you need a two-step binding pattern or want to
|
|
132
|
-
* conditionally bind handlers.
|
|
133
|
-
*
|
|
134
|
-
* @param opts - Object containing route configuration
|
|
135
|
-
* @returns Binding options with a `to()` method for attaching the handler
|
|
136
|
-
*/
|
|
137
52
|
bindRoute<RouteConfig extends IAuthRouteConfig>(opts: {
|
|
138
53
|
configs: RouteConfig;
|
|
139
54
|
}): IBindRouteOptions<RouteConfig, RouteEnv, RouteSchema, BasePath>;
|
|
140
|
-
/**
|
|
141
|
-
* Defines and registers a route with its handler in a single call.
|
|
142
|
-
*
|
|
143
|
-
* Preferred method for most use cases. Applies authentication and authorization
|
|
144
|
-
* middleware automatically based on config.
|
|
145
|
-
*
|
|
146
|
-
* @param opts - Object containing route config, handler, and optional hook
|
|
147
|
-
* @returns The registered route definition
|
|
148
|
-
*/
|
|
55
|
+
/** Defines and registers a route with its handler in a single call. */
|
|
149
56
|
defineRoute<RouteConfig extends IAuthRouteConfig, ResponseType = unknown>(opts: {
|
|
150
57
|
configs: RouteConfig;
|
|
151
58
|
handler: TRouteHandler<ResponseType, RouteEnv>;
|
|
152
59
|
hook?: Hook<any, RouteEnv, string, ValueOrPromise<any>>;
|
|
153
60
|
}): IDefineRouteOptions<RouteConfig, RouteEnv, RouteSchema, BasePath>;
|
|
154
61
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Configuration options for controller instantiation.
|
|
157
|
-
*/
|
|
62
|
+
/** Configuration options for controller instantiation. */
|
|
158
63
|
export interface IControllerOptions {
|
|
159
|
-
/** Logger scope identifier, typically the controller class name */
|
|
160
64
|
scope: string;
|
|
161
|
-
/**
|
|
162
|
-
* Controller base path for all routes.
|
|
163
|
-
*
|
|
164
|
-
* If not provided, will be read from `@controller` decorator metadata.
|
|
165
|
-
* At least one of decorator path or constructor path must be provided.
|
|
166
|
-
*
|
|
167
|
-
* @example '/users' or '/api/products'
|
|
168
|
-
*/
|
|
65
|
+
/** Falls back to @controller decorator path if not provided. */
|
|
169
66
|
path?: string;
|
|
170
|
-
/**
|
|
171
|
-
* Whether to use strict path matching.
|
|
172
|
-
*
|
|
173
|
-
* When `true` (default), `/users` and `/users/` are different routes.
|
|
174
|
-
* When `false`, trailing slashes are ignored.
|
|
175
|
-
*
|
|
176
|
-
* @default true
|
|
177
|
-
*/
|
|
67
|
+
/** When true (default), /users and /users/ are different routes. */
|
|
178
68
|
isStrict?: boolean;
|
|
179
69
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Per-route authentication configuration (scoped under `authenticate`).
|
|
182
|
-
*
|
|
183
|
-
* - `{ skip: true }` — skip authentication for this route
|
|
184
|
-
* - `{ strategies, mode }` — override controller-level authentication
|
|
185
|
-
*/
|
|
70
|
+
/** Per-route authentication config: { skip: true } or { strategies, mode }. */
|
|
186
71
|
export type TRouteAuthenticateConfig = {
|
|
187
72
|
skip: true;
|
|
188
73
|
} | {
|
|
@@ -190,39 +75,11 @@ export type TRouteAuthenticateConfig = {
|
|
|
190
75
|
strategies?: TAuthStrategy[];
|
|
191
76
|
mode?: TAuthMode;
|
|
192
77
|
};
|
|
193
|
-
/**
|
|
194
|
-
* Per-route authorization configuration (scoped under `authorize`).
|
|
195
|
-
*
|
|
196
|
-
* - `{ skip: true }` — skip authorization for this route
|
|
197
|
-
* - `IAuthorizationSpec` — single requirement
|
|
198
|
-
* - `IAuthorizationSpec[]` — multiple requirements (all must pass)
|
|
199
|
-
*/
|
|
78
|
+
/** Per-route authorization config: { skip: true }, single spec, or array of specs. */
|
|
200
79
|
export type TRouteAuthorizeConfig = {
|
|
201
80
|
skip: true;
|
|
202
81
|
} | IAuthorizationSpec | IAuthorizationSpec[];
|
|
203
|
-
/**
|
|
204
|
-
* Per-route auth configuration for CRUD factory routes.
|
|
205
|
-
*
|
|
206
|
-
* Priority (endpoint config takes precedence over controller):
|
|
207
|
-
* 1. If endpoint has `authenticate: { skip: true }` -> no auth (also skips authorize)
|
|
208
|
-
* 2. If endpoint has `authenticate: { strategies, mode }` -> use these (overrides controller)
|
|
209
|
-
* 3. Otherwise -> use controller-level authenticate
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```typescript
|
|
213
|
-
* // Skip auth for public read endpoints
|
|
214
|
-
* find: { authenticate: { skip: true } }
|
|
215
|
-
*
|
|
216
|
-
* // Override auth strategy for a specific route
|
|
217
|
-
* create: { authenticate: { strategies: ['jwt'], mode: 'required' } }
|
|
218
|
-
*
|
|
219
|
-
* // Skip only authorization (keep authentication)
|
|
220
|
-
* updateById: { authorize: { skip: true } }
|
|
221
|
-
*
|
|
222
|
-
* // Override authorization for a specific route
|
|
223
|
-
* deleteById: { authorize: { action: 'delete', resource: 'User' } }
|
|
224
|
-
* ```
|
|
225
|
-
*/
|
|
82
|
+
/** Per-route auth config. Endpoint config takes precedence over controller-level config. */
|
|
226
83
|
export type TRouteAuthConfig = {
|
|
227
84
|
authenticate?: TRouteAuthenticateConfig;
|
|
228
85
|
authorize?: TRouteAuthorizeConfig;
|
|
@@ -249,15 +106,7 @@ export type TCustomizableRouteConfig = TRouteAuthConfig & {
|
|
|
249
106
|
headers?: TResponseHeaders;
|
|
250
107
|
};
|
|
251
108
|
};
|
|
252
|
-
/**
|
|
253
|
-
* Per-route configuration for CRUD controller endpoints.
|
|
254
|
-
*
|
|
255
|
-
* Each route supports full customization of:
|
|
256
|
-
* - Authentication (authenticate: { skip } or { strategies, mode })
|
|
257
|
-
* - Request (query, params, body, headers)
|
|
258
|
-
* - Response (schema, headers)
|
|
259
|
-
*
|
|
260
|
-
*/
|
|
109
|
+
/** Per-route configuration for CRUD controller endpoints (auth, request, response). */
|
|
261
110
|
export interface ICustomizableRoutes<RouteConfig extends TCustomizableRouteConfig = TCustomizableRouteConfig> {
|
|
262
111
|
count?: RouteConfig;
|
|
263
112
|
find?: RouteConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/base/controllers/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,m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,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IACxD,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,gBAAgB,CAAC;QAC1B,KAAK,CAAC,EAAE,gBAAgB,CAAC;QACzB,IAAI,CAAC,EAAE,gBAAgB,CAAC;QACxB,OAAO,CAAC,EAAE,gBAAgB,CAAC;KAC5B,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,MAAM,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;QACtB,OAAO,CAAC,EAAE,gBAAgB,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF,uFAAuF;AACvF,MAAM,WAAW,mBAAmB,CAClC,WAAW,SAAS,wBAAwB,GAAG,wBAAwB;IAEvE,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.asTypedContext = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Type assertion function to cast middleware context to TContext.
|
|
6
|
-
* Safe at runtime because TContext is structurally identical to Context.
|
|
7
|
-
*/
|
|
4
|
+
/** Casts middleware context to TContext (safe -- structurally identical to Context). */
|
|
8
5
|
const asTypedContext = (context) => {
|
|
9
6
|
return context;
|
|
10
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/base/controllers/common/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/base/controllers/common/types.ts"],"names":[],"mappings":";;;AAwCA,wFAAwF;AACjF,MAAM,cAAc,GAAG,CAAgB,OAAgB,EAAuB,EAAE;IACrF,OAAO,OAA8B,CAAC;AACxC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB"}
|
|
@@ -7,29 +7,7 @@ import { IAuthorizationSpec } from '../../../components/auth/authorize/common/ty
|
|
|
7
7
|
import { Env, Schema } from 'hono';
|
|
8
8
|
import { z } from '@hono/zod-openapi';
|
|
9
9
|
import { ICustomizableRoutes, TRouteContext } from '../common';
|
|
10
|
-
/**
|
|
11
|
-
* Configuration options for creating a CRUD controller via {@link ControllerFactory.defineCrudController}.
|
|
12
|
-
*
|
|
13
|
-
* @typeParam EntitySchema - The Drizzle table schema type with an ID column
|
|
14
|
-
* @typeParam Routes - The routes configuration type (inferred from routes option)
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const UserControllerClass = ControllerFactory.defineCrudController<UserSchema>({
|
|
19
|
-
* entity: UserEntity,
|
|
20
|
-
* repository: { name: 'UserRepository' },
|
|
21
|
-
* controller: {
|
|
22
|
-
* name: 'UserController',
|
|
23
|
-
* basePath: '/users'
|
|
24
|
-
* },
|
|
25
|
-
* authenticate: { strategies: ['jwt'] },
|
|
26
|
-
* routes: {
|
|
27
|
-
* find: { authenticate: { skip: true } },
|
|
28
|
-
* findById: { authenticate: { skip: true } }
|
|
29
|
-
* }
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
10
|
+
/** Configuration options for creating a CRUD controller via ControllerFactory.defineCrudController. */
|
|
33
11
|
export interface ICrudControllerOptions<EntitySchema extends TTableSchemaWithId, Routes extends ICustomizableRoutes = ICustomizableRoutes> {
|
|
34
12
|
/** Entity class or resolver function returning the entity class */
|
|
35
13
|
entity: TClass<BaseEntity<EntitySchema>> | TResolver<TClass<BaseEntity<EntitySchema>>>;
|
|
@@ -46,131 +24,24 @@ export interface ICrudControllerOptions<EntitySchema extends TTableSchemaWithId,
|
|
|
46
24
|
requestSchema?: boolean;
|
|
47
25
|
};
|
|
48
26
|
};
|
|
49
|
-
/**
|
|
50
|
-
* Authentication config applied to all routes (unless overridden per-route)
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* // Apply JWT auth to all routes
|
|
54
|
-
* authenticate: { strategies: ['jwt'] }
|
|
55
|
-
*/
|
|
27
|
+
/** Authentication config applied to all routes (unless overridden per-route). */
|
|
56
28
|
authenticate?: {
|
|
57
29
|
strategies?: TAuthStrategy[];
|
|
58
30
|
mode?: TAuthMode;
|
|
59
31
|
};
|
|
60
|
-
/**
|
|
61
|
-
* Authorization config applied to all routes (unless overridden per-route)
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* // Apply authorization to all routes
|
|
65
|
-
* authorize: { action: 'manage', resource: 'User' }
|
|
66
|
-
*/
|
|
32
|
+
/** Authorization config applied to all routes (unless overridden per-route). */
|
|
67
33
|
authorize?: IAuthorizationSpec | IAuthorizationSpec[];
|
|
68
|
-
/**
|
|
69
|
-
* Per-route configuration combining schema and auth
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* // JWT auth on all, skip for public read endpoints
|
|
73
|
-
* authenticate: { strategies: ['jwt'] },
|
|
74
|
-
* routes: {
|
|
75
|
-
* find: { authenticate: { skip: true } },
|
|
76
|
-
* findById: { authenticate: { skip: true } },
|
|
77
|
-
* count: { authenticate: { skip: true } },
|
|
78
|
-
* }
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* // No controller auth, require JWT only for writes
|
|
82
|
-
* routes: {
|
|
83
|
-
* create: { authenticate: { strategies: ['jwt'] } },
|
|
84
|
-
* updateById: { authenticate: { strategies: ['jwt'] }, requestBody: CustomUpdateSchema },
|
|
85
|
-
* deleteById: { authenticate: { strategies: ['jwt'] } },
|
|
86
|
-
* }
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* // Custom response schema with auth
|
|
90
|
-
* authenticate: { strategies: ['jwt'] },
|
|
91
|
-
* routes: {
|
|
92
|
-
* find: { authenticate: { skip: true }, schema: CustomFindResponseSchema },
|
|
93
|
-
* create: { schema: CustomCreateResponseSchema, requestBody: CustomCreateBodySchema },
|
|
94
|
-
* }
|
|
95
|
-
*/
|
|
34
|
+
/** Per-route configuration combining schema and auth overrides. */
|
|
96
35
|
routes?: Routes;
|
|
97
36
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Factory for generating CRUD controllers from entity definitions.
|
|
100
|
-
*
|
|
101
|
-
* Creates fully-typed controller classes with standard CRUD endpoints
|
|
102
|
-
* (count, find, findById, findOne, create, updateById, updateBy, deleteById, deleteBy)
|
|
103
|
-
* based on entity schemas.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* // Define a CRUD controller for User entity
|
|
108
|
-
* const UserControllerClass = ControllerFactory.defineCrudController<UserSchema>({
|
|
109
|
-
* entity: UserEntity,
|
|
110
|
-
* repository: { name: 'UserRepository' },
|
|
111
|
-
* controller: { name: 'UserController', basePath: '/users' },
|
|
112
|
-
* authenticate: { strategies: ['jwt'] },
|
|
113
|
-
* routes: {
|
|
114
|
-
* find: { authenticate: { skip: true } },
|
|
115
|
-
* findById: { authenticate: { skip: true } }
|
|
116
|
-
* }
|
|
117
|
-
* });
|
|
118
|
-
*
|
|
119
|
-
* // Instantiate with repository
|
|
120
|
-
* const userController = new UserControllerClass(userRepository);
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
37
|
+
/** Factory for generating typed CRUD controllers from entity definitions. */
|
|
123
38
|
export declare class ControllerFactory extends BaseHelper {
|
|
124
39
|
constructor();
|
|
125
|
-
/**
|
|
126
|
-
* Creates a CRUD controller class for the given entity.
|
|
127
|
-
*
|
|
128
|
-
* The returned class extends {@link BaseController} and includes handlers for:
|
|
129
|
-
* - `GET /count` - Count records matching filter
|
|
130
|
-
* - `GET /` - Find all records with pagination
|
|
131
|
-
* - `GET /:id` - Find record by ID
|
|
132
|
-
* - `GET /find-one` - Find single record matching filter
|
|
133
|
-
* - `POST /` - Create new record
|
|
134
|
-
* - `PATCH /:id` - Update record by ID
|
|
135
|
-
* - `PATCH /` - Update records matching filter
|
|
136
|
-
* - `DELETE /:id` - Delete record by ID
|
|
137
|
-
* - `DELETE /` - Delete records matching filter
|
|
138
|
-
*
|
|
139
|
-
* @typeParam EntitySchema - The Drizzle table schema type
|
|
140
|
-
* @typeParam RouteEnv - Hono environment type
|
|
141
|
-
* @typeParam RouteSchema - Combined route schema type
|
|
142
|
-
* @typeParam BasePath - Base path type
|
|
143
|
-
* @typeParam ConfigurableOptions - Controller configuration options type
|
|
144
|
-
* @param defOpts - Controller configuration options
|
|
145
|
-
* @returns A controller class constructor
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* const ProductController = ControllerFactory.defineCrudController({
|
|
150
|
-
* entity: ProductEntity,
|
|
151
|
-
* repository: { name: 'ProductRepository' },
|
|
152
|
-
* controller: { name: 'ProductController', basePath: '/products' }
|
|
153
|
-
* });
|
|
154
|
-
* ```
|
|
155
|
-
*/
|
|
40
|
+
/** Creates a CRUD controller class with standard endpoints (count, find, findById, create, update, delete). */
|
|
156
41
|
static defineCrudController<EntitySchema extends TTableSchemaWithId, Routes extends ICustomizableRoutes = ICustomizableRoutes, RouteEnv extends Env = Env, RouteSchema extends Schema = {}, BasePath extends string = '/', ConfigurableOptions extends object = {}>(defOpts: ICrudControllerOptions<EntitySchema, Routes>): {
|
|
157
42
|
new (repository: AbstractRepository<EntitySchema>): {
|
|
158
|
-
/** Repository instance for database operations */
|
|
159
43
|
repository: AbstractRepository<EntitySchema>;
|
|
160
|
-
/**
|
|
161
|
-
* Normalizes response data based on the `x-request-count` header.
|
|
162
|
-
*
|
|
163
|
-
* If the header is 'true' (default), returns full response with count.
|
|
164
|
-
* If 'false', returns only the data portion.
|
|
165
|
-
*
|
|
166
|
-
* Also sets the `X-Response-Count-Data` header with the count.
|
|
167
|
-
*
|
|
168
|
-
* @typeParam ResponseSchema - The response data type
|
|
169
|
-
* @typeParam RequestContext - Hono context type
|
|
170
|
-
* @typeParam ResponseData - Full response shape with count and data
|
|
171
|
-
* @param opts - Context and response data
|
|
172
|
-
* @returns Normalized response (full or data-only)
|
|
173
|
-
*/
|
|
44
|
+
/** Normalizes response based on x-request-count header (returns full or data-only). */
|
|
174
45
|
normalizeCountData<ResponseSchema extends unknown, RequestContext extends TRouteContext<RouteEnv> = TRouteContext<RouteEnv>, ResponseData extends {
|
|
175
46
|
count: number;
|
|
176
47
|
data?: TNullable<ResponseSchema>;
|
|
@@ -181,95 +52,43 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
181
52
|
context: RequestContext;
|
|
182
53
|
responseData: ResponseData;
|
|
183
54
|
}): ResponseData | TNullable<ResponseSchema>;
|
|
184
|
-
/**
|
|
185
|
-
* Handles GET /count - Returns count of records matching the filter.
|
|
186
|
-
*
|
|
187
|
-
* @param opts - Request options containing the Hono context
|
|
188
|
-
* @returns JSON response with count
|
|
189
|
-
*/
|
|
55
|
+
/** GET /count */
|
|
190
56
|
count(opts: {
|
|
191
57
|
context: TRouteContext<RouteEnv>;
|
|
192
58
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
193
|
-
/**
|
|
194
|
-
* Handles GET / - Returns paginated list of records with Content-Range header.
|
|
195
|
-
*
|
|
196
|
-
* Sets `Content-Range` header following HTTP RFC 7233 standard for pagination.
|
|
197
|
-
*
|
|
198
|
-
* @param opts - Request options containing the Hono context
|
|
199
|
-
* @returns JSON response with data array and range information
|
|
200
|
-
*/
|
|
59
|
+
/** GET / - Returns paginated list with Content-Range header. */
|
|
201
60
|
find(opts: {
|
|
202
61
|
context: TRouteContext<RouteEnv>;
|
|
203
62
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
204
|
-
/**
|
|
205
|
-
* Handles GET /:id - Returns single record by ID.
|
|
206
|
-
*
|
|
207
|
-
* @param opts - Request options containing the Hono context
|
|
208
|
-
* @returns JSON response with the found record or null
|
|
209
|
-
*/
|
|
63
|
+
/** GET /:id */
|
|
210
64
|
findById(opts: {
|
|
211
65
|
context: TRouteContext<RouteEnv>;
|
|
212
66
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
213
|
-
/**
|
|
214
|
-
* Handles GET /find-one - Returns first record matching the filter.
|
|
215
|
-
*
|
|
216
|
-
* @param opts - Request options containing the Hono context
|
|
217
|
-
* @returns JSON response with the found record or null
|
|
218
|
-
*/
|
|
67
|
+
/** GET /find-one */
|
|
219
68
|
findOne(opts: {
|
|
220
69
|
context: TRouteContext<RouteEnv>;
|
|
221
70
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
222
|
-
/**
|
|
223
|
-
* Handles POST / - Creates a new record.
|
|
224
|
-
*
|
|
225
|
-
* @param opts - Request options containing the Hono context with request body
|
|
226
|
-
* @returns JSON response with created record and count
|
|
227
|
-
*/
|
|
71
|
+
/** POST / */
|
|
228
72
|
create(opts: {
|
|
229
73
|
context: TRouteContext<RouteEnv>;
|
|
230
74
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
231
|
-
/**
|
|
232
|
-
* Handles PATCH /:id - Updates a record by ID.
|
|
233
|
-
*
|
|
234
|
-
* @param opts - Request options containing the Hono context with ID param and body
|
|
235
|
-
* @returns JSON response with updated record and count
|
|
236
|
-
*/
|
|
75
|
+
/** PATCH /:id */
|
|
237
76
|
updateById(opts: {
|
|
238
77
|
context: TRouteContext<RouteEnv>;
|
|
239
78
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
240
|
-
/**
|
|
241
|
-
* Handles PATCH / - Updates records matching the where filter.
|
|
242
|
-
*
|
|
243
|
-
* @param opts - Request options containing the Hono context with where query and body
|
|
244
|
-
* @returns JSON response with updated records array and count
|
|
245
|
-
*/
|
|
79
|
+
/** PATCH / */
|
|
246
80
|
updateBy(opts: {
|
|
247
81
|
context: TRouteContext<RouteEnv>;
|
|
248
82
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
249
|
-
/**
|
|
250
|
-
* Handles DELETE /:id - Deletes a record by ID.
|
|
251
|
-
*
|
|
252
|
-
* @param opts - Request options containing the Hono context with ID param
|
|
253
|
-
* @returns JSON response with deleted record and count
|
|
254
|
-
*/
|
|
83
|
+
/** DELETE /:id */
|
|
255
84
|
deleteById(opts: {
|
|
256
85
|
context: TRouteContext<RouteEnv>;
|
|
257
86
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
258
|
-
/**
|
|
259
|
-
* Handles DELETE / - Deletes records matching the where filter.
|
|
260
|
-
*
|
|
261
|
-
* @param opts - Request options containing the Hono context with where query
|
|
262
|
-
* @returns JSON response with deleted records array and count
|
|
263
|
-
*/
|
|
87
|
+
/** DELETE / */
|
|
264
88
|
deleteBy(opts: {
|
|
265
89
|
context: TRouteContext<RouteEnv>;
|
|
266
90
|
}): Promise<Response & import("hono").TypedResponse<any, 200, "json">>;
|
|
267
|
-
/**
|
|
268
|
-
* Registers all CRUD route handlers.
|
|
269
|
-
*
|
|
270
|
-
* Called during controller configuration. Binds all standard CRUD
|
|
271
|
-
* endpoints to their respective handler methods.
|
|
272
|
-
*/
|
|
91
|
+
/** Registers all CRUD route handlers. */
|
|
273
92
|
binding(): ValueOrPromise<void>;
|
|
274
93
|
toHonoHandler<ResponseType = unknown>(opts: {
|
|
275
94
|
handler: import("../common").TRouteHandler<ResponseType, RouteEnv>;
|
|
@@ -297,7 +116,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
297
116
|
strategies?: TAuthStrategy[];
|
|
298
117
|
mode?: TAuthMode;
|
|
299
118
|
};
|
|
300
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
119
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
301
120
|
readonly request: {
|
|
302
121
|
query: import("../../..").TAnyObjectSchema | z.ZodObject<{
|
|
303
122
|
where: z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>]> | z.ZodOptional<z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>]>>;
|
|
@@ -351,7 +170,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
351
170
|
strategies?: TAuthStrategy[];
|
|
352
171
|
mode?: TAuthMode;
|
|
353
172
|
};
|
|
354
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
173
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
355
174
|
readonly request: {
|
|
356
175
|
query: import("../../..").TAnyObjectSchema | z.ZodObject<{
|
|
357
176
|
filter: any;
|
|
@@ -406,7 +225,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
406
225
|
strategies?: TAuthStrategy[];
|
|
407
226
|
mode?: TAuthMode;
|
|
408
227
|
};
|
|
409
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
228
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
410
229
|
readonly request: {
|
|
411
230
|
params: z.ZodObject<{
|
|
412
231
|
id: z.ZodNumber;
|
|
@@ -466,7 +285,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
466
285
|
strategies?: TAuthStrategy[];
|
|
467
286
|
mode?: TAuthMode;
|
|
468
287
|
};
|
|
469
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
288
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
470
289
|
readonly request: {
|
|
471
290
|
query: import("../../..").TAnyObjectSchema | z.ZodObject<{
|
|
472
291
|
filter: any;
|
|
@@ -521,7 +340,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
521
340
|
strategies?: TAuthStrategy[];
|
|
522
341
|
mode?: TAuthMode;
|
|
523
342
|
};
|
|
524
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
343
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
525
344
|
readonly request: {
|
|
526
345
|
readonly body: {
|
|
527
346
|
description: string;
|
|
@@ -582,7 +401,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
582
401
|
strategies?: TAuthStrategy[];
|
|
583
402
|
mode?: TAuthMode;
|
|
584
403
|
};
|
|
585
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
404
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
586
405
|
readonly request: {
|
|
587
406
|
readonly params: z.ZodObject<{
|
|
588
407
|
id: z.ZodNumber;
|
|
@@ -648,7 +467,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
648
467
|
strategies?: TAuthStrategy[];
|
|
649
468
|
mode?: TAuthMode;
|
|
650
469
|
};
|
|
651
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
470
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
652
471
|
readonly request: {
|
|
653
472
|
readonly query: import("../../..").TAnyObjectSchema | z.ZodObject<{
|
|
654
473
|
where: z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>]>;
|
|
@@ -712,7 +531,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
712
531
|
strategies?: TAuthStrategy[];
|
|
713
532
|
mode?: TAuthMode;
|
|
714
533
|
};
|
|
715
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
534
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
716
535
|
readonly request: {
|
|
717
536
|
params: z.ZodObject<{
|
|
718
537
|
id: z.ZodNumber;
|
|
@@ -769,7 +588,7 @@ export declare class ControllerFactory extends BaseHelper {
|
|
|
769
588
|
strategies?: TAuthStrategy[];
|
|
770
589
|
mode?: TAuthMode;
|
|
771
590
|
};
|
|
772
|
-
readonly authorize: IAuthorizationSpec<Env> | IAuthorizationSpec<Env>[] | undefined;
|
|
591
|
+
readonly authorize: IAuthorizationSpec<Env, string, string> | IAuthorizationSpec<Env, string, string>[] | undefined;
|
|
773
592
|
readonly request: {
|
|
774
593
|
query: import("../../..").TAnyObjectSchema | z.ZodObject<{
|
|
775
594
|
where: z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>]>;
|