@relaybus/postgres 0.1.0 → 0.3.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/knex.cjs CHANGED
@@ -16,6 +16,7 @@ function splitPositionalSql(sql) {
16
16
  function createKnexExecutor(knex) {
17
17
  return {
18
18
  transaction: (work) => knex.transaction(work),
19
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
19
20
  async query(sql, parameters, transaction) {
20
21
  const parts = splitPositionalSql(sql);
21
22
  const knexSql = parts.map((part) => typeof part === "string" ? part : "?").join("");
package/dist/knex.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/positional-sql.ts","../src/knex/knex-executor.ts"],"names":[],"mappings":";;;AASO,SAAS,mBAAmB,GAAA,EAAkC;AACnE,EAAA,MAAM,QAA6B,EAAC;AACpC,EAAA,IAAI,SAAA,GAAY,CAAA;AAChB,EAAA,KAAA,MAAW,KAAA,IAAS,GAAA,CAAI,QAAA,CAAS,UAAU,CAAA,EAAG;AAC5C,IAAA,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,KAAA,CAAM,SAAA,EAAW,MAAM,KAAK,CAAA,EAAG,EAAE,cAAA,EAAgB,OAAO,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,GAAG,CAAA;AACtF,IAAA,SAAA,GAAY,KAAA,CAAM,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA,CAAE,MAAA;AAAA,EACrC;AACA,EAAA,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,KAAA,CAAM,SAAS,CAAC,CAAA;AAC/B,EAAA,OAAO,KAAA;AACT;;;ACDO,SAAS,mBAAmB,IAAA,EAAiD;AAClF,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,IAAA,CAAK,YAAY,IAAI,CAAA;AAAA,IAC5C,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,KAAA,GAAQ,mBAAmB,GAAG,CAAA;AACpC,MAAA,MAAM,OAAA,GAAU,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,KAAU,OAAO,IAAA,KAAS,QAAA,GAAW,IAAA,GAAO,GAAI,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA;AACpF,MAAA,MAAM,WAAW,KAAA,CAAM,OAAA;AAAA,QAAQ,CAAC,IAAA,KAC9B,OAAO,IAAA,KAAS,QAAA,GAAW,EAAC,GAAI,CAAC,UAAA,CAAW,IAAA,CAAK,cAAc,CAAC;AAAA,OAClE;AACA,MAAA,MAAM,SAAS,MAAA,CAAO,WAAA,IAAe,IAAA,EAAM,GAAA,CAAI,SAAS,QAAQ,CAAA;AAChE,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"knex.cjs","sourcesContent":["/** A piece of SQL text, or a reference to the (zero-based) parameter that stands at this position. */\nexport type PositionalSqlPart = string | { readonly parameterIndex: number };\n\n/**\n * Splits SQL written with PostgreSQL `$1, $2, ...` placeholders into text and\n * parameter references, in order of appearance. A placeholder used twice\n * appears twice. Adapters for libraries with their own placeholder syntax\n * (Knex `?`, Drizzle parameter chunks) rebuild the statement from the parts.\n */\nexport function splitPositionalSql(sql: string): PositionalSqlPart[] {\n const parts: PositionalSqlPart[] = [];\n let textStart = 0;\n for (const match of sql.matchAll(/\\$(\\d+)/g)) {\n parts.push(sql.slice(textStart, match.index), { parameterIndex: Number(match[1]) - 1 });\n textStart = match.index + match[0].length;\n }\n parts.push(sql.slice(textStart));\n return parts;\n}\n","import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\nimport { splitPositionalSql } from '../positional-sql.js';\n\n/** What a Knex instance and a Knex transaction have in common. */\nexport interface KnexQueryable {\n raw(sql: string, bindings: readonly unknown[]): PromiseLike<{ readonly rows: PostgresRow[] }>;\n}\n\n/** The part of a `Knex` instance the executor uses. */\nexport interface KnexLike extends KnexQueryable {\n transaction<T>(work: (transaction: KnexQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for Knex with the `pg` client. The transaction handle is a Knex\n * transaction: pass `trx` from `knex.transaction(async (trx) => ...)`.\n */\nexport function createKnexExecutor(knex: KnexLike): PostgresExecutor<KnexQueryable> {\n return {\n transaction: (work) => knex.transaction(work),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const parts = splitPositionalSql(sql);\n const knexSql = parts.map((part) => (typeof part === 'string' ? part : '?')).join('');\n const bindings = parts.flatMap((part) =>\n typeof part === 'string' ? [] : [parameters[part.parameterIndex]],\n );\n const result = await (transaction ?? knex).raw(knexSql, bindings);\n return result.rows;\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/positional-sql.ts","../src/knex/knex-executor.ts"],"names":[],"mappings":";;;AASO,SAAS,mBAAmB,GAAA,EAAkC;AACnE,EAAA,MAAM,QAA6B,EAAC;AACpC,EAAA,IAAI,SAAA,GAAY,CAAA;AAChB,EAAA,KAAA,MAAW,KAAA,IAAS,GAAA,CAAI,QAAA,CAAS,UAAU,CAAA,EAAG;AAC5C,IAAA,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,KAAA,CAAM,SAAA,EAAW,MAAM,KAAK,CAAA,EAAG,EAAE,cAAA,EAAgB,OAAO,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,GAAG,CAAA;AACtF,IAAA,SAAA,GAAY,KAAA,CAAM,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA,CAAE,MAAA;AAAA,EACrC;AACA,EAAA,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,KAAA,CAAM,SAAS,CAAC,CAAA;AAC/B,EAAA,OAAO,KAAA;AACT;;;ACDO,SAAS,mBAAmB,IAAA,EAAiD;AAClF,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,IAAA,CAAK,YAAY,IAAI,CAAA;AAAA;AAAA,IAE5C,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,KAAA,GAAQ,mBAAmB,GAAG,CAAA;AACpC,MAAA,MAAM,OAAA,GAAU,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,KAAU,OAAO,IAAA,KAAS,QAAA,GAAW,IAAA,GAAO,GAAI,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA;AACpF,MAAA,MAAM,WAAW,KAAA,CAAM,OAAA;AAAA,QAAQ,CAAC,IAAA,KAC9B,OAAO,IAAA,KAAS,QAAA,GAAW,EAAC,GAAI,CAAC,UAAA,CAAW,IAAA,CAAK,cAAc,CAAC;AAAA,OAClE;AACA,MAAA,MAAM,SAAS,MAAA,CAAO,WAAA,IAAe,IAAA,EAAM,GAAA,CAAI,SAAS,QAAQ,CAAA;AAChE,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"knex.cjs","sourcesContent":["/** A piece of SQL text, or a reference to the (zero-based) parameter that stands at this position. */\nexport type PositionalSqlPart = string | { readonly parameterIndex: number };\n\n/**\n * Splits SQL written with PostgreSQL `$1, $2, ...` placeholders into text and\n * parameter references, in order of appearance. A placeholder used twice\n * appears twice. Adapters for libraries with their own placeholder syntax\n * (Knex `?`, Drizzle parameter chunks) rebuild the statement from the parts.\n */\nexport function splitPositionalSql(sql: string): PositionalSqlPart[] {\n const parts: PositionalSqlPart[] = [];\n let textStart = 0;\n for (const match of sql.matchAll(/\\$(\\d+)/g)) {\n parts.push(sql.slice(textStart, match.index), { parameterIndex: Number(match[1]) - 1 });\n textStart = match.index + match[0].length;\n }\n parts.push(sql.slice(textStart));\n return parts;\n}\n","import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\nimport { splitPositionalSql } from '../positional-sql.js';\n\n/** What a Knex instance and a Knex transaction have in common. */\nexport interface KnexQueryable {\n raw(sql: string, bindings: readonly unknown[]): PromiseLike<{ readonly rows: PostgresRow[] }>;\n}\n\n/** The part of a `Knex` instance the executor uses. */\nexport interface KnexLike extends KnexQueryable {\n transaction<T>(work: (transaction: KnexQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for Knex with the `pg` client. The transaction handle is a Knex\n * transaction: pass `trx` from `knex.transaction(async (trx) => ...)`.\n */\nexport function createKnexExecutor(knex: KnexLike): PostgresExecutor<KnexQueryable> {\n return {\n transaction: (work) => knex.transaction(work),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const parts = splitPositionalSql(sql);\n const knexSql = parts.map((part) => (typeof part === 'string' ? part : '?')).join('');\n const bindings = parts.flatMap((part) =>\n typeof part === 'string' ? [] : [parameters[part.parameterIndex]],\n );\n const result = await (transaction ?? knex).raw(knexSql, bindings);\n return result.rows;\n },\n };\n}\n"]}
package/dist/knex.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { b as PostgresRow, P as PostgresExecutor } from './executor-CSM7ZOhz.cjs';
1
+ import { c as PostgresRow, P as PostgresExecutor } from './executor-CfJgktC6.cjs';
2
2
 
3
3
  /** What a Knex instance and a Knex transaction have in common. */
4
4
  interface KnexQueryable {
package/dist/knex.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { b as PostgresRow, P as PostgresExecutor } from './executor-CSM7ZOhz.js';
1
+ import { c as PostgresRow, P as PostgresExecutor } from './executor-CfJgktC6.js';
2
2
 
3
3
  /** What a Knex instance and a Knex transaction have in common. */
4
4
  interface KnexQueryable {
package/dist/knex.js CHANGED
@@ -4,6 +4,7 @@ import { splitPositionalSql } from './chunk-UUFSUL2M.js';
4
4
  function createKnexExecutor(knex) {
5
5
  return {
6
6
  transaction: (work) => knex.transaction(work),
7
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
7
8
  async query(sql, parameters, transaction) {
8
9
  const parts = splitPositionalSql(sql);
9
10
  const knexSql = parts.map((part) => typeof part === "string" ? part : "?").join("");
package/dist/knex.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/knex/knex-executor.ts"],"names":[],"mappings":";;;AAiBO,SAAS,mBAAmB,IAAA,EAAiD;AAClF,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,IAAA,CAAK,YAAY,IAAI,CAAA;AAAA,IAC5C,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,KAAA,GAAQ,mBAAmB,GAAG,CAAA;AACpC,MAAA,MAAM,OAAA,GAAU,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,KAAU,OAAO,IAAA,KAAS,QAAA,GAAW,IAAA,GAAO,GAAI,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA;AACpF,MAAA,MAAM,WAAW,KAAA,CAAM,OAAA;AAAA,QAAQ,CAAC,IAAA,KAC9B,OAAO,IAAA,KAAS,QAAA,GAAW,EAAC,GAAI,CAAC,UAAA,CAAW,IAAA,CAAK,cAAc,CAAC;AAAA,OAClE;AACA,MAAA,MAAM,SAAS,MAAA,CAAO,WAAA,IAAe,IAAA,EAAM,GAAA,CAAI,SAAS,QAAQ,CAAA;AAChE,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"knex.js","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\nimport { splitPositionalSql } from '../positional-sql.js';\n\n/** What a Knex instance and a Knex transaction have in common. */\nexport interface KnexQueryable {\n raw(sql: string, bindings: readonly unknown[]): PromiseLike<{ readonly rows: PostgresRow[] }>;\n}\n\n/** The part of a `Knex` instance the executor uses. */\nexport interface KnexLike extends KnexQueryable {\n transaction<T>(work: (transaction: KnexQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for Knex with the `pg` client. The transaction handle is a Knex\n * transaction: pass `trx` from `knex.transaction(async (trx) => ...)`.\n */\nexport function createKnexExecutor(knex: KnexLike): PostgresExecutor<KnexQueryable> {\n return {\n transaction: (work) => knex.transaction(work),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const parts = splitPositionalSql(sql);\n const knexSql = parts.map((part) => (typeof part === 'string' ? part : '?')).join('');\n const bindings = parts.flatMap((part) =>\n typeof part === 'string' ? [] : [parameters[part.parameterIndex]],\n );\n const result = await (transaction ?? knex).raw(knexSql, bindings);\n return result.rows;\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/knex/knex-executor.ts"],"names":[],"mappings":";;;AAiBO,SAAS,mBAAmB,IAAA,EAAiD;AAClF,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,IAAA,CAAK,YAAY,IAAI,CAAA;AAAA;AAAA,IAE5C,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,KAAA,GAAQ,mBAAmB,GAAG,CAAA;AACpC,MAAA,MAAM,OAAA,GAAU,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,KAAU,OAAO,IAAA,KAAS,QAAA,GAAW,IAAA,GAAO,GAAI,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA;AACpF,MAAA,MAAM,WAAW,KAAA,CAAM,OAAA;AAAA,QAAQ,CAAC,IAAA,KAC9B,OAAO,IAAA,KAAS,QAAA,GAAW,EAAC,GAAI,CAAC,UAAA,CAAW,IAAA,CAAK,cAAc,CAAC;AAAA,OAClE;AACA,MAAA,MAAM,SAAS,MAAA,CAAO,WAAA,IAAe,IAAA,EAAM,GAAA,CAAI,SAAS,QAAQ,CAAA;AAChE,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"knex.js","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\nimport { splitPositionalSql } from '../positional-sql.js';\n\n/** What a Knex instance and a Knex transaction have in common. */\nexport interface KnexQueryable {\n raw(sql: string, bindings: readonly unknown[]): PromiseLike<{ readonly rows: PostgresRow[] }>;\n}\n\n/** The part of a `Knex` instance the executor uses. */\nexport interface KnexLike extends KnexQueryable {\n transaction<T>(work: (transaction: KnexQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for Knex with the `pg` client. The transaction handle is a Knex\n * transaction: pass `trx` from `knex.transaction(async (trx) => ...)`.\n */\nexport function createKnexExecutor(knex: KnexLike): PostgresExecutor<KnexQueryable> {\n return {\n transaction: (work) => knex.transaction(work),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const parts = splitPositionalSql(sql);\n const knexSql = parts.map((part) => (typeof part === 'string' ? part : '?')).join('');\n const bindings = parts.flatMap((part) =>\n typeof part === 'string' ? [] : [parameters[part.parameterIndex]],\n );\n const result = await (transaction ?? knex).raw(knexSql, bindings);\n return result.rows;\n },\n };\n}\n"]}
package/dist/kysely.cjs CHANGED
@@ -6,6 +6,7 @@ var kysely = require('kysely');
6
6
  function createKyselyExecutor(database) {
7
7
  return {
8
8
  transaction: (work) => database.transaction().execute(work),
9
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
9
10
  async query(sql, parameters, transaction) {
10
11
  const result = await (transaction ?? database).executeQuery(
11
12
  kysely.CompiledQuery.raw(sql, [...parameters])
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/kysely/kysely-executor.ts"],"names":["CompiledQuery"],"mappings":";;;;;AAoBO,SAAS,qBAAqB,QAAA,EAAyD;AAC5F,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,SAAS,WAAA,EAAY,CAAE,QAAQ,IAAI,CAAA;AAAA,IAC1D,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,MAAA,GAAS,MAAA,CAAO,WAAA,IAAe,QAAA,EAAU,YAAA;AAAA,QAC7CA,qBAAc,GAAA,CAAI,GAAA,EAAK,CAAC,GAAG,UAAU,CAAC;AAAA,OACxC;AACA,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"kysely.cjs","sourcesContent":["import { CompiledQuery } from 'kysely';\nimport type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a Kysely instance and a Kysely transaction have in common. */\nexport interface KyselyQueryable {\n executeQuery<R>(query: CompiledQuery<R>): Promise<{ readonly rows: R[] }>;\n}\n\n/** The part of a `Kysely` instance the executor uses. */\nexport interface KyselyLike extends KyselyQueryable {\n transaction(): {\n execute<T>(work: (transaction: KyselyQueryable) => Promise<T>): Promise<T>;\n };\n}\n\n/**\n * Executor for Kysely. The transaction handle is a Kysely `Transaction`: pass\n * `trx` from `db.transaction().execute(async (trx) => ...)` as the\n * `transaction` option of `publish`.\n */\nexport function createKyselyExecutor(database: KyselyLike): PostgresExecutor<KyselyQueryable> {\n return {\n transaction: (work) => database.transaction().execute(work),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const result = await (transaction ?? database).executeQuery<PostgresRow>(\n CompiledQuery.raw(sql, [...parameters]),\n );\n return result.rows;\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/kysely/kysely-executor.ts"],"names":["CompiledQuery"],"mappings":";;;;;AAoBO,SAAS,qBAAqB,QAAA,EAAyD;AAC5F,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,SAAS,WAAA,EAAY,CAAE,QAAQ,IAAI,CAAA;AAAA;AAAA,IAE1D,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,MAAA,GAAS,MAAA,CAAO,WAAA,IAAe,QAAA,EAAU,YAAA;AAAA,QAC7CA,qBAAc,GAAA,CAAI,GAAA,EAAK,CAAC,GAAG,UAAU,CAAC;AAAA,OACxC;AACA,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"kysely.cjs","sourcesContent":["import { CompiledQuery } from 'kysely';\nimport type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a Kysely instance and a Kysely transaction have in common. */\nexport interface KyselyQueryable {\n executeQuery<R>(query: CompiledQuery<R>): Promise<{ readonly rows: R[] }>;\n}\n\n/** The part of a `Kysely` instance the executor uses. */\nexport interface KyselyLike extends KyselyQueryable {\n transaction(): {\n execute<T>(work: (transaction: KyselyQueryable) => Promise<T>): Promise<T>;\n };\n}\n\n/**\n * Executor for Kysely. The transaction handle is a Kysely `Transaction`: pass\n * `trx` from `db.transaction().execute(async (trx) => ...)` as the\n * `transaction` option of `publish`.\n */\nexport function createKyselyExecutor(database: KyselyLike): PostgresExecutor<KyselyQueryable> {\n return {\n transaction: (work) => database.transaction().execute(work),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const result = await (transaction ?? database).executeQuery<PostgresRow>(\n CompiledQuery.raw(sql, [...parameters]),\n );\n return result.rows;\n },\n };\n}\n"]}
package/dist/kysely.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CompiledQuery } from 'kysely';
2
- import { P as PostgresExecutor } from './executor-CSM7ZOhz.cjs';
2
+ import { P as PostgresExecutor } from './executor-CfJgktC6.cjs';
3
3
 
4
4
  /** What a Kysely instance and a Kysely transaction have in common. */
5
5
  interface KyselyQueryable {
package/dist/kysely.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CompiledQuery } from 'kysely';
2
- import { P as PostgresExecutor } from './executor-CSM7ZOhz.js';
2
+ import { P as PostgresExecutor } from './executor-CfJgktC6.js';
3
3
 
4
4
  /** What a Kysely instance and a Kysely transaction have in common. */
5
5
  interface KyselyQueryable {
package/dist/kysely.js CHANGED
@@ -4,6 +4,7 @@ import { CompiledQuery } from 'kysely';
4
4
  function createKyselyExecutor(database) {
5
5
  return {
6
6
  transaction: (work) => database.transaction().execute(work),
7
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
7
8
  async query(sql, parameters, transaction) {
8
9
  const result = await (transaction ?? database).executeQuery(
9
10
  CompiledQuery.raw(sql, [...parameters])
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/kysely/kysely-executor.ts"],"names":[],"mappings":";;;AAoBO,SAAS,qBAAqB,QAAA,EAAyD;AAC5F,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,SAAS,WAAA,EAAY,CAAE,QAAQ,IAAI,CAAA;AAAA,IAC1D,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,MAAA,GAAS,MAAA,CAAO,WAAA,IAAe,QAAA,EAAU,YAAA;AAAA,QAC7C,cAAc,GAAA,CAAI,GAAA,EAAK,CAAC,GAAG,UAAU,CAAC;AAAA,OACxC;AACA,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"kysely.js","sourcesContent":["import { CompiledQuery } from 'kysely';\nimport type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a Kysely instance and a Kysely transaction have in common. */\nexport interface KyselyQueryable {\n executeQuery<R>(query: CompiledQuery<R>): Promise<{ readonly rows: R[] }>;\n}\n\n/** The part of a `Kysely` instance the executor uses. */\nexport interface KyselyLike extends KyselyQueryable {\n transaction(): {\n execute<T>(work: (transaction: KyselyQueryable) => Promise<T>): Promise<T>;\n };\n}\n\n/**\n * Executor for Kysely. The transaction handle is a Kysely `Transaction`: pass\n * `trx` from `db.transaction().execute(async (trx) => ...)` as the\n * `transaction` option of `publish`.\n */\nexport function createKyselyExecutor(database: KyselyLike): PostgresExecutor<KyselyQueryable> {\n return {\n transaction: (work) => database.transaction().execute(work),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const result = await (transaction ?? database).executeQuery<PostgresRow>(\n CompiledQuery.raw(sql, [...parameters]),\n );\n return result.rows;\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/kysely/kysely-executor.ts"],"names":[],"mappings":";;;AAoBO,SAAS,qBAAqB,QAAA,EAAyD;AAC5F,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,SAAS,WAAA,EAAY,CAAE,QAAQ,IAAI,CAAA;AAAA;AAAA,IAE1D,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,MAAM,MAAA,GAAS,MAAA,CAAO,WAAA,IAAe,QAAA,EAAU,YAAA;AAAA,QAC7C,cAAc,GAAA,CAAI,GAAA,EAAK,CAAC,GAAG,UAAU,CAAC;AAAA,OACxC;AACA,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAChB;AAAA,GACF;AACF","file":"kysely.js","sourcesContent":["import { CompiledQuery } from 'kysely';\nimport type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a Kysely instance and a Kysely transaction have in common. */\nexport interface KyselyQueryable {\n executeQuery<R>(query: CompiledQuery<R>): Promise<{ readonly rows: R[] }>;\n}\n\n/** The part of a `Kysely` instance the executor uses. */\nexport interface KyselyLike extends KyselyQueryable {\n transaction(): {\n execute<T>(work: (transaction: KyselyQueryable) => Promise<T>): Promise<T>;\n };\n}\n\n/**\n * Executor for Kysely. The transaction handle is a Kysely `Transaction`: pass\n * `trx` from `db.transaction().execute(async (trx) => ...)` as the\n * `transaction` option of `publish`.\n */\nexport function createKyselyExecutor(database: KyselyLike): PostgresExecutor<KyselyQueryable> {\n return {\n transaction: (work) => database.transaction().execute(work),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n const result = await (transaction ?? database).executeQuery<PostgresRow>(\n CompiledQuery.raw(sql, [...parameters]),\n );\n return result.rows;\n },\n };\n}\n"]}
package/dist/prisma.cjs CHANGED
@@ -4,6 +4,7 @@
4
4
  function createPrismaExecutor(client, transactionOptions = {}) {
5
5
  return {
6
6
  transaction: (work) => client.$transaction(work, transactionOptions),
7
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
7
8
  async query(sql, parameters, transaction) {
8
9
  return await (transaction ?? client).$queryRawUnsafe(sql, ...parameters);
9
10
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/prisma/prisma-executor.ts"],"names":[],"mappings":";;;AA6BO,SAAS,oBAAA,CACd,MAAA,EACA,kBAAA,GAA+C,EAAC,EACb;AACnC,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA,IACnE,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,OAAO,WAAA,IAAe,MAAA,EAAQ,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC1E;AAAA,GACF;AACF","file":"prisma.cjs","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a `PrismaClient` and an interactive-transaction client have in common. */\nexport interface PrismaQueryable {\n $queryRawUnsafe(query: string, ...values: unknown[]): PromiseLike<unknown>;\n}\n\n/** The part of a `PrismaClient` the executor uses. */\nexport interface PrismaClientLike extends PrismaQueryable {\n $transaction<T>(\n work: (transaction: PrismaQueryable) => Promise<T>,\n options?: PrismaTransactionOptions,\n ): Promise<T>;\n}\n\n/** Prisma interactive transaction limits. Prisma's defaults (2 s wait, 5 s run) are short for handlers. */\nexport interface PrismaTransactionOptions {\n readonly maxWait?: number;\n readonly timeout?: number;\n}\n\n/**\n * Executor for Prisma, typed structurally so the package has no Prisma\n * dependency. The transaction handle is the client of an interactive\n * transaction: pass `tx` from `prisma.$transaction(async (tx) => ...)`.\n *\n * Not yet verified against a real Prisma client and database: it is covered by\n * unit tests with a structural fake only.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return {\n transaction: (work) => client.$transaction(work, transactionOptions),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? client).$queryRawUnsafe(sql, ...parameters)) as PostgresRow[];\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/prisma/prisma-executor.ts"],"names":[],"mappings":";;;AA6BO,SAAS,oBAAA,CACd,MAAA,EACA,kBAAA,GAA+C,EAAC,EACb;AACnC,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA;AAAA,IAEnE,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,OAAO,WAAA,IAAe,MAAA,EAAQ,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC1E;AAAA,GACF;AACF","file":"prisma.cjs","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a `PrismaClient` and an interactive-transaction client have in common. */\nexport interface PrismaQueryable {\n $queryRawUnsafe(query: string, ...values: unknown[]): PromiseLike<unknown>;\n}\n\n/** The part of a `PrismaClient` the executor uses. */\nexport interface PrismaClientLike extends PrismaQueryable {\n $transaction<T>(\n work: (transaction: PrismaQueryable) => Promise<T>,\n options?: PrismaTransactionOptions,\n ): Promise<T>;\n}\n\n/** Prisma interactive transaction limits. Prisma's defaults (2 s wait, 5 s run) are short for handlers. */\nexport interface PrismaTransactionOptions {\n readonly maxWait?: number;\n readonly timeout?: number;\n}\n\n/**\n * Executor for Prisma, typed structurally so the package has no Prisma\n * dependency. The transaction handle is the client of an interactive\n * transaction: pass `tx` from `prisma.$transaction(async (tx) => ...)`.\n *\n * Not yet verified against a real Prisma client and database: it is covered by\n * unit tests with a structural fake only.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return {\n transaction: (work) => client.$transaction(work, transactionOptions),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? client).$queryRawUnsafe(sql, ...parameters)) as PostgresRow[];\n },\n };\n}\n"]}
package/dist/prisma.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as PostgresExecutor } from './executor-CSM7ZOhz.cjs';
1
+ import { P as PostgresExecutor } from './executor-CfJgktC6.cjs';
2
2
 
3
3
  /** What a `PrismaClient` and an interactive-transaction client have in common. */
4
4
  interface PrismaQueryable {
package/dist/prisma.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as PostgresExecutor } from './executor-CSM7ZOhz.js';
1
+ import { P as PostgresExecutor } from './executor-CfJgktC6.js';
2
2
 
3
3
  /** What a `PrismaClient` and an interactive-transaction client have in common. */
4
4
  interface PrismaQueryable {
package/dist/prisma.js CHANGED
@@ -2,6 +2,7 @@
2
2
  function createPrismaExecutor(client, transactionOptions = {}) {
3
3
  return {
4
4
  transaction: (work) => client.$transaction(work, transactionOptions),
5
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
5
6
  async query(sql, parameters, transaction) {
6
7
  return await (transaction ?? client).$queryRawUnsafe(sql, ...parameters);
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/prisma/prisma-executor.ts"],"names":[],"mappings":";AA6BO,SAAS,oBAAA,CACd,MAAA,EACA,kBAAA,GAA+C,EAAC,EACb;AACnC,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA,IACnE,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,OAAO,WAAA,IAAe,MAAA,EAAQ,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC1E;AAAA,GACF;AACF","file":"prisma.js","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a `PrismaClient` and an interactive-transaction client have in common. */\nexport interface PrismaQueryable {\n $queryRawUnsafe(query: string, ...values: unknown[]): PromiseLike<unknown>;\n}\n\n/** The part of a `PrismaClient` the executor uses. */\nexport interface PrismaClientLike extends PrismaQueryable {\n $transaction<T>(\n work: (transaction: PrismaQueryable) => Promise<T>,\n options?: PrismaTransactionOptions,\n ): Promise<T>;\n}\n\n/** Prisma interactive transaction limits. Prisma's defaults (2 s wait, 5 s run) are short for handlers. */\nexport interface PrismaTransactionOptions {\n readonly maxWait?: number;\n readonly timeout?: number;\n}\n\n/**\n * Executor for Prisma, typed structurally so the package has no Prisma\n * dependency. The transaction handle is the client of an interactive\n * transaction: pass `tx` from `prisma.$transaction(async (tx) => ...)`.\n *\n * Not yet verified against a real Prisma client and database: it is covered by\n * unit tests with a structural fake only.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return {\n transaction: (work) => client.$transaction(work, transactionOptions),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? client).$queryRawUnsafe(sql, ...parameters)) as PostgresRow[];\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/prisma/prisma-executor.ts"],"names":[],"mappings":";AA6BO,SAAS,oBAAA,CACd,MAAA,EACA,kBAAA,GAA+C,EAAC,EACb;AACnC,EAAA,OAAO;AAAA,IACL,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA;AAAA,IAEnE,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,OAAO,WAAA,IAAe,MAAA,EAAQ,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC1E;AAAA,GACF;AACF","file":"prisma.js","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a `PrismaClient` and an interactive-transaction client have in common. */\nexport interface PrismaQueryable {\n $queryRawUnsafe(query: string, ...values: unknown[]): PromiseLike<unknown>;\n}\n\n/** The part of a `PrismaClient` the executor uses. */\nexport interface PrismaClientLike extends PrismaQueryable {\n $transaction<T>(\n work: (transaction: PrismaQueryable) => Promise<T>,\n options?: PrismaTransactionOptions,\n ): Promise<T>;\n}\n\n/** Prisma interactive transaction limits. Prisma's defaults (2 s wait, 5 s run) are short for handlers. */\nexport interface PrismaTransactionOptions {\n readonly maxWait?: number;\n readonly timeout?: number;\n}\n\n/**\n * Executor for Prisma, typed structurally so the package has no Prisma\n * dependency. The transaction handle is the client of an interactive\n * transaction: pass `tx` from `prisma.$transaction(async (tx) => ...)`.\n *\n * Not yet verified against a real Prisma client and database: it is covered by\n * unit tests with a structural fake only.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return {\n transaction: (work) => client.$transaction(work, transactionOptions),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? client).$queryRawUnsafe(sql, ...parameters)) as PostgresRow[];\n },\n };\n}\n"]}
package/dist/typeorm.cjs CHANGED
@@ -4,6 +4,7 @@
4
4
  function createTypeOrmExecutor(dataSource) {
5
5
  return {
6
6
  transaction: (work) => dataSource.transaction(work),
7
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
7
8
  async query(sql, parameters, transaction) {
8
9
  return await (transaction ?? dataSource).query(sql, [...parameters]);
9
10
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/typeorm/typeorm-executor.ts"],"names":[],"mappings":";;;AAkBO,SAAS,sBACd,UAAA,EACoC;AACpC,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,UAAA,CAAW,YAAY,IAAI,CAAA;AAAA,IAClD,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,MAAA,CAAO,eAAe,UAAA,EAAY,KAAA,CAAM,KAAK,CAAC,GAAG,UAAU,CAAC,CAAA;AAAA,IACtE;AAAA,GACF;AACF","file":"typeorm.cjs","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a TypeORM `DataSource` and an `EntityManager` have in common. */\nexport interface TypeOrmQueryable {\n query(query: string, parameters?: unknown[]): Promise<unknown>;\n}\n\n/** The part of a `DataSource` the executor uses. */\nexport interface TypeOrmDataSourceLike extends TypeOrmQueryable {\n transaction<T>(work: (manager: TypeOrmQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for TypeORM. The transaction handle is the `EntityManager` of a\n * transaction: pass `manager` from `dataSource.transaction(async (manager) => ...)`\n * (or the manager your transaction decorator provides). Every statement the\n * store sends is a plain SELECT or INSERT, for which `query` returns the rows.\n */\nexport function createTypeOrmExecutor(\n dataSource: TypeOrmDataSourceLike,\n): PostgresExecutor<TypeOrmQueryable> {\n return {\n transaction: (work) => dataSource.transaction(work),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? dataSource).query(sql, [...parameters])) as PostgresRow[];\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/typeorm/typeorm-executor.ts"],"names":[],"mappings":";;;AAkBO,SAAS,sBACd,UAAA,EACoC;AACpC,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,UAAA,CAAW,YAAY,IAAI,CAAA;AAAA;AAAA,IAElD,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,MAAA,CAAO,eAAe,UAAA,EAAY,KAAA,CAAM,KAAK,CAAC,GAAG,UAAU,CAAC,CAAA;AAAA,IACtE;AAAA,GACF;AACF","file":"typeorm.cjs","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a TypeORM `DataSource` and an `EntityManager` have in common. */\nexport interface TypeOrmQueryable {\n query(query: string, parameters?: unknown[]): Promise<unknown>;\n}\n\n/** The part of a `DataSource` the executor uses. */\nexport interface TypeOrmDataSourceLike extends TypeOrmQueryable {\n transaction<T>(work: (manager: TypeOrmQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for TypeORM. The transaction handle is the `EntityManager` of a\n * transaction: pass `manager` from `dataSource.transaction(async (manager) => ...)`\n * (or the manager your transaction decorator provides). Every statement the\n * store sends is a plain SELECT or INSERT, for which `query` returns the rows.\n */\nexport function createTypeOrmExecutor(\n dataSource: TypeOrmDataSourceLike,\n): PostgresExecutor<TypeOrmQueryable> {\n return {\n transaction: (work) => dataSource.transaction(work),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? dataSource).query(sql, [...parameters])) as PostgresRow[];\n },\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { P as PostgresExecutor } from './executor-CSM7ZOhz.cjs';
1
+ import { P as PostgresExecutor } from './executor-CfJgktC6.cjs';
2
2
 
3
3
  /** What a TypeORM `DataSource` and an `EntityManager` have in common. */
4
4
  interface TypeOrmQueryable {
package/dist/typeorm.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as PostgresExecutor } from './executor-CSM7ZOhz.js';
1
+ import { P as PostgresExecutor } from './executor-CfJgktC6.js';
2
2
 
3
3
  /** What a TypeORM `DataSource` and an `EntityManager` have in common. */
4
4
  interface TypeOrmQueryable {
package/dist/typeorm.js CHANGED
@@ -2,6 +2,7 @@
2
2
  function createTypeOrmExecutor(dataSource) {
3
3
  return {
4
4
  transaction: (work) => dataSource.transaction(work),
5
+ // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature
5
6
  async query(sql, parameters, transaction) {
6
7
  return await (transaction ?? dataSource).query(sql, [...parameters]);
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/typeorm/typeorm-executor.ts"],"names":[],"mappings":";AAkBO,SAAS,sBACd,UAAA,EACoC;AACpC,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,UAAA,CAAW,YAAY,IAAI,CAAA;AAAA,IAClD,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,MAAA,CAAO,eAAe,UAAA,EAAY,KAAA,CAAM,KAAK,CAAC,GAAG,UAAU,CAAC,CAAA;AAAA,IACtE;AAAA,GACF;AACF","file":"typeorm.js","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a TypeORM `DataSource` and an `EntityManager` have in common. */\nexport interface TypeOrmQueryable {\n query(query: string, parameters?: unknown[]): Promise<unknown>;\n}\n\n/** The part of a `DataSource` the executor uses. */\nexport interface TypeOrmDataSourceLike extends TypeOrmQueryable {\n transaction<T>(work: (manager: TypeOrmQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for TypeORM. The transaction handle is the `EntityManager` of a\n * transaction: pass `manager` from `dataSource.transaction(async (manager) => ...)`\n * (or the manager your transaction decorator provides). Every statement the\n * store sends is a plain SELECT or INSERT, for which `query` returns the rows.\n */\nexport function createTypeOrmExecutor(\n dataSource: TypeOrmDataSourceLike,\n): PostgresExecutor<TypeOrmQueryable> {\n return {\n transaction: (work) => dataSource.transaction(work),\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? dataSource).query(sql, [...parameters])) as PostgresRow[];\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/typeorm/typeorm-executor.ts"],"names":[],"mappings":";AAkBO,SAAS,sBACd,UAAA,EACoC;AACpC,EAAA,OAAO;AAAA,IACL,WAAA,EAAa,CAAC,IAAA,KAAS,UAAA,CAAW,YAAY,IAAI,CAAA;AAAA;AAAA,IAElD,MAAM,KAAA,CAAM,GAAA,EAAK,UAAA,EAA0C,WAAA,EAAa;AACtE,MAAA,OAAQ,MAAA,CAAO,eAAe,UAAA,EAAY,KAAA,CAAM,KAAK,CAAC,GAAG,UAAU,CAAC,CAAA;AAAA,IACtE;AAAA,GACF;AACF","file":"typeorm.js","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from '../executor.js';\n\n/** What a TypeORM `DataSource` and an `EntityManager` have in common. */\nexport interface TypeOrmQueryable {\n query(query: string, parameters?: unknown[]): Promise<unknown>;\n}\n\n/** The part of a `DataSource` the executor uses. */\nexport interface TypeOrmDataSourceLike extends TypeOrmQueryable {\n transaction<T>(work: (manager: TypeOrmQueryable) => Promise<T>): Promise<T>;\n}\n\n/**\n * Executor for TypeORM. The transaction handle is the `EntityManager` of a\n * transaction: pass `manager` from `dataSource.transaction(async (manager) => ...)`\n * (or the manager your transaction decorator provides). Every statement the\n * store sends is a plain SELECT or INSERT, for which `query` returns the rows.\n */\nexport function createTypeOrmExecutor(\n dataSource: TypeOrmDataSourceLike,\n): PostgresExecutor<TypeOrmQueryable> {\n return {\n transaction: (work) => dataSource.transaction(work),\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n async query(sql, parameters: readonly PostgresParameter[], transaction) {\n return (await (transaction ?? dataSource).query(sql, [...parameters])) as PostgresRow[];\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@relaybus/postgres",
3
- "version": "0.1.0",
4
- "description": "PostgreSQL event store for relaybus: transactional outbox with SKIP LOCKED leasing, for pg, Prisma, TypeORM, Knex, Kysely and Drizzle.",
3
+ "version": "0.3.0",
4
+ "description": "PostgreSQL event store for relaybus: a transactional outbox written in your own transaction (pg, Prisma, TypeORM, Drizzle, Knex, Kysely) with SKIP LOCKED leasing and per-key ordering.",
5
5
  "license": "MIT",
6
6
  "author": "Berkcan Şavur <berkcansavur@gmail.com>",
7
- "homepage": "https://github.com/berkcansavur/relaybus#readme",
7
+ "homepage": "https://berkcansavur.github.io/relaybus/packages/postgres",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/berkcansavur/relaybus.git",
@@ -12,13 +12,26 @@
12
12
  },
13
13
  "bugs": "https://github.com/berkcansavur/relaybus/issues",
14
14
  "keywords": [
15
- "event-bus",
16
- "outbox",
17
- "pg",
15
+ "relaybus",
18
16
  "postgres",
19
17
  "postgresql",
20
- "relaybus",
21
- "skip-locked"
18
+ "postgres-queue",
19
+ "pg",
20
+ "prisma",
21
+ "typeorm",
22
+ "drizzle",
23
+ "knex",
24
+ "kysely",
25
+ "skip-locked",
26
+ "transactional-outbox",
27
+ "outbox-pattern",
28
+ "outbox",
29
+ "event-bus",
30
+ "event-driven",
31
+ "reliable-events",
32
+ "at-least-once",
33
+ "exactly-once",
34
+ "dead-letter-queue"
22
35
  ],
23
36
  "type": "module",
24
37
  "sideEffects": false,
@@ -106,7 +119,7 @@
106
119
  "knex": ">=3.0.0",
107
120
  "typeorm": ">=0.3.0",
108
121
  "drizzle-orm": ">=0.36.0",
109
- "@relaybus/core": "^0.1.0"
122
+ "@relaybus/core": "^0.3.0"
110
123
  },
111
124
  "devDependencies": {
112
125
  "pg": "8.23.1",
@@ -117,8 +130,8 @@
117
130
  "knex": "3.3.0",
118
131
  "typeorm": "1.1.2",
119
132
  "drizzle-orm": "0.45.4",
120
- "@relaybus/core": "0.1.0",
121
- "@relaybus/testing": "0.1.0"
133
+ "@relaybus/testing": "0.3.0",
134
+ "@relaybus/core": "0.3.0"
122
135
  },
123
136
  "typesVersions": {
124
137
  "*": {
@@ -1,24 +0,0 @@
1
- /** Values the store binds: always text, numbers or null (documents travel as JSON text). */
2
- type PostgresParameter = string | number | null;
3
- type PostgresRow = Readonly<Record<string, unknown>>;
4
- /**
5
- * The only thing {@link PostgresEventStore} needs from a database library:
6
- * run a parameterized statement, optionally on a transaction handle, and open
7
- * a transaction. Implement it to support another client; adapters for `pg`,
8
- * Kysely, Knex, TypeORM, Drizzle and Prisma ship with the package.
9
- *
10
- * Contract:
11
- * - SQL uses PostgreSQL placeholders (`$1`, `$2`, ...). Adapters translate if
12
- * their library needs another syntax.
13
- * - Every statement the store sends returns its rows (or none), so `query`
14
- * always resolves to an array of rows keyed by column name.
15
- * - Without a `transaction`, a statement runs on its own connection in
16
- * autocommit mode, in READ COMMITTED isolation.
17
- * - `transaction` commits when `work` resolves and rolls back when it rejects.
18
- */
19
- interface PostgresExecutor<TTransaction> {
20
- transaction<T>(work: (transaction: TTransaction) => Promise<T>): Promise<T>;
21
- query(sql: string, parameters: readonly PostgresParameter[], transaction?: TTransaction): Promise<readonly PostgresRow[]>;
22
- }
23
-
24
- export type { PostgresExecutor as P, PostgresParameter as a, PostgresRow as b };
@@ -1,24 +0,0 @@
1
- /** Values the store binds: always text, numbers or null (documents travel as JSON text). */
2
- type PostgresParameter = string | number | null;
3
- type PostgresRow = Readonly<Record<string, unknown>>;
4
- /**
5
- * The only thing {@link PostgresEventStore} needs from a database library:
6
- * run a parameterized statement, optionally on a transaction handle, and open
7
- * a transaction. Implement it to support another client; adapters for `pg`,
8
- * Kysely, Knex, TypeORM, Drizzle and Prisma ship with the package.
9
- *
10
- * Contract:
11
- * - SQL uses PostgreSQL placeholders (`$1`, `$2`, ...). Adapters translate if
12
- * their library needs another syntax.
13
- * - Every statement the store sends returns its rows (or none), so `query`
14
- * always resolves to an array of rows keyed by column name.
15
- * - Without a `transaction`, a statement runs on its own connection in
16
- * autocommit mode, in READ COMMITTED isolation.
17
- * - `transaction` commits when `work` resolves and rolls back when it rejects.
18
- */
19
- interface PostgresExecutor<TTransaction> {
20
- transaction<T>(work: (transaction: TTransaction) => Promise<T>): Promise<T>;
21
- query(sql: string, parameters: readonly PostgresParameter[], transaction?: TTransaction): Promise<readonly PostgresRow[]>;
22
- }
23
-
24
- export type { PostgresExecutor as P, PostgresParameter as a, PostgresRow as b };