@outbuild-company/schedule-core 1.22.0 → 1.23.0

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
@@ -17,6 +17,20 @@ declare const LINK_TYPE: {
17
17
  /** Canonical stored dependency relationship. */
18
18
  type LinkType = (typeof LINK_TYPE)[keyof typeof LINK_TYPE];
19
19
 
20
+ /** Named normalized activity scheduling constraints. */
21
+ declare const CONSTRAINT_TYPE: {
22
+ readonly ASAP: "asap";
23
+ readonly ALAP: "alap";
24
+ readonly SNET: "snet";
25
+ readonly SNLT: "snlt";
26
+ readonly FNET: "fnet";
27
+ readonly FNLT: "fnlt";
28
+ readonly MSO: "mso";
29
+ readonly MFO: "mfo";
30
+ };
31
+ /** Normalized activity scheduling constraint. */
32
+ type ConstraintType = (typeof CONSTRAINT_TYPE)[keyof typeof CONSTRAINT_TYPE];
33
+
20
34
  interface WorkTimeQuery {
21
35
  readonly direction: WorkTimeDirection;
22
36
  readonly date: Date;
@@ -198,13 +212,10 @@ declare const NOT_STARTED_PROGRESS = 0;
198
212
  /** Progress percentage representing a completed activity. */
199
213
  declare const COMPLETED_PROGRESS = 100;
200
214
 
201
- declare const CREATION_OVERRIDE_FIELD_LIST: readonly ["name", "description", "type", "startDate", "durationHours", "constraintType", "constraintDate", "calendarId", "assignedDefaultCalendar", "autoScheduling", "progress", "cost", "usedCost", "realCost", "workHours", "realWorkHours", "ponderator", "hasCustomPonderator", "customId", "subcontractId", "responsableIds", "tagIds", "isLookahead"];
202
- type CreationOverrideField = (typeof CREATION_OVERRIDE_FIELD_LIST)[number];
203
- type CreationOverrides = Partial<Pick<CoreActivity, CreationOverrideField>>;
204
-
205
215
  /** Discriminators for commands accepted by {@link ScheduleCore.dispatch}. */
206
216
  declare const DISPATCH_ACTION_KIND: {
207
217
  readonly ACTIVITY_CLIPBOARD_CLEAR: "activity-clipboard-clear";
218
+ readonly ACTIVITY_CLIPBOARD_IMPORT: "activity-clipboard-import";
208
219
  readonly ACTIVITY_COPY: "activity-copy";
209
220
  readonly CALENDAR_RECONCILE: "calendar-reconcile";
210
221
  readonly ACTIVITY_PASTE_COPIED: "activity-paste-copied";
@@ -722,6 +733,11 @@ type DispatchAction = {
722
733
  } | {
723
734
  kind: typeof DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR;
724
735
  eventSource?: string;
736
+ } | {
737
+ kind: typeof DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_IMPORT;
738
+ snapshot: ActivityClipboardSnapshot;
739
+ references?: ActivityClipboardReferences;
740
+ eventSource?: string;
725
741
  } | {
726
742
  kind: typeof DISPATCH_ACTION_KIND.ACTIVITY_PASTE_COPIED;
727
743
  destination: {
@@ -1578,19 +1594,38 @@ interface EntityChange<T> {
1578
1594
  after: Readonly<T> | null;
1579
1595
  }
1580
1596
 
1581
- /** Named normalized activity scheduling constraints. */
1582
- declare const CONSTRAINT_TYPE: {
1583
- readonly ASAP: "asap";
1584
- readonly ALAP: "alap";
1585
- readonly SNET: "snet";
1586
- readonly SNLT: "snlt";
1587
- readonly FNET: "fnet";
1588
- readonly FNLT: "fnlt";
1589
- readonly MSO: "mso";
1590
- readonly MFO: "mfo";
1591
- };
1592
- /** Normalized activity scheduling constraint. */
1593
- type ConstraintType = (typeof CONSTRAINT_TYPE)[keyof typeof CONSTRAINT_TYPE];
1597
+ declare const CREATION_OVERRIDE_FIELD_LIST: readonly ["name", "description", "type", "startDate", "durationHours", "constraintType", "constraintDate", "calendarId", "assignedDefaultCalendar", "autoScheduling", "progress", "cost", "usedCost", "realCost", "workHours", "realWorkHours", "ponderator", "hasCustomPonderator", "customId", "subcontractId", "responsableIds", "tagIds", "isLookahead"];
1598
+ type CreationOverrideField = (typeof CREATION_OVERRIDE_FIELD_LIST)[number];
1599
+ type CreationOverrides = Partial<Pick<CoreActivity, CreationOverrideField>>;
1600
+
1601
+ /** One copied activity: its identity in the source schedule plus the fields a paste recreates. */
1602
+ interface ActivityClipboardEntry {
1603
+ readonly originalId: ActivityId;
1604
+ readonly originalParentId: ActivityId | typeof ROOT_PARENT_ID;
1605
+ readonly overrides: CreationOverrides;
1606
+ }
1607
+ /**
1608
+ * Portable snapshot of the activity clipboard.
1609
+ *
1610
+ * `originalId`, `originalParentId` and the link endpoints are only mapping
1611
+ * keys inside the snapshot, so a snapshot exported from one schedule can be
1612
+ * imported into another one.
1613
+ */
1614
+ interface ActivityClipboardSnapshot {
1615
+ readonly activities: ReadonlyArray<ActivityClipboardEntry>;
1616
+ readonly links: ReadonlyArray<Readonly<Link>>;
1617
+ }
1618
+ /**
1619
+ * Consumer-owned reference catalogs of the destination schedule.
1620
+ *
1621
+ * Every provided list filters the copied field on import; an omitted list
1622
+ * leaves that field untouched.
1623
+ */
1624
+ interface ActivityClipboardReferences {
1625
+ readonly subcontractIds?: ReadonlyArray<number>;
1626
+ readonly responsableIds?: ReadonlyArray<string>;
1627
+ readonly tagIds?: ReadonlyArray<string>;
1628
+ }
1594
1629
 
1595
1630
  declare const SAVE_FIELD_POLICY: {
1596
1631
  readonly TRACKED: "tracked";
@@ -1950,6 +1985,12 @@ interface ScheduleActivitiesApi {
1950
1985
  * @param currentCustomId - Existing value to ignore, or `null`.
1951
1986
  */
1952
1987
  isCustomIdInUse(customId: string, currentCustomId?: string | null): boolean;
1988
+ /**
1989
+ * Reads the activity clipboard as a portable snapshot.
1990
+ *
1991
+ * @returns A defensive copy, or `null` when nothing has been copied.
1992
+ */
1993
+ clipboard(): ActivityClipboardSnapshot | null;
1953
1994
  /**
1954
1995
  * Creates one activity through the canonical dispatch pipeline.
1955
1996
  *
@@ -2071,6 +2112,21 @@ interface ScheduleActivitiesApi {
2071
2112
  duplicate(activityIds: ReadonlyArray<ActivityId>, context?: MutationContext): Promise<DispatchResult>;
2072
2113
  /** @returns The complete result of clearing core-owned clipboard state. */
2073
2114
  clearClipboard(context?: MutationContext): Promise<DispatchResult>;
2115
+ /**
2116
+ * Replaces the activity clipboard with a snapshot exported elsewhere.
2117
+ *
2118
+ * Copied `calendarId` values unknown to this schedule are dropped so the
2119
+ * paste falls back to the schedule default calendar; every list in
2120
+ * `references` filters the matching copied field. Rejects an empty
2121
+ * snapshot (`clipboard_empty`) or one whose links point outside its own
2122
+ * activities (`clipboard_snapshot_invalid`). Never touches history or
2123
+ * persistence tracking.
2124
+ * @param snapshot - Snapshot read through {@link ScheduleActivitiesApi.clipboard}.
2125
+ * @param references - Destination reference catalogs, when known.
2126
+ * @param context - Optional consumer event source.
2127
+ * @returns The complete dispatch result.
2128
+ */
2129
+ importClipboard(snapshot: ActivityClipboardSnapshot, references?: ActivityClipboardReferences, context?: MutationContext): Promise<DispatchResult>;
2074
2130
  /**
2075
2131
  * Synchronizes consumer-owned lookahead metadata into core state.
2076
2132
  *
@@ -2978,6 +3034,15 @@ declare class ScheduleCore {
2978
3034
  getChildrenIds(parentId: ActivityId | typeof ROOT_PARENT_ID): ReadonlyArray<ActivityId>;
2979
3035
  /** @returns A defensive snapshot of selected activity IDs. */
2980
3036
  getSelectedActivityIds(): string[];
3037
+ /**
3038
+ * Reads the core-owned activity clipboard as a portable snapshot.
3039
+ *
3040
+ * The snapshot can be imported into another `ScheduleCore` through the
3041
+ * `activity-clipboard-import` command, which is how a copy survives the
3042
+ * replacement of the schedule instance.
3043
+ * @returns A defensive copy, or `null` when nothing has been copied.
3044
+ */
3045
+ getActivityClipboardView(): ActivityClipboardSnapshot | null;
2981
3046
  /** @returns A defensive snapshot of explicitly hidden activity IDs. */
2982
3047
  getHiddenActivityIds(): string[];
2983
3048
  /** @returns A defensive snapshot of activity IDs not currently hidden. */
@@ -3602,6 +3667,7 @@ declare const REJECTION_REASON: {
3602
3667
  readonly ACTIVITY_IDS_EMPTY: "activity_ids_empty";
3603
3668
  readonly NO_ACTIVITY_SELECTION: "no_activity_selection";
3604
3669
  readonly CLIPBOARD_EMPTY: "clipboard_empty";
3670
+ readonly CLIPBOARD_SNAPSHOT_INVALID: "clipboard_snapshot_invalid";
3605
3671
  readonly ACTIVITY_PASTE_INVARIANT_FAILED: "activity_paste_invariant_failed";
3606
3672
  readonly SOLE_SCHEDULE_ROOT: "sole_schedule_root";
3607
3673
  readonly ANCHOR_SIBLING_CONFLICT: "anchor_sibling_conflict";
@@ -3631,4 +3697,4 @@ declare const DISPATCH_TRACK_EVENT: {
3631
3697
  /** Consumer analytics event name emitted by a schedule mutation. */
3632
3698
  type DispatchTrackEvent = (typeof DISPATCH_TRACK_EVENT)[keyof typeof DISPATCH_TRACK_EVENT];
3633
3699
 
3634
- export { ACTIVITY_BATCH_ACTION_KIND, ACTIVITY_BATCH_MODE, ACTIVITY_DATE_EDGE, ACTIVITY_FIELD, ACTIVITY_PONDERATOR_CRITERION, ACTIVITY_PROGRESS_ORIGIN, ACTIVITY_TYPE, type ActivityBaselineSnapshot, type ActivityBatchAction, type ActivityBatchInput, type ActivityBatchItem, type ActivityBatchItemInput, type ActivityBatchLinkInput$1 as ActivityBatchLinkInput, type ActivityBatchMode, type ActivityBatchParentReference, type ActivityBatchReference, type ActivityBulkEdit, type ActivityCreateInput, type ActivityCreationOverrides, type ActivityCreter, type ActivityDateEdge, type ActivityDateEdit, type ActivityField, type ActivityFieldEdit, type ActivityFieldValue, type ActivityId, type ActivityLookaheadSyncInput, type ActivityMoveInput, type ActivityStatus, type ActivityType, type ApplyLookaheadConversionInput, type BackendActivityInput, type BackendCalendarExceptionInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BackendShiftInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, CHANGE_SET_SOURCE_KIND, COLUMN, COMPLETED_PROGRESS, CONFIRMATION_KIND, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CONSTRAINT_WARNING_KIND, CREATION_KIND, type Calendar, type CalendarId, type CalendarLike, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ChangeSetSource, type ColumnName, type ConfirmationAlternative, type ConfirmationKind, type ConfirmationRequest, type ConstraintType, type ConstraintWarning, type CoreActivity, type CoreBaselinePoint, type CreationKind, type CriticalPathResult, P6_PROPERTY_CONTRACT as DATA_DATE_PROPERTY_CONTRACT, DATE_GESTURE_KIND, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_LINK_OPERATION_KIND, DISPATCH_TRACK_EVENT, type P6ActivityCalculationInputs as DataDateActivityCalculationInputs, type P6ActivityColumnKey as DataDateActivityColumnKey, type P6ActivityData as DataDateActivityData, type P6ActivityDraftState as DataDateActivityDraftState, type P6ActivityInputPatch as DataDateActivityInputPatch, type P6ActivityState as DataDateActivityState, type P6ActivityType as DataDateActivityType, P6CapabilityError as DataDateCapabilityError, type P6CapabilityErrorCode as DataDateCapabilityErrorCode, type P6DependencyReference as DataDateDependencyReference, type P6DiagnosticProjectIdentity as DataDateDiagnosticProjectIdentity, type P6DiagnosticRelationship as DataDateDiagnosticRelationship, type P6DiagnosticRelationshipType as DataDateDiagnosticRelationshipType, type P6DurationType as DataDateDurationType, type P6EndingActivityOption as DataDateEndingActivityOption, type P6EndingActivityPage as DataDateEndingActivityPage, type P6EndingActivitySearch as DataDateEndingActivitySearch, type P6MappedScheduleOptions as DataDateMappedScheduleOptions, type P6MissingActivityInput as DataDateMissingActivityInput, type P6OutOfSequencePolicy as DataDateOutOfSequencePolicy, type P6ProjectPlannedStartChange as DataDateProjectPlannedStartChange, type P6ProjectState as DataDateProjectState, type P6PropertyContractRow as DataDatePropertyContractRow, type P6PropertyEdgeCases as DataDatePropertyEdgeCases, type P6RawProjectOptions as DataDateRawProjectOptions, type P6RawScheduleOptions as DataDateRawScheduleOptions, type P6RequiredHistoricalField as DataDateRequiredHistoricalField, type P6ResourceAssignment as DataDateResourceAssignment, type P6ScheduleDiagnostic as DataDateScheduleDiagnostic, type P6ScheduleDiagnosticCode as DataDateScheduleDiagnosticCode, type P6ScheduleInput as DataDateScheduleInput, type P6ScheduleReadiness as DataDateScheduleReadiness, type P6ScheduleResult as DataDateScheduleResult, type P6ScheduleRunLog as DataDateScheduleRunLog, type P6ScheduleSettings as DataDateScheduleSettings, type P6ScheduleWarning as DataDateScheduleWarning, type P6SettingsChange as DataDateSettingsChange, type DateGesture, type DateGestureKind, type DateGesturePreview, type DatesBatchVerdict, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchManyAction, type DispatchManyChangeSetSource, type DispatchManyResult, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, EDIT_ALERT_KEY, EDIT_DENIAL_REASON, ENTITY_CHANGE_KIND, type EditAlertKey, type EditDenialReason, type EditResult, type EditableColumnName, type EffectiveGraphAudit, type EntityChange, type ActivityBatchLinkInput as ErgonomicActivityBatchLinkInput, type ExpectedProgressAdapter, FILTER_FIELD, FILTER_LOGIC, FILTER_OPERATOR, FILTER_REJECTION_REASON, FILTER_VALUE_KIND, FLAT_WBS_DEPTH, type FilterCriterion, type FilterCriterionGroup, type FilterCriterionValue, type FilterDateRange, type FilterField, type FilterLogic, type FilterOperator, type FilterRejection, type FilterState, type FilterValueKind, GROUP_ID_PREFIX, GROUP_ID_SEPARATOR, type GroupCriterion, type GroupCriterionInput, type GroupLevelWindow, type GroupState, type GroupStateInput, type ImpactRequestSyncInput, LINK_BATCH_OPERATION_KIND, LINK_CODE, LINK_CODE_TO_TYPE, LINK_REJECTION_REASON, LINK_RELATIONSHIP, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkBatchOperationKind, type LinkBatchRequest, type LinkBatchVerdict, type LinkCreateRequest, type LinkId, type LinkPatchRequest, type LinkRejection, type LinkRelationship, type LinkType, type LinkTypeCode, type LinkUpdateAction, type LinksBatchOperation, type LoadDiagnostic, type LoadDiagnosticCode, type LookaheadActualIntent, LookaheadActualTransitionError, type LookaheadActualTransitionErrorCode, type LookaheadConversionFormerParent, type LookaheadConversionGroup, type LookaheadConversionInput, type LookaheadConversionMilestoneMove, type LookaheadConversionPlan, type LookaheadConversionResult, type LookaheadDerivedCalendars, type LookaheadDerivedFields, type LookaheadDerivedFieldsResolver, type LookaheadDerivedInput, type LookaheadProgressActualActivityState, type LookaheadProgressActualInput, type LookaheadProgressActualPlan, MINIMUM_GROUP_DEPTH, MINIMUM_GROUP_LEVEL, type MutationContext, NEW_ACTIVITY_DEFAULTS, NOT_STARTED_PROGRESS, ORDER_DIRECTION, ORDER_MODE, type OrderDirection, type OrderMode, type OrderRule, type OrderState, type ParsedInput, type PendingRequest, type PersistableActivityField, type PersistedEntityIdentity, type PersistenceCheckpoint, type PipelineColumnName, type ProjectWorkHours, REJECTION_REASON, ROOT_PARENT_ID, SCHEDULE_CORE_STATUS, SCHEDULE_EFFECT_KIND, SIR_AUTO_REJECT_REASON, STATUS, STATUS_CRITERIA, type ScheduleActivitiesApi, type ScheduleApiNamespaces, type ScheduleAutoScheduleAction, type ScheduleBaselinesApi, type ScheduleCalendarsApi, type ScheduleCellsApi, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleCriticalPathApi, type ScheduleP6Api as ScheduleDataDatesApi, type ScheduleDiagnosticsApi, type ScheduleEffect, type ScheduleHistoryApi, type ScheduleImpactRequestsApi, type ScheduleLinksApi, type SchedulePersistenceApi, type ScheduleProjectionApi, type ScheduleSelectionApi, type ScheduleViewApi, type SectorMetadata, type SelectionToggleInput, type StaticActivityDefaults, type StatusCriteria, type TrackingEvent, UNASSIGNED_GROUP_LABEL, UNASSIGNED_VALUE_ID, type UndoOptions, VIEW_ATTRIBUTE_KIND, VISUAL_ROW_KIND, type ViewAttributeAssignmentInput, type ViewAttributeCatalogInput, type ViewAttributeFilterCriterion, type ViewAttributeOrderRule, type ViewAttributeValueInput, type ViewFilterInput, type ViewStateChange, type ViewStatePropChange, type VisualRow, WORK_TIME_DIRECTION, type WbsDepth, type WithProplannerId, type WorkTimeDirection, allowedSecondaryConstraintTypes, appendGroupRowId, buildGroupRowId, checkNoUpdatedLinks, computeExpectedProgress, createLookaheadDerivedFields, createOutbuildP6ScheduleSettings as createOutbuildDataDateScheduleSettings, createSchedule, expectedProgressFromBaseline, formatUtcAsP6WallDate, getActiveBaseline, getUnsavedActivities, isRootParent, isViewAttributeCriterion, isViewAttributeOrderRule, mapP6ScheduleOptions as mapDataDateScheduleOptions, normalizeParentKey, parseFromBackend, parseP6DayAsCalendarStart, parseP6WallDateAsUtc, planLookaheadProgressActuals, prepareLookaheadProgressActuals, resolveExpectedFinishDateSelection, resolveLookaheadActualDateSelection, willRunCriticalPath, yieldToBrowser };
3700
+ export { ACTIVITY_BATCH_ACTION_KIND, ACTIVITY_BATCH_MODE, ACTIVITY_DATE_EDGE, ACTIVITY_FIELD, ACTIVITY_PONDERATOR_CRITERION, ACTIVITY_PROGRESS_ORIGIN, ACTIVITY_TYPE, type ActivityBaselineSnapshot, type ActivityBatchAction, type ActivityBatchInput, type ActivityBatchItem, type ActivityBatchItemInput, type ActivityBatchLinkInput$1 as ActivityBatchLinkInput, type ActivityBatchMode, type ActivityBatchParentReference, type ActivityBatchReference, type ActivityBulkEdit, type ActivityClipboardEntry, type ActivityClipboardReferences, type ActivityClipboardSnapshot, type ActivityCreateInput, type ActivityCreationOverrides, type ActivityCreter, type ActivityDateEdge, type ActivityDateEdit, type ActivityField, type ActivityFieldEdit, type ActivityFieldValue, type ActivityId, type ActivityLookaheadSyncInput, type ActivityMoveInput, type ActivityStatus, type ActivityType, type ApplyLookaheadConversionInput, type BackendActivityInput, type BackendCalendarExceptionInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BackendShiftInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, CHANGE_SET_SOURCE_KIND, COLUMN, COMPLETED_PROGRESS, CONFIRMATION_KIND, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CONSTRAINT_WARNING_KIND, CREATION_KIND, type Calendar, type CalendarId, type CalendarLike, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ChangeSetSource, type ColumnName, type ConfirmationAlternative, type ConfirmationKind, type ConfirmationRequest, type ConstraintType, type ConstraintWarning, type CoreActivity, type CoreBaselinePoint, type CreationKind, type CriticalPathResult, P6_PROPERTY_CONTRACT as DATA_DATE_PROPERTY_CONTRACT, DATE_GESTURE_KIND, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_LINK_OPERATION_KIND, DISPATCH_TRACK_EVENT, type P6ActivityCalculationInputs as DataDateActivityCalculationInputs, type P6ActivityColumnKey as DataDateActivityColumnKey, type P6ActivityData as DataDateActivityData, type P6ActivityDraftState as DataDateActivityDraftState, type P6ActivityInputPatch as DataDateActivityInputPatch, type P6ActivityState as DataDateActivityState, type P6ActivityType as DataDateActivityType, P6CapabilityError as DataDateCapabilityError, type P6CapabilityErrorCode as DataDateCapabilityErrorCode, type P6DependencyReference as DataDateDependencyReference, type P6DiagnosticProjectIdentity as DataDateDiagnosticProjectIdentity, type P6DiagnosticRelationship as DataDateDiagnosticRelationship, type P6DiagnosticRelationshipType as DataDateDiagnosticRelationshipType, type P6DurationType as DataDateDurationType, type P6EndingActivityOption as DataDateEndingActivityOption, type P6EndingActivityPage as DataDateEndingActivityPage, type P6EndingActivitySearch as DataDateEndingActivitySearch, type P6MappedScheduleOptions as DataDateMappedScheduleOptions, type P6MissingActivityInput as DataDateMissingActivityInput, type P6OutOfSequencePolicy as DataDateOutOfSequencePolicy, type P6ProjectPlannedStartChange as DataDateProjectPlannedStartChange, type P6ProjectState as DataDateProjectState, type P6PropertyContractRow as DataDatePropertyContractRow, type P6PropertyEdgeCases as DataDatePropertyEdgeCases, type P6RawProjectOptions as DataDateRawProjectOptions, type P6RawScheduleOptions as DataDateRawScheduleOptions, type P6RequiredHistoricalField as DataDateRequiredHistoricalField, type P6ResourceAssignment as DataDateResourceAssignment, type P6ScheduleDiagnostic as DataDateScheduleDiagnostic, type P6ScheduleDiagnosticCode as DataDateScheduleDiagnosticCode, type P6ScheduleInput as DataDateScheduleInput, type P6ScheduleReadiness as DataDateScheduleReadiness, type P6ScheduleResult as DataDateScheduleResult, type P6ScheduleRunLog as DataDateScheduleRunLog, type P6ScheduleSettings as DataDateScheduleSettings, type P6ScheduleWarning as DataDateScheduleWarning, type P6SettingsChange as DataDateSettingsChange, type DateGesture, type DateGestureKind, type DateGesturePreview, type DatesBatchVerdict, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchManyAction, type DispatchManyChangeSetSource, type DispatchManyResult, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, EDIT_ALERT_KEY, EDIT_DENIAL_REASON, ENTITY_CHANGE_KIND, type EditAlertKey, type EditDenialReason, type EditResult, type EditableColumnName, type EffectiveGraphAudit, type EntityChange, type ActivityBatchLinkInput as ErgonomicActivityBatchLinkInput, type ExpectedProgressAdapter, FILTER_FIELD, FILTER_LOGIC, FILTER_OPERATOR, FILTER_REJECTION_REASON, FILTER_VALUE_KIND, FLAT_WBS_DEPTH, type FilterCriterion, type FilterCriterionGroup, type FilterCriterionValue, type FilterDateRange, type FilterField, type FilterLogic, type FilterOperator, type FilterRejection, type FilterState, type FilterValueKind, GROUP_ID_PREFIX, GROUP_ID_SEPARATOR, type GroupCriterion, type GroupCriterionInput, type GroupLevelWindow, type GroupState, type GroupStateInput, type ImpactRequestSyncInput, LINK_BATCH_OPERATION_KIND, LINK_CODE, LINK_CODE_TO_TYPE, LINK_REJECTION_REASON, LINK_RELATIONSHIP, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkBatchOperationKind, type LinkBatchRequest, type LinkBatchVerdict, type LinkCreateRequest, type LinkId, type LinkPatchRequest, type LinkRejection, type LinkRelationship, type LinkType, type LinkTypeCode, type LinkUpdateAction, type LinksBatchOperation, type LoadDiagnostic, type LoadDiagnosticCode, type LookaheadActualIntent, LookaheadActualTransitionError, type LookaheadActualTransitionErrorCode, type LookaheadConversionFormerParent, type LookaheadConversionGroup, type LookaheadConversionInput, type LookaheadConversionMilestoneMove, type LookaheadConversionPlan, type LookaheadConversionResult, type LookaheadDerivedCalendars, type LookaheadDerivedFields, type LookaheadDerivedFieldsResolver, type LookaheadDerivedInput, type LookaheadProgressActualActivityState, type LookaheadProgressActualInput, type LookaheadProgressActualPlan, MINIMUM_GROUP_DEPTH, MINIMUM_GROUP_LEVEL, type MutationContext, NEW_ACTIVITY_DEFAULTS, NOT_STARTED_PROGRESS, ORDER_DIRECTION, ORDER_MODE, type OrderDirection, type OrderMode, type OrderRule, type OrderState, type ParsedInput, type PendingRequest, type PersistableActivityField, type PersistedEntityIdentity, type PersistenceCheckpoint, type PipelineColumnName, type ProjectWorkHours, REJECTION_REASON, ROOT_PARENT_ID, SCHEDULE_CORE_STATUS, SCHEDULE_EFFECT_KIND, SIR_AUTO_REJECT_REASON, STATUS, STATUS_CRITERIA, type ScheduleActivitiesApi, type ScheduleApiNamespaces, type ScheduleAutoScheduleAction, type ScheduleBaselinesApi, type ScheduleCalendarsApi, type ScheduleCellsApi, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleCriticalPathApi, type ScheduleP6Api as ScheduleDataDatesApi, type ScheduleDiagnosticsApi, type ScheduleEffect, type ScheduleHistoryApi, type ScheduleImpactRequestsApi, type ScheduleLinksApi, type SchedulePersistenceApi, type ScheduleProjectionApi, type ScheduleSelectionApi, type ScheduleViewApi, type SectorMetadata, type SelectionToggleInput, type StaticActivityDefaults, type StatusCriteria, type TrackingEvent, UNASSIGNED_GROUP_LABEL, UNASSIGNED_VALUE_ID, type UndoOptions, VIEW_ATTRIBUTE_KIND, VISUAL_ROW_KIND, type ViewAttributeAssignmentInput, type ViewAttributeCatalogInput, type ViewAttributeFilterCriterion, type ViewAttributeOrderRule, type ViewAttributeValueInput, type ViewFilterInput, type ViewStateChange, type ViewStatePropChange, type VisualRow, WORK_TIME_DIRECTION, type WbsDepth, type WithProplannerId, type WorkTimeDirection, allowedSecondaryConstraintTypes, appendGroupRowId, buildGroupRowId, checkNoUpdatedLinks, computeExpectedProgress, createLookaheadDerivedFields, createOutbuildP6ScheduleSettings as createOutbuildDataDateScheduleSettings, createSchedule, expectedProgressFromBaseline, formatUtcAsP6WallDate, getActiveBaseline, getUnsavedActivities, isRootParent, isViewAttributeCriterion, isViewAttributeOrderRule, mapP6ScheduleOptions as mapDataDateScheduleOptions, normalizeParentKey, parseFromBackend, parseP6DayAsCalendarStart, parseP6WallDateAsUtc, planLookaheadProgressActuals, prepareLookaheadProgressActuals, resolveExpectedFinishDateSelection, resolveLookaheadActualDateSelection, willRunCriticalPath, yieldToBrowser };
package/dist/index.d.ts CHANGED
@@ -17,6 +17,20 @@ declare const LINK_TYPE: {
17
17
  /** Canonical stored dependency relationship. */
18
18
  type LinkType = (typeof LINK_TYPE)[keyof typeof LINK_TYPE];
19
19
 
20
+ /** Named normalized activity scheduling constraints. */
21
+ declare const CONSTRAINT_TYPE: {
22
+ readonly ASAP: "asap";
23
+ readonly ALAP: "alap";
24
+ readonly SNET: "snet";
25
+ readonly SNLT: "snlt";
26
+ readonly FNET: "fnet";
27
+ readonly FNLT: "fnlt";
28
+ readonly MSO: "mso";
29
+ readonly MFO: "mfo";
30
+ };
31
+ /** Normalized activity scheduling constraint. */
32
+ type ConstraintType = (typeof CONSTRAINT_TYPE)[keyof typeof CONSTRAINT_TYPE];
33
+
20
34
  interface WorkTimeQuery {
21
35
  readonly direction: WorkTimeDirection;
22
36
  readonly date: Date;
@@ -198,13 +212,10 @@ declare const NOT_STARTED_PROGRESS = 0;
198
212
  /** Progress percentage representing a completed activity. */
199
213
  declare const COMPLETED_PROGRESS = 100;
200
214
 
201
- declare const CREATION_OVERRIDE_FIELD_LIST: readonly ["name", "description", "type", "startDate", "durationHours", "constraintType", "constraintDate", "calendarId", "assignedDefaultCalendar", "autoScheduling", "progress", "cost", "usedCost", "realCost", "workHours", "realWorkHours", "ponderator", "hasCustomPonderator", "customId", "subcontractId", "responsableIds", "tagIds", "isLookahead"];
202
- type CreationOverrideField = (typeof CREATION_OVERRIDE_FIELD_LIST)[number];
203
- type CreationOverrides = Partial<Pick<CoreActivity, CreationOverrideField>>;
204
-
205
215
  /** Discriminators for commands accepted by {@link ScheduleCore.dispatch}. */
206
216
  declare const DISPATCH_ACTION_KIND: {
207
217
  readonly ACTIVITY_CLIPBOARD_CLEAR: "activity-clipboard-clear";
218
+ readonly ACTIVITY_CLIPBOARD_IMPORT: "activity-clipboard-import";
208
219
  readonly ACTIVITY_COPY: "activity-copy";
209
220
  readonly CALENDAR_RECONCILE: "calendar-reconcile";
210
221
  readonly ACTIVITY_PASTE_COPIED: "activity-paste-copied";
@@ -722,6 +733,11 @@ type DispatchAction = {
722
733
  } | {
723
734
  kind: typeof DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR;
724
735
  eventSource?: string;
736
+ } | {
737
+ kind: typeof DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_IMPORT;
738
+ snapshot: ActivityClipboardSnapshot;
739
+ references?: ActivityClipboardReferences;
740
+ eventSource?: string;
725
741
  } | {
726
742
  kind: typeof DISPATCH_ACTION_KIND.ACTIVITY_PASTE_COPIED;
727
743
  destination: {
@@ -1578,19 +1594,38 @@ interface EntityChange<T> {
1578
1594
  after: Readonly<T> | null;
1579
1595
  }
1580
1596
 
1581
- /** Named normalized activity scheduling constraints. */
1582
- declare const CONSTRAINT_TYPE: {
1583
- readonly ASAP: "asap";
1584
- readonly ALAP: "alap";
1585
- readonly SNET: "snet";
1586
- readonly SNLT: "snlt";
1587
- readonly FNET: "fnet";
1588
- readonly FNLT: "fnlt";
1589
- readonly MSO: "mso";
1590
- readonly MFO: "mfo";
1591
- };
1592
- /** Normalized activity scheduling constraint. */
1593
- type ConstraintType = (typeof CONSTRAINT_TYPE)[keyof typeof CONSTRAINT_TYPE];
1597
+ declare const CREATION_OVERRIDE_FIELD_LIST: readonly ["name", "description", "type", "startDate", "durationHours", "constraintType", "constraintDate", "calendarId", "assignedDefaultCalendar", "autoScheduling", "progress", "cost", "usedCost", "realCost", "workHours", "realWorkHours", "ponderator", "hasCustomPonderator", "customId", "subcontractId", "responsableIds", "tagIds", "isLookahead"];
1598
+ type CreationOverrideField = (typeof CREATION_OVERRIDE_FIELD_LIST)[number];
1599
+ type CreationOverrides = Partial<Pick<CoreActivity, CreationOverrideField>>;
1600
+
1601
+ /** One copied activity: its identity in the source schedule plus the fields a paste recreates. */
1602
+ interface ActivityClipboardEntry {
1603
+ readonly originalId: ActivityId;
1604
+ readonly originalParentId: ActivityId | typeof ROOT_PARENT_ID;
1605
+ readonly overrides: CreationOverrides;
1606
+ }
1607
+ /**
1608
+ * Portable snapshot of the activity clipboard.
1609
+ *
1610
+ * `originalId`, `originalParentId` and the link endpoints are only mapping
1611
+ * keys inside the snapshot, so a snapshot exported from one schedule can be
1612
+ * imported into another one.
1613
+ */
1614
+ interface ActivityClipboardSnapshot {
1615
+ readonly activities: ReadonlyArray<ActivityClipboardEntry>;
1616
+ readonly links: ReadonlyArray<Readonly<Link>>;
1617
+ }
1618
+ /**
1619
+ * Consumer-owned reference catalogs of the destination schedule.
1620
+ *
1621
+ * Every provided list filters the copied field on import; an omitted list
1622
+ * leaves that field untouched.
1623
+ */
1624
+ interface ActivityClipboardReferences {
1625
+ readonly subcontractIds?: ReadonlyArray<number>;
1626
+ readonly responsableIds?: ReadonlyArray<string>;
1627
+ readonly tagIds?: ReadonlyArray<string>;
1628
+ }
1594
1629
 
1595
1630
  declare const SAVE_FIELD_POLICY: {
1596
1631
  readonly TRACKED: "tracked";
@@ -1950,6 +1985,12 @@ interface ScheduleActivitiesApi {
1950
1985
  * @param currentCustomId - Existing value to ignore, or `null`.
1951
1986
  */
1952
1987
  isCustomIdInUse(customId: string, currentCustomId?: string | null): boolean;
1988
+ /**
1989
+ * Reads the activity clipboard as a portable snapshot.
1990
+ *
1991
+ * @returns A defensive copy, or `null` when nothing has been copied.
1992
+ */
1993
+ clipboard(): ActivityClipboardSnapshot | null;
1953
1994
  /**
1954
1995
  * Creates one activity through the canonical dispatch pipeline.
1955
1996
  *
@@ -2071,6 +2112,21 @@ interface ScheduleActivitiesApi {
2071
2112
  duplicate(activityIds: ReadonlyArray<ActivityId>, context?: MutationContext): Promise<DispatchResult>;
2072
2113
  /** @returns The complete result of clearing core-owned clipboard state. */
2073
2114
  clearClipboard(context?: MutationContext): Promise<DispatchResult>;
2115
+ /**
2116
+ * Replaces the activity clipboard with a snapshot exported elsewhere.
2117
+ *
2118
+ * Copied `calendarId` values unknown to this schedule are dropped so the
2119
+ * paste falls back to the schedule default calendar; every list in
2120
+ * `references` filters the matching copied field. Rejects an empty
2121
+ * snapshot (`clipboard_empty`) or one whose links point outside its own
2122
+ * activities (`clipboard_snapshot_invalid`). Never touches history or
2123
+ * persistence tracking.
2124
+ * @param snapshot - Snapshot read through {@link ScheduleActivitiesApi.clipboard}.
2125
+ * @param references - Destination reference catalogs, when known.
2126
+ * @param context - Optional consumer event source.
2127
+ * @returns The complete dispatch result.
2128
+ */
2129
+ importClipboard(snapshot: ActivityClipboardSnapshot, references?: ActivityClipboardReferences, context?: MutationContext): Promise<DispatchResult>;
2074
2130
  /**
2075
2131
  * Synchronizes consumer-owned lookahead metadata into core state.
2076
2132
  *
@@ -2978,6 +3034,15 @@ declare class ScheduleCore {
2978
3034
  getChildrenIds(parentId: ActivityId | typeof ROOT_PARENT_ID): ReadonlyArray<ActivityId>;
2979
3035
  /** @returns A defensive snapshot of selected activity IDs. */
2980
3036
  getSelectedActivityIds(): string[];
3037
+ /**
3038
+ * Reads the core-owned activity clipboard as a portable snapshot.
3039
+ *
3040
+ * The snapshot can be imported into another `ScheduleCore` through the
3041
+ * `activity-clipboard-import` command, which is how a copy survives the
3042
+ * replacement of the schedule instance.
3043
+ * @returns A defensive copy, or `null` when nothing has been copied.
3044
+ */
3045
+ getActivityClipboardView(): ActivityClipboardSnapshot | null;
2981
3046
  /** @returns A defensive snapshot of explicitly hidden activity IDs. */
2982
3047
  getHiddenActivityIds(): string[];
2983
3048
  /** @returns A defensive snapshot of activity IDs not currently hidden. */
@@ -3602,6 +3667,7 @@ declare const REJECTION_REASON: {
3602
3667
  readonly ACTIVITY_IDS_EMPTY: "activity_ids_empty";
3603
3668
  readonly NO_ACTIVITY_SELECTION: "no_activity_selection";
3604
3669
  readonly CLIPBOARD_EMPTY: "clipboard_empty";
3670
+ readonly CLIPBOARD_SNAPSHOT_INVALID: "clipboard_snapshot_invalid";
3605
3671
  readonly ACTIVITY_PASTE_INVARIANT_FAILED: "activity_paste_invariant_failed";
3606
3672
  readonly SOLE_SCHEDULE_ROOT: "sole_schedule_root";
3607
3673
  readonly ANCHOR_SIBLING_CONFLICT: "anchor_sibling_conflict";
@@ -3631,4 +3697,4 @@ declare const DISPATCH_TRACK_EVENT: {
3631
3697
  /** Consumer analytics event name emitted by a schedule mutation. */
3632
3698
  type DispatchTrackEvent = (typeof DISPATCH_TRACK_EVENT)[keyof typeof DISPATCH_TRACK_EVENT];
3633
3699
 
3634
- export { ACTIVITY_BATCH_ACTION_KIND, ACTIVITY_BATCH_MODE, ACTIVITY_DATE_EDGE, ACTIVITY_FIELD, ACTIVITY_PONDERATOR_CRITERION, ACTIVITY_PROGRESS_ORIGIN, ACTIVITY_TYPE, type ActivityBaselineSnapshot, type ActivityBatchAction, type ActivityBatchInput, type ActivityBatchItem, type ActivityBatchItemInput, type ActivityBatchLinkInput$1 as ActivityBatchLinkInput, type ActivityBatchMode, type ActivityBatchParentReference, type ActivityBatchReference, type ActivityBulkEdit, type ActivityCreateInput, type ActivityCreationOverrides, type ActivityCreter, type ActivityDateEdge, type ActivityDateEdit, type ActivityField, type ActivityFieldEdit, type ActivityFieldValue, type ActivityId, type ActivityLookaheadSyncInput, type ActivityMoveInput, type ActivityStatus, type ActivityType, type ApplyLookaheadConversionInput, type BackendActivityInput, type BackendCalendarExceptionInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BackendShiftInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, CHANGE_SET_SOURCE_KIND, COLUMN, COMPLETED_PROGRESS, CONFIRMATION_KIND, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CONSTRAINT_WARNING_KIND, CREATION_KIND, type Calendar, type CalendarId, type CalendarLike, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ChangeSetSource, type ColumnName, type ConfirmationAlternative, type ConfirmationKind, type ConfirmationRequest, type ConstraintType, type ConstraintWarning, type CoreActivity, type CoreBaselinePoint, type CreationKind, type CriticalPathResult, P6_PROPERTY_CONTRACT as DATA_DATE_PROPERTY_CONTRACT, DATE_GESTURE_KIND, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_LINK_OPERATION_KIND, DISPATCH_TRACK_EVENT, type P6ActivityCalculationInputs as DataDateActivityCalculationInputs, type P6ActivityColumnKey as DataDateActivityColumnKey, type P6ActivityData as DataDateActivityData, type P6ActivityDraftState as DataDateActivityDraftState, type P6ActivityInputPatch as DataDateActivityInputPatch, type P6ActivityState as DataDateActivityState, type P6ActivityType as DataDateActivityType, P6CapabilityError as DataDateCapabilityError, type P6CapabilityErrorCode as DataDateCapabilityErrorCode, type P6DependencyReference as DataDateDependencyReference, type P6DiagnosticProjectIdentity as DataDateDiagnosticProjectIdentity, type P6DiagnosticRelationship as DataDateDiagnosticRelationship, type P6DiagnosticRelationshipType as DataDateDiagnosticRelationshipType, type P6DurationType as DataDateDurationType, type P6EndingActivityOption as DataDateEndingActivityOption, type P6EndingActivityPage as DataDateEndingActivityPage, type P6EndingActivitySearch as DataDateEndingActivitySearch, type P6MappedScheduleOptions as DataDateMappedScheduleOptions, type P6MissingActivityInput as DataDateMissingActivityInput, type P6OutOfSequencePolicy as DataDateOutOfSequencePolicy, type P6ProjectPlannedStartChange as DataDateProjectPlannedStartChange, type P6ProjectState as DataDateProjectState, type P6PropertyContractRow as DataDatePropertyContractRow, type P6PropertyEdgeCases as DataDatePropertyEdgeCases, type P6RawProjectOptions as DataDateRawProjectOptions, type P6RawScheduleOptions as DataDateRawScheduleOptions, type P6RequiredHistoricalField as DataDateRequiredHistoricalField, type P6ResourceAssignment as DataDateResourceAssignment, type P6ScheduleDiagnostic as DataDateScheduleDiagnostic, type P6ScheduleDiagnosticCode as DataDateScheduleDiagnosticCode, type P6ScheduleInput as DataDateScheduleInput, type P6ScheduleReadiness as DataDateScheduleReadiness, type P6ScheduleResult as DataDateScheduleResult, type P6ScheduleRunLog as DataDateScheduleRunLog, type P6ScheduleSettings as DataDateScheduleSettings, type P6ScheduleWarning as DataDateScheduleWarning, type P6SettingsChange as DataDateSettingsChange, type DateGesture, type DateGestureKind, type DateGesturePreview, type DatesBatchVerdict, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchManyAction, type DispatchManyChangeSetSource, type DispatchManyResult, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, EDIT_ALERT_KEY, EDIT_DENIAL_REASON, ENTITY_CHANGE_KIND, type EditAlertKey, type EditDenialReason, type EditResult, type EditableColumnName, type EffectiveGraphAudit, type EntityChange, type ActivityBatchLinkInput as ErgonomicActivityBatchLinkInput, type ExpectedProgressAdapter, FILTER_FIELD, FILTER_LOGIC, FILTER_OPERATOR, FILTER_REJECTION_REASON, FILTER_VALUE_KIND, FLAT_WBS_DEPTH, type FilterCriterion, type FilterCriterionGroup, type FilterCriterionValue, type FilterDateRange, type FilterField, type FilterLogic, type FilterOperator, type FilterRejection, type FilterState, type FilterValueKind, GROUP_ID_PREFIX, GROUP_ID_SEPARATOR, type GroupCriterion, type GroupCriterionInput, type GroupLevelWindow, type GroupState, type GroupStateInput, type ImpactRequestSyncInput, LINK_BATCH_OPERATION_KIND, LINK_CODE, LINK_CODE_TO_TYPE, LINK_REJECTION_REASON, LINK_RELATIONSHIP, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkBatchOperationKind, type LinkBatchRequest, type LinkBatchVerdict, type LinkCreateRequest, type LinkId, type LinkPatchRequest, type LinkRejection, type LinkRelationship, type LinkType, type LinkTypeCode, type LinkUpdateAction, type LinksBatchOperation, type LoadDiagnostic, type LoadDiagnosticCode, type LookaheadActualIntent, LookaheadActualTransitionError, type LookaheadActualTransitionErrorCode, type LookaheadConversionFormerParent, type LookaheadConversionGroup, type LookaheadConversionInput, type LookaheadConversionMilestoneMove, type LookaheadConversionPlan, type LookaheadConversionResult, type LookaheadDerivedCalendars, type LookaheadDerivedFields, type LookaheadDerivedFieldsResolver, type LookaheadDerivedInput, type LookaheadProgressActualActivityState, type LookaheadProgressActualInput, type LookaheadProgressActualPlan, MINIMUM_GROUP_DEPTH, MINIMUM_GROUP_LEVEL, type MutationContext, NEW_ACTIVITY_DEFAULTS, NOT_STARTED_PROGRESS, ORDER_DIRECTION, ORDER_MODE, type OrderDirection, type OrderMode, type OrderRule, type OrderState, type ParsedInput, type PendingRequest, type PersistableActivityField, type PersistedEntityIdentity, type PersistenceCheckpoint, type PipelineColumnName, type ProjectWorkHours, REJECTION_REASON, ROOT_PARENT_ID, SCHEDULE_CORE_STATUS, SCHEDULE_EFFECT_KIND, SIR_AUTO_REJECT_REASON, STATUS, STATUS_CRITERIA, type ScheduleActivitiesApi, type ScheduleApiNamespaces, type ScheduleAutoScheduleAction, type ScheduleBaselinesApi, type ScheduleCalendarsApi, type ScheduleCellsApi, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleCriticalPathApi, type ScheduleP6Api as ScheduleDataDatesApi, type ScheduleDiagnosticsApi, type ScheduleEffect, type ScheduleHistoryApi, type ScheduleImpactRequestsApi, type ScheduleLinksApi, type SchedulePersistenceApi, type ScheduleProjectionApi, type ScheduleSelectionApi, type ScheduleViewApi, type SectorMetadata, type SelectionToggleInput, type StaticActivityDefaults, type StatusCriteria, type TrackingEvent, UNASSIGNED_GROUP_LABEL, UNASSIGNED_VALUE_ID, type UndoOptions, VIEW_ATTRIBUTE_KIND, VISUAL_ROW_KIND, type ViewAttributeAssignmentInput, type ViewAttributeCatalogInput, type ViewAttributeFilterCriterion, type ViewAttributeOrderRule, type ViewAttributeValueInput, type ViewFilterInput, type ViewStateChange, type ViewStatePropChange, type VisualRow, WORK_TIME_DIRECTION, type WbsDepth, type WithProplannerId, type WorkTimeDirection, allowedSecondaryConstraintTypes, appendGroupRowId, buildGroupRowId, checkNoUpdatedLinks, computeExpectedProgress, createLookaheadDerivedFields, createOutbuildP6ScheduleSettings as createOutbuildDataDateScheduleSettings, createSchedule, expectedProgressFromBaseline, formatUtcAsP6WallDate, getActiveBaseline, getUnsavedActivities, isRootParent, isViewAttributeCriterion, isViewAttributeOrderRule, mapP6ScheduleOptions as mapDataDateScheduleOptions, normalizeParentKey, parseFromBackend, parseP6DayAsCalendarStart, parseP6WallDateAsUtc, planLookaheadProgressActuals, prepareLookaheadProgressActuals, resolveExpectedFinishDateSelection, resolveLookaheadActualDateSelection, willRunCriticalPath, yieldToBrowser };
3700
+ export { ACTIVITY_BATCH_ACTION_KIND, ACTIVITY_BATCH_MODE, ACTIVITY_DATE_EDGE, ACTIVITY_FIELD, ACTIVITY_PONDERATOR_CRITERION, ACTIVITY_PROGRESS_ORIGIN, ACTIVITY_TYPE, type ActivityBaselineSnapshot, type ActivityBatchAction, type ActivityBatchInput, type ActivityBatchItem, type ActivityBatchItemInput, type ActivityBatchLinkInput$1 as ActivityBatchLinkInput, type ActivityBatchMode, type ActivityBatchParentReference, type ActivityBatchReference, type ActivityBulkEdit, type ActivityClipboardEntry, type ActivityClipboardReferences, type ActivityClipboardSnapshot, type ActivityCreateInput, type ActivityCreationOverrides, type ActivityCreter, type ActivityDateEdge, type ActivityDateEdit, type ActivityField, type ActivityFieldEdit, type ActivityFieldValue, type ActivityId, type ActivityLookaheadSyncInput, type ActivityMoveInput, type ActivityStatus, type ActivityType, type ApplyLookaheadConversionInput, type BackendActivityInput, type BackendCalendarExceptionInput, type BackendCalendarInput, type BackendLinkInput, type BackendScheduleInput, type BackendSectorInput, type BackendShiftInput, type BaselinePoint, type BaselineVersion, type BranchOrderChange, CALENDAR_UNIT, CHANGE_SET_SOURCE_KIND, COLUMN, COMPLETED_PROGRESS, CONFIRMATION_KIND, CONSTRAINT_TYPE, CONSTRAINT_TYPE_TO_LABEL, CONSTRAINT_WARNING_KIND, CREATION_KIND, type Calendar, type CalendarId, type CalendarLike, type CalendarUnit, type CalendarWorktime, type ChangeSet, type ChangeSetSource, type ColumnName, type ConfirmationAlternative, type ConfirmationKind, type ConfirmationRequest, type ConstraintType, type ConstraintWarning, type CoreActivity, type CoreBaselinePoint, type CreationKind, type CriticalPathResult, P6_PROPERTY_CONTRACT as DATA_DATE_PROPERTY_CONTRACT, DATE_GESTURE_KIND, DEFAULT_HOURS_PER_DAY, DISPATCH_ACTION_KIND, DISPATCH_ACTION_KINDS, DISPATCH_LINK_OPERATION_KIND, DISPATCH_TRACK_EVENT, type P6ActivityCalculationInputs as DataDateActivityCalculationInputs, type P6ActivityColumnKey as DataDateActivityColumnKey, type P6ActivityData as DataDateActivityData, type P6ActivityDraftState as DataDateActivityDraftState, type P6ActivityInputPatch as DataDateActivityInputPatch, type P6ActivityState as DataDateActivityState, type P6ActivityType as DataDateActivityType, P6CapabilityError as DataDateCapabilityError, type P6CapabilityErrorCode as DataDateCapabilityErrorCode, type P6DependencyReference as DataDateDependencyReference, type P6DiagnosticProjectIdentity as DataDateDiagnosticProjectIdentity, type P6DiagnosticRelationship as DataDateDiagnosticRelationship, type P6DiagnosticRelationshipType as DataDateDiagnosticRelationshipType, type P6DurationType as DataDateDurationType, type P6EndingActivityOption as DataDateEndingActivityOption, type P6EndingActivityPage as DataDateEndingActivityPage, type P6EndingActivitySearch as DataDateEndingActivitySearch, type P6MappedScheduleOptions as DataDateMappedScheduleOptions, type P6MissingActivityInput as DataDateMissingActivityInput, type P6OutOfSequencePolicy as DataDateOutOfSequencePolicy, type P6ProjectPlannedStartChange as DataDateProjectPlannedStartChange, type P6ProjectState as DataDateProjectState, type P6PropertyContractRow as DataDatePropertyContractRow, type P6PropertyEdgeCases as DataDatePropertyEdgeCases, type P6RawProjectOptions as DataDateRawProjectOptions, type P6RawScheduleOptions as DataDateRawScheduleOptions, type P6RequiredHistoricalField as DataDateRequiredHistoricalField, type P6ResourceAssignment as DataDateResourceAssignment, type P6ScheduleDiagnostic as DataDateScheduleDiagnostic, type P6ScheduleDiagnosticCode as DataDateScheduleDiagnosticCode, type P6ScheduleInput as DataDateScheduleInput, type P6ScheduleReadiness as DataDateScheduleReadiness, type P6ScheduleResult as DataDateScheduleResult, type P6ScheduleRunLog as DataDateScheduleRunLog, type P6ScheduleSettings as DataDateScheduleSettings, type P6ScheduleWarning as DataDateScheduleWarning, type P6SettingsChange as DataDateSettingsChange, type DateGesture, type DateGestureKind, type DateGesturePreview, type DatesBatchVerdict, type DeletedActivitySnapshot, type DeletedLinkSnapshot, type DispatchAction, type DispatchActionKind, type DispatchManyAction, type DispatchManyChangeSetSource, type DispatchManyResult, type DispatchOptions, type DispatchRejectReason, type DispatchResult, type DispatchTrackEvent, EDIT_ALERT_KEY, EDIT_DENIAL_REASON, ENTITY_CHANGE_KIND, type EditAlertKey, type EditDenialReason, type EditResult, type EditableColumnName, type EffectiveGraphAudit, type EntityChange, type ActivityBatchLinkInput as ErgonomicActivityBatchLinkInput, type ExpectedProgressAdapter, FILTER_FIELD, FILTER_LOGIC, FILTER_OPERATOR, FILTER_REJECTION_REASON, FILTER_VALUE_KIND, FLAT_WBS_DEPTH, type FilterCriterion, type FilterCriterionGroup, type FilterCriterionValue, type FilterDateRange, type FilterField, type FilterLogic, type FilterOperator, type FilterRejection, type FilterState, type FilterValueKind, GROUP_ID_PREFIX, GROUP_ID_SEPARATOR, type GroupCriterion, type GroupCriterionInput, type GroupLevelWindow, type GroupState, type GroupStateInput, type ImpactRequestSyncInput, LINK_BATCH_OPERATION_KIND, LINK_CODE, LINK_CODE_TO_TYPE, LINK_REJECTION_REASON, LINK_RELATIONSHIP, LINK_TYPE, LINK_TYPE_CODE, type Link, type LinkBatchOperationKind, type LinkBatchRequest, type LinkBatchVerdict, type LinkCreateRequest, type LinkId, type LinkPatchRequest, type LinkRejection, type LinkRelationship, type LinkType, type LinkTypeCode, type LinkUpdateAction, type LinksBatchOperation, type LoadDiagnostic, type LoadDiagnosticCode, type LookaheadActualIntent, LookaheadActualTransitionError, type LookaheadActualTransitionErrorCode, type LookaheadConversionFormerParent, type LookaheadConversionGroup, type LookaheadConversionInput, type LookaheadConversionMilestoneMove, type LookaheadConversionPlan, type LookaheadConversionResult, type LookaheadDerivedCalendars, type LookaheadDerivedFields, type LookaheadDerivedFieldsResolver, type LookaheadDerivedInput, type LookaheadProgressActualActivityState, type LookaheadProgressActualInput, type LookaheadProgressActualPlan, MINIMUM_GROUP_DEPTH, MINIMUM_GROUP_LEVEL, type MutationContext, NEW_ACTIVITY_DEFAULTS, NOT_STARTED_PROGRESS, ORDER_DIRECTION, ORDER_MODE, type OrderDirection, type OrderMode, type OrderRule, type OrderState, type ParsedInput, type PendingRequest, type PersistableActivityField, type PersistedEntityIdentity, type PersistenceCheckpoint, type PipelineColumnName, type ProjectWorkHours, REJECTION_REASON, ROOT_PARENT_ID, SCHEDULE_CORE_STATUS, SCHEDULE_EFFECT_KIND, SIR_AUTO_REJECT_REASON, STATUS, STATUS_CRITERIA, type ScheduleActivitiesApi, type ScheduleApiNamespaces, type ScheduleAutoScheduleAction, type ScheduleBaselinesApi, type ScheduleCalendarsApi, type ScheduleCellsApi, ScheduleCore, type ScheduleCoreInput, type ScheduleCoreReporter, type ScheduleCoreStatus, type ScheduleCriticalPathApi, type ScheduleP6Api as ScheduleDataDatesApi, type ScheduleDiagnosticsApi, type ScheduleEffect, type ScheduleHistoryApi, type ScheduleImpactRequestsApi, type ScheduleLinksApi, type SchedulePersistenceApi, type ScheduleProjectionApi, type ScheduleSelectionApi, type ScheduleViewApi, type SectorMetadata, type SelectionToggleInput, type StaticActivityDefaults, type StatusCriteria, type TrackingEvent, UNASSIGNED_GROUP_LABEL, UNASSIGNED_VALUE_ID, type UndoOptions, VIEW_ATTRIBUTE_KIND, VISUAL_ROW_KIND, type ViewAttributeAssignmentInput, type ViewAttributeCatalogInput, type ViewAttributeFilterCriterion, type ViewAttributeOrderRule, type ViewAttributeValueInput, type ViewFilterInput, type ViewStateChange, type ViewStatePropChange, type VisualRow, WORK_TIME_DIRECTION, type WbsDepth, type WithProplannerId, type WorkTimeDirection, allowedSecondaryConstraintTypes, appendGroupRowId, buildGroupRowId, checkNoUpdatedLinks, computeExpectedProgress, createLookaheadDerivedFields, createOutbuildP6ScheduleSettings as createOutbuildDataDateScheduleSettings, createSchedule, expectedProgressFromBaseline, formatUtcAsP6WallDate, getActiveBaseline, getUnsavedActivities, isRootParent, isViewAttributeCriterion, isViewAttributeOrderRule, mapP6ScheduleOptions as mapDataDateScheduleOptions, normalizeParentKey, parseFromBackend, parseP6DayAsCalendarStart, parseP6WallDateAsUtc, planLookaheadProgressActuals, prepareLookaheadProgressActuals, resolveExpectedFinishDateSelection, resolveLookaheadActualDateSelection, willRunCriticalPath, yieldToBrowser };
package/dist/index.js CHANGED
@@ -340,6 +340,7 @@ var LINK_REJECTION_REASON = {
340
340
  // src/dispatch/action-kinds.ts
341
341
  var DISPATCH_ACTION_KIND = {
342
342
  ACTIVITY_CLIPBOARD_CLEAR: "activity-clipboard-clear",
343
+ ACTIVITY_CLIPBOARD_IMPORT: "activity-clipboard-import",
343
344
  ACTIVITY_COPY: "activity-copy",
344
345
  CALENDAR_RECONCILE: "calendar-reconcile",
345
346
  ACTIVITY_PASTE_COPIED: "activity-paste-copied",
@@ -522,6 +523,7 @@ function createActivitiesApi(engine) {
522
523
  hasChildren: (parentId) => engine.hasChild(parentId),
523
524
  indentTargetParentIds: (ids) => engine.getIndentTargetParentIds(ids),
524
525
  isCustomIdInUse: (customId, currentCustomId) => engine.isCustomIdInUse(customId, currentCustomId ?? null),
526
+ clipboard: () => engine.getActivityClipboardView(),
525
527
  create: (input, options) => engine.dispatch(
526
528
  { ...input, kind: DISPATCH_ACTION_KIND.ACTIVITY_CREATE },
527
529
  options
@@ -604,6 +606,12 @@ function createActivitiesApi(engine) {
604
606
  ...context,
605
607
  kind: DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR
606
608
  }),
609
+ importClipboard: (snapshot, references, context = {}) => engine.dispatch({
610
+ ...context,
611
+ kind: DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_IMPORT,
612
+ snapshot,
613
+ ...references === void 0 ? {} : { references }
614
+ }),
607
615
  lookaheadSync: (input) => engine.dispatch({
608
616
  ...input,
609
617
  kind: DISPATCH_ACTION_KIND.ACTIVITY_LOOKAHEAD_SYNC
@@ -946,6 +954,7 @@ var REJECTION_REASON = {
946
954
  ACTIVITY_IDS_EMPTY: "activity_ids_empty",
947
955
  NO_ACTIVITY_SELECTION: "no_activity_selection",
948
956
  CLIPBOARD_EMPTY: "clipboard_empty",
957
+ CLIPBOARD_SNAPSHOT_INVALID: "clipboard_snapshot_invalid",
949
958
  ACTIVITY_PASTE_INVARIANT_FAILED: "activity_paste_invariant_failed",
950
959
  SOLE_SCHEDULE_ROOT: "sole_schedule_root",
951
960
  ANCHOR_SIBLING_CONFLICT: "anchor_sibling_conflict",
@@ -11742,6 +11751,7 @@ var NON_SCHEDULING_INLINE_COLUMNS = /* @__PURE__ */ new Set([
11742
11751
  ]);
11743
11752
  var NON_SCHEDULING_KINDS = /* @__PURE__ */ new Set([
11744
11753
  DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR,
11754
+ DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_IMPORT,
11745
11755
  DISPATCH_ACTION_KIND.ACTIVITY_COPY,
11746
11756
  DISPATCH_ACTION_KIND.CELL_CLIPBOARD_CLEAR,
11747
11757
  DISPATCH_ACTION_KIND.CELL_COPY,
@@ -11762,6 +11772,7 @@ var NON_SCHEDULING_KINDS = /* @__PURE__ */ new Set([
11762
11772
  ]);
11763
11773
  var PURE_VIEW_STATE_KINDS = /* @__PURE__ */ new Set([
11764
11774
  DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR,
11775
+ DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_IMPORT,
11765
11776
  DISPATCH_ACTION_KIND.ACTIVITY_COPY,
11766
11777
  DISPATCH_ACTION_KIND.CELL_CLIPBOARD_CLEAR,
11767
11778
  DISPATCH_ACTION_KIND.CELL_COPY,
@@ -18379,8 +18390,7 @@ function dispatchActivityCopy(action, deps) {
18379
18390
  if (!selection.ok) return selection;
18380
18391
  return { ...selection, changes: { ...selection.changes, source: action } };
18381
18392
  }
18382
- function dispatchActivityClipboardClear(action, clipboard) {
18383
- clipboard.value = null;
18393
+ function clipboardOnlyResult(action) {
18384
18394
  return {
18385
18395
  ok: true,
18386
18396
  changes: {
@@ -18392,6 +18402,57 @@ function dispatchActivityClipboardClear(action, clipboard) {
18392
18402
  }
18393
18403
  };
18394
18404
  }
18405
+ function dispatchActivityClipboardClear(action, clipboard) {
18406
+ clipboard.value = null;
18407
+ return clipboardOnlyResult(action);
18408
+ }
18409
+ function keepKnownIds(ids, known) {
18410
+ if (ids === void 0 || known === void 0) return ids;
18411
+ const knownSet = new Set(known);
18412
+ return ids.filter((id) => knownSet.has(id));
18413
+ }
18414
+ function localizeOverrides(overrides, deps, references) {
18415
+ const localized = cloneDomainValue(overrides);
18416
+ const hasUnknownCalendar = localized.calendarId != null && !deps.calendars.has(localized.calendarId);
18417
+ if (hasUnknownCalendar) delete localized.calendarId;
18418
+ const hasUnknownSubcontract = references?.subcontractIds !== void 0 && localized.subcontractId != null && !references.subcontractIds.includes(localized.subcontractId);
18419
+ if (hasUnknownSubcontract) localized.subcontractId = null;
18420
+ const responsableIds = keepKnownIds(
18421
+ localized.responsableIds,
18422
+ references?.responsableIds
18423
+ );
18424
+ if (responsableIds !== void 0)
18425
+ localized.responsableIds = [...responsableIds];
18426
+ const tagIds = keepKnownIds(localized.tagIds, references?.tagIds);
18427
+ if (tagIds !== void 0) localized.tagIds = [...tagIds];
18428
+ return localized;
18429
+ }
18430
+ function hasDanglingLink(snapshot) {
18431
+ const copiedIds = new Set(
18432
+ snapshot.activities.map((entry) => String(entry.originalId))
18433
+ );
18434
+ return snapshot.links.some(
18435
+ (link) => !copiedIds.has(String(link.source)) || !copiedIds.has(String(link.target))
18436
+ );
18437
+ }
18438
+ function dispatchActivityClipboardImport(action, deps) {
18439
+ const { snapshot, references } = action;
18440
+ if (snapshot.activities.length === 0) {
18441
+ return { ok: false, reason: REJECTION_REASON.CLIPBOARD_EMPTY };
18442
+ }
18443
+ if (hasDanglingLink(snapshot)) {
18444
+ return { ok: false, reason: REJECTION_REASON.CLIPBOARD_SNAPSHOT_INVALID };
18445
+ }
18446
+ deps.clipboard.value = {
18447
+ activities: snapshot.activities.map((entry) => ({
18448
+ originalId: entry.originalId,
18449
+ originalParentId: entry.originalParentId,
18450
+ overrides: localizeOverrides(entry.overrides, deps, references)
18451
+ })),
18452
+ links: snapshot.links.map((link) => cloneDomainValue(link))
18453
+ };
18454
+ return clipboardOnlyResult(action);
18455
+ }
18395
18456
 
18396
18457
  // src/activity-copy-paste/paste.ts
18397
18458
  function resolveDestination(afterSiblingId, adapter) {
@@ -18997,6 +19058,12 @@ async function performDispatch(action, options, deps) {
18997
19058
  if (action.kind === DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR) {
18998
19059
  return dispatchActivityClipboardClear(action, deps.activityClipboard);
18999
19060
  }
19061
+ if (action.kind === DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_IMPORT) {
19062
+ return dispatchActivityClipboardImport(action, {
19063
+ clipboard: deps.activityClipboard,
19064
+ calendars: deps.calendars
19065
+ });
19066
+ }
19000
19067
  if (action.kind === DISPATCH_ACTION_KIND.ACTIVITY_PASTE_COPIED) {
19001
19068
  return dispatchActivityPasteCopied(action, options, deps);
19002
19069
  }
@@ -23413,7 +23480,7 @@ function getDispatchHistoryPolicy(action) {
23413
23480
  if (action.kind === DISPATCH_ACTION_KIND.PERSISTENCE_ACKNOWLEDGE) {
23414
23481
  return DISPATCH_HISTORY_POLICY.CHECKPOINT_ON_SUCCESS;
23415
23482
  }
23416
- if (action.kind === DISPATCH_ACTION_KIND.SIR_SYNC || action.kind === DISPATCH_ACTION_KIND.CALENDAR_RECONCILE || action.kind === DISPATCH_ACTION_KIND.ACTIVITY_LOOKAHEAD_SYNC || action.kind === DISPATCH_ACTION_KIND.BASELINE_APPLY || action.kind === DISPATCH_ACTION_KIND.PONDERATOR_CRITERION_SET || action.kind === DISPATCH_ACTION_KIND.STATUS_CRITERIA_SET || action.kind === DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR || action.kind === DISPATCH_ACTION_KIND.ACTIVITY_COPY || action.kind === DISPATCH_ACTION_KIND.SELECTION_TOGGLE || action.kind === DISPATCH_ACTION_KIND.SELECTION_REPLACE || action.kind === DISPATCH_ACTION_KIND.VISIBILITY_SET || action.kind === DISPATCH_ACTION_KIND.FILTER_SET || action.kind === DISPATCH_ACTION_KIND.SORT_SET || action.kind === DISPATCH_ACTION_KIND.VIEW_ATTRIBUTES_SET || action.kind === DISPATCH_ACTION_KIND.GROUP_SET || action.kind === DISPATCH_ACTION_KIND.WBS_DEPTH_SET) {
23483
+ if (action.kind === DISPATCH_ACTION_KIND.SIR_SYNC || action.kind === DISPATCH_ACTION_KIND.CALENDAR_RECONCILE || action.kind === DISPATCH_ACTION_KIND.ACTIVITY_LOOKAHEAD_SYNC || action.kind === DISPATCH_ACTION_KIND.BASELINE_APPLY || action.kind === DISPATCH_ACTION_KIND.PONDERATOR_CRITERION_SET || action.kind === DISPATCH_ACTION_KIND.STATUS_CRITERIA_SET || action.kind === DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_CLEAR || action.kind === DISPATCH_ACTION_KIND.ACTIVITY_CLIPBOARD_IMPORT || action.kind === DISPATCH_ACTION_KIND.ACTIVITY_COPY || action.kind === DISPATCH_ACTION_KIND.SELECTION_TOGGLE || action.kind === DISPATCH_ACTION_KIND.SELECTION_REPLACE || action.kind === DISPATCH_ACTION_KIND.VISIBILITY_SET || action.kind === DISPATCH_ACTION_KIND.FILTER_SET || action.kind === DISPATCH_ACTION_KIND.SORT_SET || action.kind === DISPATCH_ACTION_KIND.VIEW_ATTRIBUTES_SET || action.kind === DISPATCH_ACTION_KIND.GROUP_SET || action.kind === DISPATCH_ACTION_KIND.WBS_DEPTH_SET) {
23417
23484
  return DISPATCH_HISTORY_POLICY.SKIP;
23418
23485
  }
23419
23486
  return DISPATCH_HISTORY_POLICY.RECORD;
@@ -31169,6 +31236,18 @@ var ScheduleCore = class _ScheduleCore {
31169
31236
  this.assertReady();
31170
31237
  return readSelectedActivityIds(this.coreRuntime.state);
31171
31238
  }
31239
+ /**
31240
+ * Reads the core-owned activity clipboard as a portable snapshot.
31241
+ *
31242
+ * The snapshot can be imported into another `ScheduleCore` through the
31243
+ * `activity-clipboard-import` command, which is how a copy survives the
31244
+ * replacement of the schedule instance.
31245
+ * @returns A defensive copy, or `null` when nothing has been copied.
31246
+ */
31247
+ getActivityClipboardView() {
31248
+ this.assertReady();
31249
+ return cloneDomainValue(this._activityClipboard.value);
31250
+ }
31172
31251
  /** @returns A defensive snapshot of explicitly hidden activity IDs. */
31173
31252
  getHiddenActivityIds() {
31174
31253
  this.assertReady();