@forinda/kickjs-db 8.5.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.mts +1 -1
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/create-BS-WBMOA.mjs +29 -0
- package/dist/create-BS-WBMOA.mjs.map +1 -0
- package/dist/{custom-type-BmdS5BG0.mjs → custom-type-CqYKyYJW.mjs} +2 -2
- package/dist/{custom-type-BmdS5BG0.mjs.map → custom-type-CqYKyYJW.mjs.map} +1 -1
- package/dist/devtools-events.d.mts +1 -1
- package/dist/devtools-events.mjs +1 -1
- package/dist/{index-CPXDGgLd.d.mts → index-DH4qiCqU.d.mts} +23 -16
- package/dist/index-DH4qiCqU.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/mysql.d.mts +1 -1
- package/dist/mysql.d.mts.map +1 -1
- package/dist/mysql.mjs +2 -2
- package/dist/{pg-MX2JRnko.mjs → pg-DGxRYyFW.mjs} +3 -3
- package/dist/{pg-MX2JRnko.mjs.map → pg-DGxRYyFW.mjs.map} +1 -1
- package/dist/pg.d.mts +1 -1
- package/dist/pg.d.mts.map +1 -1
- package/dist/pg.mjs +2 -2
- package/dist/schema.mjs +2 -2
- package/dist/split-statements-BTlvQSAj.mjs +14 -0
- package/dist/{split-statements-DIj3eS4k.mjs.map → split-statements-BTlvQSAj.mjs.map} +1 -1
- package/dist/sqlite.d.mts +1 -1
- package/dist/sqlite.d.mts.map +1 -1
- package/dist/sqlite.mjs +2 -2
- package/dist/sqlite.mjs.map +1 -1
- package/dist/{src-CTNmcABD.mjs → src-CcX7Jjfq.mjs} +16 -16
- package/dist/{src-CTNmcABD.mjs.map → src-CcX7Jjfq.mjs.map} +1 -1
- package/dist/testing.d.mts +21 -1
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +3 -2
- package/dist/testing.mjs.map +1 -1
- package/dist/{types-qncdU0FL.d.mts → types-p2E6CrKO.d.mts} +78 -17
- package/dist/types-p2E6CrKO.d.mts.map +1 -0
- package/package.json +4 -4
- package/dist/create-BQW0LbA5.mjs +0 -29
- package/dist/create-BQW0LbA5.mjs.map +0 -1
- package/dist/index-CPXDGgLd.d.mts.map +0 -1
- package/dist/split-statements-DIj3eS4k.mjs +0 -14
- package/dist/types-qncdU0FL.d.mts.map +0 -1
package/dist/testing.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { r as KickDbClient } from "./types-
|
|
2
|
+
import { o as QueryEvent, r as KickDbClient } from "./types-p2E6CrKO.mjs";
|
|
3
3
|
import { t as SchemaToTypes } from "./schema-types-DIccweFR.mjs";
|
|
4
4
|
//#region src/testing.d.ts
|
|
5
5
|
export interface TestDbOptions<S> {
|
|
@@ -49,5 +49,25 @@ export declare function createPgTestDb<S>(opts: TestDbOptions<S> & {
|
|
|
49
49
|
* it('creates a user', () => rolledBack(db, async () => { … }))
|
|
50
50
|
*/
|
|
51
51
|
export declare function rolledBack<T>(db: Pick<KickDbClient<any>, 'transaction'>, fn: () => Promise<T>): Promise<T>;
|
|
52
|
+
type Observable = Pick<KickDbClient<any>, 'on' | 'off'>;
|
|
53
|
+
/**
|
|
54
|
+
* Run `fn` and return the queries it sent, in order. The client must have
|
|
55
|
+
* events on — `createTestDb` / `createPgTestDb` clients do; your own needs
|
|
56
|
+
* `createDbClient({ events: true })`.
|
|
57
|
+
*
|
|
58
|
+
* const { result, queries } = await captureQueries(db, () => repo.list())
|
|
59
|
+
*/
|
|
60
|
+
export declare function captureQueries<T>(db: Observable, fn: () => Promise<T>): Promise<{
|
|
61
|
+
result: T;
|
|
62
|
+
queries: QueryEvent[];
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Assert `fn` sends exactly `count` queries — a guard against N+1 queries
|
|
66
|
+
* that grows with the data. On a mismatch the error lists every query sent.
|
|
67
|
+
*
|
|
68
|
+
* await expectQueries(db, 2, () => postsWithAuthors()) // 1 + 1, not 1 + N
|
|
69
|
+
*/
|
|
70
|
+
export declare function expectQueries<T>(db: Observable, count: number, fn: () => Promise<T>): Promise<T>;
|
|
52
71
|
//#endregion
|
|
72
|
+
export {};
|
|
53
73
|
//# sourceMappingURL=testing.d.mts.map
|
package/dist/testing.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.mts","names":[],"sources":["../src/testing.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"testing.d.mts","names":[],"sources":["../src/testing.ts"],"mappings":";;;;iBAeiB,cAAc;EAC7B,QAAQ;;;;;EAKR;;EAEA;;;;;;;;wBASoB,aAAa,GACjC,MAAM,cAAc,KACnB,QAAQ,aAAa,cAAc;iBA6BrB,SAAS;EACxB,IAAI,aAAa,cAAc;;EAE/B;;EAEA,QAAQ;;;;;;;;;;;wBAYY,eAAe,GACnC,MAAM,cAAc;;EAElB;IAED,QAAQ,SAAS;;;;;;;;;;wBA8EE,WAAW,GAE/B,IAAI,KAAK,mCACT,UAAU,QAAQ,KACjB,QAAQ;KAcN,aAAa,KAAK;;;;;;;;wBASD,eAAe,GACnC,IAAI,YACJ,UAAU,QAAQ,KACjB;EAAU,QAAQ;EAAG,SAAS;;;;;;;;wBAuBX,cAAc,GAClC,IAAI,YACJ,eACA,UAAU,QAAQ,KACjB,QAAQ"}
|
package/dist/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-db v8.
|
|
2
|
+
* @forinda/kickjs-db v8.7.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{D as emitPg,
|
|
11
|
+
import{D as emitPg,I as EVENTS_ENABLED,K as diff,Y as extractSnapshot,d as migrateLatest,t as createDbClient,y as emitSqlite}from"./create-BS-WBMOA.mjs";import{randomBytes}from"node:crypto";async function createTestDb(opts){let{default:Database}=await import(`better-sqlite3`),{sqliteAdapter,sqliteDialect}=await import(`./sqlite.mjs`),database=new Database(`:memory:`);if(database.pragma(`foreign_keys = ON`),opts.migrationsDir)await migrateLatest({adapter:sqliteAdapter({database}),migrationsDir:opts.migrationsDir,requireReviewed:!1,driftCheck:`ignore`});else{let empty={version:1,dialect:`sqlite`,tables:{}},target=extractSnapshot(opts.schema,`sqlite`,{casing:opts.casing});database.exec(emitSqlite(diff(empty,target),{from:empty,to:target}))}return createDbClient({schema:opts.schema,dialect:sqliteDialect({database}),casing:opts.casing,events:!0})}async function createPgTestDb(opts){let{default:pg}=await import(`pg`),{pgAdapter,pgDialect}=await import(`./pg.mjs`),name=`kick_test_${randomBytes(6).toString(`hex`)}`,admin=new pg.Client({connectionString:opts.connectionString});await admin.connect();try{await admin.query(`CREATE DATABASE "${name}"`)}finally{await admin.end()}let url=new URL(opts.connectionString);url.pathname=`/${name}`;let connectionString=url.toString(),pool=new pg.Pool({connectionString});pool.on(`error`,()=>{}),pool.on(`connect`,client=>client.on(`error`,()=>{})),opts.migrationsDir?await migrateLatest({adapter:pgAdapter({pool}),migrationsDir:opts.migrationsDir,requireReviewed:!1,driftCheck:`ignore`}):await pool.query(emitPg(diff({version:1,dialect:`postgres`,tables:{}},extractSnapshot(opts.schema,`postgres`,{casing:opts.casing}))));let db=createDbClient({schema:opts.schema,dialect:pgDialect({pool}),casing:opts.casing,events:!0});return{db,connectionString,async drop(){await db.destroy();let admin=new pg.Client({connectionString:opts.connectionString});await admin.connect();try{await admin.query(`DROP DATABASE IF EXISTS "${name}" WITH (FORCE)`)}finally{await admin.end()}}}}const ROLLBACK=Symbol(`kickjs-db rolled back`);async function rolledBack(db,fn){let result;return await db.transaction(async()=>{throw result=await fn(),ROLLBACK}).catch(err=>{if(err!==ROLLBACK)throw err}),result}async function captureQueries(db,fn){if(db[EVENTS_ENABLED]===!1)throw Error("captureQueries: this client was created without events, so no query is reported and every count would be 0. Create it with `events: true`.");let queries=[],listener=event=>void queries.push(event);db.on(`query`,listener);try{return{result:await fn(),queries}}finally{db.off(`query`,listener)}}async function expectQueries(db,count,fn){let{result,queries}=await captureQueries(db,fn);if(queries.length!==count){let list=queries.map((q,i)=>` ${i+1}. ${q.sql}`).join(`
|
|
12
|
+
`);throw Error(`Expected ${count} quer${count===1?`y`:`ies`}, ran ${queries.length}:\n${list||` (none)`}`)}return result}export{captureQueries,createPgTestDb,createTestDb,expectQueries,rolledBack};
|
|
12
13
|
//# sourceMappingURL=testing.mjs.map
|
package/dist/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","names":[],"sources":["../src/testing.ts"],"sourcesContent":["// `@forinda/kickjs-db/testing` — test helpers (D.15): a throwaway database\n// per test file, and a transaction per test that never commits.\nimport { randomBytes } from 'node:crypto'\nimport { createDbClient } from './client/create'\nimport type { KickDbClient } from './client/types'\nimport type { SchemaToTypes } from './client/schema-types'\nimport { diff } from './diff/engine'\nimport { emitPg } from './emit/pg'\nimport { emitSqlite } from './emit/sqlite'\nimport { migrateLatest } from './migrate/runner'\nimport { extractSnapshot } from './snapshot/extract'\nimport type { SchemaSnapshot } from './snapshot/types'\n\nexport interface TestDbOptions<S> {\n schema: S\n /**\n * Apply these migrations instead of creating tables straight from the\n * schema — the SQL production runs. Unreviewed ones apply too.\n */\n migrationsDir?: string\n /** The `casing` your client and `kick.config.ts` use. */\n casing?: 'snake_case'\n}\n\n/**\n * A fresh in-memory SQLite database with your schema, foreign keys on —\n * milliseconds to create, one per test file. Needs `better-sqlite3`.\n *\n * const db = await createTestDb({ schema })\n */\nexport async function createTestDb<S>(\n opts: TestDbOptions<S>,\n): Promise<KickDbClient<SchemaToTypes<S>>> {\n const { default: Database } = await import('better-sqlite3')\n const { sqliteAdapter, sqliteDialect } = await import('./sqlite')\n const database = new Database(':memory:')\n database.pragma('foreign_keys = ON')\n\n if (opts.migrationsDir) {\n await migrateLatest({\n adapter: sqliteAdapter({ database }),\n migrationsDir: opts.migrationsDir,\n requireReviewed: false,\n driftCheck: 'ignore',\n })\n } else {\n const empty: SchemaSnapshot = { version: 1, dialect: 'sqlite', tables: {} }\n const target = extractSnapshot(opts.schema as Record<string, unknown>, 'sqlite', {\n casing: opts.casing,\n })\n database.exec(emitSqlite(diff(empty, target), { from: empty, to: target }))\n }\n return createDbClient({\n schema: opts.schema,\n dialect: sqliteDialect({ database }),\n casing: opts.casing,\n }) as never\n}\n\nexport interface PgTestDb<S> {\n db: KickDbClient<SchemaToTypes<S>>\n /** The throwaway database's connection string — for code that opens its own pool. */\n connectionString: string\n /** Close the client and drop the database. Call it in `afterAll`. */\n drop(): Promise<void>\n}\n\n/**\n * A throwaway database on an existing Postgres server — a CI service\n * container, a local Docker Postgres — with your schema or migrations\n * applied. Creating one takes well under a second, so each test file can\n * have its own without starting a container. Needs `pg`.\n *\n * const pg = await createPgTestDb({ schema, connectionString: process.env.TEST_DATABASE_URL! })\n * afterAll(() => pg.drop())\n */\nexport async function createPgTestDb<S>(\n opts: TestDbOptions<S> & {\n /** A database on the server to connect to first, with permission to CREATE DATABASE. */\n connectionString: string\n },\n): Promise<PgTestDb<S>> {\n const { default: pg } = await import('pg')\n const { pgAdapter, pgDialect } = await import('./pg')\n const name = `kick_test_${randomBytes(6).toString('hex')}`\n\n const admin = new pg.Client({ connectionString: opts.connectionString })\n await admin.connect()\n try {\n await admin.query(`CREATE DATABASE \"${name}\"`)\n } finally {\n await admin.end()\n }\n\n const url = new URL(opts.connectionString)\n url.pathname = `/${name}`\n const connectionString = url.toString()\n const pool = new pg.Pool({ connectionString })\n // Dropped connections at teardown aren't test failures. The client-level\n // listener matters: `pool.end()` resolves before a client's socket closes,\n // and the pool detaches its own listener first, so the FORCE drop's\n // termination would otherwise surface as an uncaught error.\n pool.on('error', () => {})\n pool.on('connect', (client) => client.on('error', () => {}))\n\n if (opts.migrationsDir) {\n await migrateLatest({\n adapter: pgAdapter({ pool }),\n migrationsDir: opts.migrationsDir,\n requireReviewed: false,\n driftCheck: 'ignore',\n })\n } else {\n const empty: SchemaSnapshot = { version: 1, dialect: 'postgres', tables: {} }\n await pool.query(\n emitPg(\n diff(\n empty,\n extractSnapshot(opts.schema as Record<string, unknown>, 'postgres', {\n casing: opts.casing,\n }),\n ),\n ),\n )\n }\n\n const db = createDbClient({\n schema: opts.schema,\n dialect: pgDialect({ pool }),\n casing: opts.casing,\n }) as never as KickDbClient<SchemaToTypes<S>>\n return {\n db,\n connectionString,\n async drop() {\n await db.destroy() // ends the pool\n const admin = new pg.Client({ connectionString: opts.connectionString })\n await admin.connect()\n try {\n await admin.query(`DROP DATABASE IF EXISTS \"${name}\" WITH (FORCE)`)\n } finally {\n await admin.end()\n }\n },\n }\n}\n\nconst ROLLBACK = Symbol('kickjs-db rolled back')\n\n/**\n * Run `fn` in a transaction that's always rolled back — every test starts\n * from the same data. Code that only holds the client (a service, a\n * repository) joins the transaction through the call chain, so nothing it\n * writes survives. `afterCommit` hooks don't run. A real failure in `fn`\n * still throws.\n *\n * it('creates a user', () => rolledBack(db, async () => { … }))\n */\nexport async function rolledBack<T>(\n // oxlint-disable-next-line no-explicit-any -- any schema's client\n db: Pick<KickDbClient<any>, 'transaction'>,\n fn: () => Promise<T>,\n): Promise<T> {\n let result!: T\n await db\n .transaction(async () => {\n result = await fn()\n throw ROLLBACK\n })\n .catch((err: unknown) => {\n if (err !== ROLLBACK) throw err\n })\n return result\n}\n"],"mappings":";;;;;;;;;;0KA8BA,eAAsB,aACpB,KACyC,CACzC,GAAM,CAAE,QAAS,UAAa,MAAM,OAAO,kBACrC,CAAE,cAAe,eAAkB,MAAM,OAAO,gBAChD,SAAW,IAAI,SAAS,UAAU,EAGxC,GAFA,SAAS,OAAO,mBAAmB,EAE/B,KAAK,cACP,MAAM,cAAc,CA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Q,CAAC,CAIhE,EACJ,gBAAgB,KAAK,OAAmC,WAAY,CAClE,OAAQ,KAAK,MACf,CAAC,CACH,CACF,CACF,EAGF,IAAM,GAAK,eAAe,CACxB,OAAQ,KAAK,OACb,QAAS,UAAU,CAAE,IAAK,CAAC,EAC3B,OAAQ,KAAK,MACf,CAAC,EACD,MAAO,CACL,GACA,iBACA,MAAM,MAAO,CACX,MAAM,GAAG,QAAQ,EACjB,IAAM,MAAQ,IAAI,GAAG,OAAO,CAAE,iBAAkB,KAAK,gBAAiB,CAAC,EACvE,MAAM,MAAM,QAAQ,EACpB,GAAI,CACF,MAAM,MAAM,MAAM,4BAA4B,KAAK,eAAe,CACpE,QAAU,CACR,MAAM,MAAM,IAAI,CAClB,CACF,CACF,CACF,CAEA,MAAM,SAAW,OAAO,uBAAuB,EAW/C,eAAsB,WAEpB,GACA,GACY,CACZ,IAAI,OASJ,OARA,MAAM,GACH,YAAY,SAAY,CAEvB,KADA,QAAS,MAAM,GAAG,EACZ,QACR,CAAC,CAAC,CACD,MAAO,KAAiB,CACvB,GAAI,MAAQ,SAAU,MAAM,GAC9B,CAAC,EACI,MACT"}
|
|
1
|
+
{"version":3,"file":"testing.mjs","names":[],"sources":["../src/testing.ts"],"sourcesContent":["// `@forinda/kickjs-db/testing` — test helpers (D.15): a throwaway database\n// per test file, and a transaction per test that never commits.\nimport { randomBytes } from 'node:crypto'\nimport { createDbClient } from './client/create'\nimport { EVENTS_ENABLED } from './client/events'\nimport type { QueryEvent } from './client/types'\nimport type { KickDbClient } from './client/types'\nimport type { SchemaToTypes } from './client/schema-types'\nimport { diff } from './diff/engine'\nimport { emitPg } from './emit/pg'\nimport { emitSqlite } from './emit/sqlite'\nimport { migrateLatest } from './migrate/runner'\nimport { extractSnapshot } from './snapshot/extract'\nimport type { SchemaSnapshot } from './snapshot/types'\n\nexport interface TestDbOptions<S> {\n schema: S\n /**\n * Apply these migrations instead of creating tables straight from the\n * schema — the SQL production runs. Unreviewed ones apply too.\n */\n migrationsDir?: string\n /** The `casing` your client and `kick.config.ts` use. */\n casing?: 'snake_case'\n}\n\n/**\n * A fresh in-memory SQLite database with your schema, foreign keys on —\n * milliseconds to create, one per test file. Needs `better-sqlite3`.\n *\n * const db = await createTestDb({ schema })\n */\nexport async function createTestDb<S>(\n opts: TestDbOptions<S>,\n): Promise<KickDbClient<SchemaToTypes<S>>> {\n const { default: Database } = await import('better-sqlite3')\n const { sqliteAdapter, sqliteDialect } = await import('./sqlite')\n const database = new Database(':memory:')\n database.pragma('foreign_keys = ON')\n\n if (opts.migrationsDir) {\n await migrateLatest({\n adapter: sqliteAdapter({ database }),\n migrationsDir: opts.migrationsDir,\n requireReviewed: false,\n driftCheck: 'ignore',\n })\n } else {\n const empty: SchemaSnapshot = { version: 1, dialect: 'sqlite', tables: {} }\n const target = extractSnapshot(opts.schema as Record<string, unknown>, 'sqlite', {\n casing: opts.casing,\n })\n database.exec(emitSqlite(diff(empty, target), { from: empty, to: target }))\n }\n return createDbClient({\n schema: opts.schema,\n dialect: sqliteDialect({ database }),\n casing: opts.casing,\n // On, so captureQueries / expectQueries can count.\n events: true,\n }) as never\n}\n\nexport interface PgTestDb<S> {\n db: KickDbClient<SchemaToTypes<S>>\n /** The throwaway database's connection string — for code that opens its own pool. */\n connectionString: string\n /** Close the client and drop the database. Call it in `afterAll`. */\n drop(): Promise<void>\n}\n\n/**\n * A throwaway database on an existing Postgres server — a CI service\n * container, a local Docker Postgres — with your schema or migrations\n * applied. Creating one takes well under a second, so each test file can\n * have its own without starting a container. Needs `pg`.\n *\n * const pg = await createPgTestDb({ schema, connectionString: process.env.TEST_DATABASE_URL! })\n * afterAll(() => pg.drop())\n */\nexport async function createPgTestDb<S>(\n opts: TestDbOptions<S> & {\n /** A database on the server to connect to first, with permission to CREATE DATABASE. */\n connectionString: string\n },\n): Promise<PgTestDb<S>> {\n const { default: pg } = await import('pg')\n const { pgAdapter, pgDialect } = await import('./pg')\n const name = `kick_test_${randomBytes(6).toString('hex')}`\n\n const admin = new pg.Client({ connectionString: opts.connectionString })\n await admin.connect()\n try {\n await admin.query(`CREATE DATABASE \"${name}\"`)\n } finally {\n await admin.end()\n }\n\n const url = new URL(opts.connectionString)\n url.pathname = `/${name}`\n const connectionString = url.toString()\n const pool = new pg.Pool({ connectionString })\n // Dropped connections at teardown aren't test failures. The client-level\n // listener matters: `pool.end()` resolves before a client's socket closes,\n // and the pool detaches its own listener first, so the FORCE drop's\n // termination would otherwise surface as an uncaught error.\n pool.on('error', () => {})\n pool.on('connect', (client) => client.on('error', () => {}))\n\n if (opts.migrationsDir) {\n await migrateLatest({\n adapter: pgAdapter({ pool }),\n migrationsDir: opts.migrationsDir,\n requireReviewed: false,\n driftCheck: 'ignore',\n })\n } else {\n const empty: SchemaSnapshot = { version: 1, dialect: 'postgres', tables: {} }\n await pool.query(\n emitPg(\n diff(\n empty,\n extractSnapshot(opts.schema as Record<string, unknown>, 'postgres', {\n casing: opts.casing,\n }),\n ),\n ),\n )\n }\n\n const db = createDbClient({\n schema: opts.schema,\n dialect: pgDialect({ pool }),\n casing: opts.casing,\n events: true,\n }) as never as KickDbClient<SchemaToTypes<S>>\n return {\n db,\n connectionString,\n async drop() {\n await db.destroy() // ends the pool\n const admin = new pg.Client({ connectionString: opts.connectionString })\n await admin.connect()\n try {\n await admin.query(`DROP DATABASE IF EXISTS \"${name}\" WITH (FORCE)`)\n } finally {\n await admin.end()\n }\n },\n }\n}\n\nconst ROLLBACK = Symbol('kickjs-db rolled back')\n\n/**\n * Run `fn` in a transaction that's always rolled back — every test starts\n * from the same data. Code that only holds the client (a service, a\n * repository) joins the transaction through the call chain, so nothing it\n * writes survives. `afterCommit` hooks don't run. A real failure in `fn`\n * still throws.\n *\n * it('creates a user', () => rolledBack(db, async () => { … }))\n */\nexport async function rolledBack<T>(\n // oxlint-disable-next-line no-explicit-any -- any schema's client\n db: Pick<KickDbClient<any>, 'transaction'>,\n fn: () => Promise<T>,\n): Promise<T> {\n let result!: T\n await db\n .transaction(async () => {\n result = await fn()\n throw ROLLBACK\n })\n .catch((err: unknown) => {\n if (err !== ROLLBACK) throw err\n })\n return result\n}\n\n// oxlint-disable-next-line no-explicit-any -- any schema's client\ntype Observable = Pick<KickDbClient<any>, 'on' | 'off'>\n\n/**\n * Run `fn` and return the queries it sent, in order. The client must have\n * events on — `createTestDb` / `createPgTestDb` clients do; your own needs\n * `createDbClient({ events: true })`.\n *\n * const { result, queries } = await captureQueries(db, () => repo.list())\n */\nexport async function captureQueries<T>(\n db: Observable,\n fn: () => Promise<T>,\n): Promise<{ result: T; queries: QueryEvent[] }> {\n if ((db as unknown as Record<symbol, unknown>)[EVENTS_ENABLED] === false) {\n throw new Error(\n 'captureQueries: this client was created without events, so no query is reported ' +\n 'and every count would be 0. Create it with `events: true`.',\n )\n }\n const queries: QueryEvent[] = []\n const listener = (event: QueryEvent) => void queries.push(event)\n db.on('query', listener)\n try {\n return { result: await fn(), queries }\n } finally {\n db.off('query', listener)\n }\n}\n\n/**\n * Assert `fn` sends exactly `count` queries — a guard against N+1 queries\n * that grows with the data. On a mismatch the error lists every query sent.\n *\n * await expectQueries(db, 2, () => postsWithAuthors()) // 1 + 1, not 1 + N\n */\nexport async function expectQueries<T>(\n db: Observable,\n count: number,\n fn: () => Promise<T>,\n): Promise<T> {\n const { result, queries } = await captureQueries(db, fn)\n if (queries.length !== count) {\n const list = queries.map((q, i) => ` ${i + 1}. ${q.sql}`).join('\\n')\n throw new Error(\n `Expected ${count} quer${count === 1 ? 'y' : 'ies'}, ran ${queries.length}:\\n${list || ' (none)'}`,\n )\n }\n return result\n}\n"],"mappings":";;;;;;;;;;8LAgCA,eAAsB,aACpB,KACyC,CACzC,GAAM,CAAE,QAAS,UAAa,MAAM,OAAO,kBACrC,CAAE,cAAe,eAAkB,MAAM,OAAO,gBAChD,SAAW,IAAI,SAAS,UAAU,EAGxC,GAFA,SAAS,OAAO,mBAAmB,EAE/B,KAAK,cACP,MAAM,cAAc,CAClB,QAAS,cAAc,C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,KAAK;CAAI,EACpE,MAAU,MACR,YAAY,MAAM,OAAO,QAAU,EAAI,IAAM,MAAM,QAAQ,QAAQ,OAAO,KAAK,MAAQ,YACzF,CACF,CACA,OAAO,MACT"}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
|
|
2
2
|
import { l as NotNullBrand, o as GeneratedBrand, t as ColumnBuilder } from "./types-DtX5fIbn.mjs";
|
|
3
|
-
import { CommonTableExpression, Dialect, Expression, ExpressionBuilder, Insertable, Kysely, KyselyPlugin, SelectQueryBuilder, Selectable, SqlBool, UpdateObject } from "kysely";
|
|
3
|
+
import { CommonTableExpression, Dialect, Expression, ExpressionBuilder, Insertable, Kysely, KyselyPlugin, SelectQueryBuilder, SelectType, Selectable, SqlBool, UpdateObject } from "kysely";
|
|
4
|
+
//#region src/client/insert-many.d.ts
|
|
5
|
+
interface InsertManyOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Bind parameters one statement may use. Default the dialect's limit; set it
|
|
8
|
+
* for a driver with a lower one — `100` for Cloudflare D1.
|
|
9
|
+
*/
|
|
10
|
+
maxParams?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Run every statement in one transaction (joining the caller's if one is
|
|
13
|
+
* open), so the rows land all together or not at all. Default `true`.
|
|
14
|
+
* `false` for a driver without transactions (Cloudflare D1).
|
|
15
|
+
*/
|
|
16
|
+
atomic?: boolean;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
4
19
|
//#region src/client/upsert.d.ts
|
|
5
|
-
interface UpsertOptions<DB, T extends keyof DB & string> {
|
|
6
|
-
/**
|
|
20
|
+
interface UpsertOptions<DB, T extends keyof DB & string> extends InsertManyOptions {
|
|
21
|
+
/**
|
|
22
|
+
* The row — or rows — to insert. Many rows are split into statements that
|
|
23
|
+
* fit the dialect's parameter limit, in one transaction (see `insertMany`).
|
|
24
|
+
*/
|
|
7
25
|
values: Insertable<DB[T]> | ReadonlyArray<Insertable<DB[T]>>;
|
|
8
26
|
/**
|
|
9
27
|
* The unique key (or primary key) whose conflict turns the insert into an
|
|
@@ -138,7 +156,10 @@ interface TenancyOptions {
|
|
|
138
156
|
/**
|
|
139
157
|
* `'database'`: at most this many tenants' connections open at once — the
|
|
140
158
|
* least recently used idle one is closed to make room. A soft cap: tenants
|
|
141
|
-
* with a query in flight are never closed. Default
|
|
159
|
+
* with a query in flight are never closed. Default 100: a pool each is
|
|
160
|
+
* already more connections than most databases allow, and the tenant id
|
|
161
|
+
* often comes from a request — unbounded, a client sending made-up ids
|
|
162
|
+
* would open a pool per id.
|
|
142
163
|
*/
|
|
143
164
|
maxOpenTenants?: number;
|
|
144
165
|
/**
|
|
@@ -331,16 +352,11 @@ type TableRelations<Table extends string> = Table extends keyof RegisteredRelati
|
|
|
331
352
|
*/
|
|
332
353
|
type QueryOps<DB, Table extends keyof DB & string> = ExpressionBuilder<DB, Table>;
|
|
333
354
|
/**
|
|
334
|
-
* The table-bound shape passed as the first arg to callbacks
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
* adapter-side helpers. At runtime, the same `u` is a Proxy whose
|
|
338
|
-
* property reads return Kysely column refs (`eb.ref('users.id')`),
|
|
339
|
-
* so `eb('id', '=', u.id)` Just Works for either layer-1 or
|
|
340
|
-
* relational-query call sites. Most adopters keep the first arg
|
|
341
|
-
* underscored and reach for `eb('col', op, value)` directly.
|
|
355
|
+
* The table-bound shape passed as the first arg to callbacks: each column
|
|
356
|
+
* is a reference typed with its value — `u.id` is an `Expression<number>`,
|
|
357
|
+
* so `eq(u.id, 1)` checks the value and `eb('id', '=', u.id)` works too.
|
|
342
358
|
*/
|
|
343
|
-
type TableRefs<DB, Table extends keyof DB & string> = DB[Table];
|
|
359
|
+
type TableRefs<DB, Table extends keyof DB & string> = { [K in keyof DB[Table]]: Expression<SelectType<DB[Table][K]>>; };
|
|
344
360
|
/**
|
|
345
361
|
* Options bag for `findMany` / `findFirst` / `findUnique`.
|
|
346
362
|
*
|
|
@@ -492,6 +508,15 @@ interface TransactionOptions extends TransactionEvent {
|
|
|
492
508
|
* `isolation` and `retry` apply only when a transaction actually starts.
|
|
493
509
|
*/
|
|
494
510
|
nested?: 'reuse' | 'savepoint' | 'separate';
|
|
511
|
+
/**
|
|
512
|
+
* Must be the outermost transaction, so that when the callback returns its
|
|
513
|
+
* work is committed — not just folded into a caller's transaction that may
|
|
514
|
+
* still roll back. Throws if a transaction is already open on this call
|
|
515
|
+
* chain (unless `nested: 'separate'`, which commits on its own). For work
|
|
516
|
+
* that has to be on disk before anything else happens: a payment recorded
|
|
517
|
+
* before the confirmation email goes out.
|
|
518
|
+
*/
|
|
519
|
+
durable?: boolean;
|
|
495
520
|
/**
|
|
496
521
|
* Start the transaction read-only (Postgres, MySQL): a write inside it fails.
|
|
497
522
|
* For reports that must see one consistent view and must not change it.
|
|
@@ -534,6 +559,14 @@ interface SlowQueryEvent extends QueryEvent {
|
|
|
534
559
|
/** The configured threshold the query exceeded. */
|
|
535
560
|
thresholdMs: number;
|
|
536
561
|
}
|
|
562
|
+
/** A read about to run, for {@link CreateDbClientOptions.route}. */
|
|
563
|
+
interface ReadRoute {
|
|
564
|
+
/** The table it reads — `undefined` for a join list, a subquery, raw SQL. */
|
|
565
|
+
table: string | undefined;
|
|
566
|
+
/** How many replicas there are: valid indexes are `0` to `replicas - 1`. */
|
|
567
|
+
replicas: number;
|
|
568
|
+
}
|
|
569
|
+
type ReadRouter = (read: ReadRoute) => 'primary' | number | undefined;
|
|
537
570
|
interface KickDbClientEvents {
|
|
538
571
|
beforeQuery: BeforeQueryEvent;
|
|
539
572
|
query: QueryEvent;
|
|
@@ -601,8 +634,9 @@ interface KickDbClient<DB = RegisteredDB> {
|
|
|
601
634
|
off<E extends keyof KickDbClientEvents>(event: E, listener: (e: KickDbClientEvents[E]) => void | Promise<void>): this;
|
|
602
635
|
/**
|
|
603
636
|
* Insert, or update the rows whose `target` key already exists — one
|
|
604
|
-
* statement (`ON CONFLICT … DO UPDATE` / `ON DUPLICATE KEY UPDATE`)
|
|
605
|
-
*
|
|
637
|
+
* statement (`ON CONFLICT … DO UPDATE` / `ON DUPLICATE KEY UPDATE`), or
|
|
638
|
+
* several in one transaction when the rows pass the dialect's parameter
|
|
639
|
+
* limit. Returns the rows as stored.
|
|
606
640
|
*
|
|
607
641
|
* await db.upsert('users', { values: { email, name }, target: ['email'] })
|
|
608
642
|
*/
|
|
@@ -612,6 +646,22 @@ interface KickDbClient<DB = RegisteredDB> {
|
|
|
612
646
|
upsert<T extends keyof DB & string>(table: T, opts: UpsertOptions<DB, T> & {
|
|
613
647
|
values: ReadonlyArray<Insertable<DB[T]>>;
|
|
614
648
|
}): Promise<Selectable<DB[T]>[]>;
|
|
649
|
+
/**
|
|
650
|
+
* Insert any number of rows, in as few statements as the dialect's limit on
|
|
651
|
+
* bind parameters allows (65,535 on Postgres and MySQL, 32,766 on SQLite),
|
|
652
|
+
* in one transaction. `insertInto(t).values(rows)` is one statement, and
|
|
653
|
+
* fails past that limit. Returns how many rows went in — or, with
|
|
654
|
+
* `returning: true`, the rows (Postgres, SQLite).
|
|
655
|
+
*
|
|
656
|
+
* await db.insertMany('events', rows)
|
|
657
|
+
* await db.insertMany('events', rows, { maxParams: 100, atomic: false }) // Cloudflare D1
|
|
658
|
+
*/
|
|
659
|
+
insertMany<T extends keyof DB & string>(table: T, rows: ReadonlyArray<Insertable<DB[T]>>, options?: InsertManyOptions & {
|
|
660
|
+
returning?: false;
|
|
661
|
+
}): Promise<number>;
|
|
662
|
+
insertMany<T extends keyof DB & string>(table: T, rows: ReadonlyArray<Insertable<DB[T]>>, options: InsertManyOptions & {
|
|
663
|
+
returning: true;
|
|
664
|
+
}): Promise<Selectable<DB[T]>[]>;
|
|
615
665
|
/**
|
|
616
666
|
* The row matching `where`, or a new one from `where` + `create`;
|
|
617
667
|
* `created` says which. Race-safe across concurrent requests.
|
|
@@ -701,6 +751,17 @@ interface CreateDbClientOptions<TSchema, _DB = unknown> {
|
|
|
701
751
|
* own writes through `db.primary`.
|
|
702
752
|
*/
|
|
703
753
|
replica?: Dialect | readonly Dialect[];
|
|
754
|
+
/**
|
|
755
|
+
* Where each read outside a transaction goes, when there are replicas:
|
|
756
|
+
* return `'primary'`, a replica's index, or `undefined` for the default
|
|
757
|
+
* (replicas in turn). Called per read with the table it reads (`undefined`
|
|
758
|
+
* for a query not on one table). For read-your-writes after a request
|
|
759
|
+
* wrote, tables that replicate late, a replica in the caller's region, or
|
|
760
|
+
* skipping one that lags:
|
|
761
|
+
*
|
|
762
|
+
* route: ({ table }) => (wroteThisRequest() || table === 'balances' ? 'primary' : undefined)
|
|
763
|
+
*/
|
|
764
|
+
route?: ReadRouter;
|
|
704
765
|
/**
|
|
705
766
|
* Enable lifecycle event emission for `query` / `queryError` /
|
|
706
767
|
* `slowQuery` / `transactionStart` / `transactionCommit` /
|
|
@@ -785,5 +846,5 @@ interface CreateDbClientOptions<TSchema, _DB = unknown> {
|
|
|
785
846
|
casing?: 'snake_case';
|
|
786
847
|
}
|
|
787
848
|
//#endregion
|
|
788
|
-
export {
|
|
789
|
-
//# sourceMappingURL=types-
|
|
849
|
+
export { TenantRequiredError as A, KickDbRegister as C, Tenancy as D, BypassOptions as E, ModelExtensions as F, FindOrCreateOptions as I, UpsertOptions as L, tenantKey as M, ExtendedClient as N, TenancyOptions as O, ExtensionDefinition as P, InsertManyOptions as R, WithClause as S, BypassInfo as T, QueryNamespace as _, QueryErrorEvent as a, TableQueryNamespace as b, ReadRouter as c, TransactionOptions as d, TransactionRetryEvent as f, KickDbRelationsRegister as g, FindManyRow as h, KickDbClientEvents as i, defineTenancy as j, TenancyStrategy as k, SlowQueryEvent as l, FindManyOptions as m, CreateDbClientOptions as n, QueryEvent as o, TransactionRollbackEvent as p, KickDbClient as r, ReadRoute as s, BeforeQueryEvent as t, TransactionEvent as u, RegisteredRelations as v, RegisteredDB as w, TableRelations as x, RelationMapEntry as y };
|
|
850
|
+
//# sourceMappingURL=types-p2E6CrKO.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-p2E6CrKO.d.mts","names":["_$__upsert0.UpsertOptions","_$__insert_many0.InsertManyOptions","_$__upsert0.FindOrCreateOptions","_$___extend_types0.ExtensionDefinition","_$___extend_types0.ExtendedClient","KyselyDialect","_$___tenancy0.Tenancy"],"sources":["../src/client/insert-many.ts","../src/client/upsert.ts","../src/extend/types.ts","../src/tenancy.ts","../src/client/register.ts","../src/query/types.ts","../src/client/types.ts"],"mappings":";;;;UAiBiB;;;;;EAKf;;;;;;EAMA;;;;UCTe,cAAc,IAAI,gBAAgB,qBAAqB;;;;;EAKtE,QAAQ,WAAW,GAAG,MAAM,cAAc,WAAW,GAAG;;;;;;EAMxD,QAAQ,oBAAoB,GAAG;;;;;;EAM/B,SAAS,oBAAoB,GAAG,eAAe,aAAa,IAAI;;;;;;EAMhE,SAAS,IAAI,kBAAkB,IAAI,OAAO,WAAW;;;KAIlD,YAAY,QAAQ,WAAW,iBAAiB,KAAK,GAAG,aAAa,WAAU;;KAG/E,WAAW,IAAI,gBAAgB,IAAI,KAAK,KAAK,WAAW,GAAG,KAAK,YAAY,MAC/E,QAAQ,WAAW,GAAG;KAEZ,oBACV,IACA,gBAAgB,aAChB,UAAU,QAAQ,WAAW,GAAG,OAAO,QAAQ,WAAW,GAAG;;EAG7D,OAAO,IAAI,OAAO,cAAc,SAAS,WAAW,GAAG;gBACzC,WAAW,IAAI,GAAG;EAE5B,SAAS,WAAW,IAAI,GAAG;;EAC3B,QAAQ,WAAW,IAAI,GAAG;;;;;;;;;;;KCnBpB,gBAAgB,SACzB,eAAe,eAAe,mBAAmB;;;;;;;UASnC,gBAAgB;;EAE/B,OAAO,QAAQ,aAAa;;EAE5B,UAAU,KAAK;;;;;;KAOL,iBAAiB,SAC1B,eAAe,eAAe,eAAe,gBAAgB,GAAG;;UAIlD,oBAAoB;EACnC,QAAQ,gBAAgB;EACxB,SAAS,iBAAiB;;;;;;;;;;;;;;;KAgBhB,cAAc,IAAI,QAC3B,WAA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AAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAyB/B,SAAS,UAAwDC,oBAAA,KAC/D,KAAK,IACyCC,eAAJ,IAAI;EAEhD,WAAW;;UAGI,sBAAsB,SAAS;;EAE9C,QAAQ;;;;;EAKR,SAASC;;;;;;EAMT;;;;;EAKA,UAXSC;;;;;;;EAkBT,UAAUD,mBAAyBA;;;;;;;;;;;EAWnC,QAAQ;;;;;;;EAOR;;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BA,iDAAiD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCjD,UAAU;;;;;;EAMV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-db",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"description": "KickJS-native ORM — code-first schema, reversible migrations, multi-dialect SQL builder",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@testcontainers/mysql": "^12.2.0",
|
|
95
95
|
"@testcontainers/postgresql": "^12.2.0",
|
|
96
96
|
"@types/better-sqlite3": "^9.6.0",
|
|
97
|
-
"@types/node": "^26.6.
|
|
97
|
+
"@types/node": "^26.6.5",
|
|
98
98
|
"@types/pg": "^8.23.1",
|
|
99
99
|
"better-sqlite3": "^13.0.3",
|
|
100
100
|
"kysely": "^0.29.6",
|
|
@@ -104,9 +104,9 @@
|
|
|
104
104
|
"pg": "^8.23.1",
|
|
105
105
|
"pg-cursor": "^2.22.1",
|
|
106
106
|
"typescript": "^7.0.2",
|
|
107
|
+
"@forinda/kickjs": "10.2.0",
|
|
107
108
|
"@forinda/kickjs-devtools-kit": "7.3.0",
|
|
108
|
-
"@forinda/kickjs-schema": "0.2.4"
|
|
109
|
-
"@forinda/kickjs": "9.1.0"
|
|
109
|
+
"@forinda/kickjs-schema": "0.2.4"
|
|
110
110
|
},
|
|
111
111
|
"publishConfig": {
|
|
112
112
|
"access": "public"
|