qubu 0.6.1 → 0.6.2

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.
Files changed (84) hide show
  1. package/dist/{complete-DP7pliuY.mjs → canonical-B5_ouh-c.mjs} +466 -241
  2. package/dist/codegen.d.mts +2 -2
  3. package/dist/codegen.mjs +180 -90
  4. package/dist/column-Cyc2CMnG.mjs +116 -0
  5. package/dist/column-DDRvD7SF.mjs +721 -0
  6. package/dist/{constraints-DM_tarXc.mjs → constraints-CAmi18Uk.mjs} +8 -3
  7. package/dist/core.d.mts +3 -3
  8. package/dist/core.mjs +4 -4
  9. package/dist/diff.d.mts +9 -9
  10. package/dist/diff.mjs +152 -102
  11. package/dist/{explain-CkIK13L_.mjs → explain-BIqEmZha.mjs} +1 -1
  12. package/dist/{expressions-BCjc08zw.mjs → expressions-_6JF_J77.mjs} +2 -1
  13. package/dist/index-CaxrMD1A.d.mts +1 -0
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +368 -74
  16. package/dist/introspection/mysql.d.mts +1 -1
  17. package/dist/introspection/mysql.mjs +156 -23
  18. package/dist/introspection/postgres.d.mts +6 -3
  19. package/dist/introspection/postgres.mjs +388 -53
  20. package/dist/introspection/sqlite.d.mts +1 -1
  21. package/dist/introspection/sqlite.mjs +198 -12
  22. package/dist/introspection.d.mts +26 -12
  23. package/dist/introspection.mjs +2 -672
  24. package/dist/mysql.d.mts +3 -3
  25. package/dist/mysql.mjs +6 -5
  26. package/dist/{errors-Dxv73YJu.mjs → omit-VEr9Ydux.mjs} +5 -1
  27. package/dist/{on-conflict-CnaY5qso.mjs → on-conflict-B2rFyHGF.mjs} +6 -8
  28. package/dist/on-duplicate-key-update-Czsw1Yq-.mjs +95 -0
  29. package/dist/{postgres-Dey7QXPL.mjs → postgres-hFhd0I9n.mjs} +4 -5
  30. package/dist/postgres.d.mts +2 -2
  31. package/dist/postgres.mjs +2 -2
  32. package/dist/{registry-oWDiqD7i.mjs → registry-BXE_4M9P.mjs} +1 -1
  33. package/dist/{relational-DSAJ-l58.mjs → relational-CoPBETjI.mjs} +3 -2
  34. package/dist/schema.d.mts +2 -2
  35. package/dist/schema.mjs +8 -8
  36. package/dist/{serialize-CE-gw5_s.mjs → serialize-CyobNEx-.mjs} +174 -30
  37. package/dist/serialize-Du2UPZMt.d.mts +92 -0
  38. package/dist/snapshot/mysql.d.mts +5 -5
  39. package/dist/snapshot/mysql.mjs +8 -8
  40. package/dist/snapshot/postgres.d.mts +3 -3
  41. package/dist/snapshot/postgres.mjs +9 -9
  42. package/dist/snapshot/sqlite.d.mts +3 -3
  43. package/dist/snapshot/sqlite.mjs +7 -7
  44. package/dist/snapshot-mIb-Zzb5.mjs +1489 -0
  45. package/dist/snapshot.d.mts +4 -5
  46. package/dist/snapshot.mjs +3 -4
  47. package/dist/{source-BDuUXmAk.mjs → source-DYSUqzvb.mjs} +2 -2
  48. package/dist/sqlite.d.mts +2 -2
  49. package/dist/sqlite.mjs +6 -6
  50. package/dist/{table-C1QGNe4P.mjs → table-B8zEq0az.mjs} +4 -4
  51. package/dist/{types-BLNRatG_.mjs → types-CYHpSPwj.mjs} +10 -5
  52. package/dist/{types-BEn0N_al.d.mts → types-CiMvKi5V.d.mts} +14 -4
  53. package/dist/{types-DUe6eeI0.d.mts → types-Dqr4o2I1.d.mts} +590 -168
  54. package/dist/value-CpaUFtjw.mjs +45 -0
  55. package/dist/vite/ambient.d.ts +2 -0
  56. package/dist/vite.d.mts +1 -1
  57. package/dist/vite.mjs +2 -0
  58. package/docs/dialects-and-execution.md +61 -11
  59. package/docs/getting-started.md +1 -1
  60. package/docs/guides/extensions/typed-expressions.md +5 -3
  61. package/docs/guides/json.md +95 -2
  62. package/docs/guides/mutations.md +36 -0
  63. package/docs/index.md +1 -1
  64. package/docs/migrations/adapters.md +58 -21
  65. package/docs/migrations/recovery.md +7 -1
  66. package/docs/query-model/fragments.md +21 -1
  67. package/docs/reference/introspection-support.md +16 -18
  68. package/docs/reference/supported-surface.md +8 -7
  69. package/docs/schema/catalog-model.md +20 -7
  70. package/docs/schema/code-generation.md +1 -1
  71. package/docs/schema/diff.md +2 -2
  72. package/docs/schema/introspection.md +21 -14
  73. package/docs/schema/snapshots.md +18 -8
  74. package/docs/schema/storage-and-schema-sql.md +7 -2
  75. package/package.json +2 -1
  76. package/dist/canonical-DMvR9yBe.mjs +0 -972
  77. package/dist/column-BzN8KFJa.mjs +0 -364
  78. package/dist/column-CFvSbil0.mjs +0 -309
  79. package/dist/complete-types-CNMWBWap.d.mts +0 -371
  80. package/dist/index-CGui70hi.d.mts +0 -32
  81. package/dist/json-Db7XRD91.mjs +0 -169
  82. package/dist/omit-OxV58AwX.mjs +0 -5
  83. package/dist/serialize-OvXCLzjm.d.mts +0 -66
  84. package/dist/snapshot-DgsOhf_8.mjs +0 -354
