@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,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkTenantId = checkTenantId;
|
|
4
|
+
exports.userfrontHttp = userfrontHttp;
|
|
5
|
+
exports.exportUserfront = exportUserfront;
|
|
6
|
+
exports.mapUserfrontUser = mapUserfrontUser;
|
|
7
|
+
const record_set_1 = require("./record-set");
|
|
8
|
+
const translate_kit_1 = require("./translate-kit");
|
|
9
|
+
const vendor_http_1 = require("./vendor-http");
|
|
10
|
+
const API = 'https://api.userfront.com/v0';
|
|
11
|
+
const MAX_PAGES = 100_000;
|
|
12
|
+
/** First-factor strategies that are not a social login. */
|
|
13
|
+
const NON_SOCIAL = new Set(['password', 'link', 'verificationCode', 'totp', 'sso', 'saml', 'passkey', 'webauthn', 'email', 'phone']);
|
|
14
|
+
function checkTenantId(tenantId) {
|
|
15
|
+
const t = tenantId.trim();
|
|
16
|
+
if (!/^[A-Za-z0-9]{4,16}$/.test(t))
|
|
17
|
+
throw new Error(`Not a Userfront tenant id: ${tenantId}`);
|
|
18
|
+
return t;
|
|
19
|
+
}
|
|
20
|
+
function userfrontHttp(o) {
|
|
21
|
+
return new vendor_http_1.VendorHttp({
|
|
22
|
+
vendor: 'Userfront',
|
|
23
|
+
baseUrl: (o.apiBase ?? API).replace(/\/+$/, ''),
|
|
24
|
+
headers: { authorization: `Bearer ${o.apiKey}` },
|
|
25
|
+
fetchImpl: o.fetchImpl,
|
|
26
|
+
sleep: o.sleep,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function exportUserfront(opts) {
|
|
30
|
+
const set = new record_set_1.RecordSet();
|
|
31
|
+
const tid = checkTenantId(opts.tenantId);
|
|
32
|
+
if (!/^uf_(test|live)_admin_/.test(opts.apiKey))
|
|
33
|
+
throw new Error('Userfront export needs an admin API key (uf_live_admin_… or uf_test_admin_…).');
|
|
34
|
+
const progress = opts.onProgress ?? (() => undefined);
|
|
35
|
+
const http = userfrontHttp(opts);
|
|
36
|
+
progress('organizations');
|
|
37
|
+
const orgIds = new Set();
|
|
38
|
+
await walk(async (page) => (await http.get(`/tenants/${tid}/tenants?page=${page}`)).body, (body) => (0, record_set_1.objs)(body?.results).concat((0, record_set_1.objs)(body?.tenants)), (body) => {
|
|
39
|
+
const n = body?.totalPages;
|
|
40
|
+
return typeof n === 'number' ? n : undefined;
|
|
41
|
+
}, (t) => {
|
|
42
|
+
const id = (0, record_set_1.str)(t.tenantId);
|
|
43
|
+
if (!id || id === tid || orgIds.has(id))
|
|
44
|
+
return false;
|
|
45
|
+
orgIds.add(id);
|
|
46
|
+
set.add('organization', (0, record_set_1.compact)({ id, name: (0, record_set_1.str)(t.name) ?? id, image_url: (0, record_set_1.str)(t.image), public_metadata: (0, record_set_1.bag)(t.data), created_at: (0, record_set_1.str)(t.createdAt) }), id);
|
|
47
|
+
return true;
|
|
48
|
+
});
|
|
49
|
+
progress('roles');
|
|
50
|
+
const roleNames = new Set();
|
|
51
|
+
const rolesBody = await optional(async () => (await http.get(`/tenants/${tid}/roles`)).body);
|
|
52
|
+
for (const r of (0, record_set_1.objs)(rolesBody?.roles)) {
|
|
53
|
+
const name = (0, record_set_1.str)(r.name);
|
|
54
|
+
if (name)
|
|
55
|
+
roleNames.add(name);
|
|
56
|
+
}
|
|
57
|
+
progress('users');
|
|
58
|
+
const seen = new Set();
|
|
59
|
+
let unknownOrgs = 0;
|
|
60
|
+
let mfa = 0;
|
|
61
|
+
let passkeys = 0;
|
|
62
|
+
let social = 0;
|
|
63
|
+
await walk((page) => findUsers(http, tid, page), (body) => (0, record_set_1.objs)(body?.results), (body) => {
|
|
64
|
+
const meta = body?.meta;
|
|
65
|
+
return (0, record_set_1.isObj)(meta) && typeof meta.totalPages === 'number' ? meta.totalPages : undefined;
|
|
66
|
+
}, (u) => {
|
|
67
|
+
const rawId = (0, record_set_1.str)(u.userId);
|
|
68
|
+
if (rawId && seen.has(rawId))
|
|
69
|
+
return false;
|
|
70
|
+
if (rawId)
|
|
71
|
+
seen.add(rawId);
|
|
72
|
+
const user = mapUserfrontUser(u, tid);
|
|
73
|
+
if (!user) {
|
|
74
|
+
set.omit('user', 'no email, phone number or username');
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
const authz = (0, record_set_1.isObj)(u.authorization) ? u.authorization : {};
|
|
78
|
+
const mine = authz[tid];
|
|
79
|
+
const own = (0, record_set_1.isObj)(mine) ? (0, record_set_1.strs)(mine.roles) : [];
|
|
80
|
+
if (own.length)
|
|
81
|
+
user.roles = own.map(translate_kit_1.keyOf);
|
|
82
|
+
for (const n of own)
|
|
83
|
+
roleNames.add(n);
|
|
84
|
+
set.add('user', user, user.id);
|
|
85
|
+
for (const [orgId, raw] of Object.entries(authz)) {
|
|
86
|
+
if (orgId === tid || !(0, record_set_1.isObj)(raw))
|
|
87
|
+
continue;
|
|
88
|
+
if (!orgIds.has(orgId)) {
|
|
89
|
+
unknownOrgs++;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const roles = (0, record_set_1.strs)(raw.roles).map(translate_kit_1.keyOf);
|
|
93
|
+
set.add('membership', { organization_id: orgId, user_id: user.id, role: roles[0] ?? 'member' }, `${orgId}:${user.id}`);
|
|
94
|
+
for (const r of (0, record_set_1.strs)(raw.roles))
|
|
95
|
+
roleNames.add(r);
|
|
96
|
+
if (roles.length > 1)
|
|
97
|
+
set.warn('Some organization members hold several Userfront roles; Atlas seats each member with one role (the first).');
|
|
98
|
+
}
|
|
99
|
+
const auth = (0, record_set_1.isObj)(u.authentication) ? u.authentication : {};
|
|
100
|
+
if (u.isMfaRequired === true || (0, record_set_1.objs)(auth.secondFactors).length > 0)
|
|
101
|
+
mfa++;
|
|
102
|
+
for (const f of (0, record_set_1.objs)(auth.firstFactors)) {
|
|
103
|
+
const strategy = (0, record_set_1.str)(f.strategy);
|
|
104
|
+
if (strategy && /passkey|webauthn/i.test(strategy))
|
|
105
|
+
passkeys++;
|
|
106
|
+
else if (strategy && !NON_SOCIAL.has(strategy))
|
|
107
|
+
social++;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
if (unknownOrgs > 0) {
|
|
112
|
+
set.warn(`${unknownOrgs} organization grant(s) name a tenant that is not in the organization listing; those memberships were left out.`);
|
|
113
|
+
}
|
|
114
|
+
if (mfa > 0)
|
|
115
|
+
set.omit('mfa_factor', 'Userfront does not export second-factor secrets; members enrol again in Atlas', mfa);
|
|
116
|
+
if (passkeys > 0)
|
|
117
|
+
set.omit('passkey', 'Userfront does not export passkey public keys; register again in Atlas', passkeys);
|
|
118
|
+
if (social > 0)
|
|
119
|
+
set.omit('identity', "Userfront does not export social accounts' provider user ids: they relink by verified email on first social sign-in", social);
|
|
120
|
+
if (set.count('user') > 0) {
|
|
121
|
+
set.warn('Userfront never returns password hashes: turn on the userfront lazy-migration preset so each password moves on its first Atlas sign-in.');
|
|
122
|
+
}
|
|
123
|
+
for (const name of roleNames) {
|
|
124
|
+
const key = (0, translate_kit_1.keyOf)(name);
|
|
125
|
+
set.add('role', { key, name, scope: 'app' }, `app:${key}`);
|
|
126
|
+
if (orgIds.size > 0)
|
|
127
|
+
set.add('role', { key, name, scope: 'organization' }, `org:${key}`);
|
|
128
|
+
}
|
|
129
|
+
set.manifest = { origin: tid, settings: { tenant_id: tid } };
|
|
130
|
+
return set;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Walk a paged listing whose page numbering Userfront does not document: page
|
|
134
|
+
* 0 is probed, then pages go up from 1 until one is empty, past the reported
|
|
135
|
+
* total, or adds nobody new (a row seen twice is taken once).
|
|
136
|
+
*/
|
|
137
|
+
async function walk(get, rowsOf, totalPages, take) {
|
|
138
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
139
|
+
const body = await optional(() => get(page));
|
|
140
|
+
const rows = rowsOf(body);
|
|
141
|
+
let fresh = 0;
|
|
142
|
+
for (const r of rows)
|
|
143
|
+
if (take(r))
|
|
144
|
+
fresh++;
|
|
145
|
+
const pages = totalPages(body);
|
|
146
|
+
if (page > 0 && (rows.length === 0 || (pages !== undefined && page > pages)))
|
|
147
|
+
break;
|
|
148
|
+
if (page >= 2 && fresh === 0)
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function findUsers(http, tenantId, page) {
|
|
153
|
+
return (await http.post(`/tenants/${tenantId}/users/find`, { filters: {}, page, order: [['createdAt', 'ASC']] })).body;
|
|
154
|
+
}
|
|
155
|
+
/** One Userfront user (users/find result) → a user record. */
|
|
156
|
+
function mapUserfrontUser(u, tenantId) {
|
|
157
|
+
const id = (0, record_set_1.str)(u.userId);
|
|
158
|
+
if (!id)
|
|
159
|
+
return null;
|
|
160
|
+
const email = (0, record_set_1.str)(u.email)?.toLowerCase();
|
|
161
|
+
const phone = (0, record_set_1.e164)(u.phoneNumber);
|
|
162
|
+
const username = (0, record_set_1.str)(u.username);
|
|
163
|
+
const uuid = (0, record_set_1.str)(u.userUuid);
|
|
164
|
+
const user = (0, record_set_1.compact)({
|
|
165
|
+
id,
|
|
166
|
+
emails: email ? [{ email, verified: u.isEmailConfirmed === true || (u.isEmailConfirmed === undefined && u.isConfirmed === true), primary: true }] : [],
|
|
167
|
+
phones: phone ? [{ phone, verified: u.isPhoneNumberConfirmed === true, primary: !email }] : [],
|
|
168
|
+
username,
|
|
169
|
+
name: (0, record_set_1.str)(u.name),
|
|
170
|
+
image_url: (0, record_set_1.str)(u.image),
|
|
171
|
+
locked: u.locked === true ? true : undefined,
|
|
172
|
+
public_metadata: (0, record_set_1.bag)(u.data),
|
|
173
|
+
private_metadata: (0, record_set_1.bag)({ ...(uuid ? { userfront_user_uuid: uuid } : {}), userfront_tenant_id: tenantId }),
|
|
174
|
+
created_at: (0, record_set_1.str)(u.createdAt),
|
|
175
|
+
last_sign_in_at: (0, record_set_1.str)(u.lastActiveAt),
|
|
176
|
+
});
|
|
177
|
+
return user.emails?.length || user.phones?.length || user.username ? user : null;
|
|
178
|
+
}
|
|
179
|
+
async function optional(fn) {
|
|
180
|
+
try {
|
|
181
|
+
return await fn();
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
if (err instanceof vendor_http_1.VendorApiError && [400, 403, 404, 405].includes(err.status))
|
|
185
|
+
return null;
|
|
186
|
+
throw err;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=userfront.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userfront.js","sourceRoot":"","sources":["../../../src/migrate/export/userfront.ts"],"names":[],"mappings":";;AAqCA,sCAIC;AAED,sCAQC;AAED,0CAoGC;AA6BD,4CAqBC;AA1MD,6CAA+F;AAC/F,mDAAwC;AACxC,+CAA2D;AA6B3D,MAAM,GAAG,GAAG,8BAA8B,CAAC;AAC3C,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,2DAA2D;AAC3D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAErI,SAAgB,aAAa,CAAC,QAAgB;IAC5C,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC1B,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;IAC9F,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,aAAa,CAAC,CAAwG;IACpI,OAAO,IAAI,wBAAU,CAAC;QACpB,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QAC/C,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,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
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP side of `atlas migrate export <vendor>`: calls the OLD vendor's
|
|
3
|
+
* management API from the owner's machine, with the owner's vendor
|
|
4
|
+
* credentials. Nothing here talks to Atlas, and no vendor credential is ever
|
|
5
|
+
* written into a bundle or sent anywhere but the vendor.
|
|
6
|
+
*
|
|
7
|
+
* Shared by every vendor exporter: JSON requests, a bounded retry on 429 and
|
|
8
|
+
* 5xx that honours `Retry-After` (and the `X-RateLimit-Reset` epoch some
|
|
9
|
+
* vendors send instead), and errors that name the call without echoing a
|
|
10
|
+
* credential.
|
|
11
|
+
*/
|
|
12
|
+
export declare class VendorApiError extends Error {
|
|
13
|
+
readonly vendor: string;
|
|
14
|
+
readonly status: number;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
constructor(vendor: string, status: number, path: string, detail: string);
|
|
17
|
+
}
|
|
18
|
+
export interface VendorHttpOptions {
|
|
19
|
+
vendor: string;
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
/** Headers on every call (the authorization header lives here, never in a URL). */
|
|
22
|
+
headers?: Record<string, string> | (() => Promise<Record<string, string>> | Record<string, string>);
|
|
23
|
+
fetchImpl?: typeof fetch;
|
|
24
|
+
sleep?: (ms: number) => Promise<void>;
|
|
25
|
+
/** Attempts per call on 429/5xx, the first included. */
|
|
26
|
+
attempts?: number;
|
|
27
|
+
now?: () => number;
|
|
28
|
+
}
|
|
29
|
+
export interface VendorResponse<T> {
|
|
30
|
+
status: number;
|
|
31
|
+
body: T;
|
|
32
|
+
headers: Headers;
|
|
33
|
+
}
|
|
34
|
+
export declare class VendorHttp {
|
|
35
|
+
private readonly o;
|
|
36
|
+
constructor(o: VendorHttpOptions);
|
|
37
|
+
get vendor(): string;
|
|
38
|
+
url(path: string): string;
|
|
39
|
+
get<T>(path: string): Promise<VendorResponse<T>>;
|
|
40
|
+
post<T>(path: string, body: unknown): Promise<VendorResponse<T>>;
|
|
41
|
+
request<T>(method: string, path: string, body?: unknown): Promise<VendorResponse<T>>;
|
|
42
|
+
private waitFor;
|
|
43
|
+
private now;
|
|
44
|
+
}
|
|
45
|
+
/** The `rel="next"` URL of an RFC 8288 `Link` header (Okta's pagination). */
|
|
46
|
+
export declare function nextLink(header: string | null): string | null;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The HTTP side of `atlas migrate export <vendor>`: calls the OLD vendor's
|
|
4
|
+
* management API from the owner's machine, with the owner's vendor
|
|
5
|
+
* credentials. Nothing here talks to Atlas, and no vendor credential is ever
|
|
6
|
+
* written into a bundle or sent anywhere but the vendor.
|
|
7
|
+
*
|
|
8
|
+
* Shared by every vendor exporter: JSON requests, a bounded retry on 429 and
|
|
9
|
+
* 5xx that honours `Retry-After` (and the `X-RateLimit-Reset` epoch some
|
|
10
|
+
* vendors send instead), and errors that name the call without echoing a
|
|
11
|
+
* credential.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.VendorHttp = exports.VendorApiError = void 0;
|
|
15
|
+
exports.nextLink = nextLink;
|
|
16
|
+
class VendorApiError extends Error {
|
|
17
|
+
vendor;
|
|
18
|
+
status;
|
|
19
|
+
path;
|
|
20
|
+
constructor(vendor, status, path, detail) {
|
|
21
|
+
super(`${vendor} API ${status} on ${path}${detail ? `: ${detail}` : ''}`);
|
|
22
|
+
this.vendor = vendor;
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.path = path;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.VendorApiError = VendorApiError;
|
|
28
|
+
const MAX_WAIT_MS = 60_000;
|
|
29
|
+
class VendorHttp {
|
|
30
|
+
o;
|
|
31
|
+
constructor(o) {
|
|
32
|
+
this.o = o;
|
|
33
|
+
}
|
|
34
|
+
get vendor() {
|
|
35
|
+
return this.o.vendor;
|
|
36
|
+
}
|
|
37
|
+
url(path) {
|
|
38
|
+
return /^https:\/\//.test(path) ? path : `${this.o.baseUrl.replace(/\/+$/, '')}${path.startsWith('/') ? '' : '/'}${path}`;
|
|
39
|
+
}
|
|
40
|
+
async get(path) {
|
|
41
|
+
return this.request('GET', path);
|
|
42
|
+
}
|
|
43
|
+
async post(path, body) {
|
|
44
|
+
return this.request('POST', path, body);
|
|
45
|
+
}
|
|
46
|
+
async request(method, path, body) {
|
|
47
|
+
const fetchImpl = this.o.fetchImpl ?? fetch;
|
|
48
|
+
const sleep = this.o.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
49
|
+
const attempts = Math.max(1, this.o.attempts ?? 5);
|
|
50
|
+
const display = path.split('?')[0].replace(/^https:\/\/[^/]+/, '');
|
|
51
|
+
for (let attempt = 1;; attempt++) {
|
|
52
|
+
const extra = typeof this.o.headers === 'function' ? await this.o.headers() : this.o.headers;
|
|
53
|
+
const headers = { accept: 'application/json', ...extra };
|
|
54
|
+
if (body !== undefined)
|
|
55
|
+
headers['content-type'] = 'application/json';
|
|
56
|
+
let res;
|
|
57
|
+
try {
|
|
58
|
+
res = await fetchImpl(this.url(path), {
|
|
59
|
+
method,
|
|
60
|
+
headers,
|
|
61
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
if (attempt < attempts) {
|
|
66
|
+
await sleep(backoff(attempt));
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
throw new VendorApiError(this.o.vendor, 0, display, err instanceof Error ? err.message : String(err));
|
|
70
|
+
}
|
|
71
|
+
if ((res.status === 429 || res.status >= 500) && attempt < attempts) {
|
|
72
|
+
await sleep(this.waitFor(res, attempt));
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const text = await res.text();
|
|
76
|
+
let parsed = null;
|
|
77
|
+
if (text) {
|
|
78
|
+
try {
|
|
79
|
+
parsed = JSON.parse(text);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
parsed = text;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (res.status < 200 || res.status >= 300) {
|
|
86
|
+
throw new VendorApiError(this.o.vendor, res.status, display, errorDetail(parsed));
|
|
87
|
+
}
|
|
88
|
+
return { status: res.status, body: parsed, headers: res.headers };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
waitFor(res, attempt) {
|
|
92
|
+
const retryAfter = res.headers.get('retry-after');
|
|
93
|
+
if (retryAfter) {
|
|
94
|
+
const secs = Number(retryAfter);
|
|
95
|
+
if (Number.isFinite(secs))
|
|
96
|
+
return Math.min(Math.max(secs * 1000, 0), MAX_WAIT_MS);
|
|
97
|
+
const at = Date.parse(retryAfter);
|
|
98
|
+
if (Number.isFinite(at))
|
|
99
|
+
return Math.min(Math.max(at - this.now(), 0), MAX_WAIT_MS);
|
|
100
|
+
}
|
|
101
|
+
const reset = Number(res.headers.get('x-ratelimit-reset'));
|
|
102
|
+
if (Number.isFinite(reset) && reset > 1e9) {
|
|
103
|
+
return Math.min(Math.max(reset * 1000 - this.now(), 250), MAX_WAIT_MS);
|
|
104
|
+
}
|
|
105
|
+
return backoff(attempt);
|
|
106
|
+
}
|
|
107
|
+
now() {
|
|
108
|
+
return (this.o.now ?? Date.now)();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.VendorHttp = VendorHttp;
|
|
112
|
+
function backoff(attempt) {
|
|
113
|
+
return Math.min(500 * 2 ** (attempt - 1), MAX_WAIT_MS);
|
|
114
|
+
}
|
|
115
|
+
/** A short, credential-free description of a vendor error body. */
|
|
116
|
+
function errorDetail(body) {
|
|
117
|
+
if (typeof body === 'string')
|
|
118
|
+
return body.slice(0, 200);
|
|
119
|
+
if (!body || typeof body !== 'object')
|
|
120
|
+
return '';
|
|
121
|
+
const b = body;
|
|
122
|
+
const first = Array.isArray(b.errors) ? b.errors[0] : undefined;
|
|
123
|
+
const pick = [b.message, b.error_description, b.errorSummary, b.errorDescription, first?.long_message, first?.message, b.error, b.errorCode];
|
|
124
|
+
const found = pick.find((v) => typeof v === 'string' && v);
|
|
125
|
+
return typeof found === 'string' ? found.slice(0, 200) : '';
|
|
126
|
+
}
|
|
127
|
+
/** The `rel="next"` URL of an RFC 8288 `Link` header (Okta's pagination). */
|
|
128
|
+
function nextLink(header) {
|
|
129
|
+
if (!header)
|
|
130
|
+
return null;
|
|
131
|
+
for (const part of header.split(',')) {
|
|
132
|
+
const m = /<([^>]+)>\s*;\s*rel="?next"?/.exec(part.trim());
|
|
133
|
+
if (m)
|
|
134
|
+
return m[1];
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=vendor-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor-http.js","sourceRoot":"","sources":["../../../src/migrate/export/vendor-http.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAmIH,4BAOC;AAxID,MAAa,cAAe,SAAQ,KAAK;IAE5B;IACA;IACA;IAHX,YACW,MAAc,EACd,MAAc,EACd,IAAY,EACrB,MAAc;QAEd,KAAK,CAAC,GAAG,MAAM,QAAQ,MAAM,OAAO,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QALjE,WAAM,GAAN,MAAM,CAAQ;QACd,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;IAIvB,CAAC;CACF;AATD,wCASC;AAoBD,MAAM,WAAW,GAAG,MAAM,CAAC;AAE3B,MAAa,UAAU;IACQ;IAA7B,YAA6B,CAAoB;QAApB,MAAC,GAAD,CAAC,CAAmB;IAAG,CAAC;IAErD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,aAAa,CAAC,IAAI,CAAC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YAAY,EAAE,CAAC,CAAC,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;IAC7I,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC;IAC3D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9D,CAAC;AAED,6EAA6E;AAC7E,SAAgB,QAAQ,CAAC,MAAqB;IAC5C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC,CAAE,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TranslationResult } from '../framework/plugin';
|
|
2
|
+
import { type Obj } from './record-set';
|
|
3
|
+
import { type VendorHttp } from './vendor-http';
|
|
4
|
+
/**
|
|
5
|
+
* `atlas migrate workos config` — what WorkOS's API exposes of an environment:
|
|
6
|
+
* roles and permissions (RBAC), the redirect URIs and CORS origins registered
|
|
7
|
+
* for AuthKit, and the SSO connections / Directory Sync directories (which
|
|
8
|
+
* move with the data export). Authentication methods, MFA policy, session and
|
|
9
|
+
* token lifetimes, branding, email templates, JWT templates and signup rules
|
|
10
|
+
* live only in the WorkOS dashboard: the report lists each as manual, with
|
|
11
|
+
* where to find it.
|
|
12
|
+
*/
|
|
13
|
+
export interface WorkosConfigSnapshot {
|
|
14
|
+
clientId?: string;
|
|
15
|
+
roles: Obj[];
|
|
16
|
+
permissions: Obj[];
|
|
17
|
+
redirectUris: Obj[];
|
|
18
|
+
corsOrigins: Obj[];
|
|
19
|
+
connections: Obj[];
|
|
20
|
+
directories: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function fetchWorkosConfig(http: VendorHttp, clientId?: string): Promise<WorkosConfigSnapshot>;
|
|
23
|
+
export declare function translateWorkosConfig(snap: WorkosConfigSnapshot): TranslationResult;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchWorkosConfig = fetchWorkosConfig;
|
|
4
|
+
exports.translateWorkosConfig = translateWorkosConfig;
|
|
5
|
+
const record_set_1 = require("./record-set");
|
|
6
|
+
const translate_kit_1 = require("./translate-kit");
|
|
7
|
+
const vendor_http_1 = require("./vendor-http");
|
|
8
|
+
async function listOf(http, path) {
|
|
9
|
+
const out = [];
|
|
10
|
+
let after;
|
|
11
|
+
try {
|
|
12
|
+
for (;;) {
|
|
13
|
+
const q = new URLSearchParams({ limit: '100', order: 'asc' });
|
|
14
|
+
if (after)
|
|
15
|
+
q.set('after', after);
|
|
16
|
+
const body = (await http.get(`${path}?${q.toString()}`)).body;
|
|
17
|
+
out.push(...(0, record_set_1.objs)((0, record_set_1.isObj)(body) ? body.data : undefined));
|
|
18
|
+
const next = (0, record_set_1.isObj)(body) && (0, record_set_1.isObj)(body.list_metadata) ? (0, record_set_1.str)(body.list_metadata.after) : undefined;
|
|
19
|
+
if (!next || next === after)
|
|
20
|
+
break;
|
|
21
|
+
after = next;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
// Absent on this environment (RBAC off, endpoint not offered, no permission).
|
|
26
|
+
if (err instanceof vendor_http_1.VendorApiError && [400, 403, 404, 405].includes(err.status))
|
|
27
|
+
return out;
|
|
28
|
+
throw err;
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
async function plainList(http, path) {
|
|
33
|
+
try {
|
|
34
|
+
const body = (await http.get(path)).body;
|
|
35
|
+
return (0, record_set_1.objs)((0, record_set_1.isObj)(body) ? body.data : undefined);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
if (err instanceof vendor_http_1.VendorApiError && [400, 403, 404, 405].includes(err.status))
|
|
39
|
+
return [];
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function fetchWorkosConfig(http, clientId) {
|
|
44
|
+
return {
|
|
45
|
+
...(clientId ? { clientId } : {}),
|
|
46
|
+
// The roles listing is not paginated.
|
|
47
|
+
roles: await plainList(http, '/authorization/roles'),
|
|
48
|
+
permissions: await listOf(http, '/authorization/permissions'),
|
|
49
|
+
redirectUris: await listOf(http, '/user_management/redirect_uris'),
|
|
50
|
+
corsOrigins: await listOf(http, '/user_management/cors_origins'),
|
|
51
|
+
connections: await listOf(http, '/connections'),
|
|
52
|
+
directories: (await listOf(http, '/directories')).length,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function translateWorkosConfig(snap) {
|
|
56
|
+
const b = new translate_kit_1.ConfigBuilder();
|
|
57
|
+
for (const p of snap.permissions) {
|
|
58
|
+
const key = (0, record_set_1.str)(p.slug);
|
|
59
|
+
if (key)
|
|
60
|
+
b.push('permissions', { key, name: (0, record_set_1.str)(p.name) ?? key, description: (0, record_set_1.str)(p.description) ?? '' });
|
|
61
|
+
}
|
|
62
|
+
if (snap.permissions.length)
|
|
63
|
+
b.add('mapped', 'authorization', 'permissions', `${snap.permissions.length} permission(s).`, 'permissions');
|
|
64
|
+
let roles = 0;
|
|
65
|
+
for (const r of snap.roles) {
|
|
66
|
+
const slug = (0, record_set_1.str)(r.slug);
|
|
67
|
+
// Organization-specific roles are exported per organization with the data.
|
|
68
|
+
if (!slug || (0, record_set_1.str)(r.type) === 'OrganizationRole')
|
|
69
|
+
continue;
|
|
70
|
+
roles++;
|
|
71
|
+
b.roles[slug] = slug;
|
|
72
|
+
b.push('roles', { key: slug, name: (0, record_set_1.str)(r.name) ?? slug, description: (0, record_set_1.str)(r.description) ?? '', permissions: (0, record_set_1.strs)(r.permissions) });
|
|
73
|
+
}
|
|
74
|
+
if (roles)
|
|
75
|
+
b.add('mapped', 'authorization', 'environment roles', `${roles} role(s); members keep the same role slug as their Atlas role key.`, 'roles');
|
|
76
|
+
if (snap.roles.length === 0)
|
|
77
|
+
b.add('manual', 'authorization', 'roles', 'No roles were returned (RBAC may be off for this environment); the default "admin" and "member" roles carry over as Atlas organization roles.');
|
|
78
|
+
const redirects = new Set();
|
|
79
|
+
for (const u of snap.redirectUris) {
|
|
80
|
+
const uri = (0, record_set_1.str)(u.uri);
|
|
81
|
+
if (uri)
|
|
82
|
+
redirects.add(uri);
|
|
83
|
+
}
|
|
84
|
+
for (const url of redirects) {
|
|
85
|
+
if (url.includes('*'))
|
|
86
|
+
b.add('differs', 'redirect URIs', url, 'Atlas redirect URLs are exact (no wildcards).', 'redirect_urls');
|
|
87
|
+
else
|
|
88
|
+
b.push('redirect_urls', { url });
|
|
89
|
+
}
|
|
90
|
+
const exact = [...redirects].filter((u) => !u.includes('*')).length;
|
|
91
|
+
if (exact)
|
|
92
|
+
b.add('mapped', 'redirect URIs', 'redirect_uris', `${exact} redirect URI(s).`, 'redirect_urls');
|
|
93
|
+
if (redirects.size === 0)
|
|
94
|
+
b.add('manual', 'redirect URIs', 'redirect_uris', 'WorkOS did not list its redirect URIs by API: add your app\'s post-sign-in URLs to Atlas (redirect_urls).', 'redirect_urls');
|
|
95
|
+
for (const o of snap.corsOrigins) {
|
|
96
|
+
const origin = (0, record_set_1.str)(o.origin);
|
|
97
|
+
if (origin)
|
|
98
|
+
b.add('manual', 'CORS origins', origin, 'Add this origin to the allowed origins of your Atlas instance (Atlas dashboard → Settings → Allowed origins).');
|
|
99
|
+
}
|
|
100
|
+
const sso = snap.connections.length;
|
|
101
|
+
if (sso)
|
|
102
|
+
b.add('mapped', 'enterprise', `${sso} SSO connection(s)`, 'Move with the data export as Atlas SSO connections. WorkOS does not return the identity provider details: each customer\'s IdP is set up again against the new Atlas service-provider settings.', 'sso_connections');
|
|
103
|
+
if (snap.directories)
|
|
104
|
+
b.add('manual', 'enterprise', `${snap.directories} Directory Sync directory(ies)`, 'Reconnect through Atlas SCIM provisioning; the identity provider re-provisions users and groups.');
|
|
105
|
+
for (const [setting, where] of [
|
|
106
|
+
['authentication methods (password, Magic Auth, social, passkeys)', 'Authentication → Methods'],
|
|
107
|
+
['social connections (client ids and secrets)', 'Authentication → Social login (use the same OAuth apps in Atlas so imported accounts relink)'],
|
|
108
|
+
['multi-factor authentication policy', 'Authentication → Multi-Factor Auth'],
|
|
109
|
+
['session lifetime and access token lifetime', 'Authentication → Sessions'],
|
|
110
|
+
['sign-up rules, email verification and domain restrictions', 'Authentication → Sign-up'],
|
|
111
|
+
['branding, hosted-page text and email templates', 'Branding and Email'],
|
|
112
|
+
['JWT templates and custom claims', 'Authentication → Sessions → JWT template'],
|
|
113
|
+
['custom authentication domain', 'Domains'],
|
|
114
|
+
['Radar (bot and fraud rules)', 'Radar'],
|
|
115
|
+
['webhooks and events', 'Webhooks (create Atlas webhook endpoints)'],
|
|
116
|
+
]) {
|
|
117
|
+
b.add('manual', 'settings not in the API', setting, `WorkOS does not expose this by API; copy it from the WorkOS dashboard (${where}).`);
|
|
118
|
+
}
|
|
119
|
+
return b.result(`WorkOS environment${snap.clientId ? ` ${snap.clientId}` : ''}`, {
|
|
120
|
+
...(snap.clientId
|
|
121
|
+
? { bridge: { preset: 'workos', vars: { client_id: snap.clientId } }, lazy: { preset: 'workos', config: { client_id: snap.clientId } } }
|
|
122
|
+
: {}),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=workos-config.js.map
|
|
@@ -0,0 +1 @@
|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,CAAC;KAC5D,EAAE,CAAC;QACX,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,yBAAyB,EAAE,OAAO,EAAE,0EAA0E,KAAK,IAAI,CAAC,CAAC;IAC3I,CAAC;IAED,OAAO,CAAC,CAAC,MAAM,CAAC,qBAAqB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE;QAC/E,GAAG,CAAC,IAAI,CAAC,QAAQ;YACf,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE;YACxI,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { UserRecord } from '@atlasauth/migrate';
|
|
2
|
+
import { RecordSet, type Obj } from './record-set';
|
|
3
|
+
/**
|
|
4
|
+
* `atlas migrate export workos` — a WorkOS environment (AuthKit + SSO +
|
|
5
|
+
* Directory Sync) onto the canonical bundle models, read with an API key on
|
|
6
|
+
* this machine.
|
|
7
|
+
*
|
|
8
|
+
* - organizations (verified domains, metadata), environment roles and each
|
|
9
|
+
* organization's custom roles, memberships with their role slug, pending
|
|
10
|
+
* and past invitations;
|
|
11
|
+
* - users (verified email, names, avatar, metadata, last sign-in) with the
|
|
12
|
+
* OAuth identities WorkOS holds for them (provider user ids, so social
|
|
13
|
+
* sign-in relinks exactly);
|
|
14
|
+
* - SSO connections (SAML / OIDC) with the IdP signing certificates WorkOS
|
|
15
|
+
* returns; the IdP entity id, SSO URL and OIDC client secret are NOT
|
|
16
|
+
* available through the API, so the customer's IdP is reconfigured against
|
|
17
|
+
* the new Atlas connection;
|
|
18
|
+
* - password hashes: WorkOS publishes no export of them (only an import
|
|
19
|
+
* path). If WorkOS support gives you a hash file, pass it
|
|
20
|
+
* (--workos-hashes-file); otherwise turn on the `workos` lazy-migration
|
|
21
|
+
* preset, which checks each password against WorkOS on first sign-in.
|
|
22
|
+
*
|
|
23
|
+
* Not exportable: TOTP secrets and passkeys (users enrol again), API key
|
|
24
|
+
* secrets (reissue as Atlas API keys), sessions (the `workos` bridge preset
|
|
25
|
+
* exchanges the access token). Directory Sync directories are reconnected in
|
|
26
|
+
* Atlas SCIM.
|
|
27
|
+
*/
|
|
28
|
+
export interface WorkosExportOptions {
|
|
29
|
+
apiKey: string;
|
|
30
|
+
/** For the manifest only (the client id appears in token issuers). */
|
|
31
|
+
clientId?: string;
|
|
32
|
+
/** API base (default https://api.workos.com). */
|
|
33
|
+
baseUrl?: string;
|
|
34
|
+
/** A password-hash export from WorkOS support (CSV or NDJSON), when the owner has one. */
|
|
35
|
+
hashesText?: string;
|
|
36
|
+
/** Also count TOTP / SMS / WebAuthn factors per user (one more request each) so the report says how many re-enrol. */
|
|
37
|
+
countFactors?: boolean;
|
|
38
|
+
fetchImpl?: typeof fetch;
|
|
39
|
+
sleep?: (ms: number) => Promise<void>;
|
|
40
|
+
onProgress?: (message: string) => void;
|
|
41
|
+
}
|
|
42
|
+
export declare function exportWorkos(opts: WorkosExportOptions): Promise<RecordSet>;
|
|
43
|
+
/** One WorkOS user → a user record (a user always has an email). */
|
|
44
|
+
export declare function mapWorkosUser(u: Obj): UserRecord | null;
|
|
45
|
+
/** `GoogleOAuth` → `google`, `GitHubOAuth` → `github`: the provider name an Atlas provider key is looked up by. */
|
|
46
|
+
export declare function providerKey(provider: string): string;
|