@outbuild-company/schedule-core 1.15.11 → 1.15.13

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.js CHANGED
@@ -2959,6 +2959,7 @@ async function alapPass(reversedIds, links, asapPlans, adapter, _options, isCurr
2959
2959
  const boundary = getParentBoundary(activity);
2960
2960
  let latestEnd = boundary;
2961
2961
  let successorAnchor = null;
2962
+ let successorAnchorType = null;
2962
2963
  let anchorInSubtree = false;
2963
2964
  const outgoing = outgoingLinks.get(String(activityId)) ?? [];
2964
2965
  for (const link of outgoing) {
@@ -2983,6 +2984,7 @@ async function alapPass(reversedIds, links, asapPlans, adapter, _options, isCurr
2983
2984
  }
2984
2985
  if (successorAnchor === null || predecessorEnd < successorAnchor) {
2985
2986
  successorAnchor = predecessorEnd;
2987
+ successorAnchorType = link.type;
2986
2988
  anchorInSubtree = activity.parentId && !isRootParent(activity.parentId) ? isInSubtree(link.target, activity.parentId) : false;
2987
2989
  }
2988
2990
  }
@@ -3026,7 +3028,9 @@ async function alapPass(reversedIds, links, asapPlans, adapter, _options, isCurr
3026
3028
  task: activity
3027
3029
  });
3028
3030
  } else if (activity.durationHours === 0) {
3029
- if (isFinishMarker) {
3031
+ if (successorAnchor !== null && successorAnchorType === LINK_TYPE.FINISH_TO_START && latestEnd.getTime() === successorAnchor.getTime()) {
3032
+ snappedEnd = latestEnd;
3033
+ } else if (isFinishMarker) {
3030
3034
  snappedEnd = finishMarkerEnd();
3031
3035
  } else {
3032
3036
  snappedEnd = adapter.getClosestWorkTime({
@@ -16337,9 +16341,19 @@ function resolveDestination(afterSiblingId, adapter) {
16337
16341
  return { ok: false, reason: REJECTION_REASON.ANCHOR_SIBLING_NOT_FOUND };
16338
16342
  }
16339
16343
  if (sibling.parentId == null) {
16340
- return adapter.getRootIds().length === 1 ? { ok: true, parentId: sibling.id } : { ok: true, parentId: ROOT_PARENT_ID, afterSiblingId };
16344
+ return adapter.getRootIds().length === 1 ? {
16345
+ ok: true,
16346
+ parentId: sibling.id,
16347
+ beforeSiblingId: adapter.getChildren(sibling.id)[0]
16348
+ } : { ok: true, parentId: ROOT_PARENT_ID, afterSiblingId };
16349
+ }
16350
+ if (adapter.hasChildren(sibling.id)) {
16351
+ return {
16352
+ ok: true,
16353
+ parentId: sibling.id,
16354
+ beforeSiblingId: adapter.getChildren(sibling.id)[0]
16355
+ };
16341
16356
  }
16342
- if (adapter.hasChildren(sibling.id)) return { ok: true, parentId: sibling.id };
16343
16357
  return {
16344
16358
  ok: true,
16345
16359
  parentId: String(sibling.parentId),
@@ -16371,11 +16385,13 @@ async function dispatchActivityPasteCopied(action, options, deps) {
16371
16385
  for (const copied of clipboard.activities) {
16372
16386
  const mappedParent = originalToNew.get(copied.originalParentId);
16373
16387
  const afterSiblingId = mappedParent === void 0 ? previousRootId ?? destination.afterSiblingId : void 0;
16388
+ const beforeSiblingId = mappedParent === void 0 && afterSiblingId === void 0 ? destination.beforeSiblingId : void 0;
16374
16389
  const created = await createActivityCore(
16375
16390
  {
16376
16391
  kind: DISPATCH_ACTION_KIND.ACTIVITY_CREATE,
16377
16392
  parentId: mappedParent ?? destination.parentId,
16378
16393
  ...afterSiblingId === void 0 ? {} : { afterSiblingId },
16394
+ ...beforeSiblingId === void 0 ? {} : { beforeSiblingId },
16379
16395
  overrides: cloneDomainValue(copied.overrides),
16380
16396
  eventSource: action.eventSource
16381
16397
  },