@atlasauth/cli 0.25.0 → 0.26.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 (546) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +26 -5
  3. package/dist/args.d.ts +631 -0
  4. package/dist/args.js +304 -0
  5. package/dist/args.js.map +1 -0
  6. package/dist/cli.d.ts +2 -0
  7. package/dist/cli.js +19 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/commands/actions-gallery.d.ts +8 -0
  10. package/dist/commands/actions-gallery.js +197 -0
  11. package/dist/commands/actions-gallery.js.map +1 -0
  12. package/dist/commands/actions.d.ts +13 -0
  13. package/dist/commands/actions.js +135 -0
  14. package/dist/commands/actions.js.map +1 -0
  15. package/dist/commands/admin.d.ts +49 -0
  16. package/dist/commands/admin.js +353 -0
  17. package/dist/commands/admin.js.map +1 -0
  18. package/dist/commands/api-keys.d.ts +4 -0
  19. package/dist/commands/api-keys.js +96 -0
  20. package/dist/commands/api-keys.js.map +1 -0
  21. package/dist/commands/auth.d.ts +25 -0
  22. package/dist/commands/auth.js +102 -0
  23. package/dist/commands/auth.js.map +1 -0
  24. package/dist/commands/config.d.ts +128 -0
  25. package/dist/commands/config.js +1822 -0
  26. package/dist/commands/config.js.map +1 -0
  27. package/dist/commands/csp.d.ts +32 -0
  28. package/dist/commands/csp.js +180 -0
  29. package/dist/commands/csp.js.map +1 -0
  30. package/dist/commands/dev.d.ts +8 -0
  31. package/dist/commands/dev.js +84 -0
  32. package/dist/commands/dev.js.map +1 -0
  33. package/dist/commands/doctor-scan.d.ts +27 -0
  34. package/dist/commands/doctor-scan.js +221 -0
  35. package/dist/commands/doctor-scan.js.map +1 -0
  36. package/dist/commands/fga.d.ts +10 -0
  37. package/dist/commands/fga.js +146 -0
  38. package/dist/commands/fga.js.map +1 -0
  39. package/dist/commands/golive.d.ts +40 -0
  40. package/dist/commands/golive.js +297 -0
  41. package/dist/commands/golive.js.map +1 -0
  42. package/dist/commands/id-accounts.d.ts +13 -0
  43. package/dist/commands/id-accounts.js +195 -0
  44. package/dist/commands/id-accounts.js.map +1 -0
  45. package/dist/commands/import-better-auth.d.ts +3 -0
  46. package/dist/commands/import-better-auth.js +164 -0
  47. package/dist/commands/import-better-auth.js.map +1 -0
  48. package/dist/commands/import-jsonl.d.ts +50 -0
  49. package/dist/commands/import-jsonl.js +252 -0
  50. package/dist/commands/import-jsonl.js.map +1 -0
  51. package/dist/commands/import.d.ts +3 -0
  52. package/dist/commands/import.js +133 -0
  53. package/dist/commands/import.js.map +1 -0
  54. package/dist/commands/info.d.ts +75 -0
  55. package/dist/commands/info.js +362 -0
  56. package/dist/commands/info.js.map +1 -0
  57. package/dist/commands/init-next.d.ts +4 -0
  58. package/dist/commands/init-next.js +86 -0
  59. package/dist/commands/init-next.js.map +1 -0
  60. package/dist/commands/init.d.ts +3 -0
  61. package/dist/commands/init.js +525 -0
  62. package/dist/commands/init.js.map +1 -0
  63. package/dist/commands/integrations.d.ts +8 -0
  64. package/dist/commands/integrations.js +112 -0
  65. package/dist/commands/integrations.js.map +1 -0
  66. package/dist/commands/listen.d.ts +17 -0
  67. package/dist/commands/listen.js +223 -0
  68. package/dist/commands/listen.js.map +1 -0
  69. package/dist/commands/mcp.d.ts +38 -0
  70. package/dist/commands/mcp.js +111 -0
  71. package/dist/commands/mcp.js.map +1 -0
  72. package/dist/commands/migrate.d.ts +16 -0
  73. package/dist/commands/migrate.js +114 -0
  74. package/dist/commands/migrate.js.map +1 -0
  75. package/dist/commands/move-origin.d.ts +11 -0
  76. package/dist/commands/move-origin.js +95 -0
  77. package/dist/commands/move-origin.js.map +1 -0
  78. package/dist/commands/operator.d.ts +18 -0
  79. package/dist/commands/operator.js +238 -0
  80. package/dist/commands/operator.js.map +1 -0
  81. package/dist/commands/orgs.d.ts +4 -0
  82. package/dist/commands/orgs.js +72 -0
  83. package/dist/commands/orgs.js.map +1 -0
  84. package/dist/commands/pages.d.ts +14 -0
  85. package/dist/commands/pages.js +113 -0
  86. package/dist/commands/pages.js.map +1 -0
  87. package/dist/commands/partner-platforms.d.ts +10 -0
  88. package/dist/commands/partner-platforms.js +157 -0
  89. package/dist/commands/partner-platforms.js.map +1 -0
  90. package/dist/commands/project-commands.d.ts +38 -0
  91. package/dist/commands/project-commands.js +431 -0
  92. package/dist/commands/project-commands.js.map +1 -0
  93. package/dist/commands/referrals.d.ts +69 -0
  94. package/dist/commands/referrals.js +1056 -0
  95. package/dist/commands/referrals.js.map +1 -0
  96. package/dist/commands/resources.d.ts +44 -0
  97. package/dist/commands/resources.js +234 -0
  98. package/dist/commands/resources.js.map +1 -0
  99. package/dist/commands/sessions.d.ts +4 -0
  100. package/dist/commands/sessions.js +28 -0
  101. package/dist/commands/sessions.js.map +1 -0
  102. package/dist/commands/setup-guide.d.ts +3 -0
  103. package/dist/commands/setup-guide.js +38 -0
  104. package/dist/commands/setup-guide.js.map +1 -0
  105. package/dist/commands/shared.d.ts +38 -0
  106. package/dist/commands/shared.js +69 -0
  107. package/dist/commands/shared.js.map +1 -0
  108. package/dist/commands/status.d.ts +3 -0
  109. package/dist/commands/status.js +77 -0
  110. package/dist/commands/status.js.map +1 -0
  111. package/dist/commands/users.d.ts +4 -0
  112. package/dist/commands/users.js +111 -0
  113. package/dist/commands/users.js.map +1 -0
  114. package/dist/commands/webhooks.d.ts +34 -0
  115. package/dist/commands/webhooks.js +301 -0
  116. package/dist/commands/webhooks.js.map +1 -0
  117. package/dist/config-http.d.ts +38 -0
  118. package/dist/config-http.js +70 -0
  119. package/dist/config-http.js.map +1 -0
  120. package/dist/config.d.ts +64 -0
  121. package/dist/config.js +69 -0
  122. package/dist/config.js.map +1 -0
  123. package/dist/context.d.ts +89 -0
  124. package/dist/context.js +32 -0
  125. package/dist/context.js.map +1 -0
  126. package/dist/define-config.d.ts +9 -0
  127. package/dist/define-config.js +8 -0
  128. package/dist/define-config.js.map +1 -0
  129. package/dist/errors.d.ts +15 -0
  130. package/dist/errors.js +25 -0
  131. package/dist/errors.js.map +1 -0
  132. package/dist/help.d.ts +8 -0
  133. package/dist/help.js +926 -0
  134. package/dist/help.js.map +1 -0
  135. package/dist/import/csv.d.ts +6 -0
  136. package/dist/import/csv.js +63 -0
  137. package/dist/import/csv.js.map +1 -0
  138. package/dist/import/vendors.d.ts +57 -0
  139. package/dist/import/vendors.js +568 -0
  140. package/dist/import/vendors.js.map +1 -0
  141. package/dist/index.d.ts +33 -0
  142. package/dist/index.js +81 -0
  143. package/dist/index.js.map +1 -0
  144. package/dist/io.d.ts +21 -0
  145. package/dist/io.js +28 -0
  146. package/dist/io.js.map +1 -0
  147. package/dist/migrate/appwrite/plugin.d.ts +2 -0
  148. package/dist/migrate/appwrite/plugin.js +103 -0
  149. package/dist/migrate/appwrite/plugin.js.map +1 -0
  150. package/dist/migrate/auth0/plugin.d.ts +2 -0
  151. package/dist/migrate/auth0/plugin.js +126 -0
  152. package/dist/migrate/auth0/plugin.js.map +1 -0
  153. package/dist/migrate/authentik/plugin.d.ts +2 -0
  154. package/dist/migrate/authentik/plugin.js +135 -0
  155. package/dist/migrate/authentik/plugin.js.map +1 -0
  156. package/dist/migrate/azure-ad-b2c/plugin.d.ts +8 -0
  157. package/dist/migrate/azure-ad-b2c/plugin.js +165 -0
  158. package/dist/migrate/azure-ad-b2c/plugin.js.map +1 -0
  159. package/dist/migrate/better-auth/integration.d.ts +59 -0
  160. package/dist/migrate/better-auth/integration.js +81 -0
  161. package/dist/migrate/better-auth/integration.js.map +1 -0
  162. package/dist/migrate/better-auth/orchestrator.d.ts +43 -0
  163. package/dist/migrate/better-auth/orchestrator.js +525 -0
  164. package/dist/migrate/better-auth/orchestrator.js.map +1 -0
  165. package/dist/migrate/better-auth/output.d.ts +20 -0
  166. package/dist/migrate/better-auth/output.js +146 -0
  167. package/dist/migrate/better-auth/output.js.map +1 -0
  168. package/dist/migrate/better-auth/translate.d.ts +77 -0
  169. package/dist/migrate/better-auth/translate.js +1989 -0
  170. package/dist/migrate/better-auth/translate.js.map +1 -0
  171. package/dist/migrate/clerk/plugin.d.ts +2 -0
  172. package/dist/migrate/clerk/plugin.js +76 -0
  173. package/dist/migrate/clerk/plugin.js.map +1 -0
  174. package/dist/migrate/cognito/plugin.d.ts +5 -0
  175. package/dist/migrate/cognito/plugin.js +170 -0
  176. package/dist/migrate/cognito/plugin.js.map +1 -0
  177. package/dist/migrate/corbado/plugin.d.ts +2 -0
  178. package/dist/migrate/corbado/plugin.js +63 -0
  179. package/dist/migrate/corbado/plugin.js.map +1 -0
  180. package/dist/migrate/descope/plugin.d.ts +2 -0
  181. package/dist/migrate/descope/plugin.js +83 -0
  182. package/dist/migrate/descope/plugin.js.map +1 -0
  183. package/dist/migrate/entra-external-id/plugin.d.ts +8 -0
  184. package/dist/migrate/entra-external-id/plugin.js +12 -0
  185. package/dist/migrate/entra-external-id/plugin.js.map +1 -0
  186. package/dist/migrate/export/appwrite-config.d.ts +28 -0
  187. package/dist/migrate/export/appwrite-config.js +170 -0
  188. package/dist/migrate/export/appwrite-config.js.map +1 -0
  189. package/dist/migrate/export/appwrite.d.ts +51 -0
  190. package/dist/migrate/export/appwrite.js +288 -0
  191. package/dist/migrate/export/appwrite.js.map +1 -0
  192. package/dist/migrate/export/auth0-config.d.ts +29 -0
  193. package/dist/migrate/export/auth0-config.js +249 -0
  194. package/dist/migrate/export/auth0-config.js.map +1 -0
  195. package/dist/migrate/export/auth0.d.ts +62 -0
  196. package/dist/migrate/export/auth0.js +575 -0
  197. package/dist/migrate/export/auth0.js.map +1 -0
  198. package/dist/migrate/export/authentik-config.d.ts +45 -0
  199. package/dist/migrate/export/authentik-config.js +357 -0
  200. package/dist/migrate/export/authentik-config.js.map +1 -0
  201. package/dist/migrate/export/authentik.d.ts +110 -0
  202. package/dist/migrate/export/authentik.js +838 -0
  203. package/dist/migrate/export/authentik.js.map +1 -0
  204. package/dist/migrate/export/azure-config.d.ts +58 -0
  205. package/dist/migrate/export/azure-config.js +344 -0
  206. package/dist/migrate/export/azure-config.js.map +1 -0
  207. package/dist/migrate/export/azure.d.ts +85 -0
  208. package/dist/migrate/export/azure.js +373 -0
  209. package/dist/migrate/export/azure.js.map +1 -0
  210. package/dist/migrate/export/clerk-config.d.ts +26 -0
  211. package/dist/migrate/export/clerk-config.js +227 -0
  212. package/dist/migrate/export/clerk-config.js.map +1 -0
  213. package/dist/migrate/export/clerk.d.ts +46 -0
  214. package/dist/migrate/export/clerk.js +486 -0
  215. package/dist/migrate/export/clerk.js.map +1 -0
  216. package/dist/migrate/export/cognito-config.d.ts +25 -0
  217. package/dist/migrate/export/cognito-config.js +273 -0
  218. package/dist/migrate/export/cognito-config.js.map +1 -0
  219. package/dist/migrate/export/cognito.d.ts +103 -0
  220. package/dist/migrate/export/cognito.js +441 -0
  221. package/dist/migrate/export/cognito.js.map +1 -0
  222. package/dist/migrate/export/corbado-config.d.ts +20 -0
  223. package/dist/migrate/export/corbado-config.js +63 -0
  224. package/dist/migrate/export/corbado-config.js.map +1 -0
  225. package/dist/migrate/export/corbado.d.ts +37 -0
  226. package/dist/migrate/export/corbado.js +132 -0
  227. package/dist/migrate/export/corbado.js.map +1 -0
  228. package/dist/migrate/export/descope.d.ts +35 -0
  229. package/dist/migrate/export/descope.js +208 -0
  230. package/dist/migrate/export/descope.js.map +1 -0
  231. package/dist/migrate/export/fake-vendor.test-helper.d.ts +27 -0
  232. package/dist/migrate/export/fake-vendor.test-helper.js +41 -0
  233. package/dist/migrate/export/fake-vendor.test-helper.js.map +1 -0
  234. package/dist/migrate/export/firebase-config.d.ts +24 -0
  235. package/dist/migrate/export/firebase-config.js +215 -0
  236. package/dist/migrate/export/firebase-config.js.map +1 -0
  237. package/dist/migrate/export/firebase.d.ts +102 -0
  238. package/dist/migrate/export/firebase.js +464 -0
  239. package/dist/migrate/export/firebase.js.map +1 -0
  240. package/dist/migrate/export/frameworks/app-users.d.ts +42 -0
  241. package/dist/migrate/export/frameworks/app-users.js +161 -0
  242. package/dist/migrate/export/frameworks/app-users.js.map +1 -0
  243. package/dist/migrate/export/frameworks/authjs.d.ts +41 -0
  244. package/dist/migrate/export/frameworks/authjs.js +146 -0
  245. package/dist/migrate/export/frameworks/authjs.js.map +1 -0
  246. package/dist/migrate/export/frameworks/devise.d.ts +39 -0
  247. package/dist/migrate/export/frameworks/devise.js +218 -0
  248. package/dist/migrate/export/frameworks/devise.js.map +1 -0
  249. package/dist/migrate/export/frameworks/django.d.ts +45 -0
  250. package/dist/migrate/export/frameworks/django.js +315 -0
  251. package/dist/migrate/export/frameworks/django.js.map +1 -0
  252. package/dist/migrate/export/frameworks/lucia.d.ts +42 -0
  253. package/dist/migrate/export/frameworks/lucia.js +263 -0
  254. package/dist/migrate/export/frameworks/lucia.js.map +1 -0
  255. package/dist/migrate/export/frameworks/tables.d.ts +90 -0
  256. package/dist/migrate/export/frameworks/tables.js +325 -0
  257. package/dist/migrate/export/frameworks/tables.js.map +1 -0
  258. package/dist/migrate/export/frameworks/webauthn.d.ts +25 -0
  259. package/dist/migrate/export/frameworks/webauthn.js +130 -0
  260. package/dist/migrate/export/frameworks/webauthn.js.map +1 -0
  261. package/dist/migrate/export/frontegg-config.d.ts +29 -0
  262. package/dist/migrate/export/frontegg-config.js +238 -0
  263. package/dist/migrate/export/frontegg-config.js.map +1 -0
  264. package/dist/migrate/export/frontegg.d.ts +67 -0
  265. package/dist/migrate/export/frontegg.js +410 -0
  266. package/dist/migrate/export/frontegg.js.map +1 -0
  267. package/dist/migrate/export/fusionauth-config.d.ts +26 -0
  268. package/dist/migrate/export/fusionauth-config.js +226 -0
  269. package/dist/migrate/export/fusionauth-config.js.map +1 -0
  270. package/dist/migrate/export/fusionauth.d.ts +99 -0
  271. package/dist/migrate/export/fusionauth.js +642 -0
  272. package/dist/migrate/export/fusionauth.js.map +1 -0
  273. package/dist/migrate/export/hanko-config.d.ts +27 -0
  274. package/dist/migrate/export/hanko-config.js +265 -0
  275. package/dist/migrate/export/hanko-config.js.map +1 -0
  276. package/dist/migrate/export/hanko.d.ts +52 -0
  277. package/dist/migrate/export/hanko.js +605 -0
  278. package/dist/migrate/export/hanko.js.map +1 -0
  279. package/dist/migrate/export/keycloak-config.d.ts +19 -0
  280. package/dist/migrate/export/keycloak-config.js +219 -0
  281. package/dist/migrate/export/keycloak-config.js.map +1 -0
  282. package/dist/migrate/export/keycloak.d.ts +155 -0
  283. package/dist/migrate/export/keycloak.js +878 -0
  284. package/dist/migrate/export/keycloak.js.map +1 -0
  285. package/dist/migrate/export/kinde-descope-config.d.ts +38 -0
  286. package/dist/migrate/export/kinde-descope-config.js +172 -0
  287. package/dist/migrate/export/kinde-descope-config.js.map +1 -0
  288. package/dist/migrate/export/kinde.d.ts +57 -0
  289. package/dist/migrate/export/kinde.js +333 -0
  290. package/dist/migrate/export/kinde.js.map +1 -0
  291. package/dist/migrate/export/ldap.d.ts +53 -0
  292. package/dist/migrate/export/ldap.js +277 -0
  293. package/dist/migrate/export/ldap.js.map +1 -0
  294. package/dist/migrate/export/logto-config.d.ts +27 -0
  295. package/dist/migrate/export/logto-config.js +264 -0
  296. package/dist/migrate/export/logto-config.js.map +1 -0
  297. package/dist/migrate/export/logto.d.ts +150 -0
  298. package/dist/migrate/export/logto.js +809 -0
  299. package/dist/migrate/export/logto.js.map +1 -0
  300. package/dist/migrate/export/magic-config.d.ts +14 -0
  301. package/dist/migrate/export/magic-config.js +28 -0
  302. package/dist/migrate/export/magic-config.js.map +1 -0
  303. package/dist/migrate/export/magic.d.ts +31 -0
  304. package/dist/migrate/export/magic.js +93 -0
  305. package/dist/migrate/export/magic.js.map +1 -0
  306. package/dist/migrate/export/mini-yaml.d.ts +19 -0
  307. package/dist/migrate/export/mini-yaml.js +581 -0
  308. package/dist/migrate/export/mini-yaml.js.map +1 -0
  309. package/dist/migrate/export/nhost-config.d.ts +26 -0
  310. package/dist/migrate/export/nhost-config.js +360 -0
  311. package/dist/migrate/export/nhost-config.js.map +1 -0
  312. package/dist/migrate/export/nhost.d.ts +64 -0
  313. package/dist/migrate/export/nhost.js +304 -0
  314. package/dist/migrate/export/nhost.js.map +1 -0
  315. package/dist/migrate/export/okta-config.d.ts +30 -0
  316. package/dist/migrate/export/okta-config.js +205 -0
  317. package/dist/migrate/export/okta-config.js.map +1 -0
  318. package/dist/migrate/export/okta.d.ts +43 -0
  319. package/dist/migrate/export/okta.js +337 -0
  320. package/dist/migrate/export/okta.js.map +1 -0
  321. package/dist/migrate/export/onelogin.d.ts +22 -0
  322. package/dist/migrate/export/onelogin.js +123 -0
  323. package/dist/migrate/export/onelogin.js.map +1 -0
  324. package/dist/migrate/export/ory-config.d.ts +58 -0
  325. package/dist/migrate/export/ory-config.js +451 -0
  326. package/dist/migrate/export/ory-config.js.map +1 -0
  327. package/dist/migrate/export/ory.d.ts +81 -0
  328. package/dist/migrate/export/ory.js +555 -0
  329. package/dist/migrate/export/ory.js.map +1 -0
  330. package/dist/migrate/export/password-detect.d.ts +29 -0
  331. package/dist/migrate/export/password-detect.js +81 -0
  332. package/dist/migrate/export/password-detect.js.map +1 -0
  333. package/dist/migrate/export/pingone.d.ts +36 -0
  334. package/dist/migrate/export/pingone.js +218 -0
  335. package/dist/migrate/export/pingone.js.map +1 -0
  336. package/dist/migrate/export/plugin-kit.d.ts +25 -0
  337. package/dist/migrate/export/plugin-kit.js +82 -0
  338. package/dist/migrate/export/plugin-kit.js.map +1 -0
  339. package/dist/migrate/export/pocketbase-config.d.ts +28 -0
  340. package/dist/migrate/export/pocketbase-config.js +180 -0
  341. package/dist/migrate/export/pocketbase-config.js.map +1 -0
  342. package/dist/migrate/export/pocketbase.d.ts +52 -0
  343. package/dist/migrate/export/pocketbase.js +243 -0
  344. package/dist/migrate/export/pocketbase.js.map +1 -0
  345. package/dist/migrate/export/project-files.d.ts +15 -0
  346. package/dist/migrate/export/project-files.js +43 -0
  347. package/dist/migrate/export/project-files.js.map +1 -0
  348. package/dist/migrate/export/propelauth-config.d.ts +18 -0
  349. package/dist/migrate/export/propelauth-config.js +58 -0
  350. package/dist/migrate/export/propelauth-config.js.map +1 -0
  351. package/dist/migrate/export/propelauth-harness.test-helper.d.ts +62 -0
  352. package/dist/migrate/export/propelauth-harness.test-helper.js +109 -0
  353. package/dist/migrate/export/propelauth-harness.test-helper.js.map +1 -0
  354. package/dist/migrate/export/propelauth.d.ts +48 -0
  355. package/dist/migrate/export/propelauth.js +255 -0
  356. package/dist/migrate/export/propelauth.js.map +1 -0
  357. package/dist/migrate/export/record-set.d.ts +44 -0
  358. package/dist/migrate/export/record-set.js +98 -0
  359. package/dist/migrate/export/record-set.js.map +1 -0
  360. package/dist/migrate/export/source-lines.d.ts +17 -0
  361. package/dist/migrate/export/source-lines.js +43 -0
  362. package/dist/migrate/export/source-lines.js.map +1 -0
  363. package/dist/migrate/export/sso-metadata.d.ts +47 -0
  364. package/dist/migrate/export/sso-metadata.js +180 -0
  365. package/dist/migrate/export/sso-metadata.js.map +1 -0
  366. package/dist/migrate/export/stytch-config.d.ts +22 -0
  367. package/dist/migrate/export/stytch-config.js +102 -0
  368. package/dist/migrate/export/stytch-config.js.map +1 -0
  369. package/dist/migrate/export/stytch.d.ts +68 -0
  370. package/dist/migrate/export/stytch.js +510 -0
  371. package/dist/migrate/export/stytch.js.map +1 -0
  372. package/dist/migrate/export/supabase-config.d.ts +48 -0
  373. package/dist/migrate/export/supabase-config.js +408 -0
  374. package/dist/migrate/export/supabase-config.js.map +1 -0
  375. package/dist/migrate/export/supabase.d.ts +86 -0
  376. package/dist/migrate/export/supabase.js +524 -0
  377. package/dist/migrate/export/supabase.js.map +1 -0
  378. package/dist/migrate/export/supertokens-config.d.ts +20 -0
  379. package/dist/migrate/export/supertokens-config.js +150 -0
  380. package/dist/migrate/export/supertokens-config.js.map +1 -0
  381. package/dist/migrate/export/supertokens.d.ts +125 -0
  382. package/dist/migrate/export/supertokens.js +464 -0
  383. package/dist/migrate/export/supertokens.js.map +1 -0
  384. package/dist/migrate/export/table.d.ts +35 -0
  385. package/dist/migrate/export/table.js +248 -0
  386. package/dist/migrate/export/table.js.map +1 -0
  387. package/dist/migrate/export/translate-kit.d.ts +46 -0
  388. package/dist/migrate/export/translate-kit.js +148 -0
  389. package/dist/migrate/export/translate-kit.js.map +1 -0
  390. package/dist/migrate/export/userfront-config.d.ts +15 -0
  391. package/dist/migrate/export/userfront-config.js +49 -0
  392. package/dist/migrate/export/userfront-config.js.map +1 -0
  393. package/dist/migrate/export/userfront.d.ts +38 -0
  394. package/dist/migrate/export/userfront.js +189 -0
  395. package/dist/migrate/export/userfront.js.map +1 -0
  396. package/dist/migrate/export/vendor-http.d.ts +46 -0
  397. package/dist/migrate/export/vendor-http.js +138 -0
  398. package/dist/migrate/export/vendor-http.js.map +1 -0
  399. package/dist/migrate/export/workos-config.d.ts +23 -0
  400. package/dist/migrate/export/workos-config.js +125 -0
  401. package/dist/migrate/export/workos-config.js.map +1 -0
  402. package/dist/migrate/export/workos.d.ts +46 -0
  403. package/dist/migrate/export/workos.js +272 -0
  404. package/dist/migrate/export/workos.js.map +1 -0
  405. package/dist/migrate/export/zip.d.ts +8 -0
  406. package/dist/migrate/export/zip.js +66 -0
  407. package/dist/migrate/export/zip.js.map +1 -0
  408. package/dist/migrate/export/zitadel-config.d.ts +37 -0
  409. package/dist/migrate/export/zitadel-config.js +279 -0
  410. package/dist/migrate/export/zitadel-config.js.map +1 -0
  411. package/dist/migrate/export/zitadel.d.ts +82 -0
  412. package/dist/migrate/export/zitadel.js +447 -0
  413. package/dist/migrate/export/zitadel.js.map +1 -0
  414. package/dist/migrate/firebase/plugin.d.ts +2 -0
  415. package/dist/migrate/firebase/plugin.js +152 -0
  416. package/dist/migrate/firebase/plugin.js.map +1 -0
  417. package/dist/migrate/framework/builtins.d.ts +2 -0
  418. package/dist/migrate/framework/builtins.js +52 -0
  419. package/dist/migrate/framework/builtins.js.map +1 -0
  420. package/dist/migrate/framework/commands.d.ts +20 -0
  421. package/dist/migrate/framework/commands.js +58 -0
  422. package/dist/migrate/framework/commands.js.map +1 -0
  423. package/dist/migrate/framework/custom.d.ts +12 -0
  424. package/dist/migrate/framework/custom.js +96 -0
  425. package/dist/migrate/framework/custom.js.map +1 -0
  426. package/dist/migrate/framework/orchestrator.d.ts +113 -0
  427. package/dist/migrate/framework/orchestrator.js +532 -0
  428. package/dist/migrate/framework/orchestrator.js.map +1 -0
  429. package/dist/migrate/framework/plugin.d.ts +167 -0
  430. package/dist/migrate/framework/plugin.js +3 -0
  431. package/dist/migrate/framework/plugin.js.map +1 -0
  432. package/dist/migrate/framework/registry.d.ts +11 -0
  433. package/dist/migrate/framework/registry.js +44 -0
  434. package/dist/migrate/framework/registry.js.map +1 -0
  435. package/dist/migrate/framework/report.d.ts +17 -0
  436. package/dist/migrate/framework/report.js +103 -0
  437. package/dist/migrate/framework/report.js.map +1 -0
  438. package/dist/migrate/frameworks/plugins.d.ts +29 -0
  439. package/dist/migrate/frameworks/plugins.js +402 -0
  440. package/dist/migrate/frameworks/plugins.js.map +1 -0
  441. package/dist/migrate/frameworks/report.d.ts +92 -0
  442. package/dist/migrate/frameworks/report.js +207 -0
  443. package/dist/migrate/frameworks/report.js.map +1 -0
  444. package/dist/migrate/frameworks/translate-js.d.ts +5 -0
  445. package/dist/migrate/frameworks/translate-js.js +503 -0
  446. package/dist/migrate/frameworks/translate-js.js.map +1 -0
  447. package/dist/migrate/frameworks/translate-rails-django.d.ts +3 -0
  448. package/dist/migrate/frameworks/translate-rails-django.js +1391 -0
  449. package/dist/migrate/frameworks/translate-rails-django.js.map +1 -0
  450. package/dist/migrate/frontegg/plugin.d.ts +2 -0
  451. package/dist/migrate/frontegg/plugin.js +78 -0
  452. package/dist/migrate/frontegg/plugin.js.map +1 -0
  453. package/dist/migrate/fusionauth/plugin.d.ts +2 -0
  454. package/dist/migrate/fusionauth/plugin.js +109 -0
  455. package/dist/migrate/fusionauth/plugin.js.map +1 -0
  456. package/dist/migrate/hanko/plugin.d.ts +2 -0
  457. package/dist/migrate/hanko/plugin.js +100 -0
  458. package/dist/migrate/hanko/plugin.js.map +1 -0
  459. package/dist/migrate/keycloak/plugin.d.ts +2 -0
  460. package/dist/migrate/keycloak/plugin.js +148 -0
  461. package/dist/migrate/keycloak/plugin.js.map +1 -0
  462. package/dist/migrate/kinde/plugin.d.ts +2 -0
  463. package/dist/migrate/kinde/plugin.js +105 -0
  464. package/dist/migrate/kinde/plugin.js.map +1 -0
  465. package/dist/migrate/ldap/plugin.d.ts +2 -0
  466. package/dist/migrate/ldap/plugin.js +73 -0
  467. package/dist/migrate/ldap/plugin.js.map +1 -0
  468. package/dist/migrate/logto/plugin.d.ts +2 -0
  469. package/dist/migrate/logto/plugin.js +131 -0
  470. package/dist/migrate/logto/plugin.js.map +1 -0
  471. package/dist/migrate/magic/plugin.d.ts +2 -0
  472. package/dist/migrate/magic/plugin.js +56 -0
  473. package/dist/migrate/magic/plugin.js.map +1 -0
  474. package/dist/migrate/nhost/plugin.d.ts +2 -0
  475. package/dist/migrate/nhost/plugin.js +115 -0
  476. package/dist/migrate/nhost/plugin.js.map +1 -0
  477. package/dist/migrate/oidc/plugin.d.ts +2 -0
  478. package/dist/migrate/oidc/plugin.js +73 -0
  479. package/dist/migrate/oidc/plugin.js.map +1 -0
  480. package/dist/migrate/okta/plugin.d.ts +2 -0
  481. package/dist/migrate/okta/plugin.js +105 -0
  482. package/dist/migrate/okta/plugin.js.map +1 -0
  483. package/dist/migrate/onelogin/plugin.d.ts +2 -0
  484. package/dist/migrate/onelogin/plugin.js +61 -0
  485. package/dist/migrate/onelogin/plugin.js.map +1 -0
  486. package/dist/migrate/ory/plugin.d.ts +2 -0
  487. package/dist/migrate/ory/plugin.js +186 -0
  488. package/dist/migrate/ory/plugin.js.map +1 -0
  489. package/dist/migrate/ping-identity/plugin.d.ts +2 -0
  490. package/dist/migrate/ping-identity/plugin.js +100 -0
  491. package/dist/migrate/ping-identity/plugin.js.map +1 -0
  492. package/dist/migrate/pocketbase/plugin.d.ts +2 -0
  493. package/dist/migrate/pocketbase/plugin.js +99 -0
  494. package/dist/migrate/pocketbase/plugin.js.map +1 -0
  495. package/dist/migrate/propelauth/plugin.d.ts +2 -0
  496. package/dist/migrate/propelauth/plugin.js +65 -0
  497. package/dist/migrate/propelauth/plugin.js.map +1 -0
  498. package/dist/migrate/saml/plugin.d.ts +2 -0
  499. package/dist/migrate/saml/plugin.js +79 -0
  500. package/dist/migrate/saml/plugin.js.map +1 -0
  501. package/dist/migrate/stytch/plugin.d.ts +2 -0
  502. package/dist/migrate/stytch/plugin.js +97 -0
  503. package/dist/migrate/stytch/plugin.js.map +1 -0
  504. package/dist/migrate/supabase/plugin.d.ts +2 -0
  505. package/dist/migrate/supabase/plugin.js +149 -0
  506. package/dist/migrate/supabase/plugin.js.map +1 -0
  507. package/dist/migrate/supertokens/plugin.d.ts +2 -0
  508. package/dist/migrate/supertokens/plugin.js +114 -0
  509. package/dist/migrate/supertokens/plugin.js.map +1 -0
  510. package/dist/migrate/user-table/plugin.d.ts +2 -0
  511. package/dist/migrate/user-table/plugin.js +62 -0
  512. package/dist/migrate/user-table/plugin.js.map +1 -0
  513. package/dist/migrate/userfront/plugin.d.ts +2 -0
  514. package/dist/migrate/userfront/plugin.js +60 -0
  515. package/dist/migrate/userfront/plugin.js.map +1 -0
  516. package/dist/migrate/workos/plugin.d.ts +2 -0
  517. package/dist/migrate/workos/plugin.js +81 -0
  518. package/dist/migrate/workos/plugin.js.map +1 -0
  519. package/dist/migrate/zitadel/plugin.d.ts +2 -0
  520. package/dist/migrate/zitadel/plugin.js +114 -0
  521. package/dist/migrate/zitadel/plugin.js.map +1 -0
  522. package/dist/output.d.ts +41 -0
  523. package/dist/output.js +72 -0
  524. package/dist/output.js.map +1 -0
  525. package/dist/project.d.ts +64 -0
  526. package/dist/project.js +86 -0
  527. package/dist/project.js.map +1 -0
  528. package/dist/prompt.d.ts +15 -0
  529. package/dist/prompt.js +46 -0
  530. package/dist/prompt.js.map +1 -0
  531. package/dist/redact.d.ts +41 -0
  532. package/dist/redact.js +115 -0
  533. package/dist/redact.js.map +1 -0
  534. package/dist/run.d.ts +12 -0
  535. package/dist/run.js +169 -0
  536. package/dist/run.js.map +1 -0
  537. package/dist/secrets.d.ts +41 -0
  538. package/dist/secrets.js +142 -0
  539. package/dist/secrets.js.map +1 -0
  540. package/dist/serialize.d.ts +30 -0
  541. package/dist/serialize.js +131 -0
  542. package/dist/serialize.js.map +1 -0
  543. package/dist/version.d.ts +7 -0
  544. package/dist/version.js +21 -0
  545. package/dist/version.js.map +1 -0
  546. package/package.json +3 -3
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bag = exports.strs = exports.objs = exports.str = exports.isObj = exports.RecordSet = void 0;
4
+ exports.e164 = e164;
5
+ exports.compact = compact;
6
+ const migrate_1 = require("@atlasauth/migrate");
7
+ /**
8
+ * What a vendor exporter gathered, grouped by canonical model. A vendor API
9
+ * hands data back in ITS order (users carry their identities, organizations
10
+ * their members); the bundle needs canonical order, so exporters collect here
11
+ * and the writer replays {@link RecordSet.ordered}.
12
+ */
13
+ class RecordSet {
14
+ rows = new Map();
15
+ seen = new Map();
16
+ warnings = [];
17
+ omitted = {};
18
+ /** Manifest fields the exporter learned (origin, providers, settings, rpId). */
19
+ manifest = {};
20
+ /**
21
+ * Add a row. With `key`, a second row with the same key is dropped (a member
22
+ * reached through two listings, a role seen on two organizations).
23
+ */
24
+ add(model, data, key) {
25
+ if (key !== undefined) {
26
+ const keys = this.seen.get(model) ?? new Set();
27
+ if (keys.has(key))
28
+ return;
29
+ keys.add(key);
30
+ this.seen.set(model, keys);
31
+ }
32
+ const list = this.rows.get(model) ?? [];
33
+ list.push(data);
34
+ this.rows.set(model, list);
35
+ }
36
+ warn(message) {
37
+ if (!this.warnings.includes(message))
38
+ this.warnings.push(message);
39
+ }
40
+ omit(model, reason, count = 1) {
41
+ const o = this.omitted[model] ?? { count: 0, reason };
42
+ o.count += count;
43
+ this.omitted[model] = o;
44
+ }
45
+ count(model) {
46
+ return this.rows.get(model)?.length ?? 0;
47
+ }
48
+ list(model) {
49
+ return (this.rows.get(model) ?? []);
50
+ }
51
+ /** Every row, in the order the bundle writer requires. */
52
+ *ordered() {
53
+ for (const model of migrate_1.CANONICAL_MODEL_ORDER) {
54
+ for (const data of this.rows.get(model) ?? [])
55
+ yield { model, data };
56
+ }
57
+ }
58
+ counts() {
59
+ const out = {};
60
+ for (const model of migrate_1.CANONICAL_MODEL_ORDER) {
61
+ const n = this.rows.get(model)?.length ?? 0;
62
+ if (n)
63
+ out[model] = n;
64
+ }
65
+ return out;
66
+ }
67
+ }
68
+ exports.RecordSet = RecordSet;
69
+ const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
70
+ exports.isObj = isObj;
71
+ const str = (v) => typeof v === 'string' && v.trim() ? v.trim() : typeof v === 'number' && Number.isFinite(v) ? String(v) : undefined;
72
+ exports.str = str;
73
+ const objs = (v) => (Array.isArray(v) ? v.filter(exports.isObj) : []);
74
+ exports.objs = objs;
75
+ const strs = (v) => Array.isArray(v) ? v.map((x) => (0, exports.str)(x)).filter((x) => x !== undefined) : [];
76
+ exports.strs = strs;
77
+ /** A metadata bag, only when it has keys. */
78
+ const bag = (v) => ((0, exports.isObj)(v) && Object.keys(v).length > 0 ? v : undefined);
79
+ exports.bag = bag;
80
+ /** E.164 or nothing: vendors store numbers with spaces/dashes; anything else is dropped. */
81
+ function e164(raw) {
82
+ const s = (0, exports.str)(raw);
83
+ if (!s)
84
+ return undefined;
85
+ const digits = s.replace(/[\s().-]/g, '');
86
+ const withPlus = digits.startsWith('+') ? digits : digits.startsWith('00') ? `+${digits.slice(2)}` : `+${digits}`;
87
+ return /^\+[1-9]\d{6,14}$/.test(withPlus) ? withPlus : undefined;
88
+ }
89
+ /** Drop undefined fields so a record carries only what the vendor had. */
90
+ function compact(o) {
91
+ for (const k of Object.keys(o)) {
92
+ const v = o[k];
93
+ if (v === undefined || (Array.isArray(v) && v.length === 0))
94
+ delete o[k];
95
+ }
96
+ return o;
97
+ }
98
+ //# sourceMappingURL=record-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-set.js","sourceRoot":"","sources":["../../../src/migrate/export/record-set.ts"],"names":[],"mappings":";;;AAoFA,oBAMC;AAED,0BAMC;AAlGD,gDAK4B;AAE5B;;;;;GAKG;AACH,MAAa,SAAS;IACH,IAAI,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC5C,IAAI,GAAG,IAAI,GAAG,EAA+B,CAAC;IACtD,QAAQ,GAAa,EAAE,CAAC;IACxB,OAAO,GAAsD,EAAE,CAAC;IACzE,gFAAgF;IAChF,QAAQ,GAAqG,EAAE,CAAC;IAEhH;;;OAGG;IACH,GAAG,CAA2B,KAAQ,EAAE,IAA4B,EAAE,GAAY;QAChF,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;YACvD,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO;YAC1B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,MAAc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Y;IAC/B,MAAM,CAAC,GAAG,IAAA,WAAG,EAAC,GAAG,CAAC,CAAC;IACnB,IAAI,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACzB,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;IAClH,OAAO,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC;AACD,0EAA0E;AAC1E,SAAgB,OAAO,CAAmB,CAAI;IAC5C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAmB,EAAE,CAAC;QACjD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ReportStatus } from '../framework/plugin';
2
+ import type { ConfigBuilder } from './translate-kit';
3
+ /**
4
+ * Report lines that point at a config FILE the owner keeps (appwrite.json,
5
+ * nhost.toml, pb_schema.json): the 1-based line a setting sits on, so the
6
+ * report reads `nhost/nhost.toml:42` instead of a bare setting path.
7
+ */
8
+ /**
9
+ * The line of a JSON key path (`["settings", "auth", "security", "duration"]`)
10
+ * in a JSON text, found by walking the quoted keys in order. Undefined when a
11
+ * key is missing (the report then names only the setting path).
12
+ */
13
+ export declare function jsonKeyLine(text: string, path: string[]): number | undefined;
14
+ /** The 1-based line of a character offset. */
15
+ export declare function lineAt(text: string, offset: number): number;
16
+ /** Add a report line with a file location (when the line is known). */
17
+ export declare function addAt(b: ConfigBuilder, file: string | undefined, line: number | undefined, status: ReportStatus, area: string, setting: string, note: string, atlas?: string): void;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonKeyLine = jsonKeyLine;
4
+ exports.lineAt = lineAt;
5
+ exports.addAt = addAt;
6
+ /**
7
+ * Report lines that point at a config FILE the owner keeps (appwrite.json,
8
+ * nhost.toml, pb_schema.json): the 1-based line a setting sits on, so the
9
+ * report reads `nhost/nhost.toml:42` instead of a bare setting path.
10
+ */
11
+ /**
12
+ * The line of a JSON key path (`["settings", "auth", "security", "duration"]`)
13
+ * in a JSON text, found by walking the quoted keys in order. Undefined when a
14
+ * key is missing (the report then names only the setting path).
15
+ */
16
+ function jsonKeyLine(text, path) {
17
+ let at = 0;
18
+ for (const key of path) {
19
+ const i = text.indexOf(`"${key}"`, at);
20
+ if (i < 0)
21
+ return undefined;
22
+ at = i + key.length + 2;
23
+ }
24
+ return lineAt(text, at);
25
+ }
26
+ /** The 1-based line of a character offset. */
27
+ function lineAt(text, offset) {
28
+ let line = 1;
29
+ for (let i = 0; i < offset && i < text.length; i++)
30
+ if (text.charCodeAt(i) === 10)
31
+ line++;
32
+ return line;
33
+ }
34
+ /** Add a report line with a file location (when the line is known). */
35
+ function addAt(b, file, line, status, area, setting, note, atlas) {
36
+ b.add(status, area, setting, note, atlas);
37
+ if (file && line) {
38
+ const entry = b.report[b.report.length - 1];
39
+ entry.file = file;
40
+ entry.line = line;
41
+ }
42
+ }
43
+ //# sourceMappingURL=source-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-lines.js","sourceRoot":"","sources":["../../../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,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { SsoConnectionRecord } from '@atlasauth/migrate';
2
+ import { RecordSet, type Obj } from './record-set';
3
+ export interface SamlIdp {
4
+ entityId: string;
5
+ ssoUrl?: string;
6
+ ssoBinding?: string;
7
+ certificates: string[];
8
+ nameIdFormat?: string;
9
+ wantAuthnRequestsSigned?: boolean;
10
+ }
11
+ /** Every identity provider in a metadata document. Throws on a document with none. */
12
+ export declare function parseSamlMetadata(xml: string): SamlIdp[];
13
+ export interface SsoConnectionOptions {
14
+ name?: string;
15
+ domains?: string[];
16
+ organizationId?: string;
17
+ metadataUrl?: string;
18
+ id?: string;
19
+ }
20
+ export declare function samlConnections(xml: string, o?: SsoConnectionOptions): {
21
+ connections: SsoConnectionRecord[];
22
+ warnings: string[];
23
+ };
24
+ export interface OidcDiscovery {
25
+ issuer: string;
26
+ authorization_endpoint?: string;
27
+ token_endpoint?: string;
28
+ userinfo_endpoint?: string;
29
+ jwks_uri?: string;
30
+ scopes_supported: string[];
31
+ grant_types_supported: string[];
32
+ id_token_signing_alg_values_supported: string[];
33
+ }
34
+ /** The discovery URL for an issuer or a discovery URL. */
35
+ export declare function discoveryUrl(input: string): string;
36
+ export declare function parseDiscovery(doc: unknown, requested: string): OidcDiscovery;
37
+ export declare function fetchDiscovery(fetchImpl: typeof fetch, input: string): Promise<OidcDiscovery>;
38
+ export declare function oidcConnection(d: OidcDiscovery, o?: SsoConnectionOptions & {
39
+ clientId?: string;
40
+ clientSecret?: string;
41
+ }): SsoConnectionRecord;
42
+ /** The records an SSO-only route writes: the connection, and an organization when it belongs to one. */
43
+ export declare function connectionSet(connections: SsoConnectionRecord[], origin: string, organization?: {
44
+ id: string;
45
+ name: string;
46
+ }): RecordSet;
47
+ export type { Obj };
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseSamlMetadata = parseSamlMetadata;
4
+ exports.samlConnections = samlConnections;
5
+ exports.discoveryUrl = discoveryUrl;
6
+ exports.parseDiscovery = parseDiscovery;
7
+ exports.fetchDiscovery = fetchDiscovery;
8
+ exports.oidcConnection = oidcConnection;
9
+ exports.connectionSet = connectionSet;
10
+ const record_set_1 = require("./record-set");
11
+ /**
12
+ * The SSO connections any identity provider hands over as standard documents:
13
+ * SAML 2.0 IdP metadata (an EntityDescriptor, or an EntitiesDescriptor
14
+ * federation) and an OpenID Connect discovery document. Used by the `saml` and
15
+ * `oidc` routes, and by every vendor whose enterprise connections are
16
+ * described by one of the two.
17
+ */
18
+ // ── SAML metadata ───────────────────────────────────────────────────────────
19
+ const attr = (tag, name) => {
20
+ const m = new RegExp(`\\b${name}\\s*=\\s*("([^"]*)"|'([^']*)')`).exec(tag);
21
+ const v = m ? (m[2] ?? m[3]) : undefined;
22
+ return v === undefined ? undefined : decodeXml(v);
23
+ };
24
+ function decodeXml(s) {
25
+ return s.replace(/&(lt|gt|amp|quot|apos|#x[0-9a-f]+|#\d+);/gi, (_, e) => {
26
+ const l = e.toLowerCase();
27
+ if (l === 'lt')
28
+ return '<';
29
+ if (l === 'gt')
30
+ return '>';
31
+ if (l === 'amp')
32
+ return '&';
33
+ if (l === 'quot')
34
+ return '"';
35
+ if (l === 'apos')
36
+ return "'";
37
+ return String.fromCodePoint(l.startsWith('#x') ? parseInt(l.slice(2), 16) : parseInt(l.slice(1), 10));
38
+ });
39
+ }
40
+ /** Elements by local name, ignoring any namespace prefix (`md:`, `ds:`, none). */
41
+ function elements(xml, local) {
42
+ const out = [];
43
+ const re = new RegExp(`<(?:[A-Za-z0-9_-]+:)?${local}\\b([^>]*?)(/>|>([\\s\\S]*?)</(?:[A-Za-z0-9_-]+:)?${local}\\s*>)`, 'g');
44
+ for (let m = re.exec(xml); m; m = re.exec(xml))
45
+ out.push({ tag: m[1], body: m[3] ?? '' });
46
+ return out;
47
+ }
48
+ /** Every identity provider in a metadata document. Throws on a document with none. */
49
+ function parseSamlMetadata(xml) {
50
+ if (/<!DOCTYPE|<!ENTITY/i.test(xml))
51
+ throw new Error('The metadata contains a DOCTYPE / ENTITY declaration, which is refused.');
52
+ const idps = [];
53
+ const scoped = elements(xml, 'EntityDescriptor');
54
+ // An EntityDescriptor nested in an EntitiesDescriptor is matched by the regex too; a lone one matches once.
55
+ for (const ed of scoped) {
56
+ const idp = elements(ed.body, 'IDPSSODescriptor')[0];
57
+ const entityId = attr(`${ed.tag}`, 'entityID');
58
+ if (!idp || !entityId)
59
+ continue;
60
+ const services = elements(idp.body, 'SingleSignOnService').map((s) => ({ binding: attr(s.tag, 'Binding') ?? '', location: attr(s.tag, 'Location') }));
61
+ const pick = services.find((s) => s.binding.endsWith('HTTP-Redirect') && s.location) ?? services.find((s) => s.binding.endsWith('HTTP-POST') && s.location) ?? services.find((s) => s.location);
62
+ const certs = [];
63
+ for (const k of elements(idp.body, 'KeyDescriptor')) {
64
+ if (attr(k.tag, 'use') === 'encryption')
65
+ continue;
66
+ for (const c of elements(k.body, 'X509Certificate')) {
67
+ const b64 = c.body.replace(/\s+/g, '');
68
+ if (/^[A-Za-z0-9+/=]+$/.test(b64) && !certs.includes(b64))
69
+ certs.push(b64);
70
+ }
71
+ }
72
+ idps.push((0, record_set_1.compact)({
73
+ entityId,
74
+ ssoUrl: pick?.location,
75
+ ssoBinding: pick?.binding,
76
+ certificates: certs,
77
+ nameIdFormat: elements(idp.body, 'NameIDFormat')[0]?.body.trim() || undefined,
78
+ wantAuthnRequestsSigned: attr(idp.tag, 'WantAuthnRequestsSigned') === 'true' ? true : undefined,
79
+ }));
80
+ }
81
+ if (!idps.length)
82
+ throw new Error('No identity provider (IDPSSODescriptor) found in the SAML metadata.');
83
+ return idps;
84
+ }
85
+ const pem = (b64) => `-----BEGIN CERTIFICATE-----\n${b64.match(/.{1,64}/g).join('\n')}\n-----END CERTIFICATE-----\n`;
86
+ function samlConnections(xml, o = {}) {
87
+ const idps = parseSamlMetadata(xml);
88
+ const warnings = [];
89
+ const connections = idps.map((idp, i) => {
90
+ // compact() drops an empty certificate list.
91
+ const certificates = idp.certificates ?? [];
92
+ if (!idp.ssoUrl)
93
+ warnings.push(`${idp.entityId}: no SingleSignOnService in the metadata.`);
94
+ if (!certificates.length)
95
+ warnings.push(`${idp.entityId}: no signing certificate in the metadata; Atlas cannot verify its assertions.`);
96
+ if (certificates.length > 1)
97
+ warnings.push(`${idp.entityId}: ${certificates.length} signing certificates; the first is imported, add the others in the dashboard when the IdP rolls its key.`);
98
+ return (0, record_set_1.compact)({
99
+ id: o.id ?? (idps.length > 1 ? `${slug(idp.entityId)}-${i + 1}` : slug(idp.entityId)),
100
+ name: o.name ?? hostName(idp.entityId),
101
+ organization_id: o.organizationId,
102
+ protocol: 'saml',
103
+ domains: o.domains,
104
+ enabled: true,
105
+ saml: (0, record_set_1.compact)({
106
+ idp_entity_id: idp.entityId,
107
+ idp_sso_url: idp.ssoUrl,
108
+ idp_certificate: certificates[0] ? pem(certificates[0]) : undefined,
109
+ idp_metadata_url: o.metadataUrl,
110
+ idp_metadata_xml: idps.length === 1 ? xml : undefined,
111
+ }),
112
+ });
113
+ });
114
+ return { connections, warnings };
115
+ }
116
+ const slug = (s) => s.replace(/^https?:\/\//, '').replace(/[^A-Za-z0-9]+/g, '-').replace(/^-+|-+$/g, '').toLowerCase().slice(0, 64) || 'saml';
117
+ const hostName = (entityId) => {
118
+ try {
119
+ return new URL(entityId).host;
120
+ }
121
+ catch {
122
+ return entityId.slice(0, 64);
123
+ }
124
+ };
125
+ /** The discovery URL for an issuer or a discovery URL. */
126
+ function discoveryUrl(input) {
127
+ const u = input.trim().replace(/\/+$/, '');
128
+ if (!/^https:\/\//i.test(u))
129
+ throw new Error('The OpenID Connect issuer must be an https:// URL.');
130
+ return u.endsWith('/.well-known/openid-configuration') ? u : `${u}/.well-known/openid-configuration`;
131
+ }
132
+ function parseDiscovery(doc, requested) {
133
+ if (!(0, record_set_1.isObj)(doc) || !(0, record_set_1.str)(doc.issuer))
134
+ throw new Error('The discovery document has no issuer.');
135
+ const issuer = (0, record_set_1.str)(doc.issuer);
136
+ const want = requested.replace(/\/\.well-known\/openid-configuration$/, '').replace(/\/+$/, '');
137
+ // RFC 8414 §3.3: the issuer in the document must equal the one it was fetched for.
138
+ if (issuer.replace(/\/+$/, '') !== want)
139
+ throw new Error(`The discovery document names issuer ${issuer}, not ${want}.`);
140
+ return {
141
+ issuer,
142
+ authorization_endpoint: (0, record_set_1.str)(doc.authorization_endpoint),
143
+ token_endpoint: (0, record_set_1.str)(doc.token_endpoint),
144
+ userinfo_endpoint: (0, record_set_1.str)(doc.userinfo_endpoint),
145
+ jwks_uri: (0, record_set_1.str)(doc.jwks_uri),
146
+ scopes_supported: (0, record_set_1.strs)(doc.scopes_supported),
147
+ grant_types_supported: (0, record_set_1.strs)(doc.grant_types_supported),
148
+ id_token_signing_alg_values_supported: (0, record_set_1.strs)(doc.id_token_signing_alg_values_supported),
149
+ };
150
+ }
151
+ async function fetchDiscovery(fetchImpl, input) {
152
+ const url = discoveryUrl(input);
153
+ const res = await fetchImpl(url, { headers: { accept: 'application/json' }, redirect: 'error' });
154
+ if (res.status !== 200)
155
+ throw new Error(`${url} answered ${res.status}.`);
156
+ return parseDiscovery(await res.json().catch(() => null), input.trim().replace(/\/\.well-known\/openid-configuration$/, ''));
157
+ }
158
+ function oidcConnection(d, o = {}) {
159
+ const scopes = ['openid', 'email', 'profile'].filter((s) => d.scopes_supported.length === 0 || d.scopes_supported.includes(s));
160
+ return (0, record_set_1.compact)({
161
+ id: o.id ?? slug(d.issuer),
162
+ name: o.name ?? hostName(d.issuer),
163
+ organization_id: o.organizationId,
164
+ protocol: 'oidc',
165
+ domains: o.domains,
166
+ enabled: true,
167
+ oidc: (0, record_set_1.compact)({ issuer: d.issuer, discovery_url: discoveryUrl(d.issuer), client_id: o.clientId, client_secret: o.clientSecret, scopes }),
168
+ });
169
+ }
170
+ /** The records an SSO-only route writes: the connection, and an organization when it belongs to one. */
171
+ function connectionSet(connections, origin, organization) {
172
+ const set = new record_set_1.RecordSet();
173
+ set.manifest = { origin };
174
+ if (organization)
175
+ set.add('organization', { id: organization.id, name: organization.name, slug: slug(organization.name) }, organization.id);
176
+ for (const c of connections)
177
+ set.add('sso_connection', organization ? { ...c, organization_id: organization.id } : c, c.id);
178
+ return set;
179
+ }
180
+ //# sourceMappingURL=sso-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sso-metadata.js","sourceRoot":"","sources":["../../../src/migrate/export/sso-metadata.ts"],"names":[],"mappings":";;AAiDA,8CA8BC;AAYD,0CA0BC;AAyBD,oCAIC;AAED,wCAgBC;AAED,wCAKC;AAED,wCAWC;AAGD,sCAMC;AAhMD,6CAA8E;AAE9E;;;;;;GAMG;AAEH,+EAA+E;AAE/E,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,IAAY,EAAsB,EAAE;IAC7D,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,MAAM,IAAI,gCAAgC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3E,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,OAAO,CAAC,4CAA4C,EAAE,CAAC,CAAC,EAAE,CAAS,EAAE,EAAE;QAC9E,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,IAAI;YAAE,OAAO,GAAG,CAAC;QAC3B,IAAI,CAAC,KAAK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a,CAAC,WAAkC,EAAE,MAAc,EAAE,YAA2C;IAC3H,MAAM,GAAG,GAAG,IAAI,sBAAS,EAAE,CAAC;IAC5B,GAAG,CAAC,QAAQ,GAAG,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,YAAY;QAAE,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;IAC5I,KAAK,MAAM,CAAC,IAAI,WAAW;QAAE,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,eAAe,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5H,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { TranslationResult } from '../framework/plugin';
2
+ import { type Obj } from './record-set';
3
+ import { type StytchProduct } from './stytch';
4
+ import { type VendorHttp } from './vendor-http';
5
+ /**
6
+ * `atlas migrate stytch config` — what Stytch's project API exposes: the RBAC
7
+ * policy (roles, resources and their actions) and, for B2B, the organizations
8
+ * with their SSO connections. Password strength, session duration, OAuth
9
+ * providers, MFA and branding are dashboard-only settings: the report lists
10
+ * each as manual, with where to find it. The bridge and lazy-migration presets
11
+ * are carried to the next step.
12
+ */
13
+ export interface StytchConfigSnapshot {
14
+ projectId: string;
15
+ product: StytchProduct;
16
+ roles: Obj[];
17
+ resources: Obj[];
18
+ organizations: number;
19
+ ssoConnections: number;
20
+ }
21
+ export declare function fetchStytchConfig(http: VendorHttp, projectId: string, product: StytchProduct): Promise<StytchConfigSnapshot>;
22
+ export declare function translateStytchConfig(snap: StytchConfigSnapshot): TranslationResult;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchStytchConfig = fetchStytchConfig;
4
+ exports.translateStytchConfig = translateStytchConfig;
5
+ const record_set_1 = require("./record-set");
6
+ const stytch_1 = require("./stytch");
7
+ const translate_kit_1 = require("./translate-kit");
8
+ const vendor_http_1 = require("./vendor-http");
9
+ async function optionalGet(http, path) {
10
+ try {
11
+ const body = (await http.get(path)).body;
12
+ return (0, record_set_1.isObj)(body) ? body : null;
13
+ }
14
+ catch (err) {
15
+ if (err instanceof vendor_http_1.VendorApiError && [400, 403, 404].includes(err.status))
16
+ return null;
17
+ throw err;
18
+ }
19
+ }
20
+ async function fetchStytchConfig(http, projectId, product) {
21
+ // The consumer policy endpoint is UNCONFIRMED; a project without it just reports no roles.
22
+ const res = await optionalGet(http, product === 'b2b' ? '/v1/b2b/rbac/policy' : '/v1/rbac/policy');
23
+ const policy = res && (0, record_set_1.isObj)(res.policy) ? res.policy : {};
24
+ let organizations = 0;
25
+ let ssoConnections = 0;
26
+ if (product === 'b2b') {
27
+ try {
28
+ const { body } = await http.post('/v1/b2b/organizations/search', { limit: 1000 });
29
+ const orgs = (0, record_set_1.objs)((0, record_set_1.isObj)(body) ? body.organizations : undefined);
30
+ organizations = orgs.length;
31
+ for (const o of orgs) {
32
+ const id = (0, record_set_1.str)(o.organization_id);
33
+ const sso = id ? await optionalGet(http, `/v1/b2b/sso/${encodeURIComponent(id)}`) : null;
34
+ if (sso)
35
+ ssoConnections += (0, record_set_1.objs)(sso.saml_connections).length + (0, record_set_1.objs)(sso.oidc_connections).length;
36
+ }
37
+ }
38
+ catch (err) {
39
+ if (!(err instanceof vendor_http_1.VendorApiError))
40
+ throw err;
41
+ }
42
+ }
43
+ return { projectId, product, roles: (0, record_set_1.objs)(policy.roles), resources: (0, record_set_1.objs)(policy.resources), organizations, ssoConnections };
44
+ }
45
+ function translateStytchConfig(snap) {
46
+ const b = new translate_kit_1.ConfigBuilder();
47
+ const permissions = new Set();
48
+ for (const r of snap.resources) {
49
+ const resource = (0, record_set_1.str)(r.resource_id);
50
+ if (resource)
51
+ for (const a of (0, record_set_1.strs)(r.actions))
52
+ permissions.add(`${resource}:${a}`);
53
+ }
54
+ let roles = 0;
55
+ for (const r of snap.roles) {
56
+ const id = (0, record_set_1.str)(r.role_id);
57
+ if (!id)
58
+ continue;
59
+ const key = (0, stytch_1.stytchRoleKey)(id);
60
+ const perms = (0, record_set_1.objs)(r.permissions).flatMap((p) => (0, record_set_1.strs)(p.actions).map((a) => `${(0, record_set_1.str)(p.resource_id) ?? '*'}:${a}`));
61
+ for (const p of perms)
62
+ if (!p.startsWith('*:'))
63
+ permissions.add(p);
64
+ // Built-in roles already exist in Atlas as admin and member.
65
+ if (key !== id)
66
+ continue;
67
+ roles++;
68
+ b.roles[id] = key;
69
+ b.push('roles', { key, name: key, description: (0, record_set_1.str)(r.description) ?? '', permissions: perms });
70
+ }
71
+ for (const key of permissions)
72
+ b.push('permissions', { key, name: key, description: '' });
73
+ if (permissions.size)
74
+ b.add('mapped', 'authorization', 'RBAC resources and actions', `${permissions.size} permission(s), keyed resource:action.`, 'permissions');
75
+ if (roles)
76
+ b.add('mapped', 'authorization', 'custom roles', `${roles} role(s); members keep the same role id as their Atlas role key. stytch_admin and stytch_member map to Atlas's admin and member.`, 'roles');
77
+ if (snap.roles.length === 0)
78
+ b.add('manual', 'authorization', 'RBAC policy', 'No RBAC policy was returned; default roles carry over as admin and member.');
79
+ if (snap.ssoConnections)
80
+ b.add('mapped', 'enterprise', `${snap.ssoConnections} SSO connection(s) in ${snap.organizations} organization(s)`, 'Move with the data export as Atlas SSO connections.', 'sso_connections');
81
+ if (snap.product === 'b2b')
82
+ b.add('manual', 'organizations', 'organization MFA policy, allowed auth methods, JIT provisioning', 'Per-organization settings are kept in the exported organization metadata; set the matching policy on each Atlas organization.');
83
+ for (const [setting, where] of [
84
+ ['password strength (zxcvbn / LUDS) and breach check', 'Dashboard → Authentication → Passwords; set Atlas password rules under auth_config.password'],
85
+ ['session duration and JWT lifetime', 'Dashboard → Sessions; set the Atlas session lifetime'],
86
+ ['OAuth providers (client ids and secrets)', 'Dashboard → OAuth; use the same OAuth apps in Atlas so imported accounts relink'],
87
+ ['redirect URLs and authorized domains', 'Dashboard → Redirect URLs, SDK configuration'],
88
+ ['multi-factor authentication (TOTP, SMS)', 'Dashboard → Authentication → MFA'],
89
+ ['email templates, SMS and branding', 'Dashboard → Email templates, Branding'],
90
+ ['custom claims and JWT templates', 'Dashboard → Sessions → JWT templates'],
91
+ ['webhooks', 'Dashboard → Webhooks (create Atlas webhook endpoints)'],
92
+ ]) {
93
+ b.add('manual', 'settings not in the API', setting, `Stytch does not expose this through the project API; copy it from ${where}.`);
94
+ }
95
+ const test = snap.projectId.startsWith('project-test-');
96
+ const vars = { project_id: snap.projectId, ...(test ? { api_host: 'test.stytch.com' } : {}), ...(snap.product === 'b2b' ? { jwks_path: 'b2b/sessions' } : {}) };
97
+ return b.result(`Stytch project ${snap.projectId}`, {
98
+ bridge: { preset: 'stytch', vars },
99
+ lazy: { preset: 'stytch', config: { project_id: snap.projectId, product: snap.product } },
100
+ });
101
+ }
102
+ //# sourceMappingURL=stytch-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stytch-config.js","sourceRoot":"","sources":["../../../src/migrate/export/stytch-config.ts"],"names":[],"mappings":";;AAkCA,8CAqBC;AAED,sDAgDC;AAvGD,6CAAgE;AAChE,qCAA6D;AAC7D,mDAAgD;AAChD,+CAAgE;AAmBhE,KAAK,UAAU,WAAW,CAAC,IAAgB,EAAE,IAAY;IACvD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAM,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9C,OAAO,IAAA,kBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACnC,CAAC;IAAC,OAA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,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACxL,OAAO,CAAC,CAAC,MAAM,CAAC,kBAAkB,IAAI,CAAC,SAAS,EAAE,EAAE;QAClD,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE;KAC1F,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { PasswordHash, UserRecord } from '@atlasauth/migrate';
2
+ import { RecordSet, type Obj } from './record-set';
3
+ import { VendorHttp } from './vendor-http';
4
+ /**
5
+ * `atlas migrate export stytch` — Stytch (consumer and B2B) onto the canonical
6
+ * bundle models, from the Stytch API with the project id and secret (on this
7
+ * machine only).
8
+ *
9
+ * consumer `POST /v1/users/search` (cursor paging, 1000 per page): emails
10
+ * and phone numbers with their verified flags, name, OAuth
11
+ * providers, metadata, roles, lock state.
12
+ * B2B `POST /v1/b2b/organizations/search`, then per organization
13
+ * `POST /v1/b2b/organizations/members/search`, `GET /v1/b2b/sso/{org}`
14
+ * and the RBAC policy (`GET /v1/b2b/rbac/policy`).
15
+ *
16
+ * Stytch members belong to ONE organization each (`member_id` is per
17
+ * organization). Atlas users are people, so members sharing an email become one
18
+ * user: the earliest member's id is the user id (the session JWT `sub` of that
19
+ * member maps to it) and the others' ids are kept in `private_metadata`.
20
+ *
21
+ * Password hashes never leave Stytch through the API: they come from the export
22
+ * Stytch support sends on request (support@stytch.com), given as `--stytch-hashes`
23
+ * (CSV, JSON or NDJSON). Until then the `stytch` lazy-migration preset checks
24
+ * passwords against Stytch on first sign-in. TOTP secrets, passkeys and crypto
25
+ * wallets are not exported.
26
+ */
27
+ export type StytchProduct = 'consumer' | 'b2b';
28
+ export interface StytchExportOptions {
29
+ projectId: string;
30
+ secret: string;
31
+ /** Detected from the project when omitted. */
32
+ product?: StytchProduct;
33
+ /** Override `https://api.stytch.com` (live) / `https://test.stytch.com` (test), e.g. a custom domain. */
34
+ baseUrl?: string;
35
+ /** The support-provided password export (CSV, JSON array or NDJSON text). */
36
+ hashesText?: string;
37
+ fetchImpl?: typeof fetch;
38
+ sleep?: (ms: number) => Promise<void>;
39
+ onProgress?: (message: string) => void;
40
+ }
41
+ /** The API host for a project id: live projects are on api.stytch.com, test projects on test.stytch.com. */
42
+ export declare function stytchBaseUrl(projectId: string): string;
43
+ /** HTTP Basic credentials for the project. */
44
+ export declare function stytchAuthorization(projectId: string, secret: string): string;
45
+ export declare function stytchHttp(o: Pick<StytchExportOptions, 'projectId' | 'secret' | 'baseUrl' | 'fetchImpl' | 'sleep'>): VendorHttp;
46
+ /** Is this a B2B project? Its organization search answers; a consumer project refuses the endpoint. */
47
+ export declare function detectStytchProduct(http: VendorHttp): Promise<StytchProduct>;
48
+ /** Stytch's cursor paging: `results_metadata.next_cursor` until it is null. */
49
+ export declare function stytchSearch(http: VendorHttp, path: string, body: Obj, key: string): Promise<Obj[]>;
50
+ export declare function exportStytch(opts: StytchExportOptions): Promise<RecordSet>;
51
+ /** One Stytch user object → a user record; null with nothing to sign in with. */
52
+ export declare function mapStytchUser(u: Obj): UserRecord | null;
53
+ export declare function stytchRoleKey(roleId: string): string;
54
+ /**
55
+ * Parse the password export Stytch support sends: a JSON array (or an object
56
+ * holding one under `users` / `members` / `results`), NDJSON, or CSV with a
57
+ * header row. Keys are lower-cased; a nested `scrypt_config` etc. is flattened.
58
+ */
59
+ export declare function parseStytchHashes(text: string): Obj[];
60
+ /**
61
+ * One row of the support export → the bundle's password hash. Field names
62
+ * follow Stytch's own password-migration API (`hash`, `hash_type`, and the
63
+ * `scrypt_config` / `pbkdf_2_config` / salt fields), which is the format the
64
+ * export mirrors (UNCONFIRMED: Stytch support documents it per request).
65
+ */
66
+ export declare function stytchPasswordHash(row: Obj): PasswordHash | {
67
+ reason: string;
68
+ };