@outbuild-company/schedule-core 1.10.3 → 1.10.4

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.d.cts CHANGED
@@ -885,7 +885,6 @@ declare class ScheduleCore {
885
885
  private _reapplyActiveFilter;
886
886
  private _recordScheduleMutation;
887
887
  private _startCriticalPathForCurrentRevision;
888
- private _runCriticalPathAndCapture;
889
888
  undo(options?: UndoOptions): Promise<ChangeSet | null>;
890
889
  private _runUndo;
891
890
  redo(options?: {
package/dist/index.d.ts CHANGED
@@ -885,7 +885,6 @@ declare class ScheduleCore {
885
885
  private _reapplyActiveFilter;
886
886
  private _recordScheduleMutation;
887
887
  private _startCriticalPathForCurrentRevision;
888
- private _runCriticalPathAndCapture;
889
888
  undo(options?: UndoOptions): Promise<ChangeSet | null>;
890
889
  private _runUndo;
891
890
  redo(options?: {
package/dist/index.js CHANGED
@@ -4282,15 +4282,28 @@ var setDuration = (value) => ({
4282
4282
  });
4283
4283
 
4284
4284
  // src/columns/start-date/start-date-pipeline.ts
4285
+ var SIR_APPLY_EVENT_SOURCE = "sir-apply";
4285
4286
  var startDatePipeline = {
4286
4287
  targetField: "startDate",
4287
- canEdit(activity, hierarchy) {
4288
+ canEdit(activity, hierarchy, edit) {
4288
4289
  if (isSummaryActivity2(activity, hierarchy)) {
4289
4290
  return cannotEdit("summary", "summary_column_value");
4290
4291
  }
4291
- if (hasProgress(activity)) {
4292
+ if (!hasProgress(activity)) return canEdit();
4293
+ if (edit?.eventSource !== SIR_APPLY_EVENT_SOURCE) {
4292
4294
  return cannotEdit("has_progress", "cant_edit_activity_with_progress");
4293
4295
  }
4296
+ if (isCompletedActivity(activity)) {
4297
+ return cannotEdit("completed", "cant_edit_completed_activity");
4298
+ }
4299
+ if (!isValidDate(edit.newValue)) return canEdit();
4300
+ if (isSameDay(activity.startDate, edit.newValue)) return canEdit();
4301
+ if (edit.newValue.getTime() > activity.startDate.getTime()) {
4302
+ return cannotEdit(
4303
+ "sir_start_after_progress",
4304
+ "sir_cant_move_start_after_progress"
4305
+ );
4306
+ }
4294
4307
  return canEdit();
4295
4308
  },
4296
4309
  parseInput(rawValue, _activity, _ctx) {
@@ -13860,7 +13873,7 @@ async function dispatchBulkEdit(action, options, deps) {
13860
13873
  const warnings = [];
13861
13874
  let needsAutoSchedule = false;
13862
13875
  for (const edit of action.edits) {
13863
- const outcome = applyOneEdit2(edit, deps);
13876
+ const outcome = applyOneEdit2(edit, deps, action.eventSource);
13864
13877
  verdicts.push(outcome.verdict);
13865
13878
  if (!outcome.verdict.ok || !outcome.changes) continue;
13866
13879
  const constraintWarning = toConstraintWarning(
@@ -13956,7 +13969,7 @@ async function dispatchBulkEdit(action, options, deps) {
13956
13969
  })
13957
13970
  };
13958
13971
  }
13959
- function applyOneEdit2(edit, deps) {
13972
+ function applyOneEdit2(edit, deps, eventSource) {
13960
13973
  const { ctx } = deps;
13961
13974
  const activityId = edit.activityId;
13962
13975
  const pipeline = findPipelineForColumn(edit.column);
@@ -13981,7 +13994,10 @@ function applyOneEdit2(edit, deps) {
13981
13994
  changes: null
13982
13995
  };
13983
13996
  }
13984
- const editGate = pipeline.canEdit(activitySnap, ctx.hierarchy);
13997
+ const editGate = pipeline.canEdit(activitySnap, ctx.hierarchy, {
13998
+ eventSource,
13999
+ newValue: edit.newValue
14000
+ });
13985
14001
  if (!editGate.allowed) {
13986
14002
  return {
13987
14003
  verdict: {
@@ -21344,11 +21360,7 @@ var ScheduleCore = class _ScheduleCore {
21344
21360
  );
21345
21361
  });
21346
21362
  this._criticalPathReady = this._initPromise.then(
21347
- () => this._enqueue(async () => {
21348
- const result = await this._runCriticalPathAndCapture();
21349
- this._criticalPathRevision = this._scheduleRevision;
21350
- return result;
21351
- })
21363
+ () => this._startCriticalPathForCurrentRevision()
21352
21364
  );
21353
21365
  const waitForCriticalPathOnLoad = input.criticalPathOnLoad === true;
21354
21366
  this._ready = waitForCriticalPathOnLoad ? this._criticalPathReady.then(() => void 0) : this._initPromise;
@@ -21986,39 +21998,6 @@ var ScheduleCore = class _ScheduleCore {
21986
21998
  void promise.then(clearIfActive, clearIfActive);
21987
21999
  return promise;
21988
22000
  }
21989
- async _runCriticalPathAndCapture() {
21990
- if (this._status === SCHEDULE_CORE_STATUS.DESTROYED) {
21991
- return {
21992
- changes: {
21993
- source: { kind: "init" },
21994
- activities: [],
21995
- links: [],
21996
- calendars: [],
21997
- trackingEvents: []
21998
- }
21999
- };
22000
- }
22001
- this.coreRuntime.state.beginWriteCapture();
22002
- this.coreRuntime.customIdTracker.beginCustomIdTransaction();
22003
- let changes;
22004
- try {
22005
- await applyCriticalPath(
22006
- this.coreRuntime.state,
22007
- this.coreRuntime.sector.hoursPerDay
22008
- );
22009
- changes = await assembleChangeSet(this.coreRuntime.state, {
22010
- source: { kind: "init" },
22011
- beforeSnap: /* @__PURE__ */ new Map(),
22012
- touchedIds: [],
22013
- scheduledIds: [],
22014
- hoursPerDay: this.coreRuntime.sector.hoursPerDay
22015
- });
22016
- } finally {
22017
- this.coreRuntime.state.endWriteCapture();
22018
- this.coreRuntime.customIdTracker.commitCustomIdTransaction();
22019
- }
22020
- return { changes };
22021
- }
22022
22001
  undo(options = {}) {
22023
22002
  const admitted = this._admitScheduleMutation();
22024
22003
  let changedState = false;