neoorm 0.1.3 → 0.1.4
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/README.md +88 -0
- package/dist/bin/neoorm.js +28 -7
- package/dist/bin/neoorm.js.map +1 -1
- package/dist/codegen/diff-manifest.d.ts +11 -0
- package/dist/codegen/diff-manifest.d.ts.map +1 -0
- package/dist/codegen/diff-manifest.js +504 -0
- package/dist/codegen/diff-manifest.js.map +1 -0
- package/dist/codegen/generate.d.ts +6 -5
- package/dist/codegen/generate.d.ts.map +1 -1
- package/dist/codegen/generate.js +21 -54
- package/dist/codegen/generate.js.map +1 -1
- package/dist/codegen/schema-to-manifest.d.ts.map +1 -1
- package/dist/codegen/schema-to-manifest.js +7 -4
- package/dist/codegen/schema-to-manifest.js.map +1 -1
- package/dist/dialect/index.d.ts +1 -1
- package/dist/dialect/index.d.ts.map +1 -1
- package/dist/dialect/index.js.map +1 -1
- package/dist/dialect/postgres.d.ts +8 -1
- package/dist/dialect/postgres.d.ts.map +1 -1
- package/dist/dialect/postgres.js +240 -29
- package/dist/dialect/postgres.js.map +1 -1
- package/dist/dialect/types.d.ts +57 -4
- package/dist/dialect/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/introspect/pull.d.ts.map +1 -1
- package/dist/introspect/pull.js +15 -32
- package/dist/introspect/pull.js.map +1 -1
- package/dist/introspect/queries.d.ts +36 -0
- package/dist/introspect/queries.d.ts.map +1 -0
- package/dist/introspect/queries.js +102 -0
- package/dist/introspect/queries.js.map +1 -0
- package/dist/introspect/to-manifest.d.ts +4 -0
- package/dist/introspect/to-manifest.d.ts.map +1 -0
- package/dist/introspect/to-manifest.js +188 -0
- package/dist/introspect/to-manifest.js.map +1 -0
- package/dist/migrate/runner.d.ts +12 -1
- package/dist/migrate/runner.d.ts.map +1 -1
- package/dist/migrate/runner.js +43 -13
- package/dist/migrate/runner.js.map +1 -1
- package/dist/runtime/query/compile.d.ts +2 -2
- package/dist/runtime/query/compile.d.ts.map +1 -1
- package/dist/runtime/query/compile.js +240 -44
- package/dist/runtime/query/compile.js.map +1 -1
- package/dist/runtime/query/count.d.ts.map +1 -1
- package/dist/runtime/query/count.js +1 -1
- package/dist/runtime/query/count.js.map +1 -1
- package/dist/runtime/query/delete.d.ts.map +1 -1
- package/dist/runtime/query/delete.js +2 -2
- package/dist/runtime/query/delete.js.map +1 -1
- package/dist/runtime/query/find.d.ts.map +1 -1
- package/dist/runtime/query/find.js +1 -1
- package/dist/runtime/query/find.js.map +1 -1
- package/dist/runtime/query/update.d.ts.map +1 -1
- package/dist/runtime/query/update.js +2 -2
- package/dist/runtime/query/update.js.map +1 -1
- package/dist/schema/column-where.d.ts +36 -0
- package/dist/schema/column-where.d.ts.map +1 -0
- package/dist/schema/column-where.js +2 -0
- package/dist/schema/column-where.js.map +1 -0
- package/dist/schema/column.d.ts.map +1 -1
- package/dist/schema/column.js +1 -1
- package/dist/schema/column.js.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/relation-types.d.ts +65 -16
- package/dist/schema/relation-types.d.ts.map +1 -1
- package/dist/schema/relation.d.ts +13 -13
- package/dist/schema/relation.d.ts.map +1 -1
- package/dist/schema/relation.js.map +1 -1
- package/dist/schema/types.d.ts +12 -38
- package/dist/schema/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,6 +158,94 @@ manyToMany(schema.posts, schema.tags, {
|
|
|
158
158
|
});
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
## Where clauses
|
|
162
|
+
|
|
163
|
+
`findMany`, `findFirst`, `findUnique`, `count`, `update`, `updateMany`, `delete`, and `deleteMany` all accept a typed `where` argument.
|
|
164
|
+
|
|
165
|
+
### Column filters
|
|
166
|
+
|
|
167
|
+
Equality shorthand and explicit operators:
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
// equality
|
|
171
|
+
await db.posts.findMany({ where: { published: true } });
|
|
172
|
+
|
|
173
|
+
// operators
|
|
174
|
+
await db.posts.findFirst({
|
|
175
|
+
where: {
|
|
176
|
+
title: { contains: "ORM" },
|
|
177
|
+
views: { gte: 100 },
|
|
178
|
+
id: { in: ["post_1", "post_2"] },
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
String columns support `equals`, `contains`, `startsWith`, `endsWith`, `in`, and `notIn`. Numeric, boolean, and date columns support `equals`, `gt`, `gte`, `lt`, `lte`, `in`, and `notIn`. All nullable columns also support `isNull` and `isNotNull`.
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
await db.users.findMany({
|
|
187
|
+
where: {
|
|
188
|
+
name: null, // shorthand for IS NULL
|
|
189
|
+
email: { isNotNull: true },
|
|
190
|
+
id: { notIn: ["user_1", "user_2"] },
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Logical combinators
|
|
196
|
+
|
|
197
|
+
Top-level `AND`, `OR`, and `NOT` keys combine conditions. Multiple sibling keys still imply `AND`:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
await db.users.findMany({
|
|
201
|
+
where: {
|
|
202
|
+
OR: [
|
|
203
|
+
{ email: { contains: "@example.com" } },
|
|
204
|
+
{ email: { contains: "@test.com" } },
|
|
205
|
+
],
|
|
206
|
+
NOT: { name: { isNull: true } },
|
|
207
|
+
createdAt: { gte: new Date("2025-01-01") },
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Relation filters
|
|
213
|
+
|
|
214
|
+
Relation names come from `fk(..., { as: "author", inverse: "posts" })` and `manyToMany(..., { as: "tags" })` — they are not the FK column names on the table.
|
|
215
|
+
|
|
216
|
+
| Pattern | Use for |
|
|
217
|
+
|---------|---------|
|
|
218
|
+
| `authorId: "user_1"` | Filter by FK column value |
|
|
219
|
+
| `author: { email: "a@b.c" }` | Filter by related record (to-one) |
|
|
220
|
+
| `posts: { some: { ... } }` | At least one related record matches (to-many) |
|
|
221
|
+
| `posts: { every: { ... } }` | All related records match (to-many) |
|
|
222
|
+
| `posts: { none: { ... } }` | No related records match (to-many) |
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
// users who have at least one published post
|
|
226
|
+
await db.users.findMany({
|
|
227
|
+
where: {
|
|
228
|
+
posts: { some: { published: true } },
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// posts whose author has a verified email
|
|
233
|
+
await db.posts.findMany({
|
|
234
|
+
where: {
|
|
235
|
+
author: { email: { contains: "@" } },
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// posts tagged "orm" (many-to-many via junction table)
|
|
240
|
+
await db.posts.findMany({
|
|
241
|
+
where: {
|
|
242
|
+
tags: { some: { slug: "orm" } },
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Relation filters compile to SQL `EXISTS` subqueries, so they work with `findMany`, `count`, `updateMany`, and `deleteMany` without duplicate rows.
|
|
248
|
+
|
|
161
249
|
## Transactions
|
|
162
250
|
|
|
163
251
|
```ts
|
package/dist/bin/neoorm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { join, resolve } from "node:path";
|
|
|
4
4
|
import { Pool } from "pg";
|
|
5
5
|
import { loadConfig } from "../config.js";
|
|
6
6
|
import { generateFromSchema } from "../codegen/generate.js";
|
|
7
|
-
import { migrateDeploy, dbPush } from "../migrate/runner.js";
|
|
7
|
+
import { migrateDeploy, dbPush, dbPushWarnings } from "../migrate/runner.js";
|
|
8
8
|
import { introspectPostgres } from "../introspect/pull.js";
|
|
9
9
|
import { writeFile } from "node:fs/promises";
|
|
10
10
|
const program = new Command();
|
|
@@ -15,17 +15,23 @@ program
|
|
|
15
15
|
program
|
|
16
16
|
.command("generate")
|
|
17
17
|
.description("Generate manifest, client, and migrations from schema")
|
|
18
|
-
.
|
|
18
|
+
.option("--accept-data-loss", "Include destructive schema changes in generated migrations")
|
|
19
|
+
.action(async (options) => {
|
|
19
20
|
const cwd = process.cwd();
|
|
20
21
|
const config = await loadConfig(cwd);
|
|
21
22
|
const schemaPath = resolve(cwd, config.schema);
|
|
22
23
|
const outDir = resolve(cwd, config.out);
|
|
23
|
-
const { migrationName, schemaChanged, warnings } = await generateFromSchema(schemaPath, outDir
|
|
24
|
+
const { migrationName, schemaChanged, warnings, destructiveBlocked } = await generateFromSchema(schemaPath, outDir, {
|
|
25
|
+
...(options.acceptDataLoss ? { acceptDataLoss: true } : {}),
|
|
26
|
+
});
|
|
24
27
|
console.log(`Generated client at ${outDir}/client.ts`);
|
|
25
28
|
console.log(`Generated manifest at ${outDir}/manifest.ts`);
|
|
26
29
|
if (migrationName) {
|
|
27
30
|
console.log(`Created migration: ${migrationName}`);
|
|
28
31
|
}
|
|
32
|
+
else if (destructiveBlocked) {
|
|
33
|
+
console.log("Destructive schema changes detected — no migration written");
|
|
34
|
+
}
|
|
29
35
|
else if (schemaChanged) {
|
|
30
36
|
console.log("Manifest updated (no migration SQL needed)");
|
|
31
37
|
}
|
|
@@ -40,7 +46,8 @@ program
|
|
|
40
46
|
.command("migrate")
|
|
41
47
|
.description("Run migrations")
|
|
42
48
|
.argument("[subcommand]", "dev | deploy")
|
|
43
|
-
.
|
|
49
|
+
.option("--accept-data-loss", "Include destructive schema changes in generated migrations")
|
|
50
|
+
.action(async (subcommand, options) => {
|
|
44
51
|
const cwd = process.cwd();
|
|
45
52
|
const config = await loadConfig(cwd);
|
|
46
53
|
const outDir = resolve(cwd, config.out);
|
|
@@ -61,7 +68,9 @@ program
|
|
|
61
68
|
if (subcommand === "dev") {
|
|
62
69
|
const { generateFromSchema } = await import("../codegen/generate.js");
|
|
63
70
|
const schemaPath = resolve(cwd, config.schema);
|
|
64
|
-
const { migrationName, warnings } = await generateFromSchema(schemaPath, outDir
|
|
71
|
+
const { migrationName, warnings, destructiveBlocked } = await generateFromSchema(schemaPath, outDir, {
|
|
72
|
+
...(options.acceptDataLoss ? { acceptDataLoss: true } : {}),
|
|
73
|
+
});
|
|
65
74
|
for (const warning of warnings) {
|
|
66
75
|
console.warn(`Warning: ${warning}`);
|
|
67
76
|
}
|
|
@@ -69,6 +78,9 @@ program
|
|
|
69
78
|
await migrateDeploy(pool, join(outDir, "migrations"));
|
|
70
79
|
console.log(`Created and applied: ${migrationName}`);
|
|
71
80
|
}
|
|
81
|
+
else if (destructiveBlocked) {
|
|
82
|
+
console.log("Destructive schema changes detected — no migration created");
|
|
83
|
+
}
|
|
72
84
|
}
|
|
73
85
|
}
|
|
74
86
|
else {
|
|
@@ -85,6 +97,7 @@ program
|
|
|
85
97
|
.description("Database utilities")
|
|
86
98
|
.argument("<subcommand>", "push | pull")
|
|
87
99
|
.option("-o, --output <file>", "Output file for pull", "schema.pulled.ts")
|
|
100
|
+
.option("--accept-data-loss", "Apply destructive schema changes when pushing to the database")
|
|
88
101
|
.action(async (subcommand, options) => {
|
|
89
102
|
const cwd = process.cwd();
|
|
90
103
|
const config = await loadConfig(cwd);
|
|
@@ -98,8 +111,16 @@ program
|
|
|
98
111
|
console.error("Run neoorm generate first");
|
|
99
112
|
process.exit(1);
|
|
100
113
|
}
|
|
101
|
-
await dbPush(pool, manifest);
|
|
102
|
-
|
|
114
|
+
const { appliedStatements, destructiveBlocked } = await dbPush(pool, manifest, { ...(options.acceptDataLoss ? { acceptDataLoss: true } : {}) });
|
|
115
|
+
for (const warning of dbPushWarnings(destructiveBlocked)) {
|
|
116
|
+
console.warn(`Warning: ${warning}`);
|
|
117
|
+
}
|
|
118
|
+
if (appliedStatements === 0 && destructiveBlocked.length === 0) {
|
|
119
|
+
console.log("Database schema is up to date");
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log(`Database schema pushed (${appliedStatements} statement(s) applied)`);
|
|
123
|
+
}
|
|
103
124
|
}
|
|
104
125
|
else if (subcommand === "pull") {
|
|
105
126
|
const content = await introspectPostgres(pool);
|
package/dist/bin/neoorm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neoorm.js","sourceRoot":"","sources":["../../src/bin/neoorm.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"neoorm.js","sourceRoot":"","sources":["../../src/bin/neoorm.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,YAAY,CAAC;KACzB,OAAO,CAAC,OAAO,CAAC,CA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,CAAC;gBAC/D,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CACT,2BAA2B,iBAAiB,wBAAwB,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,IAAI,kBAAkB,CAAC,CAAC;YACtE,MAAM,SAAS,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,qBAAqB,UAAU,EAAE,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DestructiveChange, Manifest, ManifestColumn, ManifestDiff, TableDiff } from "../dialect/types.js";
|
|
2
|
+
export declare function columnSqlType(col: ManifestColumn, manifest?: Manifest): string;
|
|
3
|
+
export declare function columnsEqual(a: ManifestColumn, b: ManifestColumn, manifest?: Manifest): boolean;
|
|
4
|
+
export declare function buildMigrationSql(tableDiffs: TableDiff[], extensions?: string[], manifest?: Manifest): string[];
|
|
5
|
+
export declare function diffManifest(prev: Manifest | null, next: Manifest): ManifestDiff;
|
|
6
|
+
export declare function resolveMigrationSql(diff: ManifestDiff, prev: Manifest | null, next: Manifest, acceptDataLoss: boolean): {
|
|
7
|
+
sql: string[];
|
|
8
|
+
blocked: DestructiveChange[];
|
|
9
|
+
};
|
|
10
|
+
export declare function formatDestructiveWarnings(destructive: DestructiveChange[]): string[];
|
|
11
|
+
//# sourceMappingURL=diff-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-manifest.d.ts","sourceRoot":"","sources":["../../src/codegen/diff-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EAEjB,QAAQ,EACR,cAAc,EAGd,YAAY,EACZ,SAAS,EACV,MAAM,qBAAqB,CAAC;AAgB7B,wBAAgB,aAAa,CAC3B,GAAG,EAAE,cAAc,EACnB,QAAQ,CAAC,EAAE,QAAQ,GAClB,MAAM,CAER;AAuCD,wBAAgB,YAAY,CAC1B,CAAC,EAAE,cAAc,EACjB,CAAC,EAAE,cAAc,EACjB,QAAQ,CAAC,EAAE,QAAQ,GAClB,OAAO,CAYT;AAqbD,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,EAAE,EACvB,UAAU,GAAE,MAAM,EAAO,EACzB,QAAQ,CAAC,EAAE,QAAQ,GAClB,MAAM,EAAE,CAqCV;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,GAAG,IAAI,EACrB,IAAI,EAAE,QAAQ,GACb,YAAY,CA6Cd;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,QAAQ,GAAG,IAAI,EACrB,IAAI,EAAE,QAAQ,EACd,cAAc,EAAE,OAAO,GACtB;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAgDjD;AAED,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,iBAAiB,EAAE,GAC/B,MAAM,EAAE,CAuBV"}
|