viborm 1.3.1 → 1.3.3
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/{adapter-namespace-BpMbLKpL.mjs → adapter-namespace-CWLEmon2.mjs} +2 -2
- package/dist/{adapter-namespace-BpMbLKpL.mjs.map → adapter-namespace-CWLEmon2.mjs.map} +1 -1
- package/dist/adapters.d.mts +1 -1
- package/dist/adapters.mjs +1 -1
- package/dist/{batch-refs-B4zn-FAu.mjs → batch-refs-DGJPz8-G.mjs} +2 -2
- package/dist/{batch-refs-B4zn-FAu.mjs.map → batch-refs-DGJPz8-G.mjs.map} +1 -1
- package/dist/{bind-parameter-capacity-qfEejeOX.mjs → bind-parameter-capacity-DiwRmZ1h.mjs} +2 -2
- package/dist/{bind-parameter-capacity-qfEejeOX.mjs.map → bind-parameter-capacity-DiwRmZ1h.mjs.map} +1 -1
- package/dist/{builder-s1ySUuMb.mjs → builder-D6Ug-zjM.mjs} +2 -2
- package/dist/{builder-s1ySUuMb.mjs.map → builder-D6Ug-zjM.mjs.map} +1 -1
- package/dist/bun-sql.d.mts +1 -1
- package/dist/bun-sql.mjs +1 -1
- package/dist/bun-sqlite.d.mts +1 -1
- package/dist/bun-sqlite.mjs +1 -1
- package/dist/cache/cloudflare-kv.d.mts +1 -1
- package/dist/cache/cloudflare-kv.mjs +1 -1
- package/dist/cache/memory.d.mts +1 -1
- package/dist/cache/memory.mjs +1 -1
- package/dist/cache.d.mts +1 -1
- package/dist/cache.mjs +1 -1
- package/dist/cache.mjs.map +1 -1
- package/dist/chain-B5IbqLGi.mjs +2 -0
- package/dist/chain-B5IbqLGi.mjs.map +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/client-BmcHzDBa.mjs +2 -0
- package/dist/client-BmcHzDBa.mjs.map +1 -0
- package/dist/{client-70MrTq1E.d.mts → client-DR0vYetv.d.mts} +2 -2
- package/dist/{client-BgJ7Faln.mjs → client-DjtWangN.mjs} +3 -3
- package/dist/{client-BgJ7Faln.mjs.map → client-DjtWangN.mjs.map} +1 -1
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{clock-C24RcpwO.mjs → clock-YTLtjLFS.mjs} +1 -1
- package/dist/{clock-C24RcpwO.mjs.map → clock-YTLtjLFS.mjs.map} +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/d1.d.mts +1 -1
- package/dist/d1.mjs +1 -1
- package/dist/datetime-physical-codec-qKxFtI3B.mjs +2 -0
- package/dist/datetime-physical-codec-qKxFtI3B.mjs.map +1 -0
- package/dist/{driver-vn-9CN0y.mjs → driver-BvP7eW0A.mjs} +2 -2
- package/dist/{driver-vn-9CN0y.mjs.map → driver-BvP7eW0A.mjs.map} +1 -1
- package/dist/{driver-B9fIori_.mjs → driver-Bzc0GCQ4.mjs} +2 -2
- package/dist/{driver-B9fIori_.mjs.map → driver-Bzc0GCQ4.mjs.map} +1 -1
- package/dist/driver.d.mts +1 -1
- package/dist/driver.mjs +1 -1
- package/dist/{error-mapping-C9WgitPi.mjs → error-mapping-6op318w6.mjs} +2 -2
- package/dist/error-mapping-6op318w6.mjs.map +1 -0
- package/dist/every-WUr3mlvg.mjs +2 -0
- package/dist/{every-CcpKWCVo.mjs.map → every-WUr3mlvg.mjs.map} +1 -1
- package/dist/{fs-estate-i8Zlr1OQ.mjs → fs-estate-azK36i9V.mjs} +2 -2
- package/dist/{fs-estate-i8Zlr1OQ.mjs.map → fs-estate-azK36i9V.mjs.map} +1 -1
- package/dist/{geo-area-codec-CbkmFArQ.mjs → geo-area-codec-BmMmWgU_.mjs} +2 -2
- package/dist/{geo-area-codec-CbkmFArQ.mjs.map → geo-area-codec-BmMmWgU_.mjs.map} +1 -1
- package/dist/{geo-point-codec-DyEHMdJg.mjs → geo-point-codec-D95uXgDF.mjs} +2 -2
- package/dist/{geo-point-codec-DyEHMdJg.mjs.map → geo-point-codec-D95uXgDF.mjs.map} +1 -1
- package/dist/{hydration-BsPZI4jE.mjs → hydration-BflrXEIQ.mjs} +2 -2
- package/dist/{hydration-BsPZI4jE.mjs.map → hydration-BflrXEIQ.mjs.map} +1 -1
- package/dist/{identifier-conversion-BneQiLxQ.mjs → identifier-conversion-Bs7A2GGU.mjs} +2 -2
- package/dist/{identifier-conversion-BneQiLxQ.mjs.map → identifier-conversion-Bs7A2GGU.mjs.map} +1 -1
- package/dist/identity-Bj2EN6Ss.mjs +2 -0
- package/dist/identity-Bj2EN6Ss.mjs.map +1 -0
- package/dist/{index-VsM29vYN.d.mts → index-B_jh2oaQ.d.mts} +38 -11
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/instrumentation.d.mts +1 -1
- package/dist/instrumentation.mjs +1 -1
- package/dist/{key-D9LtHxVK.mjs → key-B89Z4vxn.mjs} +2 -2
- package/dist/{key-D9LtHxVK.mjs.map → key-B89Z4vxn.mjs.map} +1 -1
- package/dist/{libsql-BlSBYwd_.mjs → libsql-C8dn4id0.mjs} +2 -2
- package/dist/{libsql-BlSBYwd_.mjs.map → libsql-C8dn4id0.mjs.map} +1 -1
- package/dist/libsql.d.mts +1 -1
- package/dist/libsql.mjs +1 -1
- package/dist/{memory-C0k-_S_n.mjs → memory-B7CcHS6I.mjs} +2 -2
- package/dist/{memory-C0k-_S_n.mjs.map → memory-B7CcHS6I.mjs.map} +1 -1
- package/dist/migrations/mysql.d.mts +4 -4
- package/dist/migrations/mysql.mjs +1 -1
- package/dist/migrations/postgres.d.mts +4 -4
- package/dist/migrations/postgres.mjs +1 -1
- package/dist/migrations/sqlite.d.mts +4 -4
- package/dist/migrations/sqlite.mjs +1 -1
- package/dist/migrations/storage/durable-object.mjs +1 -1
- package/dist/migrations/storage/fs.mjs +1 -1
- package/dist/migrations/storage/r2.mjs +1 -1
- package/dist/migrations/tenant.d.mts +2 -2
- package/dist/migrations/tenant.mjs +1 -1
- package/dist/migrations.d.mts +4 -4
- package/dist/migrations.mjs +1 -1
- package/dist/mysql-adapter-ABpgFB2N.mjs +2 -0
- package/dist/mysql-adapter-ABpgFB2N.mjs.map +1 -0
- package/dist/{mysql-DOLHwIM_.mjs → mysql-mUmhH9Cf.mjs} +2 -2
- package/dist/{mysql-DOLHwIM_.mjs.map → mysql-mUmhH9Cf.mjs.map} +1 -1
- package/dist/mysql2.d.mts +1 -1
- package/dist/mysql2.mjs +1 -1
- package/dist/neon-http.d.mts +1 -1
- package/dist/neon-http.mjs +1 -1
- package/dist/{object-store-ChYHlOMD.mjs → object-store-CZADAv4c.mjs} +2 -2
- package/dist/{object-store-ChYHlOMD.mjs.map → object-store-CZADAv4c.mjs.map} +1 -1
- package/dist/{object-store-D9mvOHP4.d.mts → object-store-Ds9NKRU6.d.mts} +3 -3
- package/dist/permissions.d.mts +2 -2
- package/dist/permissions.mjs +1 -1
- package/dist/permissions.mjs.map +1 -1
- package/dist/pg.d.mts +1 -1
- package/dist/pg.mjs +1 -1
- package/dist/pglite.d.mts +1 -1
- package/dist/pglite.mjs +1 -1
- package/dist/{physical-CAOaNM4R.mjs → physical-uJfmo4-Z.mjs} +2 -2
- package/dist/{physical-CAOaNM4R.mjs.map → physical-uJfmo4-Z.mjs.map} +1 -1
- package/dist/{pinned-session-BTplL3iZ.mjs → pinned-session-C79aDzOg.mjs} +2 -2
- package/dist/{pinned-session-BTplL3iZ.mjs.map → pinned-session-C79aDzOg.mjs.map} +1 -1
- package/dist/planetscale.d.mts +1 -1
- package/dist/planetscale.mjs +1 -1
- package/dist/{planner-C1NzLBge.d.mts → planner-DHZG9Vy7.d.mts} +1 -1
- package/dist/{postgres-DQVSTqVm.mjs → postgres-BACQ_wqF.mjs} +2 -2
- package/dist/{postgres-DQVSTqVm.mjs.map → postgres-BACQ_wqF.mjs.map} +1 -1
- package/dist/{postgres-adapter-CGthb5yh.mjs → postgres-adapter-Ci07rgh_.mjs} +2 -2
- package/dist/{postgres-adapter-CGthb5yh.mjs.map → postgres-adapter-Ci07rgh_.mjs.map} +1 -1
- package/dist/postgres-adapter-DaMvNOkx.mjs +2 -0
- package/dist/postgres-adapter-DaMvNOkx.mjs.map +1 -0
- package/dist/{postgres-result-KyBKBNJr.mjs → postgres-result-D403cLyA.mjs} +2 -2
- package/dist/{postgres-result-KyBKBNJr.mjs.map → postgres-result-D403cLyA.mjs.map} +1 -1
- package/dist/postgres.d.mts +1 -1
- package/dist/postgres.mjs +1 -1
- package/dist/{provider-limits-Da00ilvv.mjs → provider-limits-DSv2tYFr.mjs} +2 -2
- package/dist/{provider-limits-Da00ilvv.mjs.map → provider-limits-DSv2tYFr.mjs.map} +1 -1
- package/dist/result-shape-BKydBCsR.mjs +2 -0
- package/dist/result-shape-BKydBCsR.mjs.map +1 -0
- package/dist/rows-v1VuwOTa.mjs +2 -0
- package/dist/rows-v1VuwOTa.mjs.map +1 -0
- package/dist/{scalar-CpEwuJvn.mjs → scalar-Cm7nMFmO.mjs} +2 -2
- package/dist/{scalar-CpEwuJvn.mjs.map → scalar-Cm7nMFmO.mjs.map} +1 -1
- package/dist/schema/json.d.mts +1 -1
- package/dist/schema/json.mjs +1 -1
- package/dist/{schema-BnzGHn7k.mjs → schema-D3-ScVH6.mjs} +2 -2
- package/dist/{schema-BnzGHn7k.mjs.map → schema-D3-ScVH6.mjs.map} +1 -1
- package/dist/{schema-introspection-DZsdP6bi.mjs → schema-introspection-TdJrSaKd.mjs} +3 -3
- package/dist/{schema-introspection-DZsdP6bi.mjs.map → schema-introspection-TdJrSaKd.mjs.map} +1 -1
- package/dist/schema.d.mts +1 -1
- package/dist/schema.mjs +1 -1
- package/dist/{select-assembly-CkGe2ABs.mjs → select-assembly-uZfvbYjz.mjs} +2 -2
- package/dist/select-assembly-uZfvbYjz.mjs.map +1 -0
- package/dist/{settle-CS_k6Ztm.mjs → settle-etgtP1WM.mjs} +2 -2
- package/dist/{settle-CS_k6Ztm.mjs.map → settle-etgtP1WM.mjs.map} +1 -1
- package/dist/sha256-CEYo7k7R.mjs +2 -0
- package/dist/sha256-CEYo7k7R.mjs.map +1 -0
- package/dist/soft-delete.d.mts +1 -1
- package/dist/sql-BvHwL73I.mjs +2 -0
- package/dist/sql-BvHwL73I.mjs.map +1 -0
- package/dist/{sql-EsoN_7Et.d.mts → sql-Q_twK-wW.d.mts} +5 -0
- package/dist/{sql-statement-tokens-CFi1y3bK.mjs → sql-statement-tokens-BW7Q-rF-.mjs} +1 -1
- package/dist/{sql-statement-tokens-CFi1y3bK.mjs.map → sql-statement-tokens-BW7Q-rF-.mjs.map} +1 -1
- package/dist/sql.d.mts +1 -1
- package/dist/sql.mjs +1 -1
- package/dist/sqlite-adapter-DPc9T6Lh.mjs +2 -0
- package/dist/sqlite-adapter-DPc9T6Lh.mjs.map +1 -0
- package/dist/{sqlite-utils-D_cypcyW.mjs → sqlite-utils-BvSlEs5W.mjs} +2 -2
- package/dist/{sqlite-utils-D_cypcyW.mjs.map → sqlite-utils-BvSlEs5W.mjs.map} +1 -1
- package/dist/sqlite3.d.mts +1 -1
- package/dist/sqlite3.mjs +1 -1
- package/dist/{standard-sql-CoGqv-iX.mjs → standard-sql-CYdZ_KXH.mjs} +2 -2
- package/dist/standard-sql-CYdZ_KXH.mjs.map +1 -0
- package/dist/{to-many-C5RMZl05.mjs → to-many-Btc9X5Ga.mjs} +2 -2
- package/dist/{to-many-C5RMZl05.mjs.map → to-many-Btc9X5Ga.mjs.map} +1 -1
- package/dist/{utils-C3r4gO3Y.mjs → utils-Qr8ug94X.mjs} +2 -2
- package/dist/{utils-C3r4gO3Y.mjs.map → utils-Qr8ug94X.mjs.map} +1 -1
- package/dist/v-514RME2X.mjs +2 -0
- package/dist/v-514RME2X.mjs.map +1 -0
- package/dist/{validation-BQtO6srU.mjs → validation-CPnrLcjW.mjs} +2 -2
- package/dist/{validation-BQtO6srU.mjs.map → validation-CPnrLcjW.mjs.map} +1 -1
- package/dist/validation-gwZYm3Yn.mjs +2 -0
- package/dist/validation-gwZYm3Yn.mjs.map +1 -0
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/dist/{validator-CVSrhn0u.mjs → validator-CQOw7G3q.mjs} +2 -2
- package/dist/{validator-CVSrhn0u.mjs.map → validator-CQOw7G3q.mjs.map} +1 -1
- package/dist/version-0RVYpih5.mjs +2 -0
- package/dist/{version-C8QLCt1n.mjs.map → version-0RVYpih5.mjs.map} +1 -1
- package/package.json +15 -15
- package/dist/chain-7qiFSE8J.mjs +0 -2
- package/dist/chain-7qiFSE8J.mjs.map +0 -1
- package/dist/client-6YgGlXzN.mjs +0 -2
- package/dist/client-6YgGlXzN.mjs.map +0 -1
- package/dist/controls-KQ85SWfT.mjs +0 -2
- package/dist/controls-KQ85SWfT.mjs.map +0 -1
- package/dist/datetime-physical-codec-BEqQbIP_.mjs +0 -2
- package/dist/datetime-physical-codec-BEqQbIP_.mjs.map +0 -1
- package/dist/error-mapping-C9WgitPi.mjs.map +0 -1
- package/dist/every-CcpKWCVo.mjs +0 -2
- package/dist/identity-oQvIe7u8.mjs +0 -2
- package/dist/identity-oQvIe7u8.mjs.map +0 -1
- package/dist/mysql-adapter-C6c5govr.mjs +0 -2
- package/dist/mysql-adapter-C6c5govr.mjs.map +0 -1
- package/dist/postgres-adapter-CxEit2-v.mjs +0 -2
- package/dist/postgres-adapter-CxEit2-v.mjs.map +0 -1
- package/dist/result-shape-B6yWtnx_.mjs +0 -2
- package/dist/result-shape-B6yWtnx_.mjs.map +0 -1
- package/dist/select-assembly-CkGe2ABs.mjs.map +0 -1
- package/dist/sql-Bhxq9arK.mjs +0 -2
- package/dist/sql-Bhxq9arK.mjs.map +0 -1
- package/dist/sqlite-adapter-BXAJy3mI.mjs +0 -2
- package/dist/sqlite-adapter-BXAJy3mI.mjs.map +0 -1
- package/dist/standard-sql-CoGqv-iX.mjs.map +0 -1
- package/dist/v-DtLdBQYg.mjs +0 -2
- package/dist/v-DtLdBQYg.mjs.map +0 -1
- package/dist/validation-BamBwne9.mjs +0 -2
- package/dist/validation-BamBwne9.mjs.map +0 -1
- package/dist/version-C8QLCt1n.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-utils-
|
|
1
|
+
{"version":3,"file":"sqlite-utils-BvSlEs5W.mjs","names":[],"sources":["../src/drivers/shared/sqlite-utils.ts"],"sourcesContent":["/**\n * Shared SQLite Utilities\n *\n * Common result parser and parameter conversion for SQLite-based drivers.\n */\n\nimport { parseIntegerBoolean } from \"@adapters/shared/result-parsing\";\nimport type { DriverResultParser } from \"../driver\";\nimport { getExecutionTransactionPhases } from \"../execution-context\";\nimport type { QueryExecutionContext } from \"../types\";\nimport type { TransactionOptionSupport } from \"./transaction-options\";\nimport { runTransactionLifecycle } from \"./transactions\";\n\nexport type SQLiteBinaryValue = ArrayBuffer | ArrayBufferView;\n\nexport function isSQLiteBinaryValue(\n value: unknown\n): value is SQLiteBinaryValue {\n return value instanceof ArrayBuffer || ArrayBuffer.isView(value);\n}\n\nexport function sqliteBinaryToUint8Array(value: SQLiteBinaryValue): Uint8Array {\n if (value instanceof ArrayBuffer) {\n return new Uint8Array(value);\n }\n return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);\n}\n\n/**\n * Convert provider-neutral scalar values to SQLite values. Binary values stay\n * in their standard Web API form; each provider owns any narrower conversion.\n */\nexport function convertValueForSQLite(value: unknown): unknown {\n if (value instanceof Date) return value.toISOString();\n if (typeof value === \"boolean\") return value ? 1 : 0;\n if (value === undefined) return null;\n return value;\n}\n\nexport function convertValuesForSQLite(values: unknown[]): unknown[] {\n return values.map(convertValueForSQLite);\n}\n\n/**\n * Shared result parser for the SQLite drivers. It speaks about ROW VALUES only:\n * - Boolean integer parsing (0/1 -> false/true)\n * - `json` columns, which SQLite stores as TEXT\n *\n * It says nothing about a RESULT (Arnaud's D-35). A SQLite transport answers a\n * `count`/`exist` in the shape the engine's own projection asked for — the\n * engine aliases that column `_count` and reads `_count` back — so the meaning\n * of a count and an exists answer has one authority, the engine's decoder, and\n * this middleware has nothing to add at the result boundary. Recovering a count\n * from a provider that did NOT preserve the alias is a dialect fact, stated\n * once at the adapter seam by the provider that needs it (MySQL).\n */\nexport const sqliteResultParser: DriverResultParser = {\n parseField: parseSQLiteField,\n};\n\n/**\n * The shipped parser's own field hook. `sqliteResultParser` is one mutable\n * object every SQLite-family driver shares, so a driver that must recognise\n * the shipped parser compares against this definition, never against what the\n * shared object holds when its module loads. The shipped parser defines no\n * `parseRelation` or `parseResult`.\n */\nexport function parseSQLiteField(\n value: unknown,\n scalarType: string,\n next: (value: unknown, scalarType: string) => unknown\n): unknown {\n if (scalarType === \"boolean\") {\n const parsed = parseIntegerBoolean(value);\n if (parsed !== undefined) return next(parsed, scalarType);\n }\n // SQLite stores json as TEXT — decode here where we know the string is\n // serialized JSON (the default parser never sniffs json strings)\n if (scalarType === \"json\" && typeof value === \"string\") {\n return next(JSON.parse(value), scalarType);\n }\n return next(value, scalarType);\n}\n\n/** Raw INTEGER leaves retain exact values; only safe-range values become numbers. */\nexport function normalizeSQLiteRawRows<T>(rows: T[]): T[] {\n return rows.map((row) => {\n if (row === null || typeof row !== \"object\") return row;\n const normalized = { ...row };\n for (const key of Object.keys(normalized)) {\n const value: unknown = Reflect.get(normalized, key);\n if (\n typeof value === \"bigint\" &&\n value >= BigInt(Number.MIN_SAFE_INTEGER) &&\n value <= BigInt(Number.MAX_SAFE_INTEGER)\n )\n Reflect.set(normalized, key, Number(value));\n }\n return normalized;\n });\n}\n\n/**\n * SQLite has no isolation-level statement: one writer at a time on one\n * connection makes every transaction serializable already. `Serializable` is\n * therefore honored by construction, with no SQL to emit; the three weaker\n * levels are refused because pretending to relax isolation we cannot relax\n * would misreport what the transaction actually guarantees.\n */\nexport const LOCAL_SQLITE_TRANSACTION_SUPPORT: TransactionOptionSupport =\n Object.freeze({\n isolationLevel: \"serializable-only\",\n isolationLevelReason:\n \"SQLite serializes transactions on a single connection and has no statement to weaken isolation, so only Serializable can be honored truthfully\",\n timeout: true,\n maxWait: \"queue\",\n });\n\n/** One transaction on a local, synchronous, single-connection SQLite handle. */\nexport function runLocalSQLiteTransaction<\n Client extends {\n exec(sql: string): unknown;\n readonly inTransaction: boolean;\n },\n T,\n>(\n client: Client,\n fn: (tx: Client) => Promise<T>,\n context: QueryExecutionContext | undefined\n): Promise<T> {\n return runTransactionLifecycle({\n begin: () => client.exec(\"BEGIN IMMEDIATE\"),\n callback: () => fn(client),\n commit: () => client.exec(\"COMMIT\"),\n // A failed BEGIN never grants rollback ownership. After a failed COMMIT,\n // successful rollback restores this same database, including :memory:.\n rollback: () => {\n if (client.inTransaction) client.exec(\"ROLLBACK\");\n },\n phases: getExecutionTransactionPhases(context),\n });\n}\n"],"mappings":"iMAeA,SAAgB,oBACd,EAC4B,CAC5B,OAAO,aAAiB,aAAe,YAAY,OAAO,EAAM,CAGlE,SAAgB,yBAAyB,EAAsC,CAI7E,OAHI,aAAiB,YACZ,IAAI,WAAW,EAAM,CAEvB,IAAI,WAAW,EAAM,OAAQ,EAAM,WAAY,EAAM,WAAW,CAOzE,SAAgB,sBAAsB,EAAyB,CAI7D,OAHI,aAAiB,KAAa,EAAM,aAAa,CACjD,OAAO,GAAU,UAAkB,EAAQ,EAAI,EAC/C,IAAU,IAAA,GAAkB,KACzB,EAGT,SAAgB,uBAAuB,EAA8B,CACnE,OAAO,EAAO,IAAI,sBAAsB,CAgB1C,MAAa,EAAyC,CACpD,WAAY,iBACb,CASD,SAAgB,iBACd,EACA,EACA,EACS,CACT,GAAI,IAAe,UAAW,CAC5B,IAAM,EAAS,EAAoB,EAAM,CACzC,GAAI,IAAW,IAAA,GAAW,OAAO,EAAK,EAAQ,EAAW,CAO3D,OAFS,EADL,IAAe,QAAU,OAAO,GAAU,SAChC,KAAK,MAAM,EAAM,CAEnB,EAFqB,EAAW,CAM9C,SAAgB,uBAA0B,EAAgB,CACxD,OAAO,EAAK,IAAK,GAAQ,CACvB,GAAoB,OAAO,GAAQ,WAA/B,EAAyC,OAAO,EACpD,IAAM,EAAa,CAAE,GAAG,EAAK,CAC7B,IAAK,IAAM,KAAO,OAAO,KAAK,EAAW,CAAE,CACzC,IAAM,EAAiB,QAAQ,IAAI,EAAY,EAAI,CAEjD,OAAO,GAAU,UACjB,GAAS,OAAO,WAAwB,EACxC,GAAS,eAA+B,EAExC,QAAQ,IAAI,EAAY,EAAK,OAAO,EAAM,CAAC,CAE/C,OAAO,GACP,CAUJ,MAAa,EACX,OAAO,OAAO,CACZ,eAAgB,oBAChB,qBACE,iJACF,QAAS,GACT,QAAS,QACV,CAAC,CAGJ,SAAgB,0BAOd,EACA,EACA,EACY,CACZ,OAAO,EAAwB,CAC7B,UAAa,EAAO,KAAK,kBAAkB,CAC3C,aAAgB,EAAG,EAAO,CAC1B,WAAc,EAAO,KAAK,SAAS,CAGnC,aAAgB,CACV,EAAO,eAAe,EAAO,KAAK,WAAW,EAEnD,OAAQ,EAA8B,EAAQ,CAC/C,CAAC"}
|
package/dist/sqlite3.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Schema, At as DriverConfig, F as LinkedClientConfig, Ft as VibORMClient, Nn as QueryExecutionContext, Pn as QueryResult, Pt as NoExtraDriverConfigKeys, h as DriverResultParser, kn as TransactionOptionSupport, p as SqliteMigrationCapability, s as DatabaseAdapter, u as Driver } from "./index-
|
|
1
|
+
import { A as Schema, At as DriverConfig, F as LinkedClientConfig, Ft as VibORMClient, Nn as QueryExecutionContext, Pn as QueryResult, Pt as NoExtraDriverConfigKeys, h as DriverResultParser, kn as TransactionOptionSupport, p as SqliteMigrationCapability, s as DatabaseAdapter, u as Driver } from "./index-B_jh2oaQ.mjs";
|
|
2
2
|
import Database from "better-sqlite3";
|
|
3
3
|
|
|
4
4
|
//#region src/drivers/sqlite3/index.d.ts
|
package/dist/sqlite3.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./chunk-BuuaeEvq.mjs";import{i as t}from"./bind-parameter-capacity-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{i as t}from"./bind-parameter-capacity-DiwRmZ1h.mjs";import{r as n}from"./validation-gwZYm3Yn.mjs";import{a as r,i,n as a,r as o}from"./client-BmcHzDBa.mjs";import{c as s,n as c,r as l,t as u}from"./driver-Bzc0GCQ4.mjs";import{a as d,c as f,i as p,l as m,n as h,o as g,s as _,t as v}from"./sqlite-utils-BvSlEs5W.mjs";import{t as y}from"./sqlite-adapter-DPc9T6Lh.mjs";import{Buffer as b}from"node:buffer";import x from"better-sqlite3";const S=new WeakMap,C=x.prototype.prepare;function cachedStatement(e,t,n){if(e.prepare!==C)return e.prepare(t);let r=S.get(e);r||(r=[new Map,new Map],S.set(e,r));let i=r[n?0:1],a=i.get(t);return a===void 0?(a=e.prepare(t),i.size===100&&i.delete(i.keys().next().value)):i.delete(t),i.set(t,a),a}function convertValuesForSQLite3(e){return e.map(e=>{let t=h(e);if(b.isBuffer(t)||!p(t))return t;let n=f(t);return b.from(n.buffer,n.byteOffset,n.byteLength)})}const w={client:!0,dataDir:!0,options:!0};var T=class SQLite3Driver extends u{static canonicalExecuteEntry=SQLite3Driver.prototype._execute;static canonicalExecute=SQLite3Driver.prototype.execute;static canonicalRunStatement=SQLite3Driver.prototype.runStatement;static canonicalTypedStatement=SQLite3Driver.prototype.executeTypedStatement;static canonicalPositionalExecute=SQLite3Driver.prototype.executePositional;static canonicalNativePrepare=x.prototype.prepare;adapter=new y;maxBindParametersPerStatement=32766;result=m;sqliteMigrationCapability=c;serializeTransactions=!0;get numbersPlaceholders(){return!1}driverOptions;suppliedClient;canonicalAdapterParseResult=this.adapter.result.parseResult;canonicalAdapter=this.adapter;canonicalAdapterResult=this.adapter.result;canonicalAdapterParseField=this.adapter.result.parseField;canonicalAdapterParseRelation=this.adapter.result.parseRelation;constructor(e={}){if(super(`sqlite`,`sqlite3`),this.driverOptions=e,this.suppliedClient=e.client,this.suppliedClient){if(this.suppliedClient.pragma(`foreign_keys`,{simple:!0})!==1)throw new n(`A supplied SQLite database must enable PRAGMA foreign_keys = ON before wrapping.`,{meta:{driver:`sqlite3`}});this.client=this.suppliedClient,Object.defineProperty(this,`connectionQueue`,{value:l(this.suppliedClient)})}SQLite3Driver.isPositionalCandidate(this)&&r(this,(e,t)=>this.executePositional(e,t),SQLite3Driver.isPositionalCandidate)}async initClient(){if(this.suppliedClient!==void 0)return this.suppliedClient;let e=this.driverOptions.dataDir??`:memory:`,t=this.driverOptions.options??{},n=new x(e,t);return n.pragma(`foreign_keys = ON`),t.timeout===void 0&&n.pragma(`busy_timeout = 5000`),n}async closeClient(e){e!==this.suppliedClient&&e.close()}async execute(e,t,n,r){let i=convertValuesForSQLite3(n);return this.runStatement(e,t,i,r?.model!==`$raw`)}async executeRaw(e,t,n){let r=n?convertValuesForSQLite3(n):void 0;return this.runStatement(e,t,r,!1)}async executePositional(e,n){let r,a=await this.executeTypedStatement(e,n,async(e,n,i,a)=>{let s={provider:this.driverName,operation:a.operation??`execute`};if(!SQLite3Driver.isPositionalProducer(this,e)){let r=await this.execute(e,n,i,a);return t(r,s),{kind:`borrowed`,result:r}}let c=convertValuesForSQLite3(i),l=cachedStatement(e,n,!0);if(!l.reader){let e={rows:[],rowCount:l.run(...c).changes};return t(e,s),{kind:`borrowed`,result:e}}r=e,l.safeIntegers(!0);let u=l.raw().all(...c),d=l.columns().map(e=>e.name);return o(u,d,s),{kind:`positional`,rows:u,columns:d}});return a.kind===`positional`&&!(r&&SQLite3Driver.isPositionalProducer(this,r))?{kind:`borrowed`,result:i(a)}:a}static isPositionalProducer(e,t){return SQLite3Driver.isPositionalCandidate(e)&&e.client===t}static isPositionalCandidate(e){return e instanceof SQLite3Driver?e.driverOptions.options?.nativeBinding===void 0&&SQLite3Driver.hasCanonicalProducerSurface(e)&&e.executeTypedStatement===SQLite3Driver.canonicalTypedStatement&&e.executePositional===SQLite3Driver.canonicalPositionalExecute&&e.result.parseField===g&&e.result.parseRelation===void 0&&e.result.parseResult===void 0&&e.adapter===e.canonicalAdapter&&e.adapter.result===e.canonicalAdapterResult&&e.adapter.result.parseField===e.canonicalAdapterParseField&&e.adapter.result.parseRelation===e.canonicalAdapterParseRelation&&(e.client===void 0||e.client===null||SQLite3Driver.isPositionalClient(e.client)):!1}static isPositionalClient(e){return Object.getPrototypeOf(e)===x.prototype&&!Object.hasOwn(e,`prepare`)&&Object.getOwnPropertyDescriptor(x.prototype,`prepare`)?.value===SQLite3Driver.canonicalNativePrepare}runStatement(e,t,n,r){let i=r?cachedStatement(e,t,!1):e.prepare(t);if(i.reader){i.safeIntegers(!0);let e=n?i.all(...n):i.all();return{rows:r?e:d(e),rowCount:e.length}}return{rows:[],rowCount:(n?i.run(...n):i.run()).changes}}static hasCanonicalProducerSurface(e){return Object.getPrototypeOf(e)===SQLite3Driver.prototype&&e._execute===SQLite3Driver.canonicalExecuteEntry&&e.execute===SQLite3Driver.canonicalExecute&&e.runStatement===SQLite3Driver.canonicalRunStatement&&e.result===m&&e.adapter.result.parseResult===e.canonicalAdapterParseResult}transactionOptionSupport(){return v}async transaction(e,t,n){return _(e,t,n)}};function createClient(e){s(e,`sqlite3`,w,{databaseUrl:`pass the database file as dataDir`});let{client:t,dataDir:n,options:r}=e;return a(e,new T({client:t,dataDir:n,options:r}))}export{T as SQLite3Driver,createClient};
|
|
2
2
|
//# sourceMappingURL=sqlite3.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{n as e}from"./chunk-BuuaeEvq.mjs";import{o as t,t as n}from"./sql-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{o as t,t as n}from"./sql-BvHwL73I.mjs";const createIdentifierQuoter=e=>t=>e+(t.indexOf(e)===-1?t:t.replaceAll(e,e+e))+e,qualifiedPrefix=(e,t)=>`${e(t)}.`,renderQualifiedIdentifier=(e,t,n)=>t===void 0?e(n):qualifiedPrefix(e,t)+e(n),createQualifiedIdentifierRenderer=(e,t)=>{if(t===void 0)return e;let n=qualifiedPrefix(e,t);return t=>n+e(t)},createRawSql=()=>e=>t.raw(e),stringifyJson=e=>JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t),r=/^\d+$/,buildJsonPath=e=>{let t=`$`;for(let n of e)t+=r.test(n)?`[${n}]`:`.${JSON.stringify(n)}`;return t},createStandardLiterals=()=>({value:e=>t`${e}`,null:()=>t.raw(`NULL`),list:e=>e.length===0?t.raw(`()`):t`(${t.join(e,`, `)})`}),createComparisonOperators=()=>({eq:(e,n)=>t`${e} = ${n}`,neq:(e,n)=>t`${e} <> ${n}`,lt:(e,n)=>t`${e} < ${n}`,lte:(e,n)=>t`${e} <= ${n}`,gt:(e,n)=>t`${e} > ${n}`,gte:(e,n)=>t`${e} >= ${n}`}),createNullOperators=()=>({isNull:e=>t`${e} IS NULL`,isNotNull:e=>t`${e} IS NOT NULL`}),createRangeOperators=()=>({between:(e,n,r)=>t`${e} BETWEEN ${n} AND ${r}`,notBetween:(e,n,r)=>t`${e} NOT BETWEEN ${n} AND ${r}`}),createExistenceOperators=()=>({exists:e=>t`EXISTS (${e})`,notExists:e=>t`NOT EXISTS (${e})`}),createAggregateFunctions=e=>({count:e=>e?t`COUNT(${e})`:t.raw(`COUNT(*)`),countDistinct:e=>t`COUNT(DISTINCT ${e})`,sum:e=>t`SUM(${e})`,numberSum:n=>{let r=t`SUM(CASE WHEN ABS(${n}) >= 1e-288 THEN ${n} / 4294967296.0 / 4294967296.0 END)`,i=t`SUM(CASE WHEN ABS(${n}) < 1e-288 THEN ${n} END)`,a=t.raw(e??`1.7976931348623157e308`),o=t`CASE WHEN ${r} IS NULL THEN ${i} WHEN ABS(${r}) < 9.7453140114e288 THEN ${r} * 4294967296.0 * 4294967296.0 + COALESCE(${i}, 0) WHEN ${r} > 0 THEN ${a} ELSE -${a} END`;return{parts:[r,i],value:o,order:e?[o]:[o,r]}},avg:e=>t`AVG(${e})`,min:e=>t`MIN(${e})`,max:e=>t`MAX(${e})`});function decimalCoefficientPrecision(e){return e.startsWith(`-`)?e.length-1:e.length}function createDecimalSumOperandPrecision(e){return t=>{let n=decimalCoefficientPrecision(t);return n<=e?n:void 0}}const createDirectionOrderBy=()=>({asc:e=>t`${e} ASC`,desc:e=>t`${e} DESC`}),directionKeyword=e=>e===`desc`?t.raw(`DESC`):t.raw(`ASC`),createEmulatedNullsOrderBy=()=>({nullsFirst:(e,n)=>t`(${e} IS NULL) DESC, ${e} ${directionKeyword(n)}`,nullsLast:(e,n)=>t`(${e} IS NULL) ASC, ${e} ${directionKeyword(n)}`}),createStandardClauses=()=>({select:e=>t`SELECT ${e}`,selectDistinct:e=>t`SELECT DISTINCT ${e}`,from:e=>t`FROM ${e}`,where:e=>t`WHERE ${e}`,orderBy:e=>t`ORDER BY ${e}`,limit:e=>t`LIMIT ${e}`,offset:e=>t`OFFSET ${e}`,groupBy:e=>t`GROUP BY ${e}`,having:e=>t`HAVING ${e}`}),createNumericSetOperations=()=>({assign:(e,n)=>t`${e} = ${n}`,increment:(e,n)=>t`${e} = ${e} + ${n}`,decrement:(e,n)=>t`${e} = ${e} - ${n}`}),createRelationFilters=()=>({some:e=>t`EXISTS (${e})`,every:e=>t`NOT EXISTS (${e})`,none:e=>t`NOT EXISTS (${e})`,is:e=>t`EXISTS (${e})`,isNot:e=>t`NOT EXISTS (${e})`}),createMutationCommands=()=>({update:(e,n,r)=>r?t`UPDATE ${e} SET ${n} WHERE ${r}`:t`UPDATE ${e} SET ${n}`,delete:(e,n)=>n?t`DELETE FROM ${e} WHERE ${n}`:t`DELETE FROM ${e}`}),rowValues=e=>t`(${t.join(e,`, `)})`,unionTypedRows=e=>(n,r,i)=>t`(${t.join([n.head,...r.map(e=>t`SELECT ${t.join(e,`, `)}`)],` UNION ALL `)}) AS ${t.raw(e(i))}`,createSetOperations=(e,n=unionTypedRows(e))=>({union:(...e)=>t.join(e,` UNION `),unionAll:(...e)=>t.join(e,` UNION ALL `),intersect:(...e)=>t.join(e,` INTERSECT `),except:(e,n)=>t`${e} EXCEPT ${n}`,typedRows:n}),isQualifiedColumnNamed=(e,t,n)=>{if(e===void 0||!e.endsWith(t))return!1;let r=e.slice(0,-t.length-1);return e[r.length]===`.`&&r.length>=2&&r[0]===n&&r.at(-1)===n&&!r.slice(1,-1).replaceAll(n+n,``).includes(n)},createIdentifiers=(e,r,i=!1)=>{let a=createQualifiedIdentifierRenderer(e,r),o=e(``)[0];return{escape:n=>t.raw(e(n)),column:(n,r)=>{let i=n?`${e(n)}.${e(r)}`:e(r);return t.raw(i)},table:(n,r)=>{let i=a(n);return t.raw(r===void 0?i:`${i} AS ${e(r)}`)},aliased:(t,r)=>{let a=e(r);return i&&isQualifiedColumnNamed(n.leafText(t),a,o)?t:new n([``,` AS ${a}`],[t])}}},createSubqueries=e=>({scalar:e=>t`(${e})`,correlate:(n,r)=>t`(${n}) AS ${t.raw(e(r))}`,existsCheck:(e,n)=>t`SELECT 1 FROM ${e} WHERE ${n}`,isolated:e=>e}),createCteBuilders=(e,n)=>({with:r=>{let i=r.map(({name:r,query:i,inlined:a})=>a&&n?t`${t.raw(e(r))} AS ${n} (${i})`:t`${t.raw(e(r))} AS (${i})`);return t`WITH ${t.join(i,`, `)}`},recursive:(n,r,i,a=`all`)=>{let o=a===`all`?t.raw(`UNION ALL`):t.raw(`UNION`);return t`WITH RECURSIVE ${t.raw(e(n))} AS (
|
|
2
2
|
${r}
|
|
3
3
|
${o}
|
|
4
4
|
${i}
|
|
5
5
|
)`}}),createInsertStatement=e=>(n,r,i,a)=>{let o=r.map(n=>t.raw(e(n))),s=Array.isArray(i)?t`VALUES ${t.join(i.map(e=>t`(${t.join(e,`, `)})`),`, `)}`:i.select;return t`INSERT ${a?t`${a} `:t``}INTO ${n} (${t.join(o,`, `)}) ${s}`},createOnConflictBuilders=()=>({onConflict:(e,n,r)=>e?r?t`ON CONFLICT (${e}) WHERE ${r} DO ${n}`:t`ON CONFLICT (${e}) DO ${n}`:t`ON CONFLICT DO ${n}`,onConflictUpdate:(e,n)=>n?t`UPDATE SET ${e} WHERE ${n}`:t`UPDATE SET ${e}`,skipDuplicates:()=>({prefix:t``,suffix:t`ON CONFLICT DO NOTHING`})}),createMembershipOperators=()=>({in:(e,n)=>t`${e} IN ${n}`,notIn:(e,n)=>t`${e} NOT IN ${n}`}),createLogicalOperators=(e,n)=>({and:(...n)=>n.length===0?e():n.length===1?n[0]:t`(${t.join(n,` AND `)})`,or:(...e)=>e.length===0?n():e.length===1?e[0]:t`(${t.join(e,` OR `)})`,not:e=>t`NOT (${e})`}),createCommonExpressions=()=>({caseWhen:(e,n)=>e.length===0?n:t`CASE ${t.join(e.map(e=>t`WHEN ${e.when} THEN ${e.then}`),` `)} ELSE ${n} END`,add:(e,n)=>t`(${e} + ${n})`,subtract:(e,n)=>t`(${e} - ${n})`,multiply:(e,n)=>t`(${e} * ${n})`,divide:(e,n)=>t`(${e} / ${n})`,upper:e=>t`UPPER(${e})`,lower:e=>t`LOWER(${e})`,coalesce:(...e)=>t`COALESCE(${t.join(e,`, `)})`}),createCastExpression=e=>(n,r)=>t`CAST(${n} AS ${t.raw(e[r])})`,createCoreJoins=()=>({inner:(e,n)=>t`INNER JOIN ${e} ON ${n}`,left:(e,n)=>t`LEFT JOIN ${e} ON ${n}`,right:(e,n)=>t`RIGHT JOIN ${e} ON ${n}`,cross:e=>t`CROSS JOIN ${e}`}),createLateralJoins=e=>({lateral:(n,r)=>t`JOIN LATERAL (${n}) AS ${t.raw(e(r))} ON TRUE`,lateralLeft:(n,r)=>t`LEFT JOIN LATERAL (${n}) AS ${t.raw(e(r))} ON TRUE`}),escapeLikeLiteral=e=>e.replace(/[\\%_]/g,e=>`\\${e}`),escapeGlobLiteral=e=>e.replace(/[*?[]/g,e=>`[${e}]`);export{escapeLikeLiteral as A,createRelationFilters as C,createSubqueries as D,createStandardLiterals as E,stringifyJson as M,createIdentifierQuoter as N,decimalCoefficientPrecision as O,renderQualifiedIdentifier as P,createRawSql as S,createStandardClauses as T,createMutationCommands as _,createComparisonOperators as a,createOnConflictBuilders as b,createDecimalSumOperandPrecision as c,createExistenceOperators as d,createIdentifiers as f,createMembershipOperators as g,createLogicalOperators as h,createCommonExpressions as i,rowValues as j,escapeGlobLiteral as k,createDirectionOrderBy as l,createLateralJoins as m,createAggregateFunctions as n,createCoreJoins as o,createInsertStatement as p,createCastExpression as r,createCteBuilders as s,buildJsonPath as t,createEmulatedNullsOrderBy as u,createNullOperators as v,createSetOperations as w,createRangeOperators as x,createNumericSetOperations as y};
|
|
6
|
-
//# sourceMappingURL=standard-sql-
|
|
6
|
+
//# sourceMappingURL=standard-sql-CYdZ_KXH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-sql-CYdZ_KXH.mjs","names":["sql"],"sources":["../src/sql/identifiers.ts","../src/adapters/shared/standard-sql.ts"],"sourcesContent":["/**\n * Identifier text primitives.\n *\n * Quoting one name for a dialect, and composing a namespace-qualified object\n * name, are string concerns with no `Sql` involvement: runtime adapters wrap the\n * result in `Sql`, migration drivers splice it into DDL text. Both pass their\n * own quoter — the two differ in escape semantics and null handling — so what is\n * shared here is the composition rule alone, and it has one owner.\n */\n\n/** Quote a single identifier for the dialect: `\"name\"` or `` `name` ``. */\nexport type IdentifierQuoter = (name: string) => string;\n\n/** Build an identifier quoter that doubles embedded quote characters to prevent SQL injection. */\nexport const createIdentifierQuoter =\n (quoteChar: '\"' | \"`\"): IdentifierQuoter =>\n (name: string): string => {\n const escaped =\n name.indexOf(quoteChar) === -1\n ? name\n : name.replaceAll(quoteChar, quoteChar + quoteChar);\n return quoteChar + escaped + quoteChar;\n };\n\n/**\n * The one qualification rule. A present namespace contributes a quoted prefix;\n * an absent one contributes nothing, which is what unbound MySQL and every\n * SQLite adapter mean.\n */\nconst qualifiedPrefix = (\n quoteIdentifier: IdentifierQuoter,\n namespace: string\n): string => `${quoteIdentifier(namespace)}.`;\n\n/**\n * Compose one namespace-qualified object name. The namespace must already be\n * normalized: this primitive validates nothing, holds nothing, and returns text\n * for exactly one object.\n */\nexport const renderQualifiedIdentifier = (\n quoteIdentifier: IdentifierQuoter,\n namespace: string | undefined,\n object: string\n): string =>\n namespace === undefined\n ? quoteIdentifier(object)\n : qualifiedPrefix(quoteIdentifier, namespace) + quoteIdentifier(object);\n\n/**\n * Bind one namespace so its prefix is quoted once per adapter rather than once\n * per rendered statement. The returned function renders exactly what\n * `renderQualifiedIdentifier` would for the same namespace.\n */\nexport const createQualifiedIdentifierRenderer = (\n quoteIdentifier: IdentifierQuoter,\n namespace: string | undefined\n): IdentifierQuoter => {\n if (namespace === undefined) {\n return quoteIdentifier;\n }\n const prefix = qualifiedPrefix(quoteIdentifier, namespace);\n return (object: string): string => prefix + quoteIdentifier(object);\n};\n","import { Sql, sql } from \"@sql\";\nimport {\n createQualifiedIdentifierRenderer,\n type IdentifierQuoter,\n} from \"../../sql/identifiers\";\nimport type { CastType, DatabaseAdapter } from \"../database-adapter\";\n\ntype StandardLiterals = Pick<\n DatabaseAdapter[\"literals\"],\n \"value\" | \"null\" | \"list\"\n>;\n\ntype ComparisonOperators = Pick<\n DatabaseAdapter[\"operators\"],\n \"eq\" | \"neq\" | \"lt\" | \"lte\" | \"gt\" | \"gte\"\n>;\n\ntype NullOperators = Pick<DatabaseAdapter[\"operators\"], \"isNull\" | \"isNotNull\">;\n\ntype RangeOperators = Pick<\n DatabaseAdapter[\"operators\"],\n \"between\" | \"notBetween\"\n>;\n\ntype ExistenceOperators = Pick<\n DatabaseAdapter[\"operators\"],\n \"exists\" | \"notExists\"\n>;\n\ntype DirectionOrderBy = Pick<DatabaseAdapter[\"orderBy\"], \"asc\" | \"desc\">;\n\ntype NumericSetOperations = Pick<\n DatabaseAdapter[\"set\"],\n \"assign\" | \"increment\" | \"decrement\"\n>;\n\ntype MutationCommands = Pick<DatabaseAdapter[\"mutations\"], \"update\" | \"delete\">;\n\nexport const createRawSql = (): DatabaseAdapter[\"raw\"] => {\n return (sqlString: string): Sql => sql.raw(sqlString);\n};\n\n/**\n * JSON-serialize a value for dialects that store lists/JSON as JSON text\n * (MySQL, SQLite). BigInt has no JSON representation, so it serializes as a\n * string; the result parser converts it back via the scalar's bigint type.\n */\nexport const stringifyJson = (value: unknown): string =>\n JSON.stringify(value, (_key, v) =>\n typeof v === \"bigint\" ? v.toString() : v\n );\n\nconst JSON_PATH_ARRAY_INDEX = /^\\d+$/;\n\n/**\n * Build a MySQL/SQLite JSONPath string from path segments: '$' plus `[N]`\n * for integer segments (array indices) and `.\"seg\"` for object keys.\n * Keys are JSON-string-escaped so quotes/dots/backslashes in a segment\n * cannot alter the path structure; the result is bound as a parameter.\n */\nexport const buildJsonPath = (path: string[]): string => {\n let jsonPath = \"$\";\n for (const segment of path) {\n jsonPath += JSON_PATH_ARRAY_INDEX.test(segment)\n ? `[${segment}]`\n : `.${JSON.stringify(segment)}`;\n }\n return jsonPath;\n};\n\nexport const createStandardLiterals = (): StandardLiterals => ({\n value: (v: unknown): Sql => sql`${v}`,\n null: (): Sql => sql.raw(\"NULL\"),\n list: (values: Sql[]): Sql => {\n if (values.length === 0) return sql.raw(\"()\");\n return sql`(${sql.join(values, \", \")})`;\n },\n});\n\nexport const createComparisonOperators = (): ComparisonOperators => ({\n eq: (left: Sql, right: Sql): Sql => sql`${left} = ${right}`,\n neq: (left: Sql, right: Sql): Sql => sql`${left} <> ${right}`,\n lt: (left: Sql, right: Sql): Sql => sql`${left} < ${right}`,\n lte: (left: Sql, right: Sql): Sql => sql`${left} <= ${right}`,\n gt: (left: Sql, right: Sql): Sql => sql`${left} > ${right}`,\n gte: (left: Sql, right: Sql): Sql => sql`${left} >= ${right}`,\n});\n\nexport const createNullOperators = (): NullOperators => ({\n isNull: (expr: Sql): Sql => sql`${expr} IS NULL`,\n isNotNull: (expr: Sql): Sql => sql`${expr} IS NOT NULL`,\n});\n\nexport const createRangeOperators = (): RangeOperators => ({\n between: (column: Sql, min: Sql, max: Sql): Sql =>\n sql`${column} BETWEEN ${min} AND ${max}`,\n notBetween: (column: Sql, min: Sql, max: Sql): Sql =>\n sql`${column} NOT BETWEEN ${min} AND ${max}`,\n});\n\nexport const createExistenceOperators = (): ExistenceOperators => ({\n exists: (subquery: Sql): Sql => sql`EXISTS (${subquery})`,\n notExists: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n});\n\ntype StandardAggregates = Omit<\n DatabaseAdapter[\"aggregates\"],\n \"decimalAvg\" | \"decimalSumOperandPrecision\"\n>;\n\n/**\n * The aggregate functions every dialect spells identically. `decimalAvg` is\n * deliberately absent: an exact decimal average is derived from `SUM` and\n * `COUNT` in the column's own physical domain, which is the one thing the three\n * dialects do not agree on, so each adapter states it.\n * `decimalSumOperandPrecision` is absent because each dialect also owns exact\n * admission of an operand compared with a widened sum.\n *\n * `infinity` is the dialect's infinite double literal; MySQL has none.\n */\nexport const createAggregateFunctions = (\n infinity?: string\n): StandardAggregates => ({\n count: (expr?: Sql): Sql =>\n expr ? sql`COUNT(${expr})` : sql.raw(\"COUNT(*)\"),\n countDistinct: (expr: Sql): Sql => sql`COUNT(DISTINCT ${expr})`,\n sum: (expr: Sql): Sql => sql`SUM(${expr})`,\n numberSum: (expr: Sql) => {\n const high = sql`SUM(CASE WHEN ABS(${expr}) >= 1e-288 THEN ${expr} / 4294967296.0 / 4294967296.0 END)`;\n const low = sql`SUM(CASE WHEN ABS(${expr}) < 1e-288 THEN ${expr} END)`;\n // The reader's join in SQL: scaling `high` back by 2^64 is exact below\n // 2^960 and leaves the double range from there, where this multiplies\n // nothing — PostgreSQL and MySQL raise on an overflowing product. Without\n // an infinite double (MySQL) the overflow clamps to the largest finite\n // one, which a `having` operand of exactly that value cannot tell apart,\n // and `high` then sorts an infinite sum past a clamped one.\n const bound = sql.raw(infinity ?? \"1.7976931348623157e308\");\n const value = sql`CASE WHEN ${high} IS NULL THEN ${low} WHEN ABS(${high}) < 9.7453140114e288 THEN ${high} * 4294967296.0 * 4294967296.0 + COALESCE(${low}, 0) WHEN ${high} > 0 THEN ${bound} ELSE -${bound} END`;\n return {\n parts: [high, low] as const,\n value,\n order: infinity ? [value] : [value, high],\n };\n },\n avg: (expr: Sql): Sql => sql`AVG(${expr})`,\n min: (expr: Sql): Sql => sql`MIN(${expr})`,\n max: (expr: Sql): Sql => sql`MAX(${expr})`,\n});\n\n/** The widened precision carried by one trusted coefficient spelling. */\nexport function decimalCoefficientPrecision(coefficient: string): number {\n return coefficient.startsWith(\"-\")\n ? coefficient.length - 1\n : coefficient.length;\n}\n\n/** Exact-decimal aggregate operand admission for precision-bounded dialects. */\nexport function createDecimalSumOperandPrecision(\n maxPrecision: number\n): (coefficient: string) => number | undefined {\n return (coefficient) => {\n const precision = decimalCoefficientPrecision(coefficient);\n return precision <= maxPrecision ? precision : undefined;\n };\n}\n\nexport const createDirectionOrderBy = (): DirectionOrderBy => ({\n asc: (column: Sql): Sql => sql`${column} ASC`,\n desc: (column: Sql): Sql => sql`${column} DESC`,\n});\n\nconst directionKeyword = (direction: \"asc\" | \"desc\"): Sql =>\n direction === \"desc\" ? sql.raw(\"DESC\") : sql.raw(\"ASC\");\n\n/**\n * NULLS FIRST/LAST emulation for dialects without native support\n * (MySQL, SQLite): prepend an IS NULL sort key. IS NULL yields 1 for\n * NULL rows, so DESC puts them first and ASC puts them last.\n */\nexport const createEmulatedNullsOrderBy = (): Pick<\n DatabaseAdapter[\"orderBy\"],\n \"nullsFirst\" | \"nullsLast\"\n> => ({\n nullsFirst: (column: Sql, direction: \"asc\" | \"desc\"): Sql =>\n sql`(${column} IS NULL) DESC, ${column} ${directionKeyword(direction)}`,\n nullsLast: (column: Sql, direction: \"asc\" | \"desc\"): Sql =>\n sql`(${column} IS NULL) ASC, ${column} ${directionKeyword(direction)}`,\n});\n\nexport const createStandardClauses = (): DatabaseAdapter[\"clauses\"] => ({\n select: (columns: Sql): Sql => sql`SELECT ${columns}`,\n selectDistinct: (columns: Sql): Sql => sql`SELECT DISTINCT ${columns}`,\n from: (table: Sql): Sql => sql`FROM ${table}`,\n where: (condition: Sql): Sql => sql`WHERE ${condition}`,\n orderBy: (orders: Sql): Sql => sql`ORDER BY ${orders}`,\n limit: (count: Sql): Sql => sql`LIMIT ${count}`,\n offset: (count: Sql): Sql => sql`OFFSET ${count}`,\n groupBy: (columns: Sql): Sql => sql`GROUP BY ${columns}`,\n having: (condition: Sql): Sql => sql`HAVING ${condition}`,\n});\n\n/**\n * The native arithmetic every dialect shares.\n *\n * `increment`/`decrement` are complete here for EVERY scalar including decimal:\n * addition of two values already in the column's domain — logical decimals on\n * PostgreSQL/MySQL, unscaled coefficients at the same scale on SQLite — creates\n * no digit beyond that domain and therefore never rounds.\n *\n * `multiply` and `divide` do create such digits, so each adapter overrides them\n * to route a decimal target through the shared half-even rule.\n */\nexport const createNumericSetOperations = (): NumericSetOperations => ({\n assign: (column: Sql, value: Sql): Sql => sql`${column} = ${value}`,\n increment: (column: Sql, by: Sql): Sql => sql`${column} = ${column} + ${by}`,\n decrement: (column: Sql, by: Sql): Sql => sql`${column} = ${column} - ${by}`,\n});\n\nexport const createRelationFilters = (): DatabaseAdapter[\"filters\"] => ({\n some: (subquery: Sql): Sql => sql`EXISTS (${subquery})`,\n every: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n none: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n is: (subquery: Sql): Sql => sql`EXISTS (${subquery})`,\n isNot: (subquery: Sql): Sql => sql`NOT EXISTS (${subquery})`,\n});\n\nexport const createMutationCommands = (): MutationCommands => ({\n update: (table: Sql, sets: Sql, where?: Sql): Sql => {\n if (where) {\n return sql`UPDATE ${table} SET ${sets} WHERE ${where}`;\n }\n return sql`UPDATE ${table} SET ${sets}`;\n },\n delete: (table: Sql, where?: Sql): Sql => {\n if (where) {\n return sql`DELETE FROM ${table} WHERE ${where}`;\n }\n return sql`DELETE FROM ${table}`;\n },\n});\n\ntype TypedRows = DatabaseAdapter[\"setOperations\"][\"typedRows\"];\n\n/** One row's values, in order: `(a, b)`. */\nexport const rowValues = (row: readonly Sql[]): Sql =>\n sql`(${sql.join(row, \", \")})`;\n\n/**\n * `typedRows`' default form: the empty typed read, then one `UNION ALL\n * SELECT` per row, each typed against the arms before it.\n */\nconst unionTypedRows =\n (quoteIdent: IdentifierQuoter): TypedRows =>\n (typed, rows, alias) =>\n sql`(${sql.join(\n [typed.head, ...rows.map((row) => sql`SELECT ${sql.join(row, \", \")}`)],\n \" UNION ALL \"\n )}) AS ${sql.raw(quoteIdent(alias))}`;\n\nexport const createSetOperations = (\n quoteIdent: IdentifierQuoter,\n typedRows: TypedRows = unionTypedRows(quoteIdent)\n): DatabaseAdapter[\"setOperations\"] => ({\n union: (...queries: Sql[]): Sql => sql.join(queries, \" UNION \"),\n unionAll: (...queries: Sql[]): Sql => sql.join(queries, \" UNION ALL \"),\n intersect: (...queries: Sql[]): Sql => sql.join(queries, \" INTERSECT \"),\n except: (left: Sql, right: Sql): Sql => sql`${left} EXCEPT ${right}`,\n typedRows,\n});\n\n// ============================================================\n// Dialect-parameterized factories: identical grammar across\n// adapters, differing only in the identifier quote character.\n// ============================================================\n\n/**\n * Whether `text` is exactly `<one quoted identifier>.<quotedName>`: a column\n * reference through a table alias whose column is the name itself.\n */\nconst isQualifiedColumnNamed = (\n text: string | undefined,\n quotedName: string,\n quote: string\n): boolean => {\n if (text === undefined || !text.endsWith(quotedName)) return false;\n const qualifier = text.slice(0, -quotedName.length - 1);\n return (\n text[qualifier.length] === \".\" &&\n qualifier.length >= 2 &&\n qualifier[0] === quote &&\n qualifier.at(-1) === quote &&\n !qualifier\n .slice(1, -1)\n .replaceAll(quote + quote, \"\")\n .includes(quote)\n );\n};\n\n/**\n * `namespace` is the adapter's prevalidated database namespace, or `undefined`\n * for the unqualified dialects. It is quoted once here, at adapter\n * construction — `table()` runs once per persistent table per compiled\n * statement and must not re-quote it.\n *\n * `namesQualifiedColumns`: the dialect names an unaliased `\"t\".\"c\"` result\n * column `c` (PostgreSQL, MySQL), so `aliased` leaves out an alias that only\n * repeats the column's own name. SQLite promises no name for an unaliased\n * column, so it always states the alias.\n */\nexport const createIdentifiers = (\n quoteIdent: IdentifierQuoter,\n namespace?: string,\n namesQualifiedColumns = false\n): DatabaseAdapter[\"identifiers\"] => {\n const qualify = createQualifiedIdentifierRenderer(quoteIdent, namespace);\n const quote = quoteIdent(\"\")[0]!;\n return {\n escape: (name: string): Sql => sql.raw(quoteIdent(name)),\n\n column: (alias: string, field: string): Sql => {\n const identifier = alias\n ? `${quoteIdent(alias)}.${quoteIdent(field)}`\n : quoteIdent(field);\n return sql.raw(identifier);\n },\n\n table: (tableName: string, alias?: string): Sql => {\n const qualified = qualify(tableName);\n return sql.raw(\n alias === undefined ? qualified : `${qualified} AS ${quoteIdent(alias)}`\n );\n },\n\n aliased: (expression: Sql, alias: string): Sql => {\n const quoted = quoteIdent(alias);\n return namesQualifiedColumns &&\n isQualifiedColumnNamed(Sql.leafText(expression), quoted, quote)\n ? expression\n : new Sql([\"\", ` AS ${quoted}`], [expression]);\n },\n };\n};\n\nexport const createSubqueries = (\n quoteIdent: IdentifierQuoter\n): DatabaseAdapter[\"subqueries\"] => ({\n scalar: (query: Sql): Sql => sql`(${query})`,\n\n correlate: (query: Sql, alias: string): Sql =>\n sql`(${query}) AS ${sql.raw(quoteIdent(alias))}`,\n\n existsCheck: (from: Sql, where: Sql): Sql =>\n sql`SELECT 1 FROM ${from} WHERE ${where}`,\n\n isolated: (condition: Sql): Sql => condition,\n});\n\n/**\n * `inlining` is the dialect's `NOT MATERIALIZED` (PostgreSQL 12+), or nothing\n * where the database never materializes a member on its own account.\n */\nexport const createCteBuilders = (\n quoteIdent: IdentifierQuoter,\n inlining?: Sql\n): DatabaseAdapter[\"cte\"] => ({\n with: (\n definitions: { name: string; query: Sql; inlined?: boolean }[]\n ): Sql => {\n const defs = definitions.map(({ name, query, inlined }) =>\n inlined && inlining\n ? sql`${sql.raw(quoteIdent(name))} AS ${inlining} (${query})`\n : sql`${sql.raw(quoteIdent(name))} AS (${query})`\n );\n return sql`WITH ${sql.join(defs, \", \")}`;\n },\n\n recursive: (\n name: string,\n anchor: Sql,\n recursive: Sql,\n union: \"all\" | \"distinct\" = \"all\"\n ): Sql => {\n const unionKeyword =\n union === \"all\" ? sql.raw(\"UNION ALL\") : sql.raw(\"UNION\");\n return sql`WITH RECURSIVE ${sql.raw(quoteIdent(name))} AS (\n ${anchor}\n ${unionKeyword}\n ${recursive}\n )`;\n },\n});\n\nexport const createInsertStatement =\n (quoteIdent: IdentifierQuoter): DatabaseAdapter[\"mutations\"][\"insert\"] =>\n (\n table: Sql,\n columns: string[],\n source: Sql[][] | { readonly select: Sql },\n prefix?: Sql\n ): Sql => {\n const cols = columns.map((c) => sql.raw(quoteIdent(c)));\n const body = Array.isArray(source)\n ? sql`VALUES ${sql.join(\n source.map((row) => sql`(${sql.join(row, \", \")})`),\n \", \"\n )}`\n : source.select;\n const prefixPart = prefix ? sql`${prefix} ` : sql``;\n return sql`INSERT ${prefixPart}INTO ${table} (${sql.join(\n cols,\n \", \"\n )}) ${body}`;\n };\n\n/**\n * Standard ON CONFLICT grammar shared by PostgreSQL and SQLite.\n * MySQL's ON DUPLICATE KEY UPDATE is a different grammar with different\n * semantics — it stays in the MySQL adapter.\n */\nexport const createOnConflictBuilders = (): Pick<\n DatabaseAdapter[\"mutations\"],\n \"onConflict\" | \"onConflictUpdate\" | \"skipDuplicates\"\n> => ({\n onConflict: (target: Sql | null, action: Sql, targetWhere?: Sql): Sql => {\n if (target) {\n if (targetWhere) {\n // ON CONFLICT (id) WHERE <targetWhere> DO UPDATE ...\n return sql`ON CONFLICT (${target}) WHERE ${targetWhere} DO ${action}`;\n }\n return sql`ON CONFLICT (${target}) DO ${action}`;\n }\n return sql`ON CONFLICT DO ${action}`;\n },\n\n onConflictUpdate: (sets: Sql, setWhere?: Sql): Sql => {\n if (setWhere) {\n // UPDATE SET x = y WHERE <setWhere>\n return sql`UPDATE SET ${sets} WHERE ${setWhere}`;\n }\n return sql`UPDATE SET ${sets}`;\n },\n\n // The UNTARGETED skip, and the only caller left is top-level `createMany`,\n // whose `skipDuplicates: true` means \"any unique constraint\". Junction\n // membership inserts want the opposite — only an exact repeat of the complete\n // membership key — and reach `onConflict` above with that key as the target.\n skipDuplicates: () => ({\n prefix: sql``,\n suffix: sql`ON CONFLICT DO NOTHING`,\n }),\n});\n\nexport const createMembershipOperators = (): Pick<\n DatabaseAdapter[\"operators\"],\n \"in\" | \"notIn\"\n> => ({\n in: (column: Sql, values: Sql): Sql => sql`${column} IN ${values}`,\n notIn: (column: Sql, values: Sql): Sql => sql`${column} NOT IN ${values}`,\n});\n\n/**\n * AND/OR/NOT with vacuous-case literals: the dialect's TRUE for an empty\n * AND and FALSE for an empty OR (pass the adapter's literals.true/false).\n */\nexport const createLogicalOperators = (\n vacuousTrue: () => Sql,\n vacuousFalse: () => Sql\n): Pick<DatabaseAdapter[\"operators\"], \"and\" | \"or\" | \"not\"> => ({\n and: (...conditions: Sql[]): Sql => {\n if (conditions.length === 0) return vacuousTrue();\n if (conditions.length === 1) return conditions[0]!;\n return sql`(${sql.join(conditions, \" AND \")})`;\n },\n\n or: (...conditions: Sql[]): Sql => {\n if (conditions.length === 0) return vacuousFalse();\n if (conditions.length === 1) return conditions[0]!;\n return sql`(${sql.join(conditions, \" OR \")})`;\n },\n\n not: (condition: Sql): Sql => sql`NOT (${condition})`,\n});\n\nexport const createCommonExpressions = (): Pick<\n DatabaseAdapter[\"expressions\"],\n | \"caseWhen\"\n | \"add\"\n | \"subtract\"\n | \"multiply\"\n | \"divide\"\n | \"upper\"\n | \"lower\"\n | \"coalesce\"\n> => ({\n caseWhen: (branches, otherwise): Sql =>\n branches.length === 0\n ? otherwise\n : sql`CASE ${sql.join(\n branches.map(\n (branch) => sql`WHEN ${branch.when} THEN ${branch.then}`\n ),\n \" \"\n )} ELSE ${otherwise} END`,\n add: (left: Sql, right: Sql): Sql => sql`(${left} + ${right})`,\n subtract: (left: Sql, right: Sql): Sql => sql`(${left} - ${right})`,\n multiply: (left: Sql, right: Sql): Sql => sql`(${left} * ${right})`,\n divide: (left: Sql, right: Sql): Sql => sql`(${left} / ${right})`,\n upper: (expr: Sql): Sql => sql`UPPER(${expr})`,\n lower: (expr: Sql): Sql => sql`LOWER(${expr})`,\n coalesce: (...exprs: Sql[]): Sql => sql`COALESCE(${sql.join(exprs, \", \")})`,\n});\n\nexport const createCastExpression =\n (typeMap: Record<CastType, string>): DatabaseAdapter[\"expressions\"][\"cast\"] =>\n (expr: Sql, type: CastType): Sql =>\n sql`CAST(${expr} AS ${sql.raw(typeMap[type])})`;\n\nexport const createCoreJoins = (): Pick<\n DatabaseAdapter[\"joins\"],\n \"inner\" | \"left\" | \"right\" | \"cross\"\n> => ({\n inner: (table: Sql, condition: Sql): Sql =>\n sql`INNER JOIN ${table} ON ${condition}`,\n\n left: (table: Sql, condition: Sql): Sql =>\n sql`LEFT JOIN ${table} ON ${condition}`,\n\n right: (table: Sql, condition: Sql): Sql =>\n sql`RIGHT JOIN ${table} ON ${condition}`,\n\n cross: (table: Sql): Sql => sql`CROSS JOIN ${table}`,\n});\n\nexport const createLateralJoins = (\n quoteIdent: IdentifierQuoter\n): Pick<DatabaseAdapter[\"joins\"], \"lateral\" | \"lateralLeft\"> => ({\n lateral: (subquery: Sql, alias: string): Sql =>\n sql`JOIN LATERAL (${subquery}) AS ${sql.raw(quoteIdent(alias))} ON TRUE`,\n\n lateralLeft: (subquery: Sql, alias: string): Sql =>\n sql`LEFT JOIN LATERAL (${subquery}) AS ${sql.raw(quoteIdent(alias))} ON TRUE`,\n});\n\n/**\n * Escape a user value so a SQL `LIKE` pattern matches it literally.\n *\n * `%`, `_` and the escape character itself become escaped; every other\n * character is left alone. The caller appends its own wildcard and must emit\n * a matching `ESCAPE` clause — backslash is only the escape character because\n * every `ESCAPE` clause in this codebase spells backslash.\n */\nexport const escapeLikeLiteral = (value: string): string =>\n value.replace(/[\\\\%_]/g, (char) => `\\\\${char}`);\n\n/**\n * Escape a user value so a SQLite `GLOB` pattern matches it literally.\n *\n * GLOB has no `ESCAPE` clause, so a metacharacter is quoted by wrapping it in\n * a one-character class: `*` becomes `[*]`. Only `*`, `?` and `[` need it —\n * a `]` outside a class is already literal in SQLite's GLOB, and backslash is\n * not a GLOB metacharacter at all.\n */\nexport const escapeGlobLiteral = (value: string): string =>\n value.replace(/[*?[]/g, (char) => `[${char}]`);\n"],"mappings":"uFAcA,MAAa,uBACV,GACA,GAKQ,GAHL,EAAK,QAAQ,EAAU,GAAK,GACxB,EACA,EAAK,WAAW,EAAW,EAAY,EAAU,EAC1B,EAQ3B,iBACJ,EACA,IACW,GAAG,EAAgB,EAAU,CAAC,GAO9B,2BACX,EACA,EACA,IAEA,IAAc,IAAA,GACV,EAAgB,EAAO,CACvB,gBAAgB,EAAiB,EAAU,CAAG,EAAgB,EAAO,CAO9D,mCACX,EACA,IACqB,CACrB,GAAI,IAAc,IAAA,GAChB,OAAO,EAET,IAAM,EAAS,gBAAgB,EAAiB,EAAU,CAC1D,MAAQ,IAA2B,EAAS,EAAgB,EAAO,ECvBxD,iBACH,GAA2BA,EAAI,IAAI,EAAU,CAQ1C,cAAiB,GAC5B,KAAK,UAAU,GAAQ,EAAM,IAC3B,OAAO,GAAM,SAAW,EAAE,UAAU,CAAG,EACxC,CAEG,EAAwB,QAQjB,cAAiB,GAA2B,CACvD,IAAI,EAAW,IACf,IAAK,IAAM,KAAW,EACpB,GAAY,EAAsB,KAAK,EAAQ,CAC3C,IAAI,EAAQ,GACZ,IAAI,KAAK,UAAU,EAAQ,GAEjC,OAAO,GAGI,4BAAkD,CAC7D,MAAQ,GAAoB,CAAG,GAAG,IAClC,SAAiBA,EAAI,IAAI,OAAO,CAChC,KAAO,GACD,EAAO,SAAW,EAAUA,EAAI,IAAI,KAAK,CACtC,CAAG,IAAIA,EAAI,KAAK,EAAQ,KAAK,CAAC,GAExC,EAEY,+BAAwD,CACnE,IAAK,EAAW,IAAoB,CAAG,GAAG,EAAK,KAAK,IACpD,KAAM,EAAW,IAAoB,CAAG,GAAG,EAAK,MAAM,IACtD,IAAK,EAAW,IAA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c,w as l,y as u}from"./v-DtLdBQYg.mjs";import{rt as d}from"./geo-point-codec-DyEHMdJg.mjs";import{_ as f,a as p,c as m,l as h,n as g,o as _,u as v,v as y}from"./scalar-CpEwuJvn.mjs";import{t as b}from"./current-oXcxSCBQ.mjs";const x=c.bigint();var S=class BigIntScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new BigIntScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.bigint({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return new BigIntScalar(v(this,{array:!0,base:c.bigint({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new BigIntScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new BigIntScalar(v(this,{isUnique:!0}),this._nativeType)}default(e){return new BigIntScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}schema(e){return new BigIntScalar(v(this,{schema:e,base:c.bigint({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}map(e){return new BigIntScalar(v(this,{columnName:e}),this._nativeType)}increment(){return new BigIntScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`increment`},default:void 0,disallowZero:!0,optional:!0}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const bigInt=e=>new S(p(`bigint`,x),g(`s.bigInt`,e)),C=c.blob();var w=class BlobScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new BlobScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.blob({nullable:!0})}),this._nativeType)}default(e){return new BlobScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new BlobScalar(v(this,{columnName:e}),this._nativeType)}array(){throw Error(`Blob scalars don't support array modifier`)}id(){throw Error(`Blob scalars cannot be used as IDs`)}unique(){throw Error(`Blob scalars cannot be unique`)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const blob=e=>new w(p(`blob`,C),g(`s.blob`,e)),T=c.boolean();var E=class BooleanScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new BooleanScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.boolean({nullable:!0,array:this.state.array})}),this._nativeType)}array(){return new BooleanScalar(v(this,{array:!0,base:c.boolean({nullable:this.state.nullable,array:!0})}),this._nativeType)}default(e){return new BooleanScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new BooleanScalar(v(this,{columnName:e}),this._nativeType)}_internal;get"~"(){return this._internal??={state:this.state,nativeType:this._nativeType}}};const boolean=e=>new E(p(`boolean`,T),g(`s.boolean`,e)),D=_(()=>b(`date`)),O=_(()=>b(`date`)),k=c.isoDate();var A=class DateScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new DateScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.isoDate({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return(this.state.autoGenerate?.kind===`now`||this.state.autoGenerate?.kind===`updatedAt`)&&h(`s.date`),new DateScalar(v(this,{array:!0,base:c.isoDate({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new DateScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new DateScalar(v(this,{isUnique:!0}),this._nativeType)}schema(e){return new DateScalar(v(this,{schema:e,base:c.isoDate({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}default(e){return new DateScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new DateScalar(v(this,{columnName:e}),this._nativeType)}now(){return this.state.array&&h(`s.date`),new DateScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`now`},default:D,optional:!0}),this._nativeType)}updatedAt(){return this.state.array&&h(`s.date`),new DateScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`updatedAt`},default:O,optional:!0}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const date=e=>new A(p(`date`,k),g(`s.date`,e)),j=_(()=>b(`datetime`)),M=_(()=>b(`datetime`)),N=c.isoTimestamp();var P=class DateTimeScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new DateTimeScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.isoTimestamp({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return(this.state.autoGenerate?.kind===`now`||this.state.autoGenerate?.kind===`updatedAt`)&&h(`s.dateTime`),new DateTimeScalar(v(this,{array:!0,base:c.isoTimestamp({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new DateTimeScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new DateTimeScalar(v(this,{isUnique:!0}),this._nativeType)}schema(e){return new DateTimeScalar(v(this,{schema:e,base:c.isoTimestamp({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}default(e){return new DateTimeScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new DateTimeScalar(v(this,{columnName:e}),this._nativeType)}now(){return this.state.array&&h(`s.dateTime`),new DateTimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`now`},default:j,optional:!0}),this._nativeType)}updatedAt(){return this.state.array&&h(`s.dateTime`),new DateTimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`updatedAt`},default:M,optional:!0}),this._nativeType)}withoutTimezone(){return new DateTimeScalar(v(this,{withTimezone:!1}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const dateTime=e=>new P({...p(`datetime`,N),withTimezone:!0},g(`s.dateTime`,e)),F=_(()=>b(`time`)),I=_(()=>b(`time`)),L=c.isoTime();var R=class TimeScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new TimeScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.isoTime({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return(this.state.autoGenerate?.kind===`now`||this.state.autoGenerate?.kind===`updatedAt`)&&h(`s.time`),new TimeScalar(v(this,{array:!0,base:c.isoTime({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new TimeScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new TimeScalar(v(this,{isUnique:!0}),this._nativeType)}schema(e){return new TimeScalar(v(this,{schema:e,base:c.isoTime({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}default(e){return new TimeScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new TimeScalar(v(this,{columnName:e}),this._nativeType)}now(){return this.state.array&&h(`s.time`),new TimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`now`},default:F,optional:!0}),this._nativeType)}updatedAt(){return this.state.array&&h(`s.time`),new TimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`updatedAt`},default:I,optional:!0}),this._nativeType)}withoutTimezone(){return new TimeScalar(v(this,{withTimezone:!1}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const time=e=>new R({...p(`time`,L),withTimezone:!1},g(`s.time`,e));function refuse(e,t){throw new n({kind:`schema-builder`,builder:`s.decimal`,path:e},[{path:e,message:t}])}function readDecimalDescriptor(e){let n=t(e)?e.precision:void 0,r=t(e)?e.scale:void 0;return typeof n==`number`&&Number.isSafeInteger(n)&&n>=1||refuse(`descriptor.precision`,`'precision' must be an integer between 1 and the maximum safe integer`),typeof r==`number`&&Number.isSafeInteger(r)&&r>=0&&r<=n&&!Object.is(r,-0)||refuse(`descriptor.scale`,`'scale' must be an integer between 0 and precision`),Object.freeze({precision:n,scale:r})}function refuseDecimalListKey(e){let t=`a fixed-decimal list cannot be an ID, a unique field, an index member, a foreign-key member, or a relation identity member`;refuse(e,e===`array`?`A decimal key cannot become a list: ${t}`:`A decimal list cannot be declared '.${e}()': ${t}`)}function normalizeDecimalDefault(e,t){if(typeof e==`function`)return e;let n=d(t,e);return n.issues!==void 0&&refuse(`default`,`The decimal default did not satisfy its field schema`),n.value}var z=class DecimalScalar{state;constructor(e){this.state=e}get descriptor(){return this.state.decimal}nullable(){return new DecimalScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.decimal({nullable:!0,array:this.state.array,decimal:this.descriptor,schema:this.state.schema})}))}array(){(this.state.isId||this.state.isUnique)&&refuseDecimalListKey(`array`);let e=c.decimal({nullable:this.state.nullable,array:!0,decimal:this.descriptor,schema:this.state.schema}),t=v(this,{array:!0,base:e});return this.state.hasDefault&&typeof this.state.default!=`function`&&Object.defineProperty(t,`default`,{value:normalizeDecimalDefault(this.state.default,e),configurable:!0,enumerable:!0,writable:!0}),new DecimalScalar(t)}id(){return this.state.array&&refuseDecimalListKey(`id`),new DecimalScalar(v(this,{isId:!0,isUnique:!0}))}unique(){return this.state.array&&refuseDecimalListKey(`unique`),new DecimalScalar(v(this,{isUnique:!0}))}default(e){return withValidatedDecimalDefault(this,normalizeDecimalDefault(e,this.state.base))}schema(e){let t=c.decimal({nullable:this.state.nullable,array:this.state.array,decimal:this.descriptor,schema:e}),n=v(this,{schema:e,base:t});return this.state.hasDefault&&typeof this.state.default!=`function`&&Object.defineProperty(n,`default`,{value:normalizeDecimalDefault(this.state.default,t),configurable:!0,enumerable:!0,writable:!0}),new DecimalScalar(n)}map(e){return new DecimalScalar(v(this,{columnName:e}))}get"~"(){return{state:this.state}}};function withValidatedDecimalDefault(e,t){return new z(v(e,{hasDefault:!0,default:t,optional:!0}))}const buildDecimalScalar=e=>{let t=readDecimalDescriptor(e);return new z({...p(`decimal`,c.decimal({decimal:t})),decimal:t})},decimal=e=>buildDecimalScalar(e);var B=class EnumScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}get enumValues(){return`values`in this.state.base?this.state.base.values:[]}nullable(){return new EnumScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.enum(this.enumValues,{nullable:!0,array:this.state.array})}),this._nativeType)}array(){return new EnumScalar(v(this,{array:!0,base:c.enum(this.enumValues,{nullable:this.state.nullable,array:!0})}),this._nativeType)}default(e){return new EnumScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new EnumScalar(v(this,{columnName:e}),this._nativeType)}name(e){return new EnumScalar(v(this,{enumName:e}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const enumScalar=(e,t)=>new B(p(`enum`,c.enum(e)),g(`s.enum`,t)),V=c.integer();var H=class IntScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new IntScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.integer({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return new IntScalar(v(this,{array:!0,base:c.integer({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new IntScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new IntScalar(v(this,{isUnique:!0}),this._nativeType)}default(e){return new IntScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}schema(e){return new IntScalar(v(this,{schema:e,base:c.integer({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}map(e){return new IntScalar(v(this,{columnName:e}),this._nativeType)}increment(){return new IntScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`increment`},default:void 0,disallowZero:!0,optional:!0}),this._nativeType)}_internal;get"~"(){return this._internal??={state:this.state,nativeType:this._nativeType}}};const int=e=>new H(p(`int`,V),g(`s.int`,e)),U=c.json();var W=class JsonScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new JsonScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.json({nullable:!0,schema:this.state.schema})}),this._nativeType)}default(e){let t=r(e);if(t===`AnyNull`||t===`DbNull`&&!this.state.nullable)throw new n({kind:`schema-builder`,builder:`s.json`,path:`default`},[{path:`default`,message:`JSON default must name a null this column can store`}]);let a=e===null&&!this.state.nullable?i:e;return new JsonScalar(v(this,{hasDefault:!0,default:a,optional:!0}),this._nativeType)}schema(e){return new JsonScalar(v(this,{schema:e,base:c.json({nullable:this.state.nullable,schema:e})}),this._nativeType)}map(e){return new JsonScalar(v(this,{columnName:e}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const json=e=>new W(p(`json`,U),g(`s.json`,e)),G=c.number();var K=class NumberScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new NumberScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.number({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return new NumberScalar(v(this,{array:!0,base:c.number({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new NumberScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new NumberScalar(v(this,{isUnique:!0}),this._nativeType)}default(e){return new NumberScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}schema(e){return new NumberScalar(v(this,{schema:e,base:c.number({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}map(e){return new NumberScalar(v(this,{columnName:e}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const number=e=>new K(p(`number`,G),g(`s.number`,e)),q=c.point();var J=class PointScalar{state;constructor(e){this.state=e}nullable(){return new PointScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.point({nullable:!0})}))}default(e){return new PointScalar(v(this,{hasDefault:!0,default:normalizePointDefault(e,this.state.base),optional:!0}))}map(e){return new PointScalar(v(this,{columnName:e}))}get"~"(){return{state:this.state}}};function normalizePointDefault(e,t){if(typeof e==`function`)return e;let r=d(t,e);if(!r.issues)return r.value;throw new n({kind:`schema-builder`,builder:`s.point`,path:`default`},r.issues.map(e=>({path:e.path?.join(`.`)??`default`,message:e.message})))}function point(...e){if(e.length!==0)throw new n({kind:`schema-builder`,builder:`s.point`,path:`arguments`},[{path:`arguments`,message:`s.point() takes no native type or options`}]);return new J(p(`point`,q))}const Y=c.vector();var X=class VectorScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new VectorScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.vector(this.state.dimension,{nullable:!0})}),this._nativeType)}default(e){return new VectorScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new VectorScalar(v(this,{columnName:e}),this._nativeType)}dimension(e){if(!Number.isSafeInteger(e)||e<=0)throw new n({kind:`schema-builder`,builder:`s.vector`,path:`dimension`},[{path:`dimension`,message:`Vector dimension must be a positive safe integer`}]);return new VectorScalar(v(this,{dimension:e,base:c.vector(e,{nullable:this.state.nullable})}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const vector=e=>new X(p(`vector`,Y),g(`s.vector`,e));var Z=class ModelToMany{#e;#t;constructor(e){this.#e=Object.freeze(e),this.#t=Object.freeze({state:this.#e,settleTarget:s(()=>this.#e.target.getter)})}name(e){return new ModelToMany({...this.#e,name:a(`s.toMany`,e)})}through(e){return this.#n({...this.#e.junction,table:o(`through`,e)})}source(e){return this.#n({...this.#e.junction,source:o(`source`,e)})}target(e){return this.#n({...this.#e.junction,target:o(`target`,e)})}onDelete(e){return this.#n({...this.#e.junction,onDelete:u(`onDelete`,e)})}onUpdate(e){return this.#n({...this.#e.junction,onUpdate:u(`onUpdate`,e)})}#n(e){return new ModelToMany({...this.#e,junction:Object.freeze(e)})}get"~"(){return this.#t}};function toMany(e,t){return typeof e==`function`?(arguments.length>1&&l(`s.toMany`,`options`,`A model-target relation takes exactly one argument`),new Z({kind:`relation`,cardinality:`many`,target:{kind:`model`,getter:e}})):y({kind:`relation`,cardinality:`many`,target:{kind:`variants`,entries:f(`s.toMany`,e,t)}})}export{bigInt as _,json as a,z as c,withValidatedDecimalDefault as d,time as f,blob as g,boolean as h,number as i,buildDecimalScalar as l,date as m,vector as n,int as o,dateTime as p,point as r,enumScalar as s,toMany as t,decimal as u};
|
|
2
|
-
//# sourceMappingURL=to-many-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{o as t}from"./value-guards-CK9guf2Z.mjs";import{t as n}from"./validation-gwZYm3Yn.mjs";import{A as r,D as i,S as a,b as o,m as s,n as c,w as l,y as u}from"./v-514RME2X.mjs";import{rt as d}from"./geo-point-codec-D95uXgDF.mjs";import{_ as f,a as p,c as m,l as h,n as g,o as _,u as v,v as y}from"./scalar-Cm7nMFmO.mjs";import{t as b}from"./current-oXcxSCBQ.mjs";const x=c.bigint();var S=class BigIntScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new BigIntScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.bigint({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return new BigIntScalar(v(this,{array:!0,base:c.bigint({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new BigIntScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new BigIntScalar(v(this,{isUnique:!0}),this._nativeType)}default(e){return new BigIntScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}schema(e){return new BigIntScalar(v(this,{schema:e,base:c.bigint({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}map(e){return new BigIntScalar(v(this,{columnName:e}),this._nativeType)}increment(){return new BigIntScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`increment`},default:void 0,disallowZero:!0,optional:!0}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const bigInt=e=>new S(p(`bigint`,x),g(`s.bigInt`,e)),C=c.blob();var w=class BlobScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new BlobScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.blob({nullable:!0})}),this._nativeType)}default(e){return new BlobScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new BlobScalar(v(this,{columnName:e}),this._nativeType)}array(){throw Error(`Blob scalars don't support array modifier`)}id(){throw Error(`Blob scalars cannot be used as IDs`)}unique(){throw Error(`Blob scalars cannot be unique`)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const blob=e=>new w(p(`blob`,C),g(`s.blob`,e)),T=c.boolean();var E=class BooleanScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new BooleanScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.boolean({nullable:!0,array:this.state.array})}),this._nativeType)}array(){return new BooleanScalar(v(this,{array:!0,base:c.boolean({nullable:this.state.nullable,array:!0})}),this._nativeType)}default(e){return new BooleanScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new BooleanScalar(v(this,{columnName:e}),this._nativeType)}_internal;get"~"(){return this._internal??={state:this.state,nativeType:this._nativeType}}};const boolean=e=>new E(p(`boolean`,T),g(`s.boolean`,e)),D=_(()=>b(`date`)),O=_(()=>b(`date`)),k=c.isoDate();var A=class DateScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new DateScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.isoDate({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return(this.state.autoGenerate?.kind===`now`||this.state.autoGenerate?.kind===`updatedAt`)&&h(`s.date`),new DateScalar(v(this,{array:!0,base:c.isoDate({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new DateScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new DateScalar(v(this,{isUnique:!0}),this._nativeType)}schema(e){return new DateScalar(v(this,{schema:e,base:c.isoDate({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}default(e){return new DateScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new DateScalar(v(this,{columnName:e}),this._nativeType)}now(){return this.state.array&&h(`s.date`),new DateScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`now`},default:D,optional:!0}),this._nativeType)}updatedAt(){return this.state.array&&h(`s.date`),new DateScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`updatedAt`},default:O,optional:!0}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const date=e=>new A(p(`date`,k),g(`s.date`,e)),j=_(()=>b(`datetime`)),M=_(()=>b(`datetime`)),N=c.isoTimestamp();var P=class DateTimeScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new DateTimeScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.isoTimestamp({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return(this.state.autoGenerate?.kind===`now`||this.state.autoGenerate?.kind===`updatedAt`)&&h(`s.dateTime`),new DateTimeScalar(v(this,{array:!0,base:c.isoTimestamp({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new DateTimeScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new DateTimeScalar(v(this,{isUnique:!0}),this._nativeType)}schema(e){return new DateTimeScalar(v(this,{schema:e,base:c.isoTimestamp({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}default(e){return new DateTimeScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new DateTimeScalar(v(this,{columnName:e}),this._nativeType)}now(){return this.state.array&&h(`s.dateTime`),new DateTimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`now`},default:j,optional:!0}),this._nativeType)}updatedAt(){return this.state.array&&h(`s.dateTime`),new DateTimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`updatedAt`},default:M,optional:!0}),this._nativeType)}withoutTimezone(){return new DateTimeScalar(v(this,{withTimezone:!1}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const dateTime=e=>new P({...p(`datetime`,N),withTimezone:!0},g(`s.dateTime`,e)),F=_(()=>b(`time`)),I=_(()=>b(`time`)),L=c.isoTime();var R=class TimeScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new TimeScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.isoTime({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return(this.state.autoGenerate?.kind===`now`||this.state.autoGenerate?.kind===`updatedAt`)&&h(`s.time`),new TimeScalar(v(this,{array:!0,base:c.isoTime({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new TimeScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new TimeScalar(v(this,{isUnique:!0}),this._nativeType)}schema(e){return new TimeScalar(v(this,{schema:e,base:c.isoTime({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}default(e){return new TimeScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new TimeScalar(v(this,{columnName:e}),this._nativeType)}now(){return this.state.array&&h(`s.time`),new TimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`now`},default:F,optional:!0}),this._nativeType)}updatedAt(){return this.state.array&&h(`s.time`),new TimeScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`updatedAt`},default:I,optional:!0}),this._nativeType)}withoutTimezone(){return new TimeScalar(v(this,{withTimezone:!1}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const time=e=>new R({...p(`time`,L),withTimezone:!1},g(`s.time`,e));function refuse(e,t){throw new n({kind:`schema-builder`,builder:`s.decimal`,path:e},[{path:e,message:t}])}function readDecimalDescriptor(e){let n=t(e)?e.precision:void 0,r=t(e)?e.scale:void 0;return typeof n==`number`&&Number.isSafeInteger(n)&&n>=1||refuse(`descriptor.precision`,`'precision' must be an integer between 1 and the maximum safe integer`),typeof r==`number`&&Number.isSafeInteger(r)&&r>=0&&r<=n&&!Object.is(r,-0)||refuse(`descriptor.scale`,`'scale' must be an integer between 0 and precision`),Object.freeze({precision:n,scale:r})}function refuseDecimalListKey(e){let t=`a fixed-decimal list cannot be an ID, a unique field, an index member, a foreign-key member, or a relation identity member`;refuse(e,e===`array`?`A decimal key cannot become a list: ${t}`:`A decimal list cannot be declared '.${e}()': ${t}`)}function normalizeDecimalDefault(e,t){if(typeof e==`function`)return e;let n=d(t,e);return n.issues!==void 0&&refuse(`default`,`The decimal default did not satisfy its field schema`),n.value}var z=class DecimalScalar{state;constructor(e){this.state=e}get descriptor(){return this.state.decimal}nullable(){return new DecimalScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.decimal({nullable:!0,array:this.state.array,decimal:this.descriptor,schema:this.state.schema})}))}array(){(this.state.isId||this.state.isUnique)&&refuseDecimalListKey(`array`);let e=c.decimal({nullable:this.state.nullable,array:!0,decimal:this.descriptor,schema:this.state.schema}),t=v(this,{array:!0,base:e});return this.state.hasDefault&&typeof this.state.default!=`function`&&Object.defineProperty(t,`default`,{value:normalizeDecimalDefault(this.state.default,e),configurable:!0,enumerable:!0,writable:!0}),new DecimalScalar(t)}id(){return this.state.array&&refuseDecimalListKey(`id`),new DecimalScalar(v(this,{isId:!0,isUnique:!0}))}unique(){return this.state.array&&refuseDecimalListKey(`unique`),new DecimalScalar(v(this,{isUnique:!0}))}default(e){return withValidatedDecimalDefault(this,normalizeDecimalDefault(e,this.state.base))}schema(e){let t=c.decimal({nullable:this.state.nullable,array:this.state.array,decimal:this.descriptor,schema:e}),n=v(this,{schema:e,base:t});return this.state.hasDefault&&typeof this.state.default!=`function`&&Object.defineProperty(n,`default`,{value:normalizeDecimalDefault(this.state.default,t),configurable:!0,enumerable:!0,writable:!0}),new DecimalScalar(n)}map(e){return new DecimalScalar(v(this,{columnName:e}))}get"~"(){return{state:this.state}}};function withValidatedDecimalDefault(e,t){return new z(v(e,{hasDefault:!0,default:t,optional:!0}))}const buildDecimalScalar=e=>{let t=readDecimalDescriptor(e);return new z({...p(`decimal`,c.decimal({decimal:t})),decimal:t})},decimal=e=>buildDecimalScalar(e);var B=class EnumScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}get enumValues(){return`values`in this.state.base?this.state.base.values:[]}nullable(){return new EnumScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.enum(this.enumValues,{nullable:!0,array:this.state.array})}),this._nativeType)}array(){return new EnumScalar(v(this,{array:!0,base:c.enum(this.enumValues,{nullable:this.state.nullable,array:!0})}),this._nativeType)}default(e){return new EnumScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new EnumScalar(v(this,{columnName:e}),this._nativeType)}name(e){return new EnumScalar(v(this,{enumName:e}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const enumScalar=(e,t)=>new B(p(`enum`,c.enum(e)),g(`s.enum`,t)),V=c.integer();var H=class IntScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new IntScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.integer({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return new IntScalar(v(this,{array:!0,base:c.integer({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new IntScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new IntScalar(v(this,{isUnique:!0}),this._nativeType)}default(e){return new IntScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}schema(e){return new IntScalar(v(this,{schema:e,base:c.integer({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}map(e){return new IntScalar(v(this,{columnName:e}),this._nativeType)}increment(){return new IntScalar(v(this,{hasDefault:!0,autoGenerate:{kind:`increment`},default:void 0,disallowZero:!0,optional:!0}),this._nativeType)}_internal;get"~"(){return this._internal??={state:this.state,nativeType:this._nativeType}}};const int=e=>new H(p(`int`,V),g(`s.int`,e)),U=c.json();var W=class JsonScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new JsonScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.json({nullable:!0,schema:this.state.schema})}),this._nativeType)}default(e){let t=r(e);if(t===`AnyNull`||t===`DbNull`&&!this.state.nullable)throw new n({kind:`schema-builder`,builder:`s.json`,path:`default`},[{path:`default`,message:`JSON default must name a null this column can store`}]);let a=e===null&&!this.state.nullable?i:e;return new JsonScalar(v(this,{hasDefault:!0,default:a,optional:!0}),this._nativeType)}schema(e){return new JsonScalar(v(this,{schema:e,base:c.json({nullable:this.state.nullable,schema:e})}),this._nativeType)}map(e){return new JsonScalar(v(this,{columnName:e}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const json=e=>new W(p(`json`,U),g(`s.json`,e)),G=c.number();var K=class NumberScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new NumberScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.number({nullable:!0,array:this.state.array,schema:this.state.schema})}),this._nativeType)}array(){return new NumberScalar(v(this,{array:!0,base:c.number({nullable:this.state.nullable,array:!0,schema:this.state.schema})}),this._nativeType)}id(){return new NumberScalar(v(this,{isId:!0,isUnique:!0}),this._nativeType)}unique(){return new NumberScalar(v(this,{isUnique:!0}),this._nativeType)}default(e){return new NumberScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}schema(e){return new NumberScalar(v(this,{schema:e,base:c.number({nullable:this.state.nullable,array:this.state.array,schema:e})}),this._nativeType)}map(e){return new NumberScalar(v(this,{columnName:e}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const number=e=>new K(p(`number`,G),g(`s.number`,e)),q=c.point();var J=class PointScalar{state;constructor(e){this.state=e}nullable(){return new PointScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.point({nullable:!0})}))}default(e){return new PointScalar(v(this,{hasDefault:!0,default:normalizePointDefault(e,this.state.base),optional:!0}))}map(e){return new PointScalar(v(this,{columnName:e}))}get"~"(){return{state:this.state}}};function normalizePointDefault(e,t){if(typeof e==`function`)return e;let r=d(t,e);if(!r.issues)return r.value;throw new n({kind:`schema-builder`,builder:`s.point`,path:`default`},r.issues.map(e=>({path:e.path?.join(`.`)??`default`,message:e.message})))}function point(...e){if(e.length!==0)throw new n({kind:`schema-builder`,builder:`s.point`,path:`arguments`},[{path:`arguments`,message:`s.point() takes no native type or options`}]);return new J(p(`point`,q))}const Y=c.vector();var X=class VectorScalar{state;_nativeType;constructor(e,t){this.state=e,this._nativeType=t}nullable(){return new VectorScalar(v(this,{nullable:!0,hasDefault:!0,default:m(this.state),optional:!0,base:c.vector(this.state.dimension,{nullable:!0})}),this._nativeType)}default(e){return new VectorScalar(v(this,{hasDefault:!0,default:e,optional:!0}),this._nativeType)}map(e){return new VectorScalar(v(this,{columnName:e}),this._nativeType)}dimension(e){if(!Number.isSafeInteger(e)||e<=0)throw new n({kind:`schema-builder`,builder:`s.vector`,path:`dimension`},[{path:`dimension`,message:`Vector dimension must be a positive safe integer`}]);return new VectorScalar(v(this,{dimension:e,base:c.vector(e,{nullable:this.state.nullable})}),this._nativeType)}get"~"(){return{state:this.state,nativeType:this._nativeType}}};const vector=e=>new X(p(`vector`,Y),g(`s.vector`,e));var Z=class ModelToMany{#e;#t;constructor(e){this.#e=Object.freeze(e),this.#t=Object.freeze({state:this.#e,settleTarget:s(()=>this.#e.target.getter)})}name(e){return new ModelToMany({...this.#e,name:a(`s.toMany`,e)})}through(e){return this.#n({...this.#e.junction,table:o(`through`,e)})}source(e){return this.#n({...this.#e.junction,source:o(`source`,e)})}target(e){return this.#n({...this.#e.junction,target:o(`target`,e)})}onDelete(e){return this.#n({...this.#e.junction,onDelete:u(`onDelete`,e)})}onUpdate(e){return this.#n({...this.#e.junction,onUpdate:u(`onUpdate`,e)})}#n(e){return new ModelToMany({...this.#e,junction:Object.freeze(e)})}get"~"(){return this.#t}};function toMany(e,t){return typeof e==`function`?(arguments.length>1&&l(`s.toMany`,`options`,`A model-target relation takes exactly one argument`),new Z({kind:`relation`,cardinality:`many`,target:{kind:`model`,getter:e}})):y({kind:`relation`,cardinality:`many`,target:{kind:`variants`,entries:f(`s.toMany`,e,t)}})}export{bigInt as _,json as a,z as c,withValidatedDecimalDefault as d,time as f,blob as g,boolean as h,number as i,buildDecimalScalar as l,date as m,vector as n,int as o,dateTime as p,point as r,enumScalar as s,toMany as t,decimal as u};
|
|
2
|
+
//# sourceMappingURL=to-many-Btc9X5Ga.mjs.map
|