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