create-croissant 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/apps/web/package.json +4 -0
- package/template/apps/web/src/components/login-form.tsx +95 -48
- package/template/apps/web/src/components/signup-form.tsx +149 -79
- package/template/apps/web/src/routes/__root.tsx +18 -11
- package/template/apps/web/src/routes/client-orpc-auth.tsx +8 -20
- package/template/apps/web/src/routes/client-orpc.tsx +269 -24
- package/template/apps/web/src/routes/isr.tsx +4 -0
- package/template/apps/web/src/routes/ssr-orpc.tsx +245 -18
- package/template/apps/web/vite.config.ts +5 -1
- package/template/package.json +3 -1
- package/template/packages/orpc/src/lib/router.ts +63 -0
- package/template/apps/web/node_modules/@better-auth/core/LICENSE.md +0 -20
- package/template/apps/web/node_modules/@better-auth/core/README.md +0 -17
- package/template/apps/web/node_modules/@better-auth/core/dist/api/index.d.mts +0 -278
- package/template/apps/web/node_modules/@better-auth/core/dist/api/index.mjs +0 -56
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/index.d.mts +0 -6
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/index.mjs +0 -20
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/pure.index.d.mts +0 -6
- package/template/apps/web/node_modules/@better-auth/core/dist/async_hooks/pure.index.mjs +0 -33
- package/template/apps/web/node_modules/@better-auth/core/dist/context/endpoint-context.d.mts +0 -18
- package/template/apps/web/node_modules/@better-auth/core/dist/context/endpoint-context.mjs +0 -29
- package/template/apps/web/node_modules/@better-auth/core/dist/context/global.d.mts +0 -6
- package/template/apps/web/node_modules/@better-auth/core/dist/context/global.mjs +0 -36
- package/template/apps/web/node_modules/@better-auth/core/dist/context/index.d.mts +0 -5
- package/template/apps/web/node_modules/@better-auth/core/dist/context/index.mjs +0 -5
- package/template/apps/web/node_modules/@better-auth/core/dist/context/request-state.d.mts +0 -27
- package/template/apps/web/node_modules/@better-auth/core/dist/context/request-state.mjs +0 -47
- package/template/apps/web/node_modules/@better-auth/core/dist/context/transaction.d.mts +0 -24
- package/template/apps/web/node_modules/@better-auth/core/dist/context/transaction.mjs +0 -93
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/factory.d.mts +0 -17
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/factory.mjs +0 -754
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.d.mts +0 -18
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.mjs +0 -36
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.d.mts +0 -12
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.mjs +0 -30
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.d.mts +0 -26
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.mjs +0 -37
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-name.d.mts +0 -18
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-field-name.mjs +0 -31
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-id-field.d.mts +0 -36
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-id-field.mjs +0 -64
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-model-name.d.mts +0 -12
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/get-model-name.mjs +0 -21
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/index.d.mts +0 -525
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/index.mjs +0 -24
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/types.d.mts +0 -105
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/utils.d.mts +0 -7
- package/template/apps/web/node_modules/@better-auth/core/dist/db/adapter/utils.mjs +0 -37
- package/template/apps/web/node_modules/@better-auth/core/dist/db/get-tables.d.mts +0 -6
- package/template/apps/web/node_modules/@better-auth/core/dist/db/get-tables.mjs +0 -265
- package/template/apps/web/node_modules/@better-auth/core/dist/db/index.d.mts +0 -10
- package/template/apps/web/node_modules/@better-auth/core/dist/db/index.mjs +0 -8
- package/template/apps/web/node_modules/@better-auth/core/dist/db/plugin.d.mts +0 -12
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/account.d.mts +0 -28
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/account.mjs +0 -17
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/rate-limit.d.mts +0 -18
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/rate-limit.mjs +0 -9
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/session.d.mts +0 -23
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/session.mjs +0 -12
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/shared.d.mts +0 -10
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/shared.mjs +0 -9
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/user.d.mts +0 -22
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/user.mjs +0 -11
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/verification.d.mts +0 -21
- package/template/apps/web/node_modules/@better-auth/core/dist/db/schema/verification.mjs +0 -10
- package/template/apps/web/node_modules/@better-auth/core/dist/db/type.d.mts +0 -167
- package/template/apps/web/node_modules/@better-auth/core/dist/env/color-depth.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/core/dist/env/color-depth.mjs +0 -86
- package/template/apps/web/node_modules/@better-auth/core/dist/env/env-impl.d.mts +0 -32
- package/template/apps/web/node_modules/@better-auth/core/dist/env/env-impl.mjs +0 -81
- package/template/apps/web/node_modules/@better-auth/core/dist/env/index.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/core/dist/env/index.mjs +0 -4
- package/template/apps/web/node_modules/@better-auth/core/dist/env/logger.d.mts +0 -48
- package/template/apps/web/node_modules/@better-auth/core/dist/env/logger.mjs +0 -79
- package/template/apps/web/node_modules/@better-auth/core/dist/error/codes.d.mts +0 -68
- package/template/apps/web/node_modules/@better-auth/core/dist/error/codes.mjs +0 -54
- package/template/apps/web/node_modules/@better-auth/core/dist/error/index.d.mts +0 -19
- package/template/apps/web/node_modules/@better-auth/core/dist/error/index.mjs +0 -27
- package/template/apps/web/node_modules/@better-auth/core/dist/index.d.mts +0 -9
- package/template/apps/web/node_modules/@better-auth/core/dist/index.mjs +0 -1
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/api.mjs +0 -12
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/attributes.d.mts +0 -11
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/attributes.mjs +0 -10
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/index.d.mts +0 -3
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/index.mjs +0 -3
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/noop.mjs +0 -42
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/pure.index.d.mts +0 -7
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/pure.index.mjs +0 -7
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/tracer.d.mts +0 -13
- package/template/apps/web/node_modules/@better-auth/core/dist/instrumentation/tracer.mjs +0 -53
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.d.mts +0 -56
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.mjs +0 -64
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.d.mts +0 -44
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.mjs +0 -41
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/index.d.mts +0 -8
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/index.mjs +0 -7
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/oauth-provider.d.mts +0 -192
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.d.mts +0 -54
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.mjs +0 -73
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/utils.d.mts +0 -16
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/utils.mjs +0 -37
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.d.mts +0 -85
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.mjs +0 -79
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/verify.d.mts +0 -42
- package/template/apps/web/node_modules/@better-auth/core/dist/oauth2/verify.mjs +0 -92
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/apple.d.mts +0 -126
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/apple.mjs +0 -107
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/atlassian.d.mts +0 -70
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/atlassian.mjs +0 -80
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/cognito.d.mts +0 -85
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/cognito.mjs +0 -162
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/discord.d.mts +0 -124
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/discord.mjs +0 -62
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/dropbox.d.mts +0 -69
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/dropbox.mjs +0 -72
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/facebook.d.mts +0 -79
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/facebook.mjs +0 -124
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/figma.d.mts +0 -61
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/figma.mjs +0 -83
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/github.d.mts +0 -102
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/github.mjs +0 -92
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/gitlab.d.mts +0 -123
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/gitlab.mjs +0 -79
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/google.d.mts +0 -97
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/google.mjs +0 -109
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/huggingface.d.mts +0 -83
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/huggingface.mjs +0 -73
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/index.d.mts +0 -1834
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/index.mjs +0 -78
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kakao.d.mts +0 -161
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kakao.mjs +0 -70
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kick.d.mts +0 -73
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/kick.mjs +0 -68
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/line.d.mts +0 -105
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/line.mjs +0 -110
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linear.d.mts +0 -68
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linear.mjs +0 -85
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linkedin.d.mts +0 -67
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/linkedin.mjs +0 -73
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.d.mts +0 -174
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.mjs +0 -140
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/naver.d.mts +0 -92
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/naver.mjs +0 -65
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/notion.d.mts +0 -64
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/notion.mjs +0 -72
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paybin.d.mts +0 -71
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paybin.mjs +0 -81
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paypal.d.mts +0 -129
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/paypal.mjs +0 -140
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/polar.d.mts +0 -74
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/polar.mjs +0 -71
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/railway.d.mts +0 -65
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/railway.mjs +0 -74
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/reddit.d.mts +0 -62
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/reddit.mjs +0 -80
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/roblox.d.mts +0 -70
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/roblox.mjs +0 -57
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/salesforce.d.mts +0 -79
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/salesforce.mjs +0 -87
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/slack.d.mts +0 -83
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/slack.mjs +0 -66
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/spotify.d.mts +0 -63
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/spotify.mjs +0 -69
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/tiktok.d.mts +0 -168
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/tiktok.mjs +0 -60
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitch.d.mts +0 -79
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitch.mjs +0 -75
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitter.d.mts +0 -126
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/twitter.mjs +0 -85
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vercel.d.mts +0 -62
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vercel.mjs +0 -58
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vk.d.mts +0 -70
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/vk.mjs +0 -81
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/wechat.d.mts +0 -113
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/wechat.mjs +0 -81
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/zoom.d.mts +0 -163
- package/template/apps/web/node_modules/@better-auth/core/dist/social-providers/zoom.mjs +0 -69
- package/template/apps/web/node_modules/@better-auth/core/dist/types/context.d.mts +0 -277
- package/template/apps/web/node_modules/@better-auth/core/dist/types/cookie.d.mts +0 -15
- package/template/apps/web/node_modules/@better-auth/core/dist/types/helper.d.mts +0 -10
- package/template/apps/web/node_modules/@better-auth/core/dist/types/index.d.mts +0 -9
- package/template/apps/web/node_modules/@better-auth/core/dist/types/init-options.d.mts +0 -1358
- package/template/apps/web/node_modules/@better-auth/core/dist/types/plugin-client.d.mts +0 -113
- package/template/apps/web/node_modules/@better-auth/core/dist/types/plugin.d.mts +0 -124
- package/template/apps/web/node_modules/@better-auth/core/dist/types/secret.d.mts +0 -11
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/async.d.mts +0 -22
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/async.mjs +0 -32
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/db.d.mts +0 -9
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/db.mjs +0 -15
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/deprecate.d.mts +0 -9
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/deprecate.mjs +0 -16
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/error-codes.d.mts +0 -13
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/error-codes.mjs +0 -10
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/fetch-metadata.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/fetch-metadata.mjs +0 -6
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/host.d.mts +0 -147
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/host.mjs +0 -291
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/id.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/id.mjs +0 -7
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/ip.d.mts +0 -54
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/ip.mjs +0 -116
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/is-api-error.d.mts +0 -6
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/is-api-error.mjs +0 -8
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/json.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/json.mjs +0 -41
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/string.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/string.mjs +0 -6
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/url.d.mts +0 -20
- package/template/apps/web/node_modules/@better-auth/core/dist/utils/url.mjs +0 -31
- package/template/apps/web/node_modules/@better-auth/core/package.json +0 -193
- package/template/apps/web/node_modules/@better-auth/core/src/api/index.ts +0 -140
- package/template/apps/web/node_modules/@better-auth/core/src/async_hooks/index.ts +0 -40
- package/template/apps/web/node_modules/@better-auth/core/src/async_hooks/pure.index.ts +0 -46
- package/template/apps/web/node_modules/@better-auth/core/src/context/endpoint-context.ts +0 -50
- package/template/apps/web/node_modules/@better-auth/core/src/context/global.ts +0 -57
- package/template/apps/web/node_modules/@better-auth/core/src/context/index.ts +0 -23
- package/template/apps/web/node_modules/@better-auth/core/src/context/request-state.ts +0 -91
- package/template/apps/web/node_modules/@better-auth/core/src/context/transaction.ts +0 -136
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/factory.ts +0 -1440
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-default-field-name.ts +0 -59
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-default-model-name.ts +0 -51
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-field-attributes.ts +0 -62
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-field-name.ts +0 -43
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-id-field.ts +0 -150
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/get-model-name.ts +0 -36
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/index.ts +0 -567
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/types.ts +0 -132
- package/template/apps/web/node_modules/@better-auth/core/src/db/adapter/utils.ts +0 -61
- package/template/apps/web/node_modules/@better-auth/core/src/db/get-tables.ts +0 -296
- package/template/apps/web/node_modules/@better-auth/core/src/db/index.ts +0 -43
- package/template/apps/web/node_modules/@better-auth/core/src/db/plugin.ts +0 -11
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/account.ts +0 -47
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/rate-limit.ts +0 -36
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/session.ts +0 -29
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/shared.ts +0 -7
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/user.ts +0 -28
- package/template/apps/web/node_modules/@better-auth/core/src/db/schema/verification.ts +0 -28
- package/template/apps/web/node_modules/@better-auth/core/src/db/type.ts +0 -333
- package/template/apps/web/node_modules/@better-auth/core/src/env/color-depth.ts +0 -172
- package/template/apps/web/node_modules/@better-auth/core/src/env/env-impl.ts +0 -124
- package/template/apps/web/node_modules/@better-auth/core/src/env/index.ts +0 -23
- package/template/apps/web/node_modules/@better-auth/core/src/env/logger.ts +0 -145
- package/template/apps/web/node_modules/@better-auth/core/src/error/codes.ts +0 -71
- package/template/apps/web/node_modules/@better-auth/core/src/error/index.ts +0 -35
- package/template/apps/web/node_modules/@better-auth/core/src/index.ts +0 -1
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/api.ts +0 -17
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/attributes.ts +0 -22
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/index.ts +0 -2
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/noop.ts +0 -74
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/pure.index.ts +0 -31
- package/template/apps/web/node_modules/@better-auth/core/src/instrumentation/tracer.ts +0 -95
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/client-credentials-token.ts +0 -126
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/create-authorization-url.ts +0 -89
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/index.ts +0 -33
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/oauth-provider.ts +0 -222
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/refresh-access-token.ts +0 -157
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/utils.ts +0 -51
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/validate-authorization-code.ts +0 -180
- package/template/apps/web/node_modules/@better-auth/core/src/oauth2/verify.ts +0 -221
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/apple.ts +0 -231
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/atlassian.ts +0 -133
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/cognito.ts +0 -281
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/discord.ts +0 -170
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/dropbox.ts +0 -112
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/facebook.ts +0 -215
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/figma.ts +0 -118
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/github.ts +0 -184
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/gitlab.ts +0 -155
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/google.ts +0 -204
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/huggingface.ts +0 -119
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/index.ts +0 -132
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/kakao.ts +0 -179
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/kick.ts +0 -109
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/line.ts +0 -169
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/linear.ts +0 -121
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/linkedin.ts +0 -110
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/microsoft-entra-id.ts +0 -352
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/naver.ts +0 -113
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/notion.ts +0 -108
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/paybin.ts +0 -118
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/paypal.ts +0 -263
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/polar.ts +0 -111
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/railway.ts +0 -100
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/reddit.ts +0 -122
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/roblox.ts +0 -112
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/salesforce.ts +0 -159
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/slack.ts +0 -112
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/spotify.ts +0 -94
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/tiktok.ts +0 -211
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/twitch.ts +0 -112
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/twitter.ts +0 -199
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/vercel.ts +0 -87
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/vk.ts +0 -125
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/wechat.ts +0 -213
- package/template/apps/web/node_modules/@better-auth/core/src/social-providers/zoom.ts +0 -230
- package/template/apps/web/node_modules/@better-auth/core/src/types/context.ts +0 -415
- package/template/apps/web/node_modules/@better-auth/core/src/types/cookie.ts +0 -10
- package/template/apps/web/node_modules/@better-auth/core/src/types/helper.ts +0 -27
- package/template/apps/web/node_modules/@better-auth/core/src/types/index.ts +0 -40
- package/template/apps/web/node_modules/@better-auth/core/src/types/init-options.ts +0 -1610
- package/template/apps/web/node_modules/@better-auth/core/src/types/plugin-client.ts +0 -129
- package/template/apps/web/node_modules/@better-auth/core/src/types/plugin.ts +0 -163
- package/template/apps/web/node_modules/@better-auth/core/src/types/secret.ts +0 -8
- package/template/apps/web/node_modules/@better-auth/core/src/utils/async.ts +0 -53
- package/template/apps/web/node_modules/@better-auth/core/src/utils/db.ts +0 -20
- package/template/apps/web/node_modules/@better-auth/core/src/utils/deprecate.ts +0 -21
- package/template/apps/web/node_modules/@better-auth/core/src/utils/error-codes.ts +0 -68
- package/template/apps/web/node_modules/@better-auth/core/src/utils/fetch-metadata.ts +0 -3
- package/template/apps/web/node_modules/@better-auth/core/src/utils/host.ts +0 -401
- package/template/apps/web/node_modules/@better-auth/core/src/utils/id.ts +0 -5
- package/template/apps/web/node_modules/@better-auth/core/src/utils/ip.ts +0 -211
- package/template/apps/web/node_modules/@better-auth/core/src/utils/is-api-error.ts +0 -10
- package/template/apps/web/node_modules/@better-auth/core/src/utils/json.ts +0 -56
- package/template/apps/web/node_modules/@better-auth/core/src/utils/string.ts +0 -3
- package/template/apps/web/node_modules/@better-auth/core/src/utils/url.ts +0 -43
- package/template/apps/web/node_modules/@better-auth/utils/README.md +0 -384
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.cjs +0 -104
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.cts +0 -44
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.mts +0 -44
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.d.ts +0 -44
- package/template/apps/web/node_modules/@better-auth/utils/dist/base32.mjs +0 -101
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.cjs +0 -80
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.cts +0 -16
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.mts +0 -16
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.d.ts +0 -16
- package/template/apps/web/node_modules/@better-auth/utils/dist/base64.mjs +0 -77
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.cjs +0 -16
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.cts +0 -8
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.mts +0 -8
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.d.ts +0 -8
- package/template/apps/web/node_modules/@better-auth/utils/dist/binary.mjs +0 -14
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.cjs +0 -90
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.cts +0 -19
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.mts +0 -19
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.d.ts +0 -19
- package/template/apps/web/node_modules/@better-auth/utils/dist/ecdsa.mjs +0 -88
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.cjs +0 -31
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.cts +0 -7
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.mts +0 -7
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.d.ts +0 -7
- package/template/apps/web/node_modules/@better-auth/utils/dist/hash.mjs +0 -29
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.cjs +0 -40
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.cts +0 -8
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.mts +0 -8
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.d.ts +0 -8
- package/template/apps/web/node_modules/@better-auth/utils/dist/hex.mjs +0 -38
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.cjs +0 -58
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.cts +0 -9
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.mts +0 -9
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.d.ts +0 -9
- package/template/apps/web/node_modules/@better-auth/utils/dist/hmac.mjs +0 -56
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.cjs +0 -10
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.cts +0 -3
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.mts +0 -3
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.d.ts +0 -3
- package/template/apps/web/node_modules/@better-auth/utils/dist/index.mjs +0 -8
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.cjs +0 -90
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.cts +0 -13
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.mts +0 -13
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.d.ts +0 -13
- package/template/apps/web/node_modules/@better-auth/utils/dist/otp.mjs +0 -88
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.cjs +0 -36
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.cts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.d.ts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.mjs +0 -33
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.cjs +0 -47
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.cts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.d.ts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/password.node.mjs +0 -44
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.cjs +0 -55
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.cts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.mts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.d.ts +0 -4
- package/template/apps/web/node_modules/@better-auth/utils/dist/random.mjs +0 -53
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.cjs +0 -76
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.cts +0 -16
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.mts +0 -16
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.d.ts +0 -16
- package/template/apps/web/node_modules/@better-auth/utils/dist/rsa.mjs +0 -74
- package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.cts +0 -22
- package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.mts +0 -22
- package/template/apps/web/node_modules/@better-auth/utils/dist/shared/utils.ecd028f7.d.ts +0 -22
- package/template/apps/web/node_modules/@better-auth/utils/package.json +0 -95
- package/template/apps/web/node_modules/better-call/LICENSE +0 -21
- package/template/apps/web/node_modules/better-call/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.cjs +0 -181
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.d.cts +0 -16
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.d.mts +0 -16
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.mjs +0 -178
- package/template/apps/web/node_modules/better-call/dist/adapters/node/request.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/client.cjs +0 -23
- package/template/apps/web/node_modules/better-call/dist/client.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/client.d.cts +0 -53
- package/template/apps/web/node_modules/better-call/dist/client.d.mts +0 -53
- package/template/apps/web/node_modules/better-call/dist/client.mjs +0 -14
- package/template/apps/web/node_modules/better-call/dist/client.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/context.cjs +0 -103
- package/template/apps/web/node_modules/better-call/dist/context.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/context.d.cts +0 -341
- package/template/apps/web/node_modules/better-call/dist/context.d.mts +0 -341
- package/template/apps/web/node_modules/better-call/dist/context.mjs +0 -103
- package/template/apps/web/node_modules/better-call/dist/context.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/cookies.cjs +0 -87
- package/template/apps/web/node_modules/better-call/dist/cookies.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/cookies.d.cts +0 -103
- package/template/apps/web/node_modules/better-call/dist/cookies.d.mts +0 -103
- package/template/apps/web/node_modules/better-call/dist/cookies.mjs +0 -84
- package/template/apps/web/node_modules/better-call/dist/cookies.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/crypto.cjs +0 -39
- package/template/apps/web/node_modules/better-call/dist/crypto.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/crypto.mjs +0 -36
- package/template/apps/web/node_modules/better-call/dist/crypto.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/endpoint.cjs +0 -70
- package/template/apps/web/node_modules/better-call/dist/endpoint.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/endpoint.d.cts +0 -475
- package/template/apps/web/node_modules/better-call/dist/endpoint.d.mts +0 -475
- package/template/apps/web/node_modules/better-call/dist/endpoint.mjs +0 -70
- package/template/apps/web/node_modules/better-call/dist/endpoint.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/error.cjs +0 -141
- package/template/apps/web/node_modules/better-call/dist/error.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/error.d.cts +0 -103
- package/template/apps/web/node_modules/better-call/dist/error.d.mts +0 -103
- package/template/apps/web/node_modules/better-call/dist/error.mjs +0 -133
- package/template/apps/web/node_modules/better-call/dist/error.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/helper.d.cts +0 -12
- package/template/apps/web/node_modules/better-call/dist/helper.d.mts +0 -12
- package/template/apps/web/node_modules/better-call/dist/index.cjs +0 -28
- package/template/apps/web/node_modules/better-call/dist/index.d.cts +0 -11
- package/template/apps/web/node_modules/better-call/dist/index.d.mts +0 -11
- package/template/apps/web/node_modules/better-call/dist/index.mjs +0 -10
- package/template/apps/web/node_modules/better-call/dist/middleware.cjs +0 -52
- package/template/apps/web/node_modules/better-call/dist/middleware.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/middleware.d.cts +0 -123
- package/template/apps/web/node_modules/better-call/dist/middleware.d.mts +0 -123
- package/template/apps/web/node_modules/better-call/dist/middleware.mjs +0 -52
- package/template/apps/web/node_modules/better-call/dist/middleware.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/node.cjs +0 -18
- package/template/apps/web/node_modules/better-call/dist/node.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/node.d.cts +0 -9
- package/template/apps/web/node_modules/better-call/dist/node.d.mts +0 -9
- package/template/apps/web/node_modules/better-call/dist/node.mjs +0 -15
- package/template/apps/web/node_modules/better-call/dist/node.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/openapi.cjs +0 -191
- package/template/apps/web/node_modules/better-call/dist/openapi.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/openapi.d.cts +0 -113
- package/template/apps/web/node_modules/better-call/dist/openapi.d.mts +0 -113
- package/template/apps/web/node_modules/better-call/dist/openapi.mjs +0 -189
- package/template/apps/web/node_modules/better-call/dist/openapi.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/router.cjs +0 -118
- package/template/apps/web/node_modules/better-call/dist/router.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/router.d.cts +0 -103
- package/template/apps/web/node_modules/better-call/dist/router.d.mts +0 -103
- package/template/apps/web/node_modules/better-call/dist/router.mjs +0 -117
- package/template/apps/web/node_modules/better-call/dist/router.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/standard-schema.d.cts +0 -59
- package/template/apps/web/node_modules/better-call/dist/standard-schema.d.mts +0 -59
- package/template/apps/web/node_modules/better-call/dist/to-response.cjs +0 -153
- package/template/apps/web/node_modules/better-call/dist/to-response.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/to-response.d.cts +0 -12
- package/template/apps/web/node_modules/better-call/dist/to-response.d.mts +0 -12
- package/template/apps/web/node_modules/better-call/dist/to-response.mjs +0 -153
- package/template/apps/web/node_modules/better-call/dist/to-response.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/utils.cjs +0 -86
- package/template/apps/web/node_modules/better-call/dist/utils.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/utils.mjs +0 -82
- package/template/apps/web/node_modules/better-call/dist/utils.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/validator.cjs +0 -58
- package/template/apps/web/node_modules/better-call/dist/validator.cjs.map +0 -1
- package/template/apps/web/node_modules/better-call/dist/validator.mjs +0 -57
- package/template/apps/web/node_modules/better-call/dist/validator.mjs.map +0 -1
- package/template/apps/web/node_modules/better-call/package.json +0 -96
- package/template/apps/web/node_modules/set-cookie-parser/LICENSE +0 -21
- package/template/apps/web/node_modules/set-cookie-parser/README.md +0 -169
- package/template/apps/web/node_modules/set-cookie-parser/dist/.eslintrc.cjs +0 -16
- package/template/apps/web/node_modules/set-cookie-parser/dist/set-cookie.cjs +0 -260
- package/template/apps/web/node_modules/set-cookie-parser/lib/set-cookie.d.ts +0 -119
- package/template/apps/web/node_modules/set-cookie-parser/lib/set-cookie.js +0 -265
- package/template/apps/web/node_modules/set-cookie-parser/package.json +0 -61
|
@@ -1,193 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
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>;
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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";
|
|
@@ -1,91 +0,0 @@
|
|
|
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
|
-
}
|