bigal 15.11.4 → 16.0.0-beta.1
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/CHANGELOG.md +10 -0
- package/README.md +43 -29
- package/dist/index.cjs +1138 -758
- package/dist/index.d.cts +641 -635
- package/dist/index.d.mts +641 -635
- package/dist/index.d.ts +641 -635
- package/dist/index.mjs +1106 -749
- package/docs/.vitepress/config.ts +2 -1
- package/docs/.vitepress/theme/custom.css +71 -2
- package/docs/advanced/bigal-vs-raw-sql.md +23 -23
- package/docs/advanced/known-issues.md +21 -26
- package/docs/getting-started.md +29 -35
- package/docs/guide/crud-operations.md +61 -28
- package/docs/guide/migration-v16.md +608 -0
- package/docs/guide/models.md +405 -87
- package/docs/guide/querying.md +128 -42
- package/docs/guide/relationships.md +80 -130
- package/docs/guide/subqueries-and-joins.md +28 -32
- package/docs/guide/views.md +79 -51
- package/docs/index.md +27 -32
- package/docs/package-lock.json +123 -120
- package/docs/package.json +1 -1
- package/{context7.json → docs/public/context7.json} +3 -1
- package/docs/reference/api.md +392 -60
- package/docs/reference/configuration.md +113 -26
- package/package.json +10 -8
- package/release.config.mjs +10 -7
- package/scripts/migrate-v16.ts +484 -0
- package/skills/upgrade-v16/SKILL.md +220 -0
- package/skills/using-bigal/SKILL.md +271 -164
- package/.agents/skills/enforcing-typescript-standards/SKILL.md +0 -412
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [16.0.0-beta.1](https://github.com/bigalorm/bigal/compare/v15.11.4...v16.0.0-beta.1) (2026-03-23)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
- Function-based schema API
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- Function-based schema API ([5b67b83](https://github.com/bigalorm/bigal/commit/5b67b83c29cfe7b53b725415c0eeff175445ffac))
|
|
10
|
+
|
|
1
11
|
## [15.11.4](https://github.com/bigalorm/bigal/compare/v15.11.3...v15.11.4) (2026-03-12)
|
|
2
12
|
|
|
3
13
|
## [15.11.3](https://github.com/bigalorm/bigal/compare/v15.11.2...v15.11.3) (2026-03-12)
|
package/README.md
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
[](https://nodejs.org)
|
|
5
5
|
[](https://snyk.io/test/npm/bigal)
|
|
6
6
|
|
|
7
|
-
A PostgreSQL-optimized, type-safe TypeScript ORM for Node.js. BigAl uses a fluent builder
|
|
8
|
-
|
|
9
|
-
Postgres
|
|
7
|
+
A PostgreSQL-optimized, type-safe TypeScript ORM for Node.js. BigAl uses a fluent builder
|
|
8
|
+
pattern for queries, function-based schema definitions with PostgreSQL-native column builders,
|
|
9
|
+
and immutable query state. Built exclusively for Postgres with native support for JSONB,
|
|
10
|
+
DISTINCT ON, subquery joins, ON CONFLICT upserts, and pgvector.
|
|
10
11
|
|
|
11
12
|
## Install
|
|
12
13
|
|
|
@@ -27,49 +28,62 @@ npm install pg
|
|
|
27
28
|
npm install @neondatabase/serverless
|
|
28
29
|
```
|
|
29
30
|
|
|
31
|
+
Requires Node.js >= 22.
|
|
32
|
+
|
|
30
33
|
## Quick Start
|
|
31
34
|
|
|
32
35
|
```ts
|
|
33
|
-
import {
|
|
36
|
+
import { initialize, defineTable as table, serial, text, integer, belongsTo, hasMany, createdAt, updatedAt } from 'bigal';
|
|
37
|
+
import type { Repository } from 'bigal';
|
|
34
38
|
import { Pool } from 'postgres-pool';
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
// Define models with PostgreSQL-native column builders
|
|
41
|
+
// Column names auto-derive from property keys (priceCents -> price_cents)
|
|
42
|
+
const Product = table('products', {
|
|
43
|
+
id: serial().primaryKey(),
|
|
44
|
+
name: text().notNull(),
|
|
45
|
+
priceCents: integer().notNull(),
|
|
46
|
+
store: belongsTo('Store'),
|
|
47
|
+
createdAt: createdAt(),
|
|
48
|
+
updatedAt: updatedAt(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const Store = table('stores', {
|
|
52
|
+
id: serial().primaryKey(),
|
|
53
|
+
name: text(),
|
|
54
|
+
products: hasMany('Product').via('store'),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Initialize with typed destructuring -- no type assertions needed
|
|
48
58
|
const pool = new Pool('postgres://localhost/mydb');
|
|
49
|
-
const
|
|
50
|
-
|
|
59
|
+
const { Product, Store } = initialize({
|
|
60
|
+
pool,
|
|
61
|
+
models: { Product, Store },
|
|
62
|
+
});
|
|
51
63
|
|
|
52
|
-
// Fluent queries
|
|
53
|
-
const products = await
|
|
54
|
-
.find()
|
|
64
|
+
// Fluent queries -- just await the chain
|
|
65
|
+
const products = await Product.find()
|
|
55
66
|
.where({ priceCents: { '>=': 1000 }, name: { contains: 'widget' } })
|
|
56
67
|
.sort('name asc')
|
|
57
68
|
.limit(10);
|
|
58
69
|
|
|
59
70
|
// Upserts with ON CONFLICT
|
|
60
|
-
await
|
|
71
|
+
await Product.create({ name: 'Widget', priceCents: 999, store: 1 }, { onConflict: { action: 'merge', targets: ['name'], merge: ['priceCents'] } });
|
|
72
|
+
|
|
73
|
+
// Inspect generated SQL without executing
|
|
74
|
+
const { sql, params } = Product.find().where({ name: 'Widget' }).toSQL();
|
|
61
75
|
```
|
|
62
76
|
|
|
63
77
|
## Documentation
|
|
64
78
|
|
|
65
79
|
Full documentation is available at **[bigalorm.github.io/bigal](https://bigalorm.github.io/bigal/)**.
|
|
66
80
|
|
|
67
|
-
- [Getting Started](https://bigalorm.github.io/bigal/getting-started)
|
|
68
|
-
- [Models](https://bigalorm.github.io/bigal/guide/models)
|
|
69
|
-
- [Querying](https://bigalorm.github.io/bigal/guide/querying)
|
|
70
|
-
- [CRUD Operations](https://bigalorm.github.io/bigal/guide/crud-operations)
|
|
71
|
-
- [Subqueries & Joins](https://bigalorm.github.io/bigal/guide/subqueries-and-joins)
|
|
72
|
-
- [API Reference](https://bigalorm.github.io/bigal/reference/api)
|
|
81
|
+
- [Getting Started](https://bigalorm.github.io/bigal/getting-started) -- install, first model, first query
|
|
82
|
+
- [Models](https://bigalorm.github.io/bigal/guide/models) -- table definitions, column types, relationships
|
|
83
|
+
- [Querying](https://bigalorm.github.io/bigal/guide/querying) -- operators, pagination, JSONB, DISTINCT ON
|
|
84
|
+
- [CRUD Operations](https://bigalorm.github.io/bigal/guide/crud-operations) -- create, update, destroy, upserts
|
|
85
|
+
- [Subqueries & Joins](https://bigalorm.github.io/bigal/guide/subqueries-and-joins) -- subquery builder, aggregates
|
|
86
|
+
- [API Reference](https://bigalorm.github.io/bigal/reference/api) -- all exports and method signatures
|
|
73
87
|
|
|
74
88
|
## Machine-Readable Documentation
|
|
75
89
|
|
|
@@ -91,7 +105,7 @@ npx skills add bigalorm/bigal
|
|
|
91
105
|
## Compatibility
|
|
92
106
|
|
|
93
107
|
- [PostgreSQL](http://www.postgresql.org/) 14 or above
|
|
94
|
-
- Node.js
|
|
108
|
+
- Node.js 22 or above
|
|
95
109
|
|
|
96
110
|
## License
|
|
97
111
|
|