qubu 0.6.0 → 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 (95) hide show
  1. package/README.md +112 -0
  2. package/dist/{complete-DP7pliuY.mjs → canonical-B5_ouh-c.mjs} +466 -241
  3. package/dist/codegen.d.mts +2 -2
  4. package/dist/codegen.mjs +180 -90
  5. package/dist/column-Cyc2CMnG.mjs +116 -0
  6. package/dist/column-DDRvD7SF.mjs +721 -0
  7. package/dist/{constraints-YGyNPQ_z.mjs → constraints-CAmi18Uk.mjs} +8 -3
  8. package/dist/core.d.mts +3 -3
  9. package/dist/core.mjs +4 -5
  10. package/dist/diagnostics-I9vVtXkc.mjs +40 -0
  11. package/dist/diff.d.mts +9 -9
  12. package/dist/diff.mjs +152 -102
  13. package/dist/{explain-CkIK13L_.mjs → explain-BIqEmZha.mjs} +1 -1
  14. package/dist/expressions-_6JF_J77.mjs +130 -0
  15. package/dist/index-CaxrMD1A.d.mts +1 -0
  16. package/dist/index.d.mts +2 -2
  17. package/dist/index.mjs +414 -77
  18. package/dist/introspection/mysql.d.mts +26 -0
  19. package/dist/introspection/mysql.mjs +1278 -0
  20. package/dist/introspection/postgres.d.mts +43 -0
  21. package/dist/introspection/postgres.mjs +1889 -0
  22. package/dist/introspection/sqlite.d.mts +15 -0
  23. package/dist/introspection/sqlite.mjs +1172 -0
  24. package/dist/introspection.d.mts +26 -87
  25. package/dist/introspection.mjs +3 -4351
  26. package/dist/mysql.d.mts +3 -3
  27. package/dist/mysql.mjs +8 -7
  28. package/dist/{errors-Dxv73YJu.mjs → omit-VEr9Ydux.mjs} +5 -1
  29. package/dist/{on-conflict-DZQ85f1t.mjs → on-conflict-B2rFyHGF.mjs} +78 -8
  30. package/dist/on-duplicate-key-update-Czsw1Yq-.mjs +95 -0
  31. package/dist/postgres-hFhd0I9n.mjs +68 -0
  32. package/dist/postgres.d.mts +3 -3
  33. package/dist/postgres.mjs +3 -52
  34. package/dist/registry-BXE_4M9P.mjs +127 -0
  35. package/dist/{relational-CxnLCqZQ.mjs → relational-CoPBETjI.mjs} +3 -3
  36. package/dist/schema.d.mts +2 -2
  37. package/dist/schema.mjs +8 -7
  38. package/dist/{serialize-BN07IK0v.mjs → serialize-CyobNEx-.mjs} +174 -30
  39. package/dist/serialize-Du2UPZMt.d.mts +92 -0
  40. package/dist/snapshot/mysql.d.mts +5 -5
  41. package/dist/snapshot/mysql.mjs +32 -32
  42. package/dist/snapshot/postgres.d.mts +5 -5
  43. package/dist/snapshot/postgres.mjs +25 -25
  44. package/dist/snapshot/sqlite.d.mts +5 -5
  45. package/dist/snapshot/sqlite.mjs +30 -30
  46. package/dist/snapshot-mIb-Zzb5.mjs +1489 -0
  47. package/dist/snapshot.d.mts +4 -5
  48. package/dist/snapshot.mjs +3 -4
  49. package/dist/{source-SqrKWjFJ.mjs → source-DYSUqzvb.mjs} +2 -2
  50. package/dist/sqlite.d.mts +2 -2
  51. package/dist/sqlite.mjs +10 -10
  52. package/dist/{table-BwflqeAj.mjs → table-B8zEq0az.mjs} +4 -4
  53. package/dist/{types-BIJsj2fJ.mjs → types-CYHpSPwj.mjs} +10 -7
  54. package/dist/{types-CTCqtFlS.d.mts → types-CiMvKi5V.d.mts} +14 -4
  55. package/dist/{types-C0VkiwpR.d.mts → types-Dqr4o2I1.d.mts} +640 -189
  56. package/dist/value-CpaUFtjw.mjs +45 -0
  57. package/dist/vite/ambient.d.ts +2 -0
  58. package/dist/vite.d.mts +1 -1
  59. package/dist/vite.mjs +2 -0
  60. package/docs/dialects-and-execution.md +61 -11
  61. package/docs/getting-started.md +1 -1
  62. package/docs/guides/compose-queries.md +22 -0
  63. package/docs/guides/drizzle.md +11 -11
  64. package/docs/guides/extensions/typed-expressions.md +5 -3
  65. package/docs/guides/json.md +95 -2
  66. package/docs/guides/mutations.md +125 -0
  67. package/docs/guides/valtio-sync.md +113 -0
  68. package/docs/index.md +1 -1
  69. package/docs/migrations/adapters.md +58 -21
  70. package/docs/migrations/index.md +50 -12
  71. package/docs/migrations/operations.md +20 -6
  72. package/docs/migrations/recovery.md +7 -1
  73. package/docs/query-model/fragments.md +21 -1
  74. package/docs/reference/introspection-support.md +16 -18
  75. package/docs/reference/supported-surface.md +23 -11
  76. package/docs/schema/catalog-model.md +20 -7
  77. package/docs/schema/code-generation.md +4 -3
  78. package/docs/schema/diff.md +2 -2
  79. package/docs/schema/introspection.md +24 -16
  80. package/docs/schema/snapshots.md +18 -8
  81. package/docs/schema/storage-and-schema-sql.md +7 -2
  82. package/docs/sql-semantic-types.md +8 -0
  83. package/package.json +14 -1
  84. package/dist/canonical-DMvR9yBe.mjs +0 -972
  85. package/dist/column-Da37jYSD.mjs +0 -309
  86. package/dist/column-r1Y4ivwt.mjs +0 -327
  87. package/dist/complete-types-CY0KbzNw.d.mts +0 -371
  88. package/dist/index-B2rZf3-2.d.mts +0 -32
  89. package/dist/json-Db7XRD91.mjs +0 -169
  90. package/dist/omit-OxV58AwX.mjs +0 -5
  91. package/dist/registry-BRcUuazJ.mjs +0 -256
  92. package/dist/serialize-CEIIlWhC.d.mts +0 -66
  93. package/dist/snapshot-Xam8-q0j.mjs +0 -392
  94. package/dist/standard-DfcZEVOj.mjs +0 -12
  95. package/dist/value-D14I_XgL.mjs +0 -29
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # Qubu
2
+
3
+ > Build parameterized SQL from simple type declarations and composable values.
4
+
5
+ Qubu is a functional-first, type-aware SQL builder for TypeScript. Define
6
+ tables once, combine expressions and clauses as ordinary values, and inspect
7
+ the exact SQL and parameters before execution.
8
+
9
+ Qubu stays close to SQL rather than replacing it with an object model. The type
10
+ system tracks the facts needed to compose a query safely, while the rendered
11
+ statement remains recognizable to anyone who knows SQL.
12
+
13
+ > [!IMPORTANT]
14
+ > Qubu is pre-alpha. Its public APIs and package structure may change between
15
+ > releases.
16
+
17
+ ## A small query
18
+
19
+ Declare a table, build a reusable condition, and pass it into a query:
20
+
21
+ ```ts
22
+ import { eq, from, integer, render, select, table, text, where } from "qubu"
23
+
24
+ const users = table("users", {
25
+ id: integer(),
26
+ name: text(),
27
+ })
28
+
29
+ const byId = where(eq(users.id, 7))
30
+
31
+ const query = select(
32
+ {
33
+ id: users.id,
34
+ name: users.name,
35
+ },
36
+ from(users),
37
+ byId,
38
+ )
39
+
40
+ type UserRow = typeof query.row
41
+ // { id: number; name: string }
42
+
43
+ render(query)
44
+ // {
45
+ // text: 'SELECT "users"."id" AS "id", "users"."name" AS "name" FROM "users" WHERE ("users"."id" = ?)',
46
+ // parameters: [7],
47
+ // }
48
+ ```
49
+
50
+ The table declaration supplies the application types, the condition remains a
51
+ value that can be reused, and `7` becomes a bound parameter instead of SQL
52
+ text. The projection determines the inferred result row.
53
+
54
+ Clauses are independent values. `select()` accepts them in any argument order
55
+ and renders them in canonical SQL order. Writing the final call in SQL order is
56
+ still the preferred style because it is easier to scan.
57
+
58
+ ## Designed to be understood
59
+
60
+ Qubu favors small declarations and functions that return composable values. A
61
+ query can be assembled or changed one piece at a time, and TypeScript reports
62
+ when those pieces do not fit. Rendering provides the SQL and parameters needed
63
+ to check the result directly.
64
+
65
+ These properties also help coding agents. A table declaration gives an agent a
66
+ compact description of the data, composable values keep changes local, and the
67
+ type checker and rendered SQL provide concrete feedback. That reduces guessing
68
+ and makes the resulting work easier for a person to review.
69
+
70
+ Qubu ships [version-matched documentation](docs/index.md) and a
71
+ [Qubu skill](skills/qubu/SKILL.md) that routes agent tasks to the relevant
72
+ guide for the installed package.
73
+
74
+ ## Scope and boundaries
75
+
76
+ Qubu is for developers who know SQL and want composition and type checking
77
+ without adopting an ORM model. It does not provide relationship loading,
78
+ identity maps, lazy loading, or change tracking.
79
+
80
+ Qubu constructs and renders queries, and it can pass them through an
81
+ application-supplied adapter. The application continues to own its database
82
+ driver, connections, and database lifecycle. PostgreSQL, SQLite, and MySQL
83
+ differences remain visible through explicit dialect entrypoints.
84
+
85
+ Optional entrypoints and workspace packages cover schema introspection, source
86
+ generation, snapshots, diffs, migration planning, DDL emission, and migration
87
+ operations. These stages remain separate so applications can inspect and
88
+ approve a change before executing it. See [Supported features](docs/reference/supported-surface.md)
89
+ for the complete package and ownership map.
90
+
91
+ ## Start here
92
+
93
+ Install Qubu in a TypeScript project:
94
+
95
+ ```bash
96
+ pnpm add qubu
97
+ ```
98
+
99
+ Continue with the documentation for the task at hand:
100
+
101
+ - [Getting started](docs/getting-started.md) defines a table and renders the
102
+ first query.
103
+ - [Build a `SELECT`](docs/guides/select/overview.md) covers projections,
104
+ predicates, joins, grouping, and pagination.
105
+ - [Write mutations](docs/guides/mutations.md) covers typed `INSERT`, `UPDATE`,
106
+ and `DELETE` statements.
107
+ - [Dialects and execution](docs/dialects-and-execution.md) explains rendering
108
+ policies and the application-owned adapter boundary.
109
+ - [Schema and migration documentation](docs/schema/tables-and-names.md) starts
110
+ with table metadata and links through snapshots, diffs, plans, and DDL.
111
+ - [Troubleshooting](docs/troubleshooting.md) starts from common query failures
112
+ and their repair paths.