tempest-db-js 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 +21 -0
- package/README.md +54 -0
- package/dist/chunk-F36ZSQAN.js +1360 -0
- package/dist/chunk-F36ZSQAN.js.map +1 -0
- package/dist/index.cjs +1411 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1084 -0
- package/dist/index.d.ts +1084 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.cjs +1038 -0
- package/dist/migrations/index.cjs.map +1 -0
- package/dist/migrations/index.d.cts +391 -0
- package/dist/migrations/index.d.ts +391 -0
- package/dist/migrations/index.js +925 -0
- package/dist/migrations/index.js.map +1 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mauricio Benjamin
|
|
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,54 @@
|
|
|
1
|
+
# tempest-db-js
|
|
2
|
+
|
|
3
|
+
> Type-safe, class-based ORM for TypeScript — **SQLAlchemy 2.0 ergonomics** for the JS/TS world.
|
|
4
|
+
> Foundation package for the future **`tempest-ts-sdk`**.
|
|
5
|
+
|
|
6
|
+
📖 **Documentation:** [Português (BR)](https://mauriciobenjamin700.github.io/tempest-db-js/) · [English (US)](https://mauriciobenjamin700.github.io/tempest-db-js/en/)
|
|
7
|
+
|
|
8
|
+
> ⚠️ **Status: pre-alpha (v0.0.0).** Phase 1 type-inference is proven; the public API is still taking shape. Not yet published to npm.
|
|
9
|
+
|
|
10
|
+
## Why tempest-db-js
|
|
11
|
+
|
|
12
|
+
You define a model **once**, as a class — tempest-db-js infers everything else:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { Model, column, type InferModel, type InferInsert } from "tempest-db-js";
|
|
16
|
+
|
|
17
|
+
class User extends Model {
|
|
18
|
+
static tablename = "users";
|
|
19
|
+
id = column.integer().primaryKey();
|
|
20
|
+
name = column.text().notNull();
|
|
21
|
+
age = column.integer().notNull();
|
|
22
|
+
nickname = column.text(); // nullable
|
|
23
|
+
createdAt = column.timestamp().default(new Date());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type UserRow = InferModel<typeof User>;
|
|
27
|
+
// { id: number; name: string; age: number; nickname: string | null; createdAt: Date | null }
|
|
28
|
+
|
|
29
|
+
type UserInsert = InferInsert<typeof User>;
|
|
30
|
+
// { name: string; age: number; nickname: string | null; id?: number; createdAt?: Date | null }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
No manual `interface`, no codegen step, no schema/type drift. The class **is** the source of truth — just like SQLAlchemy's declarative `Mapped[...]`.
|
|
34
|
+
|
|
35
|
+
## The TypeScript reality
|
|
36
|
+
|
|
37
|
+
SQLAlchemy reads `Mapped[int]` at runtime via descriptors; TypeScript erases types at compile time. tempest-db-js bridges this by making each column a **runtime-typed builder** (`column.integer()`) that carries both its SQL type (runtime) and its static type (inference). You get class-based ergonomics **and** strong query-result inference — the trade-off being that returned rows are inferred plain objects, not active-record class instances (a post-MVP stretch goal).
|
|
38
|
+
|
|
39
|
+
## Roadmap
|
|
40
|
+
|
|
41
|
+
See [ROADMAP.md](./ROADMAP.md). Targets: **SQLite** (`better-sqlite3`) then **PostgreSQL** (`postgres.js`), performance-first.
|
|
42
|
+
|
|
43
|
+
## Development
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install
|
|
47
|
+
npm run test:types # tsc --noEmit — the type-level test suite
|
|
48
|
+
npm test # vitest runtime tests
|
|
49
|
+
npm run build # tsup → dual ESM + CJS + .d.ts
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT
|