@dudousxd/nestjs-durable-store-mikro-orm 0.37.0 → 0.39.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
@@ -160,8 +160,25 @@ declare class ScheduleEntity {
160
160
  createdAt: Date;
161
161
  updatedAt: Date;
162
162
  }
163
+ /**
164
+ * Validate a durable `schema` option: an identifier of at most 63 characters. Returns it, or
165
+ * `undefined` when none is set.
166
+ */
167
+ declare function durableSchemaName(schema: string | undefined): string | undefined;
168
+ /**
169
+ * Build the durable MikroORM entity schemas with column names pinned per `naming` (default
170
+ * `'snake_case'`). Register the result in your MikroORM config / `MikroOrmModule.forFeature`.
171
+ *
172
+ * ```ts
173
+ * entities: durableEntities({ naming: 'snake_case' })
174
+ * ```
175
+ *
176
+ * `schema` puts every durable table in that database schema (Postgres) or database (MySQL):
177
+ * `durableEntities({ schema: 'durable' })`. Not supported on SQLite.
178
+ */
163
179
  declare function durableEntities(options?: {
164
180
  naming?: DurableColumnNaming;
181
+ schema?: string;
165
182
  }): EntitySchema[];
166
183
  /** Durable entity schemas with the canonical `'snake_case'` column names. */
167
184
  declare const ENTITIES: EntitySchema<any, never, _mikro_orm_core.EntityCtor<any>>[];
