@rebasepro/server 0.28.2 → 0.29.0-canary.g0e3a0e7

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 (105) hide show
  1. package/dist/{GCSStorageController-LXeAF6Ks.js → GCSStorageController-Ch3Ridyt.js} +4 -4
  2. package/dist/{GCSStorageController-LXeAF6Ks.js.map → GCSStorageController-Ch3Ridyt.js.map} +1 -1
  3. package/dist/{S3StorageController-CVKMUXo_.js → S3StorageController-CmNMg7Gu.js} +4 -4
  4. package/dist/{S3StorageController-CVKMUXo_.js.map → S3StorageController-CmNMg7Gu.js.map} +1 -1
  5. package/dist/{access-BDz4FO9D.js → access-BZjeLhf5.js} +7 -7
  6. package/dist/{access-BDz4FO9D.js.map → access-BZjeLhf5.js.map} +1 -1
  7. package/dist/api/rest/api-generator.d.ts +19 -0
  8. package/dist/{ast-schema-editor-C4bDSb61.js → ast-schema-editor-Dg7BWKE3.js} +3 -3
  9. package/dist/{ast-schema-editor-C4bDSb61.js.map → ast-schema-editor-Dg7BWKE3.js.map} +1 -1
  10. package/dist/auth/cookie-utils.d.ts +14 -6
  11. package/dist/auth/rate-limiter.d.ts +8 -0
  12. package/dist/{auth-CZGfVKcL.js → auth-CSWKaSgJ.js} +70 -18
  13. package/dist/auth-CSWKaSgJ.js.map +1 -0
  14. package/dist/{auth_adapter-B7RUMk6e.js → auth_adapter-HFv5axIT.js} +20 -2
  15. package/dist/auth_adapter-HFv5axIT.js.map +1 -0
  16. package/dist/backend/options.d.ts +3 -0
  17. package/dist/backend-CaG_Jyso.js.map +1 -1
  18. package/dist/{backup-BmzY9xdN.js → backup-woinIDjt.js} +9 -9
  19. package/dist/{backup-BmzY9xdN.js.map → backup-woinIDjt.js.map} +1 -1
  20. package/dist/boot/driver.d.ts +4 -0
  21. package/dist/boot/sources.d.ts +7 -0
  22. package/dist/{branch-routes-DpgaeTJl.js → branch-routes-F5VIJrZp.js} +3 -3
  23. package/dist/{branch-routes-DpgaeTJl.js.map → branch-routes-F5VIJrZp.js.map} +1 -1
  24. package/dist/{contract-routes-vYiBHbjI.js → contract-routes-D8Vsxjx8.js} +3 -3
  25. package/dist/{contract-routes-vYiBHbjI.js.map → contract-routes-D8Vsxjx8.js.map} +1 -1
  26. package/dist/{cron-loader-C_C-lNgG.js → cron-loader-n9Uh_E1a.js} +3 -3
  27. package/dist/{cron-loader-C_C-lNgG.js.map → cron-loader-n9Uh_E1a.js.map} +1 -1
  28. package/dist/{cron-routes-DlwOV6zl.js → cron-routes-mLexIC9F.js} +4 -4
  29. package/dist/{cron-routes-DlwOV6zl.js.map → cron-routes-mLexIC9F.js.map} +1 -1
  30. package/dist/{cron-scheduler-6ipIm5mm.js → cron-scheduler-DhxuCDuI.js} +2 -2
  31. package/dist/{cron-scheduler-6ipIm5mm.js.map → cron-scheduler-DhxuCDuI.js.map} +1 -1
  32. package/dist/{cron-store-KIOM8LCC.js → cron-store-DzKz7jXF.js} +2 -2
  33. package/dist/{cron-store-KIOM8LCC.js.map → cron-store-DzKz7jXF.js.map} +1 -1
  34. package/dist/data_driver-D0mg1Y_x.js.map +1 -1
  35. package/dist/dist-B4YtgTMh.js +19359 -0
  36. package/dist/dist-B4YtgTMh.js.map +1 -0
  37. package/dist/env.d.ts +7 -0
  38. package/dist/{errors-DIWnZIDY.js → errors-DpTMfX77.js} +58 -8
  39. package/dist/errors-DpTMfX77.js.map +1 -0
  40. package/dist/{field-access-KYk8RGOx.js → field-access-CzKjatID.js} +3 -3
  41. package/dist/{field-access-KYk8RGOx.js.map → field-access-CzKjatID.js.map} +1 -1
  42. package/dist/{filter-dialect-CE4bloug.js → filter-dialect-C5wfpopB.js} +110 -9
  43. package/dist/{filter-dialect-CE4bloug.js.map → filter-dialect-C5wfpopB.js.map} +1 -1
  44. package/dist/{function-loader-CKB9b4uP.js → function-loader-BzKo2Oiu.js} +2 -2
  45. package/dist/{function-loader-CKB9b4uP.js.map → function-loader-BzKo2Oiu.js.map} +1 -1
  46. package/dist/{function-routes-DLaXaiQA.js → function-routes-CQ0z3WDt.js} +2 -2
  47. package/dist/{function-routes-DLaXaiQA.js.map → function-routes-CQ0z3WDt.js.map} +1 -1
  48. package/dist/functions/index.d.ts +1 -0
  49. package/dist/functions/index.js +10 -29
  50. package/dist/functions/index.js.map +1 -1
  51. package/dist/functions/wait-until.d.ts +29 -1
  52. package/dist/{history-recorder-BE4HWR-M.js → history-recorder-wkBuX7Np.js} +2 -2
  53. package/dist/{history-recorder-BE4HWR-M.js.map → history-recorder-wkBuX7Np.js.map} +1 -1
  54. package/dist/index.d.ts +4 -1
  55. package/dist/index.es.js +2260 -1284
  56. package/dist/index.es.js.map +1 -1
  57. package/dist/init/surfaces.d.ts +19 -3
  58. package/dist/{jobs-CXTs9qXH.js → jobs-D61qYEGt.js} +2 -2
  59. package/dist/{jobs-CXTs9qXH.js.map → jobs-D61qYEGt.js.map} +1 -1
  60. package/dist/{jwt-5EvX3lQa.js → jwt-CBmQXYs-.js} +2 -2
  61. package/dist/{jwt-5EvX3lQa.js.map → jwt-CBmQXYs-.js.map} +1 -1
  62. package/dist/{keys-DJ1ZNcZi.js → keys-Cd_4l48g.js} +2 -2
  63. package/dist/{keys-DJ1ZNcZi.js.map → keys-Cd_4l48g.js.map} +1 -1
  64. package/dist/{logs-routes-DXLvMasE.js → logs-routes-08LiyYua.js} +2 -2
  65. package/dist/{logs-routes-DXLvMasE.js.map → logs-routes-08LiyYua.js.map} +1 -1
  66. package/dist/mcp/consent-page.d.ts +14 -1
  67. package/dist/mcp/mcp-apps.d.ts +51 -17
  68. package/dist/mcp/mcp-routes.d.ts +6 -1
  69. package/dist/mcp/mcp-tools.d.ts +44 -1
  70. package/dist/mcp/mcp-view.d.ts +107 -0
  71. package/dist/mcp/oauth-metadata.d.ts +7 -1
  72. package/dist/mcp/show-app-guide.d.ts +1 -0
  73. package/dist/metrics/database.d.ts +69 -0
  74. package/dist/metrics/db-connection-errors.d.ts +21 -0
  75. package/dist/{offline-BjJdcVBb-BOzzsnrh.js → offline-BjJdcVBb-B_bOcnDC.js} +4 -4
  76. package/dist/{offline-BjJdcVBb-BOzzsnrh.js.map → offline-BjJdcVBb-B_bOcnDC.js.map} +1 -1
  77. package/dist/{offline-store-Cxhh99Q--FB6fSf5A.js → offline-store-Cxhh99Q--DQ-M1M8d.js} +4 -4
  78. package/dist/{offline-store-Cxhh99Q--FB6fSf5A.js.map → offline-store-Cxhh99Q--DQ-M1M8d.js.map} +1 -1
  79. package/dist/{openapi-generator-B6aw_KuR.js → openapi-generator-B3LsKCon.js} +4 -4
  80. package/dist/{openapi-generator-B6aw_KuR.js.map → openapi-generator-B3LsKCon.js.map} +1 -1
  81. package/dist/{proxy-2nS5N63I.js → proxy-LUsudeht.js} +2 -2
  82. package/dist/{proxy-2nS5N63I.js.map → proxy-LUsudeht.js.map} +1 -1
  83. package/dist/{query-parser-DFVCjW5i.js → query-parser-C90z8csB.js} +6 -6
  84. package/dist/{query-parser-DFVCjW5i.js.map → query-parser-C90z8csB.js.map} +1 -1
  85. package/dist/{request-timeout-Cqm4JXtZ.js → request-timeout-DW2OBWfJ.js} +2 -2
  86. package/dist/{request-timeout-Cqm4JXtZ.js.map → request-timeout-DW2OBWfJ.js.map} +1 -1
  87. package/dist/{rls-simulator-routes-D5-XfjzW.js → rls-simulator-routes-igGu-giT.js} +4 -4
  88. package/dist/{rls-simulator-routes-D5-XfjzW.js.map → rls-simulator-routes-igGu-giT.js.map} +1 -1
  89. package/dist/{schema-editor-routes-DzSe6V0a.js → schema-editor-routes-kF1ZKCB2.js} +4 -4
  90. package/dist/{schema-editor-routes-DzSe6V0a.js.map → schema-editor-routes-kF1ZKCB2.js.map} +1 -1
  91. package/dist/serve-spa.d.ts +2 -10
  92. package/dist/{soft-delete-params-9lKBAlDw.js → soft-delete-params-DDRmxT2z.js} +2 -2
  93. package/dist/{soft-delete-params-9lKBAlDw.js.map → soft-delete-params-DDRmxT2z.js.map} +1 -1
  94. package/dist/{sql-export-routes-BxMqgAFX.js → sql-export-routes-DObpbf8x.js} +3 -3
  95. package/dist/{sql-export-routes-BxMqgAFX.js.map → sql-export-routes-DObpbf8x.js.map} +1 -1
  96. package/dist/{src-JQNz7cWv.js → src-BXDkXOtq.js} +2 -1
  97. package/dist/{src-JQNz7cWv.js.map → src-BXDkXOtq.js.map} +1 -1
  98. package/dist/{upload-validation-IYXn4xcm.js → upload-validation-B-psYLaN.js} +2 -2
  99. package/dist/{upload-validation-IYXn4xcm.js.map → upload-validation-B-psYLaN.js.map} +1 -1
  100. package/package.json +5 -5
  101. package/dist/auth-CZGfVKcL.js.map +0 -1
  102. package/dist/auth_adapter-B7RUMk6e.js.map +0 -1
  103. package/dist/dist-CT9HJehq.js +0 -22
  104. package/dist/dist-CT9HJehq.js.map +0 -1
  105. package/dist/errors-DIWnZIDY.js.map +0 -1
