@forgeax/engine-import 0.1.6 → 0.1.7
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/.tsbuildinfo +1 -1
- package/dist/__tests__/source-package-publication.integration.test.d.ts +2 -0
- package/dist/__tests__/source-package-publication.integration.test.d.ts.map +1 -0
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -1
- package/dist/source-package-publication.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/__tests__/source-package-publication.integration.test.ts +75 -0
- package/src/source-package-publication.ts +31 -0
package/dist/index.mjs
CHANGED
|
@@ -2652,6 +2652,19 @@ function isScriptablePackFailure(error) {
|
|
|
2652
2652
|
function inspectHead(root, guid, desiredKey) {
|
|
2653
2653
|
return new DdcLifecycle(root).inspect(guid, desiredKey);
|
|
2654
2654
|
}
|
|
2655
|
+
var PUBLICATION_SETTLE_TIMEOUT_MS = 5e3;
|
|
2656
|
+
var PUBLICATION_SETTLE_POLL_MS = 10;
|
|
2657
|
+
async function inspectAfterSupersededCommit(candidate) {
|
|
2658
|
+
let head = await inspectHead(candidate.root, candidate.lease.guid, candidate.lease.desiredKey);
|
|
2659
|
+
if (head.state === "current" && head.currentKey === candidate.lease.desiredKey) return head;
|
|
2660
|
+
const deadline = Date.now() + PUBLICATION_SETTLE_TIMEOUT_MS;
|
|
2661
|
+
while (Date.now() < deadline && head.activeLease !== void 0 && head.activeLease.attempt !== candidate.lease.attempt && head.activeLease.desiredKey === candidate.lease.desiredKey) {
|
|
2662
|
+
await new Promise((resolve3) => setTimeout(resolve3, PUBLICATION_SETTLE_POLL_MS));
|
|
2663
|
+
head = await inspectHead(candidate.root, candidate.lease.guid, candidate.lease.desiredKey);
|
|
2664
|
+
if (head.state === "current" && head.currentKey === candidate.lease.desiredKey) return head;
|
|
2665
|
+
}
|
|
2666
|
+
return head;
|
|
2667
|
+
}
|
|
2655
2668
|
async function stageSourcePackageDdc(input) {
|
|
2656
2669
|
const session = new DdcGenerationSession(input.root, { generation: 1 });
|
|
2657
2670
|
try {
|
|
@@ -2670,6 +2683,10 @@ async function commitSourcePackageDdc(candidate) {
|
|
|
2670
2683
|
try {
|
|
2671
2684
|
const commit = await candidate.session.commitEntry(candidate, candidate.lease.desiredKey);
|
|
2672
2685
|
if (commit.result !== "current") {
|
|
2686
|
+
const head = await inspectAfterSupersededCommit(candidate);
|
|
2687
|
+
if (head.state === "current" && head.currentKey === candidate.lease.desiredKey) {
|
|
2688
|
+
return ok(head);
|
|
2689
|
+
}
|
|
2673
2690
|
return err(
|
|
2674
2691
|
sourcePackageError("source-package-ddc-failed", candidate.context, {
|
|
2675
2692
|
stage: "ddc",
|