no-mistakes 0.69.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/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ import type {
2
+ PostgresCatalog,
3
+ PostgresCatalogOptions,
4
+ PostgresCompleteCatalog,
5
+ PostgresOrderingCatalog,
6
+ } from "./postgres-catalog-types";
7
+ export type * from "./postgres-catalog-types";
1
8
  import type {
2
9
  CheckReport,
3
10
  AnalyzeProjectOptions,
@@ -175,3 +182,17 @@ export function reactCheck(
175
182
  export function reactUsages(
176
183
  options: WithInvocationOptions<ProjectOptions & { target: string }>,
177
184
  ): Promise<ReactUsagesReport>;
185
+
186
+ /**
187
+ * Observe committed PostgreSQL metadata in a read-only transaction and return the catalog that
188
+ * `schemaCatalogPath` reads. Requires psql. `coverage: "ordering"` returns only the ordering facts.
189
+ */
190
+ export function generatePostgresCatalog(
191
+ options: WithInvocationOptions<PostgresCatalogOptions & { coverage: "ordering" }>,
192
+ ): Promise<PostgresOrderingCatalog>;
193
+ export function generatePostgresCatalog(
194
+ options: WithInvocationOptions<PostgresCatalogOptions & { coverage?: "complete" }>,
195
+ ): Promise<PostgresCompleteCatalog>;
196
+ export function generatePostgresCatalog(
197
+ options: WithInvocationOptions<PostgresCatalogOptions>,
198
+ ): Promise<PostgresCatalog>;
package/index.js CHANGED
@@ -24,6 +24,7 @@ function createJsonApis(descriptors) {
24
24
  }
25
25
 
26
26
  const jsonApis = createJsonApis({
27
+ generatePostgresCatalog: "generatePostgresCatalogJson",
27
28
  analyzeProject: "analyzeProjectJson",
28
29
  callSites: "callSitesJson",
29
30
  check: "checkJson",
@@ -164,3 +165,5 @@ module.exports.testsImpact = planning.testsImpact;
164
165
  module.exports.testsPlan = planning.testsPlan;
165
166
  module.exports.testsTargets = planning.testsTargets;
166
167
  module.exports.testsWhy = planning.testsWhy;
168
+
169
+ module.exports.generatePostgresCatalog = jsonApis.generatePostgresCatalog;
package/index.mjs CHANGED
@@ -20,6 +20,7 @@ export const {
20
20
  exportsOf,
21
21
  fetches,
22
22
  flow,
23
+ generatePostgresCatalog,
23
24
  impactedChecks,
24
25
  importUsages,
25
26
  importers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "no-mistakes",
3
- "version": "0.69.0",
3
+ "version": "0.70.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.69.0",
49
- "no-mistakes-linux-arm64-gnu": "0.69.0",
50
- "no-mistakes-linux-x64-gnu": "0.69.0",
51
- "no-mistakes-win32-x64-msvc": "0.69.0"
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"
52
52
  }
53
53
  }
@@ -0,0 +1,105 @@
1
+ /** Which facts a generated catalog carries. It is stated in the catalog's `coverage` field. */
2
+ export type PostgresCatalogCoverage = "complete" | "ordering";
3
+ export interface PostgresCatalogOptions {
4
+ /** Environment variable containing a PostgreSQL connection URL; never pass secrets as options. */
5
+ connectionEnv: string;
6
+ /** Exact PostgreSQL schema name. */
7
+ schema: string;
8
+ /**
9
+ * `complete` (the default) carries every schema fact, and every catalog rule accepts it.
10
+ * `ordering` carries only what conflict and lock ordering need; other catalog rules reject it.
11
+ */
12
+ coverage?: PostgresCatalogCoverage;
13
+ }
14
+ export interface PostgresOrderingCatalog {
15
+ formatVersion: 2;
16
+ coverage: "ordering";
17
+ schema: string;
18
+ tables: Record<string, PostgresCatalogTable>;
19
+ }
20
+ /** A catalog with every fact the catalog model holds. Every catalog rule accepts it. */
21
+ export interface PostgresCompleteCatalog {
22
+ formatVersion: 2;
23
+ coverage: "complete";
24
+ schema: string;
25
+ tables: Record<string, PostgresCompleteCatalogTable>;
26
+ functions: Record<string, PostgresCatalogFunction>;
27
+ enums: Record<string, PostgresCatalogEnum>;
28
+ views: Record<string, PostgresCatalogView>;
29
+ }
30
+ export type PostgresCatalog = PostgresOrderingCatalog | PostgresCompleteCatalog;
31
+ export interface PostgresCatalogColumn {
32
+ dataType: string;
33
+ nullable: boolean;
34
+ ordinalPosition: number;
35
+ defaultExpression: string | null;
36
+ generated: "stored" | "virtual" | null;
37
+ generatedExpression: string | null;
38
+ identity: "a" | "d" | null;
39
+ }
40
+ export interface PostgresCompleteCatalogColumn extends PostgresCatalogColumn {
41
+ comment: string | null;
42
+ }
43
+ export interface PostgresCatalogIndexKey {
44
+ column: string | null;
45
+ opclass: string;
46
+ collation: string | null;
47
+ orderingSupported: boolean;
48
+ expression: string;
49
+ descending: boolean;
50
+ nullsFirst: boolean;
51
+ }
52
+ export interface PostgresCatalogIndex {
53
+ accessMethod: string;
54
+ unique: boolean;
55
+ primary: boolean;
56
+ constraintBacked: boolean;
57
+ immediate: boolean;
58
+ live: boolean;
59
+ valid: boolean;
60
+ ready: boolean;
61
+ predicate: string | null;
62
+ definition: string;
63
+ keys: PostgresCatalogIndexKey[];
64
+ }
65
+ export interface PostgresCatalogTable {
66
+ relationKind: "table" | "partitioned table";
67
+ columns: Record<string, PostgresCatalogColumn>;
68
+ primaryKey: { columns: string[] } | null;
69
+ uniqueConstraints: Record<string, { columns: string[] }>;
70
+ indexes: Record<string, PostgresCatalogIndex>;
71
+ }
72
+ export interface PostgresCatalogForeignKey {
73
+ columns: string[];
74
+ referencedTable: string;
75
+ referencedColumns: string[];
76
+ onDelete: "NO ACTION" | "RESTRICT" | "CASCADE" | "SET NULL" | "SET DEFAULT";
77
+ onUpdate: "NO ACTION" | "RESTRICT" | "CASCADE" | "SET NULL" | "SET DEFAULT";
78
+ validated: boolean;
79
+ }
80
+ export interface PostgresCompleteCatalogTable extends Omit<PostgresCatalogTable, "columns"> {
81
+ columns: Record<string, PostgresCompleteCatalogColumn>;
82
+ comment: string | null;
83
+ /** `pg_get_partkeydef` text such as `RANGE (created_at)`; `null` unless partitioned. */
84
+ physicalPartition: { key: string } | null;
85
+ foreignKeys: Record<string, PostgresCatalogForeignKey>;
86
+ /** `definition` is `pg_get_constraintdef` text; NOT NULL constraints are not checks. */
87
+ checkConstraints: Record<string, { definition: string; validated: boolean }>;
88
+ /** `definition` is `pg_get_triggerdef` text; internal triggers are omitted. */
89
+ triggers: Record<string, { definition: string }>;
90
+ }
91
+ /** Keyed by name and identity arguments, such as `touch()` or `over(a integer)`. */
92
+ export interface PostgresCatalogFunction {
93
+ /** `pg_get_functiondef` text. */
94
+ definition: string;
95
+ }
96
+ export interface PostgresCatalogEnum {
97
+ /** Labels in `enumsortorder`. */
98
+ values: string[];
99
+ }
100
+ export interface PostgresCatalogView {
101
+ materialized: boolean;
102
+ /** `pg_get_viewdef` text. */
103
+ definition: string;
104
+ comment: string | null;
105
+ }