@@ -0,0 +1,69 @@
1
+ /**
2
+ * What the database side of this process looks like, for `/metrics`.
3
+ *
4
+ * Three kinds of number, each answering a question the pool-wait histogram
5
+ * cannot:
6
+ *
7
+ * - **Pools** (`rebase_db_pool_{connections,idle,waiting}`, per source and pool) —
8
+ * read from the pools at each scrape. `waiting` above zero for long is a
9
+ * pool too small for its load; `total` across instances is what they ask of
10
+ * the database between them.
11
+ * - **Connection errors** (`rebase_db_connection_errors_total{code}`) —
12
+ * requests answered 503 because no connection could be had: the server out
13
+ * of connections (`53300`, `53400`), the pool exhausted, a connect timeout,
14
+ * the database unreachable. Counted where the request's error is classified.
15
+ * - **The server** (`rebase_db_connections{state}`, `rebase_db_max_connections`,
16
+ * `rebase_db_size_bytes`, `rebase_db_replica_lag_seconds`) — sampled every
17
+ * 30 seconds by a probe on each source's own connection, not at scrape time:
18
+ * a scrape every few seconds must not become a query every few seconds.
19
+ *
20
+ * The control plane scrapes this on every substrate, including where it
21
+ * cannot reach the database itself, so these are how it sees the database.
22
+ *
23
+ * @module
24
+ */
25
+ import { type DatabaseAdmin, type DatabaseHealthSample } from "@rebasepro/types";
26
+ import type { MetricsRegistry } from "./index.js";
27
+ export { dbConnectionErrorCounts, noteDbConnectionError, type DbConnectionErrorCode } from "./db-connection-errors.js";
28
+ export declare const DB_POOL_CONNECTIONS_METRIC = "rebase_db_pool_connections";
29
+ export declare const DB_POOL_IDLE_METRIC = "rebase_db_pool_idle";
30
+ export declare const DB_POOL_WAITING_METRIC = "rebase_db_pool_waiting";
31
+ export declare const DB_CONNECTION_ERRORS_METRIC = "rebase_db_connection_errors_total";
32
+ export declare const DB_CONNECTIONS_METRIC = "rebase_db_connections";
33
+ export declare const DB_MAX_CONNECTIONS_METRIC = "rebase_db_max_connections";
34
+ export declare const DB_SIZE_METRIC = "rebase_db_size_bytes";
35
+ export declare const DB_REPLICA_LAG_METRIC = "rebase_db_replica_lag_seconds";
36
+ /** How often the server behind each source is sampled. */
37
+ export declare const DB_PROBE_INTERVAL_MS = 30000;
38
+ /** A pool's three counts, as `pg.Pool` keeps them. Any field may be missing on another driver's pool. */
39
+ interface CountedPool {
40
+ totalCount?: number;
41
+ idleCount?: number;
42
+ waitingCount?: number;
43
+ }
44
+ /** One data source as the metrics see it: its key, the pool the server opened, and how to reach its admin. */
45
+ export interface MeteredSource {
46
+ key: string;
47
+ pool?: CountedPool;
48
+ admin: () => DatabaseAdmin | undefined;
49
+ }
50
+ /**
51
+ * Report each source's pools and the connection-error totals at every render.
52
+ * The server's own pool is read directly — any driver whose pool keeps
53
+ * `pg.Pool`'s counts reports it — and the driver's other pools through
54
+ * `SQLAdmin.poolStats`, when it has one.
55
+ */
56
+ export declare function recordDatabasePools(registry: MetricsRegistry, sources: readonly MeteredSource[]): void;
57
+ /** Write one source's sample into the registry. A field the sample lacks leaves its gauge as it was. */
58
+ export declare function applyHealthSample(registry: MetricsRegistry, source: string, sample: DatabaseHealthSample): void;
59
+ /**
60
+ * Sample every source that can be sampled, now and every
61
+ * {@link DB_PROBE_INTERVAL_MS}. Returns the stop. The timer is unref'd, so it
62
+ * never holds the process open; a sample still running is not doubled.
63
+ *
64
+ * A source whose driver has no `SQLAdmin.sampleHealth` is skipped. A failed
65
+ * sample is logged at debug and leaves the last values in place — the gauges
66
+ * describe the database, and the database did not change because one sample
67
+ * failed.
68
+ */
69
+ export declare function startDatabaseProbe(registry: MetricsRegistry, sources: readonly MeteredSource[], intervalMs?: number): () => void;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Requests that failed for want of a database connection, counted where the
3
+ * error handler classifies them — see `rebase_db_connection_errors_total` in
4
+ * `database.ts`, which renders these.
5
+ *
6
+ * Its own module, with no imports, because the error handler is part of the
7
+ * portable `@rebasepro/server/functions` entry: whatever it imports has to load
8
+ * on a runtime without Node.
9
+ *
10
+ * @module
11
+ */
12
+ /**
13
+ * Why a request found no connection: a SQLSTATE (`53300`, `53400`) or
14
+ * `pool_exhausted`, `connect_timeout`, `unreachable`. A closed set — never a
15
+ * message — so the label stays bounded.
16
+ */
17
+ export type DbConnectionErrorCode = "53300" | "53400" | "pool_exhausted" | "connect_timeout" | "unreachable";
18
+ /** Count one request that failed for want of a connection. */
19
+ export declare function noteDbConnectionError(code: DbConnectionErrorCode): void;
20
+ /** The totals so far, for rendering and for tests. */
21
+ export declare function dbConnectionErrorCounts(): ReadonlyMap<string, number>;
@@ -3,10 +3,10 @@ import __rebaseProcess from "process";
3
3
  globalThis.process ??= __rebaseProcess;
