@rebasepro/server 0.22.0 → 0.24.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 (211) hide show
  1. package/README.md +1 -1
  2. package/bin/rebase-server.js +4 -2
  3. package/dist/{GCSStorageController-CLIJXwGS.js → GCSStorageController-BSiP1c-f.js} +57 -29
  4. package/dist/GCSStorageController-BSiP1c-f.js.map +1 -0
  5. package/dist/{S3StorageController-Dcuf8lMA.js → S3StorageController-CAwFRgjV.js} +19 -7
  6. package/dist/S3StorageController-CAwFRgjV.js.map +1 -0
  7. package/dist/api/ast-schema-editor.d.ts +127 -1
  8. package/dist/api/errors.d.ts +9 -0
  9. package/dist/api/live-schema-routes.d.ts +52 -8
  10. package/dist/api/logs-routes.d.ts +39 -1
  11. package/dist/api/openapi-generator.d.ts +17 -0
  12. package/dist/api/rest/api-generator.d.ts +158 -42
  13. package/dist/api/rest/auth-collection-writes.d.ts +85 -0
  14. package/dist/api/rest/field-access-query.d.ts +6 -2
  15. package/dist/api/rest/idempotency.d.ts +7 -1
  16. package/dist/api/rest/nested-write-access.d.ts +46 -0
  17. package/dist/api/rest/write-validation.d.ts +34 -2
  18. package/dist/api/types.d.ts +17 -1
  19. package/dist/{ast-schema-editor-CslO8Oje.js → ast-schema-editor-CWqS_sLJ.js} +411 -13
  20. package/dist/ast-schema-editor-CWqS_sLJ.js.map +1 -0
  21. package/dist/auth/access.d.ts +105 -0
  22. package/dist/auth/adapter-middleware.d.ts +2 -1
  23. package/dist/auth/address-ownership.d.ts +68 -0
  24. package/dist/auth/admin-roles-route.d.ts +4 -2
  25. package/dist/auth/admin-roles.d.ts +17 -20
  26. package/dist/auth/admin-user-ops.d.ts +35 -2
  27. package/dist/auth/admin-users-route.d.ts +1 -0
  28. package/dist/auth/api-keys/api-key-middleware.d.ts +56 -55
  29. package/dist/auth/api-keys/api-key-routes.d.ts +41 -11
  30. package/dist/auth/api-keys/api-key-store.d.ts +31 -8
  31. package/dist/auth/api-keys/api-key-types.d.ts +14 -16
  32. package/dist/auth/api-keys/http-operation.d.ts +19 -0
  33. package/dist/auth/api-keys/index.d.ts +11 -11
  34. package/dist/auth/api-keys/key-grant.d.ts +41 -0
  35. package/dist/auth/api-keys/legacy-permissions.d.ts +33 -0
  36. package/dist/auth/auth-hooks.d.ts +50 -7
  37. package/dist/auth/builtin-auth-adapter.d.ts +8 -0
  38. package/dist/auth/captcha.d.ts +5 -0
  39. package/dist/auth/cookie-utils.d.ts +7 -0
  40. package/dist/auth/deliverable-address.d.ts +6 -0
  41. package/dist/auth/email-change-routes.d.ts +41 -0
  42. package/dist/auth/expired-token-sweep.d.ts +67 -0
  43. package/dist/auth/impersonation.d.ts +110 -0
  44. package/dist/auth/index.d.ts +4 -2
  45. package/dist/auth/interfaces.d.ts +146 -65
  46. package/dist/auth/jwt.d.ts +66 -3
  47. package/dist/auth/magic-link-routes.d.ts +2 -6
  48. package/dist/auth/mfa-routes.d.ts +2 -9
  49. package/dist/auth/middleware.d.ts +17 -5
  50. package/dist/auth/oauth-signin-policy.d.ts +25 -8
  51. package/dist/auth/otp-routes.d.ts +2 -6
  52. package/dist/auth/passwordless-signup.d.ts +27 -0
  53. package/dist/auth/platform-token.d.ts +122 -0
  54. package/dist/auth/rate-limiter.d.ts +72 -1
  55. package/dist/auth/routes.d.ts +45 -0
  56. package/dist/auth/scope-routes.d.ts +22 -0
  57. package/dist/auth/session-routes.d.ts +18 -6
  58. package/dist/auth/token-revocation.d.ts +53 -1
  59. package/dist/auth/verify-credential.d.ts +28 -0
  60. package/dist/{auth-CCDpk2rn.js → auth-DMLngxn_.js} +2712 -711
  61. package/dist/auth-DMLngxn_.js.map +1 -0
  62. package/dist/backend-DTAOsLQc.js +30 -0
  63. package/dist/backend-DTAOsLQc.js.map +1 -0
  64. package/dist/backup/backup-common.d.ts +29 -0
  65. package/dist/backup/backup-routes.d.ts +24 -4
  66. package/dist/backup/backup-schedule.d.ts +33 -0
  67. package/dist/backup/backup-storage.d.ts +14 -0
  68. package/dist/backup/index.d.ts +2 -0
  69. package/dist/backup-CN0s50D2.js +444 -0
  70. package/dist/backup-CN0s50D2.js.map +1 -0
  71. package/dist/boot/bundle.d.ts +19 -0
  72. package/dist/boot/driver.d.ts +10 -0
  73. package/dist/boot/env.d.ts +51 -6
  74. package/dist/boot/fetch-bundle.d.ts +18 -1
  75. package/dist/boot/rls-audit-option.d.ts +26 -0
  76. package/dist/boot/security-headers.d.ts +26 -0
  77. package/dist/boot/sources.d.ts +1 -0
  78. package/dist/boot/static-routing.d.ts +56 -0
  79. package/dist/collection_patch-BRu-BvDv.js +472 -0
  80. package/dist/collection_patch-BRu-BvDv.js.map +1 -0
  81. package/dist/{contract-routes-eLxV0le1.js → contract-routes-fz8i4pxs.js} +17 -4
  82. package/dist/contract-routes-fz8i4pxs.js.map +1 -0
  83. package/dist/cron/cron-routes.d.ts +7 -2
  84. package/dist/cron/cron-scheduler.d.ts +146 -21
  85. package/dist/cron/cron-store.d.ts +76 -8
  86. package/dist/cron/index.d.ts +1 -1
  87. package/dist/{cron-loader-CQjvjpEw.js → cron-loader-CwaANlOG.js} +4 -4
  88. package/dist/cron-loader-CwaANlOG.js.map +1 -0
  89. package/dist/cron-routes-Bc-SB0Se.js +96 -0
  90. package/dist/cron-routes-Bc-SB0Se.js.map +1 -0
  91. package/dist/{cron-scheduler-COPQxlEq.js → cron-scheduler-CYQgco86.js} +427 -83
  92. package/dist/cron-scheduler-CYQgco86.js.map +1 -0
  93. package/dist/{cron-store-BYGZFNWk.js → cron-store-D2Q9-Aco.js} +139 -23
  94. package/dist/cron-store-D2Q9-Aco.js.map +1 -0
  95. package/dist/{ddl-bootstrap-CfNvxMuK.js → ddl-bootstrap-BaqMSa4Y.js} +3 -26
  96. package/dist/ddl-bootstrap-BaqMSa4Y.js.map +1 -0
  97. package/dist/email/index.d.ts +2 -2
  98. package/dist/email/link-base.d.ts +5 -4
  99. package/dist/email/smtp-email-service.d.ts +13 -1
  100. package/dist/email/templates.d.ts +31 -0
  101. package/dist/email/types.d.ts +29 -2
  102. package/dist/env.d.ts +25 -7
  103. package/dist/{errors-DWsX4yTd.js → errors-D6_y86c5.js} +102 -8
  104. package/dist/errors-D6_y86c5.js.map +1 -0
  105. package/dist/{function-loader-xnbDAPfa.js → function-loader-D7o5Epjj.js} +2 -2
  106. package/dist/{function-loader-xnbDAPfa.js.map → function-loader-D7o5Epjj.js.map} +1 -1
  107. package/dist/{function-routes-Chet4-lB.js → function-routes-CaNG4waN.js} +24 -12
  108. package/dist/function-routes-CaNG4waN.js.map +1 -0
  109. package/dist/functions/context.d.ts +17 -6
  110. package/dist/functions/guards.d.ts +22 -5
  111. package/dist/functions/index.d.ts +2 -2
  112. package/dist/functions/index.js +90 -36
  113. package/dist/functions/index.js.map +1 -1
  114. package/dist/{history-recorder-BQmB0P_j.js → history-recorder-Nr8zLvoU.js} +9 -7
  115. package/dist/history-recorder-Nr8zLvoU.js.map +1 -0
  116. package/dist/{history-store-CetkrBBD.js → history-store-rcAm_xFR.js} +2 -2
  117. package/dist/{history-store-CetkrBBD.js.map → history-store-rcAm_xFR.js.map} +1 -1
  118. package/dist/index.d.ts +14 -4
  119. package/dist/index.es.js +5733 -1551
  120. package/dist/index.es.js.map +1 -1
  121. package/dist/init/docs.d.ts +5 -2
  122. package/dist/init/health.d.ts +17 -2
  123. package/dist/init/shutdown.d.ts +18 -3
  124. package/dist/init.d.ts +54 -0
  125. package/dist/jobs/index.d.ts +2 -2
  126. package/dist/jobs/job-queue.d.ts +23 -2
  127. package/dist/jobs/job-store.d.ts +37 -5
  128. package/dist/jobs/types.d.ts +8 -6
  129. package/dist/{jobs-Bjr8DZAi.js → jobs-DqYNfquG.js} +306 -167
  130. package/dist/jobs-DqYNfquG.js.map +1 -0
  131. package/dist/{jwt-C4OW-DNq.js → jwt-R6bSPMjk.js} +114 -38
  132. package/dist/{jwt-C4OW-DNq.js.map → jwt-R6bSPMjk.js.map} +1 -1
  133. package/dist/{keys-Qfc4XieN.js → keys-GAVZqbqx.js} +18 -17
  134. package/dist/{keys-Qfc4XieN.js.map → keys-GAVZqbqx.js.map} +1 -1
  135. package/dist/{logger-DO2PZc4i.js → logger-D-S-hO5e.js} +26 -3
  136. package/dist/logger-D-S-hO5e.js.map +1 -0
  137. package/dist/{logs-routes-3EEzPjhl.js → logs-routes-DAdv37GI.js} +54 -11
  138. package/dist/logs-routes-DAdv37GI.js.map +1 -0
  139. package/dist/mcp/consent-page.d.ts +1 -1
  140. package/dist/mcp/mcp-routes.d.ts +45 -2
  141. package/dist/mcp/mcp-tools.d.ts +22 -10
  142. package/dist/mcp/oauth-metadata.d.ts +21 -16
  143. package/dist/mcp/oauth-routes.d.ts +34 -1
  144. package/dist/mcp/oauth-store.d.ts +29 -13
  145. package/dist/metrics/history-recorder.d.ts +1 -1
  146. package/dist/{openapi-generator-D8uFz-LW.js → openapi-generator-DAq_XVDu.js} +135 -22
  147. package/dist/openapi-generator-DAq_XVDu.js.map +1 -0
  148. package/dist/{proxy-Czngl3p9.js → proxy-qRlqeUmO.js} +2 -2
  149. package/dist/{proxy-Czngl3p9.js.map → proxy-qRlqeUmO.js.map} +1 -1
  150. package/dist/{query-parser-BleZmY18.js → query-parser-BgiKJKvc.js} +41 -82
  151. package/dist/query-parser-BgiKJKvc.js.map +1 -0
  152. package/dist/{request-timeout-C_4C2BeR.js → request-timeout-DgH7j8qO.js} +3 -3
  153. package/dist/{request-timeout-C_4C2BeR.js.map → request-timeout-DgH7j8qO.js.map} +1 -1
  154. package/dist/rls-audit/index.d.ts +4 -0
  155. package/dist/schema-edit/apply-schema-change.d.ts +63 -3
  156. package/dist/schema-edit/project-root.d.ts +3 -2
  157. package/dist/schema-edit/remote-source.d.ts +9 -4
  158. package/dist/{schema-editor-routes-DdLihzp0.js → schema-editor-routes-oIyuWl3L.js} +12 -7
  159. package/dist/schema-editor-routes-oIyuWl3L.js.map +1 -0
  160. package/dist/serve-spa.d.ts +58 -0
  161. package/dist/services/routed-realtime-service.d.ts +11 -0
  162. package/dist/soft-delete-params-BWPilMPF.js +59 -0
  163. package/dist/soft-delete-params-BWPilMPF.js.map +1 -0
  164. package/dist/{src-Br6ARbs6.js → src-CatHFUym.js} +439 -45
  165. package/dist/src-CatHFUym.js.map +1 -0
  166. package/dist/{src-1vL-I1Po.js → src-I3aG1PcY.js} +371 -81
  167. package/dist/src-I3aG1PcY.js.map +1 -0
  168. package/dist/storage/GCSStorageController.d.ts +13 -1
  169. package/dist/storage/LocalStorageController.d.ts +2 -0
  170. package/dist/storage/S3StorageController.d.ts +2 -0
  171. package/dist/storage/index.d.ts +2 -2
  172. package/dist/storage/keys.d.ts +12 -0
  173. package/dist/storage/property-limits.d.ts +41 -6
  174. package/dist/storage/rendition-cache.d.ts +11 -1
  175. package/dist/storage/request-keys.d.ts +82 -0
  176. package/dist/storage/requested-object.d.ts +74 -0
  177. package/dist/storage/routes.d.ts +36 -18
  178. package/dist/storage/tus-handler.d.ts +30 -5
  179. package/dist/storage/types.d.ts +36 -1
  180. package/dist/types-BfKcm9do.js.map +1 -1
  181. package/dist/utils/logger.d.ts +12 -0
  182. package/package.json +9 -9
  183. package/dist/GCSStorageController-CLIJXwGS.js.map +0 -1
  184. package/dist/S3StorageController-Dcuf8lMA.js.map +0 -1
  185. package/dist/admin-roles-vYdp_Pil.js +0 -36
  186. package/dist/admin-roles-vYdp_Pil.js.map +0 -1
  187. package/dist/admin_block-DxKLmdiv.js +0 -206
  188. package/dist/admin_block-DxKLmdiv.js.map +0 -1
  189. package/dist/ast-schema-editor-CslO8Oje.js.map +0 -1
  190. package/dist/auth/api-keys/api-key-permission-guard.d.ts +0 -65
  191. package/dist/auth-CCDpk2rn.js.map +0 -1
  192. package/dist/backup-DzI9jLwc.js +0 -192
  193. package/dist/backup-DzI9jLwc.js.map +0 -1
  194. package/dist/contract-routes-eLxV0le1.js.map +0 -1
  195. package/dist/cron-loader-CQjvjpEw.js.map +0 -1
  196. package/dist/cron-routes-B7CRGfiq.js +0 -72
  197. package/dist/cron-routes-B7CRGfiq.js.map +0 -1
  198. package/dist/cron-scheduler-COPQxlEq.js.map +0 -1
  199. package/dist/cron-store-BYGZFNWk.js.map +0 -1
  200. package/dist/ddl-bootstrap-CfNvxMuK.js.map +0 -1
  201. package/dist/errors-DWsX4yTd.js.map +0 -1
  202. package/dist/function-routes-Chet4-lB.js.map +0 -1
  203. package/dist/history-recorder-BQmB0P_j.js.map +0 -1
  204. package/dist/jobs-Bjr8DZAi.js.map +0 -1
  205. package/dist/logger-DO2PZc4i.js.map +0 -1
  206. package/dist/logs-routes-3EEzPjhl.js.map +0 -1
  207. package/dist/openapi-generator-D8uFz-LW.js.map +0 -1
  208. package/dist/query-parser-BleZmY18.js.map +0 -1
  209. package/dist/schema-editor-routes-DdLihzp0.js.map +0 -1
  210. package/dist/src-1vL-I1Po.js.map +0 -1
  211. package/dist/src-Br6ARbs6.js.map +0 -1
