qubu 0.5.1 → 0.6.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/dist/codegen.mjs +1 -1
- package/dist/column-Da37jYSD.mjs +309 -0
- package/dist/column-r1Y4ivwt.mjs +327 -0
- package/dist/constraints-YGyNPQ_z.mjs +208 -0
- package/dist/core.mjs +3 -3
- package/dist/index-B2rZf3-2.d.mts +32 -0
- package/dist/index.mjs +9 -7
- package/dist/introspection.mjs +1 -1
- package/dist/{on-conflict-jPsl9l0K.mjs → on-conflict-DZQ85f1t.mjs} +3 -2
- package/dist/postgres.mjs +3 -3
- package/dist/registry-BRcUuazJ.mjs +256 -0
- package/dist/{relational-x3BDVX9e.mjs → relational-CxnLCqZQ.mjs} +2 -2
- package/dist/schema.mjs +6 -4
- package/dist/{sqlite-CsIUtZ2Q.mjs → serialize-BN07IK0v.mjs} +3 -317
- package/dist/serialize-CEIIlWhC.d.mts +66 -0
- package/dist/snapshot/mysql.d.mts +17 -0
- package/dist/snapshot/mysql.mjs +356 -0
- package/dist/snapshot/postgres.d.mts +17 -0
- package/dist/snapshot/postgres.mjs +237 -0
- package/dist/snapshot/sqlite.d.mts +25 -0
- package/dist/snapshot/sqlite.mjs +321 -0
- package/dist/{snapshot-BSraiLtH.mjs → snapshot-Xam8-q0j.mjs} +1 -1
- package/dist/snapshot.d.mts +3 -2
- package/dist/snapshot.mjs +2 -583
- package/dist/{source-C4Vmu5bb.mjs → source-SqrKWjFJ.mjs} +2 -1
- package/dist/sqlite.mjs +2 -2
- package/dist/{table-DLQ7YWth.mjs → table-BwflqeAj.mjs} +3 -2
- package/dist/{types-CTENnDh9.mjs → types-BIJsj2fJ.mjs} +3 -2
- package/dist/{value-BEEj_Ayd.mjs → value-D14I_XgL.mjs} +1 -1
- package/docs/migrations/index.md +7 -7
- package/docs/reference/mysql-snapshot.md +5 -5
- package/docs/reference/postgres-snapshot.md +7 -7
- package/docs/reference/sqlite-snapshot.md +5 -5
- package/docs/reference/supported-surface.md +3 -0
- package/docs/schema/code-generation.md +2 -2
- package/docs/schema/ddl-emission.md +1 -1
- package/docs/schema/snapshots.md +12 -0
- package/package.json +13 -1
- package/dist/column-DmazTL67.mjs +0 -633
- package/dist/index-C-480HmV.d.mts +0 -146
- package/dist/registry-BGqa05et.mjs +0 -461
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
> MySQL facts Qubu v1 can encode and the combinations that need a later server
|
|
5
5
|
> version or engine policy.
|
|
6
6
|
|
|
7
|
-
Import the adapter from the
|
|
7
|
+
Import the adapter from the MySQL snapshot subpath:
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import {
|
|
10
|
+
import { createSchemaSnapshot, tryCreateSchemaSnapshot } from "qubu/snapshot/mysql"
|
|
11
11
|
|
|
12
|
-
const snapshot =
|
|
13
|
-
const result =
|
|
12
|
+
const snapshot = createSchemaSnapshot(appSchema)
|
|
13
|
+
const result = tryCreateSchemaSnapshot(appSchema)
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
The snapshot dialect is named `mysql`, the same name used by Qubu's query
|
|
@@ -38,7 +38,7 @@ Capability checks run before common traversal. Use the non-throwing form when
|
|
|
38
38
|
a schema may include a MySQL engine or version-specific feature:
|
|
39
39
|
|
|
40
40
|
```ts
|
|
41
|
-
const result =
|
|
41
|
+
const result = tryCreateSchemaSnapshot(appSchema)
|
|
42
42
|
if (!result.ok) {
|
|
43
43
|
for (const issue of result.diagnostics) {
|
|
44
44
|
console.error(issue.path.join("."), issue.code, issue.message)
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
> PostgreSQL facts Qubu v1 can encode and the cases that need a later server
|
|
5
5
|
> version policy.
|
|
6
6
|
|
|
7
|
-
Import the adapter from the
|
|
7
|
+
Import the adapter from the PostgreSQL snapshot subpath:
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
+
import { createSchemaSnapshot } from "qubu/snapshot"
|
|
10
11
|
import {
|
|
11
|
-
createSchemaSnapshot,
|
|
12
|
-
createPostgresSchemaSnapshot,
|
|
12
|
+
createSchemaSnapshot as createPostgresSnapshot,
|
|
13
13
|
postgresSnapshotAdapter,
|
|
14
|
-
} from "qubu/snapshot"
|
|
14
|
+
} from "qubu/snapshot/postgres"
|
|
15
15
|
|
|
16
|
-
const snapshot =
|
|
16
|
+
const snapshot = createPostgresSnapshot(appSchema)
|
|
17
17
|
// Equivalent: createSchemaSnapshot(appSchema, { adapter: postgresSnapshotAdapter })
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -46,9 +46,9 @@ schema and application boundaries.
|
|
|
46
46
|
Use the non-throwing form when a schema may contain a server-specific feature:
|
|
47
47
|
|
|
48
48
|
```ts
|
|
49
|
-
import {
|
|
49
|
+
import { tryCreateSchemaSnapshot } from "qubu/snapshot/postgres"
|
|
50
50
|
|
|
51
|
-
const result =
|
|
51
|
+
const result = tryCreateSchemaSnapshot(appSchema)
|
|
52
52
|
if (!result.ok) {
|
|
53
53
|
for (const issue of result.diagnostics) {
|
|
54
54
|
console.error(issue.path.join("."), issue.code, issue.message)
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
> Use this matrix to decide which SQLite schema facts Qubu v1 can serialize and which combinations must be diagnosed before a snapshot is written.
|
|
4
4
|
|
|
5
|
-
Import the adapter from the
|
|
5
|
+
Import the adapter from the SQLite snapshot subpath:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
import {
|
|
8
|
+
import { createSchemaSnapshot, tryCreateSchemaSnapshot } from "qubu/snapshot/sqlite"
|
|
9
9
|
|
|
10
|
-
const snapshot =
|
|
11
|
-
const result =
|
|
10
|
+
const snapshot = createSchemaSnapshot(appSchema)
|
|
11
|
+
const result = tryCreateSchemaSnapshot(appSchema)
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
The snapshot dialect is `sqlite`, the same name used by Qubu's query dialect.
|
|
@@ -36,7 +36,7 @@ Capability checks run before common traversal. Use the non-throwing form when a
|
|
|
36
36
|
schema may include a feature that depends on a SQLite version or table shape:
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
const result =
|
|
39
|
+
const result = tryCreateSchemaSnapshot(appSchema)
|
|
40
40
|
if (!result.ok) {
|
|
41
41
|
for (const issue of result.diagnostics) {
|
|
42
42
|
console.error(issue.path.join("."), issue.code, issue.message)
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
| `qubu/postgres` | Runtime | PostgreSQL query dialect helpers such as `postgresDialect()` and `ilike()` |
|
|
16
16
|
| `qubu/schema` | Runtime | Advanced schema metadata, storage and constraint models, source models, and schema-expression extensions |
|
|
17
17
|
| `qubu/snapshot` | Runtime | Canonical Snapshot v1 and v2 traversal, encoding, decoding, diagnostics, and fingerprints |
|
|
18
|
+
| `qubu/snapshot/mysql` | Runtime | MySQL snapshot adapter, schema dialect, and convenience creators |
|
|
19
|
+
| `qubu/snapshot/postgres` | Runtime | PostgreSQL snapshot adapter, schema dialect, and convenience creators |
|
|
20
|
+
| `qubu/snapshot/sqlite` | Runtime | SQLite snapshot adapter, schema dialect, affinity helper, and convenience creators |
|
|
18
21
|
| `qubu/sqlite` | Runtime | The SQLite query dialect policy and native SQLite column factories |
|
|
19
22
|
| `qubu/vite` | Runtime | The optional `qubu()` Vite compiler hint |
|
|
20
23
|
| `qubu/package.json` | JSON | The published package manifest |
|
|
@@ -49,10 +49,10 @@ baseline for the next catalog read:
|
|
|
49
49
|
|
|
50
50
|
```ts
|
|
51
51
|
import { mapCatalogToSnapshot } from "qubu/introspection"
|
|
52
|
-
import {
|
|
52
|
+
import { createSchemaSnapshot } from "qubu/snapshot/sqlite"
|
|
53
53
|
import { mainSchema } from "./schema.generated.ts"
|
|
54
54
|
|
|
55
|
-
const previousSnapshot =
|
|
55
|
+
const previousSnapshot = createSchemaSnapshot(mainSchema)
|
|
56
56
|
const next = mapCatalogToSnapshot(nextCatalog, {
|
|
57
57
|
namespace: "main",
|
|
58
58
|
previousSnapshot,
|
|
@@ -9,7 +9,7 @@ plan returns diagnostics and no SQL.
|
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
import { emitMigrationPlan } from "@qubu/migrate/ddl"
|
|
12
|
-
import { postgresSchemaDialect } from "qubu/snapshot"
|
|
12
|
+
import { postgresSchemaDialect } from "qubu/snapshot/postgres"
|
|
13
13
|
|
|
14
14
|
const result = emitMigrationPlan(plan, postgresSchemaDialect)
|
|
15
15
|
if (!result.ok) {
|
package/docs/schema/snapshots.md
CHANGED
|
@@ -65,6 +65,18 @@ envelope. A dialect adapter owns physical storage mapping, SQL literal and
|
|
|
65
65
|
expression encoding, dialect extensions, capability checks, and any dialect
|
|
66
66
|
naming policy. PostgreSQL, SQLite, and MySQL adapters can implement
|
|
67
67
|
`SchemaSnapshotAdapter` without duplicating traversal or decoder rules.
|
|
68
|
+
The neutral API stays at `qubu/snapshot`; built-in dialect adapters have
|
|
69
|
+
dedicated subpaths so importing neutral snapshot utilities does not widen that
|
|
70
|
+
API:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { createSchemaSnapshot } from "qubu/snapshot"
|
|
74
|
+
import { createSchemaSnapshot as createPostgresSnapshot } from "qubu/snapshot/postgres"
|
|
75
|
+
|
|
76
|
+
const neutral = createSchemaSnapshot(appSchema)
|
|
77
|
+
const postgres = createPostgresSnapshot(appSchema)
|
|
78
|
+
```
|
|
79
|
+
|
|
68
80
|
The PostgreSQL adapter is documented in the [PostgreSQL snapshot support
|
|
69
81
|
matrix](../reference/postgres-snapshot.md). Its schema dialect extends the
|
|
70
82
|
`postgresql` query dialect, and snapshot metadata uses that same identity.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qubu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/aleclarson/qubu"
|
|
@@ -48,6 +48,18 @@
|
|
|
48
48
|
"types": "./dist/snapshot.d.mts",
|
|
49
49
|
"import": "./dist/snapshot.mjs"
|
|
50
50
|
},
|
|
51
|
+
"./snapshot/mysql": {
|
|
52
|
+
"types": "./dist/snapshot/mysql.d.mts",
|
|
53
|
+
"import": "./dist/snapshot/mysql.mjs"
|
|
54
|
+
},
|
|
55
|
+
"./snapshot/postgres": {
|
|
56
|
+
"types": "./dist/snapshot/postgres.d.mts",
|
|
57
|
+
"import": "./dist/snapshot/postgres.mjs"
|
|
58
|
+
},
|
|
59
|
+
"./snapshot/sqlite": {
|
|
60
|
+
"types": "./dist/snapshot/sqlite.d.mts",
|
|
61
|
+
"import": "./dist/snapshot/sqlite.mjs"
|
|
62
|
+
},
|
|
51
63
|
"./sqlite": {
|
|
52
64
|
"types": "./dist/sqlite.d.mts",
|
|
53
65
|
"import": "./dist/sqlite.mjs"
|