@@ -9,15 +9,15 @@
9
9
  | `qubu` | Runtime | Ordinary query and schema definitions, reads, writes, SQL templates, rendering, EXPLAIN, and execution contracts |
10
10
  | `qubu/core` | Runtime | Fragment and rendering primitives, dialect construction, SQL types, and extension constructors |
11
11
  | `qubu/codegen` | Runtime | Deterministic machine-owned TypeScript schemas from complete, non-lossy introspection |
12
- | `qubu/diff` | Runtime | Canonical Snapshot v1 or v2 comparison, rename hints, suggestions, and safety diagnostics |
13
- | `qubu/introspection` | Runtime | Shared catalog contracts, normalized catalog models, diagnostics, and mapping to Snapshot v1 or v2 |
12
+ | `qubu/diff` | Runtime | Canonical Snapshot v1 comparison, rename hints, suggestions, and safety diagnostics |
13
+ | `qubu/introspection` | Runtime | Shared catalog contracts, normalized catalog models, diagnostics, and mapping to Snapshot v1 |
14
14
  | `qubu/introspection/postgres` | Runtime | PostgreSQL catalog reader and catalog queries for one selected namespace |
15
15
  | `qubu/introspection/sqlite` | Runtime | SQLite catalog reader and catalog queries for one selected namespace |
16
16
  | `qubu/introspection/mysql` | Runtime | MySQL catalog reader and catalog queries for one selected namespace |
17
17
  | `qubu/mysql` | Runtime | The MySQL query dialect policy |
18
18
  | `qubu/postgres` | Runtime | PostgreSQL query dialect helpers such as `postgresDialect()` and `ilike()` |
19
19
  | `qubu/schema` | Runtime | Advanced schema metadata, storage and constraint models, source models, and schema-expression extensions |
20
- | `qubu/snapshot` | Runtime | Canonical Snapshot v1 and v2 traversal, encoding, decoding, diagnostics, and fingerprints |
20
+ | `qubu/snapshot` | Runtime | Canonical Snapshot v1 traversal, encoding, decoding, diagnostics, and fingerprints |
21
21
  | `qubu/snapshot/mysql` | Runtime | MySQL snapshot adapter, schema dialect, and convenience creators |
