@highstate/backend 0.9.8 → 0.9.9

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,6 +1,6 @@
1
1
  {
2
2
  "sourceHashes": {
3
- "./dist/index.js": "2ccc50f29dbff43b4367fc8651bad5755599ad1ef2367b2d44c692e70d16d0f8",
3
+ "./dist/index.js": "bac9fe2cacea1c7b42619b6950c9516162da5dba571a6d8282fbe880645b7f97",
4
4
  "./dist/shared/index.js": "8d015e5f855592ea97cbcf2152042d87f82087b1576d4e667d0cc0e873e68927",
5
5
  "./dist/library/worker/main.js": "2acb09c0340ce9d3f6825ff0c7d2d8a08596f378aa41df211e464257f463497c",
6
6
  "./dist/library/package-resolution-worker.js": "4bfa368ad35a64c109df9e5a468c057791164760fe166c4eb5d9a889dee4d7bc"
package/dist/index.js CHANGED
@@ -2732,11 +2732,11 @@ var OperationWorkset = class _OperationWorkset {
2732
2732
  }
2733
2733
  return this.instanceIdsToUpdate.has(instanceId);
2734
2734
  }
2735
- updateState(update) {
2735
+ updateState(update, phase) {
2736
2736
  const finalState = applyPartialInstanceState(this.stateMap, update);
2737
2737
  this.stateManager.emitStatePatch(this.operation.projectId, createInstanceStatePatch(update));
2738
2738
  if (finalState.parentId) {
2739
- this.recalculateCompositeInstanceState(finalState.parentId);
2739
+ this.recalculateCompositeInstanceState(finalState.parentId, phase);
2740
2740
  }
2741
2741
  return finalState;
2742
2742
  }
@@ -2812,7 +2812,7 @@ var OperationWorkset = class _OperationWorkset {
2812
2812
  }
2813
2813
  return Array.from(dependentStateIds).map((id) => this.stateMap.get(id)).filter((state) => !!state);
2814
2814
  }
2815
- recalculateCompositeInstanceState(instanceId) {
2815
+ recalculateCompositeInstanceState(instanceId, phase) {
2816
2816
  const state = this.stateMap.get(instanceId) ?? createInstanceState(instanceId);
2817
2817
  let currentResourceCount = 0;
2818
2818
  let totalResourceCount = 0;
@@ -2828,13 +2828,14 @@ var OperationWorkset = class _OperationWorkset {
2828
2828
  }
2829
2829
  const updatedState = {
2830
2830
  ...state,
2831
+ status: _OperationWorkset.getStatusByOperationPhase(phase),
2831
2832
  currentResourceCount,
2832
2833
  totalResourceCount
2833
2834
  };
2834
2835
  this.stateMap.set(instanceId, updatedState);
2835
2836
  this.stateManager.emitStatePatch(this.operation.projectId, updatedState);
2836
2837
  if (state.parentId) {
2837
- this.recalculateCompositeInstanceState(state.parentId);
2838
+ this.recalculateCompositeInstanceState(state.parentId, phase);
2838
2839
  }
2839
2840
  }
2840
2841
  addInstance(instance) {
@@ -2983,6 +2984,16 @@ var OperationWorkset = class _OperationWorkset {
2983
2984
  }
2984
2985
  return void 0;
2985
2986
  }
2987
+ static getStatusByOperationPhase(phase) {
2988
+ switch (phase) {
2989
+ case "update":
2990
+ return "updating";
2991
+ case "destroy":
2992
+ return "destroying";
2993
+ case "refresh":
2994
+ return "refreshing";
2995
+ }
2996
+ }
2986
2997
  async getUpToDateInputHash(instance) {
2987
2998
  const component = this.library.components[instance.type];
2988
2999
  this.inputHashResolverInputs.set(instance.id, {
@@ -3248,7 +3259,7 @@ var RuntimeOperation = class {
3248
3259
  ...state,
3249
3260
  parentId: instance?.parentId,
3250
3261
  latestOperationId: this.operation.id,
3251
- status: this.getStatusByOperationType(),
3262
+ status: "pending",
3252
3263
  error: null
3253
3264
  });
3254
3265
  const children = this.workset.getAffectedCompositeChildren(instanceId, this.currentPhase);
@@ -3515,7 +3526,7 @@ var RuntimeOperation = class {
3515
3526
  }
3516
3527
  return;
3517
3528
  }
3518
- const state = this.workset.updateState(patch);
3529
+ const state = this.workset.updateState(patch, this.currentPhase);
3519
3530
  if (this.operation.type !== "preview") {
3520
3531
  this.persistStates.call(state);
3521
3532
  if (patch.secrets) {
@@ -3533,20 +3544,6 @@ var RuntimeOperation = class {
3533
3544
  this.instancePromiseMap.set(instanceId, instancePromise);
3534
3545
  return instancePromise;
3535
3546
  }
3536
- getStatusByOperationType() {
3537
- switch (this.operation.type) {
3538
- case "update":
3539
- return "updating";
3540
- case "preview":
3541
- return "previewing";
3542
- case "recreate":
3543
- return "updating";
3544
- case "destroy":
3545
- return "destroying";
3546
- case "refresh":
3547
- return "refreshing";
3548
- }
3549
- }
3550
3547
  getInstanceDependencies(instance) {
3551
3548
  const dependencies = [];
3552
3549
  const instanceInputs = this.workset.resolvedInstanceInputs.get(instance.id) ?? {};