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