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
package/dist/cli/migrate.d.ts
CHANGED
|
@@ -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.
|
package/dist/cli/observe.d.ts
CHANGED
|
@@ -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/cli/observe.js
CHANGED
|
@@ -170,7 +170,16 @@ async function apiLatency(res, pool, params) {
|
|
|
170
170
|
try {
|
|
171
171
|
await client.query('ROLLBACK');
|
|
172
172
|
}
|
|
173
|
-
catch {
|
|
173
|
+
catch {
|
|
174
|
+
// Deliberately swallowed, and only this one. `err` above is the failure
|
|
175
|
+
// worth reporting and it is what the 500 below carries; a ROLLBACK that
|
|
176
|
+
// also fails means the connection is already gone, which node-postgres
|
|
177
|
+
// handles by discarding the client on the release() in `finally`.
|
|
178
|
+
// Surfacing it instead would replace a real diagnosis ("statement
|
|
179
|
+
// timeout", "relation does not exist") with "connection terminated", and
|
|
180
|
+
// this server writes no log of its own, so the HTTP response is the only
|
|
181
|
+
// channel either error could reach. Same shape as cli/studio.ts.
|
|
182
|
+
}
|
|
174
183
|
sendJson(res, 500, { error: err instanceof Error ? err.message : String(err) });
|
|
175
184
|
}
|
|
176
185
|
finally {
|
|
@@ -202,7 +211,16 @@ async function apiModels(res, pool, params) {
|
|
|
202
211
|
try {
|
|
203
212
|
await client.query('ROLLBACK');
|
|
204
213
|
}
|
|
205
|
-
catch {
|
|
214
|
+
catch {
|
|
215
|
+
// Deliberately swallowed, and only this one. `err` above is the failure
|
|
216
|
+
// worth reporting and it is what the 500 below carries; a ROLLBACK that
|
|
217
|
+
// also fails means the connection is already gone, which node-postgres
|
|
218
|
+
// handles by discarding the client on the release() in `finally`.
|
|
219
|
+
// Surfacing it instead would replace a real diagnosis ("statement
|
|
220
|
+
// timeout", "relation does not exist") with "connection terminated", and
|
|
221
|
+
// this server writes no log of its own, so the HTTP response is the only
|
|
222
|
+
// channel either error could reach. Same shape as cli/studio.ts.
|
|
223
|
+
}
|
|
206
224
|
sendJson(res, 500, { error: err instanceof Error ? err.message : String(err) });
|
|
207
225
|
}
|
|
208
226
|
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
|
/**
|
|
@@ -56,8 +56,12 @@ import { ownLookup } from '../query/utils.js';
|
|
|
56
56
|
* Copy 2 belongs to the SQL compiler and cannot import this one (a query-path
|
|
57
57
|
* module must not depend on `cli/`), so the deduplication has to go the other
|
|
58
58
|
* way: the list wants to live in `query/filters.ts` and be imported here, the
|
|
59
|
-
* way {@link COLUMN_REF_OPERATORS} above now is.
|
|
60
|
-
*
|
|
59
|
+
* way {@link COLUMN_REF_OPERATORS} above now is.
|
|
60
|
+
*
|
|
61
|
+
* That destination now EXISTS (`RELATION_FILTER_WRAPPERS` in `query/filters.ts`)
|
|
62
|
+
* and nothing imports it, including this file, so it is a fourth copy rather
|
|
63
|
+
* than a deduplication and this comment is still the only thing holding them in
|
|
64
|
+
* step. Moving each walk onto it is a change per walk, each with its own tests.
|
|
61
65
|
*/
|
|
62
66
|
export const RELATION_FILTER_WRAPPERS = ['some', 'none', 'every', 'is', 'isNot'];
|
|
63
67
|
const RELATION_FILTER_WRAPPER_SET = new Set(RELATION_FILTER_WRAPPERS);
|