create-croissant 0.1.8 → 0.1.9

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 (479) hide show
  1. package/package.json +1 -1
  2. package/template/apps/web/package.json +2 -0
  3. package/template/apps/web/src/components/login-form.tsx +95 -48
  4. package/template/apps/web/src/components/signup-form.tsx +149 -79
  5. package/template/apps/web/src/routes/__root.tsx +17 -12
  6. package/template/apps/web/src/routes/client-orpc-auth.tsx +8 -20
  7. package/template/apps/web/src/routes/client-orpc.tsx +203 -108
  8. package/template/apps/web/src/routes/ssr-orpc.tsx +169 -96
  9. package/template/package.json +3 -1
  10. package/template/apps/web/node_modules/@better-auth/core/LICENSE.md +0 -20
  11. package/template/apps/web/node_modules/@better-auth/core/README.md +0 -17
  12. package/template/apps/web/node_modules/@better-auth/core/dist/api/index.d.mts +0 -278
  13. package/template/apps/web/node_modules/@better-auth/core/dist/api/index.mjs +0 -56
  14. package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/index.d.mts +0 -6
  15. package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/index.mjs +0 -20
  16. package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/pure.index.d.mts +0 -6
  17. package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/pure.index.mjs +0 -33
  18. package/template/apps/web/node_modules/@better-auth/core/dist/context/endpoint-context.d.mts +0 -18
  19. package/template/apps/web/node_modules/@better-auth/core/dist/context/endpoint-context.mjs +0 -29
  20. package/template/apps/web/node_modules/@better-auth/core/dist/context/global.d.mts +0 -6
  21. package/template/apps/web/node_modules/@better-auth/core/dist/context/global.mjs +0 -36
  22. package/template/apps/web/node_modules/@better-auth/core/dist/context/index.d.mts +0 -5
  23. package/template/apps/web/node_modules/@better-auth/core/dist/context/index.mjs +0 -5
  24. package/template/apps/web/node_modules/@better-auth/core/dist/context/request-state.d.mts +0 -27
  25. package/template/apps/web/node_modules/@better-auth/core/dist/context/request-state.mjs +0 -47
  26. package/template/apps/web/node_modules/@better-auth/core/dist/context/transaction.d.mts +0 -24
  27. package/template/apps/web/node_modules/@better-auth/core/dist/context/transaction.mjs +0 -93
  28. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/factory.d.mts +0 -17
  29. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/factory.mjs +0 -754
  30. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.d.mts +0 -18
  31. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.mjs +0 -36
  32. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.d.mts +0 -12
  33. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.mjs +0 -30
  34. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.d.mts +0 -26
  35. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.mjs +0 -37
  36. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-name.d.mts +0 -18
  37. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-name.mjs +0 -31
  38. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-id-field.d.mts +0 -36
  39. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-id-field.mjs +0 -64
  40. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-model-name.d.mts +0 -12
  41. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-model-name.mjs +0 -21
  42. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/index.d.mts +0 -525
  43. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/index.mjs +0 -24
  44. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/types.d.mts +0 -105
  45. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/utils.d.mts +0 -7
  46. package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/utils.mjs +0 -37
  47. package/template/apps/web/node_modules/@better-auth/core/dist/db/get-tables.d.mts +0 -6
  48. package/template/apps/web/node_modules/@better-auth/core/dist/db/get-tables.mjs +0 -265
  49. package/template/apps/web/node_modules/@better-auth/core/dist/db/index.d.mts +0 -10
  50. package/template/apps/web/node_modules/@better-auth/core/dist/db/index.mjs +0 -8
  51. package/template/apps/web/node_modules/@better-auth/core/dist/db/plugin.d.mts +0 -12
  52. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/account.d.mts +0 -28
  53. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/account.mjs +0 -17
  54. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/rate-limit.d.mts +0 -18
  55. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/rate-limit.mjs +0 -9
  56. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/session.d.mts +0 -23
  57. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/session.mjs +0 -12
  58. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/shared.d.mts +0 -10
  59. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/shared.mjs +0 -9
  60. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/user.d.mts +0 -22
  61. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/user.mjs +0 -11
  62. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/verification.d.mts +0 -21
  63. package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/verification.mjs +0 -10
  64. package/template/apps/web/node_modules/@better-auth/core/dist/db/type.d.mts +0 -167
  65. package/template/apps/web/node_modules/@better-auth/core/dist/env/color-depth.d.mts +0 -4
  66. package/template/apps/web/node_modules/@better-auth/core/dist/env/color-depth.mjs +0 -86
  67. package/template/apps/web/node_modules/@better-auth/core/dist/env/env-impl.d.mts +0 -32
  68. package/template/apps/web/node_modules/@better-auth/core/dist/env/env-impl.mjs +0 -81
  69. package/template/apps/web/node_modules/@better-auth/core/dist/env/index.d.mts +0 -4
  70. package/template/apps/web/node_modules/@better-auth/core/dist/env/index.mjs +0 -4
  71. package/template/apps/web/node_modules/@better-auth/core/dist/env/logger.d.mts +0 -48
  72. package/template/apps/web/node_modules/@better-auth/core/dist/env/logger.mjs +0 -79
  73. package/template/apps/web/node_modules/@better-auth/core/dist/error/codes.d.mts +0 -68
  74. package/template/apps/web/node_modules/@better-auth/core/dist/error/codes.mjs +0 -54
  75. package/template/apps/web/node_modules/@better-auth/core/dist/error/index.d.mts +0 -19
  76. package/template/apps/web/node_modules/@better-auth/core/dist/error/index.mjs +0 -27
  77. package/template/apps/web/node_modules/@better-auth/core/dist/index.d.mts +0 -9
  78. package/template/apps/web/node_modules/@better-auth/core/dist/index.mjs +0 -1
  79. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/api.mjs +0 -12
  80. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/attributes.d.mts +0 -11
  81. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/attributes.mjs +0 -10
  82. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/index.d.mts +0 -3
  83. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/index.mjs +0 -3
  84. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/noop.mjs +0 -42
  85. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/pure.index.d.mts +0 -7
  86. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/pure.index.mjs +0 -7
  87. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/tracer.d.mts +0 -13
  88. package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/tracer.mjs +0 -53
  89. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.d.mts +0 -56
  90. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.mjs +0 -64
  91. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.d.mts +0 -44
  92. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.mjs +0 -41
  93. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/index.d.mts +0 -8
  94. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/index.mjs +0 -7
  95. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/oauth-provider.d.mts +0 -192
  96. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.d.mts +0 -54
  97. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.mjs +0 -73
  98. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/utils.d.mts +0 -16
  99. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/utils.mjs +0 -37
  100. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.d.mts +0 -85
  101. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.mjs +0 -79
  102. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/verify.d.mts +0 -42
  103. package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/verify.mjs +0 -92
  104. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/apple.d.mts +0 -126
  105. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/apple.mjs +0 -107
  106. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/atlassian.d.mts +0 -70
  107. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/atlassian.mjs +0 -80
  108. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/cognito.d.mts +0 -85
  109. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/cognito.mjs +0 -162
  110. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/discord.d.mts +0 -124
  111. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/discord.mjs +0 -62
  112. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/dropbox.d.mts +0 -69
  113. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/dropbox.mjs +0 -72
  114. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/facebook.d.mts +0 -79
  115. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/facebook.mjs +0 -124
  116. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/figma.d.mts +0 -61
  117. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/figma.mjs +0 -83
  118. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/github.d.mts +0 -102
  119. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/github.mjs +0 -92
  120. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/gitlab.d.mts +0 -123
  121. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/gitlab.mjs +0 -79
  122. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/google.d.mts +0 -97
  123. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/google.mjs +0 -109
  124. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/huggingface.d.mts +0 -83
  125. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/huggingface.mjs +0 -73
  126. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/index.d.mts +0 -1834
  127. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/index.mjs +0 -78
  128. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kakao.d.mts +0 -161
  129. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kakao.mjs +0 -70
  130. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kick.d.mts +0 -73
  131. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kick.mjs +0 -68
  132. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/line.d.mts +0 -105
  133. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/line.mjs +0 -110
  134. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linear.d.mts +0 -68
  135. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linear.mjs +0 -85
  136. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linkedin.d.mts +0 -67
  137. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linkedin.mjs +0 -73
  138. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.d.mts +0 -174
  139. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.mjs +0 -140
  140. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/naver.d.mts +0 -92
  141. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/naver.mjs +0 -65
  142. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/notion.d.mts +0 -64
  143. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/notion.mjs +0 -72
  144. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paybin.d.mts +0 -71
  145. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paybin.mjs +0 -81
  146. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paypal.d.mts +0 -129
  147. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paypal.mjs +0 -140
  148. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/polar.d.mts +0 -74
  149. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/polar.mjs +0 -71
  150. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/railway.d.mts +0 -65
  151. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/railway.mjs +0 -74
  152. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/reddit.d.mts +0 -62
  153. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/reddit.mjs +0 -80
  154. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/roblox.d.mts +0 -70
  155. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/roblox.mjs +0 -57
  156. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/salesforce.d.mts +0 -79
  157. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/salesforce.mjs +0 -87
  158. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/slack.d.mts +0 -83
  159. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/slack.mjs +0 -66
  160. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/spotify.d.mts +0 -63
  161. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/spotify.mjs +0 -69
  162. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/tiktok.d.mts +0 -168
  163. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/tiktok.mjs +0 -60
  164. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitch.d.mts +0 -79
  165. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitch.mjs +0 -75
  166. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitter.d.mts +0 -126
  167. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitter.mjs +0 -85
  168. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vercel.d.mts +0 -62
  169. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vercel.mjs +0 -58
  170. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vk.d.mts +0 -70
  171. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vk.mjs +0 -81
  172. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/wechat.d.mts +0 -113
  173. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/wechat.mjs +0 -81
  174. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/zoom.d.mts +0 -163
  175. package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/zoom.mjs +0 -69
  176. package/template/apps/web/node_modules/@better-auth/core/dist/types/context.d.mts +0 -277
  177. package/template/apps/web/node_modules/@better-auth/core/dist/types/cookie.d.mts +0 -15
  178. package/template/apps/web/node_modules/@better-auth/core/dist/types/helper.d.mts +0 -10
  179. package/template/apps/web/node_modules/@better-auth/core/dist/types/index.d.mts +0 -9
  180. package/template/apps/web/node_modules/@better-auth/core/dist/types/init-options.d.mts +0 -1358
  181. package/template/apps/web/node_modules/@better-auth/core/dist/types/plugin-client.d.mts +0 -113
  182. package/template/apps/web/node_modules/@better-auth/core/dist/types/plugin.d.mts +0 -124
  183. package/template/apps/web/node_modules/@better-auth/core/dist/types/secret.d.mts +0 -11
  184. package/template/apps/web/node_modules/@better-auth/core/dist/utils/async.d.mts +0 -22
  185. package/template/apps/web/node_modules/@better-auth/core/dist/utils/async.mjs +0 -32
  186. package/template/apps/web/node_modules/@better-auth/core/dist/utils/db.d.mts +0 -9
  187. package/template/apps/web/node_modules/@better-auth/core/dist/utils/db.mjs +0 -15
  188. package/template/apps/web/node_modules/@better-auth/core/dist/utils/deprecate.d.mts +0 -9
  189. package/template/apps/web/node_modules/@better-auth/core/dist/utils/deprecate.mjs +0 -16
  190. package/template/apps/web/node_modules/@better-auth/core/dist/utils/error-codes.d.mts +0 -13
  191. package/template/apps/web/node_modules/@better-auth/core/dist/utils/error-codes.mjs +0 -10
  192. package/template/apps/web/node_modules/@better-auth/core/dist/utils/fetch-metadata.d.mts +0 -4
  193. package/template/apps/web/node_modules/@better-auth/core/dist/utils/fetch-metadata.mjs +0 -6
  194. package/template/apps/web/node_modules/@better-auth/core/dist/utils/host.d.mts +0 -147
  195. package/template/apps/web/node_modules/@better-auth/core/dist/utils/host.mjs +0 -291
  196. package/template/apps/web/node_modules/@better-auth/core/dist/utils/id.d.mts +0 -4
  197. package/template/apps/web/node_modules/@better-auth/core/dist/utils/id.mjs +0 -7
  198. package/template/apps/web/node_modules/@better-auth/core/dist/utils/ip.d.mts +0 -54
  199. package/template/apps/web/node_modules/@better-auth/core/dist/utils/ip.mjs +0 -116
  200. package/template/apps/web/node_modules/@better-auth/core/dist/utils/is-api-error.d.mts +0 -6
  201. package/template/apps/web/node_modules/@better-auth/core/dist/utils/is-api-error.mjs +0 -8
  202. package/template/apps/web/node_modules/@better-auth/core/dist/utils/json.d.mts +0 -4
  203. package/template/apps/web/node_modules/@better-auth/core/dist/utils/json.mjs +0 -41
  204. package/template/apps/web/node_modules/@better-auth/core/dist/utils/string.d.mts +0 -4
  205. package/template/apps/web/node_modules/@better-auth/core/dist/utils/string.mjs +0 -6
  206. package/template/apps/web/node_modules/@better-auth/core/dist/utils/url.d.mts +0 -20
  207. package/template/apps/web/node_modules/@better-auth/core/dist/utils/url.mjs +0 -31
  208. package/template/apps/web/node_modules/@better-auth/core/package.json +0 -193
  209. package/template/apps/web/node_modules/@better-auth/core/src/api/index.ts +0 -140
  210. package/template/apps/web/node_modules/@better-auth/core/src/async_hooks/index.ts +0 -40
  211. package/template/apps/web/node_modules/@better-auth/core/src/async_hooks/pure.index.ts +0 -46
  212. package/template/apps/web/node_modules/@better-auth/core/src/context/endpoint-context.ts +0 -50
  213. package/template/apps/web/node_modules/@better-auth/core/src/context/global.ts +0 -57
  214. package/template/apps/web/node_modules/@better-auth/core/src/context/index.ts +0 -23
  215. package/template/apps/web/node_modules/@better-auth/core/src/context/request-state.ts +0 -91
  216. package/template/apps/web/node_modules/@better-auth/core/src/context/transaction.ts +0 -136
  217. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/factory.ts +0 -1440
  218. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-default-field-name.ts +0 -59
  219. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-default-model-name.ts +0 -51
  220. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-field-attributes.ts +0 -62
  221. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-field-name.ts +0 -43
  222. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-id-field.ts +0 -150
  223. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-model-name.ts +0 -36
  224. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/index.ts +0 -567
  225. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/types.ts +0 -132
  226. package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/utils.ts +0 -61
  227. package/template/apps/web/node_modules/@better-auth/core/src/db/get-tables.ts +0 -296
  228. package/template/apps/web/node_modules/@better-auth/core/src/db/index.ts +0 -43
  229. package/template/apps/web/node_modules/@better-auth/core/src/db/plugin.ts +0 -11
  230. package/template/apps/web/node_modules/@better-auth/core/src/db/schema/account.ts +0 -47
  231. package/template/apps/web/node_modules/@better-auth/core/src/db/schema/rate-limit.ts +0 -36
  232. package/template/apps/web/node_modules/@better-auth/core/src/db/schema/session.ts +0 -29
  233. package/template/apps/web/node_modules/@better-auth/core/src/db/schema/shared.ts +0 -7
  234. package/template/apps/web/node_modules/@better-auth/core/src/db/schema/user.ts +0 -28
  235. package/template/apps/web/node_modules/@better-auth/core/src/db/schema/verification.ts +0 -28
  236. package/template/apps/web/node_modules/@better-auth/core/src/db/type.ts +0 -333
  237. package/template/apps/web/node_modules/@better-auth/core/src/env/color-depth.ts +0 -172
  238. package/template/apps/web/node_modules/@better-auth/core/src/env/env-impl.ts +0 -124
  239. package/template/apps/web/node_modules/@better-auth/core/src/env/index.ts +0 -23
  240. package/template/apps/web/node_modules/@better-auth/core/src/env/logger.ts +0 -145
  241. package/template/apps/web/node_modules/@better-auth/core/src/error/codes.ts +0 -71
  242. package/template/apps/web/node_modules/@better-auth/core/src/error/index.ts +0 -35
  243. package/template/apps/web/node_modules/@better-auth/core/src/index.ts +0 -1
  244. package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/api.ts +0 -17
  245. package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/attributes.ts +0 -22
  246. package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/index.ts +0 -2
  247. package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/noop.ts +0 -74
  248. package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/pure.index.ts +0 -31
  249. package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/tracer.ts +0 -95
  250. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/client-credentials-token.ts +0 -126
  251. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/create-authorization-url.ts +0 -89
  252. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/index.ts +0 -33
  253. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/oauth-provider.ts +0 -222
  254. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/refresh-access-token.ts +0 -157
  255. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/utils.ts +0 -51
  256. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/validate-authorization-code.ts +0 -180
  257. package/template/apps/web/node_modules/@better-auth/core/src/oauth2/verify.ts +0 -221
  258. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/apple.ts +0 -231
  259. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/atlassian.ts +0 -133
  260. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/cognito.ts +0 -281
  261. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/discord.ts +0 -170
  262. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/dropbox.ts +0 -112
  263. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/facebook.ts +0 -215
  264. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/figma.ts +0 -118
  265. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/github.ts +0 -184
  266. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/gitlab.ts +0 -155
  267. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/google.ts +0 -204
  268. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/huggingface.ts +0 -119
  269. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/index.ts +0 -132
  270. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/kakao.ts +0 -179
  271. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/kick.ts +0 -109
  272. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/line.ts +0 -169
  273. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/linear.ts +0 -121
  274. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/linkedin.ts +0 -110
  275. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/microsoft-entra-id.ts +0 -352
  276. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/naver.ts +0 -113
  277. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/notion.ts +0 -108
  278. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/paybin.ts +0 -118
  279. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/paypal.ts +0 -263
  280. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/polar.ts +0 -111
  281. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/railway.ts +0 -100
  282. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/reddit.ts +0 -122
  283. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/roblox.ts +0 -112
  284. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/salesforce.ts +0 -159
  285. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/slack.ts +0 -112
  286. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/spotify.ts +0 -94
  287. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/tiktok.ts +0 -211
  288. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/twitch.ts +0 -112
  289. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/twitter.ts +0 -199
  290. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/vercel.ts +0 -87
  291. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/vk.ts +0 -125
  292. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/wechat.ts +0 -213
  293. package/template/apps/web/node_modules/@better-auth/core/src/social-providers/zoom.ts +0 -230
  294. package/template/apps/web/node_modules/@better-auth/core/src/types/context.ts +0 -415
  295. package/template/apps/web/node_modules/@better-auth/core/src/types/cookie.ts +0 -10
  296. package/template/apps/web/node_modules/@better-auth/core/src/types/helper.ts +0 -27
  297. package/template/apps/web/node_modules/@better-auth/core/src/types/index.ts +0 -40
  298. package/template/apps/web/node_modules/@better-auth/core/src/types/init-options.ts +0 -1610
  299. package/template/apps/web/node_modules/@better-auth/core/src/types/plugin-client.ts +0 -129
  300. package/template/apps/web/node_modules/@better-auth/core/src/types/plugin.ts +0 -163
  301. package/template/apps/web/node_modules/@better-auth/core/src/types/secret.ts +0 -8
  302. package/template/apps/web/node_modules/@better-auth/core/src/utils/async.ts +0 -53
  303. package/template/apps/web/node_modules/@better-auth/core/src/utils/db.ts +0 -20
  304. package/template/apps/web/node_modules/@better-auth/core/src/utils/deprecate.ts +0 -21
  305. package/template/apps/web/node_modules/@better-auth/core/src/utils/error-codes.ts +0 -68
  306. package/template/apps/web/node_modules/@better-auth/core/src/utils/fetch-metadata.ts +0 -3
  307. package/template/apps/web/node_modules/@better-auth/core/src/utils/host.ts +0 -401
  308. package/template/apps/web/node_modules/@better-auth/core/src/utils/id.ts +0 -5
  309. package/template/apps/web/node_modules/@better-auth/core/src/utils/ip.ts +0 -211
  310. package/template/apps/web/node_modules/@better-auth/core/src/utils/is-api-error.ts +0 -10
  311. package/template/apps/web/node_modules/@better-auth/core/src/utils/json.ts +0 -56
  312. package/template/apps/web/node_modules/@better-auth/core/src/utils/string.ts +0 -3
  313. package/template/apps/web/node_modules/@better-auth/core/src/utils/url.ts +0 -43
  314. package/template/apps/web/node_modules/@better-auth/utils/README.md +0 -384
  315. package/template/apps/web/node_modules/@better-auth/utils/dist/base32.cjs +0 -104
  316. package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.cts +0 -44
  317. package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.mts +0 -44
  318. package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.ts +0 -44
  319. package/template/apps/web/node_modules/@better-auth/utils/dist/base32.mjs +0 -101
  320. package/template/apps/web/node_modules/@better-auth/utils/dist/base64.cjs +0 -80
  321. package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.cts +0 -16
  322. package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.mts +0 -16
  323. package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.ts +0 -16
  324. package/template/apps/web/node_modules/@better-auth/utils/dist/base64.mjs +0 -77
  325. package/template/apps/web/node_modules/@better-auth/utils/dist/binary.cjs +0 -16
  326. package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.cts +0 -8
  327. package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.mts +0 -8
  328. package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.ts +0 -8
  329. package/template/apps/web/node_modules/@better-auth/utils/dist/binary.mjs +0 -14
  330. package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.cjs +0 -90
  331. package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.cts +0 -19
  332. package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.mts +0 -19
  333. package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.ts +0 -19
  334. package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.mjs +0 -88
  335. package/template/apps/web/node_modules/@better-auth/utils/dist/hash.cjs +0 -31
  336. package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.cts +0 -7
  337. package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.mts +0 -7
  338. package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.ts +0 -7
  339. package/template/apps/web/node_modules/@better-auth/utils/dist/hash.mjs +0 -29
  340. package/template/apps/web/node_modules/@better-auth/utils/dist/hex.cjs +0 -40
  341. package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.cts +0 -8
  342. package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.mts +0 -8
  343. package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.ts +0 -8
  344. package/template/apps/web/node_modules/@better-auth/utils/dist/hex.mjs +0 -38
  345. package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.cjs +0 -58
  346. package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.cts +0 -9
  347. package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.mts +0 -9
  348. package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.ts +0 -9
  349. package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.mjs +0 -56
  350. package/template/apps/web/node_modules/@better-auth/utils/dist/index.cjs +0 -10
  351. package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.cts +0 -3
  352. package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.mts +0 -3
  353. package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.ts +0 -3
  354. package/template/apps/web/node_modules/@better-auth/utils/dist/index.mjs +0 -8
  355. package/template/apps/web/node_modules/@better-auth/utils/dist/otp.cjs +0 -90
  356. package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.cts +0 -13
  357. package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.mts +0 -13
  358. package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.ts +0 -13
  359. package/template/apps/web/node_modules/@better-auth/utils/dist/otp.mjs +0 -88
  360. package/template/apps/web/node_modules/@better-auth/utils/dist/password.cjs +0 -36
  361. package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.cts +0 -4
  362. package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.mts +0 -4
  363. package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.ts +0 -4
  364. package/template/apps/web/node_modules/@better-auth/utils/dist/password.mjs +0 -33
  365. package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.cjs +0 -47
  366. package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.cts +0 -4
  367. package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.mts +0 -4
  368. package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.ts +0 -4
  369. package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.mjs +0 -44
  370. package/template/apps/web/node_modules/@better-auth/utils/dist/random.cjs +0 -55
  371. package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.cts +0 -4
  372. package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.mts +0 -4
  373. package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.ts +0 -4
  374. package/template/apps/web/node_modules/@better-auth/utils/dist/random.mjs +0 -53
  375. package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.cjs +0 -76
  376. package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.cts +0 -16
  377. package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.mts +0 -16
  378. package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.ts +0 -16
  379. package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.mjs +0 -74
  380. package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.cts +0 -22
  381. package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.mts +0 -22
  382. package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.ts +0 -22
  383. package/template/apps/web/node_modules/@better-auth/utils/package.json +0 -95
  384. package/template/apps/web/node_modules/better-call/LICENSE +0 -21
  385. package/template/apps/web/node_modules/better-call/dist/_virtual/_rolldown/runtime.cjs +0 -29
  386. package/template/apps/web/node_modules/better-call/dist/adapters/node/request.cjs +0 -181
  387. package/template/apps/web/node_modules/better-call/dist/adapters/node/request.cjs.map +0 -1
  388. package/template/apps/web/node_modules/better-call/dist/adapters/node/request.d.cts +0 -16
  389. package/template/apps/web/node_modules/better-call/dist/adapters/node/request.d.mts +0 -16
  390. package/template/apps/web/node_modules/better-call/dist/adapters/node/request.mjs +0 -178
  391. package/template/apps/web/node_modules/better-call/dist/adapters/node/request.mjs.map +0 -1
  392. package/template/apps/web/node_modules/better-call/dist/client.cjs +0 -23
  393. package/template/apps/web/node_modules/better-call/dist/client.cjs.map +0 -1
  394. package/template/apps/web/node_modules/better-call/dist/client.d.cts +0 -53
  395. package/template/apps/web/node_modules/better-call/dist/client.d.mts +0 -53
  396. package/template/apps/web/node_modules/better-call/dist/client.mjs +0 -14
  397. package/template/apps/web/node_modules/better-call/dist/client.mjs.map +0 -1
  398. package/template/apps/web/node_modules/better-call/dist/context.cjs +0 -103
  399. package/template/apps/web/node_modules/better-call/dist/context.cjs.map +0 -1
  400. package/template/apps/web/node_modules/better-call/dist/context.d.cts +0 -341
  401. package/template/apps/web/node_modules/better-call/dist/context.d.mts +0 -341
  402. package/template/apps/web/node_modules/better-call/dist/context.mjs +0 -103
  403. package/template/apps/web/node_modules/better-call/dist/context.mjs.map +0 -1
  404. package/template/apps/web/node_modules/better-call/dist/cookies.cjs +0 -87
  405. package/template/apps/web/node_modules/better-call/dist/cookies.cjs.map +0 -1
  406. package/template/apps/web/node_modules/better-call/dist/cookies.d.cts +0 -103
  407. package/template/apps/web/node_modules/better-call/dist/cookies.d.mts +0 -103
  408. package/template/apps/web/node_modules/better-call/dist/cookies.mjs +0 -84
  409. package/template/apps/web/node_modules/better-call/dist/cookies.mjs.map +0 -1
  410. package/template/apps/web/node_modules/better-call/dist/crypto.cjs +0 -39
  411. package/template/apps/web/node_modules/better-call/dist/crypto.cjs.map +0 -1
  412. package/template/apps/web/node_modules/better-call/dist/crypto.mjs +0 -36
  413. package/template/apps/web/node_modules/better-call/dist/crypto.mjs.map +0 -1
  414. package/template/apps/web/node_modules/better-call/dist/endpoint.cjs +0 -70
  415. package/template/apps/web/node_modules/better-call/dist/endpoint.cjs.map +0 -1
  416. package/template/apps/web/node_modules/better-call/dist/endpoint.d.cts +0 -475
  417. package/template/apps/web/node_modules/better-call/dist/endpoint.d.mts +0 -475
  418. package/template/apps/web/node_modules/better-call/dist/endpoint.mjs +0 -70
  419. package/template/apps/web/node_modules/better-call/dist/endpoint.mjs.map +0 -1
  420. package/template/apps/web/node_modules/better-call/dist/error.cjs +0 -141
  421. package/template/apps/web/node_modules/better-call/dist/error.cjs.map +0 -1
  422. package/template/apps/web/node_modules/better-call/dist/error.d.cts +0 -103
  423. package/template/apps/web/node_modules/better-call/dist/error.d.mts +0 -103
  424. package/template/apps/web/node_modules/better-call/dist/error.mjs +0 -133
  425. package/template/apps/web/node_modules/better-call/dist/error.mjs.map +0 -1
  426. package/template/apps/web/node_modules/better-call/dist/helper.d.cts +0 -12
  427. package/template/apps/web/node_modules/better-call/dist/helper.d.mts +0 -12
  428. package/template/apps/web/node_modules/better-call/dist/index.cjs +0 -28
  429. package/template/apps/web/node_modules/better-call/dist/index.d.cts +0 -11
  430. package/template/apps/web/node_modules/better-call/dist/index.d.mts +0 -11
  431. package/template/apps/web/node_modules/better-call/dist/index.mjs +0 -10
  432. package/template/apps/web/node_modules/better-call/dist/middleware.cjs +0 -52
  433. package/template/apps/web/node_modules/better-call/dist/middleware.cjs.map +0 -1
  434. package/template/apps/web/node_modules/better-call/dist/middleware.d.cts +0 -123
  435. package/template/apps/web/node_modules/better-call/dist/middleware.d.mts +0 -123
  436. package/template/apps/web/node_modules/better-call/dist/middleware.mjs +0 -52
  437. package/template/apps/web/node_modules/better-call/dist/middleware.mjs.map +0 -1
  438. package/template/apps/web/node_modules/better-call/dist/node.cjs +0 -18
  439. package/template/apps/web/node_modules/better-call/dist/node.cjs.map +0 -1
  440. package/template/apps/web/node_modules/better-call/dist/node.d.cts +0 -9
  441. package/template/apps/web/node_modules/better-call/dist/node.d.mts +0 -9
  442. package/template/apps/web/node_modules/better-call/dist/node.mjs +0 -15
  443. package/template/apps/web/node_modules/better-call/dist/node.mjs.map +0 -1
  444. package/template/apps/web/node_modules/better-call/dist/openapi.cjs +0 -191
  445. package/template/apps/web/node_modules/better-call/dist/openapi.cjs.map +0 -1
  446. package/template/apps/web/node_modules/better-call/dist/openapi.d.cts +0 -113
  447. package/template/apps/web/node_modules/better-call/dist/openapi.d.mts +0 -113
  448. package/template/apps/web/node_modules/better-call/dist/openapi.mjs +0 -189
  449. package/template/apps/web/node_modules/better-call/dist/openapi.mjs.map +0 -1
  450. package/template/apps/web/node_modules/better-call/dist/router.cjs +0 -118
  451. package/template/apps/web/node_modules/better-call/dist/router.cjs.map +0 -1
  452. package/template/apps/web/node_modules/better-call/dist/router.d.cts +0 -103
  453. package/template/apps/web/node_modules/better-call/dist/router.d.mts +0 -103
  454. package/template/apps/web/node_modules/better-call/dist/router.mjs +0 -117
  455. package/template/apps/web/node_modules/better-call/dist/router.mjs.map +0 -1
  456. package/template/apps/web/node_modules/better-call/dist/standard-schema.d.cts +0 -59
  457. package/template/apps/web/node_modules/better-call/dist/standard-schema.d.mts +0 -59
  458. package/template/apps/web/node_modules/better-call/dist/to-response.cjs +0 -153
  459. package/template/apps/web/node_modules/better-call/dist/to-response.cjs.map +0 -1
  460. package/template/apps/web/node_modules/better-call/dist/to-response.d.cts +0 -12
  461. package/template/apps/web/node_modules/better-call/dist/to-response.d.mts +0 -12
  462. package/template/apps/web/node_modules/better-call/dist/to-response.mjs +0 -153
  463. package/template/apps/web/node_modules/better-call/dist/to-response.mjs.map +0 -1
  464. package/template/apps/web/node_modules/better-call/dist/utils.cjs +0 -86
  465. package/template/apps/web/node_modules/better-call/dist/utils.cjs.map +0 -1
  466. package/template/apps/web/node_modules/better-call/dist/utils.mjs +0 -82
  467. package/template/apps/web/node_modules/better-call/dist/utils.mjs.map +0 -1
  468. package/template/apps/web/node_modules/better-call/dist/validator.cjs +0 -58
  469. package/template/apps/web/node_modules/better-call/dist/validator.cjs.map +0 -1
  470. package/template/apps/web/node_modules/better-call/dist/validator.mjs +0 -57
  471. package/template/apps/web/node_modules/better-call/dist/validator.mjs.map +0 -1
  472. package/template/apps/web/node_modules/better-call/package.json +0 -96
  473. package/template/apps/web/node_modules/set-cookie-parser/LICENSE +0 -21
  474. package/template/apps/web/node_modules/set-cookie-parser/README.md +0 -169
  475. package/template/apps/web/node_modules/set-cookie-parser/dist/.eslintrc.cjs +0 -16
  476. package/template/apps/web/node_modules/set-cookie-parser/dist/set-cookie.cjs +0 -260
  477. package/template/apps/web/node_modules/set-cookie-parser/lib/set-cookie.d.ts +0 -119
  478. package/template/apps/web/node_modules/set-cookie-parser/lib/set-cookie.js +0 -265
  479. package/template/apps/web/node_modules/set-cookie-parser/package.json +0 -61
