no-mistakes 0.70.0 → 0.72.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/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ import type { PostgresSqlSource, PostgresSqlFacts } from "./postgres-source-types";
2
+ export type * from "./postgres-source-types";
3
+ /** Parse SQL on the native async worker without repository I/O or a database. */
4
+ export function parsePostgresSql(source: PostgresSqlSource): Promise<PostgresSqlFacts>;
5
+ export function parsePostgresSql(sources: PostgresSqlSource[]): Promise<PostgresSqlFacts[]>;
1
6
  import type {
2
7
  PostgresCatalog,
3
8
  PostgresCatalogOptions,
package/index.js CHANGED
@@ -24,6 +24,7 @@ function createJsonApis(descriptors) {
24
24
  }
25
25
 
26
26
  const jsonApis = createJsonApis({
27
+ parsePostgresSql: "parsePostgresSqlJson",
27
28
  generatePostgresCatalog: "generatePostgresCatalogJson",
28
29
  analyzeProject: "analyzeProjectJson",
29
30
  callSites: "callSitesJson",
@@ -167,3 +168,4 @@ module.exports.testsTargets = planning.testsTargets;
167
168
  module.exports.testsWhy = planning.testsWhy;
168
169
 
169
170
  module.exports.generatePostgresCatalog = jsonApis.generatePostgresCatalog;
171
+ module.exports.parsePostgresSql = jsonApis.parsePostgresSql;
package/index.mjs CHANGED
@@ -21,6 +21,7 @@ export const {
21
21
  fetches,
22
22
  flow,
23
23
  generatePostgresCatalog,
24
+ parsePostgresSql,
24
25
  impactedChecks,
25
26
  importUsages,
26
27
  importers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "no-mistakes",
3
- "version": "0.70.0",
3
+ "version": "0.72.0",
4
4
  "description": "Deterministic impact maps, test plans, Playwright coverage, and repository checks for coding agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,9 +45,9 @@
45
45
  "access": "public"
46
46
  },
47
47
  "optionalDependencies": {
48
- "no-mistakes-darwin-arm64": "0.70.0",
49
- "no-mistakes-linux-arm64-gnu": "0.70.0",
50
- "no-mistakes-linux-x64-gnu": "0.70.0",
51
- "no-mistakes-win32-x64-msvc": "0.70.0"
48
+ "no-mistakes-darwin-arm64": "0.72.0",
49
+ "no-mistakes-linux-arm64-gnu": "0.72.0",
50
+ "no-mistakes-linux-x64-gnu": "0.72.0",
51
+ "no-mistakes-win32-x64-msvc": "0.72.0"
52
52
  }
53
53
  }
@@ -1,5 +1,7 @@
1
1
  /** Which facts a generated catalog carries. It is stated in the catalog's `coverage` field. */
2
2
  export type PostgresCatalogCoverage = "complete" | "ordering";
3
+ /** Explicit accessible relation names for requested schemas; an unrequested key is absent. */
4
+ export type PostgresSearchPathEvidence = Partial<Record<string, string[] | null>>;
3
5
  export interface PostgresCatalogOptions {
4
6
  /** Environment variable containing a PostgreSQL connection URL; never pass secrets as options. */
5
7
  connectionEnv: string;
@@ -10,11 +12,21 @@ export interface PostgresCatalogOptions {
10
12
  * `ordering` carries only what conflict and lock ordering need; other catalog rules reject it.
11
13
  */
12
14
  coverage?: PostgresCatalogCoverage;
15
+ /** Opt in to evidence for these exact schemas; absent or inaccessible schemas become null. */
16
+ searchPathSchemas?: string[];
17
+ /**
18
+ * Non-empty name to record as `currentDatabase` instead of the connected database's name.
19
+ * Use the deployed database's name so regeneration does not depend on where it runs.
20
+ */
21
+ currentDatabase?: string;
13
22
  }
14
23
  export interface PostgresOrderingCatalog {
15
24
  formatVersion: 2;
16
25
  coverage: "ordering";
17
26
  schema: string;
27
+ searchPathEvidence?: PostgresSearchPathEvidence;
28
+ /** Exact connected database name; absent in catalogs generated by older versions. */
29
+ currentDatabase?: string;
18
30
  tables: Record<string, PostgresCatalogTable>;
19
31
  }
20
32
  /** A catalog with every fact the catalog model holds. Every catalog rule accepts it. */
@@ -22,6 +34,9 @@ export interface PostgresCompleteCatalog {
22
34
  formatVersion: 2;
23
35
  coverage: "complete";
24
36
  schema: string;
37
+ searchPathEvidence?: PostgresSearchPathEvidence;
38
+ /** Exact connected database name; absent in catalogs generated by older versions. */
39
+ currentDatabase?: string;
25
40
  tables: Record<string, PostgresCompleteCatalogTable>;
26
41
  functions: Record<string, PostgresCatalogFunction>;
27
42
  enums: Record<string, PostgresCatalogEnum>;
@@ -0,0 +1,11 @@
1
+ import type { PostgresSqlName } from "./postgres-source-types";
2
+ export interface PostgresSqlDrop {
3
+ objectType: string;
4
+ names: PostgresSqlName[];
5
+ table: PostgresSqlName | null;
6
+ signatures: string[];
7
+ ifExists: boolean;
8
+ cascade: boolean;
9
+ restrict: boolean;
10
+ temporary: boolean;
11
+ }
@@ -0,0 +1,29 @@
1
+ import type {
2
+ PostgresSqlIdentifier,
3
+ PostgresSqlName,
4
+ PostgresSqlSpan,
5
+ } from "./postgres-source-types";
6
+ /** Syntactic root; wrappers never promote a nested call through an unrelated operator. */
7
+ export type PostgresSqlExpressionRoot =
8
+ | { kind: "columnReference"; name: PostgresSqlName }
9
+ | {
10
+ kind: "functionCall";
11
+ name: PostgresSqlName;
12
+ arguments: PostgresSqlCallArgument[];
13
+ argumentsComplete: boolean;
14
+ syntax: PostgresSqlFunctionSyntax;
15
+ modifiers: string[];
16
+ }
17
+ | { kind: "parenthesized"; expression: PostgresSqlExpressionRoot }
18
+ | { kind: "cast"; dataType: string; expression: PostgresSqlExpressionRoot }
19
+ | { kind: "literal"; sql: string }
20
+ | { kind: "binary" | "unary"; operator: string }
21
+ | { kind: "case" | "subquery" | "other" };
22
+ /** Bare CURRENT_TIMESTAMP is a value function; CURRENT_TIMESTAMP(3) uses call syntax. */
23
+ export type PostgresSqlFunctionSyntax = "call" | "value";
24
+ export interface PostgresSqlCallArgument {
25
+ name: PostgresSqlIdentifier | null;
26
+ sql: string;
27
+ span: PostgresSqlSpan | null;
28
+ root: PostgresSqlExpressionRoot;
29
+ }
@@ -0,0 +1,25 @@
1
+ import type {
2
+ PostgresSqlDiagnostic,
3
+ PostgresSqlExpression,
4
+ PostgresSqlSpan,
5
+ PostgresSqlStatement,
6
+ } from "./postgres-source-types";
7
+ /** Nested facts are procedural source occurrences, never guaranteed execution. */
8
+ export interface PostgresSqlProceduralBlock {
9
+ language: string;
10
+ bodyEncoding: PostgresSqlBodyEncoding;
11
+ bodySpan: PostgresSqlSpan;
12
+ statements: PostgresSqlStatement[];
13
+ diagnostics: PostgresSqlDiagnostic[];
14
+ complete: boolean;
15
+ }
16
+
17
+ /** Branch DDL describes source occurrences, never guaranteed execution. */
18
+ export interface PostgresSqlConditionalBranch {
19
+ condition: PostgresSqlExpression | null;
20
+ span: PostgresSqlSpan;
21
+ statements: PostgresSqlStatement[];
22
+ }
23
+
24
+ /** Original body source slices retain this enclosing literal encoding. */
25
+ export type PostgresSqlBodyEncoding = "dollarQuoted" | "singleQuoted";
@@ -0,0 +1,201 @@
1
+ import type { PostgresSqlExpressionRoot } from "./postgres-expression-types";
2
+ export type * from "./postgres-expression-types";
3
+ import type { PostgresSqlDrop } from "./postgres-drop-types";
4
+ export type * from "./postgres-drop-types";
5
+ import type {
6
+ PostgresSqlConditionalBranch,
7
+ PostgresSqlProceduralBlock,
8
+ } from "./postgres-procedural-types";
9
+ export type * from "./postgres-procedural-types";
10
+ /** Pure SQL source input. No repository, database, or filesystem options are needed. */
11
+ export interface PostgresSqlSource {
12
+ sql: string;
13
+ fileName?: string | null;
14
+ }
15
+ /** UTF-8 byte offset, with one-based Unicode scalar line and column. */
16
+ export interface PostgresSqlPosition {
17
+ offset: number;
18
+ line: number;
19
+ column: number;
20
+ }
21
+ /** End-exclusive source span. */
22
+ export interface PostgresSqlSpan {
23
+ start: PostgresSqlPosition;
24
+ end: PostgresSqlPosition;
25
+ }
26
+ export interface PostgresSqlDiagnostic {
27
+ message: string;
28
+ span: PostgresSqlSpan | null;
29
+ }
30
+ export interface PostgresSqlIdentifier {
31
+ value: string;
32
+ quoted: boolean;
33
+ identity: string;
34
+ }
35
+ export interface PostgresSqlName {
36
+ parts: PostgresSqlIdentifier[];
37
+ sql: string;
38
+ }
39
+ export interface PostgresSqlFunctionReference {
40
+ name: PostgresSqlName;
41
+ span: PostgresSqlSpan | null;
42
+ }
43
+ export interface PostgresSqlExpression {
44
+ sql: string;
45
+ identity: string;
46
+ span: PostgresSqlSpan | null;
47
+ columns: PostgresSqlName[];
48
+ functions: PostgresSqlFunctionReference[];
49
+ root: PostgresSqlExpressionRoot;
50
+ }
51
+ export interface PostgresSqlType {
52
+ sql: string;
53
+ name: PostgresSqlName | null;
54
+ builtin: string | null;
55
+ modifiers: string[];
56
+ arrayDimensions: (number | null)[];
57
+ fields: PostgresSqlColumn[];
58
+ }
59
+ export interface PostgresSqlGeneratedColumn {
60
+ expression: PostgresSqlExpression;
61
+ storage: string | null;
62
+ }
63
+ export interface PostgresSqlIdentityColumn {
64
+ mode: string;
65
+ options: string[];
66
+ }
67
+ export interface PostgresSqlColumn {
68
+ name: PostgresSqlIdentifier;
69
+ dataType: PostgresSqlType;
70
+ nullable: boolean;
71
+ default: PostgresSqlExpression | null;
72
+ generated: PostgresSqlGeneratedColumn | null;
73
+ identity: PostgresSqlIdentityColumn | null;
74
+ constraints: PostgresSqlConstraint[];
75
+ span: PostgresSqlSpan | null;
76
+ }
77
+ export type PostgresSqlConstraintKind = "primaryKey" | "unique" | "foreignKey" | "check" | "other";
78
+ export interface PostgresSqlConstraint {
79
+ kind: PostgresSqlConstraintKind;
80
+ name: PostgresSqlIdentifier | null;
81
+ columns: PostgresSqlIdentifier[];
82
+ expression: PostgresSqlExpression | null;
83
+ referencedTable: PostgresSqlName | null;
84
+ referencedColumns: PostgresSqlIdentifier[];
85
+ onDelete: string | null;
86
+ onUpdate: string | null;
87
+ characteristics: string | null;
88
+ sql: string;
89
+ }
90
+ export type PostgresSqlAlterOperation =
91
+ | { kind: "addColumn"; column: PostgresSqlColumn }
92
+ | {
93
+ kind: "alterColumnType";
94
+ column: PostgresSqlIdentifier;
95
+ dataType: PostgresSqlType;
96
+ using: PostgresSqlExpression | null;
97
+ }
98
+ | { kind: "setDefault"; column: PostgresSqlIdentifier; expression: PostgresSqlExpression }
99
+ | { kind: "dropDefault" | "setNotNull" | "dropNotNull"; column: PostgresSqlIdentifier }
100
+ | { kind: "addConstraint"; constraint: PostgresSqlConstraint; notValid: boolean }
101
+ | { kind: "validateConstraint"; name: PostgresSqlIdentifier }
102
+ | { kind: "other"; sql: string };
103
+ export interface PostgresSqlIndexKey {
104
+ expression: PostgresSqlExpression;
105
+ ascending: boolean;
106
+ nullsFirst: boolean;
107
+ operatorClass: PostgresSqlName | null;
108
+ }
109
+ export interface PostgresSqlIndex {
110
+ name: PostgresSqlName | null;
111
+ table: PostgresSqlName;
112
+ method: string;
113
+ unique: boolean;
114
+ nullsDistinct: boolean;
115
+ keys: PostgresSqlIndexKey[];
116
+ include: PostgresSqlIdentifier[];
117
+ predicate: PostgresSqlExpression | null;
118
+ options: string[];
119
+ structuralIdentity: string;
120
+ }
121
+ export interface PostgresSqlView {
122
+ name: PostgresSqlName;
123
+ columns: PostgresSqlIdentifier[];
124
+ materialized: boolean;
125
+ temporary: boolean;
126
+ orReplace: boolean;
127
+ query: string;
128
+ dependencies: PostgresSqlName[];
129
+ dependenciesComplete: boolean;
130
+ functions: PostgresSqlFunctionReference[];
131
+ }
132
+ export interface PostgresSqlTriggerTransition {
133
+ kind: string;
134
+ name: PostgresSqlName;
135
+ }
136
+ export interface PostgresSqlTrigger {
137
+ name: PostgresSqlName;
138
+ table: PostgresSqlName;
139
+ timing: string | null;
140
+ events: string[];
141
+ forEach: string | null;
142
+ condition: PostgresSqlExpression | null;
143
+ function: PostgresSqlName | null;
144
+ arguments: string[];
145
+ constraint: boolean;
146
+ orReplace: boolean;
147
+ referencedTable: PostgresSqlName | null;
148
+ transitions: PostgresSqlTriggerTransition[];
149
+ executionKind: string | null;
150
+ characteristics: string | null;
151
+ }
152
+ export interface PostgresSqlFunctionArgument {
153
+ name: PostgresSqlIdentifier | null;
154
+ mode: string | null;
155
+ dataType: PostgresSqlType;
156
+ default: PostgresSqlExpression | null;
157
+ }
158
+ export interface PostgresSqlFunction {
159
+ name: PostgresSqlName;
160
+ arguments: PostgresSqlFunctionArgument[];
161
+ returnType: PostgresSqlType | null;
162
+ returnsSet: boolean;
163
+ language: string | null;
164
+ behavior: string | null;
165
+ bodySql: string | null;
166
+ orReplace: boolean;
167
+ temporary: boolean;
168
+ calledOnNull: string | null;
169
+ parallel: string | null;
170
+ configuration: string[];
171
+ security: string | null;
172
+ }
173
+ export type PostgresSqlStatementKind =
174
+ | {
175
+ kind: "createTable";
176
+ table: PostgresSqlName;
177
+ columns: PostgresSqlColumn[];
178
+ constraints: PostgresSqlConstraint[];
179
+ temporary: boolean;
180
+ }
181
+ | { kind: "alterTable"; table: PostgresSqlName; operations: PostgresSqlAlterOperation[] }
182
+ | { kind: "createIndex"; index: PostgresSqlIndex }
183
+ | { kind: "createView"; view: PostgresSqlView }
184
+ | { kind: "createTrigger"; trigger: PostgresSqlTrigger }
185
+ | { kind: "createFunction"; function: PostgresSqlFunction }
186
+ | { kind: "drop"; drop: PostgresSqlDrop }
187
+ | { kind: "doBlock"; block: PostgresSqlProceduralBlock }
188
+ | { kind: "conditional"; branches: PostgresSqlConditionalBranch[] }
189
+ | { kind: "other" };
190
+ export type PostgresSqlStatement = PostgresSqlStatementKind & {
191
+ ordinal: number;
192
+ span: PostgresSqlSpan;
193
+ sql: string;
194
+ };
195
+ /** Versioned facts retain valid neighbors when a statement cannot be parsed. */
196
+ export interface PostgresSqlFacts {
197
+ schemaVersion: 1;
198
+ fileName: string | null;
199
+ statements: PostgresSqlStatement[];
200
+ diagnostics: PostgresSqlDiagnostic[];
201
+ }