@authup/server-core 1.0.0-beta.56 → 1.0.0-beta.58
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/dist/adapters/database/domains/role/entity.d.ts.map +1 -1
- package/dist/adapters/database/domains/role/entity.mjs +2 -1
- package/dist/adapters/database/domains/role/entity.mjs.map +1 -1
- package/dist/adapters/database/logger/module.mjs +2 -4
- package/dist/adapters/database/logger/module.mjs.map +1 -1
- package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.d.ts +25 -0
- package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.d.ts.map +1 -0
- package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.mjs +60 -0
- package/dist/adapters/database/migrations/mysql/1784970000000-RoleClientForeignKey.mjs.map +1 -0
- package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.d.ts +25 -0
- package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.d.ts.map +1 -0
- package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.mjs +60 -0
- package/dist/adapters/database/migrations/postgres/1784970000000-RoleClientForeignKey.mjs.map +1 -0
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/identity.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/identity.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs.map +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs +1 -1
- package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/client/module.d.ts +6 -6
- package/dist/adapters/http/controllers/entities/client/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/client/module.mjs +30 -7
- package/dist/adapters/http/controllers/entities/client/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/client-permission/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/client-permission/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/client-permission/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/client-permission/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/client-role/module.d.ts +4 -4
- package/dist/adapters/http/controllers/entities/client-role/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/client-role/module.mjs +19 -4
- package/dist/adapters/http/controllers/entities/client-role/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/client-scope/module.d.ts +4 -4
- package/dist/adapters/http/controllers/entities/client-scope/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/client-scope/module.mjs +19 -4
- package/dist/adapters/http/controllers/entities/client-scope/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/consent/module.d.ts +3 -3
- package/dist/adapters/http/controllers/entities/consent/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/consent/module.mjs +15 -3
- package/dist/adapters/http/controllers/entities/consent/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/event/module.d.ts +2 -2
- package/dist/adapters/http/controllers/entities/event/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/event/module.mjs +11 -2
- package/dist/adapters/http/controllers/entities/event/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provide-role/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/identity-provide-role/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provide-role/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/identity-provide-role/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts +6 -6
- package/dist/adapters/http/controllers/entities/identity-provider/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +24 -8
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/key/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/key/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/key/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/key/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/permission/module.d.ts +6 -6
- package/dist/adapters/http/controllers/entities/permission/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/permission/module.mjs +27 -6
- package/dist/adapters/http/controllers/entities/permission/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/permission-policy/module.d.ts +4 -4
- package/dist/adapters/http/controllers/entities/permission-policy/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/permission-policy/module.mjs +19 -4
- package/dist/adapters/http/controllers/entities/permission-policy/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/policy/module.d.ts +7 -7
- package/dist/adapters/http/controllers/entities/policy/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/policy/module.mjs +27 -6
- package/dist/adapters/http/controllers/entities/policy/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.d.ts +6 -6
- package/dist/adapters/http/controllers/entities/realm/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/realm/module.mjs +29 -8
- package/dist/adapters/http/controllers/entities/realm/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/role/module.d.ts +6 -6
- package/dist/adapters/http/controllers/entities/role/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/role/module.mjs +27 -6
- package/dist/adapters/http/controllers/entities/role/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/role-attribute/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/role-attribute/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/role-attribute/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/role-attribute/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/role-permission/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/role-permission/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/role-permission/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/role-permission/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/scope/module.d.ts +6 -6
- package/dist/adapters/http/controllers/entities/scope/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/scope/module.mjs +27 -6
- package/dist/adapters/http/controllers/entities/scope/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/session/module.d.ts +3 -3
- package/dist/adapters/http/controllers/entities/session/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/session/module.mjs +15 -3
- package/dist/adapters/http/controllers/entities/session/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/trust-anchor/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/trust-anchor/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/user/module.d.ts +6 -6
- package/dist/adapters/http/controllers/entities/user/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/user/module.mjs +27 -6
- package/dist/adapters/http/controllers/entities/user/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/user-attribute/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/user-attribute/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/user-attribute/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/user-attribute/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts +4 -4
- package/dist/adapters/http/controllers/entities/user-authenticator/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs +19 -4
- package/dist/adapters/http/controllers/entities/user-authenticator/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/user-permission/module.d.ts +5 -5
- package/dist/adapters/http/controllers/entities/user-permission/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/user-permission/module.mjs +23 -5
- package/dist/adapters/http/controllers/entities/user-permission/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/entities/user-role/module.d.ts +4 -4
- package/dist/adapters/http/controllers/entities/user-role/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/entities/user-role/module.mjs +19 -4
- package/dist/adapters/http/controllers/entities/user-role/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/index.mjs +2 -1
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/authenticator-challenge/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.d.ts +1 -0
- package/dist/adapters/http/controllers/workflows/index.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/index.mjs +3 -1
- package/dist/adapters/http/controllers/workflows/logout/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/logout/module.mjs +5 -1
- package/dist/adapters/http/controllers/workflows/logout/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/userinfo/index.d.ts +2 -0
- package/dist/adapters/http/controllers/workflows/userinfo/index.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/userinfo/index.mjs +5 -0
- package/dist/adapters/http/controllers/workflows/userinfo/module.d.ts +18 -0
- package/dist/adapters/http/controllers/workflows/userinfo/module.d.ts.map +1 -0
- package/dist/adapters/http/controllers/workflows/userinfo/module.mjs +53 -0
- package/dist/adapters/http/controllers/workflows/userinfo/module.mjs.map +1 -0
- package/dist/adapters/http/index.mjs +2 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.d.ts +1 -0
- package/dist/adapters/http/middleware/built-in/authorization/module.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs +10 -1
- package/dist/adapters/http/middleware/built-in/authorization/module.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/rate-limit.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/rate-limit.mjs +4 -2
- package/dist/adapters/http/middleware/built-in/rate-limit.mjs.map +1 -1
- package/dist/adapters/http/request/client-certificate.mjs +1 -1
- package/dist/adapters/http/request/client-certificate.mjs.map +1 -1
- package/dist/adapters/http/request/event-context.mjs +1 -1
- package/dist/adapters/http/request/event-context.mjs.map +1 -1
- package/dist/adapters/http/request/helpers/locations.mjs +1 -3
- package/dist/adapters/http/request/helpers/locations.mjs.map +1 -1
- package/dist/app/factory.d.ts +2 -1
- package/dist/app/factory.d.ts.map +1 -1
- package/dist/app/factory.mjs +2 -2
- package/dist/app/factory.mjs.map +1 -1
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.mjs +5 -1
- package/dist/app/modules/authentication/module.mjs +6 -3
- package/dist/app/modules/authentication/module.mjs.map +1 -1
- package/dist/app/modules/authentication/repositories/session.mjs +2 -2
- package/dist/app/modules/authentication/repositories/session.mjs.map +1 -1
- package/dist/app/modules/components/module.d.ts +3 -0
- package/dist/app/modules/components/module.d.ts.map +1 -1
- package/dist/app/modules/components/module.mjs +17 -2
- package/dist/app/modules/components/module.mjs.map +1 -1
- package/dist/app/modules/config/constants.d.ts +1 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +1 -0
- package/dist/app/modules/config/constants.mjs.map +1 -1
- package/dist/app/modules/config/helpers.d.ts +9 -0
- package/dist/app/modules/config/helpers.d.ts.map +1 -0
- package/dist/app/modules/config/helpers.mjs +22 -0
- package/dist/app/modules/config/helpers.mjs.map +1 -0
- package/dist/app/modules/config/index.d.ts +2 -0
- package/dist/app/modules/config/index.d.ts.map +1 -1
- package/dist/app/modules/config/index.mjs +6 -1
- package/dist/app/modules/config/module.d.ts.map +1 -1
- package/dist/app/modules/config/module.mjs +2 -7
- package/dist/app/modules/config/module.mjs.map +1 -1
- package/dist/app/modules/config/normalize.d.ts.map +1 -1
- package/dist/app/modules/config/normalize.mjs +4 -0
- package/dist/app/modules/config/normalize.mjs.map +1 -1
- package/dist/app/modules/config/read/env.d.ts.map +1 -1
- package/dist/app/modules/config/read/env.mjs +2 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/read/fs.d.ts.map +1 -1
- package/dist/app/modules/config/read/fs.mjs +31 -8
- package/dist/app/modules/config/read/fs.mjs.map +1 -1
- package/dist/app/modules/config/read/module.mjs +8 -3
- package/dist/app/modules/config/read/module.mjs.map +1 -1
- package/dist/app/modules/config/trust-proxy.d.ts +28 -0
- package/dist/app/modules/config/trust-proxy.d.ts.map +1 -0
- package/dist/app/modules/config/trust-proxy.mjs +64 -0
- package/dist/app/modules/config/trust-proxy.mjs.map +1 -0
- package/dist/app/modules/config/types.d.ts +18 -0
- package/dist/app/modules/config/types.d.ts.map +1 -1
- package/dist/app/modules/config/validator.d.ts.map +1 -1
- package/dist/app/modules/config/validator.mjs +7 -0
- package/dist/app/modules/config/validator.mjs.map +1 -1
- package/dist/app/modules/database/module.mjs +2 -1
- package/dist/app/modules/database/module.mjs.map +1 -1
- package/dist/app/modules/database/repositories/client/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/client/repository.mjs +3 -4
- package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/client-permission/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/client-permission/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/client-role/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/client-role/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/client-scope/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/client-scope/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/event/repository.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/event/repository.mjs +4 -3
- package/dist/app/modules/database/repositories/event/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/identity-provider/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/identity-provider/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/identity-provider-role-mapping/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/identity-provider-role-mapping/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/key/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/key/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/permission/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/permission/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/permission-policy/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/permission-policy/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/policy/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/policy/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/query.d.ts +20 -0
- package/dist/app/modules/database/repositories/query.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/query.mjs +26 -3
- package/dist/app/modules/database/repositories/query.mjs.map +1 -1
- package/dist/app/modules/database/repositories/realm/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/realm/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/role/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/role/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/role-attribute/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/role-attribute/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/role-permission/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/role-permission/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/schema-validation.d.ts +17 -3
- package/dist/app/modules/database/repositories/schema-validation.d.ts.map +1 -1
- package/dist/app/modules/database/repositories/schema-validation.mjs +29 -5
- package/dist/app/modules/database/repositories/schema-validation.mjs.map +1 -1
- package/dist/app/modules/database/repositories/scope/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/scope/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/trust-anchor/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/trust-anchor/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/user/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user-attribute/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/user-attribute/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user-authenticator/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/user-authenticator/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user-permission/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/user-permission/repository.mjs.map +1 -1
- package/dist/app/modules/database/repositories/user-role/repository.mjs +2 -2
- package/dist/app/modules/database/repositories/user-role/repository.mjs.map +1 -1
- package/dist/app/modules/http/constants.d.ts +2 -13
- package/dist/app/modules/http/constants.d.ts.map +1 -1
- package/dist/app/modules/http/constants.mjs.map +1 -1
- package/dist/app/modules/http/module.d.ts.map +1 -1
- package/dist/app/modules/http/module.mjs +7 -1
- package/dist/app/modules/http/module.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +4 -2
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +208 -124
- package/dist/app/modules/http/modules/controller.mjs.map +1 -1
- package/dist/app/modules/http/modules/middleware.mjs +10 -5
- package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
- package/dist/app/modules/identity/module.mjs +6 -3
- package/dist/app/modules/identity/module.mjs.map +1 -1
- package/dist/app/modules/index.mjs +5 -1
- package/dist/app/modules/oauth2/module.mjs +37 -17
- package/dist/app/modules/oauth2/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/authorize/state/repository.mjs +1 -1
- package/dist/app/modules/oauth2/repositories/authorize/state/repository.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/consent/repository.mjs +2 -2
- package/dist/app/modules/oauth2/repositories/consent/repository.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/token/repository.mjs +1 -1
- package/dist/app/modules/oauth2/repositories/token/repository.mjs.map +1 -1
- package/dist/app/modules/provisioning/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/module.mjs +21 -12
- package/dist/app/modules/provisioning/module.mjs.map +1 -1
- package/dist/app/modules/provisioning/sources/file/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/file/module.mjs +11 -2
- package/dist/app/modules/provisioning/sources/file/module.mjs.map +1 -1
- package/dist/app/types.d.ts +5 -0
- package/dist/app/types.d.ts.map +1 -0
- package/dist/app/types.mjs +4 -0
- package/dist/cli/commands/healthcheck.d.ts +2 -1
- package/dist/cli/commands/healthcheck.d.ts.map +1 -1
- package/dist/cli/commands/healthcheck.mjs +3 -2
- package/dist/cli/commands/healthcheck.mjs.map +1 -1
- package/dist/cli/commands/index.d.ts +0 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.mjs +1 -2
- package/dist/cli/commands/migration.d.ts +2 -1
- package/dist/cli/commands/migration.d.ts.map +1 -1
- package/dist/cli/commands/migration.mjs +3 -2
- package/dist/cli/commands/migration.mjs.map +1 -1
- package/dist/cli/commands/start.d.ts +2 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.mjs +3 -2
- package/dist/cli/commands/start.mjs.map +1 -1
- package/dist/cli/config.d.ts +18 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.mjs +34 -0
- package/dist/cli/config.mjs.map +1 -0
- package/dist/cli/module.d.ts +8 -8
- package/dist/cli/module.d.ts.map +1 -1
- package/dist/cli/module.mjs +8 -28
- package/dist/cli/module.mjs.map +1 -1
- package/dist/cli/types.d.ts +5 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.mjs +4 -0
- package/dist/components/event-cleaner/module.d.ts.map +1 -1
- package/dist/components/event-cleaner/module.mjs +26 -14
- package/dist/components/event-cleaner/module.mjs.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +1 -4
- package/dist/components/oauth2-cleaner/module.d.ts.map +1 -1
- package/dist/components/oauth2-cleaner/module.mjs +29 -17
- package/dist/components/oauth2-cleaner/module.mjs.map +1 -1
- package/dist/components/types.d.ts +1 -0
- package/dist/components/types.d.ts.map +1 -1
- package/dist/core/authentication/login-throttle/service.d.ts.map +1 -1
- package/dist/core/authentication/login-throttle/service.mjs +2 -1
- package/dist/core/authentication/login-throttle/service.mjs.map +1 -1
- package/dist/core/authentication/session/module.mjs +2 -4
- package/dist/core/authentication/session/module.mjs.map +1 -1
- package/dist/core/entities/client/constants.d.ts +10 -0
- package/dist/core/entities/client/constants.d.ts.map +1 -0
- package/dist/core/entities/client/constants.mjs +20 -0
- package/dist/core/entities/client/constants.mjs.map +1 -0
- package/dist/core/entities/client/index.d.ts +1 -0
- package/dist/core/entities/client/index.d.ts.map +1 -1
- package/dist/core/entities/client/index.mjs +3 -2
- package/dist/core/entities/client/schema.d.ts.map +1 -1
- package/dist/core/entities/client/schema.mjs +40 -3
- package/dist/core/entities/client/schema.mjs.map +1 -1
- package/dist/core/entities/client/service.d.ts.map +1 -1
- package/dist/core/entities/client/service.mjs +9 -61
- package/dist/core/entities/client/service.mjs.map +1 -1
- package/dist/core/entities/client/web-client.d.ts +39 -3
- package/dist/core/entities/client/web-client.d.ts.map +1 -1
- package/dist/core/entities/client/web-client.mjs +68 -12
- package/dist/core/entities/client/web-client.mjs.map +1 -1
- package/dist/core/entities/client-permission/service.mjs +12 -9
- package/dist/core/entities/client-permission/service.mjs.map +1 -1
- package/dist/core/entities/client-scope/schema.d.ts.map +1 -1
- package/dist/core/entities/client-scope/schema.mjs +3 -1
- package/dist/core/entities/client-scope/schema.mjs.map +1 -1
- package/dist/core/entities/event/constants.d.ts +7 -0
- package/dist/core/entities/event/constants.d.ts.map +1 -1
- package/dist/core/entities/event/constants.mjs +7 -1
- package/dist/core/entities/event/constants.mjs.map +1 -1
- package/dist/core/entities/event/index.mjs +2 -2
- package/dist/core/entities/event/service.mjs +1 -1
- package/dist/core/entities/event/service.mjs.map +1 -1
- package/dist/core/entities/index.mjs +4 -3
- package/dist/core/entities/key/service.mjs +4 -2
- package/dist/core/entities/key/service.mjs.map +1 -1
- package/dist/core/entities/permission/service.d.ts.map +1 -1
- package/dist/core/entities/permission/service.mjs +1 -1
- package/dist/core/entities/permission/service.mjs.map +1 -1
- package/dist/core/entities/policy/service.d.ts.map +1 -1
- package/dist/core/entities/policy/service.mjs +3 -2
- package/dist/core/entities/policy/service.mjs.map +1 -1
- package/dist/core/entities/realm/service.d.ts.map +1 -1
- package/dist/core/entities/realm/service.mjs +1 -1
- package/dist/core/entities/realm/service.mjs.map +1 -1
- package/dist/core/entities/role/schema.d.ts.map +1 -1
- package/dist/core/entities/role/schema.mjs +4 -0
- package/dist/core/entities/role/schema.mjs.map +1 -1
- package/dist/core/entities/role/service.d.ts.map +1 -1
- package/dist/core/entities/role/service.mjs +1 -1
- package/dist/core/entities/role/service.mjs.map +1 -1
- package/dist/core/entities/role-permission/service.mjs +12 -9
- package/dist/core/entities/role-permission/service.mjs.map +1 -1
- package/dist/core/entities/scope/service.d.ts.map +1 -1
- package/dist/core/entities/scope/service.mjs +1 -1
- package/dist/core/entities/scope/service.mjs.map +1 -1
- package/dist/core/entities/session/schema.d.ts.map +1 -1
- package/dist/core/entities/session/schema.mjs +2 -0
- package/dist/core/entities/session/schema.mjs.map +1 -1
- package/dist/core/entities/user/schema.d.ts.map +1 -1
- package/dist/core/entities/user/schema.mjs +2 -0
- package/dist/core/entities/user/schema.mjs.map +1 -1
- package/dist/core/entities/user/service.d.ts.map +1 -1
- package/dist/core/entities/user/service.mjs +1 -1
- package/dist/core/entities/user/service.mjs.map +1 -1
- package/dist/core/entities/user-authenticator/helpers.mjs +1 -1
- package/dist/core/entities/user-authenticator/helpers.mjs.map +1 -1
- package/dist/core/entities/user-authenticator/service.mjs +7 -7
- package/dist/core/entities/user-authenticator/service.mjs.map +1 -1
- package/dist/core/entities/user-permission/service.mjs +12 -9
- package/dist/core/entities/user-permission/service.mjs.map +1 -1
- package/dist/core/identity/password-recovery/check.mjs +4 -4
- package/dist/core/identity/password-recovery/check.mjs.map +1 -1
- package/dist/core/identity/password-recovery/service.mjs +1 -1
- package/dist/core/identity/password-recovery/service.mjs.map +1 -1
- package/dist/core/identity/registration/check.mjs +2 -2
- package/dist/core/identity/registration/check.mjs.map +1 -1
- package/dist/core/index.mjs +5 -3
- package/dist/core/key/check.mjs +2 -2
- package/dist/core/key/check.mjs.map +1 -1
- package/dist/core/provisioning/entities/client/relations-validator.d.ts.map +1 -1
- package/dist/core/provisioning/entities/client/relations-validator.mjs +2 -0
- package/dist/core/provisioning/entities/client/relations-validator.mjs.map +1 -1
- package/dist/core/provisioning/entities/client/types.d.ts +8 -0
- package/dist/core/provisioning/entities/client/types.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/client/module.d.ts +3 -1
- package/dist/core/provisioning/synchronizer/client/module.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/client/module.mjs +10 -1
- package/dist/core/provisioning/synchronizer/client/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/client/types.d.ts +3 -1
- package/dist/core/provisioning/synchronizer/client/types.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/entity-resolver.d.ts +4 -1
- package/dist/core/provisioning/synchronizer/entity-resolver.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/entity-resolver.mjs +14 -29
- package/dist/core/provisioning/synchronizer/entity-resolver.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/index.d.ts +1 -0
- package/dist/core/provisioning/synchronizer/index.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/permission/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/permission/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/realm/module.d.ts.map +1 -1
- package/dist/core/provisioning/synchronizer/realm/module.mjs +8 -9
- package/dist/core/provisioning/synchronizer/realm/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/role/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/role/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/scope/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/scope/module.mjs.map +1 -1
- package/dist/core/provisioning/synchronizer/types.d.ts +11 -0
- package/dist/core/provisioning/synchronizer/types.d.ts.map +1 -0
- package/dist/core/provisioning/synchronizer/types.mjs +4 -0
- package/dist/core/provisioning/synchronizer/user/module.mjs +0 -1
- package/dist/core/provisioning/synchronizer/user/module.mjs.map +1 -1
- package/dist/core/query/describe.d.ts +25 -0
- package/dist/core/query/describe.d.ts.map +1 -0
- package/dist/core/query/describe.mjs +50 -0
- package/dist/core/query/describe.mjs.map +1 -0
- package/dist/core/query/fields.d.ts +44 -0
- package/dist/core/query/fields.d.ts.map +1 -0
- package/dist/core/query/fields.mjs +46 -0
- package/dist/core/query/fields.mjs.map +1 -0
- package/dist/core/query/index.d.ts +1 -0
- package/dist/core/query/index.d.ts.map +1 -1
- package/dist/core/query/index.mjs +2 -1
- package/dist/core/query/module.d.ts +1 -1
- package/dist/core/query/module.mjs +1 -1
- package/dist/core/query/module.mjs.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/path.mjs.map +1 -1
- package/dist/swagger.json +1324 -193
- package/dist/ui/client/.vite/ssr-manifest.json +1030 -760
- package/dist/ui/client/assets/index-BTK3GPZZ.js +106 -0
- package/dist/ui/client/assets/index-Cx_pI7BS.css +2 -0
- package/dist/ui/client/index.html +2 -2
- package/dist/ui/server/server.js +4465 -11501
- package/package.json +51 -50
- package/dist/cli/commands/reset.d.ts +0 -2
- package/dist/cli/commands/reset.d.ts.map +0 -1
- package/dist/cli/commands/reset.mjs +0 -23
- package/dist/cli/commands/reset.mjs.map +0 -1
- package/dist/components/database/index.d.ts +0 -2
- package/dist/components/database/index.d.ts.map +0 -1
- package/dist/components/database/index.mjs +0 -7
- package/dist/components/database/unique-entries/factory.d.ts +0 -4
- package/dist/components/database/unique-entries/factory.d.ts.map +0 -1
- package/dist/components/database/unique-entries/factory.mjs +0 -12
- package/dist/components/database/unique-entries/factory.mjs.map +0 -1
- package/dist/components/database/unique-entries/index.d.ts +0 -3
- package/dist/components/database/unique-entries/index.d.ts.map +0 -1
- package/dist/components/database/unique-entries/index.mjs +0 -6
- package/dist/components/database/unique-entries/module.d.ts +0 -15
- package/dist/components/database/unique-entries/module.d.ts.map +0 -1
- package/dist/components/database/unique-entries/module.mjs +0 -69
- package/dist/components/database/unique-entries/module.mjs.map +0 -1
- package/dist/ui/client/assets/index-C05uGFDe.js +0 -131
- package/dist/ui/client/assets/index-CiHrf73J.css +0 -2
|
@@ -42,9 +42,16 @@ var RealmProvisioningSynchronizer = class extends BaseProvisioningSynchronizer {
|
|
|
42
42
|
case ProvisioningEntityStrategyType.REPLACE:
|
|
43
43
|
input.attributes.id = attributes.id;
|
|
44
44
|
attributes = await this.repository.save(this.repository.create(input.attributes));
|
|
45
|
-
break;
|
|
46
45
|
}
|
|
47
46
|
else attributes = await this.repository.save(this.repository.create(input.attributes));
|
|
47
|
+
if (input.relations && input.relations.scopes) {
|
|
48
|
+
const scopes = input.relations.scopes.map((child) => {
|
|
49
|
+
child.attributes.realmId = attributes.id;
|
|
50
|
+
child.attributes.realm = attributes;
|
|
51
|
+
return child;
|
|
52
|
+
});
|
|
53
|
+
await this.scopeSynchronizer.synchronizeMany(scopes);
|
|
54
|
+
}
|
|
48
55
|
if (input.relations && input.relations.clients) {
|
|
49
56
|
const clients = input.relations.clients.map((child) => {
|
|
50
57
|
child.attributes.realmId = attributes.id;
|
|
@@ -77,14 +84,6 @@ var RealmProvisioningSynchronizer = class extends BaseProvisioningSynchronizer {
|
|
|
77
84
|
});
|
|
78
85
|
await this.userSynchronizer.synchronizeMany(users);
|
|
79
86
|
}
|
|
80
|
-
if (input.relations && input.relations.scopes) {
|
|
81
|
-
const scopes = input.relations.scopes.map((child) => {
|
|
82
|
-
child.attributes.realmId = attributes.id;
|
|
83
|
-
child.attributes.realm = attributes;
|
|
84
|
-
return child;
|
|
85
|
-
});
|
|
86
|
-
await this.scopeSynchronizer.synchronizeMany(scopes);
|
|
87
|
-
}
|
|
88
87
|
return {
|
|
89
88
|
...input,
|
|
90
89
|
attributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","RealmProvisioningSynchronizer","repository","clientSynchronizer","permissionSynchronizer","roleSynchronizer","userSynchronizer","scopeSynchronizer","ctx","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","type","ABSENT","remove","MERGE","merge","save","REPLACE","id","create","relations","
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","RealmProvisioningSynchronizer","repository","clientSynchronizer","permissionSynchronizer","roleSynchronizer","userSynchronizer","scopeSynchronizer","ctx","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","type","ABSENT","remove","MERGE","merge","save","REPLACE","id","create","relations","scopes","map","child","realmId","realm","synchronizeMany","clients","permissions","roles","users"],"sources":["../../../../../src/core/provisioning/synchronizer/realm/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { pickRecord } from '@authup/kit';\nimport type { IRealmRepository } from '../../../entities/index.ts';\nimport type { ClientProvisioningEntity, ScopeProvisioningEntity } from '../../entities/index.ts';\nimport type { PermissionProvisioningEntity } from '../../entities/permission/index.ts';\nimport type { RealmProvisioningEntity } from '../../entities/realm/index.ts';\nimport type { RoleProvisioningEntity } from '../../entities/role/index.ts';\nimport type { UserProvisioningEntity } from '../../entities/user/index.ts';\nimport { ProvisioningEntityStrategyType, normalizeEntityProvisioningStrategy } from '../../strategy/index.ts';\nimport type { IProvisioningSynchronizer } from '../../types.ts';\nimport { BaseProvisioningSynchronizer } from '../base.ts';\nimport type { RealmProvisioningSynchronizerContext } from './types.ts';\n\nexport class RealmProvisioningSynchronizer extends BaseProvisioningSynchronizer<RealmProvisioningEntity> {\n protected repository : IRealmRepository;\n\n protected clientSynchronizer: IProvisioningSynchronizer<ClientProvisioningEntity>;\n\n protected permissionSynchronizer: IProvisioningSynchronizer<PermissionProvisioningEntity>;\n\n protected roleSynchronizer: IProvisioningSynchronizer<RoleProvisioningEntity>;\n\n protected userSynchronizer: IProvisioningSynchronizer<UserProvisioningEntity>;\n\n protected scopeSynchronizer : IProvisioningSynchronizer<ScopeProvisioningEntity>;\n\n constructor(ctx: RealmProvisioningSynchronizerContext) {\n super();\n\n this.repository = ctx.repository;\n this.clientSynchronizer = ctx.clientSynchronizer;\n this.permissionSynchronizer = ctx.permissionSynchronizer;\n this.roleSynchronizer = ctx.roleSynchronizer;\n this.userSynchronizer = ctx.userSynchronizer;\n this.scopeSynchronizer = ctx.scopeSynchronizer;\n }\n\n async synchronize(input: RealmProvisioningEntity): Promise<RealmProvisioningEntity> {\n this.canonicalizeName(input.attributes);\n\n const strategy = normalizeEntityProvisioningStrategy(input.strategy);\n let attributes = await this.repository.findOneBy({ name: input.attributes.name });\n\n if (strategy.type === ProvisioningEntityStrategyType.ABSENT) {\n if (attributes) {\n await this.repository.remove(attributes);\n }\n return {\n ...input,\n attributes: attributes || input.attributes, \n };\n }\n\n if (attributes) {\n switch (strategy.type) {\n case ProvisioningEntityStrategyType.MERGE:\n attributes = this.repository.merge(\n attributes,\n strategy.attributes ?\n pickRecord(input.attributes, strategy.attributes) :\n input.attributes,\n );\n\n attributes = await this.repository.save(attributes);\n break;\n case ProvisioningEntityStrategyType.REPLACE:\n input.attributes.id = attributes.id;\n attributes = await this.repository.save(this.repository.create(input.attributes));\n break;\n }\n } else {\n attributes = await this.repository.save(this.repository.create(input.attributes));\n }\n\n // Scopes first: they are leaf entities carrying no relations of their\n // own, and a client below may bind them through `realmScopes`.\n if (input.relations && input.relations.scopes) {\n const scopes = input.relations.scopes.map((child) => {\n child.attributes.realmId = attributes.id;\n child.attributes.realm = attributes;\n return child;\n });\n\n await this.scopeSynchronizer.synchronizeMany(scopes);\n }\n\n if (input.relations && input.relations.clients) {\n const clients = input.relations.clients.map(\n (child) => {\n child.attributes.realmId = attributes.id;\n child.attributes.realm = attributes;\n return child;\n },\n );\n\n await this.clientSynchronizer.synchronizeMany(clients);\n }\n\n if (input.relations && input.relations.permissions) {\n const permissions = input.relations.permissions.map((child) => {\n child.attributes.realmId = attributes.id;\n child.attributes.realm = attributes;\n return child;\n });\n\n await this.permissionSynchronizer.synchronizeMany(permissions);\n }\n\n if (input.relations && input.relations.roles) {\n const roles = input.relations.roles.map((child) => {\n child.attributes.realmId = attributes.id;\n child.attributes.realm = attributes;\n return child;\n });\n\n await this.roleSynchronizer.synchronizeMany(roles);\n }\n\n if (input.relations && input.relations.users) {\n const users = input.relations.users.map((child) => {\n child.attributes.realmId = attributes.id;\n child.attributes.realm = attributes;\n return child;\n });\n\n await this.userSynchronizer.synchronizeMany(users);\n }\n\n return {\n ...input,\n attributes,\n };\n }\n}\n"],"mappings":"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"}
|
|
@@ -46,7 +46,6 @@ var RoleProvisioningSynchronizer = class extends BaseProvisioningSynchronizer {
|
|
|
46
46
|
case ProvisioningEntityStrategyType.REPLACE:
|
|
47
47
|
input.attributes.id = attributes.id;
|
|
48
48
|
attributes = await this.repository.save(this.repository.create(input.attributes));
|
|
49
|
-
break;
|
|
50
49
|
}
|
|
51
50
|
else attributes = await this.repository.save(this.repository.create(input.attributes));
|
|
52
51
|
if (!input.relations) return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","ProvisioningEntityResolver","ProvisioningJunctionSynchronizer","RoleProvisioningSynchronizer","repository","permissionResolver","permissionJunction","ctx","permissionRepository","rolePermissionRepository","ownerKey","ownerRealmKey","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","realmId","clientId","type","ABSENT","remove","MERGE","merge","save","REPLACE","id","create","relations","globalPermissions","resolveGlobal","globalPermissionsExclude","length","excludeSet","Set","filter","p","has","realmPermissions","resolveRealm","permissions","defaultScope","globalPermissionsRealmScope","overrides","buildRealmScopeOverrides","permission","realmScope","get","Map","globalPermissionsRealmScopeOverrides","permissionNames","Object","entries","permName","set"],"sources":["../../../../../src/core/provisioning/synchronizer/role/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { pickRecord } from '@authup/kit';\nimport type { Permission, RolePermission } from '@authup/core-kit';\nimport type { IRoleRepository } from '../../../entities/index.ts';\nimport type { RoleProvisioningEntity } from '../../entities/role/index.ts';\nimport { ProvisioningEntityStrategyType, normalizeEntityProvisioningStrategy } from '../../strategy/index.ts';\nimport { BaseProvisioningSynchronizer } from '../base.ts';\nimport { ProvisioningEntityResolver } from '../entity-resolver.ts';\nimport { ProvisioningJunctionSynchronizer } from '../junction-synchronizer.ts';\nimport type { RoleProvisioningSynchronizerContext } from './types.ts';\n\nexport class RoleProvisioningSynchronizer extends BaseProvisioningSynchronizer<RoleProvisioningEntity> {\n protected repository : IRoleRepository;\n\n protected permissionResolver : ProvisioningEntityResolver<Permission>;\n\n protected permissionJunction: ProvisioningJunctionSynchronizer<RolePermission>;\n\n constructor(ctx: RoleProvisioningSynchronizerContext) {\n super();\n\n this.repository = ctx.repository;\n this.permissionResolver = new ProvisioningEntityResolver(ctx.permissionRepository);\n this.permissionJunction = new ProvisioningJunctionSynchronizer({\n repository: ctx.rolePermissionRepository,\n ownerKey: 'roleId',\n ownerRealmKey: 'roleRealmId',\n });\n }\n\n async synchronize(input: RoleProvisioningEntity): Promise<RoleProvisioningEntity> {\n this.canonicalizeName(input.attributes);\n\n const strategy = normalizeEntityProvisioningStrategy(input.strategy);\n let attributes = await this.repository.findOneBy({\n name: input.attributes.name,\n realmId: input.attributes.realmId || null,\n clientId: input.attributes.clientId || null,\n });\n\n if (strategy.type === ProvisioningEntityStrategyType.ABSENT) {\n if (attributes) {\n await this.repository.remove(attributes);\n }\n return {\n ...input,\n attributes: attributes || input.attributes,\n };\n }\n\n if (attributes) {\n switch (strategy.type) {\n case ProvisioningEntityStrategyType.MERGE:\n attributes = this.repository.merge(\n attributes,\n strategy.attributes ?\n pickRecord(input.attributes, strategy.attributes) :\n input.attributes,\n );\n\n attributes = await this.repository.save(attributes);\n break;\n case ProvisioningEntityStrategyType.REPLACE:\n input.attributes.id = attributes.id;\n attributes = await this.repository.save(this.repository.create(input.attributes));\n break;\n }\n } else {\n attributes = await this.repository.save(this.repository.create(input.attributes));\n }\n\n if (!input.relations) {\n return {\n ...input,\n attributes,\n };\n }\n\n let globalPermissions = await this.permissionResolver.resolveGlobal(input.relations.globalPermissions);\n\n if (input.relations.globalPermissionsExclude && input.relations.globalPermissionsExclude.length > 0) {\n const excludeSet = new Set(input.relations.globalPermissionsExclude);\n globalPermissions = globalPermissions.filter((p) => !excludeSet.has(p.name));\n }\n\n const realmPermissions = attributes.realmId ?\n await this.permissionResolver.resolveRealm(input.relations.realmPermissions, attributes.realmId) :\n [];\n\n const permissions = [\n ...globalPermissions,\n ...realmPermissions,\n ];\n\n if (permissions.length > 0) {\n const defaultScope = input.relations.globalPermissionsRealmScope;\n\n if (defaultScope) {\n const overrides = this.buildRealmScopeOverrides(input);\n for (const permission of permissions) {\n const realmScope = overrides.get(permission.name) ?? defaultScope;\n await this.permissionJunction.synchronize(\n attributes,\n [permission],\n 'permissionId',\n 'permissionRealmId',\n { realmScope },\n );\n }\n } else {\n await this.permissionJunction.synchronize(\n attributes,\n permissions,\n 'permissionId',\n 'permissionRealmId',\n );\n }\n }\n\n return {\n ...input,\n attributes,\n };\n }\n\n private buildRealmScopeOverrides(input: RoleProvisioningEntity): Map<string, string> {\n const overrides = new Map<string, string>();\n if (input.relations?.globalPermissionsRealmScopeOverrides) {\n for (const [realmScope, permissionNames] of Object.entries(input.relations.globalPermissionsRealmScopeOverrides)) {\n if (!permissionNames) {\n continue;\n }\n for (const permName of permissionNames) {\n overrides.set(permName, realmScope);\n }\n }\n }\n return overrides;\n }\n}\n"],"mappings":";;;;;;;;;;;AAiBA,IAAaM,+BAAb,cAAkDH,6BAAAA;CACpCI;CAEAC;CAEAC;CAEV,YAAYC,KAA0C;EAClD,MAAK;EAEL,KAAKH,aAAaG,IAAIH;EACtB,KAAKC,qBAAqB,IAAIJ,2BAA2BM,IAAIC,oBAAoB;EACjF,KAAKF,qBAAqB,IAAIJ,iCAAiC;GAC3DE,YAAYG,IAAIE;GAChBC,UAAU;GACVC,eAAe;EACnB,CAAA;CACJ;CAEA,MAAMC,YAAYC,OAAgE;EAC9E,KAAKC,iBAAiBD,MAAME,UAAU;EAEtC,MAAMC,WAAWjB,oCAAoCc,MAAMG,QAAQ;EACnE,IAAID,aAAa,MAAM,KAAKX,WAAWa,UAAU;GAC7CC,MAAML,MAAME,WAAWG;GACvBC,SAASN,MAAME,WAAWI,WAAW;GACrCC,UAAUP,MAAME,WAAWK,YAAY;EAC3C,CAAA;EAEA,IAAIJ,SAASK,SAASvB,+BAA+BwB,QAAQ;GACzD,IAAIP,YACA,MAAM,KAAKX,WAAWmB,OAAOR,UAAAA;GAEjC,OAAO;IACH,GAAGF;IACHE,YAAYA,cAAcF,MAAME;GACpC;EACJ;EAEA,IAAIA,YACA,QAAQC,SAASK,MAAjB;GACI,KAAKvB,+BAA+B0B;IAChCT,aAAa,KAAKX,WAAWqB,MACzBV,YACAC,SAASD,aACLlB,WAAWgB,MAAME,YAAYC,SAASD,UAAU,IAChDF,MAAME,UAAU;IAGxBA,aAAa,MAAM,KAAKX,WAAWsB,KAAKX,UAAAA;IACxC;GACJ,KAAKjB,+BAA+B6B;IAChCd,MAAME,WAAWa,KAAKb,WAAWa;IACjCb,aAAa,MAAM,KAAKX,WAAWsB,KAAK,KAAKtB,WAAWyB,OAAOhB,MAAME,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","ProvisioningEntityResolver","ProvisioningJunctionSynchronizer","RoleProvisioningSynchronizer","repository","permissionResolver","permissionJunction","ctx","permissionRepository","rolePermissionRepository","ownerKey","ownerRealmKey","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","realmId","clientId","type","ABSENT","remove","MERGE","merge","save","REPLACE","id","create","relations","globalPermissions","resolveGlobal","globalPermissionsExclude","length","excludeSet","Set","filter","p","has","realmPermissions","resolveRealm","permissions","defaultScope","globalPermissionsRealmScope","overrides","buildRealmScopeOverrides","permission","realmScope","get","Map","globalPermissionsRealmScopeOverrides","permissionNames","Object","entries","permName","set"],"sources":["../../../../../src/core/provisioning/synchronizer/role/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { pickRecord } from '@authup/kit';\nimport type { Permission, RolePermission } from '@authup/core-kit';\nimport type { IRoleRepository } from '../../../entities/index.ts';\nimport type { RoleProvisioningEntity } from '../../entities/role/index.ts';\nimport { ProvisioningEntityStrategyType, normalizeEntityProvisioningStrategy } from '../../strategy/index.ts';\nimport { BaseProvisioningSynchronizer } from '../base.ts';\nimport { ProvisioningEntityResolver } from '../entity-resolver.ts';\nimport { ProvisioningJunctionSynchronizer } from '../junction-synchronizer.ts';\nimport type { RoleProvisioningSynchronizerContext } from './types.ts';\n\nexport class RoleProvisioningSynchronizer extends BaseProvisioningSynchronizer<RoleProvisioningEntity> {\n protected repository : IRoleRepository;\n\n protected permissionResolver : ProvisioningEntityResolver<Permission>;\n\n protected permissionJunction: ProvisioningJunctionSynchronizer<RolePermission>;\n\n constructor(ctx: RoleProvisioningSynchronizerContext) {\n super();\n\n this.repository = ctx.repository;\n this.permissionResolver = new ProvisioningEntityResolver(ctx.permissionRepository);\n this.permissionJunction = new ProvisioningJunctionSynchronizer({\n repository: ctx.rolePermissionRepository,\n ownerKey: 'roleId',\n ownerRealmKey: 'roleRealmId',\n });\n }\n\n async synchronize(input: RoleProvisioningEntity): Promise<RoleProvisioningEntity> {\n this.canonicalizeName(input.attributes);\n\n const strategy = normalizeEntityProvisioningStrategy(input.strategy);\n let attributes = await this.repository.findOneBy({\n name: input.attributes.name,\n realmId: input.attributes.realmId || null,\n clientId: input.attributes.clientId || null,\n });\n\n if (strategy.type === ProvisioningEntityStrategyType.ABSENT) {\n if (attributes) {\n await this.repository.remove(attributes);\n }\n return {\n ...input,\n attributes: attributes || input.attributes,\n };\n }\n\n if (attributes) {\n switch (strategy.type) {\n case ProvisioningEntityStrategyType.MERGE:\n attributes = this.repository.merge(\n attributes,\n strategy.attributes ?\n pickRecord(input.attributes, strategy.attributes) :\n input.attributes,\n );\n\n attributes = await this.repository.save(attributes);\n break;\n case ProvisioningEntityStrategyType.REPLACE:\n input.attributes.id = attributes.id;\n attributes = await this.repository.save(this.repository.create(input.attributes));\n break;\n }\n } else {\n attributes = await this.repository.save(this.repository.create(input.attributes));\n }\n\n if (!input.relations) {\n return {\n ...input,\n attributes,\n };\n }\n\n let globalPermissions = await this.permissionResolver.resolveGlobal(input.relations.globalPermissions);\n\n if (input.relations.globalPermissionsExclude && input.relations.globalPermissionsExclude.length > 0) {\n const excludeSet = new Set(input.relations.globalPermissionsExclude);\n globalPermissions = globalPermissions.filter((p) => !excludeSet.has(p.name));\n }\n\n const realmPermissions = attributes.realmId ?\n await this.permissionResolver.resolveRealm(input.relations.realmPermissions, attributes.realmId) :\n [];\n\n const permissions = [\n ...globalPermissions,\n ...realmPermissions,\n ];\n\n if (permissions.length > 0) {\n const defaultScope = input.relations.globalPermissionsRealmScope;\n\n if (defaultScope) {\n const overrides = this.buildRealmScopeOverrides(input);\n for (const permission of permissions) {\n const realmScope = overrides.get(permission.name) ?? defaultScope;\n await this.permissionJunction.synchronize(\n attributes,\n [permission],\n 'permissionId',\n 'permissionRealmId',\n { realmScope },\n );\n }\n } else {\n await this.permissionJunction.synchronize(\n attributes,\n permissions,\n 'permissionId',\n 'permissionRealmId',\n );\n }\n }\n\n return {\n ...input,\n attributes,\n };\n }\n\n private buildRealmScopeOverrides(input: RoleProvisioningEntity): Map<string, string> {\n const overrides = new Map<string, string>();\n if (input.relations?.globalPermissionsRealmScopeOverrides) {\n for (const [realmScope, permissionNames] of Object.entries(input.relations.globalPermissionsRealmScopeOverrides)) {\n if (!permissionNames) {\n continue;\n }\n for (const permName of permissionNames) {\n overrides.set(permName, realmScope);\n }\n }\n }\n return overrides;\n }\n}\n"],"mappings":"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"}
|
|
@@ -35,7 +35,6 @@ var ScopeProvisioningSynchronizer = class extends BaseProvisioningSynchronizer {
|
|
|
35
35
|
case ProvisioningEntityStrategyType.REPLACE:
|
|
36
36
|
input.attributes.id = attributes.id;
|
|
37
37
|
attributes = await this.repository.save(this.repository.create(input.attributes));
|
|
38
|
-
break;
|
|
39
38
|
}
|
|
40
39
|
else attributes = await this.repository.save(this.repository.create(input.attributes));
|
|
41
40
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","ScopeProvisioningSynchronizer","repository","ctx","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","realmId","type","ABSENT","remove","MERGE","merge","save","REPLACE","id","create"],"sources":["../../../../../src/core/provisioning/synchronizer/scope/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { pickRecord } from '@authup/kit';\nimport type { IScopeRepository } from '../../../entities/index.ts';\nimport type { ScopeProvisioningEntity } from '../../entities/index.ts';\nimport { ProvisioningEntityStrategyType, normalizeEntityProvisioningStrategy } from '../../strategy/index.ts';\nimport { BaseProvisioningSynchronizer } from '../base.ts';\nimport type { ScopeProvisioningSynchronizerContext } from './types.ts';\n\nexport class ScopeProvisioningSynchronizer extends BaseProvisioningSynchronizer<ScopeProvisioningEntity> {\n protected repository : IScopeRepository;\n\n constructor(ctx: ScopeProvisioningSynchronizerContext) {\n super();\n\n this.repository = ctx.repository;\n }\n\n async synchronize(input: ScopeProvisioningEntity): Promise<ScopeProvisioningEntity> {\n this.canonicalizeName(input.attributes);\n\n const strategy = normalizeEntityProvisioningStrategy(input.strategy);\n\n let attributes = await this.repository.findOneBy({\n name: input.attributes.name,\n realmId: input.attributes.realmId || null,\n });\n\n if (strategy.type === ProvisioningEntityStrategyType.ABSENT) {\n if (attributes) {\n await this.repository.remove(attributes);\n }\n return {\n ...input,\n attributes: attributes || input.attributes, \n };\n }\n\n if (attributes) {\n switch (strategy.type) {\n case ProvisioningEntityStrategyType.MERGE:\n attributes = this.repository.merge(\n attributes,\n strategy.attributes ?\n pickRecord(input.attributes, strategy.attributes) :\n input.attributes,\n );\n\n attributes = await this.repository.save(attributes);\n break;\n case ProvisioningEntityStrategyType.REPLACE:\n input.attributes.id = attributes.id;\n attributes = await this.repository.save(this.repository.create(input.attributes));\n break;\n }\n } else {\n attributes = await this.repository.save(this.repository.create(input.attributes));\n }\n\n return {\n ...input,\n attributes,\n };\n }\n}\n"],"mappings":";;;;;;;;;AAcA,IAAaI,gCAAb,cAAmDD,6BAAAA;CACrCE;CAEV,YAAYC,KAA2C;EACnD,MAAK;EAEL,KAAKD,aAAaC,IAAID;CAC1B;CAEA,MAAME,YAAYC,OAAkE;EAChF,KAAKC,iBAAiBD,MAAME,UAAU;EAEtC,MAAMC,WAAWT,oCAAoCM,MAAMG,QAAQ;EAEnE,IAAID,aAAa,MAAM,KAAKL,WAAWO,UAAU;GAC7CC,MAAML,MAAME,WAAWG;GACvBC,SAASN,MAAME,WAAWI,WAAW;EACzC,CAAA;EAEA,IAAIH,SAASI,SAASd,+BAA+Be,QAAQ;GACzD,IAAIN,YACA,MAAM,KAAKL,WAAWY,OAAOP,UAAAA;GAEjC,OAAO;IACH,GAAGF;IACHE,YAAYA,cAAcF,MAAME;GACpC;EACJ;EAEA,IAAIA,YACA,QAAQC,SAASI,MAAjB;GACI,KAAKd,+BAA+BiB;IAChCR,aAAa,KAAKL,WAAWc,MACzBT,YACAC,SAASD,aACLV,WAAWQ,MAAME,YAAYC,SAASD,UAAU,IAChDF,MAAME,UAAU;IAGxBA,aAAa,MAAM,KAAKL,WAAWe,KAAKV,UAAAA;IACxC;GACJ,KAAKT,+BAA+BoB;IAChCb,MAAME,WAAWY,KAAKZ,WAAWY;IACjCZ,aAAa,MAAM,KAAKL,WAAWe,KAAK,KAAKf,WAAWkB,OAAOf,MAAME,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","ScopeProvisioningSynchronizer","repository","ctx","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","realmId","type","ABSENT","remove","MERGE","merge","save","REPLACE","id","create"],"sources":["../../../../../src/core/provisioning/synchronizer/scope/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { pickRecord } from '@authup/kit';\nimport type { IScopeRepository } from '../../../entities/index.ts';\nimport type { ScopeProvisioningEntity } from '../../entities/index.ts';\nimport { ProvisioningEntityStrategyType, normalizeEntityProvisioningStrategy } from '../../strategy/index.ts';\nimport { BaseProvisioningSynchronizer } from '../base.ts';\nimport type { ScopeProvisioningSynchronizerContext } from './types.ts';\n\nexport class ScopeProvisioningSynchronizer extends BaseProvisioningSynchronizer<ScopeProvisioningEntity> {\n protected repository : IScopeRepository;\n\n constructor(ctx: ScopeProvisioningSynchronizerContext) {\n super();\n\n this.repository = ctx.repository;\n }\n\n async synchronize(input: ScopeProvisioningEntity): Promise<ScopeProvisioningEntity> {\n this.canonicalizeName(input.attributes);\n\n const strategy = normalizeEntityProvisioningStrategy(input.strategy);\n\n let attributes = await this.repository.findOneBy({\n name: input.attributes.name,\n realmId: input.attributes.realmId || null,\n });\n\n if (strategy.type === ProvisioningEntityStrategyType.ABSENT) {\n if (attributes) {\n await this.repository.remove(attributes);\n }\n return {\n ...input,\n attributes: attributes || input.attributes, \n };\n }\n\n if (attributes) {\n switch (strategy.type) {\n case ProvisioningEntityStrategyType.MERGE:\n attributes = this.repository.merge(\n attributes,\n strategy.attributes ?\n pickRecord(input.attributes, strategy.attributes) :\n input.attributes,\n );\n\n attributes = await this.repository.save(attributes);\n break;\n case ProvisioningEntityStrategyType.REPLACE:\n input.attributes.id = attributes.id;\n attributes = await this.repository.save(this.repository.create(input.attributes));\n break;\n }\n } else {\n attributes = await this.repository.save(this.repository.create(input.attributes));\n }\n\n return {\n ...input,\n attributes,\n };\n }\n}\n"],"mappings":";;;;;;;;;AAcA,IAAaI,gCAAb,cAAmDD,6BAAAA;CACrCE;CAEV,YAAYC,KAA2C;EACnD,MAAK;EAEL,KAAKD,aAAaC,IAAID;CAC1B;CAEA,MAAME,YAAYC,OAAkE;EAChF,KAAKC,iBAAiBD,MAAME,UAAU;EAEtC,MAAMC,WAAWT,oCAAoCM,MAAMG,QAAQ;EAEnE,IAAID,aAAa,MAAM,KAAKL,WAAWO,UAAU;GAC7CC,MAAML,MAAME,WAAWG;GACvBC,SAASN,MAAME,WAAWI,WAAW;EACzC,CAAA;EAEA,IAAIH,SAASI,SAASd,+BAA+Be,QAAQ;GACzD,IAAIN,YACA,MAAM,KAAKL,WAAWY,OAAOP,UAAAA;GAEjC,OAAO;IACH,GAAGF;IACHE,YAAYA,cAAcF,MAAME;GACpC;EACJ;EAEA,IAAIA,YACA,QAAQC,SAASI,MAAjB;GACI,KAAKd,+BAA+BiB;IAChCR,aAAa,KAAKL,WAAWc,MACzBT,YACAC,SAASD,aACLV,WAAWQ,MAAME,YAAYC,SAASD,UAAU,IAChDF,MAAME,UAAU;IAGxBA,aAAa,MAAM,KAAKL,WAAWe,KAAKV,UAAAA;IACxC;GACJ,KAAKT,+BAA+BoB;IAChCb,MAAME,WAAWY,KAAKZ,WAAWY;IACjCZ,aAAa,MAAM,KAAKL,WAAWe,KAAK,KAAKf,WAAWkB,OAAOf,MAAME,UAAU,CAAA;EAEvF;OAEAA,aAAa,MAAM,KAAKL,WAAWe,KAAK,KAAKf,WAAWkB,OAAOf,MAAME,UAAU,CAAA;EAGnF,OAAO;GACH,GAAGF;GACHE;EACJ;CACJ;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ProvisioningEntityResolverOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Whether the resolved entity carries a `clientId` column.
|
|
4
|
+
*
|
|
5
|
+
* Permissions and roles are client-ownable, so their lookups pin the
|
|
6
|
+
* client dimension. Scopes have none, so leaving the predicate in would
|
|
7
|
+
* make the query fail against the table. Defaults to true.
|
|
8
|
+
*/
|
|
9
|
+
clientScoped?: boolean;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/provisioning/synchronizer/types.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,iCAAiC,GAAG;IAC5C;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACzB,CAAC"}
|
|
@@ -58,7 +58,6 @@ var UserProvisioningSynchronizer = class extends BaseProvisioningSynchronizer {
|
|
|
58
58
|
input.attributes.email = input.attributes.email || attributes.email || (input.attributes.name ? buildUserFakeEmail(input.attributes.name) : void 0);
|
|
59
59
|
input.attributes.id = attributes.id;
|
|
60
60
|
attributes = await this.userRepository.save(this.userRepository.create(input.attributes));
|
|
61
|
-
break;
|
|
62
61
|
}
|
|
63
62
|
else {
|
|
64
63
|
if (!input.attributes.email && input.attributes.name) input.attributes.email = buildUserFakeEmail(input.attributes.name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["buildUserFakeEmail","pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","ProvisioningEntityResolver","ProvisioningJunctionSynchronizer","UserProvisioningSynchronizer","userRepository","clientRepository","permissionResolver","roleResolver","permissionJunction","roleJunction","ctx","permissionRepository","roleRepository","repository","userPermissionRepository","ownerKey","ownerRealmKey","userRoleRepository","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","realmId","type","ABSENT","remove","MERGE","includes","email","merge","save","REPLACE","undefined","id","create","permissions","resolveGlobal","relations","globalPermissions","resolveRealm","realmPermissions","clientPermissions","clientKeys","Object","keys","clientKey","client","entities","resolveClient","push","length","roles","globalRoles","realmRoles","clientRoles"],"sources":["../../../../../src/core/provisioning/synchronizer/user/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n Permission, \n Role, \n UserPermission, \n UserRole,\n} from '@authup/core-kit';\nimport { buildUserFakeEmail } from '@authup/core-kit';\nimport { pickRecord } from '@authup/kit';\nimport type {\n IClientRepository,\n IUserRepository,\n} from '../../../entities/index.ts';\nimport type { UserProvisioningEntity } from '../../entities/user/index.ts';\nimport { ProvisioningEntityStrategyType, normalizeEntityProvisioningStrategy } from '../../strategy/index.ts';\nimport { BaseProvisioningSynchronizer } from '../base.ts';\nimport { ProvisioningEntityResolver } from '../entity-resolver.ts';\nimport { ProvisioningJunctionSynchronizer } from '../junction-synchronizer.ts';\nimport type { UserProvisioningSynchronizerContext } from './types.ts';\n\nexport class UserProvisioningSynchronizer extends BaseProvisioningSynchronizer<UserProvisioningEntity> {\n protected userRepository: IUserRepository;\n\n protected clientRepository: IClientRepository;\n\n protected permissionResolver: ProvisioningEntityResolver<Permission>;\n\n protected roleResolver: ProvisioningEntityResolver<Role>;\n\n protected permissionJunction: ProvisioningJunctionSynchronizer<UserPermission>;\n\n protected roleJunction: ProvisioningJunctionSynchronizer<UserRole>;\n\n constructor(ctx: UserProvisioningSynchronizerContext) {\n super();\n\n this.userRepository = ctx.userRepository;\n this.clientRepository = ctx.clientRepository;\n\n this.permissionResolver = new ProvisioningEntityResolver(ctx.permissionRepository);\n this.roleResolver = new ProvisioningEntityResolver(ctx.roleRepository);\n\n this.permissionJunction = new ProvisioningJunctionSynchronizer({\n repository: ctx.userPermissionRepository,\n ownerKey: 'userId',\n ownerRealmKey: 'userRealmId',\n });\n this.roleJunction = new ProvisioningJunctionSynchronizer({\n repository: ctx.userRoleRepository,\n ownerKey: 'userId',\n ownerRealmKey: 'userRealmId',\n });\n }\n\n async synchronize(input: UserProvisioningEntity): Promise<UserProvisioningEntity> {\n this.canonicalizeName(input.attributes);\n\n const strategy = normalizeEntityProvisioningStrategy(input.strategy);\n\n let attributes = await this.userRepository.findOneBy({\n name: input.attributes.name,\n realmId: input.attributes.realmId || null,\n });\n\n if (strategy.type === ProvisioningEntityStrategyType.ABSENT) {\n if (attributes) {\n await this.userRepository.remove(attributes);\n }\n return {\n ...input,\n attributes: attributes || input.attributes, \n };\n }\n\n if (attributes) {\n switch (strategy.type) {\n case ProvisioningEntityStrategyType.MERGE:\n if (\n strategy.attributes &&\n strategy.attributes.includes('email')\n ) {\n input.attributes.email = input.attributes.email ||\n attributes.email ||\n buildUserFakeEmail(input.attributes.name || attributes.name);\n }\n\n attributes = this.userRepository.merge(\n attributes,\n strategy.attributes ?\n pickRecord(input.attributes, strategy.attributes) :\n input.attributes,\n );\n\n attributes = await this.userRepository.save(attributes);\n break;\n case ProvisioningEntityStrategyType.REPLACE:\n input.attributes.email = input.attributes.email ||\n attributes.email ||\n (input.attributes.name ? buildUserFakeEmail(input.attributes.name) : undefined);\n\n input.attributes.id = attributes.id;\n attributes = await this.userRepository.save(this.userRepository.create(input.attributes));\n break;\n }\n } else {\n if (!input.attributes.email && input.attributes.name) {\n input.attributes.email = buildUserFakeEmail(input.attributes.name);\n }\n\n attributes = await this.userRepository.save(this.userRepository.create(input.attributes));\n }\n\n // Permissions (Global, Realm & Client)\n const permissions : Permission[] = [\n ...await this.permissionResolver.resolveGlobal(\n input.relations && input.relations.globalPermissions,\n ),\n ...(attributes.realmId ?\n await this.permissionResolver.resolveRealm(\n input.relations && input.relations.realmPermissions,\n attributes.realmId,\n ) :\n []),\n ];\n\n if (input.relations && input.relations.clientPermissions) {\n const clientKeys = Object.keys(input.relations.clientPermissions);\n for (const clientKey of clientKeys) {\n const client = await this.clientRepository.findOneBy({\n name: clientKey,\n realmId: attributes.realmId,\n });\n\n if (client) {\n const entities = await this.permissionResolver.resolveClient(\n input.relations.clientPermissions[clientKey],\n attributes.realmId,\n client.id,\n );\n permissions.push(...entities);\n }\n }\n }\n\n if (permissions.length > 0) {\n await this.permissionJunction.synchronize(\n attributes,\n permissions,\n 'permissionId',\n 'permissionRealmId',\n );\n }\n\n // Roles (Global, Realm & Client)\n const roles : Role[] = [\n ...await this.roleResolver.resolveGlobal(\n input.relations && input.relations.globalRoles,\n ),\n ...(attributes.realmId ?\n await this.roleResolver.resolveRealm(\n input.relations && input.relations.realmRoles,\n attributes.realmId,\n ) :\n []),\n ];\n\n if (input.relations && input.relations.clientRoles) {\n const clientKeys = Object.keys(input.relations.clientRoles);\n for (const clientKey of clientKeys) {\n const client = await this.clientRepository.findOneBy({\n name: clientKey,\n realmId: attributes.realmId,\n });\n\n if (client) {\n const entities = await this.roleResolver.resolveClient(\n input.relations.clientRoles[clientKey],\n attributes.realmId,\n client.id,\n );\n roles.push(...entities);\n }\n }\n }\n\n if (roles.length > 0) {\n await this.roleJunction.synchronize(\n attributes,\n roles,\n 'roleId',\n 'roleRealmId',\n );\n }\n\n return {\n ...input,\n attributes,\n };\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["buildUserFakeEmail","pickRecord","ProvisioningEntityStrategyType","normalizeEntityProvisioningStrategy","BaseProvisioningSynchronizer","ProvisioningEntityResolver","ProvisioningJunctionSynchronizer","UserProvisioningSynchronizer","userRepository","clientRepository","permissionResolver","roleResolver","permissionJunction","roleJunction","ctx","permissionRepository","roleRepository","repository","userPermissionRepository","ownerKey","ownerRealmKey","userRoleRepository","synchronize","input","canonicalizeName","attributes","strategy","findOneBy","name","realmId","type","ABSENT","remove","MERGE","includes","email","merge","save","REPLACE","undefined","id","create","permissions","resolveGlobal","relations","globalPermissions","resolveRealm","realmPermissions","clientPermissions","clientKeys","Object","keys","clientKey","client","entities","resolveClient","push","length","roles","globalRoles","realmRoles","clientRoles"],"sources":["../../../../../src/core/provisioning/synchronizer/user/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n Permission, \n Role, \n UserPermission, \n UserRole,\n} from '@authup/core-kit';\nimport { buildUserFakeEmail } from '@authup/core-kit';\nimport { pickRecord } from '@authup/kit';\nimport type {\n IClientRepository,\n IUserRepository,\n} from '../../../entities/index.ts';\nimport type { UserProvisioningEntity } from '../../entities/user/index.ts';\nimport { ProvisioningEntityStrategyType, normalizeEntityProvisioningStrategy } from '../../strategy/index.ts';\nimport { BaseProvisioningSynchronizer } from '../base.ts';\nimport { ProvisioningEntityResolver } from '../entity-resolver.ts';\nimport { ProvisioningJunctionSynchronizer } from '../junction-synchronizer.ts';\nimport type { UserProvisioningSynchronizerContext } from './types.ts';\n\nexport class UserProvisioningSynchronizer extends BaseProvisioningSynchronizer<UserProvisioningEntity> {\n protected userRepository: IUserRepository;\n\n protected clientRepository: IClientRepository;\n\n protected permissionResolver: ProvisioningEntityResolver<Permission>;\n\n protected roleResolver: ProvisioningEntityResolver<Role>;\n\n protected permissionJunction: ProvisioningJunctionSynchronizer<UserPermission>;\n\n protected roleJunction: ProvisioningJunctionSynchronizer<UserRole>;\n\n constructor(ctx: UserProvisioningSynchronizerContext) {\n super();\n\n this.userRepository = ctx.userRepository;\n this.clientRepository = ctx.clientRepository;\n\n this.permissionResolver = new ProvisioningEntityResolver(ctx.permissionRepository);\n this.roleResolver = new ProvisioningEntityResolver(ctx.roleRepository);\n\n this.permissionJunction = new ProvisioningJunctionSynchronizer({\n repository: ctx.userPermissionRepository,\n ownerKey: 'userId',\n ownerRealmKey: 'userRealmId',\n });\n this.roleJunction = new ProvisioningJunctionSynchronizer({\n repository: ctx.userRoleRepository,\n ownerKey: 'userId',\n ownerRealmKey: 'userRealmId',\n });\n }\n\n async synchronize(input: UserProvisioningEntity): Promise<UserProvisioningEntity> {\n this.canonicalizeName(input.attributes);\n\n const strategy = normalizeEntityProvisioningStrategy(input.strategy);\n\n let attributes = await this.userRepository.findOneBy({\n name: input.attributes.name,\n realmId: input.attributes.realmId || null,\n });\n\n if (strategy.type === ProvisioningEntityStrategyType.ABSENT) {\n if (attributes) {\n await this.userRepository.remove(attributes);\n }\n return {\n ...input,\n attributes: attributes || input.attributes, \n };\n }\n\n if (attributes) {\n switch (strategy.type) {\n case ProvisioningEntityStrategyType.MERGE:\n if (\n strategy.attributes &&\n strategy.attributes.includes('email')\n ) {\n input.attributes.email = input.attributes.email ||\n attributes.email ||\n buildUserFakeEmail(input.attributes.name || attributes.name);\n }\n\n attributes = this.userRepository.merge(\n attributes,\n strategy.attributes ?\n pickRecord(input.attributes, strategy.attributes) :\n input.attributes,\n );\n\n attributes = await this.userRepository.save(attributes);\n break;\n case ProvisioningEntityStrategyType.REPLACE:\n input.attributes.email = input.attributes.email ||\n attributes.email ||\n (input.attributes.name ? buildUserFakeEmail(input.attributes.name) : undefined);\n\n input.attributes.id = attributes.id;\n attributes = await this.userRepository.save(this.userRepository.create(input.attributes));\n break;\n }\n } else {\n if (!input.attributes.email && input.attributes.name) {\n input.attributes.email = buildUserFakeEmail(input.attributes.name);\n }\n\n attributes = await this.userRepository.save(this.userRepository.create(input.attributes));\n }\n\n // Permissions (Global, Realm & Client)\n const permissions : Permission[] = [\n ...await this.permissionResolver.resolveGlobal(\n input.relations && input.relations.globalPermissions,\n ),\n ...(attributes.realmId ?\n await this.permissionResolver.resolveRealm(\n input.relations && input.relations.realmPermissions,\n attributes.realmId,\n ) :\n []),\n ];\n\n if (input.relations && input.relations.clientPermissions) {\n const clientKeys = Object.keys(input.relations.clientPermissions);\n for (const clientKey of clientKeys) {\n const client = await this.clientRepository.findOneBy({\n name: clientKey,\n realmId: attributes.realmId,\n });\n\n if (client) {\n const entities = await this.permissionResolver.resolveClient(\n input.relations.clientPermissions[clientKey],\n attributes.realmId,\n client.id,\n );\n permissions.push(...entities);\n }\n }\n }\n\n if (permissions.length > 0) {\n await this.permissionJunction.synchronize(\n attributes,\n permissions,\n 'permissionId',\n 'permissionRealmId',\n );\n }\n\n // Roles (Global, Realm & Client)\n const roles : Role[] = [\n ...await this.roleResolver.resolveGlobal(\n input.relations && input.relations.globalRoles,\n ),\n ...(attributes.realmId ?\n await this.roleResolver.resolveRealm(\n input.relations && input.relations.realmRoles,\n attributes.realmId,\n ) :\n []),\n ];\n\n if (input.relations && input.relations.clientRoles) {\n const clientKeys = Object.keys(input.relations.clientRoles);\n for (const clientKey of clientKeys) {\n const client = await this.clientRepository.findOneBy({\n name: clientKey,\n realmId: attributes.realmId,\n });\n\n if (client) {\n const entities = await this.roleResolver.resolveClient(\n input.relations.clientRoles[clientKey],\n attributes.realmId,\n client.id,\n );\n roles.push(...entities);\n }\n }\n }\n\n if (roles.length > 0) {\n await this.roleJunction.synchronize(\n attributes,\n roles,\n 'roleId',\n 'roleRealmId',\n );\n }\n\n return {\n ...input,\n attributes,\n };\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Parameter } from '@rapiq/core';
|
|
2
|
+
import type { Schema, SchemaDescription } from '@rapiq/core';
|
|
3
|
+
/**
|
|
4
|
+
* The parameter subset advertised on single-record reads: a record
|
|
5
|
+
* response never advertises filter/sort/pagination vocabulary (no
|
|
6
|
+
* single read processes those). NOTE: today only the user/client
|
|
7
|
+
* single reads actually decode `fields`/`relations`
|
|
8
|
+
* (`decodeQuery(..., { parameters: ['fields', 'relations'] })`); the
|
|
9
|
+
* other record endpoints ignore the query entirely, so for them this
|
|
10
|
+
* advertisement is the TARGET vocabulary, not current behavior —
|
|
11
|
+
* converging them is tracked in plan 076.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RECORD_QUERY_PARAMETERS: `${Parameter}`[];
|
|
14
|
+
/**
|
|
15
|
+
* Serialize an entity schema's declared query constraints for the
|
|
16
|
+
* response `meta.schema` key (issue #1649) — the static upper bound of
|
|
17
|
+
* the queryable vocabulary. Relation capabilities are not expanded
|
|
18
|
+
* inline: `relations.schemas` names each relation's target schema,
|
|
19
|
+
* whose own endpoints carry its description. Actor-dependent gates
|
|
20
|
+
* (relations read gate, field visibility conditions) are deliberately
|
|
21
|
+
* not reflected. Descriptions are immutable per (schema, parameters),
|
|
22
|
+
* so they are memoized — callers MUST NOT mutate the returned object.
|
|
23
|
+
*/
|
|
24
|
+
export declare function describeQuerySchema(schema: Schema<any>, parameters?: `${Parameter}`[]): SchemaDescription;
|
|
25
|
+
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/core/query/describe.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE7D;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,GAAG,SAAS,EAAE,EAGnD,CAAC;AAgBF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EACnB,UAAU,CAAC,EAAE,GAAG,SAAS,EAAE,EAAE,GAC7B,iBAAiB,CAgBpB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { Parameter } from "@rapiq/core";
|
|
5
|
+
//#region src/core/query/describe.ts
|
|
6
|
+
/**
|
|
7
|
+
* The parameter subset advertised on single-record reads: a record
|
|
8
|
+
* response never advertises filter/sort/pagination vocabulary (no
|
|
9
|
+
* single read processes those). NOTE: today only the user/client
|
|
10
|
+
* single reads actually decode `fields`/`relations`
|
|
11
|
+
* (`decodeQuery(..., { parameters: ['fields', 'relations'] })`); the
|
|
12
|
+
* other record endpoints ignore the query entirely, so for them this
|
|
13
|
+
* advertisement is the TARGET vocabulary, not current behavior —
|
|
14
|
+
* converging them is tracked in plan 076.
|
|
15
|
+
*/ const RECORD_QUERY_PARAMETERS = [Parameter.FIELDS, Parameter.RELATIONS];
|
|
16
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
17
|
+
function deepFreeze(input) {
|
|
18
|
+
if (input !== null && typeof input === "object") {
|
|
19
|
+
for (const value of Object.values(input)) deepFreeze(value);
|
|
20
|
+
Object.freeze(input);
|
|
21
|
+
}
|
|
22
|
+
return input;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Serialize an entity schema's declared query constraints for the
|
|
26
|
+
* response `meta.schema` key (issue #1649) — the static upper bound of
|
|
27
|
+
* the queryable vocabulary. Relation capabilities are not expanded
|
|
28
|
+
* inline: `relations.schemas` names each relation's target schema,
|
|
29
|
+
* whose own endpoints carry its description. Actor-dependent gates
|
|
30
|
+
* (relations read gate, field visibility conditions) are deliberately
|
|
31
|
+
* not reflected. Descriptions are immutable per (schema, parameters),
|
|
32
|
+
* so they are memoized — callers MUST NOT mutate the returned object.
|
|
33
|
+
*/ function describeQuerySchema(schema, parameters) {
|
|
34
|
+
let bySignature = cache.get(schema);
|
|
35
|
+
if (!bySignature) {
|
|
36
|
+
bySignature = /* @__PURE__ */ new Map();
|
|
37
|
+
cache.set(schema, bySignature);
|
|
38
|
+
}
|
|
39
|
+
const signature = parameters ? [...parameters].sort().join(",") : "*";
|
|
40
|
+
let output = bySignature.get(signature);
|
|
41
|
+
if (!output) {
|
|
42
|
+
output = deepFreeze(schema.describe(parameters ? { parameters } : {}));
|
|
43
|
+
bySignature.set(signature, output);
|
|
44
|
+
}
|
|
45
|
+
return output;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { RECORD_QUERY_PARAMETERS, describeQuerySchema };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=describe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.mjs","names":["Parameter","RECORD_QUERY_PARAMETERS","FIELDS","RELATIONS","cache","WeakMap","deepFreeze","input","value","Object","values","freeze","describeQuerySchema","schema","parameters","bySignature","get","Map","set","signature","sort","join","output","describe"],"sources":["../../../src/core/query/describe.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { Parameter } from '@rapiq/core';\nimport type { Schema, SchemaDescription } from '@rapiq/core';\n\n/**\n * The parameter subset advertised on single-record reads: a record\n * response never advertises filter/sort/pagination vocabulary (no\n * single read processes those). NOTE: today only the user/client\n * single reads actually decode `fields`/`relations`\n * (`decodeQuery(..., { parameters: ['fields', 'relations'] })`); the\n * other record endpoints ignore the query entirely, so for them this\n * advertisement is the TARGET vocabulary, not current behavior —\n * converging them is tracked in plan 076.\n */\nexport const RECORD_QUERY_PARAMETERS: `${Parameter}`[] = [\n Parameter.FIELDS,\n Parameter.RELATIONS,\n];\n\nconst cache = new WeakMap<Schema<any>, Map<string, SchemaDescription>>();\n\nfunction deepFreeze<T>(input: T) : T {\n if (input !== null && typeof input === 'object') {\n for (const value of Object.values(input)) {\n deepFreeze(value);\n }\n\n Object.freeze(input);\n }\n\n return input;\n}\n\n/**\n * Serialize an entity schema's declared query constraints for the\n * response `meta.schema` key (issue #1649) — the static upper bound of\n * the queryable vocabulary. Relation capabilities are not expanded\n * inline: `relations.schemas` names each relation's target schema,\n * whose own endpoints carry its description. Actor-dependent gates\n * (relations read gate, field visibility conditions) are deliberately\n * not reflected. Descriptions are immutable per (schema, parameters),\n * so they are memoized — callers MUST NOT mutate the returned object.\n */\nexport function describeQuerySchema(\n schema: Schema<any>,\n parameters?: `${Parameter}`[],\n) : SchemaDescription {\n let bySignature = cache.get(schema);\n if (!bySignature) {\n bySignature = new Map();\n cache.set(schema, bySignature);\n }\n\n const signature = parameters ? [...parameters].sort().join(',') : '*';\n\n let output = bySignature.get(signature);\n if (!output) {\n output = deepFreeze(schema.describe(parameters ? { parameters } : {}));\n bySignature.set(signature, output);\n }\n\n return output;\n}\n"],"mappings":";;;;;;;;;;;;;;GAoBA,MAAaC,0BAA4C,CACrDD,UAAUE,QACVF,UAAUG,SACb;AAED,MAAMC,wBAAQ,IAAIC,QAAAA;AAElB,SAASC,WAAcC,OAAQ;CAC3B,IAAIA,UAAU,QAAQ,OAAOA,UAAU,UAAU;EAC7C,KAAK,MAAMC,SAASC,OAAOC,OAAOH,KAAAA,GAC9BD,WAAWE,KAAAA;EAGfC,OAAOE,OAAOJ,KAAAA;CAClB;CAEA,OAAOA;AACX;;;;;;;;;;GAYA,SAAgBK,oBACZC,QACAC,YAA6B;CAE7B,IAAIC,cAAcX,MAAMY,IAAIH,MAAAA;CAC5B,IAAI,CAACE,aAAa;EACdA,8BAAc,IAAIE,IAAAA;EAClBb,MAAMc,IAAIL,QAAQE,WAAAA;CACtB;CAEA,MAAMI,YAAYL,aAAa,CAAIA,GAAAA,UAAW,CAAA,CAACM,KAAI,CAAA,CAAGC,KAAK,GAAA,IAAO;CAElE,IAAIC,SAASP,YAAYC,IAAIG,SAAAA;CAC7B,IAAI,CAACG,QAAQ;EACTA,SAAShB,WAAWO,OAAOU,SAAST,aAAa,EAAEA,WAAW,IAAI,CAAC,CAAA,CAAA;EACnEC,YAAYG,IAAIC,WAAWG,MAAAA;CAC/B;CAEA,OAAOA;AACX"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { KeyValidationVerdict, KeyValidatorMany } from '@rapiq/core';
|
|
2
|
+
import type { ActorContext } from '@authup/server-kit';
|
|
3
|
+
import type { QueryDecodeContext } from './types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Per-field read gate: given the acting identity, answer with a
|
|
6
|
+
* {@link KeyValidationVerdict} for one gated column — `true` to project
|
|
7
|
+
* it, `false` to strip it, or an `ICondition` to project it visible
|
|
8
|
+
* only on rows satisfying the condition (rapiq attaches it to the
|
|
9
|
+
* `Field` node; the repository layer enforces it after the fetch via
|
|
10
|
+
* `redactFieldConditions`).
|
|
11
|
+
*
|
|
12
|
+
* A returned condition must be authored FAIL-CLOSED over incomplete
|
|
13
|
+
* rows: `@rapiq/adapter-memory` unifies a missing column with `null`, so a
|
|
14
|
+
* negative predicate (`not(...)`, `ne(...)`) over an unselected column
|
|
15
|
+
* evaluates true and ships the value. The SQL adapter force-selects
|
|
16
|
+
* every column a condition references (rapiq#830's operand
|
|
17
|
+
* projection), so this is defense in depth — but prefer positive legs
|
|
18
|
+
* (`eq(x, true)`) plus an outer presence guard (`ne('realmId', null)`)
|
|
19
|
+
* over negated trees.
|
|
20
|
+
*/
|
|
21
|
+
export type FieldReadGate = (actor: ActorContext) => Promise<KeyValidationVerdict> | KeyValidationVerdict;
|
|
22
|
+
/**
|
|
23
|
+
* Build a rapiq `fields.validateMany` hook gating individual columns on
|
|
24
|
+
* a per-actor verdict (issue #3322): invoked once per (governing
|
|
25
|
+
* schema, relation path) with every client-requested field, so a gate
|
|
26
|
+
* can compile the actor's permission tree once per query instead of
|
|
27
|
+
* once per field. The batched form matters because the gate applies
|
|
28
|
+
* uniformly at the query ROOT and under any relation path — the
|
|
29
|
+
* position where `ClientPermissionService` & co. serve
|
|
30
|
+
* `include=client&fields[client]=secret` never runs the client
|
|
31
|
+
* service's own read path.
|
|
32
|
+
*
|
|
33
|
+
* Ungated fields accept. Schema defaults never reach the hook, so an
|
|
34
|
+
* unqualified list request costs no evaluation. Caller classes mirror
|
|
35
|
+
* the relations read gate: a SYSTEM decode (no actor in the context)
|
|
36
|
+
* is unrestricted; every REQUEST decode carries an actor (anonymous
|
|
37
|
+
* ones hold no grants). A gate failure fails closed (strip).
|
|
38
|
+
*
|
|
39
|
+
* NOTE: schemas import this file DIRECTLY (never the `core/query`
|
|
40
|
+
* barrel) — the barrel reaches `module.ts`, which imports every
|
|
41
|
+
* schema; importing it from a schema would create a TDZ cycle.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createFieldsReadGate(gates: Record<string, FieldReadGate>): KeyValidatorMany<QueryDecodeContext | undefined>;
|
|
44
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/core/query/fields.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,oBAAoB,EAEpB,gBAAgB,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACpC,gBAAgB,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAoBnD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/core/query/fields.ts
|
|
5
|
+
/**
|
|
6
|
+
* Build a rapiq `fields.validateMany` hook gating individual columns on
|
|
7
|
+
* a per-actor verdict (issue #3322): invoked once per (governing
|
|
8
|
+
* schema, relation path) with every client-requested field, so a gate
|
|
9
|
+
* can compile the actor's permission tree once per query instead of
|
|
10
|
+
* once per field. The batched form matters because the gate applies
|
|
11
|
+
* uniformly at the query ROOT and under any relation path — the
|
|
12
|
+
* position where `ClientPermissionService` & co. serve
|
|
13
|
+
* `include=client&fields[client]=secret` never runs the client
|
|
14
|
+
* service's own read path.
|
|
15
|
+
*
|
|
16
|
+
* Ungated fields accept. Schema defaults never reach the hook, so an
|
|
17
|
+
* unqualified list request costs no evaluation. Caller classes mirror
|
|
18
|
+
* the relations read gate: a SYSTEM decode (no actor in the context)
|
|
19
|
+
* is unrestricted; every REQUEST decode carries an actor (anonymous
|
|
20
|
+
* ones hold no grants). A gate failure fails closed (strip).
|
|
21
|
+
*
|
|
22
|
+
* NOTE: schemas import this file DIRECTLY (never the `core/query`
|
|
23
|
+
* barrel) — the barrel reaches `module.ts`, which imports every
|
|
24
|
+
* schema; importing it from a schema would create a TDZ cycle.
|
|
25
|
+
*/ function createFieldsReadGate(gates) {
|
|
26
|
+
return async (names, context) => {
|
|
27
|
+
const record = {};
|
|
28
|
+
for (const name of names) {
|
|
29
|
+
const gate = gates[name];
|
|
30
|
+
if (!gate || !context || !context.actor) {
|
|
31
|
+
record[name] = true;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
record[name] = await gate(context.actor);
|
|
36
|
+
} catch {
|
|
37
|
+
record[name] = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return record;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { createFieldsReadGate };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=fields.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.mjs","names":["createFieldsReadGate","gates","names","context","record","name","gate","actor"],"sources":["../../../src/core/query/fields.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n KeyValidationVerdict,\n KeyValidationVerdictRecord,\n KeyValidatorMany,\n} from '@rapiq/core';\nimport type { ActorContext } from '@authup/server-kit';\nimport type { QueryDecodeContext } from './types.ts';\n\n/**\n * Per-field read gate: given the acting identity, answer with a\n * {@link KeyValidationVerdict} for one gated column — `true` to project\n * it, `false` to strip it, or an `ICondition` to project it visible\n * only on rows satisfying the condition (rapiq attaches it to the\n * `Field` node; the repository layer enforces it after the fetch via\n * `redactFieldConditions`).\n *\n * A returned condition must be authored FAIL-CLOSED over incomplete\n * rows: `@rapiq/adapter-memory` unifies a missing column with `null`, so a\n * negative predicate (`not(...)`, `ne(...)`) over an unselected column\n * evaluates true and ships the value. The SQL adapter force-selects\n * every column a condition references (rapiq#830's operand\n * projection), so this is defense in depth — but prefer positive legs\n * (`eq(x, true)`) plus an outer presence guard (`ne('realmId', null)`)\n * over negated trees.\n */\nexport type FieldReadGate = (actor: ActorContext) => Promise<KeyValidationVerdict> | KeyValidationVerdict;\n\n/**\n * Build a rapiq `fields.validateMany` hook gating individual columns on\n * a per-actor verdict (issue #3322): invoked once per (governing\n * schema, relation path) with every client-requested field, so a gate\n * can compile the actor's permission tree once per query instead of\n * once per field. The batched form matters because the gate applies\n * uniformly at the query ROOT and under any relation path — the\n * position where `ClientPermissionService` & co. serve\n * `include=client&fields[client]=secret` never runs the client\n * service's own read path.\n *\n * Ungated fields accept. Schema defaults never reach the hook, so an\n * unqualified list request costs no evaluation. Caller classes mirror\n * the relations read gate: a SYSTEM decode (no actor in the context)\n * is unrestricted; every REQUEST decode carries an actor (anonymous\n * ones hold no grants). A gate failure fails closed (strip).\n *\n * NOTE: schemas import this file DIRECTLY (never the `core/query`\n * barrel) — the barrel reaches `module.ts`, which imports every\n * schema; importing it from a schema would create a TDZ cycle.\n */\nexport function createFieldsReadGate(\n gates: Record<string, FieldReadGate>,\n) : KeyValidatorMany<QueryDecodeContext | undefined> {\n return async (names, context) => {\n const record : KeyValidationVerdictRecord = {};\n\n for (const name of names) {\n const gate = gates[name];\n if (!gate || !context || !context.actor) {\n record[name] = true;\n continue;\n }\n\n try {\n record[name] = await gate(context.actor);\n } catch {\n record[name] = false;\n }\n }\n\n return record;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;GAuDA,SAAgBA,qBACZC,OAAoC;CAEpC,OAAO,OAAOC,OAAOC,YAAAA;EACjB,MAAMC,SAAsC,CAAC;EAE7C,KAAK,MAAMC,QAAQH,OAAO;GACtB,MAAMI,OAAOL,MAAMI;GACnB,IAAI,CAACC,QAAQ,CAACH,WAAW,CAACA,QAAQI,OAAO;IACrCH,OAAOC,QAAQ;IACf;GACJ;GAEA,IAAI;IACAD,OAAOC,QAAQ,MAAMC,KAAKH,QAAQI,KAAK;GAC3C,QAAQ;IACJH,OAAOC,QAAQ;GACnB;EACJ;EAEA,OAAOD;CACX;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/query/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/query/index.ts"],"names":[],"mappings":"AAOA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { RECORD_QUERY_PARAMETERS, describeQuerySchema } from "./describe.mjs";
|
|
4
5
|
import { createRelationsReadGate } from "./relations.mjs";
|
|
5
6
|
import { appendQueryConditions, decodeQuery, queryCodec, schemaRegistry } from "./module.mjs";
|
|
6
|
-
export { appendQueryConditions, createRelationsReadGate, decodeQuery, queryCodec, schemaRegistry };
|
|
7
|
+
export { RECORD_QUERY_PARAMETERS, appendQueryConditions, createRelationsReadGate, decodeQuery, describeQuerySchema, queryCodec, schemaRegistry };
|
|
@@ -11,7 +11,7 @@ import type { DecodeQueryOptions } from './types.ts';
|
|
|
11
11
|
* schemas are security policy over the domain types, and services
|
|
12
12
|
* consume them to decode wire queries into the rapiq IR. A repository
|
|
13
13
|
* layer MAY extend the registry with additional, storage-derived
|
|
14
|
-
* schemas (e.g. `@rapiq/typeorm`'s `defineSchemaRegistryWithDataSource`
|
|
14
|
+
* schemas (e.g. `@rapiq/adapter-typeorm`'s `defineSchemaRegistryWithDataSource`
|
|
15
15
|
* with the `registry` option — already-registered schemas take
|
|
16
16
|
* precedence), but the allow-lists themselves stay explicit and are
|
|
17
17
|
* never auto-derived from entity metadata.
|
|
@@ -38,7 +38,7 @@ import { createURLCodec } from "@rapiq/codec-url";
|
|
|
38
38
|
* schemas are security policy over the domain types, and services
|
|
39
39
|
* consume them to decode wire queries into the rapiq IR. A repository
|
|
40
40
|
* layer MAY extend the registry with additional, storage-derived
|
|
41
|
-
* schemas (e.g. `@rapiq/typeorm`'s `defineSchemaRegistryWithDataSource`
|
|
41
|
+
* schemas (e.g. `@rapiq/adapter-typeorm`'s `defineSchemaRegistryWithDataSource`
|
|
42
42
|
* with the `registry` option — already-registered schemas take
|
|
43
43
|
* precedence), but the allow-lists themselves stay explicit and are
|
|
44
44
|
* never auto-derived from entity metadata.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["createURLCodec","Query","SchemaRegistry","isObject","clientSchema","clientPermissionSchema","clientRoleSchema","clientScopeSchema","consentSchema","eventSchema","identityProviderSchema","identityProviderRoleMappingSchema","keySchema","permissionSchema","permissionPolicySchema","policySchema","realmSchema","roleSchema","roleAttributeSchema","rolePermissionSchema","scopeSchema","sessionSchema","trustAnchorSchema","userSchema","userAttributeSchema","userAuthenticatorSchema","userPermissionSchema","userRoleSchema","schemaRegistry","schemas","schema","add","queryCodec","decodeQuery","input","options","normalized","parsed","decodeAsync","parameters","context","actor","appendQueryConditions","query","conditions","fields","filters","and","relations","pagination","sorts"],"sources":["../../../src/core/query/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { createURLCodec } from '@rapiq/codec-url';\nimport type {\n ICondition, \n IQuery, \n ObjectLiteral, \n Schema,\n} from '@rapiq/core';\nimport { Query, SchemaRegistry, isObject } from '@rapiq/core';\nimport { clientSchema } from '../entities/client/schema.ts';\nimport { clientPermissionSchema } from '../entities/client-permission/schema.ts';\nimport { clientRoleSchema } from '../entities/client-role/schema.ts';\nimport { clientScopeSchema } from '../entities/client-scope/schema.ts';\nimport { consentSchema } from '../entities/consent/schema.ts';\nimport { eventSchema } from '../entities/event/schema.ts';\nimport { identityProviderSchema } from '../entities/identity-provider/schema.ts';\nimport { identityProviderRoleMappingSchema } from '../entities/identity-provider-role-mapping/schema.ts';\nimport { keySchema } from '../entities/key/schema.ts';\nimport { permissionSchema } from '../entities/permission/schema.ts';\nimport { permissionPolicySchema } from '../entities/permission-policy/schema.ts';\nimport { policySchema } from '../entities/policy/schema.ts';\nimport { realmSchema } from '../entities/realm/schema.ts';\nimport { roleSchema } from '../entities/role/schema.ts';\nimport { roleAttributeSchema } from '../entities/role-attribute/schema.ts';\nimport { rolePermissionSchema } from '../entities/role-permission/schema.ts';\nimport { scopeSchema } from '../entities/scope/schema.ts';\nimport { sessionSchema } from '../entities/session/schema.ts';\nimport { trustAnchorSchema } from '../entities/trust-anchor/schema.ts';\nimport { userSchema } from '../entities/user/schema.ts';\nimport { userAttributeSchema } from '../entities/user-attribute/schema.ts';\nimport { userAuthenticatorSchema } from '../entities/user-authenticator/schema.ts';\nimport { userPermissionSchema } from '../entities/user-permission/schema.ts';\nimport { userRoleSchema } from '../entities/user-role/schema.ts';\nimport type { DecodeQueryOptions, QueryDecodeContext } from './types.ts';\n\n/**\n * Registry of every entity schema — the server-side allow-list layer.\n * Relation traversal (e.g. a `realm.name` filter) resolves through the\n * `schemaMapping` of the owning schema into the related schema's own\n * allow-lists.\n *\n * The registry deliberately lives in core (persistence-agnostic): the\n * schemas are security policy over the domain types, and services\n * consume them to decode wire queries into the rapiq IR. A repository\n * layer MAY extend the registry with additional, storage-derived\n * schemas (e.g. `@rapiq/typeorm`'s `defineSchemaRegistryWithDataSource`\n * with the `registry` option — already-registered schemas take\n * precedence), but the allow-lists themselves stay explicit and are\n * never auto-derived from entity metadata.\n */\nexport const schemaRegistry = new SchemaRegistry();\n\nconst schemas : Schema<any>[] = [\n clientSchema,\n clientPermissionSchema,\n clientRoleSchema,\n clientScopeSchema,\n consentSchema,\n eventSchema,\n identityProviderSchema,\n identityProviderRoleMappingSchema,\n keySchema,\n permissionSchema,\n permissionPolicySchema,\n policySchema,\n realmSchema,\n roleSchema,\n roleAttributeSchema,\n rolePermissionSchema,\n scopeSchema,\n sessionSchema,\n trustAnchorSchema,\n userSchema,\n userAttributeSchema,\n userAuthenticatorSchema,\n userPermissionSchema,\n userRoleSchema,\n];\n\nfor (const schema of schemas) {\n schemaRegistry.add(schema);\n}\n\n/**\n * URL transport codec bound to the schema registry: decodes both the\n * v2 expression dialect (stamped or detected) and legacy v1 bracket\n * payloads, so pre-v2 clients keep working.\n */\nexport const queryCodec = createURLCodec(schemaRegistry);\n\n/**\n * Decode a raw wire query (routup `useRequestQuery` output or a raw\n * query string) against a registered schema into the rapiq IR. The\n * schema's allow-lists, defaults and pagination bounds are applied\n * here — downstream consumers (repository adapters) only execute the\n * returned query.\n *\n * Async because the schema validate hooks are: the relations read\n * gate (`createRelationsReadGate`) awaits the actor's permission\n * pre-gate per include, and rapiq refuses async validators on the\n * synchronous decode path. Pass the acting identity via\n * `options.actor` on every request-driven decode (authenticated or\n * anonymous — the HTTP adapter always builds one); a decode without\n * an actor is a system call and runs unrestricted.\n */\nexport async function decodeQuery<RECORD extends ObjectLiteral = ObjectLiteral>(\n input: unknown,\n options: DecodeQueryOptions<RECORD>,\n) : Promise<Query> {\n const normalized = isObject(input) || typeof input === 'string' ? input : {};\n\n const parsed = await queryCodec.decodeAsync(normalized, {\n // Schema<RECORD> is invariant; the codec's non-generic options\n // accept Schema<ObjectLiteral>, so collapse the variance here.\n schema: options.schema as Schema<any> | string,\n parameters: options.parameters,\n context: { actor: options.actor } satisfies QueryDecodeContext,\n });\n\n return parsed ?? new Query({});\n}\n\n/**\n * Append server-derived conditions (a route realm, an owner scope, ...)\n * onto a decoded query by AND-wrapping its filter tree. The wrap makes\n * the appended scope non-displaceable: unlike a filters merge (per-field\n * replace, flat-root-AND restriction), a client-sent condition on the\n * same field intersects with the scope instead of replacing it, and\n * compound client trees (`or(...)`) are preserved as-is. Same guarantee\n * class as a mandatory `andWhere` at the repository — expressed once in\n * the IR. Appended conditions do not pass through `decodeQuery`, so the\n * schema allow-lists do not constrain them (server-derived context).\n *\n * Immutable: returns a new `Query` whose filters node is the\n * AND-wrapped successor (`IFilters.and`); every other parameter node is\n * carried over **by reference**, so the input query stays untouched and\n * nothing is copied. The node enumeration mirrors rapiq's\n * `QueryContext` — keep it in sync when the IR gains a parameter.\n */\nexport function appendQueryConditions(query: IQuery, ...conditions: ICondition[]) : Query {\n return new Query({\n fields: query.fields,\n filters: query.filters.and(...conditions),\n relations: query.relations,\n pagination: query.pagination,\n sorts: query.sorts,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDA,MAAa4B,iBAAiB,IAAI1B,eAAAA;AAElC,MAAM2B,UAA0B;CAC5BzB;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;AACH;AAED,KAAK,MAAMG,UAAUD,SACjBD,eAAeG,IAAID,MAAAA;;;;;GAQvB,MAAaE,aAAahC,eAAe4B,cAAAA;;;;;;;;;;;;;;;GAiBzC,eAAsBK,YAClBC,OACAC,SAAmC;CAEnC,MAAMC,aAAajC,SAAS+B,KAAAA,KAAU,OAAOA,UAAU,WAAWA,QAAQ,CAAC;CAU3E,OAAOG,MARcL,WAAWM,YAAYF,YAAY;EAGpDN,QAAQK,QAAQL;EAChBS,YAAYJ,QAAQI;EACpBC,SAAS,EAAEC,OAAON,QAAQM,MAAM;CACpC,CAAA,KAEiB,IAAIxC,MAAM,CAAC,CAAA;AAChC;;;;;;;;;;;;;;;;;GAmBA,SAAgByC,sBAAsBC,OAAe,GAAGC,YAAwB;CAC5E,OAAO,IAAI3C,MAAM;EACb4C,QAAQF,MAAME;EACdC,SAASH,MAAMG,QAAQC,IAAG,GAAIH,UAAAA;EAC9BI,WAAWL,MAAMK;EACjBC,YAAYN,MAAMM;EAClBC,OAAOP,MAAMO;CACjB,CAAA;AACJ"}
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["createURLCodec","Query","SchemaRegistry","isObject","clientSchema","clientPermissionSchema","clientRoleSchema","clientScopeSchema","consentSchema","eventSchema","identityProviderSchema","identityProviderRoleMappingSchema","keySchema","permissionSchema","permissionPolicySchema","policySchema","realmSchema","roleSchema","roleAttributeSchema","rolePermissionSchema","scopeSchema","sessionSchema","trustAnchorSchema","userSchema","userAttributeSchema","userAuthenticatorSchema","userPermissionSchema","userRoleSchema","schemaRegistry","schemas","schema","add","queryCodec","decodeQuery","input","options","normalized","parsed","decodeAsync","parameters","context","actor","appendQueryConditions","query","conditions","fields","filters","and","relations","pagination","sorts"],"sources":["../../../src/core/query/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { createURLCodec } from '@rapiq/codec-url';\nimport type {\n ICondition, \n IQuery, \n ObjectLiteral, \n Schema,\n} from '@rapiq/core';\nimport { Query, SchemaRegistry, isObject } from '@rapiq/core';\nimport { clientSchema } from '../entities/client/schema.ts';\nimport { clientPermissionSchema } from '../entities/client-permission/schema.ts';\nimport { clientRoleSchema } from '../entities/client-role/schema.ts';\nimport { clientScopeSchema } from '../entities/client-scope/schema.ts';\nimport { consentSchema } from '../entities/consent/schema.ts';\nimport { eventSchema } from '../entities/event/schema.ts';\nimport { identityProviderSchema } from '../entities/identity-provider/schema.ts';\nimport { identityProviderRoleMappingSchema } from '../entities/identity-provider-role-mapping/schema.ts';\nimport { keySchema } from '../entities/key/schema.ts';\nimport { permissionSchema } from '../entities/permission/schema.ts';\nimport { permissionPolicySchema } from '../entities/permission-policy/schema.ts';\nimport { policySchema } from '../entities/policy/schema.ts';\nimport { realmSchema } from '../entities/realm/schema.ts';\nimport { roleSchema } from '../entities/role/schema.ts';\nimport { roleAttributeSchema } from '../entities/role-attribute/schema.ts';\nimport { rolePermissionSchema } from '../entities/role-permission/schema.ts';\nimport { scopeSchema } from '../entities/scope/schema.ts';\nimport { sessionSchema } from '../entities/session/schema.ts';\nimport { trustAnchorSchema } from '../entities/trust-anchor/schema.ts';\nimport { userSchema } from '../entities/user/schema.ts';\nimport { userAttributeSchema } from '../entities/user-attribute/schema.ts';\nimport { userAuthenticatorSchema } from '../entities/user-authenticator/schema.ts';\nimport { userPermissionSchema } from '../entities/user-permission/schema.ts';\nimport { userRoleSchema } from '../entities/user-role/schema.ts';\nimport type { DecodeQueryOptions, QueryDecodeContext } from './types.ts';\n\n/**\n * Registry of every entity schema — the server-side allow-list layer.\n * Relation traversal (e.g. a `realm.name` filter) resolves through the\n * `schemaMapping` of the owning schema into the related schema's own\n * allow-lists.\n *\n * The registry deliberately lives in core (persistence-agnostic): the\n * schemas are security policy over the domain types, and services\n * consume them to decode wire queries into the rapiq IR. A repository\n * layer MAY extend the registry with additional, storage-derived\n * schemas (e.g. `@rapiq/adapter-typeorm`'s `defineSchemaRegistryWithDataSource`\n * with the `registry` option — already-registered schemas take\n * precedence), but the allow-lists themselves stay explicit and are\n * never auto-derived from entity metadata.\n */\nexport const schemaRegistry = new SchemaRegistry();\n\nconst schemas : Schema<any>[] = [\n clientSchema,\n clientPermissionSchema,\n clientRoleSchema,\n clientScopeSchema,\n consentSchema,\n eventSchema,\n identityProviderSchema,\n identityProviderRoleMappingSchema,\n keySchema,\n permissionSchema,\n permissionPolicySchema,\n policySchema,\n realmSchema,\n roleSchema,\n roleAttributeSchema,\n rolePermissionSchema,\n scopeSchema,\n sessionSchema,\n trustAnchorSchema,\n userSchema,\n userAttributeSchema,\n userAuthenticatorSchema,\n userPermissionSchema,\n userRoleSchema,\n];\n\nfor (const schema of schemas) {\n schemaRegistry.add(schema);\n}\n\n/**\n * URL transport codec bound to the schema registry: decodes both the\n * v2 expression dialect (stamped or detected) and legacy v1 bracket\n * payloads, so pre-v2 clients keep working.\n */\nexport const queryCodec = createURLCodec(schemaRegistry);\n\n/**\n * Decode a raw wire query (routup `useRequestQuery` output or a raw\n * query string) against a registered schema into the rapiq IR. The\n * schema's allow-lists, defaults and pagination bounds are applied\n * here — downstream consumers (repository adapters) only execute the\n * returned query.\n *\n * Async because the schema validate hooks are: the relations read\n * gate (`createRelationsReadGate`) awaits the actor's permission\n * pre-gate per include, and rapiq refuses async validators on the\n * synchronous decode path. Pass the acting identity via\n * `options.actor` on every request-driven decode (authenticated or\n * anonymous — the HTTP adapter always builds one); a decode without\n * an actor is a system call and runs unrestricted.\n */\nexport async function decodeQuery<RECORD extends ObjectLiteral = ObjectLiteral>(\n input: unknown,\n options: DecodeQueryOptions<RECORD>,\n) : Promise<Query> {\n const normalized = isObject(input) || typeof input === 'string' ? input : {};\n\n const parsed = await queryCodec.decodeAsync(normalized, {\n // Schema<RECORD> is invariant; the codec's non-generic options\n // accept Schema<ObjectLiteral>, so collapse the variance here.\n schema: options.schema as Schema<any> | string,\n parameters: options.parameters,\n context: { actor: options.actor } satisfies QueryDecodeContext,\n });\n\n return parsed ?? new Query({});\n}\n\n/**\n * Append server-derived conditions (a route realm, an owner scope, ...)\n * onto a decoded query by AND-wrapping its filter tree. The wrap makes\n * the appended scope non-displaceable: unlike a filters merge (per-field\n * replace, flat-root-AND restriction), a client-sent condition on the\n * same field intersects with the scope instead of replacing it, and\n * compound client trees (`or(...)`) are preserved as-is. Same guarantee\n * class as a mandatory `andWhere` at the repository — expressed once in\n * the IR. Appended conditions do not pass through `decodeQuery`, so the\n * schema allow-lists do not constrain them (server-derived context).\n *\n * Immutable: returns a new `Query` whose filters node is the\n * AND-wrapped successor (`IFilters.and`); every other parameter node is\n * carried over **by reference**, so the input query stays untouched and\n * nothing is copied. The node enumeration mirrors rapiq's\n * `QueryContext` — keep it in sync when the IR gains a parameter.\n */\nexport function appendQueryConditions(query: IQuery, ...conditions: ICondition[]) : Query {\n return new Query({\n fields: query.fields,\n filters: query.filters.and(...conditions),\n relations: query.relations,\n pagination: query.pagination,\n sorts: query.sorts,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDA,MAAa4B,iBAAiB,IAAI1B,eAAAA;AAElC,MAAM2B,UAA0B;CAC5BzB;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;CACAC;AACH;AAED,KAAK,MAAMG,UAAUD,SACjBD,eAAeG,IAAID,MAAAA;;;;;GAQvB,MAAaE,aAAahC,eAAe4B,cAAAA;;;;;;;;;;;;;;;GAiBzC,eAAsBK,YAClBC,OACAC,SAAmC;CAEnC,MAAMC,aAAajC,SAAS+B,KAAAA,KAAU,OAAOA,UAAU,WAAWA,QAAQ,CAAC;CAU3E,OAAOG,MARcL,WAAWM,YAAYF,YAAY;EAGpDN,QAAQK,QAAQL;EAChBS,YAAYJ,QAAQI;EACpBC,SAAS,EAAEC,OAAON,QAAQM,MAAM;CACpC,CAAA,KAEiB,IAAIxC,MAAM,CAAC,CAAA;AAChC;;;;;;;;;;;;;;;;;GAmBA,SAAgByC,sBAAsBC,OAAe,GAAGC,YAAwB;CAC5E,OAAO,IAAI3C,MAAM;EACb4C,QAAQF,MAAME;EACdC,SAASH,MAAMG,QAAQC,IAAG,GAAIH,UAAAA;EAC9BI,WAAWL,MAAMK;EACjBC,YAAYN,MAAMM;EAClBC,OAAOP,MAAMO;CACjB,CAAA;AACJ"}
|