@rebasepro/server 0.16.0 → 0.16.1-canary.g041c925

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 (210) hide show
  1. package/dist/{GCSStorageController-BEmDYFKc.js → GCSStorageController-Bl7nmhdv.js} +7 -6
  2. package/dist/{GCSStorageController-BEmDYFKc.js.map → GCSStorageController-Bl7nmhdv.js.map} +1 -1
  3. package/dist/{S3StorageController-B2EDXXMH.js → S3StorageController-CWvvrRpF.js} +7 -6
  4. package/dist/{S3StorageController-B2EDXXMH.js.map → S3StorageController-CWvvrRpF.js.map} +1 -1
  5. package/dist/{admin_block-DLILvzle.js → admin_block-BeypnEfb.js} +6 -6
  6. package/dist/admin_block-BeypnEfb.js.map +1 -0
  7. package/dist/api/ast-schema-editor.d.ts +23 -0
  8. package/dist/api/contract-routes.d.ts +1 -1
  9. package/dist/api/errors.d.ts +1 -1
  10. package/dist/api/index.d.ts +3 -3
  11. package/dist/api/live-schema-routes.d.ts +122 -0
  12. package/dist/api/logs-routes.d.ts +1 -1
  13. package/dist/api/mount.d.ts +41 -0
  14. package/dist/api/rest/api-generator.d.ts +2 -2
  15. package/dist/api/rest/index.d.ts +1 -1
  16. package/dist/api/rest/query-parser.d.ts +1 -1
  17. package/dist/api/schema-editor-routes.d.ts +1 -1
  18. package/dist/api/types.d.ts +12 -4
  19. package/dist/{schema-editor-routes-CV9k0w3G.js → ast-schema-editor-CDGgrIn7.js} +37 -45
  20. package/dist/ast-schema-editor-CDGgrIn7.js.map +1 -0
  21. package/dist/auth/adapter-middleware.d.ts +2 -2
  22. package/dist/auth/admin-roles-route.d.ts +2 -2
  23. package/dist/auth/admin-user-ops.d.ts +3 -3
  24. package/dist/auth/admin-users-route.d.ts +4 -6
  25. package/dist/auth/api-keys/api-key-middleware.d.ts +2 -2
  26. package/dist/auth/api-keys/api-key-permission-guard.d.ts +1 -1
  27. package/dist/auth/api-keys/api-key-routes.d.ts +2 -2
  28. package/dist/auth/api-keys/api-key-store.d.ts +1 -1
  29. package/dist/auth/api-keys/index.d.ts +9 -9
  30. package/dist/auth/apple-oauth.d.ts +2 -2
  31. package/dist/auth/auth-hooks.d.ts +4 -4
  32. package/dist/auth/bitbucket-oauth.d.ts +2 -2
  33. package/dist/auth/builtin-auth-adapter.d.ts +8 -4
  34. package/dist/auth/capabilities.d.ts +51 -0
  35. package/dist/auth/captcha.d.ts +86 -0
  36. package/dist/auth/cookie-utils.d.ts +2 -2
  37. package/dist/auth/discord-oauth.d.ts +2 -2
  38. package/dist/auth/facebook-oauth.d.ts +2 -2
  39. package/dist/auth/github-oauth.d.ts +2 -2
  40. package/dist/auth/gitlab-oauth.d.ts +2 -2
  41. package/dist/auth/google-oauth.d.ts +1 -1
  42. package/dist/auth/index.d.ts +58 -54
  43. package/dist/auth/jwks-routes.d.ts +1 -1
  44. package/dist/auth/jwt.d.ts +1 -1
  45. package/dist/auth/linkedin-oauth.d.ts +2 -2
  46. package/dist/auth/magic-link-routes.d.ts +10 -3
  47. package/dist/auth/mfa-gate.d.ts +1 -1
  48. package/dist/auth/mfa-routes.d.ts +3 -3
  49. package/dist/auth/microsoft-oauth.d.ts +2 -2
  50. package/dist/auth/middleware.d.ts +6 -7
  51. package/dist/auth/otp-routes.d.ts +89 -0
  52. package/dist/auth/rate-limiter.d.ts +2 -2
  53. package/dist/auth/require-auth.d.ts +1 -1
  54. package/dist/auth/reset-password-admin.d.ts +4 -4
  55. package/dist/auth/routes.d.ts +18 -10
  56. package/dist/auth/session-routes.d.ts +3 -3
  57. package/dist/auth/slack-oauth.d.ts +2 -2
  58. package/dist/auth/spotify-oauth.d.ts +2 -2
  59. package/dist/auth/token-revocation.d.ts +2 -2
  60. package/dist/auth/twitter-oauth.d.ts +2 -2
  61. package/dist/{auth-5Et5mnUA.js → auth-DzarZhLS.js} +603 -4376
  62. package/dist/auth-DzarZhLS.js.map +1 -0
  63. package/dist/backup/backup-common.d.ts +1 -1
  64. package/dist/backup/backup-routes.d.ts +3 -3
  65. package/dist/backup/index.d.ts +3 -3
  66. package/dist/{backup-C6ljYVTp.js → backup-CRdZkA6c.js} +7 -6
  67. package/dist/{backup-C6ljYVTp.js.map → backup-CRdZkA6c.js.map} +1 -1
  68. package/dist/boot/bindings.d.ts +81 -0
  69. package/dist/boot/boot.d.ts +5 -5
  70. package/dist/boot/bundle.d.ts +10 -1
  71. package/dist/boot/driver.d.ts +1 -1
  72. package/dist/boot/env.d.ts +28 -1
  73. package/dist/boot/fetch-bundle.d.ts +144 -1
  74. package/dist/boot/local-provisioner.d.ts +30 -0
  75. package/dist/boot/options.d.ts +30 -6
  76. package/dist/boot/resource-adapters.d.ts +31 -0
  77. package/dist/boot/resource-loading.d.ts +10 -0
  78. package/dist/boot/role.d.ts +3 -2
  79. package/dist/boot/sources.d.ts +1 -1
  80. package/dist/boot/version-skew.d.ts +1 -1
  81. package/dist/collections/BackendCollectionRegistry.d.ts +1 -1
  82. package/dist/collections/loader.d.ts +1 -1
  83. package/dist/{contract-routes-DZ-LBpSL.js → contract-routes-DDSRyGSl.js} +8 -7
  84. package/dist/contract-routes-DDSRyGSl.js.map +1 -0
  85. package/dist/cron/cron-routes.d.ts +2 -2
  86. package/dist/cron/cron-scheduler.d.ts +3 -3
  87. package/dist/cron/index.d.ts +8 -8
  88. package/dist/{cron-loader-YhhQeVBM.js → cron-loader-d9WMFENB.js} +8 -7
  89. package/dist/{cron-loader-YhhQeVBM.js.map → cron-loader-d9WMFENB.js.map} +1 -1
  90. package/dist/{cron-routes-maM_RlUu.js → cron-routes-B_GKclr5.js} +9 -8
  91. package/dist/cron-routes-B_GKclr5.js.map +1 -0
  92. package/dist/{cron-scheduler-DIpYBmZP.js → cron-scheduler-BB82dWuU.js} +9 -9
  93. package/dist/cron-scheduler-BB82dWuU.js.map +1 -0
  94. package/dist/{cron-store-DfH_4Cd9.js → cron-store-BTZqwkM1.js} +10 -9
  95. package/dist/{cron-store-DfH_4Cd9.js.map → cron-store-BTZqwkM1.js.map} +1 -1
  96. package/dist/{ddl-bootstrap-Cywoj8Ta.js → ddl-bootstrap-euwN8FOy.js} +21 -6
  97. package/dist/ddl-bootstrap-euwN8FOy.js.map +1 -0
  98. package/dist/deploy/pod-contract.d.ts +139 -0
  99. package/dist/dev-secrets.d.ts +52 -0
  100. package/dist/{dynamic-import-Dvh-K5fl.js → dynamic-import-X40pTZUQ.js} +5 -4
  101. package/dist/{dynamic-import-Dvh-K5fl.js.map → dynamic-import-X40pTZUQ.js.map} +1 -1
  102. package/dist/email/dev-sink.d.ts +88 -0
  103. package/dist/email/index.d.ts +9 -7
  104. package/dist/email/link-base.d.ts +1 -1
  105. package/dist/email/smtp-email-service.d.ts +2 -2
  106. package/dist/email/templates.d.ts +12 -0
  107. package/dist/email/types.d.ts +18 -6
  108. package/dist/env.d.ts +1 -1
  109. package/dist/{errors-EBYiaJ2E.js → errors-DBwpj9N8.js} +8 -7
  110. package/dist/errors-DBwpj9N8.js.map +1 -0
  111. package/dist/{function-loader-DDS1v7YX.js → function-loader-LLdmBFoL.js} +9 -8
  112. package/dist/{function-loader-DDS1v7YX.js.map → function-loader-LLdmBFoL.js.map} +1 -1
  113. package/dist/{function-routes-Btcez1T-.js → function-routes-ClT6UQpD.js} +8 -7
  114. package/dist/function-routes-ClT6UQpD.js.map +1 -0
  115. package/dist/functions/context.d.ts +141 -0
  116. package/dist/functions/define-function.d.ts +1 -1
  117. package/dist/functions/function-routes.d.ts +9 -3
  118. package/dist/functions/guards.d.ts +76 -0
  119. package/dist/functions/index.d.ts +96 -5
  120. package/dist/functions/index.js +919 -0
  121. package/dist/functions/index.js.map +1 -0
  122. package/dist/functions/internal.d.ts +26 -0
  123. package/dist/functions/proxy.d.ts +1 -1
  124. package/dist/functions/request-timeout.d.ts +9 -1
  125. package/dist/functions/runtime-env.d.ts +92 -0
  126. package/dist/functions/wait-until.d.ts +74 -0
  127. package/dist/history/history-routes.d.ts +2 -2
  128. package/dist/history/index.d.ts +1 -1
  129. package/dist/index.d.ts +65 -54
  130. package/dist/index.es.js +3498 -305
  131. package/dist/index.es.js.map +1 -1
  132. package/dist/init/docs.d.ts +1 -1
  133. package/dist/init/middlewares.d.ts +1 -1
  134. package/dist/init/shutdown.d.ts +4 -0
  135. package/dist/init/storage.d.ts +1 -1
  136. package/dist/init/surfaces.d.ts +10 -0
  137. package/dist/init.d.ts +171 -22
  138. package/dist/jobs/index.d.ts +5 -5
  139. package/dist/{jobs-CyOKXXlu.js → jobs-CeZzdeR8.js} +10 -9
  140. package/dist/{jobs-CyOKXXlu.js.map → jobs-CeZzdeR8.js.map} +1 -1
  141. package/dist/{jwt-DxH9fLPt.js → jwt-CpMqxVct.js} +9 -8
  142. package/dist/{jwt-DxH9fLPt.js.map → jwt-CpMqxVct.js.map} +1 -1
  143. package/dist/{logger-DfvF_8r-.js → logger-DS03e908.js} +104 -10
  144. package/dist/logger-DS03e908.js.map +1 -0
  145. package/dist/{logs-routes-CWBLQj2l.js → logs-routes-DB72iQSr.js} +36 -9
  146. package/dist/logs-routes-DB72iQSr.js.map +1 -0
  147. package/dist/metrics/index.d.ts +1 -1
  148. package/dist/{openapi-generator-BCKJRUS4.js → openapi-generator-wFJo22gg.js} +7 -11
  149. package/dist/{openapi-generator-BCKJRUS4.js.map → openapi-generator-wFJo22gg.js.map} +1 -1
  150. package/dist/{proxy-Bj5DVllb.js → proxy-CMymhnwG.js} +9 -6
  151. package/dist/{proxy-Bj5DVllb.js.map → proxy-CMymhnwG.js.map} +1 -1
  152. package/dist/query-parser-C3hHu17g.js +355 -0
  153. package/dist/query-parser-C3hHu17g.js.map +1 -0
  154. package/dist/{request-timeout-BuFoEKwT.js → request-timeout-C8gkc-j7.js} +21 -6
  155. package/dist/request-timeout-C8gkc-j7.js.map +1 -0
  156. package/dist/rls-audit/index.d.ts +111 -0
  157. package/dist/{rolldown-runtime-DSJWtz9O.js → rolldown-runtime-dW7B1o5h.js} +4 -3
  158. package/dist/schema-edit/apply-schema-change.d.ts +141 -0
  159. package/dist/schema-edit/github-repository.d.ts +67 -0
  160. package/dist/schema-edit/local-git-repository.d.ts +28 -0
  161. package/dist/schema-edit/project-root.d.ts +43 -0
  162. package/dist/schema-edit/remote-source.d.ts +25 -0
  163. package/dist/schema-edit/schema-edit-permissions.d.ts +129 -0
  164. package/dist/schema-editor-routes-CRKMZnXu.js +87 -0
  165. package/dist/schema-editor-routes-CRKMZnXu.js.map +1 -0
  166. package/dist/schemas-DBxgjM9A.js +4153 -0
  167. package/dist/schemas-DBxgjM9A.js.map +1 -0
  168. package/dist/{selection-_z6TM1DB.js → selection-CRpqKUbt.js} +6 -5
  169. package/dist/{selection-_z6TM1DB.js.map → selection-CRpqKUbt.js.map} +1 -1
  170. package/dist/services/webhook-service.d.ts +1 -1
  171. package/dist/singleton.d.ts +7 -0
  172. package/dist/{src-CrCxd8km.js → src-6VqGNeDB.js} +122 -5
  173. package/dist/src-6VqGNeDB.js.map +1 -0
  174. package/dist/{src-BPfYOeN4.js → src-C5vFEj-t.js} +8 -6
  175. package/dist/src-C5vFEj-t.js.map +1 -0
  176. package/dist/storage/GCSStorageController.d.ts +1 -1
  177. package/dist/storage/LocalStorageController.d.ts +1 -1
  178. package/dist/storage/S3StorageController.d.ts +1 -1
  179. package/dist/storage/cache-headers.d.ts +87 -0
  180. package/dist/storage/index.d.ts +11 -11
  181. package/dist/storage/path-pattern.d.ts +58 -0
  182. package/dist/storage/policies.d.ts +88 -0
  183. package/dist/storage/range.d.ts +63 -0
  184. package/dist/storage/rendition-cache.d.ts +45 -0
  185. package/dist/storage/routes.d.ts +17 -5
  186. package/dist/storage/storage-registry.d.ts +1 -1
  187. package/dist/storage/triggers.d.ts +66 -0
  188. package/dist/storage/tus-handler.d.ts +34 -3
  189. package/dist/topics/runtime.d.ts +68 -0
  190. package/dist/{types-DSnOC4mF.js → types-BfKcm9do.js} +5 -4
  191. package/dist/{types-DSnOC4mF.js.map → types-BfKcm9do.js.map} +1 -1
  192. package/dist/utils/host.d.ts +58 -0
  193. package/dist/utils/logger.d.ts +0 -15
  194. package/dist/utils/request-id.d.ts +1 -1
  195. package/functions/package.json +24 -0
  196. package/package.json +13 -7
  197. package/dist/admin_block-DLILvzle.js.map +0 -1
  198. package/dist/auth-5Et5mnUA.js.map +0 -1
  199. package/dist/contract-routes-DZ-LBpSL.js.map +0 -1
  200. package/dist/cron-routes-maM_RlUu.js.map +0 -1
  201. package/dist/cron-scheduler-DIpYBmZP.js.map +0 -1
  202. package/dist/ddl-bootstrap-Cywoj8Ta.js.map +0 -1
  203. package/dist/errors-EBYiaJ2E.js.map +0 -1
  204. package/dist/function-routes-Btcez1T-.js.map +0 -1
  205. package/dist/logger-DfvF_8r-.js.map +0 -1
  206. package/dist/logs-routes-CWBLQj2l.js.map +0 -1
  207. package/dist/request-timeout-BuFoEKwT.js.map +0 -1
  208. package/dist/schema-editor-routes-CV9k0w3G.js.map +0 -1
  209. package/dist/src-BPfYOeN4.js.map +0 -1
  210. package/dist/src-CrCxd8km.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types-DSnOC4mF.js","names":[],"sources":["../src/storage/types.ts"],"sourcesContent":["/**\n * Storage configuration and types for Rebase backend\n */\n\nimport { StorageSource, UploadFileProps, UploadFileResult, DownloadConfig, StorageListResult, StorageReference } from \"@rebasepro/types\";\n\n/**\n * Local filesystem storage configuration\n */\nexport interface LocalStorageConfig {\n type: \"local\";\n /** Base directory for file storage (e.g., './uploads') */\n basePath: string;\n /** Maximum file size in bytes (default: 50MB) */\n maxFileSize?: number;\n /** Allowed MIME types (if not set, all types allowed) */\n allowedMimeTypes?: string[];\n /** Base URL for generating download URLs (default: auto-detected from request) */\n baseUrl?: string;\n}\n\n/**\n * S3-compatible storage configuration (works with AWS S3 and MinIO)\n */\nexport interface S3StorageConfig {\n type: \"s3\";\n /** S3 bucket name */\n bucket: string;\n /** AWS region (e.g., 'us-east-1') */\n region?: string;\n /** Custom endpoint URL (required for MinIO, Cloudflare R2, Hetzner Object Storage) */\n endpoint?: string;\n /** AWS access key ID */\n accessKeyId: string;\n /** AWS secret access key */\n secretAccessKey: string;\n /** Use path-style URLs (required for MinIO) */\n forcePathStyle?: boolean;\n /** Maximum file size in bytes (default: 50MB) */\n maxFileSize?: number;\n /** Allowed MIME types (if not set, all types allowed) */\n allowedMimeTypes?: string[];\n /** URL expiration time in seconds for signed URLs (default: 3600) */\n signedUrlExpiration?: number;\n}\n\n/**\n * Google Cloud Storage configuration (works with GCS and Firebase Storage)\n */\nexport interface GCSStorageConfig {\n type: \"gcs\";\n /** GCS bucket name (e.g. \"my-project.appspot.com\" for Firebase Storage) */\n bucket: string;\n /** GCP project ID (optional, auto-detected from credentials) */\n projectId?: string;\n /** Path to service account JSON key file */\n keyFilename?: string;\n /** Service account credentials object (alternative to keyFilename) */\n credentials?: { client_email: string; private_key: string; project_id?: string };\n /** Maximum file size in bytes (default: 50MB) */\n maxFileSize?: number;\n /** Allowed MIME types */\n allowedMimeTypes?: string[];\n /** Signed URL expiration in seconds (default: 3600) */\n signedUrlExpiration?: number;\n}\n\n/**\n * Storage configuration — local filesystem, S3-compatible, or Google Cloud Storage.\n *\n * **Built-in providers:**\n * - `local` — Zero-config filesystem storage. Great for dev and single-server deployments (Hetzner, bare metal).\n * - `s3` — Any S3-compatible provider. AWS S3, Cloudflare R2, MinIO, Hetzner Object Storage,\n * Backblaze B2, DigitalOcean Spaces, and even GCS (via its S3-compatible interoperability API).\n * - `gcs` — Native Google Cloud Storage / Firebase Storage via `@google-cloud/storage`.\n *\n * **Custom providers:**\n * For other cloud storage (Azure Blob, etc.), implement the `StorageController`\n * interface and pass the instance directly to the `storage` config.\n */\nexport type BackendStorageConfig = LocalStorageConfig | S3StorageConfig | GCSStorageConfig;\n\n/** What a storage request is trying to do to an object. */\nexport type {\n StorageOperation,\n StorageAuthorizeUser,\n StorageAuthorizeContext,\n StorageAuthorizeData,\n StorageAuthorize\n} from \"@rebasepro/types\";\n\n/**\n * Storage controller interface for backend implementations\n */\nexport interface StorageController {\n /**\n * Upload an object\n */\n putObject(props: UploadFileProps): Promise<UploadFileResult>;\n\n /**\n * Get a download URL (signed URL equivalent) for an object\n */\n getSignedUrl(key: string, bucket?: string): Promise<DownloadConfig>;\n\n /**\n * Get object as a File\n */\n getObject(key: string, bucket?: string): Promise<File | null>;\n\n /**\n * Delete an object\n */\n deleteObject(key: string, bucket?: string): Promise<void>;\n\n /**\n * List objects in a prefix\n */\n listObjects(prefix: string, options?: {\n bucket?: string;\n maxResults?: number;\n pageToken?: string;\n }): Promise<StorageListResult>;\n\n /**\n * Get the storage provider identifier.\n *\n * Built-in values are `'local'` and `'s3'`. Custom implementations\n * should return their own identifier (e.g. `'gcs'`, `'azure'`).\n */\n getType(): string;\n}\n\n/**\n * Default maximum file size (50MB)\n */\nexport const DEFAULT_MAX_FILE_SIZE = 50 * 1024 * 1024;\n\n/**\n * Common image MIME types\n */\nexport const IMAGE_MIME_TYPES = [\n \"image/jpeg\",\n \"image/png\",\n \"image/gif\",\n \"image/webp\",\n \"image/svg+xml\",\n \"image/bmp\",\n \"image/tiff\"\n];\n\n/**\n * Common document MIME types\n */\nexport const DOCUMENT_MIME_TYPES = [\n \"application/pdf\",\n \"application/msword\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"application/vnd.ms-excel\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n \"application/vnd.ms-powerpoint\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n \"text/plain\",\n \"text/csv\"\n];\n"],"mappings":";;;;;;;AAwIA,IAAa,wBAAwB,KAAK,OAAO;;;;AAKjD,IAAa,mBAAmB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;;AAKA,IAAa,sBAAsB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ"}
