@outbuild-company/schedule-core 1.6.0 → 1.6.2
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/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +1721 -507
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -6
- package/dist/index.d.ts +121 -6
- package/dist/index.js +1721 -507
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -322,6 +322,32 @@ interface PersistedEntityIdentity {
|
|
|
322
322
|
readonly id: string;
|
|
323
323
|
readonly proplannerId: number;
|
|
324
324
|
}
|
|
325
|
+
type ActivityBatchMode = 'append' | 'replace';
|
|
326
|
+
type ActivityBatchReference = ActivityId | {
|
|
327
|
+
readonly batchId: string;
|
|
328
|
+
};
|
|
329
|
+
type ActivityBatchParentReference = '0' | ActivityBatchReference;
|
|
330
|
+
interface ActivityBatchItem {
|
|
331
|
+
readonly batchId: string;
|
|
332
|
+
readonly parent: ActivityBatchParentReference;
|
|
333
|
+
readonly index?: number;
|
|
334
|
+
readonly activityId?: ActivityId;
|
|
335
|
+
readonly overrides?: CreationOverrides;
|
|
336
|
+
}
|
|
337
|
+
interface ActivityBatchLinkInput {
|
|
338
|
+
readonly source: ActivityBatchReference;
|
|
339
|
+
readonly target: ActivityBatchReference;
|
|
340
|
+
readonly type: LinkType;
|
|
341
|
+
readonly lag: number;
|
|
342
|
+
readonly linkId?: LinkId;
|
|
343
|
+
}
|
|
344
|
+
interface ActivityBatchAction {
|
|
345
|
+
readonly kind: 'activity-batch';
|
|
346
|
+
readonly mode: ActivityBatchMode;
|
|
347
|
+
readonly items: ReadonlyArray<ActivityBatchItem>;
|
|
348
|
+
readonly links: ReadonlyArray<ActivityBatchLinkInput>;
|
|
349
|
+
readonly eventSource?: string;
|
|
350
|
+
}
|
|
325
351
|
|
|
326
352
|
type DispatchAction = {
|
|
327
353
|
kind: 'persistence-acknowledge';
|
|
@@ -441,6 +467,7 @@ type DispatchAction = {
|
|
|
441
467
|
activityIds: ReadonlyArray<ActivityId>;
|
|
442
468
|
isLookahead: boolean;
|
|
443
469
|
hasLookaheadTasks: boolean;
|
|
470
|
+
acknowledgePersistedLookahead?: boolean;
|
|
444
471
|
eventSource?: string;
|
|
445
472
|
} | {
|
|
446
473
|
kind: 'activity-paste';
|
|
@@ -455,6 +482,7 @@ type DispatchAction = {
|
|
|
455
482
|
links: ReadonlyArray<PastedLinkInput>;
|
|
456
483
|
eventSource?: string;
|
|
457
484
|
};
|
|
485
|
+
type InternalDispatchAction = DispatchAction | ActivityBatchAction;
|
|
458
486
|
interface PastedActivityInput {
|
|
459
487
|
readonly originalId: ActivityId;
|
|
460
488
|
readonly originalParentId: ActivityId | '0';
|
|
@@ -534,7 +562,7 @@ interface ViewStateChange {
|
|
|
534
562
|
readonly visible?: ViewStatePropChange;
|
|
535
563
|
}
|
|
536
564
|
interface ChangeSet {
|
|
537
|
-
source:
|
|
565
|
+
source: InternalDispatchAction | {
|
|
538
566
|
kind: 'init';
|
|
539
567
|
} | {
|
|
540
568
|
kind: 'undo';
|
|
@@ -693,12 +721,56 @@ interface ScheduleCoreInput extends BackendScheduleInput {
|
|
|
693
721
|
reporter?: ScheduleCoreReporter;
|
|
694
722
|
}
|
|
695
723
|
|
|
724
|
+
type DateGesture = {
|
|
725
|
+
readonly kind: 'move';
|
|
726
|
+
readonly activityIds: readonly ActivityId[];
|
|
727
|
+
readonly anchorActivityId: ActivityId;
|
|
728
|
+
} | {
|
|
729
|
+
readonly kind: 'resize-start' | 'resize-end';
|
|
730
|
+
readonly activityId: ActivityId;
|
|
731
|
+
};
|
|
732
|
+
interface DateGesturePreview {
|
|
733
|
+
getDates(activityId: ActivityId, proposedEdgeTimeMs: number): {
|
|
734
|
+
startTimeMs: number;
|
|
735
|
+
endTimeMs: number;
|
|
736
|
+
} | null;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
interface UndoOptions {
|
|
740
|
+
readonly skipCriticalPath?: boolean;
|
|
741
|
+
readonly expectedUndoDepth?: number;
|
|
742
|
+
}
|
|
743
|
+
|
|
696
744
|
declare class ScheduleCore {
|
|
697
745
|
private _status;
|
|
698
746
|
private readonly coreRuntime;
|
|
699
747
|
private readonly _undo;
|
|
700
748
|
private _opQueue;
|
|
701
749
|
private _scheduleRevision;
|
|
750
|
+
/**
|
|
751
|
+
* Revision counting mutations that have been ADMITTED, whether or not they
|
|
752
|
+
* have changed anything yet. `_scheduleRevision` counts the ones that
|
|
753
|
+
* actually did.
|
|
754
|
+
*
|
|
755
|
+
* INVARIANT: `_pendingScheduleRevision >= _scheduleRevision`, and equality
|
|
756
|
+
* means no mutation is in flight.
|
|
757
|
+
*
|
|
758
|
+
* The two exist separately because the useful instant and the knowable
|
|
759
|
+
* instant are not the same one. A critical-path calculation becomes garbage
|
|
760
|
+
* the moment the next mutation is admitted, but whether that mutation is
|
|
761
|
+
* substantive is only knowable once its ChangeSet exists, which is hundreds
|
|
762
|
+
* of milliseconds later at project scale. Measured live on a 12268-activity
|
|
763
|
+
* project: the cancellation flag flipped 929 ms into a 930 ms calculation,
|
|
764
|
+
* 812 into 812 and 785 into 785, because the job's apply block queues behind
|
|
765
|
+
* the very dispatch whose completion cancels it. Cancellation and job end
|
|
766
|
+
* were the same event, so every discarded job ran the whole calculation.
|
|
767
|
+
*
|
|
768
|
+
* Splitting the counter buys the early signal without moving the meaning of
|
|
769
|
+
* `_scheduleRevision`, whose three readers (`isCriticalPathSettled`,
|
|
770
|
+
* `createDateGesturePreview` and the job's own `isCurrent`) are all written
|
|
771
|
+
* against "the state actually changed".
|
|
772
|
+
*/
|
|
773
|
+
private _pendingScheduleRevision;
|
|
702
774
|
private _criticalPathRevision;
|
|
703
775
|
private _activeCriticalPath;
|
|
704
776
|
constructor(input: ScheduleCoreInput);
|
|
@@ -709,6 +781,7 @@ declare class ScheduleCore {
|
|
|
709
781
|
get status(): ScheduleCoreStatus;
|
|
710
782
|
getSector(): Readonly<SectorMetadata>;
|
|
711
783
|
getActivityView(id: ActivityId): Readonly<CoreActivity> | null;
|
|
784
|
+
createDateGesturePreview(gesture: DateGesture): DateGesturePreview;
|
|
712
785
|
getAllActivitiesView(): ReadonlyArray<Readonly<CoreActivity>>;
|
|
713
786
|
getChildrenView(parentId: ActivityId | '0'): ReadonlyArray<Readonly<CoreActivity>>;
|
|
714
787
|
getLinkView(id: LinkId): Readonly<Link> | null;
|
|
@@ -734,8 +807,51 @@ declare class ScheduleCore {
|
|
|
734
807
|
getDeletedActivitiesSinceLastSave(): ReadonlyArray<Readonly<DeletedActivitySnapshot>>;
|
|
735
808
|
getDeletedLinksSinceLastSave(): ReadonlyArray<Readonly<DeletedLinkSnapshot>>;
|
|
736
809
|
private _enqueue;
|
|
810
|
+
/**
|
|
811
|
+
* Marks a mutation as admitted and invalidates the calculation in flight.
|
|
812
|
+
*
|
|
813
|
+
* Called BEFORE `_enqueue`, which is the point of the whole thing: the wait
|
|
814
|
+
* in the operation queue is part of the window a running calculation wastes,
|
|
815
|
+
* and it is the longest part of it when several mutations are already
|
|
816
|
+
* queued.
|
|
817
|
+
*
|
|
818
|
+
* `dispatchChangesSchedulingState` is a pure function of the action, so this
|
|
819
|
+
* decision needs no state and cannot be wrong about the action's nature. What
|
|
820
|
+
* it cannot know yet is whether the mutation will produce anything, which is
|
|
821
|
+
* what `_settleScheduleMutation` reconciles afterwards.
|
|
822
|
+
*/
|
|
823
|
+
private _beginScheduleMutation;
|
|
824
|
+
/** Undo and redo have no action to classify: reaching them IS the mutation. */
|
|
825
|
+
private _admitScheduleMutation;
|
|
826
|
+
/**
|
|
827
|
+
* Closes a mutation admitted by `_beginScheduleMutation`, on EVERY exit path.
|
|
828
|
+
*
|
|
829
|
+
* `changedState` false means the mutation was admitted and produced nothing
|
|
830
|
+
* (rejected, non-substantive, or rolled back). The pending revision walks
|
|
831
|
+
* back so the invariant holds and `isCriticalPathSettled` keeps telling the
|
|
832
|
+
* truth, and the calculation this mutation killed for nothing is re-armed.
|
|
833
|
+
*
|
|
834
|
+
* The re-arm goes through the queue and that is not incidental. Started
|
|
835
|
+
* outside it, the calculation would run immediately while the next queued
|
|
836
|
+
* mutation is still waiting, and that mutation would kill it again on
|
|
837
|
+
* admission: a cancel-and-restart treadmill burning a fresh project-wide deep
|
|
838
|
+
* copy per lap. Inside the queue the restart cannot happen until the queue
|
|
839
|
+
* drains, so at most one calculation is armed per settled mutation. The burst
|
|
840
|
+
* scenario will NOT catch a regression here, because there every dispatch
|
|
841
|
+
* succeeds and this path is never taken.
|
|
842
|
+
*
|
|
843
|
+
* It re-arms through `recomputeCriticalPath` rather than enqueueing the job
|
|
844
|
+
* directly, because the queue slot must NOT await the job: the job's own
|
|
845
|
+
* apply block needs a later slot on this same queue, so awaiting it from
|
|
846
|
+
* inside a slot deadlocks the core. `recomputeCriticalPath` already has the
|
|
847
|
+
* shape that returns the job's promise out of the slot instead of awaiting
|
|
848
|
+
* it, and it keeps `_criticalPathReady` pointing at the live calculation.
|
|
849
|
+
*/
|
|
850
|
+
private _settleScheduleMutation;
|
|
737
851
|
dispatch(action: DispatchAction, options?: DispatchOptions): Promise<DispatchResult>;
|
|
852
|
+
applyActivityBatch(action: ActivityBatchAction, options?: DispatchOptions): Promise<DispatchResult>;
|
|
738
853
|
private _dispatchInner;
|
|
854
|
+
private _runDispatch;
|
|
739
855
|
recomputeCriticalPath(): Promise<{
|
|
740
856
|
changes: ChangeSet;
|
|
741
857
|
} | null>;
|
|
@@ -791,13 +907,12 @@ declare class ScheduleCore {
|
|
|
791
907
|
private _recordScheduleMutation;
|
|
792
908
|
private _startCriticalPathForCurrentRevision;
|
|
793
909
|
private _runCriticalPathAndCapture;
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
skipCriticalPath?: boolean;
|
|
797
|
-
}): Promise<ChangeSet | null>;
|
|
910
|
+
undo(options?: UndoOptions): Promise<ChangeSet | null>;
|
|
911
|
+
private _runUndo;
|
|
798
912
|
redo(options?: {
|
|
799
913
|
skipCriticalPath?: boolean;
|
|
800
914
|
}): Promise<ChangeSet | null>;
|
|
915
|
+
private _runRedo;
|
|
801
916
|
canUndo(): boolean;
|
|
802
917
|
canRedo(): boolean;
|
|
803
918
|
clearHistory(): void;
|
|
@@ -955,4 +1070,4 @@ declare const DISPATCH_TRACK_EVENT: {
|
|
|
955
1070
|
};
|
|
956
1071
|
type DispatchTrackEvent = (typeof DISPATCH_TRACK_EVENT)[keyof typeof DISPATCH_TRACK_EVENT];
|
|
957
1072
|
|
|
958
|
-
export { ACTIVITY_TYPE, type ActivityCreter, type ActivityId, type ActivityType, type BackendActivityInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, COLUMN, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CREATION_KIND, type Calendar, type CalendarId, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ColumnName, type ConstraintType, type ConstraintWarning, type CoreActivity, type CreationKind, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_TRACK_EVENT, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, type EntityChange, type FilterCriterion, type FilterDateRange, type FilterField, type FilterState, LINK_CODE_TO_TYPE, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkId, type LinkType, type LinkTypeCode, type LinksBatchOperation, NEW_ACTIVITY_DEFAULTS, type OrderRule, type OrderState, type ParsedInput, type PastedActivityInput, type PastedLinkInput, type PendingRequest, type PersistedEntityIdentity, REJECTION_REASON, ROOT_PARENT_ID, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleEffect, type SectorMetadata, type StatusCriteria, type TrackingEvent, WORK_TIME_DIRECTION, type WorkTimeDirection, checkNoUpdatedLinks, computeExpectedProgress, expectedProgressFromBaseline, getActiveBaseline, getUnsavedActivities, isRootParent, normalizeParentKey, parseFromBackend, willRunCriticalPath, yieldToBrowser };
|
|
1073
|
+
export { ACTIVITY_TYPE, type ActivityBatchAction, type ActivityBatchItem, type ActivityBatchLinkInput, type ActivityBatchMode, type ActivityBatchParentReference, type ActivityBatchReference, type ActivityCreter, type ActivityId, type ActivityType, type BackendActivityInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, COLUMN, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CREATION_KIND, type Calendar, type CalendarId, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ColumnName, type ConstraintType, type ConstraintWarning, type CoreActivity, type CreationKind, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_TRACK_EVENT, type DateGesture, type DateGesturePreview, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, type EntityChange, type FilterCriterion, type FilterDateRange, type FilterField, type FilterState, LINK_CODE_TO_TYPE, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkId, type LinkType, type LinkTypeCode, type LinksBatchOperation, NEW_ACTIVITY_DEFAULTS, type OrderRule, type OrderState, type ParsedInput, type PastedActivityInput, type PastedLinkInput, type PendingRequest, type PersistedEntityIdentity, REJECTION_REASON, ROOT_PARENT_ID, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleEffect, type SectorMetadata, type StatusCriteria, type TrackingEvent, type UndoOptions, WORK_TIME_DIRECTION, type WorkTimeDirection, checkNoUpdatedLinks, computeExpectedProgress, expectedProgressFromBaseline, getActiveBaseline, getUnsavedActivities, isRootParent, normalizeParentKey, parseFromBackend, willRunCriticalPath, yieldToBrowser };
|
package/dist/index.d.ts
CHANGED
|
@@ -322,6 +322,32 @@ interface PersistedEntityIdentity {
|
|
|
322
322
|
readonly id: string;
|
|
323
323
|
readonly proplannerId: number;
|
|
324
324
|
}
|
|
325
|
+
type ActivityBatchMode = 'append' | 'replace';
|
|
326
|
+
type ActivityBatchReference = ActivityId | {
|
|
327
|
+
readonly batchId: string;
|
|
328
|
+
};
|
|
329
|
+
type ActivityBatchParentReference = '0' | ActivityBatchReference;
|
|
330
|
+
interface ActivityBatchItem {
|
|
331
|
+
readonly batchId: string;
|
|
332
|
+
readonly parent: ActivityBatchParentReference;
|
|
333
|
+
readonly index?: number;
|
|
334
|
+
readonly activityId?: ActivityId;
|
|
335
|
+
readonly overrides?: CreationOverrides;
|
|
336
|
+
}
|
|
337
|
+
interface ActivityBatchLinkInput {
|
|
338
|
+
readonly source: ActivityBatchReference;
|
|
339
|
+
readonly target: ActivityBatchReference;
|
|
340
|
+
readonly type: LinkType;
|
|
341
|
+
readonly lag: number;
|
|
342
|
+
readonly linkId?: LinkId;
|
|
343
|
+
}
|
|
344
|
+
interface ActivityBatchAction {
|
|
345
|
+
readonly kind: 'activity-batch';
|
|
346
|
+
readonly mode: ActivityBatchMode;
|
|
347
|
+
readonly items: ReadonlyArray<ActivityBatchItem>;
|
|
348
|
+
readonly links: ReadonlyArray<ActivityBatchLinkInput>;
|
|
349
|
+
readonly eventSource?: string;
|
|
350
|
+
}
|
|
325
351
|
|
|
326
352
|
type DispatchAction = {
|
|
327
353
|
kind: 'persistence-acknowledge';
|
|
@@ -441,6 +467,7 @@ type DispatchAction = {
|
|
|
441
467
|
activityIds: ReadonlyArray<ActivityId>;
|
|
442
468
|
isLookahead: boolean;
|
|
443
469
|
hasLookaheadTasks: boolean;
|
|
470
|
+
acknowledgePersistedLookahead?: boolean;
|
|
444
471
|
eventSource?: string;
|
|
445
472
|
} | {
|
|
446
473
|
kind: 'activity-paste';
|
|
@@ -455,6 +482,7 @@ type DispatchAction = {
|
|
|
455
482
|
links: ReadonlyArray<PastedLinkInput>;
|
|
456
483
|
eventSource?: string;
|
|
457
484
|
};
|
|
485
|
+
type InternalDispatchAction = DispatchAction | ActivityBatchAction;
|
|
458
486
|
interface PastedActivityInput {
|
|
459
487
|
readonly originalId: ActivityId;
|
|
460
488
|
readonly originalParentId: ActivityId | '0';
|
|
@@ -534,7 +562,7 @@ interface ViewStateChange {
|
|
|
534
562
|
readonly visible?: ViewStatePropChange;
|
|
535
563
|
}
|
|
536
564
|
interface ChangeSet {
|
|
537
|
-
source:
|
|
565
|
+
source: InternalDispatchAction | {
|
|
538
566
|
kind: 'init';
|
|
539
567
|
} | {
|
|
540
568
|
kind: 'undo';
|
|
@@ -693,12 +721,56 @@ interface ScheduleCoreInput extends BackendScheduleInput {
|
|
|
693
721
|
reporter?: ScheduleCoreReporter;
|
|
694
722
|
}
|
|
695
723
|
|
|
724
|
+
type DateGesture = {
|
|
725
|
+
readonly kind: 'move';
|
|
726
|
+
readonly activityIds: readonly ActivityId[];
|
|
727
|
+
readonly anchorActivityId: ActivityId;
|
|
728
|
+
} | {
|
|
729
|
+
readonly kind: 'resize-start' | 'resize-end';
|
|
730
|
+
readonly activityId: ActivityId;
|
|
731
|
+
};
|
|
732
|
+
interface DateGesturePreview {
|
|
733
|
+
getDates(activityId: ActivityId, proposedEdgeTimeMs: number): {
|
|
734
|
+
startTimeMs: number;
|
|
735
|
+
endTimeMs: number;
|
|
736
|
+
} | null;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
interface UndoOptions {
|
|
740
|
+
readonly skipCriticalPath?: boolean;
|
|
741
|
+
readonly expectedUndoDepth?: number;
|
|
742
|
+
}
|
|
743
|
+
|
|
696
744
|
declare class ScheduleCore {
|
|
697
745
|
private _status;
|
|
698
746
|
private readonly coreRuntime;
|
|
699
747
|
private readonly _undo;
|
|
700
748
|
private _opQueue;
|
|
701
749
|
private _scheduleRevision;
|
|
750
|
+
/**
|
|
751
|
+
* Revision counting mutations that have been ADMITTED, whether or not they
|
|
752
|
+
* have changed anything yet. `_scheduleRevision` counts the ones that
|
|
753
|
+
* actually did.
|
|
754
|
+
*
|
|
755
|
+
* INVARIANT: `_pendingScheduleRevision >= _scheduleRevision`, and equality
|
|
756
|
+
* means no mutation is in flight.
|
|
757
|
+
*
|
|
758
|
+
* The two exist separately because the useful instant and the knowable
|
|
759
|
+
* instant are not the same one. A critical-path calculation becomes garbage
|
|
760
|
+
* the moment the next mutation is admitted, but whether that mutation is
|
|
761
|
+
* substantive is only knowable once its ChangeSet exists, which is hundreds
|
|
762
|
+
* of milliseconds later at project scale. Measured live on a 12268-activity
|
|
763
|
+
* project: the cancellation flag flipped 929 ms into a 930 ms calculation,
|
|
764
|
+
* 812 into 812 and 785 into 785, because the job's apply block queues behind
|
|
765
|
+
* the very dispatch whose completion cancels it. Cancellation and job end
|
|
766
|
+
* were the same event, so every discarded job ran the whole calculation.
|
|
767
|
+
*
|
|
768
|
+
* Splitting the counter buys the early signal without moving the meaning of
|
|
769
|
+
* `_scheduleRevision`, whose three readers (`isCriticalPathSettled`,
|
|
770
|
+
* `createDateGesturePreview` and the job's own `isCurrent`) are all written
|
|
771
|
+
* against "the state actually changed".
|
|
772
|
+
*/
|
|
773
|
+
private _pendingScheduleRevision;
|
|
702
774
|
private _criticalPathRevision;
|
|
703
775
|
private _activeCriticalPath;
|
|
704
776
|
constructor(input: ScheduleCoreInput);
|
|
@@ -709,6 +781,7 @@ declare class ScheduleCore {
|
|
|
709
781
|
get status(): ScheduleCoreStatus;
|
|
710
782
|
getSector(): Readonly<SectorMetadata>;
|
|
711
783
|
getActivityView(id: ActivityId): Readonly<CoreActivity> | null;
|
|
784
|
+
createDateGesturePreview(gesture: DateGesture): DateGesturePreview;
|
|
712
785
|
getAllActivitiesView(): ReadonlyArray<Readonly<CoreActivity>>;
|
|
713
786
|
getChildrenView(parentId: ActivityId | '0'): ReadonlyArray<Readonly<CoreActivity>>;
|
|
714
787
|
getLinkView(id: LinkId): Readonly<Link> | null;
|
|
@@ -734,8 +807,51 @@ declare class ScheduleCore {
|
|
|
734
807
|
getDeletedActivitiesSinceLastSave(): ReadonlyArray<Readonly<DeletedActivitySnapshot>>;
|
|
735
808
|
getDeletedLinksSinceLastSave(): ReadonlyArray<Readonly<DeletedLinkSnapshot>>;
|
|
736
809
|
private _enqueue;
|
|
810
|
+
/**
|
|
811
|
+
* Marks a mutation as admitted and invalidates the calculation in flight.
|
|
812
|
+
*
|
|
813
|
+
* Called BEFORE `_enqueue`, which is the point of the whole thing: the wait
|
|
814
|
+
* in the operation queue is part of the window a running calculation wastes,
|
|
815
|
+
* and it is the longest part of it when several mutations are already
|
|
816
|
+
* queued.
|
|
817
|
+
*
|
|
818
|
+
* `dispatchChangesSchedulingState` is a pure function of the action, so this
|
|
819
|
+
* decision needs no state and cannot be wrong about the action's nature. What
|
|
820
|
+
* it cannot know yet is whether the mutation will produce anything, which is
|
|
821
|
+
* what `_settleScheduleMutation` reconciles afterwards.
|
|
822
|
+
*/
|
|
823
|
+
private _beginScheduleMutation;
|
|
824
|
+
/** Undo and redo have no action to classify: reaching them IS the mutation. */
|
|
825
|
+
private _admitScheduleMutation;
|
|
826
|
+
/**
|
|
827
|
+
* Closes a mutation admitted by `_beginScheduleMutation`, on EVERY exit path.
|
|
828
|
+
*
|
|
829
|
+
* `changedState` false means the mutation was admitted and produced nothing
|
|
830
|
+
* (rejected, non-substantive, or rolled back). The pending revision walks
|
|
831
|
+
* back so the invariant holds and `isCriticalPathSettled` keeps telling the
|
|
832
|
+
* truth, and the calculation this mutation killed for nothing is re-armed.
|
|
833
|
+
*
|
|
834
|
+
* The re-arm goes through the queue and that is not incidental. Started
|
|
835
|
+
* outside it, the calculation would run immediately while the next queued
|
|
836
|
+
* mutation is still waiting, and that mutation would kill it again on
|
|
837
|
+
* admission: a cancel-and-restart treadmill burning a fresh project-wide deep
|
|
838
|
+
* copy per lap. Inside the queue the restart cannot happen until the queue
|
|
839
|
+
* drains, so at most one calculation is armed per settled mutation. The burst
|
|
840
|
+
* scenario will NOT catch a regression here, because there every dispatch
|
|
841
|
+
* succeeds and this path is never taken.
|
|
842
|
+
*
|
|
843
|
+
* It re-arms through `recomputeCriticalPath` rather than enqueueing the job
|
|
844
|
+
* directly, because the queue slot must NOT await the job: the job's own
|
|
845
|
+
* apply block needs a later slot on this same queue, so awaiting it from
|
|
846
|
+
* inside a slot deadlocks the core. `recomputeCriticalPath` already has the
|
|
847
|
+
* shape that returns the job's promise out of the slot instead of awaiting
|
|
848
|
+
* it, and it keeps `_criticalPathReady` pointing at the live calculation.
|
|
849
|
+
*/
|
|
850
|
+
private _settleScheduleMutation;
|
|
737
851
|
dispatch(action: DispatchAction, options?: DispatchOptions): Promise<DispatchResult>;
|
|
852
|
+
applyActivityBatch(action: ActivityBatchAction, options?: DispatchOptions): Promise<DispatchResult>;
|
|
738
853
|
private _dispatchInner;
|
|
854
|
+
private _runDispatch;
|
|
739
855
|
recomputeCriticalPath(): Promise<{
|
|
740
856
|
changes: ChangeSet;
|
|
741
857
|
} | null>;
|
|
@@ -791,13 +907,12 @@ declare class ScheduleCore {
|
|
|
791
907
|
private _recordScheduleMutation;
|
|
792
908
|
private _startCriticalPathForCurrentRevision;
|
|
793
909
|
private _runCriticalPathAndCapture;
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
skipCriticalPath?: boolean;
|
|
797
|
-
}): Promise<ChangeSet | null>;
|
|
910
|
+
undo(options?: UndoOptions): Promise<ChangeSet | null>;
|
|
911
|
+
private _runUndo;
|
|
798
912
|
redo(options?: {
|
|
799
913
|
skipCriticalPath?: boolean;
|
|
800
914
|
}): Promise<ChangeSet | null>;
|
|
915
|
+
private _runRedo;
|
|
801
916
|
canUndo(): boolean;
|
|
802
917
|
canRedo(): boolean;
|
|
803
918
|
clearHistory(): void;
|
|
@@ -955,4 +1070,4 @@ declare const DISPATCH_TRACK_EVENT: {
|
|
|
955
1070
|
};
|
|
956
1071
|
type DispatchTrackEvent = (typeof DISPATCH_TRACK_EVENT)[keyof typeof DISPATCH_TRACK_EVENT];
|
|
957
1072
|
|
|
958
|
-
export { ACTIVITY_TYPE, type ActivityCreter, type ActivityId, type ActivityType, type BackendActivityInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, COLUMN, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CREATION_KIND, type Calendar, type CalendarId, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ColumnName, type ConstraintType, type ConstraintWarning, type CoreActivity, type CreationKind, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_TRACK_EVENT, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, type EntityChange, type FilterCriterion, type FilterDateRange, type FilterField, type FilterState, LINK_CODE_TO_TYPE, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkId, type LinkType, type LinkTypeCode, type LinksBatchOperation, NEW_ACTIVITY_DEFAULTS, type OrderRule, type OrderState, type ParsedInput, type PastedActivityInput, type PastedLinkInput, type PendingRequest, type PersistedEntityIdentity, REJECTION_REASON, ROOT_PARENT_ID, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleEffect, type SectorMetadata, type StatusCriteria, type TrackingEvent, WORK_TIME_DIRECTION, type WorkTimeDirection, checkNoUpdatedLinks, computeExpectedProgress, expectedProgressFromBaseline, getActiveBaseline, getUnsavedActivities, isRootParent, normalizeParentKey, parseFromBackend, willRunCriticalPath, yieldToBrowser };
|
|
1073
|
+
export { ACTIVITY_TYPE, type ActivityBatchAction, type ActivityBatchItem, type ActivityBatchLinkInput, type ActivityBatchMode, type ActivityBatchParentReference, type ActivityBatchReference, type ActivityCreter, type ActivityId, type ActivityType, type BackendActivityInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, COLUMN, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CREATION_KIND, type Calendar, type CalendarId, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ColumnName, type ConstraintType, type ConstraintWarning, type CoreActivity, type CreationKind, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_TRACK_EVENT, type DateGesture, type DateGesturePreview, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, type EntityChange, type FilterCriterion, type FilterDateRange, type FilterField, type FilterState, LINK_CODE_TO_TYPE, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkId, type LinkType, type LinkTypeCode, type LinksBatchOperation, NEW_ACTIVITY_DEFAULTS, type OrderRule, type OrderState, type ParsedInput, type PastedActivityInput, type PastedLinkInput, type PendingRequest, type PersistedEntityIdentity, REJECTION_REASON, ROOT_PARENT_ID, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleEffect, type SectorMetadata, type StatusCriteria, type TrackingEvent, type UndoOptions, WORK_TIME_DIRECTION, type WorkTimeDirection, checkNoUpdatedLinks, computeExpectedProgress, expectedProgressFromBaseline, getActiveBaseline, getUnsavedActivities, isRootParent, normalizeParentKey, parseFromBackend, willRunCriticalPath, yieldToBrowser };
|