@highstate/backend 0.19.1 → 0.21.1
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/chunk-b05q6fm2.js +37 -0
- package/dist/{chunk-V2NILDHS.js → chunk-gxjwa93h.js} +704 -604
- package/dist/{chunk-X2WG3WGL.js → chunk-vzdz6chj.js} +18 -15
- package/dist/highstate.manifest.json +4 -4
- package/dist/index.js +7350 -3514
- package/dist/library/package-resolution-worker.js +121 -10
- package/dist/library/worker/main.js +31 -17
- package/dist/shared/index.js +254 -4
- package/package.json +19 -20
- package/prisma/backend/_schema/object.prisma +12 -0
- package/prisma/backend/sqlite/migrations/20260222113554_add_object_tracking/migration.sql +7 -0
- package/prisma/project/artifact.prisma +3 -0
- package/prisma/project/entity.prisma +125 -0
- package/prisma/project/instance.prisma +6 -0
- package/prisma/project/migrations/20260301210131_add_entity_tracking/migration.sql +70 -0
- package/prisma/project/migrations/20260302212734_add_resource_hooks_flag/migration.sql +1 -0
- package/prisma/project/operation.prisma +3 -0
- package/src/artifact/factory.ts +3 -2
- package/src/business/artifact.test.ts +22 -2
- package/src/business/artifact.ts +7 -1
- package/src/business/entity-snapshot.test.ts +684 -0
- package/src/business/entity-snapshot.ts +904 -0
- package/src/business/evaluation.test.ts +56 -0
- package/src/business/evaluation.ts +102 -22
- package/src/business/global-search.test.ts +344 -0
- package/src/business/global-search.ts +902 -0
- package/src/business/index.ts +4 -0
- package/src/business/instance-lock.ts +58 -74
- package/src/business/instance-state.test.ts +15 -1
- package/src/business/instance-state.ts +37 -14
- package/src/business/object-ref-index.test.ts +140 -0
- package/src/business/object-ref-index.ts +193 -0
- package/src/business/operation.test.ts +15 -1
- package/src/business/operation.ts +4 -0
- package/src/business/project-model.ts +154 -13
- package/src/business/project-unlock.ts +25 -2
- package/src/business/project.ts +9 -0
- package/src/business/secret.test.ts +35 -2
- package/src/business/secret.ts +32 -9
- package/src/business/settings.ts +761 -0
- package/src/business/unit-output.test.ts +477 -0
- package/src/business/unit-output.ts +461 -0
- package/src/business/worker.ts +55 -4
- package/src/database/_generated/backend/postgresql/browser.ts +6 -0
- package/src/database/_generated/backend/postgresql/client.ts +6 -0
- package/src/database/_generated/backend/postgresql/internal/class.ts +23 -5
- package/src/database/_generated/backend/postgresql/internal/prismaNamespace.ts +89 -5
- package/src/database/_generated/backend/postgresql/internal/prismaNamespaceBrowser.ts +9 -0
- package/src/database/_generated/backend/postgresql/models/Object.ts +1076 -0
- package/src/database/_generated/backend/postgresql/models.ts +1 -0
- package/src/database/_generated/backend/sqlite/browser.ts +6 -0
- package/src/database/_generated/backend/sqlite/client.ts +6 -0
- package/src/database/_generated/backend/sqlite/internal/class.ts +23 -5
- package/src/database/_generated/backend/sqlite/internal/prismaNamespace.ts +89 -5
- package/src/database/_generated/backend/sqlite/internal/prismaNamespaceBrowser.ts +9 -0
- package/src/database/_generated/backend/sqlite/models/Object.ts +1074 -0
- package/src/database/_generated/backend/sqlite/models.ts +1 -0
- package/src/database/_generated/project/browser.ts +23 -0
- package/src/database/_generated/project/client.ts +23 -0
- package/src/database/_generated/project/commonInputTypes.ts +87 -53
- package/src/database/_generated/project/enums.ts +8 -0
- package/src/database/_generated/project/internal/class.ts +53 -5
- package/src/database/_generated/project/internal/prismaNamespace.ts +367 -13
- package/src/database/_generated/project/internal/prismaNamespaceBrowser.ts +48 -1
- package/src/database/_generated/project/models/Artifact.ts +199 -11
- package/src/database/_generated/project/models/Entity.ts +1274 -0
- package/src/database/_generated/project/models/EntitySnapshot.ts +2389 -0
- package/src/database/_generated/project/models/EntitySnapshotContent.ts +1260 -0
- package/src/database/_generated/project/models/EntitySnapshotReference.ts +1449 -0
- package/src/database/_generated/project/models/InstanceState.ts +361 -1
- package/src/database/_generated/project/models/Operation.ts +148 -3
- package/src/database/_generated/project/models/OperationLog.ts +0 -4
- package/src/database/_generated/project/models.ts +4 -0
- package/src/database/migration.ts +3 -0
- package/src/library/find-package-json.test.ts +77 -0
- package/src/library/find-package-json.ts +149 -0
- package/src/library/package-resolution-worker.ts +7 -3
- package/src/library/worker/evaluator.ts +7 -1
- package/src/orchestrator/manager.ts +7 -0
- package/src/orchestrator/operation-context.captured-outputs.test.ts +118 -0
- package/src/orchestrator/operation-context.ts +154 -16
- package/src/orchestrator/operation-plan.destroy.test.md +33 -12
- package/src/orchestrator/operation-plan.destroy.test.ts +140 -2
- package/src/orchestrator/operation-plan.fixtures.ts +2 -0
- package/src/orchestrator/operation-plan.md +4 -1
- package/src/orchestrator/operation-plan.ts +286 -92
- package/src/orchestrator/operation-plan.update.test.md +286 -11
- package/src/orchestrator/operation-plan.update.test.ts +656 -5
- package/src/orchestrator/operation-workset.ts +72 -22
- package/src/orchestrator/operation.cancel.test.ts +4 -0
- package/src/orchestrator/operation.composite.test.ts +341 -0
- package/src/orchestrator/operation.destroy.test.ts +4 -0
- package/src/orchestrator/operation.output-validation.failure.test.ts +124 -0
- package/src/orchestrator/operation.preview.test.ts +4 -0
- package/src/orchestrator/operation.refresh.test.ts +4 -0
- package/src/orchestrator/operation.test-utils.ts +52 -13
- package/src/orchestrator/operation.ts +230 -68
- package/src/orchestrator/operation.update.failure.test.ts +4 -0
- package/src/orchestrator/operation.update.skip.test.ts +196 -0
- package/src/orchestrator/operation.update.test.ts +4 -0
- package/src/orchestrator/plan-test-builder.ts +1 -0
- package/src/orchestrator/unit-input-values.test.ts +450 -0
- package/src/orchestrator/unit-input-values.ts +281 -0
- package/src/pubsub/manager.ts +3 -0
- package/src/runner/abstractions.ts +23 -54
- package/src/runner/factory.ts +3 -3
- package/src/runner/force-abort.ts +7 -2
- package/src/runner/local.ts +116 -87
- package/src/runner/pulumi.ts +3 -5
- package/src/services.ts +53 -2
- package/src/shared/models/prisma.ts +1 -0
- package/src/shared/models/project/entity.ts +121 -0
- package/src/shared/models/project/index.ts +1 -0
- package/src/shared/models/project/operation.ts +61 -3
- package/src/shared/models/project/state.ts +10 -0
- package/src/shared/models/project/worker.ts +7 -0
- package/src/shared/resolvers/effective-output-type.test.ts +494 -0
- package/src/shared/resolvers/effective-output-type.ts +162 -0
- package/src/shared/resolvers/index.ts +1 -0
- package/src/shared/resolvers/input.ts +59 -9
- package/src/shared/utils/index.ts +1 -0
- package/src/shared/utils/stable-json.ts +41 -0
- package/src/terminal/manager.ts +6 -0
- package/src/terminal/run.sh.ts +9 -4
- package/src/worker/manager.ts +97 -1
- package/LICENSE +0 -21
- package/dist/chunk-I7BWSAN6.js +0 -49
- package/dist/chunk-I7BWSAN6.js.map +0 -1
- package/dist/chunk-V2NILDHS.js.map +0 -1
- package/dist/chunk-X2WG3WGL.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/library/package-resolution-worker.js.map +0 -1
- package/dist/library/worker/main.js.map +0 -1
- package/dist/shared/index.js.map +0 -1
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { mkdir } from 'node:fs/promises';
|
|
3
|
-
import { basename, dirname, relative } from 'node:path';
|
|
4
|
-
import { findWorkspaceDir, readPackageJSON, resolvePackageJSON } from 'pkg-types';
|
|
5
|
-
|
|
1
|
+
// @bun
|
|
6
2
|
// src/common/utils.ts
|
|
3
|
+
import { z } from "zod";
|
|
7
4
|
async function runWithRetryOnError(runner, tryHandleError, maxRetries = 1) {
|
|
8
5
|
let lastError;
|
|
9
|
-
for (let i = 0;
|
|
6
|
+
for (let i = 0;i < maxRetries + 1; i++) {
|
|
10
7
|
try {
|
|
11
8
|
return await runner();
|
|
12
9
|
} catch (e) {
|
|
@@ -19,12 +16,13 @@ async function runWithRetryOnError(runner, tryHandleError, maxRetries = 1) {
|
|
|
19
16
|
}
|
|
20
17
|
throw lastError;
|
|
21
18
|
}
|
|
22
|
-
|
|
19
|
+
|
|
20
|
+
class AbortError extends Error {
|
|
23
21
|
constructor(message, options) {
|
|
24
22
|
super(message, options);
|
|
25
23
|
this.name = "AbortError";
|
|
26
24
|
}
|
|
27
|
-
}
|
|
25
|
+
}
|
|
28
26
|
function isAbortError(error) {
|
|
29
27
|
return error instanceof Error && error.name === "AbortError";
|
|
30
28
|
}
|
|
@@ -68,6 +66,12 @@ function waitForAbort(signal) {
|
|
|
68
66
|
signal.addEventListener("abort", () => resolve(), { once: true });
|
|
69
67
|
});
|
|
70
68
|
}
|
|
69
|
+
|
|
70
|
+
// src/common/codebase.ts
|
|
71
|
+
import { mkdir } from "fs/promises";
|
|
72
|
+
import { dirname, relative } from "path";
|
|
73
|
+
import { resolvePackageJSON } from "pkg-types";
|
|
74
|
+
import z2 from "zod";
|
|
71
75
|
var codebaseConfig = z2.object({
|
|
72
76
|
HIGHSTATE_CODEBASE_PATH: z2.string().optional()
|
|
73
77
|
});
|
|
@@ -103,6 +107,9 @@ async function getCodebaseHighstatePath(config, logger) {
|
|
|
103
107
|
}
|
|
104
108
|
return codebaseHighstatePath;
|
|
105
109
|
}
|
|
110
|
+
// src/common/local.ts
|
|
111
|
+
import { basename } from "path";
|
|
112
|
+
import { findWorkspaceDir, readPackageJSON } from "pkg-types";
|
|
106
113
|
async function resolveMainLocalProject(projectPath, projectName) {
|
|
107
114
|
if (!projectPath) {
|
|
108
115
|
projectPath = await findWorkspaceDir();
|
|
@@ -116,12 +123,10 @@ async function resolveMainLocalProject(projectPath, projectName) {
|
|
|
116
123
|
}
|
|
117
124
|
return [projectPath, projectName];
|
|
118
125
|
}
|
|
119
|
-
|
|
120
126
|
// src/common/logger.ts
|
|
121
127
|
function createProjectLogger(logger, projectId) {
|
|
122
128
|
return logger.child({ projectId }, { msgPrefix: `[project:${projectId}] ` });
|
|
123
129
|
}
|
|
124
|
-
|
|
125
130
|
// src/common/tree.ts
|
|
126
131
|
function renderTree(node) {
|
|
127
132
|
const lines = [];
|
|
@@ -138,9 +143,7 @@ function renderTree(node) {
|
|
|
138
143
|
const isLastChild = index === node.children.length - 1;
|
|
139
144
|
renderNode(child, "", isLastChild);
|
|
140
145
|
});
|
|
141
|
-
return lines.join(
|
|
146
|
+
return lines.join(`
|
|
147
|
+
`);
|
|
142
148
|
}
|
|
143
|
-
|
|
144
|
-
export { AbortError, codebaseConfig, createProjectLogger, errorToString, getCodebaseHighstatePath, isAbortErrorLike, renderTree, resolveMainLocalProject, runWithRetryOnError, stringArrayType, waitForAbort };
|
|
145
|
-
//# sourceMappingURL=chunk-X2WG3WGL.js.map
|
|
146
|
-
//# sourceMappingURL=chunk-X2WG3WGL.js.map
|
|
149
|
+
export { codebaseConfig, getCodebaseHighstatePath, resolveMainLocalProject, createProjectLogger, renderTree, runWithRetryOnError, AbortError, isAbortErrorLike, stringArrayType, errorToString, waitForAbort };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sourceHashes": {
|
|
3
|
-
"./dist/index.js":
|
|
4
|
-
"./dist/shared/index.js":
|
|
5
|
-
"./dist/library/worker/main.js":
|
|
6
|
-
"./dist/library/package-resolution-worker.js":
|
|
3
|
+
"./dist/index.js": 542555825,
|
|
4
|
+
"./dist/shared/index.js": 998634541,
|
|
5
|
+
"./dist/library/worker/main.js": 3821435996,
|
|
6
|
+
"./dist/library/package-resolution-worker.js": 704325585
|
|
7
7
|
}
|
|
8
8
|
}
|