@relaybus/postgres 0.3.0 → 0.4.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/index.d.cts CHANGED
@@ -190,11 +190,23 @@ interface PostgresConnectionOptions extends PostgresEventStoreSettings {
190
190
  /** Use another database library through an adapter. The store never closes it. */
191
191
  interface PostgresExecutorOptions<TTransaction> extends PostgresEventStoreSettings {
192
192
  readonly executor: PostgresExecutor<TTransaction>;
193
- readonly pool?: never;
193
+ /**
194
+ * Optional `pg` pool on the same database, for example the one an ORM's `pg` driver adapter uses
195
+ * (`new PrismaPg(pool)`, Kysely's `PostgresDialect`, Drizzle's `node-postgres`). The store never
196
+ * closes it. With it:
197
+ * - the statements the store sends outside a transaction (the dispatcher's claims, completions and
198
+ * lease renewals, maintenance) run on it as prepared statements (`preparedStatements`), which ORM
199
+ * raw queries cannot do; statements in a transaction still go through `executor`;
200
+ * - with `wakeUp: 'notify'` the store listens for wake-ups with its connection settings, so a
201
+ * delivery published in an ORM transaction is dispatched right after that transaction commits,
202
+ * instead of after a fixed delay or the next poll.
203
+ */
204
+ readonly pool?: Pool;
194
205
  readonly connectionString?: never;
195
206
  readonly poolConfig?: never;
196
207
  }
197
208
  type PostgresEventStoreOptions<TTransaction = PoolClient> = PostgresPoolOptions | PostgresConnectionOptions | PostgresExecutorOptions<TTransaction>;
209
+
198
210
  /**
199
211
  * PostgreSQL {@link EventStore} (PostgreSQL 13 or newer).
200
212
  *
@@ -329,4 +341,5 @@ declare class ReconcileFailedError extends RelayBusError {
329
341
  readonly code: string;
330
342
  }
331
343
 
332
- export { PgExecutor, type PgExecutorOptions, type PostgresConnectionOptions, PostgresEventStore, type PostgresEventStoreOptions, type PostgresEventStoreSettings, PostgresExecutor, type PostgresExecutorOptions, type PostgresNames, PostgresParameter, type PostgresPoolOptions, PostgresQueryOptions, PostgresRow, type PostgresSchemaOptions, type PostgresWakeUp, ReconcileFailedError, createPostgresSchemaSql, createPostgresSchemaStatements, resolvePostgresNames };
344
+ export { PgExecutor, PostgresEventStore, PostgresExecutor, PostgresParameter, PostgresQueryOptions, PostgresRow, ReconcileFailedError, createPostgresSchemaSql, createPostgresSchemaStatements, resolvePostgresNames };
345
+ export type { PgExecutorOptions, PostgresConnectionOptions, PostgresEventStoreOptions, PostgresEventStoreSettings, PostgresExecutorOptions, PostgresNames, PostgresPoolOptions, PostgresSchemaOptions, PostgresWakeUp };
package/dist/index.d.ts CHANGED
@@ -190,11 +190,23 @@ interface PostgresConnectionOptions extends PostgresEventStoreSettings {
190
190
  /** Use another database library through an adapter. The store never closes it. */
191
191
  interface PostgresExecutorOptions<TTransaction> extends PostgresEventStoreSettings {
192
192
  readonly executor: PostgresExecutor<TTransaction>;
193
- readonly pool?: never;
193
+ /**
194
+ * Optional `pg` pool on the same database, for example the one an ORM's `pg` driver adapter uses
195
+ * (`new PrismaPg(pool)`, Kysely's `PostgresDialect`, Drizzle's `node-postgres`). The store never
196
+ * closes it. With it:
197
+ * - the statements the store sends outside a transaction (the dispatcher's claims, completions and
198
+ * lease renewals, maintenance) run on it as prepared statements (`preparedStatements`), which ORM
199
+ * raw queries cannot do; statements in a transaction still go through `executor`;
200
+ * - with `wakeUp: 'notify'` the store listens for wake-ups with its connection settings, so a
201
+ * delivery published in an ORM transaction is dispatched right after that transaction commits,
202
+ * instead of after a fixed delay or the next poll.
203
+ */
204
+ readonly pool?: Pool;
194
205
  readonly connectionString?: never;
195
206
  readonly poolConfig?: never;
196
207
  }
197
208
  type PostgresEventStoreOptions<TTransaction = PoolClient> = PostgresPoolOptions | PostgresConnectionOptions | PostgresExecutorOptions<TTransaction>;
209
+
198
210
  /**
199
211
  * PostgreSQL {@link EventStore} (PostgreSQL 13 or newer).
200
212
  *
@@ -329,4 +341,5 @@ declare class ReconcileFailedError extends RelayBusError {
329
341
  readonly code: string;
330
342
  }
331
343
 
332
- export { PgExecutor, type PgExecutorOptions, type PostgresConnectionOptions, PostgresEventStore, type PostgresEventStoreOptions, type PostgresEventStoreSettings, PostgresExecutor, type PostgresExecutorOptions, type PostgresNames, PostgresParameter, type PostgresPoolOptions, PostgresQueryOptions, PostgresRow, type PostgresSchemaOptions, type PostgresWakeUp, ReconcileFailedError, createPostgresSchemaSql, createPostgresSchemaStatements, resolvePostgresNames };
344
+ export { PgExecutor, PostgresEventStore, PostgresExecutor, PostgresParameter, PostgresQueryOptions, PostgresRow, ReconcileFailedError, createPostgresSchemaSql, createPostgresSchemaStatements, resolvePostgresNames };
345
+ export type { PgExecutorOptions, PostgresConnectionOptions, PostgresEventStoreOptions, PostgresEventStoreSettings, PostgresExecutorOptions, PostgresNames, PostgresPoolOptions, PostgresSchemaOptions, PostgresWakeUp };