@stackframe/stack-shared 2.8.8 → 2.8.10

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 +8 -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 +724 -0
  7. package/dist/config/schema.d.ts +51 -48
  8. package/dist/config/schema.js +230 -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 +199 -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 +188 -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 +1223 -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 +153 -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 +294 -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 +18 -10
  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 +640 -0
  245. package/dist/interface/crud/projects.d.ts +36 -31
  246. package/dist/interface/crud/projects.js +218 -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 +444 -0
  293. package/dist/known-errors.d.ts +12 -9
  294. package/dist/known-errors.js +1088 -561
  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 +65 -0
  421. package/dist/utils/objects.d.ts +31 -30
  422. package/dist/utils/objects.js +196 -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 +299 -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
@@ -1,722 +1,1249 @@
1
- import { StackAssertionError, StatusError, throwErr } from "./utils/errors";
2
- import { identityArgs } from "./utils/functions";
3
- import { deindent } from "./utils/strings";
4
- export class KnownError extends StatusError {
5
- constructor(statusCode, humanReadableMessage, details) {
6
- super(statusCode, humanReadableMessage);
7
- this.statusCode = statusCode;
8
- this.humanReadableMessage = humanReadableMessage;
9
- this.details = details;
10
- this.name = "KnownError";
11
- }
12
- getBody() {
13
- return new TextEncoder().encode(JSON.stringify(this.toDescriptiveJson(), undefined, 2));
14
- }
15
- getHeaders() {
16
- return {
17
- "Content-Type": ["application/json; charset=utf-8"],
18
- "X-Stack-Known-Error": [this.errorCode],
19
- };
20
- }
21
- toDescriptiveJson() {
22
- return {
23
- code: this.errorCode,
24
- ...this.details ? { details: this.details } : {},
25
- error: this.humanReadableMessage,
26
- };
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/known-errors.tsx
21
+ var known_errors_exports = {};
22
+ __export(known_errors_exports, {
23
+ KnownError: () => KnownError,
24
+ KnownErrors: () => KnownErrors
25
+ });
26
+ module.exports = __toCommonJS(known_errors_exports);
27
+ var import_errors = require("./utils/errors");
28
+ var import_functions = require("./utils/functions");
29
+ var import_strings = require("./utils/strings");
30
+ var KnownError = class extends import_errors.StatusError {
31
+ constructor(statusCode, humanReadableMessage, details) {
32
+ super(
33
+ statusCode,
34
+ humanReadableMessage
35
+ );
36
+ this.statusCode = statusCode;
37
+ this.humanReadableMessage = humanReadableMessage;
38
+ this.details = details;
39
+ this.name = "KnownError";
40
+ }
41
+ getBody() {
42
+ return new TextEncoder().encode(JSON.stringify(this.toDescriptiveJson(), void 0, 2));
43
+ }
44
+ getHeaders() {
45
+ return {
46
+ "Content-Type": ["application/json; charset=utf-8"],
47
+ "X-Stack-Known-Error": [this.errorCode]
48
+ };
49
+ }
50
+ toDescriptiveJson() {
51
+ return {
52
+ code: this.errorCode,
53
+ ...this.details ? { details: this.details } : {},
54
+ error: this.humanReadableMessage
55
+ };
56
+ }
57
+ get errorCode() {
58
+ return this.constructor.errorCode ?? (0, import_errors.throwErr)(`Can't find error code for this KnownError. Is its constructor a KnownErrorConstructor? ${this}`);
59
+ }
60
+ static constructorArgsFromJson(json) {
61
+ return [
62
+ 400,
63
+ json.message,
64
+ json
65
+ ];
66
+ }
67
+ static fromJson(json) {
68
+ for (const [_, KnownErrorType] of Object.entries(KnownErrors)) {
69
+ if (json.code === KnownErrorType.prototype.errorCode) {
70
+ const constructorArgs = KnownErrorType.constructorArgsFromJson(json);
71
+ return new KnownErrorType(
72
+ ...constructorArgs
73
+ );
74
+ }
27
75
  }
28
- get errorCode() {
29
- return this.constructor.errorCode ?? throwErr(`Can't find error code for this KnownError. Is its constructor a KnownErrorConstructor? ${this}`);
76
+ throw new Error(`Unknown KnownError code. You may need to update your version of Stack to see more detailed information. ${json.code}: ${json.message}`);
77
+ }
78
+ };
79
+ var knownErrorConstructorErrorCodeSentinel = Symbol("knownErrorConstructorErrorCodeSentinel");
80
+ function createKnownErrorConstructor(SuperClass, errorCode, create, constructorArgsFromJson) {
81
+ const createFn = create === "inherit" ? import_functions.identityArgs : create;
82
+ const constructorArgsFromJsonFn = constructorArgsFromJson === "inherit" ? SuperClass.constructorArgsFromJson : constructorArgsFromJson;
83
+ class KnownErrorImpl extends SuperClass {
84
+ constructor(...args) {
85
+ super(...createFn(...args));
86
+ this.name = `KnownError<${errorCode}>`;
87
+ this.constructorArgs = args;
30
88
  }
31
89
  static constructorArgsFromJson(json) {
32
- return [
33
- 400,
34
- json.message,
35
- json,
36
- ];
37
- }
38
- static fromJson(json) {
39
- for (const [_, KnownErrorType] of Object.entries(KnownErrors)) {
40
- if (json.code === KnownErrorType.prototype.errorCode) {
41
- const constructorArgs = KnownErrorType.constructorArgsFromJson(json);
42
- return new KnownErrorType(
43
- // @ts-expect-error
44
- ...constructorArgs);
45
- }
46
- }
47
- throw new Error(`Unknown KnownError code. You may need to update your version of Stack to see more detailed information. ${json.code}: ${json.message}`);
90
+ return constructorArgsFromJsonFn(json.details);
48
91
  }
92
+ }
93
+ KnownErrorImpl.errorCode = errorCode;
94
+ ;
95
+ return KnownErrorImpl;
49
96
  }
50
- const knownErrorConstructorErrorCodeSentinel = Symbol("knownErrorConstructorErrorCodeSentinel");
51
- function createKnownErrorConstructor(SuperClass, errorCode, create, constructorArgsFromJson) {
52
- const createFn = create === "inherit" ? identityArgs : create;
53
- const constructorArgsFromJsonFn = constructorArgsFromJson === "inherit" ? SuperClass.constructorArgsFromJson : constructorArgsFromJson;
54
- // @ts-expect-error this is not a mixin, but TS detects it as one
55
- class KnownErrorImpl extends SuperClass {
56
- constructor(...args) {
57
- // @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
58
- super(...createFn(...args));
59
- this.name = `KnownError<${errorCode}>`;
60
- this.constructorArgs = args;
61
- }
62
- static constructorArgsFromJson(json) {
63
- return constructorArgsFromJsonFn(json.details);
64
- }
65
- }
66
- KnownErrorImpl.errorCode = errorCode;
67
- ;
68
- // @ts-expect-error
69
- return KnownErrorImpl;
70
- }
71
- const UnsupportedError = createKnownErrorConstructor(KnownError, "UNSUPPORTED_ERROR", (originalErrorCode) => [
97
+ var UnsupportedError = createKnownErrorConstructor(
98
+ KnownError,
99
+ "UNSUPPORTED_ERROR",
100
+ (originalErrorCode) => [
72
101
  500,
73
102
  `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}`,
74
103
  {
75
- originalErrorCode,
76
- },
77
- ], (json) => [
78
- json?.originalErrorCode ?? throwErr("originalErrorCode not found in UnsupportedError details"),
79
- ]);
80
- const BodyParsingError = createKnownErrorConstructor(KnownError, "BODY_PARSING_ERROR", (message) => [
104
+ originalErrorCode
105
+ }
106
+ ],
107
+ (json) => [
108
+ json?.originalErrorCode ?? (0, import_errors.throwErr)("originalErrorCode not found in UnsupportedError details")
109
+ ]
110
+ );
111
+ var BodyParsingError = createKnownErrorConstructor(
112
+ KnownError,
113
+ "BODY_PARSING_ERROR",
114
+ (message) => [
81
115
  400,
82
- message,
83
- ], (json) => [json.message]);
84
- const SchemaError = createKnownErrorConstructor(KnownError, "SCHEMA_ERROR", (message) => [
116
+ message
117
+ ],
118
+ (json) => [json.message]
119
+ );
120
+ var SchemaError = createKnownErrorConstructor(
121
+ KnownError,
122
+ "SCHEMA_ERROR",
123
+ (message) => [
85
124
  400,
86
- message || throwErr("SchemaError requires a message"),
125
+ message || (0, import_errors.throwErr)("SchemaError requires a message"),
87
126
  {
88
- message,
89
- },
90
- ], (json) => [json.message]);
91
- const AllOverloadsFailed = createKnownErrorConstructor(KnownError, "ALL_OVERLOADS_FAILED", (overloadErrors) => [
127
+ message
128
+ }
129
+ ],
130
+ (json) => [json.message]
131
+ );
132
+ var AllOverloadsFailed = createKnownErrorConstructor(
133
+ KnownError,
134
+ "ALL_OVERLOADS_FAILED",
135
+ (overloadErrors) => [
92
136
  400,
93
- deindent `
137
+ import_strings.deindent`
94
138
  This endpoint has multiple overloads, but they all failed to process the request.
95
139
 
96
- ${overloadErrors.map((e, i) => deindent `
97
- Overload ${i + 1}: ${JSON.stringify(e, undefined, 2)}
140
+ ${overloadErrors.map((e, i) => import_strings.deindent`
141
+ Overload ${i + 1}: ${JSON.stringify(e, void 0, 2)}
98
142
  `).join("\n\n")}
99
143
  `,
100
144
  {
101
- overload_errors: overloadErrors,
102
- },
103
- ], (json) => [
104
- json?.overload_errors ?? throwErr("overload_errors not found in AllOverloadsFailed details"),
105
- ]);
106
- const ProjectAuthenticationError = createKnownErrorConstructor(KnownError, "PROJECT_AUTHENTICATION_ERROR", "inherit", "inherit");
107
- const InvalidProjectAuthentication = createKnownErrorConstructor(ProjectAuthenticationError, "INVALID_PROJECT_AUTHENTICATION", "inherit", "inherit");
108
- const ProjectKeyWithoutAccessType = createKnownErrorConstructor(InvalidProjectAuthentication, "PROJECT_KEY_WITHOUT_ACCESS_TYPE", () => [
109
- 400,
110
- "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.",
111
- ], () => []);
112
- const InvalidAccessType = createKnownErrorConstructor(InvalidProjectAuthentication, "INVALID_ACCESS_TYPE", (accessType) => [
113
- 400,
114
- `The x-stack-access-type header must be 'client', 'server', or 'admin', but was '${accessType}'.`,
115
- ], (json) => [
116
- json?.accessType ?? throwErr("accessType not found in InvalidAccessType details"),
117
- ]);
118
- const AccessTypeWithoutProjectId = createKnownErrorConstructor(InvalidProjectAuthentication, "ACCESS_TYPE_WITHOUT_PROJECT_ID", (accessType) => [
119
- 400,
120
- deindent `
145
+ overload_errors: overloadErrors
146
+ }
147
+ ],
148
+ (json) => [
149
+ json?.overload_errors ?? (0, import_errors.throwErr)("overload_errors not found in AllOverloadsFailed details")
150
+ ]
151
+ );
152
+ var ProjectAuthenticationError = createKnownErrorConstructor(
153
+ KnownError,
154
+ "PROJECT_AUTHENTICATION_ERROR",
155
+ "inherit",
156
+ "inherit"
157
+ );
158
+ var InvalidProjectAuthentication = createKnownErrorConstructor(
159
+ ProjectAuthenticationError,
160
+ "INVALID_PROJECT_AUTHENTICATION",
161
+ "inherit",
162
+ "inherit"
163
+ );
164
+ var ProjectKeyWithoutAccessType = createKnownErrorConstructor(
165
+ InvalidProjectAuthentication,
166
+ "PROJECT_KEY_WITHOUT_ACCESS_TYPE",
167
+ () => [
168
+ 400,
169
+ "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."
170
+ ],
171
+ () => []
172
+ );
173
+ var InvalidAccessType = createKnownErrorConstructor(
174
+ InvalidProjectAuthentication,
175
+ "INVALID_ACCESS_TYPE",
176
+ (accessType) => [
177
+ 400,
178
+ `The x-stack-access-type header must be 'client', 'server', or 'admin', but was '${accessType}'.`
179
+ ],
180
+ (json) => [
181
+ json?.accessType ?? (0, import_errors.throwErr)("accessType not found in InvalidAccessType details")
182
+ ]
183
+ );
184
+ var AccessTypeWithoutProjectId = createKnownErrorConstructor(
185
+ InvalidProjectAuthentication,
186
+ "ACCESS_TYPE_WITHOUT_PROJECT_ID",
187
+ (accessType) => [
188
+ 400,
189
+ import_strings.deindent`
121
190
  The x-stack-access-type header was '${accessType}', but the x-stack-project-id header was not provided.
122
191
 
123
192
  For more information, see the docs on REST API authentication: https://docs.stack-auth.com/rest-api/overview#authentication
124
193
  `,
125
194
  {
126
- request_type: accessType,
127
- },
128
- ], (json) => [json.request_type]);
129
- const AccessTypeRequired = createKnownErrorConstructor(InvalidProjectAuthentication, "ACCESS_TYPE_REQUIRED", () => [
195
+ request_type: accessType
196
+ }
197
+ ],
198
+ (json) => [json.request_type]
199
+ );
200
+ var AccessTypeRequired = createKnownErrorConstructor(
201
+ InvalidProjectAuthentication,
202
+ "ACCESS_TYPE_REQUIRED",
203
+ () => [
130
204
  400,
131
- deindent `
205
+ import_strings.deindent`
132
206
  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'.
133
207
 
134
208
  For more information, see the docs on REST API authentication: https://docs.stack-auth.com/rest-api/overview#authentication
135
- `,
136
- ], () => []);
137
- const InsufficientAccessType = createKnownErrorConstructor(InvalidProjectAuthentication, "INSUFFICIENT_ACCESS_TYPE", (actualAccessType, allowedAccessTypes) => [
209
+ `
210
+ ],
211
+ () => []
212
+ );
213
+ var InsufficientAccessType = createKnownErrorConstructor(
214
+ InvalidProjectAuthentication,
215
+ "INSUFFICIENT_ACCESS_TYPE",
216
+ (actualAccessType, allowedAccessTypes) => [
138
217
  401,
139
- `The x-stack-access-type header must be ${allowedAccessTypes.map(s => `'${s}'`).join(" or ")}, but was '${actualAccessType}'.`,
218
+ `The x-stack-access-type header must be ${allowedAccessTypes.map((s) => `'${s}'`).join(" or ")}, but was '${actualAccessType}'.`,
140
219
  {
141
- actual_access_type: actualAccessType,
142
- allowed_access_types: allowedAccessTypes,
143
- },
144
- ], (json) => [
220
+ actual_access_type: actualAccessType,
221
+ allowed_access_types: allowedAccessTypes
222
+ }
223
+ ],
224
+ (json) => [
145
225
  json.actual_access_type,
146
- json.allowed_access_types,
147
- ]);
148
- const InvalidPublishableClientKey = createKnownErrorConstructor(InvalidProjectAuthentication, "INVALID_PUBLISHABLE_CLIENT_KEY", (projectId) => [
226
+ json.allowed_access_types
227
+ ]
228
+ );
229
+ var InvalidPublishableClientKey = createKnownErrorConstructor(
230
+ InvalidProjectAuthentication,
231
+ "INVALID_PUBLISHABLE_CLIENT_KEY",
232
+ (projectId) => [
149
233
  401,
150
234
  `The publishable key is not valid for the project ${JSON.stringify(projectId)}. Does the project and/or the key exist?`,
151
235
  {
152
- project_id: projectId,
153
- },
154
- ], (json) => [json.project_id]);
155
- const InvalidSecretServerKey = createKnownErrorConstructor(InvalidProjectAuthentication, "INVALID_SECRET_SERVER_KEY", (projectId) => [
236
+ project_id: projectId
237
+ }
238
+ ],
239
+ (json) => [json.project_id]
240
+ );
241
+ var InvalidSecretServerKey = createKnownErrorConstructor(
242
+ InvalidProjectAuthentication,
243
+ "INVALID_SECRET_SERVER_KEY",
244
+ (projectId) => [
156
245
  401,
157
246
  `The secret server key is not valid for the project ${JSON.stringify(projectId)}. Does the project and/or the key exist?`,
158
247
  {
159
- project_id: projectId,
160
- },
161
- ], (json) => [json.project_id]);
162
- const InvalidSuperSecretAdminKey = createKnownErrorConstructor(InvalidProjectAuthentication, "INVALID_SUPER_SECRET_ADMIN_KEY", (projectId) => [
248
+ project_id: projectId
249
+ }
250
+ ],
251
+ (json) => [json.project_id]
252
+ );
253
+ var InvalidSuperSecretAdminKey = createKnownErrorConstructor(
254
+ InvalidProjectAuthentication,
255
+ "INVALID_SUPER_SECRET_ADMIN_KEY",
256
+ (projectId) => [
163
257
  401,
164
258
  `The super secret admin key is not valid for the project ${JSON.stringify(projectId)}. Does the project and/or the key exist?`,
165
259
  {
166
- project_id: projectId,
167
- },
168
- ], (json) => [json.project_id]);
169
- const InvalidAdminAccessToken = createKnownErrorConstructor(InvalidProjectAuthentication, "INVALID_ADMIN_ACCESS_TOKEN", "inherit", "inherit");
170
- const UnparsableAdminAccessToken = createKnownErrorConstructor(InvalidAdminAccessToken, "UNPARSABLE_ADMIN_ACCESS_TOKEN", () => [
260
+ project_id: projectId
261
+ }
262
+ ],
263
+ (json) => [json.project_id]
264
+ );
265
+ var InvalidAdminAccessToken = createKnownErrorConstructor(
266
+ InvalidProjectAuthentication,
267
+ "INVALID_ADMIN_ACCESS_TOKEN",
268
+ "inherit",
269
+ "inherit"
270
+ );
271
+ var UnparsableAdminAccessToken = createKnownErrorConstructor(
272
+ InvalidAdminAccessToken,
273
+ "UNPARSABLE_ADMIN_ACCESS_TOKEN",
274
+ () => [
171
275
  401,
172
- "Admin access token is not parsable.",
173
- ], () => []);
174
- const AdminAccessTokenExpired = createKnownErrorConstructor(InvalidAdminAccessToken, "ADMIN_ACCESS_TOKEN_EXPIRED", (expiredAt) => [
276
+ "Admin access token is not parsable."
277
+ ],
278
+ () => []
279
+ );
280
+ var AdminAccessTokenExpired = createKnownErrorConstructor(
281
+ InvalidAdminAccessToken,
282
+ "ADMIN_ACCESS_TOKEN_EXPIRED",
283
+ (expiredAt) => [
175
284
  401,
176
285
  `Admin access token has expired. Please refresh it and try again.${expiredAt ? ` (The access token expired at ${expiredAt.toISOString()}.)` : ""}`,
177
- { expired_at_millis: expiredAt?.getTime() ?? null },
178
- ], (json) => [json.expired_at_millis ?? undefined]);
179
- const InvalidProjectForAdminAccessToken = createKnownErrorConstructor(InvalidAdminAccessToken, "INVALID_PROJECT_FOR_ADMIN_ACCESS_TOKEN", () => [
286
+ { expired_at_millis: expiredAt?.getTime() ?? null }
287
+ ],
288
+ (json) => [json.expired_at_millis ?? void 0]
289
+ );
290
+ var InvalidProjectForAdminAccessToken = createKnownErrorConstructor(
291
+ InvalidAdminAccessToken,
292
+ "INVALID_PROJECT_FOR_ADMIN_ACCESS_TOKEN",
293
+ () => [
180
294
  401,
181
- "Admin access tokens must be created on the internal project.",
182
- ], () => []);
183
- const AdminAccessTokenIsNotAdmin = createKnownErrorConstructor(InvalidAdminAccessToken, "ADMIN_ACCESS_TOKEN_IS_NOT_ADMIN", () => [
295
+ "Admin access tokens must be created on the internal project."
296
+ ],
297
+ () => []
298
+ );
299
+ var AdminAccessTokenIsNotAdmin = createKnownErrorConstructor(
300
+ InvalidAdminAccessToken,
301
+ "ADMIN_ACCESS_TOKEN_IS_NOT_ADMIN",
302
+ () => [
184
303
  401,
185
- "Admin access token does not have the required permissions to access this project.",
186
- ], () => []);
187
- /**
188
- * @deprecated Use InsufficientAccessType instead
189
- */
190
- const ProjectAuthenticationRequired = createKnownErrorConstructor(ProjectAuthenticationError, "PROJECT_AUTHENTICATION_REQUIRED", "inherit", "inherit");
191
- /**
192
- * @deprecated Use InsufficientAccessType instead
193
- */
194
- const ClientAuthenticationRequired = createKnownErrorConstructor(ProjectAuthenticationRequired, "CLIENT_AUTHENTICATION_REQUIRED", () => [
304
+ "Admin access token does not have the required permissions to access this project."
305
+ ],
306
+ () => []
307
+ );
308
+ var ProjectAuthenticationRequired = createKnownErrorConstructor(
309
+ ProjectAuthenticationError,
310
+ "PROJECT_AUTHENTICATION_REQUIRED",
311
+ "inherit",
312
+ "inherit"
313
+ );
314
+ var ClientAuthenticationRequired = createKnownErrorConstructor(
315
+ ProjectAuthenticationRequired,
316
+ "CLIENT_AUTHENTICATION_REQUIRED",
317
+ () => [
195
318
  401,
196
- "The publishable client key must be provided.",
197
- ], () => []);
198
- /**
199
- * @deprecated Use InsufficientAccessType instead
200
- */
201
- const ServerAuthenticationRequired = createKnownErrorConstructor(ProjectAuthenticationRequired, "SERVER_AUTHENTICATION_REQUIRED", () => [
319
+ "The publishable client key must be provided."
320
+ ],
321
+ () => []
322
+ );
323
+ var ServerAuthenticationRequired = createKnownErrorConstructor(
324
+ ProjectAuthenticationRequired,
325
+ "SERVER_AUTHENTICATION_REQUIRED",
326
+ () => [
202
327
  401,
203
- "The secret server key must be provided.",
204
- ], () => []);
205
- /**
206
- * @deprecated Use InsufficientAccessType instead
207
- */
208
- const ClientOrServerAuthenticationRequired = createKnownErrorConstructor(ProjectAuthenticationRequired, "CLIENT_OR_SERVER_AUTHENTICATION_REQUIRED", () => [
328
+ "The secret server key must be provided."
329
+ ],
330
+ () => []
331
+ );
332
+ var ClientOrServerAuthenticationRequired = createKnownErrorConstructor(
333
+ ProjectAuthenticationRequired,
334
+ "CLIENT_OR_SERVER_AUTHENTICATION_REQUIRED",
335
+ () => [
209
336
  401,
210
- "Either the publishable client key or the secret server key must be provided.",
211
- ], () => []);
212
- /**
213
- * @deprecated Use InsufficientAccessType instead
214
- */
215
- const ClientOrAdminAuthenticationRequired = createKnownErrorConstructor(ProjectAuthenticationRequired, "CLIENT_OR_ADMIN_AUTHENTICATION_REQUIRED", () => [
337
+ "Either the publishable client key or the secret server key must be provided."
338
+ ],
339
+ () => []
340
+ );
341
+ var ClientOrAdminAuthenticationRequired = createKnownErrorConstructor(
342
+ ProjectAuthenticationRequired,
343
+ "CLIENT_OR_ADMIN_AUTHENTICATION_REQUIRED",
344
+ () => [
216
345
  401,
217
- "Either the publishable client key or the super secret admin key must be provided.",
218
- ], () => []);
219
- /**
220
- * @deprecated Use InsufficientAccessType instead
221
- */
222
- const ClientOrServerOrAdminAuthenticationRequired = createKnownErrorConstructor(ProjectAuthenticationRequired, "CLIENT_OR_SERVER_OR_ADMIN_AUTHENTICATION_REQUIRED", () => [
346
+ "Either the publishable client key or the super secret admin key must be provided."
347
+ ],
348
+ () => []
349
+ );
350
+ var ClientOrServerOrAdminAuthenticationRequired = createKnownErrorConstructor(
351
+ ProjectAuthenticationRequired,
352
+ "CLIENT_OR_SERVER_OR_ADMIN_AUTHENTICATION_REQUIRED",
353
+ () => [
223
354
  401,
224
- "Either the publishable client key, the secret server key, or the super secret admin key must be provided.",
225
- ], () => []);
226
- /**
227
- * @deprecated Use InsufficientAccessType instead
228
- */
229
- const AdminAuthenticationRequired = createKnownErrorConstructor(ProjectAuthenticationRequired, "ADMIN_AUTHENTICATION_REQUIRED", () => [
355
+ "Either the publishable client key, the secret server key, or the super secret admin key must be provided."
356
+ ],
357
+ () => []
358
+ );
359
+ var AdminAuthenticationRequired = createKnownErrorConstructor(
360
+ ProjectAuthenticationRequired,
361
+ "ADMIN_AUTHENTICATION_REQUIRED",
362
+ () => [
230
363
  401,
231
- "The super secret admin key must be provided.",
232
- ], () => []);
233
- const ExpectedInternalProject = createKnownErrorConstructor(ProjectAuthenticationError, "EXPECTED_INTERNAL_PROJECT", () => [
364
+ "The super secret admin key must be provided."
365
+ ],
366
+ () => []
367
+ );
368
+ var ExpectedInternalProject = createKnownErrorConstructor(
369
+ ProjectAuthenticationError,
370
+ "EXPECTED_INTERNAL_PROJECT",
371
+ () => [
234
372
  401,
235
- "The project ID is expected to be internal.",
236
- ], () => []);
237
- const SessionAuthenticationError = createKnownErrorConstructor(KnownError, "SESSION_AUTHENTICATION_ERROR", "inherit", "inherit");
238
- const InvalidSessionAuthentication = createKnownErrorConstructor(SessionAuthenticationError, "INVALID_SESSION_AUTHENTICATION", "inherit", "inherit");
239
- const InvalidAccessToken = createKnownErrorConstructor(InvalidSessionAuthentication, "INVALID_ACCESS_TOKEN", "inherit", "inherit");
240
- const UnparsableAccessToken = createKnownErrorConstructor(InvalidAccessToken, "UNPARSABLE_ACCESS_TOKEN", () => [
373
+ "The project ID is expected to be internal."
374
+ ],
375
+ () => []
376
+ );
377
+ var SessionAuthenticationError = createKnownErrorConstructor(
378
+ KnownError,
379
+ "SESSION_AUTHENTICATION_ERROR",
380
+ "inherit",
381
+ "inherit"
382
+ );
383
+ var InvalidSessionAuthentication = createKnownErrorConstructor(
384
+ SessionAuthenticationError,
385
+ "INVALID_SESSION_AUTHENTICATION",
386
+ "inherit",
387
+ "inherit"
388
+ );
389
+ var InvalidAccessToken = createKnownErrorConstructor(
390
+ InvalidSessionAuthentication,
391
+ "INVALID_ACCESS_TOKEN",
392
+ "inherit",
393
+ "inherit"
394
+ );
395
+ var UnparsableAccessToken = createKnownErrorConstructor(
396
+ InvalidAccessToken,
397
+ "UNPARSABLE_ACCESS_TOKEN",
398
+ () => [
241
399
  401,
242
- "Access token is not parsable.",
243
- ], () => []);
244
- const AccessTokenExpired = createKnownErrorConstructor(InvalidAccessToken, "ACCESS_TOKEN_EXPIRED", (expiredAt) => [
400
+ "Access token is not parsable."
401
+ ],
402
+ () => []
403
+ );
404
+ var AccessTokenExpired = createKnownErrorConstructor(
405
+ InvalidAccessToken,
406
+ "ACCESS_TOKEN_EXPIRED",
407
+ (expiredAt) => [
245
408
  401,
246
409
  `Access token has expired. Please refresh it and try again.${expiredAt ? ` (The access token expired at ${expiredAt.toISOString()}.)` : ""}`,
247
- { expired_at_millis: expiredAt?.getTime() ?? null },
248
- ], (json) => [json.expired_at_millis ? new Date(json.expired_at_millis) : undefined]);
249
- const InvalidProjectForAccessToken = createKnownErrorConstructor(InvalidAccessToken, "INVALID_PROJECT_FOR_ACCESS_TOKEN", (expectedProjectId, actualProjectId) => [
410
+ { expired_at_millis: expiredAt?.getTime() ?? null }
411
+ ],
412
+ (json) => [json.expired_at_millis ? new Date(json.expired_at_millis) : void 0]
413
+ );
414
+ var InvalidProjectForAccessToken = createKnownErrorConstructor(
415
+ InvalidAccessToken,
416
+ "INVALID_PROJECT_FOR_ACCESS_TOKEN",
417
+ (expectedProjectId, actualProjectId) => [
250
418
  401,
251
419
  `Access token not valid for this project. Expected project ID ${JSON.stringify(expectedProjectId)}, but the token is for project ID ${JSON.stringify(actualProjectId)}.`,
252
420
  {
253
- expected_project_id: expectedProjectId,
254
- actual_project_id: actualProjectId,
255
- },
256
- ], (json) => [json.expected_project_id, json.actual_project_id]);
257
- const RefreshTokenError = createKnownErrorConstructor(KnownError, "REFRESH_TOKEN_ERROR", "inherit", "inherit");
258
- const RefreshTokenNotFoundOrExpired = createKnownErrorConstructor(RefreshTokenError, "REFRESH_TOKEN_NOT_FOUND_OR_EXPIRED", () => [
421
+ expected_project_id: expectedProjectId,
422
+ actual_project_id: actualProjectId
423
+ }
424
+ ],
425
+ (json) => [json.expected_project_id, json.actual_project_id]
426
+ );
427
+ var RefreshTokenError = createKnownErrorConstructor(
428
+ KnownError,
429
+ "REFRESH_TOKEN_ERROR",
430
+ "inherit",
431
+ "inherit"
432
+ );
433
+ var RefreshTokenNotFoundOrExpired = createKnownErrorConstructor(
434
+ RefreshTokenError,
435
+ "REFRESH_TOKEN_NOT_FOUND_OR_EXPIRED",
436
+ () => [
259
437
  401,
260
- "Refresh token not found for this project, or the session has expired/been revoked.",
261
- ], () => []);
262
- const CannotDeleteCurrentSession = createKnownErrorConstructor(RefreshTokenError, "CANNOT_DELETE_CURRENT_SESSION", () => [
438
+ "Refresh token not found for this project, or the session has expired/been revoked."
439
+ ],
440
+ () => []
441
+ );
442
+ var CannotDeleteCurrentSession = createKnownErrorConstructor(
443
+ RefreshTokenError,
444
+ "CANNOT_DELETE_CURRENT_SESSION",
445
+ () => [
263
446
  400,
264
- "Cannot delete the current session.",
265
- ], () => []);
266
- const ProviderRejected = createKnownErrorConstructor(RefreshTokenError, "PROVIDER_REJECTED", () => [
447
+ "Cannot delete the current session."
448
+ ],
449
+ () => []
450
+ );
451
+ var ProviderRejected = createKnownErrorConstructor(
452
+ RefreshTokenError,
453
+ "PROVIDER_REJECTED",
454
+ () => [
267
455
  401,
268
- "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.",
269
- ], () => []);
270
- const UserWithEmailAlreadyExists = createKnownErrorConstructor(KnownError, "USER_EMAIL_ALREADY_EXISTS", (email) => [
456
+ "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."
457
+ ],
458
+ () => []
459
+ );
460
+ var UserWithEmailAlreadyExists = createKnownErrorConstructor(
461
+ KnownError,
462
+ "USER_EMAIL_ALREADY_EXISTS",
463
+ (email) => [
271
464
  409,
272
465
  `A user with email ${JSON.stringify(email)} already exists.`,
273
466
  {
274
- email,
275
- },
276
- ], (json) => [json.email]);
277
- const EmailNotVerified = createKnownErrorConstructor(KnownError, "EMAIL_NOT_VERIFIED", () => [
467
+ email
468
+ }
469
+ ],
470
+ (json) => [json.email]
471
+ );
472
+ var EmailNotVerified = createKnownErrorConstructor(
473
+ KnownError,
474
+ "EMAIL_NOT_VERIFIED",
475
+ () => [
278
476
  400,
279
- "The email is not verified.",
280
- ], () => []);
281
- const CannotGetOwnUserWithoutUser = createKnownErrorConstructor(KnownError, "CANNOT_GET_OWN_USER_WITHOUT_USER", () => [
477
+ "The email is not verified."
478
+ ],
479
+ () => []
480
+ );
481
+ var CannotGetOwnUserWithoutUser = createKnownErrorConstructor(
482
+ KnownError,
483
+ "CANNOT_GET_OWN_USER_WITHOUT_USER",
484
+ () => [
282
485
  400,
283
- "You have specified 'me' as a userId, but did not provide authentication for a user.",
284
- ], () => []);
285
- const UserIdDoesNotExist = createKnownErrorConstructor(KnownError, "USER_ID_DOES_NOT_EXIST", (userId) => [
486
+ "You have specified 'me' as a userId, but did not provide authentication for a user."
487
+ ],
488
+ () => []
489
+ );
490
+ var UserIdDoesNotExist = createKnownErrorConstructor(
491
+ KnownError,
492
+ "USER_ID_DOES_NOT_EXIST",
493
+ (userId) => [
286
494
  400,
287
495
  `The given user with the ID ${userId} does not exist.`,
288
496
  {
289
- user_id: userId,
290
- },
291
- ], (json) => [json.user_id]);
292
- const UserNotFound = createKnownErrorConstructor(KnownError, "USER_NOT_FOUND", () => [
497
+ user_id: userId
498
+ }
499
+ ],
500
+ (json) => [json.user_id]
501
+ );
502
+ var UserNotFound = createKnownErrorConstructor(
503
+ KnownError,
504
+ "USER_NOT_FOUND",
505
+ () => [
293
506
  404,
294
- "User not found.",
295
- ], () => []);
296
- const ProjectNotFound = createKnownErrorConstructor(KnownError, "PROJECT_NOT_FOUND", (projectId) => {
297
- if (typeof projectId !== "string")
298
- throw new StackAssertionError("projectId of KnownErrors.ProjectNotFound must be a string");
507
+ "User not found."
508
+ ],
509
+ () => []
510
+ );
511
+ var ProjectNotFound = createKnownErrorConstructor(
512
+ KnownError,
513
+ "PROJECT_NOT_FOUND",
514
+ (projectId) => {
515
+ if (typeof projectId !== "string") throw new import_errors.StackAssertionError("projectId of KnownErrors.ProjectNotFound must be a string");
299
516
  return [
300
- 404,
301
- `Project ${projectId} not found or is not accessible with the current user.`,
302
- {
303
- project_id: projectId,
304
- },
517
+ 404,
518
+ `Project ${projectId} not found or is not accessible with the current user.`,
519
+ {
520
+ project_id: projectId
521
+ }
305
522
  ];
306
- }, (json) => [json.project_id]);
307
- const SignUpNotEnabled = createKnownErrorConstructor(KnownError, "SIGN_UP_NOT_ENABLED", () => [
523
+ },
524
+ (json) => [json.project_id]
525
+ );
526
+ var SignUpNotEnabled = createKnownErrorConstructor(
527
+ KnownError,
528
+ "SIGN_UP_NOT_ENABLED",
529
+ () => [
308
530
  400,
309
- "Creation of new accounts is not enabled for this project. Please ask the project owner to enable it.",
310
- ], () => []);
311
- const PasswordAuthenticationNotEnabled = createKnownErrorConstructor(KnownError, "PASSWORD_AUTHENTICATION_NOT_ENABLED", () => [
531
+ "Creation of new accounts is not enabled for this project. Please ask the project owner to enable it."
532
+ ],
533
+ () => []
534
+ );
535
+ var PasswordAuthenticationNotEnabled = createKnownErrorConstructor(
536
+ KnownError,
537
+ "PASSWORD_AUTHENTICATION_NOT_ENABLED",
538
+ () => [
312
539
  400,
313
- "Password authentication is not enabled for this project.",
314
- ], () => []);
315
- const PasskeyAuthenticationNotEnabled = createKnownErrorConstructor(KnownError, "PASSKEY_AUTHENTICATION_NOT_ENABLED", () => [
540
+ "Password authentication is not enabled for this project."
541
+ ],
542
+ () => []
543
+ );
544
+ var PasskeyAuthenticationNotEnabled = createKnownErrorConstructor(
545
+ KnownError,
546
+ "PASSKEY_AUTHENTICATION_NOT_ENABLED",
547
+ () => [
316
548
  400,
317
- "Passkey authentication is not enabled for this project.",
318
- ], () => []);
319
- const AnonymousAccountsNotEnabled = createKnownErrorConstructor(KnownError, "ANONYMOUS_ACCOUNTS_NOT_ENABLED", () => [
549
+ "Passkey authentication is not enabled for this project."
550
+ ],
551
+ () => []
552
+ );
553
+ var AnonymousAccountsNotEnabled = createKnownErrorConstructor(
554
+ KnownError,
555
+ "ANONYMOUS_ACCOUNTS_NOT_ENABLED",
556
+ () => [
320
557
  400,
321
- "Anonymous accounts are not enabled for this project.",
322
- ], () => []);
323
- const EmailPasswordMismatch = createKnownErrorConstructor(KnownError, "EMAIL_PASSWORD_MISMATCH", () => [
558
+ "Anonymous accounts are not enabled for this project."
559
+ ],
560
+ () => []
561
+ );
562
+ var EmailPasswordMismatch = createKnownErrorConstructor(
563
+ KnownError,
564
+ "EMAIL_PASSWORD_MISMATCH",
565
+ () => [
324
566
  400,
325
- "Wrong e-mail or password.",
326
- ], () => []);
327
- const RedirectUrlNotWhitelisted = createKnownErrorConstructor(KnownError, "REDIRECT_URL_NOT_WHITELISTED", () => [
567
+ "Wrong e-mail or password."
568
+ ],
569
+ () => []
570
+ );
571
+ var RedirectUrlNotWhitelisted = createKnownErrorConstructor(
572
+ KnownError,
573
+ "REDIRECT_URL_NOT_WHITELISTED",
574
+ () => [
328
575
  400,
329
- "Redirect URL not whitelisted. Did you forget to add this domain to the trusted domains list on the Stack Auth dashboard?",
330
- ], () => []);
331
- const PasswordRequirementsNotMet = createKnownErrorConstructor(KnownError, "PASSWORD_REQUIREMENTS_NOT_MET", "inherit", "inherit");
332
- const PasswordTooShort = createKnownErrorConstructor(PasswordRequirementsNotMet, "PASSWORD_TOO_SHORT", (minLength) => [
576
+ "Redirect URL not whitelisted. Did you forget to add this domain to the trusted domains list on the Stack Auth dashboard?"
577
+ ],
578
+ () => []
579
+ );
580
+ var PasswordRequirementsNotMet = createKnownErrorConstructor(
581
+ KnownError,
582
+ "PASSWORD_REQUIREMENTS_NOT_MET",
583
+ "inherit",
584
+ "inherit"
585
+ );
586
+ var PasswordTooShort = createKnownErrorConstructor(
587
+ PasswordRequirementsNotMet,
588
+ "PASSWORD_TOO_SHORT",
589
+ (minLength) => [
333
590
  400,
334
591
  `Password too short. Minimum length is ${minLength}.`,
335
592
  {
336
- min_length: minLength,
337
- },
338
- ], (json) => [
339
- json?.min_length ?? throwErr("min_length not found in PasswordTooShort details"),
340
- ]);
341
- const PasswordTooLong = createKnownErrorConstructor(PasswordRequirementsNotMet, "PASSWORD_TOO_LONG", (maxLength) => [
593
+ min_length: minLength
594
+ }
595
+ ],
596
+ (json) => [
597
+ json?.min_length ?? (0, import_errors.throwErr)("min_length not found in PasswordTooShort details")
598
+ ]
599
+ );
600
+ var PasswordTooLong = createKnownErrorConstructor(
601
+ PasswordRequirementsNotMet,
602
+ "PASSWORD_TOO_LONG",
603
+ (maxLength) => [
342
604
  400,
343
605
  `Password too long. Maximum length is ${maxLength}.`,
344
606
  {
345
- maxLength,
346
- },
347
- ], (json) => [
348
- json?.maxLength ?? throwErr("maxLength not found in PasswordTooLong details"),
349
- ]);
350
- const UserDoesNotHavePassword = createKnownErrorConstructor(KnownError, "USER_DOES_NOT_HAVE_PASSWORD", () => [
351
- 400,
352
- "This user does not have password authentication enabled.",
353
- ], () => []);
354
- const VerificationCodeError = createKnownErrorConstructor(KnownError, "VERIFICATION_ERROR", "inherit", "inherit");
355
- const VerificationCodeNotFound = createKnownErrorConstructor(VerificationCodeError, "VERIFICATION_CODE_NOT_FOUND", () => [
607
+ maxLength
608
+ }
609
+ ],
610
+ (json) => [
611
+ json?.maxLength ?? (0, import_errors.throwErr)("maxLength not found in PasswordTooLong details")
612
+ ]
613
+ );
614
+ var UserDoesNotHavePassword = createKnownErrorConstructor(
615
+ KnownError,
616
+ "USER_DOES_NOT_HAVE_PASSWORD",
617
+ () => [
618
+ 400,
619
+ "This user does not have password authentication enabled."
620
+ ],
621
+ () => []
622
+ );
623
+ var VerificationCodeError = createKnownErrorConstructor(
624
+ KnownError,
625
+ "VERIFICATION_ERROR",
626
+ "inherit",
627
+ "inherit"
628
+ );
629
+ var VerificationCodeNotFound = createKnownErrorConstructor(
630
+ VerificationCodeError,
631
+ "VERIFICATION_CODE_NOT_FOUND",
632
+ () => [
356
633
  404,
357
- "The verification code does not exist for this project.",
358
- ], () => []);
359
- const VerificationCodeExpired = createKnownErrorConstructor(VerificationCodeError, "VERIFICATION_CODE_EXPIRED", () => [
634
+ "The verification code does not exist for this project."
635
+ ],
636
+ () => []
637
+ );
638
+ var VerificationCodeExpired = createKnownErrorConstructor(
639
+ VerificationCodeError,
640
+ "VERIFICATION_CODE_EXPIRED",
641
+ () => [
360
642
  400,
361
- "The verification code has expired.",
362
- ], () => []);
363
- const VerificationCodeAlreadyUsed = createKnownErrorConstructor(VerificationCodeError, "VERIFICATION_CODE_ALREADY_USED", () => [
643
+ "The verification code has expired."
644
+ ],
645
+ () => []
646
+ );
647
+ var VerificationCodeAlreadyUsed = createKnownErrorConstructor(
648
+ VerificationCodeError,
649
+ "VERIFICATION_CODE_ALREADY_USED",
650
+ () => [
364
651
  409,
365
- "The verification link has already been used.",
366
- ], () => []);
367
- const VerificationCodeMaxAttemptsReached = createKnownErrorConstructor(VerificationCodeError, "VERIFICATION_CODE_MAX_ATTEMPTS_REACHED", () => [
652
+ "The verification link has already been used."
653
+ ],
654
+ () => []
655
+ );
656
+ var VerificationCodeMaxAttemptsReached = createKnownErrorConstructor(
657
+ VerificationCodeError,
658
+ "VERIFICATION_CODE_MAX_ATTEMPTS_REACHED",
659
+ () => [
368
660
  400,
369
- "The verification code nonce has reached the maximum number of attempts. This code is not valid anymore.",
370
- ], () => []);
371
- const PasswordConfirmationMismatch = createKnownErrorConstructor(KnownError, "PASSWORD_CONFIRMATION_MISMATCH", () => [
661
+ "The verification code nonce has reached the maximum number of attempts. This code is not valid anymore."
662
+ ],
663
+ () => []
664
+ );
665
+ var PasswordConfirmationMismatch = createKnownErrorConstructor(
666
+ KnownError,
667
+ "PASSWORD_CONFIRMATION_MISMATCH",
668
+ () => [
372
669
  400,
373
- "Passwords do not match.",
374
- ], () => []);
375
- const EmailAlreadyVerified = createKnownErrorConstructor(KnownError, "EMAIL_ALREADY_VERIFIED", () => [
670
+ "Passwords do not match."
671
+ ],
672
+ () => []
673
+ );
674
+ var EmailAlreadyVerified = createKnownErrorConstructor(
675
+ KnownError,
676
+ "EMAIL_ALREADY_VERIFIED",
677
+ () => [
376
678
  409,
377
- "The e-mail is already verified.",
378
- ], () => []);
379
- const EmailNotAssociatedWithUser = createKnownErrorConstructor(KnownError, "EMAIL_NOT_ASSOCIATED_WITH_USER", () => [
679
+ "The e-mail is already verified."
680
+ ],
681
+ () => []
682
+ );
683
+ var EmailNotAssociatedWithUser = createKnownErrorConstructor(
684
+ KnownError,
685
+ "EMAIL_NOT_ASSOCIATED_WITH_USER",
686
+ () => [
380
687
  400,
381
- "The e-mail is not associated with a user that could log in with that e-mail.",
382
- ], () => []);
383
- const EmailIsNotPrimaryEmail = createKnownErrorConstructor(KnownError, "EMAIL_IS_NOT_PRIMARY_EMAIL", (email, primaryEmail) => [
688
+ "The e-mail is not associated with a user that could log in with that e-mail."
689
+ ],
690
+ () => []
691
+ );
692
+ var EmailIsNotPrimaryEmail = createKnownErrorConstructor(
693
+ KnownError,
694
+ "EMAIL_IS_NOT_PRIMARY_EMAIL",
695
+ (email, primaryEmail) => [
384
696
  400,
385
697
  `The given e-mail (${email}) must equal the user's primary e-mail (${primaryEmail}).`,
386
698
  {
387
- email,
388
- primary_email: primaryEmail,
389
- },
390
- ], (json) => [json.email, json.primary_email]);
391
- const PasskeyRegistrationFailed = createKnownErrorConstructor(KnownError, "PASSKEY_REGISTRATION_FAILED", (message) => [
699
+ email,
700
+ primary_email: primaryEmail
701
+ }
702
+ ],
703
+ (json) => [json.email, json.primary_email]
704
+ );
705
+ var PasskeyRegistrationFailed = createKnownErrorConstructor(
706
+ KnownError,
707
+ "PASSKEY_REGISTRATION_FAILED",
708
+ (message) => [
392
709
  400,
393
- message,
394
- ], (json) => [json.message]);
395
- const PasskeyWebAuthnError = createKnownErrorConstructor(KnownError, "PASSKEY_WEBAUTHN_ERROR", (message, code) => [
710
+ message
711
+ ],
712
+ (json) => [json.message]
713
+ );
714
+ var PasskeyWebAuthnError = createKnownErrorConstructor(
715
+ KnownError,
716
+ "PASSKEY_WEBAUTHN_ERROR",
717
+ (message, code) => [
396
718
  400,
397
719
  message,
398
720
  {
399
- message,
400
- code,
401
- },
402
- ], (json) => [json.message, json.code]);
403
- const PasskeyAuthenticationFailed = createKnownErrorConstructor(KnownError, "PASSKEY_AUTHENTICATION_FAILED", (message) => [
721
+ message,
722
+ code
723
+ }
724
+ ],
725
+ (json) => [json.message, json.code]
726
+ );
727
+ var PasskeyAuthenticationFailed = createKnownErrorConstructor(
728
+ KnownError,
729
+ "PASSKEY_AUTHENTICATION_FAILED",
730
+ (message) => [
404
731
  400,
405
- message,
406
- ], (json) => [json.message]);
407
- const PermissionNotFound = createKnownErrorConstructor(KnownError, "PERMISSION_NOT_FOUND", (permissionId) => [
732
+ message
733
+ ],
734
+ (json) => [json.message]
735
+ );
736
+ var PermissionNotFound = createKnownErrorConstructor(
737
+ KnownError,
738
+ "PERMISSION_NOT_FOUND",
739
+ (permissionId) => [
408
740
  404,
409
741
  `Permission "${permissionId}" not found. Make sure you created it on the dashboard.`,
410
742
  {
411
- permission_id: permissionId,
412
- },
413
- ], (json) => [json.permission_id]);
414
- const ContainedPermissionNotFound = createKnownErrorConstructor(KnownError, "CONTAINED_PERMISSION_NOT_FOUND", (permissionId) => [
743
+ permission_id: permissionId
744
+ }
745
+ ],
746
+ (json) => [json.permission_id]
747
+ );
748
+ var ContainedPermissionNotFound = createKnownErrorConstructor(
749
+ KnownError,
750
+ "CONTAINED_PERMISSION_NOT_FOUND",
751
+ (permissionId) => [
415
752
  400,
416
753
  `Contained permission with ID "${permissionId}" not found. Make sure you created it on the dashboard.`,
417
754
  {
418
- permission_id: permissionId,
419
- },
420
- ], (json) => [json.permission_id]);
421
- const TeamNotFound = createKnownErrorConstructor(KnownError, "TEAM_NOT_FOUND", (teamId) => [
755
+ permission_id: permissionId
756
+ }
757
+ ],
758
+ (json) => [json.permission_id]
759
+ );
760
+ var TeamNotFound = createKnownErrorConstructor(
761
+ KnownError,
762
+ "TEAM_NOT_FOUND",
763
+ (teamId) => [
422
764
  404,
423
765
  `Team ${teamId} not found.`,
424
766
  {
425
- team_id: teamId,
426
- },
427
- ], (json) => [json.team_id]);
428
- const TeamAlreadyExists = createKnownErrorConstructor(KnownError, "TEAM_ALREADY_EXISTS", (teamId) => [
767
+ team_id: teamId
768
+ }
769
+ ],
770
+ (json) => [json.team_id]
771
+ );
772
+ var TeamAlreadyExists = createKnownErrorConstructor(
773
+ KnownError,
774
+ "TEAM_ALREADY_EXISTS",
775
+ (teamId) => [
429
776
  409,
430
777
  `Team ${teamId} already exists.`,
431
778
  {
432
- team_id: teamId,
433
- },
434
- ], (json) => [json.team_id]);
435
- const TeamMembershipNotFound = createKnownErrorConstructor(KnownError, "TEAM_MEMBERSHIP_NOT_FOUND", (teamId, userId) => [
779
+ team_id: teamId
780
+ }
781
+ ],
782
+ (json) => [json.team_id]
783
+ );
784
+ var TeamMembershipNotFound = createKnownErrorConstructor(
785
+ KnownError,
786
+ "TEAM_MEMBERSHIP_NOT_FOUND",
787
+ (teamId, userId) => [
436
788
  404,
437
789
  `User ${userId} is not found in team ${teamId}.`,
438
790
  {
439
- team_id: teamId,
440
- user_id: userId,
441
- },
442
- ], (json) => [json.team_id, json.user_id]);
443
- const EmailTemplateAlreadyExists = createKnownErrorConstructor(KnownError, "EMAIL_TEMPLATE_ALREADY_EXISTS", () => [
791
+ team_id: teamId,
792
+ user_id: userId
793
+ }
794
+ ],
795
+ (json) => [json.team_id, json.user_id]
796
+ );
797
+ var EmailTemplateAlreadyExists = createKnownErrorConstructor(
798
+ KnownError,
799
+ "EMAIL_TEMPLATE_ALREADY_EXISTS",
800
+ () => [
444
801
  409,
445
- "Email template already exists.",
446
- ], () => []);
447
- const OAuthConnectionNotConnectedToUser = createKnownErrorConstructor(KnownError, "OAUTH_CONNECTION_NOT_CONNECTED_TO_USER", () => [
802
+ "Email template already exists."
803
+ ],
804
+ () => []
805
+ );
806
+ var OAuthConnectionNotConnectedToUser = createKnownErrorConstructor(
807
+ KnownError,
808
+ "OAUTH_CONNECTION_NOT_CONNECTED_TO_USER",
809
+ () => [
448
810
  400,
449
- "The OAuth connection is not connected to any user.",
450
- ], () => []);
451
- const OAuthConnectionAlreadyConnectedToAnotherUser = createKnownErrorConstructor(KnownError, "OAUTH_CONNECTION_ALREADY_CONNECTED_TO_ANOTHER_USER", () => [
811
+ "The OAuth connection is not connected to any user."
812
+ ],
813
+ () => []
814
+ );
815
+ var OAuthConnectionAlreadyConnectedToAnotherUser = createKnownErrorConstructor(
816
+ KnownError,
817
+ "OAUTH_CONNECTION_ALREADY_CONNECTED_TO_ANOTHER_USER",
818
+ () => [
452
819
  409,
453
- "The OAuth connection is already connected to another user.",
454
- ], () => []);
455
- const OAuthConnectionDoesNotHaveRequiredScope = createKnownErrorConstructor(KnownError, "OAUTH_CONNECTION_DOES_NOT_HAVE_REQUIRED_SCOPE", () => [
820
+ "The OAuth connection is already connected to another user."
821
+ ],
822
+ () => []
823
+ );
824
+ var OAuthConnectionDoesNotHaveRequiredScope = createKnownErrorConstructor(
825
+ KnownError,
826
+ "OAUTH_CONNECTION_DOES_NOT_HAVE_REQUIRED_SCOPE",
827
+ () => [
456
828
  400,
457
- "The OAuth connection does not have the required scope.",
458
- ], () => []);
459
- const OAuthExtraScopeNotAvailableWithSharedOAuthKeys = createKnownErrorConstructor(KnownError, "OAUTH_EXTRA_SCOPE_NOT_AVAILABLE_WITH_SHARED_OAUTH_KEYS", () => [
829
+ "The OAuth connection does not have the required scope."
830
+ ],
831
+ () => []
832
+ );
833
+ var OAuthExtraScopeNotAvailableWithSharedOAuthKeys = createKnownErrorConstructor(
834
+ KnownError,
835
+ "OAUTH_EXTRA_SCOPE_NOT_AVAILABLE_WITH_SHARED_OAUTH_KEYS",
836
+ () => [
460
837
  400,
461
- "Extra scopes are not available with shared OAuth keys. Please add your own OAuth keys on the Stack dashboard to use extra scopes.",
462
- ], () => []);
463
- const OAuthAccessTokenNotAvailableWithSharedOAuthKeys = createKnownErrorConstructor(KnownError, "OAUTH_ACCESS_TOKEN_NOT_AVAILABLE_WITH_SHARED_OAUTH_KEYS", () => [
838
+ "Extra scopes are not available with shared OAuth keys. Please add your own OAuth keys on the Stack dashboard to use extra scopes."
839
+ ],
840
+ () => []
841
+ );
842
+ var OAuthAccessTokenNotAvailableWithSharedOAuthKeys = createKnownErrorConstructor(
843
+ KnownError,
844
+ "OAUTH_ACCESS_TOKEN_NOT_AVAILABLE_WITH_SHARED_OAUTH_KEYS",
845
+ () => [
464
846
  400,
465
- "Access tokens are not available with shared OAuth keys. Please add your own OAuth keys on the Stack dashboard to use access tokens.",
466
- ], () => []);
467
- const InvalidOAuthClientIdOrSecret = createKnownErrorConstructor(KnownError, "INVALID_OAUTH_CLIENT_ID_OR_SECRET", (clientId) => [
847
+ "Access tokens are not available with shared OAuth keys. Please add your own OAuth keys on the Stack dashboard to use access tokens."
848
+ ],
849
+ () => []
850
+ );
851
+ var InvalidOAuthClientIdOrSecret = createKnownErrorConstructor(
852
+ KnownError,
853
+ "INVALID_OAUTH_CLIENT_ID_OR_SECRET",
854
+ (clientId) => [
468
855
  400,
469
856
  "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.",
470
857
  {
471
- client_id: clientId ?? null,
472
- },
473
- ], (json) => [json.client_id ?? undefined]);
474
- const InvalidScope = createKnownErrorConstructor(KnownError, "INVALID_SCOPE", (scope) => [
475
- 400,
476
- `The scope "${scope}" is not a valid OAuth scope for Stack.`,
477
- ], (json) => [json.scope]);
478
- const UserAlreadyConnectedToAnotherOAuthConnection = createKnownErrorConstructor(KnownError, "USER_ALREADY_CONNECTED_TO_ANOTHER_OAUTH_CONNECTION", () => [
858
+ client_id: clientId ?? null
859
+ }
860
+ ],
861
+ (json) => [json.client_id ?? void 0]
862
+ );
863
+ var InvalidScope = createKnownErrorConstructor(
864
+ KnownError,
865
+ "INVALID_SCOPE",
866
+ (scope) => [
867
+ 400,
868
+ `The scope "${scope}" is not a valid OAuth scope for Stack.`
869
+ ],
870
+ (json) => [json.scope]
871
+ );
872
+ var UserAlreadyConnectedToAnotherOAuthConnection = createKnownErrorConstructor(
873
+ KnownError,
874
+ "USER_ALREADY_CONNECTED_TO_ANOTHER_OAUTH_CONNECTION",
875
+ () => [
479
876
  409,
480
- "The user is already connected to another OAuth account. Did you maybe selected the wrong account?",
481
- ], () => []);
482
- const OuterOAuthTimeout = createKnownErrorConstructor(KnownError, "OUTER_OAUTH_TIMEOUT", () => [
877
+ "The user is already connected to another OAuth account. Did you maybe selected the wrong account?"
878
+ ],
879
+ () => []
880
+ );
881
+ var OuterOAuthTimeout = createKnownErrorConstructor(
882
+ KnownError,
883
+ "OUTER_OAUTH_TIMEOUT",
884
+ () => [
483
885
  408,
484
- "The OAuth flow has timed out. Please sign in again.",
485
- ], () => []);
486
- const OAuthProviderNotFoundOrNotEnabled = createKnownErrorConstructor(KnownError, "OAUTH_PROVIDER_NOT_FOUND_OR_NOT_ENABLED", () => [
886
+ "The OAuth flow has timed out. Please sign in again."
887
+ ],
888
+ () => []
889
+ );
890
+ var OAuthProviderNotFoundOrNotEnabled = createKnownErrorConstructor(
891
+ KnownError,
892
+ "OAUTH_PROVIDER_NOT_FOUND_OR_NOT_ENABLED",
893
+ () => [
487
894
  400,
488
- "The OAuth provider is not found or not enabled.",
489
- ], () => []);
490
- const MultiFactorAuthenticationRequired = createKnownErrorConstructor(KnownError, "MULTI_FACTOR_AUTHENTICATION_REQUIRED", (attemptCode) => [
895
+ "The OAuth provider is not found or not enabled."
896
+ ],
897
+ () => []
898
+ );
899
+ var MultiFactorAuthenticationRequired = createKnownErrorConstructor(
900
+ KnownError,
901
+ "MULTI_FACTOR_AUTHENTICATION_REQUIRED",
902
+ (attemptCode) => [
491
903
  400,
492
904
  `Multi-factor authentication is required for this user.`,
493
905
  {
494
- attempt_code: attemptCode,
495
- },
496
- ], (json) => [json.attempt_code]);
497
- const InvalidTotpCode = createKnownErrorConstructor(KnownError, "INVALID_TOTP_CODE", () => [
498
- 400,
499
- "The TOTP code is invalid. Please try again.",
500
- ], () => []);
501
- const UserAuthenticationRequired = createKnownErrorConstructor(KnownError, "USER_AUTHENTICATION_REQUIRED", () => [
906
+ attempt_code: attemptCode
907
+ }
908
+ ],
909
+ (json) => [json.attempt_code]
910
+ );
911
+ var InvalidTotpCode = createKnownErrorConstructor(
912
+ KnownError,
913
+ "INVALID_TOTP_CODE",
914
+ () => [
915
+ 400,
916
+ "The TOTP code is invalid. Please try again."
917
+ ],
918
+ () => []
919
+ );
920
+ var UserAuthenticationRequired = createKnownErrorConstructor(
921
+ KnownError,
922
+ "USER_AUTHENTICATION_REQUIRED",
923
+ () => [
502
924
  401,
503
- "User authentication required for this endpoint.",
504
- ], () => []);
505
- const TeamMembershipAlreadyExists = createKnownErrorConstructor(KnownError, "TEAM_MEMBERSHIP_ALREADY_EXISTS", () => [
925
+ "User authentication required for this endpoint."
926
+ ],
927
+ () => []
928
+ );
929
+ var TeamMembershipAlreadyExists = createKnownErrorConstructor(
930
+ KnownError,
931
+ "TEAM_MEMBERSHIP_ALREADY_EXISTS",
932
+ () => [
506
933
  409,
507
- "Team membership already exists.",
508
- ], () => []);
509
- const ProjectPermissionRequired = createKnownErrorConstructor(KnownError, "PROJECT_PERMISSION_REQUIRED", (userId, permissionId) => [
934
+ "Team membership already exists."
935
+ ],
936
+ () => []
937
+ );
938
+ var ProjectPermissionRequired = createKnownErrorConstructor(
939
+ KnownError,
940
+ "PROJECT_PERMISSION_REQUIRED",
941
+ (userId, permissionId) => [
510
942
  401,
511
943
  `User ${userId} does not have permission ${permissionId}.`,
512
944
  {
513
- user_id: userId,
514
- permission_id: permissionId,
515
- },
516
- ], (json) => [json.user_id, json.permission_id]);
517
- const TeamPermissionRequired = createKnownErrorConstructor(KnownError, "TEAM_PERMISSION_REQUIRED", (teamId, userId, permissionId) => [
945
+ user_id: userId,
946
+ permission_id: permissionId
947
+ }
948
+ ],
949
+ (json) => [json.user_id, json.permission_id]
950
+ );
951
+ var TeamPermissionRequired = createKnownErrorConstructor(
952
+ KnownError,
953
+ "TEAM_PERMISSION_REQUIRED",
954
+ (teamId, userId, permissionId) => [
518
955
  401,
519
956
  `User ${userId} does not have permission ${permissionId} in team ${teamId}.`,
520
957
  {
521
- team_id: teamId,
522
- user_id: userId,
523
- permission_id: permissionId,
524
- },
525
- ], (json) => [json.team_id, json.user_id, json.permission_id]);
526
- const TeamPermissionNotFound = createKnownErrorConstructor(KnownError, "TEAM_PERMISSION_NOT_FOUND", (teamId, userId, permissionId) => [
958
+ team_id: teamId,
959
+ user_id: userId,
960
+ permission_id: permissionId
961
+ }
962
+ ],
963
+ (json) => [json.team_id, json.user_id, json.permission_id]
964
+ );
965
+ var TeamPermissionNotFound = createKnownErrorConstructor(
966
+ KnownError,
967
+ "TEAM_PERMISSION_NOT_FOUND",
968
+ (teamId, userId, permissionId) => [
527
969
  401,
528
970
  `User ${userId} does not have permission ${permissionId} in team ${teamId}.`,
529
971
  {
530
- team_id: teamId,
531
- user_id: userId,
532
- permission_id: permissionId,
533
- },
534
- ], (json) => [json.team_id, json.user_id, json.permission_id]);
535
- const InvalidSharedOAuthProviderId = createKnownErrorConstructor(KnownError, "INVALID_SHARED_OAUTH_PROVIDER_ID", (providerId) => [
972
+ team_id: teamId,
973
+ user_id: userId,
974
+ permission_id: permissionId
975
+ }
976
+ ],
977
+ (json) => [json.team_id, json.user_id, json.permission_id]
978
+ );
979
+ var InvalidSharedOAuthProviderId = createKnownErrorConstructor(
980
+ KnownError,
981
+ "INVALID_SHARED_OAUTH_PROVIDER_ID",
982
+ (providerId) => [
536
983
  400,
537
984
  `The shared OAuth provider with ID ${providerId} is not valid.`,
538
985
  {
539
- provider_id: providerId,
540
- },
541
- ], (json) => [json.provider_id]);
542
- const InvalidStandardOAuthProviderId = createKnownErrorConstructor(KnownError, "INVALID_STANDARD_OAUTH_PROVIDER_ID", (providerId) => [
986
+ provider_id: providerId
987
+ }
988
+ ],
989
+ (json) => [json.provider_id]
990
+ );
991
+ var InvalidStandardOAuthProviderId = createKnownErrorConstructor(
992
+ KnownError,
993
+ "INVALID_STANDARD_OAUTH_PROVIDER_ID",
994
+ (providerId) => [
543
995
  400,
544
996
  `The standard OAuth provider with ID ${providerId} is not valid.`,
545
997
  {
546
- provider_id: providerId,
547
- },
548
- ], (json) => [json.provider_id]);
549
- const InvalidAuthorizationCode = createKnownErrorConstructor(KnownError, "INVALID_AUTHORIZATION_CODE", () => [
550
- 400,
551
- "The given authorization code is invalid.",
552
- ], () => []);
553
- const OAuthProviderAccessDenied = createKnownErrorConstructor(KnownError, "OAUTH_PROVIDER_ACCESS_DENIED", () => [
554
- 400,
555
- "The OAuth provider denied access to the user.",
556
- ], () => []);
557
- const ContactChannelAlreadyUsedForAuthBySomeoneElse = createKnownErrorConstructor(KnownError, "CONTACT_CHANNEL_ALREADY_USED_FOR_AUTH_BY_SOMEONE_ELSE", (type, contactChannelValue) => [
998
+ provider_id: providerId
999
+ }
1000
+ ],
1001
+ (json) => [json.provider_id]
1002
+ );
1003
+ var InvalidAuthorizationCode = createKnownErrorConstructor(
1004
+ KnownError,
1005
+ "INVALID_AUTHORIZATION_CODE",
1006
+ () => [
1007
+ 400,
1008
+ "The given authorization code is invalid."
1009
+ ],
1010
+ () => []
1011
+ );
1012
+ var OAuthProviderAccessDenied = createKnownErrorConstructor(
1013
+ KnownError,
1014
+ "OAUTH_PROVIDER_ACCESS_DENIED",
1015
+ () => [
1016
+ 400,
1017
+ "The OAuth provider denied access to the user."
1018
+ ],
1019
+ () => []
1020
+ );
1021
+ var ContactChannelAlreadyUsedForAuthBySomeoneElse = createKnownErrorConstructor(
1022
+ KnownError,
1023
+ "CONTACT_CHANNEL_ALREADY_USED_FOR_AUTH_BY_SOMEONE_ELSE",
1024
+ (type, contactChannelValue) => [
558
1025
  409,
559
- contactChannelValue ?
560
- `The ${type} (${contactChannelValue}) is already used for authentication by another account.` :
561
- `This ${type} is already used for authentication by another account.`,
562
- { type, contact_channel_value: contactChannelValue ?? null },
563
- ], (json) => [json.type, json.contact_channel_value]);
564
- const InvalidPollingCodeError = createKnownErrorConstructor(KnownError, "INVALID_POLLING_CODE", (details) => [
1026
+ contactChannelValue ? `The ${type} (${contactChannelValue}) is already used for authentication by another account.` : `This ${type} is already used for authentication by another account.`,
1027
+ { type, contact_channel_value: contactChannelValue ?? null }
1028
+ ],
1029
+ (json) => [json.type, json.contact_channel_value]
1030
+ );
1031
+ var InvalidPollingCodeError = createKnownErrorConstructor(
1032
+ KnownError,
1033
+ "INVALID_POLLING_CODE",
1034
+ (details) => [
565
1035
  400,
566
1036
  "The polling code is invalid or does not exist.",
567
- details,
568
- ], (json) => [json]);
569
- const CliAuthError = createKnownErrorConstructor(KnownError, "CLI_AUTH_ERROR", (message) => [
1037
+ details
1038
+ ],
1039
+ (json) => [json]
1040
+ );
1041
+ var CliAuthError = createKnownErrorConstructor(
1042
+ KnownError,
1043
+ "CLI_AUTH_ERROR",
1044
+ (message) => [
570
1045
  400,
571
- message,
572
- ], (json) => [json.message]);
573
- const CliAuthExpiredError = createKnownErrorConstructor(KnownError, "CLI_AUTH_EXPIRED_ERROR", (message = "CLI authentication request expired. Please try again.") => [
1046
+ message
1047
+ ],
1048
+ (json) => [json.message]
1049
+ );
1050
+ var CliAuthExpiredError = createKnownErrorConstructor(
1051
+ KnownError,
1052
+ "CLI_AUTH_EXPIRED_ERROR",
1053
+ (message = "CLI authentication request expired. Please try again.") => [
574
1054
  400,
575
- message,
576
- ], (json) => [json.message]);
577
- const CliAuthUsedError = createKnownErrorConstructor(KnownError, "CLI_AUTH_USED_ERROR", (message = "This authentication token has already been used.") => [
1055
+ message
1056
+ ],
1057
+ (json) => [json.message]
1058
+ );
1059
+ var CliAuthUsedError = createKnownErrorConstructor(
1060
+ KnownError,
1061
+ "CLI_AUTH_USED_ERROR",
1062
+ (message = "This authentication token has already been used.") => [
578
1063
  400,
579
- message,
580
- ], (json) => [json.message]);
581
- const ApiKeyNotValid = createKnownErrorConstructor(KnownError, "API_KEY_NOT_VALID", "inherit", "inherit");
582
- const ApiKeyExpired = createKnownErrorConstructor(ApiKeyNotValid, "API_KEY_EXPIRED", () => [
1064
+ message
1065
+ ],
1066
+ (json) => [json.message]
1067
+ );
1068
+ var ApiKeyNotValid = createKnownErrorConstructor(
1069
+ KnownError,
1070
+ "API_KEY_NOT_VALID",
1071
+ "inherit",
1072
+ "inherit"
1073
+ );
1074
+ var ApiKeyExpired = createKnownErrorConstructor(
1075
+ ApiKeyNotValid,
1076
+ "API_KEY_EXPIRED",
1077
+ () => [
583
1078
  401,
584
- "API key has expired.",
585
- ], () => []);
586
- const ApiKeyRevoked = createKnownErrorConstructor(ApiKeyNotValid, "API_KEY_REVOKED", () => [
1079
+ "API key has expired."
1080
+ ],
1081
+ () => []
1082
+ );
1083
+ var ApiKeyRevoked = createKnownErrorConstructor(
1084
+ ApiKeyNotValid,
1085
+ "API_KEY_REVOKED",
1086
+ () => [
587
1087
  401,
588
- "API key has been revoked.",
589
- ], () => []);
590
- const WrongApiKeyType = createKnownErrorConstructor(ApiKeyNotValid, "WRONG_API_KEY_TYPE", (expectedType, actualType) => [
1088
+ "API key has been revoked."
1089
+ ],
1090
+ () => []
1091
+ );
1092
+ var WrongApiKeyType = createKnownErrorConstructor(
1093
+ ApiKeyNotValid,
1094
+ "WRONG_API_KEY_TYPE",
1095
+ (expectedType, actualType) => [
591
1096
  400,
592
1097
  `This endpoint is for ${expectedType} API keys, but a ${actualType} API key was provided.`,
593
- { expected_type: expectedType, actual_type: actualType },
594
- ], (json) => [json.expected_type, json.actual_type]);
595
- const ApiKeyNotFound = createKnownErrorConstructor(ApiKeyNotValid, "API_KEY_NOT_FOUND", () => [
1098
+ { expected_type: expectedType, actual_type: actualType }
1099
+ ],
1100
+ (json) => [json.expected_type, json.actual_type]
1101
+ );
1102
+ var ApiKeyNotFound = createKnownErrorConstructor(
1103
+ ApiKeyNotValid,
1104
+ "API_KEY_NOT_FOUND",
1105
+ () => [
596
1106
  404,
597
- "API key not found.",
598
- ], () => []);
599
- const PublicApiKeyCannotBeRevoked = createKnownErrorConstructor(ApiKeyNotValid, "PUBLIC_API_KEY_CANNOT_BE_REVOKED", () => [
1107
+ "API key not found."
1108
+ ],
1109
+ () => []
1110
+ );
1111
+ var PublicApiKeyCannotBeRevoked = createKnownErrorConstructor(
1112
+ ApiKeyNotValid,
1113
+ "PUBLIC_API_KEY_CANNOT_BE_REVOKED",
1114
+ () => [
600
1115
  400,
601
- "Public API keys cannot be revoked by the secretscanner endpoint.",
602
- ], () => []);
603
- const PermissionIdAlreadyExists = createKnownErrorConstructor(KnownError, "PERMISSION_ID_ALREADY_EXISTS", (permissionId) => [
1116
+ "Public API keys cannot be revoked by the secretscanner endpoint."
1117
+ ],
1118
+ () => []
1119
+ );
1120
+ var PermissionIdAlreadyExists = createKnownErrorConstructor(
1121
+ KnownError,
1122
+ "PERMISSION_ID_ALREADY_EXISTS",
1123
+ (permissionId) => [
604
1124
  400,
605
1125
  `Permission with ID "${permissionId}" already exists. Choose a different ID.`,
606
1126
  {
607
- permission_id: permissionId,
608
- },
609
- ], (json) => [json.permission_id]);
610
- export const KnownErrors = {
611
- CannotDeleteCurrentSession,
612
- UnsupportedError,
613
- BodyParsingError,
614
- SchemaError,
615
- AllOverloadsFailed,
616
- ProjectAuthenticationError,
617
- PermissionIdAlreadyExists,
618
- CliAuthError,
619
- CliAuthExpiredError,
620
- CliAuthUsedError,
621
- InvalidProjectAuthentication,
622
- ProjectKeyWithoutAccessType,
623
- InvalidAccessType,
624
- AccessTypeWithoutProjectId,
625
- AccessTypeRequired,
626
- CannotGetOwnUserWithoutUser,
627
- InsufficientAccessType,
628
- InvalidPublishableClientKey,
629
- InvalidSecretServerKey,
630
- InvalidSuperSecretAdminKey,
631
- InvalidAdminAccessToken,
632
- UnparsableAdminAccessToken,
633
- AdminAccessTokenExpired,
634
- InvalidProjectForAdminAccessToken,
635
- AdminAccessTokenIsNotAdmin,
636
- ProjectAuthenticationRequired,
637
- ClientAuthenticationRequired,
638
- ServerAuthenticationRequired,
639
- ClientOrServerAuthenticationRequired,
640
- ClientOrAdminAuthenticationRequired,
641
- ClientOrServerOrAdminAuthenticationRequired,
642
- AdminAuthenticationRequired,
643
- ExpectedInternalProject,
644
- SessionAuthenticationError,
645
- InvalidSessionAuthentication,
646
- InvalidAccessToken,
647
- UnparsableAccessToken,
648
- AccessTokenExpired,
649
- InvalidProjectForAccessToken,
650
- RefreshTokenError,
651
- ProviderRejected,
652
- RefreshTokenNotFoundOrExpired,
653
- UserWithEmailAlreadyExists,
654
- EmailNotVerified,
655
- UserIdDoesNotExist,
656
- UserNotFound,
657
- ApiKeyNotFound,
658
- PublicApiKeyCannotBeRevoked,
659
- ProjectNotFound,
660
- SignUpNotEnabled,
661
- PasswordAuthenticationNotEnabled,
662
- PasskeyAuthenticationNotEnabled,
663
- AnonymousAccountsNotEnabled,
664
- EmailPasswordMismatch,
665
- RedirectUrlNotWhitelisted,
666
- PasswordRequirementsNotMet,
667
- PasswordTooShort,
668
- PasswordTooLong,
669
- UserDoesNotHavePassword,
670
- VerificationCodeError,
671
- VerificationCodeNotFound,
672
- VerificationCodeExpired,
673
- VerificationCodeAlreadyUsed,
674
- VerificationCodeMaxAttemptsReached,
675
- PasswordConfirmationMismatch,
676
- EmailAlreadyVerified,
677
- EmailNotAssociatedWithUser,
678
- EmailIsNotPrimaryEmail,
679
- PasskeyRegistrationFailed,
680
- PasskeyWebAuthnError,
681
- PasskeyAuthenticationFailed,
682
- PermissionNotFound,
683
- ContainedPermissionNotFound,
684
- TeamNotFound,
685
- TeamMembershipNotFound,
686
- EmailTemplateAlreadyExists,
687
- OAuthConnectionNotConnectedToUser,
688
- OAuthConnectionAlreadyConnectedToAnotherUser,
689
- OAuthConnectionDoesNotHaveRequiredScope,
690
- OAuthExtraScopeNotAvailableWithSharedOAuthKeys,
691
- OAuthAccessTokenNotAvailableWithSharedOAuthKeys,
692
- InvalidOAuthClientIdOrSecret,
693
- InvalidScope,
694
- UserAlreadyConnectedToAnotherOAuthConnection,
695
- OuterOAuthTimeout,
696
- OAuthProviderNotFoundOrNotEnabled,
697
- MultiFactorAuthenticationRequired,
698
- InvalidTotpCode,
699
- UserAuthenticationRequired,
700
- TeamMembershipAlreadyExists,
701
- ProjectPermissionRequired,
702
- TeamPermissionRequired,
703
- InvalidSharedOAuthProviderId,
704
- InvalidStandardOAuthProviderId,
705
- InvalidAuthorizationCode,
706
- TeamPermissionNotFound,
707
- OAuthProviderAccessDenied,
708
- ContactChannelAlreadyUsedForAuthBySomeoneElse,
709
- InvalidPollingCodeError,
710
- ApiKeyNotValid,
711
- ApiKeyExpired,
712
- ApiKeyRevoked,
713
- WrongApiKeyType,
714
- };
715
- // ensure that all known error codes are unique
716
- const knownErrorCodes = new Set();
717
- for (const [_, KnownError] of Object.entries(KnownErrors)) {
718
- if (knownErrorCodes.has(KnownError.errorCode)) {
719
- throw new Error(`Duplicate known error code: ${KnownError.errorCode}`);
1127
+ permission_id: permissionId
720
1128
  }
721
- knownErrorCodes.add(KnownError.errorCode);
1129
+ ],
1130
+ (json) => [json.permission_id]
1131
+ );
1132
+ var KnownErrors = {
1133
+ CannotDeleteCurrentSession,
1134
+ UnsupportedError,
1135
+ BodyParsingError,
1136
+ SchemaError,
1137
+ AllOverloadsFailed,
1138
+ ProjectAuthenticationError,
1139
+ PermissionIdAlreadyExists,
1140
+ CliAuthError,
1141
+ CliAuthExpiredError,
1142
+ CliAuthUsedError,
1143
+ InvalidProjectAuthentication,
1144
+ ProjectKeyWithoutAccessType,
1145
+ InvalidAccessType,
1146
+ AccessTypeWithoutProjectId,
1147
+ AccessTypeRequired,
1148
+ CannotGetOwnUserWithoutUser,
1149
+ InsufficientAccessType,
1150
+ InvalidPublishableClientKey,
1151
+ InvalidSecretServerKey,
1152
+ InvalidSuperSecretAdminKey,
1153
+ InvalidAdminAccessToken,
1154
+ UnparsableAdminAccessToken,
1155
+ AdminAccessTokenExpired,
1156
+ InvalidProjectForAdminAccessToken,
1157
+ AdminAccessTokenIsNotAdmin,
1158
+ ProjectAuthenticationRequired,
1159
+ ClientAuthenticationRequired,
1160
+ ServerAuthenticationRequired,
1161
+ ClientOrServerAuthenticationRequired,
1162
+ ClientOrAdminAuthenticationRequired,
1163
+ ClientOrServerOrAdminAuthenticationRequired,
1164
+ AdminAuthenticationRequired,
1165
+ ExpectedInternalProject,
1166
+ SessionAuthenticationError,
1167
+ InvalidSessionAuthentication,
1168
+ InvalidAccessToken,
1169
+ UnparsableAccessToken,
1170
+ AccessTokenExpired,
1171
+ InvalidProjectForAccessToken,
1172
+ RefreshTokenError,
1173
+ ProviderRejected,
1174
+ RefreshTokenNotFoundOrExpired,
1175
+ UserWithEmailAlreadyExists,
1176
+ EmailNotVerified,
1177
+ UserIdDoesNotExist,
1178
+ UserNotFound,
1179
+ ApiKeyNotFound,
1180
+ PublicApiKeyCannotBeRevoked,
1181
+ ProjectNotFound,
1182
+ SignUpNotEnabled,
1183
+ PasswordAuthenticationNotEnabled,
1184
+ PasskeyAuthenticationNotEnabled,
1185
+ AnonymousAccountsNotEnabled,
1186
+ EmailPasswordMismatch,
1187
+ RedirectUrlNotWhitelisted,
1188
+ PasswordRequirementsNotMet,
1189
+ PasswordTooShort,
1190
+ PasswordTooLong,
1191
+ UserDoesNotHavePassword,
1192
+ VerificationCodeError,
1193
+ VerificationCodeNotFound,
1194
+ VerificationCodeExpired,
1195
+ VerificationCodeAlreadyUsed,
1196
+ VerificationCodeMaxAttemptsReached,
1197
+ PasswordConfirmationMismatch,
1198
+ EmailAlreadyVerified,
1199
+ EmailNotAssociatedWithUser,
1200
+ EmailIsNotPrimaryEmail,
1201
+ PasskeyRegistrationFailed,
1202
+ PasskeyWebAuthnError,
1203
+ PasskeyAuthenticationFailed,
1204
+ PermissionNotFound,
1205
+ ContainedPermissionNotFound,
1206
+ TeamNotFound,
1207
+ TeamMembershipNotFound,
1208
+ EmailTemplateAlreadyExists,
1209
+ OAuthConnectionNotConnectedToUser,
1210
+ OAuthConnectionAlreadyConnectedToAnotherUser,
1211
+ OAuthConnectionDoesNotHaveRequiredScope,
1212
+ OAuthExtraScopeNotAvailableWithSharedOAuthKeys,
1213
+ OAuthAccessTokenNotAvailableWithSharedOAuthKeys,
1214
+ InvalidOAuthClientIdOrSecret,
1215
+ InvalidScope,
1216
+ UserAlreadyConnectedToAnotherOAuthConnection,
1217
+ OuterOAuthTimeout,
1218
+ OAuthProviderNotFoundOrNotEnabled,
1219
+ MultiFactorAuthenticationRequired,
1220
+ InvalidTotpCode,
1221
+ UserAuthenticationRequired,
1222
+ TeamMembershipAlreadyExists,
1223
+ ProjectPermissionRequired,
1224
+ TeamPermissionRequired,
1225
+ InvalidSharedOAuthProviderId,
1226
+ InvalidStandardOAuthProviderId,
1227
+ InvalidAuthorizationCode,
1228
+ TeamPermissionNotFound,
1229
+ OAuthProviderAccessDenied,
1230
+ ContactChannelAlreadyUsedForAuthBySomeoneElse,
1231
+ InvalidPollingCodeError,
1232
+ ApiKeyNotValid,
1233
+ ApiKeyExpired,
1234
+ ApiKeyRevoked,
1235
+ WrongApiKeyType
1236
+ };
1237
+ var knownErrorCodes = /* @__PURE__ */ new Set();
1238
+ for (const [_, KnownError2] of Object.entries(KnownErrors)) {
1239
+ if (knownErrorCodes.has(KnownError2.errorCode)) {
1240
+ throw new Error(`Duplicate known error code: ${KnownError2.errorCode}`);
1241
+ }
1242
+ knownErrorCodes.add(KnownError2.errorCode);
722
1243
  }
1244
+ // Annotate the CommonJS export names for ESM import in node:
1245
+ 0 && (module.exports = {
1246
+ KnownError,
1247
+ KnownErrors
1248
+ });
1249
+ //# sourceMappingURL=known-errors.js.map