@dudousxd/nestjs-durable-store-prisma 0.24.7 → 0.26.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.cjs +497 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +498 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/prisma/schema.prisma +13 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StateStore, WorkflowRun, RunStatus, RetentionPolicy,
|
|
1
|
+
import { StateStore, StepResultSettlement, StepCheckpoint, WorkflowRun, RunStatus, RetentionPolicy, StepSettlement, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow as BufferedSignalRow$1 } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
|
|
3
3
|
interface RunRow {
|
|
4
4
|
id: string;
|
|
@@ -87,6 +87,11 @@ interface Delegate<Row> {
|
|
|
87
87
|
* not model rows, so the result type is stated at the call site rather than derived from `Row`. */
|
|
88
88
|
groupBy(args: Args): Promise<Record<string, unknown>[]>;
|
|
89
89
|
}
|
|
90
|
+
interface SignalIdRow {
|
|
91
|
+
token: string;
|
|
92
|
+
signalId: string;
|
|
93
|
+
expiresAt: bigint;
|
|
94
|
+
}
|
|
90
95
|
interface ScheduleRow {
|
|
91
96
|
id: string;
|
|
92
97
|
namespace: string;
|
|
@@ -108,6 +113,8 @@ interface DurablePrismaTx {
|
|
|
108
113
|
durableBufferedEvent: Delegate<BufferedEventRow>;
|
|
109
114
|
/** Only needed for persisted schedules (`engine.schedules`) — add the `DurableSchedule` model. */
|
|
110
115
|
durableSchedule?: Delegate<ScheduleRow>;
|
|
116
|
+
/** Only needed for signal dedupe (`signal(..., { id })`) — add the `DurableSignalId` model. */
|
|
117
|
+
durableSignalId?: Delegate<SignalIdRow>;
|
|
111
118
|
}
|
|
112
119
|
interface DurablePrismaClient extends DurablePrismaTx {
|
|
113
120
|
/** Prisma's interactive-transaction form: runs `fn` with a tx-scoped client and commits on resolve. */
|
|
@@ -125,6 +132,12 @@ interface DurablePrismaClient extends DurablePrismaTx {
|
|
|
125
132
|
*/
|
|
126
133
|
declare class PrismaStateStore implements StateStore {
|
|
127
134
|
private readonly db;
|
|
135
|
+
readonly settleResultsIfPending?: (results: StepResultSettlement[]) => Promise<(StepCheckpoint | null)[]>;
|
|
136
|
+
readonly insertCheckpointIfAbsent?: (checkpoint: StepCheckpoint) => Promise<boolean>;
|
|
137
|
+
readonly tryLockRunAndGet?: (runId: string, owner: string, leaseUntilMs: number, nowMs: number) => Promise<WorkflowRun | null>;
|
|
138
|
+
readonly claimPendingRuns?: (limit: number, owner: string, leaseUntilMs: number, nowMs: number, namespace?: string) => Promise<WorkflowRun[]>;
|
|
139
|
+
/** Raw single-statement writes on Postgres/MySQL (Prisma wraps `updateMany` in a transaction). */
|
|
140
|
+
private readonly fast?;
|
|
128
141
|
constructor(db: DurablePrismaClient);
|
|
129
142
|
tryAdmitSingleton(runId: string, tag: string, workflow: string, limit: number, retryWakeAt?: number): Promise<boolean>;
|
|
130
143
|
createRun(run: WorkflowRun): Promise<void>;
|
|
@@ -214,6 +227,14 @@ declare class PrismaStateStore implements StateStore {
|
|
|
214
227
|
takeBufferedSignal(token: string): Promise<{
|
|
215
228
|
payload: unknown;
|
|
216
229
|
} | null>;
|
|
230
|
+
takeOldestBufferedSignal(tokens: string[]): Promise<{
|
|
231
|
+
token: string;
|
|
232
|
+
payload: unknown;
|
|
233
|
+
} | null>;
|
|
234
|
+
private signalIds;
|
|
235
|
+
claimSignalId(token: string, id: string, expiresAt: number, nowMs: number): Promise<boolean>;
|
|
236
|
+
releaseSignalId(token: string, id: string): Promise<void>;
|
|
237
|
+
deleteExpiredSignalIds(nowMs: number, limit: number): Promise<number>;
|
|
217
238
|
listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow$1[]>;
|
|
218
239
|
deleteBufferedSignals(ids: string[]): Promise<void>;
|
|
219
240
|
bufferEvent(input: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StateStore, WorkflowRun, RunStatus, RetentionPolicy,
|
|
1
|
+
import { StateStore, StepResultSettlement, StepCheckpoint, WorkflowRun, RunStatus, RetentionPolicy, StepSettlement, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow as BufferedSignalRow$1 } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
|
|
3
3
|
interface RunRow {
|
|
4
4
|
id: string;
|
|
@@ -87,6 +87,11 @@ interface Delegate<Row> {
|
|
|
87
87
|
* not model rows, so the result type is stated at the call site rather than derived from `Row`. */
|
|
88
88
|
groupBy(args: Args): Promise<Record<string, unknown>[]>;
|
|
89
89
|
}
|
|
90
|
+
interface SignalIdRow {
|
|
91
|
+
token: string;
|
|
92
|
+
signalId: string;
|
|
93
|
+
expiresAt: bigint;
|
|
94
|
+
}
|
|
90
95
|
interface ScheduleRow {
|
|
91
96
|
id: string;
|
|
92
97
|
namespace: string;
|
|
@@ -108,6 +113,8 @@ interface DurablePrismaTx {
|
|
|
108
113
|
durableBufferedEvent: Delegate<BufferedEventRow>;
|
|
109
114
|
/** Only needed for persisted schedules (`engine.schedules`) — add the `DurableSchedule` model. */
|
|
110
115
|
durableSchedule?: Delegate<ScheduleRow>;
|
|
116
|
+
/** Only needed for signal dedupe (`signal(..., { id })`) — add the `DurableSignalId` model. */
|
|
117
|
+
durableSignalId?: Delegate<SignalIdRow>;
|
|
111
118
|
}
|
|
112
119
|
interface DurablePrismaClient extends DurablePrismaTx {
|
|
113
120
|
/** Prisma's interactive-transaction form: runs `fn` with a tx-scoped client and commits on resolve. */
|
|
@@ -125,6 +132,12 @@ interface DurablePrismaClient extends DurablePrismaTx {
|
|
|
125
132
|
*/
|
|
126
133
|
declare class PrismaStateStore implements StateStore {
|
|
127
134
|
private readonly db;
|
|
135
|
+
readonly settleResultsIfPending?: (results: StepResultSettlement[]) => Promise<(StepCheckpoint | null)[]>;
|
|
136
|
+
readonly insertCheckpointIfAbsent?: (checkpoint: StepCheckpoint) => Promise<boolean>;
|
|
137
|
+
readonly tryLockRunAndGet?: (runId: string, owner: string, leaseUntilMs: number, nowMs: number) => Promise<WorkflowRun | null>;
|
|
138
|
+
readonly claimPendingRuns?: (limit: number, owner: string, leaseUntilMs: number, nowMs: number, namespace?: string) => Promise<WorkflowRun[]>;
|
|
139
|
+
/** Raw single-statement writes on Postgres/MySQL (Prisma wraps `updateMany` in a transaction). */
|
|
140
|
+
private readonly fast?;
|
|
128
141
|
constructor(db: DurablePrismaClient);
|
|
129
142
|
tryAdmitSingleton(runId: string, tag: string, workflow: string, limit: number, retryWakeAt?: number): Promise<boolean>;
|
|
130
143
|
createRun(run: WorkflowRun): Promise<void>;
|
|
@@ -214,6 +227,14 @@ declare class PrismaStateStore implements StateStore {
|
|
|
214
227
|
takeBufferedSignal(token: string): Promise<{
|
|
215
228
|
payload: unknown;
|
|
216
229
|
} | null>;
|
|
230
|
+
takeOldestBufferedSignal(tokens: string[]): Promise<{
|
|
231
|
+
token: string;
|
|
232
|
+
payload: unknown;
|
|
233
|
+
} | null>;
|
|
234
|
+
private signalIds;
|
|
235
|
+
claimSignalId(token: string, id: string, expiresAt: number, nowMs: number): Promise<boolean>;
|
|
236
|
+
releaseSignalId(token: string, id: string): Promise<void>;
|
|
237
|
+
deleteExpiredSignalIds(nowMs: number, limit: number): Promise<number>;
|
|
217
238
|
listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow$1[]>;
|
|
218
239
|
deleteBufferedSignals(ids: string[]): Promise<void>;
|
|
219
240
|
bufferEvent(input: {
|