@outbuild-company/schedule-core 1.35.0 → 1.35.1

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
@@ -37274,6 +37274,33 @@ function prepareLookaheadProgressActuals(input) {
37274
37274
  if (input.dataDate === null) return actuals;
37275
37275
  return withMirroredPercent(input.activity, actuals, input.nextProgress);
37276
37276
  }
37277
+ function prepareLookaheadProgressActualsForPersistence(input) {
37278
+ const { resolveCalendar, ...progressInput } = input;
37279
+ const preparedActuals = prepareLookaheadProgressActuals(progressInput);
37280
+ if (input.dataDate === null) {
37281
+ return preparedActuals;
37282
+ }
37283
+ const actualStart = input.intent?.actualStart;
37284
+ const needsActualStartNormalization = actualStart !== void 0 && isUtcMidnight(actualStart);
37285
+ if (!needsActualStartNormalization) return preparedActuals;
37286
+ const intent = normalizeActualStart(input.intent, resolveCalendar);
37287
+ if (intent === void 0) {
37288
+ return preparedActuals;
37289
+ }
37290
+ return prepareLookaheadProgressActuals({ ...progressInput, intent });
37291
+ }
37292
+ function normalizeActualStart(intent, resolveCalendar) {
37293
+ if (intent?.actualStart === void 0) return intent;
37294
+ if (!isUtcMidnight(intent.actualStart)) return intent;
37295
+ const calendar = resolveCalendar();
37296
+ if (calendar === null) {
37297
+ invalid4("ACTIVITY_CALENDAR_REQUIRED");
37298
+ }
37299
+ return {
37300
+ ...intent,
37301
+ actualStart: defaultActualStartTime(intent.actualStart, calendar)
37302
+ };
37303
+ }
37277
37304
  function withMirroredPercent(activity, actuals, nextProgress) {
37278
37305
  const executionStatus = actuals.executionStatus ?? activity.executionStatus;
37279
37306
  if (executionStatus !== P6_EXECUTION_STATUS.IN_PROGRESS) return actuals;
@@ -37344,7 +37371,20 @@ function createScheduleCalendars(input) {
37344
37371
  function createLookaheadDerivedFields(input) {
37345
37372
  const { resolveCalendar } = createScheduleCalendars(input);
37346
37373
  return {
37347
- derive({ previous, next, calendarId, dataDate, totalFloatMethod }) {
37374
+ getCalendar(calendarId) {
37375
+ const calendar = resolveCalendar(calendarId);
37376
+ if (!calendar) {
37377
+ throw new LookaheadActualTransitionError("ACTIVITY_CALENDAR_REQUIRED");
37378
+ }
37379
+ return calendar;
37380
+ },
37381
+ derive({
37382
+ previous,
37383
+ next,
37384
+ calendarId,
37385
+ dataDate,
37386
+ totalFloatMethod
37387
+ }) {
37348
37388
  if (!isP6ActivityState(next)) return null;
37349
37389
  const calendar = resolveCalendar(calendarId);
37350
37390
  if (!calendar) return null;
@@ -38126,6 +38166,7 @@ exports.parseP6DayAsCalendarStart = parseP6DayAsCalendarStart;
38126
38166
  exports.parseP6WallDateAsUtc = parseP6WallDateAsUtc;
38127
38167
  exports.planLookaheadProgressActuals = planLookaheadProgressActuals;
38128
38168
  exports.prepareLookaheadProgressActuals = prepareLookaheadProgressActuals;
38169
+ exports.prepareLookaheadProgressActualsForPersistence = prepareLookaheadProgressActualsForPersistence;
38129
38170
  exports.rescheduledOnLoad = rescheduledOnLoad;
38130
38171
  exports.resolveExpectedFinishDateSelection = resolveExpectedFinishDateSelection;
38131
38172
  exports.resolveLookaheadActualDateSelection = resolveLookaheadActualDateSelection;