@@ -9,9 +9,9 @@ import { type RebaseEnv } from "../env.js";
9
9
  * a set of environment variables, and everything either side needs to agree on
10
10
  * has to be part of the contract rather than a convention each project reinvents.
11
11
  */
12
- declare const bootEnvExtension: z.ZodObject<{
12
+ export declare const bootEnvExtension: z.ZodObject<{
13
13
  SMTP_HOST: z.ZodOptional<z.ZodString>;
14
- SMTP_PORT: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
14
+ SMTP_PORT: z.ZodPreprocess<z.ZodDefault<z.ZodCoercedNumber<unknown>>>;
15
15
  SMTP_SECURE: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
16
16
  "": "";
17
17
  true: "true";
@@ -34,19 +34,24 @@ declare const bootEnvExtension: z.ZodObject<{
34
34
  none: "none";
35
35
  ensure: "ensure";
36
36
  }>>;
37
+ REBASE_HSTS_INCLUDE_SUBDOMAINS: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
38
+ "": "";
39
+ true: "true";
40
+ false: "false";
41
+ }>>, z.ZodTransform<boolean, "" | "true" | "false">>;
37
42
  REBASE_METRICS: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
38
43
  "": "";
39
44
  true: "true";
40
45
  false: "false";
41
46
  }>>, z.ZodTransform<boolean, "" | "true" | "false">>;
