@outbuild-company/schedule-core 1.16.0 → 1.16.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/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +70 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +70 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11588,18 +11588,19 @@ var AUTOSCHEDULE_SCOPE = { ROOTS: "roots" };
|
|
|
11588
11588
|
async function runPostMutation(deps, args) {
|
|
11589
11589
|
recomputePromotedSummaryPonderators(deps);
|
|
11590
11590
|
const progressInvalidation = resolveProgressInvalidation(deps.adapter);
|
|
11591
|
-
const
|
|
11591
|
+
const effectiveArgs = resolveTransactionAutoscheduleArgs(deps.adapter, args);
|
|
11592
|
+
const passes = resolvePasses(effectiveArgs, progressInvalidation);
|
|
11592
11593
|
if (passes.has(DERIVED_PASS.AUTOSCHEDULE)) {
|
|
11593
|
-
await refreshMutatedParentBounds(deps.adapter,
|
|
11594
|
+
await refreshMutatedParentBounds(deps.adapter, effectiveArgs);
|
|
11594
11595
|
}
|
|
11595
11596
|
const schedule = passes.has(DERIVED_PASS.AUTOSCHEDULE) ? await runAutoschedule(
|
|
11596
11597
|
deps,
|
|
11597
|
-
|
|
11598
|
-
|
|
11598
|
+
effectiveArgs.autoscheduleFrom,
|
|
11599
|
+
effectiveArgs.preventSummaryTargetPullback
|
|
11599
11600
|
) : emptySchedule();
|
|
11600
11601
|
await rollUpParentBounds(
|
|
11601
11602
|
deps.adapter,
|
|
11602
|
-
|
|
11603
|
+
effectiveArgs,
|
|
11603
11604
|
schedule.scheduledIds,
|
|
11604
11605
|
passes,
|
|
11605
11606
|
progressInvalidation
|
|
@@ -11607,6 +11608,49 @@ async function runPostMutation(deps, args) {
|
|
|
11607
11608
|
await runDerivedRecomputes(deps, passes, args.now);
|
|
11608
11609
|
return schedule;
|
|
11609
11610
|
}
|
|
11611
|
+
function resolveTransactionAutoscheduleArgs(adapter, args) {
|
|
11612
|
+
const autoscheduleFrom = resolveTransactionAutoscheduleFrom(
|
|
11613
|
+
adapter,
|
|
11614
|
+
args.autoscheduleFrom
|
|
11615
|
+
);
|
|
11616
|
+
return autoscheduleFrom === args.autoscheduleFrom ? args : { ...args, autoscheduleFrom };
|
|
11617
|
+
}
|
|
11618
|
+
function resolveTransactionAutoscheduleFrom(adapter, requested) {
|
|
11619
|
+
if (requested === AUTOSCHEDULE_SCOPE.ROOTS) {
|
|
11620
|
+
return AUTOSCHEDULE_SCOPE.ROOTS;
|
|
11621
|
+
}
|
|
11622
|
+
const targets = collectLinkMutationTargets(adapter);
|
|
11623
|
+
if (targets.size === 0) return requested;
|
|
11624
|
+
if (requested !== null) targets.add(String(requested));
|
|
11625
|
+
if (targets.size !== 1) return AUTOSCHEDULE_SCOPE.ROOTS;
|
|
11626
|
+
const [target] = targets;
|
|
11627
|
+
if (target === void 0 || !adapter.activityExists(target) || adapter.hasChildren(target)) {
|
|
11628
|
+
return AUTOSCHEDULE_SCOPE.ROOTS;
|
|
11629
|
+
}
|
|
11630
|
+
return target;
|
|
11631
|
+
}
|
|
11632
|
+
function collectLinkMutationTargets(adapter) {
|
|
11633
|
+
const targets = /* @__PURE__ */ new Set();
|
|
11634
|
+
const journal = adapter.peekWriteCapture();
|
|
11635
|
+
if (!journal) return targets;
|
|
11636
|
+
for (const operation of journal.ops) {
|
|
11637
|
+
if (operation.kind === WRITE_OPERATION_KIND.LINK_REMOVE) {
|
|
11638
|
+
targets.add(String(operation.before.target));
|
|
11639
|
+
continue;
|
|
11640
|
+
}
|
|
11641
|
+
if (operation.kind === WRITE_OPERATION_KIND.LINK_ADD) {
|
|
11642
|
+
const link = adapter.getLink(operation.linkId);
|
|
11643
|
+
if (link) targets.add(String(link.target));
|
|
11644
|
+
continue;
|
|
11645
|
+
}
|
|
11646
|
+
if (operation.kind === WRITE_OPERATION_KIND.LINK_FIELD) {
|
|
11647
|
+
targets.add(String(operation.before.target));
|
|
11648
|
+
const link = adapter.getLink(operation.linkId);
|
|
11649
|
+
if (link) targets.add(String(link.target));
|
|
11650
|
+
}
|
|
11651
|
+
}
|
|
11652
|
+
return targets;
|
|
11653
|
+
}
|
|
11610
11654
|
function recomputePromotedSummaryPonderators(deps) {
|
|
11611
11655
|
const journal = deps.adapter.peekWriteCapture();
|
|
11612
11656
|
if (!journal) return;
|
|
@@ -14752,12 +14796,20 @@ function collectInvalidLinkIdsForCycle(movedActivityIds, adapter) {
|
|
|
14752
14796
|
const src = String(link.source);
|
|
14753
14797
|
const tgt = String(link.target);
|
|
14754
14798
|
if (!moved.has(src) && !moved.has(tgt)) continue;
|
|
14755
|
-
if (
|
|
14799
|
+
if (isHierarchyInvalidLink(link, adapter)) {
|
|
14756
14800
|
out.push(String(link.id));
|
|
14757
14801
|
}
|
|
14758
14802
|
}
|
|
14759
14803
|
return out;
|
|
14760
14804
|
}
|
|
14805
|
+
function isHierarchyInvalidLink(link, adapter) {
|
|
14806
|
+
const source = String(link.source);
|
|
14807
|
+
const target = String(link.target);
|
|
14808
|
+
return isAncestor(target, source, adapter) || isAncestor(source, target, adapter);
|
|
14809
|
+
}
|
|
14810
|
+
function collectInvalidLinkIdsFromSnapshots(links, adapter) {
|
|
14811
|
+
return [...links].filter(([, link]) => isHierarchyInvalidLink(link, adapter)).map(([linkId]) => String(linkId));
|
|
14812
|
+
}
|
|
14761
14813
|
function isAncestor(descendantId, candidateAncestorId, adapter) {
|
|
14762
14814
|
let cur = String(descendantId);
|
|
14763
14815
|
const guard = /* @__PURE__ */ new Set();
|
|
@@ -14981,6 +15033,10 @@ async function dispatchActivityMove(action, options, deps) {
|
|
|
14981
15033
|
}
|
|
14982
15034
|
);
|
|
14983
15035
|
const invalidLinkIds = parentChanged ? collectInvalidLinkIdsForCycle([action.activityId], adapter) : [];
|
|
15036
|
+
const promotionInvalidLinkIds = collectInvalidLinkIdsFromSnapshots(
|
|
15037
|
+
beforeLinks,
|
|
15038
|
+
adapter
|
|
15039
|
+
);
|
|
14984
15040
|
const trackingEvent = {
|
|
14985
15041
|
name: DISPATCH_TRACK_EVENT.ACTIVITY_MOVE,
|
|
14986
15042
|
properties: {
|
|
@@ -14989,7 +15045,7 @@ async function dispatchActivityMove(action, options, deps) {
|
|
|
14989
15045
|
after_sibling_id: action.afterSiblingId ?? null,
|
|
14990
15046
|
before_sibling_id: action.beforeSiblingId ?? null,
|
|
14991
15047
|
invalid_link_ids: [
|
|
14992
|
-
.../* @__PURE__ */ new Set([...invalidLinkIds.map(String)
|
|
15048
|
+
.../* @__PURE__ */ new Set([...promotionInvalidLinkIds, ...invalidLinkIds.map(String)])
|
|
14993
15049
|
]
|
|
14994
15050
|
}
|
|
14995
15051
|
};
|
|
@@ -15169,6 +15225,10 @@ async function dispatchActivityIndent(action, options, deps) {
|
|
|
15169
15225
|
if (shift.before !== void 0) beforeImage.correlativeId = shift.before;
|
|
15170
15226
|
beforeSnap.set(shift.activityId, beforeImage);
|
|
15171
15227
|
}
|
|
15228
|
+
const promotionInvalidLinkIds = collectInvalidLinkIdsFromSnapshots(
|
|
15229
|
+
beforeLinks,
|
|
15230
|
+
adapter
|
|
15231
|
+
);
|
|
15172
15232
|
const invalidLinkIds = collectInvalidLinkIdsForCycle(succeededIds, adapter);
|
|
15173
15233
|
for (const linkId of invalidLinkIds) {
|
|
15174
15234
|
const link = adapter.getLink(linkId);
|
|
@@ -15199,7 +15259,9 @@ async function dispatchActivityIndent(action, options, deps) {
|
|
|
15199
15259
|
activity_id: f.activityId,
|
|
15200
15260
|
reason: f.reason
|
|
15201
15261
|
})),
|
|
15202
|
-
invalid_link_ids: [
|
|
15262
|
+
invalid_link_ids: [
|
|
15263
|
+
.../* @__PURE__ */ new Set([...promotionInvalidLinkIds, ...invalidLinkIds.map(String)])
|
|
15264
|
+
]
|
|
15203
15265
|
}
|
|
15204
15266
|
};
|
|
15205
15267
|
if (action.eventSource !== void 0) {
|