@outbuild-company/schedule-core 1.6.2 → 1.6.3

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.cjs CHANGED
@@ -4425,29 +4425,6 @@ function toConstraintWarning(activityId, notification) {
4425
4425
  };
4426
4426
  }
4427
4427
 
4428
- // src/constants/activity-properties.ts
4429
- var ACTIVITY_PROPERTY = {
4430
- PARENT: "parentId",
4431
- TYPE: "type",
4432
- START_DATE: "startDate",
4433
- END_DATE: "endDate",
4434
- CONSTRAINT_TYPE: "constraintType",
4435
- CONSTRAINT_DATE: "constraintDate",
4436
- AUTO_SCHEDULING: "autoScheduling",
4437
- PROGRESS: "progress",
4438
- COST: "cost",
4439
- USED_COST: "usedCost",
4440
- REAL_COST: "realCost",
4441
- WORK_HOURS: "workHours",
4442
- REAL_WORK_HOURS: "realWorkHours",
4443
- CORRELATIVE_ID: "correlativeId",
4444
- CUSTOM_ID: "customId",
4445
- NEW_ACTIVITIES_ARRAY: "newActivityIds",
4446
- HAS_NEW_ACTIVITIES: "hasNewActivities"};
4447
- var LINK_PROPERTY = {
4448
- TYPE: "type",
4449
- LAG: "lag"};
4450
-
4451
4428
  // src/columns/types.ts