22
22
  | `qubu/snapshot/postgres` | Runtime | PostgreSQL snapshot adapter, schema dialect, and convenience creators |
23
23
  | `qubu/snapshot/sqlite` | Runtime | SQLite snapshot adapter, schema dialect, affinity helper, and convenience creators |
@@ -25,6 +25,7 @@
25
25
  | `qubu/vite` | Runtime | The optional `qubu()` Vite compiler hint |
26
26
  | `qubu/package.json` | JSON | The published package manifest |
27
27
  | `@qubu/migrate` | Runtime | Migration compiler format identity and shared plan types |
28
+ | `@qubu/pgvector` | Runtime | PostgreSQL pgvector columns, dense-vector codecs, distance expressions, and HNSW/IVFFlat index metadata |
28
29
  | `@qubu/migrate/plan` | Runtime | Pure migration planning with dependencies, decisions, preconditions, and explicit custom SQL |
29
30
  | `@qubu/migrate/ddl` | Runtime | DDL preflight and generic emission from a migration plan and supplied schema dialect |
30
31
  | `@qubu/migrate/ddl/postgres` | Runtime | PostgreSQL DDL emission from an approved migration plan |
@@ -78,14 +79,14 @@ entrypoint table.
78
79
  | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
79
80
  | Schema values | `table`, immutable `schema` registries with namespaces, portable and dialect-native column storage descriptors, canonical default and generated-column metadata, identity descriptors, named primary, candidate-key, nullable unique, foreign-key, and check constraints, physical object names, included-column indexes, typed dialect extensions, and typed column helpers |
80
81
  | Read queries | Named projections, spreadable source columns, aliases, joins, typed custom and LATERAL `FROM` sources, correlated subqueries, `WHERE`, grouping with declared-key proofs, `HAVING`, ordering, window expressions, distinctness, pagination, row locking, ordinary and recursive CTEs, subqueries, and set operations |
81
- | Expressions | Comparison, boolean, arithmetic, null, range, membership, aggregate, window, string, JSON scalar reads, definition-backed and raw casts, cases, parameterized SQL templates, custom expressions, and branded deterministic schema expressions |
82
+ | Expressions | Comparison, boolean, arithmetic, null, range, membership, aggregate, window, string, JSON scalar reads and typed nested JSON query results, definition-backed and raw casts, cases, parameterized SQL templates, custom expressions, and branded deterministic schema expressions |
82
83
  | SQL type metadata | Portable domains and capabilities, physical column storage descriptors, `SqlTypeOf`, projected SQL type maps, `SourceLike` and `TableLike` field constraints, contextual literals, typed extension values, calls, and casts, plus a permissive `SqlUnknown` fallback |
83
- | Write queries | `INSERT` values, defaults, and selects; typed `UPDATE`, PostgreSQL `UPDATE ... FROM`, and `DELETE`; typed assignments; `RETURNING`; and explicit unrestricted-write opt-in |
84
+ | Write queries | `INSERT` values, defaults, and selects; typed `UPDATE`, PostgreSQL `UPDATE ... FROM`, and `DELETE`; typed assignments; PostgreSQL/SQLite conflict clauses; MySQL duplicate-key updates and incoming rows; `RETURNING` on supporting dialects; and explicit unrestricted-write opt-in |
84
85
  | Rendering | Standard, PostgreSQL, SQLite, MySQL, and user-created policies for identifiers, placeholders, pagination, row locking, JSON, logical cast targets, schema literals, and EXPLAIN options |
85
86
  | Execution boundary | `QueryAdapter`, opt-in `ExplainableQueryAdapter`, `StreamingQueryAdapter`, and `TransactionalQueryAdapter` capabilities, bound clients from `qubu()`, structured results from `execute()` or `db.execute()`, row-only results from `executeRows()` or `db.rows()`, typed read streams from `stream()` or `db.stream()`, and adapter-decoded plan rows from `explain()` or `db.explain()` |
