@rebasepro/server 0.28.2 → 0.29.0

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.
Files changed (113) hide show
  1. package/dist/{GCSStorageController-LXeAF6Ks.js → GCSStorageController-BrIYwK-M.js} +4 -4
  2. package/dist/{GCSStorageController-LXeAF6Ks.js.map → GCSStorageController-BrIYwK-M.js.map} +1 -1
  3. package/dist/{S3StorageController-CVKMUXo_.js → S3StorageController-BD2Y9fAu.js} +4 -4
  4. package/dist/{S3StorageController-CVKMUXo_.js.map → S3StorageController-BD2Y9fAu.js.map} +1 -1
  5. package/dist/{access-BDz4FO9D.js → access-9uIagW6R.js} +7 -7
  6. package/dist/{access-BDz4FO9D.js.map → access-9uIagW6R.js.map} +1 -1
  7. package/dist/api/rest/api-generator.d.ts +19 -0
  8. package/dist/api/rest/query-parser.d.ts +13 -14
  9. package/dist/{ast-schema-editor-C4bDSb61.js → ast-schema-editor-CNfBLvr-.js} +3 -3
  10. package/dist/{ast-schema-editor-C4bDSb61.js.map → ast-schema-editor-CNfBLvr-.js.map} +1 -1
  11. package/dist/auth/cookie-utils.d.ts +14 -6
  12. package/dist/auth/rate-limiter.d.ts +8 -0
  13. package/dist/{auth-CZGfVKcL.js → auth-Crf0K_Ex.js} +78 -18
  14. package/dist/auth-Crf0K_Ex.js.map +1 -0
  15. package/dist/{auth_adapter-B7RUMk6e.js → auth_adapter-HFv5axIT.js} +20 -2
  16. package/dist/auth_adapter-HFv5axIT.js.map +1 -0
  17. package/dist/backend/options.d.ts +3 -0
  18. package/dist/backend-CaG_Jyso.js.map +1 -1
  19. package/dist/{backup-BmzY9xdN.js → backup-Cu1Xss09.js} +9 -9
  20. package/dist/{backup-BmzY9xdN.js.map → backup-Cu1Xss09.js.map} +1 -1
  21. package/dist/boot/driver.d.ts +4 -0
  22. package/dist/boot/sources.d.ts +7 -0
  23. package/dist/{branch-routes-DpgaeTJl.js → branch-routes-XdCv4JwV.js} +3 -3
  24. package/dist/{branch-routes-DpgaeTJl.js.map → branch-routes-XdCv4JwV.js.map} +1 -1
  25. package/dist/{contract-routes-vYiBHbjI.js → contract-routes-Dw-7TPpm.js} +3 -3
  26. package/dist/{contract-routes-vYiBHbjI.js.map → contract-routes-Dw-7TPpm.js.map} +1 -1
  27. package/dist/{cron-loader-C_C-lNgG.js → cron-loader-DIvfKXNc.js} +3 -3
  28. package/dist/{cron-loader-C_C-lNgG.js.map → cron-loader-DIvfKXNc.js.map} +1 -1
  29. package/dist/{cron-routes-DlwOV6zl.js → cron-routes-DU3iiBvf.js} +4 -4
  30. package/dist/{cron-routes-DlwOV6zl.js.map → cron-routes-DU3iiBvf.js.map} +1 -1
  31. package/dist/{cron-scheduler-6ipIm5mm.js → cron-scheduler-BpZ7mPoi.js} +2 -2
  32. package/dist/{cron-scheduler-6ipIm5mm.js.map → cron-scheduler-BpZ7mPoi.js.map} +1 -1
  33. package/dist/{cron-store-KIOM8LCC.js → cron-store-DzgxrJB8.js} +2 -2
  34. package/dist/{cron-store-KIOM8LCC.js.map → cron-store-DzgxrJB8.js.map} +1 -1
  35. package/dist/data_driver-D0mg1Y_x.js.map +1 -1
  36. package/dist/dist-CwBjjwfY.js +19359 -0
  37. package/dist/dist-CwBjjwfY.js.map +1 -0
  38. package/dist/env.d.ts +7 -0
  39. package/dist/{errors-DIWnZIDY.js → errors-DpTMfX77.js} +58 -8
  40. package/dist/errors-DpTMfX77.js.map +1 -0
  41. package/dist/{field-access-KYk8RGOx.js → field-access-wcJeaL5H.js} +3 -3
  42. package/dist/{field-access-KYk8RGOx.js.map → field-access-wcJeaL5H.js.map} +1 -1
  43. package/dist/{filter-dialect-CE4bloug.js → filter-dialect-FFhZoNGh.js} +110 -9
  44. package/dist/filter-dialect-FFhZoNGh.js.map +1 -0
  45. package/dist/{function-loader-CKB9b4uP.js → function-loader-BzKo2Oiu.js} +2 -2
  46. package/dist/{function-loader-CKB9b4uP.js.map → function-loader-BzKo2Oiu.js.map} +1 -1
  47. package/dist/{function-routes-DLaXaiQA.js → function-routes-CQ0z3WDt.js} +2 -2
  48. package/dist/{function-routes-DLaXaiQA.js.map → function-routes-CQ0z3WDt.js.map} +1 -1
  49. package/dist/functions/index.d.ts +1 -0
  50. package/dist/functions/index.js +10 -29
  51. package/dist/functions/index.js.map +1 -1
  52. package/dist/functions/wait-until.d.ts +29 -1
  53. package/dist/{history-recorder-BE4HWR-M.js → history-recorder-B1j5i1ZT.js} +2 -2
  54. package/dist/{history-recorder-BE4HWR-M.js.map → history-recorder-B1j5i1ZT.js.map} +1 -1
  55. package/dist/index.d.ts +4 -1
  56. package/dist/index.es.js +2303 -1300
  57. package/dist/index.es.js.map +1 -1
  58. package/dist/init/surfaces.d.ts +19 -3
  59. package/dist/jobs/job-queue.d.ts +10 -0
  60. package/dist/{jobs-CXTs9qXH.js → jobs-CzFPOfp1.js} +4 -3
  61. package/dist/jobs-CzFPOfp1.js.map +1 -0
  62. package/dist/{jwt-5EvX3lQa.js → jwt-GIOW5uNd.js} +2 -2
  63. package/dist/{jwt-5EvX3lQa.js.map → jwt-GIOW5uNd.js.map} +1 -1
  64. package/dist/{keys-DJ1ZNcZi.js → keys-eRFGbaeH.js} +2 -2
  65. package/dist/{keys-DJ1ZNcZi.js.map → keys-eRFGbaeH.js.map} +1 -1
  66. package/dist/{logs-routes-DXLvMasE.js → logs-routes-08LiyYua.js} +2 -2
  67. package/dist/{logs-routes-DXLvMasE.js.map → logs-routes-08LiyYua.js.map} +1 -1
  68. package/dist/mcp/consent-page.d.ts +14 -1
  69. package/dist/mcp/mcp-apps.d.ts +51 -17
  70. package/dist/mcp/mcp-routes.d.ts +6 -1
  71. package/dist/mcp/mcp-tools.d.ts +44 -1
  72. package/dist/mcp/mcp-view.d.ts +107 -0
  73. package/dist/mcp/oauth-metadata.d.ts +7 -1
  74. package/dist/mcp/show-app-guide.d.ts +1 -0
  75. package/dist/metrics/database.d.ts +69 -0
  76. package/dist/metrics/db-connection-errors.d.ts +21 -0
  77. package/dist/{offline-BjJdcVBb-BOzzsnrh.js → offline-Cy6woFyt-CTjHURuZ.js} +14 -5
  78. package/dist/offline-Cy6woFyt-CTjHURuZ.js.map +1 -0
  79. package/dist/{offline-store-Cxhh99Q--FB6fSf5A.js → offline-store-C2Sy3Kwl-DFw34Y50.js} +17 -7
  80. package/dist/offline-store-C2Sy3Kwl-DFw34Y50.js.map +1 -0
  81. package/dist/{openapi-generator-B6aw_KuR.js → openapi-generator-CzvnvC53.js} +5 -5
  82. package/dist/{openapi-generator-B6aw_KuR.js.map → openapi-generator-CzvnvC53.js.map} +1 -1
  83. package/dist/{proxy-2nS5N63I.js → proxy-LUsudeht.js} +2 -2
  84. package/dist/{proxy-2nS5N63I.js.map → proxy-LUsudeht.js.map} +1 -1
  85. package/dist/{query-parser-DFVCjW5i.js → query-parser-B0HJPjPt.js} +137 -31
  86. package/dist/query-parser-B0HJPjPt.js.map +1 -0
  87. package/dist/{request-timeout-Cqm4JXtZ.js → request-timeout-DW2OBWfJ.js} +2 -2
  88. package/dist/{request-timeout-Cqm4JXtZ.js.map → request-timeout-DW2OBWfJ.js.map} +1 -1
  89. package/dist/{rls-simulator-routes-D5-XfjzW.js → rls-simulator-routes-77UrbME2.js} +4 -4
  90. package/dist/{rls-simulator-routes-D5-XfjzW.js.map → rls-simulator-routes-77UrbME2.js.map} +1 -1
  91. package/dist/{schema-editor-routes-DzSe6V0a.js → schema-editor-routes-MSrmYTCh.js} +4 -4
  92. package/dist/{schema-editor-routes-DzSe6V0a.js.map → schema-editor-routes-MSrmYTCh.js.map} +1 -1
  93. package/dist/serve-spa.d.ts +2 -10
  94. package/dist/{soft-delete-params-9lKBAlDw.js → soft-delete-params-DDRmxT2z.js} +2 -2
  95. package/dist/{soft-delete-params-9lKBAlDw.js.map → soft-delete-params-DDRmxT2z.js.map} +1 -1
  96. package/dist/{sql-export-routes-BxMqgAFX.js → sql-export-routes-DAeT_WVm.js} +3 -3
  97. package/dist/{sql-export-routes-BxMqgAFX.js.map → sql-export-routes-DAeT_WVm.js.map} +1 -1
  98. package/dist/{src-JQNz7cWv.js → src-DwcwNTsc.js} +12 -3
  99. package/dist/src-DwcwNTsc.js.map +1 -0
  100. package/dist/{upload-validation-IYXn4xcm.js → upload-validation-B-psYLaN.js} +2 -2
  101. package/dist/{upload-validation-IYXn4xcm.js.map → upload-validation-B-psYLaN.js.map} +1 -1
  102. package/package.json +5 -5
  103. package/dist/auth-CZGfVKcL.js.map +0 -1
  104. package/dist/auth_adapter-B7RUMk6e.js.map +0 -1
  105. package/dist/dist-CT9HJehq.js +0 -22
  106. package/dist/dist-CT9HJehq.js.map +0 -1
  107. package/dist/errors-DIWnZIDY.js.map +0 -1
  108. package/dist/filter-dialect-CE4bloug.js.map +0 -1
  109. package/dist/jobs-CXTs9qXH.js.map +0 -1
  110. package/dist/offline-BjJdcVBb-BOzzsnrh.js.map +0 -1
  111. package/dist/offline-store-Cxhh99Q--FB6fSf5A.js.map +0 -1
  112. package/dist/query-parser-DFVCjW5i.js.map +0 -1
  113. package/dist/src-JQNz7cWv.js.map +0 -1
