@portaidentity/server 1.7.0
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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/dist/applications/cache.d.ts +64 -0
- package/dist/applications/cache.d.ts.map +1 -0
- package/dist/applications/cache.js +161 -0
- package/dist/applications/cache.js.map +1 -0
- package/dist/applications/errors.d.ts +25 -0
- package/dist/applications/errors.d.ts.map +1 -0
- package/dist/applications/errors.js +31 -0
- package/dist/applications/errors.js.map +1 -0
- package/dist/applications/index.d.ts +17 -0
- package/dist/applications/index.d.ts.map +1 -0
- package/dist/applications/index.js +19 -0
- package/dist/applications/index.js.map +1 -0
- package/dist/applications/repository.d.ts +184 -0
- package/dist/applications/repository.d.ts.map +1 -0
- package/dist/applications/repository.js +367 -0
- package/dist/applications/repository.js.map +1 -0
- package/dist/applications/service.d.ts +160 -0
- package/dist/applications/service.d.ts.map +1 -0
- package/dist/applications/service.js +388 -0
- package/dist/applications/service.js.map +1 -0
- package/dist/applications/slugs.d.ts +61 -0
- package/dist/applications/slugs.d.ts.map +1 -0
- package/dist/applications/slugs.js +115 -0
- package/dist/applications/slugs.js.map +1 -0
- package/dist/applications/types.d.ts +129 -0
- package/dist/applications/types.d.ts.map +1 -0
- package/dist/applications/types.js +62 -0
- package/dist/applications/types.js.map +1 -0
- package/dist/auth/csrf.d.ts +71 -0
- package/dist/auth/csrf.d.ts.map +1 -0
- package/dist/auth/csrf.js +112 -0
- package/dist/auth/csrf.js.map +1 -0
- package/dist/auth/email-renderer.d.ts +37 -0
- package/dist/auth/email-renderer.d.ts.map +1 -0
- package/dist/auth/email-renderer.js +116 -0
- package/dist/auth/email-renderer.js.map +1 -0
- package/dist/auth/email-service.d.ts +154 -0
- package/dist/auth/email-service.d.ts.map +1 -0
- package/dist/auth/email-service.js +415 -0
- package/dist/auth/email-service.js.map +1 -0
- package/dist/auth/email-transport.d.ts +65 -0
- package/dist/auth/email-transport.d.ts.map +1 -0
- package/dist/auth/email-transport.js +82 -0
- package/dist/auth/email-transport.js.map +1 -0
- package/dist/auth/i18n.d.ts +81 -0
- package/dist/auth/i18n.d.ts.map +1 -0
- package/dist/auth/i18n.js +395 -0
- package/dist/auth/i18n.js.map +1 -0
- package/dist/auth/index.d.ts +28 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +31 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/interaction-authority.d.ts +39 -0
- package/dist/auth/interaction-authority.d.ts.map +1 -0
- package/dist/auth/interaction-authority.js +30 -0
- package/dist/auth/interaction-authority.js.map +1 -0
- package/dist/auth/magic-link-session.d.ts +81 -0
- package/dist/auth/magic-link-session.d.ts.map +1 -0
- package/dist/auth/magic-link-session.js +183 -0
- package/dist/auth/magic-link-session.js.map +1 -0
- package/dist/auth/rate-limiter.d.ts +143 -0
- package/dist/auth/rate-limiter.d.ts.map +1 -0
- package/dist/auth/rate-limiter.js +220 -0
- package/dist/auth/rate-limiter.js.map +1 -0
- package/dist/auth/recovery-crypto.d.ts +34 -0
- package/dist/auth/recovery-crypto.d.ts.map +1 -0
- package/dist/auth/recovery-crypto.js +103 -0
- package/dist/auth/recovery-crypto.js.map +1 -0
- package/dist/auth/recovery-job-processor.d.ts +24 -0
- package/dist/auth/recovery-job-processor.d.ts.map +1 -0
- package/dist/auth/recovery-job-processor.js +123 -0
- package/dist/auth/recovery-job-processor.js.map +1 -0
- package/dist/auth/recovery-job-repository.d.ts +219 -0
- package/dist/auth/recovery-job-repository.d.ts.map +1 -0
- package/dist/auth/recovery-job-repository.js +340 -0
- package/dist/auth/recovery-job-repository.js.map +1 -0
- package/dist/auth/recovery-service.d.ts +27 -0
- package/dist/auth/recovery-service.d.ts.map +1 -0
- package/dist/auth/recovery-service.js +53 -0
- package/dist/auth/recovery-service.js.map +1 -0
- package/dist/auth/recovery-worker.d.ts +158 -0
- package/dist/auth/recovery-worker.d.ts.map +1 -0
- package/dist/auth/recovery-worker.js +306 -0
- package/dist/auth/recovery-worker.js.map +1 -0
- package/dist/auth/template-engine.d.ts +134 -0
- package/dist/auth/template-engine.d.ts.map +1 -0
- package/dist/auth/template-engine.js +225 -0
- package/dist/auth/template-engine.js.map +1 -0
- package/dist/auth/token-repository.d.ts +238 -0
- package/dist/auth/token-repository.d.ts.map +1 -0
- package/dist/auth/token-repository.js +475 -0
- package/dist/auth/token-repository.js.map +1 -0
- package/dist/auth/tokens.d.ts +45 -0
- package/dist/auth/tokens.d.ts.map +1 -0
- package/dist/auth/tokens.js +51 -0
- package/dist/auth/tokens.js.map +1 -0
- package/dist/cli/bootstrap.d.ts +55 -0
- package/dist/cli/bootstrap.d.ts.map +1 -0
- package/dist/cli/bootstrap.js +90 -0
- package/dist/cli/bootstrap.js.map +1 -0
- package/dist/cli/commands/health.d.ts +20 -0
- package/dist/cli/commands/health.d.ts.map +1 -0
- package/dist/cli/commands/health.js +80 -0
- package/dist/cli/commands/health.js.map +1 -0
- package/dist/cli/commands/init.d.ts +48 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +349 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +19 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +88 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/seed.d.ts +19 -0
- package/dist/cli/commands/seed.d.ts.map +1 -0
- package/dist/cli/commands/seed.js +71 -0
- package/dist/cli/commands/seed.js.map +1 -0
- package/dist/cli/commands/user-2fa.d.ts +29 -0
- package/dist/cli/commands/user-2fa.d.ts.map +1 -0
- package/dist/cli/commands/user-2fa.js +113 -0
- package/dist/cli/commands/user-2fa.js.map +1 -0
- package/dist/cli/error-handler.d.ts +31 -0
- package/dist/cli/error-handler.d.ts.map +1 -0
- package/dist/cli/error-handler.js +65 -0
- package/dist/cli/error-handler.js.map +1 -0
- package/dist/cli/index.d.ts +48 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +99 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/output.d.ts +94 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +124 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/prompt.d.ts +48 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +96 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/clients/cache.d.ts +63 -0
- package/dist/clients/cache.d.ts.map +1 -0
- package/dist/clients/cache.js +160 -0
- package/dist/clients/cache.js.map +1 -0
- package/dist/clients/crypto.d.ts +69 -0
- package/dist/clients/crypto.d.ts.map +1 -0
- package/dist/clients/crypto.js +83 -0
- package/dist/clients/crypto.js.map +1 -0
- package/dist/clients/errors.d.ts +27 -0
- package/dist/clients/errors.d.ts.map +1 -0
- package/dist/clients/errors.js +33 -0
- package/dist/clients/errors.js.map +1 -0
- package/dist/clients/index.d.ts +19 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +23 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/repository.d.ts +161 -0
- package/dist/clients/repository.d.ts.map +1 -0
- package/dist/clients/repository.js +318 -0
- package/dist/clients/repository.js.map +1 -0
- package/dist/clients/resolve-login-methods.d.ts +74 -0
- package/dist/clients/resolve-login-methods.d.ts.map +1 -0
- package/dist/clients/resolve-login-methods.js +68 -0
- package/dist/clients/resolve-login-methods.js.map +1 -0
- package/dist/clients/secret-repository.d.ts +109 -0
- package/dist/clients/secret-repository.d.ts.map +1 -0
- package/dist/clients/secret-repository.js +166 -0
- package/dist/clients/secret-repository.js.map +1 -0
- package/dist/clients/secret-service.d.ts +87 -0
- package/dist/clients/secret-service.d.ts.map +1 -0
- package/dist/clients/secret-service.js +204 -0
- package/dist/clients/secret-service.js.map +1 -0
- package/dist/clients/service.d.ts +158 -0
- package/dist/clients/service.d.ts.map +1 -0
- package/dist/clients/service.js +523 -0
- package/dist/clients/service.js.map +1 -0
- package/dist/clients/types.d.ts +214 -0
- package/dist/clients/types.d.ts.map +1 -0
- package/dist/clients/types.js +77 -0
- package/dist/clients/types.js.map +1 -0
- package/dist/clients/validators.d.ts +87 -0
- package/dist/clients/validators.d.ts.map +1 -0
- package/dist/clients/validators.js +164 -0
- package/dist/clients/validators.js.map +1 -0
- package/dist/config/index.d.ts +23 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +52 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +35 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +167 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/custom-claims/cache.d.ts +48 -0
- package/dist/custom-claims/cache.d.ts.map +1 -0
- package/dist/custom-claims/cache.js +122 -0
- package/dist/custom-claims/cache.js.map +1 -0
- package/dist/custom-claims/errors.d.ts +25 -0
- package/dist/custom-claims/errors.d.ts.map +1 -0
- package/dist/custom-claims/errors.js +31 -0
- package/dist/custom-claims/errors.js.map +1 -0
- package/dist/custom-claims/index.d.ts +14 -0
- package/dist/custom-claims/index.d.ts.map +1 -0
- package/dist/custom-claims/index.js +17 -0
- package/dist/custom-claims/index.js.map +1 -0
- package/dist/custom-claims/repository.d.ts +147 -0
- package/dist/custom-claims/repository.d.ts.map +1 -0
- package/dist/custom-claims/repository.js +338 -0
- package/dist/custom-claims/repository.js.map +1 -0
- package/dist/custom-claims/service.d.ts +129 -0
- package/dist/custom-claims/service.d.ts.map +1 -0
- package/dist/custom-claims/service.js +296 -0
- package/dist/custom-claims/service.js.map +1 -0
- package/dist/custom-claims/types.d.ts +132 -0
- package/dist/custom-claims/types.d.ts.map +1 -0
- package/dist/custom-claims/types.js +61 -0
- package/dist/custom-claims/types.js.map +1 -0
- package/dist/custom-claims/validators.d.ts +61 -0
- package/dist/custom-claims/validators.d.ts.map +1 -0
- package/dist/custom-claims/validators.js +136 -0
- package/dist/custom-claims/validators.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/admin-permissions.d.ts +147 -0
- package/dist/lib/admin-permissions.d.ts.map +1 -0
- package/dist/lib/admin-permissions.js +261 -0
- package/dist/lib/admin-permissions.js.map +1 -0
- package/dist/lib/audit-log.d.ts +45 -0
- package/dist/lib/audit-log.d.ts.map +1 -0
- package/dist/lib/audit-log.js +79 -0
- package/dist/lib/audit-log.js.map +1 -0
- package/dist/lib/branding-assets.d.ts +47 -0
- package/dist/lib/branding-assets.d.ts.map +1 -0
- package/dist/lib/branding-assets.js +93 -0
- package/dist/lib/branding-assets.js.map +1 -0
- package/dist/lib/bulk-operations.d.ts +54 -0
- package/dist/lib/bulk-operations.d.ts.map +1 -0
- package/dist/lib/bulk-operations.js +201 -0
- package/dist/lib/bulk-operations.js.map +1 -0
- package/dist/lib/cursor.d.ts +110 -0
- package/dist/lib/cursor.d.ts.map +1 -0
- package/dist/lib/cursor.js +115 -0
- package/dist/lib/cursor.js.map +1 -0
- package/dist/lib/data-export.d.ts +67 -0
- package/dist/lib/data-export.d.ts.map +1 -0
- package/dist/lib/data-export.js +272 -0
- package/dist/lib/data-export.js.map +1 -0
- package/dist/lib/data-import-plan.d.ts +50 -0
- package/dist/lib/data-import-plan.d.ts.map +1 -0
- package/dist/lib/data-import-plan.js +235 -0
- package/dist/lib/data-import-plan.js.map +1 -0
- package/dist/lib/data-import.d.ts +276 -0
- package/dist/lib/data-import.d.ts.map +1 -0
- package/dist/lib/data-import.js +1694 -0
- package/dist/lib/data-import.js.map +1 -0
- package/dist/lib/database.d.ts +22 -0
- package/dist/lib/database.d.ts.map +1 -0
- package/dist/lib/database.js +103 -0
- package/dist/lib/database.js.map +1 -0
- package/dist/lib/entity-history.d.ts +52 -0
- package/dist/lib/entity-history.d.ts.map +1 -0
- package/dist/lib/entity-history.js +121 -0
- package/dist/lib/entity-history.js.map +1 -0
- package/dist/lib/etag.d.ts +92 -0
- package/dist/lib/etag.d.ts.map +1 -0
- package/dist/lib/etag.js +155 -0
- package/dist/lib/etag.js.map +1 -0
- package/dist/lib/image-validator.d.ts +44 -0
- package/dist/lib/image-validator.d.ts.map +1 -0
- package/dist/lib/image-validator.js +204 -0
- package/dist/lib/image-validator.js.map +1 -0
- package/dist/lib/logger.d.ts +15 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +84 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/migrator.d.ts +14 -0
- package/dist/lib/migrator.d.ts.map +1 -0
- package/dist/lib/migrator.js +34 -0
- package/dist/lib/migrator.js.map +1 -0
- package/dist/lib/redis.d.ts +5 -0
- package/dist/lib/redis.d.ts.map +1 -0
- package/dist/lib/redis.js +29 -0
- package/dist/lib/redis.js.map +1 -0
- package/dist/lib/runtime-paths.d.ts +38 -0
- package/dist/lib/runtime-paths.d.ts.map +1 -0
- package/dist/lib/runtime-paths.js +50 -0
- package/dist/lib/runtime-paths.js.map +1 -0
- package/dist/lib/session-tracking.d.ts +81 -0
- package/dist/lib/session-tracking.d.ts.map +1 -0
- package/dist/lib/session-tracking.js +145 -0
- package/dist/lib/session-tracking.js.map +1 -0
- package/dist/lib/signing-key-crypto.d.ts +53 -0
- package/dist/lib/signing-key-crypto.d.ts.map +1 -0
- package/dist/lib/signing-key-crypto.js +108 -0
- package/dist/lib/signing-key-crypto.js.map +1 -0
- package/dist/lib/signing-keys.d.ts +141 -0
- package/dist/lib/signing-keys.d.ts.map +1 -0
- package/dist/lib/signing-keys.js +206 -0
- package/dist/lib/signing-keys.js.map +1 -0
- package/dist/lib/stats.d.ts +83 -0
- package/dist/lib/stats.d.ts.map +1 -0
- package/dist/lib/stats.js +187 -0
- package/dist/lib/stats.js.map +1 -0
- package/dist/lib/super-admin-protection.d.ts +69 -0
- package/dist/lib/super-admin-protection.d.ts.map +1 -0
- package/dist/lib/super-admin-protection.js +102 -0
- package/dist/lib/super-admin-protection.js.map +1 -0
- package/dist/lib/system-config.d.ts +79 -0
- package/dist/lib/system-config.d.ts.map +1 -0
- package/dist/lib/system-config.js +159 -0
- package/dist/lib/system-config.js.map +1 -0
- package/dist/middleware/admin-auth.d.ts +100 -0
- package/dist/middleware/admin-auth.d.ts.map +1 -0
- package/dist/middleware/admin-auth.js +241 -0
- package/dist/middleware/admin-auth.js.map +1 -0
- package/dist/middleware/admin-cors.d.ts +41 -0
- package/dist/middleware/admin-cors.d.ts.map +1 -0
- package/dist/middleware/admin-cors.js +83 -0
- package/dist/middleware/admin-cors.js.map +1 -0
- package/dist/middleware/admin-mutation-audit.d.ts +9 -0
- package/dist/middleware/admin-mutation-audit.d.ts.map +1 -0
- package/dist/middleware/admin-mutation-audit.js +76 -0
- package/dist/middleware/admin-mutation-audit.js.map +1 -0
- package/dist/middleware/admin-rate-limiter.d.ts +56 -0
- package/dist/middleware/admin-rate-limiter.d.ts.map +1 -0
- package/dist/middleware/admin-rate-limiter.js +97 -0
- package/dist/middleware/admin-rate-limiter.js.map +1 -0
- package/dist/middleware/client-secret-hash.d.ts +34 -0
- package/dist/middleware/client-secret-hash.d.ts.map +1 -0
- package/dist/middleware/client-secret-hash.js +74 -0
- package/dist/middleware/client-secret-hash.js.map +1 -0
- package/dist/middleware/error-handler.d.ts +3 -0
- package/dist/middleware/error-handler.d.ts.map +1 -0
- package/dist/middleware/error-handler.js +93 -0
- package/dist/middleware/error-handler.js.map +1 -0
- package/dist/middleware/health.d.ts +3 -0
- package/dist/middleware/health.d.ts.map +1 -0
- package/dist/middleware/health.js +35 -0
- package/dist/middleware/health.js.map +1 -0
- package/dist/middleware/metrics.d.ts +40 -0
- package/dist/middleware/metrics.d.ts.map +1 -0
- package/dist/middleware/metrics.js +75 -0
- package/dist/middleware/metrics.js.map +1 -0
- package/dist/middleware/oidc-client-tenant.d.ts +37 -0
- package/dist/middleware/oidc-client-tenant.d.ts.map +1 -0
- package/dist/middleware/oidc-client-tenant.js +156 -0
- package/dist/middleware/oidc-client-tenant.js.map +1 -0
- package/dist/middleware/oidc-cors.d.ts +33 -0
- package/dist/middleware/oidc-cors.d.ts.map +1 -0
- package/dist/middleware/oidc-cors.js +68 -0
- package/dist/middleware/oidc-cors.js.map +1 -0
- package/dist/middleware/oidc-preflight-cors.d.ts +54 -0
- package/dist/middleware/oidc-preflight-cors.d.ts.map +1 -0
- package/dist/middleware/oidc-preflight-cors.js +267 -0
- package/dist/middleware/oidc-preflight-cors.js.map +1 -0
- package/dist/middleware/prompt-login-reset.d.ts +103 -0
- package/dist/middleware/prompt-login-reset.d.ts.map +1 -0
- package/dist/middleware/prompt-login-reset.js +204 -0
- package/dist/middleware/prompt-login-reset.js.map +1 -0
- package/dist/middleware/ready.d.ts +23 -0
- package/dist/middleware/ready.d.ts.map +1 -0
- package/dist/middleware/ready.js +60 -0
- package/dist/middleware/ready.js.map +1 -0
- package/dist/middleware/request-logger.d.ts +27 -0
- package/dist/middleware/request-logger.d.ts.map +1 -0
- package/dist/middleware/request-logger.js +46 -0
- package/dist/middleware/request-logger.js.map +1 -0
- package/dist/middleware/require-permission.d.ts +28 -0
- package/dist/middleware/require-permission.d.ts.map +1 -0
- package/dist/middleware/require-permission.js +63 -0
- package/dist/middleware/require-permission.js.map +1 -0
- package/dist/middleware/require-user-organization.d.ts +18 -0
- package/dist/middleware/require-user-organization.d.ts.map +1 -0
- package/dist/middleware/require-user-organization.js +53 -0
- package/dist/middleware/require-user-organization.js.map +1 -0
- package/dist/middleware/root-page.d.ts +62 -0
- package/dist/middleware/root-page.d.ts.map +1 -0
- package/dist/middleware/root-page.js +134 -0
- package/dist/middleware/root-page.js.map +1 -0
- package/dist/middleware/security-headers.d.ts +98 -0
- package/dist/middleware/security-headers.d.ts.map +1 -0
- package/dist/middleware/security-headers.js +159 -0
- package/dist/middleware/security-headers.js.map +1 -0
- package/dist/middleware/tenant-resolver.d.ts +37 -0
- package/dist/middleware/tenant-resolver.d.ts.map +1 -0
- package/dist/middleware/tenant-resolver.js +71 -0
- package/dist/middleware/tenant-resolver.js.map +1 -0
- package/dist/middleware/token-rate-limiter.d.ts +89 -0
- package/dist/middleware/token-rate-limiter.d.ts.map +1 -0
- package/dist/middleware/token-rate-limiter.js +189 -0
- package/dist/middleware/token-rate-limiter.js.map +1 -0
- package/dist/oidc/account-finder.d.ts +52 -0
- package/dist/oidc/account-finder.d.ts.map +1 -0
- package/dist/oidc/account-finder.js +134 -0
- package/dist/oidc/account-finder.js.map +1 -0
- package/dist/oidc/adapter-factory.d.ts +90 -0
- package/dist/oidc/adapter-factory.d.ts.map +1 -0
- package/dist/oidc/adapter-factory.js +165 -0
- package/dist/oidc/adapter-factory.js.map +1 -0
- package/dist/oidc/configuration.d.ts +155 -0
- package/dist/oidc/configuration.d.ts.map +1 -0
- package/dist/oidc/configuration.js +531 -0
- package/dist/oidc/configuration.js.map +1 -0
- package/dist/oidc/postgres-adapter.d.ts +159 -0
- package/dist/oidc/postgres-adapter.d.ts.map +1 -0
- package/dist/oidc/postgres-adapter.js +222 -0
- package/dist/oidc/postgres-adapter.js.map +1 -0
- package/dist/oidc/protocol-security-observer.d.ts +38 -0
- package/dist/oidc/protocol-security-observer.d.ts.map +1 -0
- package/dist/oidc/protocol-security-observer.js +93 -0
- package/dist/oidc/protocol-security-observer.js.map +1 -0
- package/dist/oidc/provider.d.ts +37 -0
- package/dist/oidc/provider.d.ts.map +1 -0
- package/dist/oidc/provider.js +71 -0
- package/dist/oidc/provider.js.map +1 -0
- package/dist/oidc/redis-adapter.d.ts +140 -0
- package/dist/oidc/redis-adapter.d.ts.map +1 -0
- package/dist/oidc/redis-adapter.js +344 -0
- package/dist/oidc/redis-adapter.js.map +1 -0
- package/dist/organizations/cache.d.ts +60 -0
- package/dist/organizations/cache.d.ts.map +1 -0
- package/dist/organizations/cache.js +157 -0
- package/dist/organizations/cache.js.map +1 -0
- package/dist/organizations/errors.d.ts +25 -0
- package/dist/organizations/errors.d.ts.map +1 -0
- package/dist/organizations/errors.js +31 -0
- package/dist/organizations/errors.js.map +1 -0
- package/dist/organizations/index.d.ts +15 -0
- package/dist/organizations/index.d.ts.map +1 -0
- package/dist/organizations/index.js +15 -0
- package/dist/organizations/index.js.map +1 -0
- package/dist/organizations/repository.d.ts +183 -0
- package/dist/organizations/repository.d.ts.map +1 -0
- package/dist/organizations/repository.js +354 -0
- package/dist/organizations/repository.js.map +1 -0
- package/dist/organizations/service.d.ts +168 -0
- package/dist/organizations/service.d.ts.map +1 -0
- package/dist/organizations/service.js +511 -0
- package/dist/organizations/service.js.map +1 -0
- package/dist/organizations/slugs.d.ts +57 -0
- package/dist/organizations/slugs.d.ts.map +1 -0
- package/dist/organizations/slugs.js +130 -0
- package/dist/organizations/slugs.js.map +1 -0
- package/dist/organizations/types.d.ts +146 -0
- package/dist/organizations/types.d.ts.map +1 -0
- package/dist/organizations/types.js +49 -0
- package/dist/organizations/types.js.map +1 -0
- package/dist/rbac/cache.d.ts +110 -0
- package/dist/rbac/cache.d.ts.map +1 -0
- package/dist/rbac/cache.js +271 -0
- package/dist/rbac/cache.js.map +1 -0
- package/dist/rbac/errors.d.ts +34 -0
- package/dist/rbac/errors.d.ts.map +1 -0
- package/dist/rbac/errors.js +43 -0
- package/dist/rbac/errors.js.map +1 -0
- package/dist/rbac/index.d.ts +17 -0
- package/dist/rbac/index.d.ts.map +1 -0
- package/dist/rbac/index.js +21 -0
- package/dist/rbac/index.js.map +1 -0
- package/dist/rbac/mapping-repository.d.ts +121 -0
- package/dist/rbac/mapping-repository.d.ts.map +1 -0
- package/dist/rbac/mapping-repository.js +224 -0
- package/dist/rbac/mapping-repository.js.map +1 -0
- package/dist/rbac/permission-repository.d.ts +100 -0
- package/dist/rbac/permission-repository.d.ts.map +1 -0
- package/dist/rbac/permission-repository.js +190 -0
- package/dist/rbac/permission-repository.js.map +1 -0
- package/dist/rbac/permission-service.d.ts +85 -0
- package/dist/rbac/permission-service.d.ts.map +1 -0
- package/dist/rbac/permission-service.js +179 -0
- package/dist/rbac/permission-service.js.map +1 -0
- package/dist/rbac/role-repository.d.ts +104 -0
- package/dist/rbac/role-repository.d.ts.map +1 -0
- package/dist/rbac/role-repository.js +202 -0
- package/dist/rbac/role-repository.js.map +1 -0
- package/dist/rbac/role-service.d.ts +111 -0
- package/dist/rbac/role-service.d.ts.map +1 -0
- package/dist/rbac/role-service.js +256 -0
- package/dist/rbac/role-service.js.map +1 -0
- package/dist/rbac/slugs.d.ts +116 -0
- package/dist/rbac/slugs.d.ts.map +1 -0
- package/dist/rbac/slugs.js +178 -0
- package/dist/rbac/slugs.js.map +1 -0
- package/dist/rbac/types.d.ts +187 -0
- package/dist/rbac/types.d.ts.map +1 -0
- package/dist/rbac/types.js +75 -0
- package/dist/rbac/types.js.map +1 -0
- package/dist/rbac/user-role-service.d.ts +101 -0
- package/dist/rbac/user-role-service.d.ts.map +1 -0
- package/dist/rbac/user-role-service.js +166 -0
- package/dist/rbac/user-role-service.js.map +1 -0
- package/dist/routes/applications.d.ts +40 -0
- package/dist/routes/applications.d.ts.map +1 -0
- package/dist/routes/applications.js +284 -0
- package/dist/routes/applications.js.map +1 -0
- package/dist/routes/audit.d.ts +31 -0
- package/dist/routes/audit.d.ts.map +1 -0
- package/dist/routes/audit.js +140 -0
- package/dist/routes/audit.js.map +1 -0
- package/dist/routes/branding.d.ts +17 -0
- package/dist/routes/branding.d.ts.map +1 -0
- package/dist/routes/branding.js +104 -0
- package/dist/routes/branding.js.map +1 -0
- package/dist/routes/bulk.d.ts +37 -0
- package/dist/routes/bulk.d.ts.map +1 -0
- package/dist/routes/bulk.js +94 -0
- package/dist/routes/bulk.js.map +1 -0
- package/dist/routes/clients.d.ts +44 -0
- package/dist/routes/clients.d.ts.map +1 -0
- package/dist/routes/clients.js +353 -0
- package/dist/routes/clients.js.map +1 -0
- package/dist/routes/config.d.ts +35 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +115 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/custom-claims.d.ts +38 -0
- package/dist/routes/custom-claims.d.ts.map +1 -0
- package/dist/routes/custom-claims.js +208 -0
- package/dist/routes/custom-claims.js.map +1 -0
- package/dist/routes/exports.d.ts +21 -0
- package/dist/routes/exports.d.ts.map +1 -0
- package/dist/routes/exports.js +98 -0
- package/dist/routes/exports.js.map +1 -0
- package/dist/routes/imports.d.ts +18 -0
- package/dist/routes/imports.d.ts.map +1 -0
- package/dist/routes/imports.js +72 -0
- package/dist/routes/imports.js.map +1 -0
- package/dist/routes/interactions.d.ts +111 -0
- package/dist/routes/interactions.d.ts.map +1 -0
- package/dist/routes/interactions.js +1074 -0
- package/dist/routes/interactions.js.map +1 -0
- package/dist/routes/invitation.d.ts +31 -0
- package/dist/routes/invitation.d.ts.map +1 -0
- package/dist/routes/invitation.js +342 -0
- package/dist/routes/invitation.js.map +1 -0
- package/dist/routes/keys.d.ts +28 -0
- package/dist/routes/keys.d.ts.map +1 -0
- package/dist/routes/keys.js +91 -0
- package/dist/routes/keys.js.map +1 -0
- package/dist/routes/magic-link.d.ts +43 -0
- package/dist/routes/magic-link.d.ts.map +1 -0
- package/dist/routes/magic-link.js +264 -0
- package/dist/routes/magic-link.js.map +1 -0
- package/dist/routes/organizations.d.ts +38 -0
- package/dist/routes/organizations.d.ts.map +1 -0
- package/dist/routes/organizations.js +347 -0
- package/dist/routes/organizations.js.map +1 -0
- package/dist/routes/password-reset.d.ts +65 -0
- package/dist/routes/password-reset.d.ts.map +1 -0
- package/dist/routes/password-reset.js +493 -0
- package/dist/routes/password-reset.js.map +1 -0
- package/dist/routes/permissions.d.ts +33 -0
- package/dist/routes/permissions.d.ts.map +1 -0
- package/dist/routes/permissions.js +166 -0
- package/dist/routes/permissions.js.map +1 -0
- package/dist/routes/roles.d.ts +37 -0
- package/dist/routes/roles.d.ts.map +1 -0
- package/dist/routes/roles.js +222 -0
- package/dist/routes/roles.js.map +1 -0
- package/dist/routes/sessions.d.ts +37 -0
- package/dist/routes/sessions.d.ts.map +1 -0
- package/dist/routes/sessions.js +121 -0
- package/dist/routes/sessions.js.map +1 -0
- package/dist/routes/stats.d.ts +28 -0
- package/dist/routes/stats.d.ts.map +1 -0
- package/dist/routes/stats.js +65 -0
- package/dist/routes/stats.js.map +1 -0
- package/dist/routes/two-factor-admin.d.ts +54 -0
- package/dist/routes/two-factor-admin.d.ts.map +1 -0
- package/dist/routes/two-factor-admin.js +344 -0
- package/dist/routes/two-factor-admin.js.map +1 -0
- package/dist/routes/two-factor.d.ts +31 -0
- package/dist/routes/two-factor.d.ts.map +1 -0
- package/dist/routes/two-factor.js +595 -0
- package/dist/routes/two-factor.js.map +1 -0
- package/dist/routes/user-roles.d.ts +33 -0
- package/dist/routes/user-roles.d.ts.map +1 -0
- package/dist/routes/user-roles.js +129 -0
- package/dist/routes/user-roles.js.map +1 -0
- package/dist/routes/users.d.ts +61 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/users.js +868 -0
- package/dist/routes/users.js.map +1 -0
- package/dist/security/decision-context.d.ts +52 -0
- package/dist/security/decision-context.d.ts.map +1 -0
- package/dist/security/decision-context.js +150 -0
- package/dist/security/decision-context.js.map +1 -0
- package/dist/security/decision-event.d.ts +128 -0
- package/dist/security/decision-event.d.ts.map +1 -0
- package/dist/security/decision-event.js +225 -0
- package/dist/security/decision-event.js.map +1 -0
- package/dist/security/transport-decision.d.ts +6 -0
- package/dist/security/transport-decision.d.ts.map +1 -0
- package/dist/security/transport-decision.js +37 -0
- package/dist/security/transport-decision.js.map +1 -0
- package/dist/server.d.ts +50 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +491 -0
- package/dist/server.js.map +1 -0
- package/dist/two-factor/cache.d.ts +47 -0
- package/dist/two-factor/cache.d.ts.map +1 -0
- package/dist/two-factor/cache.js +122 -0
- package/dist/two-factor/cache.js.map +1 -0
- package/dist/two-factor/crypto.d.ts +41 -0
- package/dist/two-factor/crypto.d.ts.map +1 -0
- package/dist/two-factor/crypto.js +94 -0
- package/dist/two-factor/crypto.js.map +1 -0
- package/dist/two-factor/errors.d.ts +82 -0
- package/dist/two-factor/errors.d.ts.map +1 -0
- package/dist/two-factor/errors.js +112 -0
- package/dist/two-factor/errors.js.map +1 -0
- package/dist/two-factor/index.d.ts +18 -0
- package/dist/two-factor/index.d.ts.map +1 -0
- package/dist/two-factor/index.js +25 -0
- package/dist/two-factor/index.js.map +1 -0
- package/dist/two-factor/otp.d.ts +43 -0
- package/dist/two-factor/otp.d.ts.map +1 -0
- package/dist/two-factor/otp.js +57 -0
- package/dist/two-factor/otp.js.map +1 -0
- package/dist/two-factor/recovery.d.ts +45 -0
- package/dist/two-factor/recovery.d.ts.map +1 -0
- package/dist/two-factor/recovery.js +104 -0
- package/dist/two-factor/recovery.js.map +1 -0
- package/dist/two-factor/repository.d.ts +156 -0
- package/dist/two-factor/repository.d.ts.map +1 -0
- package/dist/two-factor/repository.js +251 -0
- package/dist/two-factor/repository.js.map +1 -0
- package/dist/two-factor/service.d.ts +232 -0
- package/dist/two-factor/service.d.ts.map +1 -0
- package/dist/two-factor/service.js +599 -0
- package/dist/two-factor/service.js.map +1 -0
- package/dist/two-factor/totp.d.ts +57 -0
- package/dist/two-factor/totp.d.ts.map +1 -0
- package/dist/two-factor/totp.js +96 -0
- package/dist/two-factor/totp.js.map +1 -0
- package/dist/two-factor/types.d.ts +152 -0
- package/dist/two-factor/types.d.ts.map +1 -0
- package/dist/two-factor/types.js +64 -0
- package/dist/two-factor/types.js.map +1 -0
- package/dist/users/cache.d.ts +49 -0
- package/dist/users/cache.d.ts.map +1 -0
- package/dist/users/cache.js +140 -0
- package/dist/users/cache.js.map +1 -0
- package/dist/users/claims.d.ts +67 -0
- package/dist/users/claims.d.ts.map +1 -0
- package/dist/users/claims.js +104 -0
- package/dist/users/claims.js.map +1 -0
- package/dist/users/errors.d.ts +25 -0
- package/dist/users/errors.d.ts.map +1 -0
- package/dist/users/errors.js +31 -0
- package/dist/users/errors.js.map +1 -0
- package/dist/users/gdpr.d.ts +110 -0
- package/dist/users/gdpr.d.ts.map +1 -0
- package/dist/users/gdpr.js +211 -0
- package/dist/users/gdpr.js.map +1 -0
- package/dist/users/index.d.ts +20 -0
- package/dist/users/index.d.ts.map +1 -0
- package/dist/users/index.js +19 -0
- package/dist/users/index.js.map +1 -0
- package/dist/users/password.d.ts +85 -0
- package/dist/users/password.d.ts.map +1 -0
- package/dist/users/password.js +138 -0
- package/dist/users/password.js.map +1 -0
- package/dist/users/repository.d.ts +263 -0
- package/dist/users/repository.d.ts.map +1 -0
- package/dist/users/repository.js +499 -0
- package/dist/users/repository.js.map +1 -0
- package/dist/users/service.d.ts +299 -0
- package/dist/users/service.d.ts.map +1 -0
- package/dist/users/service.js +698 -0
- package/dist/users/service.js.map +1 -0
- package/dist/users/types.d.ts +220 -0
- package/dist/users/types.d.ts.map +1 -0
- package/dist/users/types.js +77 -0
- package/dist/users/types.js.map +1 -0
- package/locales/default/en/common.json +10 -0
- package/locales/default/en/consent.json +13 -0
- package/locales/default/en/emails.json +17 -0
- package/locales/default/en/errors.json +21 -0
- package/locales/default/en/forgot-password.json +11 -0
- package/locales/default/en/invitation.json +18 -0
- package/locales/default/en/login.json +17 -0
- package/locales/default/en/logout.json +9 -0
- package/locales/default/en/magic-link.json +12 -0
- package/locales/default/en/reset-password.json +16 -0
- package/locales/default/en/two-factor.json +29 -0
- package/migrations/.gitkeep +0 -0
- package/migrations/001_extensions.sql +22 -0
- package/migrations/002_organizations.sql +43 -0
- package/migrations/003_applications.sql +50 -0
- package/migrations/004_clients.sql +74 -0
- package/migrations/005_users.sql +119 -0
- package/migrations/006_roles_permissions.sql +80 -0
- package/migrations/007_custom_claims.sql +55 -0
- package/migrations/008_config.sql +51 -0
- package/migrations/009_audit_log.sql +31 -0
- package/migrations/010_oidc_adapter.sql +34 -0
- package/migrations/011_seed.sql +53 -0
- package/migrations/012_two_factor.sql +88 -0
- package/migrations/013_client_secret_sha256.sql +22 -0
- package/migrations/014_login_methods.sql +34 -0
- package/migrations/015_signing_key_encryption.sql +20 -0
- package/migrations/016_failed_login_count.sql +27 -0
- package/migrations/017_audit_retention.sql +11 -0
- package/migrations/018_admin_api_enhancements.sql +78 -0
- package/migrations/019_invitation_details.sql +27 -0
- package/migrations/020_two_factor_admin_permission.sql +108 -0
- package/migrations/021_auth_recovery_jobs.sql +74 -0
- package/migrations/022_recovery_artifact_ownership.sql +25 -0
- package/migrations/023_magic_link_authority.sql +39 -0
- package/package.json +106 -0
- package/templates/default/emails/invitation.hbs +39 -0
- package/templates/default/emails/invitation.txt.hbs +18 -0
- package/templates/default/emails/magic-link.hbs +30 -0
- package/templates/default/emails/magic-link.txt.hbs +11 -0
- package/templates/default/emails/otp-code.hbs +31 -0
- package/templates/default/emails/otp-code.txt.hbs +15 -0
- package/templates/default/emails/password-changed.hbs +24 -0
- package/templates/default/emails/password-changed.txt.hbs +7 -0
- package/templates/default/emails/password-reset.hbs +30 -0
- package/templates/default/emails/password-reset.txt.hbs +11 -0
- package/templates/default/emails/welcome.hbs +25 -0
- package/templates/default/emails/welcome.txt.hbs +9 -0
- package/templates/default/layouts/main.hbs +49 -0
- package/templates/default/pages/accept-invite.hbs +25 -0
- package/templates/default/pages/consent.hbs +27 -0
- package/templates/default/pages/error.hbs +15 -0
- package/templates/default/pages/forgot-password.hbs +21 -0
- package/templates/default/pages/invite-expired.hbs +6 -0
- package/templates/default/pages/invite-success.hbs +9 -0
- package/templates/default/pages/login.hbs +108 -0
- package/templates/default/pages/logout-success.hbs +5 -0
- package/templates/default/pages/logout.hbs +24 -0
- package/templates/default/pages/magic-link-sent.hbs +10 -0
- package/templates/default/pages/magic-link-success.hbs +17 -0
- package/templates/default/pages/reset-password.hbs +20 -0
- package/templates/default/pages/reset-success.hbs +9 -0
- package/templates/default/pages/two-factor-setup.hbs +65 -0
- package/templates/default/pages/two-factor-verify.hbs +77 -0
- package/templates/default/partials/flash-messages.hbs +10 -0
- package/templates/default/partials/footer.hbs +4 -0
- package/templates/default/partials/header.hbs +8 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI output helpers.
|
|
3
|
+
*
|
|
4
|
+
* Provides table and JSON formatters, color helpers, and common display
|
|
5
|
+
* utilities. All commands use these helpers for consistent output across
|
|
6
|
+
* the CLI.
|
|
7
|
+
*
|
|
8
|
+
* Table output uses cli-table3 with bold headers.
|
|
9
|
+
* JSON output uses formatted (2-space indent) JSON to stdout.
|
|
10
|
+
* Color helpers use chalk for success/warning/error messages.
|
|
11
|
+
*
|
|
12
|
+
* @module cli/output
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Format data as a table and print to stdout.
|
|
16
|
+
*
|
|
17
|
+
* Creates a cli-table3 instance with bold headers and prints each row.
|
|
18
|
+
* Used by list and show commands for human-readable output.
|
|
19
|
+
*
|
|
20
|
+
* @param headers - Column header labels (will be bold)
|
|
21
|
+
* @param rows - Array of row data (each row is an array of cell strings)
|
|
22
|
+
*/
|
|
23
|
+
export declare function printTable(headers: string[], rows: string[][]): void;
|
|
24
|
+
/**
|
|
25
|
+
* Print data as formatted JSON to stdout.
|
|
26
|
+
*
|
|
27
|
+
* Outputs a 2-space-indented JSON representation. Used when the --json
|
|
28
|
+
* flag is provided for machine-readable output.
|
|
29
|
+
*
|
|
30
|
+
* @param data - Any JSON-serializable value
|
|
31
|
+
*/
|
|
32
|
+
export declare function printJson(data: unknown): void;
|
|
33
|
+
/**
|
|
34
|
+
* Print a success message with green checkmark.
|
|
35
|
+
*
|
|
36
|
+
* @param message - The success message to display
|
|
37
|
+
*/
|
|
38
|
+
export declare function success(message: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Print a warning message with yellow icon.
|
|
41
|
+
*
|
|
42
|
+
* @param message - The warning message to display
|
|
43
|
+
*/
|
|
44
|
+
export declare function warn(message: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Print an error message with red X to stderr.
|
|
47
|
+
*
|
|
48
|
+
* Uses console.error so error messages go to stderr (fd 2),
|
|
49
|
+
* keeping stdout clean for piping and scripting.
|
|
50
|
+
*
|
|
51
|
+
* @param message - The error message to display
|
|
52
|
+
*/
|
|
53
|
+
export declare function error(message: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Print a "total" summary line below a table.
|
|
56
|
+
*
|
|
57
|
+
* Standard pattern: "Total: N <label>" displayed after list output.
|
|
58
|
+
*
|
|
59
|
+
* @param label - Plural noun describing the items (e.g., "organizations")
|
|
60
|
+
* @param count - Number of items
|
|
61
|
+
*/
|
|
62
|
+
export declare function printTotal(label: string, count: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Smart output: if --json, print JSON; otherwise, run the table renderer.
|
|
65
|
+
*
|
|
66
|
+
* Common pattern used by all list/show commands. The table renderer is
|
|
67
|
+
* a callback so we don't build table data when JSON mode is active.
|
|
68
|
+
*
|
|
69
|
+
* @param isJson - Whether JSON output is requested (from argv.json)
|
|
70
|
+
* @param tableRenderer - Function that renders table output when called
|
|
71
|
+
* @param jsonData - Data to output in JSON mode
|
|
72
|
+
*/
|
|
73
|
+
export declare function outputResult(isJson: boolean, tableRenderer: () => void, jsonData: unknown): void;
|
|
74
|
+
/**
|
|
75
|
+
* Return an ID string for table display.
|
|
76
|
+
*
|
|
77
|
+
* Previously truncated UUIDs to 8 characters, but full IDs are needed
|
|
78
|
+
* for copy-paste into subsequent CLI commands. Now returns the full string.
|
|
79
|
+
*
|
|
80
|
+
* @param id - The string to display
|
|
81
|
+
* @returns The full ID string
|
|
82
|
+
*/
|
|
83
|
+
export declare function truncateId(id: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Format a Date for display.
|
|
86
|
+
*
|
|
87
|
+
* Converts Date objects or ISO strings to YYYY-MM-DD format.
|
|
88
|
+
* Null/undefined values render as an em-dash for clean table display.
|
|
89
|
+
*
|
|
90
|
+
* @param date - Date object, ISO string, or null
|
|
91
|
+
* @returns Formatted date string or em-dash for null values
|
|
92
|
+
*/
|
|
93
|
+
export declare function formatDate(date: Date | string | null | undefined): string;
|
|
94
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAIpE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,OAAO,EACf,aAAa,EAAE,MAAM,IAAI,EACzB,QAAQ,EAAE,OAAO,GAChB,IAAI,CAMN;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIzE"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI output helpers.
|
|
3
|
+
*
|
|
4
|
+
* Provides table and JSON formatters, color helpers, and common display
|
|
5
|
+
* utilities. All commands use these helpers for consistent output across
|
|
6
|
+
* the CLI.
|
|
7
|
+
*
|
|
8
|
+
* Table output uses cli-table3 with bold headers.
|
|
9
|
+
* JSON output uses formatted (2-space indent) JSON to stdout.
|
|
10
|
+
* Color helpers use chalk for success/warning/error messages.
|
|
11
|
+
*
|
|
12
|
+
* @module cli/output
|
|
13
|
+
*/
|
|
14
|
+
import Table from 'cli-table3';
|
|
15
|
+
import chalk from 'chalk';
|
|
16
|
+
/**
|
|
17
|
+
* Format data as a table and print to stdout.
|
|
18
|
+
*
|
|
19
|
+
* Creates a cli-table3 instance with bold headers and prints each row.
|
|
20
|
+
* Used by list and show commands for human-readable output.
|
|
21
|
+
*
|
|
22
|
+
* @param headers - Column header labels (will be bold)
|
|
23
|
+
* @param rows - Array of row data (each row is an array of cell strings)
|
|
24
|
+
*/
|
|
25
|
+
export function printTable(headers, rows) {
|
|
26
|
+
const table = new Table({ head: headers.map((h) => chalk.bold(h)) });
|
|
27
|
+
rows.forEach((row) => table.push(row));
|
|
28
|
+
console.log(table.toString());
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Print data as formatted JSON to stdout.
|
|
32
|
+
*
|
|
33
|
+
* Outputs a 2-space-indented JSON representation. Used when the --json
|
|
34
|
+
* flag is provided for machine-readable output.
|
|
35
|
+
*
|
|
36
|
+
* @param data - Any JSON-serializable value
|
|
37
|
+
*/
|
|
38
|
+
export function printJson(data) {
|
|
39
|
+
console.log(JSON.stringify(data, null, 2));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Print a success message with green checkmark.
|
|
43
|
+
*
|
|
44
|
+
* @param message - The success message to display
|
|
45
|
+
*/
|
|
46
|
+
export function success(message) {
|
|
47
|
+
console.log(chalk.green('✅ ' + message));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Print a warning message with yellow icon.
|
|
51
|
+
*
|
|
52
|
+
* @param message - The warning message to display
|
|
53
|
+
*/
|
|
54
|
+
export function warn(message) {
|
|
55
|
+
console.log(chalk.yellow('⚠️ ' + message));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Print an error message with red X to stderr.
|
|
59
|
+
*
|
|
60
|
+
* Uses console.error so error messages go to stderr (fd 2),
|
|
61
|
+
* keeping stdout clean for piping and scripting.
|
|
62
|
+
*
|
|
63
|
+
* @param message - The error message to display
|
|
64
|
+
*/
|
|
65
|
+
export function error(message) {
|
|
66
|
+
console.error(chalk.red('❌ ' + message));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Print a "total" summary line below a table.
|
|
70
|
+
*
|
|
71
|
+
* Standard pattern: "Total: N <label>" displayed after list output.
|
|
72
|
+
*
|
|
73
|
+
* @param label - Plural noun describing the items (e.g., "organizations")
|
|
74
|
+
* @param count - Number of items
|
|
75
|
+
*/
|
|
76
|
+
export function printTotal(label, count) {
|
|
77
|
+
console.log(`\nTotal: ${count} ${label}`);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Smart output: if --json, print JSON; otherwise, run the table renderer.
|
|
81
|
+
*
|
|
82
|
+
* Common pattern used by all list/show commands. The table renderer is
|
|
83
|
+
* a callback so we don't build table data when JSON mode is active.
|
|
84
|
+
*
|
|
85
|
+
* @param isJson - Whether JSON output is requested (from argv.json)
|
|
86
|
+
* @param tableRenderer - Function that renders table output when called
|
|
87
|
+
* @param jsonData - Data to output in JSON mode
|
|
88
|
+
*/
|
|
89
|
+
export function outputResult(isJson, tableRenderer, jsonData) {
|
|
90
|
+
if (isJson) {
|
|
91
|
+
printJson(jsonData);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
tableRenderer();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Return an ID string for table display.
|
|
99
|
+
*
|
|
100
|
+
* Previously truncated UUIDs to 8 characters, but full IDs are needed
|
|
101
|
+
* for copy-paste into subsequent CLI commands. Now returns the full string.
|
|
102
|
+
*
|
|
103
|
+
* @param id - The string to display
|
|
104
|
+
* @returns The full ID string
|
|
105
|
+
*/
|
|
106
|
+
export function truncateId(id) {
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Format a Date for display.
|
|
111
|
+
*
|
|
112
|
+
* Converts Date objects or ISO strings to YYYY-MM-DD format.
|
|
113
|
+
* Null/undefined values render as an em-dash for clean table display.
|
|
114
|
+
*
|
|
115
|
+
* @param date - Date object, ISO string, or null
|
|
116
|
+
* @returns Formatted date string or em-dash for null values
|
|
117
|
+
*/
|
|
118
|
+
export function formatDate(date) {
|
|
119
|
+
if (!date)
|
|
120
|
+
return '—';
|
|
121
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
122
|
+
return d.toISOString().split('T')[0];
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,OAAiB,EAAE,IAAgB;IAC5D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE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W,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI prompt utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides confirmation, text input, and password (hidden) prompts
|
|
5
|
+
* for interactive CLI commands. Uses Node.js built-in readline.
|
|
6
|
+
*
|
|
7
|
+
* - `confirm()` — y/N confirmation, respects --force flag
|
|
8
|
+
* - `promptInput()` — reads a line of text (echoed)
|
|
9
|
+
* - `promptPassword()` — reads a line with hidden input (no echo)
|
|
10
|
+
*
|
|
11
|
+
* @module cli/prompt
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Ask a y/N confirmation question.
|
|
15
|
+
*
|
|
16
|
+
* Returns true if user types "y" or "Y", false for anything else.
|
|
17
|
+
* If force is true, skips the prompt entirely and returns true —
|
|
18
|
+
* this allows `--force` to bypass confirmations in scripts/automation.
|
|
19
|
+
*
|
|
20
|
+
* @param message - The question to display (e.g., "Delete organization?")
|
|
21
|
+
* @param force - If true, skip the prompt and return true (from argv.force)
|
|
22
|
+
* @returns true if confirmed, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
export declare function confirm(message: string, force?: boolean): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Prompt the user for a line of text input.
|
|
27
|
+
*
|
|
28
|
+
* Displays the message and waits for the user to type a response.
|
|
29
|
+
* Returns the trimmed input string. Used for non-sensitive fields
|
|
30
|
+
* like email, name, etc.
|
|
31
|
+
*
|
|
32
|
+
* @param message - The prompt message to display (e.g., "Admin email: ")
|
|
33
|
+
* @returns The user's trimmed input
|
|
34
|
+
*/
|
|
35
|
+
export declare function promptInput(message: string): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Prompt the user for a password (hidden input).
|
|
38
|
+
*
|
|
39
|
+
* Displays the message but suppresses character echo so the password
|
|
40
|
+
* is not visible on screen. Uses a muted Writable stream as the
|
|
41
|
+
* readline output to prevent echo while still allowing the prompt
|
|
42
|
+
* message to be displayed via direct stdout write.
|
|
43
|
+
*
|
|
44
|
+
* @param message - The prompt message to display (e.g., "Password: ")
|
|
45
|
+
* @returns The user's password input (trimmed)
|
|
46
|
+
*/
|
|
47
|
+
export declare function promptPassword(message: string): Promise<string>;
|
|
48
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,UAAQ,GACZ,OAAO,CAAC,OAAO,CAAC,CAalB;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQlE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBrE"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI prompt utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides confirmation, text input, and password (hidden) prompts
|
|
5
|
+
* for interactive CLI commands. Uses Node.js built-in readline.
|
|
6
|
+
*
|
|
7
|
+
* - `confirm()` — y/N confirmation, respects --force flag
|
|
8
|
+
* - `promptInput()` — reads a line of text (echoed)
|
|
9
|
+
* - `promptPassword()` — reads a line with hidden input (no echo)
|
|
10
|
+
*
|
|
11
|
+
* @module cli/prompt
|
|
12
|
+
*/
|
|
13
|
+
import * as readline from 'node:readline/promises';
|
|
14
|
+
import { Writable } from 'node:stream';
|
|
15
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
16
|
+
/**
|
|
17
|
+
* Ask a y/N confirmation question.
|
|
18
|
+
*
|
|
19
|
+
* Returns true if user types "y" or "Y", false for anything else.
|
|
20
|
+
* If force is true, skips the prompt entirely and returns true —
|
|
21
|
+
* this allows `--force` to bypass confirmations in scripts/automation.
|
|
22
|
+
*
|
|
23
|
+
* @param message - The question to display (e.g., "Delete organization?")
|
|
24
|
+
* @param force - If true, skip the prompt and return true (from argv.force)
|
|
25
|
+
* @returns true if confirmed, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
export async function confirm(message, force = false) {
|
|
28
|
+
// --force flag bypasses all confirmation prompts
|
|
29
|
+
if (force)
|
|
30
|
+
return true;
|
|
31
|
+
const rl = readline.createInterface({ input, output });
|
|
32
|
+
try {
|
|
33
|
+
const answer = await rl.question(`${message} (y/N): `);
|
|
34
|
+
// Only explicit "y" or "Y" confirms — empty input or anything else is "no"
|
|
35
|
+
return answer.trim().toLowerCase() === 'y';
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
// Always close the readline interface to release stdin
|
|
39
|
+
rl.close();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Prompt the user for a line of text input.
|
|
44
|
+
*
|
|
45
|
+
* Displays the message and waits for the user to type a response.
|
|
46
|
+
* Returns the trimmed input string. Used for non-sensitive fields
|
|
47
|
+
* like email, name, etc.
|
|
48
|
+
*
|
|
49
|
+
* @param message - The prompt message to display (e.g., "Admin email: ")
|
|
50
|
+
* @returns The user's trimmed input
|
|
51
|
+
*/
|
|
52
|
+
export async function promptInput(message) {
|
|
53
|
+
const rl = readline.createInterface({ input, output });
|
|
54
|
+
try {
|
|
55
|
+
const answer = await rl.question(message);
|
|
56
|
+
return answer.trim();
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
rl.close();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Prompt the user for a password (hidden input).
|
|
64
|
+
*
|
|
65
|
+
* Displays the message but suppresses character echo so the password
|
|
66
|
+
* is not visible on screen. Uses a muted Writable stream as the
|
|
67
|
+
* readline output to prevent echo while still allowing the prompt
|
|
68
|
+
* message to be displayed via direct stdout write.
|
|
69
|
+
*
|
|
70
|
+
* @param message - The prompt message to display (e.g., "Password: ")
|
|
71
|
+
* @returns The user's password input (trimmed)
|
|
72
|
+
*/
|
|
73
|
+
export async function promptPassword(message) {
|
|
74
|
+
// Write the prompt message directly to stdout before creating the
|
|
75
|
+
// muted readline — this ensures the user sees the prompt label
|
|
76
|
+
output.write(message);
|
|
77
|
+
// Create a Writable that discards all output — this suppresses
|
|
78
|
+
// character echo while readline is active
|
|
79
|
+
const muted = new Writable({
|
|
80
|
+
write(_chunk, _encoding, callback) {
|
|
81
|
+
callback();
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
const rl = readline.createInterface({ input, output: muted, terminal: true });
|
|
85
|
+
try {
|
|
86
|
+
// Empty string prompt since we already wrote the label above
|
|
87
|
+
const answer = await rl.question('');
|
|
88
|
+
// Move to the next line since echo was suppressed (no newline from Enter)
|
|
89
|
+
output.write('\n');
|
|
90
|
+
return answer.trim();
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
rl.close();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,OAAe,EACf,KAAK,GAAG,KAAK;IAEb,iDAAiD;IACjD,IAAI,KAAK;QAAE,OAAO,IAAI,CAAC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6DAA6D;QAC7D,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrC,0EAA0E;QAC1E,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client cache — Redis-backed fast lookup layer.
|
|
3
|
+
*
|
|
4
|
+
* Provides get/set/invalidate operations for Client objects stored in Redis.
|
|
5
|
+
* Each client is cached under two keys:
|
|
6
|
+
* - `client:cid:{clientId}` — for lookups by OIDC client_id (public identifier)
|
|
7
|
+
* - `client:id:{id}` — for lookups by internal UUID
|
|
8
|
+
*
|
|
9
|
+
* Both keys store the same JSON-serialized Client object with a 5-minute TTL.
|
|
10
|
+
* Date fields (createdAt, updatedAt) are serialized as ISO 8601 strings and
|
|
11
|
+
* deserialized back to Date objects on read.
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: Secret data is NEVER cached. Secret lookups always hit the
|
|
14
|
+
* database directly to ensure revoked/expired secrets are immediately
|
|
15
|
+
* ineffective. Only client metadata is cached here.
|
|
16
|
+
*
|
|
17
|
+
* All Redis errors are caught and logged — cache failures never propagate
|
|
18
|
+
* to callers. The system gracefully degrades to direct database lookups
|
|
19
|
+
* when Redis is unavailable.
|
|
20
|
+
*/
|
|
21
|
+
import type { Client } from './types.js';
|
|
22
|
+
/**
|
|
23
|
+
* Get a client from cache by OIDC client_id.
|
|
24
|
+
*
|
|
25
|
+
* Returns null on cache miss, invalid JSON, or Redis error.
|
|
26
|
+
* Callers should fall back to the database on null.
|
|
27
|
+
*
|
|
28
|
+
* @param clientId - OIDC client_id (public identifier)
|
|
29
|
+
* @returns Cached client or null
|
|
30
|
+
*/
|
|
31
|
+
export declare function getCachedClientByClientId(clientId: string): Promise<Client | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Get a client from cache by internal UUID.
|
|
34
|
+
*
|
|
35
|
+
* Returns null on cache miss, invalid JSON, or Redis error.
|
|
36
|
+
* Callers should fall back to the database on null.
|
|
37
|
+
*
|
|
38
|
+
* @param id - Client internal UUID
|
|
39
|
+
* @returns Cached client or null
|
|
40
|
+
*/
|
|
41
|
+
export declare function getCachedClientById(id: string): Promise<Client | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Store a client in cache under both client_id and internal ID keys.
|
|
44
|
+
*
|
|
45
|
+
* Both keys get the same TTL so they expire together.
|
|
46
|
+
* Date fields are serialized to ISO 8601 strings automatically
|
|
47
|
+
* by JSON.stringify().
|
|
48
|
+
*
|
|
49
|
+
* @param client - Client to cache
|
|
50
|
+
*/
|
|
51
|
+
export declare function cacheClient(client: Client): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Invalidate all cache entries for a client.
|
|
54
|
+
*
|
|
55
|
+
* Deletes both the client_id-keyed and ID-keyed cache entries.
|
|
56
|
+
* Should be called after any write operation (create, update,
|
|
57
|
+
* status change) to ensure stale data is not served.
|
|
58
|
+
*
|
|
59
|
+
* @param clientId - OIDC client_id (public identifier)
|
|
60
|
+
* @param id - Client internal UUID
|
|
61
|
+
*/
|
|
62
|
+
export declare function invalidateClientCache(clientId: string, id: string): Promise<void>;
|
|
63
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/clients/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAmBzC;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxF;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAW5E;AAMD;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAc/D;AAMD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAavF"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client cache — Redis-backed fast lookup layer.
|
|
3
|
+
*
|
|
4
|
+
* Provides get/set/invalidate operations for Client objects stored in Redis.
|
|
5
|
+
* Each client is cached under two keys:
|
|
6
|
+
* - `client:cid:{clientId}` — for lookups by OIDC client_id (public identifier)
|
|
7
|
+
* - `client:id:{id}` — for lookups by internal UUID
|
|
8
|
+
*
|
|
9
|
+
* Both keys store the same JSON-serialized Client object with a 5-minute TTL.
|
|
10
|
+
* Date fields (createdAt, updatedAt) are serialized as ISO 8601 strings and
|
|
11
|
+
* deserialized back to Date objects on read.
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: Secret data is NEVER cached. Secret lookups always hit the
|
|
14
|
+
* database directly to ensure revoked/expired secrets are immediately
|
|
15
|
+
* ineffective. Only client metadata is cached here.
|
|
16
|
+
*
|
|
17
|
+
* All Redis errors are caught and logged — cache failures never propagate
|
|
18
|
+
* to callers. The system gracefully degrades to direct database lookups
|
|
19
|
+
* when Redis is unavailable.
|
|
20
|
+
*/
|
|
21
|
+
import { getRedis } from '../lib/redis.js';
|
|
22
|
+
import { logger } from '../lib/logger.js';
|
|
23
|
+
import { afterDatabaseCommit } from '../lib/database.js';
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Constants
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
/** Cache TTL in seconds (5 minutes) */
|
|
28
|
+
const CACHE_TTL = 300;
|
|
29
|
+
/** Key prefix for OIDC client_id lookups */
|
|
30
|
+
const CLIENT_ID_PREFIX = 'client:cid:';
|
|
31
|
+
/** Key prefix for internal UUID lookups */
|
|
32
|
+
const ID_PREFIX = 'client:id:';
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Cache retrieval
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* Get a client from cache by OIDC client_id.
|
|
38
|
+
*
|
|
39
|
+
* Returns null on cache miss, invalid JSON, or Redis error.
|
|
40
|
+
* Callers should fall back to the database on null.
|
|
41
|
+
*
|
|
42
|
+
* @param clientId - OIDC client_id (public identifier)
|
|
43
|
+
* @returns Cached client or null
|
|
44
|
+
*/
|
|
45
|
+
export async function getCachedClientByClientId(clientId) {
|
|
46
|
+
try {
|
|
47
|
+
const redis = getRedis();
|
|
48
|
+
const data = await redis.get(`${CLIENT_ID_PREFIX}${clientId}`);
|
|
49
|
+
if (!data)
|
|
50
|
+
return null;
|
|
51
|
+
return deserializeClient(data);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Graceful degradation — log and return null so caller falls back to DB
|
|
55
|
+
logger.warn({ event: 'client-cache-read-failed' }, 'Client cache read failed');
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get a client from cache by internal UUID.
|
|
61
|
+
*
|
|
62
|
+
* Returns null on cache miss, invalid JSON, or Redis error.
|
|
63
|
+
* Callers should fall back to the database on null.
|
|
64
|
+
*
|
|
65
|
+
* @param id - Client internal UUID
|
|
66
|
+
* @returns Cached client or null
|
|
67
|
+
*/
|
|
68
|
+
export async function getCachedClientById(id) {
|
|
69
|
+
try {
|
|
70
|
+
const redis = getRedis();
|
|
71
|
+
const data = await redis.get(`${ID_PREFIX}${id}`);
|
|
72
|
+
if (!data)
|
|
73
|
+
return null;
|
|
74
|
+
return deserializeClient(data);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Graceful degradation — log and return null so caller falls back to DB
|
|
78
|
+
logger.warn({ event: 'client-cache-read-failed' }, 'Client cache read failed');
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// Cache storage
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
/**
|
|
86
|
+
* Store a client in cache under both client_id and internal ID keys.
|
|
87
|
+
*
|
|
88
|
+
* Both keys get the same TTL so they expire together.
|
|
89
|
+
* Date fields are serialized to ISO 8601 strings automatically
|
|
90
|
+
* by JSON.stringify().
|
|
91
|
+
*
|
|
92
|
+
* @param client - Client to cache
|
|
93
|
+
*/
|
|
94
|
+
export async function cacheClient(client) {
|
|
95
|
+
await afterDatabaseCommit(async () => {
|
|
96
|
+
try {
|
|
97
|
+
const redis = getRedis();
|
|
98
|
+
const data = JSON.stringify(client);
|
|
99
|
+
// Store under both keys with the same TTL
|
|
100
|
+
await redis.set(`${CLIENT_ID_PREFIX}${client.clientId}`, data, 'EX', CACHE_TTL);
|
|
101
|
+
await redis.set(`${ID_PREFIX}${client.id}`, data, 'EX', CACHE_TTL);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// Graceful degradation — cache write failure is non-fatal
|
|
105
|
+
logger.warn({ event: 'client-cache-write-failed' }, 'Client cache write failed');
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Cache invalidation
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
/**
|
|
113
|
+
* Invalidate all cache entries for a client.
|
|
114
|
+
*
|
|
115
|
+
* Deletes both the client_id-keyed and ID-keyed cache entries.
|
|
116
|
+
* Should be called after any write operation (create, update,
|
|
117
|
+
* status change) to ensure stale data is not served.
|
|
118
|
+
*
|
|
119
|
+
* @param clientId - OIDC client_id (public identifier)
|
|
120
|
+
* @param id - Client internal UUID
|
|
121
|
+
*/
|
|
122
|
+
export async function invalidateClientCache(clientId, id) {
|
|
123
|
+
await afterDatabaseCommit(async () => {
|
|
124
|
+
try {
|
|
125
|
+
const redis = getRedis();
|
|
126
|
+
await redis.del(`${CLIENT_ID_PREFIX}${clientId}`, `${ID_PREFIX}${id}`);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// Graceful degradation — cache invalidation failure is non-fatal
|
|
130
|
+
logger.warn({ event: 'client-cache-invalidation-failed' }, 'Client cache invalidation failed');
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
// Serialization helpers
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
/**
|
|
138
|
+
* Deserialize a JSON string from Redis into a Client object.
|
|
139
|
+
*
|
|
140
|
+
* Converts ISO 8601 date strings back to Date objects for the
|
|
141
|
+
* createdAt and updatedAt fields, which JSON.stringify() serializes
|
|
142
|
+
* as strings rather than Date instances.
|
|
143
|
+
*
|
|
144
|
+
* @param data - JSON string from Redis
|
|
145
|
+
* @returns Client object with proper Date instances, or null if parse fails
|
|
146
|
+
*/
|
|
147
|
+
function deserializeClient(data) {
|
|
148
|
+
try {
|
|
149
|
+
const parsed = JSON.parse(data);
|
|
150
|
+
// Restore Date objects from ISO string serialization
|
|
151
|
+
parsed.createdAt = new Date(parsed.createdAt);
|
|
152
|
+
parsed.updatedAt = new Date(parsed.updatedAt);
|
|
153
|
+
return parsed;
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
logger.warn('Failed to parse cached client JSON');
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/clients/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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