86
- | Snapshots | Pure Snapshot v1 and v2 creation, canonical encoding and strict decoding, immutable data, diagnostics, and FNV change-detection fingerprints |
87
+ | Snapshots | Pure Snapshot v1 creation, canonical encoding and strict decoding, immutable data, diagnostics, and FNV change-detection fingerprints |
87
88
  | Introspection | PostgreSQL, SQLite, and MySQL catalog readers for one selected namespace, normalized catalog data, structured diagnostics, and strict or explicit lossy snapshot mapping |
88
- | Snapshot diffing | Pure Snapshot v1 and v2 comparison, explicit rename evidence, non-authoritative suggestions, and safety diagnostics |
89
+ | Snapshot diffing | Pure Snapshot v1 comparison, explicit rename evidence, non-authoritative suggestions, and safety diagnostics |
89
90
  | Migration planning | Pure, dialect-neutral plans with stable ordering, dependency edges, preconditions, explicit review decisions, and tagged custom SQL |
90
91
  | DDL emission | Preflight plus deterministic PostgreSQL, SQLite, and MySQL statements from an approved `MigrationPlan` and matching `SchemaDialect` |
91
92
  | Migration operations | Strict artifacts and baselines, authoritative programs, repository and journal validation, adapter capability preflight, execution, status/drift, reconciliation, SQLite bootstrap, and complete PostgreSQL bootstrap with standalone enum ordering |
@@ -31,25 +31,38 @@ IDs are evidence selected by the adapter's identity policy. PostgreSQL OIDs,
31
31
  SQLite implementation names, and similar catalog keys stay in current-run
32
32
  references and are not used as logical IDs.
33
33
 
34
- ## Snapshot v2
34
+ ## Snapshot v1
35
35
 
36
36
  `qubu/snapshot` provides the strict complete format as a separate API:
37
37
 
38
38
  ```ts
39
39
  import { decodeCompleteSchemaSnapshot, encodeCompleteSchemaSnapshot } from "qubu/snapshot"
40
40
 
41
- const encoded = encodeCompleteSchemaSnapshot(snapshotV2)
41
+ const encoded = encodeCompleteSchemaSnapshot(snapshotV1)
42
42
  const decoded = decodeCompleteSchemaSnapshot(encoded)
43
43
  ```
44
44
 
45
- Snapshot v2 uses the same `qubu-schema` envelope with `version: 2`. Its
45
+ Snapshot v1 uses the same `qubu-schema` envelope with `version: 1`. Its
46
46
  namespace, capability facts, object-family arrays, cross-object references,
47
47
  provenance, typed dialect extensions, and deferred/opaque boundaries are
48
48
  strictly validated. Arrays are ordered by logical ID (with ordinal sequences
49
49
  and index terms ordered by their semantic position), and the fingerprint is computed
50
50
  from the deterministic encoding.
51
51
 
52
- Snapshot v1 remains a separate strict format. `decodeSchemaSnapshot` still
53
- accepts only v1 and continues to reject unknown fields and future versions;
54
- v2 callers must select `decodeCompleteSchemaSnapshot` explicitly. Neither
55
- snapshot format evaluates database-provided SQL.
52
+ Normalized references to nested catalog objects retain their owner scope. A
53
+ table-local index or constraint reference is mapped with
54
+ `owner: { kind: "table", id }`; view columns use the view kind and ID; domain
55
+ constraints use the domain kind and ID. The legacy `tableId` shorthand on
56
+ catalog entity references is converted to that owner form at the Snapshot v1
57
+ boundary. Top-level references have no owner. This scope prevents equal child
58
+ IDs from different tables or object families from overwriting one another.
59
+
60
+ Catalog extension payloads and configuration records are opaque JSON. Their
61
+ keys and values are preserved through normalization and canonical encoding;
62
+ objects inside those payloads are not treated as Snapshot expressions or
63
+ native storage declarations.
64
+
65
+ Snapshot v1 is the only strict schema snapshot format. `decodeSchemaSnapshot`
66
+ and `decodeCompleteSchemaSnapshot` both validate the same version-1 envelope,
67
+ reject unknown fields and future versions, and never evaluate database-provided
68
+ SQL.
@@ -135,6 +135,6 @@ module does not look complete by omission.
135
135
 
