@outbuild-company/schedule-core 1.13.3 → 1.13.5

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
@@ -63,8 +63,8 @@ interface BaselineVersion {
63
63
  }
64
64
  /** Backend baseline point accepted at the package boundary. */
65
65
  interface BaselinePoint {
66
- start_date: string;
67
- end_date: string;
66
+ start_date: string | null;
67
+ end_date: string | null;
68
68
  /** Baseline duration in working days. */
69
69
  duration: number;
70
70
  cost: number | string;
package/dist/index.d.ts CHANGED
@@ -63,8 +63,8 @@ interface BaselineVersion {
63
63
  }
64
64
  /** Backend baseline point accepted at the package boundary. */
65
65
  interface BaselinePoint {
66
- start_date: string;
67
- end_date: string;
66
+ start_date: string | null;
67
+ end_date: string | null;
68
68
  /** Baseline duration in working days. */
69
69
  duration: number;
70
70
  cost: number | string;
package/dist/index.js CHANGED
@@ -14865,6 +14865,7 @@ async function dispatchActivitySetProgress(action, options, deps) {
14865
14865
  changes.postProcessors ?? [],
14866
14866
  adapter
14867
14867
  );
14868
+ const autoscheduleFrom = changes.needsAutoSchedule ? ctx.hierarchy.hasChildren(action.activityId) ? AUTOSCHEDULE_SCOPE.ROOTS : action.activityId : null;
14868
14869
  const { scheduledIds } = await runPostMutation(
14869
14870
  {
14870
14871
  adapter,
@@ -14874,7 +14875,7 @@ async function dispatchActivitySetProgress(action, options, deps) {
14874
14875
  },
14875
14876
  {
14876
14877
  action,
14877
- autoscheduleFrom: changes.needsAutoSchedule ? action.activityId : null,
14878
+ autoscheduleFrom,
14878
14879
  recomputeParentsFrom: [],
14879
14880
  collectDirty: (sids) => collectDirtyForInlineEdit(action.activityId, touchedIds, sids),
14880
14881
  now: deps.now,
@@ -15355,7 +15356,7 @@ function parseFiniteNonNegative(value) {
15355
15356
  if (!Number.isFinite(numeric) || numeric < 0) return null;
15356
15357
  return numeric;
15357
15358
  }
15358
- function normalizeBaselinePoint(point, reporter, diagnostic) {
15359
+ function normalizeBaselinePoint(point, reporter, diagnostic, isMilestone = false) {
15359
15360
  const durationDays = parseFiniteNonNegative(point.duration);
15360
15361
  const cost = parseFiniteNonNegative(point.cost);
15361
15362
  const workHours = parseFiniteNonNegative(point.hh_work);
@@ -15371,9 +15372,17 @@ function normalizeBaselinePoint(point, reporter, diagnostic) {
15371
15372
  );
15372
15373
  return null;
15373
15374
  }
15375
+ const startDate = parseBaselineDate(point.start_date);
15376
+ const parsedEndDate = parseBaselineDate(point.end_date);
15377
+ const hasInvertedLegacyMilestone = isMilestone && durationDays === 0 && startDate !== null && parsedEndDate !== null && parsedEndDate < startDate;
15378
+ if (hasInvertedLegacyMilestone) {
15379
+ reporter.warn(
15380
+ "[baseline] normalizing inverted zero-duration milestone to one instant"
15381
+ );
15382
+ }
15374
15383
  return {
15375
- startDate: parseBaselineDate(point.start_date),
15376
- endDate: parseBaselineDate(point.end_date),
15384
+ startDate,
15385
+ endDate: hasInvertedLegacyMilestone ? startDate : parsedEndDate,
15377
15386
  durationDays,
15378
15387
  cost,
15379
15388
  workHours,
@@ -15417,14 +15426,20 @@ function applyBaselinePoints(adapter, points, reporter, recordDiagnostic = noopL
15417
15426
  }
15418
15427
  const changed = [];
15419
15428
  for (const [coreId, group] of grouped) {
15429
+ const isMilestone = adapter.getActivity(coreId)?.type === ACTIVITY_TYPE.MILESTONE;
15420
15430
  adapter.setActivityField(
15421
15431
  coreId,
15422
15432
  "baselinePoints",
15423
15433
  group.map(
15424
- (point) => normalizeBaselinePoint(point, reporter, {
15425
- record: recordDiagnostic,
15426
- sampleId: coreId
15427
- })
15434
+ (point) => normalizeBaselinePoint(
15435
+ point,
15436
+ reporter,
15437
+ {
15438
+ record: recordDiagnostic,
15439
+ sampleId: coreId
15440
+ },
15441
+ isMilestone
15442
+ )
15428
15443
  ).filter((point) => point !== null)
15429
15444
  );
15430
15445
  changed.push(coreId);
@@ -20909,13 +20924,18 @@ function parseCriticality(raw, reporter) {
20909
20924
  );
20910
20925
  return false;
20911
20926
  }
20912
- function parseBaselinePoints(raw, reporter, recordDiagnostic, activityId) {
20927
+ function parseBaselinePoints(raw, reporter, recordDiagnostic, activityId, isMilestone) {
20913
20928
  if (!Array.isArray(raw)) return [];
20914
20929
  return raw.map(
20915
- (point) => normalizeBaselinePoint(point, reporter, {
20916
- record: recordDiagnostic,
20917
- sampleId: activityId
20918
- })
20930
+ (point) => normalizeBaselinePoint(
20931
+ point,
20932
+ reporter,
20933
+ {
20934
+ record: recordDiagnostic,
20935
+ sampleId: activityId
20936
+ },
20937
+ isMilestone
20938
+ )
20919
20939
  ).filter((point) => point !== null);
20920
20940
  }
20921
20941
  function parseActivity(raw, context) {
@@ -20976,7 +20996,8 @@ function parseActivity(raw, context) {
20976
20996
  raw.baseline_points,
20977
20997
  context.reporter,
20978
20998
  context.recordDiagnostic,
20979
- String(raw.unique_id)
20999
+ String(raw.unique_id),
21000
+ isMilestone
20980
21001
  ),
20981
21002
  baselineSnapshot: null,
20982
21003
  recursiveDurationHours: durationToHours(