@nagi-js/core 0.1.1-rc.23 → 0.1.1-rc.24

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.
@@ -183,11 +183,13 @@ type StreamEffect = {
183
183
  } | {
184
184
  readonly tag: "close-error";
185
185
  readonly stepId: StepId;
186
- readonly error: SerializedError;
187
186
  } | {
188
187
  readonly tag: "retry";
189
188
  readonly stepId: StepId;
190
189
  readonly nextAttempt: AttemptNumber;
190
+ } | {
191
+ readonly tag: "reopen";
192
+ readonly stepId: StepId;
191
193
  } | {
192
194
  readonly tag: "close-run";
193
195
  };
@@ -484,7 +486,6 @@ type StreamEvent<C = Json> = {
484
486
  readonly attempt: AttemptNumber;
485
487
  } | {
486
488
  readonly kind: "error";
487
- readonly error: SerializedError;
488
489
  };
489
490
  interface StreamingStepCtx<Input = unknown, Chunk = Json> extends StepCtx<Input> {
490
491
  readonly emit: (chunk: Chunk) => Promise<void>;
@@ -668,7 +669,7 @@ interface WorkerRunOnceOpts {
668
669
  readonly maxSteps?: number;
669
670
  }
670
671
  interface WorkerRunUntilEmptyOpts {
671
- readonly deadline?: number;
672
+ readonly timeoutMs?: Millis;
672
673
  }
673
674
  interface WorkerRunResult {
674
675
  readonly processed: number;
@@ -709,10 +710,15 @@ interface TimedOutSignal {
709
710
  readonly attempt: AttemptNumber;
710
711
  readonly fireAt: Date;
711
712
  }
713
+ interface StartSeed {
714
+ readonly queue: Queue;
715
+ readonly flowId: string;
716
+ readonly steps: readonly StepId[];
717
+ }
712
718
  interface Store {
713
719
  appendFact(runId: RunId, fact: Exclude<Fact, RunEndFact>): Promise<void>;
714
720
  endRun(runId: RunId, fact: RunEndFact): Promise<boolean>;
715
- loadRunState(runId: RunId): Promise<RunState>;
721
+ loadRunState(runId: RunId, tx?: Tx): Promise<RunState>;
716
722
  settleSignal(args: {
717
723
  readonly runId: RunId;
718
724
  readonly stepId: StepId;
@@ -725,7 +731,7 @@ interface Store {
725
731
  tryStartRun(runId: RunId, fact: FlowStartedFact, concurrency?: {
726
732
  readonly key: string;
727
733
  readonly mode: ConcurrencyMode;
728
- }): Promise<{
734
+ }, seed?: StartSeed): Promise<{
729
735
  readonly started: boolean;
730
736
  readonly canceled: ReadonlyArray<{
731
737
  readonly runId: RunId;
@@ -783,10 +789,8 @@ type RunEvent = {
783
789
  readonly flowId: string;
784
790
  } | {
785
791
  readonly type: "flow.completed";
786
- readonly output: Json;
787
792
  } | {
788
793
  readonly type: "flow.failed";
789
- readonly error: SerializedError;
790
794
  } | {
791
795
  readonly type: "flow.canceled";
792
796
  readonly cause: "concurrency";
@@ -802,12 +806,10 @@ type RunEvent = {
802
806
  readonly type: "step.completed";
803
807
  readonly stepId: StepId;
804
808
  readonly attempt: AttemptNumber;
805
- readonly output: Json;
806
809
  } | {
807
810
  readonly type: "step.failed";
808
811
  readonly stepId: StepId;
809
812
  readonly attempt: AttemptNumber;
810
- readonly error: SerializedError;
811
813
  } | {
812
814
  readonly type: "step.retried";
813
815
  readonly stepId: StepId;
@@ -816,6 +818,13 @@ type RunEvent = {
816
818
  readonly type: "step.skipped";
817
819
  readonly stepId: StepId;
818
820
  readonly reason: SkipReason;
821
+ } | {
822
+ readonly type: "step.canceled";
823
+ readonly stepId: StepId;
824
+ readonly attempt: AttemptNumber;
825
+ } | {
826
+ readonly type: "step.reset";
827
+ readonly stepId: StepId;
819
828
  };
820
829
  type RunEventEnvelope = RunEvent & {
821
830
  readonly runId: RunId;
@@ -894,4 +903,4 @@ interface ReplayOpts {
894
903
  readonly scope?: ResetScope;
895
904
  }
896
905
 
897
- export { type QueueInspectEntry as $, type ActivityConfig as A, type BackoffStrategy as B, type CancelArgs as C, DEFAULT_REAPER_INTERVAL_MS as D, type FlowStartedFact as E, type Fact as F, type GetOnceResult as G, type GlobalFact as H, type InferSchemaInput as I, type InferSchemaOutput as J, type Json as K, type LeaseReapedFact as L, type LogEntry as M, type LogLevel as N, type Logger as O, type Millis as P, type NeedRef as Q, type NeedsMap as R, type NeedsOutputs as S, type Optional as T, type ParentLink as U, type PrunableStatus as V, type PruneOpts as W, type PruneResult as X, type Queue as Y, type QueueDequeueOpts as Z, type QueueEnqueueOpts as _, type ActivityCtx as a, type StreamingStepCtx as a$, type QueueMessage as a0, type ReapedLease as a1, type ReaperDecision as a2, type Register as a3, type Release as a4, type ReplayMode as a5, type ReplayOpts as a6, type ResetScope as a7, type Resolved as a8, type ResolvedConcurrency as a9, type StepCancelCause as aA, type StepCanceledFact as aB, type StepCompleteEvent as aC, type StepCompletedFact as aD, type StepCtx as aE, type StepErrorEvent as aF, type StepEvent as aG, type StepFailedFact as aH, type StepId as aI, type StepKind as aJ, type StepLifecycleHooks as aK, type StepMap as aL, type StepOutput as aM, type StepResetFact as aN, type StepRetriedFact as aO, type StepRetryEvent as aP, type StepRunStatus as aQ, type StepSkippedFact as aR, type StepStartEvent as aS, type StepStartedFact as aT, type StepState as aU, type StepStatus as aV, type StepView as aW, type Store as aX, type StreamEffect as aY, type StreamEvent as aZ, type StreamTransport as a_, type ResolvedNeeds as aa, type RetryPolicy as ab, type RowDelta as ac, type RunCancelCause as ad, type RunDescription as ae, type RunEndFact as af, type RunEvent as ag, type RunEventEnvelope as ah, type RunEventTransport as ai, type RunId as aj, type RunPhase as ak, type RunState as al, type RunStatus as am, type RunView as an, type SerializedError as ao, type SettleSignalResult as ap, type SignalBufferedFact as aq, type SignalConfig as ar, type SignalReceivedEvent as as, type SignalReceivedFact as at, type SkipReason as au, type SnapshotGoneDisposition as av, type SnapshotGonePolicy as aw, StandardSchemaV1 as ax, type Step as ay, type StepAbortRequestedFact as az, type AttemptNumber as b, type StreamingTaskConfig as b0, type StringKeyOf as b1, type SubflowConfig as b2, type SubflowStepOutput as b3, type TaskConfig as b4, type TimedOutSignal as b5, type Tx as b6, type Worker as b7, type WorkerConfig as b8, type WorkerRunOnceOpts as b9, type WorkerRunResult as ba, type WorkerRunUntilEmptyOpts as bb, attemptOf as bc, decideExpiredLeaseAction as bd, errorOf as be, factConsequences as bf, foldRun as bg, isRunEnd as bh, isStepTerminal as bi, isTerminalRun as bj, outputOf as bk, resolvedOf as bl, runStatusOf as bm, stepStateOf as bn, stepStatusOf as bo, unwrap as bp, type Builder as c, type ClaimToken as d, type Clock as e, type ConcurrencyMode as f, type DriftPolicy as g, type FactConsequences as h, type FactKind as i, type Flow as j, type FlowCanceledByConcurrencyFact as k, type FlowCanceledExplicitlyFact as l, type FlowCanceledFact as m, type FlowCompleteEvent as n, type FlowCompletedFact as o, type FlowConcurrency as p, type FlowConfig as q, type FlowErrorEvent as r, type FlowEvent as s, type FlowFailedFact as t, type FlowHooks as u, type FlowIdOf as v, type FlowInput as w, type FlowOutput as x, type FlowRefUpdatedFact as y, type FlowStartEvent as z };
906
+ export { type QueueInspectEntry as $, type ActivityConfig as A, type BackoffStrategy as B, type CancelArgs as C, DEFAULT_REAPER_INTERVAL_MS as D, type FlowStartedFact as E, type Fact as F, type GetOnceResult as G, type GlobalFact as H, type InferSchemaInput as I, type InferSchemaOutput as J, type Json as K, type LeaseReapedFact as L, type LogEntry as M, type LogLevel as N, type Logger as O, type Millis as P, type NeedRef as Q, type NeedsMap as R, type NeedsOutputs as S, type Optional as T, type ParentLink as U, type PrunableStatus as V, type PruneOpts as W, type PruneResult as X, type Queue as Y, type QueueDequeueOpts as Z, type QueueEnqueueOpts as _, type ActivityCtx as a, type StreamTransport as a$, type QueueMessage as a0, type ReapedLease as a1, type ReaperDecision as a2, type Register as a3, type Release as a4, type ReplayMode as a5, type ReplayOpts as a6, type ResetScope as a7, type Resolved as a8, type ResolvedConcurrency as a9, type StepAbortRequestedFact as aA, type StepCancelCause as aB, type StepCanceledFact as aC, type StepCompleteEvent as aD, type StepCompletedFact as aE, type StepCtx as aF, type StepErrorEvent as aG, type StepEvent as aH, type StepFailedFact as aI, type StepId as aJ, type StepKind as aK, type StepLifecycleHooks as aL, type StepMap as aM, type StepOutput as aN, type StepResetFact as aO, type StepRetriedFact as aP, type StepRetryEvent as aQ, type StepRunStatus as aR, type StepSkippedFact as aS, type StepStartEvent as aT, type StepStartedFact as aU, type StepState as aV, type StepStatus as aW, type StepView as aX, type Store as aY, type StreamEffect as aZ, type StreamEvent as a_, type ResolvedNeeds as aa, type RetryPolicy as ab, type RowDelta as ac, type RunCancelCause as ad, type RunDescription as ae, type RunEndFact as af, type RunEvent as ag, type RunEventEnvelope as ah, type RunEventTransport as ai, type RunId as aj, type RunPhase as ak, type RunState as al, type RunStatus as am, type RunView as an, type SerializedError as ao, type SettleSignalResult as ap, type SignalBufferedFact as aq, type SignalConfig as ar, type SignalReceivedEvent as as, type SignalReceivedFact as at, type SkipReason as au, type SnapshotGoneDisposition as av, type SnapshotGonePolicy as aw, StandardSchemaV1 as ax, type StartSeed as ay, type Step as az, type AttemptNumber as b, type StreamingStepCtx as b0, type StreamingTaskConfig as b1, type StringKeyOf as b2, type SubflowConfig as b3, type SubflowStepOutput as b4, type TaskConfig as b5, type TimedOutSignal as b6, type Tx as b7, type Worker as b8, type WorkerConfig as b9, type WorkerRunOnceOpts as ba, type WorkerRunResult as bb, type WorkerRunUntilEmptyOpts as bc, attemptOf as bd, decideExpiredLeaseAction as be, errorOf as bf, factConsequences as bg, foldRun as bh, isRunEnd as bi, isStepTerminal as bj, isTerminalRun as bk, outputOf as bl, resolvedOf as bm, runStatusOf as bn, stepStateOf as bo, stepStatusOf as bp, unwrap as bq, type Builder as c, type ClaimToken as d, type Clock as e, type ConcurrencyMode as f, type DriftPolicy as g, type FactConsequences as h, type FactKind as i, type Flow as j, type FlowCanceledByConcurrencyFact as k, type FlowCanceledExplicitlyFact as l, type FlowCanceledFact as m, type FlowCompleteEvent as n, type FlowCompletedFact as o, type FlowConcurrency as p, type FlowConfig as q, type FlowErrorEvent as r, type FlowEvent as s, type FlowFailedFact as t, type FlowHooks as u, type FlowIdOf as v, type FlowInput as w, type FlowOutput as x, type FlowRefUpdatedFact as y, type FlowStartEvent as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nagi-js/core",
3
- "version": "0.1.1-rc.23",
3
+ "version": "0.1.1-rc.24",
4
4
  "description": "Type-safe declarative workflow engine. Edge-compliant. Zero runtime deps.",
5
5
  "license": "MIT",
6
6
  "type": "module",