136
136
  The entrypoint does not provide a CLI, filesystem ownership, live driver
137
137
  integration, multiple namespaces, runtime schema materialization, migrations,
138
- DDL, Snapshot v2 object generation, or hand-edit merging. Use
138
+ DDL, non-table object generation, or hand-edit merging. Use
139
139
  [Database introspection](introspection.md) for the catalog boundary and
140
140
  [Canonical schema snapshots](snapshots.md) for the identity artifact.
@@ -1,6 +1,6 @@
1
1
  # Snapshot diffing
2
2
 
3
- > Compare canonical Snapshot v1 or v2 values and review identity changes before a later planning step.
3
+ > Compare canonical Snapshot v1 values and review identity changes before a later planning step.
4
4
 
5
5
  The optional `qubu/diff` entrypoint compares immutable snapshot data. It does
6
6
  not open a connection, render SQL, execute a change, or infer migration history.
@@ -57,7 +57,7 @@ an `ambiguous` diagnostic and leaves both operations visible for review.
57
57
 
58
58
  Removing an object is marked `destructive`. Narrowing nullability, changing
59
59
  storage, removing a value, or changing a constraint can also receive that
60
- classification. Opaque and deferred Snapshot v2 records remain visible as
60
+ classification. Opaque and deferred Snapshot v1 records remain visible as
61
61
  `add` or `remove` data and produce `lossy` or `unsupported` diagnostics. They
62
62
  cannot be silently promoted to a rename.
63
63
 
@@ -1,6 +1,6 @@
1
1
  # Database introspection
2
2
 
3
- > Read one existing database namespace into explainable catalog data and an optional canonical Snapshot v1 or complete Snapshot v2 without giving Qubu ownership of the connection.
3
+ > Read one existing database namespace into explainable catalog data and a canonical Snapshot v1 without giving Qubu ownership of the connection.
4
4
 
5
5
  Database introspection is an optional capability exported from
6
6
  `qubu/introspection`. It discovers database facts; it does not recreate the
@@ -85,8 +85,8 @@ catalog. Use `createCompleteIntrospectionCatalog()` to materialize and freeze
85
85
  all optional collections, then `mapCatalogToCompleteSnapshot()` when an
86
86
  adapter-supported family such as views, routines, triggers, partitions,
87
87
  collations, comments, or retained opaque and deferred objects must cross the
88
- strict Snapshot v2 boundary. Snapshot v1 is still selected explicitly by
89
- `mapCatalogToSnapshot()` and remains table-shaped.
88
+ strict Snapshot v1 boundary. `mapCatalogToSnapshot()` delegates to the complete
89
+ mapper, so the canonical result is always Snapshot v1.
90
90
 
91
91
  The result is successful only when Snapshot v1 validation succeeds. A failed
92
92
  result may retain the partial catalog and structured diagnostics, but it has no
@@ -108,9 +108,9 @@ rename. Pass the previous snapshot or an identity hint when a later diff must
108
108
  preserve identity across a rename. See [snapshot diffing](diff.md) for the
109
109
  comparison and hint boundary.
110
110
 
111
- The first version selects one namespace: a PostgreSQL schema, MySQL database,
112
- or SQLite database such as `main`. It does not combine attached databases or
113
- multiple PostgreSQL schemas into one Snapshot v1 value.
111
+ Each Snapshot v1 result selects one namespace: a PostgreSQL schema, MySQL
112
+ database, or SQLite database such as `main`. It does not combine attached
113
+ databases or multiple PostgreSQL schemas into one value.
114
114
 
115
115
  ## Strict and lossy output
116
116
 
@@ -127,12 +127,20 @@ generated expressions, checks, predicates, and expression index terms remain
127
127
  dialect-tagged SQL. Falsy values such as `0`, `false`, `NULL`, and empty
128
128
  strings are preserved.
129
129
 