42
47
  REBASE_METRICS_TOKEN: z.ZodOptional<z.ZodString>;
43
- LOG_LEVEL: z.ZodOptional<z.ZodEnum<{
48
+ LOG_LEVEL: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
44
49
  "": "";
45
50
  debug: "debug";
46
51
  info: "info";
47
52
  warn: "warn";
48
53
  error: "error";
49
- }>>;
54
+ }>>>;
50
55
  STORAGE_PUBLIC_READ: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
51
56
  "": "";
52
57
  true: "true";
@@ -62,6 +67,7 @@ declare const bootEnvExtension: z.ZodObject<{
62
67
  true: "true";
63
68
  false: "false";
64
69
  }>>, z.ZodTransform<boolean, "" | "true" | "false">>;
70
+ STORAGE_DOWNLOAD_TOKEN_TTL: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
65
71
  AUTH_REQUIRE: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
66
72
  "": "";
67
73
  true: "true";
@@ -82,6 +88,21 @@ declare const bootEnvExtension: z.ZodObject<{
82
88
  true: "true";
83
89
  false: "false";
84
90
  }>>, z.ZodTransform<boolean, "" | "true" | "false">>;
91
+ AUTH_REQUIRE_EMAIL_VERIFICATION: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
92
+ "": "";
93
+ true: "true";
94
+ false: "false";
95
+ }>>, z.ZodTransform<boolean, "" | "true" | "false">>;
96
+ AUTH_MAGIC_LINK_CREATES_USERS: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
97
+ "": "";
98
+ true: "true";
99
+ false: "false";
100
+ }>>, z.ZodTransform<boolean, "" | "true" | "false">>;
101
+ AUTH_REFRESH_TOKEN_REUSE: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
102
+ "": "";
103
+ reject: "reject";
104
+ "revoke-session": "revoke-session";
105
+ }>>, z.ZodTransform<"reject" | "revoke-session" | undefined, "" | "reject" | "revoke-session" | undefined>>;
85
106
  CAPTCHA_PROVIDER: z.ZodOptional<z.ZodEnum<{
86
107
  "": "";
87
108
  turnstile: "turnstile";
@@ -131,7 +152,7 @@ declare const bootEnvExtension: z.ZodObject<{
131
152
  true: "true";
132
153
  false: "false";
133
154
  }>>, z.ZodTransform<boolean | undefined, "" | "true" | "false" | undefined>>;
134
- REBASE_MAX_BODY_SIZE: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
155
+ REBASE_MAX_BODY_SIZE: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
135
156
  REBASE_COMPRESSION: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
136
157
  "": "";
137
158
  true: "true";
@@ -223,4 +244,28 @@ export type CorsOriginResolver = (origin: string) => string | null;
223
244
  * adds localhost to it rather than replacing it.
224
245
  */
225
246
  export declare function resolveCorsOrigin(env: RebaseBootEnv): CorsOriginResolver;
226
- export {};
247
+ /**
248
+ * Response headers a browser app on another origin may read.
249
+ *
250
+ * Outside the CORS-safelisted few, a cross-origin `fetch` sees a header only
251
+ * when `Access-Control-Expose-Headers` names it — and the runtime named none.
252
+ * So in every cross-origin setup (every `rebase dev` project: a Vite frontend on
253
+ * its own port) the SDK read no `ETag`, `etagOf(row)` was always `undefined`,
254
+ * and an `ifMatch` update went out with no `If-Match` — a conditional write
255
+ * silently made unconditional. A 429's `Retry-After` and the `X-Request-ID` an
256
+ * error is reported by were lost the same way.
257
+ *
258
+ * These are the headers the SDK reads, plus the ones the API sends for a caller
259
+ * to act on (`X-RateLimit-*`, `Preference-Applied`). A backend that wires its
260
+ * own `cors()` wants the same list; `packages/server/test/cors-exposed-headers.test.ts`
261
+ * fails when the SDK reads a header this does not name.
262
+ */
263
+ export declare const CORS_EXPOSED_HEADERS: readonly string[];
264
+ /** What the runtime hands Hono's `cors()`. */
265
+ export interface RebaseCorsOptions {
266
+ origin: CorsOriginResolver;
267
+ credentials: true;
268
+ exposeHeaders: string[];
269
+ }
270
+ /** The runtime's whole CORS config, so a test can drive the same one boot does. */
271
+ export declare function resolveCorsOptions(env: RebaseBootEnv): RebaseCorsOptions;
@@ -33,6 +33,19 @@ export declare const BUNDLE_FETCH_DIR_ENV = "REBASE_BUNDLE_FETCH_DIR";
33
33
  * whether to fetch at all — keep the two in step.
34
34
  */
35
35
  export declare const BUNDLE_SOURCE_FILENAME = ".rebase-bundle-source";
36
+ /**
37
+ * Present in a bundle root while a dependency install there has not finished.
38
+ *
39
+ * Written before npm starts and removed once it returns, so it outlives exactly
40
+ * one thing: an install that was killed partway. A failed install deletes what
41
+ * it wrote, but a SIGKILL — an OOMKill, a startup probe restarting the
42
+ * container — runs no cleanup, and the partial `node_modules` it leaves on the
43
+ * pod's volume cannot be told from a finished one by looking at the directory.
44
+ *
45
+ * `infra/docker/entrypoint.mjs` reads this file by the same name — keep the two
46
+ * in step.
47
+ */
48
+ export declare const INSTALL_PENDING_FILENAME = ".rebase-install-pending";
36
49
  /** What the tree in `destination` was fetched from, or null if unknown. */
37
50
  export declare function unpackedBundleSource(destination: string): string | null;
38
51
  /**
@@ -56,7 +69,11 @@ export interface FetchBundleOptions {
56
69
  fetchImpl?: typeof fetch;
57
70
  /** Injected for tests. */
58
71
  extract?: (tarball: string, destination: string) => Promise<void>;
59
- /** How long a single download attempt may take before it is abandoned. */
72
+ /**
73
+ * How long a download attempt may go without progress — waiting for the
74
+ * response, or between two chunks of its body — before it is abandoned and
75
+ * retried.
76
+ */
60
77
  timeoutMs?: number;
61
78
  /**
62
79
  * How many times to try the download.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The scheduled RLS audit, switched on from the environment.
3
+ *
4
+ * `REBASE_RLS_AUDIT=true` is how a bundle boot — the runtime image,
5
+ * `rebase start`, `rebase dev` — asks for the audit, because a bundle has no
6
+ * code path to `rlsAudit.enabled`. The variable also decides which process owns
7
+ * the scan (`boot/role.ts`); this is the other half, without which a process
8
+ * that owned the scan had none to run.
9
+ *
10
+ * The scanner is `@rebasepro/rls-check`, loaded from the bundle rather than
11
+ * imported: the runtime deliberately carries no Postgres driver of its own (see
12
+ * `rls-audit/index.ts`), so a project that wants the audit declares the package
13
+ * among its dependencies and the bundle brings it.
14
+ */
15
+ import type { RebaseBootEnv } from "./env.js";
16
+ import type { RlsAuditConfig } from "../rls-audit/index.js";
17
+ export declare const RLS_CHECK_PACKAGE = "@rebasepro/rls-check";
18
+ /**
19
+ * The `rlsAudit` option for a bundle boot: on, with the bundle's own scanner,
20
+ * when `REBASE_RLS_AUDIT` is true; otherwise undefined.
21
+ *
22
+ * Refuses rather than booting without it. The variable is an explicit request
23
+ * for a security audit, and a boot that quietly skipped it would report a
24
+ * database as unaudited only to whoever thought to open the admin route.
25
+ */
26
+ export declare function resolveRlsAuditOptions(env: Pick<RebaseBootEnv, "REBASE_RLS_AUDIT">, resolveFrom: string[]): Promise<RlsAuditConfig | undefined>;
@@ -0,0 +1,26 @@
1
+ import type { MiddlewareHandler } from "hono";
2
+ /**
3
+ * The `Strict-Transport-Security` value this runtime sends.
4
+ *
5
+ * Without `includeSubDomains` unless the operator asks for it. The default
6
+ * `secureHeaders()` sends it, and on a self-hosted custom domain that tells
7
+ * every browser to refuse plain HTTP on every sibling subdomain for six months —
8
+ * a decision about hosts this process does not serve, and not one it can undo
9
+ * once a browser has cached it.
10
+ */
11
+ export declare function strictTransportSecurity(includeSubDomains: boolean): string;
12
+ /**
13
+ * The Content-Security-Policy every static app is served with.
14
+ *
15
+ * Conservative on purpose: it says who may frame the app (this origin only,
16
+ * like the `X-Frame-Options: SAMEORIGIN` already sent), forbids plugins, and
17
+ * pins `<base>` to this origin. It restricts no script, style, worker, font or
18
+ * connection source, because an app's own build decides those — the CMS admin
19
+ * runs inline scripts, module workers and third-party sign-in, and a policy
20
+ * that broke any of them would be one every project had to turn off.
21
+ */
22
+ export declare const STATIC_APP_CSP = "frame-ancestors 'self'; object-src 'none'; base-uri 'self'";
23
+ /** The security headers both boot paths — backend and static-only — install. */
24
+ export declare function runtimeSecureHeaders(options: {
25
+ hstsIncludeSubDomains: boolean;
26
+ }): MiddlewareHandler;
@@ -51,6 +51,7 @@ export declare function envSuffixForKey(key: string, defaultKey: string): string
51
51
  *
52
52
  * `media-cdn` and `media_cdn` are different source keys but the same suffix, and
53
53
  * without this check one of them would silently read the other's configuration.
54
+ * Every spelling a key is read under counts (see `envSuffixFormsForKey`).
54
55
  */
55
56
  export declare function assertDistinctSuffixes(definitions: {
56
57
  key: string;
@@ -0,0 +1,56 @@
1
+ import { type StaticAppRequest } from "../serve-spa.js";
2
+ import { type LoadedStaticApp } from "./bundle.js";
3
+ /**
4
+ * A request's hostname in the form an app's `host` is written in: lowercase,
5
+ * with no port and no trailing dot.
6
+ *
7
+ * All three are ways of naming the same host that a browser, a proxy or a
8
+ * person with curl will send. `Admin.Example.com`, `admin.example.com:443` and
9
+ * the fully-qualified `admin.example.com.` are one site, and an app that
10
+ * answered only the first spelling would be down for whoever typed another.
11
+ *
12
+ * An IPv6 literal comes back as it arrived: its colons are not a port, and no
13
+ * app is ever given one, so all it has to do here is not be mangled into
14
+ * something that could match.
15
+ */
16
+ export declare function normalizeRequestHost(host: string): string;
17
+ /**
18
+ * Which static app answers a request: the one rule, written once.
19
+ *
20
+ * An app is a candidate when it names no hostname or names this one, and the
21
+ * path is under its own. Of the candidates, the longest path wins, and at an
22
+ * equal path the app with a hostname beats the one without — which is
23
+ * {@link compareStaticApps}, so the first candidate in that order is the winner.
24
+ * `undefined` when no app claims the request, and then no app answers it.
25
+ *
26
+ * The CLI and the control plane order apps by the same rule, so the app a
27
+ * deploy says is at an address is the app that answers there.
28
+ */
29
+ export declare function createStaticAppResolver(apps: readonly LoadedStaticApp[]): (request: StaticAppRequest) => LoadedStaticApp | undefined;
30
+ /** How one static app is mounted: what `serveSPA` needs beyond its own build. */
31
+ export interface StaticAppMount {
32
+ app: LoadedStaticApp;
33
+ /** Sibling paths the app's SPA fallback must decline — the path-only rule. */
34
+ siblingPaths: string[];
35
+ /** Present when apps are told apart by hostname; see `ServeSPAConfig.owns`. */
36
+ owns?: (request: StaticAppRequest) => boolean;
37
+ }
38
+ /**
39
+ * Decide how each static app is mounted, in the order given.
40
+ *
41
+ * Two rules, chosen by whether any app names a hostname.
42
+ *
43
+ * **None does:** every app declines the paths of the apps nested beneath it
44
+ * (`nestedAppPaths`), exactly as a bundle has always been served. Not the
45
+ * resolver, even though it would agree on every ordinary request: in the
46
+ * corner it disagrees — a file in the root app's build under a sibling's
47
+ * prefix — those bundles are already deployed. A bundle that never mentions
48
+ * a hostname gets byte-for-byte what it got before hostnames existed.
49
+ *
50
+ * **Any does:** a path cannot say which app a request belongs to any more.
51
+ * Two apps can both sit at "/", and a host-less site must still answer
52
+ * `/cms` on its own domain while an admin on another hostname owns `/cms`
53
+ * there — excluding "/cms" by path would 404 the site's. So every mount asks
54
+ * the one resolver instead, and declines whatever another app wins.
55
+ */
56
+ export declare function planStaticAppMounts(apps: readonly LoadedStaticApp[]): StaticAppMount[];