@@ -3,18 +3,19 @@ import __rebaseProcess from "process";
3
3
  globalThis.process ??= __rebaseProcess;
4
4
  __rebaseCreateRequire(import.meta.url);
5
5
  import { i as __toESM, n as __exportAll } from "./rolldown-runtime-dW7B1o5h.js";
6
- import { V as rewriteLegacyRlsFunctions, _ as scopesBeyond, a as KEY_MANAGEMENT_SCOPES, f as knownScopes, l as isAdminScope, m as roleNameProblem, o as SCOPE_TARGETS, p as parseScope, s as hasAdminRole, u as isBuiltInScope, x as validateScopes, y as summarizeRoles } from "./src-JQNz7cWv.js";
6
+ import { V as rewriteLegacyRlsFunctions, W as isPostgresCollectionConfig, _ as scopesBeyond, a as KEY_MANAGEMENT_SCOPES, f as knownScopes, l as isAdminScope, m as roleNameProblem, o as SCOPE_TARGETS, p as parseScope, s as hasAdminRole, u as isBuiltInScope, x as validateScopes, y as summarizeRoles } from "./src-DwcwNTsc.js";
7
7
  import { n as isAnonymousUid, r as policy, t as ANONYMOUS_USER_ID } from "./policy-PdzX-Opd.js";
