symmetria 2.2.0 → 2.5.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.
Files changed (65) hide show
  1. package/README.md +28 -27
  2. package/dist/better-auth.js +1 -1
  3. package/dist/{binding-BiJH76XX.js → binding-jM09pXvJ.js} +4 -3
  4. package/dist/binding-jM09pXvJ.js.map +1 -0
  5. package/dist/bun.d.ts +2 -2
  6. package/dist/bun.js +4 -3
  7. package/dist/bun.js.map +1 -1
  8. package/dist/cohere.d.ts +1 -1
  9. package/dist/cohere.js +1 -1
  10. package/dist/{compile-CLksO6-D.js → compile-hFOq0snq.js} +404 -45
  11. package/dist/compile-hFOq0snq.js.map +1 -0
  12. package/dist/{core-Bu8-BTNf.js → core-kaO0qvAO.js} +120 -7
  13. package/dist/core-kaO0qvAO.js.map +1 -0
  14. package/dist/driver.d.ts +3 -3
  15. package/dist/driver.js +2 -2
  16. package/dist/google.d.ts +1 -1
  17. package/dist/google.js +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +331 -316
  20. package/dist/index.js.map +1 -1
  21. package/dist/{inspection-CYlzNdVg.js → inspection-djgix9ya.js} +3 -3
  22. package/dist/{inspection-CYlzNdVg.js.map → inspection-djgix9ya.js.map} +1 -1
  23. package/dist/internal.d.ts +1 -1
  24. package/dist/internal.js +3 -3
  25. package/dist/jina.d.ts +1 -1
  26. package/dist/jina.js +1 -1
  27. package/dist/mistral.d.ts +1 -1
  28. package/dist/mistral.js +1 -1
  29. package/dist/ollama.d.ts +1 -1
  30. package/dist/ollama.js +1 -1
  31. package/dist/openai.d.ts +1 -1
  32. package/dist/openai.js +1 -1
  33. package/dist/{pg-Cx2W_Lmd.js → pg-9c7xlOnS.js} +6 -5
  34. package/dist/{pg-Cx2W_Lmd.js.map → pg-9c7xlOnS.js.map} +1 -1
  35. package/dist/{pg-B7bJIFw0.d.ts → pg-B5rodRoT.d.ts} +3 -3
  36. package/dist/pg.d.ts +3 -3
  37. package/dist/pg.js +2 -2
  38. package/dist/{pool-CFas0E3j.js → pool-C3RZQz3X.js} +27 -11
  39. package/dist/pool-C3RZQz3X.js.map +1 -0
  40. package/dist/{pool-x45tVc5q.d.ts → pool-XG_sgock.d.ts} +2 -2
  41. package/dist/{search-CwBcdihW.js → search-jZqgEILM.js} +13 -6
  42. package/dist/search-jZqgEILM.js.map +1 -0
  43. package/dist/search.d.ts +1 -1
  44. package/dist/search.js +1 -1
  45. package/dist/{table-Lbap-R_E.js → table-BOy3SI0b.js} +24 -5
  46. package/dist/table-BOy3SI0b.js.map +1 -0
  47. package/dist/{types-DPWc6nQ9.js → types-BCMCu-EF.js} +28 -5
  48. package/dist/types-BCMCu-EF.js.map +1 -0
  49. package/dist/{types-Dki1Ej7A.d.ts → types-C2s_w1LW.d.ts} +167 -119
  50. package/dist/values-CInqtWRn.js +11 -0
  51. package/dist/values-CInqtWRn.js.map +1 -0
  52. package/dist/vector.d.ts +1 -1
  53. package/dist/vector.js +1 -1
  54. package/dist/voyage.d.ts +1 -1
  55. package/dist/voyage.js +1 -1
  56. package/package.json +1 -1
  57. package/dist/binding-BiJH76XX.js.map +0 -1
  58. package/dist/compile-CLksO6-D.js.map +0 -1
  59. package/dist/core-Bu8-BTNf.js.map +0 -1
  60. package/dist/pool-CFas0E3j.js.map +0 -1
  61. package/dist/search-CwBcdihW.js.map +0 -1
  62. package/dist/table-Lbap-R_E.js.map +0 -1
  63. package/dist/types-DPWc6nQ9.js.map +0 -1
  64. package/dist/values-C7U6IIQZ.js +0 -10
  65. package/dist/values-C7U6IIQZ.js.map +0 -1
package/README.md CHANGED
@@ -127,21 +127,21 @@ import { createDatabase } from "symmetria";
127
127
  import { postgres } from "symmetria/bun";
128
128
  import { appSchema } from "./schema.ts";
129
129
 
