@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.
Files changed (390) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/args.d.ts +121 -0
  3. package/dist/args.js +45 -0
  4. package/dist/args.js.map +1 -1
  5. package/dist/commands/config.js +71 -6
  6. package/dist/commands/config.js.map +1 -1
  7. package/dist/commands/dev.d.ts +8 -0
  8. package/dist/commands/dev.js +84 -0
  9. package/dist/commands/dev.js.map +1 -0
  10. package/dist/commands/init.js +13 -8
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/commands/migrate.d.ts +6 -2
  13. package/dist/commands/migrate.js +13 -3
  14. package/dist/commands/migrate.js.map +1 -1
  15. package/dist/commands/pages.d.ts +14 -0
  16. package/dist/commands/pages.js +113 -0
  17. package/dist/commands/pages.js.map +1 -0
  18. package/dist/context.d.ts +1 -1
  19. package/dist/help.d.ts +1 -1
  20. package/dist/help.js +96 -2
  21. package/dist/help.js.map +1 -1
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.js +3 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/migrate/appwrite/plugin.d.ts +2 -0
  26. package/dist/migrate/appwrite/plugin.js +103 -0
  27. package/dist/migrate/appwrite/plugin.js.map +1 -0
  28. package/dist/migrate/auth0/plugin.d.ts +2 -0
  29. package/dist/migrate/auth0/plugin.js +126 -0
  30. package/dist/migrate/auth0/plugin.js.map +1 -0
  31. package/dist/migrate/authentik/plugin.d.ts +2 -0
  32. package/dist/migrate/authentik/plugin.js +135 -0
  33. package/dist/migrate/authentik/plugin.js.map +1 -0
  34. package/dist/migrate/azure-ad-b2c/plugin.d.ts +8 -0
  35. package/dist/migrate/azure-ad-b2c/plugin.js +165 -0
  36. package/dist/migrate/azure-ad-b2c/plugin.js.map +1 -0
  37. package/dist/migrate/clerk/plugin.d.ts +2 -0
  38. package/dist/migrate/clerk/plugin.js +76 -0
  39. package/dist/migrate/clerk/plugin.js.map +1 -0
  40. package/dist/migrate/cognito/plugin.d.ts +5 -0
  41. package/dist/migrate/cognito/plugin.js +170 -0
  42. package/dist/migrate/cognito/plugin.js.map +1 -0
  43. package/dist/migrate/corbado/plugin.d.ts +2 -0
  44. package/dist/migrate/corbado/plugin.js +63 -0
  45. package/dist/migrate/corbado/plugin.js.map +1 -0
  46. package/dist/migrate/descope/plugin.d.ts +2 -0
  47. package/dist/migrate/descope/plugin.js +83 -0
  48. package/dist/migrate/descope/plugin.js.map +1 -0
  49. package/dist/migrate/entra-external-id/plugin.d.ts +8 -0
  50. package/dist/migrate/entra-external-id/plugin.js +12 -0
  51. package/dist/migrate/entra-external-id/plugin.js.map +1 -0
  52. package/dist/migrate/export/appwrite-config.d.ts +28 -0
  53. package/dist/migrate/export/appwrite-config.js +170 -0
  54. package/dist/migrate/export/appwrite-config.js.map +1 -0
  55. package/dist/migrate/export/appwrite.d.ts +51 -0
  56. package/dist/migrate/export/appwrite.js +288 -0
  57. package/dist/migrate/export/appwrite.js.map +1 -0
  58. package/dist/migrate/export/auth0-config.d.ts +29 -0
  59. package/dist/migrate/export/auth0-config.js +249 -0
  60. package/dist/migrate/export/auth0-config.js.map +1 -0
  61. package/dist/migrate/export/auth0.d.ts +62 -0
  62. package/dist/migrate/export/auth0.js +575 -0
  63. package/dist/migrate/export/auth0.js.map +1 -0
  64. package/dist/migrate/export/authentik-config.d.ts +45 -0
  65. package/dist/migrate/export/authentik-config.js +357 -0
  66. package/dist/migrate/export/authentik-config.js.map +1 -0
  67. package/dist/migrate/export/authentik.d.ts +110 -0
  68. package/dist/migrate/export/authentik.js +838 -0
  69. package/dist/migrate/export/authentik.js.map +1 -0
  70. package/dist/migrate/export/azure-config.d.ts +58 -0
  71. package/dist/migrate/export/azure-config.js +344 -0
  72. package/dist/migrate/export/azure-config.js.map +1 -0
  73. package/dist/migrate/export/azure.d.ts +85 -0
  74. package/dist/migrate/export/azure.js +373 -0
  75. package/dist/migrate/export/azure.js.map +1 -0
  76. package/dist/migrate/export/clerk-config.d.ts +26 -0
  77. package/dist/migrate/export/clerk-config.js +227 -0
  78. package/dist/migrate/export/clerk-config.js.map +1 -0
  79. package/dist/migrate/export/clerk.d.ts +46 -0
  80. package/dist/migrate/export/clerk.js +486 -0
  81. package/dist/migrate/export/clerk.js.map +1 -0
  82. package/dist/migrate/export/cognito-config.d.ts +25 -0
  83. package/dist/migrate/export/cognito-config.js +273 -0
  84. package/dist/migrate/export/cognito-config.js.map +1 -0
  85. package/dist/migrate/export/cognito.d.ts +103 -0
  86. package/dist/migrate/export/cognito.js +441 -0
  87. package/dist/migrate/export/cognito.js.map +1 -0
  88. package/dist/migrate/export/corbado-config.d.ts +20 -0
  89. package/dist/migrate/export/corbado-config.js +63 -0
  90. package/dist/migrate/export/corbado-config.js.map +1 -0
  91. package/dist/migrate/export/corbado.d.ts +37 -0
  92. package/dist/migrate/export/corbado.js +132 -0
  93. package/dist/migrate/export/corbado.js.map +1 -0
  94. package/dist/migrate/export/descope.d.ts +35 -0
  95. package/dist/migrate/export/descope.js +208 -0
  96. package/dist/migrate/export/descope.js.map +1 -0
  97. package/dist/migrate/export/fake-vendor.test-helper.d.ts +27 -0
  98. package/dist/migrate/export/fake-vendor.test-helper.js +41 -0
  99. package/dist/migrate/export/fake-vendor.test-helper.js.map +1 -0
  100. package/dist/migrate/export/firebase-config.d.ts +24 -0
  101. package/dist/migrate/export/firebase-config.js +215 -0
  102. package/dist/migrate/export/firebase-config.js.map +1 -0
  103. package/dist/migrate/export/firebase.d.ts +102 -0
  104. package/dist/migrate/export/firebase.js +464 -0
  105. package/dist/migrate/export/firebase.js.map +1 -0
  106. package/dist/migrate/export/frameworks/app-users.d.ts +42 -0
  107. package/dist/migrate/export/frameworks/app-users.js +161 -0
  108. package/dist/migrate/export/frameworks/app-users.js.map +1 -0
  109. package/dist/migrate/export/frameworks/authjs.d.ts +41 -0
  110. package/dist/migrate/export/frameworks/authjs.js +146 -0
  111. package/dist/migrate/export/frameworks/authjs.js.map +1 -0
  112. package/dist/migrate/export/frameworks/devise.d.ts +39 -0
  113. package/dist/migrate/export/frameworks/devise.js +218 -0
  114. package/dist/migrate/export/frameworks/devise.js.map +1 -0
  115. package/dist/migrate/export/frameworks/django.d.ts +45 -0
  116. package/dist/migrate/export/frameworks/django.js +315 -0
  117. package/dist/migrate/export/frameworks/django.js.map +1 -0
  118. package/dist/migrate/export/frameworks/lucia.d.ts +42 -0
  119. package/dist/migrate/export/frameworks/lucia.js +263 -0
  120. package/dist/migrate/export/frameworks/lucia.js.map +1 -0
  121. package/dist/migrate/export/frameworks/tables.d.ts +90 -0
  122. package/dist/migrate/export/frameworks/tables.js +325 -0
  123. package/dist/migrate/export/frameworks/tables.js.map +1 -0
  124. package/dist/migrate/export/frameworks/webauthn.d.ts +25 -0
  125. package/dist/migrate/export/frameworks/webauthn.js +130 -0
  126. package/dist/migrate/export/frameworks/webauthn.js.map +1 -0
  127. package/dist/migrate/export/frontegg-config.d.ts +29 -0
  128. package/dist/migrate/export/frontegg-config.js +238 -0
  129. package/dist/migrate/export/frontegg-config.js.map +1 -0
  130. package/dist/migrate/export/frontegg.d.ts +67 -0
  131. package/dist/migrate/export/frontegg.js +410 -0
  132. package/dist/migrate/export/frontegg.js.map +1 -0
  133. package/dist/migrate/export/fusionauth-config.d.ts +26 -0
  134. package/dist/migrate/export/fusionauth-config.js +226 -0
  135. package/dist/migrate/export/fusionauth-config.js.map +1 -0
  136. package/dist/migrate/export/fusionauth.d.ts +99 -0
  137. package/dist/migrate/export/fusionauth.js +642 -0
  138. package/dist/migrate/export/fusionauth.js.map +1 -0
  139. package/dist/migrate/export/hanko-config.d.ts +27 -0
  140. package/dist/migrate/export/hanko-config.js +265 -0
  141. package/dist/migrate/export/hanko-config.js.map +1 -0
  142. package/dist/migrate/export/hanko.d.ts +52 -0
  143. package/dist/migrate/export/hanko.js +605 -0
  144. package/dist/migrate/export/hanko.js.map +1 -0
  145. package/dist/migrate/export/keycloak-config.d.ts +19 -0
  146. package/dist/migrate/export/keycloak-config.js +219 -0
  147. package/dist/migrate/export/keycloak-config.js.map +1 -0
  148. package/dist/migrate/export/keycloak.d.ts +155 -0
  149. package/dist/migrate/export/keycloak.js +878 -0
  150. package/dist/migrate/export/keycloak.js.map +1 -0
  151. package/dist/migrate/export/kinde-descope-config.d.ts +38 -0
  152. package/dist/migrate/export/kinde-descope-config.js +172 -0
  153. package/dist/migrate/export/kinde-descope-config.js.map +1 -0
  154. package/dist/migrate/export/kinde.d.ts +57 -0
  155. package/dist/migrate/export/kinde.js +333 -0
  156. package/dist/migrate/export/kinde.js.map +1 -0
  157. package/dist/migrate/export/ldap.d.ts +53 -0
  158. package/dist/migrate/export/ldap.js +277 -0
  159. package/dist/migrate/export/ldap.js.map +1 -0
  160. package/dist/migrate/export/logto-config.d.ts +27 -0
  161. package/dist/migrate/export/logto-config.js +264 -0
  162. package/dist/migrate/export/logto-config.js.map +1 -0
  163. package/dist/migrate/export/logto.d.ts +150 -0
  164. package/dist/migrate/export/logto.js +809 -0
  165. package/dist/migrate/export/logto.js.map +1 -0
  166. package/dist/migrate/export/magic-config.d.ts +14 -0
  167. package/dist/migrate/export/magic-config.js +28 -0
  168. package/dist/migrate/export/magic-config.js.map +1 -0
  169. package/dist/migrate/export/magic.d.ts +31 -0
  170. package/dist/migrate/export/magic.js +93 -0
  171. package/dist/migrate/export/magic.js.map +1 -0
  172. package/dist/migrate/export/mini-yaml.d.ts +19 -0
  173. package/dist/migrate/export/mini-yaml.js +581 -0
  174. package/dist/migrate/export/mini-yaml.js.map +1 -0
  175. package/dist/migrate/export/nhost-config.d.ts +26 -0
  176. package/dist/migrate/export/nhost-config.js +360 -0
  177. package/dist/migrate/export/nhost-config.js.map +1 -0
  178. package/dist/migrate/export/nhost.d.ts +64 -0
  179. package/dist/migrate/export/nhost.js +304 -0
  180. package/dist/migrate/export/nhost.js.map +1 -0
  181. package/dist/migrate/export/okta-config.d.ts +30 -0
  182. package/dist/migrate/export/okta-config.js +205 -0
  183. package/dist/migrate/export/okta-config.js.map +1 -0
  184. package/dist/migrate/export/okta.d.ts +43 -0
  185. package/dist/migrate/export/okta.js +337 -0
  186. package/dist/migrate/export/okta.js.map +1 -0
  187. package/dist/migrate/export/onelogin.d.ts +22 -0
  188. package/dist/migrate/export/onelogin.js +123 -0
  189. package/dist/migrate/export/onelogin.js.map +1 -0
  190. package/dist/migrate/export/ory-config.d.ts +58 -0
  191. package/dist/migrate/export/ory-config.js +451 -0
  192. package/dist/migrate/export/ory-config.js.map +1 -0
  193. package/dist/migrate/export/ory.d.ts +81 -0
  194. package/dist/migrate/export/ory.js +555 -0
  195. package/dist/migrate/export/ory.js.map +1 -0
  196. package/dist/migrate/export/password-detect.d.ts +29 -0
  197. package/dist/migrate/export/password-detect.js +81 -0
  198. package/dist/migrate/export/password-detect.js.map +1 -0
  199. package/dist/migrate/export/pingone.d.ts +36 -0
  200. package/dist/migrate/export/pingone.js +218 -0
  201. package/dist/migrate/export/pingone.js.map +1 -0
  202. package/dist/migrate/export/plugin-kit.d.ts +25 -0
  203. package/dist/migrate/export/plugin-kit.js +82 -0
  204. package/dist/migrate/export/plugin-kit.js.map +1 -0
  205. package/dist/migrate/export/pocketbase-config.d.ts +28 -0
  206. package/dist/migrate/export/pocketbase-config.js +180 -0
  207. package/dist/migrate/export/pocketbase-config.js.map +1 -0
  208. package/dist/migrate/export/pocketbase.d.ts +52 -0
  209. package/dist/migrate/export/pocketbase.js +243 -0
  210. package/dist/migrate/export/pocketbase.js.map +1 -0
  211. package/dist/migrate/export/project-files.d.ts +15 -0
  212. package/dist/migrate/export/project-files.js +43 -0
  213. package/dist/migrate/export/project-files.js.map +1 -0
  214. package/dist/migrate/export/propelauth-config.d.ts +18 -0
  215. package/dist/migrate/export/propelauth-config.js +58 -0
  216. package/dist/migrate/export/propelauth-config.js.map +1 -0
  217. package/dist/migrate/export/propelauth-harness.test-helper.d.ts +62 -0
  218. package/dist/migrate/export/propelauth-harness.test-helper.js +109 -0
  219. package/dist/migrate/export/propelauth-harness.test-helper.js.map +1 -0
  220. package/dist/migrate/export/propelauth.d.ts +48 -0
  221. package/dist/migrate/export/propelauth.js +255 -0
  222. package/dist/migrate/export/propelauth.js.map +1 -0
  223. package/dist/migrate/export/record-set.d.ts +44 -0
  224. package/dist/migrate/export/record-set.js +98 -0
  225. package/dist/migrate/export/record-set.js.map +1 -0
  226. package/dist/migrate/export/source-lines.d.ts +17 -0
  227. package/dist/migrate/export/source-lines.js +43 -0
  228. package/dist/migrate/export/source-lines.js.map +1 -0
  229. package/dist/migrate/export/sso-metadata.d.ts +47 -0
  230. package/dist/migrate/export/sso-metadata.js +180 -0
  231. package/dist/migrate/export/sso-metadata.js.map +1 -0
  232. package/dist/migrate/export/stytch-config.d.ts +22 -0
  233. package/dist/migrate/export/stytch-config.js +102 -0
  234. package/dist/migrate/export/stytch-config.js.map +1 -0
  235. package/dist/migrate/export/stytch.d.ts +68 -0
  236. package/dist/migrate/export/stytch.js +510 -0
  237. package/dist/migrate/export/stytch.js.map +1 -0
  238. package/dist/migrate/export/supabase-config.d.ts +48 -0
  239. package/dist/migrate/export/supabase-config.js +408 -0
  240. package/dist/migrate/export/supabase-config.js.map +1 -0
  241. package/dist/migrate/export/supabase.d.ts +86 -0
  242. package/dist/migrate/export/supabase.js +524 -0
  243. package/dist/migrate/export/supabase.js.map +1 -0
  244. package/dist/migrate/export/supertokens-config.d.ts +20 -0
  245. package/dist/migrate/export/supertokens-config.js +150 -0
  246. package/dist/migrate/export/supertokens-config.js.map +1 -0
  247. package/dist/migrate/export/supertokens.d.ts +125 -0
  248. package/dist/migrate/export/supertokens.js +464 -0
  249. package/dist/migrate/export/supertokens.js.map +1 -0
  250. package/dist/migrate/export/table.d.ts +35 -0
  251. package/dist/migrate/export/table.js +248 -0
  252. package/dist/migrate/export/table.js.map +1 -0
  253. package/dist/migrate/export/translate-kit.d.ts +46 -0
  254. package/dist/migrate/export/translate-kit.js +148 -0
  255. package/dist/migrate/export/translate-kit.js.map +1 -0
  256. package/dist/migrate/export/userfront-config.d.ts +15 -0
  257. package/dist/migrate/export/userfront-config.js +49 -0
  258. package/dist/migrate/export/userfront-config.js.map +1 -0
  259. package/dist/migrate/export/userfront.d.ts +38 -0
  260. package/dist/migrate/export/userfront.js +189 -0
  261. package/dist/migrate/export/userfront.js.map +1 -0
  262. package/dist/migrate/export/vendor-http.d.ts +46 -0
  263. package/dist/migrate/export/vendor-http.js +138 -0
  264. package/dist/migrate/export/vendor-http.js.map +1 -0
  265. package/dist/migrate/export/workos-config.d.ts +23 -0
  266. package/dist/migrate/export/workos-config.js +125 -0
  267. package/dist/migrate/export/workos-config.js.map +1 -0
  268. package/dist/migrate/export/workos.d.ts +46 -0
  269. package/dist/migrate/export/workos.js +272 -0
  270. package/dist/migrate/export/workos.js.map +1 -0
  271. package/dist/migrate/export/zip.d.ts +8 -0
  272. package/dist/migrate/export/zip.js +66 -0
  273. package/dist/migrate/export/zip.js.map +1 -0
  274. package/dist/migrate/export/zitadel-config.d.ts +37 -0
  275. package/dist/migrate/export/zitadel-config.js +279 -0
  276. package/dist/migrate/export/zitadel-config.js.map +1 -0
  277. package/dist/migrate/export/zitadel.d.ts +82 -0
  278. package/dist/migrate/export/zitadel.js +447 -0
  279. package/dist/migrate/export/zitadel.js.map +1 -0
  280. package/dist/migrate/firebase/plugin.d.ts +2 -0
  281. package/dist/migrate/firebase/plugin.js +152 -0
  282. package/dist/migrate/firebase/plugin.js.map +1 -0
  283. package/dist/migrate/framework/builtins.d.ts +2 -0
  284. package/dist/migrate/framework/builtins.js +52 -0
  285. package/dist/migrate/framework/builtins.js.map +1 -0
  286. package/dist/migrate/framework/commands.d.ts +20 -0
  287. package/dist/migrate/framework/commands.js +58 -0
  288. package/dist/migrate/framework/commands.js.map +1 -0
  289. package/dist/migrate/framework/custom.d.ts +12 -0
  290. package/dist/migrate/framework/custom.js +96 -0
  291. package/dist/migrate/framework/custom.js.map +1 -0
  292. package/dist/migrate/framework/orchestrator.d.ts +113 -0
  293. package/dist/migrate/framework/orchestrator.js +532 -0
  294. package/dist/migrate/framework/orchestrator.js.map +1 -0
  295. package/dist/migrate/framework/plugin.d.ts +167 -0
  296. package/dist/migrate/framework/plugin.js +3 -0
  297. package/dist/migrate/framework/plugin.js.map +1 -0
  298. package/dist/migrate/framework/registry.d.ts +11 -0
  299. package/dist/migrate/framework/registry.js +44 -0
  300. package/dist/migrate/framework/registry.js.map +1 -0
  301. package/dist/migrate/framework/report.d.ts +17 -0
  302. package/dist/migrate/framework/report.js +103 -0
  303. package/dist/migrate/framework/report.js.map +1 -0
  304. package/dist/migrate/frameworks/plugins.d.ts +29 -0
  305. package/dist/migrate/frameworks/plugins.js +402 -0
  306. package/dist/migrate/frameworks/plugins.js.map +1 -0
  307. package/dist/migrate/frameworks/report.d.ts +92 -0
  308. package/dist/migrate/frameworks/report.js +207 -0
  309. package/dist/migrate/frameworks/report.js.map +1 -0
  310. package/dist/migrate/frameworks/translate-js.d.ts +5 -0
  311. package/dist/migrate/frameworks/translate-js.js +503 -0
  312. package/dist/migrate/frameworks/translate-js.js.map +1 -0
  313. package/dist/migrate/frameworks/translate-rails-django.d.ts +3 -0
  314. package/dist/migrate/frameworks/translate-rails-django.js +1391 -0
  315. package/dist/migrate/frameworks/translate-rails-django.js.map +1 -0
  316. package/dist/migrate/frontegg/plugin.d.ts +2 -0
  317. package/dist/migrate/frontegg/plugin.js +78 -0
  318. package/dist/migrate/frontegg/plugin.js.map +1 -0
  319. package/dist/migrate/fusionauth/plugin.d.ts +2 -0
  320. package/dist/migrate/fusionauth/plugin.js +109 -0
  321. package/dist/migrate/fusionauth/plugin.js.map +1 -0
  322. package/dist/migrate/hanko/plugin.d.ts +2 -0
  323. package/dist/migrate/hanko/plugin.js +100 -0
  324. package/dist/migrate/hanko/plugin.js.map +1 -0
  325. package/dist/migrate/keycloak/plugin.d.ts +2 -0
  326. package/dist/migrate/keycloak/plugin.js +148 -0
  327. package/dist/migrate/keycloak/plugin.js.map +1 -0
  328. package/dist/migrate/kinde/plugin.d.ts +2 -0
  329. package/dist/migrate/kinde/plugin.js +105 -0
  330. package/dist/migrate/kinde/plugin.js.map +1 -0
  331. package/dist/migrate/ldap/plugin.d.ts +2 -0
  332. package/dist/migrate/ldap/plugin.js +73 -0
  333. package/dist/migrate/ldap/plugin.js.map +1 -0
  334. package/dist/migrate/logto/plugin.d.ts +2 -0
  335. package/dist/migrate/logto/plugin.js +131 -0
  336. package/dist/migrate/logto/plugin.js.map +1 -0
  337. package/dist/migrate/magic/plugin.d.ts +2 -0
  338. package/dist/migrate/magic/plugin.js +56 -0
  339. package/dist/migrate/magic/plugin.js.map +1 -0
  340. package/dist/migrate/nhost/plugin.d.ts +2 -0
  341. package/dist/migrate/nhost/plugin.js +115 -0
  342. package/dist/migrate/nhost/plugin.js.map +1 -0
  343. package/dist/migrate/oidc/plugin.d.ts +2 -0
  344. package/dist/migrate/oidc/plugin.js +73 -0
  345. package/dist/migrate/oidc/plugin.js.map +1 -0
  346. package/dist/migrate/okta/plugin.d.ts +2 -0
  347. package/dist/migrate/okta/plugin.js +105 -0
  348. package/dist/migrate/okta/plugin.js.map +1 -0
  349. package/dist/migrate/onelogin/plugin.d.ts +2 -0
  350. package/dist/migrate/onelogin/plugin.js +61 -0
  351. package/dist/migrate/onelogin/plugin.js.map +1 -0
  352. package/dist/migrate/ory/plugin.d.ts +2 -0
  353. package/dist/migrate/ory/plugin.js +186 -0
  354. package/dist/migrate/ory/plugin.js.map +1 -0
  355. package/dist/migrate/ping-identity/plugin.d.ts +2 -0
  356. package/dist/migrate/ping-identity/plugin.js +100 -0
  357. package/dist/migrate/ping-identity/plugin.js.map +1 -0
  358. package/dist/migrate/pocketbase/plugin.d.ts +2 -0
  359. package/dist/migrate/pocketbase/plugin.js +99 -0
  360. package/dist/migrate/pocketbase/plugin.js.map +1 -0
  361. package/dist/migrate/propelauth/plugin.d.ts +2 -0
  362. package/dist/migrate/propelauth/plugin.js +65 -0
  363. package/dist/migrate/propelauth/plugin.js.map +1 -0
  364. package/dist/migrate/saml/plugin.d.ts +2 -0
  365. package/dist/migrate/saml/plugin.js +79 -0
  366. package/dist/migrate/saml/plugin.js.map +1 -0
  367. package/dist/migrate/stytch/plugin.d.ts +2 -0
  368. package/dist/migrate/stytch/plugin.js +97 -0
  369. package/dist/migrate/stytch/plugin.js.map +1 -0
  370. package/dist/migrate/supabase/plugin.d.ts +2 -0
  371. package/dist/migrate/supabase/plugin.js +149 -0
  372. package/dist/migrate/supabase/plugin.js.map +1 -0
  373. package/dist/migrate/supertokens/plugin.d.ts +2 -0
  374. package/dist/migrate/supertokens/plugin.js +114 -0
  375. package/dist/migrate/supertokens/plugin.js.map +1 -0
  376. package/dist/migrate/user-table/plugin.d.ts +2 -0
  377. package/dist/migrate/user-table/plugin.js +62 -0
  378. package/dist/migrate/user-table/plugin.js.map +1 -0
  379. package/dist/migrate/userfront/plugin.d.ts +2 -0
  380. package/dist/migrate/userfront/plugin.js +60 -0
  381. package/dist/migrate/userfront/plugin.js.map +1 -0
  382. package/dist/migrate/workos/plugin.d.ts +2 -0
  383. package/dist/migrate/workos/plugin.js +81 -0
  384. package/dist/migrate/workos/plugin.js.map +1 -0
  385. package/dist/migrate/zitadel/plugin.d.ts +2 -0
  386. package/dist/migrate/zitadel/plugin.js +114 -0
  387. package/dist/migrate/zitadel/plugin.js.map +1 -0
  388. package/dist/run.js +4 -0
  389. package/dist/run.js.map +1 -1
  390. package/package.json +7 -5