8
8
  import { n as isSQLAdmin } from "./backend-CaG_Jyso.js";
9
- import { $ as accessTokenRefusalError, C as queryTokenAuth, E as requireAuth, G as isApiKeyToken, J as extractBearerToken, K as resolveApiKey, L as applySimulation, P as applyImpersonation, T as requireAdmin, X as SERVICE_IDENTITY, Y as safeCompare, Z as scopeDataDriver, _ as createAuthMiddleware, a as assertMayManageAccount, at as httpMethodToOperation, b as fileTokenAuth, c as configureAccess, f as processAccessControl, h as requireScopeByMethod, i as assertMayGrantRoles, l as getAccessModel, m as requireScope, n as accessModelFromCollections, nt as replaceUserPassword, o as callerIsAdmin, p as readRoleNames, q as validateApiKey, r as accessOf, rt as revokeAllSessions, s as callerScopes, t as AccessModelError, tt as judgeAccessToken, u as hasScope, v as createRequireAuth, w as refuse, x as optionalAuth, y as extractUserFromToken } from "./access-BDz4FO9D.js";
9
+ import { t as AUTH_FLOW_HEADER } from "./auth_adapter-HFv5axIT.js";
10
+ import { $ as accessTokenRefusalError, C as queryTokenAuth, E as requireAuth, G as isApiKeyToken, J as extractBearerToken, K as resolveApiKey, L as applySimulation, P as applyImpersonation, T as requireAdmin, X as SERVICE_IDENTITY, Y as safeCompare, Z as scopeDataDriver, _ as createAuthMiddleware, a as assertMayManageAccount, at as httpMethodToOperation, b as fileTokenAuth, c as configureAccess, f as processAccessControl, h as requireScopeByMethod, i as assertMayGrantRoles, l as getAccessModel, m as requireScope, n as accessModelFromCollections, nt as replaceUserPassword, o as callerIsAdmin, p as readRoleNames, q as validateApiKey, r as accessOf, rt as revokeAllSessions, s as callerScopes, t as AccessModelError, tt as judgeAccessToken, u as hasScope, v as createRequireAuth, w as refuse, x as optionalAuth, y as extractUserFromToken } from "./access-9uIagW6R.js";
11
+ import { a as resolveListLimitParam } from "./query-parser-B0HJPjPt.js";
10
12
  import { a as logger } from "./logger-SigQ2oZJ.js";