130
- const database = createDatabase({
130
+ const db = createDatabase({
131
131
  schema: appSchema,
132
132
  driver: postgres({ url: process.env.DATABASE_URL! }),
133
133
  });
134
134
 
135
135
  try {
136
- await database.users
136
+ await db.users
137
137
  .insert({ name: "Ada", email: "ada@example.com" })
138
138
  .onConflict("email")
139
139
  .doNothing();
140
140
 
141
- const author = await database.users.by.email("ada@example.com").one();
142
- await database.posts.insert({ title: "Typed SQL", authorId: author.id });
141
+ const author = await db.users.get({ email: "ada@example.com" });
142
+ await db.posts.insert({ title: "Typed SQL", authorId: author.id });
143
143
 
144
- const authors = await database.users(({ name, posts }) => ({
144
+ const authors = await db.users(({ name, posts }) => ({
145
145
  name,
146
146
  posts: posts(({ title, views }) => ({ title, views }), {
147
147
  orderBy: ({ id }) => id.descending,
@@ -152,7 +152,7 @@ try {
152
152
 
153
153
  console.log(authors);
154
154
  } finally {
155
- await database.$close();
155
+ await db.$close();
156
156
  }
157
157
  ```
158
158
 
@@ -170,7 +170,7 @@ Each option can be a value or a synchronous callback receiving the same typed
170
170
  source and SQL tools.
171
171
 
172
172
  ```ts
173
- const feed = database.posts(
173
+ const feed = db.posts(
174
174
  ({ title, authorId }, { join }) => ({ title, author: join(authorId).name }),
175
175
  { orderBy: ({ id }) => id.descending },
176
176
  );
@@ -197,8 +197,8 @@ Reusable projections bind to each source occurrence, including aliases and
197
197
  relations:
198
198
 
199
199
  ```ts
200
- const userCard = database.users.shape((user) => ({ name: user.name }));
201
- const feed = database.posts((post) => ({
200
+ const userCard = db.users.shape((user) => ({ name: user.name }));
201
+ const feed = db.posts((post) => ({
202
202
  title: post.title,
203
203
  author: post.author(userCard),
204
204
  }));
@@ -207,14 +207,14 @@ const feed = database.posts((post) => ({
207
207
  `.shape()` stores a synchronous callback and evaluates it on each application. A
208
208
  projection belongs to its defining table, contains at least one selected field
209
209
  and has no `$...` controls. Apply options at use sites, for example
210
- `database.users(userCard, { limit: 20 })`. It can be defined on an offline
211
- schema and used on its connected or transaction-bound tables. To-one selections
212
- are typed as an object or `null`.
210
+ `db.users(userCard, { limit: 20 })`. It can be defined on an offline schema and
211
+ used on its connected or transaction-bound tables. To-one selections are typed
212
+ as an object or `null`.
213
213
 
214
214
  Relations offer `count`, `exists`, `sum`, `average`, `minimum` and `maximum`:
215
215
 
216
216
  ```ts
217
- const totals = database.users(({ name, posts }) => ({
217
+ const totals = db.users(({ name, posts }) => ({
218
218
  name,
219
219
  totalViews: posts.sum.views,
220
220
  latestPost: posts.maximum.createdAt,
@@ -238,7 +238,7 @@ returns `false` for empty inputs.
238
238
  ## Enum mappings
239
239
 
240
240
  ```ts
241
- const labels = database.posts((post) => ({
241
+ const labels = db.posts((post) => ({
242
242
  title: post.title,
243
243
  status: post.state.match({ draft: "Draft", published: "Published" }),
244
244
  visibleViews: post.state.match({ draft: 0n, published: post.views }),
@@ -253,31 +253,32 @@ CTEs.
253
253
  ## Write callbacks
254
254
 
255
255
  ```ts
256
- const updated = await database.posts
256
+ const updated = await db.posts
257
257
  .byId(42)
258
258
  .update((post) => ({ views: post.views.plus(1n) }))
259
- .returning((post) => ({ id: post.id, views: post.views }));
259
+ .returning("id", "views");
260
260
 
261
- const userCard = database.users.shape(({ id, name }) => ({ id, name }));
262
- await database.users.by
261
+ const userCard = db.users.shape(({ id, name }) => ({ id, name }));
262
+ await db.users.by
263
263
  .email("ada@example.com")
264
264
  .update({ name: "Ada Lovelace" })
265
265
  .returning(userCard);
266
266
 
267
- await database.users
267
+ await db.users
268
268
  .insert({ name: "Ada Lovelace", email: "ada@example.com" })
269
269
  .onConflict("email")
270
270
  .doUpdate((user, excluded) => ({ email: user.email, name: excluded.name }));
271
271
 
272
- await database.posts.update({ state: "draft" }).all(); // whole table, spelled out
272
+ await db.posts.update({ state: "draft" }).all(); // whole table, spelled out
273
273
  ```
274
274
 
275
275
  `byId()` and `.by.<key>()` lookups update and delete directly, in one statement.
276
- `returning()` accepts a callback or a row-local reusable projection of the same
277
- table. UPDATE, WHERE and RETURNING callbacks receive the row directly, including
278
- nested-insert RETURNING. Upserts receive the existing row first and the proposed
279
- `excluded` row second. `.doUpdate("name")` copies a field from `excluded`. An
280
- UPDATE or DELETE without `where()` is refused unless `.all()` confirms it.
276
+ `returning()` accepts column names, a callback or a row-local reusable
277
+ projection of the same table. UPDATE, WHERE and RETURNING callbacks receive the
278
+ row directly, including nested-insert RETURNING. Upserts receive the existing
279
+ row first and the proposed `excluded` row second. `.doUpdate("name")` copies a
280
+ field from `excluded`. An UPDATE or DELETE without `where()` is refused unless
281
+ `.all()` confirms it.
281
282
 
282
283
  ## Capabilities
283
284
 
@@ -297,7 +298,7 @@ UPDATE or DELETE without `where()` is refused unless `.all()` confirms it.
297
298
  `exists` / `inspect`, keyset pagination in both directions and `pages()` async
298
299
  iteration; `count()` and `exists()` on any table or filtered source.
299
300
  - Transactions, nested savepoints, isolation options and row locks.
300
- - `Transaction<typeof database>` for schema-specific transaction helpers.
301
+ - `Transaction<typeof db>` for schema-specific transaction helpers.
301
302
  - `$scope()` filters for reads, updates and deletes, including related tables,
302
303
  and checks every row a scoped insert, upsert or update writes, like row-level
303
304
  security's `WITH CHECK` (`SYMMETRIA_OUT_OF_SCOPE`); reused and prepared
@@ -368,7 +369,7 @@ Official drivers ship with `symmetria` and are maintained and released together:
368
369
  import { createDatabase } from "symmetria";
369
370
  import { postgres } from "symmetria/pg";
370
371
 
371
- const database = createDatabase({
372
+ const db = createDatabase({
372
373
  schema: appSchema,
373
374
  driver: postgres({ url: process.env.DATABASE_URL!, max: 10 }),
374
375
  });
@@ -1,4 +1,4 @@
1
- import { _ as not, b as or, l as and } from "./core-Bu8-BTNf.js";
1
+ import { _ as not, b as or, l as and } from "./core-kaO0qvAO.js";
2
2
  import { createAdapterFactory } from "better-auth/adapters";
3
3
  //#region src/entries/better-auth.ts
4
4
  const escapeLike = (value) => String(value).replace(/[\\%_]/g, (character) => `\\${character}`);
@@ -63,14 +63,14 @@ var QueryError = class extends Error {
63
63
  if (cause && typeof cause === "object") {
64
64
  for (const [key, value] of Object.entries(cause)) if (!RESERVED.has(key)) this[key] = value;
65
65
  }
66
- Object.assign(this, fields);
66
+ Object.assign(this, { column: void 0 }, fields);
67
67
  }
68
68
  };
69
69
  /** SQLSTATE 23505: a unique or primary key already holds the value. */
70
70
  var UniqueViolation = class extends QueryError {
71
71
  name = "UniqueViolation";
72
72
  };
73
- /** SQLSTATE 23503: the referenced row is missing, or a referencing row still exists. */
73
+ /** SQLSTATE 23503, or 23001 from PostgreSQL 18 for a RESTRICT key: the referenced row is missing, or a referencing row still exists. */
74
74
  var ForeignKeyViolation = class extends QueryError {
75
75
  name = "ForeignKeyViolation";
76
76
  };
@@ -167,6 +167,7 @@ const isConnectionError = (error) => {
167
167
  const KINDS = {
168
168
  "23505": "unique",
169
169
  "23503": "foreign-key",
170
+ "23001": "foreign-key",
170
171
  "23502": "not-null",
171
172
  "23514": "check",
172
173
  "23P01": "exclusion",
@@ -242,4 +243,4 @@ const createDatabase = ({ schema: model, driver }) => {
242
243
  //#endregion
243
244
  export { UniqueViolation as C, TooManyRowsError as S, NotNullViolation as _, isRetryableTransactionError as a, SerializationFailure as b, scopeViolationText as c, ConnectionError as d, DeadlockDetected as f, NotFoundError as g, ForeignKeyViolation as h, isConnectionError as i, sqlState as l, ExclusionViolation as m, createDatabase as n, queryError as o, DuplicateConflictKeyError as p, databaseError as r, scopeViolation as s, SCHEMA_BIND as t, CheckViolation as u, OutOfScopeError as v, SymmetriaError as x, QueryError as y };
244
245
 
245
- //# sourceMappingURL=binding-BiJH76XX.js.map
246
+ //# sourceMappingURL=binding-jM09pXvJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-jM09pXvJ.js","names":[],"sources":["../src/errors.ts","../src/driver/errors.ts","../src/schema/binding.ts"],"sourcesContent":["/**\n * Error classes: Symmetria's own failures carry a `code`, and database\n * failures from the built-in adapters carry what PostgreSQL reported, so both\n * can be told apart with `instanceof`.\n */\nimport type { DatabaseErrorKind } from \"./driver/errors\";\n\n/** A failure Symmetria itself detected; `code` names it for `switch` and logs. */\nexport class SymmetriaError extends Error {\n override name = \"SymmetriaError\";\n readonly code: string;\n\n constructor(message: string, code: string, options?: ErrorOptions) {\n super(message, options);\n this.code = code;\n }\n}\n\n/** `one()`, `get()` or a nested `connect` found no row. */\nexport class NotFoundError extends SymmetriaError {\n override name = \"NotFoundError\";\n readonly table: string;\n\n constructor(message: string, table: string) {\n super(message, \"SYMMETRIA_RECORD_NOT_FOUND\");\n this.table = table;\n }\n}\n\n/** `one()` or `maybeOne()` found more than one row. */\nexport class TooManyRowsError extends SymmetriaError {\n override name = \"TooManyRowsError\";\n readonly table: string;\n\n constructor(message: string, table: string) {\n super(message, \"SYMMETRIA_TOO_MANY_ROWS\");\n this.table = table;\n }\n}\n\n/** A write through a `$scope()` database would leave a row outside the scope. */\nexport class OutOfScopeError extends SymmetriaError {\n override name = \"OutOfScopeError\";\n readonly table: string;\n\n constructor(message: string, table: string, cause: unknown) {\n super(message, \"SYMMETRIA_OUT_OF_SCOPE\", { cause });\n this.table = table;\n }\n}\n\n/** Two rows of one upsert share a conflict key. */\nexport class DuplicateConflictKeyError extends SymmetriaError {\n override name = \"DuplicateConflictKeyError\";\n readonly table: string;\n\n constructor(message: string, table: string) {\n super(message, \"SYMMETRIA_DUPLICATE_CONFLICT_KEY\");\n this.table = table;\n }\n}\n\n/** What `QueryError` takes from the driver error it wraps. */\nexport type QueryErrorFields = {\n readonly kind: DatabaseErrorKind;\n readonly sqlState: string;\n readonly table?: string;\n readonly column?: string;\n readonly constraint?: string;\n readonly detail?: string;\n};\n\nconst RESERVED = new Set([\"name\", \"message\", \"stack\", \"cause\"]);\n\n/**\n * A statement PostgreSQL rejected, or a connection that failed, as the\n * built-in adapters throw it. The driver's own error is the `cause`, and its\n * fields (`code`, `errno`, `hint`, `severity`, …) are copied, so code that\n * read them from the driver error keeps working.\n */\nexport class QueryError extends Error {\n override name = \"QueryError\";\n /** What was violated; `\"other\"` for every SQLSTATE without a class of its own. */\n declare readonly kind: DatabaseErrorKind;\n /** The five-character SQLSTATE, such as `23505`. */\n declare readonly sqlState: string;\n declare readonly table?: string;\n declare readonly column?: string;\n declare readonly constraint?: string;\n /** PostgreSQL's DETAIL, such as `Key (email)=(ada@example.com) already exists.` */\n declare readonly detail?: string;\n\n constructor(message: string, fields: QueryErrorFields, cause: unknown) {\n super(message, { cause });\n\n if (cause && typeof cause === \"object\") {\n for (const [key, value] of Object.entries(cause)) {\n if (!RESERVED.has(key)) {\n (this as Record<string, unknown>)[key] = value;\n }\n }\n }\n\n // JavaScriptCore gives every Error a `column` of its own: where in the\n // source it was created. Unless PostgreSQL named a column, there is none.\n Object.assign(this, { column: undefined }, fields);\n }\n}\n\n/** SQLSTATE 23505: a unique or primary key already holds the value. */\nexport class UniqueViolation extends QueryError {\n override name = \"UniqueViolation\";\n}\n\n/** SQLSTATE 23503, or 23001 from PostgreSQL 18 for a RESTRICT key: the referenced row is missing, or a referencing row still exists. */\nexport class ForeignKeyViolation extends QueryError {\n override name = \"ForeignKeyViolation\";\n}\n\n/** SQLSTATE 23502: NULL in a NOT NULL column. */\nexport class NotNullViolation extends QueryError {\n override name = \"NotNullViolation\";\n}\n\n/** SQLSTATE 23514: a CHECK constraint failed. */\nexport class CheckViolation extends QueryError {\n override name = \"CheckViolation\";\n}\n\n/** SQLSTATE 23P01: an exclusion constraint failed. */\nexport class ExclusionViolation extends QueryError {\n override name = \"ExclusionViolation\";\n}\n\n/** SQLSTATE 40001: a concurrent transaction conflicted; `retries` re-runs it. */\nexport class SerializationFailure extends QueryError {\n override name = \"SerializationFailure\";\n}\n\n/** SQLSTATE 40P01: PostgreSQL ended the transaction to break a deadlock. */\nexport class DeadlockDetected extends QueryError {\n override name = \"DeadlockDetected\";\n}\n\n/** The connection was lost or could not be opened. */\nexport class ConnectionError extends QueryError {\n override name = \"ConnectionError\";\n}\n","/**\n * PostgreSQL error inspection shared by the adapters: SQLSTATE lookup, the\n * conflict classes a transaction may retry and failed `$scope()` write checks.\n */\n\nimport {\n CheckViolation,\n ConnectionError,\n DeadlockDetected,\n ExclusionViolation,\n ForeignKeyViolation,\n NotNullViolation,\n OutOfScopeError,\n QueryError,\n SerializationFailure,\n UniqueViolation,\n} from \"../errors\";\n\n/** The five-character SQLSTATE of a server error (`code` on pg, `errno` on Bun). */\nexport const sqlState = (error: unknown): string | undefined => {\n if (!error || typeof error !== \"object\") {\n return undefined;\n }\n\n const value = error as { code?: unknown; errno?: unknown };\n\n return [value.code, value.errno].find(\n (code): code is string =>\n typeof code === \"string\" && /^[0-9A-Z]{5}$/.test(code),\n );\n};\n\n/**\n * The text a failed `$scope()` write check casts to boolean (see the\n * compiler's scope checks), so PostgreSQL aborts the statement with 22P02 and\n * an error that names the check: the statement's own rows (`insert`, `update`)\n * or the existing row of an upsert conflict (`conflict`), and the table.\n */\nexport const scopeViolationText = (\n check: \"insert\" | \"update\" | \"conflict\",\n table: string,\n): string => `SYMMETRIA_OUT_OF_SCOPE:${check}:${encodeURIComponent(table)}:`;\n\n/** The text in PostgreSQL's message, whose quotes depend on `lc_messages`. */\nconst SCOPE_VIOLATION =\n /SYMMETRIA_OUT_OF_SCOPE:(insert|update|conflict):([^:]*):\\d+/;\n\n/**\n * PostgreSQL's error for a failed scope check as `SYMMETRIA_OUT_OF_SCOPE`,\n * naming the table, with the driver error as its cause; other errors pass\n * through. Writes and transaction scopes both apply it, so a transaction that\n * a caught violation aborted reports the same error.\n */\nexport const scopeViolation = (error: unknown): unknown => {\n const failed =\n sqlState(error) === \"22P02\"\n ? SCOPE_VIOLATION.exec(String((error as { message?: unknown }).message))\n : null;\n\n if (!failed) {\n return error;\n }\n\n const table = decodeURIComponent(failed[2]!);\n\n return new OutOfScopeError(\n failed[1] === \"conflict\"\n ? `symmetria: upsert on \"${table}\" conflicted with a row outside the database scope`\n : `symmetria: ${failed[1]} on \"${table}\" would write a row outside the database scope`,\n table,\n error,\n );\n};\n\n/** serialization_failure and deadlock_detected: the transaction can be re-run from the start. */\nexport const isRetryableTransactionError = (error: unknown): boolean => {\n const state = sqlState(error);\n\n return state === \"40001\" || state === \"40P01\";\n};\n\n/** Connection exceptions (class 08) and the shutdowns that end a session (57P01–57P05). */\nconst connectionState = (state: string): boolean =>\n state.startsWith(\"08\") || /^57P0[1-5]$/.test(state);\n\n/** Socket and pool failures, which carry no SQLSTATE. */\nconst NODE_POSTGRES_CONNECTION =\n /^(Connection terminated|Client has encountered a connection error|Client was closed|timeout exceeded when trying to connect)/;\nconst SOCKET_CODES = new Set([\n \"ECONNREFUSED\",\n \"ECONNRESET\",\n \"ECONNABORTED\",\n \"EPIPE\",\n \"ETIMEDOUT\",\n \"EHOSTUNREACH\",\n \"ENETUNREACH\",\n \"ENOTFOUND\",\n \"EAI_AGAIN\",\n]);\n\n/**\n * Whether the connection itself failed, rather than a statement: the server\n * ended the session (class 08, 57P01–57P05), a socket error, or a client-side\n * connection loss (`Connection terminated unexpectedly` on node-postgres,\n * `ERR_POSTGRES_CONNECTION_CLOSED` and similar on Bun).\n */\nexport const isConnectionError = (error: unknown): boolean => {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const state = sqlState(error);\n\n if (state) {\n return connectionState(state);\n }\n\n const { code, message } = error as { code?: unknown; message?: unknown };\n\n return (\n (typeof code === \"string\" &&\n (SOCKET_CODES.has(code) ||\n /^ERR_POSTGRES_(CONNECTION|IDLE|LIFETIME|TLS)_/.test(code))) ||\n (typeof message === \"string\" && NODE_POSTGRES_CONNECTION.test(message))\n );\n};\n\n/** What a failed statement violated, by SQLSTATE class, or `connection` when the connection was lost. */\nexport type DatabaseErrorKind =\n | \"unique\"\n | \"foreign-key\"\n | \"not-null\"\n | \"check\"\n | \"exclusion\"\n | \"serialization\"\n | \"deadlock\"\n | \"connection\"\n | \"other\";\n\n/** A server error described the same way for node-postgres and Bun.SQL. */\nexport type DatabaseError = {\n readonly kind: DatabaseErrorKind;\n readonly sqlState: string;\n readonly message: string;\n readonly table?: string;\n readonly column?: string;\n readonly constraint?: string;\n /** PostgreSQL's DETAIL, such as `Key (email)=(ada@example.com) already exists.` */\n readonly detail?: string;\n};\n\nconst KINDS: Record<string, DatabaseErrorKind> = {\n \"23505\": \"unique\",\n \"23503\": \"foreign-key\",\n // PostgreSQL 18 reports a RESTRICT foreign key as restrict_violation.\n \"23001\": \"foreign-key\",\n \"23502\": \"not-null\",\n \"23514\": \"check\",\n \"23P01\": \"exclusion\",\n \"40001\": \"serialization\",\n \"40P01\": \"deadlock\",\n};\n\n/** Failures to open a connection, as opposed to losing one. */\nconst UNREACHABLE =\n /^(ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|ENOTFOUND|EAI_AGAIN|ERR_POSTGRES_CONNECTION_(REFUSED|TIMEOUT)|ERR_POSTGRES_TLS_.+)$/;\n\n/** 08001 (unable to connect) or 08006 (connection_failure) for a connection error without a SQLSTATE. */\nconst connectionFailureState = (error: unknown): string | undefined => {\n if (!isConnectionError(error)) {\n return undefined;\n }\n\n const { code, message } = error as { code?: unknown; message?: unknown };\n\n return UNREACHABLE.test(String(code)) ||\n /^timeout exceeded when trying to connect/.test(String(message))\n ? \"08001\"\n : \"08006\";\n};\n\n/**\n * The server error behind a failed query, normalized across both drivers, or\n * undefined for anything else (symmetria errors, programming errors):\n * `if (databaseError(error)?.kind === \"unique\") …`. A lost or refused\n * connection is `kind: \"connection\"` on both drivers; without a server\n * SQLSTATE it reports 08006 (connection_failure) or 08001 (unable to connect).\n */\nexport const databaseError = (error: unknown): DatabaseError | undefined => {\n const state = sqlState(error) ?? connectionFailureState(error);\n\n if (!state) {\n return undefined;\n }\n\n const fields = error as Record<string, unknown>;\n const text = (name: string): string | undefined =>\n typeof fields[name] === \"string\" && fields[name] !== \"\"\n ? (fields[name] as string)\n : undefined;\n const message = error instanceof Error ? error.message : String(error);\n // node-postgres omits the column of a NOT NULL violation; its message names it.\n const column =\n text(\"column\") ?? /null value in column \"([^\"]+)\"/.exec(message)?.[1];\n const table = text(\"table\");\n const constraint = text(\"constraint\");\n const detail = text(\"detail\");\n\n return Object.freeze({\n kind: KINDS[state] ?? (connectionState(state) ? \"connection\" : \"other\"),\n sqlState: state,\n message,\n ...(table ? { table } : {}),\n ...(column ? { column } : {}),\n ...(constraint ? { constraint } : {}),\n ...(detail ? { detail } : {}),\n });\n};\n\nconst CLASSES: Partial<Record<DatabaseErrorKind, typeof QueryError>> = {\n unique: UniqueViolation,\n \"foreign-key\": ForeignKeyViolation,\n \"not-null\": NotNullViolation,\n check: CheckViolation,\n exclusion: ExclusionViolation,\n serialization: SerializationFailure,\n deadlock: DeadlockDetected,\n connection: ConnectionError,\n};\n\n/**\n * A driver's database error as its `QueryError` class, with the driver error\n * as the cause; anything that did not come from the database, and an error\n * that is wrapped already, passes through unchanged.\n */\nexport const queryError = (error: unknown): unknown => {\n if (error instanceof QueryError) {\n return error;\n }\n\n const described = databaseError(error);\n\n if (!described) {\n return error;\n }\n\n const { message, ...fields } = described;\n\n return new (CLASSES[fields.kind] ?? QueryError)(message, fields, error);\n};\n","import type { Driver } from \"../query/plan/types\";\n\n/** Rebind compiled schema metadata without evaluating declaration callbacks again. */\nexport const SCHEMA_BIND = Symbol(\"symmetria.schema.bind\");\nexport type BindableSchema = {\n readonly [SCHEMA_BIND]: (driver: Driver) => unknown;\n};\n\nexport type DatabaseOptions<Model extends BindableSchema> = {\n readonly schema: Model;\n readonly driver: Driver;\n};\n\n/** Bind a reusable schema to a driver, retaining its inferred query API and scopes. */\nexport const createDatabase = <Model extends BindableSchema>({\n schema: model,\n driver,\n}: DatabaseOptions<Model>): ReturnType<Model[typeof SCHEMA_BIND]> => {\n if (!model || typeof model[SCHEMA_BIND] !== \"function\") {\n throw new Error(\n \"symmetria: createDatabase() expects a schema() declaration\",\n );\n }\n\n return model[SCHEMA_BIND](driver) as ReturnType<Model[typeof SCHEMA_BIND]>;\n};\n"],"mappings":";;AAQA,IAAa,iBAAb,cAAoC,MAAM;CACxC,OAAgB;CAChB;CAEA,YAAY,SAAiB,MAAc,SAAwB;EACjE,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,gBAAb,cAAmC,eAAe;CAChD,OAAgB;CAChB;CAEA,YAAY,SAAiB,OA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AY;AACd;;;;;;AAOA,MAAa,cAAc,UAA4B;CACrD,IAAI,iBAAiB,YACnB,OAAO;CAGT,MAAM,YAAY,cAAc,KAAK;CAErC,IAAI,CAAC,WACH,OAAO;CAGT,MAAM,EAAE,SAAS,GAAG,WAAW;CAE/B,OAAO,KAAK,QAAQ,OAAO,SAAS,YAAY,SAAS,QAAQ,KAAK;AACxE;;;;ACtPA,MAAa,cAAc,OAAO,uBAAuB;;AAWzD,MAAa,kBAAgD,EAC3D,QAAQ,OACR,aACmE;CACnE,IAAI,CAAC,SAAS,OAAO,MAAM,iBAAiB,YAC1C,MAAM,IAAI,MACR,4DACF;CAGF,OAAO,MAAM,YAAY,CAAC,MAAM;AAClC"}
package/dist/bun.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as SessionDriver, dt as BindableSchema, l as TransactionDriver, nt as QueryProfiler, pt as SCHEMA_BIND, r as Driver } from "./types-Dki1Ej7A.js";
2
- import { t as PostgresDriver } from "./pool-x45tVc5q.js";
1
+ import { c as SessionDriver, dt as BindableSchema, l as TransactionDriver, nt as QueryProfiler, pt as SCHEMA_BIND, r as Driver } from "./types-C2s_w1LW.js";
2
+ import { t as PostgresDriver } from "./pool-XG_sgock.js";
3
3
  import { SQL } from "bun";
4
4
  //#region src/driver/bun.d.ts
5
5
  type PostgresOptions = Omit<SQL.PostgresOrMySQLOptions, "adapter" | "bigint"> & {
package/dist/bun.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as SCHEMA_BIND } from "./binding-BiJH76XX.js";
2
- import { n as postgresParameters, t as createPostgresDriver } from "./pool-CFas0E3j.js";
1
+ import { t as SCHEMA_BIND } from "./binding-jM09pXvJ.js";
2
+ import { n as postgresParameters, t as createPostgresDriver } from "./pool-C3RZQz3X.js";
3
3
  import { SQL } from "bun";
4
4
  //#region src/driver/bun.ts
5
5
  /**
@@ -64,7 +64,8 @@ const postgres = (connection) => {
64
64
  } finally {
65
65
  await cancellation?.close();
66
66
  }
67
- }
67
+ },
68
+ max: options.max ?? 10
68
69
  }, profiler);
69
70
  };
70
71
  //#endregion
package/dist/bun.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bun.js","names":[],"sources":["../src/driver/bun.ts"],"sourcesContent":["/**\n * `symmetria/bun`: PostgreSQL adapter built on Bun's SQL pool.\n */\nimport { SQL } from \"bun\";\nimport { createPostgresDriver, type PostgresDriver } from \"./pool\";\nimport { postgresParameters } from \"./parameters\";\nimport type { CompiledQuery, ExecutionResult } from \"../query/plan/types\";\nimport type { QueryProfiler } from \"../observability/profiling\";\n\nexport type PostgresOptions = Omit<\n SQL.PostgresOrMySQLOptions,\n \"adapter\" | \"bigint\"\n> & { readonly profiler?: QueryProfiler | undefined };\nexport type { PostgresDriver } from \"./pool\";\n\n/** Bun reports socket-level failures with ERR_POSTGRES_* codes; server errors carry SQLSTATE codes. */\nconst transportFailure = (error: Error): boolean => {\n const code: unknown = (error as { code?: unknown }).code;\n\n return typeof code === \"string\" && code.startsWith(\"ERR_\");\n};\n\nexport const postgres = (\n connection: string | PostgresOptions,\n): PostgresDriver => {\n const { profiler, ...options } =\n typeof connection === \"string\" ? { url: connection } : connection;\n const client = new SQL({ ...options, adapter: \"postgres\", bigint: true });\n let cancellation: SQL | undefined;\n\n const execute = async (\n connection: SQL,\n query: CompiledQuery,\n ): Promise<ExecutionResult> => {\n const result = await connection.unsafe<Record<string, unknown>[]>(\n query.sql,\n postgresParameters(query.parameters),\n );\n\n return {\n rows: Array.from(result),\n affectedRows: (result as { count?: number }).count ?? result.length,\n };\n };\n\n return createPostgresDriver(\n {\n execute: (query) => execute(client, query),\n connect: async () => {\n const reserved = await client.reserve();\n let released = false;\n\n return {\n execute: (query) => execute(reserved, query),\n release: (error) => {\n if (released) {\n return;\n }\n\n released = true;\n\n if (!error || transportFailure(error)) {\n reserved.release();\n\n return;\n }\n\n void reserved\n .unsafe(\"ROLLBACK\")\n .catch(() => {})\n .finally(() => reserved.release());\n },\n // Closing a reserved connection frees its pool slot for a fresh one.\n discard: async () => {\n if (!released) {\n released = true;\n await reserved.close().catch(() => {});\n }\n },\n };\n },\n cancel: async (pid) => {\n cancellation ??= new SQL({\n ...options,\n adapter: \"postgres\",\n bigint: true,\n max: 1,\n });\n\n await cancellation.unsafe(\"SELECT pg_cancel_backend($1)\", [pid]);\n },\n close: async () => {\n try {\n await client.close();\n } finally {\n await cancellation?.close();\n }\n },\n },\n profiler,\n );\n};\n"],"mappings":";;;;;;;;AAgBA,MAAM,oBAAoB,UAA0B;CAClD,MAAM,OAAiB,MAA6B;CAEpD,OAAO,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;AAC3D;AAEA,MAAa,YACX,eACmB;CACnB,MAAM,EAAE,UAAU,GAAG,YACnB,OAAO,eAAe,WAAW,EAAE,KAAK,WAAW,IAAI;CACzD,MAAM,SAAS,IAAI,IAAI;EAAE,GAAG;EAAS,SAAS;EAAY,QAAQ;CAAK,CAAC;CACxE,IAAI;CAEJ,MAAM,UAAU,OACd,YACA,UAC6B;EAC7B,MAAM,SAAS,MAAM,WAAW,OAC9B,MAAM,KACN,mBAAmB,MAAM,UAAU,CACrC;EAEA,OAAO;GACL,MAAM,MAAM,KAAK,MAAM;GACvB,cAAe,OAA8B,SAAS,OAAO;EAC/D;CACF;CAEA,OAAO,qBACL;EACE,UAAU,UAAU,QAAQ,QAAQ,KAAK;EACzC,SAAS,YAAY;GACnB,MAAM,WAAW,MAAM,OAAO,QAAQ;GACtC,IAAI,WAAW;GAEf,OAAO;IACL,UAAU,UAAU,QAAQ,UAAU,KAAK;IAC3C,UAAU,UAAU;KAClB,IAAI,UACF;KAGF,WAAW;KAEX,IAAI,CAAC,SAAS,iBAAiB,KAAK,GAAG;MACrC,SAAS,QAAQ;MAEjB;KACF;KAEA,SACG,OAAO,UAAU,CAAC,CAClB,YAAY,CAAC,CAAC,CAAC,CACf,cAAc,SAAS,QAAQ,CAAC;IACrC;IAEA,SAAS,YAAY;KACnB,IAAI,CAAC,UAAU;MACb,WAAW;MACX,MAAM,SAAS,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;KACvC;IACF;GACF;EACF;EACA,QAAQ,OAAO,QAAQ;GACrB,iBAAiB,IAAI,IAAI;IACvB,GAAG;IACH,SAAS;IACT,QAAQ;IACR,KAAK;GACP,CAAC;GAED,MAAM,aAAa,OAAO,gCAAgC,CAAC,GAAG,CAAC;EACjE;EACA,OAAO,YAAY;GACjB,IAAI;IACF,MAAM,OAAO,MAAM;GACrB,UAAU;IACR,MAAM,cAAc,MAAM;GAC5B;EACF;CACF,GACA,QACF;AACF"}
1
+ {"version":3,"file":"bun.js","names":[],"sources":["../src/driver/bun.ts"],"sourcesContent":["/**\n * `symmetria/bun`: PostgreSQL adapter built on Bun's SQL pool.\n */\nimport { SQL } from \"bun\";\nimport { createPostgresDriver, type PostgresDriver } from \"./pool\";\nimport { postgresParameters } from \"./parameters\";\nimport type { CompiledQuery, ExecutionResult } from \"../query/plan/types\";\nimport type { QueryProfiler } from \"../observability/profiling\";\n\nexport type PostgresOptions = Omit<\n SQL.PostgresOrMySQLOptions,\n \"adapter\" | \"bigint\"\n> & { readonly profiler?: QueryProfiler | undefined };\nexport type { PostgresDriver } from \"./pool\";\n\n/** Bun reports socket-level failures with ERR_POSTGRES_* codes; server errors carry SQLSTATE codes. */\nconst transportFailure = (error: Error): boolean => {\n const code: unknown = (error as { code?: unknown }).code;\n\n return typeof code === \"string\" && code.startsWith(\"ERR_\");\n};\n\nexport const postgres = (\n connection: string | PostgresOptions,\n): PostgresDriver => {\n const { profiler, ...options } =\n typeof connection === \"string\" ? { url: connection } : connection;\n const client = new SQL({ ...options, adapter: \"postgres\", bigint: true });\n let cancellation: SQL | undefined;\n\n const execute = async (\n connection: SQL,\n query: CompiledQuery,\n ): Promise<ExecutionResult> => {\n const result = await connection.unsafe<Record<string, unknown>[]>(\n query.sql,\n postgresParameters(query.parameters),\n );\n\n return {\n rows: Array.from(result),\n affectedRows: (result as { count?: number }).count ?? result.length,\n };\n };\n\n return createPostgresDriver(\n {\n execute: (query) => execute(client, query),\n connect: async () => {\n const reserved = await client.reserve();\n let released = false;\n\n return {\n execute: (query) => execute(reserved, query),\n release: (error) => {\n if (released) {\n return;\n }\n\n released = true;\n\n if (!error || transportFailure(error)) {\n reserved.release();\n\n return;\n }\n\n void reserved\n .unsafe(\"ROLLBACK\")\n .catch(() => {})\n .finally(() => reserved.release());\n },\n // Closing a reserved connection frees its pool slot for a fresh one.\n discard: async () => {\n if (!released) {\n released = true;\n await reserved.close().catch(() => {});\n }\n },\n };\n },\n cancel: async (pid) => {\n cancellation ??= new SQL({\n ...options,\n adapter: \"postgres\",\n bigint: true,\n max: 1,\n });\n\n await cancellation.unsafe(\"SELECT pg_cancel_backend($1)\", [pid]);\n },\n close: async () => {\n try {\n await client.close();\n } finally {\n await cancellation?.close();\n }\n },\n // Bun.SQL opens ten connections unless told otherwise.\n max: options.max ?? 10,\n },\n profiler,\n );\n};\n"],"mappings":";;;;;;;;AAgBA,MAAM,oBAAoB,UAA0B;CAClD,MAAM,OAAiB,MAA6B;CAEpD,OAAO,OAAO,SAAS,YAAY,KAAK,WAAW,MAAM;AAC3D;AAEA,MAAa,YACX,eACmB;CACnB,MAAM,EAAE,UAAU,GAAG,YACnB,OAAO,eAAe,WAAW,EAAE,KAAK,WAAW,IAAI;CACzD,MAAM,SAAS,IAAI,IAAI;EAAE,GAAG;EAAS,SAAS;EAAY,QAAQ;CAAK,CAAC;CACxE,IAAI;CAEJ,MAAM,UAAU,OACd,YACA,UAC6B;EAC7B,MAAM,SAAS,MAAM,WAAW,OAC9B,MAAM,KACN,mBAAmB,MAAM,UAAU,CACrC;EAEA,OAAO;GACL,MAAM,MAAM,KAAK,MAAM;GACvB,cAAe,OAA8B,SAAS,OAAO;EAC/D;CACF;CAEA,OAAO,qBACL;EACE,UAAU,UAAU,QAAQ,QAAQ,KAAK;EACzC,SAAS,YAAY;GACnB,MAAM,WAAW,MAAM,OAAO,QAAQ;GACtC,IAAI,WAAW;GAEf,OAAO;IACL,UAAU,UAAU,QAAQ,UAAU,KAAK;IAC3C,UAAU,UAAU;KAClB,IAAI,UACF;KAGF,WAAW;KAEX,IAAI,CAAC,SAAS,iBAAiB,KAAK,GAAG;MACrC,SAAS,QAAQ;MAEjB;KACF;KAEA,SACG,OAAO,UAAU,CAAC,CAClB,YAAY,CAAC,CAAC,CAAC,CACf,cAAc,SAAS,QAAQ,CAAC;IACrC;IAEA,SAAS,YAAY;KACnB,IAAI,CAAC,UAAU;MACb,WAAW;MACX,MAAM,SAAS,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;KACvC;IACF;GACF;EACF;EACA,QAAQ,OAAO,QAAQ;GACrB,iBAAiB,IAAI,IAAI;IACvB,GAAG;IACH,SAAS;IACT,QAAQ;IACR,KAAK;GACP,CAAC;GAED,MAAM,aAAa,OAAO,gCAAgC,CAAC,GAAG,CAAC;EACjE;EACA,OAAO,YAAY;GACjB,IAAI;IACF,MAAM,OAAO,MAAM;GACrB,UAAU;IACR,MAAM,cAAc,MAAM;GAC5B;EACF;EAEA,KAAK,QAAQ,OAAO;CACtB,GACA,QACF;AACF"}
package/dist/cohere.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { K as EmbeddingModel, cn as SelectedColumn, q as MeaningSearch } from "./types-Dki1Ej7A.js";
1
+ import { K as EmbeddingModel, cn as SelectedColumn, q as MeaningSearch } from "./types-C2s_w1LW.js";
2
2
  //#region src/entries/cohere.d.ts
3
3
  export type CohereOptions = {
4
4
  readonly apiKey?: string;
package/dist/cohere.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as embedder } from "./search-CwBcdihW.js";
1
+ import { r as embedder } from "./search-jZqgEILM.js";
2
2
  import { i as postJson, r as inBatches, t as apiKey } from "./http-o1fpnTNy.js";
3
3
  //#region src/entries/cohere.ts
4
4
  /**