@relaybus/postgres 0.4.0 → 0.4.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/adapter-executor.ts","../src/prisma/prisma-executor.ts"],"names":[],"mappings":";;;AAqBO,SAAS,gBACd,MAAA,EAC8B;AAC9B,EAAA,OAAO;AAAA,IACL,aAAa,MAAA,CAAO,WAAA;AAAA;AAAA,IAEpB,KAAA,EAAO,CAAC,GAAA,EAAK,UAAA,EAAY,WAAA,KACvB,MAAA,CAAO,GAAA,CAAI,WAAA,IAAe,MAAA,CAAO,IAAA,EAAM,EAAE,GAAA,EAAK,YAAY;AAAA,GAC9D;AACF;;;ACDO,SAAS,oBAAA,CACd,MAAA,EACA,kBAAA,GAA+C,EAAC,EACb;AACnC,EAAA,OAAO,eAAA,CAAiC;AAAA,IACtC,IAAA,EAAM,MAAA;AAAA,IACN,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA,IACnE,MAAM,GAAA,CAAI,SAAA,EAAW,EAAE,GAAA,EAAK,YAAW,EAAG;AACxC,MAAA,OAAQ,MAAM,SAAA,CAAU,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH","file":"prisma.cjs","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from './executor.js';\n\n/** One statement the store sends, with its positional parameters. */\nexport type AdapterStatement = {\n readonly sql: string;\n readonly parameters: readonly PostgresParameter[];\n};\n\n/** What an adapter supplies: where statements run outside a transaction, and how it runs one. */\nexport type AdapterClient<TQueryable> = {\n /** The instance itself: statements outside a transaction run on it. */\n readonly root: TQueryable;\n readonly transaction: PostgresExecutor<TQueryable>['transaction'];\n /** Runs one statement on the caller's transaction, else on the root. */\n readonly run: (queryable: TQueryable, statement: AdapterStatement) => Promise<PostgresRow[]>;\n};\n\n/**\n * The executor every library adapter shares: a statement runs on the transaction it is given,\n * else on the root instance. An adapter supplies only how its library runs one statement.\n */\nexport function adapterExecutor<TQueryable>(\n client: AdapterClient<TQueryable>,\n): PostgresExecutor<TQueryable> {\n return {\n transaction: client.transaction,\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n query: (sql, parameters, transaction) =>\n client.run(transaction ?? client.root, { sql, parameters }),\n };\n}\n","import { adapterExecutor } from '../adapter-executor.js';\nimport type { PostgresExecutor, 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 * Integration-tested with a generated Prisma Client 7 on the `@prisma/adapter-pg` driver adapter.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return adapterExecutor<PrismaQueryable>({\n root: client,\n transaction: (work) => client.$transaction(work, transactionOptions),\n async run(queryable, { sql, parameters }) {\n return (await queryable.$queryRawUnsafe(sql, ...parameters)) as PostgresRow[];\n },\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/adapter-executor.ts","../src/prisma/prisma-executor.ts"],"names":[],"mappings":";;;AAqBO,SAAS,gBACd,MAAA,EAC8B;AAC9B,EAAA,OAAO;AAAA,IACL,aAAa,MAAA,CAAO,WAAA;AAAA;AAAA,IAEpB,KAAA,EAAO,CAAC,GAAA,EAAK,UAAA,EAAY,WAAA,KACvB,MAAA,CAAO,GAAA,CAAI,WAAA,IAAe,MAAA,CAAO,IAAA,EAAM,EAAE,GAAA,EAAK,YAAY;AAAA,GAC9D;AACF;;;ACDO,SAAS,oBAAA,CACd,MAAA,EACA,kBAAA,GAA+C,EAAC,EACb;AACnC,EAAA,OAAO,eAAA,CAAiC;AAAA,IACtC,IAAA,EAAM,MAAA;AAAA,IACN,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA,IACnE,MAAM,GAAA,CAAI,SAAA,EAAW,EAAE,GAAA,EAAK,YAAW,EAAG;AACxC,MAAA,OAAQ,MAAM,SAAA,CAAU,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH","file":"prisma.cjs","sourcesContent":["import type { PostgresExecutor, PostgresParameter, PostgresRow } from './executor.js';\n\n/** One statement the store sends, with its positional parameters. */\nexport type AdapterStatement = {\n readonly sql: string;\n readonly parameters: readonly PostgresParameter[];\n};\n\n/** What an adapter supplies: where statements run outside a transaction, and how it runs one. */\nexport type AdapterClient<TQueryable> = {\n /** The instance itself: statements outside a transaction run on it. */\n readonly root: TQueryable;\n readonly transaction: PostgresExecutor<TQueryable>['transaction'];\n /** Runs one statement on the caller's transaction, else on the root. */\n readonly run: (queryable: TQueryable, statement: AdapterStatement) => Promise<PostgresRow[]>;\n};\n\n/**\n * The executor every library adapter shares: a statement runs on the transaction it is given,\n * else on the root instance. An adapter supplies only how its library runs one statement.\n */\nexport function adapterExecutor<TQueryable>(\n client: AdapterClient<TQueryable>,\n): PostgresExecutor<TQueryable> {\n return {\n transaction: client.transaction,\n // eslint-disable-next-line relaybus/max-two-params -- PostgresExecutor port signature\n query: (sql, parameters, transaction) =>\n client.run(transaction ?? client.root, { sql, parameters }),\n };\n}\n","import { adapterExecutor } from '../adapter-executor.js';\nimport type { PostgresExecutor, 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 * Integration-tested with generated Prisma Clients 5, 6 and 7 on the `@prisma/adapter-pg` driver adapter.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return adapterExecutor<PrismaQueryable>({\n root: client,\n transaction: (work) => client.$transaction(work, transactionOptions),\n async run(queryable, { sql, parameters }) {\n return (await queryable.$queryRawUnsafe(sql, ...parameters)) as PostgresRow[];\n },\n });\n}\n"]}
package/dist/prisma.d.cts CHANGED
@@ -18,7 +18,7 @@ interface PrismaTransactionOptions {
18
18
  * dependency. The transaction handle is the client of an interactive
19
19
  * transaction: pass `tx` from `prisma.$transaction(async (tx) => ...)`.
20
20
  *
21
- * Integration-tested with a generated Prisma Client 7 on the `@prisma/adapter-pg` driver adapter.
21
+ * Integration-tested with generated Prisma Clients 5, 6 and 7 on the `@prisma/adapter-pg` driver adapter.
22
22
  */
23
23
  declare function createPrismaExecutor(client: PrismaClientLike, transactionOptions?: PrismaTransactionOptions): PostgresExecutor<PrismaQueryable>;
24
24
 
package/dist/prisma.d.ts CHANGED
@@ -18,7 +18,7 @@ interface PrismaTransactionOptions {
18
18
  * dependency. The transaction handle is the client of an interactive
19
19
  * transaction: pass `tx` from `prisma.$transaction(async (tx) => ...)`.
20
20
  *
21
- * Integration-tested with a generated Prisma Client 7 on the `@prisma/adapter-pg` driver adapter.
21
+ * Integration-tested with generated Prisma Clients 5, 6 and 7 on the `@prisma/adapter-pg` driver adapter.
22
22
  */
23
23
  declare function createPrismaExecutor(client: PrismaClientLike, transactionOptions?: PrismaTransactionOptions): PostgresExecutor<PrismaQueryable>;
24
24
 
@@ -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,eAAA,CAAiC;AAAA,IACtC,IAAA,EAAM,MAAA;AAAA,IACN,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA,IACnE,MAAM,GAAA,CAAI,SAAA,EAAW,EAAE,GAAA,EAAK,YAAW,EAAG;AACxC,MAAA,OAAQ,MAAM,SAAA,CAAU,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH","file":"prisma.js","sourcesContent":["import { adapterExecutor } from '../adapter-executor.js';\nimport type { PostgresExecutor, 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 * Integration-tested with a generated Prisma Client 7 on the `@prisma/adapter-pg` driver adapter.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return adapterExecutor<PrismaQueryable>({\n root: client,\n transaction: (work) => client.$transaction(work, transactionOptions),\n async run(queryable, { sql, parameters }) {\n return (await queryable.$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,eAAA,CAAiC;AAAA,IACtC,IAAA,EAAM,MAAA;AAAA,IACN,aAAa,CAAC,IAAA,KAAS,MAAA,CAAO,YAAA,CAAa,MAAM,kBAAkB,CAAA;AAAA,IACnE,MAAM,GAAA,CAAI,SAAA,EAAW,EAAE,GAAA,EAAK,YAAW,EAAG;AACxC,MAAA,OAAQ,MAAM,SAAA,CAAU,eAAA,CAAgB,GAAA,EAAK,GAAG,UAAU,CAAA;AAAA,IAC5D;AAAA,GACD,CAAA;AACH","file":"prisma.js","sourcesContent":["import { adapterExecutor } from '../adapter-executor.js';\nimport type { PostgresExecutor, 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 * Integration-tested with generated Prisma Clients 5, 6 and 7 on the `@prisma/adapter-pg` driver adapter.\n */\nexport function createPrismaExecutor(\n client: PrismaClientLike,\n transactionOptions: PrismaTransactionOptions = {},\n): PostgresExecutor<PrismaQueryable> {\n return adapterExecutor<PrismaQueryable>({\n root: client,\n transaction: (work) => client.$transaction(work, transactionOptions),\n async run(queryable, { sql, parameters }) {\n return (await queryable.$queryRawUnsafe(sql, ...parameters)) as PostgresRow[];\n },\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relaybus/postgres",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
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>",
@@ -119,8 +119,8 @@
119
119
  "kysely": ">=0.27.0",
120
120
  "pg": "^8.11.0",
121
121
  "typeorm": ">=0.3.0",
122
- "@prisma/client": "^6.0.0 || ^7.0.0",
123
- "@relaybus/core": "^0.4.0"
122
+ "@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0",
123
+ "@relaybus/core": "^0.4.1"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@prisma/adapter-pg": "7.10.1",
@@ -132,10 +132,11 @@
132
132
  "kysely": "0.29.7",
133
133
  "pg": "8.23.1",
134
134
  "prisma": "7.10.1",
135
+ "relaybus-postgres-0.4.0": "npm:@relaybus/postgres@0.4.0",
135
136
  "testcontainers": "12.2.1",
136
137
  "typeorm": "1.1.2",
137
- "@relaybus/core": "0.4.0",
138
- "@relaybus/testing": "0.4.0"
138
+ "@relaybus/core": "0.4.1",
139
+ "@relaybus/testing": "0.4.1"
139
140
  },
140
141
  "typesVersions": {
141
142
  "*": {