@outbuild-company/schedule-core 1.35.1 → 1.35.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.d.cts CHANGED
@@ -76,6 +76,94 @@ interface CalendarAPI {
76
76
  readonly getWorkHours: (date: Date) => string[];
77
77
  }
78
78
 
79
+ /** Validation failure raised while planning or preparing Lookahead actual dates. */
80
+ type LookaheadActualTransitionErrorCode = 'ACTIVITY_CALENDAR_REQUIRED' | 'ACTUAL_FINISH_BEFORE_START' | 'ACTUAL_FINISH_REMOVAL_NOT_APPLICABLE' | 'ACTUAL_FINISH_REMOVAL_REQUIRED' | 'ACTUAL_FINISH_REQUIRES_100' | 'ACTUAL_START_REQUIRED' | 'DATA_DATE_INACTIVE' | 'INVALID_ACTUAL_DAY' | 'INVALID_ACTUAL_TIME_SOURCE' | 'INVALID_DATA_DATE' | 'INVALID_DISPLAYED_FINISH' | 'INVALID_PROGRESS';
81
+ declare class LookaheadActualTransitionError extends Error {
82
+ readonly code: LookaheadActualTransitionErrorCode;
83
+ constructor(code: LookaheadActualTransitionErrorCode);
84
+ }
85
+ /**
86
+ * Actual dates the user confirmed in the Lookahead progress dialog.
87
+ * `actualFinish: null` is the confirmed removal of the Actual Finish when
88
+ * progress drops below 100 on a completed activity.
89
+ */
90
+ interface LookaheadActualIntent {
91
+ readonly actualStart?: Date;
92
+ readonly actualFinish?: Date | null;
93
+ }
94
+ /** Slice of the P6 activity state the Lookahead progress transition reads. */
95
+ type LookaheadProgressActualActivityState = Pick<P6ActivityDraftState, 'actualStart' | 'actualFinish' | 'remainingDurationHours' | 'executionStatus' | 'suspendDate' | 'resumeDate' | 'physicalPercentComplete' | 'originalDurationHours' | 'percentCompleteType'>;
96
+ /**
97
+ * Input of a Lookahead progress change under a Data Date: the active
98
+ * `dataDate` (`null` when inactive), the activity's P6 slice, the target
99
+ * progress (0–100) and the finish currently displayed to the user.
100
+ */
101
+ interface LookaheadProgressActualInput {
102
+ readonly dataDate: Date | null;
103
+ readonly activity: Readonly<LookaheadProgressActualActivityState>;
104
+ readonly nextProgress: number;
105
+ readonly displayedFinish?: Date | null;
106
+ }
107
+ /**
108
+ * Which actual dates the transition needs: `start` is required when a
109
+ * not-started activity gains progress, `finish` is optional when progress
110
+ * reaches 100, `uncomplete` is required when a completed activity drops
111
+ * below 100 (the Actual Finish must be removed; the Actual Start stays).
112
+ * All are `null` when the Data Date is inactive.
113
+ */
114
+ interface LookaheadProgressActualPlan {
115
+ readonly start: {
116
+ readonly required: true;
117
+ readonly suggestedAt: Date;
118
+ } | null;
119
+ readonly finish: {
120
+ readonly optional: true;
121
+ readonly suggestedAt: Date | null;
122
+ } | null;
123
+ readonly uncomplete: {
124
+ readonly required: true;
125
+ readonly removes: Date;
126
+ } | null;
127
+ }
128
+ /**
129
+ * Combines a `YYYY-MM-DD` day picked by the user with the UTC time of day of
130
+ * `timeSource`. Throws `LookaheadActualTransitionError` on an invalid day or
131
+ * time source.
132
+ */
133
+ declare function resolveLookaheadActualDateSelection(input: {
134
+ readonly selectedDay: string;
135
+ readonly timeSource: Date;
136
+ }): Date;
137
+ /**
138
+ * Decides which actual dates a progress change requires and suggests default
139
+ * values (the Data Date for the start, the displayed finish for the finish).
140
+ * Throws `LookaheadActualTransitionError` on invalid input.
141
+ */
142
+ declare function planLookaheadProgressActuals(input: LookaheadProgressActualInput): LookaheadProgressActualPlan;
143
+ /**
144
+ * Validates the confirmed `intent` against the plan and returns the P6
145
+ * activity patch to dispatch: the actual-date transition plus, while the
146
+ * activity is in progress, `nextProgress` mirrored into the percent field
147
+ * selected by `percentCompleteType` (Physical %, or the Remaining Duration
148
+ * for the duration type; the units type is read-only). Throws
149
+ * `LookaheadActualTransitionError` when a required actual start is missing,
150
+ * a finish is given below 100 %, a completed activity drops below 100 %
151
+ * without the confirmed removal of its Actual Finish, or an intent arrives
152
+ * while the Data Date is inactive.
153
+ */
154
+ declare function prepareLookaheadProgressActuals(input: LookaheadProgressActualInput & {
155
+ readonly intent?: LookaheadActualIntent;
156
+ }): Readonly<Partial<P6ActivityDraftState>>;
157
+ /**
158
+ * Prepares a Lookahead progress patch for persistence, preserving the time of
159
+ * an existing Actual Start or normalizing its first assignment to the activity
160
+ * shift.
161
+ */
162
+ declare function prepareLookaheadProgressActualsForPersistence(input: LookaheadProgressActualInput & {
163
+ readonly intent?: LookaheadActualIntent;
164
+ readonly resolveCalendar: () => CalendarAPI | null;
165
+ }): Readonly<Partial<P6ActivityDraftState>>;
166
+
79
167
  /** Canonical reasons why an activity field edit may be blocked. */
