@highstate/backend 0.7.11 → 0.8.0

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "sourceHashes": {
3
- "./dist/index.js": "7b8b86976ec2a652f27959ce4c55c600a186046b6ab359f7f6e9e25dd8199278",
4
- "./dist/shared/index.js": "c5d5a981d63ee27bc5569db1378311cd165b816e77ad440d54168c5bfef43dbb",
5
- "./dist/library/worker/main.js": "11bbed95f67a1756408bcbea93b87af1ed913ebbf7dbd35978027b0b3e219c05",
3
+ "./dist/index.js": "e69b68bf77ab9313ce725e518d463093c54b6ff50a8f356b38d1ad25f67c4870",
4
+ "./dist/shared/index.js": "45929b7c17c87f61a040a0864221979240b33ffe70765858a071b87d95b1f83b",
5
+ "./dist/library/worker/main.js": "171e65f2b0853e71101237e74cdadf6fcdb48f79bfe8bf759c7047a6090f1635",
6
6
  "./dist/library/package-resolution-worker.js": "4bfa368ad35a64c109df9e5a468c057791164760fe166c4eb5d9a889dee4d7bc"
7
7
  }
8
8
  }
package/dist/index.js CHANGED
@@ -302,6 +302,7 @@ var LocalLibraryBackend = class _LocalLibraryBackend {
302
302
  }
303
303
  async reloadLibrary() {
304
304
  this.logger.info("reloading library");
305
+ await this.ensureLibraryPackagesLoaded(this.libraryPackages, true);
305
306
  this.worker = this.createLibraryWorker({
306
307
  modulePaths: this.libraryPackages,
307
308
  logLevel: "silent"
@@ -987,6 +988,7 @@ var ProjectManager = class _ProjectManager {
987
988
  }
988
989
  async evaluateCompositeInstances(projectId, instanceIds) {
989
990
  await this.projectLockManager.getLock(projectId).lockInstances(instanceIds, async () => {
991
+ this.logger.debug({ instanceIds }, "evaluating composite instances");
990
992
  const [
991
993
  { instances, resolvedInputs, stateMap, resolveInputHash },
992
994
  topLevelCompositeChildrenIds
@@ -1059,6 +1061,10 @@ var ProjectManager = class _ProjectManager {
1059
1061
  "instance evaluation completed, %d instances persisted",
1060
1062
  compositeInstances.length
1061
1063
  );
1064
+ this.logger.debug(
1065
+ { compositeInstanceIds: compositeInstances.map((instance) => instance.instance.id) },
1066
+ "persisted composite instances"
1067
+ );
1062
1068
  await Promise.all(promises);
1063
1069
  });
1064
1070
  }
@@ -1091,10 +1097,12 @@ var ProjectManager = class _ProjectManager {
1091
1097
  if (isUnitModel2(library.components[instance.type])) {
1092
1098
  const resolvedUnits = await this.libraryBackend.getResolvedUnitSources([instance.type]);
1093
1099
  const resolvedUnit = resolvedUnits.find((unit) => unit.unitType === instance.type);
1094
- if (!resolvedUnit) {
1095
- throw new Error(`Resolved unit not found for type "${instance.type}"`);
1100
+ if (resolvedUnit) {
1101
+ sourceHash = resolvedUnit.sourceHash;
1102
+ } else {
1103
+ this.logger.warn(`resolved unit not found for type "%s"`, instance.type);
1104
+ sourceHash = void 0;
1096
1105
  }
1097
- sourceHash = resolvedUnit.sourceHash;
1098
1106
  }
1099
1107
  inputHashInputs.set(instance.id, {
1100
1108
  instance,
@@ -1748,13 +1756,15 @@ var LocalRunnerBackend = class _LocalRunnerBackend {
1748
1756
  },
1749
1757
  async (stack) => {
1750
1758
  await this.setStackConfig(stack, configMap);
1759
+ const summary = await stack.workspace.stack();
1760
+ let currentResourceCount = 0;
1761
+ const initialTotalResourceCount = summary?.resourceCount ?? 0;
1751
1762
  this.updateState({
1752
1763
  id: instanceId,
1753
1764
  status: preview ? "previewing" : "updating",
1754
- currentResourceCount: 0,
1755
- totalResourceCount: 0
1765
+ currentResourceCount,
1766
+ totalResourceCount: initialTotalResourceCount
1756
1767
  });
1757
- let currentResourceCount = 0;
1758
1768
  let totalResourceCount = 0;
1759
1769
  await runWithRetryOnError(
1760
1770
  async () => {
@@ -1769,7 +1779,9 @@ var LocalRunnerBackend = class _LocalRunnerBackend {
1769
1779
  event.resourcePreEvent.metadata.op,
1770
1780
  totalResourceCount
1771
1781
  );
1772
- this.updateState({ id: instanceId, totalResourceCount });
1782
+ if (totalResourceCount > initialTotalResourceCount) {
1783
+ this.updateState({ id: instanceId, totalResourceCount });
1784
+ }
1773
1785
  return;
1774
1786
  }
1775
1787
  if (event.resOutputsEvent) {
@@ -2928,7 +2940,9 @@ var OperationWorkset = class _OperationWorkset {
2928
2940
  workset.addInstance(instance.instance);
2929
2941
  }
2930
2942
  for (const child of instance.children) {
2931
- workset.addInstance(child);
2943
+ if (!workset.instanceMap.has(child.id)) {
2944
+ workset.addInstance(child);
2945
+ }
2932
2946
  }
2933
2947
  }
2934
2948
  for (const state of states) {