@atlasauth/cli 0.25.0 → 0.25.1
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 +6 -0
- package/dist/args.d.ts +601 -0
- package/dist/args.js +289 -0
- package/dist/args.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +19 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/actions-gallery.d.ts +8 -0
- package/dist/commands/actions-gallery.js +197 -0
- package/dist/commands/actions-gallery.js.map +1 -0
- package/dist/commands/actions.d.ts +13 -0
- package/dist/commands/actions.js +135 -0
- package/dist/commands/actions.js.map +1 -0
- package/dist/commands/admin.d.ts +49 -0
- package/dist/commands/admin.js +353 -0
- package/dist/commands/admin.js.map +1 -0
- package/dist/commands/api-keys.d.ts +4 -0
- package/dist/commands/api-keys.js +96 -0
- package/dist/commands/api-keys.js.map +1 -0
- package/dist/commands/auth.d.ts +25 -0
- package/dist/commands/auth.js +102 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/config.d.ts +104 -0
- package/dist/commands/config.js +1532 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/csp.d.ts +32 -0
- package/dist/commands/csp.js +180 -0
- package/dist/commands/csp.js.map +1 -0
- package/dist/commands/dev.d.ts +8 -0
- package/dist/commands/dev.js +84 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/fga.d.ts +10 -0
- package/dist/commands/fga.js +146 -0
- package/dist/commands/fga.js.map +1 -0
- package/dist/commands/golive.d.ts +40 -0
- package/dist/commands/golive.js +285 -0
- package/dist/commands/golive.js.map +1 -0
- package/dist/commands/id-accounts.d.ts +13 -0
- package/dist/commands/id-accounts.js +195 -0
- package/dist/commands/id-accounts.js.map +1 -0
- package/dist/commands/import-better-auth.d.ts +3 -0
- package/dist/commands/import-better-auth.js +164 -0
- package/dist/commands/import-better-auth.js.map +1 -0
- package/dist/commands/import.d.ts +3 -0
- package/dist/commands/import.js +123 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/info.d.ts +75 -0
- package/dist/commands/info.js +362 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.js +438 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/integrations.d.ts +8 -0
- package/dist/commands/integrations.js +112 -0
- package/dist/commands/integrations.js.map +1 -0
- package/dist/commands/listen.d.ts +17 -0
- package/dist/commands/listen.js +223 -0
- package/dist/commands/listen.js.map +1 -0
- package/dist/commands/mcp.d.ts +38 -0
- package/dist/commands/mcp.js +111 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/migrate.d.ts +16 -0
- package/dist/commands/migrate.js +114 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/move-origin.d.ts +11 -0
- package/dist/commands/move-origin.js +95 -0
- package/dist/commands/move-origin.js.map +1 -0
- package/dist/commands/operator.d.ts +18 -0
- package/dist/commands/operator.js +238 -0
- package/dist/commands/operator.js.map +1 -0
- package/dist/commands/orgs.d.ts +4 -0
- package/dist/commands/orgs.js +72 -0
- package/dist/commands/orgs.js.map +1 -0
- package/dist/commands/pages.d.ts +14 -0
- package/dist/commands/pages.js +113 -0
- package/dist/commands/pages.js.map +1 -0
- package/dist/commands/partner-platforms.d.ts +10 -0
- package/dist/commands/partner-platforms.js +157 -0
- package/dist/commands/partner-platforms.js.map +1 -0
- package/dist/commands/project-commands.d.ts +38 -0
- package/dist/commands/project-commands.js +361 -0
- package/dist/commands/project-commands.js.map +1 -0
- package/dist/commands/referrals.d.ts +69 -0
- package/dist/commands/referrals.js +1056 -0
- package/dist/commands/referrals.js.map +1 -0
- package/dist/commands/resources.d.ts +44 -0
- package/dist/commands/resources.js +234 -0
- package/dist/commands/resources.js.map +1 -0
- package/dist/commands/sessions.d.ts +4 -0
- package/dist/commands/sessions.js +28 -0
- package/dist/commands/sessions.js.map +1 -0
- package/dist/commands/shared.d.ts +38 -0
- package/dist/commands/shared.js +69 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +77 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/users.d.ts +4 -0
- package/dist/commands/users.js +100 -0
- package/dist/commands/users.js.map +1 -0
- package/dist/commands/webhooks.d.ts +34 -0
- package/dist/commands/webhooks.js +301 -0
- package/dist/commands/webhooks.js.map +1 -0
- package/dist/config-http.d.ts +29 -0
- package/dist/config-http.js +64 -0
- package/dist/config-http.js.map +1 -0
- package/dist/config.d.ts +64 -0
- package/dist/config.js +69 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +27 -0
- package/dist/context.js.map +1 -0
- package/dist/define-config.d.ts +9 -0
- package/dist/define-config.js +8 -0
- package/dist/define-config.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +25 -0
- package/dist/errors.js.map +1 -0
- package/dist/help.d.ts +8 -0
- package/dist/help.js +868 -0
- package/dist/help.js.map +1 -0
- package/dist/import/csv.d.ts +6 -0
- package/dist/import/csv.js +63 -0
- package/dist/import/csv.js.map +1 -0
- package/dist/import/vendors.d.ts +57 -0
- package/dist/import/vendors.js +568 -0
- package/dist/import/vendors.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +21 -0
- package/dist/io.js +28 -0
- package/dist/io.js.map +1 -0
- package/dist/migrate/appwrite/plugin.d.ts +2 -0
- package/dist/migrate/appwrite/plugin.js +103 -0
- package/dist/migrate/appwrite/plugin.js.map +1 -0
- package/dist/migrate/auth0/plugin.d.ts +2 -0
- package/dist/migrate/auth0/plugin.js +126 -0
- package/dist/migrate/auth0/plugin.js.map +1 -0
- package/dist/migrate/authentik/plugin.d.ts +2 -0
- package/dist/migrate/authentik/plugin.js +135 -0
- package/dist/migrate/authentik/plugin.js.map +1 -0
- package/dist/migrate/azure-ad-b2c/plugin.d.ts +8 -0
- package/dist/migrate/azure-ad-b2c/plugin.js +165 -0
- package/dist/migrate/azure-ad-b2c/plugin.js.map +1 -0
- package/dist/migrate/better-auth/integration.d.ts +59 -0
- package/dist/migrate/better-auth/integration.js +81 -0
- package/dist/migrate/better-auth/integration.js.map +1 -0
- package/dist/migrate/better-auth/orchestrator.d.ts +43 -0
- package/dist/migrate/better-auth/orchestrator.js +525 -0
- package/dist/migrate/better-auth/orchestrator.js.map +1 -0
- package/dist/migrate/better-auth/output.d.ts +20 -0
- package/dist/migrate/better-auth/output.js +146 -0
- package/dist/migrate/better-auth/output.js.map +1 -0
- package/dist/migrate/better-auth/translate.d.ts +77 -0
- package/dist/migrate/better-auth/translate.js +1989 -0
- package/dist/migrate/better-auth/translate.js.map +1 -0
- package/dist/migrate/clerk/plugin.d.ts +2 -0
- package/dist/migrate/clerk/plugin.js +76 -0
- package/dist/migrate/clerk/plugin.js.map +1 -0
- package/dist/migrate/cognito/plugin.d.ts +5 -0
- package/dist/migrate/cognito/plugin.js +170 -0
- package/dist/migrate/cognito/plugin.js.map +1 -0
- package/dist/migrate/corbado/plugin.d.ts +2 -0
- package/dist/migrate/corbado/plugin.js +63 -0
- package/dist/migrate/corbado/plugin.js.map +1 -0
- package/dist/migrate/descope/plugin.d.ts +2 -0
- package/dist/migrate/descope/plugin.js +83 -0
- package/dist/migrate/descope/plugin.js.map +1 -0
- package/dist/migrate/entra-external-id/plugin.d.ts +8 -0
- package/dist/migrate/entra-external-id/plugin.js +12 -0
- package/dist/migrate/entra-external-id/plugin.js.map +1 -0
- package/dist/migrate/export/appwrite-config.d.ts +28 -0
- package/dist/migrate/export/appwrite-config.js +170 -0
- package/dist/migrate/export/appwrite-config.js.map +1 -0
- package/dist/migrate/export/appwrite.d.ts +51 -0
- package/dist/migrate/export/appwrite.js +288 -0
- package/dist/migrate/export/appwrite.js.map +1 -0
- package/dist/migrate/export/auth0-config.d.ts +29 -0
- package/dist/migrate/export/auth0-config.js +249 -0
- package/dist/migrate/export/auth0-config.js.map +1 -0
- package/dist/migrate/export/auth0.d.ts +62 -0
- package/dist/migrate/export/auth0.js +575 -0
- package/dist/migrate/export/auth0.js.map +1 -0
- package/dist/migrate/export/authentik-config.d.ts +45 -0
- package/dist/migrate/export/authentik-config.js +357 -0
- package/dist/migrate/export/authentik-config.js.map +1 -0
- package/dist/migrate/export/authentik.d.ts +110 -0
- package/dist/migrate/export/authentik.js +838 -0
- package/dist/migrate/export/authentik.js.map +1 -0
- package/dist/migrate/export/azure-config.d.ts +58 -0
- package/dist/migrate/export/azure-config.js +344 -0
- package/dist/migrate/export/azure-config.js.map +1 -0
- package/dist/migrate/export/azure.d.ts +85 -0
- package/dist/migrate/export/azure.js +373 -0
- package/dist/migrate/export/azure.js.map +1 -0
- package/dist/migrate/export/clerk-config.d.ts +26 -0
- package/dist/migrate/export/clerk-config.js +227 -0
- package/dist/migrate/export/clerk-config.js.map +1 -0
- package/dist/migrate/export/clerk.d.ts +46 -0
- package/dist/migrate/export/clerk.js +486 -0
- package/dist/migrate/export/clerk.js.map +1 -0
- package/dist/migrate/export/cognito-config.d.ts +25 -0
- package/dist/migrate/export/cognito-config.js +273 -0
- package/dist/migrate/export/cognito-config.js.map +1 -0
- package/dist/migrate/export/cognito.d.ts +103 -0
- package/dist/migrate/export/cognito.js +441 -0
- package/dist/migrate/export/cognito.js.map +1 -0
- package/dist/migrate/export/corbado-config.d.ts +20 -0
- package/dist/migrate/export/corbado-config.js +63 -0
- package/dist/migrate/export/corbado-config.js.map +1 -0
- package/dist/migrate/export/corbado.d.ts +37 -0
- package/dist/migrate/export/corbado.js +132 -0
- package/dist/migrate/export/corbado.js.map +1 -0
- package/dist/migrate/export/descope.d.ts +35 -0
- package/dist/migrate/export/descope.js +208 -0
- package/dist/migrate/export/descope.js.map +1 -0
- package/dist/migrate/export/fake-vendor.test-helper.d.ts +27 -0
- package/dist/migrate/export/fake-vendor.test-helper.js +41 -0
- package/dist/migrate/export/fake-vendor.test-helper.js.map +1 -0
- package/dist/migrate/export/firebase-config.d.ts +24 -0
- package/dist/migrate/export/firebase-config.js +215 -0
- package/dist/migrate/export/firebase-config.js.map +1 -0
- package/dist/migrate/export/firebase.d.ts +102 -0
- package/dist/migrate/export/firebase.js +464 -0
- package/dist/migrate/export/firebase.js.map +1 -0
- package/dist/migrate/export/frameworks/app-users.d.ts +42 -0
- package/dist/migrate/export/frameworks/app-users.js +161 -0
- package/dist/migrate/export/frameworks/app-users.js.map +1 -0
- package/dist/migrate/export/frameworks/authjs.d.ts +41 -0
- package/dist/migrate/export/frameworks/authjs.js +146 -0
- package/dist/migrate/export/frameworks/authjs.js.map +1 -0
- package/dist/migrate/export/frameworks/devise.d.ts +39 -0
- package/dist/migrate/export/frameworks/devise.js +218 -0
- package/dist/migrate/export/frameworks/devise.js.map +1 -0
- package/dist/migrate/export/frameworks/django.d.ts +45 -0
- package/dist/migrate/export/frameworks/django.js +315 -0
- package/dist/migrate/export/frameworks/django.js.map +1 -0
- package/dist/migrate/export/frameworks/lucia.d.ts +42 -0
- package/dist/migrate/export/frameworks/lucia.js +263 -0
- package/dist/migrate/export/frameworks/lucia.js.map +1 -0
- package/dist/migrate/export/frameworks/tables.d.ts +90 -0
- package/dist/migrate/export/frameworks/tables.js +325 -0
- package/dist/migrate/export/frameworks/tables.js.map +1 -0
- package/dist/migrate/export/frameworks/webauthn.d.ts +25 -0
- package/dist/migrate/export/frameworks/webauthn.js +130 -0
- package/dist/migrate/export/frameworks/webauthn.js.map +1 -0
- package/dist/migrate/export/frontegg-config.d.ts +29 -0
- package/dist/migrate/export/frontegg-config.js +238 -0
- package/dist/migrate/export/frontegg-config.js.map +1 -0
- package/dist/migrate/export/frontegg.d.ts +67 -0
- package/dist/migrate/export/frontegg.js +410 -0
- package/dist/migrate/export/frontegg.js.map +1 -0
- package/dist/migrate/export/fusionauth-config.d.ts +26 -0
- package/dist/migrate/export/fusionauth-config.js +226 -0
- package/dist/migrate/export/fusionauth-config.js.map +1 -0
- package/dist/migrate/export/fusionauth.d.ts +99 -0
- package/dist/migrate/export/fusionauth.js +642 -0
- package/dist/migrate/export/fusionauth.js.map +1 -0
- package/dist/migrate/export/hanko-config.d.ts +27 -0
- package/dist/migrate/export/hanko-config.js +265 -0
- package/dist/migrate/export/hanko-config.js.map +1 -0
- package/dist/migrate/export/hanko.d.ts +52 -0
- package/dist/migrate/export/hanko.js +605 -0
- package/dist/migrate/export/hanko.js.map +1 -0
- package/dist/migrate/export/keycloak-config.d.ts +19 -0
- package/dist/migrate/export/keycloak-config.js +219 -0
- package/dist/migrate/export/keycloak-config.js.map +1 -0
- package/dist/migrate/export/keycloak.d.ts +155 -0
- package/dist/migrate/export/keycloak.js +878 -0
- package/dist/migrate/export/keycloak.js.map +1 -0
- package/dist/migrate/export/kinde-descope-config.d.ts +38 -0
- package/dist/migrate/export/kinde-descope-config.js +172 -0
- package/dist/migrate/export/kinde-descope-config.js.map +1 -0
- package/dist/migrate/export/kinde.d.ts +57 -0
- package/dist/migrate/export/kinde.js +333 -0
- package/dist/migrate/export/kinde.js.map +1 -0
- package/dist/migrate/export/ldap.d.ts +53 -0
- package/dist/migrate/export/ldap.js +277 -0
- package/dist/migrate/export/ldap.js.map +1 -0
- package/dist/migrate/export/logto-config.d.ts +27 -0
- package/dist/migrate/export/logto-config.js +264 -0
- package/dist/migrate/export/logto-config.js.map +1 -0
- package/dist/migrate/export/logto.d.ts +150 -0
- package/dist/migrate/export/logto.js +809 -0
- package/dist/migrate/export/logto.js.map +1 -0
- package/dist/migrate/export/magic-config.d.ts +14 -0
- package/dist/migrate/export/magic-config.js +28 -0
- package/dist/migrate/export/magic-config.js.map +1 -0
- package/dist/migrate/export/magic.d.ts +31 -0
- package/dist/migrate/export/magic.js +93 -0
- package/dist/migrate/export/magic.js.map +1 -0
- package/dist/migrate/export/mini-yaml.d.ts +19 -0
- package/dist/migrate/export/mini-yaml.js +581 -0
- package/dist/migrate/export/mini-yaml.js.map +1 -0
- package/dist/migrate/export/nhost-config.d.ts +26 -0
- package/dist/migrate/export/nhost-config.js +360 -0
- package/dist/migrate/export/nhost-config.js.map +1 -0
- package/dist/migrate/export/nhost.d.ts +64 -0
- package/dist/migrate/export/nhost.js +304 -0
- package/dist/migrate/export/nhost.js.map +1 -0
- package/dist/migrate/export/okta-config.d.ts +30 -0
- package/dist/migrate/export/okta-config.js +205 -0
- package/dist/migrate/export/okta-config.js.map +1 -0
- package/dist/migrate/export/okta.d.ts +43 -0
- package/dist/migrate/export/okta.js +337 -0
- package/dist/migrate/export/okta.js.map +1 -0
- package/dist/migrate/export/onelogin.d.ts +22 -0
- package/dist/migrate/export/onelogin.js +123 -0
- package/dist/migrate/export/onelogin.js.map +1 -0
- package/dist/migrate/export/ory-config.d.ts +58 -0
- package/dist/migrate/export/ory-config.js +451 -0
- package/dist/migrate/export/ory-config.js.map +1 -0
- package/dist/migrate/export/ory.d.ts +81 -0
- package/dist/migrate/export/ory.js +555 -0
- package/dist/migrate/export/ory.js.map +1 -0
- package/dist/migrate/export/password-detect.d.ts +29 -0
- package/dist/migrate/export/password-detect.js +81 -0
- package/dist/migrate/export/password-detect.js.map +1 -0
- package/dist/migrate/export/pingone.d.ts +36 -0
- package/dist/migrate/export/pingone.js +218 -0
- package/dist/migrate/export/pingone.js.map +1 -0
- package/dist/migrate/export/plugin-kit.d.ts +25 -0
- package/dist/migrate/export/plugin-kit.js +82 -0
- package/dist/migrate/export/plugin-kit.js.map +1 -0
- package/dist/migrate/export/pocketbase-config.d.ts +28 -0
- package/dist/migrate/export/pocketbase-config.js +180 -0
- package/dist/migrate/export/pocketbase-config.js.map +1 -0
- package/dist/migrate/export/pocketbase.d.ts +52 -0
- package/dist/migrate/export/pocketbase.js +243 -0
- package/dist/migrate/export/pocketbase.js.map +1 -0
- package/dist/migrate/export/project-files.d.ts +15 -0
- package/dist/migrate/export/project-files.js +43 -0
- package/dist/migrate/export/project-files.js.map +1 -0
- package/dist/migrate/export/propelauth-config.d.ts +18 -0
- package/dist/migrate/export/propelauth-config.js +58 -0
- package/dist/migrate/export/propelauth-config.js.map +1 -0
- package/dist/migrate/export/propelauth-harness.test-helper.d.ts +62 -0
- package/dist/migrate/export/propelauth-harness.test-helper.js +109 -0
- package/dist/migrate/export/propelauth-harness.test-helper.js.map +1 -0
- package/dist/migrate/export/propelauth.d.ts +48 -0
- package/dist/migrate/export/propelauth.js +255 -0
- package/dist/migrate/export/propelauth.js.map +1 -0
- package/dist/migrate/export/record-set.d.ts +44 -0
- package/dist/migrate/export/record-set.js +98 -0
- package/dist/migrate/export/record-set.js.map +1 -0
- package/dist/migrate/export/source-lines.d.ts +17 -0
- package/dist/migrate/export/source-lines.js +43 -0
- package/dist/migrate/export/source-lines.js.map +1 -0
- package/dist/migrate/export/sso-metadata.d.ts +47 -0
- package/dist/migrate/export/sso-metadata.js +180 -0
- package/dist/migrate/export/sso-metadata.js.map +1 -0
- package/dist/migrate/export/stytch-config.d.ts +22 -0
- package/dist/migrate/export/stytch-config.js +102 -0
- package/dist/migrate/export/stytch-config.js.map +1 -0
- package/dist/migrate/export/stytch.d.ts +68 -0
- package/dist/migrate/export/stytch.js +510 -0
- package/dist/migrate/export/stytch.js.map +1 -0
- package/dist/migrate/export/supabase-config.d.ts +48 -0
- package/dist/migrate/export/supabase-config.js +408 -0
- package/dist/migrate/export/supabase-config.js.map +1 -0
- package/dist/migrate/export/supabase.d.ts +86 -0
- package/dist/migrate/export/supabase.js +524 -0
- package/dist/migrate/export/supabase.js.map +1 -0
- package/dist/migrate/export/supertokens-config.d.ts +20 -0
- package/dist/migrate/export/supertokens-config.js +150 -0
- package/dist/migrate/export/supertokens-config.js.map +1 -0
- package/dist/migrate/export/supertokens.d.ts +125 -0
- package/dist/migrate/export/supertokens.js +464 -0
- package/dist/migrate/export/supertokens.js.map +1 -0
- package/dist/migrate/export/table.d.ts +35 -0
- package/dist/migrate/export/table.js +248 -0
- package/dist/migrate/export/table.js.map +1 -0
- package/dist/migrate/export/translate-kit.d.ts +46 -0
- package/dist/migrate/export/translate-kit.js +148 -0
- package/dist/migrate/export/translate-kit.js.map +1 -0
- package/dist/migrate/export/userfront-config.d.ts +15 -0
- package/dist/migrate/export/userfront-config.js +49 -0
- package/dist/migrate/export/userfront-config.js.map +1 -0
- package/dist/migrate/export/userfront.d.ts +38 -0
- package/dist/migrate/export/userfront.js +189 -0
- package/dist/migrate/export/userfront.js.map +1 -0
- package/dist/migrate/export/vendor-http.d.ts +46 -0
- package/dist/migrate/export/vendor-http.js +138 -0
- package/dist/migrate/export/vendor-http.js.map +1 -0
- package/dist/migrate/export/workos-config.d.ts +23 -0
- package/dist/migrate/export/workos-config.js +125 -0
- package/dist/migrate/export/workos-config.js.map +1 -0
- package/dist/migrate/export/workos.d.ts +46 -0
- package/dist/migrate/export/workos.js +272 -0
- package/dist/migrate/export/workos.js.map +1 -0
- package/dist/migrate/export/zip.d.ts +8 -0
- package/dist/migrate/export/zip.js +66 -0
- package/dist/migrate/export/zip.js.map +1 -0
- package/dist/migrate/export/zitadel-config.d.ts +37 -0
- package/dist/migrate/export/zitadel-config.js +279 -0
- package/dist/migrate/export/zitadel-config.js.map +1 -0
- package/dist/migrate/export/zitadel.d.ts +82 -0
- package/dist/migrate/export/zitadel.js +447 -0
- package/dist/migrate/export/zitadel.js.map +1 -0
- package/dist/migrate/firebase/plugin.d.ts +2 -0
- package/dist/migrate/firebase/plugin.js +152 -0
- package/dist/migrate/firebase/plugin.js.map +1 -0
- package/dist/migrate/framework/builtins.d.ts +2 -0
- package/dist/migrate/framework/builtins.js +52 -0
- package/dist/migrate/framework/builtins.js.map +1 -0
- package/dist/migrate/framework/commands.d.ts +20 -0
- package/dist/migrate/framework/commands.js +58 -0
- package/dist/migrate/framework/commands.js.map +1 -0
- package/dist/migrate/framework/custom.d.ts +12 -0
- package/dist/migrate/framework/custom.js +96 -0
- package/dist/migrate/framework/custom.js.map +1 -0
- package/dist/migrate/framework/orchestrator.d.ts +113 -0
- package/dist/migrate/framework/orchestrator.js +532 -0
- package/dist/migrate/framework/orchestrator.js.map +1 -0
- package/dist/migrate/framework/plugin.d.ts +167 -0
- package/dist/migrate/framework/plugin.js +3 -0
- package/dist/migrate/framework/plugin.js.map +1 -0
- package/dist/migrate/framework/registry.d.ts +11 -0
- package/dist/migrate/framework/registry.js +44 -0
- package/dist/migrate/framework/registry.js.map +1 -0
- package/dist/migrate/framework/report.d.ts +17 -0
- package/dist/migrate/framework/report.js +103 -0
- package/dist/migrate/framework/report.js.map +1 -0
- package/dist/migrate/frameworks/plugins.d.ts +29 -0
- package/dist/migrate/frameworks/plugins.js +402 -0
- package/dist/migrate/frameworks/plugins.js.map +1 -0
- package/dist/migrate/frameworks/report.d.ts +92 -0
- package/dist/migrate/frameworks/report.js +207 -0
- package/dist/migrate/frameworks/report.js.map +1 -0
- package/dist/migrate/frameworks/translate-js.d.ts +5 -0
- package/dist/migrate/frameworks/translate-js.js +503 -0
- package/dist/migrate/frameworks/translate-js.js.map +1 -0
- package/dist/migrate/frameworks/translate-rails-django.d.ts +3 -0
- package/dist/migrate/frameworks/translate-rails-django.js +1391 -0
- package/dist/migrate/frameworks/translate-rails-django.js.map +1 -0
- package/dist/migrate/frontegg/plugin.d.ts +2 -0
- package/dist/migrate/frontegg/plugin.js +78 -0
- package/dist/migrate/frontegg/plugin.js.map +1 -0
- package/dist/migrate/fusionauth/plugin.d.ts +2 -0
- package/dist/migrate/fusionauth/plugin.js +109 -0
- package/dist/migrate/fusionauth/plugin.js.map +1 -0
- package/dist/migrate/hanko/plugin.d.ts +2 -0
- package/dist/migrate/hanko/plugin.js +100 -0
- package/dist/migrate/hanko/plugin.js.map +1 -0
- package/dist/migrate/keycloak/plugin.d.ts +2 -0
- package/dist/migrate/keycloak/plugin.js +148 -0
- package/dist/migrate/keycloak/plugin.js.map +1 -0
- package/dist/migrate/kinde/plugin.d.ts +2 -0
- package/dist/migrate/kinde/plugin.js +105 -0
- package/dist/migrate/kinde/plugin.js.map +1 -0
- package/dist/migrate/ldap/plugin.d.ts +2 -0
- package/dist/migrate/ldap/plugin.js +73 -0
- package/dist/migrate/ldap/plugin.js.map +1 -0
- package/dist/migrate/logto/plugin.d.ts +2 -0
- package/dist/migrate/logto/plugin.js +131 -0
- package/dist/migrate/logto/plugin.js.map +1 -0
- package/dist/migrate/magic/plugin.d.ts +2 -0
- package/dist/migrate/magic/plugin.js +56 -0
- package/dist/migrate/magic/plugin.js.map +1 -0
- package/dist/migrate/nhost/plugin.d.ts +2 -0
- package/dist/migrate/nhost/plugin.js +115 -0
- package/dist/migrate/nhost/plugin.js.map +1 -0
- package/dist/migrate/oidc/plugin.d.ts +2 -0
- package/dist/migrate/oidc/plugin.js +73 -0
- package/dist/migrate/oidc/plugin.js.map +1 -0
- package/dist/migrate/okta/plugin.d.ts +2 -0
- package/dist/migrate/okta/plugin.js +105 -0
- package/dist/migrate/okta/plugin.js.map +1 -0
- package/dist/migrate/onelogin/plugin.d.ts +2 -0
- package/dist/migrate/onelogin/plugin.js +61 -0
- package/dist/migrate/onelogin/plugin.js.map +1 -0
- package/dist/migrate/ory/plugin.d.ts +2 -0
- package/dist/migrate/ory/plugin.js +186 -0
- package/dist/migrate/ory/plugin.js.map +1 -0
- package/dist/migrate/ping-identity/plugin.d.ts +2 -0
- package/dist/migrate/ping-identity/plugin.js +100 -0
- package/dist/migrate/ping-identity/plugin.js.map +1 -0
- package/dist/migrate/pocketbase/plugin.d.ts +2 -0
- package/dist/migrate/pocketbase/plugin.js +99 -0
- package/dist/migrate/pocketbase/plugin.js.map +1 -0
- package/dist/migrate/propelauth/plugin.d.ts +2 -0
- package/dist/migrate/propelauth/plugin.js +65 -0
- package/dist/migrate/propelauth/plugin.js.map +1 -0
- package/dist/migrate/saml/plugin.d.ts +2 -0
- package/dist/migrate/saml/plugin.js +79 -0
- package/dist/migrate/saml/plugin.js.map +1 -0
- package/dist/migrate/stytch/plugin.d.ts +2 -0
- package/dist/migrate/stytch/plugin.js +97 -0
- package/dist/migrate/stytch/plugin.js.map +1 -0
- package/dist/migrate/supabase/plugin.d.ts +2 -0
- package/dist/migrate/supabase/plugin.js +149 -0
- package/dist/migrate/supabase/plugin.js.map +1 -0
- package/dist/migrate/supertokens/plugin.d.ts +2 -0
- package/dist/migrate/supertokens/plugin.js +114 -0
- package/dist/migrate/supertokens/plugin.js.map +1 -0
- package/dist/migrate/user-table/plugin.d.ts +2 -0
- package/dist/migrate/user-table/plugin.js +62 -0
- package/dist/migrate/user-table/plugin.js.map +1 -0
- package/dist/migrate/userfront/plugin.d.ts +2 -0
- package/dist/migrate/userfront/plugin.js +60 -0
- package/dist/migrate/userfront/plugin.js.map +1 -0
- package/dist/migrate/workos/plugin.d.ts +2 -0
- package/dist/migrate/workos/plugin.js +81 -0
- package/dist/migrate/workos/plugin.js.map +1 -0
- package/dist/migrate/zitadel/plugin.d.ts +2 -0
- package/dist/migrate/zitadel/plugin.js +114 -0
- package/dist/migrate/zitadel/plugin.js.map +1 -0
- package/dist/output.d.ts +41 -0
- package/dist/output.js +72 -0
- package/dist/output.js.map +1 -0
- package/dist/project.d.ts +64 -0
- package/dist/project.js +86 -0
- package/dist/project.js.map +1 -0
- package/dist/prompt.d.ts +15 -0
- package/dist/prompt.js +46 -0
- package/dist/prompt.js.map +1 -0
- package/dist/run.d.ts +12 -0
- package/dist/run.js +157 -0
- package/dist/run.js.map +1 -0
- package/dist/secrets.d.ts +41 -0
- package/dist/secrets.js +142 -0
- package/dist/secrets.js.map +1 -0
- package/dist/serialize.d.ts +30 -0
- package/dist/serialize.js +131 -0
- package/dist/serialize.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.js +21 -0
- package/dist/version.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fusionAuthPassword = fusionAuthPassword;
|
|
4
|
+
exports.fusionAuthBase = fusionAuthBase;
|
|
5
|
+
exports.fusionAuthHttp = fusionAuthHttp;
|
|
6
|
+
exports.fetchFusionAuth = fetchFusionAuth;
|
|
7
|
+
exports.fusionAuthSnapshotFromTables = fusionAuthSnapshotFromTables;
|
|
8
|
+
exports.mapFusionAuth = mapFusionAuth;
|
|
9
|
+
exports.exportFusionAuth = exportFusionAuth;
|
|
10
|
+
const node_crypto_1 = require("node:crypto");
|
|
11
|
+
const tables_1 = require("./frameworks/tables");
|
|
12
|
+
const record_set_1 = require("./record-set");
|
|
13
|
+
const translate_kit_1 = require("./translate-kit");
|
|
14
|
+
const vendor_http_1 = require("./vendor-http");
|
|
15
|
+
// ── password schemes ────────────────────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* A FusionAuth password (`password`, `salt`, `factor`, `encryption_scheme`) →
|
|
18
|
+
* an Atlas hash. Schemes and their registry ids are documented in core's
|
|
19
|
+
* fusionauth-hashes.ts; salts are base64 except bcrypt's 22-character salt.
|
|
20
|
+
*/
|
|
21
|
+
function fusionAuthPassword(u) {
|
|
22
|
+
const value = (0, record_set_1.str)(u.password);
|
|
23
|
+
if (!value)
|
|
24
|
+
return null;
|
|
25
|
+
const scheme = (0, record_set_1.str)(u.encryptionScheme)?.toLowerCase();
|
|
26
|
+
const salt = (0, record_set_1.str)(u.salt);
|
|
27
|
+
const factor = Number(u.factor);
|
|
28
|
+
if (!scheme)
|
|
29
|
+
return { problem: 'no encryption scheme' };
|
|
30
|
+
const needs = (what) => ({ problem: `${scheme} without ${what}` });
|
|
31
|
+
if (scheme === 'bcrypt') {
|
|
32
|
+
if (!salt || !Number.isInteger(factor) || factor < 4 || factor > 31)
|
|
33
|
+
return needs('a salt or cost factor');
|
|
34
|
+
return { hash: { algorithm: 'bcrypt', hash: `$2a$${String(factor).padStart(2, '0')}$${salt}${value}` } };
|
|
35
|
+
}
|
|
36
|
+
const pbkdf2 = /^salted-pbkdf2-hmac-(sha256|sha512)(?:-512)?$/.exec(scheme);
|
|
37
|
+
if (pbkdf2) {
|
|
38
|
+
if (!salt || !Number.isInteger(factor) || factor < 1)
|
|
39
|
+
return needs('a salt or iteration count');
|
|
40
|
+
return { hash: { algorithm: 'pbkdf2', hash: value, salt, params: { digest: pbkdf2[1], iterations: factor, encoding: 'base64', salt_encoding: 'base64' } } };
|
|
41
|
+
}
|
|
42
|
+
if (scheme === 'salted-hmac-sha256') {
|
|
43
|
+
if (!salt)
|
|
44
|
+
return needs('a salt');
|
|
45
|
+
return { hash: { algorithm: 'hmac_sha256', hash: value, salt, params: { key_encoding: 'base64', encoding: 'base64' } } };
|
|
46
|
+
}
|
|
47
|
+
if (scheme === 'salted-md5' || scheme === 'salted-sha256') {
|
|
48
|
+
if (!salt || !Number.isInteger(factor) || factor < 1)
|
|
49
|
+
return needs('a salt or factor');
|
|
50
|
+
return { hash: { algorithm: 'fusionauth_salted', hash: value, salt, params: { digest: scheme === 'salted-md5' ? 'md5' : 'sha256', iterations: factor } } };
|
|
51
|
+
}
|
|
52
|
+
if (scheme === 'phpass-md5' || scheme === 'phppass-sha512' || scheme === 'phpass-sha512') {
|
|
53
|
+
if (!salt || !Number.isInteger(factor) || factor < 1)
|
|
54
|
+
return needs('a salt or factor');
|
|
55
|
+
return { hash: { algorithm: 'fusionauth_phpass', hash: value, salt, params: { digest: scheme === 'phpass-md5' ? 'md5' : 'sha512', iterations: factor } } };
|
|
56
|
+
}
|
|
57
|
+
return { problem: `the "${scheme}" scheme (a custom password plugin)` };
|
|
58
|
+
}
|
|
59
|
+
function fusionAuthBase(raw) {
|
|
60
|
+
const s = raw.trim().replace(/\/+$/, '');
|
|
61
|
+
return /^https?:\/\//.test(s) ? s : `https://${s}`;
|
|
62
|
+
}
|
|
63
|
+
function fusionAuthHttp(o) {
|
|
64
|
+
return new vendor_http_1.VendorHttp({
|
|
65
|
+
vendor: 'FusionAuth',
|
|
66
|
+
baseUrl: fusionAuthBase(o.baseUrl),
|
|
67
|
+
headers: { authorization: o.apiKey, ...(o.tenantId ? { 'X-FusionAuth-TenantId': o.tenantId } : {}) },
|
|
68
|
+
fetchImpl: o.fetchImpl,
|
|
69
|
+
sleep: o.sleep,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Read a tenant through the API into a snapshot. */
|
|
73
|
+
async function fetchFusionAuth(http, o) {
|
|
74
|
+
const progress = o.onProgress ?? (() => undefined);
|
|
75
|
+
const warn = o.warn ?? (() => undefined);
|
|
76
|
+
const size = Math.min(Math.max(o.pageSize ?? 100, 1), 1000);
|
|
77
|
+
/** A resource the key may not read (401/403) or this version lacks (404). */
|
|
78
|
+
const optional = async (path, what, pick, empty) => {
|
|
79
|
+
try {
|
|
80
|
+
const { body } = await http.get(path);
|
|
81
|
+
return (0, record_set_1.isObj)(body) ? pick(body) : empty;
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
if (!(err instanceof vendor_http_1.VendorApiError) || ![401, 403, 404].includes(err.status))
|
|
85
|
+
throw err;
|
|
86
|
+
if (err.status !== 404)
|
|
87
|
+
warn(`${what} could not be read with this API key (${err.status}) and were skipped.`);
|
|
88
|
+
return empty;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
progress('tenants and applications');
|
|
92
|
+
const tenants = await optional('/api/tenant', 'Tenants', (b) => (0, record_set_1.objs)(b.tenants), []);
|
|
93
|
+
const applications = await optional('/api/application', 'Applications', (b) => (0, record_set_1.objs)(b.applications), []);
|
|
94
|
+
progress('groups');
|
|
95
|
+
const groups = await optional('/api/group', 'Groups', (b) => (0, record_set_1.objs)(b.groups), []);
|
|
96
|
+
progress('identity providers');
|
|
97
|
+
const identityProviders = await optional('/api/identity-provider', 'Identity providers', (b) => (0, record_set_1.objs)(b.identityProviders), []);
|
|
98
|
+
const keys = {};
|
|
99
|
+
for (const idp of identityProviders) {
|
|
100
|
+
const keyId = (0, record_set_1.str)(idp.keyId);
|
|
101
|
+
if (!keyId || keys[keyId])
|
|
102
|
+
continue;
|
|
103
|
+
const pem = await optional(`/api/key/${encodeURIComponent(keyId)}`, `Key ${keyId}`, (b) => ((0, record_set_1.isObj)(b.key) ? (0, record_set_1.str)(b.key.publicKey) : undefined), undefined);
|
|
104
|
+
if (pem)
|
|
105
|
+
keys[keyId] = pem;
|
|
106
|
+
}
|
|
107
|
+
progress('API keys');
|
|
108
|
+
const apiKeys = await optional('/api/api-key', 'API keys', (b) => (0, record_set_1.objs)(b.apiKeys), []);
|
|
109
|
+
progress('users');
|
|
110
|
+
const users = [];
|
|
111
|
+
for (let startRow = 0;; startRow += size) {
|
|
112
|
+
const { body } = await http.post('/api/user/search', { search: { queryString: '*', numberOfResults: size, startRow } });
|
|
113
|
+
const page = (0, record_set_1.isObj)(body) ? (0, record_set_1.objs)(body.users) : [];
|
|
114
|
+
users.push(...page);
|
|
115
|
+
const total = (0, record_set_1.isObj)(body) && typeof body.total === 'number' ? body.total : undefined;
|
|
116
|
+
if (page.length < size || (total !== undefined && startRow + size >= total))
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
for (const [i, u] of users.entries()) {
|
|
120
|
+
const id = (0, record_set_1.str)(u.id);
|
|
121
|
+
if (!id)
|
|
122
|
+
continue;
|
|
123
|
+
if (i > 0 && i % 100 === 0)
|
|
124
|
+
progress(`users (${i}/${users.length})`);
|
|
125
|
+
u.links = await optional(`/api/identity-provider/link?userId=${encodeURIComponent(id)}`, 'Identity provider links', (b) => (0, record_set_1.objs)(b.identityProviderLinks), []);
|
|
126
|
+
const methods = (0, record_set_1.isObj)(u.twoFactor) ? (0, record_set_1.objs)(u.twoFactor.methods) : [];
|
|
127
|
+
if (methods.length)
|
|
128
|
+
u.recoveryCodes = await optional(`/api/user/two-factor/recovery-code/${encodeURIComponent(id)}`, 'Recovery codes', (b) => (0, record_set_1.strs)(b.recoveryCodes), []);
|
|
129
|
+
}
|
|
130
|
+
return { baseUrl: fusionAuthBase(o.baseUrl), tenants, applications, groups, identityProviders, keys, apiKeys, users, source: 'api' };
|
|
131
|
+
}
|
|
132
|
+
const roleLookup = (rows, idCol) => new Map(rows.map((r) => [(0, tables_1.text)((0, tables_1.col)(r, ...idCol)) ?? '', r]));
|
|
133
|
+
/**
|
|
134
|
+
* A snapshot from a dump of a self-hosted FusionAuth database: one file per
|
|
135
|
+
* table (`psql \copy users TO 'users.csv' CSV HEADER`, or `mysql … --batch`
|
|
136
|
+
* converted, or a JSON array), named as in FusionAuth's schema: `users`,
|
|
137
|
+
* `identities` (1.59+), `tenants`, `applications`, `application_roles`,
|
|
138
|
+
* `user_registrations`, `user_registrations_application_roles`, `groups`,
|
|
139
|
+
* `group_members`, `group_application_roles`, `identity_providers`,
|
|
140
|
+
* `identity_provider_links`, `twofactor_methods`, `twofactor_recovery_codes`,
|
|
141
|
+
* `api_keys`, `keys`.
|
|
142
|
+
*/
|
|
143
|
+
function fusionAuthSnapshotFromTables(t) {
|
|
144
|
+
const tenantRows = t.rows('tenants');
|
|
145
|
+
const tenants = tenantRows.map((r) => {
|
|
146
|
+
const data = (0, tables_1.json)((0, tables_1.col)(r, 'data')) ?? {};
|
|
147
|
+
return (0, record_set_1.compact)({ id: (0, tables_1.text)((0, tables_1.col)(r, 'id')), name: (0, tables_1.text)((0, tables_1.col)(r, 'name')), issuer: (0, tables_1.text)(data.issuer) ?? (0, tables_1.text)((0, tables_1.col)(r, 'issuer')) });
|
|
148
|
+
});
|
|
149
|
+
const appRoles = t.rows('application_roles');
|
|
150
|
+
const roleById = roleLookup(appRoles, ['id']);
|
|
151
|
+
const rolesByApp = new Map();
|
|
152
|
+
for (const r of appRoles) {
|
|
153
|
+
const appId = (0, tables_1.text)((0, tables_1.col)(r, 'applications_id', 'application_id'));
|
|
154
|
+
if (!appId)
|
|
155
|
+
continue;
|
|
156
|
+
const list = rolesByApp.get(appId) ?? [];
|
|
157
|
+
list.push({ id: (0, tables_1.text)((0, tables_1.col)(r, 'id')), name: (0, tables_1.text)((0, tables_1.col)(r, 'name')), isDefault: (0, tables_1.bool)((0, tables_1.col)(r, 'is_default')), isSuperRole: (0, tables_1.bool)((0, tables_1.col)(r, 'is_super_role')) });
|
|
158
|
+
rolesByApp.set(appId, list);
|
|
159
|
+
}
|
|
160
|
+
const applications = t.rows('applications').map((r) => ({
|
|
161
|
+
id: (0, tables_1.text)((0, tables_1.col)(r, 'id')),
|
|
162
|
+
name: (0, tables_1.text)((0, tables_1.col)(r, 'name')),
|
|
163
|
+
tenantId: (0, tables_1.text)((0, tables_1.col)(r, 'tenants_id', 'tenant_id')),
|
|
164
|
+
roles: rolesByApp.get((0, tables_1.text)((0, tables_1.col)(r, 'id')) ?? '') ?? [],
|
|
165
|
+
}));
|
|
166
|
+
const groupRoles = new Map();
|
|
167
|
+
for (const r of t.rows('group_application_roles')) {
|
|
168
|
+
const role = roleById.get((0, tables_1.text)((0, tables_1.col)(r, 'application_roles_id', 'application_role_id')) ?? '');
|
|
169
|
+
const gid = (0, tables_1.text)((0, tables_1.col)(r, 'groups_id', 'group_id'));
|
|
170
|
+
const name = role && (0, tables_1.text)((0, tables_1.col)(role, 'name'));
|
|
171
|
+
const appId = role && (0, tables_1.text)((0, tables_1.col)(role, 'applications_id', 'application_id'));
|
|
172
|
+
if (!gid || !name || !appId)
|
|
173
|
+
continue;
|
|
174
|
+
const m = groupRoles.get(gid) ?? {};
|
|
175
|
+
(m[appId] ??= []).push(name);
|
|
176
|
+
groupRoles.set(gid, m);
|
|
177
|
+
}
|
|
178
|
+
const groups = t.rows('groups').map((r) => ({ id: (0, tables_1.text)((0, tables_1.col)(r, 'id')), name: (0, tables_1.text)((0, tables_1.col)(r, 'name')), tenantId: (0, tables_1.text)((0, tables_1.col)(r, 'tenants_id', 'tenant_id')), roles: groupRoles.get((0, tables_1.text)((0, tables_1.col)(r, 'id')) ?? '') ?? {} }));
|
|
179
|
+
const memberships = new Map();
|
|
180
|
+
for (const r of t.rows('group_members')) {
|
|
181
|
+
const uid = (0, tables_1.text)((0, tables_1.col)(r, 'users_id', 'user_id'));
|
|
182
|
+
if (!uid)
|
|
183
|
+
continue;
|
|
184
|
+
(memberships.get(uid) ?? memberships.set(uid, []).get(uid)).push({ groupId: (0, tables_1.text)((0, tables_1.col)(r, 'groups_id', 'group_id')) });
|
|
185
|
+
}
|
|
186
|
+
const regRoles = new Map();
|
|
187
|
+
for (const r of t.rows('user_registrations_application_roles')) {
|
|
188
|
+
const role = roleById.get((0, tables_1.text)((0, tables_1.col)(r, 'application_roles_id', 'application_role_id')) ?? '');
|
|
189
|
+
const rid = (0, tables_1.text)((0, tables_1.col)(r, 'user_registrations_id', 'user_registration_id'));
|
|
190
|
+
const name = role && (0, tables_1.text)((0, tables_1.col)(role, 'name'));
|
|
191
|
+
if (rid && name)
|
|
192
|
+
(regRoles.get(rid) ?? regRoles.set(rid, []).get(rid)).push(name);
|
|
193
|
+
}
|
|
194
|
+
const registrations = new Map();
|
|
195
|
+
for (const r of t.rows('user_registrations')) {
|
|
196
|
+
const uid = (0, tables_1.text)((0, tables_1.col)(r, 'users_id', 'user_id'));
|
|
197
|
+
if (!uid)
|
|
198
|
+
continue;
|
|
199
|
+
(registrations.get(uid) ?? registrations.set(uid, []).get(uid)).push({
|
|
200
|
+
applicationId: (0, tables_1.text)((0, tables_1.col)(r, 'applications_id', 'application_id')),
|
|
201
|
+
username: (0, tables_1.text)((0, tables_1.col)(r, 'username')),
|
|
202
|
+
verified: (0, tables_1.bool)((0, tables_1.col)(r, 'verified')),
|
|
203
|
+
roles: regRoles.get((0, tables_1.text)((0, tables_1.col)(r, 'id')) ?? '') ?? [],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const links = new Map();
|
|
207
|
+
for (const r of t.rows('identity_provider_links', 'identity_providers_links')) {
|
|
208
|
+
const uid = (0, tables_1.text)((0, tables_1.col)(r, 'users_id', 'user_id'));
|
|
209
|
+
if (!uid)
|
|
210
|
+
continue;
|
|
211
|
+
(links.get(uid) ?? links.set(uid, []).get(uid)).push({
|
|
212
|
+
identityProviderId: (0, tables_1.text)((0, tables_1.col)(r, 'identity_providers_id', 'identity_provider_id')),
|
|
213
|
+
identityProviderUserId: (0, tables_1.text)((0, tables_1.col)(r, 'identity_provider_user_id')),
|
|
214
|
+
displayName: (0, tables_1.text)((0, tables_1.col)(r, 'display_name')),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const methods = new Map();
|
|
218
|
+
for (const r of t.rows('twofactor_methods', 'two_factor_methods')) {
|
|
219
|
+
const uid = (0, tables_1.text)((0, tables_1.col)(r, 'users_id', 'user_id'));
|
|
220
|
+
if (!uid)
|
|
221
|
+
continue;
|
|
222
|
+
const settings = (0, tables_1.json)((0, tables_1.col)(r, 'settings', 'data')) ?? {};
|
|
223
|
+
const authenticator = (0, record_set_1.isObj)(settings.authenticator) ? settings.authenticator : {};
|
|
224
|
+
(methods.get(uid) ?? methods.set(uid, []).get(uid)).push((0, record_set_1.compact)({ id: (0, tables_1.text)((0, tables_1.col)(r, 'id')), method: (0, tables_1.text)((0, tables_1.col)(r, 'method')), mobilePhone: (0, tables_1.text)((0, tables_1.col)(r, 'mobile_phone')), email: (0, tables_1.text)((0, tables_1.col)(r, 'email')), authenticator: (0, record_set_1.compact)({ ...authenticator, secret: (0, tables_1.text)((0, tables_1.col)(r, 'secret')) }) }));
|
|
225
|
+
}
|
|
226
|
+
const recovery = new Map();
|
|
227
|
+
for (const r of t.rows('twofactor_recovery_codes', 'two_factor_recovery_codes')) {
|
|
228
|
+
const uid = (0, tables_1.text)((0, tables_1.col)(r, 'users_id', 'user_id'));
|
|
229
|
+
const raw = (0, tables_1.col)(r, 'recovery_codes', 'codes');
|
|
230
|
+
let codes = [];
|
|
231
|
+
if (Array.isArray(raw))
|
|
232
|
+
codes = (0, record_set_1.strs)(raw);
|
|
233
|
+
else if (typeof raw === 'string') {
|
|
234
|
+
try {
|
|
235
|
+
const parsed = JSON.parse(raw);
|
|
236
|
+
codes = Array.isArray(parsed) ? (0, record_set_1.strs)(parsed) : [];
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
codes = raw.split(/[\s,;]+/).filter(Boolean);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (uid && codes.length)
|
|
243
|
+
recovery.set(uid, codes);
|
|
244
|
+
}
|
|
245
|
+
// 1.59+ keeps email / username in `identities`; older versions have them on `users`.
|
|
246
|
+
const identities = new Map();
|
|
247
|
+
for (const r of t.rows('identities')) {
|
|
248
|
+
const uid = (0, tables_1.text)((0, tables_1.col)(r, 'users_id', 'user_id'));
|
|
249
|
+
if (uid)
|
|
250
|
+
(identities.get(uid) ?? identities.set(uid, []).get(uid)).push(r);
|
|
251
|
+
}
|
|
252
|
+
const users = t.rows('users').map((r) => {
|
|
253
|
+
const id = (0, tables_1.text)((0, tables_1.col)(r, 'id'));
|
|
254
|
+
const idents = identities.get(id) ?? [];
|
|
255
|
+
const emailRow = idents.find((i) => (0, tables_1.text)((0, tables_1.col)(i, 'email')));
|
|
256
|
+
const nameRow = idents.find((i) => (0, tables_1.text)((0, tables_1.col)(i, 'username')));
|
|
257
|
+
const data = (0, tables_1.json)((0, tables_1.col)(r, 'data')) ?? {};
|
|
258
|
+
const mfa = methods.get(id) ?? [];
|
|
259
|
+
// Before 1.26 a single secret lived on the user row.
|
|
260
|
+
const legacySecret = (0, tables_1.text)((0, tables_1.col)(r, 'two_factor_secret'));
|
|
261
|
+
if (!mfa.length && legacySecret)
|
|
262
|
+
mfa.push({ method: 'authenticator', authenticator: { secret: legacySecret } });
|
|
263
|
+
return (0, record_set_1.compact)({
|
|
264
|
+
id,
|
|
265
|
+
tenantId: (0, tables_1.text)((0, tables_1.col)(r, 'tenants_id', 'tenant_id')),
|
|
266
|
+
email: (0, tables_1.text)((0, tables_1.col)(emailRow ?? r, 'email')),
|
|
267
|
+
verified: (0, tables_1.bool)((0, tables_1.col)(emailRow ?? r, 'verified')),
|
|
268
|
+
username: (0, tables_1.text)((0, tables_1.col)(nameRow ?? r, 'username')),
|
|
269
|
+
firstName: (0, tables_1.text)((0, tables_1.col)(r, 'first_name')),
|
|
270
|
+
lastName: (0, tables_1.text)((0, tables_1.col)(r, 'last_name')),
|
|
271
|
+
fullName: (0, tables_1.text)((0, tables_1.col)(r, 'full_name')),
|
|
272
|
+
mobilePhone: (0, tables_1.text)((0, tables_1.col)(r, 'mobile_phone')),
|
|
273
|
+
imageUrl: (0, tables_1.text)((0, tables_1.col)(r, 'image_url')),
|
|
274
|
+
active: (0, tables_1.col)(r, 'active') === undefined ? true : (0, tables_1.bool)((0, tables_1.col)(r, 'active')),
|
|
275
|
+
insertInstant: (0, tables_1.time)((0, tables_1.col)(r, 'insert_instant')),
|
|
276
|
+
lastLoginInstant: (0, tables_1.time)((0, tables_1.col)(r, 'last_login_instant')),
|
|
277
|
+
passwordChangeRequired: (0, tables_1.bool)((0, tables_1.col)(r, 'password_change_required')),
|
|
278
|
+
data,
|
|
279
|
+
password: (0, tables_1.text)((0, tables_1.col)(r, 'password')),
|
|
280
|
+
salt: (0, tables_1.text)((0, tables_1.col)(r, 'salt')),
|
|
281
|
+
factor: (0, tables_1.col)(r, 'factor'),
|
|
282
|
+
encryptionScheme: (0, tables_1.text)((0, tables_1.col)(r, 'encryption_scheme')),
|
|
283
|
+
registrations: registrations.get(id) ?? [],
|
|
284
|
+
memberships: memberships.get(id) ?? [],
|
|
285
|
+
twoFactor: mfa.length ? { methods: mfa } : undefined,
|
|
286
|
+
links: links.get(id) ?? [],
|
|
287
|
+
recoveryCodes: recovery.get(id),
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
const idps = t.rows('identity_providers').map((r) => {
|
|
291
|
+
const data = (0, tables_1.json)((0, tables_1.col)(r, 'data', 'settings')) ?? {};
|
|
292
|
+
return { ...data, id: (0, tables_1.text)((0, tables_1.col)(r, 'id')), type: (0, tables_1.text)((0, tables_1.col)(r, 'type')), name: (0, tables_1.text)((0, tables_1.col)(r, 'name')), enabled: (0, tables_1.col)(r, 'enabled') === undefined ? true : (0, tables_1.bool)((0, tables_1.col)(r, 'enabled')), keyId: (0, tables_1.text)((0, tables_1.col)(r, 'keys_id', 'key_id')) ?? (0, tables_1.text)(data.keyId) };
|
|
293
|
+
});
|
|
294
|
+
const keys = {};
|
|
295
|
+
for (const r of t.rows('keys')) {
|
|
296
|
+
const id = (0, tables_1.text)((0, tables_1.col)(r, 'id'));
|
|
297
|
+
const pem = (0, tables_1.text)((0, tables_1.col)(r, 'public_key', 'certificate'));
|
|
298
|
+
if (id && pem)
|
|
299
|
+
keys[id] = pem;
|
|
300
|
+
}
|
|
301
|
+
const apiKeys = t.rows('api_keys').map((r) => (0, record_set_1.compact)({
|
|
302
|
+
id: (0, tables_1.text)((0, tables_1.col)(r, 'id')),
|
|
303
|
+
key: (0, tables_1.text)((0, tables_1.col)(r, 'key_value', 'key')),
|
|
304
|
+
keyManager: (0, tables_1.bool)((0, tables_1.col)(r, 'key_manager')),
|
|
305
|
+
metaData: (0, tables_1.json)((0, tables_1.col)(r, 'meta_data', 'metadata')),
|
|
306
|
+
tenantId: (0, tables_1.text)((0, tables_1.col)(r, 'tenants_id', 'tenant_id')),
|
|
307
|
+
expirationInstant: (0, tables_1.time)((0, tables_1.col)(r, 'expiration_instant', 'expiration')),
|
|
308
|
+
insertInstant: (0, tables_1.time)((0, tables_1.col)(r, 'insert_instant')),
|
|
309
|
+
}));
|
|
310
|
+
return { tenants, applications, groups, identityProviders: idps, keys, apiKeys, users, source: 'database' };
|
|
311
|
+
}
|
|
312
|
+
// ── mapping ─────────────────────────────────────────────────────────────────
|
|
313
|
+
/** Enterprise identity providers: SSO connections, not social sign-in. */
|
|
314
|
+
const ENTERPRISE = new Set(['SAMLv2', 'OpenIDConnect', 'SAMLv2IdPInitiated']);
|
|
315
|
+
const epoch = (v) => (typeof v === 'number' && v > 0 ? v : typeof v === 'string' ? (Date.parse(v) || undefined) : undefined);
|
|
316
|
+
function authenticatorSecret(raw) {
|
|
317
|
+
// FusionAuth keeps the authenticator secret base64 encoded; Atlas wants base32.
|
|
318
|
+
const bytes = Buffer.from(raw, 'base64');
|
|
319
|
+
if (!bytes.length)
|
|
320
|
+
return undefined;
|
|
321
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
322
|
+
let bits = 0;
|
|
323
|
+
let acc = 0;
|
|
324
|
+
let out = '';
|
|
325
|
+
for (const b of bytes) {
|
|
326
|
+
acc = (acc << 8) | b;
|
|
327
|
+
bits += 8;
|
|
328
|
+
while (bits >= 5) {
|
|
329
|
+
out += alphabet[(acc >>> (bits - 5)) & 31];
|
|
330
|
+
bits -= 5;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (bits > 0)
|
|
334
|
+
out += alphabet[(acc << (5 - bits)) & 31];
|
|
335
|
+
return out;
|
|
336
|
+
}
|
|
337
|
+
/** Map a snapshot (API or database) onto canonical records. */
|
|
338
|
+
function mapFusionAuth(snap, opts = {}) {
|
|
339
|
+
const set = new record_set_1.RecordSet();
|
|
340
|
+
const groupsAs = opts.groupsAs ?? 'organizations';
|
|
341
|
+
const tenantsAs = opts.tenantsAs ?? (snap.tenants.length > 1 ? 'organizations' : 'skip');
|
|
342
|
+
const tenantName = new Map(snap.tenants.map((t) => [(0, record_set_1.str)(t.id) ?? '', (0, record_set_1.str)(t.name) ?? (0, record_set_1.str)(t.id) ?? '']));
|
|
343
|
+
const appName = new Map(snap.applications.map((a) => [(0, record_set_1.str)(a.id) ?? '', (0, record_set_1.str)(a.name) ?? '']));
|
|
344
|
+
// ── organizations: tenants and groups ──
|
|
345
|
+
const orgIds = new Set();
|
|
346
|
+
if (tenantsAs === 'organizations') {
|
|
347
|
+
for (const t of snap.tenants) {
|
|
348
|
+
const id = (0, record_set_1.str)(t.id);
|
|
349
|
+
if (!id)
|
|
350
|
+
continue;
|
|
351
|
+
orgIds.add(`tenant:${id}`);
|
|
352
|
+
set.add('organization', (0, record_set_1.compact)({ id: `tenant:${id}`, name: tenantName.get(id), slug: (0, translate_kit_1.keyOf)(tenantName.get(id)).replace(/_/g, '-'), private_metadata: { fusionauth_tenant_id: id, fusionauth_issuer: (0, record_set_1.str)(t.issuer) } }));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
const groups = new Map();
|
|
356
|
+
for (const g of snap.groups)
|
|
357
|
+
if ((0, record_set_1.str)(g.id) && (0, record_set_1.str)(g.name))
|
|
358
|
+
groups.set((0, record_set_1.str)(g.id), g);
|
|
359
|
+
if (groupsAs === 'organizations') {
|
|
360
|
+
for (const g of groups.values()) {
|
|
361
|
+
const id = (0, record_set_1.str)(g.id);
|
|
362
|
+
orgIds.add(`group:${id}`);
|
|
363
|
+
set.add('organization', { id: `group:${id}`, name: (0, record_set_1.str)(g.name), slug: (0, translate_kit_1.keyOf)((0, record_set_1.str)(g.name)).replace(/_/g, '-'), private_metadata: { fusionauth_group_id: id } });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (orgIds.size)
|
|
367
|
+
set.add('role', { key: 'member', name: 'Member', scope: 'organization' }, 'org:member');
|
|
368
|
+
// ── roles: application roles (FusionAuth puts the plain names in the JWT roles claim) ──
|
|
369
|
+
for (const app of snap.applications) {
|
|
370
|
+
for (const r of (0, record_set_1.objs)(app.roles)) {
|
|
371
|
+
const name = (0, record_set_1.str)(r.name);
|
|
372
|
+
if (!name)
|
|
373
|
+
continue;
|
|
374
|
+
set.add('role', (0, record_set_1.compact)({ key: (0, translate_kit_1.keyOf)(name), name, description: r.isSuperRole === true ? `Super role of ${appName.get((0, record_set_1.str)(app.id) ?? '') || 'an application'}` : undefined, scope: 'app' }), (0, translate_kit_1.keyOf)(name));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (groupsAs === 'roles') {
|
|
378
|
+
for (const g of groups.values())
|
|
379
|
+
set.add('role', { key: `group:${(0, translate_kit_1.keyOf)((0, record_set_1.str)(g.name))}`, name: (0, record_set_1.str)(g.name), description: 'FusionAuth group', scope: 'app' }, `group:${(0, translate_kit_1.keyOf)((0, record_set_1.str)(g.name))}`);
|
|
380
|
+
}
|
|
381
|
+
// ── identity providers ──
|
|
382
|
+
const idps = new Map();
|
|
383
|
+
for (const idp of snap.identityProviders)
|
|
384
|
+
if ((0, record_set_1.str)(idp.id))
|
|
385
|
+
idps.set((0, record_set_1.str)(idp.id), idp);
|
|
386
|
+
const connections = new Set();
|
|
387
|
+
for (const [id, idp] of idps) {
|
|
388
|
+
const type = (0, record_set_1.str)(idp.type) ?? '';
|
|
389
|
+
if (!ENTERPRISE.has(type))
|
|
390
|
+
continue;
|
|
391
|
+
if (type === 'SAMLv2IdPInitiated') {
|
|
392
|
+
set.omit('sso_connection', `IdP-initiated SAML provider ${(0, record_set_1.str)(idp.name) ?? id}: Atlas SAML connections are SP-initiated`);
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
set.add('sso_connection', ssoConnection(idp, id, snap, (m) => set.warn(m)));
|
|
396
|
+
connections.add(id);
|
|
397
|
+
}
|
|
398
|
+
// ── users ──
|
|
399
|
+
const counts = { password: 0, totp: 0, forced: 0, inactive: 0 };
|
|
400
|
+
const badHashes = new Map();
|
|
401
|
+
const seenUsernames = new Set();
|
|
402
|
+
const userIds = new Set();
|
|
403
|
+
for (const u of snap.users) {
|
|
404
|
+
const id = (0, record_set_1.str)(u.id);
|
|
405
|
+
if (!id)
|
|
406
|
+
continue;
|
|
407
|
+
const email = (0, record_set_1.str)(u.email)?.toLowerCase();
|
|
408
|
+
const username = (0, record_set_1.str)(u.username)?.toLowerCase();
|
|
409
|
+
const phone = (0, record_set_1.e164)(u.mobilePhone);
|
|
410
|
+
if (!email && !username && !phone) {
|
|
411
|
+
set.omit('user', 'no email, username or phone');
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
const name = (0, record_set_1.str)(u.fullName);
|
|
415
|
+
const user = (0, record_set_1.compact)({
|
|
416
|
+
id,
|
|
417
|
+
emails: email ? [{ email, verified: u.verified === true, primary: true }] : [],
|
|
418
|
+
phones: phone ? [{ phone, verified: false, primary: !email }] : [],
|
|
419
|
+
username: username && !seenUsernames.has(username) ? username : undefined,
|
|
420
|
+
first_name: (0, record_set_1.str)(u.firstName),
|
|
421
|
+
last_name: (0, record_set_1.str)(u.lastName),
|
|
422
|
+
name: !(0, record_set_1.str)(u.firstName) && !(0, record_set_1.str)(u.lastName) ? name : undefined,
|
|
423
|
+
image_url: typeof u.imageUrl === 'string' && /^https:\/\//.test(u.imageUrl) ? u.imageUrl : undefined,
|
|
424
|
+
banned: u.active === false ? true : undefined,
|
|
425
|
+
ban_reason: u.active === false ? 'Deactivated in FusionAuth' : undefined,
|
|
426
|
+
private_metadata: (0, record_set_1.bag)((0, record_set_1.compact)({ ...((0, record_set_1.isObj)(u.data) ? u.data : {}), fusionauth_tenant_id: (0, record_set_1.str)(u.tenantId), fusionauth_password_change_required: u.passwordChangeRequired === true ? true : undefined })),
|
|
427
|
+
created_at: epoch(u.insertInstant),
|
|
428
|
+
last_sign_in_at: epoch(u.lastLoginInstant),
|
|
429
|
+
});
|
|
430
|
+
if (username)
|
|
431
|
+
seenUsernames.add(username);
|
|
432
|
+
if (u.active === false)
|
|
433
|
+
counts.inactive++;
|
|
434
|
+
if (u.passwordChangeRequired === true)
|
|
435
|
+
counts.forced++;
|
|
436
|
+
const pw = fusionAuthPassword(u);
|
|
437
|
+
if (pw && 'hash' in pw)
|
|
438
|
+
user.password = pw.hash;
|
|
439
|
+
else if (pw)
|
|
440
|
+
badHashes.set(pw.problem, (badHashes.get(pw.problem) ?? 0) + 1);
|
|
441
|
+
else if (snap.source === 'api')
|
|
442
|
+
counts.password++;
|
|
443
|
+
// Application roles from every registration, plus the roles of the user's groups.
|
|
444
|
+
const roles = new Set();
|
|
445
|
+
for (const reg of (0, record_set_1.objs)(u.registrations))
|
|
446
|
+
for (const r of (0, record_set_1.strs)(reg.roles))
|
|
447
|
+
roles.add((0, translate_kit_1.keyOf)(r));
|
|
448
|
+
const memberOf = (0, record_set_1.objs)(u.memberships).map((m) => groups.get((0, record_set_1.str)(m.groupId) ?? '')).filter((g) => !!g);
|
|
449
|
+
for (const g of memberOf) {
|
|
450
|
+
for (const names of Object.values((0, record_set_1.isObj)(g.roles) ? g.roles : {}))
|
|
451
|
+
for (const r of (0, record_set_1.strs)(names))
|
|
452
|
+
roles.add((0, translate_kit_1.keyOf)(r));
|
|
453
|
+
if (groupsAs === 'roles')
|
|
454
|
+
roles.add(`group:${(0, translate_kit_1.keyOf)((0, record_set_1.str)(g.name))}`);
|
|
455
|
+
}
|
|
456
|
+
if (roles.size)
|
|
457
|
+
user.roles = [...roles];
|
|
458
|
+
set.add('user', (0, record_set_1.compact)(user));
|
|
459
|
+
userIds.add(id);
|
|
460
|
+
// Linked identities.
|
|
461
|
+
for (const link of (0, record_set_1.objs)(u.links)) {
|
|
462
|
+
const idp = idps.get((0, record_set_1.str)(link.identityProviderId) ?? '');
|
|
463
|
+
const providerUserId = (0, record_set_1.str)(link.identityProviderUserId);
|
|
464
|
+
if (!idp || !providerUserId)
|
|
465
|
+
continue;
|
|
466
|
+
const identity = linkIdentity(idp, link, id, providerUserId, connections);
|
|
467
|
+
set.add('identity', identity, `${identity.provider}:${providerUserId}`);
|
|
468
|
+
}
|
|
469
|
+
// Second factors.
|
|
470
|
+
const methods = (0, record_set_1.isObj)(u.twoFactor) ? (0, record_set_1.objs)(u.twoFactor.methods) : [];
|
|
471
|
+
for (const m of methods) {
|
|
472
|
+
const method = (0, record_set_1.str)(m.method);
|
|
473
|
+
if (method === 'authenticator') {
|
|
474
|
+
const a = (0, record_set_1.isObj)(m.authenticator) ? m.authenticator : {};
|
|
475
|
+
const secret = (0, record_set_1.str)(a.secret) ? authenticatorSecret((0, record_set_1.str)(a.secret)) : undefined;
|
|
476
|
+
if (!secret) {
|
|
477
|
+
counts.totp++;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
const algo = (0, record_set_1.str)(a.algorithm)?.toUpperCase().replace('HMAC', '').replace('-', '');
|
|
481
|
+
set.add('mfa_factor', (0, record_set_1.compact)({
|
|
482
|
+
user_id: id,
|
|
483
|
+
type: 'totp',
|
|
484
|
+
secret_base32: secret,
|
|
485
|
+
digits: typeof a.codeLength === 'number' ? a.codeLength : 6,
|
|
486
|
+
period: typeof a.timeStep === 'number' ? a.timeStep : 30,
|
|
487
|
+
algorithm: algo === 'SHA256' || algo === 'SHA512' ? algo : 'SHA1',
|
|
488
|
+
verified: true,
|
|
489
|
+
}), `totp:${id}:${(0, record_set_1.str)(m.id) ?? ''}`);
|
|
490
|
+
}
|
|
491
|
+
else if (method === 'sms') {
|
|
492
|
+
const p = (0, record_set_1.e164)(m.mobilePhone);
|
|
493
|
+
if (p)
|
|
494
|
+
set.add('mfa_factor', { user_id: id, type: 'phone', phone: p, verified: true }, `phone:${id}:${p}`);
|
|
495
|
+
}
|
|
496
|
+
else if (method === 'email') {
|
|
497
|
+
set.add('mfa_factor', { user_id: id, type: 'email', verified: true }, `email:${id}`);
|
|
498
|
+
}
|
|
499
|
+
else if (method)
|
|
500
|
+
set.omit('mfa_factor', `FusionAuth two-factor method "${method}" has no Atlas counterpart`);
|
|
501
|
+
}
|
|
502
|
+
const codes = (0, record_set_1.strs)(u.recoveryCodes);
|
|
503
|
+
if (codes.length)
|
|
504
|
+
set.add('mfa_factor', { user_id: id, type: 'backup_codes', backup_codes: codes }, `recovery:${id}`);
|
|
505
|
+
// Memberships.
|
|
506
|
+
if (tenantsAs === 'organizations' && (0, record_set_1.str)(u.tenantId) && orgIds.has(`tenant:${(0, record_set_1.str)(u.tenantId)}`)) {
|
|
507
|
+
set.add('membership', { organization_id: `tenant:${(0, record_set_1.str)(u.tenantId)}`, user_id: id, role: 'member' }, `tenant:${(0, record_set_1.str)(u.tenantId)}:${id}`);
|
|
508
|
+
}
|
|
509
|
+
if (groupsAs === 'organizations') {
|
|
510
|
+
for (const g of memberOf)
|
|
511
|
+
set.add('membership', { organization_id: `group:${(0, record_set_1.str)(g.id)}`, user_id: id, role: 'member' }, `group:${(0, record_set_1.str)(g.id)}:${id}`);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
// ── API keys ──
|
|
515
|
+
let managers = 0;
|
|
516
|
+
for (const k of snap.apiKeys) {
|
|
517
|
+
const key = (0, record_set_1.str)(k.key);
|
|
518
|
+
const id = (0, record_set_1.str)(k.id);
|
|
519
|
+
if (!id || !key)
|
|
520
|
+
continue;
|
|
521
|
+
if (k.keyManager === true) {
|
|
522
|
+
managers++;
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
const meta = (0, record_set_1.isObj)(k.metaData) ? k.metaData : {};
|
|
526
|
+
const attrs = (0, record_set_1.isObj)(meta.attributes) ? meta.attributes : {};
|
|
527
|
+
const endpoints = (0, record_set_1.isObj)(k.permissions) && (0, record_set_1.isObj)(k.permissions.endpoints) ? Object.keys(k.permissions.endpoints) : [];
|
|
528
|
+
const record = (0, record_set_1.compact)({
|
|
529
|
+
id,
|
|
530
|
+
name: (0, record_set_1.str)(attrs.description) ?? `FusionAuth API key ${id.slice(0, 8)}`,
|
|
531
|
+
hash: (0, node_crypto_1.createHash)('sha256').update(key, 'utf8').digest('hex'),
|
|
532
|
+
hash_algorithm: 'sha256',
|
|
533
|
+
start: key.slice(0, 6),
|
|
534
|
+
scopes: endpoints.length ? endpoints : undefined,
|
|
535
|
+
expires_at: epoch(k.expirationInstant),
|
|
536
|
+
created_at: epoch(k.insertInstant),
|
|
537
|
+
});
|
|
538
|
+
set.add('api_key', record);
|
|
539
|
+
}
|
|
540
|
+
if (managers)
|
|
541
|
+
set.omit('api_key', 'FusionAuth key-manager API keys (they manage other keys)', managers);
|
|
542
|
+
if (snap.apiKeys.length)
|
|
543
|
+
set.warn('FusionAuth API keys are imported as Atlas API keys carrying the endpoint permissions as scopes: review each before cutover (a FusionAuth key authorises FusionAuth endpoints, not Atlas ones).');
|
|
544
|
+
// ── what could not move ──
|
|
545
|
+
if (counts.password) {
|
|
546
|
+
set.warn(`${counts.password} user(s) have a FusionAuth password, but the API never returns password hashes. Export from the database of a self-hosted install (--set fusionauth-dump=<dir>), ask FusionAuth support for the hashes (Cloud), or turn on the fusionauth lazy-migration preset: each password is then checked against FusionAuth on its first Atlas sign-in.`);
|
|
547
|
+
}
|
|
548
|
+
if (counts.totp)
|
|
549
|
+
set.warn(`${counts.totp} user(s) use an authenticator app; FusionAuth returns no authenticator secrets over the API (a database export carries them). Those users enrol again in Atlas.`);
|
|
550
|
+
if (counts.forced)
|
|
551
|
+
set.warn(`${counts.forced} user(s) must change their password at next sign-in in FusionAuth; their current password was set by an administrator.`);
|
|
552
|
+
for (const [problem, n] of badHashes)
|
|
553
|
+
set.warn(`${n} user(s) were imported without a password (${problem}); they reset it, or use lazy migration.`);
|
|
554
|
+
set.warn('FusionAuth sessions are not exportable: the fusionauth bridge preset exchanges FusionAuth access tokens for Atlas sessions instead.');
|
|
555
|
+
const tenant = snap.tenants[0];
|
|
556
|
+
set.manifest = {
|
|
557
|
+
origin: snap.baseUrl ?? ((0, record_set_1.str)(tenant?.name) ? `tenant ${(0, record_set_1.str)(tenant?.name)}` : 'fusionauth'),
|
|
558
|
+
sourceVersion: null,
|
|
559
|
+
providers: [...new Set(set.list('identity').map((i) => i.provider))].sort(),
|
|
560
|
+
settings: (0, record_set_1.compact)({
|
|
561
|
+
source: snap.source === 'api' ? 'api' : 'database',
|
|
562
|
+
groups_as: groupsAs,
|
|
563
|
+
tenants_as: tenantsAs,
|
|
564
|
+
issuer: snap.tenants.length === 1 ? (0, record_set_1.str)(snap.tenants[0].issuer) : undefined,
|
|
565
|
+
}),
|
|
566
|
+
};
|
|
567
|
+
return set;
|
|
568
|
+
}
|
|
569
|
+
function linkIdentity(idp, link, userId, providerUserId, connections) {
|
|
570
|
+
const id = (0, record_set_1.str)(idp.id);
|
|
571
|
+
const type = (0, record_set_1.str)(idp.type) ?? '';
|
|
572
|
+
const enterprise = connections.has(id);
|
|
573
|
+
return (0, record_set_1.compact)({
|
|
574
|
+
user_id: userId,
|
|
575
|
+
provider: enterprise ? id : type.toLowerCase(),
|
|
576
|
+
provider_user_id: providerUserId,
|
|
577
|
+
kind: enterprise ? (type === 'SAMLv2' ? 'saml' : 'oidc') : 'oauth',
|
|
578
|
+
sso_connection_id: enterprise ? id : undefined,
|
|
579
|
+
profile: (0, record_set_1.bag)((0, record_set_1.compact)({ display_name: (0, record_set_1.str)(link.displayName) })),
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
function ssoConnection(idp, id, snap, warn) {
|
|
583
|
+
const name = (0, record_set_1.str)(idp.name) ?? id;
|
|
584
|
+
const domains = (0, record_set_1.strs)(idp.domains).map((d) => d.toLowerCase());
|
|
585
|
+
if ((0, record_set_1.str)(idp.type) === 'SAMLv2') {
|
|
586
|
+
const keyId = (0, record_set_1.str)(idp.keyId);
|
|
587
|
+
const cert = keyId ? snap.keys[keyId] : undefined;
|
|
588
|
+
if (!cert)
|
|
589
|
+
warn(`SAML identity provider ${name}: its verification certificate could not be read; add it in Atlas.`);
|
|
590
|
+
return (0, record_set_1.compact)({
|
|
591
|
+
id,
|
|
592
|
+
name,
|
|
593
|
+
protocol: 'saml',
|
|
594
|
+
domains,
|
|
595
|
+
enabled: idp.enabled !== false,
|
|
596
|
+
saml: (0, record_set_1.compact)({
|
|
597
|
+
idp_entity_id: (0, record_set_1.str)(idp.issuer),
|
|
598
|
+
idp_sso_url: (0, record_set_1.str)(idp.idpEndpoint),
|
|
599
|
+
idp_certificate: cert,
|
|
600
|
+
attribute_mapping: (0, record_set_1.str)(idp.emailClaim) ? { email: (0, record_set_1.str)(idp.emailClaim) } : undefined,
|
|
601
|
+
}),
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
const o = (0, record_set_1.isObj)(idp.oauth2) ? idp.oauth2 : {};
|
|
605
|
+
const secret = (0, record_set_1.str)(o.client_secret);
|
|
606
|
+
// FusionAuth returns the secret to a key that may read identity providers; a masked or absent one cannot be used.
|
|
607
|
+
const real = secret && !/^\*+$/.test(secret) ? secret : undefined;
|
|
608
|
+
if (!real)
|
|
609
|
+
warn(`OIDC identity provider ${name}: its client secret was not available; enter it on the SSO connection after the import.`);
|
|
610
|
+
const issuer = (0, record_set_1.str)(o.issuer);
|
|
611
|
+
return (0, record_set_1.compact)({
|
|
612
|
+
id,
|
|
613
|
+
name,
|
|
614
|
+
protocol: 'oidc',
|
|
615
|
+
domains,
|
|
616
|
+
enabled: idp.enabled !== false,
|
|
617
|
+
oidc: (0, record_set_1.compact)({
|
|
618
|
+
issuer,
|
|
619
|
+
discovery_url: issuer ? `${issuer.replace(/\/+$/, '')}/.well-known/openid-configuration` : undefined,
|
|
620
|
+
client_id: (0, record_set_1.str)(o.client_id),
|
|
621
|
+
client_secret: real,
|
|
622
|
+
scopes: (0, record_set_1.str)(o.scope)?.split(/\s+/).filter(Boolean),
|
|
623
|
+
}),
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
async function exportFusionAuth(o) {
|
|
627
|
+
if (o.tables) {
|
|
628
|
+
const snap = fusionAuthSnapshotFromTables(o.tables);
|
|
629
|
+
if (o.api?.baseUrl)
|
|
630
|
+
snap.baseUrl = fusionAuthBase(o.api.baseUrl);
|
|
631
|
+
return mapFusionAuth(snap, o);
|
|
632
|
+
}
|
|
633
|
+
if (!o.api)
|
|
634
|
+
throw new Error('FusionAuth: pass a database dump, or the URL and an API key.');
|
|
635
|
+
const warnings = [];
|
|
636
|
+
const snap = await fetchFusionAuth(fusionAuthHttp(o.api), { baseUrl: o.api.baseUrl, pageSize: o.api.pageSize, onProgress: o.api.onProgress, warn: (m) => warnings.push(m) });
|
|
637
|
+
const set = mapFusionAuth(snap, o);
|
|
638
|
+
for (const w of warnings)
|
|
639
|
+
set.warn(w);
|
|
640
|
+
return set;
|
|
641
|
+
}
|
|
642
|
+
//# sourceMappingURL=fusionauth.js.map
|