11
13
  import { r as toSnakeCase } from "./strings.es-B7QLnHh2.js";
12
14
  import { n as REBASE_USER_ROLE, r as revokeInternalTableSql } from "./internal-tables-CRaBxJeE.js";
13
15
  import { t as firstSqlRow } from "./sql-rows-C6GEc2oE.js";
14
- import { a as resolveListLimitParam } from "./query-parser-DFVCjW5i.js";
15
- import { _ as verifyAccessToken, a as generateAccessToken, c as getAccessTokenExpiry, d as hasAsymmetricSigningKey, f as hashRefreshToken, h as processJwtService, i as customClaimsOf, l as getJwks, m as jwtOf, n as configureJwt, o as generateDownloadToken, p as isJwtConfigured, s as generateRefreshToken, t as MAX_COOKIE_AGE_MS, u as getRefreshTokenExpiry, v as verifyDownloadToken, w as randomInt$1, x as require_jsonwebtoken } from "./jwt-5EvX3lQa.js";
16
+ import { _ as verifyAccessToken, a as generateAccessToken, c as getAccessTokenExpiry, d as hasAsymmetricSigningKey, f as hashRefreshToken, h as processJwtService, i as customClaimsOf, l as getJwks, m as jwtOf, n as configureJwt, o as generateDownloadToken, p as isJwtConfigured, s as generateRefreshToken, t as MAX_COOKIE_AGE_MS, u as getRefreshTokenExpiry, v as verifyDownloadToken, w as randomInt$1, x as require_jsonwebtoken } from "./jwt-GIOW5uNd.js";
16
17
  import { c as provisioningExec, n as SchemaChangeRefusedError, r as createDdlBootstrapper } from "./ddl-bootstrap-DhCuwhHM.js";