@@ -192,6 +209,12 @@ interface DurableSchemaLogger {
192
209
  interface EnsureMikroOrmDurableSchemaOptions {
193
210
  /** Sink for the schema-repair warning. Defaults to `console`. */
194
211
  logger?: DurableSchemaLogger | undefined;
212
+ /**
213
+ * The schema (Postgres) or database (MySQL) of the durable tables. Defaults to the one the
214
+ * registered `durableEntities({ schema })` carry; when set, it must match them. Created when
215
+ * missing.
216
+ */
217
+ schema?: string | undefined;
195
218
  /**
196
219
  * MySQL only: the largest estimated row count (`information_schema.tables.table_rows`) of an
197
220
  * existing durable table on which the boot-time heal will run a column TYPE change. MySQL runs a
@@ -223,6 +246,12 @@ declare function mikroOrmDeferredAlterWarning(deferred: ReadonlyArray<{
223
246
  * noise, and a silent repair hides a migration-managed schema that has drifted from the library.
224
247
  */
225
248
  declare function mikroOrmSchemaRepairWarning(repairs: readonly string[]): string;
249
+ /**
250
+ * The schema (Postgres) or database (MySQL) the durable tables live in, read from the registered
251
+ * entities, or `undefined` when they are unqualified. A `configured` schema (the store's `schema`
252
+ * option) must match the entities, and SQLite takes none.
253
+ */
254
+ declare function durableTableSchema(orm: MikroORM, configured?: string | undefined): string | undefined;
226
255
  /**
227
256
  * Idempotently create/extend ONLY the durable tables (additive — never drops). Safe to run on every
228
257
  * boot (auto-schema) and from a MikroORM migration when you disable auto-schema:
@@ -281,6 +310,13 @@ interface MikroOrmStateStoreOptions {
281
310
  * `blockingAlterRowLimit` on `ensureMikroOrmDurableSchema`.
282
311
  */
283
312
  schemaBlockingAlterRowLimit?: number | undefined;
313
+ /**
314
+ * The schema (Postgres) or database (MySQL) the durable tables live in. Register the entities with
315
+ * the same one (`durableEntities({ schema })`); a mismatch fails at `ensureSchema()`. Every
316
+ * statement names it, so it works behind PgBouncer in transaction mode; never set `search_path`
317
+ * for this. Default: whatever the registered entities carry (unqualified unless built with one).
318
+ */
319
+ schema?: string | undefined;
284
320
  }
285
321
  /**
286
322
  * MikroORM-backed `StateStore`. Works on any MikroORM driver — Postgres, MySQL, SQLite (tested);
@@ -479,4 +515,4 @@ declare class MikroOrmStateStore implements StateStore {
479
515
  removeBufferedEvent(id: string): Promise<boolean>;
480
516
  }
481
517
 
482
- export { BufferedEventEntity, BufferedEventRepository, BufferedSignalEntity, BufferedSignalRepository, DATETIME_PRECISION, DEFAULT_BLOCKING_ALTER_ROW_LIMIT, type DurableColumnNaming, type DurableSchemaLogger, ENTITIES, type EnsureMikroOrmDurableSchemaOptions, MikroOrmStateStore, type MikroOrmStateStoreOptions, RunAttributeEntity, RunAttributeRepository, ScheduleEntity, ScheduleRepository, SignalIdEntity, SignalIdRepository, SignalWaiterEntity, SignalWaiterRepository, StepCheckpointEntity, StepCheckpointRepository, WorkflowRunEntity, WorkflowRunRepository, durableEntities, durableManagedTables, ensureMikroOrmDurableSchema, mikroOrmDeferredAlterWarning, mikroOrmSchemaRepairWarning };
518
+ export { BufferedEventEntity, BufferedEventRepository, BufferedSignalEntity, BufferedSignalRepository, DATETIME_PRECISION, DEFAULT_BLOCKING_ALTER_ROW_LIMIT, type DurableColumnNaming, type DurableSchemaLogger, ENTITIES, type EnsureMikroOrmDurableSchemaOptions, MikroOrmStateStore, type MikroOrmStateStoreOptions, RunAttributeEntity, RunAttributeRepository, ScheduleEntity, ScheduleRepository, SignalIdEntity, SignalIdRepository, SignalWaiterEntity, SignalWaiterRepository, StepCheckpointEntity, StepCheckpointRepository, WorkflowRunEntity, WorkflowRunRepository, durableEntities, durableManagedTables, durableSchemaName, durableTableSchema, ensureMikroOrmDurableSchema, mikroOrmDeferredAlterWarning, mikroOrmSchemaRepairWarning };
package/dist/index.d.ts CHANGED
@@ -160,8 +160,25 @@ declare class ScheduleEntity {
160
160
  createdAt: Date;
161
161
  updatedAt: Date;
162
162
  }
163
+ /**
164
+ * Validate a durable `schema` option: an identifier of at most 63 characters. Returns it, or
165
+ * `undefined` when none is set.
166
+ */
167
+ declare function durableSchemaName(schema: string | undefined): string | undefined;
168
+ /**
169
+ * Build the durable MikroORM entity schemas with column names pinned per `naming` (default
170
+ * `'snake_case'`). Register the result in your MikroORM config / `MikroOrmModule.forFeature`.
171
+ *
172
+ * ```ts
173
+ * entities: durableEntities({ naming: 'snake_case' })
174
+ * ```
175
+ *
176
+ * `schema` puts every durable table in that database schema (Postgres) or database (MySQL):
177
+ * `durableEntities({ schema: 'durable' })`. Not supported on SQLite.
178
+ */
163
179
  declare function durableEntities(options?: {
164
180
  naming?: DurableColumnNaming;
181
+ schema?: string;
165
182
  }): EntitySchema[];
166
183
  /** Durable entity schemas with the canonical `'snake_case'` column names. */
167
184
  declare const ENTITIES: EntitySchema<any, never, _mikro_orm_core.EntityCtor<any>>[];
@@ -192,6 +209,12 @@ interface DurableSchemaLogger {
192
209
  interface EnsureMikroOrmDurableSchemaOptions {
193
210
  /** Sink for the schema-repair warning. Defaults to `console`. */
194
211
  logger?: DurableSchemaLogger | undefined;
212
+ /**
213
+ * The schema (Postgres) or database (MySQL) of the durable tables. Defaults to the one the
214
+ * registered `durableEntities({ schema })` carry; when set, it must match them. Created when
215
+ * missing.
216
+ */
217
+ schema?: string | undefined;
195
218
  /**
196
219
  * MySQL only: the largest estimated row count (`information_schema.tables.table_rows`) of an
197
220
  * existing durable table on which the boot-time heal will run a column TYPE change. MySQL runs a
@@ -223,6 +246,12 @@ declare function mikroOrmDeferredAlterWarning(deferred: ReadonlyArray<{
223
246
  * noise, and a silent repair hides a migration-managed schema that has drifted from the library.
224
247
  */
225
248
  declare function mikroOrmSchemaRepairWarning(repairs: readonly string[]): string;
249
+ /**
250
+ * The schema (Postgres) or database (MySQL) the durable tables live in, read from the registered
251
+ * entities, or `undefined` when they are unqualified. A `configured` schema (the store's `schema`
252
+ * option) must match the entities, and SQLite takes none.
253
+ */
254
+ declare function durableTableSchema(orm: MikroORM, configured?: string | undefined): string | undefined;
226
255
  /**
227
256
  * Idempotently create/extend ONLY the durable tables (additive — never drops). Safe to run on every
228
257
  * boot (auto-schema) and from a MikroORM migration when you disable auto-schema:
@@ -281,6 +310,13 @@ interface MikroOrmStateStoreOptions {
281
310
  * `blockingAlterRowLimit` on `ensureMikroOrmDurableSchema`.
282
311
  */
283
312
  schemaBlockingAlterRowLimit?: number | undefined;
313
+ /**
314
+ * The schema (Postgres) or database (MySQL) the durable tables live in. Register the entities with
315
+ * the same one (`durableEntities({ schema })`); a mismatch fails at `ensureSchema()`. Every
316
+ * statement names it, so it works behind PgBouncer in transaction mode; never set `search_path`
317
+ * for this. Default: whatever the registered entities carry (unqualified unless built with one).
318
+ */
319
+ schema?: string | undefined;
284
320
  }
285
321
  /**
286
322
  * MikroORM-backed `StateStore`. Works on any MikroORM driver — Postgres, MySQL, SQLite (tested);
@@ -479,4 +515,4 @@ declare class MikroOrmStateStore implements StateStore {
479
515
  removeBufferedEvent(id: string): Promise<boolean>;
480
516
  }
481
517
 
482
- export { BufferedEventEntity, BufferedEventRepository, BufferedSignalEntity, BufferedSignalRepository, DATETIME_PRECISION, DEFAULT_BLOCKING_ALTER_ROW_LIMIT, type DurableColumnNaming, type DurableSchemaLogger, ENTITIES, type EnsureMikroOrmDurableSchemaOptions, MikroOrmStateStore, type MikroOrmStateStoreOptions, RunAttributeEntity, RunAttributeRepository, ScheduleEntity, ScheduleRepository, SignalIdEntity, SignalIdRepository, SignalWaiterEntity, SignalWaiterRepository, StepCheckpointEntity, StepCheckpointRepository, WorkflowRunEntity, WorkflowRunRepository, durableEntities, durableManagedTables, ensureMikroOrmDurableSchema, mikroOrmDeferredAlterWarning, mikroOrmSchemaRepairWarning };
518
+ export { BufferedEventEntity, BufferedEventRepository, BufferedSignalEntity, BufferedSignalRepository, DATETIME_PRECISION, DEFAULT_BLOCKING_ALTER_ROW_LIMIT, type DurableColumnNaming, type DurableSchemaLogger, ENTITIES, type EnsureMikroOrmDurableSchemaOptions, MikroOrmStateStore, type MikroOrmStateStoreOptions, RunAttributeEntity, RunAttributeRepository, ScheduleEntity, ScheduleRepository, SignalIdEntity, SignalIdRepository, SignalWaiterEntity, SignalWaiterRepository, StepCheckpointEntity, StepCheckpointRepository, WorkflowRunEntity, WorkflowRunRepository, durableEntities, durableManagedTables, durableSchemaName, durableTableSchema, ensureMikroOrmDurableSchema, mikroOrmDeferredAlterWarning, mikroOrmSchemaRepairWarning };