@mateusseiboth/ember-orm 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mateus Seiboth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # EmberORM
2
+
3
+ A **Prisma-like ORM for Firebird**, written in TypeScript. Schema language,
4
+ database introspection (`db pull`), generated typed client, and an object-based
5
+ query API (`where`, `select`, `include`, `orderBy`, aggregations, transactions).
6
+
7
+ ```bash
8
+ npm install ember-orm
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```bash
14
+ # 1. scaffold a schema
15
+ npx ember init
16
+
17
+ # 2. point it at your database
18
+ export DATABASE_URL="firebird://SYSDBA:masterkey@localhost:3050//var/lib/firebird/app.fdb"
19
+
20
+ # 3. import an existing database into the schema
21
+ npx ember db pull
22
+
23
+ # 4. generate the typed client
24
+ npx ember generate
25
+ ```
26
+
27
+ ```ts
28
+ import { EmberClient } from "./generated";
29
+
30
+ const db = new EmberClient();
31
+ await db.$connect();
32
+
33
+ const users = await db.user.findMany({
34
+ where: { active: true, email: { endsWith: "@acme.com" } },
35
+ include: { posts: { where: { published: true } } },
36
+ orderBy: { createdAt: "desc" },
37
+ take: 20,
38
+ });
39
+
40
+ await db.$transaction(async (tx) => {
41
+ const u = await tx.user.create({ data: { email: "a@b.com", name: "Ada" } });
42
+ await tx.post.create({ data: { title: "Hi", author: { connect: { id: u.id } } } });
43
+ });
44
+ ```
45
+
46
+ ## Schema example
47
+
48
+ ```prisma
49
+ datasource db {
50
+ provider = "firebird"
51
+ url = env("DATABASE_URL")
52
+ }
53
+
54
+ generator client {
55
+ provider = "ember-client-js"
56
+ output = "../generated"
57
+ }
58
+
59
+ model User {
60
+ id Int @id @default(autoincrement())
61
+ email String @unique @db.VarChar(255)
62
+ name String?
63
+ posts Post[]
64
+ createdAt DateTime @default(now()) @map("CREATED_AT")
65
+
66
+ @@map("USERS")
67
+ }
68
+
69
+ model Post {
70
+ id Int @id @default(autoincrement())
71
+ title String
72
+ author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
73
+ authorId Int @map("AUTHOR_ID")
74
+ }
75
+ ```
76
+
77
+ ## Feature overview
78
+
79
+ | Area | Supported |
80
+ | ----------------- | ------------------------------------------------------------------------- |
81
+ | Reads | `findMany`, `findFirst(OrThrow)`, `findUnique(OrThrow)` |
82
+ | Writes | `create`, `createMany`, `update`, `updateMany`, `upsert`, `delete(Many)` |
83
+ | Aggregation | `count`, `aggregate` (`_count/_sum/_avg/_min/_max`), `groupBy` |
84
+ | Filtering | `equals/not/in/notIn/lt/lte/gt/gte/contains/startsWith/endsWith`, `mode` |
85
+ | Boolean logic | `AND` / `OR` / `NOT` |
86
+ | Relation filters | `some` / `every` / `none` / `is` / `isNot` (compiled to `EXISTS`) |
87
+ | Relations | `include` & nested `select` (batched, Prisma-style stitching) |
88
+ | Nested writes | `connect`, `create`, `connectOrCreate`, `disconnect`, `set`, `delete` |
89
+ | Pagination | `take` / `skip` (`FIRST` / `SKIP`) |
90
+ | Transactions | interactive `$transaction(fn)` and sequential `$transaction([...])` |
91
+ | Raw | `$queryRaw`, `$executeRaw`, `*Unsafe` variants |
92
+ | Migrations | `ember migrate dev / deploy / status`, `ember db push` (schema↔DB diff) |
93
+ | Extensions | `$extends` (result/model/query/client), `$use` middleware, `$on` events |
94
+ | Fluent API | relation traversal: `db.user.findUnique(...).posts()` |
95
+ | More ops | `omit`, `createManyAndReturn`, groupBy `having` |
96
+ | Counts | relation `_count` in `select`/`include` |
97
+ | Versions | Firebird 2.1 / 2.5 / 3 / 4 / 5 (`?version=`), Srp & legacy auth |
98
+ | Logging | `log: true` or a `QueryEvent` callback |
99
+ | Tooling | `ember init / db pull / generate / format / validate` |
100
+
101
+ ## Editor support
102
+
103
+ A VSCode extension lives in [`editors/vscode`](./editors/vscode) — a Prisma-like
104
+ experience for `.ember` files, powered by a dedicated **language server**:
105
+ syntax highlighting, as-you-type diagnostics, canonical formatting with relation
106
+ auto-completion (and format-on-save), **go-to-definition, find references,
107
+ rename, outline symbols, code actions**, and context-aware completion (keywords,
108
+ types, model/enum names, `@`/`@@` attributes, `@db.*` native types, functions).
109
+
110
+ ```bash
111
+ cd editors/vscode && npm install && npm run build # then press F5 in VSCode
112
+ ```
113
+
114
+ Editor tooling consumes the driver-free `ember-orm/editor` entry point (schema
115
+ parser, validator, printer — no database driver).
116
+
117
+ ## Documentation
118
+
119
+ See [`/doc`](./doc) for the architecture, schema language, query API, and the
120
+ Firebird-specific notes (identifier casing, transactions, pagination).
121
+
122
+ ## Safety
123
+
124
+ Every value is bound as a parameter (`?`) — identifiers are quoted and values are
125
+ never string-interpolated. Every operation runs inside a transaction.