17
- import { a as isDataException, c as warnIfDatabaseClosed, i as errorHandler, o as isDatabaseUnreachable, r as declaredErrorAnswer, t as ApiError } from "./errors-DIWnZIDY.js";
18
+ import { a as isDataException, i as errorHandler, l as warnIfDatabaseClosed, o as isDatabaseUnreachable, r as declaredErrorAnswer, t as ApiError } from "./errors-DpTMfX77.js";
18
19
  import { createHash, randomBytes, randomInt } from "node:crypto";
19
20
  import { Hono } from "hono";
20
21
  import { promisify } from "util";
@@ -515,6 +516,14 @@ function resolveTriState(value, onUnknown) {
515
516
  function checkOperation(collection, authContext, entity, targetOperation, options) {
516
517
  const onUnknown = options?.onUnknown ?? "allow";
517
518
  const clauses = options?.clauses ?? "both";
519
+ const view = isPostgresCollectionConfig(collection) ? collection.view : void 0;
520
+ if (view) {
521
+ if (targetOperation !== "select") return false;
522
+ if (view.materialized) {
523
+ const allowed = view.roles ?? ["admin"];
524
+ if (!(authContext.user?.roles ?? []).map((role) => typeof role === "string" ? role : String(role.id ?? role)).some((role) => allowed.includes(role))) return false;
525
+ }
526
+ }
518
527
  const securityRules = collection.securityRules;
519
528
  if (!securityRules || securityRules.length === 0) return true;
520
529
  const applicableRules = securityRules.filter((r) => ruleApplies(r, targetOperation));
@@ -864,7 +873,7 @@ var styles = {
864
873
  `),
865
874
  button: raw(`
866
875
  display: inline-block;
867
- background-color: #3b82f6;
876
+ background-color: #0070f4;
868
877
  color: #ffffff;
869
878
  font-size: 16px;
870
879
  font-weight: 600;
@@ -1021,7 +1030,7 @@ function getPasswordResetTemplate(resetUrl, user, appName = DEFAULT_APP_NAME, lo
1021
1030
  <p style="${styles.paragraph}">
1022
1031
  Or copy and paste this link into your browser:
1023
1032
  </p>
1024
- <p style="color: #3b82f6; word-break: break-all; font-size: 14px;">
1033
+ <p style="color: #0070f4; word-break: break-all; font-size: 14px;">
1025
1034
  ${resetUrl}
1026
1035
  </p>
1027
1036
 
@@ -1096,7 +1105,7 @@ function getEmailVerificationTemplate(verifyUrl, user, appName = DEFAULT_APP_NAM
1096
1105
  <p style="${styles.paragraph}">
1097
1106
  Or copy and paste this link into your browser:
1098
1107
  </p>
1099
- <p style="color: #3b82f6; word-break: break-all; font-size: 14px;">
1108
+ <p style="color: #0070f4; word-break: break-all; font-size: 14px;">
1100
1109
  ${verifyUrl}
1101
1110
  </p>
1102
1111
 
@@ -1172,7 +1181,7 @@ function getUserInvitationTemplate(setPasswordUrl, user, appName = DEFAULT_APP_N
1172
1181
  <p style="${styles.paragraph}">
1173
1182
  Or copy and paste this link into your browser:
1174
1183
  </p>
1175
- <p style="color: #3b82f6; word-break: break-all; font-size: 14px;">
1184
+ <p style="color: #0070f4; word-break: break-all; font-size: 14px;">
1176
1185
  ${setPasswordUrl}
1177
1186
  </p>
1178
1187
 
@@ -1381,7 +1390,7 @@ function getMagicLinkTemplate(magicLinkUrl, user, appName = DEFAULT_APP_NAME, lo
1381
1390
  <p style="${styles.paragraph}">
1382
1391
  Or copy and paste this link into your browser:
1383
1392
  </p>
1384
- <p style="color: #3b82f6; word-break: break-all; font-size: 14px;">
1393
+ <p style="color: #0070f4; word-break: break-all; font-size: 14px;">
1385
1394
  ${magicLinkUrl}
1386
1395
  </p>
1387
1396
 
@@ -1460,7 +1469,7 @@ function getEmailChangeTemplate(confirmUrl, user, newEmail, appName = DEFAULT_AP
1460
1469
  <p style="${styles.paragraph}">
1461
1470
  Or copy and paste this link into your browser:
1462
1471
  </p>
1463
- <p style="color: #3b82f6; word-break: break-all; font-size: 14px;">
1472
+ <p style="color: #0070f4; word-break: break-all; font-size: 14px;">
1464
1473
  ${confirmUrl}
1465
1474
  </p>
1466
1475
 
@@ -2782,6 +2791,19 @@ var DEFAULT_AUTH_LIMIT = {
2782
2791
  };
2783
2792
  var defaultAuthLimiter = createRateLimiter(DEFAULT_AUTH_LIMIT);
2784
2793
  /**
2794
+ * `GET /auth/config`: what the login screen offers, read on every page load
2795
+ * (twice, by the admin app) before anyone has signed in. It is public and
2796
+ * non-secret, so it gets its own bucket — counted in the login budget, a
2797
+ * hundred page loads from one office address locked everyone there out of
2798
+ * signing in. Bounded still, only far above what browsing can reach.
2799
+ */
2800
+ var AUTH_CONFIG_LIMIT = {
2801
+ name: "auth-config",
2802
+ windowMs: 900 * 1e3,
2803
+ limit: 3e3,
2804
+ message: "Too many requests, please try again later."
2805
+ };
2806
+ /**
2785
2807
  * Pre-configured strict rate limiter for sensitive endpoints (password reset, verification).
2786
2808
  * 50 requests per 15 minutes per IP.
2787
2809
  */
@@ -3509,9 +3531,42 @@ function getCookieSettings(config) {
3509
3531
  };
3510
3532
  }
3511
3533
  /**
3534
+ * Whether the request asks for the refresh token in the body
3535
+ * (`x-rebase-auth-flow: json`): a client with no cookie jar, or one keeping a
3536
+ * sign-in apart from the page's cookie session.
3537
+ */
3538
+ function requestsJsonFlow(c) {
3539
+ return c.req.header(AUTH_FLOW_HEADER)?.trim().toLowerCase() === "json";
3540
+ }
3541
+ /**
3542
+ * The cookie settings that apply to this request: the server's, or none when
3543
+ * the request asks for the json flow.
3544
+ *
3545
+ * A json-flow request is answered exactly as a server without `cookieAuth`
3546
+ * answers it. The refresh token is read from the request body and returned in
3547
+ * the response body; the cookie is never read, set or cleared. That is what
3548
+ * keeps the exemption safe:
3549
+ *
3550
+ * - The cookie is the only credential a browser attaches by itself, and a
3551
+ * json-flow request never reads it. Nothing it does can be forged across
3552
+ * sites, and a cookie the page's script cannot read is never rotated into a
3553
+ * token handed back in a body it can. The cookie path is unchanged.
3554
+ * - Every other credential a token-issuing route takes is in the request
3555
+ * itself — a password, a code, the token in the body, a bearer access
3556
+ * token — so whoever sends it already holds what the body token gives. A
3557
+ * bearer access token already reaches a durable sign-in on its own: it can
3558
+ * link a provider identity its holder controls.
3559
+ * - The header is not a CORS-safelisted one, so a cross-site page cannot
3560
+ * send it without a preflight the server's CORS policy answers.
3561
+ */
3562
+ function cookieConfigFor(c, config) {
3563
+ return config && !requestsJsonFlow(c) ? config : void 0;
3564
+ }
3565
+ /**
3512
3566
  * Set the refresh token as an httpOnly cookie on the response.
3513
3567
  */
3514
- function setRefreshCookie(c, refreshToken, config) {
3568
+ function setRefreshCookie(c, refreshToken, cookieAuth) {
3569
+ const config = cookieConfigFor(c, cookieAuth);
3515
3570
  if (!config) return;
3516
3571
  const settings = getCookieSettings(config);
3517
3572
  const isSecure = settings.secure ?? true;
@@ -3525,7 +3580,8 @@ function setRefreshCookie(c, refreshToken, config) {
3525
3580
  /**
3526
3581
  * Clear the refresh token cookie.
3527
3582
  */
3528
- function clearRefreshCookie(c, config) {
3583
+ function clearRefreshCookie(c, cookieAuth) {
3584
+ const config = cookieConfigFor(c, cookieAuth);
3529
3585
  if (!config) return;
3530
3586
  const settings = getCookieSettings(config);
3531
3587
  let cookie = `${settings.name}=; Path=${settings.path}; HttpOnly; SameSite=${settings.sameSite}; Max-Age=0`;
@@ -3535,6 +3591,7 @@ function clearRefreshCookie(c, config) {
3535
3591
  }
3536
3592
  /**
3537
3593
  * Read the refresh token from the request — cookie first, then body fallback.
3594
+ * A json-flow request is read from the body alone (see `cookieConfigFor`).
3538
3595
  *
3539
3596
  * An empty string is no token, wherever it comes from. In cookie mode every
3540
3597
  * response this server sends carries `refreshToken: ""` (see
@@ -3543,7 +3600,8 @@ function clearRefreshCookie(c, config) {
3543
3600
  * body's `""` as the token, or refusing it at the schema, kept the cookie
3544
3601
  * beside it from ever being read.
3545
3602
  */
3546
- function readRefreshToken(c, body, config) {
3603
+ function readRefreshToken(c, body, cookieAuth) {
3604
+ const config = cookieConfigFor(c, cookieAuth);
3547
3605
  if (config) {
3548
3606
  const settings = getCookieSettings(config);
3549
3607
  const cookieHeader = c.req.header("cookie") || "";
@@ -3577,9 +3635,11 @@ function decodeCookieValue(value) {
3577
3635
  }
3578
3636
  }
3579
3637
  /**
3580
- * Redact the refresh token from the response body when cookie mode is active.
3638
+ * Redact the refresh token from the response body when cookie mode is active
3639
+ * for this request (not for a json-flow one: see `cookieConfigFor`).
3581
3640
  */
3582
- function redactRefreshToken(response, c, refreshToken, config) {
3641
+ function redactRefreshToken(response, c, refreshToken, cookieAuth) {
3642
+ const config = cookieConfigFor(c, cookieAuth);
3583
3643
  if (!config) return response;
3584
3644
  setRefreshCookie(c, refreshToken, config);
3585
3645
  return {
@@ -8971,6 +9031,6 @@ var auth_exports = /* @__PURE__ */ __exportAll({
8971
9031
  verifyPassword: () => verifyPassword
8972
9032
  });
8973
9033
  //#endregion
8974
- export { getEmailChangeTemplate as $, createDataRateLimiter as A, SMTPEmailService as B, createJwksRoutes as C, DEFAULT_FUNCTIONS_ANONYMOUS_LIMIT as D, isBootstrapWindowOpen as E, clearActiveDevEmailSink as F, verifyPassword as G, resolveAuthHooks as H, createDevEmailSink as I, completeUserCreation as J, adapterRefusal as K, devEmailSinkFor as L, setSharedRateLimitStore as M, MemoryRateLimitStore as N, createAuthLimiters as O, activeDevEmailSink as P, getEmailChangeNoticeTemplate as Q, extractLinks as R, createApiKeyStore as S, configureUserPicking as T, hashPassword as U, createEmailService as V, validatePasswordStrength as W, assertEmailLinkBases as X, generateSecurePassword as Y, resolveEmailLinkBase as Z, oauthCodeFlowSchema as _, createBitbucketProvider as a, getWelcomeEmailTemplate as at, createApiKeyRoutes as b, createTwitterProvider as c, escapeHtml as ct, createMicrosoftProvider as d, createSqlRateLimitStore as dt, getEmailOtpTemplate as et, tryVerifyOidcIdToken as f, resolveRateLimitStoreKind as ft, createGoogleProvider as g, createLinkedinProvider as h, createSlackProvider as i, getUserInvitationTemplate as it, createRateLimiter as j, createDataRateLimitCheck as k, createFacebookProvider as l, html as lt, createGitHubProvider as m, createCustomAuthAdapter as n, getMagicLinkTemplate as nt, createGitLabProvider as o, resolveEmailBranding as ot, verifyOidcIdToken as p, securityRuleToConditions as pt, createAdapterAuthMiddleware as q, createSpotifyProvider as r, getPasswordResetTemplate as rt, createDiscordProvider as s, RawHtml as st, auth_exports as t, getEmailVerificationTemplate as tt, createAppleProvider as u, raw as ut, pkceTokenParams as v, createBuiltinAuthAdapter as w, createPersonalKeyRoutes as x, providerVerifiedEmail as y, registerDevEmailSink as z };
9034
+ export { getEmailChangeNoticeTemplate as $, createDataRateLimitCheck as A, registerDevEmailSink as B, createJwksRoutes as C, AUTH_CONFIG_LIMIT as D, isBootstrapWindowOpen as E, activeDevEmailSink as F, validatePasswordStrength as G, createEmailService as H, clearActiveDevEmailSink as I, createAdapterAuthMiddleware as J, verifyPassword as K, createDevEmailSink as L, createRateLimiter as M, setSharedRateLimitStore as N, DEFAULT_FUNCTIONS_ANONYMOUS_LIMIT as O, MemoryRateLimitStore as P, resolveEmailLinkBase as Q, devEmailSinkFor as R, createApiKeyStore as S, configureUserPicking as T, resolveAuthHooks as U, SMTPEmailService as V, hashPassword as W, generateSecurePassword as X, completeUserCreation as Y, assertEmailLinkBases as Z, oauthCodeFlowSchema as _, createBitbucketProvider as a, getUserInvitationTemplate as at, createApiKeyRoutes as b, createTwitterProvider as c, RawHtml as ct, createMicrosoftProvider as d, raw as dt, getEmailChangeTemplate as et, tryVerifyOidcIdToken as f, createSqlRateLimitStore as ft, createGoogleProvider as g, createLinkedinProvider as h, createSlackProvider as i, getPasswordResetTemplate as it, createDataRateLimiter as j, createAuthLimiters as k, createFacebookProvider as l, escapeHtml as lt, createGitHubProvider as m, securityRuleToConditions as mt, createCustomAuthAdapter as n, getEmailVerificationTemplate as nt, createGitLabProvider as o, getWelcomeEmailTemplate as ot, verifyOidcIdToken as p, resolveRateLimitStoreKind as pt, adapterRefusal as q, createSpotifyProvider as r, getMagicLinkTemplate as rt, createDiscordProvider as s, resolveEmailBranding as st, auth_exports as t, getEmailOtpTemplate as tt, createAppleProvider as u, html as ut, pkceTokenParams as v, createBuiltinAuthAdapter as w, createPersonalKeyRoutes as x, providerVerifiedEmail as y, extractLinks as z };
8975
9035
 
8976
- //# sourceMappingURL=auth-CZGfVKcL.js.map
9036
+ //# sourceMappingURL=auth-Crf0K_Ex.js.map