80
168
  declare const EDIT_DENIAL_REASON: {
81
169
  readonly COMPLETED: "completed";
@@ -1336,6 +1424,7 @@ type DispatchAction = {
1336
1424
  isLookahead: boolean;
1337
1425
  hasLookaheadTasks: boolean;
1338
1426
  persistedProgress?: number;
1427
+ persistedActualTransition?: LookaheadActualIntent;
1339
1428
  acknowledgePersistedLookahead?: boolean;
1340
1429
  eventSource?: string;
1341
1430
  } | ScheduleAutoScheduleAction;
@@ -4171,93 +4260,6 @@ declare function resolveExpectedFinishDateSelection(input: {
4171
4260
  readonly displayedFinish: Date;
4172
4261
  }): Date;
4173
4262
 
4174
- /** Validation failure raised while planning or preparing Lookahead actual dates. */
4175
- type LookaheadActualTransitionErrorCode = 'ACTIVITY_CALENDAR_REQUIRED' | 'ACTUAL_FINISH_BEFORE_START' | 'ACTUAL_FINISH_REMOVAL_NOT_APPLICABLE' | 'ACTUAL_FINISH_REMOVAL_REQUIRED' | 'ACTUAL_FINISH_REQUIRES_100' | 'ACTUAL_START_REQUIRED' | 'DATA_DATE_INACTIVE' | 'INVALID_ACTUAL_DAY' | 'INVALID_ACTUAL_TIME_SOURCE' | 'INVALID_DATA_DATE' | 'INVALID_DISPLAYED_FINISH' | 'INVALID_PROGRESS';
4176
- declare class LookaheadActualTransitionError extends Error {
4177
- readonly code: LookaheadActualTransitionErrorCode;
4178
- constructor(code: LookaheadActualTransitionErrorCode);
4179
- }
4180
- /**
4181
- * Actual dates the user confirmed in the Lookahead progress dialog.
4182
- * `actualFinish: null` is the confirmed removal of the Actual Finish when
4183
- * progress drops below 100 on a completed activity.
4184
- */
4185
- interface LookaheadActualIntent {
4186
- readonly actualStart?: Date;
4187
- readonly actualFinish?: Date | null;
4188
- }
4189
- /** Slice of the P6 activity state the Lookahead progress transition reads. */
4190
- type LookaheadProgressActualActivityState = Pick<P6ActivityDraftState, 'actualStart' | 'actualFinish' | 'remainingDurationHours' | 'executionStatus' | 'suspendDate' | 'resumeDate' | 'physicalPercentComplete' | 'originalDurationHours' | 'percentCompleteType'>;
4191
- /**
4192
- * Input of a Lookahead progress change under a Data Date: the active
4193
- * `dataDate` (`null` when inactive), the activity's P6 slice, the target
4194
- * progress (0–100) and the finish currently displayed to the user.
4195
- */
4196
- interface LookaheadProgressActualInput {
4197
- readonly dataDate: Date | null;
4198
- readonly activity: Readonly<LookaheadProgressActualActivityState>;
4199
- readonly nextProgress: number;
4200
- readonly displayedFinish?: Date | null;
4201
- }
4202
- /**
4203
- * Which actual dates the transition needs: `start` is required when a
4204
- * not-started activity gains progress, `finish` is optional when progress
4205
- * reaches 100, `uncomplete` is required when a completed activity drops
4206
- * below 100 (the Actual Finish must be removed; the Actual Start stays).
4207
- * All are `null` when the Data Date is inactive.
4208
- */
4209
- interface LookaheadProgressActualPlan {
4210
- readonly start: {
4211
- readonly required: true;
4212
- readonly suggestedAt: Date;
4213
- } | null;
4214
- readonly finish: {
4215
- readonly optional: true;
4216
- readonly suggestedAt: Date | null;
4217
- } | null;
4218
- readonly uncomplete: {
4219
- readonly required: true;
4220
- readonly removes: Date;
4221
- } | null;
4222
- }
4223
- /**
4224
- * Combines a `YYYY-MM-DD` day picked by the user with the UTC time of day of
4225
- * `timeSource`. Throws `LookaheadActualTransitionError` on an invalid day or
4226
- * time source.
4227
- */
4228
- declare function resolveLookaheadActualDateSelection(input: {
4229
- readonly selectedDay: string;
4230
- readonly timeSource: Date;
4231
- }): Date;
4232
- /**
4233
- * Decides which actual dates a progress change requires and suggests default
4234
- * values (the Data Date for the start, the displayed finish for the finish).
4235
- * Throws `LookaheadActualTransitionError` on invalid input.
4236
- */
4237
- declare function planLookaheadProgressActuals(input: LookaheadProgressActualInput): LookaheadProgressActualPlan;
4238
- /**
4239
- * Validates the confirmed `intent` against the plan and returns the P6
4240
- * activity patch to dispatch: the actual-date transition plus, while the
4241
- * activity is in progress, `nextProgress` mirrored into the percent field
4242
- * selected by `percentCompleteType` (Physical %, or the Remaining Duration
4243
- * for the duration type; the units type is read-only). Throws
4244
- * `LookaheadActualTransitionError` when a required actual start is missing,
4245
- * a finish is given below 100 %, a completed activity drops below 100 %
4246
- * without the confirmed removal of its Actual Finish, or an intent arrives
4247
- * while the Data Date is inactive.
4248
- */
4249
- declare function prepareLookaheadProgressActuals(input: LookaheadProgressActualInput & {
4250
- readonly intent?: LookaheadActualIntent;
4251
- }): Readonly<Partial<P6ActivityDraftState>>;
4252
- /**
4253
- * Prepares a Lookahead progress patch for persistence after calendar
4254
- * resolution, normalizing a midnight Actual Start to the activity shift.
4255
- */
4256
- declare function prepareLookaheadProgressActualsForPersistence(input: LookaheadProgressActualInput & {
4257
- readonly intent?: LookaheadActualIntent;
4258
- readonly resolveCalendar: () => CalendarAPI | null;
4259
- }): Readonly<Partial<P6ActivityDraftState>>;
4260
-
4261
4263
  /** Calendars of the schedule whose working time is read. */
4262
4264
  interface CalendarReaderInput {
4263
4265
  readonly calendars: readonly BackendCalendarInput[];
package/dist/index.d.ts CHANGED
@@ -76,6 +76,94 @@ interface CalendarAPI {
76
76
  readonly getWorkHours: (date: Date) => string[];
77
77
  }
78
78
 
79
+ /** Validation failure raised while planning or preparing Lookahead actual dates. */
80
+ type LookaheadActualTransitionErrorCode = 'ACTIVITY_CALENDAR_REQUIRED' | 'ACTUAL_FINISH_BEFORE_START' | 'ACTUAL_FINISH_REMOVAL_NOT_APPLICABLE' | 'ACTUAL_FINISH_REMOVAL_REQUIRED' | 'ACTUAL_FINISH_REQUIRES_100' | 'ACTUAL_START_REQUIRED' | 'DATA_DATE_INACTIVE' | 'INVALID_ACTUAL_DAY' | 'INVALID_ACTUAL_TIME_SOURCE' | 'INVALID_DATA_DATE' | 'INVALID_DISPLAYED_FINISH' | 'INVALID_PROGRESS';
81
+ declare class LookaheadActualTransitionError extends Error {
82
+ readonly code: LookaheadActualTransitionErrorCode;
83
+ constructor(code: LookaheadActualTransitionErrorCode);
84
+ }
85
+ /**
86
+ * Actual dates the user confirmed in the Lookahead progress dialog.
87
+ * `actualFinish: null` is the confirmed removal of the Actual Finish when
88
+ * progress drops below 100 on a completed activity.
89
+ */
90
+ interface LookaheadActualIntent {
91
+ readonly actualStart?: Date;
92
+ readonly actualFinish?: Date | null;
93
+ }
94
+ /** Slice of the P6 activity state the Lookahead progress transition reads. */
95
+ type LookaheadProgressActualActivityState = Pick<P6ActivityDraftState, 'actualStart' | 'actualFinish' | 'remainingDurationHours' | 'executionStatus' | 'suspendDate' | 'resumeDate' | 'physicalPercentComplete' | 'originalDurationHours' | 'percentCompleteType'>;
96
+ /**
97
+ * Input of a Lookahead progress change under a Data Date: the active
98
+ * `dataDate` (`null` when inactive), the activity's P6 slice, the target
99
+ * progress (0–100) and the finish currently displayed to the user.
100
+ */
101
+ interface LookaheadProgressActualInput {
102
+ readonly dataDate: Date | null;
103
+ readonly activity: Readonly<LookaheadProgressActualActivityState>;
104
+ readonly nextProgress: number;
105
+ readonly displayedFinish?: Date | null;
106
+ }
107
+ /**
108
+ * Which actual dates the transition needs: `start` is required when a
109
+ * not-started activity gains progress, `finish` is optional when progress
110
+ * reaches 100, `uncomplete` is required when a completed activity drops
111
+ * below 100 (the Actual Finish must be removed; the Actual Start stays).
112
+ * All are `null` when the Data Date is inactive.
113
+ */
114
+ interface LookaheadProgressActualPlan {
115
+ readonly start: {
116
+ readonly required: true;
117
+ readonly suggestedAt: Date;
118
+ } | null;
119
+ readonly finish: {
120
+ readonly optional: true;
121
+ readonly suggestedAt: Date | null;
122
+ } | null;
123
+ readonly uncomplete: {
124
+ readonly required: true;
125
+ readonly removes: Date;
126
+ } | null;
127
+ }
128
+ /**
129
+ * Combines a `YYYY-MM-DD` day picked by the user with the UTC time of day of
130
+ * `timeSource`. Throws `LookaheadActualTransitionError` on an invalid day or
131
+ * time source.
132
+ */
133
+ declare function resolveLookaheadActualDateSelection(input: {
134
+ readonly selectedDay: string;
135
+ readonly timeSource: Date;
136
+ }): Date;
137
+ /**
138
+ * Decides which actual dates a progress change requires and suggests default
139
+ * values (the Data Date for the start, the displayed finish for the finish).
140
+ * Throws `LookaheadActualTransitionError` on invalid input.
141
+ */
142
+ declare function planLookaheadProgressActuals(input: LookaheadProgressActualInput): LookaheadProgressActualPlan;
143
+ /**
144
+ * Validates the confirmed `intent` against the plan and returns the P6
145
+ * activity patch to dispatch: the actual-date transition plus, while the
146
+ * activity is in progress, `nextProgress` mirrored into the percent field
147
+ * selected by `percentCompleteType` (Physical %, or the Remaining Duration
148
+ * for the duration type; the units type is read-only). Throws
149
+ * `LookaheadActualTransitionError` when a required actual start is missing,
150
+ * a finish is given below 100 %, a completed activity drops below 100 %
151
+ * without the confirmed removal of its Actual Finish, or an intent arrives
152
+ * while the Data Date is inactive.
153
+ */
154
+ declare function prepareLookaheadProgressActuals(input: LookaheadProgressActualInput & {
155
+ readonly intent?: LookaheadActualIntent;
156
+ }): Readonly<Partial<P6ActivityDraftState>>;
157
+ /**
158
+ * Prepares a Lookahead progress patch for persistence, preserving the time of
159
+ * an existing Actual Start or normalizing its first assignment to the activity
160
+ * shift.
161
+ */
162
+ declare function prepareLookaheadProgressActualsForPersistence(input: LookaheadProgressActualInput & {
163
+ readonly intent?: LookaheadActualIntent;
164
+ readonly resolveCalendar: () => CalendarAPI | null;
165
+ }): Readonly<Partial<P6ActivityDraftState>>;
166
+
79
167
  /** Canonical reasons why an activity field edit may be blocked. */
80
168
  declare const EDIT_DENIAL_REASON: {
81
169
  readonly COMPLETED: "completed";
@@ -1336,6 +1424,7 @@ type DispatchAction = {
1336
1424
  isLookahead: boolean;
1337
1425
  hasLookaheadTasks: boolean;
1338
1426
  persistedProgress?: number;
1427
+ persistedActualTransition?: LookaheadActualIntent;
1339
1428
  acknowledgePersistedLookahead?: boolean;
1340
1429
  eventSource?: string;
1341
1430
  } | ScheduleAutoScheduleAction;
@@ -4171,93 +4260,6 @@ declare function resolveExpectedFinishDateSelection(input: {
4171
4260
  readonly displayedFinish: Date;
4172
4261
  }): Date;
4173
4262
 
4174
- /** Validation failure raised while planning or preparing Lookahead actual dates. */
4175
- type LookaheadActualTransitionErrorCode = 'ACTIVITY_CALENDAR_REQUIRED' | 'ACTUAL_FINISH_BEFORE_START' | 'ACTUAL_FINISH_REMOVAL_NOT_APPLICABLE' | 'ACTUAL_FINISH_REMOVAL_REQUIRED' | 'ACTUAL_FINISH_REQUIRES_100' | 'ACTUAL_START_REQUIRED' | 'DATA_DATE_INACTIVE' | 'INVALID_ACTUAL_DAY' | 'INVALID_ACTUAL_TIME_SOURCE' | 'INVALID_DATA_DATE' | 'INVALID_DISPLAYED_FINISH' | 'INVALID_PROGRESS';
4176
- declare class LookaheadActualTransitionError extends Error {
4177
- readonly code: LookaheadActualTransitionErrorCode;
4178
- constructor(code: LookaheadActualTransitionErrorCode);
4179
- }
4180
- /**
4181
- * Actual dates the user confirmed in the Lookahead progress dialog.
4182
- * `actualFinish: null` is the confirmed removal of the Actual Finish when
4183
- * progress drops below 100 on a completed activity.
4184
- */
4185
- interface LookaheadActualIntent {
4186
- readonly actualStart?: Date;
4187
- readonly actualFinish?: Date | null;
4188
- }
4189
- /** Slice of the P6 activity state the Lookahead progress transition reads. */
4190
- type LookaheadProgressActualActivityState = Pick<P6ActivityDraftState, 'actualStart' | 'actualFinish' | 'remainingDurationHours' | 'executionStatus' | 'suspendDate' | 'resumeDate' | 'physicalPercentComplete' | 'originalDurationHours' | 'percentCompleteType'>;
4191
- /**
4192
- * Input of a Lookahead progress change under a Data Date: the active
4193
- * `dataDate` (`null` when inactive), the activity's P6 slice, the target
4194
- * progress (0–100) and the finish currently displayed to the user.
4195
- */
4196
- interface LookaheadProgressActualInput {
4197
- readonly dataDate: Date | null;
4198
- readonly activity: Readonly<LookaheadProgressActualActivityState>;
4199
- readonly nextProgress: number;
4200
- readonly displayedFinish?: Date | null;
4201
- }
4202
- /**
4203
- * Which actual dates the transition needs: `start` is required when a
4204
- * not-started activity gains progress, `finish` is optional when progress
4205
- * reaches 100, `uncomplete` is required when a completed activity drops
4206
- * below 100 (the Actual Finish must be removed; the Actual Start stays).
4207
- * All are `null` when the Data Date is inactive.
4208
- */
4209
- interface LookaheadProgressActualPlan {
4210
- readonly start: {
4211
- readonly required: true;
4212
- readonly suggestedAt: Date;
4213
- } | null;
4214
- readonly finish: {
4215
- readonly optional: true;
4216
- readonly suggestedAt: Date | null;
4217
- } | null;
4218
- readonly uncomplete: {
4219
- readonly required: true;
4220
- readonly removes: Date;
4221
- } | null;
4222
- }
4223
- /**
4224
- * Combines a `YYYY-MM-DD` day picked by the user with the UTC time of day of
4225
- * `timeSource`. Throws `LookaheadActualTransitionError` on an invalid day or
4226
- * time source.
4227
- */
4228
- declare function resolveLookaheadActualDateSelection(input: {
4229
- readonly selectedDay: string;
4230
- readonly timeSource: Date;
4231
- }): Date;
4232
- /**
4233
- * Decides which actual dates a progress change requires and suggests default
4234
- * values (the Data Date for the start, the displayed finish for the finish).
4235
- * Throws `LookaheadActualTransitionError` on invalid input.
4236
- */
4237
- declare function planLookaheadProgressActuals(input: LookaheadProgressActualInput): LookaheadProgressActualPlan;
4238
- /**
4239
- * Validates the confirmed `intent` against the plan and returns the P6
4240
- * activity patch to dispatch: the actual-date transition plus, while the
4241
- * activity is in progress, `nextProgress` mirrored into the percent field
4242
- * selected by `percentCompleteType` (Physical %, or the Remaining Duration
4243
- * for the duration type; the units type is read-only). Throws
4244
- * `LookaheadActualTransitionError` when a required actual start is missing,
4245
- * a finish is given below 100 %, a completed activity drops below 100 %
4246
- * without the confirmed removal of its Actual Finish, or an intent arrives
4247
- * while the Data Date is inactive.
4248
- */
4249
- declare function prepareLookaheadProgressActuals(input: LookaheadProgressActualInput & {
4250
- readonly intent?: LookaheadActualIntent;
4251
- }): Readonly<Partial<P6ActivityDraftState>>;
4252
- /**
4253
- * Prepares a Lookahead progress patch for persistence after calendar
4254
- * resolution, normalizing a midnight Actual Start to the activity shift.
4255
- */
4256
- declare function prepareLookaheadProgressActualsForPersistence(input: LookaheadProgressActualInput & {
4257
- readonly intent?: LookaheadActualIntent;
4258
- readonly resolveCalendar: () => CalendarAPI | null;
4259
- }): Readonly<Partial<P6ActivityDraftState>>;
4260
-
4261
4263
  /** Calendars of the schedule whose working time is read. */
4262
4264
  interface CalendarReaderInput {
4263
4265
  readonly calendars: readonly BackendCalendarInput[];