@prisma-next/compat-prisma 0.3.0-pr.93.5 → 0.3.0-pr.94.2

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,64 @@
1
+ import { schema } from "@prisma-next/sql-relational-core/schema";
2
+ import { Runtime, RuntimeContext } from "@prisma-next/sql-runtime";
3
+ import { SqlContract, SqlStorage } from "@prisma-next/sql-contract/types";
4
+
5
+ //#region src/prisma-client.d.ts
6
+ interface PrismaClientOptions {
7
+ readonly contract: SqlContract<SqlStorage>;
8
+ readonly runtime?: Runtime;
9
+ readonly connectionString?: string;
10
+ }
11
+ interface FindUniqueArgs {
12
+ readonly where: Record<string, unknown>;
13
+ readonly select?: Record<string, boolean>;
14
+ }
15
+ interface FindManyArgs {
16
+ readonly where?: Record<string, unknown>;
17
+ readonly select?: Record<string, boolean>;
18
+ readonly orderBy?: Record<string, 'asc' | 'desc'>;
19
+ readonly take?: number;
20
+ readonly skip?: number;
21
+ }
22
+ type FindFirstArgs = FindManyArgs;
23
+ type TableFromSchema<Contract extends SqlContract<SqlStorage>> = ReturnType<typeof schema<Contract>>['tables'][string];
24
+ declare class ModelDelegate {
25
+ private readonly runtime;
26
+ private readonly context;
27
+ private readonly contract;
28
+ private readonly table;
29
+ private readonly tableName;
30
+ private readonly tableRef;
31
+ constructor(runtime: Runtime, context: RuntimeContext<SqlContract<SqlStorage>>, contract: SqlContract<SqlStorage>, table: TableFromSchema<SqlContract<SqlStorage>>, tableName: string);
32
+ findUnique(args: FindUniqueArgs): Promise<Record<string, unknown> | null>;
33
+ findFirst(args?: FindFirstArgs): Promise<Record<string, unknown> | null>;
34
+ findMany(args?: FindManyArgs): Promise<Record<string, unknown>[]>;
35
+ create(args: {
36
+ data: Record<string, unknown>;
37
+ }): Promise<Record<string, unknown>>;
38
+ update(_args: {
39
+ where: Record<string, unknown>;
40
+ data: Record<string, unknown>;
41
+ }): Promise<Record<string, unknown>>;
42
+ delete(_args: {
43
+ where: Record<string, unknown>;
44
+ }): Promise<Record<string, unknown>>;
45
+ private validateWhereArgs;
46
+ private unsupportedError;
47
+ }
48
+ declare class PrismaClientImpl {
49
+ readonly runtime: Runtime;
50
+ readonly context: RuntimeContext<SqlContract<SqlStorage>>;
51
+ readonly contract: SqlContract<SqlStorage>;
52
+ readonly schemaHandle: ReturnType<typeof schema>;
53
+ readonly models: Record<string, ModelDelegate>;
54
+ [key: string]: unknown;
55
+ constructor(options: PrismaClientOptions);
56
+ $disconnect(): Promise<void>;
57
+ }
58
+ declare class PrismaClient extends PrismaClientImpl {
59
+ readonly user: ModelDelegate;
60
+ constructor(options: PrismaClientOptions);
61
+ }
62
+ //#endregion
63
+ export { PrismaClient };
64
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/prisma-client.ts"],"sourcesContent":[],"mappings":";;;;;UAsBU,mBAAA;qBACW,YAAY;EADvB,SAAA,OAAA,CAAA,EAEW,OAFQ;EACI,SAAA,gBAAA,CAAA,EAAA,MAAA;;UAKvB,cAAA,CAJW;EAAO,SAAA,KAAA,EAKV,MALU,CAAA,MAAA,EAAA,OAAA,CAAA;EAIlB,SAAA,MAAA,CAAA,EAEU,MAFI,CAAA,MACN,EAAA,OACE,CAAA;AAAM;UAGhB,YAAA,CACS;EACC,SAAA,KAAA,CAAA,EADD,MACC,CAAA,MAAA,EAAA,OAAA,CAAA;EACC,SAAA,MAAA,CAAA,EADD,MACC,CAAA,MAAA,EAAA,OAAA,CAAA;EAAM,SAAA,OAAA,CAAA,EAAN,MAAM,CAAA,MAAA,EAAA,KAAA,GAAA,MAAA,CAAA;EAKtB,SAAA,IAAA,CAAA,EAAa,MAAA;EAEb,SAAA,IAAA,CAAA,EAAA,MAAe;;KAFf,aAAA,GAAgB,YAEiB;KAAjC,eACW,CAAA,iBADsB,WACtB,CADkC,UAClC,CAAA,CAAA,GADiD,UACjD,CAAA,OAAP,MAAO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B,KAAA,EA+NQ,MA/NR,CAAA,MAAA,EAAA,OAAA,CAAA;EAA4B,CAAA,CAAA,EA+NQ,OA/NR,CA+NgB,MA/NhB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EAAR,QAAA,iBAAA;EAqJd,QAAA,gBAAA;;cA6GvB,gBAAA,CA7GmD;EAmE9C,SAAA,OAAA,EA2CS,OA3CT;EACD,SAAA,OAAA,EA2CU,cA3CV,CA2CyB,WA3CzB,CA2CqC,UA3CrC,CAAA,CAAA;EACI,SAAA,QAAA,EA2CO,WA3CP,CA2CmB,UA3CnB,CAAA;EAAR,SAAA,YAAA,EA4CmB,UA5CnB,CAAA,OA4CqC,MA5CrC,CAAA;EAKyB,SAAA,MAAA,EAwCZ,MAxCY,CAAA,MAAA,EAwCG,aAxCH,CAAA;EAAoC,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;EAAR,WAAA,CAAA,OAAA,EA6CpC,mBA7CoC;EAAO,WAAA,CAAA,CAAA,EAiG3C,OAjG2C,CAAA,IAAA,CAAA;AAAA;AAoC9C,cAmEP,YAAA,SAAqB,gBAAA,CAnEd;EAC2B,SAAA,IAAA,EAoEtB,aApEsB;EAAZ,WAAA,CAAA,OAAA,EAsEZ,mBAtEY"}
package/dist/index.mjs ADDED
@@ -0,0 +1,217 @@
1
+ import postgresAdapter from "@prisma-next/adapter-postgres/runtime";
2
+ import postgresDriver from "@prisma-next/driver-postgres/runtime";
3
+ import { sql } from "@prisma-next/sql-lane/sql";
4
+ import { param } from "@prisma-next/sql-relational-core/param";
5
+ import { schema } from "@prisma-next/sql-relational-core/schema";
6
+ import { createRuntime, createRuntimeContext } from "@prisma-next/sql-runtime";
7
+ import postgresTarget from "@prisma-next/target-postgres/runtime";
8
+
9
+ //#region src/prisma-client.ts
10
+ function isColumnBuilder(value) {
11
+ return value !== null && value !== void 0 && typeof value === "object" && "kind" in value && value.kind === "column";
12
+ }
13
+ var ModelDelegate = class {
14
+ tableName;
15
+ tableRef;
16
+ constructor(runtime, context, contract, table, tableName) {
17
+ this.runtime = runtime;
18
+ this.context = context;
19
+ this.contract = contract;
20
+ this.table = table;
21
+ this.tableName = tableName;
22
+ this.tableRef = Object.freeze({
23
+ kind: "table",
24
+ name: tableName
25
+ });
26
+ }
27
+ async findUnique(args) {
28
+ return (await this.findMany({
29
+ ...args,
30
+ take: 1
31
+ }))[0] ?? null;
32
+ }
33
+ async findFirst(args = {}) {
34
+ return (await this.findMany({
35
+ ...args,
36
+ take: 1
37
+ }))[0] ?? null;
38
+ }
39
+ async findMany(args = {}) {
40
+ const tableName = this.tableName;
41
+ let query = sql({ context: this.context }).from(this.tableRef);
42
+ if (args.where) {
43
+ this.validateWhereArgs(args.where);
44
+ const whereConditions = [];
45
+ for (const [field, value] of Object.entries(args.where)) {
46
+ const tableDef = this.contract.storage.tables[this.tableName];
47
+ if (!tableDef || !tableDef.columns[field]) throw this.unsupportedError(`Unknown field '${field}' in where clause`);
48
+ const column = this.table.columns[field];
49
+ if (!isColumnBuilder(column)) throw this.unsupportedError(`Invalid column '${field}' in where clause`);
50
+ whereConditions.push({
51
+ column,
52
+ value
53
+ });
54
+ }
55
+ if (whereConditions.length === 1) {
56
+ const condition = whereConditions[0];
57
+ if (!condition) throw this.unsupportedError("Invalid where condition");
58
+ const column = condition.column;
59
+ const paramPlaceholder = param(`${tableName}_${column.column}`);
60
+ const binaryExpr = column.eq(paramPlaceholder);
61
+ query = query.where(binaryExpr);
62
+ } else if (whereConditions.length > 1) throw this.unsupportedError("Multiple where conditions (AND/OR) not supported in MVP");
63
+ }
64
+ const projection = {};
65
+ if (args.select) {
66
+ for (const [field, include] of Object.entries(args.select)) if (include) {
67
+ const tableDef = this.contract.storage.tables[this.tableName];
68
+ if (!tableDef || !tableDef.columns[field]) throw this.unsupportedError(`Unknown field '${field}' in select clause`);
69
+ const column = this.table.columns[field];
70
+ if (!isColumnBuilder(column)) throw this.unsupportedError(`Invalid column '${field}' in select clause`);
71
+ projection[field] = column;
72
+ }
73
+ } else {
74
+ const tableDef = this.contract.storage.tables[tableName];
75
+ const tableColumns = this.table.columns;
76
+ if (tableDef && tableColumns) for (const columnName of Object.keys(tableDef.columns)) {
77
+ const column = tableColumns[columnName];
78
+ if (isColumnBuilder(column)) projection[columnName] = column;
79
+ }
80
+ if (Object.keys(projection).length === 0 && tableColumns) for (const key in tableColumns) {
81
+ const value = tableColumns[key];
82
+ if (isColumnBuilder(value)) projection[key] = value;
83
+ }
84
+ if (Object.keys(projection).length === 0) throw this.unsupportedError("Select projection cannot be empty");
85
+ }
86
+ query = query.select(projection);
87
+ if (args.orderBy) {
88
+ const orderByEntries = Object.entries(args.orderBy);
89
+ if (orderByEntries.length > 1) throw this.unsupportedError("Multiple orderBy fields not supported in MVP");
90
+ const orderByEntry = orderByEntries[0];
91
+ if (!orderByEntry) throw this.unsupportedError("Invalid orderBy entry");
92
+ const [field, direction] = orderByEntry;
93
+ const tableDef = this.contract.storage.tables[this.tableName];
94
+ if (!tableDef || !tableDef.columns[field]) throw this.unsupportedError(`Unknown field '${field}' in orderBy clause`);
95
+ const columnValue = this.table.columns[field];
96
+ if (!isColumnBuilder(columnValue)) throw this.unsupportedError(`Invalid column '${field}' in orderBy clause`);
97
+ const column = columnValue;
98
+ const orderExpr = direction === "asc" ? column.asc() : column.desc();
99
+ query = query.orderBy(orderExpr);
100
+ }
101
+ if (args.take !== void 0) query = query.limit(args.take);
102
+ if (args.skip !== void 0) throw this.unsupportedError("skip/OFFSET not supported in MVP");
103
+ const paramsMap = {};
104
+ if (args.where) for (const [field, value] of Object.entries(args.where)) paramsMap[`${tableName}_${field}`] = value;
105
+ const plan = query.build({ params: paramsMap });
106
+ const results = [];
107
+ for await (const row of this.runtime.execute(plan)) results.push(row);
108
+ return results;
109
+ }
110
+ async create(args) {
111
+ const tableName = this.tableName;
112
+ const tableDef = this.contract.storage.tables[tableName];
113
+ if (!tableDef) throw new Error(`Table ${tableName} not found in contract`);
114
+ const columns = [];
115
+ const values = [];
116
+ const placeholders = [];
117
+ let paramIndex = 1;
118
+ for (const [field, value] of Object.entries(args.data)) {
119
+ if (!tableDef.columns[field]) throw this.unsupportedError(`Unknown field '${field}' in create data`);
120
+ columns.push(`"${field}"`);
121
+ values.push(value);
122
+ placeholders.push(`$${paramIndex}`);
123
+ paramIndex++;
124
+ }
125
+ if (columns.length === 0) throw this.unsupportedError("create() requires at least one field in data");
126
+ const insertPlan = sql({ context: this.context }).raw(`INSERT INTO "${tableName}" (${columns.join(", ")}) VALUES (${placeholders.join(", ")}) RETURNING *`, {
127
+ params: values,
128
+ annotations: {
129
+ intent: "write",
130
+ isMutation: true,
131
+ hasWhere: false,
132
+ hasLimit: false
133
+ }
134
+ });
135
+ const results = [];
136
+ for await (const row of this.runtime.execute(insertPlan)) results.push(row);
137
+ if (results.length === 0) throw new Error("INSERT did not return a row");
138
+ const result = results[0];
139
+ if (!result) throw new Error("INSERT did not return a row");
140
+ return result;
141
+ }
142
+ async update(_args) {
143
+ throw this.unsupportedError("update() mutations are not supported in MVP compatibility layer");
144
+ }
145
+ async delete(_args) {
146
+ throw this.unsupportedError("delete() mutations are not supported in MVP compatibility layer");
147
+ }
148
+ validateWhereArgs(where) {
149
+ for (const [field, value] of Object.entries(where)) {
150
+ if (value === null || value === void 0) throw this.unsupportedError("Null/undefined values in where clause not supported in MVP");
151
+ if (typeof value === "object" && !Array.isArray(value)) throw this.unsupportedError(`Complex where predicates (e.g., {${field}: {gt: ...}}) not supported in MVP`);
152
+ if (Array.isArray(value)) throw this.unsupportedError("IN/NOT IN predicates not supported in MVP");
153
+ }
154
+ }
155
+ unsupportedError(message) {
156
+ const error = new Error(message);
157
+ error.code = "CONFIG.INVALID";
158
+ error.category = "CONFIG";
159
+ error.severity = "error";
160
+ return error;
161
+ }
162
+ };
163
+ var PrismaClientImpl = class {
164
+ runtime;
165
+ context;
166
+ contract;
167
+ schemaHandle;
168
+ models = {};
169
+ constructor(options) {
170
+ this.contract = options.contract;
171
+ this.context = createRuntimeContext({
172
+ contract: this.contract,
173
+ target: postgresTarget,
174
+ adapter: postgresAdapter,
175
+ extensionPacks: []
176
+ });
177
+ if (options.runtime) this.runtime = options.runtime;
178
+ else {
179
+ const connectionString = options.connectionString ?? process.env["DATABASE_URL"];
180
+ if (!connectionString) throw new Error("DATABASE_URL environment variable or connectionString option is required");
181
+ this.runtime = createRuntime({
182
+ driver: postgresDriver.create({ connectionString }),
183
+ context: this.context,
184
+ verify: {
185
+ mode: "onFirstUse",
186
+ requireMarker: false
187
+ }
188
+ });
189
+ }
190
+ this.schemaHandle = schema(this.context);
191
+ for (const [tableName, table] of Object.entries(this.schemaHandle.tables)) {
192
+ const modelName = tableName.charAt(0).toLowerCase() + tableName.slice(1);
193
+ this.models[modelName] = new ModelDelegate(this.runtime, this.context, this.contract, table, tableName);
194
+ }
195
+ }
196
+ async $disconnect() {
197
+ await this.runtime.close();
198
+ }
199
+ };
200
+ var PrismaClient = class extends PrismaClientImpl {
201
+ constructor(options) {
202
+ super(options);
203
+ const proxy = new Proxy(this, { get(target, prop) {
204
+ if (prop in target && prop !== "models") {
205
+ if (typeof prop === "string" || typeof prop === "number") return target[prop];
206
+ return;
207
+ }
208
+ if (typeof prop === "string" && target.models[prop]) return target.models[prop];
209
+ } });
210
+ for (const [modelName, delegate] of Object.entries(this.models)) proxy[modelName] = delegate;
211
+ return proxy;
212
+ }
213
+ };
214
+
215
+ //#endregion
216
+ export { PrismaClient };
217
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["runtime: Runtime","context: RuntimeContext<SqlContract<SqlStorage>>","contract: SqlContract<SqlStorage>","table: TableFromSchema<SqlContract<SqlStorage>>","whereConditions: Array<{ column: ColumnBuilder; value: unknown }>","projection: Record<string, ColumnBuilder>","orderExpr: OrderBuilder","paramsMap: Record<string, unknown>","results: Record<string, unknown>[]","columns: string[]","values: unknown[]","placeholders: string[]"],"sources":["../src/prisma-client.ts"],"sourcesContent":["import postgresAdapter from '@prisma-next/adapter-postgres/runtime';\nimport type { ExecutionPlan } from '@prisma-next/contract/types';\nimport postgresDriver from '@prisma-next/driver-postgres/runtime';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport { sql } from '@prisma-next/sql-lane/sql';\nimport type { TableRef } from '@prisma-next/sql-relational-core/ast';\nimport { param } from '@prisma-next/sql-relational-core/param';\nimport type { SqlQueryPlan } from '@prisma-next/sql-relational-core/plan';\nimport { schema } from '@prisma-next/sql-relational-core/schema';\nimport type {\n BinaryBuilder,\n ColumnBuilder,\n OrderBuilder,\n} from '@prisma-next/sql-relational-core/types';\nimport {\n createRuntime,\n createRuntimeContext,\n type Runtime,\n type RuntimeContext,\n} from '@prisma-next/sql-runtime';\nimport postgresTarget from '@prisma-next/target-postgres/runtime';\n\ninterface PrismaClientOptions {\n readonly contract: SqlContract<SqlStorage>;\n readonly runtime?: Runtime;\n readonly connectionString?: string;\n}\n\ninterface FindUniqueArgs {\n readonly where: Record<string, unknown>;\n readonly select?: Record<string, boolean>;\n}\n\ninterface FindManyArgs {\n readonly where?: Record<string, unknown>;\n readonly select?: Record<string, boolean>;\n readonly orderBy?: Record<string, 'asc' | 'desc'>;\n readonly take?: number;\n readonly skip?: number;\n}\n\ntype FindFirstArgs = FindManyArgs;\n\ntype TableFromSchema<Contract extends SqlContract<SqlStorage>> = ReturnType<\n typeof schema<Contract>\n>['tables'][string];\n\nfunction isColumnBuilder(value: unknown): value is ColumnBuilder {\n return (\n value !== null &&\n value !== undefined &&\n typeof value === 'object' &&\n 'kind' in value &&\n value.kind === 'column'\n );\n}\n\n// NOTE: we can rely on the Prisma ORM's complex type definitions for the method return values, we only need to ensure the compatibility layer behaves correctly at runtime\nclass ModelDelegate {\n private readonly tableName: string;\n private readonly tableRef: TableRef;\n\n constructor(\n private readonly runtime: Runtime,\n private readonly context: RuntimeContext<SqlContract<SqlStorage>>,\n private readonly contract: SqlContract<SqlStorage>,\n private readonly table: TableFromSchema<SqlContract<SqlStorage>>,\n tableName: string,\n ) {\n // Store table name explicitly (from schema key)\n this.tableName = tableName;\n // Create a clean TableRef that preserves the name property\n // Object.assign in TableBuilderImpl may have overwritten name if there's a column named 'name'\n // We preserve the original table for column access but create a clean ref for from() calls\n this.tableRef = Object.freeze({\n kind: 'table' as const,\n name: tableName,\n }) as TableRef;\n }\n\n async findUnique(args: FindUniqueArgs): Promise<Record<string, unknown> | null> {\n const result = await this.findMany({\n ...args,\n take: 1,\n });\n\n return result[0] ?? null;\n }\n\n async findFirst(args: FindFirstArgs = {}): Promise<Record<string, unknown> | null> {\n const result = await this.findMany({\n ...args,\n take: 1,\n });\n\n return result[0] ?? null;\n }\n\n async findMany(args: FindManyArgs = {}): Promise<Record<string, unknown>[]> {\n const tableName = this.tableName;\n let query = sql({ context: this.context }).from(this.tableRef);\n\n // Handle where clause (equality only for MVP)\n if (args.where) {\n this.validateWhereArgs(args.where);\n const whereConditions: Array<{ column: ColumnBuilder; value: unknown }> = [];\n\n for (const [field, value] of Object.entries(args.where)) {\n // Check contract first to validate field exists\n const tableDef = this.contract.storage.tables[this.tableName];\n if (!tableDef || !tableDef.columns[field]) {\n throw this.unsupportedError(`Unknown field '${field}' in where clause`);\n }\n // Access column via columns property to avoid conflicts with table properties\n const columns = this.table.columns;\n const column = columns[field];\n if (!isColumnBuilder(column)) {\n throw this.unsupportedError(`Invalid column '${field}' in where clause`);\n }\n whereConditions.push({ column, value });\n }\n\n if (whereConditions.length === 1) {\n const condition = whereConditions[0];\n if (!condition) {\n throw this.unsupportedError('Invalid where condition');\n }\n const column = condition.column as unknown as ColumnBuilder;\n const paramPlaceholder = param(`${tableName}_${(column as { column: string }).column}`);\n const binaryExpr = (column as { eq: (value: unknown) => BinaryBuilder }).eq(\n paramPlaceholder,\n );\n query = query.where(binaryExpr);\n } else if (whereConditions.length > 1) {\n throw this.unsupportedError('Multiple where conditions (AND/OR) not supported in MVP');\n }\n }\n\n // Handle select projection\n const projection: Record<string, ColumnBuilder> = {};\n if (args.select) {\n for (const [field, include] of Object.entries(args.select)) {\n if (include) {\n // Check contract first, then access column\n const tableDef = this.contract.storage.tables[this.tableName];\n if (!tableDef || !tableDef.columns[field]) {\n throw this.unsupportedError(`Unknown field '${field}' in select clause`);\n }\n const columns = this.table.columns;\n const column = columns[field];\n if (!isColumnBuilder(column)) {\n throw this.unsupportedError(`Invalid column '${field}' in select clause`);\n }\n projection[field] = column;\n }\n }\n } else {\n // Default: select all columns from contract definition\n const tableDef = this.contract.storage.tables[tableName];\n const tableColumns = this.table.columns;\n if (tableDef && tableColumns) {\n for (const columnName of Object.keys(tableDef.columns)) {\n // Access column via columns property to avoid conflicts with table properties like 'name'\n const column = tableColumns[columnName];\n if (isColumnBuilder(column)) {\n projection[columnName] = column;\n }\n }\n }\n\n // Fallback: iterate table columns directly\n if (Object.keys(projection).length === 0 && tableColumns) {\n for (const key in tableColumns) {\n const value = tableColumns[key];\n if (isColumnBuilder(value)) {\n projection[key] = value;\n }\n }\n }\n\n if (Object.keys(projection).length === 0) {\n throw this.unsupportedError('Select projection cannot be empty');\n }\n }\n\n query = query.select(projection);\n\n // Handle orderBy\n if (args.orderBy) {\n const orderByEntries = Object.entries(args.orderBy);\n if (orderByEntries.length > 1) {\n throw this.unsupportedError('Multiple orderBy fields not supported in MVP');\n }\n\n const orderByEntry = orderByEntries[0];\n if (!orderByEntry) {\n throw this.unsupportedError('Invalid orderBy entry');\n }\n const [field, direction] = orderByEntry;\n const tableDef = this.contract.storage.tables[this.tableName];\n if (!tableDef || !tableDef.columns[field]) {\n throw this.unsupportedError(`Unknown field '${field}' in orderBy clause`);\n }\n const columns = this.table.columns;\n const columnValue = columns[field];\n if (!isColumnBuilder(columnValue)) {\n throw this.unsupportedError(`Invalid column '${field}' in orderBy clause`);\n }\n const column = columnValue as unknown as ColumnBuilder;\n\n const orderExpr: OrderBuilder =\n direction === 'asc'\n ? (column as { asc: () => OrderBuilder }).asc()\n : (column as { desc: () => OrderBuilder }).desc();\n query = query.orderBy(orderExpr);\n }\n\n // Handle pagination\n if (args.take !== undefined) {\n query = query.limit(args.take);\n }\n\n if (args.skip !== undefined) {\n throw this.unsupportedError('skip/OFFSET not supported in MVP');\n }\n\n // Build plan with params\n const paramsMap: Record<string, unknown> = {};\n if (args.where) {\n for (const [field, value] of Object.entries(args.where)) {\n paramsMap[`${tableName}_${field}`] = value;\n }\n }\n\n const plan = query.build({ params: paramsMap });\n\n // Execute via runtime\n const results: Record<string, unknown>[] = [];\n for await (const row of this.runtime.execute<Record<string, unknown>>(\n plan as ExecutionPlan<Record<string, unknown>> | SqlQueryPlan<Record<string, unknown>>,\n )) {\n results.push(row);\n }\n\n return results;\n }\n\n async create(args: { data: Record<string, unknown> }): Promise<Record<string, unknown>> {\n const tableName = this.tableName;\n const tableDef = this.contract.storage.tables[tableName];\n\n if (!tableDef) {\n throw new Error(`Table ${tableName} not found in contract`);\n }\n\n // Build INSERT statement using raw SQL (MVP: simple inserts only)\n const columns: string[] = [];\n const values: unknown[] = [];\n const placeholders: string[] = [];\n let paramIndex = 1;\n\n for (const [field, value] of Object.entries(args.data)) {\n const columnDef = tableDef.columns[field];\n if (!columnDef) {\n throw this.unsupportedError(`Unknown field '${field}' in create data`);\n }\n\n // Skip auto-generated fields (id with default, createdAt with default, etc.)\n // For MVP, we'll include all provided fields\n columns.push(`\"${field}\"`);\n values.push(value);\n placeholders.push(`$${paramIndex}`);\n paramIndex++;\n }\n\n if (columns.length === 0) {\n throw this.unsupportedError('create() requires at least one field in data');\n }\n\n // Use raw SQL for INSERT (MVP approach)\n const sqlBuilder = sql({ context: this.context });\n const insertPlan = sqlBuilder.raw(\n `INSERT INTO \"${tableName}\" (${columns.join(', ')}) VALUES (${placeholders.join(', ')}) RETURNING *`,\n {\n params: values,\n annotations: {\n intent: 'write',\n isMutation: true,\n hasWhere: false,\n hasLimit: false,\n },\n },\n );\n\n // Execute and return the created row\n const results: Record<string, unknown>[] = [];\n for await (const row of this.runtime.execute<Record<string, unknown>>(\n insertPlan as ExecutionPlan<Record<string, unknown>> | SqlQueryPlan<Record<string, unknown>>,\n )) {\n results.push(row);\n }\n\n if (results.length === 0) {\n throw new Error('INSERT did not return a row');\n }\n\n const result = results[0];\n if (!result) {\n throw new Error('INSERT did not return a row');\n }\n return result;\n }\n\n async update(_args: {\n where: Record<string, unknown>;\n data: Record<string, unknown>;\n }): Promise<Record<string, unknown>> {\n void _args;\n throw this.unsupportedError('update() mutations are not supported in MVP compatibility layer');\n }\n\n async delete(_args: { where: Record<string, unknown> }): Promise<Record<string, unknown>> {\n void _args;\n throw this.unsupportedError('delete() mutations are not supported in MVP compatibility layer');\n }\n\n private validateWhereArgs(where: Record<string, unknown>): void {\n // MVP: only simple equality is supported\n for (const [field, value] of Object.entries(where)) {\n if (value === null || value === undefined) {\n throw this.unsupportedError('Null/undefined values in where clause not supported in MVP');\n }\n if (typeof value === 'object' && !Array.isArray(value)) {\n throw this.unsupportedError(\n `Complex where predicates (e.g., {${field}: {gt: ...}}) not supported in MVP`,\n );\n }\n if (Array.isArray(value)) {\n throw this.unsupportedError('IN/NOT IN predicates not supported in MVP');\n }\n }\n }\n\n private unsupportedError(message: string): Error {\n const error = new Error(message) as Error & {\n code: string;\n category: string;\n severity: string;\n };\n error.code = 'CONFIG.INVALID';\n error.category = 'CONFIG';\n error.severity = 'error';\n return error;\n }\n}\n\nclass PrismaClientImpl {\n readonly runtime: Runtime;\n readonly context: RuntimeContext<SqlContract<SqlStorage>>;\n readonly contract: SqlContract<SqlStorage>;\n readonly schemaHandle: ReturnType<typeof schema>;\n readonly models: Record<string, ModelDelegate> = {};\n\n // Dynamic model access properties (populated at runtime)\n [key: string]: unknown;\n\n constructor(options: PrismaClientOptions) {\n // Currently only SQL contracts are supported\n this.contract = options.contract;\n\n // Create context with contract and descriptor-first composition\n this.context = createRuntimeContext({\n contract: this.contract,\n target: postgresTarget,\n adapter: postgresAdapter,\n extensionPacks: [],\n });\n\n // Initialize runtime if not provided\n if (options.runtime) {\n this.runtime = options.runtime;\n } else {\n const connectionString = options.connectionString ?? process.env['DATABASE_URL'];\n\n if (!connectionString) {\n throw new Error('DATABASE_URL environment variable or connectionString option is required');\n }\n\n const driver = postgresDriver.create({ connectionString });\n\n this.runtime = createRuntime({\n driver,\n context: this.context,\n verify: {\n mode: 'onFirstUse',\n requireMarker: false,\n },\n });\n }\n\n // Initialize schema handle\n this.schemaHandle = schema(this.context);\n\n // Build model delegates\n for (const [tableName, table] of Object.entries(this.schemaHandle.tables)) {\n // Convert table name to camelCase model name (e.g., \"user\" -> \"user\", \"User\" -> \"user\")\n const modelName = tableName.charAt(0).toLowerCase() + tableName.slice(1);\n // Pass tableName explicitly since Object.assign in TableBuilderImpl may interfere with name property\n this.models[modelName] = new ModelDelegate(\n this.runtime,\n this.context,\n this.contract,\n table as TableFromSchema<SqlContract<SqlStorage>>,\n tableName,\n );\n }\n }\n\n async $disconnect(): Promise<void> {\n await this.runtime.close();\n }\n}\n\n// Export PrismaClient as a Proxy-wrapped class for dynamic model access\nexport class PrismaClient extends PrismaClientImpl {\n // Declare user model for TypeScript (MVP: assumes user table exists)\n declare readonly user: ModelDelegate;\n\n constructor(options: PrismaClientOptions) {\n super(options);\n const proxy = new Proxy(this, {\n get(target, prop) {\n if (prop in target && prop !== 'models') {\n if (typeof prop === 'string' || typeof prop === 'number') {\n return (target as Record<string | number, unknown>)[prop];\n }\n return undefined;\n }\n\n // Check if it's a model name\n if (typeof prop === 'string' && target.models[prop]) {\n return target.models[prop];\n }\n\n return undefined;\n },\n });\n\n // Copy model properties to instance for TypeScript type checking\n for (const [modelName, delegate] of Object.entries(this.models)) {\n (proxy as Record<string, unknown>)[modelName] = delegate;\n }\n\n // biome-ignore lint/correctness/noConstructorReturn: Proxy pattern requires returning the proxy\n return proxy;\n }\n}\n"],"mappings":";;;;;;;;;AA+CA,SAAS,gBAAgB,OAAwC;AAC/D,QACE,UAAU,QACV,UAAU,UACV,OAAO,UAAU,YACjB,UAAU,SACV,MAAM,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K1B,CAAC;AAGF,OAAK,MAAM,CAAC,WAAW,aAAa,OAAO,QAAQ,KAAK,OAAO,CAC7D,CAAC,MAAkC,aAAa;AAIlD,SAAO"}
package/package.json CHANGED
@@ -1,41 +1,46 @@
1
1
  {
2
2
  "name": "@prisma-next/compat-prisma",
3
- "version": "0.3.0-pr.93.5",
3
+ "version": "0.3.0-pr.94.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
+ "engines": {
7
+ "node": ">=20"
8
+ },
6
9
  "files": [
7
10
  "dist",
8
11
  "src"
9
12
  ],
10
13
  "dependencies": {
11
- "@prisma-next/adapter-postgres": "0.3.0-pr.93.5",
12
- "@prisma-next/contract": "0.3.0-pr.93.5",
13
- "@prisma-next/driver-postgres": "0.3.0-pr.93.5",
14
- "@prisma-next/sql-contract": "0.3.0-pr.93.5",
15
- "@prisma-next/sql-lane": "0.3.0-pr.93.5",
16
- "@prisma-next/sql-relational-core": "0.3.0-pr.93.5",
17
- "@prisma-next/sql-runtime": "0.3.0-pr.93.5",
18
- "@prisma-next/target-postgres": "0.3.0-pr.93.5"
14
+ "@prisma-next/adapter-postgres": "0.3.0-pr.94.2",
15
+ "@prisma-next/contract": "0.3.0-pr.94.2",
16
+ "@prisma-next/driver-postgres": "0.3.0-pr.94.2",
17
+ "@prisma-next/sql-contract": "0.3.0-pr.94.2",
18
+ "@prisma-next/sql-lane": "0.3.0-pr.94.2",
19
+ "@prisma-next/sql-relational-core": "0.3.0-pr.94.2",
20
+ "@prisma-next/sql-runtime": "0.3.0-pr.94.2",
21
+ "@prisma-next/target-postgres": "0.3.0-pr.94.2"
19
22
  },
20
23
  "devDependencies": {
21
24
  "@prisma/dev": "0.19.1",
22
25
  "@types/pg": "8.16.0",
23
26
  "pg": "8.16.3",
24
- "tsup": "8.5.1",
27
+ "tsdown": "0.18.4",
25
28
  "typescript": "5.9.3",
26
29
  "vitest": "4.0.16",
27
- "@prisma-next/sql-contract-ts": "0.3.0-pr.93.5",
28
30
  "@prisma-next/test-utils": "0.0.1",
29
- "@prisma-next/tsconfig": "0.0.0"
31
+ "@prisma-next/tsconfig": "0.0.0",
32
+ "@prisma-next/tsdown": "0.0.0",
33
+ "@prisma-next/sql-contract-ts": "0.3.0-pr.94.2"
30
34
  },
31
35
  "exports": {
32
- ".": {
33
- "types": "./dist/exports/index.d.ts",
34
- "import": "./dist/exports/index.js"
35
- }
36
+ ".": "./dist/index.mjs",
37
+ "./package.json": "./package.json"
36
38
  },
39
+ "main": "./dist/index.mjs",
40
+ "module": "./dist/index.mjs",
41
+ "types": "./dist/index.d.mts",
37
42
  "scripts": {
38
- "build": "tsup && tsc",
43
+ "build": "tsdown",
39
44
  "test": "vitest run",
40
45
  "test:coverage": "vitest run --coverage",
41
46
  "typecheck": "tsc --noEmit",
@@ -1,2 +0,0 @@
1
- export { PrismaClient } from '../prisma-client';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,315 +0,0 @@
1
- // src/prisma-client.ts
2
- import postgresAdapter from "@prisma-next/adapter-postgres/runtime";
3
- import postgresDriver from "@prisma-next/driver-postgres/runtime";
4
- import { sql } from "@prisma-next/sql-lane/sql";
5
- import { param } from "@prisma-next/sql-relational-core/param";
6
- import { schema } from "@prisma-next/sql-relational-core/schema";
7
- import {
8
- createRuntime,
9
- createRuntimeContext
10
- } from "@prisma-next/sql-runtime";
11
- import postgresTarget from "@prisma-next/target-postgres/runtime";
12
- function isColumnBuilder(value) {
13
- return value !== null && value !== void 0 && typeof value === "object" && "kind" in value && value.kind === "column";
14
- }
15
- var ModelDelegate = class {
16
- constructor(runtime, context, contract, table, tableName) {
17
- this.runtime = runtime;
18
- this.context = context;
19
- this.contract = contract;
20
- this.table = table;
21
- this.tableName = tableName;
22
- this.tableRef = Object.freeze({
23
- kind: "table",
24
- name: tableName
25
- });
26
- }
27
- tableName;
28
- tableRef;
29
- async findUnique(args) {
30
- const result = await this.findMany({
31
- ...args,
32
- take: 1
33
- });
34
- return result[0] ?? null;
35
- }
36
- async findFirst(args = {}) {
37
- const result = await this.findMany({
38
- ...args,
39
- take: 1
40
- });
41
- return result[0] ?? null;
42
- }
43
- async findMany(args = {}) {
44
- const tableName = this.tableName;
45
- let query = sql({ context: this.context }).from(this.tableRef);
46
- if (args.where) {
47
- this.validateWhereArgs(args.where);
48
- const whereConditions = [];
49
- for (const [field, value] of Object.entries(args.where)) {
50
- const tableDef = this.contract.storage.tables[this.tableName];
51
- if (!tableDef || !tableDef.columns[field]) {
52
- throw this.unsupportedError(`Unknown field '${field}' in where clause`);
53
- }
54
- const columns = this.table.columns;
55
- const column = columns[field];
56
- if (!isColumnBuilder(column)) {
57
- throw this.unsupportedError(`Invalid column '${field}' in where clause`);
58
- }
59
- whereConditions.push({ column, value });
60
- }
61
- if (whereConditions.length === 1) {
62
- const condition = whereConditions[0];
63
- if (!condition) {
64
- throw this.unsupportedError("Invalid where condition");
65
- }
66
- const column = condition.column;
67
- const paramPlaceholder = param(`${tableName}_${column.column}`);
68
- const binaryExpr = column.eq(
69
- paramPlaceholder
70
- );
71
- query = query.where(binaryExpr);
72
- } else if (whereConditions.length > 1) {
73
- throw this.unsupportedError("Multiple where conditions (AND/OR) not supported in MVP");
74
- }
75
- }
76
- const projection = {};
77
- if (args.select) {
78
- for (const [field, include] of Object.entries(args.select)) {
79
- if (include) {
80
- const tableDef = this.contract.storage.tables[this.tableName];
81
- if (!tableDef || !tableDef.columns[field]) {
82
- throw this.unsupportedError(`Unknown field '${field}' in select clause`);
83
- }
84
- const columns = this.table.columns;
85
- const column = columns[field];
86
- if (!isColumnBuilder(column)) {
87
- throw this.unsupportedError(`Invalid column '${field}' in select clause`);
88
- }
89
- projection[field] = column;
90
- }
91
- }
92
- } else {
93
- const tableDef = this.contract.storage.tables[tableName];
94
- const tableColumns = this.table.columns;
95
- if (tableDef && tableColumns) {
96
- for (const columnName of Object.keys(tableDef.columns)) {
97
- const column = tableColumns[columnName];
98
- if (isColumnBuilder(column)) {
99
- projection[columnName] = column;
100
- }
101
- }
102
- }
103
- if (Object.keys(projection).length === 0 && tableColumns) {
104
- for (const key in tableColumns) {
105
- const value = tableColumns[key];
106
- if (isColumnBuilder(value)) {
107
- projection[key] = value;
108
- }
109
- }
110
- }
111
- if (Object.keys(projection).length === 0) {
112
- throw this.unsupportedError("Select projection cannot be empty");
113
- }
114
- }
115
- query = query.select(projection);
116
- if (args.orderBy) {
117
- const orderByEntries = Object.entries(args.orderBy);
118
- if (orderByEntries.length > 1) {
119
- throw this.unsupportedError("Multiple orderBy fields not supported in MVP");
120
- }
121
- const orderByEntry = orderByEntries[0];
122
- if (!orderByEntry) {
123
- throw this.unsupportedError("Invalid orderBy entry");
124
- }
125
- const [field, direction] = orderByEntry;
126
- const tableDef = this.contract.storage.tables[this.tableName];
127
- if (!tableDef || !tableDef.columns[field]) {
128
- throw this.unsupportedError(`Unknown field '${field}' in orderBy clause`);
129
- }
130
- const columns = this.table.columns;
131
- const columnValue = columns[field];
132
- if (!isColumnBuilder(columnValue)) {
133
- throw this.unsupportedError(`Invalid column '${field}' in orderBy clause`);
134
- }
135
- const column = columnValue;
136
- const orderExpr = direction === "asc" ? column.asc() : column.desc();
137
- query = query.orderBy(orderExpr);
138
- }
139
- if (args.take !== void 0) {
140
- query = query.limit(args.take);
141
- }
142
- if (args.skip !== void 0) {
143
- throw this.unsupportedError("skip/OFFSET not supported in MVP");
144
- }
145
- const paramsMap = {};
146
- if (args.where) {
147
- for (const [field, value] of Object.entries(args.where)) {
148
- paramsMap[`${tableName}_${field}`] = value;
149
- }
150
- }
151
- const plan = query.build({ params: paramsMap });
152
- const results = [];
153
- for await (const row of this.runtime.execute(
154
- plan
155
- )) {
156
- results.push(row);
157
- }
158
- return results;
159
- }
160
- async create(args) {
161
- const tableName = this.tableName;
162
- const tableDef = this.contract.storage.tables[tableName];
163
- if (!tableDef) {
164
- throw new Error(`Table ${tableName} not found in contract`);
165
- }
166
- const columns = [];
167
- const values = [];
168
- const placeholders = [];
169
- let paramIndex = 1;
170
- for (const [field, value] of Object.entries(args.data)) {
171
- const columnDef = tableDef.columns[field];
172
- if (!columnDef) {
173
- throw this.unsupportedError(`Unknown field '${field}' in create data`);
174
- }
175
- columns.push(`"${field}"`);
176
- values.push(value);
177
- placeholders.push(`$${paramIndex}`);
178
- paramIndex++;
179
- }
180
- if (columns.length === 0) {
181
- throw this.unsupportedError("create() requires at least one field in data");
182
- }
183
- const sqlBuilder = sql({ context: this.context });
184
- const insertPlan = sqlBuilder.raw(
185
- `INSERT INTO "${tableName}" (${columns.join(", ")}) VALUES (${placeholders.join(", ")}) RETURNING *`,
186
- {
187
- params: values,
188
- annotations: {
189
- intent: "write",
190
- isMutation: true,
191
- hasWhere: false,
192
- hasLimit: false
193
- }
194
- }
195
- );
196
- const results = [];
197
- for await (const row of this.runtime.execute(
198
- insertPlan
199
- )) {
200
- results.push(row);
201
- }
202
- if (results.length === 0) {
203
- throw new Error("INSERT did not return a row");
204
- }
205
- const result = results[0];
206
- if (!result) {
207
- throw new Error("INSERT did not return a row");
208
- }
209
- return result;
210
- }
211
- async update(_args) {
212
- void _args;
213
- throw this.unsupportedError("update() mutations are not supported in MVP compatibility layer");
214
- }
215
- async delete(_args) {
216
- void _args;
217
- throw this.unsupportedError("delete() mutations are not supported in MVP compatibility layer");
218
- }
219
- validateWhereArgs(where) {
220
- for (const [field, value] of Object.entries(where)) {
221
- if (value === null || value === void 0) {
222
- throw this.unsupportedError("Null/undefined values in where clause not supported in MVP");
223
- }
224
- if (typeof value === "object" && !Array.isArray(value)) {
225
- throw this.unsupportedError(
226
- `Complex where predicates (e.g., {${field}: {gt: ...}}) not supported in MVP`
227
- );
228
- }
229
- if (Array.isArray(value)) {
230
- throw this.unsupportedError("IN/NOT IN predicates not supported in MVP");
231
- }
232
- }
233
- }
234
- unsupportedError(message) {
235
- const error = new Error(message);
236
- error.code = "CONFIG.INVALID";
237
- error.category = "CONFIG";
238
- error.severity = "error";
239
- return error;
240
- }
241
- };
242
- var PrismaClientImpl = class {
243
- runtime;
244
- context;
245
- contract;
246
- schemaHandle;
247
- models = {};
248
- constructor(options) {
249
- this.contract = options.contract;
250
- this.context = createRuntimeContext({
251
- contract: this.contract,
252
- target: postgresTarget,
253
- adapter: postgresAdapter,
254
- extensionPacks: []
255
- });
256
- if (options.runtime) {
257
- this.runtime = options.runtime;
258
- } else {
259
- const connectionString = options.connectionString ?? process.env["DATABASE_URL"];
260
- if (!connectionString) {
261
- throw new Error("DATABASE_URL environment variable or connectionString option is required");
262
- }
263
- const driver = postgresDriver.create({ connectionString });
264
- this.runtime = createRuntime({
265
- driver,
266
- context: this.context,
267
- verify: {
268
- mode: "onFirstUse",
269
- requireMarker: false
270
- }
271
- });
272
- }
273
- this.schemaHandle = schema(this.context);
274
- for (const [tableName, table] of Object.entries(this.schemaHandle.tables)) {
275
- const modelName = tableName.charAt(0).toLowerCase() + tableName.slice(1);
276
- this.models[modelName] = new ModelDelegate(
277
- this.runtime,
278
- this.context,
279
- this.contract,
280
- table,
281
- tableName
282
- );
283
- }
284
- }
285
- async $disconnect() {
286
- await this.runtime.close();
287
- }
288
- };
289
- var PrismaClient = class extends PrismaClientImpl {
290
- constructor(options) {
291
- super(options);
292
- const proxy = new Proxy(this, {
293
- get(target, prop) {
294
- if (prop in target && prop !== "models") {
295
- if (typeof prop === "string" || typeof prop === "number") {
296
- return target[prop];
297
- }
298
- return void 0;
299
- }
300
- if (typeof prop === "string" && target.models[prop]) {
301
- return target.models[prop];
302
- }
303
- return void 0;
304
- }
305
- });
306
- for (const [modelName, delegate] of Object.entries(this.models)) {
307
- proxy[modelName] = delegate;
308
- }
309
- return proxy;
310
- }
311
- };
312
- export {
313
- PrismaClient
314
- };
315
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/prisma-client.ts"],"sourcesContent":["import postgresAdapter from '@prisma-next/adapter-postgres/runtime';\nimport type { ExecutionPlan } from '@prisma-next/contract/types';\nimport postgresDriver from '@prisma-next/driver-postgres/runtime';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport { sql } from '@prisma-next/sql-lane/sql';\nimport type { TableRef } from '@prisma-next/sql-relational-core/ast';\nimport { param } from '@prisma-next/sql-relational-core/param';\nimport type { SqlQueryPlan } from '@prisma-next/sql-relational-core/plan';\nimport { schema } from '@prisma-next/sql-relational-core/schema';\nimport type {\n BinaryBuilder,\n ColumnBuilder,\n OrderBuilder,\n} from '@prisma-next/sql-relational-core/types';\nimport {\n createRuntime,\n createRuntimeContext,\n type Runtime,\n type RuntimeContext,\n} from '@prisma-next/sql-runtime';\nimport postgresTarget from '@prisma-next/target-postgres/runtime';\n\ninterface PrismaClientOptions {\n readonly contract: SqlContract<SqlStorage>;\n readonly runtime?: Runtime;\n readonly connectionString?: string;\n}\n\ninterface FindUniqueArgs {\n readonly where: Record<string, unknown>;\n readonly select?: Record<string, boolean>;\n}\n\ninterface FindManyArgs {\n readonly where?: Record<string, unknown>;\n readonly select?: Record<string, boolean>;\n readonly orderBy?: Record<string, 'asc' | 'desc'>;\n readonly take?: number;\n readonly skip?: number;\n}\n\ntype FindFirstArgs = FindManyArgs;\n\ntype TableFromSchema<Contract extends SqlContract<SqlStorage>> = ReturnType<\n typeof schema<Contract>\n>['tables'][string];\n\nfunction isColumnBuilder(value: unknown): value is ColumnBuilder {\n return (\n value !== null &&\n value !== undefined &&\n typeof value === 'object' &&\n 'kind' in value &&\n value.kind === 'column'\n );\n}\n\n// NOTE: we can rely on the Prisma ORM's complex type definitions for the method return values, we only need to ensure the compatibility layer behaves correctly at runtime\nclass ModelDelegate {\n private readonly tableName: string;\n private readonly tableRef: TableRef;\n\n constructor(\n private readonly runtime: Runtime,\n private readonly context: RuntimeContext<SqlContract<SqlStorage>>,\n private readonly contract: SqlContract<SqlStorage>,\n private readonly table: TableFromSchema<SqlContract<SqlStorage>>,\n tableName: string,\n ) {\n // Store table name explicitly (from schema key)\n this.tableName = tableName;\n // Create a clean TableRef that preserves the name property\n // Object.assign in TableBuilderImpl may have overwritten name if there's a column named 'name'\n // We preserve the original table for column access but create a clean ref for from() calls\n this.tableRef = Object.freeze({\n kind: 'table' as const,\n name: tableName,\n }) as TableRef;\n }\n\n async findUnique(args: FindUniqueArgs): Promise<Record<string, unknown> | null> {\n const result = await this.findMany({\n ...args,\n take: 1,\n });\n\n return result[0] ?? null;\n }\n\n async findFirst(args: FindFirstArgs = {}): Promise<Record<string, unknown> | null> {\n const result = await this.findMany({\n ...args,\n take: 1,\n });\n\n return result[0] ?? null;\n }\n\n async findMany(args: FindManyArgs = {}): Promise<Record<string, unknown>[]> {\n const tableName = this.tableName;\n let query = sql({ context: this.context }).from(this.tableRef);\n\n // Handle where clause (equality only for MVP)\n if (args.where) {\n this.validateWhereArgs(args.where);\n const whereConditions: Array<{ column: ColumnBuilder; value: unknown }> = [];\n\n for (const [field, value] of Object.entries(args.where)) {\n // Check contract first to validate field exists\n const tableDef = this.contract.storage.tables[this.tableName];\n if (!tableDef || !tableDef.columns[field]) {\n throw this.unsupportedError(`Unknown field '${field}' in where clause`);\n }\n // Access column via columns property to avoid conflicts with table properties\n const columns = this.table.columns;\n const column = columns[field];\n if (!isColumnBuilder(column)) {\n throw this.unsupportedError(`Invalid column '${field}' in where clause`);\n }\n whereConditions.push({ column, value });\n }\n\n if (whereConditions.length === 1) {\n const condition = whereConditions[0];\n if (!condition) {\n throw this.unsupportedError('Invalid where condition');\n }\n const column = condition.column as unknown as ColumnBuilder;\n const paramPlaceholder = param(`${tableName}_${(column as { column: string }).column}`);\n const binaryExpr = (column as { eq: (value: unknown) => BinaryBuilder }).eq(\n paramPlaceholder,\n );\n query = query.where(binaryExpr);\n } else if (whereConditions.length > 1) {\n throw this.unsupportedError('Multiple where conditions (AND/OR) not supported in MVP');\n }\n }\n\n // Handle select projection\n const projection: Record<string, ColumnBuilder> = {};\n if (args.select) {\n for (const [field, include] of Object.entries(args.select)) {\n if (include) {\n // Check contract first, then access column\n const tableDef = this.contract.storage.tables[this.tableName];\n if (!tableDef || !tableDef.columns[field]) {\n throw this.unsupportedError(`Unknown field '${field}' in select clause`);\n }\n const columns = this.table.columns;\n const column = columns[field];\n if (!isColumnBuilder(column)) {\n throw this.unsupportedError(`Invalid column '${field}' in select clause`);\n }\n projection[field] = column;\n }\n }\n } else {\n // Default: select all columns from contract definition\n const tableDef = this.contract.storage.tables[tableName];\n const tableColumns = this.table.columns;\n if (tableDef && tableColumns) {\n for (const columnName of Object.keys(tableDef.columns)) {\n // Access column via columns property to avoid conflicts with table properties like 'name'\n const column = tableColumns[columnName];\n if (isColumnBuilder(column)) {\n projection[columnName] = column;\n }\n }\n }\n\n // Fallback: iterate table columns directly\n if (Object.keys(projection).length === 0 && tableColumns) {\n for (const key in tableColumns) {\n const value = tableColumns[key];\n if (isColumnBuilder(value)) {\n projection[key] = value;\n }\n }\n }\n\n if (Object.keys(projection).length === 0) {\n throw this.unsupportedError('Select projection cannot be empty');\n }\n }\n\n query = query.select(projection);\n\n // Handle orderBy\n if (args.orderBy) {\n const orderByEntries = Object.entries(args.orderBy);\n if (orderByEntries.length > 1) {\n throw this.unsupportedError('Multiple orderBy fields not supported in MVP');\n }\n\n const orderByEntry = orderByEntries[0];\n if (!orderByEntry) {\n throw this.unsupportedError('Invalid orderBy entry');\n }\n const [field, direction] = orderByEntry;\n const tableDef = this.contract.storage.tables[this.tableName];\n if (!tableDef || !tableDef.columns[field]) {\n throw this.unsupportedError(`Unknown field '${field}' in orderBy clause`);\n }\n const columns = this.table.columns;\n const columnValue = columns[field];\n if (!isColumnBuilder(columnValue)) {\n throw this.unsupportedError(`Invalid column '${field}' in orderBy clause`);\n }\n const column = columnValue as unknown as ColumnBuilder;\n\n const orderExpr: OrderBuilder =\n direction === 'asc'\n ? (column as { asc: () => OrderBuilder }).asc()\n : (column as { desc: () => OrderBuilder }).desc();\n query = query.orderBy(orderExpr);\n }\n\n // Handle pagination\n if (args.take !== undefined) {\n query = query.limit(args.take);\n }\n\n if (args.skip !== undefined) {\n throw this.unsupportedError('skip/OFFSET not supported in MVP');\n }\n\n // Build plan with params\n const paramsMap: Record<string, unknown> = {};\n if (args.where) {\n for (const [field, value] of Object.entries(args.where)) {\n paramsMap[`${tableName}_${field}`] = value;\n }\n }\n\n const plan = query.build({ params: paramsMap });\n\n // Execute via runtime\n const results: Record<string, unknown>[] = [];\n for await (const row of this.runtime.execute<Record<string, unknown>>(\n plan as ExecutionPlan<Record<string, unknown>> | SqlQueryPlan<Record<string, unknown>>,\n )) {\n results.push(row);\n }\n\n return results;\n }\n\n async create(args: { data: Record<string, unknown> }): Promise<Record<string, unknown>> {\n const tableName = this.tableName;\n const tableDef = this.contract.storage.tables[tableName];\n\n if (!tableDef) {\n throw new Error(`Table ${tableName} not found in contract`);\n }\n\n // Build INSERT statement using raw SQL (MVP: simple inserts only)\n const columns: string[] = [];\n const values: unknown[] = [];\n const placeholders: string[] = [];\n let paramIndex = 1;\n\n for (const [field, value] of Object.entries(args.data)) {\n const columnDef = tableDef.columns[field];\n if (!columnDef) {\n throw this.unsupportedError(`Unknown field '${field}' in create data`);\n }\n\n // Skip auto-generated fields (id with default, createdAt with default, etc.)\n // For MVP, we'll include all provided fields\n columns.push(`\"${field}\"`);\n values.push(value);\n placeholders.push(`$${paramIndex}`);\n paramIndex++;\n }\n\n if (columns.length === 0) {\n throw this.unsupportedError('create() requires at least one field in data');\n }\n\n // Use raw SQL for INSERT (MVP approach)\n const sqlBuilder = sql({ context: this.context });\n const insertPlan = sqlBuilder.raw(\n `INSERT INTO \"${tableName}\" (${columns.join(', ')}) VALUES (${placeholders.join(', ')}) RETURNING *`,\n {\n params: values,\n annotations: {\n intent: 'write',\n isMutation: true,\n hasWhere: false,\n hasLimit: false,\n },\n },\n );\n\n // Execute and return the created row\n const results: Record<string, unknown>[] = [];\n for await (const row of this.runtime.execute<Record<string, unknown>>(\n insertPlan as ExecutionPlan<Record<string, unknown>> | SqlQueryPlan<Record<string, unknown>>,\n )) {\n results.push(row);\n }\n\n if (results.length === 0) {\n throw new Error('INSERT did not return a row');\n }\n\n const result = results[0];\n if (!result) {\n throw new Error('INSERT did not return a row');\n }\n return result;\n }\n\n async update(_args: {\n where: Record<string, unknown>;\n data: Record<string, unknown>;\n }): Promise<Record<string, unknown>> {\n void _args;\n throw this.unsupportedError('update() mutations are not supported in MVP compatibility layer');\n }\n\n async delete(_args: { where: Record<string, unknown> }): Promise<Record<string, unknown>> {\n void _args;\n throw this.unsupportedError('delete() mutations are not supported in MVP compatibility layer');\n }\n\n private validateWhereArgs(where: Record<string, unknown>): void {\n // MVP: only simple equality is supported\n for (const [field, value] of Object.entries(where)) {\n if (value === null || value === undefined) {\n throw this.unsupportedError('Null/undefined values in where clause not supported in MVP');\n }\n if (typeof value === 'object' && !Array.isArray(value)) {\n throw this.unsupportedError(\n `Complex where predicates (e.g., {${field}: {gt: ...}}) not supported in MVP`,\n );\n }\n if (Array.isArray(value)) {\n throw this.unsupportedError('IN/NOT IN predicates not supported in MVP');\n }\n }\n }\n\n private unsupportedError(message: string): Error {\n const error = new Error(message) as Error & {\n code: string;\n category: string;\n severity: string;\n };\n error.code = 'CONFIG.INVALID';\n error.category = 'CONFIG';\n error.severity = 'error';\n return error;\n }\n}\n\nclass PrismaClientImpl {\n readonly runtime: Runtime;\n readonly context: RuntimeContext<SqlContract<SqlStorage>>;\n readonly contract: SqlContract<SqlStorage>;\n readonly schemaHandle: ReturnType<typeof schema>;\n readonly models: Record<string, ModelDelegate> = {};\n\n // Dynamic model access properties (populated at runtime)\n [key: string]: unknown;\n\n constructor(options: PrismaClientOptions) {\n // Currently only SQL contracts are supported\n this.contract = options.contract;\n\n // Create context with contract and descriptor-first composition\n this.context = createRuntimeContext({\n contract: this.contract,\n target: postgresTarget,\n adapter: postgresAdapter,\n extensionPacks: [],\n });\n\n // Initialize runtime if not provided\n if (options.runtime) {\n this.runtime = options.runtime;\n } else {\n const connectionString = options.connectionString ?? process.env['DATABASE_URL'];\n\n if (!connectionString) {\n throw new Error('DATABASE_URL environment variable or connectionString option is required');\n }\n\n const driver = postgresDriver.create({ connectionString });\n\n this.runtime = createRuntime({\n driver,\n context: this.context,\n verify: {\n mode: 'onFirstUse',\n requireMarker: false,\n },\n });\n }\n\n // Initialize schema handle\n this.schemaHandle = schema(this.context);\n\n // Build model delegates\n for (const [tableName, table] of Object.entries(this.schemaHandle.tables)) {\n // Convert table name to camelCase model name (e.g., \"user\" -> \"user\", \"User\" -> \"user\")\n const modelName = tableName.charAt(0).toLowerCase() + tableName.slice(1);\n // Pass tableName explicitly since Object.assign in TableBuilderImpl may interfere with name property\n this.models[modelName] = new ModelDelegate(\n this.runtime,\n this.context,\n this.contract,\n table as TableFromSchema<SqlContract<SqlStorage>>,\n tableName,\n );\n }\n }\n\n async $disconnect(): Promise<void> {\n await this.runtime.close();\n }\n}\n\n// Export PrismaClient as a Proxy-wrapped class for dynamic model access\nexport class PrismaClient extends PrismaClientImpl {\n // Declare user model for TypeScript (MVP: assumes user table exists)\n declare readonly user: ModelDelegate;\n\n constructor(options: PrismaClientOptions) {\n super(options);\n const proxy = new Proxy(this, {\n get(target, prop) {\n if (prop in target && prop !== 'models') {\n if (typeof prop === 'string' || typeof prop === 'number') {\n return (target as Record<string | number, unknown>)[prop];\n }\n return undefined;\n }\n\n // Check if it's a model name\n if (typeof prop === 'string' && target.models[prop]) {\n return target.models[prop];\n }\n\n return undefined;\n },\n });\n\n // Copy model properties to instance for TypeScript type checking\n for (const [modelName, delegate] of Object.entries(this.models)) {\n (proxy as Record<string, unknown>)[modelName] = delegate;\n }\n\n // biome-ignore lint/correctness/noConstructorReturn: Proxy pattern requires returning the proxy\n return proxy;\n }\n}\n"],"mappings":";AAAA,OAAO,qBAAqB;AAE5B,OAAO,oBAAoB;AAE3B,SAAS,WAAW;AAEpB,SAAS,aAAa;AAEtB,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MAAM,cAA6B;AACjC,UAAM,KAAK,QAAQ,MAAM;AAAA,EAC3B;AACF;AAGO,IAAM,eAAN,cAA2B,iBAAiB;AAAA,EAIjD,YAAY,SAA8B;AACxC,UAAM,OAAO;AACb,UAAM,QAAQ,IAAI,MAAM,MAAM;AAAA,MAC5B,IAAI,QAAQ,MAAM;AAChB,YAAI,QAAQ,UAAU,SAAS,UAAU;AACvC,cAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AACxD,mBAAQ,OAA4C,IAAI;AAAA,UAC1D;AACA,iBAAO;AAAA,QACT;AAGA,YAAI,OAAO,SAAS,YAAY,OAAO,OAAO,IAAI,GAAG;AACnD,iBAAO,OAAO,OAAO,IAAI;AAAA,QAC3B;AAEA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAGD,eAAW,CAAC,WAAW,QAAQ,KAAK,OAAO,QAAQ,KAAK,MAAM,GAAG;AAC/D,MAAC,MAAkC,SAAS,IAAI;AAAA,IAClD;AAGA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,61 +0,0 @@
1
- import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
2
- import { schema } from '@prisma-next/sql-relational-core/schema';
3
- import { type Runtime, type RuntimeContext } from '@prisma-next/sql-runtime';
4
- interface PrismaClientOptions {
5
- readonly contract: SqlContract<SqlStorage>;
6
- readonly runtime?: Runtime;
7
- readonly connectionString?: string;
8
- }
9
- interface FindUniqueArgs {
10
- readonly where: Record<string, unknown>;
11
- readonly select?: Record<string, boolean>;
12
- }
13
- interface FindManyArgs {
14
- readonly where?: Record<string, unknown>;
15
- readonly select?: Record<string, boolean>;
16
- readonly orderBy?: Record<string, 'asc' | 'desc'>;
17
- readonly take?: number;
18
- readonly skip?: number;
19
- }
20
- type FindFirstArgs = FindManyArgs;
21
- type TableFromSchema<Contract extends SqlContract<SqlStorage>> = ReturnType<typeof schema<Contract>>['tables'][string];
22
- declare class ModelDelegate {
23
- private readonly runtime;
24
- private readonly context;
25
- private readonly contract;
26
- private readonly table;
27
- private readonly tableName;
28
- private readonly tableRef;
29
- constructor(runtime: Runtime, context: RuntimeContext<SqlContract<SqlStorage>>, contract: SqlContract<SqlStorage>, table: TableFromSchema<SqlContract<SqlStorage>>, tableName: string);
30
- findUnique(args: FindUniqueArgs): Promise<Record<string, unknown> | null>;
31
- findFirst(args?: FindFirstArgs): Promise<Record<string, unknown> | null>;
32
- findMany(args?: FindManyArgs): Promise<Record<string, unknown>[]>;
33
- create(args: {
34
- data: Record<string, unknown>;
35
- }): Promise<Record<string, unknown>>;
36
- update(_args: {
37
- where: Record<string, unknown>;
38
- data: Record<string, unknown>;
39
- }): Promise<Record<string, unknown>>;
40
- delete(_args: {
41
- where: Record<string, unknown>;
42
- }): Promise<Record<string, unknown>>;
43
- private validateWhereArgs;
44
- private unsupportedError;
45
- }
46
- declare class PrismaClientImpl {
47
- readonly runtime: Runtime;
48
- readonly context: RuntimeContext<SqlContract<SqlStorage>>;
49
- readonly contract: SqlContract<SqlStorage>;
50
- readonly schemaHandle: ReturnType<typeof schema>;
51
- readonly models: Record<string, ModelDelegate>;
52
- [key: string]: unknown;
53
- constructor(options: PrismaClientOptions);
54
- $disconnect(): Promise<void>;
55
- }
56
- export declare class PrismaClient extends PrismaClientImpl {
57
- readonly user: ModelDelegate;
58
- constructor(options: PrismaClientOptions);
59
- }
60
- export {};
61
- //# sourceMappingURL=prisma-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prisma-client.d.ts","sourceRoot":"","sources":["../src/prisma-client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAK/E,OAAO,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAMjE,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAGlC,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,QAAQ,EAAE,WAAW,C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