@nagi-js/core 0.1.1-rc.22 → 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>;
@@ -600,9 +601,6 @@ interface ParentLink {
600
601
  readonly runId: RunId;
601
602
  readonly stepId: StepId;
602
603
  }
603
- interface ParentRef extends ParentLink {
604
- readonly attempt: AttemptNumber;
605
- }
606
604
  interface FlowEvent {
607
605
  readonly runId: RunId;
608
606
  readonly flowId: string;
@@ -610,7 +608,7 @@ interface FlowEvent {
610
608
  }
611
609
  interface FlowStartEvent extends FlowEvent {
612
610
  readonly input: Json;
613
- readonly parent?: ParentRef;
611
+ readonly parent?: ParentLink;
614
612
  }
615
613
  interface FlowCompleteEvent extends FlowEvent {
616
614
  readonly output: Json;
@@ -671,7 +669,7 @@ interface WorkerRunOnceOpts {
671
669
  readonly maxSteps?: number;
672
670
  }
673
671
  interface WorkerRunUntilEmptyOpts {
674
- readonly deadline?: number;
672
+ readonly timeoutMs?: Millis;
675
673
  }
676
674
  interface WorkerRunResult {
677
675
  readonly processed: number;
@@ -712,10 +710,15 @@ interface TimedOutSignal {
712
710
  readonly attempt: AttemptNumber;
713
711
  readonly fireAt: Date;
714
712
  }
713
+ interface StartSeed {
714
+ readonly queue: Queue;
715
+ readonly flowId: string;
716
+ readonly steps: readonly StepId[];
717
+ }
715
718
  interface Store {
716
719
  appendFact(runId: RunId, fact: Exclude<Fact, RunEndFact>): Promise<void>;
717
720
  endRun(runId: RunId, fact: RunEndFact): Promise<boolean>;
718
- loadRunState(runId: RunId): Promise<RunState>;
721
+ loadRunState(runId: RunId, tx?: Tx): Promise<RunState>;
719
722
  settleSignal(args: {
720
723
  readonly runId: RunId;
721
724
  readonly stepId: StepId;
@@ -728,7 +731,7 @@ interface Store {
728
731
  tryStartRun(runId: RunId, fact: FlowStartedFact, concurrency?: {
729
732
  readonly key: string;
730
733
  readonly mode: ConcurrencyMode;
731
- }): Promise<{
734
+ }, seed?: StartSeed): Promise<{
732
735
  readonly started: boolean;
733
736
  readonly canceled: ReadonlyArray<{
734
737
  readonly runId: RunId;
@@ -786,10 +789,8 @@ type RunEvent = {
786
789
  readonly flowId: string;
787
790
  } | {
788
791
  readonly type: "flow.completed";
789
- readonly output: Json;
790
792
  } | {
791
793
  readonly type: "flow.failed";
792
- readonly error: SerializedError;
793
794
  } | {
794
795
  readonly type: "flow.canceled";
795
796
  readonly cause: "concurrency";
@@ -805,12 +806,10 @@ type RunEvent = {
805
806
  readonly type: "step.completed";
806
807
  readonly stepId: StepId;
807
808
  readonly attempt: AttemptNumber;
808
- readonly output: Json;
809
809
  } | {
810
810
  readonly type: "step.failed";
811
811
  readonly stepId: StepId;
812
812
  readonly attempt: AttemptNumber;
813
- readonly error: SerializedError;
814
813
  } | {
815
814
  readonly type: "step.retried";
816
815
  readonly stepId: StepId;
@@ -819,6 +818,13 @@ type RunEvent = {
819
818
  readonly type: "step.skipped";
820
819
  readonly stepId: StepId;
821
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;
822
828
  };
823
829
  type RunEventEnvelope = RunEvent & {
824
830
  readonly runId: RunId;
@@ -897,4 +903,4 @@ interface ReplayOpts {
897
903
  readonly scope?: ResetScope;
898
904
  }
899
905
 
900
- export { type QueueEnqueueOpts 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 ParentRef as V, type PrunableStatus as W, type PruneOpts as X, type PruneResult as Y, type Queue as Z, type QueueDequeueOpts as _, type ActivityCtx as a, type StreamTransport as a$, type QueueInspectEntry as a0, type QueueMessage as a1, type ReapedLease as a2, type ReaperDecision as a3, type Register as a4, type Release as a5, type ReplayMode as a6, type ReplayOpts as a7, type ResetScope as a8, type Resolved 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 ResolvedConcurrency as aa, type ResolvedNeeds as ab, type RetryPolicy as ac, type RowDelta as ad, type RunCancelCause as ae, type RunDescription as af, type RunEndFact as ag, type RunEvent as ah, type RunEventEnvelope as ai, type RunEventTransport as aj, type RunId as ak, type RunPhase as al, type RunState as am, type RunStatus as an, type RunView as ao, type SerializedError as ap, type SettleSignalResult as aq, type SignalBufferedFact as ar, type SignalConfig as as, type SignalReceivedEvent as at, type SignalReceivedFact as au, type SkipReason as av, type SnapshotGoneDisposition as aw, type SnapshotGonePolicy as ax, StandardSchemaV1 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 };
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.22",
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",