130
+ References to nested columns, constraints, and indexes include their owning
131
+ table, view, or domain in the complete Snapshot v1 output. References to
132
+ top-level objects remain unscoped, and table-local backing relationships must
133
+ resolve within the table that contains them. Dialect provenance, extensions,
134
+ native storage, and typed expressions are checked against the selected
135
+ snapshot dialect; arbitrary catalog `data` and `configuration` JSON remains
136
+ opaque.
137
+
130
138
  PostgreSQL readers expose views, materialized views, sequences, enums, domains,
131
139
  collations, routines, triggers, policies, partitions, extensions, comments,
132
140
  and ownership as typed complete catalog records. `mapCatalogToCompleteSnapshot`
133
- retains those records in Snapshot v2. The existing `mapCatalogToSnapshot`
134
- mapper still emits the table-only Snapshot v1 and does not fabricate these
135
- objects into tables. If a PostgreSQL catalog row lacks the evidence needed for
141
+ retains those records in Snapshot v1. `mapCatalogToSnapshot()` uses the same
142
+ complete mapping and does not fabricate these objects into tables. If a
143
+ PostgreSQL catalog row lacks the evidence needed for
136
144
  safe normalization, the reader retains a deferred or opaque record and emits a
137
145
  diagnostic.
138
146
 
@@ -155,13 +163,13 @@ collations used by the selected tables or columns, and comments.
155
163
 
156
164
  View definitions come from `INFORMATION_SCHEMA.VIEWS`. The reader cross-
157
165
  references each view with its `INFORMATION_SCHEMA.COLUMNS` rows by physical
158
- table name, so view columns remain attached to the view and Snapshot v2 can
166
+ table name, so view columns remain attached to the view and Snapshot v1 can
159
167
  validate their own column IDs. A missing definition or an unresolved
160
168
  cross-object reference becomes a deferred record with a diagnostic.
161
169
 
162
170
  MySQL scheduled events are kept as `CatalogOpaqueObject` records with their
163
171
  metadata and definition tagged as opaque SQL. The reader emits an
164
- `unmodeled-object` warning, and Snapshot v2 retains the record in
172
+ `unmodeled-object` warning, and Snapshot v1 retains the record in
165
173
  `opaqueObjects` without treating it as a typed routine, trigger, or migration
166
174
  operation.
167
175
 
@@ -178,9 +186,8 @@ The reader keeps that metadata as normalized typed data and never evaluates
178
186
  database-provided SQL. Optional source generation remains a later, pure step
179
187
  with a controlled literal printer.
180
188
 
181
- Use `mapCatalogToCompleteSnapshot()` for the typed MySQL families and its
182
- opaque or deferred boundaries. Use `mapCatalogToSnapshot()` when the caller
183
- needs the table-only Snapshot v1.
189
+ Use `mapCatalogToSnapshot()` or `mapCatalogToCompleteSnapshot()` for the typed
190
+ MySQL families and their opaque or deferred boundaries.
184
191
 
185
192
  ## Diagnostics and safety
186
193
 
@@ -14,10 +14,11 @@ const snapshot = createSchemaSnapshot(appSchema)
14
14
  const json = encodeSchemaSnapshot(snapshot)