1
+ {"version":3,"file":"types-BfKcm9do.js","names":[],"sources":["../src/storage/types.ts"],"sourcesContent":["/**\n * Storage configuration and types for Rebase backend\n */\n\nimport { StorageSource, UploadFileProps, UploadFileResult, DownloadConfig, StorageListResult, StorageReference } from \"@rebasepro/types\";\n\n/**\n * Local filesystem storage configuration\n */\nexport interface LocalStorageConfig {\n type: \"local\";\n /** Base directory for file storage (e.g., './uploads') */\n basePath: string;\n /** Maximum file size in bytes (default: 50MB) */\n maxFileSize?: number;\n /** Allowed MIME types (if not set, all types allowed) */\n allowedMimeTypes?: string[];\n /** Base URL for generating download URLs (default: auto-detected from request) */\n baseUrl?: string;\n}\n\n/**\n * S3-compatible storage configuration (works with AWS S3 and MinIO)\n */\nexport interface S3StorageConfig {\n type: \"s3\";\n /** S3 bucket name */\n bucket: string;\n /** AWS region (e.g., 'us-east-1') */\n region?: string;\n /** Custom endpoint URL (required for MinIO, Cloudflare R2, Hetzner Object Storage) */\n endpoint?: string;\n /** AWS access key ID */\n accessKeyId: string;\n /** AWS secret access key */\n secretAccessKey: string;\n /** Use path-style URLs (required for MinIO) */\n forcePathStyle?: boolean;\n /** Maximum file size in bytes (default: 50MB) */\n maxFileSize?: number;\n /** Allowed MIME types (if not set, all types allowed) */\n allowedMimeTypes?: string[];\n /** URL expiration time in seconds for signed URLs (default: 3600) */\n signedUrlExpiration?: number;\n}\n\n/**\n * Google Cloud Storage configuration (works with GCS and Firebase Storage)\n */\nexport interface GCSStorageConfig {\n type: \"gcs\";\n /** GCS bucket name (e.g. \"my-project.appspot.com\" for Firebase Storage) */\n bucket: string;\n /** GCP project ID (optional, auto-detected from credentials) */\n projectId?: string;\n /** Path to service account JSON key file */\n keyFilename?: string;\n /** Service account credentials object (alternative to keyFilename) */\n credentials?: { client_email: string; private_key: string; project_id?: string };\n /** Maximum file size in bytes (default: 50MB) */\n maxFileSize?: number;\n /** Allowed MIME types */\n allowedMimeTypes?: string[];\n /** Signed URL expiration in seconds (default: 3600) */\n signedUrlExpiration?: number;\n}\n\n/**\n * Storage configuration — local filesystem, S3-compatible, or Google Cloud Storage.\n *\n * **Built-in providers:**\n * - `local` — Zero-config filesystem storage. Great for dev and single-server deployments (Hetzner, bare metal).\n * - `s3` — Any S3-compatible provider. AWS S3, Cloudflare R2, MinIO, Hetzner Object Storage,\n * Backblaze B2, DigitalOcean Spaces, and even GCS (via its S3-compatible interoperability API).\n * - `gcs` — Native Google Cloud Storage / Firebase Storage via `@google-cloud/storage`.\n *\n * **Custom providers:**\n * For other cloud storage (Azure Blob, etc.), implement the `StorageController`\n * interface and pass the instance directly to the `storage` config.\n */\nexport type BackendStorageConfig = LocalStorageConfig | S3StorageConfig | GCSStorageConfig;\n\n/** What a storage request is trying to do to an object. */\nexport type {\n StorageOperation,\n StorageAuthorizeUser,\n StorageAuthorizeContext,\n StorageAuthorizeData,\n StorageAuthorize\n} from \"@rebasepro/types\";\n\n/**\n * Storage controller interface for backend implementations\n */\nexport interface StorageController {\n /**\n * Upload an object\n */\n putObject(props: UploadFileProps): Promise<UploadFileResult>;\n\n /**\n * Get a download URL (signed URL equivalent) for an object\n */\n getSignedUrl(key: string, bucket?: string): Promise<DownloadConfig>;\n\n /**\n * Get object as a File\n */\n getObject(key: string, bucket?: string): Promise<File | null>;\n\n /**\n * Delete an object\n */\n deleteObject(key: string, bucket?: string): Promise<void>;\n\n /**\n * List objects in a prefix\n */\n listObjects(prefix: string, options?: {\n bucket?: string;\n maxResults?: number;\n pageToken?: string;\n }): Promise<StorageListResult>;\n\n /**\n * Get the storage provider identifier.\n *\n * Built-in values are `'local'` and `'s3'`. Custom implementations\n * should return their own identifier (e.g. `'gcs'`, `'azure'`).\n */\n getType(): string;\n}\n\n/**\n * Default maximum file size (50MB)\n */\nexport const DEFAULT_MAX_FILE_SIZE = 50 * 1024 * 1024;\n\n/**\n * Common image MIME types\n */\nexport const IMAGE_MIME_TYPES = [\n \"image/jpeg\",\n \"image/png\",\n \"image/gif\",\n \"image/webp\",\n \"image/svg+xml\",\n \"image/bmp\",\n \"image/tiff\"\n];\n\n/**\n * Common document MIME types\n */\nexport const DOCUMENT_MIME_TYPES = [\n \"application/pdf\",\n \"application/msword\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"application/vnd.ms-excel\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n \"application/vnd.ms-powerpoint\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n \"text/plain\",\n \"text/csv\"\n];\n"],"mappings":";;;;;;;;AAwIA,IAAa,wBAAwB,KAAK,OAAO;;;;AAKjD,IAAa,mBAAmB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;;AAKA,IAAa,sBAAsB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The host globals this package reads, behind functions that do not assume Node.
3
+ *
4
+ * `process` is not defined on workerd, on Deno Deploy without the compat flag,
5
+ * or in a browser. That matters here for one specific reason: the portable
6
+ * authoring surface (`@rebasepro/server/functions`) reaches the logger and the
7
+ * error handler, and a bare `process.env.NODE_ENV` inside either of them turns
8
+ * the first log line of a request into a `ReferenceError` on a runtime that has
9
+ * no `process` — a failure that reads as "the framework crashed" rather than
10
+ * "this runtime has no process object".
11
+ *
12
+ * Nothing here throws and nothing here is async. A runtime that cannot answer
13
+ * gets the empty answer, because every caller in this file's blast radius is
14
+ * choosing a log level or a format, and the safe default for both is the
15
+ * development one.
16
+ *
17
+ * @module
18
+ */
19
+ /**
20
+ * The process environment, or the closest thing this runtime has to one.
21
+ *
22
+ * Order: a bag published by {@link setHostEnv} first, because an adapter that
23
+ * set one knows more than the ambient globals do; then `process.env`; then
24
+ * nothing.
25
+ */
26
+ export declare function hostEnv(): Record<string, string | undefined>;
27
+ /**
28
+ * Read one environment variable without touching `process` directly.
29
+ *
30
+ * Trimmed, and blank is treated as absent — a variable declared with no value
31
+ * is the ordinary way to write a compose file or a `.env` line, and every
32
+ * caller in this package means "unset" by it. See `resolveFunctionsTimeoutMs`,
33
+ * which learned that the hard way.
34
+ */
35
+ export declare function hostEnvVar(name: string): string | undefined;
36
+ /**
37
+ * Publish an environment bag for contextless readers.
38
+ *
39
+ * Called by an adapter for a runtime whose environment is not ambient. Merges
40
+ * rather than replaces, so two adapters (or an adapter plus a test) do not
41
+ * silently erase each other's variables.
42
+ */
43
+ export declare function setHostEnv(env: Record<string, string | undefined>): void;
44
+ /** @internal Test seam — drops anything {@link setHostEnv} published. */
45
+ export declare function _clearHostEnv(): void;
46
+ /**
47
+ * Write one already-formatted line to the process's output.
48
+ *
49
+ * `process.stdout.write` is preferred where it exists because it is the only
50
+ * one of the two that does not append its own formatting to a line that is
51
+ * already a complete JSON document — `console.log` on Node is
52
+ * `process.stdout.write` plus `util.format`, and `util.format` will happily
53
+ * reinterpret a `%s` that appeared inside a user's log message.
54
+ *
55
+ * Where it does not exist, `console` is the runtime's log sink and is what its
56
+ * platform collects.
57
+ */
58
+ export declare function writeLine(stream: "out" | "err", line: string): void;
@@ -1,18 +1,3 @@
1
- /**
2
- * Structured Logger for Rebase Backend
3
- *
4
- * Outputs JSON lines when `NODE_ENV=production`, human-readable prefixed
5
- * lines otherwise. Designed to work with Google Cloud Logging severity levels.
6
- *
7
- * Every line — message and data, at any depth — passes through the redaction
8
- * below, which strips Drizzle's `Failed query: … / params: …` wrapper and the
9
- * values of secret-looking keys. See the block above `serialiseError`.
10
- *
11
- * Usage:
12
- * import { logger } from "./utils/logger";
13
- * logger.info("Server started", { port: 3001 });
14
- * logger.error("Request failed", { path: "/api/test", error: err });
15
- */
16
1
  export type LogLevel = "debug" | "info" | "warn" | "error";
17
2
  export interface LogEntry {
18
3
  severity: string;
@@ -1,4 +1,4 @@
1
1
  import type { MiddlewareHandler } from "hono";
2
- import type { HonoEnv } from "../api/types";
2
+ import type { HonoEnv } from "../api/types.js";
3
3
  export declare const REQUEST_ID_HEADER = "X-Request-ID";
4
4
  export declare function requestId(): MiddlewareHandler<HonoEnv>;
@@ -0,0 +1,24 @@
1
+ {
2
+ "//": [
3
+ "Not a package. A resolution redirect, so that `@rebasepro/server/functions`",
4
+ "works under TypeScript's legacy `moduleResolution: \"node\"` as well as under",
5
+ "`bundler` / `node16` / `nodenext`.",
6
+ "",
7
+ "The `exports` map in ../package.json is the real declaration, and it is what",
8
+ "Node uses at runtime — once a package has `exports`, Node ignores directory",
9
+ "redirects like this one entirely. TypeScript's node10 mode does the opposite:",
10
+ "it ignores `exports` and resolves subpaths as directories. A project scaffolded",
11
+ "by `rebase init` compiles with `moduleResolution: \"node\"`, so without this file",
12
+ "the very import the template ships — `@rebasepro/server/functions` — fails its",
13
+ "own `tsc` with TS2307, while running perfectly.",
14
+ "",
15
+ "Deleting this file breaks type-checking for every such project and nothing",
16
+ "else, which is the hardest kind of breakage to attribute. `files` in",
17
+ "../package.json ships it; assert-build-output.mjs verifies the targets exist."
18
+ ],
19
+ "type": "module",
20
+ "main": "../dist/functions/index.js",
21
+ "module": "../dist/functions/index.js",
22
+ "types": "../dist/functions/index.d.ts",
23
+ "sideEffects": false
24
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/server",
3
3
  "type": "module",
4
- "version": "0.16.0",
4
+ "version": "0.16.1-canary.g041c925",
5
5
  "description": "Database-Agnostic Backend Core for Rebase",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -36,6 +36,11 @@
36
36
  "development": "./dist/index.es.js",
37
37
  "import": "./dist/index.es.js"
38
38
  },
39
+ "./functions": {
40
+ "types": "./dist/functions/index.d.ts",
41
+ "development": "./dist/functions/index.js",
42
+ "import": "./dist/functions/index.js"
43
+ },
39
44
  "./package.json": "./package.json"
40
45
  },
41
46
  "dependencies": {
@@ -44,10 +49,10 @@
44
49
  "jsonwebtoken": "^9.0.3",
45
50
  "ws": "^8.21.1",
46
51
  "zod": "^4.4.3",
47
- "@rebasepro/client": "0.16.0",
48
- "@rebasepro/types": "0.16.0",
49
- "@rebasepro/common": "0.16.0",
50
- "@rebasepro/utils": "0.16.0"
52
+ "@rebasepro/client": "0.16.1-canary.g041c925",
53
+ "@rebasepro/common": "0.16.1-canary.g041c925",
54
+ "@rebasepro/types": "0.16.1-canary.g041c925",
55
+ "@rebasepro/utils": "0.16.1-canary.g041c925"
51
56
  },
52
57
  "devDependencies": {
53
58
  "@jest/globals": "^30.4.1",
@@ -103,14 +108,15 @@
103
108
  },
104
109
  "files": [
105
110
  "bin",
106
- "dist"
111
+ "dist",
112
+ "functions"
107
113
  ],
108
114
  "bin": {
109
115
  "rebase-server": "bin/rebase-server.js"
110
116
  },
111
117
  "scripts": {
112
118
  "watch": "vite build --watch",
113
- "build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json && node ../../scripts/assert-build-output.mjs",
119
+ "build": "vite build && vite build --config vite.config.functions.ts && tsc --emitDeclarationOnly -p tsconfig.prod.json && node ../../tooling/scripts/add-dts-extensions.mjs dist && node ../../tooling/scripts/assert-build-output.mjs && node --experimental-vm-modules --no-warnings ../../tooling/scripts/assert-portable-entry.mjs dist/functions/index.js",
114
120
  "test:lint": "eslint \"src/**\" --quiet",
115
121
  "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --passWithNoTests --forceExit",
116
122
  "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin_block-DLILvzle.js","names":[],"sources":["../../types/src/types/admin_block.ts"],"sourcesContent":["/**\n * The keys of a collection's admin block, as data.\n *\n * There is no *type* for the block in this package any more, and that is the point:\n * `admin` is not declared on `BaseCollectionConfig` or on any property here, so a\n * BaaS install cannot even write one. `@rebasepro/admin-types` adds the field back by\n * declaration merging, which is why installing it is what makes the admin surface\n * appear.\n *\n * The *list* still has to live here, because three runtime consumers need it and two\n * of them are core — see below.\n */\n\n/**\n * Every key that belongs inside a collection's `admin` block, as data.\n *\n * The type that describes these fields is `AdminCollectionOptions` in\n * `@rebasepro/admin-types`, and it is erased at build time — but three runtime\n * consumers need the list, and two of them are core:\n *\n * - `serializeCollections`, to drop the block from the contract\n * - the ts-morph schema editor in `@rebasepro/server`, which rewrites collection\n * files on disk from the admin panel and has to know where each key goes. A key\n * missing from this list gets written to the *top level* of the file, where the\n * backend ignores it and the panel never finds it again.\n * - the `collections-admin-block` codemod\n *\n * `@rebasepro/admin-types` re-exports this and asserts it names only real option\n * keys; the count is pinned by a test there.\n *\n * @group Models\n */\nexport const ADMIN_COLLECTION_KEYS = [\n \"Actions\",\n \"additionalFields\",\n \"alwaysApplyDefaultValues\",\n \"components\",\n \"customViews\",\n \"defaultEntityAction\",\n \"defaultFilter\",\n \"defaultSelectedView\",\n \"defaultSize\",\n \"defaultViewMode\",\n \"disableDefaultActions\",\n \"display\",\n \"enabledViews\",\n \"entityActions\",\n \"entityViews\",\n \"exportable\",\n \"filterPresets\",\n \"fixedFilter\",\n \"form\",\n \"formAutoSave\",\n \"formView\",\n \"group\",\n \"hideFromEntityViews\",\n \"hideFromNavigation\",\n \"hideIdFromCollection\",\n \"hideIdFromForm\",\n \"icon\",\n \"includeJsonView\",\n \"inlineEditing\",\n \"kanban\",\n \"listProperties\",\n \"localChangesBackup\",\n \"openEntityMode\",\n \"orderProperty\",\n \"pagination\",\n \"previewProperties\",\n \"propertiesOrder\",\n \"selectionController\",\n \"selectionEnabled\",\n \"sideDialogWidth\",\n \"sort\",\n \"titleProperty\"\n] as const;\n\n/** A key of a collection's `admin` block. @group Models */\nexport type AdminCollectionKey = typeof ADMIN_COLLECTION_KEYS[number];\n\n/**\n * Every key that belongs inside a *property's* `admin` block, as data.\n *\n * The union of `AdminPropertyOptions` and its per-type extensions\n * (`AdminStringOptions`, `AdminArrayOptions`, …) in `@rebasepro/admin-types`.\n * It lives here for the same reason {@link ADMIN_COLLECTION_KEYS} does: the\n * runtime consumers are core packages that the BaaS guard forbids from\n * importing `@rebasepro/admin-types`. Here it is the boot-time collection\n * validator in `@rebasepro/server`, which has to tell \"you left `readOnly` at\n * the top of the property, where nothing reads it\" apart from \"you invented a\n * key we have never heard of\".\n *\n * `@rebasepro/admin-types` re-exports this and asserts it names only real\n * option keys.\n *\n * @group Models\n */\nexport const ADMIN_PROPERTY_KEYS = [\n \"canAddElements\",\n \"clearable\",\n \"columnWidth\",\n \"customProps\",\n \"disabled\",\n \"expanded\",\n \"Field\",\n \"Filter\",\n \"filterOperators\",\n \"fixedFilter\",\n \"hideFromCollection\",\n \"includeEntityLink\",\n \"includeId\",\n \"markdown\",\n \"minimalistView\",\n \"multiline\",\n \"Preview\",\n \"previewAsTag\",\n \"previewProperties\",\n \"readOnly\",\n \"sortable\",\n \"span\",\n \"spreadChildren\",\n \"urlPreview\",\n \"widget\",\n] as const;\n\n/** A key of a property's `admin` block. @group Models */\nexport type AdminPropertyKey = typeof ADMIN_PROPERTY_KEYS[number];\n\n/**\n * Move flattened admin keys back down into the `admin` block.\n *\n * The admin panel works with a *flat* view model — the block merged onto the\n * collection — so what comes back from a form has `icon` and `defaultViewMode`\n * at the top level while `admin` still holds whatever the file was loaded with.\n * This is the way back.\n *\n * **The top-level value wins.** It is the one the form just wrote; the block is\n * the copy the collection was loaded with, and preferring it resolves every edit\n * in favour of the value the user changed away from.\n *\n * This lives here, next to the key lists, because it had two implementations —\n * `toAdminCollectionConfig` in `@rebasepro/admin-types` and `nestAdminKeys` in\n * `@rebasepro/server`'s schema editor — that agreed on everything except that\n * precedence, which is the only part that decides whether a save is visible.\n *\n * @group Models\n */\nexport function nestAdminKeysOf(\n source: Record<string, unknown>,\n adminKeys: readonly string[]\n): Record<string, unknown> {\n const keys = new Set<string>(adminKeys);\n const top: Record<string, unknown> = {};\n const block: Record<string, unknown> = { ...((source.admin as Record<string, unknown> | undefined) ?? {}) };\n\n for (const [key, value] of Object.entries(source)) {\n if (key === \"admin\") continue;\n if (keys.has(key)) block[key] = value;\n else top[key] = value;\n }\n\n if (Object.keys(block).length > 0) top.admin = block;\n return top;\n}\n\n/**\n * {@link nestAdminKeysOf} for a collection.\n *\n * @group Models\n */\nexport function nestAdminCollectionKeys(collection: Record<string, unknown>): Record<string, unknown> {\n return nestAdminKeysOf(collection, ADMIN_COLLECTION_KEYS);\n}\n\n/**\n * {@link nestAdminKeysOf} for a property, applied to its children too.\n *\n * A map property carries `properties`, an array property carries `of`, and both\n * hold properties with `admin` blocks of their own. A flat `readOnly` left on a\n * child is as dead — and as fatal at the next boot — as one left on the parent,\n * so the walk goes all the way down.\n *\n * @group Models\n */\nexport function nestAdminPropertyKeys(property: Record<string, unknown>): Record<string, unknown> {\n const nested = nestAdminKeysOf(property, ADMIN_PROPERTY_KEYS);\n\n const children = nested.properties;\n if (children && typeof children === \"object\" && !Array.isArray(children)) {\n nested.properties = Object.fromEntries(\n Object.entries(children as Record<string, unknown>).map(([key, child]) => [\n key,\n child && typeof child === \"object\" && !Array.isArray(child)\n ? nestAdminPropertyKeys(child as Record<string, unknown>)\n : child\n ])\n );\n }\n\n const of = nested.of;\n if (Array.isArray(of)) {\n nested.of = of.map(entry => entry && typeof entry === \"object\" && !Array.isArray(entry)\n ? nestAdminPropertyKeys(entry as Record<string, unknown>)\n : entry);\n } else if (of && typeof of === \"object\") {\n nested.of = nestAdminPropertyKeys(of as Record<string, unknown>);\n }\n\n return nested;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,wBAAwB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;;;;;;;;;;;;;;;;AAsBA,IAAa,sBAAsB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,gBACZ,QACA,WACuB;CACvB,MAAM,OAAO,IAAI,IAAY,SAAS;CACtC,MAAM,MAA+B,CAAC;CACtC,MAAM,QAAiC,EAAE,GAAK,OAAO,SAAiD,CAAC,EAAG;CAE1G,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EAC/C,IAAI,QAAQ,SAAS;EACrB,IAAI,KAAK,IAAI,GAAG,GAAG,MAAM,OAAO;OAC3B,IAAI,OAAO;CACpB;CAEA,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,GAAG,IAAI,QAAQ;CAC/C,OAAO;AACX;;;;;;AAOA,SAAgB,wBAAwB,YAA8D;CAClG,OAAO,gBAAgB,YAAY,qBAAqB;AAC5D;;;;;;;;;;;AAYA,SAAgB,sBAAsB,UAA4D;CAC9F,MAAM,SAAS,gBAAgB,UAAU,mBAAmB;CAE5D,MAAM,WAAW,OAAO;CACxB,IAAI,YAAY,OAAO,aAAa,YAAY,CAAC,MAAM,QAAQ,QAAQ,GACnE,OAAO,aAAa,OAAO,YACvB,OAAO,QAAQ,QAAmC,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CACtE,KACA,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IACpD,sBAAsB,KAAgC,IACtD,KACV,CAAC,CACL;CAGJ,MAAM,KAAK,OAAO;CAClB,IAAI,MAAM,QAAQ,EAAE,GAChB,OAAO,KAAK,GAAG,KAAI,UAAS,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAChF,sBAAsB,KAAgC,IACtD,KAAK;MACR,IAAI,MAAM,OAAO,OAAO,UAC3B,OAAO,KAAK,sBAAsB,EAA6B;CAGnE,OAAO;AACX"}