@prisma-next/sql-schema-ir 0.3.0-pr.99.3 → 0.3.0-pr.99.5

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.
@@ -0,0 +1,2 @@
1
+ import { a as SqlIndexIR, c as SqlTypeMetadata, i as SqlForeignKeyIR, l as SqlTypeMetadataRegistry, n as SqlAnnotations, o as SqlSchemaIR, r as SqlColumnIR, s as SqlTableIR, t as PrimaryKey, u as SqlUniqueIR } from "../types-B_SW1GAT.mjs";
2
+ export { PrimaryKey, SqlAnnotations, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlTableIR, SqlTypeMetadata, SqlTypeMetadataRegistry, SqlUniqueIR };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ import { a as SqlIndexIR, c as SqlTypeMetadata, i as SqlForeignKeyIR, l as SqlTypeMetadataRegistry, n as SqlAnnotations, o as SqlSchemaIR, r as SqlColumnIR, s as SqlTableIR, t as PrimaryKey, u as SqlUniqueIR } from "./types-B_SW1GAT.mjs";
2
+ export { PrimaryKey, SqlAnnotations, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlTableIR, SqlTypeMetadata, SqlTypeMetadataRegistry, SqlUniqueIR };
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import "./exports/types.mjs";
2
+
3
+ export { };
@@ -0,0 +1,115 @@
1
+ //#region src/types.d.ts
2
+ /**
3
+ * SQL Schema IR types for target-agnostic schema representation.
4
+ *
5
+ * These types represent the canonical in-memory representation of SQL schemas
6
+ * for the SQL family, used for verification and future migration planning.
7
+ */
8
+ /**
9
+ * Primary key definition matching ContractIR format.
10
+ * Defined here to avoid circular dependency with sql-contract.
11
+ */
12
+ type PrimaryKey = {
13
+ readonly columns: readonly string[];
14
+ readonly name?: string;
15
+ };
16
+ /**
17
+ * Namespaced annotations for extensibility.
18
+ * Each namespace (e.g., 'pg', 'pgvector') owns its annotations.
19
+ */
20
+ type SqlAnnotations = {
21
+ readonly [namespace: string]: unknown;
22
+ };
23
+ /**
24
+ * SQL column IR representing a column in a table.
25
+ */
26
+ type SqlColumnIR = {
27
+ readonly name: string;
28
+ readonly nativeType: string;
29
+ readonly nullable: boolean;
30
+ readonly annotations?: SqlAnnotations;
31
+ };
32
+ /**
33
+ * SQL foreign key IR.
34
+ */
35
+ type SqlForeignKeyIR = {
36
+ readonly columns: readonly string[];
37
+ readonly referencedTable: string;
38
+ readonly referencedColumns: readonly string[];
39
+ readonly name?: string;
40
+ readonly annotations?: SqlAnnotations;
41
+ };
42
+ /**
43
+ * SQL unique constraint IR.
44
+ */
45
+ type SqlUniqueIR = {
46
+ readonly columns: readonly string[];
47
+ readonly name?: string;
48
+ readonly annotations?: SqlAnnotations;
49
+ };
50
+ /**
51
+ * SQL index IR.
52
+ */
53
+ type SqlIndexIR = {
54
+ readonly columns: readonly string[];
55
+ readonly name?: string;
56
+ readonly unique: boolean;
57
+ readonly annotations?: SqlAnnotations;
58
+ };
59
+ /**
60
+ * SQL table IR representing a table in the schema.
61
+ * Primary key format matches ContractIR for consistency.
62
+ */
63
+ type SqlTableIR = {
64
+ readonly name: string;
65
+ readonly columns: Record<string, SqlColumnIR>;
66
+ readonly primaryKey?: PrimaryKey;
67
+ readonly foreignKeys: readonly SqlForeignKeyIR[];
68
+ readonly uniques: readonly SqlUniqueIR[];
69
+ readonly indexes: readonly SqlIndexIR[];
70
+ readonly annotations?: SqlAnnotations;
71
+ };
72
+ /**
73
+ * SQL Schema IR representing the complete database schema.
74
+ * This is the target-agnostic representation used for verification and migration planning.
75
+ */
76
+ type SqlSchemaIR = {
77
+ readonly tables: Record<string, SqlTableIR>;
78
+ readonly extensions: readonly string[];
79
+ readonly annotations?: SqlAnnotations;
80
+ };
81
+ /**
82
+ * SQL type metadata for control-plane and execution-plane type availability and mapping.
83
+ * This abstraction provides a read-only view of type information without encode/decode behavior.
84
+ */
85
+ interface SqlTypeMetadata {
86
+ /**
87
+ * Namespaced type identifier in format 'namespace/name@version'
88
+ * Examples: 'pg/int4@1', 'pg/text@1', 'pg/timestamptz@1'
89
+ */
90
+ readonly typeId: string;
91
+ /**
92
+ * Contract scalar type IDs that this type can handle.
93
+ * Examples: ['text'], ['int4', 'float8'], ['timestamp', 'timestamptz']
94
+ */
95
+ readonly targetTypes: readonly string[];
96
+ /**
97
+ * Native database type name (target-specific).
98
+ * Examples: 'integer', 'text', 'character varying', 'timestamp with time zone'
99
+ * This is optional because not all types have a native database representation.
100
+ */
101
+ readonly nativeType?: string;
102
+ }
103
+ /**
104
+ * Registry interface for SQL type metadata.
105
+ * Provides read-only iteration over type metadata entries.
106
+ */
107
+ interface SqlTypeMetadataRegistry {
108
+ /**
109
+ * Returns an iterator over all type metadata entries.
110
+ */
111
+ values(): IterableIterator<SqlTypeMetadata>;
112
+ }
113
+ //#endregion
114
+ export { SqlIndexIR as a, SqlTypeMetadata as c, SqlForeignKeyIR as i, SqlTypeMetadataRegistry as l, SqlAnnotations as n, SqlSchemaIR as o, SqlColumnIR as r, SqlTableIR as s, PrimaryKey as t, SqlUniqueIR as u };
115
+ //# sourceMappingURL=types-B_SW1GAT.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-B_SW1GAT.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;AAWA;AASA;AAOA;AAUA;AAWA;AASA;AAWA;;;AAGwB,KA5DZ,UAAA,GA4DY;EACS,SAAA,OAAA,EAAA,SAAA,MAAA,EAAA;EACJ,SAAA,IAAA,CAAA,EAAA,MAAA;CACA;;;AAQ7B;;AACmB,KA/DP,cAAA,GA+DO;EAEM,UAAA,SAAA,EAAA,MAAA,CAAA,EAAA,OAAA;CAAc;AAOvC;AAyBA;;KA1FY,WAAA;;;;yBAIa;;;;;KAMb,eAAA;;;;;yBAKa;;;;;KAMb,WAAA;;;yBAGa;;;;;KAMb,UAAA;;;;yBAIa;;;;;;KAOb,UAAA;;oBAEQ,eAAe;wBACX;iCACS;6BACJ;6BACA;yBACJ;;;;;;KAOb,WAAA;mBACO,eAAe;;yBAET;;;;;;UAOR,eAAA;;;;;;;;;;;;;;;;;;;;;;UAyBA,uBAAA;;;;YAIL,iBAAiB"}
package/package.json CHANGED
@@ -1,37 +1,43 @@
1
1
  {
2
2
  "name": "@prisma-next/sql-schema-ir",
3
- "version": "0.3.0-pr.99.3",
3
+ "version": "0.3.0-pr.99.5",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "SQL Schema IR types for schema introspection and verification",
7
7
  "dependencies": {
8
- "@prisma-next/contract": "0.3.0-pr.99.3"
8
+ "@prisma-next/contract": "0.3.0-pr.99.5"
9
9
  },
10
10
  "devDependencies": {
11
- "tsup": "8.5.1",
11
+ "tsdown": "0.18.4",
12
12
  "typescript": "5.9.3",
13
13
  "vitest": "4.0.16",
14
14
  "@prisma-next/test-utils": "0.0.1",
15
- "@prisma-next/tsconfig": "0.0.0"
15
+ "@prisma-next/tsconfig": "0.0.0",
16
+ "@prisma-next/tsdown": "0.0.0"
16
17
  },
17
18
  "files": [
18
19
  "dist",
19
20
  "src"
20
21
  ],
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
21
25
  "exports": {
22
- "./types": {
23
- "types": "./dist/exports/types.d.ts",
24
- "import": "./dist/exports/types.js"
25
- }
26
+ ".": "./dist/index.mjs",
27
+ "./types": "./dist/exports/types.mjs",
28
+ "./package.json": "./package.json"
26
29
  },
30
+ "main": "./dist/index.mjs",
31
+ "module": "./dist/index.mjs",
32
+ "types": "./dist/index.d.mts",
27
33
  "scripts": {
28
- "build": "tsup --config tsup.config.ts && tsc --project tsconfig.build.json",
34
+ "build": "tsdown",
29
35
  "test": "vitest run --passWithNoTests",
30
36
  "test:coverage": "vitest run --coverage --passWithNoTests",
31
- "typecheck": "tsc --project tsconfig.json --noEmit",
37
+ "typecheck": "tsc --noEmit",
32
38
  "lint": "biome check . --error-on-warnings",
33
39
  "lint:fix": "biome check --write .",
34
40
  "lint:fix:unsafe": "biome check --write --unsafe .",
35
- "clean": "rm -rf dist coverage .tmp-output"
41
+ "clean": "rm -rf dist dist-tsc dist-tsc-prod coverage .tmp-output"
36
42
  }
37
43
  }
