@crvouga/mockingbird-service-postgres 3.6.0 → 3.7.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/CHANGELOG.md +7 -1
- package/COMPATIBILITY.md +31 -0
- package/README.md +5 -0
- package/dist/admin.js +216 -26
- package/dist/admin.js.map +3 -3
- package/dist/api/schema-report.d.ts +32 -0
- package/dist/ast/nodes.d.ts +2 -0
- package/dist/executor/relation.d.ts +1 -0
- package/dist/expressions/context.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +405 -27
- package/dist/index.js.map +4 -4
- package/dist/server.js +229 -27
- package/dist/server.js.map +3 -3
- package/dist/storage/database-state.d.ts +7 -0
- package/dist/types/regnamespace.d.ts +5 -0
- package/dist/types/value.d.ts +2 -0
- package/dist/unstable.js +388 -198
- package/dist/unstable.js.map +4 -4
- package/dist/wire/cli.js +457 -82
- package/dist/wire/cli.js.map +4 -4
- package/dist/wire/index.js +229 -27
- package/dist/wire/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface SchemaReportOptions {
|
|
2
|
+
/** Hard upper bounds are 4 MiB, 10,000 statements and 1,000 diagnostics. */
|
|
3
|
+
maxInputBytes?: number;
|
|
4
|
+
maxStatements?: number;
|
|
5
|
+
maxDiagnostics?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SchemaDiagnostic {
|
|
8
|
+
statement: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
line: number;
|
|
11
|
+
column: number;
|
|
12
|
+
object?: string;
|
|
13
|
+
sqlstate: string | null;
|
|
14
|
+
category: "unsupported" | "syntax" | "prerequisite" | "execution" | "unknown" | "limit";
|
|
15
|
+
message: string;
|
|
16
|
+
prerequisiteStatement?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface SchemaReport {
|
|
19
|
+
/** Identifies the local implementation; this is not a live PostgreSQL compatibility assertion. */
|
|
20
|
+
engine: "mockingbird-postgres";
|
|
21
|
+
version: string;
|
|
22
|
+
statements: number;
|
|
23
|
+
accepted: number;
|
|
24
|
+
/** false means a detected gap; null means semantics still require oracle verification. */
|
|
25
|
+
compatible: false | null;
|
|
26
|
+
truncated: boolean;
|
|
27
|
+
diagnostics: SchemaDiagnostic[];
|
|
28
|
+
}
|
|
29
|
+
/** Analyze plain schema SQL in a discarded in-memory database, without network or filesystem access.
|
|
30
|
+
* Successful execution is explicitly unverified: function bodies and dynamic SQL are not proved.
|
|
31
|
+
*/
|
|
32
|
+
export declare function analyzeSchema(sql: string, options?: SchemaReportOptions): SchemaReport;
|
package/dist/ast/nodes.d.ts
CHANGED
|
@@ -555,6 +555,7 @@ export interface CreateSequenceStmt {
|
|
|
555
555
|
readonly options: SequenceOptions;
|
|
556
556
|
}
|
|
557
557
|
export interface AlterSequenceStmt {
|
|
558
|
+
readonly renameTo?: string;
|
|
558
559
|
readonly type: "alter_sequence";
|
|
559
560
|
readonly name: string[];
|
|
560
561
|
readonly ifExists: boolean;
|
|
@@ -623,6 +624,7 @@ export interface CreateFunctionStmt {
|
|
|
623
624
|
readonly language: string;
|
|
624
625
|
readonly body: string | null;
|
|
625
626
|
readonly sqlBody: Statement[] | null;
|
|
627
|
+
readonly settings?: Record<string, string>;
|
|
626
628
|
readonly volatility: "immutable" | "stable" | "volatile" | null;
|
|
627
629
|
readonly strict: boolean;
|
|
628
630
|
}
|
|
@@ -8,12 +8,16 @@ import { type TypeId } from "../types/value.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class EngineCtx implements CastEnv, CompareCtx {
|
|
10
10
|
readonly state: DatabaseState;
|
|
11
|
+
private writeXid;
|
|
12
|
+
rowVersionXid(): number;
|
|
11
13
|
/** transaction timestamp (now(), current_timestamp) — UTC micros since PG epoch */
|
|
12
14
|
readonly txNow: bigint;
|
|
13
15
|
/** statement timestamp */
|
|
14
16
|
readonly stmtNow: bigint;
|
|
15
17
|
constructor(state: DatabaseState, txNow?: bigint);
|
|
16
18
|
timezone(): string;
|
|
19
|
+
relationOid(parts: string[]): number;
|
|
20
|
+
relationName(oid: number): string | null;
|
|
17
21
|
namespaceOid(name: string): number;
|
|
18
22
|
namespaceName(oid: number): string | null;
|
|
19
23
|
zoneOffsetAt(utcMicros: bigint): number;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,3 +26,4 @@ export type { BindValue, JsValue, QueryRow } from "./api/bind.js";
|
|
|
26
26
|
export { Database, type DatabaseFaults, type DatabaseHistory, type DatabaseOptions, type HistoryCheckpoint, type QueryOptions, type RegisterFunctionOptions, Snapshot, } from "./api/database.js";
|
|
27
27
|
export { type ResultSet, type RunResult, Statement } from "./api/statement.js";
|
|
28
28
|
export { type ErrorCategory, PostgresError } from "./errors/error.js";
|
|
29
|
+
export { analyzeSchema, type SchemaReport, type SchemaReportOptions, type SchemaDiagnostic, } from "./api/schema-report.js";
|