@dudousxd/nestjs-durable-store-mikro-orm 0.33.2 → 0.33.3

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
@@ -1,6 +1,6 @@
1
1
  import * as _mikro_orm_core from '@mikro-orm/core';
2
2
  import { EntityRepository, EntityRepositoryType, EntitySchema, MikroORM } from '@mikro-orm/core';
3
- import { StepKind, RunStatus, StateStore, WorkflowRun, RetentionPolicy, StepCheckpoint, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait } from '@dudousxd/nestjs-durable-core';
3
+ import { StepKind, RunStatus, StateStore, WorkflowRun, RetentionPolicy, StepCheckpoint, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow } from '@dudousxd/nestjs-durable-core';
4
4
 
5
5
  /**
6
6
  * Custom repositories for the durable entities, so a host app can `@InjectRepository`/inject a
@@ -432,6 +432,8 @@ declare class MikroOrmStateStore implements StateStore {
432
432
  takeBufferedSignal(token: string): Promise<{
433
433
  payload: unknown;
434
434
  } | null>;
435
+ listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow[]>;
436
+ deleteBufferedSignals(ids: string[]): Promise<void>;
435
437
  bufferEvent(input: {
436
438
  name: string;
437
439
  payload: unknown;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _mikro_orm_core from '@mikro-orm/core';
2
2
  import { EntityRepository, EntityRepositoryType, EntitySchema, MikroORM } from '@mikro-orm/core';
3
- import { StepKind, RunStatus, StateStore, WorkflowRun, RetentionPolicy, StepCheckpoint, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait } from '@dudousxd/nestjs-durable-core';
3
+ import { StepKind, RunStatus, StateStore, WorkflowRun, RetentionPolicy, StepCheckpoint, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow } from '@dudousxd/nestjs-durable-core';
4
4
 
5
5
  /**
6
6
  * Custom repositories for the durable entities, so a host app can `@InjectRepository`/inject a
@@ -432,6 +432,8 @@ declare class MikroOrmStateStore implements StateStore {
432
432
  takeBufferedSignal(token: string): Promise<{
433
433
  payload: unknown;
434
434
  } | null>;
435
+ listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow[]>;
436
+ deleteBufferedSignals(ids: string[]): Promise<void>;
435
437
  bufferEvent(input: {
436
438
  name: string;
437
439
  payload: unknown;
package/dist/index.js CHANGED
@@ -2117,6 +2117,37 @@ var MikroOrmStateStore = class _MikroOrmStateStore {
2117
2117
  payload
2118
2118
  };
2119
2119
  }
2120
+ async listBufferedSignals(tokenPrefix, afterId, limit) {
2121
+ const em = this.fork();
2122
+ const rows = await em.find(BufferedSignalEntity, {
2123
+ token: {
2124
+ $like: `${tokenPrefix}%`
2125
+ },
2126
+ ...afterId !== void 0 ? {
2127
+ id: {
2128
+ $gt: Number(afterId)
2129
+ }
2130
+ } : {}
2131
+ }, {
2132
+ orderBy: {
2133
+ id: "asc"
2134
+ },
2135
+ limit
2136
+ });
2137
+ return rows.filter((r) => r.token.startsWith(tokenPrefix)).map((r) => ({
2138
+ id: String(r.id),
2139
+ token: r.token,
2140
+ payload: r.payload ?? void 0
2141
+ }));
2142
+ }
2143
+ async deleteBufferedSignals(ids) {
2144
+ if (ids.length === 0) return;
2145
+ await this.fork().nativeDelete(BufferedSignalEntity, {
2146
+ id: {
2147
+ $in: ids.map(Number)
2148
+ }
2149
+ });
2150
+ }
2120
2151
  async bufferEvent(input) {
2121
2152
  const em = this.fork();
2122
2153
  const e = new BufferedEventEntity();