turbine-orm 0.3.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/LICENSE +21 -0
- package/README.md +295 -0
- package/dist/cli/config.d.ts +58 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +123 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/index.d.ts +23 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +935 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/migrate.d.ts +94 -0
- package/dist/cli/migrate.d.ts.map +1 -0
- package/dist/cli/migrate.js +383 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/ui.d.ts +74 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +220 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/client.d.ts +212 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +423 -0
- package/dist/client.js.map +1 -0
- package/dist/generate.d.ts +24 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +289 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/introspect.d.ts +22 -0
- package/dist/introspect.d.ts.map +1 -0
- package/dist/introspect.js +284 -0
- package/dist/introspect.js.map +1 -0
- package/dist/pipeline.d.ts +44 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +69 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/query.d.ts +342 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +1396 -0
- package/dist/query.js.map +1 -0
- package/dist/schema-builder.d.ts +127 -0
- package/dist/schema-builder.d.ts.map +1 -0
- package/dist/schema-builder.js +164 -0
- package/dist/schema-builder.js.map +1 -0
- package/dist/schema-sql.d.ts +71 -0
- package/dist/schema-sql.d.ts.map +1 -0
- package/dist/schema-sql.js +347 -0
- package/dist/schema-sql.js.map +1 -0
- package/dist/schema.d.ts +90 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +129 -0
- package/dist/schema.js.map +1 -0
- package/dist/serverless.d.ts +162 -0
- package/dist/serverless.d.ts.map +1 -0
- package/dist/serverless.js +195 -0
- package/dist/serverless.js.map +1 -0
- package/dist/types.d.ts +93 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +126 -0
- package/dist/types.js.map +1 -0
- package/package.json +74 -0
package/dist/generate.js
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @batadata/turbine — Code generator
|
|
3
|
+
*
|
|
4
|
+
* Takes an IntrospectedSchema and emits TypeScript files:
|
|
5
|
+
* - types.ts — Entity interfaces, Create/Update input types
|
|
6
|
+
* - metadata.ts — Runtime schema metadata (column maps, relations, etc.)
|
|
7
|
+
* - index.ts — Configured TurbineClient with typed table accessors
|
|
8
|
+
*
|
|
9
|
+
* Output goes to the specified directory (default: ./generated/turbine/).
|
|
10
|
+
*/
|
|
11
|
+
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { snakeToPascal, singularize, } from './schema.js';
|
|
14
|
+
/** Get the TypeScript type name for a table (singularized PascalCase) */
|
|
15
|
+
function entityName(tableName) {
|
|
16
|
+
return snakeToPascal(singularize(tableName));
|
|
17
|
+
}
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Main generate function
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
export function generate(options) {
|
|
22
|
+
const outDir = options.outDir ?? './generated/turbine';
|
|
23
|
+
mkdirSync(outDir, { recursive: true });
|
|
24
|
+
const files = [];
|
|
25
|
+
// Generate types.ts
|
|
26
|
+
const typesContent = generateTypes(options.schema);
|
|
27
|
+
writeFileSync(join(outDir, 'types.ts'), typesContent, 'utf-8');
|
|
28
|
+
files.push('types.ts');
|
|
29
|
+
// Generate metadata.ts
|
|
30
|
+
const metadataContent = generateMetadata(options.schema);
|
|
31
|
+
writeFileSync(join(outDir, 'metadata.ts'), metadataContent, 'utf-8');
|
|
32
|
+
files.push('metadata.ts');
|
|
33
|
+
// Generate index.ts (configured client)
|
|
34
|
+
const indexContent = generateIndex(options.schema);
|
|
35
|
+
writeFileSync(join(outDir, 'index.ts'), indexContent, 'utf-8');
|
|
36
|
+
files.push('index.ts');
|
|
37
|
+
return { outDir, files };
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// types.ts generator
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
function generatedFileHeader() {
|
|
43
|
+
return [
|
|
44
|
+
'/**',
|
|
45
|
+
' * Auto-generated by @batadata/turbine — DO NOT EDIT',
|
|
46
|
+
' *',
|
|
47
|
+
` * Generated at: ${new Date().toISOString()}`,
|
|
48
|
+
' * @see https://batadata.com/docs/turbine',
|
|
49
|
+
' */',
|
|
50
|
+
'',
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
function generateTypes(schema) {
|
|
54
|
+
const lines = [
|
|
55
|
+
...generatedFileHeader(),
|
|
56
|
+
];
|
|
57
|
+
// Generate enum types
|
|
58
|
+
for (const [enumName, labels] of Object.entries(schema.enums)) {
|
|
59
|
+
const typeName = snakeToPascal(enumName);
|
|
60
|
+
lines.push(`/** Database enum: ${enumName} */`);
|
|
61
|
+
lines.push(`export type ${typeName} = ${labels.map((l) => `'${l}'`).join(' | ')};`);
|
|
62
|
+
lines.push('');
|
|
63
|
+
}
|
|
64
|
+
// Generate entity types for each table
|
|
65
|
+
for (const table of Object.values(schema.tables)) {
|
|
66
|
+
const typeName = entityName(table.name);
|
|
67
|
+
// --- Base entity interface ---
|
|
68
|
+
lines.push(`/** Row type for the \`${table.name}\` table */`);
|
|
69
|
+
lines.push(`export interface ${typeName} {`);
|
|
70
|
+
for (const col of table.columns) {
|
|
71
|
+
const pkNote = table.primaryKey.includes(col.name) ? ' (primary key)' : '';
|
|
72
|
+
const nullNote = col.nullable ? ' (nullable)' : '';
|
|
73
|
+
lines.push(` /** Column: ${col.name} — ${col.pgType}${pkNote}${nullNote} */`);
|
|
74
|
+
lines.push(` ${col.field}: ${col.tsType};`);
|
|
75
|
+
}
|
|
76
|
+
lines.push('}');
|
|
77
|
+
lines.push('');
|
|
78
|
+
// --- Create input type ---
|
|
79
|
+
// Required: non-nullable columns without defaults (except PK)
|
|
80
|
+
// Optional: nullable columns (default to NULL) or columns with explicit defaults
|
|
81
|
+
lines.push(`/** Input type for creating a row in \`${table.name}\` */`);
|
|
82
|
+
lines.push(`export type ${typeName}Create = {`);
|
|
83
|
+
for (const col of table.columns) {
|
|
84
|
+
const isPk = table.primaryKey.includes(col.name);
|
|
85
|
+
const isOptional = col.hasDefault || col.nullable || isPk;
|
|
86
|
+
if (isOptional) {
|
|
87
|
+
const reason = isPk ? 'auto-generated' : col.hasDefault ? 'has default' : 'nullable';
|
|
88
|
+
lines.push(` /** Optional: ${reason} */`);
|
|
89
|
+
lines.push(` ${col.field}?: ${col.tsType};`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
lines.push(` ${col.field}: ${col.tsType};`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
lines.push('};');
|
|
96
|
+
lines.push('');
|
|
97
|
+
// --- Update input type (all fields optional except PK) ---
|
|
98
|
+
const nonPkCols = table.columns.filter((c) => !table.primaryKey.includes(c.name));
|
|
99
|
+
lines.push(`/** Input type for updating a row in \`${table.name}\` */`);
|
|
100
|
+
lines.push(`export type ${typeName}Update = {`);
|
|
101
|
+
for (const col of nonPkCols) {
|
|
102
|
+
lines.push(` ${col.field}?: ${col.tsType};`);
|
|
103
|
+
}
|
|
104
|
+
lines.push('};');
|
|
105
|
+
lines.push('');
|
|
106
|
+
// --- Relation types ---
|
|
107
|
+
const hasRelations = Object.keys(table.relations).length > 0;
|
|
108
|
+
if (hasRelations) {
|
|
109
|
+
for (const [relName, rel] of Object.entries(table.relations)) {
|
|
110
|
+
const targetType = entityName(rel.to);
|
|
111
|
+
if (rel.type === 'hasMany') {
|
|
112
|
+
lines.push(`/** ${typeName} with \`${relName}\` relation loaded (${rel.type}: ${rel.to}) */`);
|
|
113
|
+
lines.push(`export interface ${typeName}With${snakeToPascal(relName)} extends ${typeName} {`);
|
|
114
|
+
lines.push(` ${relName}: ${targetType}[];`);
|
|
115
|
+
lines.push('}');
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
lines.push(`/** ${typeName} with \`${relName}\` relation loaded (${rel.type}: ${rel.to}) */`);
|
|
119
|
+
lines.push(`export interface ${typeName}With${snakeToPascal(relName)} extends ${typeName} {`);
|
|
120
|
+
lines.push(` ${relName}: ${targetType} | null;`);
|
|
121
|
+
lines.push('}');
|
|
122
|
+
}
|
|
123
|
+
lines.push('');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return lines.join('\n');
|
|
128
|
+
}
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// metadata.ts generator
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
function generateMetadata(schema) {
|
|
133
|
+
const lines = [
|
|
134
|
+
...generatedFileHeader(),
|
|
135
|
+
"import type { SchemaMetadata } from '@batadata/turbine';",
|
|
136
|
+
'',
|
|
137
|
+
'export const SCHEMA: SchemaMetadata = {',
|
|
138
|
+
' tables: {',
|
|
139
|
+
];
|
|
140
|
+
for (const table of Object.values(schema.tables)) {
|
|
141
|
+
lines.push(` ${table.name}: {`);
|
|
142
|
+
lines.push(` name: '${table.name}',`);
|
|
143
|
+
// columns
|
|
144
|
+
lines.push(' columns: [');
|
|
145
|
+
for (const col of table.columns) {
|
|
146
|
+
lines.push(` ${serializeColumn(col)},`);
|
|
147
|
+
}
|
|
148
|
+
lines.push(' ],');
|
|
149
|
+
// columnMap
|
|
150
|
+
lines.push(' columnMap: {');
|
|
151
|
+
for (const [field, col] of Object.entries(table.columnMap)) {
|
|
152
|
+
lines.push(` ${field}: '${col}',`);
|
|
153
|
+
}
|
|
154
|
+
lines.push(' },');
|
|
155
|
+
// reverseColumnMap
|
|
156
|
+
lines.push(' reverseColumnMap: {');
|
|
157
|
+
for (const [col, field] of Object.entries(table.reverseColumnMap)) {
|
|
158
|
+
lines.push(` ${quoteIfNeeded(col)}: '${field}',`);
|
|
159
|
+
}
|
|
160
|
+
lines.push(' },');
|
|
161
|
+
// dateColumns
|
|
162
|
+
const dateCols = [...table.dateColumns];
|
|
163
|
+
lines.push(` dateColumns: new Set([${dateCols.map((c) => `'${c}'`).join(', ')}]),`);
|
|
164
|
+
// pgTypes
|
|
165
|
+
lines.push(' pgTypes: {');
|
|
166
|
+
for (const [col, pgType] of Object.entries(table.pgTypes)) {
|
|
167
|
+
lines.push(` ${quoteIfNeeded(col)}: '${pgType}',`);
|
|
168
|
+
}
|
|
169
|
+
lines.push(' },');
|
|
170
|
+
// allColumns
|
|
171
|
+
lines.push(` allColumns: [${table.allColumns.map((c) => `'${c}'`).join(', ')}],`);
|
|
172
|
+
// primaryKey
|
|
173
|
+
lines.push(` primaryKey: [${table.primaryKey.map((c) => `'${c}'`).join(', ')}],`);
|
|
174
|
+
// uniqueColumns
|
|
175
|
+
lines.push(` uniqueColumns: [${table.uniqueColumns.map((uc) => `[${uc.map((c) => `'${c}'`).join(', ')}]`).join(', ')}],`);
|
|
176
|
+
// relations
|
|
177
|
+
lines.push(' relations: {');
|
|
178
|
+
for (const [relName, rel] of Object.entries(table.relations)) {
|
|
179
|
+
lines.push(` ${relName}: { type: '${rel.type}', name: '${rel.name}', from: '${rel.from}', to: '${rel.to}', foreignKey: '${rel.foreignKey}', referenceKey: '${rel.referenceKey}' },`);
|
|
180
|
+
}
|
|
181
|
+
lines.push(' },');
|
|
182
|
+
// indexes
|
|
183
|
+
lines.push(' indexes: [');
|
|
184
|
+
for (const idx of table.indexes) {
|
|
185
|
+
lines.push(` { name: '${idx.name}', columns: [${idx.columns.map((c) => `'${c}'`).join(', ')}], unique: ${idx.unique}, definition: ${JSON.stringify(idx.definition)} },`);
|
|
186
|
+
}
|
|
187
|
+
lines.push(' ],');
|
|
188
|
+
lines.push(' },');
|
|
189
|
+
}
|
|
190
|
+
lines.push(' },');
|
|
191
|
+
// enums
|
|
192
|
+
lines.push(' enums: {');
|
|
193
|
+
for (const [enumName, labels] of Object.entries(schema.enums)) {
|
|
194
|
+
lines.push(` ${enumName}: [${labels.map((l) => `'${l}'`).join(', ')}],`);
|
|
195
|
+
}
|
|
196
|
+
lines.push(' },');
|
|
197
|
+
lines.push('};');
|
|
198
|
+
lines.push('');
|
|
199
|
+
return lines.join('\n');
|
|
200
|
+
}
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// index.ts generator (configured client with typed table accessors)
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
function generateIndex(schema) {
|
|
205
|
+
const tableEntries = Object.values(schema.tables);
|
|
206
|
+
const lines = [
|
|
207
|
+
...generatedFileHeader(),
|
|
208
|
+
"import { TurbineClient as BaseTurbineClient, QueryInterface } from '@batadata/turbine';",
|
|
209
|
+
"import type { TurbineConfig } from '@batadata/turbine';",
|
|
210
|
+
"import { SCHEMA } from './metadata.js';",
|
|
211
|
+
];
|
|
212
|
+
// Import all entity types
|
|
213
|
+
const typeImports = tableEntries.map((t) => entityName(t.name));
|
|
214
|
+
lines.push(`import type { ${typeImports.join(', ')} } from './types.js';`);
|
|
215
|
+
lines.push('');
|
|
216
|
+
// Generate the client class with JSDoc
|
|
217
|
+
lines.push('/**');
|
|
218
|
+
lines.push(' * Generated Turbine client with typed table accessors.');
|
|
219
|
+
lines.push(' *');
|
|
220
|
+
lines.push(' * Tables:');
|
|
221
|
+
for (const table of tableEntries) {
|
|
222
|
+
lines.push(` * - \`${snakeToCamelStr(table.name)}\` (${table.name})`);
|
|
223
|
+
}
|
|
224
|
+
lines.push(' *');
|
|
225
|
+
lines.push(' * @example');
|
|
226
|
+
lines.push(' * ```ts');
|
|
227
|
+
lines.push(' * const db = turbine({ connectionString: process.env.DATABASE_URL });');
|
|
228
|
+
if (tableEntries.length > 0) {
|
|
229
|
+
const firstTable = tableEntries[0];
|
|
230
|
+
const accessor = snakeToCamelStr(firstTable.name);
|
|
231
|
+
lines.push(` * const rows = await db.${accessor}.findMany();`);
|
|
232
|
+
}
|
|
233
|
+
lines.push(' * ```');
|
|
234
|
+
lines.push(' */');
|
|
235
|
+
lines.push('export class TurbineClient extends BaseTurbineClient {');
|
|
236
|
+
for (const table of tableEntries) {
|
|
237
|
+
const typeName = entityName(table.name);
|
|
238
|
+
const accessor = snakeToCamelStr(table.name);
|
|
239
|
+
lines.push(` /** Query interface for the \`${table.name}\` table */`);
|
|
240
|
+
lines.push(` declare readonly ${accessor}: QueryInterface<${typeName}>;`);
|
|
241
|
+
}
|
|
242
|
+
lines.push('');
|
|
243
|
+
lines.push(' constructor(config?: TurbineConfig) {');
|
|
244
|
+
lines.push(' super(config, SCHEMA);');
|
|
245
|
+
lines.push(' }');
|
|
246
|
+
lines.push('}');
|
|
247
|
+
lines.push('');
|
|
248
|
+
// Factory function with JSDoc
|
|
249
|
+
lines.push('/**');
|
|
250
|
+
lines.push(' * Create a new Turbine client instance.');
|
|
251
|
+
lines.push(' *');
|
|
252
|
+
lines.push(' * @param config - Connection configuration. Falls back to DATABASE_URL env var.');
|
|
253
|
+
lines.push(' * @returns A fully-typed TurbineClient with table accessors.');
|
|
254
|
+
lines.push(' */');
|
|
255
|
+
lines.push('export function turbine(config?: TurbineConfig): TurbineClient {');
|
|
256
|
+
lines.push(' return new TurbineClient(config);');
|
|
257
|
+
lines.push('}');
|
|
258
|
+
lines.push('');
|
|
259
|
+
// Re-export everything
|
|
260
|
+
lines.push("export * from './types.js';");
|
|
261
|
+
lines.push("export { SCHEMA } from './metadata.js';");
|
|
262
|
+
lines.push('');
|
|
263
|
+
return lines.join('\n');
|
|
264
|
+
}
|
|
265
|
+
// ---------------------------------------------------------------------------
|
|
266
|
+
// Helpers
|
|
267
|
+
// ---------------------------------------------------------------------------
|
|
268
|
+
function serializeColumn(col) {
|
|
269
|
+
const parts = [
|
|
270
|
+
`name: '${col.name}'`,
|
|
271
|
+
`field: '${col.field}'`,
|
|
272
|
+
`pgType: '${col.pgType}'`,
|
|
273
|
+
`tsType: '${col.tsType}'`,
|
|
274
|
+
`nullable: ${col.nullable}`,
|
|
275
|
+
`hasDefault: ${col.hasDefault}`,
|
|
276
|
+
`isArray: ${col.isArray}`,
|
|
277
|
+
`pgArrayType: '${col.pgArrayType}'`,
|
|
278
|
+
];
|
|
279
|
+
if (col.maxLength !== undefined)
|
|
280
|
+
parts.push(`maxLength: ${col.maxLength}`);
|
|
281
|
+
return `{ ${parts.join(', ')} }`;
|
|
282
|
+
}
|
|
283
|
+
function quoteIfNeeded(s) {
|
|
284
|
+
return /[^a-zA-Z0-9_$]/.test(s) ? `'${s}'` : s;
|
|
285
|
+
}
|
|
286
|
+
function snakeToCamelStr(s) {
|
|
287
|
+
return s.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAIL,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,yEAAyE;AACzE,SAAS,UAAU,CAAC,SAAiB;IACnC,OAAO,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/C,CAAC;AAeD,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E,MAAM,UAAU,QAAQ,CAAC,OAAwB;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;AACnE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @batadata/turbine
|
|
3
|
+
*
|
|
4
|
+
* Turbine TypeScript SDK — type-safe Postgres queries with nested relations
|
|
5
|
+
* and pipeline batching. Feels like Prisma, runs at raw-SQL speed.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // 1. Generate types from your database:
|
|
10
|
+
* // npx turbine generate
|
|
11
|
+
*
|
|
12
|
+
* // 2. Import the generated client:
|
|
13
|
+
* import { turbine } from './generated/turbine';
|
|
14
|
+
*
|
|
15
|
+
* const db = turbine({ connectionString: process.env.DATABASE_URL });
|
|
16
|
+
*
|
|
17
|
+
* // Type-safe queries with auto-complete
|
|
18
|
+
* const user = await db.users.findUnique({ where: { id: 1 } });
|
|
19
|
+
*
|
|
20
|
+
* // Nested relations in a single query (json_agg, no N+1)
|
|
21
|
+
* const userWithPosts = await db.users.findUnique({
|
|
22
|
+
* where: { id: 1 },
|
|
23
|
+
* with: { posts: { with: { comments: true } } },
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Pipeline: multiple queries in one round-trip
|
|
27
|
+
* const [user, count] = await db.pipeline(
|
|
28
|
+
* db.users.buildFindUnique({ where: { id: 1 } }),
|
|
29
|
+
* db.posts.buildCount({ where: { orgId: 1 } }),
|
|
30
|
+
* );
|
|
31
|
+
*
|
|
32
|
+
* await db.disconnect();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export { TurbineClient, TransactionClient, type TurbineConfig, type TransactionOptions, type Middleware, type MiddlewareParams, type MiddlewareNext, } from './client.js';
|
|
36
|
+
export { QueryInterface, type DeferredQuery, type FindUniqueArgs, type FindManyArgs, type CreateArgs, type CreateManyArgs, type UpdateArgs, type UpdateManyArgs, type DeleteArgs, type DeleteManyArgs, type UpsertArgs, type CountArgs, type GroupByArgs, type AggregateArgs, type AggregateResult, type RelationFilter, type JsonFilter, type ArrayFilter, type WithClause, type WithOptions, type OrderDirection, } from './query.js';
|
|
37
|
+
export { executePipeline, type PipelineResults } from './pipeline.js';
|
|
38
|
+
export type { SchemaMetadata, TableMetadata, ColumnMetadata, RelationDef, IndexMetadata, } from './schema.js';
|
|
39
|
+
export { snakeToCamel, camelToSnake, snakeToPascal, singularize, pgTypeToTs, isDateType, pgArrayType, } from './schema.js';
|
|
40
|
+
export { introspect, type IntrospectOptions } from './introspect.js';
|
|
41
|
+
export { generate, type GenerateOptions } from './generate.js';
|
|
42
|
+
export { defineSchema, table, column, ColumnBuilder, type ColumnDef, type ColumnTypeName, type ColumnConfig, type ColumnType, type TableDef, type SchemaDef, } from './schema-builder.js';
|
|
43
|
+
export { schemaToSQL, schemaToSQLString, schemaDiff, schemaPush, type DiffResult, type AlterDef, type AlterColumnDef, type PushResult, } from './schema-sql.js';
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGtE,YAAY,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAG/D,OAAO,EACL,YAAY,EAEZ,KAAK,EACL,MAAM,EACN,aAAa,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,GACf,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @batadata/turbine
|
|
3
|
+
*
|
|
4
|
+
* Turbine TypeScript SDK — type-safe Postgres queries with nested relations
|
|
5
|
+
* and pipeline batching. Feels like Prisma, runs at raw-SQL speed.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // 1. Generate types from your database:
|
|
10
|
+
* // npx turbine generate
|
|
11
|
+
*
|
|
12
|
+
* // 2. Import the generated client:
|
|
13
|
+
* import { turbine } from './generated/turbine';
|
|
14
|
+
*
|
|
15
|
+
* const db = turbine({ connectionString: process.env.DATABASE_URL });
|
|
16
|
+
*
|
|
17
|
+
* // Type-safe queries with auto-complete
|
|
18
|
+
* const user = await db.users.findUnique({ where: { id: 1 } });
|
|
19
|
+
*
|
|
20
|
+
* // Nested relations in a single query (json_agg, no N+1)
|
|
21
|
+
* const userWithPosts = await db.users.findUnique({
|
|
22
|
+
* where: { id: 1 },
|
|
23
|
+
* with: { posts: { with: { comments: true } } },
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Pipeline: multiple queries in one round-trip
|
|
27
|
+
* const [user, count] = await db.pipeline(
|
|
28
|
+
* db.users.buildFindUnique({ where: { id: 1 } }),
|
|
29
|
+
* db.posts.buildCount({ where: { orgId: 1 } }),
|
|
30
|
+
* );
|
|
31
|
+
*
|
|
32
|
+
* await db.disconnect();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
// Client
|
|
36
|
+
export { TurbineClient, TransactionClient, } from './client.js';
|
|
37
|
+
// Query builder
|
|
38
|
+
export { QueryInterface, } from './query.js';
|
|
39
|
+
// Pipeline
|
|
40
|
+
export { executePipeline } from './pipeline.js';
|
|
41
|
+
// Schema utilities
|
|
42
|
+
export { snakeToCamel, camelToSnake, snakeToPascal, singularize, pgTypeToTs, isDateType, pgArrayType, } from './schema.js';
|
|
43
|
+
// Introspection
|
|
44
|
+
export { introspect } from './introspect.js';
|
|
45
|
+
// Code generation
|
|
46
|
+
export { generate } from './generate.js';
|
|
47
|
+
// Schema builder — define schemas in TypeScript
|
|
48
|
+
export { defineSchema,
|
|
49
|
+
// Legacy compat (deprecated — use object format with defineSchema)
|
|
50
|
+
table, column, ColumnBuilder, } from './schema-builder.js';
|
|
51
|
+
// Schema SQL — generate DDL, diff, and push
|
|
52
|
+
export { schemaToSQL, schemaToSQLString, schemaDiff, schemaPush, } from './schema-sql.js';
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,SAAS;AACT,OAAO,EACL,aAAa,EACb,iBAAiB,GAMlB,MAAM,aAAa,CAAC;AAErB,gBAAgB;AAChB,OAAO,EACL,cAAc,GAqBf,MAAM,YAAY,CAAC;AAEpB,WAAW;AACX,OAAO,EAAE,eAAe,EAAwB,MAAM,eAAe,CAAC;AAWtE,mBAAmB;AACnB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,gBAAgB;AAChB,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AAErE,kBAAkB;AAClB,OAAO,EAAE,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAE/D,gDAAgD;AAChD,OAAO,EACL,YAAY;AACZ,mEAAmE;AACnE,KAAK,EACL,MAAM,EACN,aAAa,GAOd,MAAM,qBAAqB,CAAC;AAE7B,4CAA4C;AAC5C,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,UAAU,GAKX,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @batadata/turbine — Schema introspection
|
|
3
|
+
*
|
|
4
|
+
* Connects to a live Postgres database, reads information_schema + pg_catalog,
|
|
5
|
+
* and produces a SchemaMetadata object describing every table, column, relation,
|
|
6
|
+
* and index in the target schema.
|
|
7
|
+
*
|
|
8
|
+
* This is the foundation of `npx turbine generate`.
|
|
9
|
+
*/
|
|
10
|
+
import { type SchemaMetadata } from './schema.js';
|
|
11
|
+
export interface IntrospectOptions {
|
|
12
|
+
/** Postgres connection string */
|
|
13
|
+
connectionString: string;
|
|
14
|
+
/** Schema to introspect (default: 'public') */
|
|
15
|
+
schema?: string;
|
|
16
|
+
/** Tables to include (default: all). Glob-like patterns not supported yet. */
|
|
17
|
+
include?: string[];
|
|
18
|
+
/** Tables to exclude (default: none). Applied after include. */
|
|
19
|
+
exclude?: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function introspect(options: IntrospectOptions): Promise<SchemaMetadata>;
|
|
22
|
+
//# sourceMappingURL=introspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspect.d.ts","sourceRoot":"","sources":["../src/introspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,KAAK,cAAc,EAUpB,MAAM,aAAa,CAAC;AA4FrB,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAMD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CA2NpF"}
|