@teambit/objects 0.0.731 → 0.0.733
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/models/model-component.js +8 -7
- package/dist/models/model-component.js.map +1 -1
- package/dist/models/model-component.spec.js +76 -0
- package/dist/models/model-component.spec.js.map +1 -1
- package/dist/models/version-history.js +2 -2
- package/dist/models/version-history.js.map +1 -1
- package/dist/models/version-history.spec.d.ts +1 -0
- package/dist/models/version-history.spec.js +79 -0
- package/dist/models/version-history.spec.js.map +1 -0
- package/dist/objects/object-list-to-graph.js +2 -2
- package/dist/objects/object-list-to-graph.js.map +1 -1
- package/models/model-component.spec.ts +69 -0
- package/models/model-component.ts +8 -7
- package/models/version-history.spec.ts +60 -0
- package/models/version-history.ts +2 -2
- package/objects/object-list-to-graph.ts +3 -3
- package/package.json +26 -26
- /package/dist/{preview-1793117184976.js → preview-1793136394048.js} +0 -0
|
@@ -1437,11 +1437,12 @@ bit import ${this.id()}@${resolvedVersion} --objects --all-history`);
|
|
|
1437
1437
|
const headExists = versionHistory.hasHash(head);
|
|
1438
1438
|
if (exitWhenFind && headExists) return {};
|
|
1439
1439
|
const getVersionObj = async ref => await ref.load(repo);
|
|
1440
|
-
const versionsToAdd =
|
|
1440
|
+
const versionsToAdd = new Map(); // by hash
|
|
1441
|
+
const addVersion = version => versionsToAdd.set(version.hash().toString(), version);
|
|
1441
1442
|
let err;
|
|
1442
1443
|
const addParentsRecursively = async version => {
|
|
1443
1444
|
await (0, _pMapSeries().default)(version.parents, async parent => {
|
|
1444
|
-
const foundParent = versionHistory.hasHash(parent) || versionsToAdd.
|
|
1445
|
+
const foundParent = versionHistory.hasHash(parent) || versionsToAdd.has(parent.toString());
|
|
1445
1446
|
if (exitWhenFind && foundParent) {
|
|
1446
1447
|
return;
|
|
1447
1448
|
}
|
|
@@ -1451,7 +1452,7 @@ bit import ${this.id()}@${resolvedVersion} --objects --all-history`);
|
|
|
1451
1452
|
err = tag ? new (_legacy6().VersionNotFound)(tag, this.id()) : new (_legacy6().ParentNotFound)(this.id(), version.hash().toString(), parent.toString());
|
|
1452
1453
|
return;
|
|
1453
1454
|
}
|
|
1454
|
-
|
|
1455
|
+
addVersion(parentVersion);
|
|
1455
1456
|
await addParentsRecursively(parentVersion);
|
|
1456
1457
|
});
|
|
1457
1458
|
};
|
|
@@ -1462,17 +1463,17 @@ bit import ${this.id()}@${resolvedVersion} --objects --all-history`);
|
|
|
1462
1463
|
};
|
|
1463
1464
|
}
|
|
1464
1465
|
return this.populateVersionHistoryMutex.runExclusive(async () => {
|
|
1465
|
-
if (!headExists)
|
|
1466
|
+
if (!headExists) addVersion(headVer);
|
|
1466
1467
|
await addParentsRecursively(headVer);
|
|
1467
|
-
const added = versionsToAdd.map(v => (0, _component2().getVersionParentsFromVersion)(v));
|
|
1468
|
+
const added = [...versionsToAdd.values()].map(v => (0, _component2().getVersionParentsFromVersion)(v));
|
|
1468
1469
|
if (err) {
|
|
1469
1470
|
return {
|
|
1470
1471
|
err,
|
|
1471
1472
|
added
|
|
1472
1473
|
};
|
|
1473
1474
|
}
|
|
1474
|
-
versionHistory.addFromVersionsObjects(versionsToAdd);
|
|
1475
|
-
_legacy4().logger.debug(`populateVersionHistoryIfMissingGracefully, updating ${this.id()} with ${versionsToAdd.
|
|
1475
|
+
versionHistory.addFromVersionsObjects([...versionsToAdd.values()]);
|
|
1476
|
+
_legacy4().logger.debug(`populateVersionHistoryIfMissingGracefully, updating ${this.id()} with ${versionsToAdd.size} versions`);
|
|
1476
1477
|
await repo.writeObjectsToTheFS([versionHistory]);
|
|
1477
1478
|
return {
|
|
1478
1479
|
added
|