@@ -1,2 +0,0 @@
1
- export type { PrimaryKey, SqlAnnotations, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlTableIR, SqlTypeMetadata, SqlTypeMetadataRegistry, SqlUniqueIR, } from '../types';
2
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,EACX,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,WAAW,GACZ,MAAM,UAAU,CAAC"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './exports/types';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,112 +0,0 @@
1
- /**
2
- * SQL Schema IR types for target-agnostic schema representation.
3
- *
4
- * These types represent the canonical in-memory representation of SQL schemas
5
- * for the SQL family, used for verification and future migration planning.
6
- */
7
- /**
8
- * Primary key definition matching ContractIR format.
9
- * Defined here to avoid circular dependency with sql-contract.
10
- */
11
- export type PrimaryKey = {
12
- readonly columns: readonly string[];
13
- readonly name?: string;
14
- };
15
- /**
16
- * Namespaced annotations for extensibility.
17
- * Each namespace (e.g., 'pg', 'pgvector') owns its annotations.
18
- */
19
- export type SqlAnnotations = {
20
- readonly [namespace: string]: unknown;
21
- };
22
- /**
23
- * SQL column IR representing a column in a table.
24
- */
25
- export type SqlColumnIR = {
26
- readonly name: string;
27
- readonly nativeType: string;
28
- readonly nullable: boolean;
29
- readonly annotations?: SqlAnnotations;
30
- };
31
- /**
32
- * SQL foreign key IR.
33
- */
34
- export type SqlForeignKeyIR = {
35
- readonly columns: readonly string[];
36
- readonly referencedTable: string;
37
- readonly referencedColumns: readonly string[];
38
- readonly name?: string;
39
- readonly annotations?: SqlAnnotations;
40
- };
41
- /**
42
- * SQL unique constraint IR.
43
- */
44
- export type SqlUniqueIR = {
45
- readonly columns: readonly string[];
46
- readonly name?: string;
47
- readonly annotations?: SqlAnnotations;
48
- };
49
- /**
50
- * SQL index IR.
51
- */
52
- export type SqlIndexIR = {
53
- readonly columns: readonly string[];
54
- readonly name?: string;
55
- readonly unique: boolean;
56
- readonly annotations?: SqlAnnotations;
57
- };
58
- /**
59
- * SQL table IR representing a table in the schema.
60
- * Primary key format matches ContractIR for consistency.
61
- */
62
- export type SqlTableIR = {
63
- readonly name: string;
64
- readonly columns: Record<string, SqlColumnIR>;
65
- readonly primaryKey?: PrimaryKey;
66
- readonly foreignKeys: readonly SqlForeignKeyIR[];
67
- readonly uniques: readonly SqlUniqueIR[];
68
- readonly indexes: readonly SqlIndexIR[];
69
- readonly annotations?: SqlAnnotations;
70
- };
71
- /**
72
- * SQL Schema IR representing the complete database schema.
73
- * This is the target-agnostic representation used for verification and migration planning.
74
- */
75
- export type SqlSchemaIR = {
76
- readonly tables: Record<string, SqlTableIR>;
77
- readonly extensions: readonly string[];
78
- readonly annotations?: SqlAnnotations;
79
- };
80
- /**
81
- * SQL type metadata for control-plane and execution-plane type availability and mapping.
82
- * This abstraction provides a read-only view of type information without encode/decode behavior.
83
- */
84
- export interface SqlTypeMetadata {
85
- /**
86
- * Namespaced type identifier in format 'namespace/name@version'
87
- * Examples: 'pg/int4@1', 'pg/text@1', 'pg/timestamptz@1'
88
- */
89
- readonly typeId: string;
90
- /**
91
- * Contract scalar type IDs that this type can handle.
92
- * Examples: ['text'], ['int4', 'float8'], ['timestamp', 'timestamptz']
93
- */
94
- readonly targetTypes: readonly string[];
95
- /**
96
- * Native database type name (target-specific).
97
- * Examples: 'integer', 'text', 'character varying', 'timestamp with time zone'
98
- * This is optional because not all types have a native database representation.
99
- */
100
- readonly nativeType?: string;
101
- }
102
- /**
103
- * Registry interface for SQL type metadata.
104
- * Provides read-only iteration over type metadata entries.
105
- */
106
- export interface SqlTypeMetadataRegistry {
107
- /**
108
- * Returns an iterator over all type metadata entries.
109
- */
110
- values(): IterableIterator<SqlTypeMetadata>;
111
- }
112
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,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