@rebasepro/server 0.16.0 → 0.16.1-canary.g2d1aec8

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 (160) hide show
  1. package/dist/api/contract-routes.d.ts +1 -1
  2. package/dist/api/errors.d.ts +1 -1
  3. package/dist/api/index.d.ts +3 -3
  4. package/dist/api/live-schema-routes.d.ts +111 -0
  5. package/dist/api/logs-routes.d.ts +1 -1
  6. package/dist/api/mount.d.ts +41 -0
  7. package/dist/api/rest/api-generator.d.ts +2 -2
  8. package/dist/api/rest/index.d.ts +1 -1
  9. package/dist/api/rest/query-parser.d.ts +1 -1
  10. package/dist/api/schema-editor-routes.d.ts +1 -1
  11. package/dist/api/types.d.ts +3 -4
  12. package/dist/{schema-editor-routes-CV9k0w3G.js → ast-schema-editor-BpFYpT38.js} +2 -39
  13. package/dist/ast-schema-editor-BpFYpT38.js.map +1 -0
  14. package/dist/auth/adapter-middleware.d.ts +2 -2
  15. package/dist/auth/admin-roles-route.d.ts +2 -2
  16. package/dist/auth/admin-user-ops.d.ts +3 -3
  17. package/dist/auth/admin-users-route.d.ts +4 -4
  18. package/dist/auth/api-keys/api-key-middleware.d.ts +2 -2
  19. package/dist/auth/api-keys/api-key-permission-guard.d.ts +1 -1
  20. package/dist/auth/api-keys/api-key-routes.d.ts +2 -2
  21. package/dist/auth/api-keys/api-key-store.d.ts +1 -1
  22. package/dist/auth/api-keys/index.d.ts +9 -9
  23. package/dist/auth/apple-oauth.d.ts +2 -2
  24. package/dist/auth/auth-hooks.d.ts +3 -3
  25. package/dist/auth/bitbucket-oauth.d.ts +2 -2
  26. package/dist/auth/builtin-auth-adapter.d.ts +7 -4
  27. package/dist/auth/captcha.d.ts +86 -0
  28. package/dist/auth/cookie-utils.d.ts +2 -2
  29. package/dist/auth/discord-oauth.d.ts +2 -2
  30. package/dist/auth/facebook-oauth.d.ts +2 -2
  31. package/dist/auth/github-oauth.d.ts +2 -2
  32. package/dist/auth/gitlab-oauth.d.ts +2 -2
  33. package/dist/auth/google-oauth.d.ts +1 -1
  34. package/dist/auth/index.d.ts +56 -54
  35. package/dist/auth/jwks-routes.d.ts +1 -1
  36. package/dist/auth/jwt.d.ts +1 -1
  37. package/dist/auth/linkedin-oauth.d.ts +2 -2
  38. package/dist/auth/magic-link-routes.d.ts +10 -3
  39. package/dist/auth/mfa-gate.d.ts +1 -1
  40. package/dist/auth/mfa-routes.d.ts +3 -3
  41. package/dist/auth/microsoft-oauth.d.ts +2 -2
  42. package/dist/auth/middleware.d.ts +5 -5
  43. package/dist/auth/rate-limiter.d.ts +2 -2
  44. package/dist/auth/require-auth.d.ts +1 -1
  45. package/dist/auth/reset-password-admin.d.ts +4 -4
  46. package/dist/auth/routes.d.ts +13 -4
  47. package/dist/auth/session-routes.d.ts +3 -3
  48. package/dist/auth/slack-oauth.d.ts +2 -2
  49. package/dist/auth/spotify-oauth.d.ts +2 -2
  50. package/dist/auth/token-revocation.d.ts +2 -2
  51. package/dist/auth/twitter-oauth.d.ts +2 -2
  52. package/dist/{auth-5Et5mnUA.js → auth-C74dqR2B.js} +250 -15
  53. package/dist/auth-C74dqR2B.js.map +1 -0
  54. package/dist/backup/backup-common.d.ts +1 -1
  55. package/dist/backup/backup-routes.d.ts +3 -3
  56. package/dist/backup/index.d.ts +3 -3
  57. package/dist/{backup-C6ljYVTp.js → backup-BJ86ah4T.js} +2 -2
  58. package/dist/{backup-C6ljYVTp.js.map → backup-BJ86ah4T.js.map} +1 -1
  59. package/dist/boot/boot.d.ts +5 -5
  60. package/dist/boot/bundle.d.ts +1 -1
  61. package/dist/boot/driver.d.ts +1 -1
  62. package/dist/boot/env.d.ts +13 -1
  63. package/dist/boot/options.d.ts +30 -6
  64. package/dist/boot/role.d.ts +3 -2
  65. package/dist/boot/sources.d.ts +1 -1
  66. package/dist/collections/BackendCollectionRegistry.d.ts +1 -1
  67. package/dist/collections/loader.d.ts +1 -1
  68. package/dist/{contract-routes-DZ-LBpSL.js → contract-routes-BEq7euZg.js} +2 -2
  69. package/dist/contract-routes-BEq7euZg.js.map +1 -0
  70. package/dist/cron/cron-routes.d.ts +2 -2
  71. package/dist/cron/cron-scheduler.d.ts +2 -2
  72. package/dist/cron/index.d.ts +8 -8
  73. package/dist/{cron-loader-YhhQeVBM.js → cron-loader-BMvtW6-J.js} +2 -2
  74. package/dist/{cron-loader-YhhQeVBM.js.map → cron-loader-BMvtW6-J.js.map} +1 -1
  75. package/dist/{cron-routes-maM_RlUu.js → cron-routes-BvYk-Kmi.js} +2 -2
  76. package/dist/{cron-routes-maM_RlUu.js.map → cron-routes-BvYk-Kmi.js.map} +1 -1
  77. package/dist/{cron-scheduler-DIpYBmZP.js → cron-scheduler-Buf-uVam.js} +2 -2
  78. package/dist/{cron-scheduler-DIpYBmZP.js.map → cron-scheduler-Buf-uVam.js.map} +1 -1
  79. package/dist/{cron-store-DfH_4Cd9.js → cron-store-CyF-oInV.js} +3 -3
  80. package/dist/{cron-store-DfH_4Cd9.js.map → cron-store-CyF-oInV.js.map} +1 -1
  81. package/dist/{ddl-bootstrap-Cywoj8Ta.js → ddl-bootstrap-DgSnERYN.js} +17 -3
  82. package/dist/ddl-bootstrap-DgSnERYN.js.map +1 -0
  83. package/dist/dev-secrets.d.ts +52 -0
  84. package/dist/email/dev-sink.d.ts +67 -0
  85. package/dist/email/index.d.ts +9 -7
  86. package/dist/email/link-base.d.ts +1 -1
  87. package/dist/email/smtp-email-service.d.ts +1 -1
  88. package/dist/env.d.ts +1 -1
  89. package/dist/{errors-EBYiaJ2E.js → errors-D_LwNKRM.js} +5 -5
  90. package/dist/errors-D_LwNKRM.js.map +1 -0
  91. package/dist/{function-loader-DDS1v7YX.js → function-loader-BrLmC_-y.js} +3 -3
  92. package/dist/{function-loader-DDS1v7YX.js.map → function-loader-BrLmC_-y.js.map} +1 -1
  93. package/dist/functions/context.d.ts +141 -0
  94. package/dist/functions/define-function.d.ts +1 -1
  95. package/dist/functions/function-routes.d.ts +2 -2
  96. package/dist/functions/guards.d.ts +76 -0
  97. package/dist/functions/index.d.ts +96 -5
  98. package/dist/functions/index.js +919 -0
  99. package/dist/functions/index.js.map +1 -0
  100. package/dist/functions/internal.d.ts +26 -0
  101. package/dist/functions/proxy.d.ts +1 -1
  102. package/dist/functions/request-timeout.d.ts +9 -1
  103. package/dist/functions/runtime-env.d.ts +92 -0
  104. package/dist/functions/wait-until.d.ts +74 -0
  105. package/dist/history/history-routes.d.ts +2 -2
  106. package/dist/history/index.d.ts +1 -1
  107. package/dist/index.d.ts +63 -54
  108. package/dist/index.es.js +2183 -164
  109. package/dist/index.es.js.map +1 -1
  110. package/dist/init/docs.d.ts +1 -1
  111. package/dist/init/middlewares.d.ts +1 -1
  112. package/dist/init/shutdown.d.ts +4 -0
  113. package/dist/init/storage.d.ts +1 -1
  114. package/dist/init/surfaces.d.ts +10 -0
  115. package/dist/init.d.ts +104 -18
  116. package/dist/jobs/index.d.ts +5 -5
  117. package/dist/{jobs-CyOKXXlu.js → jobs-Bn6nhY8J.js} +3 -3
  118. package/dist/{jobs-CyOKXXlu.js.map → jobs-Bn6nhY8J.js.map} +1 -1
  119. package/dist/{jwt-DxH9fLPt.js → jwt-BbJi0TR0.js} +2 -2
  120. package/dist/{jwt-DxH9fLPt.js.map → jwt-BbJi0TR0.js.map} +1 -1
  121. package/dist/{logger-DfvF_8r-.js → logger-TdvXIGqR.js} +101 -8
  122. package/dist/logger-TdvXIGqR.js.map +1 -0
  123. package/dist/metrics/index.d.ts +1 -1
  124. package/dist/{proxy-Bj5DVllb.js → proxy-QJKSS-CV.js} +5 -3
  125. package/dist/{proxy-Bj5DVllb.js.map → proxy-QJKSS-CV.js.map} +1 -1
  126. package/dist/{request-timeout-BuFoEKwT.js → request-timeout-OofPCHQT.js} +17 -3
  127. package/dist/request-timeout-OofPCHQT.js.map +1 -0
  128. package/dist/rls-audit/index.d.ts +111 -0
  129. package/dist/schema-edit/apply-schema-change.d.ts +141 -0
  130. package/dist/schema-edit/github-repository.d.ts +67 -0
  131. package/dist/schema-edit/local-git-repository.d.ts +28 -0
  132. package/dist/schema-edit/project-root.d.ts +29 -0
  133. package/dist/schema-edit/remote-source.d.ts +25 -0
  134. package/dist/schema-edit/schema-edit-permissions.d.ts +129 -0
  135. package/dist/schema-editor-routes-yh2cQcdJ.js +44 -0
  136. package/dist/schema-editor-routes-yh2cQcdJ.js.map +1 -0
  137. package/dist/services/webhook-service.d.ts +1 -1
  138. package/dist/singleton.d.ts +7 -0
  139. package/dist/storage/GCSStorageController.d.ts +1 -1
  140. package/dist/storage/LocalStorageController.d.ts +1 -1
  141. package/dist/storage/S3StorageController.d.ts +1 -1
  142. package/dist/storage/cache-headers.d.ts +87 -0
  143. package/dist/storage/index.d.ts +11 -11
  144. package/dist/storage/policies.d.ts +88 -0
  145. package/dist/storage/range.d.ts +63 -0
  146. package/dist/storage/routes.d.ts +3 -3
  147. package/dist/storage/storage-registry.d.ts +1 -1
  148. package/dist/storage/tus-handler.d.ts +2 -2
  149. package/dist/utils/host.d.ts +58 -0
  150. package/dist/utils/logger.d.ts +0 -15
  151. package/dist/utils/request-id.d.ts +1 -1
  152. package/functions/package.json +24 -0
  153. package/package.json +13 -7
  154. package/dist/auth-5Et5mnUA.js.map +0 -1
  155. package/dist/contract-routes-DZ-LBpSL.js.map +0 -1
  156. package/dist/ddl-bootstrap-Cywoj8Ta.js.map +0 -1
  157. package/dist/errors-EBYiaJ2E.js.map +0 -1
  158. package/dist/logger-DfvF_8r-.js.map +0 -1
  159. package/dist/request-timeout-BuFoEKwT.js.map +0 -1
  160. package/dist/schema-editor-routes-CV9k0w3G.js.map +0 -1
@@ -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.g2d1aec8",
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.g2d1aec8",
53
+ "@rebasepro/common": "0.16.1-canary.g2d1aec8",
54
+ "@rebasepro/utils": "0.16.1-canary.g2d1aec8",
55
+ "@rebasepro/types": "0.16.1-canary.g2d1aec8"
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 ../../scripts/add-dts-extensions.mjs dist && node ../../scripts/assert-build-output.mjs && node --experimental-vm-modules --no-warnings ../../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"