@atlasauth/cli 0.11.0 → 0.13.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 +15 -0
- package/dist/args.d.ts +121 -0
- package/dist/args.js +45 -0
- package/dist/args.js.map +1 -1
- package/dist/commands/config.js +71 -6
- package/dist/commands/config.js.map +1 -1
- 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/init.js +13 -8
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts +6 -2
- package/dist/commands/migrate.js +13 -3
- package/dist/commands/migrate.js.map +1 -1
- 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/context.d.ts +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +96 -2
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- 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/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/run.js +4 -0
- package/dist/run.js.map +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportAppUsers = exportAppUsers;
|
|
4
|
+
const tables_1 = require("./tables");
|
|
5
|
+
const DEFAULT_IDENTITY_COLUMNS = {
|
|
6
|
+
google: ['googleId', 'google_id'],
|
|
7
|
+
github: ['githubId', 'github_id'],
|
|
8
|
+
facebook: ['facebookId', 'facebook_id'],
|
|
9
|
+
twitter: ['twitterId', 'twitter_id'],
|
|
10
|
+
microsoft: ['microsoftId', 'microsoft_id'],
|
|
11
|
+
apple: ['appleId', 'apple_id'],
|
|
12
|
+
discord: ['discordId', 'discord_id'],
|
|
13
|
+
gitlab: ['gitlabId', 'gitlab_id'],
|
|
14
|
+
linkedin: ['linkedinId', 'linkedin_id'],
|
|
15
|
+
slack: ['slackId', 'slack_id'],
|
|
16
|
+
};
|
|
17
|
+
/** passlib adapted base64 (what Atlas's PHC PBKDF2 verifier reads). */
|
|
18
|
+
function ab64(b) {
|
|
19
|
+
return b.toString('base64').replace(/\+/g, '.').replace(/=+$/, '');
|
|
20
|
+
}
|
|
21
|
+
function exportAppUsers(tables, options = {}) {
|
|
22
|
+
const out = new tables_1.FrameworkExport();
|
|
23
|
+
const now = (options.now ?? new Date()).getTime();
|
|
24
|
+
const users = tables.find(...(options.usersTable ? [options.usersTable] : ['users', 'user', 'User', 'accounts']));
|
|
25
|
+
if (!users) {
|
|
26
|
+
out.warn('No users table found (looked for users, user, accounts; pass --users-table).');
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
const ids = new Set();
|
|
30
|
+
const providers = new Set();
|
|
31
|
+
let plm = 0;
|
|
32
|
+
let unknown = 0;
|
|
33
|
+
for (const row of users.rows) {
|
|
34
|
+
const id = (0, tables_1.text)(options.idColumn ? (0, tables_1.col)(row, options.idColumn) : (0, tables_1.col)(row, 'id', '_id', 'uuid'));
|
|
35
|
+
if (!id) {
|
|
36
|
+
out.omit('user', 'row without an id');
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const email = (0, tables_1.text)(options.emailColumn ? (0, tables_1.col)(row, options.emailColumn) : (0, tables_1.col)(row, 'email', 'emailAddress', 'email_address'))?.toLowerCase();
|
|
40
|
+
const username = (0, tables_1.text)(options.usernameColumn ? (0, tables_1.col)(row, options.usernameColumn) : (0, tables_1.col)(row, 'username', 'login'));
|
|
41
|
+
if (!email && !username) {
|
|
42
|
+
out.omit('user', 'no email or username');
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
let password;
|
|
46
|
+
const salt = (0, tables_1.text)((0, tables_1.col)(row, 'salt'));
|
|
47
|
+
const plmHash = (0, tables_1.text)((0, tables_1.col)(row, 'hash'));
|
|
48
|
+
if (!options.passwordColumn && salt && plmHash && /^([0-9a-f]{2})+$/i.test(plmHash)) {
|
|
49
|
+
const digestName = options.plmDigest ?? 'sha256';
|
|
50
|
+
const rounds = options.plmIterations ?? 25000;
|
|
51
|
+
password = {
|
|
52
|
+
algorithm: 'auto',
|
|
53
|
+
hash: `$pbkdf2-${digestName}$${rounds}$${ab64(Buffer.from(salt, 'utf8'))}$${ab64(Buffer.from(plmHash, 'hex'))}`,
|
|
54
|
+
};
|
|
55
|
+
plm++;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const digest = (0, tables_1.text)(options.passwordColumn
|
|
59
|
+
? (0, tables_1.col)(row, options.passwordColumn)
|
|
60
|
+
: (0, tables_1.col)(row, 'password', 'passwordHash', 'password_hash', 'hashedPassword', 'hashed_password', 'encrypted_password'));
|
|
61
|
+
if (digest) {
|
|
62
|
+
password = (0, tables_1.selfDescribingHash)(digest) ?? undefined;
|
|
63
|
+
if (!password)
|
|
64
|
+
unknown++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const verified = options.emailVerifiedColumn
|
|
68
|
+
? (0, tables_1.bool)((0, tables_1.col)(row, options.emailVerifiedColumn))
|
|
69
|
+
: (0, tables_1.bool)((0, tables_1.col)(row, 'emailVerified', 'email_verified', 'verified', 'isVerified', 'is_verified', 'confirmed'));
|
|
70
|
+
const name = (0, tables_1.text)(options.nameColumn ? (0, tables_1.col)(row, options.nameColumn) : (0, tables_1.col)(row, 'name', 'displayName', 'display_name', 'fullName', 'full_name'));
|
|
71
|
+
ids.add(id);
|
|
72
|
+
out.add('user', {
|
|
73
|
+
id,
|
|
74
|
+
emails: email ? [{ email, verified, primary: true }] : undefined,
|
|
75
|
+
username,
|
|
76
|
+
name,
|
|
77
|
+
first_name: (0, tables_1.text)((0, tables_1.col)(row, 'firstName', 'first_name', 'givenName', 'given_name')) ?? (0, tables_1.splitName)(name).first_name,
|
|
78
|
+
last_name: (0, tables_1.text)((0, tables_1.col)(row, 'lastName', 'last_name', 'familyName', 'family_name')) ?? (0, tables_1.splitName)(name).last_name,
|
|
79
|
+
image_url: (0, tables_1.text)((0, tables_1.col)(row, 'image', 'avatar', 'avatarUrl', 'avatar_url', 'picture')),
|
|
80
|
+
password,
|
|
81
|
+
created_at: (0, tables_1.time)((0, tables_1.col)(row, 'createdAt', 'created_at', 'date_joined')),
|
|
82
|
+
});
|
|
83
|
+
const identityColumns = options.identityColumns
|
|
84
|
+
? Object.fromEntries(Object.entries(options.identityColumns).map(([p, c]) => [p, [c]]))
|
|
85
|
+
: DEFAULT_IDENTITY_COLUMNS;
|
|
86
|
+
for (const [provider, columns] of Object.entries(identityColumns)) {
|
|
87
|
+
const subject = (0, tables_1.text)((0, tables_1.col)(row, ...columns));
|
|
88
|
+
if (!subject)
|
|
89
|
+
continue;
|
|
90
|
+
providers.add(provider);
|
|
91
|
+
out.add('identity', { user_id: id, provider, provider_user_id: subject, kind: 'oauth' });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (plm)
|
|
95
|
+
out.warn(`${plm} passport-local-mongoose password(s) carried over as PBKDF2 (${options.plmDigest ?? 'sha256'}).`);
|
|
96
|
+
if (unknown)
|
|
97
|
+
out.warn(`${unknown} password value(s) are not a format Atlas verifies: those users reset their password or migrate lazily.`);
|
|
98
|
+
const identities = tables.find(...(options.identitiesTable ? [options.identitiesTable] : ['identities', 'user_identities', 'federated_credentials', 'oauth_accounts']));
|
|
99
|
+
for (const row of identities?.rows ?? []) {
|
|
100
|
+
const userId = (0, tables_1.text)((0, tables_1.col)(row, 'user_id', 'userId'));
|
|
101
|
+
const provider = (0, tables_1.text)((0, tables_1.col)(row, 'provider'))?.replace(/^https?:\/\//, '').replace(/\/.*$/, '');
|
|
102
|
+
const subject = (0, tables_1.text)((0, tables_1.col)(row, 'provider_user_id', 'providerUserId', 'subject', 'uid', 'provider_id'));
|
|
103
|
+
if (!userId || !provider || !subject || !ids.has(userId)) {
|
|
104
|
+
out.omit('identity', 'identity row without a known user, provider or subject');
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
providers.add(provider);
|
|
108
|
+
out.add('identity', { user_id: userId, provider, provider_user_id: subject, kind: 'oauth' });
|
|
109
|
+
}
|
|
110
|
+
out.manifest.providers = [...providers].sort();
|
|
111
|
+
if (options.sessions !== false)
|
|
112
|
+
exportExpressSessions(tables, out, ids, options, now);
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
/** connect-* session stores → session records (Passport). */
|
|
116
|
+
function exportExpressSessions(tables, out, ids, options, now) {
|
|
117
|
+
const store = tables.find(...(options.sessionsTable ? [options.sessionsTable] : ['session', 'sessions', 'Sessions', 'redis_sessions']));
|
|
118
|
+
if (!store)
|
|
119
|
+
return;
|
|
120
|
+
for (const row of store.rows) {
|
|
121
|
+
// connect-redis dumps carry the key `sess:<sid>`.
|
|
122
|
+
const redisKey = (0, tables_1.text)((0, tables_1.col)(row, 'key'));
|
|
123
|
+
const sid = (0, tables_1.text)((0, tables_1.col)(row, 'sid', '_id', 'session_id', 'id')) ?? (redisKey?.startsWith('sess:') ? redisKey.slice(5) : undefined);
|
|
124
|
+
const data = (0, tables_1.json)((0, tables_1.col)(row, 'sess', 'session', 'data', 'value'));
|
|
125
|
+
if (!sid || !data) {
|
|
126
|
+
out.omit('session', 'session row without an id or session data');
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const userId = sessionUser(data, options.sessionUserPath);
|
|
130
|
+
if (!userId) {
|
|
131
|
+
out.omit('session', 'anonymous session (no passport.user)');
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!ids.has(userId)) {
|
|
135
|
+
out.omit('session', 'session of a user not in the export');
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const cookie = (0, tables_1.json)(data.cookie);
|
|
139
|
+
const ttl = Number((0, tables_1.col)(row, 'ttl'));
|
|
140
|
+
const expires = (0, tables_1.timeMs)((0, tables_1.col)(row, 'expire', 'expires', 'expired', 'expires_at')) ??
|
|
141
|
+
(0, tables_1.timeMs)(cookie?.expires) ??
|
|
142
|
+
(Number.isFinite(ttl) && ttl > 0 ? now + ttl * 1000 : undefined);
|
|
143
|
+
if (expires === undefined) {
|
|
144
|
+
out.omit('session', 'browser-session cookie with no expiry in the store');
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (expires <= now) {
|
|
148
|
+
out.omit('session', 'expired');
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
out.add('session', { id: (0, tables_1.sha256Hex)(sid).slice(0, 32), user_id: userId, token_hash: (0, tables_1.sha256Hex)(sid), expires_at: new Date(expires).toISOString() });
|
|
152
|
+
}
|
|
153
|
+
out.manifest.settings = { ...(out.manifest.settings ?? {}), session_cookie: 'connect.sid' };
|
|
154
|
+
}
|
|
155
|
+
function sessionUser(data, path) {
|
|
156
|
+
const at = (p) => p.split('.').reduce((cur, k) => (cur && typeof cur === 'object' ? cur[k] : undefined), data);
|
|
157
|
+
if (path)
|
|
158
|
+
return (0, tables_1.text)(at(path));
|
|
159
|
+
return (0, tables_1.text)(at('passport.user')) ?? (0, tables_1.text)(at('passport.user.id')) ?? (0, tables_1.text)(at('passport.user._id')) ?? (0, tables_1.text)(at('userId'));
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=app-users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-users.js","sourceRoot":"","sources":["../../../../src/migrate/export/frameworks/app-users.ts"],"names":[],"mappings":";;AA0EA,wCA2FC;AArKD,qCAakB;AA2ClB,MAAM,wBAAwB,GAA6B;IACzD,MAAM,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,MAAM,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;IACvC,OAAO,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;IACpC,SAAS,EAAE,CAAC,aAAa,EAAE,cAAc,CAAC;IAC1C,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9B,OAAO,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;IACpC,MAAM,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;IACvC,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF,uEAAuE;AACvE,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,cAAc,CAAC,MAAc,EAAE,UAAiC,EAAE;IAChF,MAAM,GAAG,GAAG,IAAI,wBAAe,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAClD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAA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4
|
+
*
|
|
5
|
+
* Every official adapter keeps the same four models under its own table and
|
|
6
|
+
* column spelling — Prisma `User`/`Account`/`Session`/`Authenticator`, Drizzle
|
|
7
|
+
* `user`/`account`/`session`/`authenticator`, `@auth/pg-adapter` and Kysely
|
|
8
|
+
* `users`/`accounts`/`sessions`, TypeORM, Sequelize, the Supabase adapter's
|
|
9
|
+
* `next_auth` schema, MongoDB's `users`/`accounts`/`sessions` collections — so
|
|
10
|
+
* the mapper accepts each spelling (camelCase, snake_case, Mongo `_id`).
|
|
11
|
+
*
|
|
12
|
+
* users → user (email + emailVerified, name, image; a password column
|
|
13
|
+
* the app's Credentials provider filled, when it is a format
|
|
14
|
+
* Atlas verifies)
|
|
15
|
+
* accounts → identity (oauth / oidc; tokens only with `oauthTokens`)
|
|
16
|
+
* authenticators → passkey (the WebAuthn provider; needs the RP id)
|
|
17
|
+
* sessions → session (database strategy; sha256 of `sessionToken`)
|
|
18
|
+
*
|
|
19
|
+
* Not exported: `verification_token` rows (magic-link tokens live minutes), the
|
|
20
|
+
* Credentials provider's `authorize` logic (it is app code: Atlas owns
|
|
21
|
+
* passwords now), JWT-strategy sessions (they live only in the browser — the
|
|
22
|
+
* bridge reads them with the app's AUTH_SECRET instead).
|
|
23
|
+
*/
|
|
24
|
+
export interface AuthJsExportOptions {
|
|
25
|
+
/** The WebAuthn RP id the Passkey provider registered against (your domain). */
|
|
26
|
+
rpId?: string;
|
|
27
|
+
/** Include OAuth access / refresh tokens on identities. Default false. */
|
|
28
|
+
oauthTokens?: boolean;
|
|
29
|
+
/** Include live database sessions for the bridge. Default true. */
|
|
30
|
+
sessions?: boolean;
|
|
31
|
+
/** The users-table column holding a Credentials-provider password hash (auto-detected otherwise). */
|
|
32
|
+
passwordColumn?: string;
|
|
33
|
+
now?: Date;
|
|
34
|
+
}
|
|
35
|
+
export declare const AUTHJS_TABLES: {
|
|
36
|
+
readonly user: readonly ["User", "users", "user", "next_auth.users"];
|
|
37
|
+
readonly account: readonly ["Account", "accounts", "account", "next_auth.accounts"];
|
|
38
|
+
readonly session: readonly ["Session", "sessions", "session", "next_auth.sessions"];
|
|
39
|
+
readonly authenticator: readonly ["Authenticator", "authenticators", "authenticator"];
|
|
40
|
+
};
|
|
41
|
+
export declare function exportAuthJs(tables: Tables, options?: AuthJsExportOptions): FrameworkExport;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AUTHJS_TABLES = void 0;
|
|
4
|
+
exports.exportAuthJs = exportAuthJs;
|
|
5
|
+
const tables_1 = require("./tables");
|
|
6
|
+
exports.AUTHJS_TABLES = {
|
|
7
|
+
user: ['User', 'users', 'user', 'next_auth.users'],
|
|
8
|
+
account: ['Account', 'accounts', 'account', 'next_auth.accounts'],
|
|
9
|
+
session: ['Session', 'sessions', 'session', 'next_auth.sessions'],
|
|
10
|
+
authenticator: ['Authenticator', 'authenticators', 'authenticator'],
|
|
11
|
+
};
|
|
12
|
+
const PASSWORD_COLUMNS = ['password', 'passwordHash', 'password_hash', 'hashedPassword', 'hashed_password', 'encryptedPassword'];
|
|
13
|
+
function exportAuthJs(tables, options = {}) {
|
|
14
|
+
const out = new tables_1.FrameworkExport();
|
|
15
|
+
const now = (options.now ?? new Date()).getTime();
|
|
16
|
+
const users = tables.find(...exports.AUTHJS_TABLES.user);
|
|
17
|
+
if (!users) {
|
|
18
|
+
out.warn(`No users table found (looked for ${exports.AUTHJS_TABLES.user.join(', ')}).`);
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
const userIds = new Set();
|
|
22
|
+
let passwordsCarried = 0;
|
|
23
|
+
let passwordsUnknown = 0;
|
|
24
|
+
for (const row of users.rows) {
|
|
25
|
+
const id = (0, tables_1.text)((0, tables_1.col)(row, 'id', '_id'));
|
|
26
|
+
const email = (0, tables_1.text)((0, tables_1.col)(row, 'email'));
|
|
27
|
+
if (!id) {
|
|
28
|
+
out.omit('user', 'row without an id');
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const verifiedAt = (0, tables_1.col)(row, 'emailVerified', 'email_verified');
|
|
32
|
+
const name = (0, tables_1.text)((0, tables_1.col)(row, 'name'));
|
|
33
|
+
const digest = (0, tables_1.text)(options.passwordColumn ? (0, tables_1.col)(row, options.passwordColumn) : (0, tables_1.col)(row, ...PASSWORD_COLUMNS));
|
|
34
|
+
let password;
|
|
35
|
+
if (digest) {
|
|
36
|
+
const known = (0, tables_1.selfDescribingHash)(digest);
|
|
37
|
+
if (known) {
|
|
38
|
+
password = known;
|
|
39
|
+
passwordsCarried++;
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
passwordsUnknown++;
|
|
43
|
+
}
|
|
44
|
+
if (!email) {
|
|
45
|
+
out.omit('user', 'no email address (Auth.js users without one cannot sign in to Atlas by email)');
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
userIds.add(id);
|
|
49
|
+
out.add('user', {
|
|
50
|
+
id,
|
|
51
|
+
emails: [{ email: email.toLowerCase(), verified: Boolean(verifiedAt) && verifiedAt !== false && verifiedAt !== 'false', primary: true }],
|
|
52
|
+
name,
|
|
53
|
+
...(0, tables_1.splitName)(name),
|
|
54
|
+
image_url: (0, tables_1.text)((0, tables_1.col)(row, 'image')),
|
|
55
|
+
password,
|
|
56
|
+
created_at: (0, tables_1.time)((0, tables_1.col)(row, 'createdAt', 'created_at')),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (passwordsCarried)
|
|
60
|
+
out.warn(`${passwordsCarried} Credentials-provider password hash(es) carried over; they verify on first sign-in and are upgraded to Argon2id.`);
|
|
61
|
+
if (passwordsUnknown) {
|
|
62
|
+
out.warn(`${passwordsUnknown} password value(s) are not a hash format Atlas verifies (bcrypt, Argon2, scrypt salt:key, PBKDF2): those users reset their password, or use lazy migration against your old /api/auth/callback/credentials.`);
|
|
63
|
+
}
|
|
64
|
+
const providers = new Set();
|
|
65
|
+
for (const row of tables.rows(...exports.AUTHJS_TABLES.account)) {
|
|
66
|
+
const userId = (0, tables_1.text)((0, tables_1.col)(row, 'userId', 'user_id'));
|
|
67
|
+
const provider = (0, tables_1.text)((0, tables_1.col)(row, 'provider'));
|
|
68
|
+
const subject = (0, tables_1.text)((0, tables_1.col)(row, 'providerAccountId', 'provider_account_id'));
|
|
69
|
+
const type = (0, tables_1.text)((0, tables_1.col)(row, 'type')) ?? 'oauth';
|
|
70
|
+
if (!userId || !provider || !subject || !userIds.has(userId)) {
|
|
71
|
+
out.omit('identity', 'account row without a known user, provider or providerAccountId');
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (type === 'email' || type === 'credentials' || type === 'webauthn')
|
|
75
|
+
continue;
|
|
76
|
+
providers.add(provider);
|
|
77
|
+
const expiresAt = (0, tables_1.col)(row, 'expires_at', 'expiresAt');
|
|
78
|
+
out.add('identity', {
|
|
79
|
+
user_id: userId,
|
|
80
|
+
provider,
|
|
81
|
+
provider_user_id: subject,
|
|
82
|
+
kind: type === 'oidc' ? 'oidc' : 'oauth',
|
|
83
|
+
...(options.oauthTokens
|
|
84
|
+
? {
|
|
85
|
+
access_token: (0, tables_1.text)((0, tables_1.col)(row, 'access_token', 'accessToken')),
|
|
86
|
+
refresh_token: (0, tables_1.text)((0, tables_1.col)(row, 'refresh_token', 'refreshToken')),
|
|
87
|
+
// Auth.js stores expires_at in epoch SECONDS.
|
|
88
|
+
expires_at: expiresAt !== undefined ? (0, tables_1.time)(Number(expiresAt) * (Number(expiresAt) < 1e11 ? 1000 : 1)) : undefined,
|
|
89
|
+
}
|
|
90
|
+
: {}),
|
|
91
|
+
scopes: (0, tables_1.text)((0, tables_1.col)(row, 'scope'))?.split(/[\s,]+/).filter(Boolean),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
out.manifest.providers = [...providers].sort();
|
|
95
|
+
const authenticators = tables.rows(...exports.AUTHJS_TABLES.authenticator);
|
|
96
|
+
if (authenticators.length && !options.rpId) {
|
|
97
|
+
out.omit('passkey', 'no RP id given (--rp-id): a passkey only works on the domain it was registered for', authenticators.length);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
for (const row of authenticators) {
|
|
101
|
+
const userId = (0, tables_1.text)((0, tables_1.col)(row, 'userId', 'user_id'));
|
|
102
|
+
const credentialId = (0, tables_1.base64url)((0, tables_1.col)(row, 'credentialID', 'credential_id', 'credentialId'));
|
|
103
|
+
const publicKey = (0, tables_1.base64url)((0, tables_1.col)(row, 'credentialPublicKey', 'credential_public_key'));
|
|
104
|
+
if (!userId || !userIds.has(userId) || !credentialId || !publicKey) {
|
|
105
|
+
out.omit('passkey', 'authenticator row without a known user, credential id or public key');
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const transports = (0, tables_1.text)((0, tables_1.col)(row, 'transports'));
|
|
109
|
+
out.add('passkey', {
|
|
110
|
+
user_id: userId,
|
|
111
|
+
credential_id: credentialId,
|
|
112
|
+
public_key: publicKey,
|
|
113
|
+
sign_count: Number((0, tables_1.col)(row, 'counter') ?? 0) || 0,
|
|
114
|
+
rp_id: options.rpId,
|
|
115
|
+
transports: transports ? transports.split(/[\s,]+/).filter(Boolean) : undefined,
|
|
116
|
+
backed_up: (0, tables_1.bool)((0, tables_1.col)(row, 'credentialBackedUp', 'credential_backed_up')),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (options.rpId)
|
|
120
|
+
out.manifest.rpId = options.rpId;
|
|
121
|
+
}
|
|
122
|
+
if (options.sessions !== false) {
|
|
123
|
+
for (const row of tables.rows(...exports.AUTHJS_TABLES.session)) {
|
|
124
|
+
const token = (0, tables_1.text)((0, tables_1.col)(row, 'sessionToken', 'session_token'));
|
|
125
|
+
const userId = (0, tables_1.text)((0, tables_1.col)(row, 'userId', 'user_id'));
|
|
126
|
+
const expires = (0, tables_1.timeMs)((0, tables_1.col)(row, 'expires', 'expires_at', 'expiresAt'));
|
|
127
|
+
if (!token || !userId || !userIds.has(userId) || expires === undefined) {
|
|
128
|
+
out.omit('session', 'session row without a token, a known user or an expiry');
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (expires <= now) {
|
|
132
|
+
out.omit('session', 'expired');
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
out.add('session', {
|
|
136
|
+
id: (0, tables_1.text)((0, tables_1.col)(row, 'id', '_id')) ?? (0, tables_1.sha256Hex)(token).slice(0, 32),
|
|
137
|
+
user_id: userId,
|
|
138
|
+
token_hash: (0, tables_1.sha256Hex)(token),
|
|
139
|
+
expires_at: new Date(expires).toISOString(),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
out.manifest.settings = { session_cookie: ['authjs.session-token', 'next-auth.session-token'] };
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=authjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authjs.js","sourceRoot":"","sources":["../../../../src/migrate/export/frameworks/authjs.ts"],"names":[],"mappings":";;;AAyDA,oCAoIC;AA7LD,qCAYkB;AAoCL,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC;IAClD,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,CAAC;IACjE,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,CAAC;IACjE,aAAa,EAAE,CAAC,eAAe,EAAE,gBAAgB,EAAE,eAAe,CAAC;CAC3D,CAAC;AAEX,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AAEjI,SAAgB,YAAY,CAAC,MAAc,EAAE,UAA+B,EAAE;IAC5E,MAAM,GAAG,GAAG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GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FrameworkExport, type Tables } from './tables';
|
|
2
|
+
/**
|
|
3
|
+
* Devise (Rails) → canonical records, from the rows the Rails runner script
|
|
4
|
+
* ({@link DEVISE_EXPORT_SCRIPT}) streams out of the app with its own models —
|
|
5
|
+
* so attributes Rails encrypts (devise-two-factor's `otp_secret` under Active
|
|
6
|
+
* Record encryption or attr_encrypted) arrive decrypted, and the Devise config
|
|
7
|
+
* (pepper, stretches, the modules each model enables) comes along.
|
|
8
|
+
*
|
|
9
|
+
* users → user: email + confirmable (`confirmed_at`), the bcrypt
|
|
10
|
+
* `encrypted_password` (with `config.pepper` when set),
|
|
11
|
+
* lockable (`locked_at`), trackable timestamps
|
|
12
|
+
* omniauth → identity: `provider`/`uid` on users, or an
|
|
13
|
+
* `identities` / `authentications` table
|
|
14
|
+
* devise-two-factor → mfa_factor totp (`otp_secret`) + backup codes (their
|
|
15
|
+
* Devise-bcrypt digests, verified like passwords)
|
|
16
|
+
* rolify / `admin` → app roles
|
|
17
|
+
* activerecord-session_store → session (the cookie store has no rows: the
|
|
18
|
+
* bridge decrypts the `_<app>_session` cookie instead)
|
|
19
|
+
*
|
|
20
|
+
* devise-encryptable digests (sha1 / sha512 / authlogic / restful_authentication)
|
|
21
|
+
* are not carried: those users reset their password or migrate lazily.
|
|
22
|
+
*/
|
|
23
|
+
export interface DeviseExportOptions {
|
|
24
|
+
/** The Warden scope / model table (default `users`). */
|
|
25
|
+
usersTable?: string;
|
|
26
|
+
/** Treat emails as verified when the model does not use :confirmable. Default false. */
|
|
27
|
+
trustUnconfirmable?: boolean;
|
|
28
|
+
sessions?: boolean;
|
|
29
|
+
now?: Date;
|
|
30
|
+
}
|
|
31
|
+
export declare function exportDevise(tables: Tables, options?: DeviseExportOptions): FrameworkExport;
|
|
32
|
+
/**
|
|
33
|
+
* The Rails runner script that streams a Devise app's rows as NDJSON
|
|
34
|
+
* (`{"table": …, "row": {…}}`), straight into `atlas migrate export devise
|
|
35
|
+
* --file -`, so decrypted secrets only ever travel through the pipe:
|
|
36
|
+
*
|
|
37
|
+
* bin/rails runner atlas_export.rb | npx atlas migrate devise export --file -
|
|
38
|
+
*/
|
|
39
|
+
export declare const DEVISE_EXPORT_SCRIPT = "# Atlas export for a Devise app. Run: bin/rails runner atlas_export.rb [ModelName]\nrequire \"json\"\n\nmodel = (ARGV[0] || \"User\").constantize\nemit = ->(table, row) { $stdout.puts({ table: table, row: row }.to_json) }\n\nsession_key = Rails.application.config.session_options[:key] rescue nil\nemit.call(\"devise_config\", {\n devise_version: Devise::VERSION,\n pepper: Devise.pepper,\n stretches: Devise.stretches,\n modules: model.devise_modules.join(\",\"),\n session_store: Rails.application.config.session_store.to_s.demodulize.underscore,\n session_key: session_key,\n session_ttl_seconds: (Rails.application.config.session_options[:expire_after] || 1209600).to_i,\n})\n\nattrs = model.column_names - %w[encrypted_otp_secret encrypted_otp_secret_iv encrypted_otp_secret_salt]\nmodel.find_each(batch_size: 1000) do |u|\n row = attrs.index_with { |c| u.read_attribute(c) }\n # devise-two-factor: read the secret through the model so Rails decrypts it.\n row[\"otp_secret\"] = u.otp_secret if u.respond_to?(:otp_secret)\n emit.call(model.table_name, row)\nend\n\n%w[Identity Authentication].each do |name|\n next unless Object.const_defined?(name)\n klass = name.constantize\n next unless klass < ActiveRecord::Base\n klass.find_each { |i| emit.call(klass.table_name, i.attributes.slice(\"user_id\", \"provider\", \"uid\", \"email\")) }\nend\n\nif Object.const_defined?(:Role) && ActiveRecord::Base.connection.table_exists?(\"users_roles\")\n Role.find_each { |r| emit.call(\"roles\", r.attributes.slice(\"id\", \"name\", \"resource_type\", \"resource_id\")) }\n ActiveRecord::Base.connection.select_all(\"SELECT user_id, role_id FROM users_roles\").each { |r| emit.call(\"users_roles\", r) }\nend\n\nif defined?(ActiveRecord::SessionStore::Session)\n scope = \"warden.user.#{Devise::Mapping.find_scope!(model)}.key\"\n ActiveRecord::SessionStore::Session.find_each do |s|\n entry = s.data[scope] rescue nil\n next unless entry\n emit.call(\"sessions\", { session_id: s.session_id, user_id: Array(entry[0]).first, updated_at: s.updated_at })\n end\nend\n";
|