create-croissant 0.1.0 → 0.1.1
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 +30 -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 +42 -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/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 +7 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/utils.mjs +25 -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 +117 -0
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/apple.mjs +101 -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 +161 -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 +117 -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 +108 -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 +135 -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/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 +187 -0
- package/template/apps/web/node_modules/@better-auth/core/src/api/index.ts +106 -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 +64 -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/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 +29 -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 +38 -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 +223 -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 +280 -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 +206 -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 +203 -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 +342 -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/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 +183 -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 +171 -0
- package/template/apps/web/src/router.tsx +20 -0
- package/template/apps/web/src/routes/__root.tsx +41 -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/dashboard.tsx +59 -0
- package/template/apps/web/src/routes/index.tsx +57 -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/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 +23 -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,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a request pathname by removing the basePath prefix and trailing slashes.
|
|
3
|
+
* This is useful for matching paths against configured path lists.
|
|
4
|
+
*
|
|
5
|
+
* @param requestUrl - The full request URL
|
|
6
|
+
* @param basePath - The base path of the auth API (e.g., "/api/auth")
|
|
7
|
+
* @returns The normalized path without basePath prefix or trailing slashes,
|
|
8
|
+
* or "/" if URL parsing fails
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* normalizePathname("http://localhost:3000/api/auth/sso/saml2/callback/provider1", "/api/auth")
|
|
12
|
+
* // Returns: "/sso/saml2/callback/provider1"
|
|
13
|
+
*
|
|
14
|
+
* normalizePathname("http://localhost:3000/sso/saml2/callback/provider1/", "/")
|
|
15
|
+
* // Returns: "/sso/saml2/callback/provider1"
|
|
16
|
+
*/
|
|
17
|
+
export function normalizePathname(
|
|
18
|
+
requestUrl: string,
|
|
19
|
+
basePath: string,
|
|
20
|
+
): string {
|
|
21
|
+
let pathname: string;
|
|
22
|
+
try {
|
|
23
|
+
pathname = new URL(requestUrl).pathname.replace(/\/+$/, "") || "/";
|
|
24
|
+
} catch {
|
|
25
|
+
return "/";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (basePath === "/" || basePath === "") {
|
|
29
|
+
return pathname;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Check for exact match or proper path boundary (basePath followed by "/" or end)
|
|
33
|
+
// This prevents "/api/auth" from matching "/api/authevil/..."
|
|
34
|
+
if (pathname === basePath) {
|
|
35
|
+
return "/";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (pathname.startsWith(basePath + "/")) {
|
|
39
|
+
return pathname.slice(basePath.length).replace(/\/+$/, "") || "/";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return pathname;
|
|
43
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright (c) 2024 - present, Bereket Engida
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
19
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
20
|
+
DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Better Auth Drizzle Adapter
|
|
2
|
+
|
|
3
|
+
Drizzle ORM adapter for [Better Auth](https://www.better-auth.com).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @better-auth/drizzle-adapter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
For full documentation, visit [better-auth.com/docs/adapters/drizzle](https://www.better-auth.com/docs/adapters/drizzle).
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
MIT
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DBAdapter, DBAdapterDebugLogOption } from "@better-auth/core/db/adapter";
|
|
2
|
+
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
|
+
|
|
4
|
+
//#region src/drizzle-adapter.d.ts
|
|
5
|
+
interface DB {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
interface DrizzleAdapterConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The schema object that defines the tables and fields
|
|
11
|
+
*/
|
|
12
|
+
schema?: Record<string, any> | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The database provider
|
|
15
|
+
*/
|
|
16
|
+
provider: "pg" | "mysql" | "sqlite";
|
|
17
|
+
/**
|
|
18
|
+
* If the table names in the schema are plural
|
|
19
|
+
* set this to true. For example, if the schema
|
|
20
|
+
* has an object with a key "users" instead of "user"
|
|
21
|
+
*/
|
|
22
|
+
usePlural?: boolean | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Enable debug logs for the adapter
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
debugLogs?: DBAdapterDebugLogOption | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* By default snake case is used for table and field names
|
|
31
|
+
* when the CLI is used to generate the schema. If you want
|
|
32
|
+
* to use camel case, set this to true.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
camelCase?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to execute multiple operations in a transaction.
|
|
38
|
+
*
|
|
39
|
+
* If the database doesn't support transactions,
|
|
40
|
+
* set this to `false` and operations will be executed sequentially.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
transaction?: boolean | undefined;
|
|
44
|
+
}
|
|
45
|
+
declare const drizzleAdapter: (db: DB, config: DrizzleAdapterConfig) => (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { DB, DrizzleAdapterConfig, drizzleAdapter };
|
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { createAdapterFactory } from "@better-auth/core/db/adapter";
|
|
2
|
+
import { logger } from "@better-auth/core/env";
|
|
3
|
+
import { BetterAuthError } from "@better-auth/core/error";
|
|
4
|
+
import { and, asc, count, desc, eq, gt, gte, ilike, inArray, isNotNull, isNull, like, lt, lte, ne, notInArray, or, sql } from "drizzle-orm";
|
|
5
|
+
//#region src/query-builders.ts
|
|
6
|
+
/**
|
|
7
|
+
* Case-insensitive LIKE/ILIKE for pattern matching.
|
|
8
|
+
* Uses ILIKE on PostgreSQL, LOWER()+LIKE on MySQL/SQLite.
|
|
9
|
+
*/
|
|
10
|
+
function insensitiveIlike(column, pattern, provider) {
|
|
11
|
+
return provider === "pg" ? ilike(column, pattern) : sql`LOWER(${column}) LIKE LOWER(${pattern})`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Case-insensitive IN for string arrays.
|
|
15
|
+
*/
|
|
16
|
+
function insensitiveInArray(column, values) {
|
|
17
|
+
if (values.length === 0) return sql`false`;
|
|
18
|
+
return sql`LOWER(${column}) IN (${sql.join(values.map((v) => sql`LOWER(${v})`), sql`, `)})`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Case-insensitive NOT IN for string arrays.
|
|
22
|
+
*/
|
|
23
|
+
function insensitiveNotInArray(column, values) {
|
|
24
|
+
if (values.length === 0) return sql`true`;
|
|
25
|
+
return sql`LOWER(${column}) NOT IN (${sql.join(values.map((v) => sql`LOWER(${v})`), sql`, `)})`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Case-insensitive equality for strings.
|
|
29
|
+
*/
|
|
30
|
+
function insensitiveEq(column, value) {
|
|
31
|
+
return sql`LOWER(${column}) = LOWER(${value})`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Case-insensitive inequality for strings.
|
|
35
|
+
*/
|
|
36
|
+
function insensitiveNe(column, value) {
|
|
37
|
+
return sql`LOWER(${column}) <> LOWER(${value})`;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/drizzle-adapter.ts
|
|
41
|
+
const drizzleAdapter = (db, config) => {
|
|
42
|
+
let lazyOptions = null;
|
|
43
|
+
const createCustomAdapter = (db) => ({ getFieldName, getDefaultFieldName, options }) => {
|
|
44
|
+
function getSchema(model) {
|
|
45
|
+
const schema = config.schema || db._.fullSchema;
|
|
46
|
+
if (!schema) throw new BetterAuthError("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");
|
|
47
|
+
const schemaModel = schema[model];
|
|
48
|
+
if (!schemaModel) throw new BetterAuthError(`[# Drizzle Adapter]: The model "${model}" was not found in the schema object. Please pass the schema directly to the adapter options.`);
|
|
49
|
+
return schemaModel;
|
|
50
|
+
}
|
|
51
|
+
const withReturning = async (model, builder, data, where) => {
|
|
52
|
+
if (config.provider !== "mysql") return (await builder.returning())[0];
|
|
53
|
+
await builder.execute();
|
|
54
|
+
const schemaModel = getSchema(model);
|
|
55
|
+
const builderVal = builder.config?.values;
|
|
56
|
+
if (where?.length) {
|
|
57
|
+
const clause = convertWhereClause(where.map((w) => {
|
|
58
|
+
if (data[w.field] !== void 0) return {
|
|
59
|
+
...w,
|
|
60
|
+
value: data[w.field]
|
|
61
|
+
};
|
|
62
|
+
return w;
|
|
63
|
+
}), model);
|
|
64
|
+
return (await db.select().from(schemaModel).where(...clause))[0];
|
|
65
|
+
} else if (builderVal && builderVal[0]?.id?.value) {
|
|
66
|
+
let tId = builderVal[0]?.id?.value;
|
|
67
|
+
if (!tId) tId = (await db.select({ id: sql`LAST_INSERT_ID()` }).from(schemaModel).orderBy(desc(schemaModel.id)).limit(1))[0].id;
|
|
68
|
+
return (await db.select().from(schemaModel).where(eq(schemaModel.id, tId)).limit(1).execute())[0];
|
|
69
|
+
} else if (data.id) return (await db.select().from(schemaModel).where(eq(schemaModel.id, data.id)).limit(1).execute())[0];
|
|
70
|
+
else {
|
|
71
|
+
if (!("id" in schemaModel)) throw new BetterAuthError(`The model "${model}" does not have an "id" field. Please use the "id" field as your primary key.`);
|
|
72
|
+
return (await db.select().from(schemaModel).orderBy(desc(schemaModel.id)).limit(1).execute())[0];
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function convertWhereClause(where, model) {
|
|
76
|
+
const schemaModel = getSchema(model);
|
|
77
|
+
if (!where) return [];
|
|
78
|
+
if (where.length === 1) {
|
|
79
|
+
const w = where[0];
|
|
80
|
+
if (!w) return [];
|
|
81
|
+
const field = getFieldName({
|
|
82
|
+
model,
|
|
83
|
+
field: w.field
|
|
84
|
+
});
|
|
85
|
+
if (!schemaModel[field]) throw new BetterAuthError(`The field "${w.field}" does not exist in the schema for the model "${model}". Please update your schema.`);
|
|
86
|
+
const isInsensitive = (w.mode ?? "sensitive") === "insensitive" && (typeof w.value === "string" || Array.isArray(w.value) && w.value.every((v) => typeof v === "string"));
|
|
87
|
+
if (w.operator === "in") {
|
|
88
|
+
if (!Array.isArray(w.value)) throw new BetterAuthError(`The value for the field "${w.field}" must be an array when using the "in" operator.`);
|
|
89
|
+
if (isInsensitive) return [insensitiveInArray(schemaModel[field], w.value)];
|
|
90
|
+
return [inArray(schemaModel[field], w.value)];
|
|
91
|
+
}
|
|
92
|
+
if (w.operator === "not_in") {
|
|
93
|
+
if (!Array.isArray(w.value)) throw new BetterAuthError(`The value for the field "${w.field}" must be an array when using the "not_in" operator.`);
|
|
94
|
+
if (isInsensitive) return [insensitiveNotInArray(schemaModel[field], w.value)];
|
|
95
|
+
return [notInArray(schemaModel[field], w.value)];
|
|
96
|
+
}
|
|
97
|
+
if (w.operator === "contains") {
|
|
98
|
+
if (isInsensitive && typeof w.value === "string") return [insensitiveIlike(schemaModel[field], `%${w.value}%`, config.provider)];
|
|
99
|
+
return [like(schemaModel[field], `%${w.value}%`)];
|
|
100
|
+
}
|
|
101
|
+
if (w.operator === "starts_with") {
|
|
102
|
+
if (isInsensitive && typeof w.value === "string") return [insensitiveIlike(schemaModel[field], `${w.value}%`, config.provider)];
|
|
103
|
+
return [like(schemaModel[field], `${w.value}%`)];
|
|
104
|
+
}
|
|
105
|
+
if (w.operator === "ends_with") {
|
|
106
|
+
if (isInsensitive && typeof w.value === "string") return [insensitiveIlike(schemaModel[field], `%${w.value}`, config.provider)];
|
|
107
|
+
return [like(schemaModel[field], `%${w.value}`)];
|
|
108
|
+
}
|
|
109
|
+
if (w.operator === "lt") return [lt(schemaModel[field], w.value)];
|
|
110
|
+
if (w.operator === "lte") return [lte(schemaModel[field], w.value)];
|
|
111
|
+
if (w.operator === "ne") {
|
|
112
|
+
if (w.value === null) return [isNotNull(schemaModel[field])];
|
|
113
|
+
if (isInsensitive && typeof w.value === "string") return [insensitiveNe(schemaModel[field], w.value)];
|
|
114
|
+
return [ne(schemaModel[field], w.value)];
|
|
115
|
+
}
|
|
116
|
+
if (w.operator === "gt") return [gt(schemaModel[field], w.value)];
|
|
117
|
+
if (w.operator === "gte") return [gte(schemaModel[field], w.value)];
|
|
118
|
+
if (w.value === null) return [isNull(schemaModel[field])];
|
|
119
|
+
if (isInsensitive && typeof w.value === "string") return [insensitiveEq(schemaModel[field], w.value)];
|
|
120
|
+
return [eq(schemaModel[field], w.value)];
|
|
121
|
+
}
|
|
122
|
+
const andGroup = where.filter((w) => w.connector === "AND" || !w.connector);
|
|
123
|
+
const orGroup = where.filter((w) => w.connector === "OR");
|
|
124
|
+
const andClause = and(...andGroup.map((w) => {
|
|
125
|
+
const field = getFieldName({
|
|
126
|
+
model,
|
|
127
|
+
field: w.field
|
|
128
|
+
});
|
|
129
|
+
const isInsensitive = (w.mode ?? "sensitive") === "insensitive" && (typeof w.value === "string" || Array.isArray(w.value) && w.value.every((v) => typeof v === "string"));
|
|
130
|
+
if (w.operator === "in") {
|
|
131
|
+
if (!Array.isArray(w.value)) throw new BetterAuthError(`The value for the field "${w.field}" must be an array when using the "in" operator.`);
|
|
132
|
+
if (isInsensitive) return insensitiveInArray(schemaModel[field], w.value);
|
|
133
|
+
return inArray(schemaModel[field], w.value);
|
|
134
|
+
}
|
|
135
|
+
if (w.operator === "not_in") {
|
|
136
|
+
if (!Array.isArray(w.value)) throw new BetterAuthError(`The value for the field "${w.field}" must be an array when using the "not_in" operator.`);
|
|
137
|
+
if (isInsensitive) return insensitiveNotInArray(schemaModel[field], w.value);
|
|
138
|
+
return notInArray(schemaModel[field], w.value);
|
|
139
|
+
}
|
|
140
|
+
if (w.operator === "contains") {
|
|
141
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveIlike(schemaModel[field], `%${w.value}%`, config.provider);
|
|
142
|
+
return like(schemaModel[field], `%${w.value}%`);
|
|
143
|
+
}
|
|
144
|
+
if (w.operator === "starts_with") {
|
|
145
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveIlike(schemaModel[field], `${w.value}%`, config.provider);
|
|
146
|
+
return like(schemaModel[field], `${w.value}%`);
|
|
147
|
+
}
|
|
148
|
+
if (w.operator === "ends_with") {
|
|
149
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveIlike(schemaModel[field], `%${w.value}`, config.provider);
|
|
150
|
+
return like(schemaModel[field], `%${w.value}`);
|
|
151
|
+
}
|
|
152
|
+
if (w.operator === "lt") return lt(schemaModel[field], w.value);
|
|
153
|
+
if (w.operator === "lte") return lte(schemaModel[field], w.value);
|
|
154
|
+
if (w.operator === "gt") return gt(schemaModel[field], w.value);
|
|
155
|
+
if (w.operator === "gte") return gte(schemaModel[field], w.value);
|
|
156
|
+
if (w.operator === "ne") {
|
|
157
|
+
if (w.value === null) return isNotNull(schemaModel[field]);
|
|
158
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveNe(schemaModel[field], w.value);
|
|
159
|
+
return ne(schemaModel[field], w.value);
|
|
160
|
+
}
|
|
161
|
+
if (w.value === null) return isNull(schemaModel[field]);
|
|
162
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveEq(schemaModel[field], w.value);
|
|
163
|
+
return eq(schemaModel[field], w.value);
|
|
164
|
+
}));
|
|
165
|
+
const orClause = or(...orGroup.map((w) => {
|
|
166
|
+
const field = getFieldName({
|
|
167
|
+
model,
|
|
168
|
+
field: w.field
|
|
169
|
+
});
|
|
170
|
+
if (!schemaModel[field]) throw new BetterAuthError(`The field "${w.field}" does not exist in the schema for the model "${model}". Please update your schema.`);
|
|
171
|
+
const isInsensitive = (w.mode ?? "sensitive") === "insensitive" && (typeof w.value === "string" || Array.isArray(w.value) && w.value.every((v) => typeof v === "string"));
|
|
172
|
+
if (w.operator === "in") {
|
|
173
|
+
if (!Array.isArray(w.value)) throw new BetterAuthError(`The value for the field "${w.field}" must be an array when using the "in" operator.`);
|
|
174
|
+
if (isInsensitive) return insensitiveInArray(schemaModel[field], w.value);
|
|
175
|
+
return inArray(schemaModel[field], w.value);
|
|
176
|
+
}
|
|
177
|
+
if (w.operator === "not_in") {
|
|
178
|
+
if (!Array.isArray(w.value)) throw new BetterAuthError(`The value for the field "${w.field}" must be an array when using the "not_in" operator.`);
|
|
179
|
+
if (isInsensitive) return insensitiveNotInArray(schemaModel[field], w.value);
|
|
180
|
+
return notInArray(schemaModel[field], w.value);
|
|
181
|
+
}
|
|
182
|
+
if (w.operator === "contains") {
|
|
183
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveIlike(schemaModel[field], `%${w.value}%`, config.provider);
|
|
184
|
+
return like(schemaModel[field], `%${w.value}%`);
|
|
185
|
+
}
|
|
186
|
+
if (w.operator === "starts_with") {
|
|
187
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveIlike(schemaModel[field], `${w.value}%`, config.provider);
|
|
188
|
+
return like(schemaModel[field], `${w.value}%`);
|
|
189
|
+
}
|
|
190
|
+
if (w.operator === "ends_with") {
|
|
191
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveIlike(schemaModel[field], `%${w.value}`, config.provider);
|
|
192
|
+
return like(schemaModel[field], `%${w.value}`);
|
|
193
|
+
}
|
|
194
|
+
if (w.operator === "lt") return lt(schemaModel[field], w.value);
|
|
195
|
+
if (w.operator === "lte") return lte(schemaModel[field], w.value);
|
|
196
|
+
if (w.operator === "gt") return gt(schemaModel[field], w.value);
|
|
197
|
+
if (w.operator === "gte") return gte(schemaModel[field], w.value);
|
|
198
|
+
if (w.operator === "ne") {
|
|
199
|
+
if (w.value === null) return isNotNull(schemaModel[field]);
|
|
200
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveNe(schemaModel[field], w.value);
|
|
201
|
+
return ne(schemaModel[field], w.value);
|
|
202
|
+
}
|
|
203
|
+
if (w.value === null) return isNull(schemaModel[field]);
|
|
204
|
+
if (isInsensitive && typeof w.value === "string") return insensitiveEq(schemaModel[field], w.value);
|
|
205
|
+
return eq(schemaModel[field], w.value);
|
|
206
|
+
}));
|
|
207
|
+
const clause = [];
|
|
208
|
+
if (andGroup.length) clause.push(andClause);
|
|
209
|
+
if (orGroup.length) clause.push(orClause);
|
|
210
|
+
return clause;
|
|
211
|
+
}
|
|
212
|
+
function checkMissingFields(schema, model, values) {
|
|
213
|
+
if (!schema) throw new BetterAuthError("Drizzle adapter failed to initialize. Drizzle Schema not found. Please provide a schema object in the adapter options object.");
|
|
214
|
+
for (const key in values) {
|
|
215
|
+
let fieldName;
|
|
216
|
+
try {
|
|
217
|
+
fieldName = getFieldName({
|
|
218
|
+
model,
|
|
219
|
+
field: key
|
|
220
|
+
});
|
|
221
|
+
} catch {
|
|
222
|
+
fieldName = key;
|
|
223
|
+
}
|
|
224
|
+
if (!schema[fieldName]) throw new BetterAuthError(`The field "${key}" does not exist in the "${model}" Drizzle schema. Please update your drizzle schema or re-generate using "npx auth@latest generate".`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Resolve the db.query key for a model.
|
|
229
|
+
*
|
|
230
|
+
* When `usePlural` is false (default), Better Auth uses singular model
|
|
231
|
+
* names like "user", but Drizzle's db.query is keyed by the schema
|
|
232
|
+
* export names (often plural like "users"). This function:
|
|
233
|
+
*
|
|
234
|
+
* 1. Tries the model name directly (works when schema keys match)
|
|
235
|
+
* 2. If usePlural is set, tries appending "s"
|
|
236
|
+
* 3. Falls back to scanning config.schema to find which db.query key
|
|
237
|
+
* corresponds to the same table object
|
|
238
|
+
*/
|
|
239
|
+
function getQueryModel(model) {
|
|
240
|
+
if (db.query[model]) return model;
|
|
241
|
+
if (config.usePlural) {
|
|
242
|
+
const plural = `${model}s`;
|
|
243
|
+
if (db.query[plural]) return plural;
|
|
244
|
+
}
|
|
245
|
+
if (config.schema) {
|
|
246
|
+
const targetTable = config.schema[model];
|
|
247
|
+
if (targetTable) {
|
|
248
|
+
const fullSchema = db._.fullSchema;
|
|
249
|
+
if (fullSchema) {
|
|
250
|
+
for (const key of Object.keys(db.query)) if (fullSchema[key] === targetTable) return key;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
async create({ model, data: values }) {
|
|
258
|
+
const schemaModel = getSchema(model);
|
|
259
|
+
checkMissingFields(schemaModel, model, values);
|
|
260
|
+
return await withReturning(model, db.insert(schemaModel).values(values), values);
|
|
261
|
+
},
|
|
262
|
+
async findOne({ model, where, select, join }) {
|
|
263
|
+
const schemaModel = getSchema(model);
|
|
264
|
+
const clause = convertWhereClause(where, model);
|
|
265
|
+
if (options.experimental?.joins) {
|
|
266
|
+
const queryModel = getQueryModel(model);
|
|
267
|
+
if (!db.query || !queryModel) {
|
|
268
|
+
logger.error(`[# Drizzle Adapter]: The model "${model}" was not found in the query object. Please update your Drizzle schema to include relations or re-generate using "npx auth@latest generate".`);
|
|
269
|
+
logger.info("Falling back to regular query");
|
|
270
|
+
} else {
|
|
271
|
+
let includes;
|
|
272
|
+
const pluralJoinResults = [];
|
|
273
|
+
if (join) {
|
|
274
|
+
includes = {};
|
|
275
|
+
const joinEntries = Object.entries(join);
|
|
276
|
+
for (const [model, joinAttr] of joinEntries) {
|
|
277
|
+
const limit = joinAttr.limit ?? options.advanced?.database?.defaultFindManyLimit ?? 100;
|
|
278
|
+
const isUnique = joinAttr.relation === "one-to-one";
|
|
279
|
+
const pluralSuffix = isUnique || config.usePlural ? "" : "s";
|
|
280
|
+
includes[`${model}${pluralSuffix}`] = isUnique ? true : { limit };
|
|
281
|
+
if (!isUnique) pluralJoinResults.push(`${model}${pluralSuffix}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const res = await db.query[queryModel].findFirst({
|
|
285
|
+
where: clause[0],
|
|
286
|
+
columns: select?.length && select.length > 0 ? select.reduce((acc, field) => {
|
|
287
|
+
acc[getFieldName({
|
|
288
|
+
model,
|
|
289
|
+
field
|
|
290
|
+
})] = true;
|
|
291
|
+
return acc;
|
|
292
|
+
}, {}) : void 0,
|
|
293
|
+
with: includes
|
|
294
|
+
});
|
|
295
|
+
if (res) for (const pluralJoinResult of pluralJoinResults) {
|
|
296
|
+
const singularKey = !config.usePlural ? pluralJoinResult.slice(0, -1) : pluralJoinResult;
|
|
297
|
+
res[singularKey] = res[pluralJoinResult];
|
|
298
|
+
if (pluralJoinResult !== singularKey) delete res[pluralJoinResult];
|
|
299
|
+
}
|
|
300
|
+
return res;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const res = await db.select(select?.length && select.length > 0 ? select.reduce((acc, field) => {
|
|
304
|
+
const fieldName = getFieldName({
|
|
305
|
+
model,
|
|
306
|
+
field
|
|
307
|
+
});
|
|
308
|
+
return {
|
|
309
|
+
...acc,
|
|
310
|
+
[fieldName]: schemaModel[fieldName]
|
|
311
|
+
};
|
|
312
|
+
}, {}) : void 0).from(schemaModel).where(...clause);
|
|
313
|
+
if (!res.length) return null;
|
|
314
|
+
return res[0];
|
|
315
|
+
},
|
|
316
|
+
async findMany({ model, where, sortBy, limit, select, offset, join }) {
|
|
317
|
+
const schemaModel = getSchema(model);
|
|
318
|
+
const clause = where ? convertWhereClause(where, model) : [];
|
|
319
|
+
const sortFn = sortBy?.direction === "desc" ? desc : asc;
|
|
320
|
+
if (options.experimental?.joins) {
|
|
321
|
+
const queryModel = getQueryModel(model);
|
|
322
|
+
if (!queryModel) {
|
|
323
|
+
logger.error(`[# Drizzle Adapter]: The model "${model}" was not found in the query object. Please update your Drizzle schema to include relations or re-generate using "npx auth@latest generate".`);
|
|
324
|
+
logger.info("Falling back to regular query");
|
|
325
|
+
} else {
|
|
326
|
+
let includes;
|
|
327
|
+
const pluralJoinResults = [];
|
|
328
|
+
if (join) {
|
|
329
|
+
includes = {};
|
|
330
|
+
const joinEntries = Object.entries(join);
|
|
331
|
+
for (const [model, joinAttr] of joinEntries) {
|
|
332
|
+
const isUnique = joinAttr.relation === "one-to-one";
|
|
333
|
+
const limit = joinAttr.limit ?? options.advanced?.database?.defaultFindManyLimit ?? 100;
|
|
334
|
+
const pluralSuffix = isUnique || config.usePlural ? "" : "s";
|
|
335
|
+
includes[`${model}${pluralSuffix}`] = isUnique ? true : { limit };
|
|
336
|
+
if (!isUnique) pluralJoinResults.push(`${model}${pluralSuffix}`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
let orderBy = void 0;
|
|
340
|
+
if (sortBy?.field) orderBy = [sortFn(schemaModel[getFieldName({
|
|
341
|
+
model,
|
|
342
|
+
field: sortBy?.field
|
|
343
|
+
})])];
|
|
344
|
+
const res = await db.query[queryModel].findMany({
|
|
345
|
+
where: clause[0],
|
|
346
|
+
with: includes,
|
|
347
|
+
columns: select?.length && select.length > 0 ? select.reduce((acc, field) => {
|
|
348
|
+
acc[getFieldName({
|
|
349
|
+
model,
|
|
350
|
+
field
|
|
351
|
+
})] = true;
|
|
352
|
+
return acc;
|
|
353
|
+
}, {}) : void 0,
|
|
354
|
+
limit: limit ?? 100,
|
|
355
|
+
offset: offset ?? 0,
|
|
356
|
+
orderBy
|
|
357
|
+
});
|
|
358
|
+
if (res) for (const item of res) for (const pluralJoinResult of pluralJoinResults) {
|
|
359
|
+
const singularKey = !config.usePlural ? pluralJoinResult.slice(0, -1) : pluralJoinResult;
|
|
360
|
+
if (singularKey === pluralJoinResult) continue;
|
|
361
|
+
item[singularKey] = item[pluralJoinResult];
|
|
362
|
+
delete item[pluralJoinResult];
|
|
363
|
+
}
|
|
364
|
+
return res;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
let builder = db.select(select?.length && select.length > 0 ? select.reduce((acc, field) => {
|
|
368
|
+
const fieldName = getFieldName({
|
|
369
|
+
model,
|
|
370
|
+
field
|
|
371
|
+
});
|
|
372
|
+
return {
|
|
373
|
+
...acc,
|
|
374
|
+
[fieldName]: schemaModel[fieldName]
|
|
375
|
+
};
|
|
376
|
+
}, {}) : void 0).from(schemaModel);
|
|
377
|
+
const effectiveLimit = limit;
|
|
378
|
+
const effectiveOffset = offset;
|
|
379
|
+
if (typeof effectiveLimit !== "undefined") builder = builder.limit(effectiveLimit);
|
|
380
|
+
if (typeof effectiveOffset !== "undefined") builder = builder.offset(effectiveOffset);
|
|
381
|
+
if (sortBy?.field) builder = builder.orderBy(sortFn(schemaModel[getFieldName({
|
|
382
|
+
model,
|
|
383
|
+
field: sortBy?.field
|
|
384
|
+
})]));
|
|
385
|
+
return await builder.where(...clause);
|
|
386
|
+
},
|
|
387
|
+
async count({ model, where }) {
|
|
388
|
+
const schemaModel = getSchema(model);
|
|
389
|
+
const clause = where ? convertWhereClause(where, model) : [];
|
|
390
|
+
return (await db.select({ count: count() }).from(schemaModel).where(...clause))[0].count;
|
|
391
|
+
},
|
|
392
|
+
async update({ model, where, update: values }) {
|
|
393
|
+
const schemaModel = getSchema(model);
|
|
394
|
+
const clause = convertWhereClause(where, model);
|
|
395
|
+
return await withReturning(model, db.update(schemaModel).set(values).where(...clause), values, where);
|
|
396
|
+
},
|
|
397
|
+
async updateMany({ model, where, update: values }) {
|
|
398
|
+
const schemaModel = getSchema(model);
|
|
399
|
+
const clause = convertWhereClause(where, model);
|
|
400
|
+
return await db.update(schemaModel).set(values).where(...clause);
|
|
401
|
+
},
|
|
402
|
+
async delete({ model, where }) {
|
|
403
|
+
const schemaModel = getSchema(model);
|
|
404
|
+
const clause = convertWhereClause(where, model);
|
|
405
|
+
return await db.delete(schemaModel).where(...clause);
|
|
406
|
+
},
|
|
407
|
+
async deleteMany({ model, where }) {
|
|
408
|
+
const schemaModel = getSchema(model);
|
|
409
|
+
const clause = convertWhereClause(where, model);
|
|
410
|
+
const res = await db.delete(schemaModel).where(...clause);
|
|
411
|
+
let count = 0;
|
|
412
|
+
if (res && "rowCount" in res) count = res.rowCount;
|
|
413
|
+
else if (Array.isArray(res)) count = res.length;
|
|
414
|
+
else if (res && ("affectedRows" in res || "rowsAffected" in res || "changes" in res)) count = res.affectedRows ?? res.rowsAffected ?? res.changes;
|
|
415
|
+
if (typeof count !== "number") logger.error("[Drizzle Adapter] The result of the deleteMany operation is not a number. This is likely a bug in the adapter. Please report this issue to the Better Auth team.", {
|
|
416
|
+
res,
|
|
417
|
+
model,
|
|
418
|
+
where
|
|
419
|
+
});
|
|
420
|
+
return count;
|
|
421
|
+
},
|
|
422
|
+
options: config
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
let adapterOptions = null;
|
|
426
|
+
adapterOptions = {
|
|
427
|
+
config: {
|
|
428
|
+
adapterId: "drizzle",
|
|
429
|
+
adapterName: "Drizzle Adapter",
|
|
430
|
+
usePlural: config.usePlural ?? false,
|
|
431
|
+
debugLogs: config.debugLogs ?? false,
|
|
432
|
+
supportsUUIDs: config.provider === "pg" ? true : false,
|
|
433
|
+
supportsJSON: config.provider === "pg" ? true : false,
|
|
434
|
+
supportsArrays: config.provider === "pg" ? true : false,
|
|
435
|
+
customTransformOutput: ({ data, fieldAttributes }) => {
|
|
436
|
+
if (fieldAttributes.type === "date") {
|
|
437
|
+
if (data === null || data === void 0) return data;
|
|
438
|
+
return new Date(data);
|
|
439
|
+
}
|
|
440
|
+
return data;
|
|
441
|
+
},
|
|
442
|
+
transaction: config.transaction ?? false ? (cb) => db.transaction((tx) => {
|
|
443
|
+
return cb(createAdapterFactory({
|
|
444
|
+
config: adapterOptions.config,
|
|
445
|
+
adapter: createCustomAdapter(tx)
|
|
446
|
+
})(lazyOptions));
|
|
447
|
+
}) : false
|
|
448
|
+
},
|
|
449
|
+
adapter: createCustomAdapter(db)
|
|
450
|
+
};
|
|
451
|
+
const adapter = createAdapterFactory(adapterOptions);
|
|
452
|
+
return (options) => {
|
|
453
|
+
lazyOptions = options;
|
|
454
|
+
return adapter(options);
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
//#endregion
|
|
458
|
+
export { drizzleAdapter };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@better-auth/drizzle-adapter",
|
|
3
|
+
"version": "1.6.6",
|
|
4
|
+
"description": "Drizzle adapter for Better Auth",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://www.better-auth.com/docs/adapters/drizzle",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/better-auth/better-auth.git",
|
|
11
|
+
"directory": "packages/drizzle-adapter"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"auth",
|
|
15
|
+
"drizzle",
|
|
16
|
+
"adapter",
|
|
17
|
+
"typescript",
|
|
18
|
+
"better-auth"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"main": "./dist/index.mjs",
|
|
28
|
+
"module": "./dist/index.mjs",
|
|
29
|
+
"types": "./dist/index.d.mts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"dev-source": "./src/index.ts",
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"default": "./dist/index.mjs"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@better-auth/utils": "0.4.0",
|
|
39
|
+
"drizzle-orm": "^0.45.2",
|
|
40
|
+
"@better-auth/core": "^1.6.6"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"drizzle-orm": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@better-auth/utils": "0.4.0",
|
|
49
|
+
"drizzle-orm": "^0.45.2",
|
|
50
|
+
"tsdown": "0.21.1",
|
|
51
|
+
"typescript": "^5.9.3",
|
|
52
|
+
"@better-auth/core": "1.6.6"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsdown",
|
|
56
|
+
"dev": "tsdown --watch",
|
|
57
|
+
"lint:package": "publint run --strict --pack false",
|
|
58
|
+
"lint:types": "attw --profile esm-only --pack .",
|
|
59
|
+
"typecheck": "tsc --noEmit",
|
|
60
|
+
"test": "vitest"
|
|
61
|
+
}
|
|
62
|
+
}
|