create-croissant 0.1.0 → 0.1.2
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.
- package/dist/index.js +3 -3
- package/package.json +16 -8
- package/template/.prettierignore +10 -0
- package/template/.prettierrc +11 -0
- package/template/README.md +88 -0
- package/template/apps/web/.env.example +4 -0
- package/template/apps/web/components.json +23 -0
- package/template/apps/web/drizzle.config.ts +11 -0
- package/template/apps/web/eslint.config.js +10 -0
- package/template/apps/web/node_modules/@better-auth/core/LICENSE.md +20 -0
- package/template/apps/web/node_modules/@better-auth/core/README.md +17 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/api/index.d.mts +278 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/api/index.mjs +56 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/index.d.mts +6 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/index.mjs +20 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/pure.index.d.mts +6 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/pure.index.mjs +33 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/endpoint-context.d.mts +18 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/endpoint-context.mjs +29 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/global.d.mts +6 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/global.mjs +36 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/index.d.mts +5 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/index.mjs +5 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/request-state.d.mts +27 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/request-state.mjs +47 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/transaction.d.mts +24 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/context/transaction.mjs +93 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/factory.d.mts +17 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/factory.mjs +754 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.d.mts +18 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.mjs +36 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.d.mts +12 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.mjs +30 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.d.mts +26 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.mjs +37 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-name.d.mts +18 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-name.mjs +31 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-id-field.d.mts +36 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-id-field.mjs +64 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-model-name.d.mts +12 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-model-name.mjs +21 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/index.d.mts +525 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/index.mjs +24 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/types.d.mts +105 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/utils.d.mts +7 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/utils.mjs +37 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/get-tables.d.mts +6 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/get-tables.mjs +265 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/index.d.mts +10 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/index.mjs +8 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/plugin.d.mts +12 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/account.d.mts +28 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/account.mjs +17 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/rate-limit.d.mts +18 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/rate-limit.mjs +9 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/session.d.mts +23 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/session.mjs +12 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/shared.d.mts +10 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/shared.mjs +9 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/user.d.mts +22 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/user.mjs +11 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/verification.d.mts +21 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/verification.mjs +10 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/db/type.d.mts +167 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/color-depth.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/color-depth.mjs +86 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/env-impl.d.mts +32 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/env-impl.mjs +81 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/index.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/index.mjs +4 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/logger.d.mts +48 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/env/logger.mjs +79 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/error/codes.d.mts +68 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/error/codes.mjs +54 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/error/index.d.mts +19 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/error/index.mjs +27 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/index.d.mts +9 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/index.mjs +1 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/api.mjs +12 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/attributes.d.mts +11 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/attributes.mjs +10 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/index.d.mts +3 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/index.mjs +3 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/noop.mjs +42 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/pure.index.d.mts +7 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/pure.index.mjs +7 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/tracer.d.mts +13 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/tracer.mjs +53 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.d.mts +56 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.mjs +64 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.d.mts +44 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.mjs +41 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/index.d.mts +8 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/index.mjs +7 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/oauth-provider.d.mts +192 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.d.mts +54 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.mjs +73 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/utils.d.mts +16 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/utils.mjs +37 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.d.mts +85 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.mjs +79 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/verify.d.mts +42 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/verify.mjs +92 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/apple.d.mts +126 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/apple.mjs +107 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/atlassian.d.mts +70 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/atlassian.mjs +80 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/cognito.d.mts +85 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/cognito.mjs +162 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/discord.d.mts +124 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/discord.mjs +62 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/dropbox.d.mts +69 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/dropbox.mjs +72 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/facebook.d.mts +79 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/facebook.mjs +124 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/figma.d.mts +61 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/figma.mjs +83 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/github.d.mts +102 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/github.mjs +92 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/gitlab.d.mts +123 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/gitlab.mjs +79 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/google.d.mts +97 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/google.mjs +109 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/huggingface.d.mts +83 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/huggingface.mjs +73 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/index.d.mts +1834 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/index.mjs +78 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kakao.d.mts +161 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kakao.mjs +70 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kick.d.mts +73 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kick.mjs +68 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/line.d.mts +105 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/line.mjs +110 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linear.d.mts +68 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linear.mjs +85 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linkedin.d.mts +67 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linkedin.mjs +73 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.d.mts +174 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.mjs +140 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/naver.d.mts +92 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/naver.mjs +65 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/notion.d.mts +64 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/notion.mjs +72 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paybin.d.mts +71 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paybin.mjs +81 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paypal.d.mts +129 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paypal.mjs +140 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/polar.d.mts +74 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/polar.mjs +71 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/railway.d.mts +65 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/railway.mjs +74 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/reddit.d.mts +62 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/reddit.mjs +80 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/roblox.d.mts +70 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/roblox.mjs +57 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/salesforce.d.mts +79 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/salesforce.mjs +87 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/slack.d.mts +83 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/slack.mjs +66 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/spotify.d.mts +63 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/spotify.mjs +69 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/tiktok.d.mts +168 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/tiktok.mjs +60 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitch.d.mts +79 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitch.mjs +75 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitter.d.mts +126 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitter.mjs +85 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vercel.d.mts +62 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vercel.mjs +58 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vk.d.mts +70 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vk.mjs +81 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/wechat.d.mts +113 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/wechat.mjs +81 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/zoom.d.mts +163 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/zoom.mjs +69 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/context.d.mts +277 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/cookie.d.mts +15 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/helper.d.mts +10 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/index.d.mts +9 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/init-options.d.mts +1358 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/plugin-client.d.mts +113 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/plugin.d.mts +124 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/types/secret.d.mts +11 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/async.d.mts +22 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/async.mjs +32 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/db.d.mts +9 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/db.mjs +15 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/deprecate.d.mts +9 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/deprecate.mjs +16 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/error-codes.d.mts +13 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/error-codes.mjs +10 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/fetch-metadata.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/fetch-metadata.mjs +6 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/host.d.mts +147 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/host.mjs +291 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/id.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/id.mjs +7 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/ip.d.mts +54 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/ip.mjs +116 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/is-api-error.d.mts +6 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/is-api-error.mjs +8 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/json.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/json.mjs +41 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/string.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/string.mjs +6 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/url.d.mts +20 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/url.mjs +31 -0
- package/template/apps/web/node_modules/@better-auth/core/package.json +193 -0
- package/template/apps/web/node_modules/@better-auth/core/src/api/index.ts +140 -0
- package/template/apps/web/node_modules/@better-auth/core/src/async_hooks/index.ts +40 -0
- package/template/apps/web/node_modules/@better-auth/core/src/async_hooks/pure.index.ts +46 -0
- package/template/apps/web/node_modules/@better-auth/core/src/context/endpoint-context.ts +50 -0
- package/template/apps/web/node_modules/@better-auth/core/src/context/global.ts +57 -0
- package/template/apps/web/node_modules/@better-auth/core/src/context/index.ts +23 -0
- package/template/apps/web/node_modules/@better-auth/core/src/context/request-state.ts +91 -0
- package/template/apps/web/node_modules/@better-auth/core/src/context/transaction.ts +136 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/factory.ts +1440 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-default-field-name.ts +59 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-default-model-name.ts +51 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-field-attributes.ts +62 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-field-name.ts +43 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-id-field.ts +150 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-model-name.ts +36 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/index.ts +567 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/types.ts +132 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/utils.ts +61 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/get-tables.ts +296 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/index.ts +43 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/plugin.ts +11 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/account.ts +47 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/rate-limit.ts +36 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/session.ts +29 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/shared.ts +7 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/user.ts +28 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/verification.ts +28 -0
- package/template/apps/web/node_modules/@better-auth/core/src/db/type.ts +333 -0
- package/template/apps/web/node_modules/@better-auth/core/src/env/color-depth.ts +172 -0
- package/template/apps/web/node_modules/@better-auth/core/src/env/env-impl.ts +124 -0
- package/template/apps/web/node_modules/@better-auth/core/src/env/index.ts +23 -0
- package/template/apps/web/node_modules/@better-auth/core/src/env/logger.ts +145 -0
- package/template/apps/web/node_modules/@better-auth/core/src/error/codes.ts +71 -0
- package/template/apps/web/node_modules/@better-auth/core/src/error/index.ts +35 -0
- package/template/apps/web/node_modules/@better-auth/core/src/index.ts +1 -0
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/api.ts +17 -0
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/attributes.ts +22 -0
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/index.ts +2 -0
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/noop.ts +74 -0
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/pure.index.ts +31 -0
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/tracer.ts +95 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/client-credentials-token.ts +126 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/create-authorization-url.ts +89 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/index.ts +33 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/oauth-provider.ts +222 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/refresh-access-token.ts +157 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/utils.ts +51 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/validate-authorization-code.ts +180 -0
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/verify.ts +221 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/apple.ts +231 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/atlassian.ts +133 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/cognito.ts +281 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/discord.ts +170 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/dropbox.ts +112 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/facebook.ts +215 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/figma.ts +118 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/github.ts +184 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/gitlab.ts +155 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/google.ts +204 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/huggingface.ts +119 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/index.ts +132 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/kakao.ts +179 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/kick.ts +109 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/line.ts +169 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/linear.ts +121 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/linkedin.ts +110 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/microsoft-entra-id.ts +352 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/naver.ts +113 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/notion.ts +108 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/paybin.ts +118 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/paypal.ts +263 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/polar.ts +111 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/railway.ts +100 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/reddit.ts +122 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/roblox.ts +112 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/salesforce.ts +159 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/slack.ts +112 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/spotify.ts +94 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/tiktok.ts +211 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/twitch.ts +112 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/twitter.ts +199 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/vercel.ts +87 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/vk.ts +125 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/wechat.ts +213 -0
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/zoom.ts +230 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/context.ts +415 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/cookie.ts +10 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/helper.ts +27 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/index.ts +40 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/init-options.ts +1610 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/plugin-client.ts +129 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/plugin.ts +163 -0
- package/template/apps/web/node_modules/@better-auth/core/src/types/secret.ts +8 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/async.ts +53 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/db.ts +20 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/deprecate.ts +21 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/error-codes.ts +68 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/fetch-metadata.ts +3 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/host.ts +401 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/id.ts +5 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/ip.ts +211 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/is-api-error.ts +10 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/json.ts +56 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/string.ts +3 -0
- package/template/apps/web/node_modules/@better-auth/core/src/utils/url.ts +43 -0
- package/template/apps/web/node_modules/@better-auth/drizzle-adapter/LICENSE.md +20 -0
- package/template/apps/web/node_modules/@better-auth/drizzle-adapter/README.md +17 -0
- package/template/apps/web/node_modules/@better-auth/drizzle-adapter/dist/index.d.mts +47 -0
- package/template/apps/web/node_modules/@better-auth/drizzle-adapter/dist/index.mjs +458 -0
- package/template/apps/web/node_modules/@better-auth/drizzle-adapter/package.json +62 -0
- package/template/apps/web/node_modules/@better-auth/utils/README.md +384 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.cjs +104 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.cts +44 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.mts +44 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.ts +44 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.mjs +101 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.cjs +80 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.cts +16 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.mts +16 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.ts +16 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.mjs +77 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.cjs +16 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.cts +8 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.mts +8 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.ts +8 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.mjs +14 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.cjs +90 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.cts +19 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.mts +19 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.ts +19 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.mjs +88 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.cjs +31 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.cts +7 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.mts +7 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.ts +7 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.mjs +29 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.cjs +40 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.cts +8 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.mts +8 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.ts +8 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.mjs +38 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.cjs +58 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.cts +9 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.mts +9 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.ts +9 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.mjs +56 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.cjs +10 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.cts +3 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.mts +3 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.ts +3 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.mjs +8 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.cjs +90 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.cts +13 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.mts +13 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.ts +13 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.mjs +88 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.cjs +36 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.cts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.ts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.mjs +33 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.cjs +47 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.cts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.ts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.mjs +44 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.cjs +55 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.cts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.mts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.ts +4 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.mjs +53 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.cjs +76 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.cts +16 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.mts +16 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.ts +16 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.mjs +74 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.cts +22 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.mts +22 -0
- package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.ts +22 -0
- package/template/apps/web/node_modules/@better-auth/utils/package.json +95 -0
- package/template/apps/web/node_modules/better-call/LICENSE +21 -0
- package/template/apps/web/node_modules/better-call/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.cjs +181 -0
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.d.cts +16 -0
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.d.mts +16 -0
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.mjs +178 -0
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/client.cjs +23 -0
- package/template/apps/web/node_modules/better-call/dist/client.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/client.d.cts +53 -0
- package/template/apps/web/node_modules/better-call/dist/client.d.mts +53 -0
- package/template/apps/web/node_modules/better-call/dist/client.mjs +14 -0
- package/template/apps/web/node_modules/better-call/dist/client.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/context.cjs +103 -0
- package/template/apps/web/node_modules/better-call/dist/context.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/context.d.cts +341 -0
- package/template/apps/web/node_modules/better-call/dist/context.d.mts +341 -0
- package/template/apps/web/node_modules/better-call/dist/context.mjs +103 -0
- package/template/apps/web/node_modules/better-call/dist/context.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/cookies.cjs +87 -0
- package/template/apps/web/node_modules/better-call/dist/cookies.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/cookies.d.cts +103 -0
- package/template/apps/web/node_modules/better-call/dist/cookies.d.mts +103 -0
- package/template/apps/web/node_modules/better-call/dist/cookies.mjs +84 -0
- package/template/apps/web/node_modules/better-call/dist/cookies.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/crypto.cjs +39 -0
- package/template/apps/web/node_modules/better-call/dist/crypto.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/crypto.mjs +36 -0
- package/template/apps/web/node_modules/better-call/dist/crypto.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/endpoint.cjs +70 -0
- package/template/apps/web/node_modules/better-call/dist/endpoint.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/endpoint.d.cts +475 -0
- package/template/apps/web/node_modules/better-call/dist/endpoint.d.mts +475 -0
- package/template/apps/web/node_modules/better-call/dist/endpoint.mjs +70 -0
- package/template/apps/web/node_modules/better-call/dist/endpoint.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/error.cjs +141 -0
- package/template/apps/web/node_modules/better-call/dist/error.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/error.d.cts +103 -0
- package/template/apps/web/node_modules/better-call/dist/error.d.mts +103 -0
- package/template/apps/web/node_modules/better-call/dist/error.mjs +133 -0
- package/template/apps/web/node_modules/better-call/dist/error.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/helper.d.cts +12 -0
- package/template/apps/web/node_modules/better-call/dist/helper.d.mts +12 -0
- package/template/apps/web/node_modules/better-call/dist/index.cjs +28 -0
- package/template/apps/web/node_modules/better-call/dist/index.d.cts +11 -0
- package/template/apps/web/node_modules/better-call/dist/index.d.mts +11 -0
- package/template/apps/web/node_modules/better-call/dist/index.mjs +10 -0
- package/template/apps/web/node_modules/better-call/dist/middleware.cjs +52 -0
- package/template/apps/web/node_modules/better-call/dist/middleware.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/middleware.d.cts +123 -0
- package/template/apps/web/node_modules/better-call/dist/middleware.d.mts +123 -0
- package/template/apps/web/node_modules/better-call/dist/middleware.mjs +52 -0
- package/template/apps/web/node_modules/better-call/dist/middleware.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/node.cjs +18 -0
- package/template/apps/web/node_modules/better-call/dist/node.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/node.d.cts +9 -0
- package/template/apps/web/node_modules/better-call/dist/node.d.mts +9 -0
- package/template/apps/web/node_modules/better-call/dist/node.mjs +15 -0
- package/template/apps/web/node_modules/better-call/dist/node.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/openapi.cjs +191 -0
- package/template/apps/web/node_modules/better-call/dist/openapi.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/openapi.d.cts +113 -0
- package/template/apps/web/node_modules/better-call/dist/openapi.d.mts +113 -0
- package/template/apps/web/node_modules/better-call/dist/openapi.mjs +189 -0
- package/template/apps/web/node_modules/better-call/dist/openapi.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/router.cjs +118 -0
- package/template/apps/web/node_modules/better-call/dist/router.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/router.d.cts +103 -0
- package/template/apps/web/node_modules/better-call/dist/router.d.mts +103 -0
- package/template/apps/web/node_modules/better-call/dist/router.mjs +117 -0
- package/template/apps/web/node_modules/better-call/dist/router.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/standard-schema.d.cts +59 -0
- package/template/apps/web/node_modules/better-call/dist/standard-schema.d.mts +59 -0
- package/template/apps/web/node_modules/better-call/dist/to-response.cjs +153 -0
- package/template/apps/web/node_modules/better-call/dist/to-response.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/to-response.d.cts +12 -0
- package/template/apps/web/node_modules/better-call/dist/to-response.d.mts +12 -0
- package/template/apps/web/node_modules/better-call/dist/to-response.mjs +153 -0
- package/template/apps/web/node_modules/better-call/dist/to-response.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/utils.cjs +86 -0
- package/template/apps/web/node_modules/better-call/dist/utils.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/utils.mjs +82 -0
- package/template/apps/web/node_modules/better-call/dist/utils.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/validator.cjs +58 -0
- package/template/apps/web/node_modules/better-call/dist/validator.cjs.map +1 -0
- package/template/apps/web/node_modules/better-call/dist/validator.mjs +57 -0
- package/template/apps/web/node_modules/better-call/dist/validator.mjs.map +1 -0
- package/template/apps/web/node_modules/better-call/package.json +96 -0
- package/template/apps/web/node_modules/set-cookie-parser/LICENSE +21 -0
- package/template/apps/web/node_modules/set-cookie-parser/README.md +169 -0
- package/template/apps/web/node_modules/set-cookie-parser/dist/.eslintrc.cjs +16 -0
- package/template/apps/web/node_modules/set-cookie-parser/dist/set-cookie.cjs +260 -0
- package/template/apps/web/node_modules/set-cookie-parser/lib/set-cookie.d.ts +119 -0
- package/template/apps/web/node_modules/set-cookie-parser/lib/set-cookie.js +265 -0
- package/template/apps/web/node_modules/set-cookie-parser/package.json +61 -0
- package/template/apps/web/package.json +44 -0
- package/template/apps/web/public/favicon.ico +0 -0
- package/template/apps/web/public/manifest.json +25 -0
- package/template/apps/web/public/robots.txt +3 -0
- package/template/apps/web/src/components/app-sidebar.tsx +139 -0
- package/template/apps/web/src/components/login-form.tsx +111 -0
- package/template/apps/web/src/components/search-form.tsx +27 -0
- package/template/apps/web/src/components/signup-form.tsx +137 -0
- package/template/apps/web/src/components/version-switcher.tsx +64 -0
- package/template/apps/web/src/hooks/use-mobile.ts +19 -0
- package/template/apps/web/src/lib/auth-client.ts +3 -0
- package/template/apps/web/src/lib/auth-utils.ts +15 -0
- package/template/apps/web/src/lib/orpc.ts +32 -0
- package/template/apps/web/src/routeTree.gen.ts +282 -0
- package/template/apps/web/src/router.tsx +20 -0
- package/template/apps/web/src/routes/__root.tsx +53 -0
- package/template/apps/web/src/routes/api/auth/$.ts +15 -0
- package/template/apps/web/src/routes/api/rpc.$.ts +34 -0
- package/template/apps/web/src/routes/client-orpc-auth.tsx +62 -0
- package/template/apps/web/src/routes/client-orpc.tsx +43 -0
- package/template/apps/web/src/routes/dashboard.tsx +59 -0
- package/template/apps/web/src/routes/index.tsx +57 -0
- package/template/apps/web/src/routes/isr.tsx +33 -0
- package/template/apps/web/src/routes/login.tsx +16 -0
- package/template/apps/web/src/routes/signup.tsx +16 -0
- package/template/apps/web/src/routes/ssr-orpc-auth.tsx +53 -0
- package/template/apps/web/src/routes/ssr-orpc.tsx +36 -0
- package/template/apps/web/tsconfig.json +29 -0
- package/template/apps/web/vite.config.ts +19 -0
- package/template/docker-compose.yml +16 -0
- package/template/package.json +35 -0
- package/template/packages/auth/eslint.config.ts +3 -0
- package/template/packages/auth/package.json +24 -0
- package/template/packages/auth/src/lib/auth.ts +13 -0
- package/template/packages/auth/tsconfig.json +17 -0
- package/template/packages/auth/tsconfig.lint.json +14 -0
- package/template/packages/db/eslint.config.ts +3 -0
- package/template/packages/db/package.json +27 -0
- package/template/packages/db/src/auth-schema.ts +93 -0
- package/template/packages/db/src/index.ts +7 -0
- package/template/packages/db/src/planets-schema.ts +13 -0
- package/template/packages/db/src/schema.ts +2 -0
- package/template/packages/db/tsconfig.json +17 -0
- package/template/packages/db/tsconfig.lint.json +14 -0
- package/template/packages/orpc/eslint.config.ts +3 -0
- package/template/packages/orpc/package.json +21 -0
- package/template/packages/orpc/src/lib/router.ts +52 -0
- package/template/packages/orpc/tsconfig.json +17 -0
- package/template/packages/orpc/tsconfig.lint.json +14 -0
- package/template/packages/ui/components.json +23 -0
- package/template/packages/ui/eslint.config.ts +3 -0
- package/template/packages/ui/package.json +48 -0
- package/template/packages/ui/src/components/.gitkeep +0 -0
- package/template/packages/ui/src/components/accordion.tsx +72 -0
- package/template/packages/ui/src/components/alert-dialog.tsx +187 -0
- package/template/packages/ui/src/components/alert.tsx +77 -0
- package/template/packages/ui/src/components/aspect-ratio.tsx +22 -0
- package/template/packages/ui/src/components/avatar.tsx +107 -0
- package/template/packages/ui/src/components/badge.tsx +53 -0
- package/template/packages/ui/src/components/breadcrumb.tsx +125 -0
- package/template/packages/ui/src/components/button-group.tsx +88 -0
- package/template/packages/ui/src/components/button.tsx +59 -0
- package/template/packages/ui/src/components/calendar.tsx +229 -0
- package/template/packages/ui/src/components/card.tsx +103 -0
- package/template/packages/ui/src/components/carousel.tsx +240 -0
- package/template/packages/ui/src/components/chart.tsx +371 -0
- package/template/packages/ui/src/components/checkbox.tsx +29 -0
- package/template/packages/ui/src/components/collapsible.tsx +19 -0
- package/template/packages/ui/src/components/combobox.tsx +295 -0
- package/template/packages/ui/src/components/command.tsx +196 -0
- package/template/packages/ui/src/components/context-menu.tsx +271 -0
- package/template/packages/ui/src/components/dialog.tsx +158 -0
- package/template/packages/ui/src/components/direction.tsx +4 -0
- package/template/packages/ui/src/components/drawer.tsx +134 -0
- package/template/packages/ui/src/components/dropdown-menu.tsx +266 -0
- package/template/packages/ui/src/components/empty.tsx +105 -0
- package/template/packages/ui/src/components/field.tsx +237 -0
- package/template/packages/ui/src/components/hover-card.tsx +51 -0
- package/template/packages/ui/src/components/input-group.tsx +159 -0
- package/template/packages/ui/src/components/input-otp.tsx +85 -0
- package/template/packages/ui/src/components/input.tsx +20 -0
- package/template/packages/ui/src/components/item.tsx +202 -0
- package/template/packages/ui/src/components/kbd.tsx +26 -0
- package/template/packages/ui/src/components/label.tsx +20 -0
- package/template/packages/ui/src/components/menubar.tsx +280 -0
- package/template/packages/ui/src/components/native-select.tsx +61 -0
- package/template/packages/ui/src/components/navigation-menu.tsx +168 -0
- package/template/packages/ui/src/components/pagination.tsx +130 -0
- package/template/packages/ui/src/components/popover.tsx +88 -0
- package/template/packages/ui/src/components/progress.tsx +83 -0
- package/template/packages/ui/src/components/radio-group.tsx +36 -0
- package/template/packages/ui/src/components/resizable.tsx +50 -0
- package/template/packages/ui/src/components/scroll-area.tsx +53 -0
- package/template/packages/ui/src/components/select.tsx +201 -0
- package/template/packages/ui/src/components/separator.tsx +23 -0
- package/template/packages/ui/src/components/sheet.tsx +138 -0
- package/template/packages/ui/src/components/sidebar.tsx +726 -0
- package/template/packages/ui/src/components/skeleton.tsx +13 -0
- package/template/packages/ui/src/components/slider.tsx +52 -0
- package/template/packages/ui/src/components/sonner.tsx +50 -0
- package/template/packages/ui/src/components/spinner.tsx +10 -0
- package/template/packages/ui/src/components/switch.tsx +30 -0
- package/template/packages/ui/src/components/table.tsx +116 -0
- package/template/packages/ui/src/components/tabs.tsx +81 -0
- package/template/packages/ui/src/components/textarea.tsx +18 -0
- package/template/packages/ui/src/components/toggle-group.tsx +87 -0
- package/template/packages/ui/src/components/toggle.tsx +46 -0
- package/template/packages/ui/src/components/tooltip.tsx +64 -0
- package/template/packages/ui/src/hooks/.gitkeep +0 -0
- package/template/packages/ui/src/hooks/use-mobile.ts +19 -0
- package/template/packages/ui/src/lib/.gitkeep +0 -0
- package/template/packages/ui/src/lib/utils.ts +7 -0
- package/template/packages/ui/src/styles/globals.css +130 -0
- package/template/packages/ui/tsconfig.json +17 -0
- package/template/packages/ui/tsconfig.lint.json +14 -0
- package/template/tsconfig.json +9 -0
- package/template/turbo.json +24 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@better-auth/core",
|
|
3
|
+
"version": "1.6.7",
|
|
4
|
+
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://www.better-auth.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/better-auth/better-auth.git",
|
|
11
|
+
"directory": "packages/core"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"auth",
|
|
15
|
+
"core",
|
|
16
|
+
"typescript",
|
|
17
|
+
"better-auth"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"src",
|
|
26
|
+
"!src/**/*.test.ts"
|
|
27
|
+
],
|
|
28
|
+
"main": "./dist/index.mjs",
|
|
29
|
+
"module": "./dist/index.mjs",
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"dev-source": "./src/index.ts",
|
|
34
|
+
"types": "./dist/index.d.mts",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./api": {
|
|
38
|
+
"dev-source": "./src/api/index.ts",
|
|
39
|
+
"types": "./dist/api/index.d.mts",
|
|
40
|
+
"default": "./dist/api/index.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./async_hooks": {
|
|
43
|
+
"dev-source": "./src/async_hooks/index.ts",
|
|
44
|
+
"types": "./dist/async_hooks/index.d.mts",
|
|
45
|
+
"node": "./dist/async_hooks/index.mjs",
|
|
46
|
+
"deno": "./dist/async_hooks/index.mjs",
|
|
47
|
+
"bun": "./dist/async_hooks/index.mjs",
|
|
48
|
+
"edge": "./dist/async_hooks/pure.index.mjs",
|
|
49
|
+
"workerd": "./dist/async_hooks/index.mjs",
|
|
50
|
+
"browser": "./dist/async_hooks/pure.index.mjs",
|
|
51
|
+
"default": "./dist/async_hooks/index.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./context": {
|
|
54
|
+
"dev-source": "./src/context/index.ts",
|
|
55
|
+
"types": "./dist/context/index.d.mts",
|
|
56
|
+
"default": "./dist/context/index.mjs"
|
|
57
|
+
},
|
|
58
|
+
"./env": {
|
|
59
|
+
"dev-source": "./src/env/index.ts",
|
|
60
|
+
"types": "./dist/env/index.d.mts",
|
|
61
|
+
"default": "./dist/env/index.mjs"
|
|
62
|
+
},
|
|
63
|
+
"./error": {
|
|
64
|
+
"dev-source": "./src/error/index.ts",
|
|
65
|
+
"types": "./dist/error/index.d.mts",
|
|
66
|
+
"default": "./dist/error/index.mjs"
|
|
67
|
+
},
|
|
68
|
+
"./utils/*": {
|
|
69
|
+
"dev-source": "./src/utils/*.ts",
|
|
70
|
+
"types": "./dist/utils/*.d.mts",
|
|
71
|
+
"default": "./dist/utils/*.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./social-providers": {
|
|
74
|
+
"dev-source": "./src/social-providers/index.ts",
|
|
75
|
+
"types": "./dist/social-providers/index.d.mts",
|
|
76
|
+
"default": "./dist/social-providers/index.mjs"
|
|
77
|
+
},
|
|
78
|
+
"./db": {
|
|
79
|
+
"dev-source": "./src/db/index.ts",
|
|
80
|
+
"types": "./dist/db/index.d.mts",
|
|
81
|
+
"default": "./dist/db/index.mjs"
|
|
82
|
+
},
|
|
83
|
+
"./db/adapter": {
|
|
84
|
+
"dev-source": "./src/db/adapter/index.ts",
|
|
85
|
+
"types": "./dist/db/adapter/index.d.mts",
|
|
86
|
+
"default": "./dist/db/adapter/index.mjs"
|
|
87
|
+
},
|
|
88
|
+
"./oauth2": {
|
|
89
|
+
"dev-source": "./src/oauth2/index.ts",
|
|
90
|
+
"types": "./dist/oauth2/index.d.mts",
|
|
91
|
+
"default": "./dist/oauth2/index.mjs"
|
|
92
|
+
},
|
|
93
|
+
"./instrumentation": {
|
|
94
|
+
"dev-source": "./src/instrumentation/index.ts",
|
|
95
|
+
"types": "./dist/instrumentation/index.d.mts",
|
|
96
|
+
"node": "./dist/instrumentation/index.mjs",
|
|
97
|
+
"deno": "./dist/instrumentation/index.mjs",
|
|
98
|
+
"bun": "./dist/instrumentation/index.mjs",
|
|
99
|
+
"edge": "./dist/instrumentation/pure.index.mjs",
|
|
100
|
+
"workerd": "./dist/instrumentation/index.mjs",
|
|
101
|
+
"browser": "./dist/instrumentation/pure.index.mjs",
|
|
102
|
+
"default": "./dist/instrumentation/index.mjs"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"typesVersions": {
|
|
106
|
+
"*": {
|
|
107
|
+
".": [
|
|
108
|
+
"dist/index.d.mts"
|
|
109
|
+
],
|
|
110
|
+
"api": [
|
|
111
|
+
"dist/api/index.d.mts"
|
|
112
|
+
],
|
|
113
|
+
"async_hooks": [
|
|
114
|
+
"dist/async_hooks/index.d.mts"
|
|
115
|
+
],
|
|
116
|
+
"context": [
|
|
117
|
+
"dist/context/index.d.mts"
|
|
118
|
+
],
|
|
119
|
+
"env": [
|
|
120
|
+
"dist/env/index.d.mts"
|
|
121
|
+
],
|
|
122
|
+
"error": [
|
|
123
|
+
"dist/error/index.d.mts"
|
|
124
|
+
],
|
|
125
|
+
"utils": [
|
|
126
|
+
"dist/utils/index.d.mts"
|
|
127
|
+
],
|
|
128
|
+
"utils/*": [
|
|
129
|
+
"dist/utils/*.d.mts"
|
|
130
|
+
],
|
|
131
|
+
"social-providers": [
|
|
132
|
+
"dist/social-providers/index.d.mts"
|
|
133
|
+
],
|
|
134
|
+
"db": [
|
|
135
|
+
"dist/db/index.d.mts"
|
|
136
|
+
],
|
|
137
|
+
"db/adapter": [
|
|
138
|
+
"dist/db/adapter/index.d.mts"
|
|
139
|
+
],
|
|
140
|
+
"oauth2": [
|
|
141
|
+
"dist/oauth2/index.d.mts"
|
|
142
|
+
],
|
|
143
|
+
"instrumentation": [
|
|
144
|
+
"dist/instrumentation/index.d.mts"
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"dependencies": {
|
|
149
|
+
"@opentelemetry/semantic-conventions": "^1.39.0",
|
|
150
|
+
"@standard-schema/spec": "^1.1.0",
|
|
151
|
+
"zod": "^4.3.6"
|
|
152
|
+
},
|
|
153
|
+
"devDependencies": {
|
|
154
|
+
"@better-auth/utils": "0.4.0",
|
|
155
|
+
"@better-fetch/fetch": "1.1.21",
|
|
156
|
+
"@opentelemetry/api": "^1.9.0",
|
|
157
|
+
"@opentelemetry/sdk-trace-base": "^1.30.0",
|
|
158
|
+
"@opentelemetry/sdk-trace-node": "^1.30.0",
|
|
159
|
+
"better-call": "1.3.5",
|
|
160
|
+
"@cloudflare/workers-types": "^4.20250121.0",
|
|
161
|
+
"jose": "^6.1.3",
|
|
162
|
+
"kysely": "^0.28.14",
|
|
163
|
+
"nanostores": "^1.1.1",
|
|
164
|
+
"tsdown": "0.21.1"
|
|
165
|
+
},
|
|
166
|
+
"peerDependencies": {
|
|
167
|
+
"@better-auth/utils": "0.4.0",
|
|
168
|
+
"@better-fetch/fetch": "1.1.21",
|
|
169
|
+
"@opentelemetry/api": "^1.9.0",
|
|
170
|
+
"better-call": "1.3.5",
|
|
171
|
+
"@cloudflare/workers-types": ">=4",
|
|
172
|
+
"jose": "^6.1.0",
|
|
173
|
+
"kysely": "^0.28.5",
|
|
174
|
+
"nanostores": "^1.0.1"
|
|
175
|
+
},
|
|
176
|
+
"peerDependenciesMeta": {
|
|
177
|
+
"@cloudflare/workers-types": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
180
|
+
"@opentelemetry/api": {
|
|
181
|
+
"optional": true
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"scripts": {
|
|
185
|
+
"build": "tsdown",
|
|
186
|
+
"dev": "tsdown --watch",
|
|
187
|
+
"lint:package": "publint run --strict --pack false",
|
|
188
|
+
"lint:types": "attw --profile esm-only --pack .",
|
|
189
|
+
"typecheck": "tsc --project tsconfig.json",
|
|
190
|
+
"test": "vitest",
|
|
191
|
+
"coverage": "vitest run --coverage --coverage.provider=istanbul"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
EndpointContext,
|
|
3
|
+
EndpointOptions,
|
|
4
|
+
StrictEndpoint,
|
|
5
|
+
} from "better-call";
|
|
6
|
+
import {
|
|
7
|
+
createEndpoint,
|
|
8
|
+
createMiddleware,
|
|
9
|
+
kAPIErrorHeaderSymbol,
|
|
10
|
+
} from "better-call";
|
|
11
|
+
import { runWithEndpointContext } from "../context";
|
|
12
|
+
import type { AuthContext } from "../types";
|
|
13
|
+
import { isAPIError } from "../utils/is-api-error";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Better-call's createEndpoint re-throws APIError without exposing the headers
|
|
17
|
+
* accumulated on ctx.responseHeaders (e.g. Set-Cookie from deleteSessionCookie
|
|
18
|
+
* before throw). Attach them to the error via kAPIErrorHeaderSymbol — matching
|
|
19
|
+
* better-call's createMiddleware contract so the outer pipeline can merge them
|
|
20
|
+
* into the response.
|
|
21
|
+
*/
|
|
22
|
+
function attachResponseHeadersToAPIError(
|
|
23
|
+
responseHeaders: Headers | undefined,
|
|
24
|
+
e: unknown,
|
|
25
|
+
): void {
|
|
26
|
+
if (!isAPIError(e) || !responseHeaders) return;
|
|
27
|
+
Object.defineProperty(e, kAPIErrorHeaderSymbol, {
|
|
28
|
+
enumerable: false,
|
|
29
|
+
configurable: true,
|
|
30
|
+
value: responseHeaders,
|
|
31
|
+
writable: false,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const optionsMiddleware = createMiddleware(async () => {
|
|
36
|
+
/**
|
|
37
|
+
* This will be passed on the instance of
|
|
38
|
+
* the context. Used to infer the type
|
|
39
|
+
* here.
|
|
40
|
+
*/
|
|
41
|
+
return {} as AuthContext;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const createAuthMiddleware = createMiddleware.create({
|
|
45
|
+
use: [
|
|
46
|
+
optionsMiddleware,
|
|
47
|
+
/**
|
|
48
|
+
* Only use for post hooks
|
|
49
|
+
*/
|
|
50
|
+
createMiddleware(async () => {
|
|
51
|
+
return {} as {
|
|
52
|
+
returned?: unknown | undefined;
|
|
53
|
+
responseHeaders?: Headers | undefined;
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const use = [optionsMiddleware];
|
|
60
|
+
|
|
61
|
+
type EndpointHandler<
|
|
62
|
+
Path extends string,
|
|
63
|
+
Options extends EndpointOptions,
|
|
64
|
+
R,
|
|
65
|
+
> = (context: EndpointContext<Path, Options, AuthContext>) => Promise<R>;
|
|
66
|
+
|
|
67
|
+
export function createAuthEndpoint<
|
|
68
|
+
Path extends string,
|
|
69
|
+
Options extends EndpointOptions,
|
|
70
|
+
R,
|
|
71
|
+
>(
|
|
72
|
+
path: Path,
|
|
73
|
+
options: Options,
|
|
74
|
+
handler: EndpointHandler<Path, Options, R>,
|
|
75
|
+
): StrictEndpoint<Path, Options, R>;
|
|
76
|
+
|
|
77
|
+
export function createAuthEndpoint<
|
|
78
|
+
Path extends string,
|
|
79
|
+
Options extends EndpointOptions,
|
|
80
|
+
R,
|
|
81
|
+
>(
|
|
82
|
+
options: Options,
|
|
83
|
+
handler: EndpointHandler<Path, Options, R>,
|
|
84
|
+
): StrictEndpoint<Path, Options, R>;
|
|
85
|
+
|
|
86
|
+
export function createAuthEndpoint<
|
|
87
|
+
Path extends string,
|
|
88
|
+
Opts extends EndpointOptions,
|
|
89
|
+
R,
|
|
90
|
+
>(
|
|
91
|
+
pathOrOptions: Path | Opts,
|
|
92
|
+
handlerOrOptions: EndpointHandler<Path, Opts, R> | Opts,
|
|
93
|
+
handlerOrNever?: any,
|
|
94
|
+
) {
|
|
95
|
+
const path: Path | undefined =
|
|
96
|
+
typeof pathOrOptions === "string" ? pathOrOptions : undefined;
|
|
97
|
+
const options: Opts =
|
|
98
|
+
typeof handlerOrOptions === "object"
|
|
99
|
+
? handlerOrOptions
|
|
100
|
+
: (pathOrOptions as Opts);
|
|
101
|
+
const handler: EndpointHandler<Path, Opts, R> =
|
|
102
|
+
typeof handlerOrOptions === "function" ? handlerOrOptions : handlerOrNever;
|
|
103
|
+
|
|
104
|
+
// todo: prettify the code, we want to call `runWithEndpointContext` to top level
|
|
105
|
+
const wrapped: EndpointHandler<Path, Opts, R> = async (ctx) => {
|
|
106
|
+
const runtimeCtx = ctx as unknown as { responseHeaders?: Headers };
|
|
107
|
+
try {
|
|
108
|
+
return await runWithEndpointContext(ctx as any, () => handler(ctx));
|
|
109
|
+
} catch (e) {
|
|
110
|
+
attachResponseHeadersToAPIError(runtimeCtx.responseHeaders, e);
|
|
111
|
+
throw e;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
if (path) {
|
|
116
|
+
return createEndpoint(
|
|
117
|
+
path,
|
|
118
|
+
{
|
|
119
|
+
...options,
|
|
120
|
+
use: [...(options?.use || []), ...use],
|
|
121
|
+
},
|
|
122
|
+
wrapped,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return createEndpoint(
|
|
127
|
+
{
|
|
128
|
+
...options,
|
|
129
|
+
use: [...(options?.use || []), ...use],
|
|
130
|
+
},
|
|
131
|
+
wrapped,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type AuthEndpoint<
|
|
136
|
+
Path extends string,
|
|
137
|
+
Opts extends EndpointOptions,
|
|
138
|
+
R,
|
|
139
|
+
> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
|
|
140
|
+
export type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
export type { AsyncLocalStorage };
|
|
4
|
+
|
|
5
|
+
const AsyncLocalStoragePromise: Promise<typeof AsyncLocalStorage | null> =
|
|
6
|
+
import(
|
|
7
|
+
/* @vite-ignore */
|
|
8
|
+
/* webpackIgnore: true */
|
|
9
|
+
"node:async_hooks"
|
|
10
|
+
)
|
|
11
|
+
.then((mod) => mod.AsyncLocalStorage)
|
|
12
|
+
.catch((err) => {
|
|
13
|
+
if ("AsyncLocalStorage" in globalThis) {
|
|
14
|
+
return (globalThis as any).AsyncLocalStorage;
|
|
15
|
+
}
|
|
16
|
+
if (typeof window !== "undefined") {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
console.warn(
|
|
20
|
+
"[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.",
|
|
21
|
+
);
|
|
22
|
+
console.warn(
|
|
23
|
+
"[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler",
|
|
24
|
+
);
|
|
25
|
+
console.warn(
|
|
26
|
+
"[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag",
|
|
27
|
+
);
|
|
28
|
+
throw err;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export async function getAsyncLocalStorage(): Promise<
|
|
32
|
+
typeof AsyncLocalStorage
|
|
33
|
+
> {
|
|
34
|
+
const mod = await AsyncLocalStoragePromise;
|
|
35
|
+
if (mod === null) {
|
|
36
|
+
throw new Error("getAsyncLocalStorage is only available in server code");
|
|
37
|
+
} else {
|
|
38
|
+
return mod;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Due to the lack of AsyncLocalStorage in some environments (like Convex),
|
|
5
|
+
*
|
|
6
|
+
* We assume serverless functions are short-lived and single-threaded, so we can use a simple polyfill.
|
|
7
|
+
*/
|
|
8
|
+
class AsyncLocalStoragePolyfill<T> {
|
|
9
|
+
#current: T | undefined = undefined;
|
|
10
|
+
|
|
11
|
+
run(store: T, fn: () => unknown): unknown {
|
|
12
|
+
const prev = this.#current;
|
|
13
|
+
this.#current = store;
|
|
14
|
+
const result = fn();
|
|
15
|
+
if (result instanceof Promise) {
|
|
16
|
+
return result.finally(() => {
|
|
17
|
+
this.#current = prev;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
this.#current = prev;
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getStore(): T | undefined {
|
|
25
|
+
return this.#current;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const AsyncLocalStoragePromise: Promise<typeof AsyncLocalStorage | null> =
|
|
30
|
+
Promise.resolve().then(() => {
|
|
31
|
+
if ("AsyncLocalStorage" in globalThis) {
|
|
32
|
+
return (globalThis as any).AsyncLocalStorage;
|
|
33
|
+
}
|
|
34
|
+
return AsyncLocalStoragePolyfill;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export async function getAsyncLocalStorage(): Promise<
|
|
38
|
+
typeof AsyncLocalStorage
|
|
39
|
+
> {
|
|
40
|
+
const mod = await AsyncLocalStoragePromise;
|
|
41
|
+
if (mod === null) {
|
|
42
|
+
throw new Error("getAsyncLocalStorage is only available in server code");
|
|
43
|
+
} else {
|
|
44
|
+
return mod;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
2
|
+
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
|
+
import type { EndpointContext, InputContext } from "better-call";
|
|
4
|
+
import type { AuthContext } from "../types";
|
|
5
|
+
import { __getBetterAuthGlobal } from "./global";
|
|
6
|
+
|
|
7
|
+
export type AuthEndpointContext = Partial<
|
|
8
|
+
InputContext<string, any> & EndpointContext<string, any>
|
|
9
|
+
> & {
|
|
10
|
+
context: AuthContext;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const ensureAsyncStorage = async () => {
|
|
14
|
+
const betterAuthGlobal = __getBetterAuthGlobal();
|
|
15
|
+
if (!betterAuthGlobal.context.endpointContextAsyncStorage) {
|
|
16
|
+
const AsyncLocalStorage = await getAsyncLocalStorage();
|
|
17
|
+
betterAuthGlobal.context.endpointContextAsyncStorage =
|
|
18
|
+
new AsyncLocalStorage<AuthEndpointContext>();
|
|
19
|
+
}
|
|
20
|
+
return betterAuthGlobal.context
|
|
21
|
+
.endpointContextAsyncStorage as AsyncLocalStorage<AuthEndpointContext>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This is for internal use only. Most users should use `getCurrentAuthContext` instead.
|
|
26
|
+
*
|
|
27
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
28
|
+
*/
|
|
29
|
+
export async function getCurrentAuthContextAsyncLocalStorage() {
|
|
30
|
+
return ensureAsyncStorage();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function getCurrentAuthContext(): Promise<AuthEndpointContext> {
|
|
34
|
+
const als = await ensureAsyncStorage();
|
|
35
|
+
const context = als.getStore();
|
|
36
|
+
if (!context) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
"No auth context found. Please make sure you are calling this function within a `runWithEndpointContext` callback.",
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return context;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export async function runWithEndpointContext<T>(
|
|
45
|
+
context: AuthEndpointContext,
|
|
46
|
+
fn: () => T,
|
|
47
|
+
): Promise<T> {
|
|
48
|
+
const als = await ensureAsyncStorage();
|
|
49
|
+
return als.run(context, fn);
|
|
50
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
2
|
+
|
|
3
|
+
interface BetterAuthGlobal {
|
|
4
|
+
/**
|
|
5
|
+
* The version of BetterAuth.
|
|
6
|
+
*/
|
|
7
|
+
version: string;
|
|
8
|
+
/**
|
|
9
|
+
* Used to track the number of BetterAuth instances in the same process.
|
|
10
|
+
*
|
|
11
|
+
* Debugging purposes only.
|
|
12
|
+
*/
|
|
13
|
+
epoch: number;
|
|
14
|
+
/**
|
|
15
|
+
* Stores the AsyncLocalStorage instances for each context.
|
|
16
|
+
*/
|
|
17
|
+
context: Record<string, AsyncLocalStorage<unknown>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const symbol = Symbol.for("better-auth:global");
|
|
21
|
+
let bind: BetterAuthGlobal | null = null;
|
|
22
|
+
|
|
23
|
+
const __context: Record<string, AsyncLocalStorage<unknown>> = {};
|
|
24
|
+
const __betterAuthVersion: string = import.meta.env
|
|
25
|
+
.BETTER_AUTH_VERSION as string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* We store context instance in the globalThis.
|
|
29
|
+
*
|
|
30
|
+
* The reason we do this is that some bundlers, web framework, or package managers might
|
|
31
|
+
* create multiple copies of BetterAuth in the same process intentionally or unintentionally.
|
|
32
|
+
*
|
|
33
|
+
* For example, yarn v1, Next.js, SSR, Vite...
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export function __getBetterAuthGlobal(): BetterAuthGlobal {
|
|
38
|
+
if (!(globalThis as any)[symbol]) {
|
|
39
|
+
(globalThis as any)[symbol] = {
|
|
40
|
+
version: __betterAuthVersion,
|
|
41
|
+
epoch: 1,
|
|
42
|
+
context: __context,
|
|
43
|
+
};
|
|
44
|
+
bind = (globalThis as any)[symbol] as BetterAuthGlobal;
|
|
45
|
+
}
|
|
46
|
+
bind = (globalThis as any)[symbol] as BetterAuthGlobal;
|
|
47
|
+
if (bind.version !== __betterAuthVersion) {
|
|
48
|
+
bind.version = __betterAuthVersion;
|
|
49
|
+
// Different versions of BetterAuth are loaded in the same process.
|
|
50
|
+
bind.epoch++;
|
|
51
|
+
}
|
|
52
|
+
return (globalThis as any)[symbol] as BetterAuthGlobal;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getBetterAuthVersion(): string {
|
|
56
|
+
return __getBetterAuthGlobal().version;
|
|
57
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type AuthEndpointContext,
|
|
3
|
+
getCurrentAuthContext,
|
|
4
|
+
getCurrentAuthContextAsyncLocalStorage,
|
|
5
|
+
runWithEndpointContext,
|
|
6
|
+
} from "./endpoint-context";
|
|
7
|
+
export { getBetterAuthVersion } from "./global";
|
|
8
|
+
export {
|
|
9
|
+
defineRequestState,
|
|
10
|
+
getCurrentRequestState,
|
|
11
|
+
getRequestStateAsyncLocalStorage,
|
|
12
|
+
hasRequestState,
|
|
13
|
+
type RequestState,
|
|
14
|
+
type RequestStateWeakMap,
|
|
15
|
+
runWithRequestState,
|
|
16
|
+
} from "./request-state";
|
|
17
|
+
export {
|
|
18
|
+
getCurrentAdapter,
|
|
19
|
+
getCurrentDBAdapterAsyncLocalStorage,
|
|
20
|
+
queueAfterTransactionHook,
|
|
21
|
+
runWithAdapter,
|
|
22
|
+
runWithTransaction,
|
|
23
|
+
} from "./transaction";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
2
|
+
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
|
+
import { __getBetterAuthGlobal } from "./global";
|
|
4
|
+
|
|
5
|
+
export type RequestStateWeakMap = WeakMap<object, any>;
|
|
6
|
+
|
|
7
|
+
const ensureAsyncStorage = async () => {
|
|
8
|
+
const betterAuthGlobal = __getBetterAuthGlobal();
|
|
9
|
+
if (!betterAuthGlobal.context.requestStateAsyncStorage) {
|
|
10
|
+
const AsyncLocalStorage = await getAsyncLocalStorage();
|
|
11
|
+
betterAuthGlobal.context.requestStateAsyncStorage =
|
|
12
|
+
new AsyncLocalStorage<RequestStateWeakMap>();
|
|
13
|
+
}
|
|
14
|
+
return betterAuthGlobal.context
|
|
15
|
+
.requestStateAsyncStorage as AsyncLocalStorage<RequestStateWeakMap>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export async function getRequestStateAsyncLocalStorage() {
|
|
19
|
+
return ensureAsyncStorage();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function hasRequestState() {
|
|
23
|
+
const als = await ensureAsyncStorage();
|
|
24
|
+
return als.getStore() !== undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function getCurrentRequestState(): Promise<RequestStateWeakMap> {
|
|
28
|
+
const als = await ensureAsyncStorage();
|
|
29
|
+
const store = als.getStore();
|
|
30
|
+
if (!store) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
"No request state found. Please make sure you are calling this function within a `runWithRequestState` callback.",
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return store;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function runWithRequestState<T>(
|
|
39
|
+
store: RequestStateWeakMap,
|
|
40
|
+
fn: () => T,
|
|
41
|
+
): Promise<T> {
|
|
42
|
+
const als = await ensureAsyncStorage();
|
|
43
|
+
return als.run(store, fn);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface RequestState<T> {
|
|
47
|
+
get(): Promise<T>;
|
|
48
|
+
set(value: T): Promise<void>;
|
|
49
|
+
|
|
50
|
+
// A unique reference used as a key to identify this state within the request's WeakMap. Useful for debugging purposes.
|
|
51
|
+
readonly ref: Readonly<object>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Defines a request-scoped state with lazy initialization.
|
|
56
|
+
*
|
|
57
|
+
* @param initFn - A function that initializes the state. It is called the first time `get()` is invoked within each request context, and only once per context.
|
|
58
|
+
* @returns A RequestState object with `get` and `set` methods, and a unique `ref` for debugging.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* const userState = defineRequestState(() => ({ id: '', name: '' }));
|
|
62
|
+
* // Later, within a request context:
|
|
63
|
+
* const user = await userState.get();
|
|
64
|
+
*/
|
|
65
|
+
export function defineRequestState<T>(
|
|
66
|
+
initFn: () => T | Promise<T>,
|
|
67
|
+
): RequestState<T>;
|
|
68
|
+
export function defineRequestState(
|
|
69
|
+
initFn: () => any | Promise<any>,
|
|
70
|
+
): RequestState<any> {
|
|
71
|
+
const ref = Object.freeze({});
|
|
72
|
+
return {
|
|
73
|
+
get ref(): Readonly<object> {
|
|
74
|
+
return ref;
|
|
75
|
+
},
|
|
76
|
+
async get() {
|
|
77
|
+
const store = await getCurrentRequestState();
|
|
78
|
+
if (!store.has(ref)) {
|
|
79
|
+
const initialValue = await initFn();
|
|
80
|
+
store.set(ref, initialValue);
|
|
81
|
+
return initialValue;
|
|
82
|
+
}
|
|
83
|
+
return store.get(ref);
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
async set(value) {
|
|
87
|
+
const store = await getCurrentRequestState();
|
|
88
|
+
store.set(ref, value);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|