@highstate/backend 0.9.7 → 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.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@highstate/backend",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.9",
|
4
4
|
"type": "module",
|
5
5
|
"files": [
|
6
6
|
"dist",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"build": "highstate build"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@highstate/contract": "^0.9.
|
29
|
+
"@highstate/contract": "^0.9.9",
|
30
30
|
"@types/node": "^22.10.1",
|
31
31
|
"ajv": "^8.17.1",
|
32
32
|
"better-lock": "^3.2.0",
|
@@ -65,5 +65,5 @@
|
|
65
65
|
"rollup": "^4.28.1",
|
66
66
|
"typescript": "^5.7.2"
|
67
67
|
},
|
68
|
-
"gitHead": "
|
68
|
+
"gitHead": "1c04a713fa1bb7c0231e5e6d0537709097bb0e8e"
|
69
69
|
}
|
@@ -22,6 +22,7 @@ import {
|
|
22
22
|
type InputResolverOutput,
|
23
23
|
type InstanceState,
|
24
24
|
type InstanceStateUpdate,
|
25
|
+
type InstanceStatus,
|
25
26
|
type LibraryModel,
|
26
27
|
type ProjectOperation,
|
27
28
|
type ResolvedInstanceInput,
|
@@ -96,12 +97,12 @@ export class OperationWorkset {
|
|
96
97
|
return this.instanceIdsToUpdate.has(instanceId)
|
97
98
|
}
|
98
99
|
|
99
|
-
public updateState(update: InstanceStateUpdate): InstanceState {
|
100
|
+
public updateState(update: InstanceStateUpdate, phase: OperationPhase): InstanceState {
|
100
101
|
const finalState = applyPartialInstanceState(this.stateMap, update)
|
101
102
|
this.stateManager.emitStatePatch(this.operation.projectId, createInstanceStatePatch(update))
|
102
103
|
|
103
104
|
if (finalState.parentId) {
|
104
|
-
this.recalculateCompositeInstanceState(finalState.parentId)
|
105
|
+
this.recalculateCompositeInstanceState(finalState.parentId, phase)
|
105
106
|
}
|
106
107
|
|
107
108
|
return finalState
|
@@ -202,7 +203,7 @@ export class OperationWorkset {
|
|
202
203
|
.filter((state): state is InstanceState => !!state)
|
203
204
|
}
|
204
205
|
|
205
|
-
private recalculateCompositeInstanceState(instanceId: string): void {
|
206
|
+
private recalculateCompositeInstanceState(instanceId: string, phase: OperationPhase): void {
|
206
207
|
const state = this.stateMap.get(instanceId) ?? createInstanceState(instanceId)
|
207
208
|
let currentResourceCount = 0
|
208
209
|
let totalResourceCount = 0
|
@@ -222,6 +223,7 @@ export class OperationWorkset {
|
|
222
223
|
|
223
224
|
const updatedState = {
|
224
225
|
...state,
|
226
|
+
status: OperationWorkset.getStatusByOperationPhase(phase),
|
225
227
|
currentResourceCount,
|
226
228
|
totalResourceCount,
|
227
229
|
}
|
@@ -230,7 +232,7 @@ export class OperationWorkset {
|
|
230
232
|
this.stateManager.emitStatePatch(this.operation.projectId, updatedState)
|
231
233
|
|
232
234
|
if (state.parentId) {
|
233
|
-
this.recalculateCompositeInstanceState(state.parentId)
|
235
|
+
this.recalculateCompositeInstanceState(state.parentId, phase)
|
234
236
|
}
|
235
237
|
}
|
236
238
|
|
@@ -431,6 +433,17 @@ export class OperationWorkset {
|
|
431
433
|
return undefined
|
432
434
|
}
|
433
435
|
|
436
|
+
private static getStatusByOperationPhase(phase: OperationPhase): InstanceStatus {
|
437
|
+
switch (phase) {
|
438
|
+
case "update":
|
439
|
+
return "updating"
|
440
|
+
case "destroy":
|
441
|
+
return "destroying"
|
442
|
+
case "refresh":
|
443
|
+
return "refreshing"
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
434
447
|
public async getUpToDateInputHash(instance: InstanceModel): Promise<string> {
|
435
448
|
const component = this.library.components[instance.type]
|
436
449
|
|
@@ -11,7 +11,6 @@ import { mapValues } from "remeda"
|
|
11
11
|
import {
|
12
12
|
type InstanceState,
|
13
13
|
type InstanceStateUpdate,
|
14
|
-
type InstanceStatus,
|
15
14
|
type ProjectOperation,
|
16
15
|
type InstanceTriggerInvocation,
|
17
16
|
createInstanceState,
|
@@ -220,7 +219,7 @@ export class RuntimeOperation {
|
|
220
219
|
...state,
|
221
220
|
parentId: instance?.parentId,
|
222
221
|
latestOperationId: this.operation.id,
|
223
|
-
status:
|
222
|
+
status: "pending",
|
224
223
|
error: null,
|
225
224
|
})
|
226
225
|
|
@@ -575,7 +574,7 @@ export class RuntimeOperation {
|
|
575
574
|
return
|
576
575
|
}
|
577
576
|
|
578
|
-
const state = this.workset.updateState(patch)
|
577
|
+
const state = this.workset.updateState(patch, this.currentPhase)
|
579
578
|
|
580
579
|
// do not persist anyting for preview operations
|
581
580
|
if (this.operation.type !== "preview") {
|
@@ -604,21 +603,6 @@ export class RuntimeOperation {
|
|
604
603
|
return instancePromise
|
605
604
|
}
|
606
605
|
|
607
|
-
private getStatusByOperationType(): InstanceStatus {
|
608
|
-
switch (this.operation.type) {
|
609
|
-
case "update":
|
610
|
-
return "updating"
|
611
|
-
case "preview":
|
612
|
-
return "previewing"
|
613
|
-
case "recreate":
|
614
|
-
return "updating"
|
615
|
-
case "destroy":
|
616
|
-
return "destroying"
|
617
|
-
case "refresh":
|
618
|
-
return "refreshing"
|
619
|
-
}
|
620
|
-
}
|
621
|
-
|
622
606
|
private getInstanceDependencies(instance: InstanceModel): InstanceModel[] {
|
623
607
|
const dependencies: InstanceModel[] = []
|
624
608
|
const instanceInputs = this.workset.resolvedInstanceInputs.get(instance.id) ?? {}
|