4
4
  __rebaseCreateRequire(import.meta.url);
5
5
  import { a as RebaseClientError, i as RebaseApiError, o as isUnsupported } from "./data_driver-D0mg1Y_x.js";
6
- import { D as Vector, E as GeoPoint, S as hasFieldOperation, T as EntityRelation, _ as normalizeOrderBy, c as collectAllPages, l as paginateFind, u as resolveFindWindow, w as EntityReference } from "./filter-dialect-CE4bloug.js";
7
- import { et as parseRelationAggregateSort, nt as toCanonicalOp } from "./src-JQNz7cWv.js";
6
+ import { D as Vector, E as GeoPoint, S as hasFieldOperation, T as EntityRelation, _ as normalizeOrderBy, c as collectAllPages, l as paginateFind, u as resolveFindWindow, w as EntityReference } from "./filter-dialect-C5wfpopB.js";
7
+ import { et as parseRelationAggregateSort, nt as toCanonicalOp } from "./src-BXDkXOtq.js";
8
8
  import { t as splitSearchTerms } from "./strings.es-B7QLnHh2.js";
9
- import { a as byIdRead, f as rebaseReviver, h as unref, i as buildQueryString, m as withETag, n as MemoryOfflineStore, p as etagOf, r as SDKQueryBuilder, s as createMutationId, t as IndexedDBOfflineStore, u as invalidBulkBody } from "./offline-store-Cxhh99Q--FB6fSf5A.js";
9
+ import { a as byIdRead, f as rebaseReviver, h as unref, i as buildQueryString, m as withETag, n as MemoryOfflineStore, p as etagOf, r as SDKQueryBuilder, s as createMutationId, t as IndexedDBOfflineStore, u as invalidBulkBody } from "./offline-store-Cxhh99Q--DQ-M1M8d.js";
10
10
  //#region ../client/dist/offline-BjJdcVBb.js
11
11
  /**
12
12
  * Lossless round-tripping of rows through the offline store.
@@ -3417,4 +3417,4 @@ var OfflineManager = class {
3417
3417
  //#endregion
3418
3418
  export { OfflineManager };
3419
3419
 
3420
- //# sourceMappingURL=offline-BjJdcVBb-BOzzsnrh.js.map
3420
+ //# sourceMappingURL=offline-BjJdcVBb-B_bOcnDC.js.map