@relaybus/postgres 0.3.1 → 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.
- package/README.md +46 -24
- package/dist/drizzle.d.cts +3 -2
- package/dist/drizzle.d.ts +3 -2
- package/dist/index.cjs +155 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -6
- package/dist/index.d.ts +20 -6
- package/dist/index.js +155 -44
- package/dist/index.js.map +1 -1
- package/dist/knex.d.cts +3 -2
- package/dist/knex.d.ts +3 -2
- package/dist/kysely.d.cts +3 -2
- package/dist/kysely.d.ts +3 -2
- package/dist/prisma.cjs.map +1 -1
- package/dist/prisma.d.cts +4 -4
- package/dist/prisma.d.ts +4 -4
- package/dist/prisma.js.map +1 -1
- package/dist/typeorm.d.cts +3 -2
- package/dist/typeorm.d.ts +3 -2
- package/package.json +20 -12
package/dist/knex.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostgresRow, PostgresExecutor } from './index.cjs';
|
|
2
2
|
|
|
3
3
|
/** What a Knex instance and a Knex transaction have in common. */
|
|
4
4
|
interface KnexQueryable {
|
|
@@ -16,4 +16,5 @@ interface KnexLike extends KnexQueryable {
|
|
|
16
16
|
*/
|
|
17
17
|
declare function createKnexExecutor(knex: KnexLike): PostgresExecutor<KnexQueryable>;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { createKnexExecutor };
|
|
20
|
+
export type { KnexLike, KnexQueryable };
|
package/dist/knex.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostgresRow, PostgresExecutor } from './index.js';
|
|
2
2
|
|
|
3
3
|
/** What a Knex instance and a Knex transaction have in common. */
|
|
4
4
|
interface KnexQueryable {
|
|
@@ -16,4 +16,5 @@ interface KnexLike extends KnexQueryable {
|
|
|
16
16
|
*/
|
|
17
17
|
declare function createKnexExecutor(knex: KnexLike): PostgresExecutor<KnexQueryable>;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { createKnexExecutor };
|
|
20
|
+
export type { KnexLike, KnexQueryable };
|
package/dist/kysely.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CompiledQuery } from 'kysely';
|
|
2
|
-
import {
|
|
2
|
+
import { PostgresExecutor } from './index.cjs';
|
|
3
3
|
|
|
4
4
|
/** What a Kysely instance and a Kysely transaction have in common. */
|
|
5
5
|
interface KyselyQueryable {
|
|
@@ -20,4 +20,5 @@ interface KyselyLike extends KyselyQueryable {
|
|
|
20
20
|
*/
|
|
21
21
|
declare function createKyselyExecutor(database: KyselyLike): PostgresExecutor<KyselyQueryable>;
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { createKyselyExecutor };
|
|
24
|
+
export type { KyselyLike, KyselyQueryable };
|
package/dist/kysely.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CompiledQuery } from 'kysely';
|
|
2
|
-
import {
|
|
2
|
+
import { PostgresExecutor } from './index.js';
|
|
3
3
|
|
|
4
4
|
/** What a Kysely instance and a Kysely transaction have in common. */
|
|
5
5
|
interface KyselyQueryable {
|
|
@@ -20,4 +20,5 @@ interface KyselyLike extends KyselyQueryable {
|
|
|
20
20
|
*/
|
|
21
21
|
declare function createKyselyExecutor(database: KyselyLike): PostgresExecutor<KyselyQueryable>;
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { createKyselyExecutor };
|
|
24
|
+
export type { KyselyLike, KyselyQueryable };
|
package/dist/prisma.cjs.map
CHANGED
|
@@ -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;;;
|
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostgresExecutor } from './index.cjs';
|
|
2
2
|
|
|
3
3
|
/** What a `PrismaClient` and an interactive-transaction client have in common. */
|
|
4
4
|
interface PrismaQueryable {
|
|
@@ -18,9 +18,9 @@ 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
|
-
*
|
|
22
|
-
* unit tests with a structural fake only.
|
|
21
|
+
* Integration-tested with generated Prisma Clients 5, 6 and 7 on the `@prisma/adapter-pg` driver adapter.
|
|
23
22
|
*/
|
|
24
23
|
declare function createPrismaExecutor(client: PrismaClientLike, transactionOptions?: PrismaTransactionOptions): PostgresExecutor<PrismaQueryable>;
|
|
25
24
|
|
|
26
|
-
export {
|
|
25
|
+
export { createPrismaExecutor };
|
|
26
|
+
export type { PrismaClientLike, PrismaQueryable, PrismaTransactionOptions };
|
package/dist/prisma.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostgresExecutor } from './index.js';
|
|
2
2
|
|
|
3
3
|
/** What a `PrismaClient` and an interactive-transaction client have in common. */
|
|
4
4
|
interface PrismaQueryable {
|
|
@@ -18,9 +18,9 @@ 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
|
-
*
|
|
22
|
-
* unit tests with a structural fake only.
|
|
21
|
+
* Integration-tested with generated Prisma Clients 5, 6 and 7 on the `@prisma/adapter-pg` driver adapter.
|
|
23
22
|
*/
|
|
24
23
|
declare function createPrismaExecutor(client: PrismaClientLike, transactionOptions?: PrismaTransactionOptions): PostgresExecutor<PrismaQueryable>;
|
|
25
24
|
|
|
26
|
-
export {
|
|
25
|
+
export { createPrismaExecutor };
|
|
26
|
+
export type { PrismaClientLike, PrismaQueryable, PrismaTransactionOptions };
|
package/dist/prisma.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/prisma/prisma-executor.ts"],"names":[],"mappings":";;;
|
|
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/dist/typeorm.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostgresExecutor } from './index.cjs';
|
|
2
2
|
|
|
3
3
|
/** What a TypeORM `DataSource` and an `EntityManager` have in common. */
|
|
4
4
|
interface TypeOrmQueryable {
|
|
@@ -16,4 +16,5 @@ interface TypeOrmDataSourceLike extends TypeOrmQueryable {
|
|
|
16
16
|
*/
|
|
17
17
|
declare function createTypeOrmExecutor(dataSource: TypeOrmDataSourceLike): PostgresExecutor<TypeOrmQueryable>;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { createTypeOrmExecutor };
|
|
20
|
+
export type { TypeOrmDataSourceLike, TypeOrmQueryable };
|
package/dist/typeorm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostgresExecutor } from './index.js';
|
|
2
2
|
|
|
3
3
|
/** What a TypeORM `DataSource` and an `EntityManager` have in common. */
|
|
4
4
|
interface TypeOrmQueryable {
|
|
@@ -16,4 +16,5 @@ interface TypeOrmDataSourceLike extends TypeOrmQueryable {
|
|
|
16
16
|
*/
|
|
17
17
|
declare function createTypeOrmExecutor(dataSource: TypeOrmDataSourceLike): PostgresExecutor<TypeOrmQueryable>;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { createTypeOrmExecutor };
|
|
20
|
+
export type { TypeOrmDataSourceLike, TypeOrmQueryable };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relaybus/postgres",
|
|
3
|
-
"version": "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>",
|
|
@@ -114,24 +114,29 @@
|
|
|
114
114
|
"provenance": true
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
|
-
"
|
|
118
|
-
"kysely": ">=0.27.0",
|
|
117
|
+
"drizzle-orm": ">=0.36.0",
|
|
119
118
|
"knex": ">=3.0.0",
|
|
119
|
+
"kysely": ">=0.27.0",
|
|
120
|
+
"pg": "^8.11.0",
|
|
120
121
|
"typeorm": ">=0.3.0",
|
|
121
|
-
"
|
|
122
|
-
"@relaybus/core": "^0.
|
|
122
|
+
"@prisma/client": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
123
|
+
"@relaybus/core": "^0.4.1"
|
|
123
124
|
},
|
|
124
125
|
"devDependencies": {
|
|
125
|
-
"pg": "
|
|
126
|
-
"@
|
|
126
|
+
"@prisma/adapter-pg": "7.10.1",
|
|
127
|
+
"@prisma/client": "7.10.1",
|
|
127
128
|
"@testcontainers/postgresql": "12.2.1",
|
|
128
|
-
"
|
|
129
|
-
"
|
|
129
|
+
"@types/pg": "8.23.1",
|
|
130
|
+
"drizzle-orm": "0.45.4",
|
|
130
131
|
"knex": "3.3.0",
|
|
132
|
+
"kysely": "0.29.7",
|
|
133
|
+
"pg": "8.23.1",
|
|
134
|
+
"prisma": "7.10.1",
|
|
135
|
+
"relaybus-postgres-0.4.0": "npm:@relaybus/postgres@0.4.0",
|
|
136
|
+
"testcontainers": "12.2.1",
|
|
131
137
|
"typeorm": "1.1.2",
|
|
132
|
-
"
|
|
133
|
-
"@relaybus/
|
|
134
|
-
"@relaybus/testing": "0.3.1"
|
|
138
|
+
"@relaybus/core": "0.4.1",
|
|
139
|
+
"@relaybus/testing": "0.4.1"
|
|
135
140
|
},
|
|
136
141
|
"typesVersions": {
|
|
137
142
|
"*": {
|
|
@@ -164,6 +169,9 @@
|
|
|
164
169
|
},
|
|
165
170
|
"drizzle-orm": {
|
|
166
171
|
"optional": true
|
|
172
|
+
},
|
|
173
|
+
"@prisma/client": {
|
|
174
|
+
"optional": true
|
|
167
175
|
}
|
|
168
176
|
},
|
|
169
177
|
"scripts": {
|