@@ -0,0 +1,62 @@
1
+ import type { PasswordHash } from '@atlasauth/migrate';
2
+ import { RecordSet, type Obj } from './record-set';
3
+ /**
4
+ * `atlas migrate export auth0` — Auth0 (and Okta Customer Identity Cloud,
5
+ * which is Auth0) onto the canonical bundle models.
6
+ *
7
+ * Read with a Management API token the owner holds (a machine-to-machine
8
+ * application's client id + secret, or a token pasted from the dashboard);
9
+ * the calls run on this machine and the credentials go nowhere else.
10
+ *
11
+ * - users: through a user-export JOB (the only complete listing — user
12
+ * search stops at 1,000), or from an export file the owner already has;
13
+ * - password hashes and MFA secrets: Auth0 releases them ONLY through a
14
+ * support ticket. Pass the decrypted file with --auth0-hashes-file; rows are matched
15
+ * by user id (`_id.$oid` → `auth0|<oid>`) or email. Without it, enable the
16
+ * `auth0` lazy-migration preset so passwords move on first sign-in;
17
+ * - social and enterprise identities, app roles (role → users), organizations,
18
+ * members with their roles, pending invitations, enterprise connections
19
+ * (SAML / OIDC / Azure AD / ADFS / Okta / Ping / Google Workspace), and the
20
+ * tenant's public signing keys;
21
+ * - with --authentication-methods: per user, phone/email second factors and
22
+ * passkeys (public key only — Auth0 never returns a TOTP secret by API).
23
+ *
24
+ * Sessions are not exported: Auth0 issues JWTs, bridged by the `auth0`
25
+ * bridge preset against the tenant's JWKS.
26
+ */
27
+ export interface Auth0ExportOptions {
28
+ /** The tenant's canonical domain (`acme.us.auth0.com`), not a custom domain. */
29
+ domain: string;
30
+ clientId?: string;
31
+ clientSecret?: string;
32
+ /** A Management API token, instead of client credentials. */
33
+ token?: string;
34
+ /** The text of a user export file (NDJSON or JSON array), instead of running an export job. */
35
+ usersText?: string;
36
+ /** The text of the decrypted password-hash / MFA export from Auth0 support (NDJSON or JSON). */
37
+ hashesText?: string;
38
+ /** Only this database / social connection's users (export job `connection_id`). */
39
+ connectionId?: string;
40
+ /** Read each user's authentication methods (phone/email factors, passkeys). One call per user. */
41
+ authenticationMethods?: boolean;
42
+ /** The WebAuthn relying party the passkeys were registered for (default: the domain). */
43
+ rpId?: string;
44
+ fetchImpl?: typeof fetch;
45
+ sleep?: (ms: number) => Promise<void>;
46
+ onProgress?: (message: string) => void;
47
+ }
48
+ /** Fields requested from the export job (json format allows whole metadata objects). */
49
+ export declare const AUTH0_EXPORT_FIELDS: readonly ["user_id", "email", "email_verified", "username", "phone_number", "phone_verified", "given_name", "family_name", "name", "nickname", "picture", "identities", "app_metadata", "user_metadata", "created_at", "last_login", "blocked"];
50
+ export declare function exportAuth0(opts: Auth0ExportOptions): Promise<RecordSet>;
51
+ export declare function managementToken(domain: string, opts: Auth0ExportOptions, fetchImpl: typeof fetch): Promise<string>;
52
+ /** NDJSON (Auth0's export format) or a JSON array / `{ users: [] }`. */
53
+ export declare function parseLines(text: string): Obj[];
54
+ /** Auth0 role names are free text: `Billing Admin` → `billing_admin`. */
55
+ export declare function roleKey(name: string): string;
56
+ /**
57
+ * An Auth0 bulk-import `custom_password_hash` (users imported into Auth0 that
58
+ * never signed in since keep it) → the Atlas registry's algorithm + params.
59
+ */
60
+ export declare function auth0CustomHash(c: Obj): PasswordHash | {
61
+ reason: string;
62
+ };
@@ -0,0 +1,575 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AUTH0_EXPORT_FIELDS = void 0;
4
+ exports.exportAuth0 = exportAuth0;
5
+ exports.managementToken = managementToken;
6
+ exports.parseLines = parseLines;
7
+ exports.roleKey = roleKey;
8
+ exports.auth0CustomHash = auth0CustomHash;
9
+ const node_zlib_1 = require("node:zlib");
10
+ const record_set_1 = require("./record-set");
11
+ const vendor_http_1 = require("./vendor-http");
12
+ /** Fields requested from the export job (json format allows whole metadata objects). */
13
+ exports.AUTH0_EXPORT_FIELDS = [
14
+ 'user_id',
15
+ 'email',
16
+ 'email_verified',
17
+ 'username',
18
+ 'phone_number',
19
+ 'phone_verified',
20
+ 'given_name',
21
+ 'family_name',
22
+ 'name',
23
+ 'nickname',
24
+ 'picture',
25
+ 'identities',
26
+ 'app_metadata',
27
+ 'user_metadata',
28
+ 'created_at',
29
+ 'last_login',
30
+ 'blocked',
31
+ ];
32
+ const ENTERPRISE_STRATEGIES = ['samlp', 'oidc', 'waad', 'adfs', 'okta', 'pingfederate', 'google-apps', 'ad'];
33
+ async function exportAuth0(opts) {
34
+ const set = new record_set_1.RecordSet();
35
+ const domain = opts.domain.replace(/^https?:\/\//, '').replace(/\/+$/, '');
36
+ if (!/^[a-z0-9.-]+$/i.test(domain))
37
+ throw new Error(`Not an Auth0 domain: ${opts.domain}`);
38
+ const progress = opts.onProgress ?? (() => undefined);
39
+ const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
40
+ const fetchImpl = opts.fetchImpl ?? fetch;
41
+ let token = opts.token;
42
+ const http = new vendor_http_1.VendorHttp({
43
+ vendor: 'Auth0',
44
+ baseUrl: `https://${domain}/api/v2`,
45
+ headers: async () => ({ authorization: `Bearer ${(token ??= await managementToken(domain, opts, fetchImpl))}` }),
46
+ fetchImpl,
47
+ sleep,
48
+ });
49
+ // Offline: only the files (users + hashes), no Management API calls at all.
50
+ const online = Boolean(opts.token || (opts.clientId && opts.clientSecret));
51
+ if (!online && opts.usersText === undefined) {
52
+ throw new Error('Auth0 export needs a Management API token (or M2M client id + secret), or a user export file.');
53
+ }
54
+ if (!online)
55
+ set.warn('Exported from files only: organizations, roles and enterprise connections need Management API access.');
56
+ const list = async (fn) => (online ? fn() : []);
57
+ // Enterprise connections first: identities point at them by name.
58
+ progress('connections');
59
+ const connectionIds = new Map();
60
+ for (const c of await list(() => pageAll(http, `/connections?${ENTERPRISE_STRATEGIES.map((s) => `strategy=${s}`).join('&')}`, 'connections'))) {
61
+ const added = addConnection(set, c, domain);
62
+ if (added)
63
+ connectionIds.set((0, record_set_1.str)(c.name), added);
64
+ }
65
+ progress('organizations');
66
+ const orgs = await list(() => checkpointAll(http, '/organizations', 'organizations'));
67
+ for (const o of orgs) {
68
+ const id = (0, record_set_1.str)(o.id);
69
+ const name = (0, record_set_1.str)(o.display_name) ?? (0, record_set_1.str)(o.name);
70
+ if (!id || !name)
71
+ continue;
72
+ set.add('organization', (0, record_set_1.compact)({
73
+ id,
74
+ name,
75
+ slug: (0, record_set_1.str)(o.name),
76
+ image_url: (0, record_set_1.str)((0, record_set_1.isObj)(o.branding) ? o.branding.logo_url : undefined),
77
+ public_metadata: (0, record_set_1.bag)(o.metadata),
78
+ }));
79
+ }
80
+ progress('roles');
81
+ const roles = await list(() => pageAll(http, '/roles', 'roles'));
82
+ const roleKeyById = new Map();
83
+ const userRoles = new Map();
84
+ for (const r of roles) {
85
+ const id = (0, record_set_1.str)(r.id);
86
+ const name = (0, record_set_1.str)(r.name);
87
+ if (!id || !name)
88
+ continue;
89
+ const key = roleKey(name);
90
+ roleKeyById.set(id, key);
91
+ const permissions = (await pageAll(http, `/roles/${id}/permissions`, 'permissions'))
92
+ .map((p) => (0, record_set_1.str)(p.permission_name))
93
+ .filter((p) => !!p);
94
+ set.add('role', (0, record_set_1.compact)({ key, name, description: (0, record_set_1.str)(r.description), scope: 'app', permissions }), `app:${key}`);
95
+ if (orgs.length)
96
+ set.add('role', (0, record_set_1.compact)({ key, name, description: (0, record_set_1.str)(r.description), scope: 'organization', permissions }), `org:${key}`);
97
+ for (const u of await checkpointAll(http, `/roles/${id}/users`, 'users')) {
98
+ const uid = (0, record_set_1.str)(u.user_id);
99
+ if (uid)
100
+ userRoles.set(uid, [...(userRoles.get(uid) ?? []), key]);
101
+ }
102
+ }
103
+ progress('users');
104
+ const userLines = opts.usersText !== undefined ? parseLines(opts.usersText) : await runExportJob(http, opts, fetchImpl, sleep, progress);
105
+ const secrets = opts.hashesText !== undefined ? indexHashes(parseLines(opts.hashesText)) : null;
106
+ const userIds = new Set();
107
+ let withHash = 0;
108
+ for (const u of userLines) {
109
+ const id = (0, record_set_1.str)(u.user_id);
110
+ if (!id)
111
+ continue;
112
+ const secret = secrets ? (secrets.byId.get(id) ?? secrets.byEmail.get((0, record_set_1.str)(u.email)?.toLowerCase() ?? '')) : undefined;
113
+ if (addUser(set, u, { roles: userRoles.get(id), secret, connectionIds })) {
114
+ userIds.add(id);
115
+ if (secret?.password)
116
+ withHash++;
117
+ }
118
+ }
119
+ const dbUsers = set.list('user').filter((u) => u.id.startsWith('auth0|')).length;
120
+ if (!secrets && dbUsers > 0) {
121
+ set.warn(`${dbUsers} database user(s) without password hashes: Auth0 releases hashes only through a support ticket. Import them later with --auth0-hashes-file, or turn on the auth0 lazy-migration preset so each password moves on its first sign-in.`);
122
+ }
123
+ else if (secrets && withHash < dbUsers) {
124
+ set.omit('password', 'no row in the hash export for this database user', dbUsers - withHash);
125
+ }
126
+ if (opts.authenticationMethods && online) {
127
+ progress('authentication methods');
128
+ for (const id of userIds)
129
+ await addAuthenticationMethods(set, http, id, opts.rpId ?? domain);
130
+ }
131
+ else {
132
+ set.warn('Second factors and passkeys were not read (pass --authentication-methods). Without them, users re-enrol MFA in Atlas.');
133
+ }
134
+ progress('organization members');
135
+ for (const o of orgs) {
136
+ const orgId = (0, record_set_1.str)(o.id);
137
+ if (!orgId)
138
+ continue;
139
+ for (const m of await checkpointAll(http, `/organizations/${orgId}/members?fields=user_id,roles&include_fields=true`, 'members')) {
140
+ const uid = (0, record_set_1.str)(m.user_id);
141
+ if (!uid || !userIds.has(uid))
142
+ continue;
143
+ const role = (0, record_set_1.objs)(m.roles).map((r) => roleKeyById.get((0, record_set_1.str)(r.id) ?? '') ?? ((0, record_set_1.str)(r.name) ? roleKey((0, record_set_1.str)(r.name)) : undefined)).find(Boolean) ?? 'member';
144
+ set.add('membership', { organization_id: orgId, user_id: uid, role }, `${orgId}:${uid}`);
145
+ if ((0, record_set_1.objs)(m.roles).length > 1)
146
+ set.warn(`Some organization members hold several Auth0 roles; Atlas seats each member with one role (the first).`);
147
+ }
148
+ for (const inv of await pageAll(http, `/organizations/${orgId}/invitations`, 'invitations')) {
149
+ const id = (0, record_set_1.str)(inv.id);
150
+ const email = (0, record_set_1.str)((0, record_set_1.isObj)(inv.invitee) ? inv.invitee.email : undefined);
151
+ if (!id || !email)
152
+ continue;
153
+ const roleIds = Array.isArray(inv.roles) ? inv.roles : [];
154
+ set.add('invitation', (0, record_set_1.compact)({
155
+ id,
156
+ organization_id: orgId,
157
+ email,
158
+ role: roleIds.map((r) => roleKeyById.get(String(r))).find(Boolean),
159
+ status: 'pending',
160
+ expires_at: (0, record_set_1.str)(inv.expires_at),
161
+ created_at: (0, record_set_1.str)(inv.created_at),
162
+ }));
163
+ }
164
+ }
165
+ progress('signing keys');
166
+ if (online) {
167
+ try {
168
+ const res = await fetchImpl(`https://${domain}/.well-known/jwks.json`, { headers: { accept: 'application/json' } });
169
+ if (res.ok) {
170
+ const body = (await res.json());
171
+ for (const k of (0, record_set_1.objs)(body.keys))
172
+ if ((0, record_set_1.str)(k.kid))
173
+ set.add('jwks', { kid: (0, record_set_1.str)(k.kid), jwk: k });
174
+ }
175
+ }
176
+ catch {
177
+ set.warn('The tenant JWKS could not be read; the bridge preset fetches it live instead.');
178
+ }
179
+ }
180
+ set.manifest = {
181
+ origin: domain,
182
+ rpId: opts.authenticationMethods ? (opts.rpId ?? domain) : null,
183
+ providers: [...new Set(set.list('identity').map((i) => i.provider))].sort(),
184
+ };
185
+ return set;
186
+ }
187
+ // ── tokens and paging ───────────────────────────────────────────────────────
188
+ async function managementToken(domain, opts, fetchImpl) {
189
+ if (!opts.clientId || !opts.clientSecret) {
190
+ throw new Error('Auth0 export needs a Management API token, or the client id and secret of a machine-to-machine application authorized for the Management API.');
191
+ }
192
+ const res = await fetchImpl(`https://${domain}/oauth/token`, {
193
+ method: 'POST',
194
+ headers: { 'content-type': 'application/json', accept: 'application/json' },
195
+ body: JSON.stringify({ grant_type: 'client_credentials', client_id: opts.clientId, client_secret: opts.clientSecret, audience: `https://${domain}/api/v2/` }),
196
+ });
197
+ const body = (await res.json().catch(() => ({})));
198
+ if (!res.ok || !body.access_token) {
199
+ throw new vendor_http_1.VendorApiError('Auth0', res.status, '/oauth/token', body.error_description ?? 'could not get a Management API token');
200
+ }
201
+ return body.access_token;
202
+ }
203
+ /** page/per_page listing with include_totals (Auth0's classic paging). */
204
+ async function pageAll(http, path, key) {
205
+ const out = [];
206
+ const sep = path.includes('?') ? '&' : '?';
207
+ for (let page = 0;; page++) {
208
+ const { body } = await http.get(`${path}${sep}page=${page}&per_page=100&include_totals=true`);
209
+ const rows = Array.isArray(body) ? body.filter(record_set_1.isObj) : (0, record_set_1.isObj)(body) ? (0, record_set_1.objs)(body[key]) : [];
210
+ out.push(...rows);
211
+ const total = (0, record_set_1.isObj)(body) && typeof body.total === 'number' ? body.total : undefined;
212
+ if (rows.length < 100 || (total !== undefined && out.length >= total))
213
+ return out;
214
+ }
215
+ }
216
+ /** Checkpoint paging (`from` / `take`, `next` in the body): no 1,000-row ceiling. */
217
+ async function checkpointAll(http, path, key) {
218
+ const out = [];
219
+ const sep = path.includes('?') ? '&' : '?';
220
+ let from;
221
+ for (;;) {
222
+ const { body } = await http.get(`${path}${sep}take=100${from ? `&from=${encodeURIComponent(from)}` : ''}`);
223
+ const rows = Array.isArray(body) ? body.filter(record_set_1.isObj) : (0, record_set_1.isObj)(body) ? (0, record_set_1.objs)(body[key]) : [];
224
+ out.push(...rows);
225
+ from = (0, record_set_1.isObj)(body) ? (0, record_set_1.str)(body.next) : undefined;
226
+ if (!from || rows.length === 0)
227
+ return out;
228
+ }
229
+ }
230
+ async function runExportJob(http, opts, fetchImpl, sleep, progress) {
231
+ const body = { format: 'json', fields: exports.AUTH0_EXPORT_FIELDS.map((name) => ({ name })) };
232
+ if (opts.connectionId)
233
+ body.connection_id = opts.connectionId;
234
+ let job;
235
+ try {
236
+ job = (await http.post('/jobs/users-exports', body)).body;
237
+ }
238
+ catch (err) {
239
+ if (err instanceof vendor_http_1.VendorApiError && (err.status === 403 || err.status === 402)) {
240
+ throw new Error(`Auth0 refused the user export job (${err.message}). Export jobs need a paid plan and the read:users scope; or download an export yourself and pass it with --auth0-users-file.`);
241
+ }
242
+ throw err;
243
+ }
244
+ const id = (0, record_set_1.str)(job.id);
245
+ if (!id)
246
+ throw new Error('Auth0 did not return an export job id.');
247
+ for (let i = 0;; i++) {
248
+ const { body: status } = await http.get(`/jobs/${id}`);
249
+ const state = (0, record_set_1.str)(status.status);
250
+ if (state === 'completed' && (0, record_set_1.str)(status.location)) {
251
+ // The location is a short-lived pre-signed URL: no Auth0 credentials go with it.
252
+ const res = await fetchImpl((0, record_set_1.str)(status.location));
253
+ if (!res.ok)
254
+ throw new vendor_http_1.VendorApiError('Auth0', res.status, 'export download', 'the export file could not be downloaded');
255
+ const raw = Buffer.from(await res.arrayBuffer());
256
+ const text = raw[0] === 0x1f && raw[1] === 0x8b ? (0, node_zlib_1.gunzipSync)(raw).toString('utf8') : raw.toString('utf8');
257
+ return parseLines(text);
258
+ }
259
+ if (state === 'failed')
260
+ throw new Error(`The Auth0 export job ${id} failed${(0, record_set_1.str)(status.summary) ? `: ${(0, record_set_1.str)(status.summary)}` : ''}.`);
261
+ if (i % 6 === 0)
262
+ progress(`waiting for export job ${id} (${state ?? 'pending'}${typeof status.time_left_seconds === 'number' ? `, ~${status.time_left_seconds}s left` : ''})`);
263
+ await sleep(5000);
264
+ }
265
+ }
266
+ /** NDJSON (Auth0's export format) or a JSON array / `{ users: [] }`. */
267
+ function parseLines(text) {
268
+ const t = text.trim();
269
+ if (!t)
270
+ return [];
271
+ if (t.startsWith('['))
272
+ return (0, record_set_1.objs)(JSON.parse(t));
273
+ try {
274
+ const one = JSON.parse(t);
275
+ if ((0, record_set_1.isObj)(one))
276
+ return Array.isArray(one.users) ? (0, record_set_1.objs)(one.users) : [one];
277
+ }
278
+ catch {
279
+ // NDJSON: one object per line.
280
+ }
281
+ return t
282
+ .split(/\r?\n/)
283
+ .filter((l) => l.trim())
284
+ .map((l) => JSON.parse(l))
285
+ .filter(record_set_1.isObj);
286
+ }
287
+ function indexHashes(rows) {
288
+ const byId = new Map();
289
+ const byEmail = new Map();
290
+ for (const r of rows) {
291
+ const oid = (0, record_set_1.isObj)(r._id) ? (0, record_set_1.str)(r._id.$oid) : (0, record_set_1.str)(r._id);
292
+ const id = (0, record_set_1.str)(r.user_id) ?? (oid ? `auth0|${oid}` : undefined);
293
+ const secret = {};
294
+ const hash = (0, record_set_1.str)(r.passwordHash) ?? (0, record_set_1.str)(r.password_hash);
295
+ if (hash)
296
+ secret.password = { algorithm: 'auto', hash };
297
+ else if ((0, record_set_1.isObj)(r.custom_password_hash)) {
298
+ const mapped = auth0CustomHash(r.custom_password_hash);
299
+ if ('reason' in mapped)
300
+ secret.passwordReason = mapped.reason;
301
+ else
302
+ secret.password = mapped;
303
+ }
304
+ // MFA secrets, when support includes them, in the bulk-import `mfa_factors` shape.
305
+ for (const f of (0, record_set_1.objs)(r.mfa_factors)) {
306
+ const totp = (0, record_set_1.isObj)(f.totp) ? (0, record_set_1.str)(f.totp.secret) : undefined;
307
+ if (totp)
308
+ (secret.totp ??= []).push(totp);
309
+ const phone = (0, record_set_1.isObj)(f.phone) ? (0, record_set_1.str)(f.phone.value) : undefined;
310
+ if (phone)
311
+ (secret.phones ??= []).push(phone);
312
+ const email = (0, record_set_1.isObj)(f.email) ? (0, record_set_1.str)(f.email.value) : undefined;
313
+ if (email)
314
+ (secret.emails ??= []).push(email);
315
+ }
316
+ if (id)
317
+ byId.set(id, secret);
318
+ const email = (0, record_set_1.str)(r.email)?.toLowerCase();
319
+ if (email && !byEmail.has(email))
320
+ byEmail.set(email, secret);
321
+ }
322
+ return { byId, byEmail };
323
+ }
324
+ function addUser(set, u, ctx) {
325
+ const id = (0, record_set_1.str)(u.user_id);
326
+ const email = (0, record_set_1.str)(u.email)?.toLowerCase();
327
+ const phone = (0, record_set_1.e164)(u.phone_number);
328
+ const user = (0, record_set_1.compact)({
329
+ id,
330
+ emails: email ? [{ email, verified: u.email_verified === true, primary: true }] : [],
331
+ phones: phone ? [{ phone, verified: u.phone_verified === true, primary: !email }] : [],
332
+ username: (0, record_set_1.str)(u.username),
333
+ first_name: (0, record_set_1.str)(u.given_name),
334
+ last_name: (0, record_set_1.str)(u.family_name),
335
+ name: (0, record_set_1.str)(u.given_name) || (0, record_set_1.str)(u.family_name) ? undefined : (0, record_set_1.str)(u.name) && (0, record_set_1.str)(u.name) !== email ? (0, record_set_1.str)(u.name) : undefined,
336
+ image_url: (0, record_set_1.str)(u.picture),
337
+ roles: ctx.roles,
338
+ banned: u.blocked === true ? true : undefined,
339
+ // app_metadata is server-controlled in Auth0 (often holds entitlements): it
340
+ // lands in the backend-only bag. user_metadata is user-editable.
341
+ private_metadata: (0, record_set_1.bag)(u.app_metadata),
342
+ unsafe_metadata: (0, record_set_1.bag)(u.user_metadata),
343
+ created_at: (0, record_set_1.str)(u.created_at),
344
+ last_sign_in_at: (0, record_set_1.str)(u.last_login),
345
+ });
346
+ if (ctx.secret?.password)
347
+ user.password = ctx.secret.password;
348
+ else if (ctx.secret?.passwordReason)
349
+ set.omit('password', ctx.secret.passwordReason);
350
+ if (!user.emails?.length && !user.phones?.length && !user.username) {
351
+ set.omit('user', 'no email, phone number or username');
352
+ return false;
353
+ }
354
+ set.add('user', user);
355
+ for (const i of (0, record_set_1.objs)(u.identities)) {
356
+ const provider = (0, record_set_1.str)(i.provider);
357
+ const sub = (0, record_set_1.str)(i.user_id);
358
+ if (!provider || !sub || provider === 'auth0' || provider === 'sms' || provider === 'email')
359
+ continue;
360
+ const connection = (0, record_set_1.str)(i.connection);
361
+ const enterprise = connection ? ctx.connectionIds.get(connection) : undefined;
362
+ set.add('identity', (0, record_set_1.compact)({
363
+ user_id: id,
364
+ provider: enterprise ? connection : provider,
365
+ provider_user_id: sub,
366
+ kind: enterprise ? (provider === 'samlp' || provider === 'adfs' ? 'saml' : 'oidc') : i.isSocial === true ? 'oauth' : 'enterprise',
367
+ sso_connection_id: enterprise,
368
+ profile: (0, record_set_1.bag)(i.profileData),
369
+ }));
370
+ }
371
+ for (const secret of ctx.secret?.totp ?? []) {
372
+ set.add('mfa_factor', { user_id: id, type: 'totp', secret_base32: secret.replace(/=+$/, '').toUpperCase(), digits: 6, period: 30, algorithm: 'SHA1', verified: true });
373
+ }
374
+ for (const p of ctx.secret?.phones ?? []) {
375
+ const n = (0, record_set_1.e164)(p);
376
+ if (n)
377
+ set.add('mfa_factor', { user_id: id, type: 'phone', phone: n, verified: true }, `phone:${id}:${n}`);
378
+ }
379
+ for (const _ of ctx.secret?.emails ?? [])
380
+ set.add('mfa_factor', { user_id: id, type: 'email', verified: true }, `email:${id}`);
381
+ return true;
382
+ }
383
+ async function addAuthenticationMethods(set, http, userId, rpId) {
384
+ let methods;
385
+ try {
386
+ methods = await pageAll(http, `/users/${encodeURIComponent(userId)}/authentication-methods`, 'authenticators');
387
+ }
388
+ catch (err) {
389
+ if (err instanceof vendor_http_1.VendorApiError && (err.status === 403 || err.status === 404))
390
+ return;
391
+ throw err;
392
+ }
393
+ for (const m of methods) {
394
+ const type = (0, record_set_1.str)(m.type);
395
+ if (m.confirmed === false)
396
+ continue;
397
+ if (type === 'phone' || type === 'sms') {
398
+ const phone = (0, record_set_1.e164)(m.phone_number);
399
+ if (phone)
400
+ set.add('mfa_factor', { user_id: userId, type: 'phone', phone, verified: true, created_at: (0, record_set_1.str)(m.created_at) }, `phone:${userId}:${phone}`);
401
+ }
402
+ else if (type === 'email') {
403
+ set.add('mfa_factor', { user_id: userId, type: 'email', verified: true, created_at: (0, record_set_1.str)(m.created_at) }, `email:${userId}`);
404
+ }
405
+ else if ((type === 'passkey' || type === 'webauthn-platform' || type === 'webauthn-roaming') && (0, record_set_1.str)(m.key_id) && (0, record_set_1.str)(m.public_key)) {
406
+ set.add('passkey', (0, record_set_1.compact)({
407
+ id: (0, record_set_1.str)(m.id),
408
+ user_id: userId,
409
+ credential_id: b64url((0, record_set_1.str)(m.key_id)),
410
+ public_key: b64url((0, record_set_1.str)(m.public_key)),
411
+ rp_id: (0, record_set_1.str)(m.relying_party_identifier) ?? rpId,
412
+ aaguid: (0, record_set_1.str)(m.aaguid),
413
+ name: (0, record_set_1.str)(m.name),
414
+ backed_up: m.credential_backed_up === true ? true : undefined,
415
+ created_at: (0, record_set_1.str)(m.created_at),
416
+ }));
417
+ }
418
+ else if (type === 'totp' || type === 'guardian' || type === 'push' || type === 'recovery-code' || type === 'webauthn-roaming' || type === 'webauthn-platform') {
419
+ set.omit('mfa_factor', `Auth0 does not return ${type} secrets by API (support export, or re-enrolment)`);
420
+ }
421
+ }
422
+ }
423
+ const b64url = (v) => v.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
424
+ /** Auth0 role names are free text: `Billing Admin` → `billing_admin`. */
425
+ function roleKey(name) {
426
+ return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'role';
427
+ }
428
+ /**
429
+ * An Auth0 bulk-import `custom_password_hash` (users imported into Auth0 that
430
+ * never signed in since keep it) → the Atlas registry's algorithm + params.
431
+ */
432
+ function auth0CustomHash(c) {
433
+ const algorithm = (0, record_set_1.str)(c.algorithm)?.toLowerCase();
434
+ const hash = (0, record_set_1.isObj)(c.hash) ? c.hash : {};
435
+ const value = (0, record_set_1.str)(hash.value);
436
+ if (!algorithm || !value)
437
+ return { reason: 'custom_password_hash without algorithm or hash value' };
438
+ const salt = (0, record_set_1.isObj)(c.salt) ? c.salt : undefined;
439
+ const pwEnc = (0, record_set_1.isObj)(c.password) ? (0, record_set_1.str)(c.password.encoding) : undefined;
440
+ if (pwEnc && !['utf8', 'utf-8', 'ascii'].includes(pwEnc)) {
441
+ return { reason: `custom_password_hash password.encoding "${pwEnc}" is not supported` };
442
+ }
443
+ const encoding = (0, record_set_1.str)(hash.encoding) ?? (algorithm === 'scrypt' ? 'hex' : 'hex');
444
+ const saltParams = salt
445
+ ? { salt_position: (0, record_set_1.str)(salt.position) ?? 'prefix', salt_encoding: (0, record_set_1.str)(salt.encoding) ?? 'utf8' }
446
+ : {};
447
+ switch (algorithm) {
448
+ case 'bcrypt':
449
+ return { algorithm: 'bcrypt', hash: value };
450
+ case 'argon2':
451
+ return { algorithm: 'argon2', hash: value };
452
+ case 'pbkdf2':
453
+ // A PHC string `$pbkdf2-<digest>$i=<iterations>,l=<keylen>$<salt>$<hash>`.
454
+ return { algorithm: 'auto', hash: value };
455
+ case 'ldap':
456
+ // RFC 2307: Atlas verifies the SHA family ({SHA}, {SSHA}, {SSHA256}, {SSHA512}).
457
+ return /^\{S?SHA(256|512)?\}/i.test(value) ? { algorithm: 'ldap_ssha', hash: value } : { reason: 'custom_password_hash ldap scheme other than {SHA}/{SSHA} is not supported' };
458
+ case 'md5':
459
+ case 'sha1':
460
+ case 'sha256':
461
+ case 'sha512': {
462
+ const s = salt ? (0, record_set_1.str)(salt.value) : undefined;
463
+ if (!s)
464
+ return { algorithm, hash: value, params: { encoding } };
465
+ return { algorithm: `${algorithm}_salted`, hash: value, salt: s, params: { encoding, ...saltParams } };
466
+ }
467
+ case 'hmac': {
468
+ const digest = (0, record_set_1.str)(hash.digest)?.toLowerCase();
469
+ const key = (0, record_set_1.isObj)(hash.key) ? (0, record_set_1.str)(hash.key.value) : undefined;
470
+ if (digest !== 'sha256' || !key)
471
+ return { reason: `custom_password_hash hmac with digest "${digest ?? '?'}" is not supported (sha256 only)` };
472
+ if (salt)
473
+ return { reason: 'custom_password_hash hmac with a salt is not supported' };
474
+ return { algorithm: 'hmac_sha256', hash: value, params: { key, key_encoding: ((0, record_set_1.isObj)(hash.key) ? (0, record_set_1.str)(hash.key.encoding) : undefined) ?? 'utf8', encoding } };
475
+ }
476
+ case 'scrypt': {
477
+ const s = salt ? (0, record_set_1.str)(salt.value) : undefined;
478
+ const keylen = typeof c.keylen === 'number' ? c.keylen : undefined;
479
+ if (!s || !keylen)
480
+ return { reason: 'custom_password_hash scrypt needs salt and keylen' };
481
+ return {
482
+ algorithm: 'scrypt',
483
+ hash: value,
484
+ salt: s,
485
+ params: {
486
+ n: typeof c.cost === 'number' ? c.cost : 16384,
487
+ r: typeof c.blockSize === 'number' ? c.blockSize : 8,
488
+ p: typeof c.parallelization === 'number' ? c.parallelization : 1,
489
+ key_length: keylen,
490
+ encoding,
491
+ salt_encoding: (0, record_set_1.str)(salt?.encoding) ?? 'utf8',
492
+ },
493
+ };
494
+ }
495
+ default:
496
+ return { reason: `custom_password_hash algorithm "${algorithm}" is not supported` };
497
+ }
498
+ }
499
+ // ── enterprise connections ──────────────────────────────────────────────────
500
+ function addConnection(set, c, domain) {
501
+ const id = (0, record_set_1.str)(c.id);
502
+ const name = (0, record_set_1.str)(c.name);
503
+ const strategy = (0, record_set_1.str)(c.strategy);
504
+ if (!id || !name || !strategy)
505
+ return undefined;
506
+ const o = (0, record_set_1.isObj)(c.options) ? c.options : {};
507
+ const domains = Array.isArray(o.domain_aliases) ? o.domain_aliases.map((d) => (0, record_set_1.str)(d)).filter((d) => !!d) : [];
508
+ if (strategy === 'samlp' || strategy === 'adfs' || strategy === 'pingfederate') {
509
+ const cert = (0, record_set_1.str)(o.signingCert) ?? (0, record_set_1.str)(o.cert);
510
+ set.add('sso_connection', (0, record_set_1.compact)({
511
+ id,
512
+ name: (0, record_set_1.str)(c.display_name) ?? name,
513
+ protocol: 'saml',
514
+ domains,
515
+ saml: (0, record_set_1.compact)({
516
+ idp_entity_id: (0, record_set_1.str)(o.entityId) ?? (0, record_set_1.str)(o.issuer),
517
+ idp_sso_url: (0, record_set_1.str)(o.signInEndpoint) ?? (0, record_set_1.str)(o.pingFederateBaseUrl),
518
+ idp_certificate: cert ? pemFromAuth0Cert(cert) : undefined,
519
+ idp_metadata_url: (0, record_set_1.str)(o.metadataUrl) ?? (0, record_set_1.str)(o.adfs_server),
520
+ idp_metadata_xml: (0, record_set_1.str)(o.metadataXml),
521
+ sp_entity_id: `urn:auth0:${domain.split('.')[0]}:${name}`,
522
+ sp_acs_url: `https://${domain}/login/callback?connection=${encodeURIComponent(name)}`,
523
+ attribute_mapping: (0, record_set_1.isObj)(o.fieldsMap)
524
+ ? Object.fromEntries(Object.entries(o.fieldsMap).filter(([, v]) => typeof v === 'string'))
525
+ : undefined,
526
+ }),
527
+ }));
528
+ return id;
529
+ }
530
+ if (strategy === 'oidc' || strategy === 'okta' || strategy === 'waad' || strategy === 'google-apps') {
531
+ const issuer = strategy === 'waad'
532
+ ? (0, record_set_1.str)(o.tenant_domain)
533
+ ? `https://login.microsoftonline.com/${(0, record_set_1.str)(o.tenant_id) ?? (0, record_set_1.str)(o.tenant_domain)}/v2.0`
534
+ : undefined
535
+ : strategy === 'google-apps'
536
+ ? 'https://accounts.google.com'
537
+ : (0, record_set_1.str)(o.issuer) ?? ((0, record_set_1.str)(o.domain) ? `https://${(0, record_set_1.str)(o.domain)}` : undefined);
538
+ set.add('sso_connection', (0, record_set_1.compact)({
539
+ id,
540
+ name: (0, record_set_1.str)(c.display_name) ?? name,
541
+ protocol: 'oidc',
542
+ domains: strategy === 'google-apps' && (0, record_set_1.str)(o.domain) ? [...domains, (0, record_set_1.str)(o.domain)] : domains,
543
+ oidc: (0, record_set_1.compact)({
544
+ issuer,
545
+ discovery_url: (0, record_set_1.str)(o.discovery_url),
546
+ client_id: (0, record_set_1.str)(o.client_id),
547
+ client_secret: (0, record_set_1.str)(o.client_secret),
548
+ scopes: (0, record_set_1.str)(o.scope)?.split(/\s+/),
549
+ }),
550
+ }));
551
+ if (!(0, record_set_1.str)(o.client_secret))
552
+ set.warn(`Enterprise connection ${name}: Auth0 does not return its client secret; enter it in Atlas after the import.`);
553
+ return id;
554
+ }
555
+ set.warn(`Enterprise connection ${name} (${strategy}) has no Atlas counterpart and was not exported (LDAP/AD connector: use lazy migration).`);
556
+ return undefined;
557
+ }
558
+ /** Auth0 returns the IdP signing certificate as base64 DER or PEM. */
559
+ function pemFromAuth0Cert(cert) {
560
+ if (cert.includes('BEGIN CERTIFICATE'))
561
+ return cert;
562
+ const body = cert.replace(/\s+/g, '');
563
+ let der = body;
564
+ // Some tenants store the PEM itself base64-encoded.
565
+ try {
566
+ const decoded = Buffer.from(body, 'base64').toString('utf8');
567
+ if (decoded.includes('BEGIN CERTIFICATE'))
568
+ return decoded;
569
+ }
570
+ catch {
571
+ der = body;
572
+ }
573
+ return `-----BEGIN CERTIFICATE-----\n${der.match(/.{1,64}/g).join('\n')}\n-----END CERTIFICATE-----`;
574
+ }
575
+ //# sourceMappingURL=auth0.js.map