@rebasepro/server 0.16.0 → 0.16.1-canary.g0d7af95
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/{GCSStorageController-BEmDYFKc.js → GCSStorageController-Bl7nmhdv.js} +7 -6
- package/dist/{GCSStorageController-BEmDYFKc.js.map → GCSStorageController-Bl7nmhdv.js.map} +1 -1
- package/dist/{S3StorageController-B2EDXXMH.js → S3StorageController-CWvvrRpF.js} +7 -6
- package/dist/{S3StorageController-B2EDXXMH.js.map → S3StorageController-CWvvrRpF.js.map} +1 -1
- package/dist/{admin_block-DLILvzle.js → admin_block-BeypnEfb.js} +6 -6
- package/dist/admin_block-BeypnEfb.js.map +1 -0
- package/dist/api/ast-schema-editor.d.ts +23 -0
- package/dist/api/contract-routes.d.ts +1 -1
- package/dist/api/errors.d.ts +1 -1
- package/dist/api/index.d.ts +3 -3
- package/dist/api/live-schema-routes.d.ts +122 -0
- package/dist/api/logs-routes.d.ts +1 -1
- package/dist/api/mount.d.ts +41 -0
- package/dist/api/rest/api-generator.d.ts +2 -2
- package/dist/api/rest/index.d.ts +1 -1
- package/dist/api/rest/query-parser.d.ts +1 -1
- package/dist/api/schema-editor-routes.d.ts +1 -1
- package/dist/api/types.d.ts +12 -4
- package/dist/{schema-editor-routes-CV9k0w3G.js → ast-schema-editor-BrarYZCq.js} +37 -45
- package/dist/ast-schema-editor-BrarYZCq.js.map +1 -0
- package/dist/auth/adapter-middleware.d.ts +2 -2
- package/dist/auth/admin-roles-route.d.ts +2 -2
- package/dist/auth/admin-user-ops.d.ts +3 -3
- package/dist/auth/admin-users-route.d.ts +4 -6
- package/dist/auth/api-keys/api-key-middleware.d.ts +2 -2
- package/dist/auth/api-keys/api-key-permission-guard.d.ts +1 -1
- package/dist/auth/api-keys/api-key-routes.d.ts +2 -2
- package/dist/auth/api-keys/api-key-store.d.ts +1 -1
- package/dist/auth/api-keys/index.d.ts +9 -9
- package/dist/auth/apple-oauth.d.ts +2 -2
- package/dist/auth/auth-hooks.d.ts +4 -4
- package/dist/auth/bitbucket-oauth.d.ts +2 -2
- package/dist/auth/builtin-auth-adapter.d.ts +8 -4
- package/dist/auth/capabilities.d.ts +51 -0
- package/dist/auth/captcha.d.ts +86 -0
- package/dist/auth/cookie-utils.d.ts +2 -2
- package/dist/auth/discord-oauth.d.ts +2 -2
- package/dist/auth/facebook-oauth.d.ts +2 -2
- package/dist/auth/github-oauth.d.ts +2 -2
- package/dist/auth/gitlab-oauth.d.ts +2 -2
- package/dist/auth/google-oauth.d.ts +1 -1
- package/dist/auth/index.d.ts +58 -54
- package/dist/auth/jwks-routes.d.ts +1 -1
- package/dist/auth/jwt.d.ts +1 -1
- package/dist/auth/linkedin-oauth.d.ts +2 -2
- package/dist/auth/magic-link-routes.d.ts +10 -3
- package/dist/auth/mfa-gate.d.ts +1 -1
- package/dist/auth/mfa-routes.d.ts +3 -3
- package/dist/auth/microsoft-oauth.d.ts +2 -2
- package/dist/auth/middleware.d.ts +6 -7
- package/dist/auth/otp-routes.d.ts +89 -0
- package/dist/auth/rate-limiter.d.ts +2 -2
- package/dist/auth/require-auth.d.ts +1 -1
- package/dist/auth/reset-password-admin.d.ts +4 -4
- package/dist/auth/routes.d.ts +18 -10
- package/dist/auth/session-routes.d.ts +3 -3
- package/dist/auth/slack-oauth.d.ts +2 -2
- package/dist/auth/spotify-oauth.d.ts +2 -2
- package/dist/auth/token-revocation.d.ts +2 -2
- package/dist/auth/twitter-oauth.d.ts +2 -2
- package/dist/{auth-5Et5mnUA.js → auth-DU-nUjPp.js} +604 -4376
- package/dist/auth-DU-nUjPp.js.map +1 -0
- package/dist/backup/backup-common.d.ts +1 -1
- package/dist/backup/backup-routes.d.ts +3 -3
- package/dist/backup/index.d.ts +3 -3
- package/dist/{backup-C6ljYVTp.js → backup-CRdZkA6c.js} +7 -6
- package/dist/{backup-C6ljYVTp.js.map → backup-CRdZkA6c.js.map} +1 -1
- package/dist/boot/boot.d.ts +5 -5
- package/dist/boot/bundle.d.ts +10 -1
- package/dist/boot/driver.d.ts +1 -1
- package/dist/boot/env.d.ts +28 -1
- package/dist/boot/fetch-bundle.d.ts +144 -1
- package/dist/boot/options.d.ts +30 -6
- package/dist/boot/resource-adapters.d.ts +31 -0
- package/dist/boot/resource-loading.d.ts +10 -0
- package/dist/boot/role.d.ts +3 -2
- package/dist/boot/sources.d.ts +8 -2
- package/dist/boot/version-skew.d.ts +1 -1
- package/dist/collections/BackendCollectionRegistry.d.ts +1 -1
- package/dist/collections/loader.d.ts +1 -1
- package/dist/collections/validate-config.d.ts +13 -0
- package/dist/{contract-routes-DZ-LBpSL.js → contract-routes-D8TvxPLo.js} +8 -7
- package/dist/contract-routes-D8TvxPLo.js.map +1 -0
- package/dist/cron/cron-routes.d.ts +2 -2
- package/dist/cron/cron-scheduler.d.ts +3 -3
- package/dist/cron/index.d.ts +8 -8
- package/dist/{cron-loader-YhhQeVBM.js → cron-loader-d9WMFENB.js} +8 -7
- package/dist/{cron-loader-YhhQeVBM.js.map → cron-loader-d9WMFENB.js.map} +1 -1
- package/dist/{cron-routes-maM_RlUu.js → cron-routes-BsukhMGm.js} +9 -8
- package/dist/cron-routes-BsukhMGm.js.map +1 -0
- package/dist/{cron-scheduler-DIpYBmZP.js → cron-scheduler-BB82dWuU.js} +9 -9
- package/dist/cron-scheduler-BB82dWuU.js.map +1 -0
- package/dist/{cron-store-DfH_4Cd9.js → cron-store-CbFfQhbg.js} +11 -9
- package/dist/{cron-store-DfH_4Cd9.js.map → cron-store-CbFfQhbg.js.map} +1 -1
- package/dist/ddl-bootstrap-5YZCZ8qk.js +146 -0
- package/dist/ddl-bootstrap-5YZCZ8qk.js.map +1 -0
- package/dist/deploy/pod-contract.d.ts +139 -0
- package/dist/dev-secrets.d.ts +52 -0
- package/dist/{dynamic-import-Dvh-K5fl.js → dynamic-import-X40pTZUQ.js} +5 -4
- package/dist/{dynamic-import-Dvh-K5fl.js.map → dynamic-import-X40pTZUQ.js.map} +1 -1
- package/dist/email/dev-sink.d.ts +88 -0
- package/dist/email/index.d.ts +9 -7
- package/dist/email/link-base.d.ts +1 -1
- package/dist/email/smtp-email-service.d.ts +2 -2
- package/dist/email/templates.d.ts +12 -0
- package/dist/email/types.d.ts +18 -6
- package/dist/env.d.ts +1 -1
- package/dist/{errors-EBYiaJ2E.js → errors-DBwpj9N8.js} +8 -7
- package/dist/errors-DBwpj9N8.js.map +1 -0
- package/dist/{function-loader-DDS1v7YX.js → function-loader-LLdmBFoL.js} +9 -8
- package/dist/{function-loader-DDS1v7YX.js.map → function-loader-LLdmBFoL.js.map} +1 -1
- package/dist/{function-routes-Btcez1T-.js → function-routes-ClT6UQpD.js} +8 -7
- package/dist/function-routes-ClT6UQpD.js.map +1 -0
- package/dist/functions/context.d.ts +141 -0
- package/dist/functions/define-function.d.ts +1 -1
- package/dist/functions/function-routes.d.ts +9 -3
- package/dist/functions/guards.d.ts +76 -0
- package/dist/functions/index.d.ts +96 -5
- package/dist/functions/index.js +919 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/functions/internal.d.ts +26 -0
- package/dist/functions/proxy.d.ts +1 -1
- package/dist/functions/request-timeout.d.ts +9 -1
- package/dist/functions/runtime-env.d.ts +92 -0
- package/dist/functions/wait-until.d.ts +74 -0
- package/dist/history/history-routes.d.ts +2 -2
- package/dist/history/index.d.ts +1 -1
- package/dist/history-recorder-B67maiTi.js +76 -0
- package/dist/history-recorder-B67maiTi.js.map +1 -0
- package/dist/history-store-oiqhb3HU.js +210 -0
- package/dist/history-store-oiqhb3HU.js.map +1 -0
- package/dist/index.d.ts +65 -54
- package/dist/index.es.js +3667 -328
- package/dist/index.es.js.map +1 -1
- package/dist/init/docs.d.ts +1 -1
- package/dist/init/middlewares.d.ts +1 -1
- package/dist/init/shutdown.d.ts +4 -0
- package/dist/init/storage.d.ts +1 -1
- package/dist/init/surfaces.d.ts +10 -0
- package/dist/init.d.ts +179 -22
- package/dist/internal-tables-DpxfPaEB.js +97 -0
- package/dist/internal-tables-DpxfPaEB.js.map +1 -0
- package/dist/jobs/index.d.ts +5 -5
- package/dist/{jobs-CyOKXXlu.js → jobs-B2ELModo.js} +11 -9
- package/dist/{jobs-CyOKXXlu.js.map → jobs-B2ELModo.js.map} +1 -1
- package/dist/{jwt-DxH9fLPt.js → jwt-DoHkMMWF.js} +9 -8
- package/dist/jwt-DoHkMMWF.js.map +1 -0
- package/dist/{logger-DfvF_8r-.js → logger-DS03e908.js} +104 -10
- package/dist/logger-DS03e908.js.map +1 -0
- package/dist/{logs-routes-CWBLQj2l.js → logs-routes-DB72iQSr.js} +36 -9
- package/dist/logs-routes-DB72iQSr.js.map +1 -0
- package/dist/metrics/history-recorder.d.ts +18 -0
- package/dist/metrics/history-store.d.ts +123 -0
- package/dist/metrics/index.d.ts +10 -2
- package/dist/{openapi-generator-BCKJRUS4.js → openapi-generator-FFGT0H6O.js} +7 -11
- package/dist/{openapi-generator-BCKJRUS4.js.map → openapi-generator-FFGT0H6O.js.map} +1 -1
- package/dist/{proxy-Bj5DVllb.js → proxy-CMymhnwG.js} +9 -6
- package/dist/{proxy-Bj5DVllb.js.map → proxy-CMymhnwG.js.map} +1 -1
- package/dist/query-parser--nstjRCh.js +355 -0
- package/dist/query-parser--nstjRCh.js.map +1 -0
- package/dist/{request-timeout-BuFoEKwT.js → request-timeout-C8gkc-j7.js} +21 -6
- package/dist/request-timeout-C8gkc-j7.js.map +1 -0
- package/dist/rls-audit/index.d.ts +111 -0
- package/dist/{rolldown-runtime-DSJWtz9O.js → rolldown-runtime-dW7B1o5h.js} +4 -3
- package/dist/schema-edit/apply-schema-change.d.ts +141 -0
- package/dist/schema-edit/github-repository.d.ts +67 -0
- package/dist/schema-edit/local-git-repository.d.ts +28 -0
- package/dist/schema-edit/project-root.d.ts +43 -0
- package/dist/schema-edit/remote-source.d.ts +25 -0
- package/dist/schema-edit/schema-edit-permissions.d.ts +129 -0
- package/dist/schema-editor-routes-Bf5h5Emf.js +87 -0
- package/dist/schema-editor-routes-Bf5h5Emf.js.map +1 -0
- package/dist/schemas-DBxgjM9A.js +4153 -0
- package/dist/schemas-DBxgjM9A.js.map +1 -0
- package/dist/{selection-_z6TM1DB.js → selection-CRpqKUbt.js} +6 -5
- package/dist/{selection-_z6TM1DB.js.map → selection-CRpqKUbt.js.map} +1 -1
- package/dist/services/webhook-service.d.ts +1 -1
- package/dist/singleton.d.ts +7 -0
- package/dist/{src-BPfYOeN4.js → src-B-CmIFMr.js} +8 -6
- package/dist/src-B-CmIFMr.js.map +1 -0
- package/dist/{src-CrCxd8km.js → src-Cdsw7DqV.js} +126 -5
- package/dist/src-Cdsw7DqV.js.map +1 -0
- package/dist/storage/GCSStorageController.d.ts +1 -1
- package/dist/storage/LocalStorageController.d.ts +1 -1
- package/dist/storage/S3StorageController.d.ts +1 -1
- package/dist/storage/cache-headers.d.ts +87 -0
- package/dist/storage/index.d.ts +11 -11
- package/dist/storage/path-pattern.d.ts +58 -0
- package/dist/storage/policies.d.ts +88 -0
- package/dist/storage/range.d.ts +63 -0
- package/dist/storage/rendition-cache.d.ts +45 -0
- package/dist/storage/routes.d.ts +17 -5
- package/dist/storage/storage-registry.d.ts +1 -1
- package/dist/storage/triggers.d.ts +66 -0
- package/dist/storage/tus-handler.d.ts +34 -3
- package/dist/topics/runtime.d.ts +68 -0
- package/dist/{types-DSnOC4mF.js → types-BfKcm9do.js} +5 -4
- package/dist/{types-DSnOC4mF.js.map → types-BfKcm9do.js.map} +1 -1
- package/dist/utils/host.d.ts +58 -0
- package/dist/utils/logger.d.ts +0 -15
- package/dist/utils/request-id.d.ts +1 -1
- package/functions/package.json +24 -0
- package/package.json +13 -7
- package/dist/admin_block-DLILvzle.js.map +0 -1
- package/dist/auth-5Et5mnUA.js.map +0 -1
- package/dist/contract-routes-DZ-LBpSL.js.map +0 -1
- package/dist/cron-routes-maM_RlUu.js.map +0 -1
- package/dist/cron-scheduler-DIpYBmZP.js.map +0 -1
- package/dist/ddl-bootstrap-Cywoj8Ta.js +0 -221
- package/dist/ddl-bootstrap-Cywoj8Ta.js.map +0 -1
- package/dist/errors-EBYiaJ2E.js.map +0 -1
- package/dist/function-routes-Btcez1T-.js.map +0 -1
- package/dist/jwt-DxH9fLPt.js.map +0 -1
- package/dist/logger-DfvF_8r-.js.map +0 -1
- package/dist/logs-routes-CWBLQj2l.js.map +0 -1
- package/dist/request-timeout-BuFoEKwT.js.map +0 -1
- package/dist/schema-editor-routes-CV9k0w3G.js.map +0 -1
- package/dist/src-BPfYOeN4.js.map +0 -1
- package/dist/src-CrCxd8km.js.map +0 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
|
-
export * from "./interfaces";
|
|
2
|
-
export { configureJwt, isJwtConfigured, generateAccessToken, verifyAccessToken, generateRefreshToken, hashRefreshToken, getRefreshTokenExpiry, getAccessTokenExpiry, generateDownloadToken, verifyDownloadToken, getJwks, hasAsymmetricSigningKey } from "./jwt";
|
|
3
|
-
export type { JwtConfig, AccessTokenPayload, DownloadTokenPayload } from "./jwt";
|
|
4
|
-
export { createJwksRoutes } from "./jwks-routes";
|
|
5
|
-
export type { JwtSigningKeyConfig, JwtSigningAlgorithm, PublicJwk } from "./jwt-keys";
|
|
6
|
-
export { hashPassword, verifyPassword, validatePasswordStrength } from "./password";
|
|
7
|
-
export { safeCompare } from "./crypto-utils";
|
|
8
|
-
export type { PasswordValidationResult } from "./password";
|
|
9
|
-
export type { AuthHooks, AuthMethod, ResolvedAuthHooks } from "./auth-hooks";
|
|
10
|
-
export { resolveAuthHooks } from "./auth-hooks";
|
|
11
|
-
export { generateSecurePassword, generateSecureToken, hashToken, prepareAdminUserValues, finalizeAdminUserCreation } from "./admin-user-ops";
|
|
12
|
-
export type { AdminUserContext, AdminUserPrepareResult } from "./admin-user-ops";
|
|
13
|
-
export { createGoogleProvider } from "./google-oauth";
|
|
14
|
-
export type { GoogleProviderConfig } from "./google-oauth";
|
|
15
|
-
export { createLinkedinProvider } from "./linkedin-oauth";
|
|
16
|
-
export { createGitHubProvider } from "./github-oauth";
|
|
17
|
-
export { createMicrosoftProvider } from "./microsoft-oauth";
|
|
18
|
-
export { createAppleProvider } from "./apple-oauth";
|
|
19
|
-
export { createFacebookProvider } from "./facebook-oauth";
|
|
20
|
-
export { createTwitterProvider } from "./twitter-oauth";
|
|
21
|
-
export { createDiscordProvider } from "./discord-oauth";
|
|
22
|
-
export { createGitLabProvider } from "./gitlab-oauth";
|
|
23
|
-
export { createBitbucketProvider } from "./bitbucket-oauth";
|
|
24
|
-
export { createSlackProvider } from "./slack-oauth";
|
|
25
|
-
export { createSpotifyProvider } from "./spotify-oauth";
|
|
26
|
-
export type { AppleCodeFlowPayload } from "./apple-oauth";
|
|
27
|
-
export { oauthCodeFlowSchema, pkceTokenParams, providerVerifiedEmail } from "./oauth-code-flow";
|
|
28
|
-
export type { OAuthCodeFlowPayload } from "./oauth-code-flow";
|
|
29
|
-
export { verifyOidcIdToken, tryVerifyOidcIdToken } from "./oidc-id-token";
|
|
30
|
-
export type { OidcIdTokenClaims, VerifyOidcIdTokenOptions } from "./oidc-id-token";
|
|
31
|
-
export { decideOAuthAutoLink, isRedirectUriAllowed } from "./oauth-signin-policy";
|
|
32
|
-
export type { AutoLinkDecision, AutoLinkRefusal } from "./oauth-signin-policy";
|
|
33
|
-
export { requireAuth, requireAdmin, optionalAuth, extractUserFromToken, createAuthMiddleware, queryTokenAuth, fileTokenAuth } from "./middleware";
|
|
34
|
-
export type { AuthMiddlewareOptions, AuthResult } from "./middleware";
|
|
35
|
-
export { createAuthRoutes } from "./routes";
|
|
36
|
-
export type { AuthModuleConfig, CookieAuthConfig } from "./routes";
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export
|
|
40
|
-
export {
|
|
41
|
-
export type {
|
|
42
|
-
export {
|
|
43
|
-
export type {
|
|
44
|
-
export {
|
|
45
|
-
export type {
|
|
46
|
-
export {
|
|
47
|
-
export type {
|
|
48
|
-
export {
|
|
49
|
-
export type {
|
|
50
|
-
export {
|
|
51
|
-
export type {
|
|
52
|
-
export {
|
|
53
|
-
export {
|
|
54
|
-
export
|
|
1
|
+
export * from "./interfaces.js";
|
|
2
|
+
export { configureJwt, isJwtConfigured, generateAccessToken, verifyAccessToken, generateRefreshToken, hashRefreshToken, getRefreshTokenExpiry, getAccessTokenExpiry, generateDownloadToken, verifyDownloadToken, getJwks, hasAsymmetricSigningKey } from "./jwt.js";
|
|
3
|
+
export type { JwtConfig, AccessTokenPayload, DownloadTokenPayload } from "./jwt.js";
|
|
4
|
+
export { createJwksRoutes } from "./jwks-routes.js";
|
|
5
|
+
export type { JwtSigningKeyConfig, JwtSigningAlgorithm, PublicJwk } from "./jwt-keys.js";
|
|
6
|
+
export { hashPassword, verifyPassword, validatePasswordStrength } from "./password.js";
|
|
7
|
+
export { safeCompare } from "./crypto-utils.js";
|
|
8
|
+
export type { PasswordValidationResult } from "./password.js";
|
|
9
|
+
export type { AuthHooks, AuthMethod, ResolvedAuthHooks } from "./auth-hooks.js";
|
|
10
|
+
export { resolveAuthHooks } from "./auth-hooks.js";
|
|
11
|
+
export { generateSecurePassword, generateSecureToken, hashToken, prepareAdminUserValues, finalizeAdminUserCreation } from "./admin-user-ops.js";
|
|
12
|
+
export type { AdminUserContext, AdminUserPrepareResult } from "./admin-user-ops.js";
|
|
13
|
+
export { createGoogleProvider } from "./google-oauth.js";
|
|
14
|
+
export type { GoogleProviderConfig } from "./google-oauth.js";
|
|
15
|
+
export { createLinkedinProvider } from "./linkedin-oauth.js";
|
|
16
|
+
export { createGitHubProvider } from "./github-oauth.js";
|
|
17
|
+
export { createMicrosoftProvider } from "./microsoft-oauth.js";
|
|
18
|
+
export { createAppleProvider } from "./apple-oauth.js";
|
|
19
|
+
export { createFacebookProvider } from "./facebook-oauth.js";
|
|
20
|
+
export { createTwitterProvider } from "./twitter-oauth.js";
|
|
21
|
+
export { createDiscordProvider } from "./discord-oauth.js";
|
|
22
|
+
export { createGitLabProvider } from "./gitlab-oauth.js";
|
|
23
|
+
export { createBitbucketProvider } from "./bitbucket-oauth.js";
|
|
24
|
+
export { createSlackProvider } from "./slack-oauth.js";
|
|
25
|
+
export { createSpotifyProvider } from "./spotify-oauth.js";
|
|
26
|
+
export type { AppleCodeFlowPayload } from "./apple-oauth.js";
|
|
27
|
+
export { oauthCodeFlowSchema, pkceTokenParams, providerVerifiedEmail } from "./oauth-code-flow.js";
|
|
28
|
+
export type { OAuthCodeFlowPayload } from "./oauth-code-flow.js";
|
|
29
|
+
export { verifyOidcIdToken, tryVerifyOidcIdToken } from "./oidc-id-token.js";
|
|
30
|
+
export type { OidcIdTokenClaims, VerifyOidcIdTokenOptions } from "./oidc-id-token.js";
|
|
31
|
+
export { decideOAuthAutoLink, isRedirectUriAllowed } from "./oauth-signin-policy.js";
|
|
32
|
+
export type { AutoLinkDecision, AutoLinkRefusal } from "./oauth-signin-policy.js";
|
|
33
|
+
export { requireAuth, requireAdmin, optionalAuth, extractUserFromToken, createAuthMiddleware, queryTokenAuth, fileTokenAuth } from "./middleware.js";
|
|
34
|
+
export type { AuthMiddlewareOptions, AuthResult } from "./middleware.js";
|
|
35
|
+
export { createAuthRoutes } from "./routes.js";
|
|
36
|
+
export type { AuthModuleConfig, CookieAuthConfig } from "./routes.js";
|
|
37
|
+
export { buildBuiltinAuthCapabilities } from "./capabilities.js";
|
|
38
|
+
export type { BuiltinAuthCapabilityInputs } from "./capabilities.js";
|
|
39
|
+
export { mountMagicLinkRoutes } from "./magic-link-routes.js";
|
|
40
|
+
export { buildCaptchaMiddlewares, createCaptchaMiddleware, createHttpCaptchaVerifier, resolveCaptchaVerifier, DEFAULT_CAPTCHA_ROUTES } from "./captcha.js";
|
|
41
|
+
export type { CaptchaConfig, CaptchaProvider, CaptchaRoute, CaptchaVerifier, CaptchaVerifyRequest, CaptchaVerifyResult } from "./captcha.js";
|
|
42
|
+
export { createResetPasswordRoute } from "./reset-password-admin.js";
|
|
43
|
+
export type { ResetPasswordRouteConfig } from "./reset-password-admin.js";
|
|
44
|
+
export { createRateLimiter, defaultAuthLimiter, strictAuthLimiter, createDataRateLimiter, apiKeyKeyGenerator } from "./rate-limiter.js";
|
|
45
|
+
export type { DataRateLimitConfig } from "./rate-limiter.js";
|
|
46
|
+
export { MemoryRateLimitStore } from "./rate-limit-store.js";
|
|
47
|
+
export type { RateLimitStore, RateLimitDecision } from "./rate-limit-store.js";
|
|
48
|
+
export { createSqlRateLimitStore } from "./sql-rate-limit-store.js";
|
|
49
|
+
export type { SqlRateLimitStoreOptions } from "./sql-rate-limit-store.js";
|
|
50
|
+
export { resolveRateLimitStoreKind, RateLimitStoreConfigurationError } from "./resolve-rate-limit-store.js";
|
|
51
|
+
export type { RateLimitStoreKind, RateLimitStoreEnv } from "./resolve-rate-limit-store.js";
|
|
52
|
+
export { createApiKeyStore, createApiKeyRoutes, isApiKeyToken, validateApiKey, httpMethodToOperation, isOperationAllowed } from "./api-keys/index.js";
|
|
53
|
+
export type { ApiKey, ApiKeyMasked, ApiKeyPermission, ApiKeyWithSecret, CreateApiKeyRequest, UpdateApiKeyRequest, ApiKeyStore, ApiKeyOperation } from "./api-keys/index.js";
|
|
54
|
+
export { createBuiltinAuthAdapter } from "./builtin-auth-adapter.js";
|
|
55
|
+
export type { BuiltinAuthAdapterConfig } from "./builtin-auth-adapter.js";
|
|
56
|
+
export { createCustomAuthAdapter } from "./custom-auth-adapter.js";
|
|
57
|
+
export { createAdapterAuthMiddleware } from "./adapter-middleware.js";
|
|
58
|
+
export type { AdapterAuthMiddlewareOptions } from "./adapter-middleware.js";
|
package/dist/auth/jwt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OAuthProvider } from "./interfaces";
|
|
2
|
-
import { type OAuthCodeFlowPayload } from "./oauth-code-flow";
|
|
1
|
+
import type { OAuthProvider } from "./interfaces.js";
|
|
2
|
+
import { type OAuthCodeFlowPayload } from "./oauth-code-flow.js";
|
|
3
3
|
export interface LinkedinUserInfo {
|
|
4
4
|
linkedinId: string;
|
|
5
5
|
email: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
2
|
+
import type { MiddlewareHandler } from "hono";
|
|
3
|
+
import type { AuthModuleConfig } from "./routes.js";
|
|
4
|
+
import type { ResolvedAuthHooks } from "./auth-hooks.js";
|
|
5
|
+
import type { HonoEnv } from "../api/types.js";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
import type { AuthResponsePayload, TransformAuthResponseContext } from "@rebasepro/types";
|
|
7
8
|
/**
|
|
@@ -29,4 +30,10 @@ export declare function mountMagicLinkRoutes(deps: {
|
|
|
29
30
|
refreshToken: string;
|
|
30
31
|
}>;
|
|
31
32
|
applyTransformHook: (response: AuthResponsePayload, method: TransformAuthResponseContext["method"], request: Request, uid: string) => Promise<AuthResponsePayload>;
|
|
33
|
+
/**
|
|
34
|
+
* Built by the caller so a misconfiguration fails the boot once, rather
|
|
35
|
+
* than being resolved again here. Absent when captcha is off, or when
|
|
36
|
+
* `magicLink` is not among the protected routes.
|
|
37
|
+
*/
|
|
38
|
+
captchaMiddleware?: MiddlewareHandler<HonoEnv>;
|
|
32
39
|
}): void;
|
package/dist/auth/mfa-gate.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
|
-
import type { AuthRepository } from "./interfaces";
|
|
15
|
+
import type { AuthRepository } from "./interfaces.js";
|
|
16
16
|
/** Error code a client watches for to switch a sign-in into its second step. */
|
|
17
17
|
export declare const MFA_REQUIRED_CODE = "MFA_REQUIRED";
|
|
18
18
|
/** Shape carried in `error.details` of an {@link MFA_REQUIRED_CODE} response. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { HonoEnv } from "../api/types";
|
|
4
|
-
import type { AuthModuleConfig } from "./routes";
|
|
5
|
-
import { resolveAuthHooks } from "./auth-hooks";
|
|
3
|
+
import { HonoEnv } from "../api/types.js";
|
|
4
|
+
import type { AuthModuleConfig } from "./routes.js";
|
|
5
|
+
import { resolveAuthHooks } from "./auth-hooks.js";
|
|
6
6
|
import type { AuthResponsePayload, TransformAuthResponseContext } from "@rebasepro/types";
|
|
7
7
|
interface MfaRoutesConfig {
|
|
8
8
|
router: Hono<HonoEnv>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OAuthProvider } from "./interfaces";
|
|
2
|
-
import { type OAuthCodeFlowPayload } from "./oauth-code-flow";
|
|
1
|
+
import type { OAuthProvider } from "./interfaces.js";
|
|
2
|
+
import { type OAuthCodeFlowPayload } from "./oauth-code-flow.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Microsoft / Entra ID (Azure AD) OAuth Provider integration.
|
|
5
5
|
*
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { MiddlewareHandler, Context } from "hono";
|
|
2
|
-
import type { AuthRepository } from "./interfaces";
|
|
2
|
+
import type { AuthRepository } from "./interfaces.js";
|
|
3
3
|
import { DataDriver } from "@rebasepro/types";
|
|
4
|
-
import { AccessTokenPayload } from "./jwt";
|
|
5
|
-
import type { HonoEnv } from "../api/types";
|
|
6
|
-
import type { ApiKeyStore } from "./api-keys/api-key-store";
|
|
7
|
-
import { extractBearerToken } from "./bearer-token";
|
|
4
|
+
import { AccessTokenPayload } from "./jwt.js";
|
|
5
|
+
import type { HonoEnv } from "../api/types.js";
|
|
6
|
+
import type { ApiKeyStore } from "./api-keys/api-key-store.js";
|
|
7
|
+
import { extractBearerToken } from "./bearer-token.js";
|
|
8
8
|
export { extractBearerToken };
|
|
9
9
|
/**
|
|
10
10
|
* Result from a custom auth validator.
|
|
11
11
|
* - `false`/`null`/`undefined` = not authenticated
|
|
12
12
|
* - `true` = authenticated as default user
|
|
13
|
-
* - object with `uid`
|
|
13
|
+
* - object with `uid` = authenticated with user info
|
|
14
14
|
*/
|
|
15
15
|
export type AuthResult = boolean | null | undefined | {
|
|
16
16
|
uid?: string;
|
|
17
|
-
userId?: string;
|
|
18
17
|
roles?: string[];
|
|
19
18
|
[key: string]: unknown;
|
|
20
19
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email one-time codes: six digits, typed in, instead of a link to click.
|
|
3
|
+
*
|
|
4
|
+
* Magic link already logs somebody in from their inbox, and on a desktop it is
|
|
5
|
+
* the better flow. It stops being the better flow the moment the two devices
|
|
6
|
+
* are not the same one: the link opens the session on the phone that has the
|
|
7
|
+
* mail, not on the television, the terminal, or the browser the person is
|
|
8
|
+
* actually sitting in front of. A code crosses that gap because a human carries
|
|
9
|
+
* it.
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* POST /auth/otp { "email": "…" } → always 200
|
|
13
|
+
* POST /auth/otp/verify { "email": "…", "code": "…" } → a session
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## Six digits is a small number, so the shape matters
|
|
17
|
+
*
|
|
18
|
+
* A million possibilities is nothing to a machine, which is why each of these
|
|
19
|
+
* is load-bearing rather than decorative:
|
|
20
|
+
*
|
|
21
|
+
* - **the code is bound to the address.** What is stored is a hash of
|
|
22
|
+
* `otp:<email>:<code>`, so `verify` needs both halves and there is no
|
|
23
|
+
* "guess any valid code in the system" — the search space is one account's,
|
|
24
|
+
* not the deployment's. A lookup keyed on the code alone would make every
|
|
25
|
+
* account in the database a target of the same million guesses;
|
|
26
|
+
* - **attempts are limited per address**, not only per IP. An IP is the
|
|
27
|
+
* attacker's to rotate and the account under attack is not — the same
|
|
28
|
+
* reasoning `mfaVerificationLimiter` is built on, and the same numbers;
|
|
29
|
+
* - **ten minutes**, and single use. The window is what the brute force gets;
|
|
30
|
+
* - **the digits are uniform.** `randomInt` rather than `random() * 1e6` or a
|
|
31
|
+
* modulo of random bytes, both of which make some codes likelier.
|
|
32
|
+
*
|
|
33
|
+
* ## Why it reuses the magic-link token store
|
|
34
|
+
*
|
|
35
|
+
* A one-time code and a magic-link token are the same object: a hashed secret
|
|
36
|
+
* for one account, with an expiry and a used flag. Reusing the store means no
|
|
37
|
+
* schema change, no second cleanup path, and no second place for "was this
|
|
38
|
+
* already used?" to be answered differently. What is hashed differs, and that
|
|
39
|
+
* is the whole difference — a code cannot be presented as a link token because
|
|
40
|
+
* the hash carries `otp:` and the address.
|
|
41
|
+
*/
|
|
42
|
+
import { Hono } from "hono";
|
|
43
|
+
import type { MiddlewareHandler } from "hono";
|
|
44
|
+
import { z } from "zod";
|
|
45
|
+
import type { AuthModuleConfig } from "./routes.js";
|
|
46
|
+
import type { ResolvedAuthHooks } from "./auth-hooks.js";
|
|
47
|
+
import type { HonoEnv } from "../api/types.js";
|
|
48
|
+
import type { AuthResponsePayload, TransformAuthResponseContext } from "@rebasepro/types";
|
|
49
|
+
/** How long a code is good for. */
|
|
50
|
+
export declare const OTP_TTL_MS: number;
|
|
51
|
+
/**
|
|
52
|
+
* A uniformly random code, as a zero-padded string.
|
|
53
|
+
*
|
|
54
|
+
* `randomInt` over the whole range rather than digit-by-digit or a modulo of
|
|
55
|
+
* random bytes: both of those are ways to make some codes likelier than others,
|
|
56
|
+
* and one of them is the classic modulo bias.
|
|
57
|
+
*/
|
|
58
|
+
export declare function generateOtpCode(): string;
|
|
59
|
+
/**
|
|
60
|
+
* What gets hashed and stored.
|
|
61
|
+
*
|
|
62
|
+
* The address is part of the secret, which is what makes `verify` a question
|
|
63
|
+
* about one account rather than about the whole table. Lower-cased and trimmed
|
|
64
|
+
* so that the address the user types matches the one they were mailed at.
|
|
65
|
+
*/
|
|
66
|
+
export declare function otpTokenMaterial(email: string, code: string): string;
|
|
67
|
+
export declare function mountOtpRoutes(deps: {
|
|
68
|
+
router: Hono<HonoEnv>;
|
|
69
|
+
config: AuthModuleConfig;
|
|
70
|
+
ops: ResolvedAuthHooks;
|
|
71
|
+
parseBody: <T>(schema: z.ZodSchema<T>, body: unknown) => T;
|
|
72
|
+
buildAuthResponse: (user: {
|
|
73
|
+
id: string;
|
|
74
|
+
email: string;
|
|
75
|
+
displayName?: string | null;
|
|
76
|
+
photoUrl?: string | null;
|
|
77
|
+
emailVerified?: boolean;
|
|
78
|
+
isAnonymous?: boolean;
|
|
79
|
+
metadata?: Record<string, unknown> | null;
|
|
80
|
+
}, roleIds: string[], accessToken: string, refreshToken: string, providerId: string) => unknown;
|
|
81
|
+
createSessionAndTokens: (uid: string, userAgent: string, ipAddress: string) => Promise<{
|
|
82
|
+
roleIds: string[];
|
|
83
|
+
accessToken: string;
|
|
84
|
+
refreshToken: string;
|
|
85
|
+
}>;
|
|
86
|
+
applyTransformHook: (response: AuthResponsePayload, method: TransformAuthResponseContext["method"], request: Request, uid: string) => Promise<AuthResponsePayload>;
|
|
87
|
+
/** Built by the caller, as for magic link. Absent when captcha is off. */
|
|
88
|
+
captchaMiddleware?: MiddlewareHandler<HonoEnv>;
|
|
89
|
+
}): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MiddlewareHandler } from "hono";
|
|
2
|
-
import { HonoEnv } from "../api/types";
|
|
3
|
-
import { RateLimitStore } from "./rate-limit-store";
|
|
2
|
+
import { HonoEnv } from "../api/types.js";
|
|
3
|
+
import { RateLimitStore } from "./rate-limit-store.js";
|
|
4
4
|
/**
|
|
5
5
|
* Sliding-window rate limiting for Hono.
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AuthAdapter } from "@rebasepro/types";
|
|
2
|
-
import type { RebaseAuthConfig } from "../init";
|
|
2
|
+
import type { RebaseAuthConfig } from "../init.js";
|
|
3
3
|
/**
|
|
4
4
|
* Whether the `auth` config is an `AuthAdapter` (it can verify a request) or a
|
|
5
5
|
* plain `RebaseAuthConfig`. Lives here rather than in `init.ts` so this module
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* 3. Built-in default (send reset email, or generate temp password)
|
|
8
8
|
*/
|
|
9
9
|
import { Hono } from "hono";
|
|
10
|
-
import type { AuthRepository } from "./interfaces";
|
|
11
|
-
import type { AuthHooks } from "./auth-hooks";
|
|
12
|
-
import type { EmailService, EmailConfig } from "../email";
|
|
13
|
-
import type { HonoEnv } from "../api/types";
|
|
10
|
+
import type { AuthRepository } from "./interfaces.js";
|
|
11
|
+
import type { AuthHooks } from "./auth-hooks.js";
|
|
12
|
+
import type { EmailService, EmailConfig } from "../email/index.js";
|
|
13
|
+
import type { HonoEnv } from "../api/types.js";
|
|
14
14
|
import type { AuthCollectionConfig } from "@rebasepro/types";
|
|
15
15
|
export interface ResetPasswordRouteConfig {
|
|
16
16
|
authRepo: AuthRepository;
|
package/dist/auth/routes.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import type { AuthRepository, OAuthProvider } from "./interfaces";
|
|
3
|
-
import type { AuthHooks } from "./auth-hooks";
|
|
4
|
-
import { EmailService, EmailConfig } from "../email";
|
|
5
|
-
import { HonoEnv } from "../api/types";
|
|
2
|
+
import type { AuthRepository, OAuthProvider } from "./interfaces.js";
|
|
3
|
+
import type { AuthHooks } from "./auth-hooks.js";
|
|
4
|
+
import { EmailService, EmailConfig } from "../email/index.js";
|
|
5
|
+
import { HonoEnv } from "../api/types.js";
|
|
6
|
+
import { type CaptchaConfig } from "./captcha.js";
|
|
6
7
|
/**
|
|
7
8
|
* Shared configuration for auth and admin route factories.
|
|
8
9
|
*/
|
|
9
10
|
export interface AuthModuleConfig {
|
|
10
11
|
authRepo: AuthRepository;
|
|
12
|
+
/**
|
|
13
|
+
* Bot protection. Off unless `enabled`.
|
|
14
|
+
*
|
|
15
|
+
* Rate limiting bounds one caller; a botnet of a thousand addresses sending
|
|
16
|
+
* one request each never touches a per-IP window, and `/register` and
|
|
17
|
+
* `/forgot-password` both send mail. See `captcha.ts`.
|
|
18
|
+
*/
|
|
19
|
+
captcha?: CaptchaConfig;
|
|
11
20
|
emailService?: EmailService;
|
|
12
21
|
emailConfig?: EmailConfig;
|
|
13
22
|
/** Allow new user registration (default: false). */
|
|
@@ -40,14 +49,13 @@ export interface AuthModuleConfig {
|
|
|
40
49
|
* verification, lifecycle hooks, etc.
|
|
41
50
|
*/
|
|
42
51
|
authHooks?: AuthHooks;
|
|
43
|
-
/**
|
|
44
|
-
* Callback that checks if bootstrap has already been completed.
|
|
45
|
-
* Used by GET /auth/config to report `needsSetup` status.
|
|
46
|
-
* When not provided, falls back to checking if any users exist.
|
|
47
|
-
*/
|
|
48
|
-
isBootstrapCompleted?: () => Promise<boolean>;
|
|
49
52
|
/** Enable magic link (passwordless email) login. Requires email service. */
|
|
50
53
|
enableMagicLink?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Enable email one-time codes: `POST /auth/otp` and `/auth/otp/verify`.
|
|
56
|
+
* Requires email to be configured, as magic link does.
|
|
57
|
+
*/
|
|
58
|
+
enableEmailOtp?: boolean;
|
|
51
59
|
/**
|
|
52
60
|
* Opt-in httpOnly cookie mode for refresh tokens.
|
|
53
61
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { HonoEnv } from "../api/types";
|
|
4
|
-
import type { AuthModuleConfig } from "./routes";
|
|
3
|
+
import { HonoEnv } from "../api/types.js";
|
|
4
|
+
import type { AuthModuleConfig } from "./routes.js";
|
|
5
5
|
import type { AuthResponsePayload, TransformAuthResponseContext } from "@rebasepro/types";
|
|
6
|
-
import type { resolveAuthHooks } from "./auth-hooks";
|
|
6
|
+
import type { resolveAuthHooks } from "./auth-hooks.js";
|
|
7
7
|
interface SessionRoutesConfig {
|
|
8
8
|
router: Hono<HonoEnv>;
|
|
9
9
|
config: AuthModuleConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OAuthProvider } from "./interfaces";
|
|
2
|
-
import { type OAuthCodeFlowPayload } from "./oauth-code-flow";
|
|
1
|
+
import type { OAuthProvider } from "./interfaces.js";
|
|
2
|
+
import { type OAuthCodeFlowPayload } from "./oauth-code-flow.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Slack OAuth Provider integration (OAuth 2.0 / "Sign in with Slack").
|
|
5
5
|
* Uses the OpenID Connect flow with the "openid,email,profile" scopes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OAuthProvider } from "./interfaces";
|
|
2
|
-
import { type OAuthCodeFlowPayload } from "./oauth-code-flow";
|
|
1
|
+
import type { OAuthProvider } from "./interfaces.js";
|
|
2
|
+
import { type OAuthCodeFlowPayload } from "./oauth-code-flow.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Spotify OAuth Provider integration.
|
|
5
5
|
* Uses the authorization code flow with the "user-read-email" scope.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OAuthProvider } from "./interfaces";
|
|
2
|
-
import { type OAuthCodeFlowPayload } from "./oauth-code-flow";
|
|
1
|
+
import type { OAuthProvider } from "./interfaces.js";
|
|
2
|
+
import { type OAuthCodeFlowPayload } from "./oauth-code-flow.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Twitter/X OAuth 2.0 Provider integration.
|
|
5
5
|
*
|