15
15
  ```
16
16
 
17
- The v1 envelope contains a format version, an independently versioned dialect
18
- extension, a versioned naming-policy description, an optional namespace, and
19
- arrays of tables. Tables, columns, constraints, and indexes are sorted by
20
- stable logical ID. Physical names are values in the snapshot, not identities:
17
+ The Snapshot v1 envelope contains a format version, an independently versioned
18
+ dialect extension, a versioned naming-policy description, a namespace,
19
+ capability facts, and arrays for every supported object family. Tables,
20
+ columns, constraints, and indexes are sorted by stable logical ID. Physical
21
+ names are values in the snapshot, not identities:
21
22
  changing a physical name does not change the TypeScript field or metadata key.
22
23
 
23
24
  Snapshot data is deliberately not executable Qubu state. Expressions are
@@ -45,6 +46,15 @@ dialect metadata, and broken foreign-key or column references as structured
45
46
  diagnostics. It does not call `process.exit()` and has no runtime validation
46
47
  library dependency.
47
48
 
49
+ References to nested columns, constraints, and indexes carry an explicit
50
+ `owner: { kind, id }` scope. Table columns, constraints, and indexes are owned
51
+ by their table; view columns are owned by their view; and domain constraints
52
+ are owned by their domain. References to top-level objects remain ownerless,
53
+ and the decoder validates each nested scope independently. Dialect metadata is
54
+ checked only in typed snapshot fields. Extension `data`, `configuration`, and
55
+ other opaque JSON payloads are retained as data and are not interpreted as
56
+ typed metadata.
57
+
48
58
  `schemaSnapshotFingerprint()` computes a deterministic content fingerprint from canonical
49
59
  JSON. The fingerprint is useful for cache keys and fixture assertions only. It is not
50
60
  an entity identity, a rename marker, or migration lineage.
@@ -91,15 +101,15 @@ Snapshot serialization remains separate from database introspection,
91
101
  comparison, rename resolution, migration planning, and DDL emission. The
92
102
  optional `qubu/introspection` entrypoint can produce the same canonical
93
103
  Snapshot v1 data from a user-owned catalog connection. The complete normalized
94
- catalog can also be encoded as strict Snapshot v2 with the dedicated
95
- complete-snapshot APIs described in [the catalog model](catalog-model.md).
104
+ catalog can also be encoded with the explicit complete-snapshot APIs described
105
+ in [the catalog model](catalog-model.md).
96
106
  Readers and connection lifecycle do not belong to this pure serialization
97
- layer. Diffing can compare either snapshot version. Resolved diffs feed
107
+ layer. Diffing consumes Snapshot v1. Resolved diffs feed
98
108
  migration plans, and approved plans feed DDL emission. The package-wide
99
109
  [ownership map](../reference/supported-surface.md#ownership-boundary) keeps
100
110
  those pure steps separate from application-owned database execution.
101
111
 
102
112
  The optional [schema source generator](code-generation.md) consumes a complete,
103
113
  non-lossy introspection result and makes its generated schema the next identity
104
- baseline. It does not replace snapshot serialization or generate Snapshot v2
114
+ baseline. It does not replace snapshot serialization or populate non-table
105
115
  object families.
@@ -36,14 +36,19 @@ declaration:
36
36
  import { nativeColumn, nativeStorage, table } from "qubu"
37
37
 
38
38
  const accounts = table("accounts", {
39
- handle: nativeColumn(nativeStorage("postgresql", 'citext COLLATE "C"')),
39
+ handle: nativeColumn(nativeStorage("postgresql", 'citext COLLATE "C"'), {
40
+ sqlType: "postgres.citext",
41
+ }),
40
42
  })
41
43
  ```
42
44
 
43
45
  `nativeStorage()` preserves the declaration text and freezes the descriptor. The
44
46
  `ColumnStorageOf`, `ColumnStorageTypeOf`, `ColumnStorageDialectOf`, and
45
47
  `ColumnStorageDeclarationOf` helpers read its metadata. Native storage is
46
- descriptive. It does not change selection, mutation, or query rendering.
48
+ descriptive. The optional `sqlType` field is the runtime semantic domain passed
49
+ to adapters; provide it for custom domains because the compile-time SQL type is
50
+ not available at runtime. It does not change selection, mutation, or query
51
+ rendering.
47
52
 
48
53
  ## Render deterministic schema expressions
49
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qubu",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/aleclarson/qubu"
@@ -124,6 +124,7 @@
124
124
  "test:type-performance": "node ./scripts/test-type-performance.mjs",
125
125
  "diff-check": "vitest --run test/diff.test.ts && pnpm --filter @qubu/migrate test -- plan.test.ts",
126
126
  "test:bun": "node ./scripts/test-package.mjs --runtime=bun",
127
+ "test:bun-sql": "bun test adapters/bun-sql/test/bun-sql.test.ts",
127
128
  "test:package": "node ./scripts/test-package.mjs",
128
129
  "test:workspace-children": "pnpm run build:workspace-packages && node ./scripts/test-workspace-packages.mjs",
129
130
  "test:workspace-packages": "pnpm run test:package && pnpm run test:workspace-children",