turbine-orm 0.67.0 → 0.70.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.
- package/dist/cjs/cli/error-catalog.d.ts +77 -0
- package/dist/cjs/cli/error-catalog.js +388 -0
- package/dist/cjs/cli/index.js +3 -2
- package/dist/cjs/cli/mcp.d.ts +19 -3
- package/dist/cjs/cli/mcp.js +709 -22
- package/dist/cjs/cli/migrate.d.ts +19 -2
- package/dist/cjs/cli/observe.d.ts +2 -2
- package/dist/cjs/cli/observe.js +20 -2
- package/dist/cjs/cli/pii-predicate-guard.d.ts +6 -2
- package/dist/cjs/cli/pii-predicate-guard.js +6 -2
- package/dist/cjs/cli/studio-ui.generated.js +1 -1
- package/dist/cjs/client.d.ts +30 -75
- package/dist/cjs/client.js +31 -11
- package/dist/cjs/introspect.d.ts +113 -17
- package/dist/cjs/introspect.js +229 -33
- package/dist/cjs/pg-types.d.ts +153 -0
- package/dist/cjs/pg-types.js +38 -0
- package/dist/cjs/pipeline.d.ts +3 -3
- package/dist/cjs/query/batched-loader.d.ts +2 -2
- package/dist/cjs/query/builder.d.ts +2 -2
- package/dist/cjs/query/builder.js +10 -1
- package/dist/cjs/query/deferred.d.ts +6 -6
- package/dist/cjs/query/filters.d.ts +13 -7
- package/dist/cjs/query/filters.js +13 -14
- package/dist/cjs/query/where.d.ts +2 -2
- package/dist/cjs/schema-sql.d.ts +18 -0
- package/dist/cjs/schema-sql.js +18 -0
- package/dist/cli/error-catalog.d.ts +77 -0
- package/dist/cli/error-catalog.js +383 -0
- package/dist/cli/index.js +3 -2
- package/dist/cli/mcp.d.ts +19 -3
- package/dist/cli/mcp.js +709 -23
- package/dist/cli/migrate.d.ts +19 -2
- package/dist/cli/observe.d.ts +2 -2
- package/dist/cli/observe.js +20 -2
- package/dist/cli/pii-predicate-guard.d.ts +6 -2
- package/dist/cli/pii-predicate-guard.js +6 -2
- package/dist/cli/studio-ui.generated.js +1 -1
- package/dist/client.d.ts +30 -75
- package/dist/client.js +31 -11
- package/dist/introspect.d.ts +113 -17
- package/dist/introspect.js +227 -33
- package/dist/pg-types.d.ts +153 -0
- package/dist/pg-types.js +37 -0
- package/dist/pipeline.d.ts +3 -3
- package/dist/query/batched-loader.d.ts +2 -2
- package/dist/query/builder.d.ts +2 -2
- package/dist/query/builder.js +10 -1
- package/dist/query/deferred.d.ts +6 -6
- package/dist/query/filters.d.ts +13 -7
- package/dist/query/filters.js +13 -13
- package/dist/query/where-compile.js +1 -1
- package/dist/query/where.d.ts +2 -2
- package/dist/schema-sql.d.ts +18 -0
- package/dist/schema-sql.js +18 -0
- package/package.json +19 -7
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* -- DOWN
|
|
12
12
|
* DROP TABLE users;
|
|
13
13
|
*/
|
|
14
|
-
import pg from 'pg';
|
|
15
14
|
import type { DatabaseAdapter } from '../adapters/index.js';
|
|
16
15
|
import { type Dialect } from '../dialect.js';
|
|
16
|
+
import type { PgCompatQueryResult } from '../pg-types.js';
|
|
17
17
|
import { type DestructiveStatement } from './destructive.js';
|
|
18
18
|
import { splitSqlStatements } from './sql-statements.js';
|
|
19
19
|
/**
|
|
@@ -289,6 +289,23 @@ export interface MigrationLockClient {
|
|
|
289
289
|
query(sql: string, params?: unknown[]): Promise<unknown>;
|
|
290
290
|
end(): Promise<void>;
|
|
291
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* The ROW-RETURNING query surface the runner needs, for the paths that read the
|
|
294
|
+
* tracking table back rather than just issuing a statement.
|
|
295
|
+
*
|
|
296
|
+
* Deliberately not `PgCompatPoolClient`: this connection is a `pg.Client`,
|
|
297
|
+
* which has no `release()`, so the pooled-client interface does not fit. Naming
|
|
298
|
+
* the driver type itself would put a pg module import back into the published
|
|
299
|
+
* declarations, which is what `src/pg-types.ts` exists to prevent, and it is
|
|
300
|
+
* also why this comment does not spell that import form out: the `consumer-types`
|
|
301
|
+
* CI job greps the built `.d.ts` files for it and cannot tell prose from code.
|
|
302
|
+
* `pg.Client` satisfies this structurally; tests supply a fake.
|
|
303
|
+
*
|
|
304
|
+
* @internal
|
|
305
|
+
*/
|
|
306
|
+
export interface MigrationQueryClient {
|
|
307
|
+
query<R = Record<string, unknown>>(sql: string, params?: unknown[]): Promise<PgCompatQueryResult<R>>;
|
|
308
|
+
}
|
|
292
309
|
/** A held (or refused) migration lock, and whatever must be released with it. */
|
|
293
310
|
export interface MigrationLock {
|
|
294
311
|
/** False when another migration already holds the lock. */
|
|
@@ -373,7 +390,7 @@ export interface MigrationDeployPlan {
|
|
|
373
390
|
*
|
|
374
391
|
* @internal exported for tests; not part of the CLI's public surface.
|
|
375
392
|
*/
|
|
376
|
-
export declare function validateChecksums(client:
|
|
393
|
+
export declare function validateChecksums(client: MigrationQueryClient, migrationsDir: string, dialect?: Dialect): Promise<ChecksumMismatch[]>;
|
|
377
394
|
export declare function formatChecksumMismatchError(mismatches: ChecksumMismatch[]): string;
|
|
378
395
|
/**
|
|
379
396
|
* Build a deploy plan from local migration files and applied migration rows.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* random token, HttpOnly cookie, CSP headers, read-only transactions.
|
|
7
7
|
*/
|
|
8
8
|
import { type IncomingMessage, type ServerResponse } from 'node:http';
|
|
9
|
-
import
|
|
9
|
+
import type { PgCompatPool } from '../pg-types.js';
|
|
10
10
|
export interface ObserveOptions {
|
|
11
11
|
url: string;
|
|
12
12
|
port: number;
|
|
@@ -19,7 +19,7 @@ export interface ObserveServerHandle {
|
|
|
19
19
|
url: string;
|
|
20
20
|
}
|
|
21
21
|
export declare function startObserve(options: ObserveOptions): Promise<ObserveServerHandle>;
|
|
22
|
-
export declare function handleRequest(req: IncomingMessage, res: ServerResponse, pool:
|
|
22
|
+
export declare function handleRequest(req: IncomingMessage, res: ServerResponse, pool: PgCompatPool, options: ObserveOptions, authToken: string, rateLimiter: Map<string, {
|
|
23
23
|
count: number;
|
|
24
24
|
resetAt: number;
|
|
25
25
|
}>): Promise<void>;
|
package/dist/cjs/cli/observe.js
CHANGED
|
@@ -177,7 +177,16 @@ async function apiLatency(res, pool, params) {
|
|
|
177
177
|
try {
|
|
178
178
|
await client.query('ROLLBACK');
|
|
179
179
|
}
|
|
180
|
-
catch {
|
|
180
|
+
catch {
|
|
181
|
+
// Deliberately swallowed, and only this one. `err` above is the failure
|
|
182
|
+
// worth reporting and it is what the 500 below carries; a ROLLBACK that
|
|
183
|
+
// also fails means the connection is already gone, which node-postgres
|
|
184
|
+
// handles by discarding the client on the release() in `finally`.
|
|
185
|
+
// Surfacing it instead would replace a real diagnosis ("statement
|
|
186
|
+
// timeout", "relation does not exist") with "connection terminated", and
|
|
187
|
+
// this server writes no log of its own, so the HTTP response is the only
|
|
188
|
+
// channel either error could reach. Same shape as cli/studio.ts.
|
|
189
|
+
}
|
|
181
190
|
sendJson(res, 500, { error: err instanceof Error ? err.message : String(err) });
|
|
182
191
|
}
|
|
183
192
|
finally {
|
|
@@ -209,7 +218,16 @@ async function apiModels(res, pool, params) {
|
|
|
209
218
|
try {
|
|
210
219
|
await client.query('ROLLBACK');
|
|
211
220
|
}
|
|
212
|
-
catch {
|
|
221
|
+
catch {
|
|
222
|
+
// Deliberately swallowed, and only this one. `err` above is the failure
|
|
223
|
+
// worth reporting and it is what the 500 below carries; a ROLLBACK that
|
|
224
|
+
// also fails means the connection is already gone, which node-postgres
|
|
225
|
+
// handles by discarding the client on the release() in `finally`.
|
|
226
|
+
// Surfacing it instead would replace a real diagnosis ("statement
|
|
227
|
+
// timeout", "relation does not exist") with "connection terminated", and
|
|
228
|
+
// this server writes no log of its own, so the HTTP response is the only
|
|
229
|
+
// channel either error could reach. Same shape as cli/studio.ts.
|
|
230
|
+
}
|
|
213
231
|
sendJson(res, 500, { error: err instanceof Error ? err.message : String(err) });
|
|
214
232
|
}
|
|
215
233
|
finally {
|
|
@@ -55,8 +55,12 @@ import type { SchemaMetadata, TableMetadata } from '../schema.js';
|
|
|
55
55
|
* Copy 2 belongs to the SQL compiler and cannot import this one (a query-path
|
|
56
56
|
* module must not depend on `cli/`), so the deduplication has to go the other
|
|
57
57
|
* way: the list wants to live in `query/filters.ts` and be imported here, the
|
|
58
|
-
* way {@link COLUMN_REF_OPERATORS} above now is.
|
|
59
|
-
*
|
|
58
|
+
* way {@link COLUMN_REF_OPERATORS} above now is.
|
|
59
|
+
*
|
|
60
|
+
* That destination now EXISTS (`RELATION_FILTER_WRAPPERS` in `query/filters.ts`)
|
|
61
|
+
* and nothing imports it, including this file, so it is a fourth copy rather
|
|
62
|
+
* than a deduplication and this comment is still the only thing holding them in
|
|
63
|
+
* step. Moving each walk onto it is a change per walk, each with its own tests.
|
|
60
64
|
*/
|
|
61
65
|
export declare const RELATION_FILTER_WRAPPERS: readonly ["some", "none", "every", "is", "isNot"];
|
|
62
66
|
/**
|
|
@@ -60,8 +60,12 @@ const utils_js_1 = require("../query/utils.js");
|
|
|
60
60
|
* Copy 2 belongs to the SQL compiler and cannot import this one (a query-path
|
|
61
61
|
* module must not depend on `cli/`), so the deduplication has to go the other
|
|
62
62
|
* way: the list wants to live in `query/filters.ts` and be imported here, the
|
|
63
|
-
* way {@link COLUMN_REF_OPERATORS} above now is.
|
|
64
|
-
*
|
|
63
|
+
* way {@link COLUMN_REF_OPERATORS} above now is.
|
|
64
|
+
*
|
|
65
|
+
* That destination now EXISTS (`RELATION_FILTER_WRAPPERS` in `query/filters.ts`)
|
|
66
|
+
* and nothing imports it, including this file, so it is a fourth copy rather
|
|
67
|
+
* than a deduplication and this comment is still the only thing holding them in
|
|
68
|
+
* step. Moving each walk onto it is a change per walk, each with its own tests.
|
|
65
69
|
*/
|
|
66
70
|
exports.RELATION_FILTER_WRAPPERS = ['some', 'none', 'every', 'is', 'isNot'];
|
|
67
71
|
const RELATION_FILTER_WRAPPER_SET = new Set(exports.RELATION_FILTER_WRAPPERS);
|