@stackframe/stack-shared 2.8.8 → 2.8.11

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 (476) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/config/format.d.cts +39 -0
  3. package/dist/config/format.d.ts +14 -13
  4. package/dist/config/format.js +147 -206
  5. package/dist/config/format.js.map +1 -0
  6. package/dist/config/schema.d.cts +729 -0
  7. package/dist/config/schema.d.ts +59 -51
  8. package/dist/config/schema.js +232 -172
  9. package/dist/config/schema.js.map +1 -0
  10. package/dist/crud.d.cts +102 -0
  11. package/dist/crud.d.ts +15 -13
  12. package/dist/crud.js +83 -128
  13. package/dist/crud.js.map +1 -0
  14. package/dist/esm/config/format.js +135 -0
  15. package/dist/esm/config/format.js.map +1 -0
  16. package/dist/esm/config/schema.js +201 -0
  17. package/dist/esm/config/schema.js.map +1 -0
  18. package/dist/esm/crud.js +60 -0
  19. package/dist/esm/crud.js.map +1 -0
  20. package/dist/esm/global.d.js +1 -0
  21. package/dist/esm/global.d.js.map +1 -0
  22. package/dist/esm/helpers/password.js +17 -0
  23. package/dist/esm/helpers/password.js.map +1 -0
  24. package/dist/esm/helpers/production-mode.js +50 -0
  25. package/dist/esm/helpers/production-mode.js.map +1 -0
  26. package/dist/esm/hooks/use-async-callback.js +38 -0
  27. package/dist/esm/hooks/use-async-callback.js.map +1 -0
  28. package/dist/esm/hooks/use-async-external-store.js +23 -0
  29. package/dist/esm/hooks/use-async-external-store.js.map +1 -0
  30. package/dist/esm/hooks/use-hash.js +17 -0
  31. package/dist/esm/hooks/use-hash.js.map +1 -0
  32. package/dist/esm/hooks/use-strict-memo.js +61 -0
  33. package/dist/esm/hooks/use-strict-memo.js.map +1 -0
  34. package/dist/esm/index.js +22 -0
  35. package/dist/esm/index.js.map +1 -0
  36. package/dist/esm/interface/adminInterface.js +244 -0
  37. package/dist/esm/interface/adminInterface.js.map +1 -0
  38. package/dist/esm/interface/clientInterface.js +2041 -0
  39. package/dist/esm/interface/clientInterface.js.map +1 -0
  40. package/dist/esm/interface/crud/contact-channels.js +77 -0
  41. package/dist/esm/interface/crud/contact-channels.js.map +1 -0
  42. package/dist/esm/interface/crud/current-user.js +65 -0
  43. package/dist/esm/interface/crud/current-user.js.map +1 -0
  44. package/dist/esm/interface/crud/email-templates.js +52 -0
  45. package/dist/esm/interface/crud/email-templates.js.map +1 -0
  46. package/dist/esm/interface/crud/emails.js +20 -0
  47. package/dist/esm/interface/crud/emails.js.map +1 -0
  48. package/dist/esm/interface/crud/internal-api-keys.js +69 -0
  49. package/dist/esm/interface/crud/internal-api-keys.js.map +1 -0
  50. package/dist/esm/interface/crud/oauth.js +24 -0
  51. package/dist/esm/interface/crud/oauth.js.map +1 -0
  52. package/dist/esm/interface/crud/project-api-keys.js +93 -0
  53. package/dist/esm/interface/crud/project-api-keys.js.map +1 -0
  54. package/dist/esm/interface/crud/project-permissions.js +113 -0
  55. package/dist/esm/interface/crud/project-permissions.js.map +1 -0
  56. package/dist/esm/interface/crud/projects.js +180 -0
  57. package/dist/esm/interface/crud/projects.js.map +1 -0
  58. package/dist/esm/interface/crud/sessions.js +62 -0
  59. package/dist/esm/interface/crud/sessions.js.map +1 -0
  60. package/dist/esm/interface/crud/svix-token.js +22 -0
  61. package/dist/esm/interface/crud/svix-token.js.map +1 -0
  62. package/dist/esm/interface/crud/team-invitation-details.js +23 -0
  63. package/dist/esm/interface/crud/team-invitation-details.js.map +1 -0
  64. package/dist/esm/interface/crud/team-invitation.js +36 -0
  65. package/dist/esm/interface/crud/team-invitation.js.map +1 -0
  66. package/dist/esm/interface/crud/team-member-profiles.js +62 -0
  67. package/dist/esm/interface/crud/team-member-profiles.js.map +1 -0
  68. package/dist/esm/interface/crud/team-memberships.js +60 -0
  69. package/dist/esm/interface/crud/team-memberships.js.map +1 -0
  70. package/dist/esm/interface/crud/team-permissions.js +114 -0
  71. package/dist/esm/interface/crud/team-permissions.js.map +1 -0
  72. package/dist/esm/interface/crud/teams.js +143 -0
  73. package/dist/esm/interface/crud/teams.js.map +1 -0
  74. package/dist/esm/interface/crud/users.js +139 -0
  75. package/dist/esm/interface/crud/users.js.map +1 -0
  76. package/dist/esm/interface/serverInterface.js +485 -0
  77. package/dist/esm/interface/serverInterface.js.map +1 -0
  78. package/dist/esm/interface/webhooks.js +21 -0
  79. package/dist/esm/interface/webhooks.js.map +1 -0
  80. package/dist/esm/known-errors.js +1238 -0
  81. package/dist/esm/known-errors.js.map +1 -0
  82. package/dist/esm/schema-fields.js +484 -0
  83. package/dist/esm/schema-fields.js.map +1 -0
  84. package/dist/esm/sessions.js +168 -0
  85. package/dist/esm/sessions.js.map +1 -0
  86. package/dist/esm/utils/api-keys.js +79 -0
  87. package/dist/esm/utils/api-keys.js.map +1 -0
  88. package/dist/esm/utils/arrays.js +78 -0
  89. package/dist/esm/utils/arrays.js.map +1 -0
  90. package/dist/esm/utils/base64.js +18 -0
  91. package/dist/esm/utils/base64.js.map +1 -0
  92. package/dist/esm/utils/booleans.js +12 -0
  93. package/dist/esm/utils/booleans.js.map +1 -0
  94. package/dist/esm/utils/browser-compat.js +21 -0
  95. package/dist/esm/utils/browser-compat.js.map +1 -0
  96. package/dist/esm/utils/bytes.js +160 -0
  97. package/dist/esm/utils/bytes.js.map +1 -0
  98. package/dist/esm/utils/caches.js +167 -0
  99. package/dist/esm/utils/caches.js.map +1 -0
  100. package/dist/esm/utils/compile-time.js +11 -0
  101. package/dist/esm/utils/compile-time.js.map +1 -0
  102. package/dist/esm/utils/crypto.js +25 -0
  103. package/dist/esm/utils/crypto.js.map +1 -0
  104. package/dist/esm/utils/dates.js +64 -0
  105. package/dist/esm/utils/dates.js.map +1 -0
  106. package/dist/esm/utils/dom.js +11 -0
  107. package/dist/esm/utils/dom.js.map +1 -0
  108. package/dist/esm/utils/env.js +58 -0
  109. package/dist/esm/utils/env.js.map +1 -0
  110. package/dist/esm/utils/errors.js +174 -0
  111. package/dist/esm/utils/errors.js.map +1 -0
  112. package/dist/esm/utils/fs.js +37 -0
  113. package/dist/esm/utils/fs.js.map +1 -0
  114. package/dist/esm/utils/functions.js +12 -0
  115. package/dist/esm/utils/functions.js.map +1 -0
  116. package/dist/esm/utils/geo.js +15 -0
  117. package/dist/esm/utils/geo.js.map +1 -0
  118. package/dist/esm/utils/globals.js +18 -0
  119. package/dist/esm/utils/globals.js.map +1 -0
  120. package/dist/esm/utils/hashes.js +55 -0
  121. package/dist/esm/utils/hashes.js.map +1 -0
  122. package/dist/esm/utils/html.js +13 -0
  123. package/dist/esm/utils/html.js.map +1 -0
  124. package/dist/esm/utils/http.js +60 -0
  125. package/dist/esm/utils/http.js.map +1 -0
  126. package/dist/esm/utils/ips.js +15 -0
  127. package/dist/esm/utils/ips.js.map +1 -0
  128. package/dist/esm/utils/json.js +31 -0
  129. package/dist/esm/utils/json.js.map +1 -0
  130. package/dist/esm/utils/jwt.js +87 -0
  131. package/dist/esm/utils/jwt.js.map +1 -0
  132. package/dist/esm/utils/locks.js +57 -0
  133. package/dist/esm/utils/locks.js.map +1 -0
  134. package/dist/esm/utils/maps.js +181 -0
  135. package/dist/esm/utils/maps.js.map +1 -0
  136. package/dist/esm/utils/math.js +8 -0
  137. package/dist/esm/utils/math.js.map +1 -0
  138. package/dist/esm/utils/node-http.js +42 -0
  139. package/dist/esm/utils/node-http.js.map +1 -0
  140. package/dist/esm/utils/numbers.js +32 -0
  141. package/dist/esm/utils/numbers.js.map +1 -0
  142. package/dist/esm/utils/oauth.js +10 -0
  143. package/dist/esm/utils/oauth.js.map +1 -0
  144. package/dist/esm/utils/objects.js +177 -0
  145. package/dist/esm/utils/objects.js.map +1 -0
  146. package/dist/esm/utils/passkey.js +1 -0
  147. package/dist/esm/utils/passkey.js.map +1 -0
  148. package/dist/esm/utils/promises.js +233 -0
  149. package/dist/esm/utils/promises.js.map +1 -0
  150. package/dist/esm/utils/proxies.js +128 -0
  151. package/dist/esm/utils/proxies.js.map +1 -0
  152. package/dist/esm/utils/react.js +78 -0
  153. package/dist/esm/utils/react.js.map +1 -0
  154. package/dist/esm/utils/results.js +141 -0
  155. package/dist/esm/utils/results.js.map +1 -0
  156. package/dist/esm/utils/sentry.js +20 -0
  157. package/dist/esm/utils/sentry.js.map +1 -0
  158. package/dist/esm/utils/stores.js +195 -0
  159. package/dist/esm/utils/stores.js.map +1 -0
  160. package/dist/esm/utils/strings.js +295 -0
  161. package/dist/esm/utils/strings.js.map +1 -0
  162. package/dist/esm/utils/strings.nicify.test.js +222 -0
  163. package/dist/esm/utils/strings.nicify.test.js.map +1 -0
  164. package/dist/esm/utils/types.js +1 -0
  165. package/dist/esm/utils/types.js.map +1 -0
  166. package/dist/esm/utils/unicode.js +11 -0
  167. package/dist/esm/utils/unicode.js.map +1 -0
  168. package/dist/esm/utils/urls.js +53 -0
  169. package/dist/esm/utils/urls.js.map +1 -0
  170. package/dist/esm/utils/uuids.js +16 -0
  171. package/dist/esm/utils/uuids.js.map +1 -0
  172. package/dist/global.d.d.cts +1 -0
  173. package/dist/global.d.d.ts +1 -0
  174. package/dist/global.d.js +2 -0
  175. package/dist/global.d.js.map +1 -0
  176. package/dist/helpers/password.d.cts +11 -0
  177. package/dist/helpers/password.d.ts +11 -2
  178. package/dist/helpers/password.js +41 -11
  179. package/dist/helpers/password.js.map +1 -0
  180. package/dist/helpers/production-mode.d.cts +12 -0
  181. package/dist/helpers/production-mode.d.ts +9 -3
  182. package/dist/helpers/production-mode.js +72 -45
  183. package/dist/helpers/production-mode.js.map +1 -0
  184. package/dist/hooks/use-async-callback.d.cts +6 -0
  185. package/dist/hooks/use-async-callback.d.ts +6 -3
  186. package/dist/hooks/use-async-callback.js +72 -30
  187. package/dist/hooks/use-async-callback.js.map +1 -0
  188. package/dist/hooks/use-async-external-store.d.cts +7 -0
  189. package/dist/hooks/use-async-external-store.d.ts +5 -2
  190. package/dist/hooks/use-async-external-store.js +47 -19
  191. package/dist/hooks/use-async-external-store.js.map +1 -0
  192. package/dist/hooks/use-hash.d.cts +3 -0
  193. package/dist/hooks/use-hash.d.ts +3 -1
  194. package/dist/hooks/use-hash.js +41 -8
  195. package/dist/hooks/use-hash.js.map +1 -0
  196. package/dist/hooks/use-strict-memo.d.cts +8 -0
  197. package/dist/hooks/use-strict-memo.d.ts +3 -1
  198. package/dist/hooks/use-strict-memo.js +78 -131
  199. package/dist/hooks/use-strict-memo.js.map +1 -0
  200. package/dist/index.d.cts +30 -0
  201. package/dist/index.d.ts +30 -4
  202. package/dist/index.js +42 -4
  203. package/dist/index.js.map +1 -0
  204. package/dist/interface/adminInterface.d.cts +94 -0
  205. package/dist/interface/adminInterface.d.ts +38 -15
  206. package/dist/interface/adminInterface.js +269 -174
  207. package/dist/interface/adminInterface.js.map +1 -0
  208. package/dist/interface/clientInterface.d.cts +260 -0
  209. package/dist/interface/clientInterface.d.ts +25 -18
  210. package/dist/interface/clientInterface.js +2054 -995
  211. package/dist/interface/clientInterface.js.map +1 -0
  212. package/dist/interface/crud/contact-channels.d.cts +180 -0
  213. package/dist/interface/crud/contact-channels.d.ts +30 -25
  214. package/dist/interface/crud/contact-channels.js +101 -59
  215. package/dist/interface/crud/contact-channels.js.map +1 -0
  216. package/dist/interface/crud/current-user.d.cts +205 -0
  217. package/dist/interface/crud/current-user.d.ts +17 -12
  218. package/dist/interface/crud/current-user.js +86 -56
  219. package/dist/interface/crud/current-user.js.map +1 -0
  220. package/dist/interface/crud/email-templates.d.cts +84 -0
  221. package/dist/interface/crud/email-templates.d.ts +24 -19
  222. package/dist/interface/crud/email-templates.js +77 -37
  223. package/dist/interface/crud/email-templates.js.map +1 -0
  224. package/dist/interface/crud/emails.d.cts +69 -0
  225. package/dist/interface/crud/emails.d.ts +12 -7
  226. package/dist/interface/crud/emails.js +54 -12
  227. package/dist/interface/crud/emails.js.map +1 -0
  228. package/dist/interface/crud/internal-api-keys.d.cts +139 -0
  229. package/dist/interface/crud/internal-api-keys.d.ts +22 -17
  230. package/dist/interface/crud/internal-api-keys.js +92 -54
  231. package/dist/interface/crud/internal-api-keys.js.map +1 -0
  232. package/dist/interface/crud/oauth.d.cts +34 -0
  233. package/dist/interface/crud/oauth.d.ts +16 -11
  234. package/dist/interface/crud/oauth.js +48 -14
  235. package/dist/interface/crud/oauth.js.map +1 -0
  236. package/dist/interface/crud/project-api-keys.d.cts +196 -0
  237. package/dist/interface/crud/project-api-keys.d.ts +20 -12
  238. package/dist/interface/crud/project-api-keys.js +121 -74
  239. package/dist/interface/crud/project-api-keys.js.map +1 -0
  240. package/dist/interface/crud/project-permissions.d.cts +160 -0
  241. package/dist/interface/crud/project-permissions.d.ts +38 -33
  242. package/dist/interface/crud/project-permissions.js +148 -90
  243. package/dist/interface/crud/project-permissions.js.map +1 -0
  244. package/dist/interface/crud/projects.d.cts +627 -0
  245. package/dist/interface/crud/projects.d.ts +43 -51
  246. package/dist/interface/crud/projects.js +210 -156
  247. package/dist/interface/crud/projects.js.map +1 -0
  248. package/dist/interface/crud/sessions.d.cts +149 -0
  249. package/dist/interface/crud/sessions.d.ts +21 -16
  250. package/dist/interface/crud/sessions.js +86 -50
  251. package/dist/interface/crud/sessions.js.map +1 -0
  252. package/dist/interface/crud/svix-token.d.cts +26 -0
  253. package/dist/interface/crud/svix-token.d.ts +14 -9
  254. package/dist/interface/crud/svix-token.js +46 -12
  255. package/dist/interface/crud/svix-token.js.map +1 -0
  256. package/dist/interface/crud/team-invitation-details.d.cts +30 -0
  257. package/dist/interface/crud/team-invitation-details.d.ts +12 -7
  258. package/dist/interface/crud/team-invitation-details.js +57 -15
  259. package/dist/interface/crud/team-invitation-details.js.map +1 -0
  260. package/dist/interface/crud/team-invitation.d.cts +49 -0
  261. package/dist/interface/crud/team-invitation.d.ts +13 -8
  262. package/dist/interface/crud/team-invitation.js +69 -27
  263. package/dist/interface/crud/team-invitation.js.map +1 -0
  264. package/dist/interface/crud/team-member-profiles.d.cts +229 -0
  265. package/dist/interface/crud/team-member-profiles.d.ts +20 -15
  266. package/dist/interface/crud/team-member-profiles.js +95 -49
  267. package/dist/interface/crud/team-member-profiles.js.map +1 -0
  268. package/dist/interface/crud/team-memberships.d.cts +74 -0
  269. package/dist/interface/crud/team-memberships.d.ts +22 -17
  270. package/dist/interface/crud/team-memberships.js +85 -45
  271. package/dist/interface/crud/team-memberships.js.map +1 -0
  272. package/dist/interface/crud/team-permissions.d.cts +168 -0
  273. package/dist/interface/crud/team-permissions.d.ts +38 -33
  274. package/dist/interface/crud/team-permissions.js +149 -91
  275. package/dist/interface/crud/team-permissions.js.map +1 -0
  276. package/dist/interface/crud/teams.d.cts +298 -0
  277. package/dist/interface/crud/teams.d.ts +45 -40
  278. package/dist/interface/crud/teams.js +177 -119
  279. package/dist/interface/crud/teams.js.map +1 -0
  280. package/dist/interface/crud/users.d.cts +469 -0
  281. package/dist/interface/crud/users.d.ts +31 -26
  282. package/dist/interface/crud/users.js +172 -118
  283. package/dist/interface/crud/users.js.map +1 -0
  284. package/dist/interface/serverInterface.d.cts +128 -0
  285. package/dist/interface/serverInterface.d.ts +29 -17
  286. package/dist/interface/serverInterface.js +506 -339
  287. package/dist/interface/serverInterface.js.map +1 -0
  288. package/dist/interface/webhooks.d.cts +292 -0
  289. package/dist/interface/webhooks.d.ts +6 -3
  290. package/dist/interface/webhooks.js +45 -15
  291. package/dist/interface/webhooks.js.map +1 -0
  292. package/dist/known-errors.d.cts +447 -0
  293. package/dist/known-errors.d.ts +15 -9
  294. package/dist/known-errors.js +1104 -562
  295. package/dist/known-errors.js.map +1 -0
  296. package/dist/schema-fields.d.cts +163 -0
  297. package/dist/schema-fields.d.ts +116 -114
  298. package/dist/schema-fields.js +593 -427
  299. package/dist/schema-fields.js.map +1 -0
  300. package/dist/sessions.d.cts +109 -0
  301. package/dist/sessions.d.ts +6 -3
  302. package/dist/sessions.js +201 -172
  303. package/dist/sessions.js.map +1 -0
  304. package/dist/utils/api-keys.d.cts +24 -0
  305. package/dist/utils/api-keys.d.ts +5 -4
  306. package/dist/utils/api-keys.js +106 -66
  307. package/dist/utils/api-keys.js.map +1 -0
  308. package/dist/utils/arrays.d.cts +18 -0
  309. package/dist/utils/arrays.d.ts +15 -13
  310. package/dist/utils/arrays.js +101 -168
  311. package/dist/utils/arrays.js.map +1 -0
  312. package/dist/utils/base64.d.cts +4 -0
  313. package/dist/utils/base64.d.ts +4 -2
  314. package/dist/utils/base64.js +41 -20
  315. package/dist/utils/base64.js.map +1 -0
  316. package/dist/utils/booleans.d.cts +6 -0
  317. package/dist/utils/booleans.d.ts +6 -4
  318. package/dist/utils/booleans.js +35 -27
  319. package/dist/utils/booleans.js.map +1 -0
  320. package/dist/utils/browser-compat.d.cts +8 -0
  321. package/dist/utils/browser-compat.d.ts +3 -1
  322. package/dist/utils/browser-compat.js +45 -16
  323. package/dist/utils/browser-compat.js.map +1 -0
  324. package/dist/utils/bytes.d.cts +15 -0
  325. package/dist/utils/bytes.d.ts +15 -13
  326. package/dist/utils/bytes.js +182 -270
  327. package/dist/utils/bytes.js.map +1 -0
  328. package/dist/utils/caches.d.cts +98 -0
  329. package/dist/utils/caches.d.ts +17 -14
  330. package/dist/utils/caches.js +188 -193
  331. package/dist/utils/caches.js.map +1 -0
  332. package/dist/utils/compile-time.d.cts +8 -0
  333. package/dist/utils/compile-time.d.ts +3 -1
  334. package/dist/utils/compile-time.js +35 -10
  335. package/dist/utils/compile-time.js.map +1 -0
  336. package/dist/utils/crypto.d.cts +8 -0
  337. package/dist/utils/crypto.d.ts +4 -2
  338. package/dist/utils/crypto.js +49 -21
  339. package/dist/utils/crypto.js.map +1 -0
  340. package/dist/utils/dates.d.cts +15 -0
  341. package/dist/utils/dates.d.ts +6 -4
  342. package/dist/utils/dates.js +83 -105
  343. package/dist/utils/dates.js.map +1 -0
  344. package/dist/utils/dom.d.cts +3 -0
  345. package/dist/utils/dom.d.ts +3 -1
  346. package/dist/utils/dom.js +35 -7
  347. package/dist/utils/dom.js.map +1 -0
  348. package/dist/utils/env.d.cts +9 -0
  349. package/dist/utils/env.d.ts +6 -4
  350. package/dist/utils/env.js +70 -43
  351. package/dist/utils/env.js.map +1 -0
  352. package/dist/utils/errors.d.cts +223 -0
  353. package/dist/utils/errors.d.ts +14 -11
  354. package/dist/utils/errors.js +148 -126
  355. package/dist/utils/errors.js.map +1 -0
  356. package/dist/utils/fs.d.cts +7 -0
  357. package/dist/utils/fs.d.ts +5 -3
  358. package/dist/utils/fs.js +70 -27
  359. package/dist/utils/fs.js.map +1 -0
  360. package/dist/utils/functions.d.cts +4 -0
  361. package/dist/utils/functions.d.ts +4 -2
  362. package/dist/utils/functions.js +35 -18
  363. package/dist/utils/functions.js.map +1 -0
  364. package/dist/utils/geo.d.cts +22 -0
  365. package/dist/utils/geo.d.ts +6 -3
  366. package/dist/utils/geo.js +39 -9
  367. package/dist/utils/geo.js.map +1 -0
  368. package/dist/utils/globals.d.cts +5 -0
  369. package/dist/utils/globals.d.ts +4 -2
  370. package/dist/utils/globals.js +41 -14
  371. package/dist/utils/globals.js.map +1 -0
  372. package/dist/utils/hashes.d.cts +7 -0
  373. package/dist/utils/hashes.d.ts +7 -5
  374. package/dist/utils/hashes.js +87 -41
  375. package/dist/utils/hashes.js.map +1 -0
  376. package/dist/utils/html.d.cts +4 -0
  377. package/dist/utils/html.d.ts +4 -2
  378. package/dist/utils/html.js +36 -37
  379. package/dist/utils/html.js.map +1 -0
  380. package/dist/utils/http.d.cts +43 -0
  381. package/dist/utils/http.d.ts +6 -4
  382. package/dist/utils/http.js +83 -83
  383. package/dist/utils/http.js.map +1 -0
  384. package/dist/utils/ips.d.cts +6 -0
  385. package/dist/utils/ips.d.ts +6 -4
  386. package/dist/utils/ips.js +48 -35
  387. package/dist/utils/ips.js.map +1 -0
  388. package/dist/utils/json.d.cts +13 -0
  389. package/dist/utils/json.d.ts +9 -6
  390. package/dist/utils/json.js +54 -157
  391. package/dist/utils/json.js.map +1 -0
  392. package/dist/utils/jwt.d.cts +44 -0
  393. package/dist/utils/jwt.d.ts +14 -11
  394. package/dist/utils/jwt.js +119 -84
  395. package/dist/utils/jwt.js.map +1 -0
  396. package/dist/utils/locks.d.cts +15 -0
  397. package/dist/utils/locks.d.ts +3 -2
  398. package/dist/utils/locks.js +76 -56
  399. package/dist/utils/locks.js.map +1 -0
  400. package/dist/utils/maps.d.cts +59 -0
  401. package/dist/utils/maps.d.ts +6 -4
  402. package/dist/utils/maps.js +207 -343
  403. package/dist/utils/maps.js.map +1 -0
  404. package/dist/utils/math.d.cts +6 -0
  405. package/dist/utils/math.d.ts +3 -1
  406. package/dist/utils/math.js +31 -16
  407. package/dist/utils/math.js.map +1 -0
  408. package/dist/utils/node-http.d.cts +15 -0
  409. package/dist/utils/node-http.d.ts +5 -5
  410. package/dist/utils/node-http.js +65 -36
  411. package/dist/utils/node-http.js.map +1 -0
  412. package/dist/utils/numbers.d.cts +5 -0
  413. package/dist/utils/numbers.d.ts +5 -3
  414. package/dist/utils/numbers.js +53 -66
  415. package/dist/utils/numbers.js.map +1 -0
  416. package/dist/utils/oauth.d.cts +8 -0
  417. package/dist/utils/oauth.d.ts +8 -6
  418. package/dist/utils/oauth.js +37 -4
  419. package/dist/utils/oauth.js.map +1 -0
  420. package/dist/utils/objects.d.cts +69 -0
  421. package/dist/utils/objects.d.ts +37 -32
  422. package/dist/utils/objects.js +224 -374
  423. package/dist/utils/objects.js.map +1 -0
  424. package/dist/utils/passkey.d.cts +1 -0
  425. package/dist/utils/passkey.d.ts +1 -1
  426. package/dist/utils/passkey.js +19 -1
  427. package/dist/utils/passkey.js.map +1 -0
  428. package/dist/utils/promises.d.cts +74 -0
  429. package/dist/utils/promises.d.ts +20 -18
  430. package/dist/utils/promises.js +252 -393
  431. package/dist/utils/promises.js.map +1 -0
  432. package/dist/utils/proxies.d.cts +4 -0
  433. package/dist/utils/proxies.d.ts +4 -2
  434. package/dist/utils/proxies.js +150 -161
  435. package/dist/utils/proxies.js.map +1 -0
  436. package/dist/utils/react.d.cts +25 -0
  437. package/dist/utils/react.d.ts +9 -6
  438. package/dist/utils/react.js +88 -134
  439. package/dist/utils/react.js.map +1 -0
  440. package/dist/utils/results.d.cts +78 -0
  441. package/dist/utils/results.d.ts +10 -9
  442. package/dist/utils/results.js +143 -324
  443. package/dist/utils/results.js.map +1 -0
  444. package/dist/utils/sentry.d.cts +5 -0
  445. package/dist/utils/sentry.d.ts +5 -2
  446. package/dist/utils/sentry.js +44 -14
  447. package/dist/utils/sentry.js.map +1 -0
  448. package/dist/utils/stores.d.cts +102 -0
  449. package/dist/utils/stores.d.ts +12 -9
  450. package/dist/utils/stores.js +219 -189
  451. package/dist/utils/stores.js.map +1 -0
  452. package/dist/utils/strings.d.cts +72 -0
  453. package/dist/utils/strings.d.ts +22 -20
  454. package/dist/utils/strings.js +300 -580
  455. package/dist/utils/strings.js.map +1 -0
  456. package/dist/utils/strings.nicify.test.d.cts +2 -0
  457. package/dist/utils/strings.nicify.test.d.ts +2 -1
  458. package/dist/utils/strings.nicify.test.js +168 -158
  459. package/dist/utils/strings.nicify.test.js.map +1 -0
  460. package/dist/utils/types.d.cts +23 -0
  461. package/dist/utils/types.d.ts +8 -6
  462. package/dist/utils/types.js +19 -1
  463. package/dist/utils/types.js.map +1 -0
  464. package/dist/utils/unicode.d.cts +3 -0
  465. package/dist/utils/unicode.d.ts +3 -1
  466. package/dist/utils/unicode.js +34 -21
  467. package/dist/utils/unicode.js.map +1 -0
  468. package/dist/utils/urls.d.cts +20 -0
  469. package/dist/utils/urls.d.ts +10 -8
  470. package/dist/utils/urls.js +76 -165
  471. package/dist/utils/urls.js.map +1 -0
  472. package/dist/utils/uuids.d.cts +4 -0
  473. package/dist/utils/uuids.d.ts +4 -2
  474. package/dist/utils/uuids.js +39 -35
  475. package/dist/utils/uuids.js.map +1 -0
  476. package/package.json +5 -5
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/known-errors.tsx"],"sourcesContent":["import { StackAssertionError, StatusError, throwErr } from \"./utils/errors\";\nimport { identityArgs } from \"./utils/functions\";\nimport { Json } from \"./utils/json\";\nimport { deindent } from \"./utils/strings\";\n\nexport type KnownErrorJson = {\n code: string,\n message: string,\n details?: Json,\n};\n\nexport type AbstractKnownErrorConstructor<Args extends any[]> =\n & (abstract new (...args: Args) => KnownError)\n & {\n constructorArgsFromJson: (json: KnownErrorJson) => Args,\n };\n\nexport type KnownErrorConstructor<SuperInstance extends KnownError, Args extends any[]> = {\n new (...args: Args): SuperInstance & { constructorArgs: Args },\n errorCode: string,\n constructorArgsFromJson: (json: KnownErrorJson) => Args,\n};\n\nexport abstract class KnownError extends StatusError {\n public name = \"KnownError\";\n\n constructor(\n public readonly statusCode: number,\n public readonly humanReadableMessage: string,\n public readonly details?: Json,\n ) {\n super(\n statusCode,\n humanReadableMessage\n );\n }\n\n public override getBody(): Uint8Array {\n return new TextEncoder().encode(JSON.stringify(this.toDescriptiveJson(), undefined, 2));\n }\n\n public override getHeaders(): Record<string, string[]> {\n return {\n \"Content-Type\": [\"application/json; charset=utf-8\"],\n \"X-Stack-Known-Error\": [this.errorCode],\n };\n }\n\n public override toDescriptiveJson(): Json {\n return {\n code: this.errorCode,\n ...this.details ? { details: this.details } : {},\n error: this.humanReadableMessage,\n };\n }\n\n get errorCode(): string {\n return (this.constructor as any).errorCode ?? throwErr(`Can't find error code for this KnownError. Is its constructor a KnownErrorConstructor? ${this}`);\n }\n\n public static constructorArgsFromJson(json: KnownErrorJson): ConstructorParameters<typeof KnownError> {\n return [\n 400,\n json.message,\n json,\n ];\n }\n\n public static fromJson(json: KnownErrorJson): KnownError {\n for (const [_, KnownErrorType] of Object.entries(KnownErrors)) {\n if (json.code === KnownErrorType.prototype.errorCode) {\n const constructorArgs = KnownErrorType.constructorArgsFromJson(json);\n return new KnownErrorType(\n // @ts-expect-error\n ...constructorArgs,\n );\n }\n }\n\n throw new Error(`Unknown KnownError code. You may need to update your version of Stack to see more detailed information. ${json.code}: ${json.message}`);\n }\n}\n\nconst knownErrorConstructorErrorCodeSentinel = Symbol(\"knownErrorConstructorErrorCodeSentinel\");\n/**\n * Exists solely so that known errors are nominative types (ie. two KnownErrors with the same interface are not the same type)\n */\ntype KnownErrorBrand<ErrorCode extends string> = {\n /**\n * Does not exist at runtime\n *\n * Must be an object because it may be true for multiple error codes (it's true for all parents)\n */\n [knownErrorConstructorErrorCodeSentinel]: {\n [K in ErrorCode]: true\n },\n};\n\nfunction createKnownErrorConstructor<ErrorCode extends string, Super extends AbstractKnownErrorConstructor<any>, Args extends any[]>(\n SuperClass: Super,\n errorCode: ErrorCode,\n create: ((...args: Args) => Readonly<ConstructorParameters<Super>>),\n constructorArgsFromJson: ((jsonDetails: any) => Args),\n): KnownErrorConstructor<InstanceType<Super> & KnownErrorBrand<ErrorCode>, Args> & { errorCode: ErrorCode };\nfunction createKnownErrorConstructor<ErrorCode extends string, Super extends AbstractKnownErrorConstructor<any>>(\n SuperClass: Super,\n errorCode: ErrorCode,\n create: \"inherit\",\n constructorArgsFromJson: \"inherit\",\n): KnownErrorConstructor<InstanceType<Super> & KnownErrorBrand<ErrorCode>, ConstructorParameters<Super>> & { errorCode: ErrorCode };\nfunction createKnownErrorConstructor<ErrorCode extends string, Super extends AbstractKnownErrorConstructor<any>, Args extends any[]>(\n SuperClass: Super,\n errorCode: ErrorCode,\n create: \"inherit\" | ((...args: Args) => Readonly<ConstructorParameters<Super>>),\n constructorArgsFromJson: \"inherit\" | ((jsonDetails: any) => Args),\n): KnownErrorConstructor<InstanceType<Super> & KnownErrorBrand<ErrorCode>, Args> & { errorCode: ErrorCode } {\n const createFn = create === \"inherit\" ? identityArgs<Args> as never : create;\n const constructorArgsFromJsonFn = constructorArgsFromJson === \"inherit\" ? SuperClass.constructorArgsFromJson as never : constructorArgsFromJson;\n\n // @ts-expect-error this is not a mixin, but TS detects it as one\n class KnownErrorImpl extends SuperClass {\n public static readonly errorCode = errorCode;\n public name = `KnownError<${errorCode}>`;\n public readonly constructorArgs: Args;\n\n constructor(...args: Args) {\n // @ts-expect-error DEVIN, STOP REMOVING THIS LINE YOU DUMBASS, YES TYPESCRIPT DOES THROW AN ERROR IF YOU DON'T HAVE IT, NO THIS IS NOT \"UNUSED\", AND YES YOU ARE BREAKING OUR CI PIPELINE EVERY TIME YOU DO IT\n super(...createFn(...args));\n this.constructorArgs = args;\n }\n\n static constructorArgsFromJson(json: KnownErrorJson): Args {\n return constructorArgsFromJsonFn(json.details);\n }\n };\n\n // @ts-expect-error\n return KnownErrorImpl;\n}\n\nconst UnsupportedError = createKnownErrorConstructor(\n KnownError,\n \"UNSUPPORTED_ERROR\",\n (originalErrorCode: string) => [\n 500,\n `An error occurred that is not currently supported (possibly because it was added in a version of Stack that is newer than this client). The original unsupported error code was: ${originalErrorCode}`,\n {\n originalErrorCode,\n },\n ] as const,\n (json) => [\n (json as any)?.originalErrorCode ?? throwErr(\"originalErrorCode not found in UnsupportedError details\"),\n ] as const,\n);\n\nconst BodyParsingError = createKnownErrorConstructor(\n KnownError,\n \"BODY_PARSING_ERROR\",\n (message: string) => [\n 400,\n message,\n ] as const,\n (json) => [json.message] as const,\n);\n\nconst SchemaError = createKnownErrorConstructor(\n KnownError,\n \"SCHEMA_ERROR\",\n (message: string) => [\n 400,\n message || throwErr(\"SchemaError requires a message\"),\n {\n message,\n },\n ] as const,\n (json: any) => [json.message] as const,\n);\n\nconst AllOverloadsFailed = createKnownErrorConstructor(\n KnownError,\n \"ALL_OVERLOADS_FAILED\",\n (overloadErrors: Json[]) => [\n 400,\n deindent`\n This endpoint has multiple overloads, but they all failed to process the request.\n\n ${overloadErrors.map((e, i) => deindent`\n Overload ${i + 1}: ${JSON.stringify(e, undefined, 2)}\n `).join(\"\\n\\n\")}\n `,\n {\n overload_errors: overloadErrors,\n },\n ] as const,\n (json) => [\n (json as any)?.overload_errors ?? throwErr(\"overload_errors not found in AllOverloadsFailed details\"),\n ] as const,\n);\n\nconst ProjectAuthenticationError = createKnownErrorConstructor(\n KnownError,\n \"PROJECT_AUTHENTICATION_ERROR\",\n \"inherit\",\n \"inherit\",\n);\n\nconst InvalidProjectAuthentication = createKnownErrorConstructor(\n ProjectAuthenticationError,\n \"INVALID_PROJECT_AUTHENTICATION\",\n \"inherit\",\n \"inherit\",\n);\n\nconst ProjectKeyWithoutAccessType = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"PROJECT_KEY_WITHOUT_ACCESS_TYPE\",\n () => [\n 400,\n \"Either an API key or an admin access token was provided, but the x-stack-access-type header is missing. Set it to 'client', 'server', or 'admin' as appropriate.\",\n ] as const,\n () => [] as const,\n);\n\nconst InvalidAccessType = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"INVALID_ACCESS_TYPE\",\n (accessType: string) => [\n 400,\n `The x-stack-access-type header must be 'client', 'server', or 'admin', but was '${accessType}'.`,\n ] as const,\n (json) => [\n (json as any)?.accessType ?? throwErr(\"accessType not found in InvalidAccessType details\"),\n ] as const,\n);\n\nconst AccessTypeWithoutProjectId = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"ACCESS_TYPE_WITHOUT_PROJECT_ID\",\n (accessType: \"client\" | \"server\" | \"admin\") => [\n 400,\n deindent`\n The x-stack-access-type header was '${accessType}', but the x-stack-project-id header was not provided.\n \n For more information, see the docs on REST API authentication: https://docs.stack-auth.com/rest-api/overview#authentication\n `,\n {\n request_type: accessType,\n },\n ] as const,\n (json: any) => [json.request_type] as const,\n);\n\nconst AccessTypeRequired = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"ACCESS_TYPE_REQUIRED\",\n () => [\n 400,\n deindent`\n You must specify an access level for this Stack project. Make sure project API keys are provided (eg. x-stack-publishable-client-key) and you set the x-stack-access-type header to 'client', 'server', or 'admin'.\n \n For more information, see the docs on REST API authentication: https://docs.stack-auth.com/rest-api/overview#authentication\n `,\n ] as const,\n () => [] as const,\n);\n\nconst InsufficientAccessType = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"INSUFFICIENT_ACCESS_TYPE\",\n (actualAccessType: \"client\" | \"server\" | \"admin\", allowedAccessTypes: (\"client\" | \"server\" | \"admin\")[]) => [\n 401,\n `The x-stack-access-type header must be ${allowedAccessTypes.map(s => `'${s}'`).join(\" or \")}, but was '${actualAccessType}'.`,\n {\n actual_access_type: actualAccessType,\n allowed_access_types: allowedAccessTypes,\n },\n ] as const,\n (json: any) => [\n json.actual_access_type,\n json.allowed_access_types,\n ] as const,\n);\n\nconst InvalidPublishableClientKey = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"INVALID_PUBLISHABLE_CLIENT_KEY\",\n (projectId: string) => [\n 401,\n `The publishable key is not valid for the project ${JSON.stringify(projectId)}. Does the project and/or the key exist?`,\n {\n project_id: projectId,\n },\n ] as const,\n (json: any) => [json.project_id] as const,\n);\n\nconst InvalidSecretServerKey = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"INVALID_SECRET_SERVER_KEY\",\n (projectId: string) => [\n 401,\n `The secret server key is not valid for the project ${JSON.stringify(projectId)}. Does the project and/or the key exist?`,\n {\n project_id: projectId,\n },\n ] as const,\n (json: any) => [json.project_id] as const,\n);\n\nconst InvalidSuperSecretAdminKey = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"INVALID_SUPER_SECRET_ADMIN_KEY\",\n (projectId: string) => [\n 401,\n `The super secret admin key is not valid for the project ${JSON.stringify(projectId)}. Does the project and/or the key exist?`,\n {\n project_id: projectId,\n },\n ] as const,\n (json: any) => [json.project_id] as const,\n);\n\nconst InvalidAdminAccessToken = createKnownErrorConstructor(\n InvalidProjectAuthentication,\n \"INVALID_ADMIN_ACCESS_TOKEN\",\n \"inherit\",\n \"inherit\",\n);\n\nconst UnparsableAdminAccessToken = createKnownErrorConstructor(\n InvalidAdminAccessToken,\n \"UNPARSABLE_ADMIN_ACCESS_TOKEN\",\n () => [\n 401,\n \"Admin access token is not parsable.\",\n ] as const,\n () => [] as const,\n);\n\nconst AdminAccessTokenExpired = createKnownErrorConstructor(\n InvalidAdminAccessToken,\n \"ADMIN_ACCESS_TOKEN_EXPIRED\",\n (expiredAt: Date | undefined) => [\n 401,\n `Admin access token has expired. Please refresh it and try again.${expiredAt ? ` (The access token expired at ${expiredAt.toISOString()}.)`: \"\"}`,\n { expired_at_millis: expiredAt?.getTime() ?? null },\n ] as const,\n (json: any) => [json.expired_at_millis ?? undefined] as const,\n);\n\nconst InvalidProjectForAdminAccessToken = createKnownErrorConstructor(\n InvalidAdminAccessToken,\n \"INVALID_PROJECT_FOR_ADMIN_ACCESS_TOKEN\",\n () => [\n 401,\n \"Admin access tokens must be created on the internal project.\",\n ] as const,\n () => [] as const,\n);\n\nconst AdminAccessTokenIsNotAdmin = createKnownErrorConstructor(\n InvalidAdminAccessToken,\n \"ADMIN_ACCESS_TOKEN_IS_NOT_ADMIN\",\n () => [\n 401,\n \"Admin access token does not have the required permissions to access this project.\",\n ] as const,\n () => [] as const,\n);\n\n/**\n * @deprecated Use InsufficientAccessType instead\n */\nconst ProjectAuthenticationRequired = createKnownErrorConstructor(\n ProjectAuthenticationError,\n \"PROJECT_AUTHENTICATION_REQUIRED\",\n \"inherit\",\n \"inherit\",\n);\n\n\n/**\n * @deprecated Use InsufficientAccessType instead\n */\nconst ClientAuthenticationRequired = createKnownErrorConstructor(\n ProjectAuthenticationRequired,\n \"CLIENT_AUTHENTICATION_REQUIRED\",\n () => [\n 401,\n \"The publishable client key must be provided.\",\n ] as const,\n () => [] as const,\n);\n\n/**\n * @deprecated Use InsufficientAccessType instead\n */\nconst ServerAuthenticationRequired = createKnownErrorConstructor(\n ProjectAuthenticationRequired,\n \"SERVER_AUTHENTICATION_REQUIRED\",\n () => [\n 401,\n \"The secret server key must be provided.\",\n ] as const,\n () => [] as const,\n);\n\n/**\n * @deprecated Use InsufficientAccessType instead\n */\nconst ClientOrServerAuthenticationRequired = createKnownErrorConstructor(\n ProjectAuthenticationRequired,\n \"CLIENT_OR_SERVER_AUTHENTICATION_REQUIRED\",\n () => [\n 401,\n \"Either the publishable client key or the secret server key must be provided.\",\n ] as const,\n () => [] as const,\n);\n\n/**\n * @deprecated Use InsufficientAccessType instead\n */\nconst ClientOrAdminAuthenticationRequired = createKnownErrorConstructor(\n ProjectAuthenticationRequired,\n \"CLIENT_OR_ADMIN_AUTHENTICATION_REQUIRED\",\n () => [\n 401,\n \"Either the publishable client key or the super secret admin key must be provided.\",\n ] as const,\n () => [] as const,\n);\n\n/**\n * @deprecated Use InsufficientAccessType instead\n */\nconst ClientOrServerOrAdminAuthenticationRequired = createKnownErrorConstructor(\n ProjectAuthenticationRequired,\n \"CLIENT_OR_SERVER_OR_ADMIN_AUTHENTICATION_REQUIRED\",\n () => [\n 401,\n \"Either the publishable client key, the secret server key, or the super secret admin key must be provided.\",\n ] as const,\n () => [] as const,\n);\n\n/**\n * @deprecated Use InsufficientAccessType instead\n */\nconst AdminAuthenticationRequired = createKnownErrorConstructor(\n ProjectAuthenticationRequired,\n \"ADMIN_AUTHENTICATION_REQUIRED\",\n () => [\n 401,\n \"The super secret admin key must be provided.\",\n ] as const,\n () => [] as const,\n);\n\nconst ExpectedInternalProject = createKnownErrorConstructor(\n ProjectAuthenticationError,\n \"EXPECTED_INTERNAL_PROJECT\",\n () => [\n 401,\n \"The project ID is expected to be internal.\",\n ] as const,\n () => [] as const,\n);\n\nconst SessionAuthenticationError = createKnownErrorConstructor(\n KnownError,\n \"SESSION_AUTHENTICATION_ERROR\",\n \"inherit\",\n \"inherit\",\n);\n\nconst InvalidSessionAuthentication = createKnownErrorConstructor(\n SessionAuthenticationError,\n \"INVALID_SESSION_AUTHENTICATION\",\n \"inherit\",\n \"inherit\",\n);\n\nconst InvalidAccessToken = createKnownErrorConstructor(\n InvalidSessionAuthentication,\n \"INVALID_ACCESS_TOKEN\",\n \"inherit\",\n \"inherit\",\n);\n\nconst UnparsableAccessToken = createKnownErrorConstructor(\n InvalidAccessToken,\n \"UNPARSABLE_ACCESS_TOKEN\",\n () => [\n 401,\n \"Access token is not parsable.\",\n ] as const,\n () => [] as const,\n);\n\nconst AccessTokenExpired = createKnownErrorConstructor(\n InvalidAccessToken,\n \"ACCESS_TOKEN_EXPIRED\",\n (expiredAt: Date | undefined) => [\n 401,\n `Access token has expired. Please refresh it and try again.${expiredAt ? ` (The access token expired at ${expiredAt.toISOString()}.)`: \"\"}`,\n { expired_at_millis: expiredAt?.getTime() ?? null },\n ] as const,\n (json: any) => [json.expired_at_millis ? new Date(json.expired_at_millis) : undefined] as const,\n);\n\nconst InvalidProjectForAccessToken = createKnownErrorConstructor(\n InvalidAccessToken,\n \"INVALID_PROJECT_FOR_ACCESS_TOKEN\",\n (expectedProjectId: string, actualProjectId: string) => [\n 401,\n `Access token not valid for this project. Expected project ID ${JSON.stringify(expectedProjectId)}, but the token is for project ID ${JSON.stringify(actualProjectId)}.`,\n {\n expected_project_id: expectedProjectId,\n actual_project_id: actualProjectId,\n },\n ] as const,\n (json: any) => [json.expected_project_id, json.actual_project_id] as const,\n);\n\n\nconst RefreshTokenError = createKnownErrorConstructor(\n KnownError,\n \"REFRESH_TOKEN_ERROR\",\n \"inherit\",\n \"inherit\",\n);\n\nconst RefreshTokenNotFoundOrExpired = createKnownErrorConstructor(\n RefreshTokenError,\n \"REFRESH_TOKEN_NOT_FOUND_OR_EXPIRED\",\n () => [\n 401,\n \"Refresh token not found for this project, or the session has expired/been revoked.\",\n ] as const,\n () => [] as const,\n);\n\nconst CannotDeleteCurrentSession = createKnownErrorConstructor(\n RefreshTokenError,\n \"CANNOT_DELETE_CURRENT_SESSION\",\n () => [\n 400,\n \"Cannot delete the current session.\",\n ] as const,\n () => [] as const,\n);\n\n\nconst ProviderRejected = createKnownErrorConstructor(\n RefreshTokenError,\n \"PROVIDER_REJECTED\",\n () => [\n 401,\n \"The provider refused to refresh their token. This usually means that the provider used to authenticate the user no longer regards this session as valid, and the user must re-authenticate.\",\n ] as const,\n () => [] as const,\n);\n\nconst UserWithEmailAlreadyExists = createKnownErrorConstructor(\n KnownError,\n \"USER_EMAIL_ALREADY_EXISTS\",\n (email: string) => [\n 409,\n `A user with email ${JSON.stringify(email)} already exists.`,\n {\n email,\n },\n ] as const,\n (json: any) => [json.email] as const,\n);\n\nconst EmailNotVerified = createKnownErrorConstructor(\n KnownError,\n \"EMAIL_NOT_VERIFIED\",\n () => [\n 400,\n \"The email is not verified.\",\n ] as const,\n () => [] as const,\n);\n\nconst CannotGetOwnUserWithoutUser = createKnownErrorConstructor(\n KnownError,\n \"CANNOT_GET_OWN_USER_WITHOUT_USER\",\n () => [\n 400,\n \"You have specified 'me' as a userId, but did not provide authentication for a user.\",\n ] as const,\n () => [] as const,\n);\n\nconst UserIdDoesNotExist = createKnownErrorConstructor(\n KnownError,\n \"USER_ID_DOES_NOT_EXIST\",\n (userId: string) => [\n 400,\n `The given user with the ID ${userId} does not exist.`,\n {\n user_id: userId,\n },\n ] as const,\n (json: any) => [json.user_id] as const,\n);\n\nconst UserNotFound = createKnownErrorConstructor(\n KnownError,\n \"USER_NOT_FOUND\",\n () => [\n 404,\n \"User not found.\",\n ] as const,\n () => [] as const,\n);\n\n\nconst ProjectNotFound = createKnownErrorConstructor(\n KnownError,\n \"PROJECT_NOT_FOUND\",\n (projectId: string) => {\n if (typeof projectId !== \"string\") throw new StackAssertionError(\"projectId of KnownErrors.ProjectNotFound must be a string\");\n return [\n 404,\n `Project ${projectId} not found or is not accessible with the current user.`,\n {\n project_id: projectId,\n },\n ] as const;\n },\n (json: any) => [json.project_id] as const,\n);\n\nconst SignUpNotEnabled = createKnownErrorConstructor(\n KnownError,\n \"SIGN_UP_NOT_ENABLED\",\n () => [\n 400,\n \"Creation of new accounts is not enabled for this project. Please ask the project owner to enable it.\",\n ] as const,\n () => [] as const,\n);\n\nconst PasswordAuthenticationNotEnabled = createKnownErrorConstructor(\n KnownError,\n \"PASSWORD_AUTHENTICATION_NOT_ENABLED\",\n () => [\n 400,\n \"Password authentication is not enabled for this project.\",\n ] as const,\n () => [] as const,\n);\n\n\nconst PasskeyAuthenticationNotEnabled = createKnownErrorConstructor(\n KnownError,\n \"PASSKEY_AUTHENTICATION_NOT_ENABLED\",\n () => [\n 400,\n \"Passkey authentication is not enabled for this project.\",\n ] as const,\n () => [] as const,\n);\n\nconst AnonymousAccountsNotEnabled = createKnownErrorConstructor(\n KnownError,\n \"ANONYMOUS_ACCOUNTS_NOT_ENABLED\",\n () => [\n 400,\n \"Anonymous accounts are not enabled for this project.\",\n ] as const,\n () => [] as const,\n);\n\n\nconst EmailPasswordMismatch = createKnownErrorConstructor(\n KnownError,\n \"EMAIL_PASSWORD_MISMATCH\",\n () => [\n 400,\n \"Wrong e-mail or password.\",\n ] as const,\n () => [] as const,\n);\n\nconst RedirectUrlNotWhitelisted = createKnownErrorConstructor(\n KnownError,\n \"REDIRECT_URL_NOT_WHITELISTED\",\n () => [\n 400,\n \"Redirect URL not whitelisted. Did you forget to add this domain to the trusted domains list on the Stack Auth dashboard?\",\n ] as const,\n () => [] as const,\n);\n\nconst PasswordRequirementsNotMet = createKnownErrorConstructor(\n KnownError,\n \"PASSWORD_REQUIREMENTS_NOT_MET\",\n \"inherit\",\n \"inherit\",\n);\n\nconst PasswordTooShort = createKnownErrorConstructor(\n PasswordRequirementsNotMet,\n \"PASSWORD_TOO_SHORT\",\n (minLength: number) => [\n 400,\n `Password too short. Minimum length is ${minLength}.`,\n {\n min_length: minLength,\n },\n ] as const,\n (json) => [\n (json as any)?.min_length ?? throwErr(\"min_length not found in PasswordTooShort details\"),\n ] as const,\n);\n\nconst PasswordTooLong = createKnownErrorConstructor(\n PasswordRequirementsNotMet,\n \"PASSWORD_TOO_LONG\",\n (maxLength: number) => [\n 400,\n `Password too long. Maximum length is ${maxLength}.`,\n {\n maxLength,\n },\n ] as const,\n (json) => [\n (json as any)?.maxLength ?? throwErr(\"maxLength not found in PasswordTooLong details\"),\n ] as const,\n);\n\nconst UserDoesNotHavePassword = createKnownErrorConstructor(\n KnownError,\n \"USER_DOES_NOT_HAVE_PASSWORD\",\n () => [\n 400,\n \"This user does not have password authentication enabled.\",\n ] as const,\n () => [] as const,\n);\n\nconst VerificationCodeError = createKnownErrorConstructor(\n KnownError,\n \"VERIFICATION_ERROR\",\n \"inherit\",\n \"inherit\",\n);\n\nconst VerificationCodeNotFound = createKnownErrorConstructor(\n VerificationCodeError,\n \"VERIFICATION_CODE_NOT_FOUND\",\n () => [\n 404,\n \"The verification code does not exist for this project.\",\n ] as const,\n () => [] as const,\n);\n\nconst VerificationCodeExpired = createKnownErrorConstructor(\n VerificationCodeError,\n \"VERIFICATION_CODE_EXPIRED\",\n () => [\n 400,\n \"The verification code has expired.\",\n ] as const,\n () => [] as const,\n);\n\nconst VerificationCodeAlreadyUsed = createKnownErrorConstructor(\n VerificationCodeError,\n \"VERIFICATION_CODE_ALREADY_USED\",\n () => [\n 409,\n \"The verification link has already been used.\",\n ] as const,\n () => [] as const,\n);\n\nconst VerificationCodeMaxAttemptsReached = createKnownErrorConstructor(\n VerificationCodeError,\n \"VERIFICATION_CODE_MAX_ATTEMPTS_REACHED\",\n () => [\n 400,\n \"The verification code nonce has reached the maximum number of attempts. This code is not valid anymore.\",\n ] as const,\n () => [] as const,\n);\n\nconst PasswordConfirmationMismatch = createKnownErrorConstructor(\n KnownError,\n \"PASSWORD_CONFIRMATION_MISMATCH\",\n () => [\n 400,\n \"Passwords do not match.\",\n ] as const,\n () => [] as const,\n);\n\nconst EmailAlreadyVerified = createKnownErrorConstructor(\n KnownError,\n \"EMAIL_ALREADY_VERIFIED\",\n () => [\n 409,\n \"The e-mail is already verified.\",\n ] as const,\n () => [] as const,\n);\n\nconst EmailNotAssociatedWithUser = createKnownErrorConstructor(\n KnownError,\n \"EMAIL_NOT_ASSOCIATED_WITH_USER\",\n () => [\n 400,\n \"The e-mail is not associated with a user that could log in with that e-mail.\",\n ] as const,\n () => [] as const,\n);\n\nconst EmailIsNotPrimaryEmail = createKnownErrorConstructor(\n KnownError,\n \"EMAIL_IS_NOT_PRIMARY_EMAIL\",\n (email: string, primaryEmail: string | null) => [\n 400,\n `The given e-mail (${email}) must equal the user's primary e-mail (${primaryEmail}).`,\n {\n email,\n primary_email: primaryEmail,\n },\n ] as const,\n (json: any) => [json.email, json.primary_email] as const,\n);\n\n\nconst PasskeyRegistrationFailed = createKnownErrorConstructor(\n KnownError,\n \"PASSKEY_REGISTRATION_FAILED\",\n (message: string) => [\n 400,\n message,\n ] as const,\n (json: any) => [json.message] as const,\n);\n\n\nconst PasskeyWebAuthnError = createKnownErrorConstructor(\n KnownError,\n \"PASSKEY_WEBAUTHN_ERROR\",\n (message: string, code: string) => [\n 400,\n message,\n {\n message,\n code,\n },\n ] as const,\n (json: any) => [json.message, json.code] as const,\n);\n\nconst PasskeyAuthenticationFailed = createKnownErrorConstructor(\n KnownError,\n \"PASSKEY_AUTHENTICATION_FAILED\",\n (message: string) => [\n 400,\n message,\n ] as const,\n (json: any) => [json.message] as const,\n);\n\n\nconst PermissionNotFound = createKnownErrorConstructor(\n KnownError,\n \"PERMISSION_NOT_FOUND\",\n (permissionId: string) => [\n 404,\n `Permission \"${permissionId}\" not found. Make sure you created it on the dashboard.`,\n {\n permission_id: permissionId,\n },\n ] as const,\n (json: any) => [json.permission_id] as const,\n);\n\nconst PermissionScopeMismatch = createKnownErrorConstructor(\n KnownError,\n \"WRONG_PERMISSION_SCOPE\",\n (permissionId: string, expectedScope: \"team\" | \"project\", actualScope: \"team\" | \"project\" | null) => [\n 404,\n `Permission ${JSON.stringify(permissionId)} not found. (It was found for a different scope ${JSON.stringify(actualScope)}, but scope ${JSON.stringify(expectedScope)} was expected.)`,\n {\n permission_id: permissionId,\n expected_scope: expectedScope,\n actual_scope: actualScope,\n },\n ] as const,\n (json: any) => [json.permission_id, json.expected_scope, json.actual_scope] as const,\n);\n\nconst ContainedPermissionNotFound = createKnownErrorConstructor(\n KnownError,\n \"CONTAINED_PERMISSION_NOT_FOUND\",\n (permissionId: string) => [\n 400,\n `Contained permission with ID \"${permissionId}\" not found. Make sure you created it on the dashboard.`,\n {\n permission_id: permissionId,\n },\n ] as const,\n (json: any) => [json.permission_id] as const,\n);\n\nconst TeamNotFound = createKnownErrorConstructor(\n KnownError,\n \"TEAM_NOT_FOUND\",\n (teamId: string) => [\n 404,\n `Team ${teamId} not found.`,\n {\n team_id: teamId,\n },\n ] as const,\n (json: any) => [json.team_id] as const,\n);\n\nconst TeamAlreadyExists = createKnownErrorConstructor(\n KnownError,\n \"TEAM_ALREADY_EXISTS\",\n (teamId: string) => [\n 409,\n `Team ${teamId} already exists.`,\n {\n team_id: teamId,\n },\n ] as const,\n (json: any) => [json.team_id] as const,\n);\n\nconst TeamMembershipNotFound = createKnownErrorConstructor(\n KnownError,\n \"TEAM_MEMBERSHIP_NOT_FOUND\",\n (teamId: string, userId: string) => [\n 404,\n `User ${userId} is not found in team ${teamId}.`,\n {\n team_id: teamId,\n user_id: userId,\n },\n ] as const,\n (json: any) => [json.team_id, json.user_id] as const,\n);\n\n\nconst EmailTemplateAlreadyExists = createKnownErrorConstructor(\n KnownError,\n \"EMAIL_TEMPLATE_ALREADY_EXISTS\",\n () => [\n 409,\n \"Email template already exists.\",\n ] as const,\n () => [] as const,\n);\n\nconst OAuthConnectionNotConnectedToUser = createKnownErrorConstructor(\n KnownError,\n \"OAUTH_CONNECTION_NOT_CONNECTED_TO_USER\",\n () => [\n 400,\n \"The OAuth connection is not connected to any user.\",\n ] as const,\n () => [] as const,\n);\n\nconst OAuthConnectionAlreadyConnectedToAnotherUser = createKnownErrorConstructor(\n KnownError,\n \"OAUTH_CONNECTION_ALREADY_CONNECTED_TO_ANOTHER_USER\",\n () => [\n 409,\n \"The OAuth connection is already connected to another user.\",\n ] as const,\n () => [] as const,\n);\n\nconst OAuthConnectionDoesNotHaveRequiredScope = createKnownErrorConstructor(\n KnownError,\n \"OAUTH_CONNECTION_DOES_NOT_HAVE_REQUIRED_SCOPE\",\n () => [\n 400,\n \"The OAuth connection does not have the required scope.\",\n ] as const,\n () => [] as const,\n);\n\nconst OAuthExtraScopeNotAvailableWithSharedOAuthKeys = createKnownErrorConstructor(\n KnownError,\n \"OAUTH_EXTRA_SCOPE_NOT_AVAILABLE_WITH_SHARED_OAUTH_KEYS\",\n () => [\n 400,\n \"Extra scopes are not available with shared OAuth keys. Please add your own OAuth keys on the Stack dashboard to use extra scopes.\",\n ] as const,\n () => [] as const,\n);\n\nconst OAuthAccessTokenNotAvailableWithSharedOAuthKeys = createKnownErrorConstructor(\n KnownError,\n \"OAUTH_ACCESS_TOKEN_NOT_AVAILABLE_WITH_SHARED_OAUTH_KEYS\",\n () => [\n 400,\n \"Access tokens are not available with shared OAuth keys. Please add your own OAuth keys on the Stack dashboard to use access tokens.\",\n ] as const,\n () => [] as const,\n);\n\nconst InvalidOAuthClientIdOrSecret = createKnownErrorConstructor(\n KnownError,\n \"INVALID_OAUTH_CLIENT_ID_OR_SECRET\",\n (clientId?: string) => [\n 400,\n \"The OAuth client ID or secret is invalid. The client ID must be equal to the project ID, and the client secret must be a publishable client key.\",\n {\n client_id: clientId ?? null,\n },\n ] as const,\n (json: any) => [json.client_id ?? undefined] as const,\n);\n\nconst InvalidScope = createKnownErrorConstructor(\n KnownError,\n \"INVALID_SCOPE\",\n (scope: string) => [\n 400,\n `The scope \"${scope}\" is not a valid OAuth scope for Stack.`,\n ] as const,\n (json: any) => [json.scope] as const,\n);\n\nconst UserAlreadyConnectedToAnotherOAuthConnection = createKnownErrorConstructor(\n KnownError,\n \"USER_ALREADY_CONNECTED_TO_ANOTHER_OAUTH_CONNECTION\",\n () => [\n 409,\n \"The user is already connected to another OAuth account. Did you maybe selected the wrong account?\",\n ] as const,\n () => [] as const,\n);\n\nconst OuterOAuthTimeout = createKnownErrorConstructor(\n KnownError,\n \"OUTER_OAUTH_TIMEOUT\",\n () => [\n 408,\n \"The OAuth flow has timed out. Please sign in again.\",\n ] as const,\n () => [] as const,\n);\n\nconst OAuthProviderNotFoundOrNotEnabled = createKnownErrorConstructor(\n KnownError,\n \"OAUTH_PROVIDER_NOT_FOUND_OR_NOT_ENABLED\",\n () => [\n 400,\n \"The OAuth provider is not found or not enabled.\",\n ] as const,\n () => [] as const,\n);\n\nconst MultiFactorAuthenticationRequired = createKnownErrorConstructor(\n KnownError,\n \"MULTI_FACTOR_AUTHENTICATION_REQUIRED\",\n (attemptCode: string) => [\n 400,\n `Multi-factor authentication is required for this user.`,\n {\n attempt_code: attemptCode,\n },\n ] as const,\n (json) => [json.attempt_code] as const,\n);\n\nconst InvalidTotpCode = createKnownErrorConstructor(\n KnownError,\n \"INVALID_TOTP_CODE\",\n () => [\n 400,\n \"The TOTP code is invalid. Please try again.\",\n ] as const,\n () => [] as const,\n);\n\nconst UserAuthenticationRequired = createKnownErrorConstructor(\n KnownError,\n \"USER_AUTHENTICATION_REQUIRED\",\n () => [\n 401,\n \"User authentication required for this endpoint.\",\n ] as const,\n () => [] as const,\n);\n\nconst TeamMembershipAlreadyExists = createKnownErrorConstructor(\n KnownError,\n \"TEAM_MEMBERSHIP_ALREADY_EXISTS\",\n () => [\n 409,\n \"Team membership already exists.\",\n ] as const,\n () => [] as const,\n);\n\nconst ProjectPermissionRequired = createKnownErrorConstructor(\n KnownError,\n \"PROJECT_PERMISSION_REQUIRED\",\n (userId, permissionId) => [\n 401,\n `User ${userId} does not have permission ${permissionId}.`,\n {\n user_id: userId,\n permission_id: permissionId,\n },\n ] as const,\n (json) => [json.user_id, json.permission_id] as const,\n);\n\nconst TeamPermissionRequired = createKnownErrorConstructor(\n KnownError,\n \"TEAM_PERMISSION_REQUIRED\",\n (teamId, userId, permissionId) => [\n 401,\n `User ${userId} does not have permission ${permissionId} in team ${teamId}.`,\n {\n team_id: teamId,\n user_id: userId,\n permission_id: permissionId,\n },\n ] as const,\n (json) => [json.team_id, json.user_id, json.permission_id] as const,\n);\n\nconst TeamPermissionNotFound = createKnownErrorConstructor(\n KnownError,\n \"TEAM_PERMISSION_NOT_FOUND\",\n (teamId, userId, permissionId) => [\n 401,\n `User ${userId} does not have permission ${permissionId} in team ${teamId}.`,\n {\n team_id: teamId,\n user_id: userId,\n permission_id: permissionId,\n },\n ] as const,\n (json) => [json.team_id, json.user_id, json.permission_id] as const,\n);\n\nconst InvalidSharedOAuthProviderId = createKnownErrorConstructor(\n KnownError,\n \"INVALID_SHARED_OAUTH_PROVIDER_ID\",\n (providerId) => [\n 400,\n `The shared OAuth provider with ID ${providerId} is not valid.`,\n {\n provider_id: providerId,\n },\n ] as const,\n (json) => [json.provider_id] as const,\n);\n\nconst InvalidStandardOAuthProviderId = createKnownErrorConstructor(\n KnownError,\n \"INVALID_STANDARD_OAUTH_PROVIDER_ID\",\n (providerId) => [\n 400,\n `The standard OAuth provider with ID ${providerId} is not valid.`,\n {\n provider_id: providerId,\n },\n ] as const,\n (json) => [json.provider_id] as const,\n);\n\nconst InvalidAuthorizationCode = createKnownErrorConstructor(\n KnownError,\n \"INVALID_AUTHORIZATION_CODE\",\n () => [\n 400,\n \"The given authorization code is invalid.\",\n ] as const,\n () => [] as const,\n);\n\nconst OAuthProviderAccessDenied = createKnownErrorConstructor(\n KnownError,\n \"OAUTH_PROVIDER_ACCESS_DENIED\",\n () => [\n 400,\n \"The OAuth provider denied access to the user.\",\n ] as const,\n () => [] as const,\n);\n\nconst ContactChannelAlreadyUsedForAuthBySomeoneElse = createKnownErrorConstructor(\n KnownError,\n \"CONTACT_CHANNEL_ALREADY_USED_FOR_AUTH_BY_SOMEONE_ELSE\",\n (type: \"email\", contactChannelValue?: string) => [\n 409,\n contactChannelValue ?\n `The ${type} (${contactChannelValue}) is already used for authentication by another account.` :\n `This ${type} is already used for authentication by another account.`,\n { type, contact_channel_value: contactChannelValue ?? null },\n ] as const,\n (json) => [json.type, json.contact_channel_value] as const,\n);\n\nconst InvalidPollingCodeError = createKnownErrorConstructor(\n KnownError,\n \"INVALID_POLLING_CODE\",\n (details?: Json) => [\n 400,\n \"The polling code is invalid or does not exist.\",\n details,\n ] as const,\n (json: any) => [json] as const,\n);\n\nconst CliAuthError = createKnownErrorConstructor(\n KnownError,\n \"CLI_AUTH_ERROR\",\n (message: string) => [\n 400,\n message,\n ] as const,\n (json: any) => [json.message] as const,\n);\n\nconst CliAuthExpiredError = createKnownErrorConstructor(\n KnownError,\n \"CLI_AUTH_EXPIRED_ERROR\",\n (message: string = \"CLI authentication request expired. Please try again.\") => [\n 400,\n message,\n ] as const,\n (json: any) => [json.message] as const,\n);\n\nconst CliAuthUsedError = createKnownErrorConstructor(\n KnownError,\n \"CLI_AUTH_USED_ERROR\",\n (message: string = \"This authentication token has already been used.\") => [\n 400,\n message,\n ] as const,\n (json: any) => [json.message] as const,\n);\n\n\nconst ApiKeyNotValid = createKnownErrorConstructor(\n KnownError,\n \"API_KEY_NOT_VALID\",\n \"inherit\",\n \"inherit\",\n);\n\nconst ApiKeyExpired = createKnownErrorConstructor(\n ApiKeyNotValid,\n \"API_KEY_EXPIRED\",\n () => [\n 401,\n \"API key has expired.\",\n ] as const,\n () => [] as const,\n);\n\nconst ApiKeyRevoked = createKnownErrorConstructor(\n ApiKeyNotValid,\n \"API_KEY_REVOKED\",\n () => [\n 401,\n \"API key has been revoked.\",\n ] as const,\n () => [] as const,\n);\n\nconst WrongApiKeyType = createKnownErrorConstructor(\n ApiKeyNotValid,\n \"WRONG_API_KEY_TYPE\",\n (expectedType: string, actualType: string) => [\n 400,\n `This endpoint is for ${expectedType} API keys, but a ${actualType} API key was provided.`,\n { expected_type: expectedType, actual_type: actualType },\n ] as const,\n (json) => [json.expected_type, json.actual_type] as const,\n);\n\nconst ApiKeyNotFound = createKnownErrorConstructor(\n ApiKeyNotValid,\n \"API_KEY_NOT_FOUND\",\n () => [\n 404,\n \"API key not found.\",\n ] as const,\n () => [] as const,\n);\n\nconst PublicApiKeyCannotBeRevoked = createKnownErrorConstructor(\n ApiKeyNotValid,\n \"PUBLIC_API_KEY_CANNOT_BE_REVOKED\",\n () => [\n 400,\n \"Public API keys cannot be revoked by the secretscanner endpoint.\",\n ] as const,\n () => [] as const,\n);\n\nconst PermissionIdAlreadyExists = createKnownErrorConstructor(\n KnownError,\n \"PERMISSION_ID_ALREADY_EXISTS\",\n (permissionId: string) => [\n 400,\n `Permission with ID \"${permissionId}\" already exists. Choose a different ID.`,\n {\n permission_id: permissionId,\n },\n ] as const,\n (json: any) => [json.permission_id] as const,\n);\n\nexport type KnownErrors = {\n [K in keyof typeof KnownErrors]: InstanceType<typeof KnownErrors[K]>;\n};\n\nexport const KnownErrors = {\n CannotDeleteCurrentSession,\n UnsupportedError,\n BodyParsingError,\n SchemaError,\n AllOverloadsFailed,\n ProjectAuthenticationError,\n PermissionIdAlreadyExists,\n CliAuthError,\n CliAuthExpiredError,\n CliAuthUsedError,\n InvalidProjectAuthentication,\n ProjectKeyWithoutAccessType,\n InvalidAccessType,\n AccessTypeWithoutProjectId,\n AccessTypeRequired,\n CannotGetOwnUserWithoutUser,\n InsufficientAccessType,\n InvalidPublishableClientKey,\n InvalidSecretServerKey,\n InvalidSuperSecretAdminKey,\n InvalidAdminAccessToken,\n UnparsableAdminAccessToken,\n AdminAccessTokenExpired,\n InvalidProjectForAdminAccessToken,\n AdminAccessTokenIsNotAdmin,\n ProjectAuthenticationRequired,\n ClientAuthenticationRequired,\n ServerAuthenticationRequired,\n ClientOrServerAuthenticationRequired,\n ClientOrAdminAuthenticationRequired,\n ClientOrServerOrAdminAuthenticationRequired,\n AdminAuthenticationRequired,\n ExpectedInternalProject,\n SessionAuthenticationError,\n InvalidSessionAuthentication,\n InvalidAccessToken,\n UnparsableAccessToken,\n AccessTokenExpired,\n InvalidProjectForAccessToken,\n RefreshTokenError,\n ProviderRejected,\n RefreshTokenNotFoundOrExpired,\n UserWithEmailAlreadyExists,\n EmailNotVerified,\n UserIdDoesNotExist,\n UserNotFound,\n ApiKeyNotFound,\n PublicApiKeyCannotBeRevoked,\n ProjectNotFound,\n SignUpNotEnabled,\n PasswordAuthenticationNotEnabled,\n PasskeyAuthenticationNotEnabled,\n AnonymousAccountsNotEnabled,\n EmailPasswordMismatch,\n RedirectUrlNotWhitelisted,\n PasswordRequirementsNotMet,\n PasswordTooShort,\n PasswordTooLong,\n UserDoesNotHavePassword,\n VerificationCodeError,\n VerificationCodeNotFound,\n VerificationCodeExpired,\n VerificationCodeAlreadyUsed,\n VerificationCodeMaxAttemptsReached,\n PasswordConfirmationMismatch,\n EmailAlreadyVerified,\n EmailNotAssociatedWithUser,\n EmailIsNotPrimaryEmail,\n PasskeyRegistrationFailed,\n PasskeyWebAuthnError,\n PasskeyAuthenticationFailed,\n PermissionNotFound,\n PermissionScopeMismatch,\n ContainedPermissionNotFound,\n TeamNotFound,\n TeamMembershipNotFound,\n EmailTemplateAlreadyExists,\n OAuthConnectionNotConnectedToUser,\n OAuthConnectionAlreadyConnectedToAnotherUser,\n OAuthConnectionDoesNotHaveRequiredScope,\n OAuthExtraScopeNotAvailableWithSharedOAuthKeys,\n OAuthAccessTokenNotAvailableWithSharedOAuthKeys,\n InvalidOAuthClientIdOrSecret,\n InvalidScope,\n UserAlreadyConnectedToAnotherOAuthConnection,\n OuterOAuthTimeout,\n OAuthProviderNotFoundOrNotEnabled,\n MultiFactorAuthenticationRequired,\n InvalidTotpCode,\n UserAuthenticationRequired,\n TeamMembershipAlreadyExists,\n ProjectPermissionRequired,\n TeamPermissionRequired,\n InvalidSharedOAuthProviderId,\n InvalidStandardOAuthProviderId,\n InvalidAuthorizationCode,\n TeamPermissionNotFound,\n OAuthProviderAccessDenied,\n ContactChannelAlreadyUsedForAuthBySomeoneElse,\n InvalidPollingCodeError,\n ApiKeyNotValid,\n ApiKeyExpired,\n ApiKeyRevoked,\n WrongApiKeyType,\n} satisfies Record<string, KnownErrorConstructor<any, any>>;\n\n\n// ensure that all known error codes are unique\nconst knownErrorCodes = new Set<string>();\nfor (const [_, KnownError] of Object.entries(KnownErrors)) {\n if (knownErrorCodes.has(KnownError.errorCode)) {\n throw new Error(`Duplicate known error code: ${KnownError.errorCode}`);\n }\n knownErrorCodes.add(KnownError.errorCode);\n}\n"],"mappings":";AAAA,SAAS,qBAAqB,aAAa,gBAAgB;AAC3D,SAAS,oBAAoB;AAE7B,SAAS,gBAAgB;AAoBlB,IAAe,aAAf,cAAkC,YAAY;A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KnownError"]}
@@ -0,0 +1,484 @@
1
+ // src/schema-fields.ts
2
+ import * as yup from "yup";
3
+ import { KnownErrors } from ".";
4
+ import { isBase64 } from "./utils/bytes";
5
+ import { StackAssertionError, throwErr } from "./utils/errors";
6
+ import { decodeBasicAuthorizationHeader } from "./utils/http";
7
+ import { allProviders } from "./utils/oauth";
8
+ import { deepPlainClone, omit } from "./utils/objects";
9
+ import { isValidUrl } from "./utils/urls";
10
+ import { isUuid } from "./utils/uuids";
11
+ yup.addMethod(yup.string, "nonEmpty", function(message) {
12
+ return this.test(
13
+ "non-empty",
14
+ message ?? (({ path }) => `${path} must not be empty`),
15
+ (value) => {
16
+ return value !== "";
17
+ }
18
+ );
19
+ });
20
+ yup.addMethod(yup.Schema, "getNested", function(path) {
21
+ if (!path.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)) throw new StackAssertionError(`yupSchema.getNested can currently only be used with alphanumeric keys. Fix this in the future. Provided key: ${path}`);
22
+ return yup.reach(this, path);
23
+ });
24
+ async function yupValidate(schema, obj, options) {
25
+ try {
26
+ return await schema.validate(obj, {
27
+ ...omit(options ?? {}, ["currentUserId"]),
28
+ context: {
29
+ ...options?.context,
30
+ stackAllowUserIdMe: options?.currentUserId !== void 0
31
+ }
32
+ });
33
+ } catch (error) {
34
+ if (error instanceof ReplaceFieldWithOwnUserId) {
35
+ const currentUserId = options?.currentUserId;
36
+ if (!currentUserId) throw new KnownErrors.CannotGetOwnUserWithoutUser();
37
+ let pathRemaining = error.path;
38
+ const fieldPath = [];
39
+ while (pathRemaining.length > 0) {
40
+ if (pathRemaining.startsWith("[")) {
41
+ const index = pathRemaining.indexOf("]");
42
+ if (index < 0) throw new StackAssertionError("Invalid path");
43
+ fieldPath.push(JSON.parse(pathRemaining.slice(1, index)));
44
+ pathRemaining = pathRemaining.slice(index + 1);
45
+ } else {
46
+ let dotIndex = pathRemaining.indexOf(".");
47
+ if (dotIndex === -1) dotIndex = pathRemaining.length;
48
+ fieldPath.push(pathRemaining.slice(0, dotIndex));
49
+ pathRemaining = pathRemaining.slice(dotIndex + 1);
50
+ }
51
+ }
52
+ const newObj = deepPlainClone(obj);
53
+ let it = newObj;
54
+ for (const field of fieldPath.slice(0, -1)) {
55
+ if (!Object.prototype.hasOwnProperty.call(it, field)) {
56
+ throw new StackAssertionError(`Segment ${field} of path ${error.path} not found in object`);
57
+ }
58
+ it = it[field];
59
+ }
60
+ it[fieldPath[fieldPath.length - 1]] = currentUserId;
61
+ return await yupValidate(schema, newObj, options);
62
+ }
63
+ throw error;
64
+ }
65
+ }
66
+ var _idDescription = (identify) => `The unique identifier of the ${identify}`;
67
+ var _displayNameDescription = (identify) => `Human-readable ${identify} display name. This is not a unique identifier.`;
68
+ var _clientMetaDataDescription = (identify) => `Client metadata. Used as a data store, accessible from the client side. Do not store information that should not be exposed to the client.`;
69
+ var _clientReadOnlyMetaDataDescription = (identify) => `Client read-only, server-writable metadata. Used as a data store, accessible from the client side. Do not store information that should not be exposed to the client. The client can read this data, but cannot modify it. This is useful for things like subscription status.`;
70
+ var _profileImageUrlDescription = (identify) => `URL of the profile image for ${identify}. Can be a Base64 encoded image. Must be smaller than 100KB. Please compress and crop to a square before passing in.`;
71
+ var _serverMetaDataDescription = (identify) => `Server metadata. Used as a data store, only accessible from the server side. You can store secret information related to the ${identify} here.`;
72
+ var _atMillisDescription = (identify) => `(the number of milliseconds since epoch, January 1, 1970, UTC)`;
73
+ var _createdAtMillisDescription = (identify) => `The time the ${identify} was created ${_atMillisDescription(identify)}`;
74
+ var _signedUpAtMillisDescription = `The time the user signed up ${_atMillisDescription}`;
75
+ var _lastActiveAtMillisDescription = `The time the user was last active ${_atMillisDescription}`;
76
+ function yupString(...args) {
77
+ return yup.string(...args);
78
+ }
79
+ function yupNumber(...args) {
80
+ return yup.number(...args);
81
+ }
82
+ function yupBoolean(...args) {
83
+ return yup.boolean(...args);
84
+ }
85
+ function yupDate(...args) {
86
+ return yup.date(...args);
87
+ }
88
+ function yupMixed(...args) {
89
+ return yup.mixed(...args);
90
+ }
91
+ function yupArray(...args) {
92
+ return yup.array(...args);
93
+ }
94
+ function yupTuple(...args) {
95
+ return yup.tuple(...args);
96
+ }
97
+ function yupObject(...args) {
98
+ const object2 = yup.object(...args).test(
99
+ "no-unknown-object-properties",
100
+ ({ path }) => `${path} contains unknown properties`,
101
+ (value, context) => {
102
+ if (context.options.context?.noUnknownPathPrefixes?.some((prefix) => context.path.startsWith(prefix))) {
103
+ if (context.schema.spec.noUnknown !== false) {
104
+ const availableKeys = new Set(Object.keys(context.schema.fields));
105
+ const unknownKeys = Object.keys(value ?? {}).filter((key) => !availableKeys.has(key));
106
+ if (unknownKeys.length > 0) {
107
+ return context.createError({
108
+ message: `${context.path || "Object"} contains unknown properties: ${unknownKeys.join(", ")}`,
109
+ path: context.path,
110
+ params: { unknownKeys, availableKeys }
111
+ });
112
+ }
113
+ }
114
+ }
115
+ return true;
116
+ }
117
+ );
118
+ return object2.default(void 0);
119
+ }
120
+ function yupNever() {
121
+ return yupMixed().test("never", "This value should never be reached", () => false);
122
+ }
123
+ function yupUnion(...args) {
124
+ if (args.length === 0) throw new Error("yupUnion must have at least one schema");
125
+ const [first] = args;
126
+ const firstDesc = first.describe();
127
+ for (const schema of args) {
128
+ const desc = schema.describe();
129
+ if (desc.type !== firstDesc.type) throw new StackAssertionError(`yupUnion must have schemas of the same type (got: ${firstDesc.type} and ${desc.type})`, { first, schema, firstDesc, desc });
130
+ }
131
+ return yupMixed().test("is-one-of", "Invalid value", async (value, context) => {
132
+ const errors = [];
133
+ for (const schema of args) {
134
+ try {
135
+ await yupValidate(schema, value, context.options);
136
+ return true;
137
+ } catch (e) {
138
+ errors.push(e);
139
+ }
140
+ }
141
+ return context.createError({
142
+ message: `${context.path} is not matched by any of the provided schemas:
143
+ ${errors.map((e, i) => " Schema " + i + ": \n " + e.errors.join("\n ")).join("\n")}`,
144
+ path: context.path
145
+ });
146
+ });
147
+ }
148
+ function yupRecord(keySchema, valueSchema) {
149
+ return yupObject().unknown(true).test(
150
+ "record",
151
+ "${path} must be a record of valid values",
152
+ async function(value, context) {
153
+ if (value == null) return true;
154
+ const { path, createError } = this;
155
+ if (typeof value !== "object") {
156
+ return createError({ message: `${path} must be an object` });
157
+ }
158
+ for (const key of Object.keys(value)) {
159
+ await yupValidate(keySchema, key, context.options);
160
+ try {
161
+ await yupValidate(valueSchema, value[key], {
162
+ ...context.options,
163
+ context: {
164
+ ...context.options.context,
165
+ path: path ? `${path}.${key}` : key
166
+ }
167
+ });
168
+ } catch (e) {
169
+ return createError({
170
+ path: path ? `${path}.${key}` : key,
171
+ message: e.message
172
+ });
173
+ }
174
+ }
175
+ return true;
176
+ }
177
+ );
178
+ }
179
+ function ensureObjectSchema(schema) {
180
+ if (!(schema instanceof yup.ObjectSchema)) throw new StackAssertionError(`assertObjectSchema: schema is not an ObjectSchema: ${schema.describe().type}`);
181
+ return schema;
182
+ }
183
+ var adaptSchema = yupMixed();
184
+ var urlSchema = yupString().test({
185
+ name: "no-spaces",
186
+ message: (params) => `${params.path} contains spaces`,
187
+ test: (value) => value == null || !value.includes(" ")
188
+ }).test({
189
+ name: "url",
190
+ message: (params) => `${params.path} is not a valid URL`,
191
+ test: (value) => value == null || isValidUrl(value)
192
+ });
193
+ var jsonSchema = yupMixed().nullable().defined().transform((value) => JSON.parse(JSON.stringify(value)));
194
+ var jsonStringSchema = yupString().test("json", (params) => `${params.path} is not valid JSON`, (value) => {
195
+ if (value == null) return true;
196
+ try {
197
+ JSON.parse(value);
198
+ return true;
199
+ } catch (error) {
200
+ return false;
201
+ }
202
+ });
203
+ var jsonStringOrEmptySchema = yupString().test("json", (params) => `${params.path} is not valid JSON`, (value) => {
204
+ if (!value) return true;
205
+ try {
206
+ JSON.parse(value);
207
+ return true;
208
+ } catch (error) {
209
+ return false;
210
+ }
211
+ });
212
+ var base64Schema = yupString().test("is-base64", (params) => `${params.path} is not valid base64`, (value) => {
213
+ if (value == null) return true;
214
+ return isBase64(value);
215
+ });
216
+ var passwordSchema = yupString().max(70);
217
+ var strictEmailSchema = (message) => yupString().email(message).matches(/^[^.]+(\.[^.]+)*@.*\.[^.][^.]+$/, message);
218
+ var emailSchema = yupString().email();
219
+ var clientOrHigherAuthTypeSchema = yupString().oneOf(["client", "server", "admin"]).defined();
220
+ var serverOrHigherAuthTypeSchema = yupString().oneOf(["server", "admin"]).defined();
221
+ var adminAuthTypeSchema = yupString().oneOf(["admin"]).defined();
222
+ var projectIdSchema = yupString().test((v) => v === void 0 || v === "internal" || isUuid(v)).meta({ openapiField: { description: _idDescription("project"), exampleValue: "e0b52f4d-dece-408c-af49-d23061bb0f8d" } });
223
+ var projectDisplayNameSchema = yupString().meta({ openapiField: { description: _displayNameDescription("project"), exampleValue: "MyMusic" } });
224
+ var projectDescriptionSchema = yupString().nullable().meta({ openapiField: { description: "A human readable description of the project", exampleValue: "A music streaming service" } });
225
+ var projectCreatedAtMillisSchema = yupNumber().meta({ openapiField: { description: _createdAtMillisDescription("project"), exampleValue: 163e10 } });
226
+ var projectUserCountSchema = yupNumber().meta({ openapiField: { description: "The number of users in this project", exampleValue: 10 } });
227
+ var projectIsProductionModeSchema = yupBoolean().meta({ openapiField: { description: "Whether the project is in production mode", exampleValue: true } });
228
+ var projectConfigIdSchema = yupString().meta({ openapiField: { description: _idDescription("project config"), exampleValue: "d09201f0-54f5-40bd-89ff-6d1815ddad24" } });
229
+ var projectAllowLocalhostSchema = yupBoolean().meta({ openapiField: { description: "Whether localhost is allowed as a domain for this project. Should only be allowed in development mode", exampleValue: true } });
230
+ var projectCreateTeamOnSignUpSchema = yupBoolean().meta({ openapiField: { description: "Whether a team should be created for each user that signs up", exampleValue: true } });
231
+ var projectMagicLinkEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether magic link authentication is enabled for this project", exampleValue: true } });
232
+ var projectPasskeyEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether passkey authentication is enabled for this project", exampleValue: true } });
233
+ var projectClientTeamCreationEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether client users can create teams", exampleValue: true } });
234
+ var projectClientUserDeletionEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether client users can delete their own account from the client", exampleValue: true } });
235
+ var projectSignUpEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether users can sign up new accounts, or whether they are only allowed to sign in to existing accounts. Regardless of this option, the server API can always create new users with the `POST /users` endpoint.", exampleValue: true } });
236
+ var projectCredentialEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether email password authentication is enabled for this project", exampleValue: true } });
237
+ var oauthIdSchema = yupString().oneOf(allProviders).meta({ openapiField: { description: `OAuth provider ID, one of ${allProviders.map((x) => `\`${x}\``).join(", ")}`, exampleValue: "google" } });
238
+ var oauthEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether the OAuth provider is enabled. If an provider is first enabled, then disabled, it will be shown in the list but with enabled=false", exampleValue: true } });
239
+ var oauthTypeSchema = yupString().oneOf(["shared", "standard"]).meta({ openapiField: { description: 'OAuth provider type, one of shared, standard. "shared" uses Stack shared OAuth keys and it is only meant for development. "standard" uses your own OAuth keys and will show your logo and company name when signing in with the provider.', exampleValue: "standard" } });
240
+ var oauthClientIdSchema = yupString().meta({ openapiField: { description: 'OAuth client ID. Needs to be specified when using type="standard"', exampleValue: "google-oauth-client-id" } });
241
+ var oauthClientSecretSchema = yupString().meta({ openapiField: { description: 'OAuth client secret. Needs to be specified when using type="standard"', exampleValue: "google-oauth-client-secret" } });
242
+ var oauthFacebookConfigIdSchema = yupString().meta({ openapiField: { description: "The configuration id for Facebook business login (for things like ads and marketing). This is only required if you are using the standard OAuth with Facebook and you are using Facebook business login." } });
243
+ var oauthMicrosoftTenantIdSchema = yupString().meta({ openapiField: { description: "The Microsoft tenant id for Microsoft directory. This is only required if you are using the standard OAuth with Microsoft and you have an Azure AD tenant." } });
244
+ var oauthAccountMergeStrategySchema = yupString().oneOf(["link_method", "raise_error", "allow_duplicates"]).meta({ openapiField: { description: "Determines how to handle OAuth logins that match an existing user by email. `link_method` adds the OAuth method to the existing user. `raise_error` rejects the login with an error. `allow_duplicates` creates a new user.", exampleValue: "link_method" } });
245
+ var emailTypeSchema = yupString().oneOf(["shared", "standard"]).meta({ openapiField: { description: 'Email provider type, one of shared, standard. "shared" uses Stack shared email provider and it is only meant for development. "standard" uses your own email server and will have your email address as the sender.', exampleValue: "standard" } });
246
+ var emailSenderNameSchema = yupString().meta({ openapiField: { description: 'Email sender name. Needs to be specified when using type="standard"', exampleValue: "Stack" } });
247
+ var emailHostSchema = yupString().meta({ openapiField: { description: 'Email host. Needs to be specified when using type="standard"', exampleValue: "smtp.your-domain.com" } });
248
+ var emailPortSchema = yupNumber().min(0).max(65535).meta({ openapiField: { description: 'Email port. Needs to be specified when using type="standard"', exampleValue: 587 } });
249
+ var emailUsernameSchema = yupString().meta({ openapiField: { description: 'Email username. Needs to be specified when using type="standard"', exampleValue: "smtp-email" } });
250
+ var emailSenderEmailSchema = emailSchema.meta({ openapiField: { description: 'Email sender email. Needs to be specified when using type="standard"', exampleValue: "example@your-domain.com" } });
251
+ var emailPasswordSchema = passwordSchema.meta({ openapiField: { description: 'Email password. Needs to be specified when using type="standard"', exampleValue: "your-email-password" } });
252
+ var handlerPathSchema = yupString().test("is-handler-path", "Handler path must start with /", (value) => value?.startsWith("/")).meta({ openapiField: { description: 'Handler path. If you did not setup a custom handler path, it should be "/handler" by default. It needs to start with /', exampleValue: "/handler" } });
253
+ var ReplaceFieldWithOwnUserId = class extends Error {
254
+ constructor(path) {
255
+ super(`This error should be caught by whoever validated the schema, and the field in the path '${path}' should be replaced with the current user's id. This is a workaround to yup not providing access to the context inside the transform function.`);
256
+ this.path = path;
257
+ }
258
+ };
259
+ var userIdMeSentinelUuid = "cad564fd-f81b-43f4-b390-98abf3fcc17e";
260
+ var userIdOrMeSchema = yupString().uuid().transform((v) => {
261
+ if (v === "me") return userIdMeSentinelUuid;
262
+ else return v;
263
+ }).test((v, context) => {
264
+ if (!("stackAllowUserIdMe" in (context.options.context ?? {}))) throw new StackAssertionError("userIdOrMeSchema is not allowed in this context. Make sure you're using yupValidate from schema-fields.ts to validate, instead of schema.validate(...).");
265
+ if (!context.options.context?.stackAllowUserIdMe) throw new StackAssertionError("userIdOrMeSchema is not allowed in this context. Make sure you're passing in the currentUserId option in yupValidate.");
266
+ if (v === userIdMeSentinelUuid) throw new ReplaceFieldWithOwnUserId(context.path);
267
+ return true;
268
+ }).meta({ openapiField: { description: "The ID of the user, or the special value `me` for the currently authenticated user", exampleValue: "3241a285-8329-4d69-8f3d-316e08cf140c" } });
269
+ var userIdSchema = yupString().uuid().meta({ openapiField: { description: _idDescription("user"), exampleValue: "3241a285-8329-4d69-8f3d-316e08cf140c" } });
270
+ var primaryEmailSchema = emailSchema.meta({ openapiField: { description: "Primary email", exampleValue: "johndoe@example.com" } });
271
+ var primaryEmailAuthEnabledSchema = yupBoolean().meta({ openapiField: { description: "Whether the primary email is used for authentication. If this is set to `false`, the user will not be able to sign in with the primary email with password or OTP", exampleValue: true } });
272
+ var primaryEmailVerifiedSchema = yupBoolean().meta({ openapiField: { description: "Whether the primary email has been verified to belong to this user", exampleValue: true } });
273
+ var userDisplayNameSchema = yupString().nullable().meta({ openapiField: { description: _displayNameDescription("user"), exampleValue: "John Doe" } });
274
+ var selectedTeamIdSchema = yupString().uuid().meta({ openapiField: { description: "ID of the team currently selected by the user", exampleValue: "team-id" } });
275
+ var profileImageUrlSchema = urlSchema.max(1e6).meta({ openapiField: { description: _profileImageUrlDescription("user"), exampleValue: "https://example.com/image.jpg" } });
276
+ var signedUpAtMillisSchema = yupNumber().meta({ openapiField: { description: _signedUpAtMillisDescription, exampleValue: 163e10 } });
277
+ var userClientMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientMetaDataDescription("user"), exampleValue: { key: "value" } } });
278
+ var userClientReadOnlyMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientReadOnlyMetaDataDescription("user"), exampleValue: { key: "value" } } });
279
+ var userServerMetadataSchema = jsonSchema.meta({ openapiField: { description: _serverMetaDataDescription("user"), exampleValue: { key: "value" } } });
280
+ var userOAuthProviderSchema = yupObject({
281
+ id: yupString().defined(),
282
+ type: yupString().oneOf(allProviders).defined(),
283
+ provider_user_id: yupString().defined()
284
+ });
285
+ var userLastActiveAtMillisSchema = yupNumber().nullable().meta({ openapiField: { description: _lastActiveAtMillisDescription, exampleValue: 163e10 } });
286
+ var userPasskeyAuthEnabledSchema = yupBoolean().meta({ openapiField: { hidden: true, description: "Whether the user has passkeys enabled", exampleValue: false } });
287
+ var userOtpAuthEnabledSchema = yupBoolean().meta({ openapiField: { hidden: true, description: "Whether the user has OTP/magic link enabled. ", exampleValue: true } });
288
+ var userOtpAuthEnabledMutationSchema = yupBoolean().meta({ openapiField: { hidden: true, description: "Whether the user has OTP/magic link enabled. Note that only accounts with verified emails can sign-in with OTP.", exampleValue: true } });
289
+ var userHasPasswordSchema = yupBoolean().meta({ openapiField: { hidden: true, description: "Whether the user has a password set. If the user does not have a password set, they will not be able to sign in with email/password.", exampleValue: true } });
290
+ var userPasswordMutationSchema = passwordSchema.nullable().meta({ openapiField: { description: "Sets the user's password. Doing so revokes all current sessions.", exampleValue: "my-new-password" } }).max(70);
291
+ var userPasswordHashMutationSchema = yupString().nonEmpty().meta({ openapiField: { description: "If `password` is not given, sets the user's password hash to the given string in Modular Crypt Format (ex.: `$2a$10$VIhIOofSMqGdGlL4wzE//e.77dAQGqNtF/1dT7bqCrVtQuInWy2qi`). Doing so revokes all current sessions." } });
292
+ var userTotpSecretMutationSchema = base64Schema.nullable().meta({ openapiField: { description: "Enables 2FA and sets a TOTP secret for the user. Set to null to disable 2FA.", exampleValue: "dG90cC1zZWNyZXQ=" } });
293
+ var signInEmailSchema = strictEmailSchema(void 0).meta({ openapiField: { description: "The email to sign in with.", exampleValue: "johndoe@example.com" } });
294
+ var emailOtpSignInCallbackUrlSchema = urlSchema.meta({ openapiField: { description: "The base callback URL to construct the magic link from. A query parameter `code` with the verification code will be appended to it. The page should then make a request to the `/auth/otp/sign-in` endpoint.", exampleValue: "https://example.com/handler/magic-link-callback" } });
295
+ var emailVerificationCallbackUrlSchema = urlSchema.meta({ openapiField: { description: "The base callback URL to construct a verification link for the verification e-mail. A query parameter `code` with the verification code will be appended to it. The page should then make a request to the `/contact-channels/verify` endpoint.", exampleValue: "https://example.com/handler/email-verification" } });
296
+ var accessTokenResponseSchema = yupString().meta({ openapiField: { description: "Short-lived access token that can be used to authenticate the user", exampleValue: "eyJhmMiJB2TO...diI4QT" } });
297
+ var refreshTokenResponseSchema = yupString().meta({ openapiField: { description: "Long-lived refresh token that can be used to obtain a new access token", exampleValue: "i8ns3aq2...14y" } });
298
+ var signInResponseSchema = yupObject({
299
+ refresh_token: refreshTokenResponseSchema.defined(),
300
+ access_token: accessTokenResponseSchema.defined(),
301
+ is_new_user: yupBoolean().meta({ openapiField: { description: "Whether the user is a new user", exampleValue: true } }).defined(),
302
+ user_id: userIdSchema.defined()
303
+ });
304
+ var teamSystemPermissions = [
305
+ "$update_team",
306
+ "$delete_team",
307
+ "$read_members",
308
+ "$remove_members",
309
+ "$invite_members",
310
+ "$manage_api_keys"
311
+ ];
312
+ var permissionDefinitionIdSchema = yupString().matches(/^\$?[a-z0-9_:]+$/, 'Only lowercase letters, numbers, ":", "_" and optional "$" at the beginning are allowed').test("is-system-permission", "System permissions must start with a dollar sign", (value, ctx) => {
313
+ if (!value) return true;
314
+ if (value.startsWith("$") && !teamSystemPermissions.includes(value)) {
315
+ return ctx.createError({ message: "Invalid system permission" });
316
+ }
317
+ return true;
318
+ }).meta({ openapiField: { description: `The permission ID used to uniquely identify a permission. Can either be a custom permission with lowercase letters, numbers, \`:\`, and \`_\` characters, or one of the system permissions: ${teamSystemPermissions.map((x) => `\`${x}\``).join(", ")}`, exampleValue: "read_secret_info" } });
319
+ var customPermissionDefinitionIdSchema = yupString().matches(/^[a-z0-9_:]+$/, 'Only lowercase letters, numbers, ":", "_" are allowed').meta({ openapiField: { description: 'The permission ID used to uniquely identify a permission. Can only contain lowercase letters, numbers, ":", and "_" characters', exampleValue: "read_secret_info" } });
320
+ var teamPermissionDescriptionSchema = yupString().meta({ openapiField: { description: "A human-readable description of the permission", exampleValue: "Read secret information" } });
321
+ var containedPermissionIdsSchema = yupArray(permissionDefinitionIdSchema.defined()).meta({ openapiField: { description: "The IDs of the permissions that are contained in this permission", exampleValue: ["read_public_info"] } });
322
+ var teamIdSchema = yupString().uuid().meta({ openapiField: { description: _idDescription("team"), exampleValue: "ad962777-8244-496a-b6a2-e0c6a449c79e" } });
323
+ var teamDisplayNameSchema = yupString().meta({ openapiField: { description: _displayNameDescription("team"), exampleValue: "My Team" } });
324
+ var teamProfileImageUrlSchema = urlSchema.max(1e6).meta({ openapiField: { description: _profileImageUrlDescription("team"), exampleValue: "https://example.com/image.jpg" } });
325
+ var teamClientMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientMetaDataDescription("team"), exampleValue: { key: "value" } } });
326
+ var teamClientReadOnlyMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientReadOnlyMetaDataDescription("team"), exampleValue: { key: "value" } } });
327
+ var teamServerMetadataSchema = jsonSchema.meta({ openapiField: { description: _serverMetaDataDescription("team"), exampleValue: { key: "value" } } });
328
+ var teamCreatedAtMillisSchema = yupNumber().meta({ openapiField: { description: _createdAtMillisDescription("team"), exampleValue: 163e10 } });
329
+ var teamInvitationEmailSchema = emailSchema.meta({ openapiField: { description: "The email of the user to invite.", exampleValue: "johndoe@example.com" } });
330
+ var teamInvitationCallbackUrlSchema = urlSchema.meta({ openapiField: { description: "The base callback URL to construct an invite link with. A query parameter `code` with the verification code will be appended to it. The page should then make a request to the `/team-invitations/accept` endpoint.", exampleValue: "https://example.com/handler/team-invitation" } });
331
+ var teamCreatorUserIdSchema = userIdOrMeSchema.meta({ openapiField: { description: 'The ID of the creator of the team. If not specified, the user will not be added to the team. Can be either "me" or the ID of the user. Only used on the client side.', exampleValue: "me" } });
332
+ var teamMemberDisplayNameSchema = yupString().meta({ openapiField: { description: _displayNameDescription("team member") + " Note that this is separate from the display_name of the user.", exampleValue: "John Doe" } });
333
+ var teamMemberProfileImageUrlSchema = urlSchema.max(1e6).meta({ openapiField: { description: _profileImageUrlDescription("team member"), exampleValue: "https://example.com/image.jpg" } });
334
+ var contactChannelIdSchema = yupString().uuid().meta({ openapiField: { description: _idDescription("contact channel"), exampleValue: "b3d396b8-c574-4c80-97b3-50031675ceb2" } });
335
+ var contactChannelTypeSchema = yupString().oneOf(["email"]).meta({ openapiField: { description: `The type of the contact channel. Currently only "email" is supported.`, exampleValue: "email" } });
336
+ var contactChannelValueSchema = yupString().when("type", {
337
+ is: "email",
338
+ then: (schema) => schema.email()
339
+ }).meta({ openapiField: { description: "The value of the contact channel. For email, this should be a valid email address.", exampleValue: "johndoe@example.com" } });
340
+ var contactChannelUsedForAuthSchema = yupBoolean().meta({ openapiField: { description: "Whether the contact channel is used for authentication. If this is set to `true`, the user will be able to sign in with the contact channel with password or OTP.", exampleValue: true } });
341
+ var contactChannelIsVerifiedSchema = yupBoolean().meta({ openapiField: { description: "Whether the contact channel has been verified. If this is set to `true`, the contact channel has been verified to belong to the user.", exampleValue: true } });
342
+ var contactChannelIsPrimarySchema = yupBoolean().meta({ openapiField: { description: "Whether the contact channel is the primary contact channel. If this is set to `true`, it will be used for authentication and notifications by default.", exampleValue: true } });
343
+ var basicAuthorizationHeaderSchema = yupString().test("is-basic-authorization-header", 'Authorization header must be in the format "Basic <base64>"', (value) => {
344
+ if (!value) return true;
345
+ return decodeBasicAuthorizationHeader(value) !== null;
346
+ });
347
+ var neonAuthorizationHeaderSchema = basicAuthorizationHeaderSchema.test("is-neon-authorization-header", "Invalid client_id:client_secret values; did you use the correct values for the Neon integration?", (value) => {
348
+ if (!value) return true;
349
+ const [clientId, clientSecret] = decodeBasicAuthorizationHeader(value) ?? throwErr(`Neon authz header invalid? This should've been validated by basicAuthorizationHeaderSchema: ${value}`);
350
+ for (const neonClientConfig of JSON.parse(process.env.STACK_NEON_INTEGRATION_CLIENTS_CONFIG || "[]")) {
351
+ if (clientId === neonClientConfig.client_id && clientSecret === neonClientConfig.client_secret) return true;
352
+ }
353
+ return false;
354
+ });
355
+ function yupDefinedWhen(schema, triggers) {
356
+ const entries = Object.entries(triggers);
357
+ return schema.when(entries.map(([key]) => key), {
358
+ is: (...values) => entries.every(([key, value], index) => value === values[index]),
359
+ then: (schema2) => schema2.defined(),
360
+ otherwise: (schema2) => schema2.optional()
361
+ });
362
+ }
363
+ function yupDefinedAndNonEmptyWhen(schema, triggers) {
364
+ const entries = Object.entries(triggers);
365
+ return schema.when(entries.map(([key]) => key), {
366
+ is: (...values) => entries.every(([key, value], index) => value === values[index]),
367
+ then: (schema2) => schema2.defined().nonEmpty(),
368
+ otherwise: (schema2) => schema2.optional()
369
+ });
370
+ }
371
+ export {
372
+ ReplaceFieldWithOwnUserId,
373
+ accessTokenResponseSchema,
374
+ adaptSchema,
375
+ adminAuthTypeSchema,
376
+ base64Schema,
377
+ basicAuthorizationHeaderSchema,
378
+ clientOrHigherAuthTypeSchema,
379
+ contactChannelIdSchema,
380
+ contactChannelIsPrimarySchema,
381
+ contactChannelIsVerifiedSchema,
382
+ contactChannelTypeSchema,
383
+ contactChannelUsedForAuthSchema,
384
+ contactChannelValueSchema,
385
+ containedPermissionIdsSchema,
386
+ customPermissionDefinitionIdSchema,
387
+ emailHostSchema,
388
+ emailOtpSignInCallbackUrlSchema,
389
+ emailPasswordSchema,
390
+ emailPortSchema,
391
+ emailSchema,
392
+ emailSenderEmailSchema,
393
+ emailSenderNameSchema,
394
+ emailTypeSchema,
395
+ emailUsernameSchema,
396
+ emailVerificationCallbackUrlSchema,
397
+ ensureObjectSchema,
398
+ handlerPathSchema,
399
+ jsonSchema,
400
+ jsonStringOrEmptySchema,
401
+ jsonStringSchema,
402
+ neonAuthorizationHeaderSchema,
403
+ oauthAccountMergeStrategySchema,
404
+ oauthClientIdSchema,
405
+ oauthClientSecretSchema,
406
+ oauthEnabledSchema,
407
+ oauthFacebookConfigIdSchema,
408
+ oauthIdSchema,
409
+ oauthMicrosoftTenantIdSchema,
410
+ oauthTypeSchema,
411
+ passwordSchema,
412
+ permissionDefinitionIdSchema,
413
+ primaryEmailAuthEnabledSchema,
414
+ primaryEmailSchema,
415
+ primaryEmailVerifiedSchema,
416
+ profileImageUrlSchema,
417
+ projectAllowLocalhostSchema,
418
+ projectClientTeamCreationEnabledSchema,
419
+ projectClientUserDeletionEnabledSchema,
420
+ projectConfigIdSchema,
421
+ projectCreateTeamOnSignUpSchema,
422
+ projectCreatedAtMillisSchema,
423
+ projectCredentialEnabledSchema,
424
+ projectDescriptionSchema,
425
+ projectDisplayNameSchema,
426
+ projectIdSchema,
427
+ projectIsProductionModeSchema,
428
+ projectMagicLinkEnabledSchema,
429
+ projectPasskeyEnabledSchema,
430
+ projectSignUpEnabledSchema,
431
+ projectUserCountSchema,
432
+ refreshTokenResponseSchema,
433
+ selectedTeamIdSchema,
434
+ serverOrHigherAuthTypeSchema,
435
+ signInEmailSchema,
436
+ signInResponseSchema,
437
+ signedUpAtMillisSchema,
438
+ strictEmailSchema,
439
+ teamClientMetadataSchema,
440
+ teamClientReadOnlyMetadataSchema,
441
+ teamCreatedAtMillisSchema,
442
+ teamCreatorUserIdSchema,
443
+ teamDisplayNameSchema,
444
+ teamIdSchema,
445
+ teamInvitationCallbackUrlSchema,
446
+ teamInvitationEmailSchema,
447
+ teamMemberDisplayNameSchema,
448
+ teamMemberProfileImageUrlSchema,
449
+ teamPermissionDescriptionSchema,
450
+ teamProfileImageUrlSchema,
451
+ teamServerMetadataSchema,
452
+ teamSystemPermissions,
453
+ urlSchema,
454
+ userClientMetadataSchema,
455
+ userClientReadOnlyMetadataSchema,
456
+ userDisplayNameSchema,
457
+ userHasPasswordSchema,
458
+ userIdOrMeSchema,
459
+ userIdSchema,
460
+ userLastActiveAtMillisSchema,
461
+ userOAuthProviderSchema,
462
+ userOtpAuthEnabledMutationSchema,
463
+ userOtpAuthEnabledSchema,
464
+ userPasskeyAuthEnabledSchema,
465
+ userPasswordHashMutationSchema,
466
+ userPasswordMutationSchema,
467
+ userServerMetadataSchema,
468
+ userTotpSecretMutationSchema,
469
+ yupArray,
470
+ yupBoolean,
471
+ yupDate,
472
+ yupDefinedAndNonEmptyWhen,
473
+ yupDefinedWhen,
474
+ yupMixed,
475
+ yupNever,
476
+ yupNumber,
477
+ yupObject,
478
+ yupRecord,
479
+ yupString,
480
+ yupTuple,
481
+ yupUnion,
482
+ yupValidate
483
+ };
484
+ //# sourceMappingURL=schema-fields.js.map