@dudousxd/nestjs-durable-testing 0.22.2 → 0.23.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.ts CHANGED
@@ -256,6 +256,12 @@ interface StateStoreContext {
256
256
  * a real engine) still asserts it, so this doesn't hide drift in the supported configurations.
257
257
  */
258
258
  supportsTagFilter?: boolean;
259
+ /**
260
+ * How many statements the store has sent to its database so far (from the driver's query log).
261
+ * When given, the contract checks that the batched checkpoint methods send a fixed number of them
262
+ * for a wide batch, not one per row.
263
+ */
264
+ statements?: () => number;
259
265
  }
260
266
  /** Builds a fresh, empty store for one test. Called once per `it` (in `beforeEach`). */
261
267
  type StateStoreFactory = () => Promise<StateStoreContext>;
@@ -350,4 +356,44 @@ interface RunDispatchContractOptions {
350
356
  */
351
357
  declare function runRunDispatchContract(name: string, makeHarness: RunDispatchHarnessFactory, options?: RunDispatchContractOptions): void;
352
358
 
353
- export { type AdmissionBackendFactory, DURABLE_CANONICAL_COLUMNS, type DurableColumnMap, type DurableColumnMismatch, type HandleableTransport, MutableClock, type RunDispatchContractOptions, type RunDispatchHarness, type RunDispatchHarnessFactory, type RunHistory, type StateStoreContext, type StateStoreFactory, StateStoreUnavailableError, type TestEngine, aggregationFixture, assertDurableColumns, assertOutput, assertReplayable, assertRunStatus, assertStepAttempts, assertStepsRan, assertTransportConformance, captureHistory, createTestEngine, failOnce, failTimes, parseRunHistory, preserveColumnExpectation, recordedSteps, registerCheckpointAggregationCases, runAdmissionBackendContract, runRunDispatchContract, runStateStoreContract, serializeRunHistory };
359
+ /** The step every case fans out over. */
360
+ declare const STEP_FAN_STEP = "fan-results-double";
361
+ /** Two engine-side transports on one broker (two instances of a deployment) and the worker side. */
362
+ interface StepFanResultsHarness {
363
+ /**
364
+ * Fresh queues (prefix, tables) for one case: two engine-side transports, and a worker serving
365
+ * {@link STEP_FAN_STEP} with `handler` (registered on whichever transport the backend runs
366
+ * workers on). `close` releases everything the case opened.
367
+ */
368
+ open(handler: (input: unknown) => Promise<unknown>): Promise<{
369
+ engines: [Transport, Transport];
370
+ close: () => Promise<void>;
371
+ }>;
372
+ }
373
+ /** Builds the harness, or returns why the backend is unavailable (no Docker, say): the case skips. */
374
+ type StepFanResultsHarnessFactory = () => Promise<StepFanResultsHarness | string>;
375
+ interface StepFanResultsContractOptions {
376
+ /** Per-case budget. Default 60s. */
377
+ timeoutMs?: number;
378
+ /** Steps in the fan. Default 2000. */
379
+ fanSize?: number;
380
+ /**
381
+ * The fewest results the largest batched write of a backlog settles. Default 8: a consumer that
382
+ * hands the engine one result at a time settles a fan in one write and one barrier read each.
383
+ */
384
+ minBatch?: number;
385
+ /**
386
+ * Whether the transport sends many tasks at once (`dispatchMany`). Default true: the contract
387
+ * then checks that a fan's steps are dispatched through it, never one `dispatch` per step.
388
+ */
389
+ bulkDispatch?: boolean;
390
+ }
391
+ /**
392
+ * A wide step fan (`ctx.all` / `ctx.allSettled` over a `@Step`) whose results come back over a
393
+ * real broker to two engine instances: every step settles once, the parent wakes O(1) times per
394
+ * wave, and the results consumer hands the engine enough results at once that they are written in
395
+ * batches rather than one by one.
396
+ */
397
+ declare function runStepFanResultsContract(name: string, makeHarness: StepFanResultsHarnessFactory, options?: StepFanResultsContractOptions): void;
398
+
399
+ export { type AdmissionBackendFactory, DURABLE_CANONICAL_COLUMNS, type DurableColumnMap, type DurableColumnMismatch, type HandleableTransport, MutableClock, type RunDispatchContractOptions, type RunDispatchHarness, type RunDispatchHarnessFactory, type RunHistory, STEP_FAN_STEP, type StateStoreContext, type StateStoreFactory, StateStoreUnavailableError, type StepFanResultsContractOptions, type StepFanResultsHarness, type StepFanResultsHarnessFactory, type TestEngine, aggregationFixture, assertDurableColumns, assertOutput, assertReplayable, assertRunStatus, assertStepAttempts, assertStepsRan, assertTransportConformance, captureHistory, createTestEngine, failOnce, failTimes, parseRunHistory, preserveColumnExpectation, recordedSteps, registerCheckpointAggregationCases, runAdmissionBackendContract, runRunDispatchContract, runStateStoreContract, runStepFanResultsContract, serializeRunHistory };