@@ -1,153 +0,0 @@
1
- import "./error.mjs";
2
- import { isAPIError } from "./utils.mjs";
3
-
4
- //#region src/to-response.ts
5
- function isJSONSerializable(value) {
6
- if (value === void 0) return false;
7
- const t = typeof value;
8
- if (t === "string" || t === "number" || t === "boolean" || t === null) return true;
9
- if (t !== "object") return false;
10
- if (Array.isArray(value)) return true;
11
- if (value.buffer) return false;
12
- return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
13
- }
14
- function safeStringify(obj, replacer, space) {
15
- let id = 0;
16
- const seen = /* @__PURE__ */ new WeakMap();
17
- const safeReplacer = (key, value) => {
18
- if (typeof value === "bigint") return value.toString();
19
- if (typeof value === "object" && value !== null) {
20
- if (seen.has(value)) return `[Circular ref-${seen.get(value)}]`;
21
- seen.set(value, id++);
22
- }
23
- if (replacer) return replacer(key, value);
24
- return value;
25
- };
26
- return JSON.stringify(obj, safeReplacer, space);
27
- }
28
- function isJSONResponse(value) {
29
- if (!value || typeof value !== "object") return false;
30
- return "_flag" in value && value._flag === "json";
31
- }
32
- /**
33
- * Headers that MUST be stripped when building an HTTP response from
34
- * arbitrary header input. These are request-only, hop-by-hop, or
35
- * transport-managed headers that cause protocol violations when present
36
- * on responses (e.g. Content-Length mismatch → net::ERR_CONTENT_LENGTH_MISMATCH).
37
- *
38
- * Sources:
39
- * - RFC 9110 §10.1 (Request Context Fields)
40
- * - RFC 9110 §7.6.1 (Connection / hop-by-hop)
41
- * - RFC 9110 §11.6-7 (Authentication credentials)
42
- * - RFC 9110 §12.5 (Content negotiation)
43
- * - RFC 9110 §13.1 (Conditional request headers)
44
- * - RFC 9110 §14.2 (Range requests)
45
- * - RFC 6265 §5.4 (Cookie)
46
- * - RFC 6454 (Origin)
47
- */
48
- const REQUEST_ONLY_HEADERS = new Set([
49
- "host",
50
- "user-agent",
51
- "referer",
52
- "from",
53
- "expect",
54
- "authorization",
55
- "proxy-authorization",
56
- "cookie",
57
- "origin",
58
- "accept-charset",
59
- "accept-encoding",
60
- "accept-language",
61
- "if-match",
62
- "if-none-match",
63
- "if-modified-since",
64
- "if-unmodified-since",
65
- "if-range",
66
- "range",
67
- "max-forwards",
68
- "connection",
69
- "keep-alive",
70
- "transfer-encoding",
71
- "te",
72
- "upgrade",
73
- "trailer",
74
- "proxy-connection",
75
- "content-length"
76
- ]);
77
- function stripRequestOnlyHeaders(headers) {
78
- for (const name of REQUEST_ONLY_HEADERS) headers.delete(name);
79
- }
80
- function toResponse(data, init) {
81
- if (data instanceof Response) {
82
- if (init?.headers) {
83
- const safeHeaders = new Headers(init.headers);
84
- stripRequestOnlyHeaders(safeHeaders);
85
- safeHeaders.forEach((value, key) => {
86
- data.headers.set(key, value);
87
- });
88
- }
89
- return data;
90
- }
91
- if (isJSONResponse(data)) {
92
- const body = data.body;
93
- const routerResponse = data.routerResponse;
94
- if (routerResponse instanceof Response) return routerResponse;
95
- const headers = new Headers();
96
- if (routerResponse?.headers) {
97
- const headers = new Headers(routerResponse.headers);
98
- for (const [key, value] of headers.entries()) headers.set(key, value);
99
- }
100
- if (data.headers) for (const [key, value] of new Headers(data.headers).entries()) headers.set(key, value);
101
- if (init?.headers) {
102
- const safeHeaders = new Headers(init.headers);
103
- stripRequestOnlyHeaders(safeHeaders);
104
- for (const [key, value] of safeHeaders.entries()) headers.set(key, value);
105
- }
106
- headers.set("Content-Type", "application/json");
107
- return new Response(JSON.stringify(body), {
108
- ...routerResponse,
109
- headers,
110
- status: data.status ?? init?.status ?? routerResponse?.status,
111
- statusText: init?.statusText ?? routerResponse?.statusText
112
- });
113
- }
114
- if (isAPIError(data)) return toResponse(data.body, {
115
- status: init?.status ?? data.statusCode,
116
- statusText: data.status.toString(),
117
- headers: init?.headers || data.headers
118
- });
119
- let body = data;
120
- const headers = new Headers(init?.headers);
121
- stripRequestOnlyHeaders(headers);
122
- if (!data) {
123
- if (data === null) body = JSON.stringify(null);
124
- headers.set("content-type", "application/json");
125
- } else if (typeof data === "string") {
126
- body = data;
127
- headers.set("Content-Type", "text/plain");
128
- } else if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
129
- body = data;
130
- headers.set("Content-Type", "application/octet-stream");
131
- } else if (data instanceof Blob) {
132
- body = data;
133
- headers.set("Content-Type", data.type || "application/octet-stream");
134
- } else if (data instanceof FormData) body = data;
135
- else if (data instanceof URLSearchParams) {
136
- body = data;
137
- headers.set("Content-Type", "application/x-www-form-urlencoded");
138
- } else if (data instanceof ReadableStream) {
139
- body = data;
140
- headers.set("Content-Type", "application/octet-stream");
141
- } else if (isJSONSerializable(data)) {
142
- body = safeStringify(data);
143
- headers.set("Content-Type", "application/json");
144
- }
145
- return new Response(body, {
146
- ...init,
147
- headers
148
- });
149
- }
150
-
151
- //#endregion
152
- export { toResponse };
153
- //# sourceMappingURL=to-response.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"to-response.mjs","names":[],"sources":["../src/to-response.ts"],"sourcesContent":["import { APIError } from \"./error\";\nimport { isAPIError } from \"./utils\";\n\nfunction isJSONSerializable(value: any) {\n\tif (value === undefined) {\n\t\treturn false;\n\t}\n\tconst t = typeof value;\n\tif (t === \"string\" || t === \"number\" || t === \"boolean\" || t === null) {\n\t\treturn true;\n\t}\n\tif (t !== \"object\") {\n\t\treturn false;\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn true;\n\t}\n\tif (value.buffer) {\n\t\treturn false;\n\t}\n\treturn (\n\t\t(value.constructor && value.constructor.name === \"Object\") ||\n\t\ttypeof value.toJSON === \"function\"\n\t);\n}\n\nfunction safeStringify(\n\tobj: any,\n\treplacer?: (key: string, value: any) => any,\n\tspace?: string | number,\n): string {\n\tlet id = 0;\n\tconst seen = new WeakMap<object, number>(); // ref -> counter\n\n\tconst safeReplacer = (key: string, value: any) => {\n\t\t// Handle bigint first\n\t\tif (typeof value === \"bigint\") {\n\t\t\treturn value.toString();\n\t\t}\n\n\t\t// Then handle circular references\n\t\tif (typeof value === \"object\" && value !== null) {\n\t\t\tif (seen.has(value)) {\n\t\t\t\treturn `[Circular ref-${seen.get(value)}]`;\n\t\t\t}\n\t\t\tseen.set(value, id++);\n\t\t}\n\n\t\t// Finally apply any custom replacer\n\t\tif (replacer) {\n\t\t\treturn replacer(key, value);\n\t\t}\n\n\t\treturn value;\n\t};\n\n\treturn JSON.stringify(obj, safeReplacer, space);\n}\n\nexport type JSONResponse = {\n\tbody: Record<string, any>;\n\trouterResponse: ResponseInit | undefined;\n\tstatus?: number;\n\theaders?: Record<string, string> | Headers;\n\t_flag: \"json\";\n};\n\nfunction isJSONResponse(value: any): value is JSONResponse {\n\tif (!value || typeof value !== \"object\") {\n\t\treturn false;\n\t}\n\treturn \"_flag\" in value && value._flag === \"json\";\n}\n\n/**\n * Headers that MUST be stripped when building an HTTP response from\n * arbitrary header input. These are request-only, hop-by-hop, or\n * transport-managed headers that cause protocol violations when present\n * on responses (e.g. Content-Length mismatch → net::ERR_CONTENT_LENGTH_MISMATCH).\n *\n * Sources:\n * - RFC 9110 §10.1 (Request Context Fields)\n * - RFC 9110 §7.6.1 (Connection / hop-by-hop)\n * - RFC 9110 §11.6-7 (Authentication credentials)\n * - RFC 9110 §12.5 (Content negotiation)\n * - RFC 9110 §13.1 (Conditional request headers)\n * - RFC 9110 §14.2 (Range requests)\n * - RFC 6265 §5.4 (Cookie)\n * - RFC 6454 (Origin)\n */\nconst REQUEST_ONLY_HEADERS = new Set([\n\t// Request context (RFC 9110 §10.1)\n\t\"host\", // §7.2\n\t\"user-agent\", // §10.1.5\n\t\"referer\", // §10.1.3\n\t\"from\", // §10.1.2\n\t\"expect\", // §10.1.1\n\n\t// Authentication credentials (RFC 9110 §11.6-7)\n\t\"authorization\", // §11.6.2\n\t\"proxy-authorization\", // §11.7.2\n\t\"cookie\", // RFC 6265 §5.4\n\t\"origin\", // RFC 6454\n\n\t// Content negotiation (RFC 9110 §12.5)\n\t\"accept-charset\", // §12.5.2 (deprecated)\n\t\"accept-encoding\", // §12.5.3\n\t\"accept-language\", // §12.5.4\n\n\t// Conditional requests (RFC 9110 §13.1)\n\t\"if-match\", // §13.1.1\n\t\"if-none-match\", // §13.1.2\n\t\"if-modified-since\", // §13.1.3\n\t\"if-unmodified-since\", // §13.1.4\n\t\"if-range\", // §13.1.5\n\n\t// Range requests (RFC 9110 §14.2)\n\t\"range\", // §14.2\n\n\t// Forwarding control (RFC 9110 §7.6)\n\t\"max-forwards\", // §7.6.2\n\n\t// Hop-by-hop (RFC 9110 §7.6.1)\n\t\"connection\", // §7.6.1\n\t\"keep-alive\",\n\t\"transfer-encoding\",\n\t\"te\", // §10.1.4\n\t\"upgrade\",\n\t\"trailer\",\n\t\"proxy-connection\", // non-standard\n\n\t// Valid on responses but WRONG if copied from request (RFC 9110 §8.6)\n\t\"content-length\",\n]);\n\nfunction stripRequestOnlyHeaders(headers: Headers): void {\n\tfor (const name of REQUEST_ONLY_HEADERS) {\n\t\theaders.delete(name);\n\t}\n}\n\nexport function toResponse(data?: any, init?: ResponseInit): Response {\n\tif (data instanceof Response) {\n\t\tif (init?.headers) {\n\t\t\tconst safeHeaders = new Headers(init.headers);\n\t\t\tstripRequestOnlyHeaders(safeHeaders);\n\t\t\tsafeHeaders.forEach((value, key) => {\n\t\t\t\tdata.headers.set(key, value);\n\t\t\t});\n\t\t}\n\t\treturn data;\n\t}\n\tconst isJSON = isJSONResponse(data);\n\tif (isJSON) {\n\t\tconst body = data.body;\n\t\tconst routerResponse = data.routerResponse;\n\t\tif (routerResponse instanceof Response) {\n\t\t\treturn routerResponse;\n\t\t}\n\t\tconst headers = new Headers();\n\t\tif (routerResponse?.headers) {\n\t\t\tconst headers = new Headers(routerResponse.headers);\n\t\t\tfor (const [key, value] of headers.entries()) {\n\t\t\t\theaders.set(key, value);\n\t\t\t}\n\t\t}\n\t\tif (data.headers) {\n\t\t\tfor (const [key, value] of new Headers(data.headers).entries()) {\n\t\t\t\theaders.set(key, value);\n\t\t\t}\n\t\t}\n\t\tif (init?.headers) {\n\t\t\tconst safeHeaders = new Headers(init.headers);\n\t\t\tstripRequestOnlyHeaders(safeHeaders);\n\t\t\tfor (const [key, value] of safeHeaders.entries()) {\n\t\t\t\theaders.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\theaders.set(\"Content-Type\", \"application/json\");\n\t\treturn new Response(JSON.stringify(body), {\n\t\t\t...routerResponse,\n\t\t\theaders,\n\t\t\tstatus: data.status ?? init?.status ?? routerResponse?.status,\n\t\t\tstatusText: init?.statusText ?? routerResponse?.statusText,\n\t\t});\n\t}\n\tif (isAPIError(data)) {\n\t\treturn toResponse(data.body, {\n\t\t\tstatus: init?.status ?? data.statusCode,\n\t\t\tstatusText: data.status.toString(),\n\t\t\theaders: init?.headers || data.headers,\n\t\t});\n\t}\n\tlet body = data;\n\tconst headers = new Headers(init?.headers);\n\tstripRequestOnlyHeaders(headers);\n\tif (!data) {\n\t\tif (data === null) {\n\t\t\tbody = JSON.stringify(null);\n\t\t}\n\t\theaders.set(\"content-type\", \"application/json\");\n\t} else if (typeof data === \"string\") {\n\t\tbody = data;\n\t\theaders.set(\"Content-Type\", \"text/plain\");\n\t} else if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {\n\t\tbody = data;\n\t\theaders.set(\"Content-Type\", \"application/octet-stream\");\n\t} else if (data instanceof Blob) {\n\t\tbody = data;\n\t\theaders.set(\"Content-Type\", data.type || \"application/octet-stream\");\n\t} else if (data instanceof FormData) {\n\t\tbody = data;\n\t} else if (data instanceof URLSearchParams) {\n\t\tbody = data;\n\t\theaders.set(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\t} else if (data instanceof ReadableStream) {\n\t\tbody = data;\n\t\theaders.set(\"Content-Type\", \"application/octet-stream\");\n\t} else if (isJSONSerializable(data)) {\n\t\tbody = safeStringify(data);\n\t\theaders.set(\"Content-Type\", \"application/json\");\n\t}\n\n\treturn new Response(body, {\n\t\t...init,\n\t\theaders,\n\t});\n}\n"],"mappings":";;;;AAGA,SAAS,mBAAmB,OAAY;AACvC,KAAI,UAAU,OACb,QAAO;CAER,MAAM,IAAI,OAAO;AACjB,KAAI,MAAM,YAAY,MAAM,YAAY,MAAM,aAAa,MAAM,KAChE,QAAO;AAER,KAAI,MAAM,SACT,QAAO;AAER,KAAI,MAAM,QAAQ,MAAM,CACvB,QAAO;AAER,KAAI,MAAM,OACT,QAAO;AAER,QACE,MAAM,eAAe,MAAM,YAAY,SAAS,YACjD,OAAO,MAAM,WAAW;;AAI1B,SAAS,cACR,KACA,UACA,OACS;CACT,IAAI,KAAK;CACT,MAAM,uBAAO,IAAI,SAAyB;CAE1C,MAAM,gBAAgB,KAAa,UAAe;AAEjD,MAAI,OAAO,UAAU,SACpB,QAAO,MAAM,UAAU;AAIxB,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAChD,OAAI,KAAK,IAAI,MAAM,CAClB,QAAO,iBAAiB,KAAK,IAAI,MAAM,CAAC;AAEzC,QAAK,IAAI,OAAO,KAAK;;AAItB,MAAI,SACH,QAAO,SAAS,KAAK,MAAM;AAG5B,SAAO;;AAGR,QAAO,KAAK,UAAU,KAAK,cAAc,MAAM;;AAWhD,SAAS,eAAe,OAAmC;AAC1D,KAAI,CAAC,SAAS,OAAO,UAAU,SAC9B,QAAO;AAER,QAAO,WAAW,SAAS,MAAM,UAAU;;;;;;;;;;;;;;;;;;AAmB5C,MAAM,uBAAuB,IAAI,IAAI;CAEpC;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CAGA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CAGA;CAGA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA,CAAC;AAEF,SAAS,wBAAwB,SAAwB;AACxD,MAAK,MAAM,QAAQ,qBAClB,SAAQ,OAAO,KAAK;;AAItB,SAAgB,WAAW,MAAY,MAA+B;AACrE,KAAI,gBAAgB,UAAU;AAC7B,MAAI,MAAM,SAAS;GAClB,MAAM,cAAc,IAAI,QAAQ,KAAK,QAAQ;AAC7C,2BAAwB,YAAY;AACpC,eAAY,SAAS,OAAO,QAAQ;AACnC,SAAK,QAAQ,IAAI,KAAK,MAAM;KAC3B;;AAEH,SAAO;;AAGR,KADe,eAAe,KAAK,EACvB;EACX,MAAM,OAAO,KAAK;EAClB,MAAM,iBAAiB,KAAK;AAC5B,MAAI,0BAA0B,SAC7B,QAAO;EAER,MAAM,UAAU,IAAI,SAAS;AAC7B,MAAI,gBAAgB,SAAS;GAC5B,MAAM,UAAU,IAAI,QAAQ,eAAe,QAAQ;AACnD,QAAK,MAAM,CAAC,KAAK,UAAU,QAAQ,SAAS,CAC3C,SAAQ,IAAI,KAAK,MAAM;;AAGzB,MAAI,KAAK,QACR,MAAK,MAAM,CAAC,KAAK,UAAU,IAAI,QAAQ,KAAK,QAAQ,CAAC,SAAS,CAC7D,SAAQ,IAAI,KAAK,MAAM;AAGzB,MAAI,MAAM,SAAS;GAClB,MAAM,cAAc,IAAI,QAAQ,KAAK,QAAQ;AAC7C,2BAAwB,YAAY;AACpC,QAAK,MAAM,CAAC,KAAK,UAAU,YAAY,SAAS,CAC/C,SAAQ,IAAI,KAAK,MAAM;;AAIzB,UAAQ,IAAI,gBAAgB,mBAAmB;AAC/C,SAAO,IAAI,SAAS,KAAK,UAAU,KAAK,EAAE;GACzC,GAAG;GACH;GACA,QAAQ,KAAK,UAAU,MAAM,UAAU,gBAAgB;GACvD,YAAY,MAAM,cAAc,gBAAgB;GAChD,CAAC;;AAEH,KAAI,WAAW,KAAK,CACnB,QAAO,WAAW,KAAK,MAAM;EAC5B,QAAQ,MAAM,UAAU,KAAK;EAC7B,YAAY,KAAK,OAAO,UAAU;EAClC,SAAS,MAAM,WAAW,KAAK;EAC/B,CAAC;CAEH,IAAI,OAAO;CACX,MAAM,UAAU,IAAI,QAAQ,MAAM,QAAQ;AAC1C,yBAAwB,QAAQ;AAChC,KAAI,CAAC,MAAM;AACV,MAAI,SAAS,KACZ,QAAO,KAAK,UAAU,KAAK;AAE5B,UAAQ,IAAI,gBAAgB,mBAAmB;YACrC,OAAO,SAAS,UAAU;AACpC,SAAO;AACP,UAAQ,IAAI,gBAAgB,aAAa;YAC/B,gBAAgB,eAAe,YAAY,OAAO,KAAK,EAAE;AACnE,SAAO;AACP,UAAQ,IAAI,gBAAgB,2BAA2B;YAC7C,gBAAgB,MAAM;AAChC,SAAO;AACP,UAAQ,IAAI,gBAAgB,KAAK,QAAQ,2BAA2B;YAC1D,gBAAgB,SAC1B,QAAO;UACG,gBAAgB,iBAAiB;AAC3C,SAAO;AACP,UAAQ,IAAI,gBAAgB,oCAAoC;YACtD,gBAAgB,gBAAgB;AAC1C,SAAO;AACP,UAAQ,IAAI,gBAAgB,2BAA2B;YAC7C,mBAAmB,KAAK,EAAE;AACpC,SAAO,cAAc,KAAK;AAC1B,UAAQ,IAAI,gBAAgB,mBAAmB;;AAGhD,QAAO,IAAI,SAAS,MAAM;EACzB,GAAG;EACH;EACA,CAAC"}
@@ -1,86 +0,0 @@
1
- const require_error = require('./error.cjs');
2
-
3
- //#region src/utils.ts
4
- const jsonContentTypeRegex = /^application\/([a-z0-9.+-]*\+)?json/i;
5
- async function getBody(request, allowedMediaTypes) {
6
- const contentType = request.headers.get("content-type") || "";
7
- const normalizedContentType = contentType.toLowerCase();
8
- if (!request.body) return;
9
- if (allowedMediaTypes && allowedMediaTypes.length > 0) {
10
- if (!allowedMediaTypes.some((allowed) => {
11
- const normalizedContentTypeBase = normalizedContentType.split(";")[0].trim();
12
- const normalizedAllowed = allowed.toLowerCase().trim();
13
- return normalizedContentTypeBase === normalizedAllowed || normalizedContentTypeBase.includes(normalizedAllowed);
14
- })) {
15
- if (!normalizedContentType) throw new require_error.APIError(415, {
16
- message: `Content-Type is required. Allowed types: ${allowedMediaTypes.join(", ")}`,
17
- code: "UNSUPPORTED_MEDIA_TYPE"
18
- });
19
- throw new require_error.APIError(415, {
20
- message: `Content-Type "${contentType}" is not allowed. Allowed types: ${allowedMediaTypes.join(", ")}`,
21
- code: "UNSUPPORTED_MEDIA_TYPE"
22
- });
23
- }
24
- }
25
- if (jsonContentTypeRegex.test(normalizedContentType)) return await request.json();
26
- if (normalizedContentType.includes("application/x-www-form-urlencoded")) {
27
- const formData = await request.formData();
28
- const result = {};
29
- formData.forEach((value, key) => {
30
- result[key] = value.toString();
31
- });
32
- return result;
33
- }
34
- if (normalizedContentType.includes("multipart/form-data")) {
35
- const formData = await request.formData();
36
- const result = {};
37
- formData.forEach((value, key) => {
38
- result[key] = value;
39
- });
40
- return result;
41
- }
42
- if (normalizedContentType.includes("text/plain")) return await request.text();
43
- if (normalizedContentType.includes("application/octet-stream")) return await request.arrayBuffer();
44
- if (normalizedContentType.includes("application/pdf") || normalizedContentType.includes("image/") || normalizedContentType.includes("video/")) return await request.blob();
45
- if (normalizedContentType.includes("application/stream") || request.body instanceof ReadableStream) return request.body;
46
- return await request.text();
47
- }
48
- function isAPIError(error) {
49
- return error instanceof require_error.APIError || error?.name === "APIError";
50
- }
51
- function tryDecode(str) {
52
- try {
53
- return str.includes("%") ? decodeURIComponent(str) : str;
54
- } catch {
55
- return str;
56
- }
57
- }
58
- async function tryCatch(promise) {
59
- try {
60
- return {
61
- data: await promise,
62
- error: null
63
- };
64
- } catch (error) {
65
- return {
66
- data: null,
67
- error
68
- };
69
- }
70
- }
71
- /**
72
- * Check if an object is a `Request`
73
- * - `instanceof`: works for native Request instances
74
- * - `toString`: handles where instanceof check fails but the object is still a valid Request
75
- */
76
- function isRequest(obj) {
77
- return obj instanceof Request || Object.prototype.toString.call(obj) === "[object Request]";
78
- }
79
-
80
- //#endregion
81
- exports.getBody = getBody;
82
- exports.isAPIError = isAPIError;
83
- exports.isRequest = isRequest;
84
- exports.tryCatch = tryCatch;
85
- exports.tryDecode = tryDecode;
86
- //# sourceMappingURL=utils.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.cjs","names":["APIError"],"sources":["../src/utils.ts"],"sourcesContent":["import { APIError } from \"./error\";\n\nconst jsonContentTypeRegex = /^application\\/([a-z0-9.+-]*\\+)?json/i;\n\nexport async function getBody(request: Request, allowedMediaTypes?: string[]) {\n\tconst contentType = request.headers.get(\"content-type\") || \"\";\n\tconst normalizedContentType = contentType.toLowerCase();\n\n\tif (!request.body) {\n\t\treturn undefined;\n\t}\n\n\t// Validate content-type if allowedMediaTypes is provided\n\tif (allowedMediaTypes && allowedMediaTypes.length > 0) {\n\t\tconst isAllowed = allowedMediaTypes.some((allowed) => {\n\t\t\t// Normalize both content types for comparison\n\t\t\tconst normalizedContentTypeBase = normalizedContentType\n\t\t\t\t.split(\";\")[0]!\n\t\t\t\t.trim();\n\t\t\tconst normalizedAllowed = allowed.toLowerCase().trim();\n\t\t\treturn (\n\t\t\t\tnormalizedContentTypeBase === normalizedAllowed ||\n\t\t\t\tnormalizedContentTypeBase.includes(normalizedAllowed)\n\t\t\t);\n\t\t});\n\n\t\tif (!isAllowed) {\n\t\t\tif (!normalizedContentType) {\n\t\t\t\tthrow new APIError(415, {\n\t\t\t\t\tmessage: `Content-Type is required. Allowed types: ${allowedMediaTypes.join(\", \")}`,\n\t\t\t\t\tcode: \"UNSUPPORTED_MEDIA_TYPE\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow new APIError(415, {\n\t\t\t\tmessage: `Content-Type \"${contentType}\" is not allowed. Allowed types: ${allowedMediaTypes.join(\", \")}`,\n\t\t\t\tcode: \"UNSUPPORTED_MEDIA_TYPE\",\n\t\t\t});\n\t\t}\n\t}\n\n\tif (jsonContentTypeRegex.test(normalizedContentType)) {\n\t\treturn await request.json();\n\t}\n\n\tif (normalizedContentType.includes(\"application/x-www-form-urlencoded\")) {\n\t\tconst formData = await request.formData();\n\t\tconst result: Record<string, string> = {};\n\t\tformData.forEach((value, key) => {\n\t\t\tresult[key] = value.toString();\n\t\t});\n\t\treturn result;\n\t}\n\n\tif (normalizedContentType.includes(\"multipart/form-data\")) {\n\t\tconst formData = await request.formData();\n\t\tconst result: Record<string, any> = {};\n\t\tformData.forEach((value, key) => {\n\t\t\tresult[key] = value;\n\t\t});\n\t\treturn result;\n\t}\n\n\tif (normalizedContentType.includes(\"text/plain\")) {\n\t\treturn await request.text();\n\t}\n\n\tif (normalizedContentType.includes(\"application/octet-stream\")) {\n\t\treturn await request.arrayBuffer();\n\t}\n\n\tif (\n\t\tnormalizedContentType.includes(\"application/pdf\") ||\n\t\tnormalizedContentType.includes(\"image/\") ||\n\t\tnormalizedContentType.includes(\"video/\")\n\t) {\n\t\tconst blob = await request.blob();\n\t\treturn blob;\n\t}\n\n\tif (\n\t\tnormalizedContentType.includes(\"application/stream\") ||\n\t\trequest.body instanceof ReadableStream\n\t) {\n\t\treturn request.body;\n\t}\n\n\treturn await request.text();\n}\n\nexport function isAPIError(error: any): error is APIError {\n\treturn error instanceof APIError || error?.name === \"APIError\";\n}\n\nexport function tryDecode(str: string) {\n\ttry {\n\t\treturn str.includes(\"%\") ? decodeURIComponent(str) : str;\n\t} catch {\n\t\treturn str;\n\t}\n}\n\ntype Success<T> = {\n\tdata: T;\n\terror: null;\n};\n\ntype Failure<E> = {\n\tdata: null;\n\terror: E;\n};\n\ntype Result<T, E = Error> = Success<T> | Failure<E>;\n\nexport async function tryCatch<T, E = Error>(\n\tpromise: Promise<T>,\n): Promise<Result<T, E>> {\n\ttry {\n\t\tconst data = await promise;\n\t\treturn { data, error: null };\n\t} catch (error) {\n\t\treturn { data: null, error: error as E };\n\t}\n}\n\n/**\n * Check if an object is a `Request`\n * - `instanceof`: works for native Request instances\n * - `toString`: handles where instanceof check fails but the object is still a valid Request\n */\nexport function isRequest(obj: unknown): obj is Request {\n\treturn (\n\t\tobj instanceof Request ||\n\t\tObject.prototype.toString.call(obj) === \"[object Request]\"\n\t);\n}\n"],"mappings":";;;AAEA,MAAM,uBAAuB;AAE7B,eAAsB,QAAQ,SAAkB,mBAA8B;CAC7E,MAAM,cAAc,QAAQ,QAAQ,IAAI,eAAe,IAAI;CAC3D,MAAM,wBAAwB,YAAY,aAAa;AAEvD,KAAI,CAAC,QAAQ,KACZ;AAID,KAAI,qBAAqB,kBAAkB,SAAS,GAanD;MAAI,CAZc,kBAAkB,MAAM,YAAY;GAErD,MAAM,4BAA4B,sBAChC,MAAM,IAAI,CAAC,GACX,MAAM;GACR,MAAM,oBAAoB,QAAQ,aAAa,CAAC,MAAM;AACtD,UACC,8BAA8B,qBAC9B,0BAA0B,SAAS,kBAAkB;IAErD,EAEc;AACf,OAAI,CAAC,sBACJ,OAAM,IAAIA,uBAAS,KAAK;IACvB,SAAS,4CAA4C,kBAAkB,KAAK,KAAK;IACjF,MAAM;IACN,CAAC;AAEH,SAAM,IAAIA,uBAAS,KAAK;IACvB,SAAS,iBAAiB,YAAY,mCAAmC,kBAAkB,KAAK,KAAK;IACrG,MAAM;IACN,CAAC;;;AAIJ,KAAI,qBAAqB,KAAK,sBAAsB,CACnD,QAAO,MAAM,QAAQ,MAAM;AAG5B,KAAI,sBAAsB,SAAS,oCAAoC,EAAE;EACxE,MAAM,WAAW,MAAM,QAAQ,UAAU;EACzC,MAAM,SAAiC,EAAE;AACzC,WAAS,SAAS,OAAO,QAAQ;AAChC,UAAO,OAAO,MAAM,UAAU;IAC7B;AACF,SAAO;;AAGR,KAAI,sBAAsB,SAAS,sBAAsB,EAAE;EAC1D,MAAM,WAAW,MAAM,QAAQ,UAAU;EACzC,MAAM,SAA8B,EAAE;AACtC,WAAS,SAAS,OAAO,QAAQ;AAChC,UAAO,OAAO;IACb;AACF,SAAO;;AAGR,KAAI,sBAAsB,SAAS,aAAa,CAC/C,QAAO,MAAM,QAAQ,MAAM;AAG5B,KAAI,sBAAsB,SAAS,2BAA2B,CAC7D,QAAO,MAAM,QAAQ,aAAa;AAGnC,KACC,sBAAsB,SAAS,kBAAkB,IACjD,sBAAsB,SAAS,SAAS,IACxC,sBAAsB,SAAS,SAAS,CAGxC,QADa,MAAM,QAAQ,MAAM;AAIlC,KACC,sBAAsB,SAAS,qBAAqB,IACpD,QAAQ,gBAAgB,eAExB,QAAO,QAAQ;AAGhB,QAAO,MAAM,QAAQ,MAAM;;AAG5B,SAAgB,WAAW,OAA+B;AACzD,QAAO,iBAAiBA,0BAAY,OAAO,SAAS;;AAGrD,SAAgB,UAAU,KAAa;AACtC,KAAI;AACH,SAAO,IAAI,SAAS,IAAI,GAAG,mBAAmB,IAAI,GAAG;SAC9C;AACP,SAAO;;;AAgBT,eAAsB,SACrB,SACwB;AACxB,KAAI;AAEH,SAAO;GAAE,MADI,MAAM;GACJ,OAAO;GAAM;UACpB,OAAO;AACf,SAAO;GAAE,MAAM;GAAa;GAAY;;;;;;;;AAS1C,SAAgB,UAAU,KAA8B;AACvD,QACC,eAAe,WACf,OAAO,UAAU,SAAS,KAAK,IAAI,KAAK"}
@@ -1,82 +0,0 @@
1
- import { APIError } from "./error.mjs";
2
-
3
- //#region src/utils.ts
4
- const jsonContentTypeRegex = /^application\/([a-z0-9.+-]*\+)?json/i;
5
- async function getBody(request, allowedMediaTypes) {
6
- const contentType = request.headers.get("content-type") || "";
7
- const normalizedContentType = contentType.toLowerCase();
8
- if (!request.body) return;
9
- if (allowedMediaTypes && allowedMediaTypes.length > 0) {
10
- if (!allowedMediaTypes.some((allowed) => {
11
- const normalizedContentTypeBase = normalizedContentType.split(";")[0].trim();
12
- const normalizedAllowed = allowed.toLowerCase().trim();
13
- return normalizedContentTypeBase === normalizedAllowed || normalizedContentTypeBase.includes(normalizedAllowed);
14
- })) {
15
- if (!normalizedContentType) throw new APIError(415, {
16
- message: `Content-Type is required. Allowed types: ${allowedMediaTypes.join(", ")}`,
17
- code: "UNSUPPORTED_MEDIA_TYPE"
18
- });
19
- throw new APIError(415, {
20
- message: `Content-Type "${contentType}" is not allowed. Allowed types: ${allowedMediaTypes.join(", ")}`,
21
- code: "UNSUPPORTED_MEDIA_TYPE"
22
- });
23
- }
24
- }
25
- if (jsonContentTypeRegex.test(normalizedContentType)) return await request.json();
26
- if (normalizedContentType.includes("application/x-www-form-urlencoded")) {
27
- const formData = await request.formData();
28
- const result = {};
29
- formData.forEach((value, key) => {
30
- result[key] = value.toString();
31
- });
32
- return result;
33
- }
34
- if (normalizedContentType.includes("multipart/form-data")) {
35
- const formData = await request.formData();
36
- const result = {};
37
- formData.forEach((value, key) => {
38
- result[key] = value;
39
- });
40
- return result;
41
- }
42
- if (normalizedContentType.includes("text/plain")) return await request.text();
43
- if (normalizedContentType.includes("application/octet-stream")) return await request.arrayBuffer();
44
- if (normalizedContentType.includes("application/pdf") || normalizedContentType.includes("image/") || normalizedContentType.includes("video/")) return await request.blob();
45
- if (normalizedContentType.includes("application/stream") || request.body instanceof ReadableStream) return request.body;
46
- return await request.text();
47
- }
48
- function isAPIError(error) {
49
- return error instanceof APIError || error?.name === "APIError";
50
- }
51
- function tryDecode(str) {
52
- try {
53
- return str.includes("%") ? decodeURIComponent(str) : str;
54
- } catch {
55
- return str;
56
- }
57
- }
58
- async function tryCatch(promise) {
59
- try {
60
- return {
61
- data: await promise,
62
- error: null
63
- };
64
- } catch (error) {
65
- return {
66
- data: null,
67
- error
68
- };
69
- }
70
- }
71
- /**
72
- * Check if an object is a `Request`
73
- * - `instanceof`: works for native Request instances
74
- * - `toString`: handles where instanceof check fails but the object is still a valid Request
75
- */
76
- function isRequest(obj) {
77
- return obj instanceof Request || Object.prototype.toString.call(obj) === "[object Request]";
78
- }
79
-
80
- //#endregion
81
- export { getBody, isAPIError, isRequest, tryCatch, tryDecode };
82
- //# sourceMappingURL=utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { APIError } from \"./error\";\n\nconst jsonContentTypeRegex = /^application\\/([a-z0-9.+-]*\\+)?json/i;\n\nexport async function getBody(request: Request, allowedMediaTypes?: string[]) {\n\tconst contentType = request.headers.get(\"content-type\") || \"\";\n\tconst normalizedContentType = contentType.toLowerCase();\n\n\tif (!request.body) {\n\t\treturn undefined;\n\t}\n\n\t// Validate content-type if allowedMediaTypes is provided\n\tif (allowedMediaTypes && allowedMediaTypes.length > 0) {\n\t\tconst isAllowed = allowedMediaTypes.some((allowed) => {\n\t\t\t// Normalize both content types for comparison\n\t\t\tconst normalizedContentTypeBase = normalizedContentType\n\t\t\t\t.split(\";\")[0]!\n\t\t\t\t.trim();\n\t\t\tconst normalizedAllowed = allowed.toLowerCase().trim();\n\t\t\treturn (\n\t\t\t\tnormalizedContentTypeBase === normalizedAllowed ||\n\t\t\t\tnormalizedContentTypeBase.includes(normalizedAllowed)\n\t\t\t);\n\t\t});\n\n\t\tif (!isAllowed) {\n\t\t\tif (!normalizedContentType) {\n\t\t\t\tthrow new APIError(415, {\n\t\t\t\t\tmessage: `Content-Type is required. Allowed types: ${allowedMediaTypes.join(\", \")}`,\n\t\t\t\t\tcode: \"UNSUPPORTED_MEDIA_TYPE\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow new APIError(415, {\n\t\t\t\tmessage: `Content-Type \"${contentType}\" is not allowed. Allowed types: ${allowedMediaTypes.join(\", \")}`,\n\t\t\t\tcode: \"UNSUPPORTED_MEDIA_TYPE\",\n\t\t\t});\n\t\t}\n\t}\n\n\tif (jsonContentTypeRegex.test(normalizedContentType)) {\n\t\treturn await request.json();\n\t}\n\n\tif (normalizedContentType.includes(\"application/x-www-form-urlencoded\")) {\n\t\tconst formData = await request.formData();\n\t\tconst result: Record<string, string> = {};\n\t\tformData.forEach((value, key) => {\n\t\t\tresult[key] = value.toString();\n\t\t});\n\t\treturn result;\n\t}\n\n\tif (normalizedContentType.includes(\"multipart/form-data\")) {\n\t\tconst formData = await request.formData();\n\t\tconst result: Record<string, any> = {};\n\t\tformData.forEach((value, key) => {\n\t\t\tresult[key] = value;\n\t\t});\n\t\treturn result;\n\t}\n\n\tif (normalizedContentType.includes(\"text/plain\")) {\n\t\treturn await request.text();\n\t}\n\n\tif (normalizedContentType.includes(\"application/octet-stream\")) {\n\t\treturn await request.arrayBuffer();\n\t}\n\n\tif (\n\t\tnormalizedContentType.includes(\"application/pdf\") ||\n\t\tnormalizedContentType.includes(\"image/\") ||\n\t\tnormalizedContentType.includes(\"video/\")\n\t) {\n\t\tconst blob = await request.blob();\n\t\treturn blob;\n\t}\n\n\tif (\n\t\tnormalizedContentType.includes(\"application/stream\") ||\n\t\trequest.body instanceof ReadableStream\n\t) {\n\t\treturn request.body;\n\t}\n\n\treturn await request.text();\n}\n\nexport function isAPIError(error: any): error is APIError {\n\treturn error instanceof APIError || error?.name === \"APIError\";\n}\n\nexport function tryDecode(str: string) {\n\ttry {\n\t\treturn str.includes(\"%\") ? decodeURIComponent(str) : str;\n\t} catch {\n\t\treturn str;\n\t}\n}\n\ntype Success<T> = {\n\tdata: T;\n\terror: null;\n};\n\ntype Failure<E> = {\n\tdata: null;\n\terror: E;\n};\n\ntype Result<T, E = Error> = Success<T> | Failure<E>;\n\nexport async function tryCatch<T, E = Error>(\n\tpromise: Promise<T>,\n): Promise<Result<T, E>> {\n\ttry {\n\t\tconst data = await promise;\n\t\treturn { data, error: null };\n\t} catch (error) {\n\t\treturn { data: null, error: error as E };\n\t}\n}\n\n/**\n * Check if an object is a `Request`\n * - `instanceof`: works for native Request instances\n * - `toString`: handles where instanceof check fails but the object is still a valid Request\n */\nexport function isRequest(obj: unknown): obj is Request {\n\treturn (\n\t\tobj instanceof Request ||\n\t\tObject.prototype.toString.call(obj) === \"[object Request]\"\n\t);\n}\n"],"mappings":";;;AAEA,MAAM,uBAAuB;AAE7B,eAAsB,QAAQ,SAAkB,mBAA8B;CAC7E,MAAM,cAAc,QAAQ,QAAQ,IAAI,eAAe,IAAI;CAC3D,MAAM,wBAAwB,YAAY,aAAa;AAEvD,KAAI,CAAC,QAAQ,KACZ;AAID,KAAI,qBAAqB,kBAAkB,SAAS,GAanD;MAAI,CAZc,kBAAkB,MAAM,YAAY;GAErD,MAAM,4BAA4B,sBAChC,MAAM,IAAI,CAAC,GACX,MAAM;GACR,MAAM,oBAAoB,QAAQ,aAAa,CAAC,MAAM;AACtD,UACC,8BAA8B,qBAC9B,0BAA0B,SAAS,kBAAkB;IAErD,EAEc;AACf,OAAI,CAAC,sBACJ,OAAM,IAAI,SAAS,KAAK;IACvB,SAAS,4CAA4C,kBAAkB,KAAK,KAAK;IACjF,MAAM;IACN,CAAC;AAEH,SAAM,IAAI,SAAS,KAAK;IACvB,SAAS,iBAAiB,YAAY,mCAAmC,kBAAkB,KAAK,KAAK;IACrG,MAAM;IACN,CAAC;;;AAIJ,KAAI,qBAAqB,KAAK,sBAAsB,CACnD,QAAO,MAAM,QAAQ,MAAM;AAG5B,KAAI,sBAAsB,SAAS,oCAAoC,EAAE;EACxE,MAAM,WAAW,MAAM,QAAQ,UAAU;EACzC,MAAM,SAAiC,EAAE;AACzC,WAAS,SAAS,OAAO,QAAQ;AAChC,UAAO,OAAO,MAAM,UAAU;IAC7B;AACF,SAAO;;AAGR,KAAI,sBAAsB,SAAS,sBAAsB,EAAE;EAC1D,MAAM,WAAW,MAAM,QAAQ,UAAU;EACzC,MAAM,SAA8B,EAAE;AACtC,WAAS,SAAS,OAAO,QAAQ;AAChC,UAAO,OAAO;IACb;AACF,SAAO;;AAGR,KAAI,sBAAsB,SAAS,aAAa,CAC/C,QAAO,MAAM,QAAQ,MAAM;AAG5B,KAAI,sBAAsB,SAAS,2BAA2B,CAC7D,QAAO,MAAM,QAAQ,aAAa;AAGnC,KACC,sBAAsB,SAAS,kBAAkB,IACjD,sBAAsB,SAAS,SAAS,IACxC,sBAAsB,SAAS,SAAS,CAGxC,QADa,MAAM,QAAQ,MAAM;AAIlC,KACC,sBAAsB,SAAS,qBAAqB,IACpD,QAAQ,gBAAgB,eAExB,QAAO,QAAQ;AAGhB,QAAO,MAAM,QAAQ,MAAM;;AAG5B,SAAgB,WAAW,OAA+B;AACzD,QAAO,iBAAiB,YAAY,OAAO,SAAS;;AAGrD,SAAgB,UAAU,KAAa;AACtC,KAAI;AACH,SAAO,IAAI,SAAS,IAAI,GAAG,mBAAmB,IAAI,GAAG;SAC9C;AACP,SAAO;;;AAgBT,eAAsB,SACrB,SACwB;AACxB,KAAI;AAEH,SAAO;GAAE,MADI,MAAM;GACJ,OAAO;GAAM;UACpB,OAAO;AACf,SAAO;GAAE,MAAM;GAAa;GAAY;;;;;;;;AAS1C,SAAgB,UAAU,KAA8B;AACvD,QACC,eAAe,WACf,OAAO,UAAU,SAAS,KAAK,IAAI,KAAK"}
@@ -1,58 +0,0 @@
1
-
2
- //#region src/validator.ts
3
- /**
4
- * Runs validation on body and query
5
- * @returns error and data object
6
- */
7
- async function runValidation(options, context = {}) {
8
- let request = {
9
- body: context.body,
10
- query: context.query
11
- };
12
- if (options.body) {
13
- const result = await options.body["~standard"].validate(context.body);
14
- if (result.issues) return {
15
- data: null,
16
- error: fromError(result.issues, "body")
17
- };
18
- request.body = result.value;
19
- }
20
- if (options.query) {
21
- const result = await options.query["~standard"].validate(context.query);
22
- if (result.issues) return {
23
- data: null,
24
- error: fromError(result.issues, "query")
25
- };
26
- request.query = result.value;
27
- }
28
- if (options.requireHeaders && !context.headers) return {
29
- data: null,
30
- error: {
31
- message: "Headers is required",
32
- issues: []
33
- }
34
- };
35
- if (options.requireRequest && !context.request) return {
36
- data: null,
37
- error: {
38
- message: "Request is required",
39
- issues: []
40
- }
41
- };
42
- return {
43
- data: request,
44
- error: null
45
- };
46
- }
47
- function fromError(error, validating) {
48
- return {
49
- message: error.map((e) => {
50
- return `[${e.path?.length ? `${validating}.` + e.path.map((x) => typeof x === "object" ? x.key : x).join(".") : validating}] ${e.message}`;
51
- }).join("; "),
52
- issues: error
53
- };
54
- }
55
-
56
- //#endregion
57
- exports.runValidation = runValidation;
58
- //# sourceMappingURL=validator.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.cjs","names":[],"sources":["../src/validator.ts"],"sourcesContent":["import type { EndpointOptions } from \"./endpoint\";\nimport type { InputContext } from \"./context\";\nimport type { StandardSchemaV1 } from \"./standard-schema\";\n\ntype ValidationResponse =\n\t| {\n\t\t\tdata: {\n\t\t\t\tbody: any;\n\t\t\t\tquery: any;\n\t\t\t};\n\t\t\terror: null;\n\t }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: {\n\t\t\t\tmessage: string;\n\t\t\t\tissues: readonly StandardSchemaV1.Issue[];\n\t\t\t};\n\t };\n\n/**\n * Runs validation on body and query\n * @returns error and data object\n */\nexport async function runValidation(\n\toptions: EndpointOptions,\n\tcontext: InputContext<any, any> = {},\n): Promise<ValidationResponse> {\n\tlet request = {\n\t\tbody: context.body,\n\t\tquery: context.query,\n\t} as {\n\t\tbody: any;\n\t\tquery: any;\n\t};\n\tif (options.body) {\n\t\tconst result = await options.body[\"~standard\"].validate(context.body);\n\t\tif (result.issues) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: fromError(result.issues, \"body\"),\n\t\t\t};\n\t\t}\n\t\trequest.body = result.value;\n\t}\n\n\tif (options.query) {\n\t\tconst result = await options.query[\"~standard\"].validate(context.query);\n\t\tif (result.issues) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: fromError(result.issues, \"query\"),\n\t\t\t};\n\t\t}\n\t\trequest.query = result.value;\n\t}\n\tif (options.requireHeaders && !context.headers) {\n\t\treturn {\n\t\t\tdata: null,\n\t\t\terror: { message: \"Headers is required\", issues: [] },\n\t\t};\n\t}\n\tif (options.requireRequest && !context.request) {\n\t\treturn {\n\t\t\tdata: null,\n\t\t\terror: { message: \"Request is required\", issues: [] },\n\t\t};\n\t}\n\treturn {\n\t\tdata: request,\n\t\terror: null,\n\t};\n}\n\nfunction fromError(\n\terror: readonly StandardSchemaV1.Issue[],\n\tvalidating: string,\n) {\n\tconst message = error\n\t\t.map((e) => {\n\t\t\treturn `[${e.path?.length ? `${validating}.` + e.path.map((x) => (typeof x === \"object\" ? x.key : x)).join(\".\") : validating}] ${e.message}`;\n\t\t})\n\t\t.join(\"; \");\n\n\treturn {\n\t\tmessage,\n\t\tissues: error,\n\t};\n}\n"],"mappings":";;;;;;AAwBA,eAAsB,cACrB,SACA,UAAkC,EAAE,EACN;CAC9B,IAAI,UAAU;EACb,MAAM,QAAQ;EACd,OAAO,QAAQ;EACf;AAID,KAAI,QAAQ,MAAM;EACjB,MAAM,SAAS,MAAM,QAAQ,KAAK,aAAa,SAAS,QAAQ,KAAK;AACrE,MAAI,OAAO,OACV,QAAO;GACN,MAAM;GACN,OAAO,UAAU,OAAO,QAAQ,OAAO;GACvC;AAEF,UAAQ,OAAO,OAAO;;AAGvB,KAAI,QAAQ,OAAO;EAClB,MAAM,SAAS,MAAM,QAAQ,MAAM,aAAa,SAAS,QAAQ,MAAM;AACvE,MAAI,OAAO,OACV,QAAO;GACN,MAAM;GACN,OAAO,UAAU,OAAO,QAAQ,QAAQ;GACxC;AAEF,UAAQ,QAAQ,OAAO;;AAExB,KAAI,QAAQ,kBAAkB,CAAC,QAAQ,QACtC,QAAO;EACN,MAAM;EACN,OAAO;GAAE,SAAS;GAAuB,QAAQ,EAAE;GAAE;EACrD;AAEF,KAAI,QAAQ,kBAAkB,CAAC,QAAQ,QACtC,QAAO;EACN,MAAM;EACN,OAAO;GAAE,SAAS;GAAuB,QAAQ,EAAE;GAAE;EACrD;AAEF,QAAO;EACN,MAAM;EACN,OAAO;EACP;;AAGF,SAAS,UACR,OACA,YACC;AAOD,QAAO;EACN,SAPe,MACd,KAAK,MAAM;AACX,UAAO,IAAI,EAAE,MAAM,SAAS,GAAG,WAAW,KAAK,EAAE,KAAK,KAAK,MAAO,OAAO,MAAM,WAAW,EAAE,MAAM,EAAG,CAAC,KAAK,IAAI,GAAG,WAAW,IAAI,EAAE;IAClI,CACD,KAAK,KAAK;EAIX,QAAQ;EACR"}
@@ -1,57 +0,0 @@
1
- //#region src/validator.ts
2
- /**
3
- * Runs validation on body and query
4
- * @returns error and data object
5
- */
6
- async function runValidation(options, context = {}) {
7
- let request = {
8
- body: context.body,
9
- query: context.query
10
- };
11
- if (options.body) {
12
- const result = await options.body["~standard"].validate(context.body);
13
- if (result.issues) return {
14
- data: null,
15
- error: fromError(result.issues, "body")
16
- };
17
- request.body = result.value;
18
- }
19
- if (options.query) {
20
- const result = await options.query["~standard"].validate(context.query);
21
- if (result.issues) return {
22
- data: null,
23
- error: fromError(result.issues, "query")
24
- };
25
- request.query = result.value;
26
- }
27
- if (options.requireHeaders && !context.headers) return {
28
- data: null,
29
- error: {
30
- message: "Headers is required",
31
- issues: []
32
- }
33
- };
34
- if (options.requireRequest && !context.request) return {
35
- data: null,
36
- error: {
37
- message: "Request is required",
38
- issues: []
39
- }
40
- };
41
- return {
42
- data: request,
43
- error: null
44
- };
45
- }
46
- function fromError(error, validating) {
47
- return {
48
- message: error.map((e) => {
49
- return `[${e.path?.length ? `${validating}.` + e.path.map((x) => typeof x === "object" ? x.key : x).join(".") : validating}] ${e.message}`;
50
- }).join("; "),
51
- issues: error
52
- };
53
- }
54
-
55
- //#endregion
56
- export { runValidation };
57
- //# sourceMappingURL=validator.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.mjs","names":[],"sources":["../src/validator.ts"],"sourcesContent":["import type { EndpointOptions } from \"./endpoint\";\nimport type { InputContext } from \"./context\";\nimport type { StandardSchemaV1 } from \"./standard-schema\";\n\ntype ValidationResponse =\n\t| {\n\t\t\tdata: {\n\t\t\t\tbody: any;\n\t\t\t\tquery: any;\n\t\t\t};\n\t\t\terror: null;\n\t }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: {\n\t\t\t\tmessage: string;\n\t\t\t\tissues: readonly StandardSchemaV1.Issue[];\n\t\t\t};\n\t };\n\n/**\n * Runs validation on body and query\n * @returns error and data object\n */\nexport async function runValidation(\n\toptions: EndpointOptions,\n\tcontext: InputContext<any, any> = {},\n): Promise<ValidationResponse> {\n\tlet request = {\n\t\tbody: context.body,\n\t\tquery: context.query,\n\t} as {\n\t\tbody: any;\n\t\tquery: any;\n\t};\n\tif (options.body) {\n\t\tconst result = await options.body[\"~standard\"].validate(context.body);\n\t\tif (result.issues) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: fromError(result.issues, \"body\"),\n\t\t\t};\n\t\t}\n\t\trequest.body = result.value;\n\t}\n\n\tif (options.query) {\n\t\tconst result = await options.query[\"~standard\"].validate(context.query);\n\t\tif (result.issues) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: fromError(result.issues, \"query\"),\n\t\t\t};\n\t\t}\n\t\trequest.query = result.value;\n\t}\n\tif (options.requireHeaders && !context.headers) {\n\t\treturn {\n\t\t\tdata: null,\n\t\t\terror: { message: \"Headers is required\", issues: [] },\n\t\t};\n\t}\n\tif (options.requireRequest && !context.request) {\n\t\treturn {\n\t\t\tdata: null,\n\t\t\terror: { message: \"Request is required\", issues: [] },\n\t\t};\n\t}\n\treturn {\n\t\tdata: request,\n\t\terror: null,\n\t};\n}\n\nfunction fromError(\n\terror: readonly StandardSchemaV1.Issue[],\n\tvalidating: string,\n) {\n\tconst message = error\n\t\t.map((e) => {\n\t\t\treturn `[${e.path?.length ? `${validating}.` + e.path.map((x) => (typeof x === \"object\" ? x.key : x)).join(\".\") : validating}] ${e.message}`;\n\t\t})\n\t\t.join(\"; \");\n\n\treturn {\n\t\tmessage,\n\t\tissues: error,\n\t};\n}\n"],"mappings":";;;;;AAwBA,eAAsB,cACrB,SACA,UAAkC,EAAE,EACN;CAC9B,IAAI,UAAU;EACb,MAAM,QAAQ;EACd,OAAO,QAAQ;EACf;AAID,KAAI,QAAQ,MAAM;EACjB,MAAM,SAAS,MAAM,QAAQ,KAAK,aAAa,SAAS,QAAQ,KAAK;AACrE,MAAI,OAAO,OACV,QAAO;GACN,MAAM;GACN,OAAO,UAAU,OAAO,QAAQ,OAAO;GACvC;AAEF,UAAQ,OAAO,OAAO;;AAGvB,KAAI,QAAQ,OAAO;EAClB,MAAM,SAAS,MAAM,QAAQ,MAAM,aAAa,SAAS,QAAQ,MAAM;AACvE,MAAI,OAAO,OACV,QAAO;GACN,MAAM;GACN,OAAO,UAAU,OAAO,QAAQ,QAAQ;GACxC;AAEF,UAAQ,QAAQ,OAAO;;AAExB,KAAI,QAAQ,kBAAkB,CAAC,QAAQ,QACtC,QAAO;EACN,MAAM;EACN,OAAO;GAAE,SAAS;GAAuB,QAAQ,EAAE;GAAE;EACrD;AAEF,KAAI,QAAQ,kBAAkB,CAAC,QAAQ,QACtC,QAAO;EACN,MAAM;EACN,OAAO;GAAE,SAAS;GAAuB,QAAQ,EAAE;GAAE;EACrD;AAEF,QAAO;EACN,MAAM;EACN,OAAO;EACP;;AAGF,SAAS,UACR,OACA,YACC;AAOD,QAAO;EACN,SAPe,MACd,KAAK,MAAM;AACX,UAAO,IAAI,EAAE,MAAM,SAAS,GAAG,WAAW,KAAK,EAAE,KAAK,KAAK,MAAO,OAAO,MAAM,WAAW,EAAE,MAAM,EAAG,CAAC,KAAK,IAAI,GAAG,WAAW,IAAI,EAAE;IAClI,CACD,KAAK,KAAK;EAIX,QAAQ;EACR"}
@@ -1,96 +0,0 @@
1
- {
2
- "name": "better-call",
3
- "version": "1.3.5",
4
- "type": "module",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/better-auth/better-call.git",
8
- "directory": "packages/better-call"
9
- },
10
- "copyright": "Copyright (C) 2025 Bereket Engida",
11
- "license": "MIT",
12
- "main": "./dist/index.mjs",
13
- "module": "./dist/index.mjs",
14
- "types": "./dist/index.d.mts",
15
- "devDependencies": {
16
- "@types/body-parser": "^1.19.6",
17
- "@types/express": "^5.0.3",
18
- "@types/set-cookie-parser": "^2.4.10",
19
- "@types/supertest": "^6.0.3",
20
- "body-parser": "^2.2.0",
21
- "express": "^5.1.0",
22
- "supertest": "^7.1.4"
23
- },
24
- "dependencies": {
25
- "@better-auth/utils": "^0.4.0",
26
- "@better-fetch/fetch": "^1.1.21",
27
- "rou3": "^0.7.12",
28
- "set-cookie-parser": "^3.0.1"
29
- },
30
- "peerDependencies": {
31
- "zod": "^4.0.0"
32
- },
33
- "peerDependenciesMeta": {
34
- "zod": {
35
- "optional": true
36
- }
37
- },
38
- "exports": {
39
- ".": {
40
- "dev-source": "./src/index.ts",
41
- "import": {
42
- "types": "./dist/index.d.mts",
43
- "default": "./dist/index.mjs"
44
- },
45
- "require": {
46
- "types": "./dist/index.d.cts",
47
- "default": "./dist/index.cjs"
48
- }
49
- },
50
- "./client": {
51
- "dev-source": "./src/client.ts",
52
- "import": {
53
- "types": "./dist/client.d.mts",
54
- "default": "./dist/client.mjs"
55
- },
56
- "require": {
57
- "types": "./dist/client.d.cts",
58
- "default": "./dist/client.cjs"
59
- }
60
- },
61
- "./error": {
62
- "dev-source": "./src/error.ts",
63
- "import": {
64
- "types": "./dist/error.d.mts",
65
- "default": "./dist/error.mjs"
66
- },
67
- "require": {
68
- "types": "./dist/error.d.cts",
69
- "default": "./dist/error.cjs"
70
- }
71
- },
72
- "./node": {
73
- "dev-source": "./src/node.ts",
74
- "import": {
75
- "types": "./dist/node.d.mts",
76
- "default": "./dist/node.mjs"
77
- },
78
- "require": {
79
- "types": "./dist/node.d.cts",
80
- "default": "./dist/node.cjs"
81
- }
82
- }
83
- },
84
- "files": [
85
- "dist"
86
- ],
87
- "scripts": {
88
- "lint:package": "publint --strict .",
89
- "lint:type": "attw --profile node16 --pack .",
90
- "test": "vitest",
91
- "coverage": "vitest run --coverage",
92
- "coverage:open": "open coverage/index.html",
93
- "build": "tsdown",
94
- "dev": "tsdown --watch"
95
- }
96
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Nathan Friedly <nathan@nfriedly.com> (http://nfriedly.com/)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.