@portaidentity/server 1.7.3 → 1.8.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 +5 -0
- package/dist/applications/index.d.ts +2 -2
- package/dist/applications/index.d.ts.map +1 -1
- package/dist/applications/index.js +2 -2
- package/dist/applications/index.js.map +1 -1
- package/dist/applications/repository.d.ts +49 -4
- package/dist/applications/repository.d.ts.map +1 -1
- package/dist/applications/repository.js +148 -10
- package/dist/applications/repository.js.map +1 -1
- package/dist/applications/service.d.ts +35 -17
- package/dist/applications/service.d.ts.map +1 -1
- package/dist/applications/service.js +144 -35
- package/dist/applications/service.js.map +1 -1
- package/dist/applications/types.d.ts +1 -1
- package/dist/applications/types.d.ts.map +1 -1
- package/dist/applications/validators.d.ts +14 -0
- package/dist/applications/validators.d.ts.map +1 -0
- package/dist/applications/validators.js +14 -0
- package/dist/applications/validators.js.map +1 -0
- package/dist/auth/effective-branding.d.ts +35 -0
- package/dist/auth/effective-branding.d.ts.map +1 -0
- package/dist/auth/effective-branding.js +81 -0
- package/dist/auth/effective-branding.js.map +1 -0
- package/dist/auth/email-service.d.ts +3 -8
- package/dist/auth/email-service.d.ts.map +1 -1
- package/dist/auth/email-service.js +22 -30
- package/dist/auth/email-service.js.map +1 -1
- package/dist/auth/i18n.d.ts +5 -0
- package/dist/auth/i18n.d.ts.map +1 -1
- package/dist/auth/i18n.js +6 -5
- package/dist/auth/i18n.js.map +1 -1
- package/dist/auth/rate-limiter.d.ts +6 -10
- package/dist/auth/rate-limiter.d.ts.map +1 -1
- package/dist/auth/rate-limiter.js +12 -16
- package/dist/auth/rate-limiter.js.map +1 -1
- package/dist/auth/recovery-job-processor.d.ts.map +1 -1
- package/dist/auth/recovery-job-processor.js +1 -1
- package/dist/auth/recovery-job-processor.js.map +1 -1
- package/dist/auth/template-engine.d.ts +3 -1
- package/dist/auth/template-engine.d.ts.map +1 -1
- package/dist/auth/template-engine.js +1 -1
- package/dist/auth/template-engine.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +12 -12
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/error-handler.d.ts +3 -2
- package/dist/cli/error-handler.d.ts.map +1 -1
- package/dist/cli/error-handler.js +9 -2
- package/dist/cli/error-handler.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.js +1 -1
- package/dist/clients/repository.d.ts +18 -0
- package/dist/clients/repository.d.ts.map +1 -1
- package/dist/clients/repository.js +36 -0
- package/dist/clients/repository.js.map +1 -1
- package/dist/clients/secret-repository.d.ts +35 -8
- package/dist/clients/secret-repository.d.ts.map +1 -1
- package/dist/clients/secret-repository.js +69 -16
- package/dist/clients/secret-repository.js.map +1 -1
- package/dist/clients/secret-service.d.ts +5 -9
- package/dist/clients/secret-service.d.ts.map +1 -1
- package/dist/clients/secret-service.js +13 -22
- package/dist/clients/secret-service.js.map +1 -1
- package/dist/clients/service.d.ts +10 -13
- package/dist/clients/service.d.ts.map +1 -1
- package/dist/clients/service.js +112 -40
- package/dist/clients/service.js.map +1 -1
- package/dist/clients/types.d.ts +1 -1
- package/dist/clients/types.d.ts.map +1 -1
- package/dist/clients/validators.d.ts +83 -1
- package/dist/clients/validators.d.ts.map +1 -1
- package/dist/clients/validators.js +110 -0
- package/dist/clients/validators.js.map +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +23 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/custom-claims/repository.d.ts +14 -9
- package/dist/custom-claims/repository.d.ts.map +1 -1
- package/dist/custom-claims/repository.js +38 -11
- package/dist/custom-claims/repository.js.map +1 -1
- package/dist/custom-claims/service.d.ts +11 -6
- package/dist/custom-claims/service.d.ts.map +1 -1
- package/dist/custom-claims/service.js +43 -20
- package/dist/custom-claims/service.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/admin-permissions.d.ts +12 -7
- package/dist/lib/admin-permissions.d.ts.map +1 -1
- package/dist/lib/admin-permissions.js +26 -16
- package/dist/lib/admin-permissions.js.map +1 -1
- package/dist/lib/audit-log.d.ts +2 -2
- package/dist/lib/audit-log.d.ts.map +1 -1
- package/dist/lib/audit-log.js +1 -1
- package/dist/lib/audit-log.js.map +1 -1
- package/dist/lib/authority-revocation.d.ts +18 -0
- package/dist/lib/authority-revocation.d.ts.map +1 -0
- package/dist/lib/authority-revocation.js +37 -0
- package/dist/lib/authority-revocation.js.map +1 -0
- package/dist/lib/branding-assets.d.ts +35 -5
- package/dist/lib/branding-assets.d.ts.map +1 -1
- package/dist/lib/branding-assets.js +33 -26
- package/dist/lib/branding-assets.js.map +1 -1
- package/dist/lib/bulk-operations.d.ts +1 -1
- package/dist/lib/bulk-operations.d.ts.map +1 -1
- package/dist/lib/bulk-operations.js +1 -13
- package/dist/lib/bulk-operations.js.map +1 -1
- package/dist/lib/cursor.d.ts +2 -0
- package/dist/lib/cursor.d.ts.map +1 -1
- package/dist/lib/cursor.js +2 -7
- package/dist/lib/cursor.js.map +1 -1
- package/dist/lib/database.d.ts.map +1 -1
- package/dist/lib/database.js +5 -0
- package/dist/lib/database.js.map +1 -1
- package/dist/lib/deletion-cleanup.d.ts +43 -0
- package/dist/lib/deletion-cleanup.d.ts.map +1 -0
- package/dist/lib/deletion-cleanup.js +207 -0
- package/dist/lib/deletion-cleanup.js.map +1 -0
- package/dist/lib/image-validator.d.ts +3 -1
- package/dist/lib/image-validator.d.ts.map +1 -1
- package/dist/lib/image-validator.js +32 -19
- package/dist/lib/image-validator.js.map +1 -1
- package/dist/lib/log-format.d.ts +20 -0
- package/dist/lib/log-format.d.ts.map +1 -0
- package/dist/lib/log-format.js +22 -0
- package/dist/lib/log-format.js.map +1 -0
- package/dist/lib/logger.d.ts +3 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +21 -4
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/redis.d.ts.map +1 -1
- package/dist/lib/redis.js +3 -0
- package/dist/lib/redis.js.map +1 -1
- package/dist/lib/session-tracking.d.ts +73 -11
- package/dist/lib/session-tracking.d.ts.map +1 -1
- package/dist/lib/session-tracking.js +76 -32
- package/dist/lib/session-tracking.js.map +1 -1
- package/dist/lib/signing-key-crypto.d.ts.map +1 -1
- package/dist/lib/signing-key-crypto.js +4 -5
- package/dist/lib/signing-key-crypto.js.map +1 -1
- package/dist/lib/signing-keys.d.ts +3 -4
- package/dist/lib/signing-keys.d.ts.map +1 -1
- package/dist/lib/signing-keys.js +66 -41
- package/dist/lib/signing-keys.js.map +1 -1
- package/dist/lib/super-admin-protection.d.ts +5 -5
- package/dist/lib/super-admin-protection.d.ts.map +1 -1
- package/dist/lib/super-admin-protection.js +6 -9
- package/dist/lib/super-admin-protection.js.map +1 -1
- package/dist/lib/system-config-catalog.d.ts +268 -0
- package/dist/lib/system-config-catalog.d.ts.map +1 -0
- package/dist/lib/system-config-catalog.js +90 -0
- package/dist/lib/system-config-catalog.js.map +1 -0
- package/dist/lib/system-config.d.ts +30 -33
- package/dist/lib/system-config.d.ts.map +1 -1
- package/dist/lib/system-config.js +78 -93
- package/dist/lib/system-config.js.map +1 -1
- package/dist/lib/with-timeout.d.ts +32 -0
- package/dist/lib/with-timeout.d.ts.map +1 -0
- package/dist/lib/with-timeout.js +45 -0
- package/dist/lib/with-timeout.js.map +1 -0
- package/dist/middleware/admin-auth.d.ts +6 -5
- package/dist/middleware/admin-auth.d.ts.map +1 -1
- package/dist/middleware/admin-auth.js +30 -20
- package/dist/middleware/admin-auth.js.map +1 -1
- package/dist/middleware/admin-cors.d.ts +3 -3
- package/dist/middleware/admin-cors.js +3 -3
- package/dist/middleware/admin-mutation-audit.d.ts +3 -2
- package/dist/middleware/admin-mutation-audit.d.ts.map +1 -1
- package/dist/middleware/admin-mutation-audit.js +12 -5
- package/dist/middleware/admin-mutation-audit.js.map +1 -1
- package/dist/middleware/admin-rate-limiter.d.ts +7 -8
- package/dist/middleware/admin-rate-limiter.d.ts.map +1 -1
- package/dist/middleware/admin-rate-limiter.js +7 -8
- package/dist/middleware/admin-rate-limiter.js.map +1 -1
- package/dist/middleware/client-secret-hash.d.ts +10 -29
- package/dist/middleware/client-secret-hash.d.ts.map +1 -1
- package/dist/middleware/client-secret-hash.js +161 -59
- package/dist/middleware/client-secret-hash.js.map +1 -1
- package/dist/middleware/health.d.ts +17 -0
- package/dist/middleware/health.d.ts.map +1 -1
- package/dist/middleware/health.js +25 -21
- package/dist/middleware/health.js.map +1 -1
- package/dist/middleware/ready.d.ts.map +1 -1
- package/dist/middleware/ready.js +1 -12
- package/dist/middleware/ready.js.map +1 -1
- package/dist/middleware/require-existing-organization.d.ts +18 -0
- package/dist/middleware/require-existing-organization.d.ts.map +1 -0
- package/dist/middleware/require-existing-organization.js +38 -0
- package/dist/middleware/require-existing-organization.js.map +1 -0
- package/dist/middleware/require-permission.d.ts.map +1 -1
- package/dist/middleware/require-permission.js +35 -1
- package/dist/middleware/require-permission.js.map +1 -1
- package/dist/middleware/require-user-organization.d.ts.map +1 -1
- package/dist/middleware/require-user-organization.js +4 -2
- package/dist/middleware/require-user-organization.js.map +1 -1
- package/dist/middleware/security-headers.d.ts +18 -0
- package/dist/middleware/security-headers.d.ts.map +1 -1
- package/dist/middleware/security-headers.js +32 -1
- package/dist/middleware/security-headers.js.map +1 -1
- package/dist/middleware/tenant-resolver.d.ts +1 -2
- package/dist/middleware/tenant-resolver.d.ts.map +1 -1
- package/dist/middleware/tenant-resolver.js +1 -5
- package/dist/middleware/tenant-resolver.js.map +1 -1
- package/dist/middleware/token-rate-limiter.d.ts +37 -16
- package/dist/middleware/token-rate-limiter.d.ts.map +1 -1
- package/dist/middleware/token-rate-limiter.js +126 -54
- package/dist/middleware/token-rate-limiter.js.map +1 -1
- package/dist/oidc/account-finder.d.ts +5 -5
- package/dist/oidc/account-finder.d.ts.map +1 -1
- package/dist/oidc/account-finder.js +31 -23
- package/dist/oidc/account-finder.js.map +1 -1
- package/dist/oidc/adapter-factory.d.ts.map +1 -1
- package/dist/oidc/adapter-factory.js +83 -3
- package/dist/oidc/adapter-factory.js.map +1 -1
- package/dist/oidc/configuration.d.ts +3 -8
- package/dist/oidc/configuration.d.ts.map +1 -1
- package/dist/oidc/configuration.js +64 -50
- package/dist/oidc/configuration.js.map +1 -1
- package/dist/oidc/provider.d.ts.map +1 -1
- package/dist/oidc/provider.js +7 -0
- package/dist/oidc/provider.js.map +1 -1
- package/dist/oidc/redis-adapter.d.ts +2 -3
- package/dist/oidc/redis-adapter.d.ts.map +1 -1
- package/dist/oidc/redis-adapter.js +54 -46
- package/dist/oidc/redis-adapter.js.map +1 -1
- package/dist/organizations/branding-url.d.ts +17 -0
- package/dist/organizations/branding-url.d.ts.map +1 -0
- package/dist/organizations/branding-url.js +38 -0
- package/dist/organizations/branding-url.js.map +1 -0
- package/dist/organizations/index.d.ts +2 -2
- package/dist/organizations/index.d.ts.map +1 -1
- package/dist/organizations/index.js +1 -1
- package/dist/organizations/index.js.map +1 -1
- package/dist/organizations/repository.d.ts +22 -32
- package/dist/organizations/repository.d.ts.map +1 -1
- package/dist/organizations/repository.js +64 -45
- package/dist/organizations/repository.js.map +1 -1
- package/dist/organizations/service.d.ts +14 -46
- package/dist/organizations/service.d.ts.map +1 -1
- package/dist/organizations/service.js +60 -112
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/types.d.ts +1 -15
- package/dist/organizations/types.d.ts.map +1 -1
- package/dist/organizations/validators.d.ts +41 -0
- package/dist/organizations/validators.d.ts.map +1 -0
- package/dist/organizations/validators.js +48 -0
- package/dist/organizations/validators.js.map +1 -0
- package/dist/portability/apply.d.ts +15 -0
- package/dist/portability/apply.d.ts.map +1 -0
- package/dist/portability/apply.js +274 -0
- package/dist/portability/apply.js.map +1 -0
- package/dist/portability/authorization.d.ts +30 -0
- package/dist/portability/authorization.d.ts.map +1 -0
- package/dist/portability/authorization.js +130 -0
- package/dist/portability/authorization.js.map +1 -0
- package/dist/portability/cleanup.d.ts +29 -0
- package/dist/portability/cleanup.d.ts.map +1 -0
- package/dist/portability/cleanup.js +167 -0
- package/dist/portability/cleanup.js.map +1 -0
- package/dist/portability/export.d.ts +18 -0
- package/dist/portability/export.d.ts.map +1 -0
- package/dist/portability/export.js +125 -0
- package/dist/portability/export.js.map +1 -0
- package/dist/portability/import-repository.d.ts +204 -0
- package/dist/portability/import-repository.d.ts.map +1 -0
- package/dist/portability/import-repository.js +347 -0
- package/dist/portability/import-repository.js.map +1 -0
- package/dist/portability/import-user-client-writers.d.ts +40 -0
- package/dist/portability/import-user-client-writers.d.ts.map +1 -0
- package/dist/portability/import-user-client-writers.js +168 -0
- package/dist/portability/import-user-client-writers.js.map +1 -0
- package/dist/portability/index.d.ts +8 -0
- package/dist/portability/index.d.ts.map +1 -0
- package/dist/portability/index.js +8 -0
- package/dist/portability/index.js.map +1 -0
- package/dist/portability/plan-support.d.ts +137 -0
- package/dist/portability/plan-support.d.ts.map +1 -0
- package/dist/portability/plan-support.js +336 -0
- package/dist/portability/plan-support.js.map +1 -0
- package/dist/portability/plan.d.ts +34 -0
- package/dist/portability/plan.d.ts.map +1 -0
- package/dist/portability/plan.js +450 -0
- package/dist/portability/plan.js.map +1 -0
- package/dist/portability/repository.d.ts +95 -0
- package/dist/portability/repository.d.ts.map +1 -0
- package/dist/portability/repository.js +388 -0
- package/dist/portability/repository.js.map +1 -0
- package/dist/portability/schema.d.ts +589 -0
- package/dist/portability/schema.d.ts.map +1 -0
- package/dist/portability/schema.js +458 -0
- package/dist/portability/schema.js.map +1 -0
- package/dist/portability/types.d.ts +381 -0
- package/dist/portability/types.d.ts.map +1 -0
- package/dist/portability/types.js +19 -0
- package/dist/portability/types.js.map +1 -0
- package/dist/rbac/errors.d.ts +4 -0
- package/dist/rbac/errors.d.ts.map +1 -1
- package/dist/rbac/errors.js +7 -0
- package/dist/rbac/errors.js.map +1 -1
- package/dist/rbac/index.d.ts +3 -3
- package/dist/rbac/index.d.ts.map +1 -1
- package/dist/rbac/index.js +3 -3
- package/dist/rbac/index.js.map +1 -1
- package/dist/rbac/mapping-repository.d.ts +84 -9
- package/dist/rbac/mapping-repository.d.ts.map +1 -1
- package/dist/rbac/mapping-repository.js +222 -55
- package/dist/rbac/mapping-repository.js.map +1 -1
- package/dist/rbac/permission-repository.d.ts +36 -19
- package/dist/rbac/permission-repository.d.ts.map +1 -1
- package/dist/rbac/permission-repository.js +93 -35
- package/dist/rbac/permission-repository.js.map +1 -1
- package/dist/rbac/permission-service.d.ts +18 -19
- package/dist/rbac/permission-service.d.ts.map +1 -1
- package/dist/rbac/permission-service.js +100 -57
- package/dist/rbac/permission-service.js.map +1 -1
- package/dist/rbac/role-repository.d.ts +29 -24
- package/dist/rbac/role-repository.d.ts.map +1 -1
- package/dist/rbac/role-repository.js +66 -43
- package/dist/rbac/role-repository.js.map +1 -1
- package/dist/rbac/role-service.d.ts +35 -32
- package/dist/rbac/role-service.d.ts.map +1 -1
- package/dist/rbac/role-service.js +210 -96
- package/dist/rbac/role-service.js.map +1 -1
- package/dist/rbac/slugs.d.ts +16 -27
- package/dist/rbac/slugs.d.ts.map +1 -1
- package/dist/rbac/slugs.js +36 -59
- package/dist/rbac/slugs.js.map +1 -1
- package/dist/rbac/types.d.ts +2 -4
- package/dist/rbac/types.d.ts.map +1 -1
- package/dist/rbac/types.js.map +1 -1
- package/dist/rbac/user-role-service.d.ts +23 -24
- package/dist/rbac/user-role-service.d.ts.map +1 -1
- package/dist/rbac/user-role-service.js +117 -61
- package/dist/rbac/user-role-service.js.map +1 -1
- package/dist/routes/applications.d.ts +4 -2
- package/dist/routes/applications.d.ts.map +1 -1
- package/dist/routes/applications.js +57 -19
- package/dist/routes/applications.js.map +1 -1
- package/dist/routes/audit.js +1 -1
- package/dist/routes/audit.js.map +1 -1
- package/dist/routes/branding.d.ts +3 -3
- package/dist/routes/branding.d.ts.map +1 -1
- package/dist/routes/branding.js +44 -16
- package/dist/routes/branding.js.map +1 -1
- package/dist/routes/bulk.d.ts +0 -5
- package/dist/routes/bulk.d.ts.map +1 -1
- package/dist/routes/bulk.js +3 -5
- package/dist/routes/bulk.js.map +1 -1
- package/dist/routes/clients.d.ts +4 -4
- package/dist/routes/clients.d.ts.map +1 -1
- package/dist/routes/clients.js +111 -52
- package/dist/routes/clients.js.map +1 -1
- package/dist/routes/config.d.ts +17 -12
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +165 -64
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/custom-claims.d.ts.map +1 -1
- package/dist/routes/custom-claims.js +8 -2
- package/dist/routes/custom-claims.js.map +1 -1
- package/dist/routes/exports.d.ts +2 -1
- package/dist/routes/exports.d.ts.map +1 -1
- package/dist/routes/exports.js +57 -1
- package/dist/routes/exports.js.map +1 -1
- package/dist/routes/imports.d.ts +2 -2
- package/dist/routes/imports.d.ts.map +1 -1
- package/dist/routes/imports.js +95 -40
- package/dist/routes/imports.js.map +1 -1
- package/dist/routes/interactions.d.ts.map +1 -1
- package/dist/routes/interactions.js +16 -34
- package/dist/routes/interactions.js.map +1 -1
- package/dist/routes/invitation.d.ts.map +1 -1
- package/dist/routes/invitation.js +10 -23
- package/dist/routes/invitation.js.map +1 -1
- package/dist/routes/keys.d.ts.map +1 -1
- package/dist/routes/keys.js +26 -13
- package/dist/routes/keys.js.map +1 -1
- package/dist/routes/magic-link.d.ts.map +1 -1
- package/dist/routes/magic-link.js +5 -17
- package/dist/routes/magic-link.js.map +1 -1
- package/dist/routes/organizations.d.ts +1 -2
- package/dist/routes/organizations.d.ts.map +1 -1
- package/dist/routes/organizations.js +43 -104
- package/dist/routes/organizations.js.map +1 -1
- package/dist/routes/password-reset.d.ts.map +1 -1
- package/dist/routes/password-reset.js +13 -35
- package/dist/routes/password-reset.js.map +1 -1
- package/dist/routes/permissions.d.ts +1 -1
- package/dist/routes/permissions.d.ts.map +1 -1
- package/dist/routes/permissions.js +58 -17
- package/dist/routes/permissions.js.map +1 -1
- package/dist/routes/public-branding.d.ts +16 -0
- package/dist/routes/public-branding.d.ts.map +1 -0
- package/dist/routes/public-branding.js +52 -0
- package/dist/routes/public-branding.js.map +1 -0
- package/dist/routes/roles.d.ts +1 -1
- package/dist/routes/roles.d.ts.map +1 -1
- package/dist/routes/roles.js +63 -21
- package/dist/routes/roles.js.map +1 -1
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +23 -12
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/two-factor.d.ts.map +1 -1
- package/dist/routes/two-factor.js +91 -38
- package/dist/routes/two-factor.js.map +1 -1
- package/dist/routes/user-roles.d.ts.map +1 -1
- package/dist/routes/user-roles.js +56 -9
- package/dist/routes/user-roles.js.map +1 -1
- package/dist/routes/users.d.ts +4 -8
- package/dist/routes/users.d.ts.map +1 -1
- package/dist/routes/users.js +108 -265
- package/dist/routes/users.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +53 -37
- package/dist/server.js.map +1 -1
- package/dist/two-factor/errors.d.ts +9 -0
- package/dist/two-factor/errors.d.ts.map +1 -1
- package/dist/two-factor/errors.js +12 -0
- package/dist/two-factor/errors.js.map +1 -1
- package/dist/two-factor/index.d.ts +5 -4
- package/dist/two-factor/index.d.ts.map +1 -1
- package/dist/two-factor/index.js +4 -4
- package/dist/two-factor/index.js.map +1 -1
- package/dist/two-factor/repository.d.ts +17 -6
- package/dist/two-factor/repository.d.ts.map +1 -1
- package/dist/two-factor/repository.js +37 -9
- package/dist/two-factor/repository.js.map +1 -1
- package/dist/two-factor/service.d.ts.map +1 -1
- package/dist/two-factor/service.js +26 -19
- package/dist/two-factor/service.js.map +1 -1
- package/dist/two-factor/totp.d.ts +13 -2
- package/dist/two-factor/totp.d.ts.map +1 -1
- package/dist/two-factor/totp.js +20 -7
- package/dist/two-factor/totp.js.map +1 -1
- package/dist/two-factor/types.d.ts +3 -0
- package/dist/two-factor/types.d.ts.map +1 -1
- package/dist/two-factor/types.js +5 -0
- package/dist/two-factor/types.js.map +1 -1
- package/dist/users/gdpr.d.ts +2 -40
- package/dist/users/gdpr.d.ts.map +1 -1
- package/dist/users/gdpr.js +3 -110
- package/dist/users/gdpr.js.map +1 -1
- package/dist/users/index.d.ts +5 -4
- package/dist/users/index.d.ts.map +1 -1
- package/dist/users/index.js +5 -4
- package/dist/users/index.js.map +1 -1
- package/dist/users/repository.d.ts +49 -3
- package/dist/users/repository.d.ts.map +1 -1
- package/dist/users/repository.js +169 -18
- package/dist/users/repository.js.map +1 -1
- package/dist/users/service.d.ts +19 -51
- package/dist/users/service.d.ts.map +1 -1
- package/dist/users/service.js +72 -122
- package/dist/users/service.js.map +1 -1
- package/dist/users/types.d.ts +4 -5
- package/dist/users/types.d.ts.map +1 -1
- package/dist/users/types.js.map +1 -1
- package/dist/users/validators.d.ts +28 -0
- package/dist/users/validators.d.ts.map +1 -0
- package/dist/users/validators.js +25 -0
- package/dist/users/validators.js.map +1 -0
- package/locales/default/en/errors.json +2 -1
- package/migrations/024_application_client_correction.sql +39 -0
- package/migrations/025_record_deletion_lifecycle.sql +26 -0
- package/migrations/026_simplify_user_lifecycle.sql +33 -0
- package/migrations/027_branding_asset_size_limits.sql +19 -0
- package/migrations/028_totp_replay_protection.sql +17 -0
- package/migrations/029_public_session_identifiers.sql +16 -0
- package/migrations/030_global_configuration_catalog.sql +39 -0
- package/migrations/031_monotonic_updated_at.sql +28 -0
- package/package.json +2 -2
- package/dist/lib/data-import-plan.d.ts +0 -50
- package/dist/lib/data-import-plan.d.ts.map +0 -1
- package/dist/lib/data-import-plan.js +0 -235
- package/dist/lib/data-import-plan.js.map +0 -1
- package/dist/lib/data-import.d.ts +0 -276
- package/dist/lib/data-import.d.ts.map +0 -1
- package/dist/lib/data-import.js +0 -1694
- package/dist/lib/data-import.js.map +0 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/** Targeted cache and authority cleanup for committed portability imports. */
|
|
2
|
+
import { invalidateApplicationCache } from '../applications/cache.js';
|
|
3
|
+
import { invalidateClientCache } from '../clients/cache.js';
|
|
4
|
+
import { invalidateDefinitionsCache } from '../custom-claims/cache.js';
|
|
5
|
+
import { revokeAffectedAuthorityInTransaction } from '../lib/authority-revocation.js';
|
|
6
|
+
import { afterDatabaseCommit, runDatabaseTransaction } from '../lib/database.js';
|
|
7
|
+
import { registerAuthorityCleanup } from '../lib/deletion-cleanup.js';
|
|
8
|
+
import { invalidateOrganizationCache } from '../organizations/cache.js';
|
|
9
|
+
import { invalidateRoleCache, invalidateUserRbacCache } from '../rbac/cache.js';
|
|
10
|
+
import { invalidateUserCache } from '../users/cache.js';
|
|
11
|
+
import { key, normalizedEmail, normalizedRbac, normalizedSlug } from './plan-support.js';
|
|
12
|
+
/**
|
|
13
|
+
* Return whether one public result record was created or updated.
|
|
14
|
+
*
|
|
15
|
+
* @param plan - Completed write plan
|
|
16
|
+
* @param entityType - Portable collection containing the record
|
|
17
|
+
* @param encodedKey - JSON-encoded public natural key
|
|
18
|
+
* @returns True when the record changed destination state
|
|
19
|
+
*/
|
|
20
|
+
function changed(plan, entityType, encodedKey) {
|
|
21
|
+
return plan.result.items.some((item) => item.entity_type === entityType &&
|
|
22
|
+
JSON.stringify(item.natural_key) === encodedKey &&
|
|
23
|
+
item.action !== 'skipped');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Register cache invalidation for every created or updated cached record.
|
|
27
|
+
*
|
|
28
|
+
* @param plan - Completed write plan
|
|
29
|
+
* @param ids - Destination identifiers resolved by the writers
|
|
30
|
+
*/
|
|
31
|
+
async function registerCacheInvalidation(plan, ids) {
|
|
32
|
+
const rbacUserIds = new Set();
|
|
33
|
+
for (const record of plan.manifest.organizations) {
|
|
34
|
+
if (!changed(plan, 'organizations', JSON.stringify({ slug: record.slug })))
|
|
35
|
+
continue;
|
|
36
|
+
const id = ids.organizationIds.get(normalizedSlug(record.slug));
|
|
37
|
+
if (id !== undefined)
|
|
38
|
+
await invalidateOrganizationCache(record.slug, id);
|
|
39
|
+
}
|
|
40
|
+
for (const record of plan.manifest.applications) {
|
|
41
|
+
if (!changed(plan, 'applications', JSON.stringify({ slug: record.slug })))
|
|
42
|
+
continue;
|
|
43
|
+
const id = ids.applicationIds.get(normalizedSlug(record.slug));
|
|
44
|
+
if (id !== undefined)
|
|
45
|
+
await invalidateApplicationCache(record.slug, id);
|
|
46
|
+
}
|
|
47
|
+
for (const record of plan.manifest.roles) {
|
|
48
|
+
const naturalKey = { application_slug: record.application_slug, slug: record.slug };
|
|
49
|
+
if (!changed(plan, 'roles', JSON.stringify(naturalKey)))
|
|
50
|
+
continue;
|
|
51
|
+
const id = ids.roleIds.get(key(normalizedSlug(record.application_slug), normalizedRbac(record.slug)));
|
|
52
|
+
if (id !== undefined)
|
|
53
|
+
await invalidateRoleCache(id);
|
|
54
|
+
}
|
|
55
|
+
for (const record of plan.manifest.claim_definitions) {
|
|
56
|
+
const naturalKey = {
|
|
57
|
+
application_slug: record.application_slug,
|
|
58
|
+
claim_name: record.claim_name,
|
|
59
|
+
};
|
|
60
|
+
if (!changed(plan, 'claim_definitions', JSON.stringify(naturalKey)))
|
|
61
|
+
continue;
|
|
62
|
+
const applicationId = ids.applicationIds.get(normalizedSlug(record.application_slug));
|
|
63
|
+
if (applicationId !== undefined)
|
|
64
|
+
await invalidateDefinitionsCache(applicationId);
|
|
65
|
+
}
|
|
66
|
+
for (const record of plan.manifest.users) {
|
|
67
|
+
const naturalKey = { organization_slug: record.organization_slug, email: record.email };
|
|
68
|
+
if (!changed(plan, 'users', JSON.stringify(naturalKey)))
|
|
69
|
+
continue;
|
|
70
|
+
const id = ids.userIds.get(key(normalizedSlug(record.organization_slug), normalizedEmail(record.email)));
|
|
71
|
+
if (id !== undefined)
|
|
72
|
+
await invalidateUserCache(id);
|
|
73
|
+
}
|
|
74
|
+
for (const record of plan.manifest.user_role_assignments) {
|
|
75
|
+
const naturalKey = {
|
|
76
|
+
organization_slug: record.organization_slug,
|
|
77
|
+
email: record.email,
|
|
78
|
+
application_slug: record.application_slug,
|
|
79
|
+
role_slug: record.role_slug,
|
|
80
|
+
};
|
|
81
|
+
if (!changed(plan, 'user_role_assignments', JSON.stringify(naturalKey)))
|
|
82
|
+
continue;
|
|
83
|
+
const id = ids.userIds.get(key(normalizedSlug(record.organization_slug), normalizedEmail(record.email)));
|
|
84
|
+
if (id !== undefined)
|
|
85
|
+
rbacUserIds.add(id);
|
|
86
|
+
}
|
|
87
|
+
for (const record of plan.manifest.role_permission_mappings) {
|
|
88
|
+
const naturalKey = {
|
|
89
|
+
application_slug: record.application_slug,
|
|
90
|
+
role_slug: record.role_slug,
|
|
91
|
+
};
|
|
92
|
+
if (!changed(plan, 'role_permission_mappings', JSON.stringify(naturalKey)))
|
|
93
|
+
continue;
|
|
94
|
+
for (const assignment of plan.snapshot.userRoles) {
|
|
95
|
+
if (normalizedSlug(assignment.application_slug) !== normalizedSlug(record.application_slug) ||
|
|
96
|
+
normalizedRbac(assignment.role_slug) !== normalizedRbac(record.role_slug)) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const id = ids.userIds.get(key(normalizedSlug(assignment.organization_slug), normalizedEmail(assignment.email)));
|
|
100
|
+
if (id !== undefined)
|
|
101
|
+
rbacUserIds.add(id);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
for (const id of [...rbacUserIds].sort())
|
|
105
|
+
await invalidateUserRbacCache(id);
|
|
106
|
+
for (const record of plan.manifest.clients) {
|
|
107
|
+
if (!changed(plan, 'clients', JSON.stringify({ client_id: record.client_id })))
|
|
108
|
+
continue;
|
|
109
|
+
const id = ids.clientIds.get(record.client_id);
|
|
110
|
+
if (id !== undefined)
|
|
111
|
+
await invalidateClientCache(record.client_id, id);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Find existing users whose import changes active authority to inactive.
|
|
116
|
+
*
|
|
117
|
+
* @param plan - Completed write plan and pre-write destination snapshot
|
|
118
|
+
* @param ids - Destination identifiers resolved by the writers
|
|
119
|
+
* @returns Sorted unique identifiers for users whose sessions must be revoked
|
|
120
|
+
*/
|
|
121
|
+
function deactivatedUserIds(plan, ids) {
|
|
122
|
+
const destinationUsers = new Map(plan.snapshot.users.map((row) => [
|
|
123
|
+
key(normalizedSlug(row.organization_slug), normalizedEmail(row.email)),
|
|
124
|
+
row,
|
|
125
|
+
]));
|
|
126
|
+
const affected = new Set();
|
|
127
|
+
for (const record of plan.manifest.users) {
|
|
128
|
+
if (record.status !== 'inactive')
|
|
129
|
+
continue;
|
|
130
|
+
const userKey = key(normalizedSlug(record.organization_slug), normalizedEmail(record.email));
|
|
131
|
+
const destination = destinationUsers.get(userKey);
|
|
132
|
+
if (destination === undefined || destination.status === 'inactive')
|
|
133
|
+
continue;
|
|
134
|
+
const id = ids.userIds.get(userKey);
|
|
135
|
+
if (id !== undefined)
|
|
136
|
+
affected.add(id);
|
|
137
|
+
}
|
|
138
|
+
return [...affected].sort();
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Register exact cache invalidation and affected-user revocation for the commit boundary.
|
|
142
|
+
*
|
|
143
|
+
* The authority callback starts only after the import commits. Its short PostgreSQL transaction
|
|
144
|
+
* revokes durable sessions and grant rows, then the existing cleanup helper schedules Redis work
|
|
145
|
+
* without keeping a PostgreSQL transaction open for Redis.
|
|
146
|
+
*
|
|
147
|
+
* @param plan - Valid plan and destination snapshot used by the apply transaction
|
|
148
|
+
* @param ids - Destination identifiers resolved by successful writes
|
|
149
|
+
*/
|
|
150
|
+
export async function registerPortabilityCleanup(plan, ids) {
|
|
151
|
+
await registerCacheInvalidation(plan, ids);
|
|
152
|
+
const userIds = deactivatedUserIds(plan, ids);
|
|
153
|
+
if (userIds.length === 0)
|
|
154
|
+
return;
|
|
155
|
+
await afterDatabaseCommit(async () => {
|
|
156
|
+
await runDatabaseTransaction(async () => {
|
|
157
|
+
const revoked = await revokeAffectedAuthorityInTransaction(userIds);
|
|
158
|
+
await registerAuthorityCleanup({
|
|
159
|
+
userIds,
|
|
160
|
+
grantIds: revoked.grantIds,
|
|
161
|
+
roleIds: [],
|
|
162
|
+
revokeOidcState: true,
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../src/portability/cleanup.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAE9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAmBzF;;;;;;;GAOG;AACH,SAAS,OAAO,CACd,IAA6B,EAC7B,UAAiC,EACjC,UAAkB;IA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AK,CAAC;QAAE,OAAO;IAEjC,MAAM,mBAAmB,CAAC,KAAK,IAAI,EAAE;QACnC,MAAM,sBAAsB,CAAC,KAAK,IAAI,EAAE;YACtC,MAAM,OAAO,GAAG,MAAM,oCAAoC,CAAC,OAAO,CAAC,CAAC;YACpE,MAAM,wBAAwB,CAAC;gBAC7B,OAAO;gBACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,OAAO,EAAE,EAAE;gBACX,eAAe,EAAE,IAAI;aACtB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Selective portability export service boundary. */
|
|
2
|
+
import { type ExportManifestRequest, type PortabilityActor, type PortabilityManifest } from './types.js';
|
|
3
|
+
/** Manifest and safe attachment name produced by one export snapshot. */
|
|
4
|
+
export interface PortabilityExport {
|
|
5
|
+
/** Complete validated portability manifest. */
|
|
6
|
+
readonly manifest: PortabilityManifest;
|
|
7
|
+
/** Safe basename returned in Content-Disposition. */
|
|
8
|
+
readonly filename: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Export the selected portable graph.
|
|
12
|
+
*
|
|
13
|
+
* @param request - Validated export selection
|
|
14
|
+
* @param actor - Authenticated audit actor
|
|
15
|
+
* @returns Exported manifest and attachment name
|
|
16
|
+
*/
|
|
17
|
+
export declare function exportPortabilityManifest(request: ExportManifestRequest, actor: PortabilityActor): Promise<PortabilityExport>;
|
|
18
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/portability/export.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAerD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AAKpB,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AA4BD;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,qBAAqB,EAC9B,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAmG5B"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/** Selective portability export service boundary. */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { writeAuditLogInTransaction } from '../lib/audit-log.js';
|
|
4
|
+
import { getPool } from '../lib/database.js';
|
|
5
|
+
import { portabilityManifestSchema } from './schema.js';
|
|
6
|
+
import { attachOrganizationBrandingAssets, readApplicationExportSelection, readAuthorizationExportGraph, readClientExportRecords, readOrganizationExportScope, readUserExportGraph, } from './repository.js';
|
|
7
|
+
import { PortabilityError, } from './types.js';
|
|
8
|
+
/** Maximum UTF-8 manifest size accepted by the matching import boundary. */
|
|
9
|
+
const MAXIMUM_MANIFEST_BYTES = 64 * 1024 * 1024;
|
|
10
|
+
/** Build non-sensitive per-collection counts for the export audit event. */
|
|
11
|
+
function recordCounts(manifest) {
|
|
12
|
+
return {
|
|
13
|
+
organizations: manifest.organizations.length,
|
|
14
|
+
applications: manifest.applications.length,
|
|
15
|
+
application_modules: manifest.application_modules.length,
|
|
16
|
+
roles: manifest.roles.length,
|
|
17
|
+
permissions: manifest.permissions.length,
|
|
18
|
+
claim_definitions: manifest.claim_definitions.length,
|
|
19
|
+
role_permission_mappings: manifest.role_permission_mappings.length,
|
|
20
|
+
users: manifest.users.length,
|
|
21
|
+
user_role_assignments: manifest.user_role_assignments.length,
|
|
22
|
+
user_claim_values: manifest.user_claim_values.length,
|
|
23
|
+
clients: manifest.clients.length,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Roll back without replacing the original export failure. */
|
|
27
|
+
async function rollbackQuietly(client) {
|
|
28
|
+
try {
|
|
29
|
+
await client.query('ROLLBACK');
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Releasing the failed connection handles cleanup; the original failure remains authoritative.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Export the selected portable graph.
|
|
37
|
+
*
|
|
38
|
+
* @param request - Validated export selection
|
|
39
|
+
* @param actor - Authenticated audit actor
|
|
40
|
+
* @returns Exported manifest and attachment name
|
|
41
|
+
*/
|
|
42
|
+
export async function exportPortabilityManifest(request, actor) {
|
|
43
|
+
const client = await getPool().connect();
|
|
44
|
+
try {
|
|
45
|
+
await client.query('BEGIN ISOLATION LEVEL REPEATABLE READ');
|
|
46
|
+
const organizationScope = await readOrganizationExportScope(client, request.scope, actor.controlPlaneOrganizationId);
|
|
47
|
+
const selectsApplicationData = request.categories.some((category) => category !== 'organizations');
|
|
48
|
+
const applicationSelection = selectsApplicationData
|
|
49
|
+
? await readApplicationExportSelection(client, request.application_selection)
|
|
50
|
+
: { applicationIds: [], applications: [] };
|
|
51
|
+
const includesAuthorization = request.categories.includes('applications_authorization');
|
|
52
|
+
const authorization = includesAuthorization
|
|
53
|
+
? await readAuthorizationExportGraph(client, applicationSelection.applicationIds)
|
|
54
|
+
: {
|
|
55
|
+
applicationModules: [],
|
|
56
|
+
roles: [],
|
|
57
|
+
permissions: [],
|
|
58
|
+
claimDefinitions: [],
|
|
59
|
+
rolePermissionMappings: [],
|
|
60
|
+
};
|
|
61
|
+
const organizations = request.categories.includes('organizations')
|
|
62
|
+
? await attachOrganizationBrandingAssets(client, organizationScope.organizations, organizationScope.organizationIds)
|
|
63
|
+
: [];
|
|
64
|
+
const userGraph = request.categories.includes('users_assignments')
|
|
65
|
+
? await readUserExportGraph(client, organizationScope.organizationIds, applicationSelection.applicationIds)
|
|
66
|
+
: { users: [], userRoleAssignments: [], userClaimValues: [] };
|
|
67
|
+
const clients = request.categories.includes('oidc_clients')
|
|
68
|
+
? await readClientExportRecords(client, organizationScope.organizationIds, applicationSelection.applicationIds)
|
|
69
|
+
: [];
|
|
70
|
+
const exportedAt = new Date().toISOString();
|
|
71
|
+
const manifest = portabilityManifestSchema.parse({
|
|
72
|
+
version: '1.0',
|
|
73
|
+
exported_at: exportedAt,
|
|
74
|
+
scope: request.scope,
|
|
75
|
+
categories: [...request.categories].sort(),
|
|
76
|
+
application_selection: {
|
|
77
|
+
all_applications: request.application_selection.all_applications,
|
|
78
|
+
application_slugs: [...request.application_selection.application_slugs].sort(),
|
|
79
|
+
},
|
|
80
|
+
organizations,
|
|
81
|
+
applications: includesAuthorization ? applicationSelection.applications : [],
|
|
82
|
+
application_modules: authorization.applicationModules,
|
|
83
|
+
roles: authorization.roles,
|
|
84
|
+
permissions: authorization.permissions,
|
|
85
|
+
claim_definitions: authorization.claimDefinitions,
|
|
86
|
+
role_permission_mappings: authorization.rolePermissionMappings,
|
|
87
|
+
users: userGraph.users,
|
|
88
|
+
user_role_assignments: userGraph.userRoleAssignments,
|
|
89
|
+
user_claim_values: userGraph.userClaimValues,
|
|
90
|
+
clients,
|
|
91
|
+
});
|
|
92
|
+
const serialized = JSON.stringify(manifest);
|
|
93
|
+
if (Buffer.byteLength(serialized, 'utf8') > MAXIMUM_MANIFEST_BYTES) {
|
|
94
|
+
throw new PortabilityError(413, 'export_manifest_too_large', 'Export manifest is too large');
|
|
95
|
+
}
|
|
96
|
+
await writeAuditLogInTransaction(client, {
|
|
97
|
+
organizationId: request.scope.kind === 'organization'
|
|
98
|
+
? organizationScope.organizationIds[0]
|
|
99
|
+
: actor.controlPlaneOrganizationId,
|
|
100
|
+
actorId: actor.userId,
|
|
101
|
+
eventType: 'admin.export',
|
|
102
|
+
eventCategory: 'admin',
|
|
103
|
+
metadata: {
|
|
104
|
+
manifest_version: manifest.version,
|
|
105
|
+
sha256_digest: createHash('sha256').update(serialized).digest('hex'),
|
|
106
|
+
mode: request.scope.kind,
|
|
107
|
+
categories: manifest.categories,
|
|
108
|
+
record_counts: recordCounts(manifest),
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
await client.query('COMMIT');
|
|
112
|
+
return {
|
|
113
|
+
manifest,
|
|
114
|
+
filename: `porta-manifest-${exportedAt.replace(/[:.]/g, '-')}.json`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
await rollbackQuietly(client);
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
client.release();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/portability/export.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,GAIjB,MAAM,YAAY,CAAC;AAEpB,4EAA4E;AAC5E,MAAM,sBAAsB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAUhD,4EAA4E;AAC5E,SAAS,YAAY,CAAC,QAA6B;IACjD,OAAO;QACL,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,MAAM;QAC5C,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,MAAM;QAC1C,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,MAAM;QACxD,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM;QAC5B,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YACtB,QAAQ,EAAE;gBACR,gBAAgB,EAAE,QAAQ,CAAC,OAAO;gBAClC,aAAa,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBACpE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;gBACxB,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,aAAa,EAAE,YAAY,CAAC,QAAQ,CAAC;aACtC;SACF,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO;YACL,QAAQ;YACR,QAAQ,EAAE,kBAAkB,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO;SACpE,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/** Explicit PostgreSQL reads used to plan selective portability imports. */
|
|
2
|
+
import type { PortabilityApplication, PortabilityApplicationModule, PortabilityClaimDefinition, PortabilityClient, PortabilityManifest, PortabilityJsonValue, PortabilityOrganization, PortabilityPermission, PortabilityRole, PortabilityUser } from './types.js';
|
|
3
|
+
/** Destination organization fields needed for matching and mutable-value comparison. */
|
|
4
|
+
export interface ImportOrganizationRow extends Omit<PortabilityOrganization, 'branding'> {
|
|
5
|
+
/** Internal identifier used only to resolve relationships inside the transaction. */
|
|
6
|
+
readonly id: string;
|
|
7
|
+
/** Whether this is Porta's protected control-plane organization. */
|
|
8
|
+
readonly is_super_admin: boolean;
|
|
9
|
+
/** Stored external logo URL. */
|
|
10
|
+
readonly branding_logo_url: string | null;
|
|
11
|
+
/** Stored external favicon URL. */
|
|
12
|
+
readonly branding_favicon_url: string | null;
|
|
13
|
+
/** Stored HTML accent color. */
|
|
14
|
+
readonly branding_primary_color: string | null;
|
|
15
|
+
/** Stored hosted-page company name. */
|
|
16
|
+
readonly branding_company_name: string | null;
|
|
17
|
+
/** Stored hosted-page custom CSS. */
|
|
18
|
+
readonly branding_custom_css: string | null;
|
|
19
|
+
}
|
|
20
|
+
/** Stored organization branding bytes needed for exact update planning. */
|
|
21
|
+
export interface ImportBrandingAssetRow {
|
|
22
|
+
/** Owning organization's public slug. */
|
|
23
|
+
readonly organization_slug: string;
|
|
24
|
+
/** Branding slot occupied by these bytes. */
|
|
25
|
+
readonly asset_type: 'logo' | 'favicon';
|
|
26
|
+
/** Validated image media type. */
|
|
27
|
+
readonly content_type: string;
|
|
28
|
+
/** Validated stored image bytes. */
|
|
29
|
+
readonly data: Buffer;
|
|
30
|
+
}
|
|
31
|
+
/** Destination application fields needed for matching and comparison. */
|
|
32
|
+
export interface ImportApplicationRow extends PortabilityApplication {
|
|
33
|
+
/** Internal identifier used only to resolve children. */
|
|
34
|
+
readonly id: string;
|
|
35
|
+
}
|
|
36
|
+
/** Destination application-module fields plus internal relationship identifiers. */
|
|
37
|
+
export interface ImportModuleRow extends PortabilityApplicationModule {
|
|
38
|
+
/** Internal module identifier used only by writers. */
|
|
39
|
+
readonly id: string;
|
|
40
|
+
/** Internal application identifier used only by writers. */
|
|
41
|
+
readonly application_id: string;
|
|
42
|
+
}
|
|
43
|
+
/** Destination role fields plus internal relationship identifiers. */
|
|
44
|
+
export interface ImportRoleRow extends PortabilityRole {
|
|
45
|
+
/** Internal role identifier used only by writers. */
|
|
46
|
+
readonly id: string;
|
|
47
|
+
/** Internal application identifier used only by writers. */
|
|
48
|
+
readonly application_id: string;
|
|
49
|
+
}
|
|
50
|
+
/** Destination permission fields plus internal relationship identifiers. */
|
|
51
|
+
export interface ImportPermissionRow extends PortabilityPermission {
|
|
52
|
+
/** Internal permission identifier used only by writers. */
|
|
53
|
+
readonly id: string;
|
|
54
|
+
/** Internal application identifier used only by writers. */
|
|
55
|
+
readonly application_id: string;
|
|
56
|
+
/** Internal module identifier, or null for application-wide permission. */
|
|
57
|
+
readonly module_id: string | null;
|
|
58
|
+
}
|
|
59
|
+
/** Destination custom-claim definition plus its internal identifier. */
|
|
60
|
+
export interface ImportClaimDefinitionRow extends PortabilityClaimDefinition {
|
|
61
|
+
/** Internal claim identifier used only by writers. */
|
|
62
|
+
readonly id: string;
|
|
63
|
+
/** Internal application identifier used only by writers. */
|
|
64
|
+
readonly application_id: string;
|
|
65
|
+
}
|
|
66
|
+
/** Existing role-to-permission edges aggregated for one public role natural key. */
|
|
67
|
+
export interface ImportRolePermissionRow {
|
|
68
|
+
/** Owning application slug. */
|
|
69
|
+
readonly application_slug: string;
|
|
70
|
+
/** Role claim value. */
|
|
71
|
+
readonly role_slug: string;
|
|
72
|
+
/** Existing permission claim values for this role. */
|
|
73
|
+
readonly permission_slugs: readonly string[];
|
|
74
|
+
}
|
|
75
|
+
/** Destination user fields plus internal ownership identifiers. */
|
|
76
|
+
export interface ImportUserRow extends PortabilityUser {
|
|
77
|
+
/** Internal user identifier used only by writers. */
|
|
78
|
+
readonly id: string;
|
|
79
|
+
/** Internal organization identifier used only by writers. */
|
|
80
|
+
readonly organization_id: string;
|
|
81
|
+
}
|
|
82
|
+
/** One existing user-to-role edge, qualified by public natural keys. */
|
|
83
|
+
export interface ImportUserRoleRow {
|
|
84
|
+
/** Owning organization slug. */
|
|
85
|
+
readonly organization_slug: string;
|
|
86
|
+
/** Assigned user's normalized email. */
|
|
87
|
+
readonly email: string;
|
|
88
|
+
/** Owning application slug. */
|
|
89
|
+
readonly application_slug: string;
|
|
90
|
+
/** Assigned role claim value. */
|
|
91
|
+
readonly role_slug: string;
|
|
92
|
+
}
|
|
93
|
+
/** One existing user claim value, qualified by public natural keys. */
|
|
94
|
+
export interface ImportUserClaimValueRow {
|
|
95
|
+
/** Owning organization slug. */
|
|
96
|
+
readonly organization_slug: string;
|
|
97
|
+
/** Assigned user's normalized email. */
|
|
98
|
+
readonly email: string;
|
|
99
|
+
/** Owning application slug. */
|
|
100
|
+
readonly application_slug: string;
|
|
101
|
+
/** Custom claim name. */
|
|
102
|
+
readonly claim_name: string;
|
|
103
|
+
/** Existing JSON-compatible claim value. */
|
|
104
|
+
readonly value: PortabilityJsonValue;
|
|
105
|
+
}
|
|
106
|
+
/** Destination OIDC client fields plus internal ownership identifiers. */
|
|
107
|
+
export interface ImportClientRow extends PortabilityClient {
|
|
108
|
+
/** Internal client identifier used only by writers. */
|
|
109
|
+
readonly id: string;
|
|
110
|
+
/** Internal organization identifier used only by writers. */
|
|
111
|
+
readonly organization_id: string;
|
|
112
|
+
/** Internal application identifier used only by writers. */
|
|
113
|
+
readonly application_id: string;
|
|
114
|
+
}
|
|
115
|
+
/** Complete destination state required by the mutation-free import planner. */
|
|
116
|
+
export interface PortabilityImportSnapshot {
|
|
117
|
+
/** Destination organizations. */
|
|
118
|
+
readonly organizations: readonly ImportOrganizationRow[];
|
|
119
|
+
/** Destination branding image records. */
|
|
120
|
+
readonly brandingAssets: readonly ImportBrandingAssetRow[];
|
|
121
|
+
/** Destination applications. */
|
|
122
|
+
readonly applications: readonly ImportApplicationRow[];
|
|
123
|
+
/** Destination application modules. */
|
|
124
|
+
readonly applicationModules: readonly ImportModuleRow[];
|
|
125
|
+
/** Destination roles. */
|
|
126
|
+
readonly roles: readonly ImportRoleRow[];
|
|
127
|
+
/** Destination permissions. */
|
|
128
|
+
readonly permissions: readonly ImportPermissionRow[];
|
|
129
|
+
/** Destination custom-claim definitions. */
|
|
130
|
+
readonly claimDefinitions: readonly ImportClaimDefinitionRow[];
|
|
131
|
+
/** Destination role-to-permission edges. */
|
|
132
|
+
readonly rolePermissions: readonly ImportRolePermissionRow[];
|
|
133
|
+
/** Destination users. */
|
|
134
|
+
readonly users: readonly ImportUserRow[];
|
|
135
|
+
/** Destination user-to-role edges. */
|
|
136
|
+
readonly userRoles: readonly ImportUserRoleRow[];
|
|
137
|
+
/** Destination custom-claim values. */
|
|
138
|
+
readonly userClaimValues: readonly ImportUserClaimValueRow[];
|
|
139
|
+
/** Destination OIDC clients. */
|
|
140
|
+
readonly clients: readonly ImportClientRow[];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Read the small destination catalog used to plan an import.
|
|
144
|
+
*
|
|
145
|
+
* The product is configured by an administrator and does not need large-data streaming here.
|
|
146
|
+
* Explicit columns keep credentials, lock state, audit data, and other non-portable fields out of
|
|
147
|
+
* planner memory. The surrounding request transaction provides the consistent snapshot.
|
|
148
|
+
*
|
|
149
|
+
* @param manifest - Normalized scope, category, application selection, and imported client IDs
|
|
150
|
+
* @returns Destination records with internal identifiers retained only for relationship matching
|
|
151
|
+
*/
|
|
152
|
+
export declare function readPortabilityImportSnapshot(manifest: PortabilityManifest): Promise<PortabilityImportSnapshot>;
|
|
153
|
+
/**
|
|
154
|
+
* Insert or update one organization and its optional branding assets.
|
|
155
|
+
*
|
|
156
|
+
* @param record - Strict portable organization fields
|
|
157
|
+
* @param destinationId - Existing identifier for update, or null for create
|
|
158
|
+
* @param destinationAssetTypes - Branding slots which currently contain stored bytes
|
|
159
|
+
* @returns Authoritative destination identifier
|
|
160
|
+
*/
|
|
161
|
+
export declare function writePortabilityOrganization(record: PortabilityOrganization, destinationId: string | null, destinationAssetTypes: ReadonlySet<'logo' | 'favicon'>): Promise<string>;
|
|
162
|
+
/**
|
|
163
|
+
* @param record - Strict portable application fields
|
|
164
|
+
* @param destinationId - Existing identifier for update, or null for create
|
|
165
|
+
* @returns Authoritative destination identifier
|
|
166
|
+
*/
|
|
167
|
+
export declare function writePortabilityApplication(record: PortabilityApplication, destinationId: string | null): Promise<string>;
|
|
168
|
+
/**
|
|
169
|
+
* @param record - Strict portable module fields
|
|
170
|
+
* @param applicationId - Resolved parent application identifier
|
|
171
|
+
* @param destinationId - Existing identifier for update, or null for create
|
|
172
|
+
* @returns Authoritative destination identifier
|
|
173
|
+
*/
|
|
174
|
+
export declare function writePortabilityModule(record: PortabilityApplicationModule, applicationId: string, destinationId: string | null): Promise<string>;
|
|
175
|
+
/**
|
|
176
|
+
* @param record - Strict portable role fields
|
|
177
|
+
* @param applicationId - Resolved parent application identifier
|
|
178
|
+
* @param destinationId - Existing identifier for update, or null for create
|
|
179
|
+
* @returns Authoritative destination identifier
|
|
180
|
+
*/
|
|
181
|
+
export declare function writePortabilityRole(record: PortabilityRole, applicationId: string, destinationId: string | null): Promise<string>;
|
|
182
|
+
/**
|
|
183
|
+
* @param record - Strict portable permission fields
|
|
184
|
+
* @param applicationId - Resolved parent application identifier
|
|
185
|
+
* @param moduleId - Resolved optional module identifier
|
|
186
|
+
* @param destinationId - Existing identifier for update, or null for create
|
|
187
|
+
* @returns Authoritative destination identifier
|
|
188
|
+
*/
|
|
189
|
+
export declare function writePortabilityPermission(record: PortabilityPermission, applicationId: string, moduleId: string | null, destinationId: string | null): Promise<string>;
|
|
190
|
+
/**
|
|
191
|
+
* @param record - Strict portable claim-definition fields
|
|
192
|
+
* @param applicationId - Resolved parent application identifier
|
|
193
|
+
* @param destinationId - Existing identifier for update, or null for create
|
|
194
|
+
* @returns Authoritative destination identifier
|
|
195
|
+
*/
|
|
196
|
+
export declare function writePortabilityClaimDefinition(record: PortabilityClaimDefinition, applicationId: string, destinationId: string | null): Promise<string>;
|
|
197
|
+
/**
|
|
198
|
+
* Add listed role-permission edges without removing destination-only edges.
|
|
199
|
+
*
|
|
200
|
+
* @param roleId - Resolved role identifier
|
|
201
|
+
* @param permissionIds - Resolved permission identifiers listed by the manifest
|
|
202
|
+
*/
|
|
203
|
+
export declare function writePortabilityRolePermissions(roleId: string, permissionIds: readonly string[]): Promise<void>;
|
|
204
|
+
//# sourceMappingURL=import-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-repository.d.ts","sourceRoot":"","sources":["../../src/portability/import-repository.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAI5E,OAAO,K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