4452
4429
  var COLUMN_WRITABLE_FIELD_LIST = [
4453
4430
  "name",
@@ -9316,6 +9293,28 @@ async function applyCriticalPath(state, hoursPerDay, isCurrent = () => true) {
9316
9293
  return true;
9317
9294
  }
9318
9295
 
9296
+ // src/constants/activity-properties.ts
9297
+ var ACTIVITY_PROPERTY = {
9298
+ PARENT: "parentId",
9299
+ TYPE: "type",
9300
+ START_DATE: "startDate",
9301
+ END_DATE: "endDate",
9302
+ CONSTRAINT_TYPE: "constraintType",
9303
+ CONSTRAINT_DATE: "constraintDate",
9304
+ PROGRESS: "progress",
9305
+ COST: "cost",
9306
+ USED_COST: "usedCost",
9307
+ REAL_COST: "realCost",
9308
+ WORK_HOURS: "workHours",
9309
+ REAL_WORK_HOURS: "realWorkHours",
9310
+ CORRELATIVE_ID: "correlativeId",
9311
+ CUSTOM_ID: "customId",
9312
+ NEW_ACTIVITIES_ARRAY: "newActivityIds",
9313
+ HAS_NEW_ACTIVITIES: "hasNewActivities"};
9314
+ var LINK_PROPERTY = {
9315
+ TYPE: "type",
9316
+ LAG: "lag"};
9317
+
9319
9318
  // src/propagations/upward/real-cost.ts
9320
9319
  function emitRealCost(state) {
9321
9320
  const rootIds = [];
@@ -9915,16 +9914,14 @@ async function dispatchInlineEdit(action, options, deps) {
9915
9914
  const { adapter, ctx, scheduler, sector } = deps;
9916
9915
  const pipeline = findPipelineForColumn(action.column);
9917
9916
  if (!pipeline) {
9918
- throw new Error(
9919
- `[ScheduleCore] no pipeline registered for column "${action.column}"`
9920
- );
9917
+ return {
9918
+ ok: false,
9919
+ reason: REJECTION_REASON.NO_PIPELINE_FOR_COLUMN
9920
+ };
9921
9921
  }
9922
- if (columnInvalidatesExpandedLinks(action.column)) {
9922
+ if (action.column === COLUMN.DURATION) {
9923
9923
  scheduler.invalidateExpandedLinksCache();
9924
9924
  }
9925
- if (action.column === ACTIVITY_PROPERTY.PARENT) {
9926
- scheduler.invalidateAllCaches();
9927
- }
9928
9925
  const activitySnap = ctx.activityReader.getActivity(action.activityId);
9929
9926
  if (!activitySnap) {
9930
9927
  return { ok: false, reason: REJECTION_REASON.ACTIVITY_NOT_FOUND };
@@ -10055,9 +10052,6 @@ async function dispatchInlineEdit(action, options, deps) {
10055
10052
  })
10056
10053
  };
10057
10054
  }
10058
- function columnInvalidatesExpandedLinks(column) {
10059
- return column === COLUMN.DURATION || column === ACTIVITY_PROPERTY.AUTO_SCHEDULING;
10060
- }
10061
10055
 
10062
10056
  // src/dispatch/handlers/link.ts
10063
10057
  function collectBatchContext(operations, adapter) {
@@ -10567,11 +10561,24 @@ function buildNewActivity(input, adapter) {
10567
10561
  startDate: rawStartDate,
10568
10562
  endDate: rawStartDate
10569
10563
  };
10570
- const startDate = overrides.startDate ? new Date(base.startDate) : adapter.getClosestWorkTime({
10564
+ let startDate = overrides.startDate ? new Date(base.startDate) : adapter.getClosestWorkTime({
10571
10565
  date: base.startDate,
10572
10566
  dir: WORK_TIME_DIRECTION.FUTURE,
10573
10567
  task: base
10574
10568
  });
10569
+ if (!overrides.startDate && parent && isMilestoneType(parent.type)) {
10570
+ const inheritedDay = new Date(parent.startDate);
10571
+ inheritedDay.setUTCHours(0, 0, 0, 0);
10572
+ const snappedDay = new Date(startDate);
10573
+ snappedDay.setUTCHours(0, 0, 0, 0);
10574
+ if (snappedDay.getTime() !== inheritedDay.getTime()) {
10575
+ startDate = adapter.getClosestWorkTime({
10576
+ date: inheritedDay,
10577
+ dir: WORK_TIME_DIRECTION.FUTURE,
10578
+ task: base
10579
+ });
10580
+ }
10581
+ }
10575
10582
  const endDate = adapter.calculateEndDate({
10576
10583
  startDate,
10577
10584
  durationHours: base.durationHours,
@@ -18151,7 +18158,7 @@ function parseActivity(raw, context) {
18151
18158
  context.hoursPerDay
18152
18159
  ),
18153
18160
  isCritical: Boolean(raw.is_critical),
18154
- freeSlackHours: raw.freeSlack,
18161
+ freeSlackHours: null,
18155
18162
  expectedProgress: null,
18156
18163
  expectedProgressBaseline: null,
18157
18164
  status: null,
@@ -18600,7 +18607,7 @@ function createActivityIdGenerator(options = {}) {
18600
18607
 
18601
18608
  // src/generators/link-id-generator.ts
18602
18609
  function createLinkIdGenerator(options = {}) {
18603
- let counter = options.seed ?? Date.now();
18610
+ let counter = options.seed ?? 0;
18604
18611
  const raise = (value) => {
18605
18612
  if (value > counter) counter = value;
18606
18613
  };
@@ -19362,7 +19369,8 @@ var SCHEDULE_CORE_STATUS = {
19362
19369
  };
19363
19370
  function initializeCore(input) {
19364
19371
  const clock = input.clock ?? null;
19365
- const loadNow = clock ? endOfLocalDay(clock()) : null;
19372
+ const initializedAt = clock?.() ?? null;
19373
+ const loadNow = initializedAt ? endOfLocalDay(initializedAt) : null;
19366
19374
  const reporter = input.reporter ?? noopReporter;
19367
19375
  const parsed2 = parseFromBackend(
19368
19376
  {
@@ -19393,6 +19401,7 @@ function initializeCore(input) {
19393
19401
  knownIds: parsed2.activities.map((a) => a.id)
19394
19402
  });
19395
19403
  const linkIdGen = createLinkIdGenerator({
19404
+ seed: initializedAt?.getTime() ?? 0,
19396
19405
  knownIds: parsed2.links.map((l) => l.id)
19397
19406
  });
19398
19407
  const uidGen = createUniqueCorrelativeIdGenerator({
@@ -20568,6 +20577,8 @@ exports.LINK_TYPE_CODE = LINK_TYPE_CODE;
20568
20577
  exports.NEW_ACTIVITY_DEFAULTS = NEW_ACTIVITY_DEFAULTS;
20569
20578
  exports.REJECTION_REASON = REJECTION_REASON;
20570
20579
  exports.ROOT_PARENT_ID = ROOT_PARENT_ID;
20580
+ exports.SCHEDULE_CORE_STATUS = SCHEDULE_CORE_STATUS;
20581
+ exports.STATUS = STATUS;
20571
20582
  exports.ScheduleCore = ScheduleCore;
20572
20583
  exports.WORK_TIME_DIRECTION = WORK_TIME_DIRECTION;
20573
20584
  exports.checkNoUpdatedLinks = checkNoUpdatedLinks;