@sirketio/auth 0.0.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/_virtual/_rolldown/runtime.mjs +36 -0
- package/dist/adapter/index.d.mts +4 -0
- package/dist/adapter/index.mjs +7 -0
- package/dist/api/index.d.mts +3872 -0
- package/dist/api/index.mjs +206 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/api/middlewares/index.d.mts +1 -0
- package/dist/api/middlewares/index.mjs +3 -0
- package/dist/api/middlewares/origin-check.d.mts +18 -0
- package/dist/api/middlewares/origin-check.mjs +140 -0
- package/dist/api/middlewares/origin-check.mjs.map +1 -0
- package/dist/api/rate-limiter/index.mjs +204 -0
- package/dist/api/rate-limiter/index.mjs.map +1 -0
- package/dist/api/routes/account.d.mts +410 -0
- package/dist/api/routes/account.mjs +493 -0
- package/dist/api/routes/account.mjs.map +1 -0
- package/dist/api/routes/callback.d.mts +31 -0
- package/dist/api/routes/callback.mjs +179 -0
- package/dist/api/routes/callback.mjs.map +1 -0
- package/dist/api/routes/email-verification.d.mts +161 -0
- package/dist/api/routes/email-verification.mjs +299 -0
- package/dist/api/routes/email-verification.mjs.map +1 -0
- package/dist/api/routes/error.d.mts +28 -0
- package/dist/api/routes/error.mjs +386 -0
- package/dist/api/routes/error.mjs.map +1 -0
- package/dist/api/routes/index.d.mts +11 -0
- package/dist/api/routes/index.mjs +13 -0
- package/dist/api/routes/ok.d.mts +36 -0
- package/dist/api/routes/ok.mjs +30 -0
- package/dist/api/routes/ok.mjs.map +1 -0
- package/dist/api/routes/password.d.mts +182 -0
- package/dist/api/routes/password.mjs +198 -0
- package/dist/api/routes/password.mjs.map +1 -0
- package/dist/api/routes/session.d.mts +415 -0
- package/dist/api/routes/session.mjs +483 -0
- package/dist/api/routes/session.mjs.map +1 -0
- package/dist/api/routes/sign-in.d.mts +171 -0
- package/dist/api/routes/sign-in.mjs +263 -0
- package/dist/api/routes/sign-in.mjs.map +1 -0
- package/dist/api/routes/sign-out.d.mts +36 -0
- package/dist/api/routes/sign-out.mjs +33 -0
- package/dist/api/routes/sign-out.mjs.map +1 -0
- package/dist/api/routes/sign-up.d.mts +160 -0
- package/dist/api/routes/sign-up.mjs +227 -0
- package/dist/api/routes/sign-up.mjs.map +1 -0
- package/dist/api/routes/update-user.d.mts +445 -0
- package/dist/api/routes/update-user.mjs +493 -0
- package/dist/api/routes/update-user.mjs.map +1 -0
- package/dist/api/state/oauth.d.mts +18 -0
- package/dist/api/state/oauth.mjs +8 -0
- package/dist/api/state/oauth.mjs.map +1 -0
- package/dist/api/state/should-session-refresh.d.mts +13 -0
- package/dist/api/state/should-session-refresh.mjs +16 -0
- package/dist/api/state/should-session-refresh.mjs.map +1 -0
- package/dist/api/to-auth-endpoints.mjs +197 -0
- package/dist/api/to-auth-endpoints.mjs.map +1 -0
- package/dist/auth/base.mjs +45 -0
- package/dist/auth/base.mjs.map +1 -0
- package/dist/auth/minimal.d.mts +12 -0
- package/dist/auth/minimal.mjs +14 -0
- package/dist/auth/minimal.mjs.map +1 -0
- package/dist/auth/trusted-origins.mjs +31 -0
- package/dist/auth/trusted-origins.mjs.map +1 -0
- package/dist/client/broadcast-channel.d.mts +20 -0
- package/dist/client/broadcast-channel.mjs +46 -0
- package/dist/client/broadcast-channel.mjs.map +1 -0
- package/dist/client/config.mjs +90 -0
- package/dist/client/config.mjs.map +1 -0
- package/dist/client/fetch-plugins.mjs +18 -0
- package/dist/client/fetch-plugins.mjs.map +1 -0
- package/dist/client/focus-manager.d.mts +11 -0
- package/dist/client/focus-manager.mjs +32 -0
- package/dist/client/focus-manager.mjs.map +1 -0
- package/dist/client/index.d.mts +33 -0
- package/dist/client/index.mjs +21 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/client/online-manager.d.mts +12 -0
- package/dist/client/online-manager.mjs +35 -0
- package/dist/client/online-manager.mjs.map +1 -0
- package/dist/client/parser.mjs +73 -0
- package/dist/client/parser.mjs.map +1 -0
- package/dist/client/path-to-object.d.mts +65 -0
- package/dist/client/plugins/index.d.mts +53 -0
- package/dist/client/plugins/index.mjs +30 -0
- package/dist/client/plugins/infer-plugin.d.mts +16 -0
- package/dist/client/plugins/infer-plugin.mjs +11 -0
- package/dist/client/plugins/infer-plugin.mjs.map +1 -0
- package/dist/client/proxy.mjs +79 -0
- package/dist/client/proxy.mjs.map +1 -0
- package/dist/client/query.d.mts +23 -0
- package/dist/client/query.mjs +98 -0
- package/dist/client/query.mjs.map +1 -0
- package/dist/client/react/index.d.mts +128 -0
- package/dist/client/react/index.mjs +24 -0
- package/dist/client/react/index.mjs.map +1 -0
- package/dist/client/react/react-store.d.mts +47 -0
- package/dist/client/react/react-store.mjs +47 -0
- package/dist/client/react/react-store.mjs.map +1 -0
- package/dist/client/session-atom.mjs +29 -0
- package/dist/client/session-atom.mjs.map +1 -0
- package/dist/client/session-refresh.d.mts +28 -0
- package/dist/client/session-refresh.mjs +140 -0
- package/dist/client/session-refresh.mjs.map +1 -0
- package/dist/client/types.d.mts +41 -0
- package/dist/client/vanilla.d.mts +127 -0
- package/dist/client/vanilla.mjs +20 -0
- package/dist/client/vanilla.mjs.map +1 -0
- package/dist/context/create-context.mjs +211 -0
- package/dist/context/create-context.mjs.map +1 -0
- package/dist/context/helpers.mjs +83 -0
- package/dist/context/helpers.mjs.map +1 -0
- package/dist/context/init.mjs +20 -0
- package/dist/context/init.mjs.map +1 -0
- package/dist/cookies/cookie-utils.d.mts +29 -0
- package/dist/cookies/cookie-utils.mjs +105 -0
- package/dist/cookies/cookie-utils.mjs.map +1 -0
- package/dist/cookies/index.d.mts +121 -0
- package/dist/cookies/index.mjs +261 -0
- package/dist/cookies/index.mjs.map +1 -0
- package/dist/cookies/session-store.d.mts +36 -0
- package/dist/cookies/session-store.mjs +200 -0
- package/dist/cookies/session-store.mjs.map +1 -0
- package/dist/crypto/buffer.d.mts +8 -0
- package/dist/crypto/buffer.mjs +18 -0
- package/dist/crypto/buffer.mjs.map +1 -0
- package/dist/crypto/index.d.mts +27 -0
- package/dist/crypto/index.mjs +38 -0
- package/dist/crypto/index.mjs.map +1 -0
- package/dist/crypto/jwt.d.mts +8 -0
- package/dist/crypto/jwt.mjs +95 -0
- package/dist/crypto/jwt.mjs.map +1 -0
- package/dist/crypto/password.d.mts +12 -0
- package/dist/crypto/password.mjs +36 -0
- package/dist/crypto/password.mjs.map +1 -0
- package/dist/crypto/random.d.mts +5 -0
- package/dist/crypto/random.mjs +8 -0
- package/dist/crypto/random.mjs.map +1 -0
- package/dist/db/adapter-base.d.mts +8 -0
- package/dist/db/adapter-base.mjs +19 -0
- package/dist/db/adapter-base.mjs.map +1 -0
- package/dist/db/field-converter.d.mts +8 -0
- package/dist/db/field-converter.mjs +21 -0
- package/dist/db/field-converter.mjs.map +1 -0
- package/dist/db/field.d.mts +42 -0
- package/dist/db/get-schema.d.mts +11 -0
- package/dist/db/get-schema.mjs +39 -0
- package/dist/db/get-schema.mjs.map +1 -0
- package/dist/db/index.d.mts +18 -0
- package/dist/db/index.mjs +34 -0
- package/dist/db/index.mjs.map +1 -0
- package/dist/db/internal-adapter.d.mts +14 -0
- package/dist/db/internal-adapter.mjs +616 -0
- package/dist/db/internal-adapter.mjs.map +1 -0
- package/dist/db/schema.d.mts +49 -0
- package/dist/db/schema.mjs +118 -0
- package/dist/db/schema.mjs.map +1 -0
- package/dist/db/to-zod.d.mts +36 -0
- package/dist/db/to-zod.mjs +26 -0
- package/dist/db/to-zod.mjs.map +1 -0
- package/dist/db/verification-token-storage.mjs +28 -0
- package/dist/db/verification-token-storage.mjs.map +1 -0
- package/dist/db/with-hooks.d.mts +33 -0
- package/dist/db/with-hooks.mjs +159 -0
- package/dist/db/with-hooks.mjs.map +1 -0
- package/dist/index.d.mts +53 -0
- package/dist/index.mjs +27 -0
- package/dist/integrations/next-js.d.mts +29 -0
- package/dist/integrations/next-js.mjs +85 -0
- package/dist/integrations/next-js.mjs.map +1 -0
- package/dist/oauth2/index.d.mts +5 -0
- package/dist/oauth2/index.mjs +7 -0
- package/dist/oauth2/link-account.d.mts +48 -0
- package/dist/oauth2/link-account.mjs +143 -0
- package/dist/oauth2/link-account.mjs.map +1 -0
- package/dist/oauth2/state.d.mts +26 -0
- package/dist/oauth2/state.mjs +51 -0
- package/dist/oauth2/state.mjs.map +1 -0
- package/dist/oauth2/utils.d.mts +8 -0
- package/dist/oauth2/utils.mjs +31 -0
- package/dist/oauth2/utils.mjs.map +1 -0
- package/dist/plugins/access/access.d.mts +30 -0
- package/dist/plugins/access/access.mjs +46 -0
- package/dist/plugins/access/access.mjs.map +1 -0
- package/dist/plugins/access/index.d.mts +3 -0
- package/dist/plugins/access/index.mjs +3 -0
- package/dist/plugins/access/types.d.mts +17 -0
- package/dist/plugins/additional-fields/client.d.mts +96 -0
- package/dist/plugins/additional-fields/client.mjs +11 -0
- package/dist/plugins/additional-fields/client.mjs.map +1 -0
- package/dist/plugins/admin/access/index.d.mts +2 -0
- package/dist/plugins/admin/access/index.mjs +3 -0
- package/dist/plugins/admin/access/statement.d.mts +118 -0
- package/dist/plugins/admin/access/statement.mjs +53 -0
- package/dist/plugins/admin/access/statement.mjs.map +1 -0
- package/dist/plugins/admin/admin.d.mts +911 -0
- package/dist/plugins/admin/admin.mjs +95 -0
- package/dist/plugins/admin/admin.mjs.map +1 -0
- package/dist/plugins/admin/client.d.mts +76 -0
- package/dist/plugins/admin/client.mjs +36 -0
- package/dist/plugins/admin/client.mjs.map +1 -0
- package/dist/plugins/admin/error-codes.d.mts +29 -0
- package/dist/plugins/admin/error-codes.mjs +30 -0
- package/dist/plugins/admin/error-codes.mjs.map +1 -0
- package/dist/plugins/admin/has-permission.mjs +16 -0
- package/dist/plugins/admin/has-permission.mjs.map +1 -0
- package/dist/plugins/admin/index.d.mts +3 -0
- package/dist/plugins/admin/index.mjs +3 -0
- package/dist/plugins/admin/routes.mjs +841 -0
- package/dist/plugins/admin/routes.mjs.map +1 -0
- package/dist/plugins/admin/schema.d.mts +40 -0
- package/dist/plugins/admin/schema.mjs +34 -0
- package/dist/plugins/admin/schema.mjs.map +1 -0
- package/dist/plugins/admin/types.d.mts +89 -0
- package/dist/plugins/api-key/adapter.mjs +468 -0
- package/dist/plugins/api-key/adapter.mjs.map +1 -0
- package/dist/plugins/api-key/client.d.mts +46 -0
- package/dist/plugins/api-key/client.mjs +19 -0
- package/dist/plugins/api-key/client.mjs.map +1 -0
- package/dist/plugins/api-key/error-codes.d.mts +33 -0
- package/dist/plugins/api-key/error-codes.mjs +34 -0
- package/dist/plugins/api-key/error-codes.mjs.map +1 -0
- package/dist/plugins/api-key/index.d.mts +1251 -0
- package/dist/plugins/api-key/index.mjs +134 -0
- package/dist/plugins/api-key/index.mjs.map +1 -0
- package/dist/plugins/api-key/rate-limit.mjs +74 -0
- package/dist/plugins/api-key/rate-limit.mjs.map +1 -0
- package/dist/plugins/api-key/routes/create-api-key.mjs +252 -0
- package/dist/plugins/api-key/routes/create-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs +24 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs.map +1 -0
- package/dist/plugins/api-key/routes/delete-api-key.mjs +74 -0
- package/dist/plugins/api-key/routes/delete-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/get-api-key.mjs +158 -0
- package/dist/plugins/api-key/routes/get-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/index.mjs +71 -0
- package/dist/plugins/api-key/routes/index.mjs.map +1 -0
- package/dist/plugins/api-key/routes/list-api-keys.mjs +194 -0
- package/dist/plugins/api-key/routes/list-api-keys.mjs.map +1 -0
- package/dist/plugins/api-key/routes/update-api-key.mjs +248 -0
- package/dist/plugins/api-key/routes/update-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/verify-api-key.mjs +224 -0
- package/dist/plugins/api-key/routes/verify-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/schema.d.mts +199 -0
- package/dist/plugins/api-key/schema.mjs +130 -0
- package/dist/plugins/api-key/schema.mjs.map +1 -0
- package/dist/plugins/api-key/types.d.mts +346 -0
- package/dist/plugins/bearer/index.d.mts +45 -0
- package/dist/plugins/bearer/index.mjs +66 -0
- package/dist/plugins/bearer/index.mjs.map +1 -0
- package/dist/plugins/captcha/constants.d.mts +10 -0
- package/dist/plugins/captcha/constants.mjs +22 -0
- package/dist/plugins/captcha/constants.mjs.map +1 -0
- package/dist/plugins/captcha/error-codes.mjs +16 -0
- package/dist/plugins/captcha/error-codes.mjs.map +1 -0
- package/dist/plugins/captcha/index.d.mts +21 -0
- package/dist/plugins/captcha/index.mjs +62 -0
- package/dist/plugins/captcha/index.mjs.map +1 -0
- package/dist/plugins/captcha/types.d.mts +28 -0
- package/dist/plugins/captcha/utils.mjs +11 -0
- package/dist/plugins/captcha/utils.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +28 -0
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +26 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +30 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +28 -0
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/index.mjs +6 -0
- package/dist/plugins/custom-session/client.d.mts +17 -0
- package/dist/plugins/custom-session/client.mjs +11 -0
- package/dist/plugins/custom-session/client.mjs.map +1 -0
- package/dist/plugins/custom-session/index.d.mts +72 -0
- package/dist/plugins/custom-session/index.mjs +78 -0
- package/dist/plugins/custom-session/index.mjs.map +1 -0
- package/dist/plugins/device-authorization/client.d.mts +17 -0
- package/dist/plugins/device-authorization/client.mjs +18 -0
- package/dist/plugins/device-authorization/client.mjs.map +1 -0
- package/dist/plugins/device-authorization/error-codes.mjs +21 -0
- package/dist/plugins/device-authorization/error-codes.mjs.map +1 -0
- package/dist/plugins/device-authorization/index.d.mts +424 -0
- package/dist/plugins/device-authorization/index.mjs +50 -0
- package/dist/plugins/device-authorization/index.mjs.map +1 -0
- package/dist/plugins/device-authorization/routes.mjs +510 -0
- package/dist/plugins/device-authorization/routes.mjs.map +1 -0
- package/dist/plugins/device-authorization/schema.mjs +57 -0
- package/dist/plugins/device-authorization/schema.mjs.map +1 -0
- package/dist/plugins/email-otp/client.d.mts +21 -0
- package/dist/plugins/email-otp/client.mjs +18 -0
- package/dist/plugins/email-otp/client.mjs.map +1 -0
- package/dist/plugins/email-otp/error-codes.d.mts +11 -0
- package/dist/plugins/email-otp/error-codes.mjs +12 -0
- package/dist/plugins/email-otp/error-codes.mjs.map +1 -0
- package/dist/plugins/email-otp/index.d.mts +428 -0
- package/dist/plugins/email-otp/index.mjs +130 -0
- package/dist/plugins/email-otp/index.mjs.map +1 -0
- package/dist/plugins/email-otp/otp-token.mjs +29 -0
- package/dist/plugins/email-otp/otp-token.mjs.map +1 -0
- package/dist/plugins/email-otp/routes.mjs +631 -0
- package/dist/plugins/email-otp/routes.mjs.map +1 -0
- package/dist/plugins/email-otp/types.d.mts +86 -0
- package/dist/plugins/email-otp/utils.mjs +17 -0
- package/dist/plugins/email-otp/utils.mjs.map +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +33 -0
- package/dist/plugins/generic-oauth/client.mjs +14 -0
- package/dist/plugins/generic-oauth/client.mjs.map +1 -0
- package/dist/plugins/generic-oauth/error-codes.d.mts +16 -0
- package/dist/plugins/generic-oauth/error-codes.mjs +17 -0
- package/dist/plugins/generic-oauth/error-codes.mjs.map +1 -0
- package/dist/plugins/generic-oauth/index.d.mts +201 -0
- package/dist/plugins/generic-oauth/index.mjs +145 -0
- package/dist/plugins/generic-oauth/index.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/auth0.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/auth0.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +32 -0
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +60 -0
- package/dist/plugins/generic-oauth/providers/gumroad.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +60 -0
- package/dist/plugins/generic-oauth/providers/hubspot.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +9 -0
- package/dist/plugins/generic-oauth/providers/index.mjs +11 -0
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/keycloak.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/keycloak.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +55 -0
- package/dist/plugins/generic-oauth/providers/line.mjs +91 -0
- package/dist/plugins/generic-oauth/providers/line.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +66 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/okta.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/okta.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +30 -0
- package/dist/plugins/generic-oauth/providers/patreon.mjs +59 -0
- package/dist/plugins/generic-oauth/providers/patreon.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +30 -0
- package/dist/plugins/generic-oauth/providers/slack.mjs +61 -0
- package/dist/plugins/generic-oauth/providers/slack.mjs.map +1 -0
- package/dist/plugins/generic-oauth/routes.mjs +411 -0
- package/dist/plugins/generic-oauth/routes.mjs.map +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +159 -0
- package/dist/plugins/haveibeenpwned/index.d.mts +46 -0
- package/dist/plugins/haveibeenpwned/index.mjs +57 -0
- package/dist/plugins/haveibeenpwned/index.mjs.map +1 -0
- package/dist/plugins/index.d.mts +65 -0
- package/dist/plugins/index.mjs +48 -0
- package/dist/plugins/jwt/adapter.mjs +27 -0
- package/dist/plugins/jwt/adapter.mjs.map +1 -0
- package/dist/plugins/jwt/client.d.mts +40 -0
- package/dist/plugins/jwt/client.mjs +19 -0
- package/dist/plugins/jwt/client.mjs.map +1 -0
- package/dist/plugins/jwt/index.d.mts +224 -0
- package/dist/plugins/jwt/index.mjs +202 -0
- package/dist/plugins/jwt/index.mjs.map +1 -0
- package/dist/plugins/jwt/schema.d.mts +26 -0
- package/dist/plugins/jwt/schema.mjs +23 -0
- package/dist/plugins/jwt/schema.mjs.map +1 -0
- package/dist/plugins/jwt/sign.d.mts +57 -0
- package/dist/plugins/jwt/sign.mjs +66 -0
- package/dist/plugins/jwt/sign.mjs.map +1 -0
- package/dist/plugins/jwt/types.d.mts +194 -0
- package/dist/plugins/jwt/utils.d.mts +42 -0
- package/dist/plugins/jwt/utils.mjs +64 -0
- package/dist/plugins/jwt/utils.mjs.map +1 -0
- package/dist/plugins/jwt/verify.d.mts +12 -0
- package/dist/plugins/jwt/verify.mjs +46 -0
- package/dist/plugins/jwt/verify.mjs.map +1 -0
- package/dist/plugins/last-login-method/client.d.mts +38 -0
- package/dist/plugins/last-login-method/client.mjs +32 -0
- package/dist/plugins/last-login-method/client.mjs.map +1 -0
- package/dist/plugins/last-login-method/index.d.mts +118 -0
- package/dist/plugins/last-login-method/index.mjs +76 -0
- package/dist/plugins/last-login-method/index.mjs.map +1 -0
- package/dist/plugins/magic-link/client.d.mts +10 -0
- package/dist/plugins/magic-link/client.mjs +11 -0
- package/dist/plugins/magic-link/client.mjs.map +1 -0
- package/dist/plugins/magic-link/index.d.mts +193 -0
- package/dist/plugins/magic-link/index.mjs +177 -0
- package/dist/plugins/magic-link/index.mjs.map +1 -0
- package/dist/plugins/magic-link/utils.mjs +12 -0
- package/dist/plugins/magic-link/utils.mjs.map +1 -0
- package/dist/plugins/mcp/authorize.mjs +133 -0
- package/dist/plugins/mcp/authorize.mjs.map +1 -0
- package/dist/plugins/mcp/index.d.mts +458 -0
- package/dist/plugins/mcp/index.mjs +717 -0
- package/dist/plugins/mcp/index.mjs.map +1 -0
- package/dist/plugins/multi-session/client.d.mts +19 -0
- package/dist/plugins/multi-session/client.mjs +20 -0
- package/dist/plugins/multi-session/client.mjs.map +1 -0
- package/dist/plugins/multi-session/error-codes.d.mts +9 -0
- package/dist/plugins/multi-session/error-codes.mjs +8 -0
- package/dist/plugins/multi-session/error-codes.mjs.map +1 -0
- package/dist/plugins/multi-session/index.d.mts +235 -0
- package/dist/plugins/multi-session/index.mjs +172 -0
- package/dist/plugins/multi-session/index.mjs.map +1 -0
- package/dist/plugins/oauth-proxy/index.d.mts +97 -0
- package/dist/plugins/oauth-proxy/index.mjs +305 -0
- package/dist/plugins/oauth-proxy/index.mjs.map +1 -0
- package/dist/plugins/oauth-proxy/utils.mjs +51 -0
- package/dist/plugins/oauth-proxy/utils.mjs.map +1 -0
- package/dist/plugins/oidc-provider/authorize.mjs +194 -0
- package/dist/plugins/oidc-provider/authorize.mjs.map +1 -0
- package/dist/plugins/oidc-provider/client.d.mts +12 -0
- package/dist/plugins/oidc-provider/client.mjs +11 -0
- package/dist/plugins/oidc-provider/client.mjs.map +1 -0
- package/dist/plugins/oidc-provider/error.mjs +17 -0
- package/dist/plugins/oidc-provider/error.mjs.map +1 -0
- package/dist/plugins/oidc-provider/index.d.mts +702 -0
- package/dist/plugins/oidc-provider/index.mjs +1093 -0
- package/dist/plugins/oidc-provider/index.mjs.map +1 -0
- package/dist/plugins/oidc-provider/schema.d.mts +160 -0
- package/dist/plugins/oidc-provider/schema.mjs +132 -0
- package/dist/plugins/oidc-provider/schema.mjs.map +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +517 -0
- package/dist/plugins/oidc-provider/utils/prompt.mjs +19 -0
- package/dist/plugins/oidc-provider/utils/prompt.mjs.map +1 -0
- package/dist/plugins/oidc-provider/utils.mjs +15 -0
- package/dist/plugins/oidc-provider/utils.mjs.map +1 -0
- package/dist/plugins/one-tap/client.d.mts +174 -0
- package/dist/plugins/one-tap/client.mjs +188 -0
- package/dist/plugins/one-tap/client.mjs.map +1 -0
- package/dist/plugins/one-tap/index.d.mts +83 -0
- package/dist/plugins/one-tap/index.mjs +95 -0
- package/dist/plugins/one-tap/index.mjs.map +1 -0
- package/dist/plugins/one-time-token/client.d.mts +10 -0
- package/dist/plugins/one-time-token/client.mjs +11 -0
- package/dist/plugins/one-time-token/client.mjs.map +1 -0
- package/dist/plugins/one-time-token/index.d.mts +133 -0
- package/dist/plugins/one-time-token/index.mjs +82 -0
- package/dist/plugins/one-time-token/index.mjs.map +1 -0
- package/dist/plugins/one-time-token/utils.mjs +12 -0
- package/dist/plugins/one-time-token/utils.mjs.map +1 -0
- package/dist/plugins/open-api/generator.d.mts +115 -0
- package/dist/plugins/open-api/generator.mjs +315 -0
- package/dist/plugins/open-api/generator.mjs.map +1 -0
- package/dist/plugins/open-api/index.d.mts +97 -0
- package/dist/plugins/open-api/index.mjs +67 -0
- package/dist/plugins/open-api/index.mjs.map +1 -0
- package/dist/plugins/open-api/logo.mjs +15 -0
- package/dist/plugins/open-api/logo.mjs.map +1 -0
- package/dist/plugins/organization/access/index.d.mts +2 -0
- package/dist/plugins/organization/access/index.mjs +3 -0
- package/dist/plugins/organization/access/statement.d.mts +249 -0
- package/dist/plugins/organization/access/statement.mjs +81 -0
- package/dist/plugins/organization/access/statement.mjs.map +1 -0
- package/dist/plugins/organization/adapter.d.mts +792 -0
- package/dist/plugins/organization/adapter.mjs +624 -0
- package/dist/plugins/organization/adapter.mjs.map +1 -0
- package/dist/plugins/organization/call.mjs +19 -0
- package/dist/plugins/organization/call.mjs.map +1 -0
- package/dist/plugins/organization/client.d.mts +372 -0
- package/dist/plugins/organization/client.mjs +95 -0
- package/dist/plugins/organization/client.mjs.map +1 -0
- package/dist/plugins/organization/error-codes.d.mts +65 -0
- package/dist/plugins/organization/error-codes.mjs +66 -0
- package/dist/plugins/organization/error-codes.mjs.map +1 -0
- package/dist/plugins/organization/has-permission.mjs +35 -0
- package/dist/plugins/organization/has-permission.mjs.map +1 -0
- package/dist/plugins/organization/index.d.mts +5 -0
- package/dist/plugins/organization/index.mjs +4 -0
- package/dist/plugins/organization/organization.d.mts +394 -0
- package/dist/plugins/organization/organization.mjs +428 -0
- package/dist/plugins/organization/organization.mjs.map +1 -0
- package/dist/plugins/organization/permission.d.mts +17 -0
- package/dist/plugins/organization/permission.mjs +16 -0
- package/dist/plugins/organization/permission.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-access-control.d.mts +394 -0
- package/dist/plugins/organization/routes/crud-access-control.mjs +678 -0
- package/dist/plugins/organization/routes/crud-access-control.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-invites.d.mts +1031 -0
- package/dist/plugins/organization/routes/crud-invites.mjs +551 -0
- package/dist/plugins/organization/routes/crud-invites.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-members.d.mts +940 -0
- package/dist/plugins/organization/routes/crud-members.mjs +466 -0
- package/dist/plugins/organization/routes/crud-members.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-org.d.mts +708 -0
- package/dist/plugins/organization/routes/crud-org.mjs +423 -0
- package/dist/plugins/organization/routes/crud-org.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-team.d.mts +1071 -0
- package/dist/plugins/organization/routes/crud-team.mjs +676 -0
- package/dist/plugins/organization/routes/crud-team.mjs.map +1 -0
- package/dist/plugins/organization/schema.d.mts +376 -0
- package/dist/plugins/organization/schema.mjs +68 -0
- package/dist/plugins/organization/schema.mjs.map +1 -0
- package/dist/plugins/organization/types.d.mts +677 -0
- package/dist/plugins/phone-number/client.d.mts +31 -0
- package/dist/plugins/phone-number/client.mjs +20 -0
- package/dist/plugins/phone-number/client.mjs.map +1 -0
- package/dist/plugins/phone-number/error-codes.d.mts +20 -0
- package/dist/plugins/phone-number/error-codes.mjs +21 -0
- package/dist/plugins/phone-number/error-codes.mjs.map +1 -0
- package/dist/plugins/phone-number/index.d.mts +318 -0
- package/dist/plugins/phone-number/index.mjs +49 -0
- package/dist/plugins/phone-number/index.mjs.map +1 -0
- package/dist/plugins/phone-number/routes.mjs +472 -0
- package/dist/plugins/phone-number/routes.mjs.map +1 -0
- package/dist/plugins/phone-number/schema.d.mts +23 -0
- package/dist/plugins/phone-number/schema.mjs +20 -0
- package/dist/plugins/phone-number/schema.mjs.map +1 -0
- package/dist/plugins/phone-number/types.d.mts +118 -0
- package/dist/plugins/two-factor/backup-codes/index.d.mts +279 -0
- package/dist/plugins/two-factor/backup-codes/index.mjs +277 -0
- package/dist/plugins/two-factor/backup-codes/index.mjs.map +1 -0
- package/dist/plugins/two-factor/client.d.mts +55 -0
- package/dist/plugins/two-factor/client.mjs +37 -0
- package/dist/plugins/two-factor/client.mjs.map +1 -0
- package/dist/plugins/two-factor/constant.mjs +8 -0
- package/dist/plugins/two-factor/constant.mjs.map +1 -0
- package/dist/plugins/two-factor/error-code.d.mts +17 -0
- package/dist/plugins/two-factor/error-code.mjs +18 -0
- package/dist/plugins/two-factor/error-code.mjs.map +1 -0
- package/dist/plugins/two-factor/index.d.mts +670 -0
- package/dist/plugins/two-factor/index.mjs +228 -0
- package/dist/plugins/two-factor/index.mjs.map +1 -0
- package/dist/plugins/two-factor/otp/index.d.mts +216 -0
- package/dist/plugins/two-factor/otp/index.mjs +199 -0
- package/dist/plugins/two-factor/otp/index.mjs.map +1 -0
- package/dist/plugins/two-factor/schema.d.mts +41 -0
- package/dist/plugins/two-factor/schema.mjs +36 -0
- package/dist/plugins/two-factor/schema.mjs.map +1 -0
- package/dist/plugins/two-factor/totp/index.d.mts +210 -0
- package/dist/plugins/two-factor/totp/index.mjs +157 -0
- package/dist/plugins/two-factor/totp/index.mjs.map +1 -0
- package/dist/plugins/two-factor/types.d.mts +73 -0
- package/dist/plugins/two-factor/utils.mjs +12 -0
- package/dist/plugins/two-factor/utils.mjs.map +1 -0
- package/dist/plugins/two-factor/verify-two-factor.mjs +85 -0
- package/dist/plugins/two-factor/verify-two-factor.mjs.map +1 -0
- package/dist/plugins/username/client.d.mts +26 -0
- package/dist/plugins/username/client.mjs +18 -0
- package/dist/plugins/username/client.mjs.map +1 -0
- package/dist/plugins/username/error-codes.d.mts +16 -0
- package/dist/plugins/username/error-codes.mjs +17 -0
- package/dist/plugins/username/error-codes.mjs.map +1 -0
- package/dist/plugins/username/index.d.mts +251 -0
- package/dist/plugins/username/index.mjs +234 -0
- package/dist/plugins/username/index.mjs.map +1 -0
- package/dist/plugins/username/schema.d.mts +33 -0
- package/dist/plugins/username/schema.mjs +26 -0
- package/dist/plugins/username/schema.mjs.map +1 -0
- package/dist/providers/index.d.mts +1 -0
- package/dist/providers/index.mjs +3 -0
- package/dist/state.d.mts +42 -0
- package/dist/state.mjs +107 -0
- package/dist/state.mjs.map +1 -0
- package/dist/types/adapter.d.mts +2 -0
- package/dist/types/api.d.mts +29 -0
- package/dist/types/auth.d.mts +29 -0
- package/dist/types/helper.d.mts +10 -0
- package/dist/types/index.d.mts +11 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/models.d.mts +11 -0
- package/dist/types/plugins.d.mts +20 -0
- package/dist/utils/boolean.mjs +8 -0
- package/dist/utils/boolean.mjs.map +1 -0
- package/dist/utils/constants.mjs +6 -0
- package/dist/utils/constants.mjs.map +1 -0
- package/dist/utils/date.mjs +8 -0
- package/dist/utils/date.mjs.map +1 -0
- package/dist/utils/get-request-ip.d.mts +7 -0
- package/dist/utils/get-request-ip.mjs +23 -0
- package/dist/utils/get-request-ip.mjs.map +1 -0
- package/dist/utils/hide-metadata.d.mts +7 -0
- package/dist/utils/hide-metadata.mjs +6 -0
- package/dist/utils/hide-metadata.mjs.map +1 -0
- package/dist/utils/index.d.mts +4 -0
- package/dist/utils/index.mjs +6 -0
- package/dist/utils/is-api-error.d.mts +7 -0
- package/dist/utils/is-api-error.mjs +11 -0
- package/dist/utils/is-api-error.mjs.map +1 -0
- package/dist/utils/is-atom.mjs +8 -0
- package/dist/utils/is-atom.mjs.map +1 -0
- package/dist/utils/is-promise.mjs +8 -0
- package/dist/utils/is-promise.mjs.map +1 -0
- package/dist/utils/middleware-response.mjs +9 -0
- package/dist/utils/middleware-response.mjs.map +1 -0
- package/dist/utils/password.mjs +26 -0
- package/dist/utils/password.mjs.map +1 -0
- package/dist/utils/plugin-helper.mjs +17 -0
- package/dist/utils/plugin-helper.mjs.map +1 -0
- package/dist/utils/shim.mjs +24 -0
- package/dist/utils/shim.mjs.map +1 -0
- package/dist/utils/time.d.mts +49 -0
- package/dist/utils/time.mjs +100 -0
- package/dist/utils/time.mjs.map +1 -0
- package/dist/utils/url.d.mts +8 -0
- package/dist/utils/url.mjs +92 -0
- package/dist/utils/url.mjs.map +1 -0
- package/dist/utils/wildcard.mjs +108 -0
- package/dist/utils/wildcard.mjs.map +1 -0
- package/package.json +428 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as _better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/organization/error-codes.d.ts
|
|
4
|
+
declare const ORGANIZATION_ERROR_CODES: {
|
|
5
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION">;
|
|
6
|
+
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: _better_auth_core_utils_error_codes0.RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS">;
|
|
7
|
+
ORGANIZATION_ALREADY_EXISTS: _better_auth_core_utils_error_codes0.RawError<"ORGANIZATION_ALREADY_EXISTS">;
|
|
8
|
+
ORGANIZATION_SLUG_ALREADY_TAKEN: _better_auth_core_utils_error_codes0.RawError<"ORGANIZATION_SLUG_ALREADY_TAKEN">;
|
|
9
|
+
ORGANIZATION_NOT_FOUND: _better_auth_core_utils_error_codes0.RawError<"ORGANIZATION_NOT_FOUND">;
|
|
10
|
+
USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION">;
|
|
11
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION">;
|
|
12
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION">;
|
|
13
|
+
NO_ACTIVE_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"NO_ACTIVE_ORGANIZATION">;
|
|
14
|
+
USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION">;
|
|
15
|
+
MEMBER_NOT_FOUND: _better_auth_core_utils_error_codes0.RawError<"MEMBER_NOT_FOUND">;
|
|
16
|
+
ROLE_NOT_FOUND: _better_auth_core_utils_error_codes0.RawError<"ROLE_NOT_FOUND">;
|
|
17
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM">;
|
|
18
|
+
TEAM_ALREADY_EXISTS: _better_auth_core_utils_error_codes0.RawError<"TEAM_ALREADY_EXISTS">;
|
|
19
|
+
TEAM_NOT_FOUND: _better_auth_core_utils_error_codes0.RawError<"TEAM_NOT_FOUND">;
|
|
20
|
+
YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER: _better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER">;
|
|
21
|
+
YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER: _better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER">;
|
|
22
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER">;
|
|
23
|
+
YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION">;
|
|
24
|
+
USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION">;
|
|
25
|
+
INVITATION_NOT_FOUND: _better_auth_core_utils_error_codes0.RawError<"INVITATION_NOT_FOUND">;
|
|
26
|
+
YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION">;
|
|
27
|
+
EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: _better_auth_core_utils_error_codes0.RawError<"EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION">;
|
|
28
|
+
YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION">;
|
|
29
|
+
INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION">;
|
|
30
|
+
YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE">;
|
|
31
|
+
FAILED_TO_RETRIEVE_INVITATION: _better_auth_core_utils_error_codes0.RawError<"FAILED_TO_RETRIEVE_INVITATION">;
|
|
32
|
+
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS: _better_auth_core_utils_error_codes0.RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS">;
|
|
33
|
+
UNABLE_TO_REMOVE_LAST_TEAM: _better_auth_core_utils_error_codes0.RawError<"UNABLE_TO_REMOVE_LAST_TEAM">;
|
|
34
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER">;
|
|
35
|
+
ORGANIZATION_MEMBERSHIP_LIMIT_REACHED: _better_auth_core_utils_error_codes0.RawError<"ORGANIZATION_MEMBERSHIP_LIMIT_REACHED">;
|
|
36
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION">;
|
|
37
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION">;
|
|
38
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM">;
|
|
39
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM">;
|
|
40
|
+
INVITATION_LIMIT_REACHED: _better_auth_core_utils_error_codes0.RawError<"INVITATION_LIMIT_REACHED">;
|
|
41
|
+
TEAM_MEMBER_LIMIT_REACHED: _better_auth_core_utils_error_codes0.RawError<"TEAM_MEMBER_LIMIT_REACHED">;
|
|
42
|
+
USER_IS_NOT_A_MEMBER_OF_THE_TEAM: _better_auth_core_utils_error_codes0.RawError<"USER_IS_NOT_A_MEMBER_OF_THE_TEAM">;
|
|
43
|
+
YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM: _better_auth_core_utils_error_codes0.RawError<"YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM">;
|
|
44
|
+
YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: _better_auth_core_utils_error_codes0.RawError<"YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM">;
|
|
45
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER">;
|
|
46
|
+
YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER">;
|
|
47
|
+
YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION">;
|
|
48
|
+
YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION">;
|
|
49
|
+
MISSING_AC_INSTANCE: _better_auth_core_utils_error_codes0.RawError<"MISSING_AC_INSTANCE">;
|
|
50
|
+
YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE">;
|
|
51
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE">;
|
|
52
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE">;
|
|
53
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE">;
|
|
54
|
+
YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE">;
|
|
55
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE">;
|
|
56
|
+
YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: _better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE">;
|
|
57
|
+
TOO_MANY_ROLES: _better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ROLES">;
|
|
58
|
+
INVALID_RESOURCE: _better_auth_core_utils_error_codes0.RawError<"INVALID_RESOURCE">;
|
|
59
|
+
ROLE_NAME_IS_ALREADY_TAKEN: _better_auth_core_utils_error_codes0.RawError<"ROLE_NAME_IS_ALREADY_TAKEN">;
|
|
60
|
+
CANNOT_DELETE_A_PRE_DEFINED_ROLE: _better_auth_core_utils_error_codes0.RawError<"CANNOT_DELETE_A_PRE_DEFINED_ROLE">;
|
|
61
|
+
ROLE_IS_ASSIGNED_TO_MEMBERS: _better_auth_core_utils_error_codes0.RawError<"ROLE_IS_ASSIGNED_TO_MEMBERS">;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { ORGANIZATION_ERROR_CODES };
|
|
65
|
+
//# sourceMappingURL=error-codes.d.mts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/organization/error-codes.ts
|
|
4
|
+
const ORGANIZATION_ERROR_CODES = defineErrorCodes({
|
|
5
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization",
|
|
6
|
+
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations",
|
|
7
|
+
ORGANIZATION_ALREADY_EXISTS: "Organization already exists",
|
|
8
|
+
ORGANIZATION_SLUG_ALREADY_TAKEN: "Organization slug already taken",
|
|
9
|
+
ORGANIZATION_NOT_FOUND: "Organization not found",
|
|
10
|
+
USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION: "User is not a member of the organization",
|
|
11
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION: "You are not allowed to update this organization",
|
|
12
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION: "You are not allowed to delete this organization",
|
|
13
|
+
NO_ACTIVE_ORGANIZATION: "No active organization",
|
|
14
|
+
USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION: "User is already a member of this organization",
|
|
15
|
+
MEMBER_NOT_FOUND: "Member not found",
|
|
16
|
+
ROLE_NOT_FOUND: "Role not found",
|
|
17
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM: "You are not allowed to create a new team",
|
|
18
|
+
TEAM_ALREADY_EXISTS: "Team already exists",
|
|
19
|
+
TEAM_NOT_FOUND: "Team not found",
|
|
20
|
+
YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER: "You cannot leave the organization as the only owner",
|
|
21
|
+
YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER: "You cannot leave the organization without an owner",
|
|
22
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER: "You are not allowed to delete this member",
|
|
23
|
+
YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION: "You are not allowed to invite users to this organization",
|
|
24
|
+
USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION: "User is already invited to this organization",
|
|
25
|
+
INVITATION_NOT_FOUND: "Invitation not found",
|
|
26
|
+
YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: "You are not the recipient of the invitation",
|
|
27
|
+
EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: "Email verification required before accepting or rejecting invitation",
|
|
28
|
+
YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: "You are not allowed to cancel this invitation",
|
|
29
|
+
INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: "Inviter is no longer a member of the organization",
|
|
30
|
+
YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: "You are not allowed to invite a user with this role",
|
|
31
|
+
FAILED_TO_RETRIEVE_INVITATION: "Failed to retrieve invitation",
|
|
32
|
+
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS: "You have reached the maximum number of teams",
|
|
33
|
+
UNABLE_TO_REMOVE_LAST_TEAM: "Unable to remove last team",
|
|
34
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER: "You are not allowed to update this member",
|
|
35
|
+
ORGANIZATION_MEMBERSHIP_LIMIT_REACHED: "Organization membership limit reached",
|
|
36
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION: "You are not allowed to create teams in this organization",
|
|
37
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION: "You are not allowed to delete teams in this organization",
|
|
38
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: "You are not allowed to update this team",
|
|
39
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM: "You are not allowed to delete this team",
|
|
40
|
+
INVITATION_LIMIT_REACHED: "Invitation limit reached",
|
|
41
|
+
TEAM_MEMBER_LIMIT_REACHED: "Team member limit reached",
|
|
42
|
+
USER_IS_NOT_A_MEMBER_OF_THE_TEAM: "User is not a member of the team",
|
|
43
|
+
YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM: "You are not allowed to list the members of this team",
|
|
44
|
+
YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: "You do not have an active team",
|
|
45
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER: "You are not allowed to create a new member",
|
|
46
|
+
YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER: "You are not allowed to remove a team member",
|
|
47
|
+
YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION: "You are not allowed to access this organization as an owner",
|
|
48
|
+
YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION: "You are not a member of this organization",
|
|
49
|
+
MISSING_AC_INSTANCE: "Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information",
|
|
50
|
+
YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE: "You must be in an organization to create a role",
|
|
51
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: "You are not allowed to create a role",
|
|
52
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: "You are not allowed to update a role",
|
|
53
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: "You are not allowed to delete a role",
|
|
54
|
+
YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: "You are not allowed to read a role",
|
|
55
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: "You are not allowed to list a role",
|
|
56
|
+
YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: "You are not allowed to get a role",
|
|
57
|
+
TOO_MANY_ROLES: "This organization has too many roles",
|
|
58
|
+
INVALID_RESOURCE: "The provided permission includes an invalid resource",
|
|
59
|
+
ROLE_NAME_IS_ALREADY_TAKEN: "That role name is already taken",
|
|
60
|
+
CANNOT_DELETE_A_PRE_DEFINED_ROLE: "Cannot delete a pre-defined role",
|
|
61
|
+
ROLE_IS_ASSIGNED_TO_MEMBERS: "Cannot delete a role that is assigned to members. Please reassign the members to a different role first"
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { ORGANIZATION_ERROR_CODES };
|
|
66
|
+
//# sourceMappingURL=error-codes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-codes.mjs","names":[],"sources":["../../../src/plugins/organization/error-codes.ts"],"sourcesContent":["import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n\nexport const ORGANIZATION_ERROR_CODES = defineErrorCodes({\n\tYOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:\n\t\t\"You are not allowed to create a new organization\",\n\tYOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:\n\t\t\"You have reached the maximum number of organizations\",\n\tORGANIZATION_ALREADY_EXISTS: \"Organization already exists\",\n\tORGANIZATION_SLUG_ALREADY_TAKEN: \"Organization slug already taken\",\n\tORGANIZATION_NOT_FOUND: \"Organization not found\",\n\tUSER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:\n\t\t\"User is not a member of the organization\",\n\tYOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:\n\t\t\"You are not allowed to update this organization\",\n\tYOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:\n\t\t\"You are not allowed to delete this organization\",\n\tNO_ACTIVE_ORGANIZATION: \"No active organization\",\n\tUSER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:\n\t\t\"User is already a member of this organization\",\n\tMEMBER_NOT_FOUND: \"Member not found\",\n\tROLE_NOT_FOUND: \"Role not found\",\n\tYOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:\n\t\t\"You are not allowed to create a new team\",\n\tTEAM_ALREADY_EXISTS: \"Team already exists\",\n\tTEAM_NOT_FOUND: \"Team not found\",\n\tYOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:\n\t\t\"You cannot leave the organization as the only owner\",\n\tYOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER:\n\t\t\"You cannot leave the organization without an owner\",\n\tYOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:\n\t\t\"You are not allowed to delete this member\",\n\tYOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:\n\t\t\"You are not allowed to invite users to this organization\",\n\tUSER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:\n\t\t\"User is already invited to this organization\",\n\tINVITATION_NOT_FOUND: \"Invitation not found\",\n\tYOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:\n\t\t\"You are not the recipient of the invitation\",\n\tEMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION:\n\t\t\"Email verification required before accepting or rejecting invitation\",\n\tYOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:\n\t\t\"You are not allowed to cancel this invitation\",\n\tINVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:\n\t\t\"Inviter is no longer a member of the organization\",\n\tYOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:\n\t\t\"You are not allowed to invite a user with this role\",\n\tFAILED_TO_RETRIEVE_INVITATION: \"Failed to retrieve invitation\",\n\tYOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:\n\t\t\"You have reached the maximum number of teams\",\n\tUNABLE_TO_REMOVE_LAST_TEAM: \"Unable to remove last team\",\n\tYOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:\n\t\t\"You are not allowed to update this member\",\n\tORGANIZATION_MEMBERSHIP_LIMIT_REACHED:\n\t\t\"Organization membership limit reached\",\n\tYOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:\n\t\t\"You are not allowed to create teams in this organization\",\n\tYOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:\n\t\t\"You are not allowed to delete teams in this organization\",\n\tYOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:\n\t\t\"You are not allowed to update this team\",\n\tYOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:\n\t\t\"You are not allowed to delete this team\",\n\tINVITATION_LIMIT_REACHED: \"Invitation limit reached\",\n\tTEAM_MEMBER_LIMIT_REACHED: \"Team member limit reached\",\n\tUSER_IS_NOT_A_MEMBER_OF_THE_TEAM: \"User is not a member of the team\",\n\tYOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM:\n\t\t\"You are not allowed to list the members of this team\",\n\tYOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: \"You do not have an active team\",\n\tYOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER:\n\t\t\"You are not allowed to create a new member\",\n\tYOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER:\n\t\t\"You are not allowed to remove a team member\",\n\tYOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION:\n\t\t\"You are not allowed to access this organization as an owner\",\n\tYOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION:\n\t\t\"You are not a member of this organization\",\n\tMISSING_AC_INSTANCE:\n\t\t\"Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information\",\n\tYOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE:\n\t\t\"You must be in an organization to create a role\",\n\tYOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: \"You are not allowed to create a role\",\n\tYOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: \"You are not allowed to update a role\",\n\tYOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: \"You are not allowed to delete a role\",\n\tYOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: \"You are not allowed to read a role\",\n\tYOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: \"You are not allowed to list a role\",\n\tYOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: \"You are not allowed to get a role\",\n\tTOO_MANY_ROLES: \"This organization has too many roles\",\n\tINVALID_RESOURCE: \"The provided permission includes an invalid resource\",\n\tROLE_NAME_IS_ALREADY_TAKEN: \"That role name is already taken\",\n\tCANNOT_DELETE_A_PRE_DEFINED_ROLE: \"Cannot delete a pre-defined role\",\n\tROLE_IS_ASSIGNED_TO_MEMBERS:\n\t\t\"Cannot delete a role that is assigned to members. Please reassign the members to a different role first\",\n});\n"],"mappings":";;;AAEA,MAAa,2BAA2B,iBAAiB;CACxD,kDACC;CACD,sDACC;CACD,6BAA6B;CAC7B,iCAAiC;CACjC,wBAAwB;CACxB,0CACC;CACD,iDACC;CACD,iDACC;CACD,wBAAwB;CACxB,+CACC;CACD,kBAAkB;CAClB,gBAAgB;CAChB,0CACC;CACD,qBAAqB;CACrB,gBAAgB;CAChB,qDACC;CACD,oDACC;CACD,2CACC;CACD,0DACC;CACD,8CACC;CACD,sBAAsB;CACtB,6CACC;CACD,sEACC;CACD,+CACC;CACD,mDACC;CACD,mDACC;CACD,+BAA+B;CAC/B,8CACC;CACD,4BAA4B;CAC5B,2CACC;CACD,uCACC;CACD,0DACC;CACD,0DACC;CACD,yCACC;CACD,yCACC;CACD,0BAA0B;CAC1B,2BAA2B;CAC3B,kCAAkC;CAClC,6CACC;CACD,gCAAgC;CAChC,iDACC;CACD,6CACC;CACD,iDACC;CACD,2CACC;CACD,qBACC;CACD,iDACC;CACD,sCAAsC;CACtC,sCAAsC;CACtC,sCAAsC;CACtC,oCAAoC;CACpC,oCAAoC;CACpC,mCAAmC;CACnC,gBAAgB;CAChB,kBAAkB;CAClB,4BAA4B;CAC5B,kCAAkC;CAClC,6BACC;CACD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { APIError } from "../../api/index.mjs";
|
|
2
|
+
import { defaultRoles } from "./access/statement.mjs";
|
|
3
|
+
import "./access/index.mjs";
|
|
4
|
+
import { cacheAllRoles, hasPermissionFn } from "./permission.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/plugins/organization/has-permission.ts
|
|
8
|
+
const hasPermission = async (input, ctx) => {
|
|
9
|
+
let acRoles = { ...input.options.roles || defaultRoles };
|
|
10
|
+
if (ctx && input.organizationId && input.options.dynamicAccessControl?.enabled && input.options.ac && !input.useMemoryCache) {
|
|
11
|
+
const roles = await ctx.context.adapter.findMany({
|
|
12
|
+
model: "organizationRole",
|
|
13
|
+
where: [{
|
|
14
|
+
field: "organizationId",
|
|
15
|
+
value: input.organizationId
|
|
16
|
+
}]
|
|
17
|
+
});
|
|
18
|
+
for (const { role, permission: permissionsString } of roles) {
|
|
19
|
+
if (role in acRoles) continue;
|
|
20
|
+
const result = z.record(z.string(), z.array(z.string())).safeParse(JSON.parse(permissionsString));
|
|
21
|
+
if (!result.success) {
|
|
22
|
+
ctx.context.logger.error("[hasPermission] Invalid permissions for role " + role, { permissions: JSON.parse(permissionsString) });
|
|
23
|
+
throw new APIError("INTERNAL_SERVER_ERROR", { message: "Invalid permissions for role " + role });
|
|
24
|
+
}
|
|
25
|
+
acRoles[role] = input.options.ac.newRole(result.data);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (input.useMemoryCache) acRoles = cacheAllRoles.get(input.organizationId) || acRoles;
|
|
29
|
+
cacheAllRoles.set(input.organizationId, acRoles);
|
|
30
|
+
return hasPermissionFn(input, acRoles);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { hasPermission };
|
|
35
|
+
//# sourceMappingURL=has-permission.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-permission.mjs","names":[],"sources":["../../../src/plugins/organization/has-permission.ts"],"sourcesContent":["import type { GenericEndpointContext } from \"@better-auth/core\";\nimport * as z from \"zod\";\nimport { APIError } from \"../../api\";\nimport type { Role } from \"../access\";\nimport { defaultRoles } from \"./access\";\nimport type { HasPermissionBaseInput } from \"./permission\";\nimport { cacheAllRoles, hasPermissionFn } from \"./permission\";\nimport type { OrganizationRole } from \"./schema\";\n\nexport const hasPermission = async (\n\tinput: {\n\t\torganizationId: string;\n\t\t/**\n\t\t * If true, will use the in-memory cache of the roles.\n\t\t * Keep in mind to use this in a stateless mindset, the purpose of this is to avoid unnecessary database calls when running multiple\n\t\t * hasPermission calls in a row.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tuseMemoryCache?: boolean | undefined;\n\t} & HasPermissionBaseInput,\n\tctx: GenericEndpointContext,\n) => {\n\tlet acRoles: {\n\t\t[x: string]: Role<any> | undefined;\n\t} = { ...(input.options.roles || defaultRoles) };\n\n\tif (\n\t\tctx &&\n\t\tinput.organizationId &&\n\t\tinput.options.dynamicAccessControl?.enabled &&\n\t\tinput.options.ac &&\n\t\t!input.useMemoryCache\n\t) {\n\t\t// Load roles from database\n\t\tconst roles = await ctx.context.adapter.findMany<\n\t\t\tOrganizationRole & { permission: string }\n\t\t>({\n\t\t\tmodel: \"organizationRole\",\n\t\t\twhere: [\n\t\t\t\t{\n\t\t\t\t\tfield: \"organizationId\",\n\t\t\t\t\tvalue: input.organizationId,\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\tfor (const { role, permission: permissionsString } of roles) {\n\t\t\t// If it's for an existing role, skip as we shouldn't override hard-coded roles.\n\t\t\tif (role in acRoles) continue;\n\n\t\t\tconst result = z\n\t\t\t\t.record(z.string(), z.array(z.string()))\n\t\t\t\t.safeParse(JSON.parse(permissionsString));\n\n\t\t\tif (!result.success) {\n\t\t\t\tctx.context.logger.error(\n\t\t\t\t\t\"[hasPermission] Invalid permissions for role \" + role,\n\t\t\t\t\t{\n\t\t\t\t\t\tpermissions: JSON.parse(permissionsString),\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tthrow new APIError(\"INTERNAL_SERVER_ERROR\", {\n\t\t\t\t\tmessage: \"Invalid permissions for role \" + role,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tacRoles[role] = input.options.ac.newRole(result.data);\n\t\t}\n\t}\n\n\tif (input.useMemoryCache) {\n\t\tacRoles = cacheAllRoles.get(input.organizationId) || acRoles;\n\t}\n\tcacheAllRoles.set(input.organizationId, acRoles);\n\n\treturn hasPermissionFn(input, acRoles);\n};\n"],"mappings":";;;;;;;AASA,MAAa,gBAAgB,OAC5B,OAWA,QACI;CACJ,IAAI,UAEA,EAAE,GAAI,MAAM,QAAQ,SAAS,cAAe;AAEhD,KACC,OACA,MAAM,kBACN,MAAM,QAAQ,sBAAsB,WACpC,MAAM,QAAQ,MACd,CAAC,MAAM,gBACN;EAED,MAAM,QAAQ,MAAM,IAAI,QAAQ,QAAQ,SAEtC;GACD,OAAO;GACP,OAAO,CACN;IACC,OAAO;IACP,OAAO,MAAM;IACb,CACD;GACD,CAAC;AAEF,OAAK,MAAM,EAAE,MAAM,YAAY,uBAAuB,OAAO;AAE5D,OAAI,QAAQ,QAAS;GAErB,MAAM,SAAS,EACb,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CACvC,UAAU,KAAK,MAAM,kBAAkB,CAAC;AAE1C,OAAI,CAAC,OAAO,SAAS;AACpB,QAAI,QAAQ,OAAO,MAClB,kDAAkD,MAClD,EACC,aAAa,KAAK,MAAM,kBAAkB,EAC1C,CACD;AACD,UAAM,IAAI,SAAS,yBAAyB,EAC3C,SAAS,kCAAkC,MAC3C,CAAC;;AAGH,WAAQ,QAAQ,MAAM,QAAQ,GAAG,QAAQ,OAAO,KAAK;;;AAIvD,KAAI,MAAM,eACT,WAAU,cAAc,IAAI,MAAM,eAAe,IAAI;AAEtD,eAAc,IAAI,MAAM,gBAAgB,QAAQ;AAEhD,QAAO,gBAAgB,OAAO,QAAQ"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OrganizationOptions } from "./types.mjs";
|
|
2
|
+
import { InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferTeam, Invitation, InvitationInput, InvitationStatus, Member, MemberInput, Organization, OrganizationInput, OrganizationRole, OrganizationSchema, Team, TeamInput, TeamMember, TeamMemberInput, defaultRolesSchema, invitationSchema, invitationStatus, memberSchema, organizationRoleSchema, organizationSchema, roleSchema, teamMemberSchema, teamSchema } from "./schema.mjs";
|
|
3
|
+
import { getOrgAdapter } from "./adapter.mjs";
|
|
4
|
+
import { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization, parseRoles } from "./organization.mjs";
|
|
5
|
+
export { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferTeam, Invitation, InvitationInput, InvitationStatus, Member, MemberInput, Organization, OrganizationCreator, OrganizationEndpoints, OrganizationInput, OrganizationOptions, OrganizationPlugin, OrganizationRole, OrganizationSchema, Team, TeamEndpoints, TeamInput, TeamMember, TeamMemberInput, defaultRolesSchema, getOrgAdapter, invitationSchema, invitationStatus, memberSchema, organization, organizationRoleSchema, organizationSchema, parseRoles, roleSchema, teamMemberSchema, teamSchema };
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { AccessControl, Statements } from "../access/types.mjs";
|
|
2
|
+
import "../access/index.mjs";
|
|
3
|
+
import { OrganizationOptions } from "./types.mjs";
|
|
4
|
+
import { InferInvitation, InferMember, InferOrganization, InferTeam, OrganizationSchema, Team, TeamMember } from "./schema.mjs";
|
|
5
|
+
import "../index.mjs";
|
|
6
|
+
import { ORGANIZATION_ERROR_CODES } from "./error-codes.mjs";
|
|
7
|
+
import { createOrgRole, deleteOrgRole, getOrgRole, listOrgRoles, updateOrgRole } from "./routes/crud-access-control.mjs";
|
|
8
|
+
import { acceptInvitation, cancelInvitation, createInvitation, getInvitation, listInvitations, listUserInvitations, rejectInvitation } from "./routes/crud-invites.mjs";
|
|
9
|
+
import { addMember, getActiveMember, getActiveMemberRole, leaveOrganization, listMembers, removeMember, updateMemberRole } from "./routes/crud-members.mjs";
|
|
10
|
+
import { checkOrganizationSlug, createOrganization, deleteOrganization, getFullOrganization, listOrganizations, setActiveOrganization, updateOrganization } from "./routes/crud-org.mjs";
|
|
11
|
+
import { addTeamMember, createTeam, listOrganizationTeams, listTeamMembers, listUserTeams, removeTeam, removeTeamMember, setActiveTeam, updateTeam } from "./routes/crud-team.mjs";
|
|
12
|
+
import * as better_call0 from "better-call";
|
|
13
|
+
import * as z from "zod";
|
|
14
|
+
|
|
15
|
+
//#region src/plugins/organization/organization.d.ts
|
|
16
|
+
declare module "@better-auth/core" {
|
|
17
|
+
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
18
|
+
organization: {
|
|
19
|
+
creator: OrganizationCreator;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
type DefaultOrganizationPlugin<Options extends OrganizationOptions> = {
|
|
24
|
+
id: "organization";
|
|
25
|
+
endpoints: OrganizationEndpoints<Options>;
|
|
26
|
+
schema: OrganizationSchema<Options>;
|
|
27
|
+
$Infer: {
|
|
28
|
+
Organization: InferOrganization<Options>;
|
|
29
|
+
Invitation: InferInvitation<Options>;
|
|
30
|
+
Member: InferMember<Options>;
|
|
31
|
+
Team: Options["teams"] extends {
|
|
32
|
+
enabled: true;
|
|
33
|
+
} ? Team : never;
|
|
34
|
+
TeamMember: Options["teams"] extends {
|
|
35
|
+
enabled: true;
|
|
36
|
+
} ? TeamMember : never;
|
|
37
|
+
ActiveOrganization: Options["teams"] extends {
|
|
38
|
+
enabled: true;
|
|
39
|
+
} ? {
|
|
40
|
+
members: InferMember<Options, false>[];
|
|
41
|
+
invitations: InferInvitation<Options, false>[];
|
|
42
|
+
teams: InferTeam<Options, false>[];
|
|
43
|
+
} & InferOrganization<Options, false> : {
|
|
44
|
+
members: InferMember<Options, false>[];
|
|
45
|
+
invitations: InferInvitation<Options, false>[];
|
|
46
|
+
} & InferOrganization<Options, false>;
|
|
47
|
+
};
|
|
48
|
+
$ERROR_CODES: typeof ORGANIZATION_ERROR_CODES;
|
|
49
|
+
options: NoInfer<Options>;
|
|
50
|
+
};
|
|
51
|
+
interface OrganizationCreator {
|
|
52
|
+
<Options extends OrganizationOptions>(options?: Options | undefined): DefaultOrganizationPlugin<Options>;
|
|
53
|
+
}
|
|
54
|
+
declare function parseRoles(roles: string | string[]): string;
|
|
55
|
+
type DynamicAccessControlEndpoints<O extends OrganizationOptions> = {
|
|
56
|
+
createOrgRole: ReturnType<typeof createOrgRole<O>>;
|
|
57
|
+
deleteOrgRole: ReturnType<typeof deleteOrgRole<O>>;
|
|
58
|
+
listOrgRoles: ReturnType<typeof listOrgRoles<O>>;
|
|
59
|
+
getOrgRole: ReturnType<typeof getOrgRole<O>>;
|
|
60
|
+
updateOrgRole: ReturnType<typeof updateOrgRole<O>>;
|
|
61
|
+
};
|
|
62
|
+
type TeamEndpoints<O extends OrganizationOptions> = {
|
|
63
|
+
createTeam: ReturnType<typeof createTeam<O>>;
|
|
64
|
+
listOrganizationTeams: ReturnType<typeof listOrganizationTeams<O>>;
|
|
65
|
+
removeTeam: ReturnType<typeof removeTeam<O>>;
|
|
66
|
+
updateTeam: ReturnType<typeof updateTeam<O>>;
|
|
67
|
+
setActiveTeam: ReturnType<typeof setActiveTeam<O>>;
|
|
68
|
+
listUserTeams: ReturnType<typeof listUserTeams<O>>;
|
|
69
|
+
listTeamMembers: ReturnType<typeof listTeamMembers<O>>;
|
|
70
|
+
addTeamMember: ReturnType<typeof addTeamMember<O>>;
|
|
71
|
+
removeTeamMember: ReturnType<typeof removeTeamMember<O>>;
|
|
72
|
+
};
|
|
73
|
+
type OrganizationEndpoints<O extends OrganizationOptions> = {
|
|
74
|
+
createOrganization: ReturnType<typeof createOrganization<O>>;
|
|
75
|
+
updateOrganization: ReturnType<typeof updateOrganization<O>>;
|
|
76
|
+
deleteOrganization: ReturnType<typeof deleteOrganization<O>>;
|
|
77
|
+
setActiveOrganization: ReturnType<typeof setActiveOrganization<O>>;
|
|
78
|
+
getFullOrganization: ReturnType<typeof getFullOrganization<O>>;
|
|
79
|
+
listOrganizations: ReturnType<typeof listOrganizations<O>>;
|
|
80
|
+
createInvitation: ReturnType<typeof createInvitation<O>>;
|
|
81
|
+
cancelInvitation: ReturnType<typeof cancelInvitation<O>>;
|
|
82
|
+
acceptInvitation: ReturnType<typeof acceptInvitation<O>>;
|
|
83
|
+
getInvitation: ReturnType<typeof getInvitation<O>>;
|
|
84
|
+
rejectInvitation: ReturnType<typeof rejectInvitation<O>>;
|
|
85
|
+
listInvitations: ReturnType<typeof listInvitations<O>>;
|
|
86
|
+
getActiveMember: ReturnType<typeof getActiveMember<O>>;
|
|
87
|
+
checkOrganizationSlug: ReturnType<typeof checkOrganizationSlug<O>>;
|
|
88
|
+
addMember: ReturnType<typeof addMember<O>>;
|
|
89
|
+
removeMember: ReturnType<typeof removeMember<O>>;
|
|
90
|
+
updateMemberRole: ReturnType<typeof updateMemberRole<O>>;
|
|
91
|
+
leaveOrganization: ReturnType<typeof leaveOrganization<O>>;
|
|
92
|
+
listUserInvitations: ReturnType<typeof listUserInvitations<O>>;
|
|
93
|
+
listMembers: ReturnType<typeof listMembers<O>>;
|
|
94
|
+
getActiveMemberRole: ReturnType<typeof getActiveMemberRole<O>>;
|
|
95
|
+
hasPermission: ReturnType<typeof createHasPermission<O>>;
|
|
96
|
+
};
|
|
97
|
+
declare const createHasPermission: <O extends OrganizationOptions>(options: O) => better_call0.StrictEndpoint<"/organization/has-permission", {
|
|
98
|
+
method: "POST";
|
|
99
|
+
requireHeaders: true;
|
|
100
|
+
body: z.ZodIntersection<z.ZodObject<{
|
|
101
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
103
|
+
permission: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
104
|
+
permissions: z.ZodUndefined;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
permission: z.ZodUndefined;
|
|
107
|
+
permissions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
108
|
+
}, z.core.$strip>]>>;
|
|
109
|
+
use: ((inputContext: better_call0.MiddlewareInputContext<{
|
|
110
|
+
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
111
|
+
session: {
|
|
112
|
+
session: Record<string, any> & {
|
|
113
|
+
id: string;
|
|
114
|
+
createdAt: Date;
|
|
115
|
+
updatedAt: Date;
|
|
116
|
+
userId: string;
|
|
117
|
+
expiresAt: Date;
|
|
118
|
+
token: string;
|
|
119
|
+
ipAddress?: string | null | undefined;
|
|
120
|
+
userAgent?: string | null | undefined;
|
|
121
|
+
};
|
|
122
|
+
user: Record<string, any> & {
|
|
123
|
+
id: string;
|
|
124
|
+
createdAt: Date;
|
|
125
|
+
updatedAt: Date;
|
|
126
|
+
email: string;
|
|
127
|
+
emailVerified: boolean;
|
|
128
|
+
name: string;
|
|
129
|
+
image?: string | null | undefined;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
}>)[];
|
|
133
|
+
}>) => Promise<{
|
|
134
|
+
session: {
|
|
135
|
+
session: {
|
|
136
|
+
id: string;
|
|
137
|
+
createdAt: Date;
|
|
138
|
+
updatedAt: Date;
|
|
139
|
+
userId: string;
|
|
140
|
+
expiresAt: Date;
|
|
141
|
+
token: string;
|
|
142
|
+
ipAddress?: string | null | undefined;
|
|
143
|
+
userAgent?: string | null | undefined;
|
|
144
|
+
} & {
|
|
145
|
+
activeTeamId?: string | undefined;
|
|
146
|
+
activeOrganizationId?: string | undefined;
|
|
147
|
+
};
|
|
148
|
+
user: {
|
|
149
|
+
id: string;
|
|
150
|
+
createdAt: Date;
|
|
151
|
+
updatedAt: Date;
|
|
152
|
+
email: string;
|
|
153
|
+
emailVerified: boolean;
|
|
154
|
+
name: string;
|
|
155
|
+
image?: string | null | undefined;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
}>)[];
|
|
159
|
+
metadata: {
|
|
160
|
+
$Infer: {
|
|
161
|
+
body: {
|
|
162
|
+
permissions: { [key in keyof (O["ac"] extends AccessControl<infer S extends Statements> ? S : {
|
|
163
|
+
readonly organization: readonly ["update", "delete"];
|
|
164
|
+
readonly member: readonly ["create", "update", "delete"];
|
|
165
|
+
readonly invitation: readonly ["create", "cancel"];
|
|
166
|
+
readonly team: readonly ["create", "update", "delete"];
|
|
167
|
+
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
168
|
+
})]?: ((O["ac"] extends AccessControl<infer S extends Statements> ? S : {
|
|
169
|
+
readonly organization: readonly ["update", "delete"];
|
|
170
|
+
readonly member: readonly ["create", "update", "delete"];
|
|
171
|
+
readonly invitation: readonly ["create", "cancel"];
|
|
172
|
+
readonly team: readonly ["create", "update", "delete"];
|
|
173
|
+
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
174
|
+
})[key] extends readonly unknown[] ? (O["ac"] extends AccessControl<infer S extends Statements> ? S : {
|
|
175
|
+
readonly organization: readonly ["update", "delete"];
|
|
176
|
+
readonly member: readonly ["create", "update", "delete"];
|
|
177
|
+
readonly invitation: readonly ["create", "cancel"];
|
|
178
|
+
readonly team: readonly ["create", "update", "delete"];
|
|
179
|
+
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
180
|
+
})[key][number] : never)[] | undefined };
|
|
181
|
+
} & {
|
|
182
|
+
organizationId?: string | undefined;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
openapi: {
|
|
186
|
+
description: string;
|
|
187
|
+
requestBody: {
|
|
188
|
+
content: {
|
|
189
|
+
"application/json": {
|
|
190
|
+
schema: {
|
|
191
|
+
type: "object";
|
|
192
|
+
properties: {
|
|
193
|
+
permission: {
|
|
194
|
+
type: string;
|
|
195
|
+
description: string;
|
|
196
|
+
deprecated: boolean;
|
|
197
|
+
};
|
|
198
|
+
permissions: {
|
|
199
|
+
type: string;
|
|
200
|
+
description: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
required: string[];
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
responses: {
|
|
209
|
+
"200": {
|
|
210
|
+
description: string;
|
|
211
|
+
content: {
|
|
212
|
+
"application/json": {
|
|
213
|
+
schema: {
|
|
214
|
+
type: "object";
|
|
215
|
+
properties: {
|
|
216
|
+
error: {
|
|
217
|
+
type: string;
|
|
218
|
+
};
|
|
219
|
+
success: {
|
|
220
|
+
type: string;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
required: string[];
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
}, {
|
|
232
|
+
error: null;
|
|
233
|
+
success: boolean;
|
|
234
|
+
}>;
|
|
235
|
+
type OrganizationPlugin<O extends OrganizationOptions> = {
|
|
236
|
+
id: "organization";
|
|
237
|
+
endpoints: OrganizationEndpoints<O> & (O extends {
|
|
238
|
+
teams: {
|
|
239
|
+
enabled: true;
|
|
240
|
+
};
|
|
241
|
+
} ? TeamEndpoints<O> : {}) & (O extends {
|
|
242
|
+
dynamicAccessControl: {
|
|
243
|
+
enabled: true;
|
|
244
|
+
};
|
|
245
|
+
} ? DynamicAccessControlEndpoints<O> : {});
|
|
246
|
+
schema: OrganizationSchema<O>;
|
|
247
|
+
$Infer: {
|
|
248
|
+
Organization: InferOrganization<O>;
|
|
249
|
+
Invitation: InferInvitation<O>;
|
|
250
|
+
Member: InferMember<O>;
|
|
251
|
+
Team: O["teams"] extends {
|
|
252
|
+
enabled: true;
|
|
253
|
+
} ? Team : never;
|
|
254
|
+
TeamMember: O["teams"] extends {
|
|
255
|
+
enabled: true;
|
|
256
|
+
} ? TeamMember : never;
|
|
257
|
+
ActiveOrganization: O["teams"] extends {
|
|
258
|
+
enabled: true;
|
|
259
|
+
} ? {
|
|
260
|
+
members: InferMember<O, false>[];
|
|
261
|
+
invitations: InferInvitation<O, false>[];
|
|
262
|
+
teams: InferTeam<O, false>[];
|
|
263
|
+
} & InferOrganization<O, false> : {
|
|
264
|
+
members: InferMember<O, false>[];
|
|
265
|
+
invitations: InferInvitation<O, false>[];
|
|
266
|
+
} & InferOrganization<O, false>;
|
|
267
|
+
};
|
|
268
|
+
$ERROR_CODES: typeof ORGANIZATION_ERROR_CODES;
|
|
269
|
+
options: NoInfer<O>;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Organization plugin for Better Auth. Organization allows you to create teams, members,
|
|
273
|
+
* and manage access control for your users.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* const auth = sirketioAuth({
|
|
278
|
+
* plugins: [
|
|
279
|
+
* organization({
|
|
280
|
+
* allowUserToCreateOrganization: true,
|
|
281
|
+
* }),
|
|
282
|
+
* ],
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
declare function organization<O extends OrganizationOptions & {
|
|
287
|
+
teams: {
|
|
288
|
+
enabled: true;
|
|
289
|
+
};
|
|
290
|
+
dynamicAccessControl?: {
|
|
291
|
+
enabled?: false | undefined;
|
|
292
|
+
} | undefined;
|
|
293
|
+
}>(options?: O | undefined): {
|
|
294
|
+
id: "organization";
|
|
295
|
+
endpoints: OrganizationEndpoints<O> & TeamEndpoints<O>;
|
|
296
|
+
schema: OrganizationSchema<O>;
|
|
297
|
+
$Infer: {
|
|
298
|
+
Organization: InferOrganization<O>;
|
|
299
|
+
Invitation: InferInvitation<O>;
|
|
300
|
+
Member: InferMember<O>;
|
|
301
|
+
Team: O["teams"] extends {
|
|
302
|
+
enabled: true;
|
|
303
|
+
} ? Team : never;
|
|
304
|
+
TeamMember: O["teams"] extends {
|
|
305
|
+
enabled: true;
|
|
306
|
+
} ? TeamMember : never;
|
|
307
|
+
ActiveOrganization: O["teams"] extends {
|
|
308
|
+
enabled: true;
|
|
309
|
+
} ? {
|
|
310
|
+
members: InferMember<O, false>[];
|
|
311
|
+
invitations: InferInvitation<O, false>[];
|
|
312
|
+
teams: InferTeam<O, false>[];
|
|
313
|
+
} & InferOrganization<O, false> : {
|
|
314
|
+
members: InferMember<O, false>[];
|
|
315
|
+
invitations: InferInvitation<O, false>[];
|
|
316
|
+
} & InferOrganization<O, false>;
|
|
317
|
+
};
|
|
318
|
+
$ERROR_CODES: typeof ORGANIZATION_ERROR_CODES;
|
|
319
|
+
options: NoInfer<O>;
|
|
320
|
+
};
|
|
321
|
+
declare function organization<O extends OrganizationOptions & {
|
|
322
|
+
teams: {
|
|
323
|
+
enabled: true;
|
|
324
|
+
};
|
|
325
|
+
dynamicAccessControl: {
|
|
326
|
+
enabled: true;
|
|
327
|
+
};
|
|
328
|
+
}>(options?: O | undefined): {
|
|
329
|
+
id: "organization";
|
|
330
|
+
endpoints: OrganizationEndpoints<O> & TeamEndpoints<O> & DynamicAccessControlEndpoints<O>;
|
|
331
|
+
schema: OrganizationSchema<O>;
|
|
332
|
+
$Infer: {
|
|
333
|
+
Organization: InferOrganization<O>;
|
|
334
|
+
Invitation: InferInvitation<O>;
|
|
335
|
+
Member: InferMember<O>;
|
|
336
|
+
Team: O["teams"] extends {
|
|
337
|
+
enabled: true;
|
|
338
|
+
} ? Team : never;
|
|
339
|
+
TeamMember: O["teams"] extends {
|
|
340
|
+
enabled: true;
|
|
341
|
+
} ? TeamMember : never;
|
|
342
|
+
ActiveOrganization: O["teams"] extends {
|
|
343
|
+
enabled: true;
|
|
344
|
+
} ? {
|
|
345
|
+
members: InferMember<O, false>[];
|
|
346
|
+
invitations: InferInvitation<O, false>[];
|
|
347
|
+
teams: InferTeam<O, false>[];
|
|
348
|
+
} & InferOrganization<O, false> : {
|
|
349
|
+
members: InferMember<O, false>[];
|
|
350
|
+
invitations: InferInvitation<O, false>[];
|
|
351
|
+
} & InferOrganization<O, false>;
|
|
352
|
+
};
|
|
353
|
+
$ERROR_CODES: typeof ORGANIZATION_ERROR_CODES;
|
|
354
|
+
options: NoInfer<O>;
|
|
355
|
+
};
|
|
356
|
+
declare function organization<O extends OrganizationOptions & {
|
|
357
|
+
dynamicAccessControl: {
|
|
358
|
+
enabled: true;
|
|
359
|
+
};
|
|
360
|
+
teams?: {
|
|
361
|
+
enabled?: false | undefined;
|
|
362
|
+
} | undefined;
|
|
363
|
+
}>(options?: O | undefined): {
|
|
364
|
+
id: "organization";
|
|
365
|
+
endpoints: OrganizationEndpoints<O> & DynamicAccessControlEndpoints<O>;
|
|
366
|
+
schema: OrganizationSchema<O>;
|
|
367
|
+
$Infer: {
|
|
368
|
+
Organization: InferOrganization<O>;
|
|
369
|
+
Invitation: InferInvitation<O>;
|
|
370
|
+
Member: InferMember<O>;
|
|
371
|
+
Team: O["teams"] extends {
|
|
372
|
+
enabled: true;
|
|
373
|
+
} ? Team : never;
|
|
374
|
+
TeamMember: O["teams"] extends {
|
|
375
|
+
enabled: true;
|
|
376
|
+
} ? TeamMember : never;
|
|
377
|
+
ActiveOrganization: O["teams"] extends {
|
|
378
|
+
enabled: true;
|
|
379
|
+
} ? {
|
|
380
|
+
members: InferMember<O, false>[];
|
|
381
|
+
invitations: InferInvitation<O, false>[];
|
|
382
|
+
teams: InferTeam<O, false>[];
|
|
383
|
+
} & InferOrganization<O, false> : {
|
|
384
|
+
members: InferMember<O, false>[];
|
|
385
|
+
invitations: InferInvitation<O, false>[];
|
|
386
|
+
} & InferOrganization<O, false>;
|
|
387
|
+
};
|
|
388
|
+
$ERROR_CODES: typeof ORGANIZATION_ERROR_CODES;
|
|
389
|
+
options: NoInfer<O>;
|
|
390
|
+
};
|
|
391
|
+
declare function organization<O extends OrganizationOptions>(options?: O | undefined): DefaultOrganizationPlugin<O>;
|
|
392
|
+
//#endregion
|
|
393
|
+
export { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization, parseRoles };
|
|
394
|
+
//# sourceMappingURL=organization.d.mts.map
|