@outbuild-company/schedule-core 1.13.2 → 1.13.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/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +48 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +48 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3595,7 +3595,7 @@ var LAG_UNIT = {
|
|
|
3595
3595
|
MONTH_DHTMLX: "mon",
|
|
3596
3596
|
YEAR: "y"
|
|
3597
3597
|
};
|
|
3598
|
-
var ENTRY_RE = /^(\d+)(fs|ss|ff|sf)?(?:([+-]?)(\d+(?:\.\d+)?)(wk|w|mon|m|d|y)?)?$/i;
|
|
3598
|
+
var ENTRY_RE = /^(\d+)(fs|ss|ff|sf)?(?:([+-]?)(\d+(?:\.\d+)?)(weeks?|wk|w|months?|mon|m|days?|d|years?|y)?)?$/i;
|
|
3599
3599
|
|
|
3600
3600
|
// src/autoscheduler/links/parse-predecessor-string.ts
|
|
3601
3601
|
var DEFAULT_WORKING_DAYS_PER_WEEK = 5;
|
|
@@ -3603,10 +3603,22 @@ var DAYS_PER_MONTH = 30;
|
|
|
3603
3603
|
var DAYS_PER_YEAR = 365;
|
|
3604
3604
|
var FIXED_UNIT_DAYS = {
|
|
3605
3605
|
[LAG_UNIT.DAY]: 1,
|
|
3606
|
+
day: 1,
|
|
3607
|
+
days: 1,
|
|
3606
3608
|
[LAG_UNIT.MONTH]: DAYS_PER_MONTH,
|
|
3607
3609
|
[LAG_UNIT.MONTH_DHTMLX]: DAYS_PER_MONTH,
|
|
3608
|
-
|
|
3610
|
+
month: DAYS_PER_MONTH,
|
|
3611
|
+
months: DAYS_PER_MONTH,
|
|
3612
|
+
[LAG_UNIT.YEAR]: DAYS_PER_YEAR,
|
|
3613
|
+
year: DAYS_PER_YEAR,
|
|
3614
|
+
years: DAYS_PER_YEAR
|
|
3609
3615
|
};
|
|
3616
|
+
var WEEK_UNITS = /* @__PURE__ */ new Set([
|
|
3617
|
+
LAG_UNIT.WEEK,
|
|
3618
|
+
LAG_UNIT.WEEK_DHTMLX,
|
|
3619
|
+
"week",
|
|
3620
|
+
"weeks"
|
|
3621
|
+
]);
|
|
3610
3622
|
function parsePredecessorString(input, options = {}) {
|
|
3611
3623
|
const specs = [];
|
|
3612
3624
|
const errors = [];
|
|
@@ -3631,7 +3643,7 @@ function parseEntry(entry, daysPerWeek) {
|
|
|
3631
3643
|
if (magnitude !== void 0) {
|
|
3632
3644
|
const value = Number(magnitude);
|
|
3633
3645
|
if (Number.isNaN(value)) return null;
|
|
3634
|
-
const unitDays = unit
|
|
3646
|
+
const unitDays = unit !== void 0 && WEEK_UNITS.has(unit) ? daysPerWeek : FIXED_UNIT_DAYS[unit ?? LAG_UNIT.DAY];
|
|
3635
3647
|
const days = value * unitDays;
|
|
3636
3648
|
lag = sign === "-" ? -days : days;
|
|
3637
3649
|
}
|
|
@@ -15345,7 +15357,7 @@ function parseFiniteNonNegative(value) {
|
|
|
15345
15357
|
if (!Number.isFinite(numeric) || numeric < 0) return null;
|
|
15346
15358
|
return numeric;
|
|
15347
15359
|
}
|
|
15348
|
-
function normalizeBaselinePoint(point, reporter, diagnostic) {
|
|
15360
|
+
function normalizeBaselinePoint(point, reporter, diagnostic, isMilestone = false) {
|
|
15349
15361
|
const durationDays = parseFiniteNonNegative(point.duration);
|
|
15350
15362
|
const cost = parseFiniteNonNegative(point.cost);
|
|
15351
15363
|
const workHours = parseFiniteNonNegative(point.hh_work);
|
|
@@ -15361,9 +15373,17 @@ function normalizeBaselinePoint(point, reporter, diagnostic) {
|
|
|
15361
15373
|
);
|
|
15362
15374
|
return null;
|
|
15363
15375
|
}
|
|
15376
|
+
const startDate = parseBaselineDate(point.start_date);
|
|
15377
|
+
const parsedEndDate = parseBaselineDate(point.end_date);
|
|
15378
|
+
const hasInvertedLegacyMilestone = isMilestone && durationDays === 0 && startDate !== null && parsedEndDate !== null && parsedEndDate < startDate;
|
|
15379
|
+
if (hasInvertedLegacyMilestone) {
|
|
15380
|
+
reporter.warn(
|
|
15381
|
+
"[baseline] normalizing inverted zero-duration milestone to one instant"
|
|
15382
|
+
);
|
|
15383
|
+
}
|
|
15364
15384
|
return {
|
|
15365
|
-
startDate
|
|
15366
|
-
endDate:
|
|
15385
|
+
startDate,
|
|
15386
|
+
endDate: hasInvertedLegacyMilestone ? startDate : parsedEndDate,
|
|
15367
15387
|
durationDays,
|
|
15368
15388
|
cost,
|
|
15369
15389
|
workHours,
|
|
@@ -15407,14 +15427,20 @@ function applyBaselinePoints(adapter, points, reporter, recordDiagnostic = noopL
|
|
|
15407
15427
|
}
|
|
15408
15428
|
const changed = [];
|
|
15409
15429
|
for (const [coreId, group] of grouped) {
|
|
15430
|
+
const isMilestone = adapter.getActivity(coreId)?.type === ACTIVITY_TYPE.MILESTONE;
|
|
15410
15431
|
adapter.setActivityField(
|
|
15411
15432
|
coreId,
|
|
15412
15433
|
"baselinePoints",
|
|
15413
15434
|
group.map(
|
|
15414
|
-
(point) => normalizeBaselinePoint(
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15435
|
+
(point) => normalizeBaselinePoint(
|
|
15436
|
+
point,
|
|
15437
|
+
reporter,
|
|
15438
|
+
{
|
|
15439
|
+
record: recordDiagnostic,
|
|
15440
|
+
sampleId: coreId
|
|
15441
|
+
},
|
|
15442
|
+
isMilestone
|
|
15443
|
+
)
|
|
15418
15444
|
).filter((point) => point !== null)
|
|
15419
15445
|
);
|
|
15420
15446
|
changed.push(coreId);
|
|
@@ -20899,13 +20925,18 @@ function parseCriticality(raw, reporter) {
|
|
|
20899
20925
|
);
|
|
20900
20926
|
return false;
|
|
20901
20927
|
}
|
|
20902
|
-
function parseBaselinePoints(raw, reporter, recordDiagnostic, activityId) {
|
|
20928
|
+
function parseBaselinePoints(raw, reporter, recordDiagnostic, activityId, isMilestone) {
|
|
20903
20929
|
if (!Array.isArray(raw)) return [];
|
|
20904
20930
|
return raw.map(
|
|
20905
|
-
(point) => normalizeBaselinePoint(
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
|
|
20931
|
+
(point) => normalizeBaselinePoint(
|
|
20932
|
+
point,
|
|
20933
|
+
reporter,
|
|
20934
|
+
{
|
|
20935
|
+
record: recordDiagnostic,
|
|
20936
|
+
sampleId: activityId
|
|
20937
|
+
},
|
|
20938
|
+
isMilestone
|
|
20939
|
+
)
|
|
20909
20940
|
).filter((point) => point !== null);
|
|
20910
20941
|
}
|
|
20911
20942
|
function parseActivity(raw, context) {
|
|
@@ -20966,7 +20997,8 @@ function parseActivity(raw, context) {
|
|
|
20966
20997
|
raw.baseline_points,
|
|
20967
20998
|
context.reporter,
|
|
20968
20999
|
context.recordDiagnostic,
|
|
20969
|
-
String(raw.unique_id)
|
|
21000
|
+
String(raw.unique_id),
|
|
21001
|
+
isMilestone
|
|
20970
21002
|
),
|
|
20971
21003
|
baselineSnapshot: null,
|
|
20972
21004
|
recursiveDurationHours: durationToHours(
|