@dudousxd/nestjs-durable-store-drizzle 0.24.4 → 0.24.5

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.
@@ -159,6 +159,7 @@ declare class DrizzlePgStateStore implements StateStore {
159
159
  listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
160
160
  listCheckpointsForReplay(runId: string): Promise<StepCheckpoint[]>;
161
161
  getLatestCheckpointByName(runId: string, name: string): Promise<StepCheckpoint | undefined>;
162
+ hasCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<boolean>;
162
163
  countCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<number>;
163
164
  listCheckpointsByNamePrefix(runId: string, prefixes: string[]): Promise<StepCheckpoint[]>;
164
165
  /** {@link StateStore.checkpointStats}: one `GROUP BY parallel_group, status, name_kind` over the
@@ -159,6 +159,7 @@ declare class DrizzlePgStateStore implements StateStore {
159
159
  listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
160
160
  listCheckpointsForReplay(runId: string): Promise<StepCheckpoint[]>;
161
161
  getLatestCheckpointByName(runId: string, name: string): Promise<StepCheckpoint | undefined>;
162
+ hasCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<boolean>;
162
163
  countCheckpoints(runId: string, fromSeq: number, toSeq: number, statuses: StepCheckpoint['status'][]): Promise<number>;
163
164
  listCheckpointsByNamePrefix(runId: string, prefixes: string[]): Promise<StepCheckpoint[]>;
164
165
  /** {@link StateStore.checkpointStats}: one `GROUP BY parallel_group, status, name_kind` over the
package/dist/pg/index.js CHANGED
@@ -835,6 +835,13 @@ var DrizzlePgStateStore = class _DrizzlePgStateStore {
835
835
  const rows = await this.db.select().from(durableStepCheckpoints).where(and(eq(durableStepCheckpoints.runId, runId), eq(durableStepCheckpoints.name, name))).orderBy(desc(durableStepCheckpoints.seq)).limit(1);
836
836
  return rows[0] ? fromCheckpointRow(rows[0]) : void 0;
837
837
  }
838
+ async hasCheckpoints(runId, fromSeq, toSeq, statuses) {
839
+ if (statuses.length === 0) return false;
840
+ const rows = await this.db.select({
841
+ seq: durableStepCheckpoints.seq
842
+ }).from(durableStepCheckpoints).where(and(eq(durableStepCheckpoints.runId, runId), gte(durableStepCheckpoints.seq, fromSeq), lte(durableStepCheckpoints.seq, toSeq), inArray(durableStepCheckpoints.status, statuses))).orderBy(desc(durableStepCheckpoints.seq)).limit(1);
843
+ return rows.length > 0;
844
+ }
838
845
  async countCheckpoints(runId, fromSeq, toSeq, statuses) {
839
846
  if (statuses.length === 0) return 0;
840
847
  const rows = await this.db.select({