@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.
Files changed (134) hide show
  1. package/dist/chunk-b05q6fm2.js +37 -0
  2. package/dist/{chunk-V2NILDHS.js → chunk-gxjwa93h.js} +704 -604
  3. package/dist/{chunk-X2WG3WGL.js → chunk-vzdz6chj.js} +18 -15
  4. package/dist/highstate.manifest.json +4 -4
  5. package/dist/index.js +7350 -3514
  6. package/dist/library/package-resolution-worker.js +121 -10
  7. package/dist/library/worker/main.js +31 -17
  8. package/dist/shared/index.js +254 -4
  9. package/package.json +19 -20
  10. package/prisma/backend/_schema/object.prisma +12 -0
  11. package/prisma/backend/sqlite/migrations/20260222113554_add_object_tracking/migration.sql +7 -0
  12. package/prisma/project/artifact.prisma +3 -0
  13. package/prisma/project/entity.prisma +125 -0
  14. package/prisma/project/instance.prisma +6 -0
  15. package/prisma/project/migrations/20260301210131_add_entity_tracking/migration.sql +70 -0
  16. package/prisma/project/migrations/20260302212734_add_resource_hooks_flag/migration.sql +1 -0
  17. package/prisma/project/operation.prisma +3 -0
  18. package/src/artifact/factory.ts +3 -2
  19. package/src/business/artifact.test.ts +22 -2
  20. package/src/business/artifact.ts +7 -1
  21. package/src/business/entity-snapshot.test.ts +684 -0
  22. package/src/business/entity-snapshot.ts +904 -0
  23. package/src/business/evaluation.test.ts +56 -0
  24. package/src/business/evaluation.ts +102 -22
  25. package/src/business/global-search.test.ts +344 -0
  26. package/src/business/global-search.ts +902 -0
  27. package/src/business/index.ts +4 -0
  28. package/src/business/instance-lock.ts +58 -74
  29. package/src/business/instance-state.test.ts +15 -1
  30. package/src/business/instance-state.ts +37 -14
  31. package/src/business/object-ref-index.test.ts +140 -0
  32. package/src/business/object-ref-index.ts +193 -0
  33. package/src/business/operation.test.ts +15 -1
  34. package/src/business/operation.ts +4 -0
  35. package/src/business/project-model.ts +154 -13
  36. package/src/business/project-unlock.ts +25 -2
  37. package/src/business/project.ts +9 -0
  38. package/src/business/secret.test.ts +35 -2
  39. package/src/business/secret.ts +32 -9
  40. package/src/business/settings.ts +761 -0
  41. package/src/business/unit-output.test.ts +477 -0
  42. package/src/business/unit-output.ts +461 -0
  43. package/src/business/worker.ts +55 -4
  44. package/src/database/_generated/backend/postgresql/browser.ts +6 -0
  45. package/src/database/_generated/backend/postgresql/client.ts +6 -0
  46. package/src/database/_generated/backend/postgresql/internal/class.ts +23 -5
  47. package/src/database/_generated/backend/postgresql/internal/prismaNamespace.ts +89 -5
  48. package/src/database/_generated/backend/postgresql/internal/prismaNamespaceBrowser.ts +9 -0
  49. package/src/database/_generated/backend/postgresql/models/Object.ts +1076 -0
  50. package/src/database/_generated/backend/postgresql/models.ts +1 -0
  51. package/src/database/_generated/backend/sqlite/browser.ts +6 -0
  52. package/src/database/_generated/backend/sqlite/client.ts +6 -0
  53. package/src/database/_generated/backend/sqlite/internal/class.ts +23 -5
  54. package/src/database/_generated/backend/sqlite/internal/prismaNamespace.ts +89 -5
  55. package/src/database/_generated/backend/sqlite/internal/prismaNamespaceBrowser.ts +9 -0
  56. package/src/database/_generated/backend/sqlite/models/Object.ts +1074 -0
  57. package/src/database/_generated/backend/sqlite/models.ts +1 -0
  58. package/src/database/_generated/project/browser.ts +23 -0
  59. package/src/database/_generated/project/client.ts +23 -0
  60. package/src/database/_generated/project/commonInputTypes.ts +87 -53
  61. package/src/database/_generated/project/enums.ts +8 -0
  62. package/src/database/_generated/project/internal/class.ts +53 -5
  63. package/src/database/_generated/project/internal/prismaNamespace.ts +367 -13
  64. package/src/database/_generated/project/internal/prismaNamespaceBrowser.ts +48 -1
  65. package/src/database/_generated/project/models/Artifact.ts +199 -11
  66. package/src/database/_generated/project/models/Entity.ts +1274 -0
  67. package/src/database/_generated/project/models/EntitySnapshot.ts +2389 -0
  68. package/src/database/_generated/project/models/EntitySnapshotContent.ts +1260 -0
  69. package/src/database/_generated/project/models/EntitySnapshotReference.ts +1449 -0
  70. package/src/database/_generated/project/models/InstanceState.ts +361 -1
  71. package/src/database/_generated/project/models/Operation.ts +148 -3
  72. package/src/database/_generated/project/models/OperationLog.ts +0 -4
  73. package/src/database/_generated/project/models.ts +4 -0
  74. package/src/database/migration.ts +3 -0
  75. package/src/library/find-package-json.test.ts +77 -0
  76. package/src/library/find-package-json.ts +149 -0
  77. package/src/library/package-resolution-worker.ts +7 -3
  78. package/src/library/worker/evaluator.ts +7 -1
  79. package/src/orchestrator/manager.ts +7 -0
  80. package/src/orchestrator/operation-context.captured-outputs.test.ts +118 -0
  81. package/src/orchestrator/operation-context.ts +154 -16
  82. package/src/orchestrator/operation-plan.destroy.test.md +33 -12
  83. package/src/orchestrator/operation-plan.destroy.test.ts +140 -2
  84. package/src/orchestrator/operation-plan.fixtures.ts +2 -0
  85. package/src/orchestrator/operation-plan.md +4 -1
  86. package/src/orchestrator/operation-plan.ts +286 -92
  87. package/src/orchestrator/operation-plan.update.test.md +286 -11
  88. package/src/orchestrator/operation-plan.update.test.ts +656 -5
  89. package/src/orchestrator/operation-workset.ts +72 -22
  90. package/src/orchestrator/operation.cancel.test.ts +4 -0
  91. package/src/orchestrator/operation.composite.test.ts +341 -0
  92. package/src/orchestrator/operation.destroy.test.ts +4 -0
  93. package/src/orchestrator/operation.output-validation.failure.test.ts +124 -0
  94. package/src/orchestrator/operation.preview.test.ts +4 -0
  95. package/src/orchestrator/operation.refresh.test.ts +4 -0
  96. package/src/orchestrator/operation.test-utils.ts +52 -13
  97. package/src/orchestrator/operation.ts +230 -68
  98. package/src/orchestrator/operation.update.failure.test.ts +4 -0
  99. package/src/orchestrator/operation.update.skip.test.ts +196 -0
  100. package/src/orchestrator/operation.update.test.ts +4 -0
  101. package/src/orchestrator/plan-test-builder.ts +1 -0
  102. package/src/orchestrator/unit-input-values.test.ts +450 -0
  103. package/src/orchestrator/unit-input-values.ts +281 -0
  104. package/src/pubsub/manager.ts +3 -0
  105. package/src/runner/abstractions.ts +23 -54
  106. package/src/runner/factory.ts +3 -3
  107. package/src/runner/force-abort.ts +7 -2
  108. package/src/runner/local.ts +116 -87
  109. package/src/runner/pulumi.ts +3 -5
  110. package/src/services.ts +53 -2
  111. package/src/shared/models/prisma.ts +1 -0
  112. package/src/shared/models/project/entity.ts +121 -0
  113. package/src/shared/models/project/index.ts +1 -0
  114. package/src/shared/models/project/operation.ts +61 -3
  115. package/src/shared/models/project/state.ts +10 -0
  116. package/src/shared/models/project/worker.ts +7 -0
  117. package/src/shared/resolvers/effective-output-type.test.ts +494 -0
  118. package/src/shared/resolvers/effective-output-type.ts +162 -0
  119. package/src/shared/resolvers/index.ts +1 -0
  120. package/src/shared/resolvers/input.ts +59 -9
  121. package/src/shared/utils/index.ts +1 -0
  122. package/src/shared/utils/stable-json.ts +41 -0
  123. package/src/terminal/manager.ts +6 -0
  124. package/src/terminal/run.sh.ts +9 -4
  125. package/src/worker/manager.ts +97 -1
  126. package/LICENSE +0 -21
  127. package/dist/chunk-I7BWSAN6.js +0 -49
  128. package/dist/chunk-I7BWSAN6.js.map +0 -1
  129. package/dist/chunk-V2NILDHS.js.map +0 -1
  130. package/dist/chunk-X2WG3WGL.js.map +0 -1
  131. package/dist/index.js.map +0 -1
  132. package/dist/library/package-resolution-worker.js.map +0 -1
  133. package/dist/library/worker/main.js.map +0 -1
  134. package/dist/shared/index.js.map +0 -1
@@ -1,8 +1,117 @@
1
- import { realpath } from 'node:fs/promises';
2
- import { findPackageJSON } from 'node:module';
3
- import { dirname } from 'node:path';
4
- import { workerData, parentPort } from 'node:worker_threads';
5
- import pino from 'pino';
1
+ // @bun
2
+ import"../chunk-b05q6fm2.js";
3
+
4
+ // src/library/package-resolution-worker.ts
5
+ import { realpath } from "fs/promises";
6
+ import { dirname as dirname2 } from "path";
7
+ import { parentPort, workerData } from "worker_threads";
8
+ import pino from "pino";
9
+
10
+ // src/library/find-package-json.ts
11
+ import { access } from "fs/promises";
12
+ import { dirname, isAbsolute, resolve } from "path";
13
+ import { fileURLToPath } from "url";
14
+ async function findPackageJSONCompat(specifier, base) {
15
+ const parsedSpecifier = toPathSpecifier(specifier);
16
+ if (parsedSpecifier.type === "bare") {
17
+ if (!base) {
18
+ return;
19
+ }
20
+ const basePath = resolveBasePath(base);
21
+ const baseDir = await normalizePathForLookup(basePath);
22
+ return await findPackageJsonForBareSpecifier(baseDir, parsedSpecifier.value);
23
+ }
24
+ const resolvedPath = resolvePathSpecifier(parsedSpecifier.value, base);
25
+ const lookupStart = await normalizePathForLookup(resolvedPath);
26
+ return await findNearestPackageJson(lookupStart);
27
+ }
28
+ function toPathSpecifier(specifier) {
29
+ if (specifier instanceof URL) {
30
+ if (specifier.protocol !== "file:") {
31
+ throw new Error(`Unsupported URL protocol "${specifier.protocol}"`);
32
+ }
33
+ return { type: "path", value: fileURLToPath(specifier) };
34
+ }
35
+ if (specifier.startsWith("file:")) {
36
+ return { type: "path", value: fileURLToPath(new URL(specifier)) };
37
+ }
38
+ if (isBareSpecifier(specifier)) {
39
+ return { type: "bare", value: specifier };
40
+ }
41
+ return { type: "path", value: specifier };
42
+ }
43
+ function isBareSpecifier(specifier) {
44
+ return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("file:");
45
+ }
46
+ function resolvePathSpecifier(specifierPath, base) {
47
+ if (isAbsolute(specifierPath)) {
48
+ return specifierPath;
49
+ }
50
+ const basePath = base ? resolveBasePath(base) : process.cwd();
51
+ if (specifierPath.startsWith(".")) {
52
+ const baseDir = isLikelyFilePath(basePath) ? dirname(basePath) : basePath;
53
+ return resolve(baseDir, specifierPath);
54
+ }
55
+ return specifierPath;
56
+ }
57
+ function resolveBasePath(base) {
58
+ if (base instanceof URL) {
59
+ if (base.protocol !== "file:") {
60
+ throw new Error(`Unsupported base URL protocol "${base.protocol}"`);
61
+ }
62
+ return fileURLToPath(base);
63
+ }
64
+ if (base.startsWith("file:")) {
65
+ return fileURLToPath(new URL(base));
66
+ }
67
+ return base;
68
+ }
69
+ async function normalizePathForLookup(pathValue) {
70
+ const existsAsFile = await pathExists(pathValue);
71
+ if (existsAsFile && isLikelyFilePath(pathValue)) {
72
+ return dirname(pathValue);
73
+ }
74
+ return pathValue;
75
+ }
76
+ function isLikelyFilePath(pathValue) {
77
+ return pathValue.endsWith(".json") || pathValue.endsWith(".mjs") || pathValue.endsWith(".js");
78
+ }
79
+ async function findNearestPackageJson(startPath) {
80
+ let current = startPath;
81
+ while (true) {
82
+ const candidate = resolve(current, "package.json");
83
+ if (await pathExists(candidate)) {
84
+ return candidate;
85
+ }
86
+ const parent = dirname(current);
87
+ if (parent === current) {
88
+ return;
89
+ }
90
+ current = parent;
91
+ }
92
+ }
93
+ async function findPackageJsonForBareSpecifier(startDirectory, packageName) {
94
+ let current = startDirectory;
95
+ while (true) {
96
+ const candidate = resolve(current, "node_modules", packageName, "package.json");
97
+ if (await pathExists(candidate)) {
98
+ return candidate;
99
+ }
100
+ const parent = dirname(current);
101
+ if (parent === current) {
102
+ return;
103
+ }
104
+ current = parent;
105
+ }
106
+ }
107
+ async function pathExists(pathValue) {
108
+ try {
109
+ await access(pathValue);
110
+ return true;
111
+ } catch {
112
+ return false;
113
+ }
114
+ }
6
115
 
7
116
  // src/library/package-resolution-worker.ts
8
117
  var { importPath: rootDir, packageNames, logLevel } = workerData;
@@ -10,14 +119,18 @@ var logger = pino({ name: "source-resolution-worker", level: logLevel ?? "silent
10
119
  var results = [];
11
120
  for (const packageName of packageNames) {
12
121
  try {
13
- const path = findPackageJSON(packageName, rootDir);
122
+ const path = await findPackageJSONCompat(packageName, rootDir);
14
123
  if (!path) {
15
- throw new Error(`Package "${packageName}" not found`);
124
+ results.push({
125
+ type: "not-found",
126
+ packageName
127
+ });
128
+ continue;
16
129
  }
17
130
  results.push({
18
131
  type: "success",
19
132
  packageName,
20
- packageRootPath: await realpath(dirname(path))
133
+ packageRootPath: await realpath(dirname2(path))
21
134
  });
22
135
  } catch (error) {
23
136
  logger.error({ error }, `failed to resolve package "%s"`, packageName);
@@ -39,5 +152,3 @@ parentPort?.postMessage({
39
152
  type: "result",
40
153
  results
41
154
  });
42
- //# sourceMappingURL=package-resolution-worker.js.map
43
- //# sourceMappingURL=package-resolution-worker.js.map
@@ -1,15 +1,28 @@
1
- import { errorToString } from '../../chunk-X2WG3WGL.js';
2
- import '../../chunk-I7BWSAN6.js';
3
- import { workerData, parentPort } from 'node:worker_threads';
4
- import { pino } from 'pino';
5
- import { InstanceNameConflictError, getRuntimeInstances, parseArgumentValue, isComponent } from '@highstate/contract';
6
- import { mapValues } from 'remeda';
1
+ // @bun
2
+ import {
3
+ errorToString
4
+ } from "../../chunk-vzdz6chj.js";
5
+ import"../../chunk-b05q6fm2.js";
7
6
 
8
- function evaluateProject(logger2, components, allInstances, resolvedInputs) {
7
+ // src/library/worker/main.ts
8
+ import { parentPort, workerData } from "worker_threads";
9
+ import { pino } from "pino";
10
+
11
+ // src/library/worker/evaluator.ts
12
+ import {
13
+ getRuntimeInstances,
14
+ InstanceNameConflictError,
15
+ parseArgumentValue
16
+ } from "@highstate/contract";
17
+ import { mapValues } from "remeda";
18
+ function toCloneSafeInstanceModel(instance) {
19
+ return JSON.parse(JSON.stringify(instance));
20
+ }
21
+ function evaluateProject(logger, components, allInstances, resolvedInputs) {
9
22
  const allInstancesMap = new Map(allInstances.map((instance) => [instance.id, instance]));
10
23
  const instanceErrors = {};
11
24
  const topLevelErrors = {};
12
- const instanceOutputs = /* @__PURE__ */ new Map();
25
+ const instanceOutputs = new Map;
13
26
  for (const instance of allInstances) {
14
27
  try {
15
28
  evaluateInstance(instance.id);
@@ -24,7 +37,7 @@ function evaluateProject(logger2, components, allInstances, resolvedInputs) {
24
37
  }
25
38
  return {
26
39
  success: true,
27
- virtualInstances: getRuntimeInstances().map((instance) => instance.instance).filter((instance) => instance.kind === "composite" || !allInstancesMap.has(instance.id)),
40
+ virtualInstances: getRuntimeInstances().map((instance) => toCloneSafeInstanceModel(instance.instance)).filter((instance) => instance.kind === "composite" || !allInstancesMap.has(instance.id)),
28
41
  topLevelErrors
29
42
  };
30
43
  function evaluateInstance(instanceId) {
@@ -54,7 +67,7 @@ function evaluateProject(logger2, components, allInstances, resolvedInputs) {
54
67
  }
55
68
  function _evaluateInstance(instance) {
56
69
  const inputs = {};
57
- logger2.debug(`evaluating instance "%s"`, instance.id);
70
+ logger.debug(`evaluating instance "%s"`, instance.id);
58
71
  for (const [inputName, input] of Object.entries(resolvedInputs[instance.id] ?? {})) {
59
72
  inputs[inputName] = input.map((input2) => {
60
73
  const evaluated = evaluateInstance(input2.input.instanceId);
@@ -73,20 +86,23 @@ function evaluateProject(logger2, components, allInstances, resolvedInputs) {
73
86
  });
74
87
  }
75
88
  }
76
- async function loadComponents(logger2, modulePaths) {
89
+
90
+ // src/library/worker/loader.lite.ts
91
+ import { isComponent } from "@highstate/contract";
92
+ async function loadComponents(logger, modulePaths) {
77
93
  const modules = {};
78
94
  for (const modulePath of modulePaths) {
79
95
  try {
80
- logger2.debug({ modulePath }, "loading module");
96
+ logger.debug({ modulePath }, "loading module");
81
97
  modules[modulePath] = await import(modulePath);
82
- logger2.debug({ modulePath }, "module loaded");
98
+ logger.debug({ modulePath }, "module loaded");
83
99
  } catch (err) {
84
- logger2.error({ modulePath, err }, "module load failed");
100
+ logger.error({ modulePath, err }, "module load failed");
85
101
  }
86
102
  }
87
103
  const components = {};
88
104
  await _loadLibrary(modules, components);
89
- logger2.debug("library loaded with %s components", Object.keys(components).length);
105
+ logger.debug("library loaded with %s components", Object.keys(components).length);
90
106
  return components;
91
107
  }
92
108
  async function _loadLibrary(value, components) {
@@ -125,5 +141,3 @@ try {
125
141
  error: errorToString(error)
126
142
  });
127
143
  }
128
- //# sourceMappingURL=main.js.map
129
- //# sourceMappingURL=main.js.map
@@ -1,4 +1,254 @@
1
- export { AccessError, BackendError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, CannotDeleteLastUnlockMethodError, GraphResolver, InputHashResolver, InputResolver, InstanceLockLostError, InstanceLockedError, InstanceNotFoundError, InstanceStateNotFoundError, InvalidInstanceKindError, MAX_WORKER_START_ATTEMPTS, OperationNotFoundError, ProjectLockedError, ProjectNotFoundError, PromiseTracker, SystemSecretNames, ValidationResolver, WorkerVersionNotFoundError, apiKeyMetaSchema, apiKeyOutputSchema, apiKeyQuerySchema, applyLibraryUpdate, artifactOutputSchema, artifactQuerySchema, backendUnlockMethodInputSchema, backendUnlockMethodMetaSchema, codebaseLibrary, codebaseProjectModelStorage, collectionQueryResult, collectionQuerySchema, createAsyncBatcher, databaseProjectModelStorage, diffLibraries, extractDigestFromImage, finalInstanceOperationStatuses, finalOperationStatuses, forSchema, getAllDependents, getMatchedInjectionInstanceInputs, getResolvedHubInputs, getResolvedInjectionInstanceInputs, getResolvedInstanceInputs, getResolvedInstanceOutputs, getWorkerIdentity, globalProjectSpace, hasObjectMeta, hostPulumiBackend, instanceCustomStatusInputSchema, instanceLockEventSchema, instanceLockOutputSchema, instanceStateEventSchema, int32ToBytes, isFinalOperationStatus, isInstanceDeployed, isTransientInstanceOperationStatus, isTransientOperationStatus, isVirtualGhostInstance, librarySpecSchema, operationEventSchema, operationLaunchInputSchema, operationMetaSchema, operationOptionsSchema, operationOutputSchema, operationPhaseInstanceSchema, operationPhaseSchema, operationPhaseTypeSchema, operationPlanInputSchema, operationStatusSchema, operationTypeSchema, pageDetailsOutputSchema, pageOutputSchema, pageQuerySchema, projectInputSchema, projectModelEventSchema, projectModelStorageSpecSchema, projectOutputSchema, projectUnlockStateSchema, projectUnlockSuiteSchema, pulumiBackendSpecSchema, resolverFactories, secretOutputSchema, secretQuerySchema, serviceAccountOutputSchema, serviceAccountQuerySchema, stableInstanceInputSchema, terminalDetailsOutputSchema, terminalOutputSchema, terminalQuerySchema, terminalSessionOutputSchema, terminalStatusSchema, toApiKeyOutput, toPageOutput, toSecretOutput, toTerminalDetailsOutput, toTerminalOutput, toTerminalSessionOutput, toWorkerOutput, toWorkerVersionOutput, triggerOutputSchema, triggerQuerySchema, unlockMethodInputSchema, unlockMethodMetaSchema, unlockMethodOutputSchema, unlockMethodType, waitAll, workerOutputSchema, workerQuerySchema, workerUnitRegistrationEventSchema, workerVersionOutputSchema, workerVersionStatusSchema } from '../chunk-V2NILDHS.js';
2
- import '../chunk-I7BWSAN6.js';
3
- //# sourceMappingURL=index.js.map
4
- //# sourceMappingURL=index.js.map
1
+ // @bun
2
+ import {
3
+ AccessError,
4
+ BackendError,
5
+ BackendUnlockMethodNotFoundError,
6
+ CannotDeleteLastBackendUnlockMethodError,
7
+ CannotDeleteLastUnlockMethodError,
8
+ GraphResolver,
9
+ InputHashResolver,
10
+ InputResolver,
11
+ InstanceLockLostError,
12
+ InstanceLockedError,
13
+ InstanceNotFoundError,
14
+ InstanceStateNotFoundError,
15
+ InvalidInstanceKindError,
16
+ MAX_WORKER_START_ATTEMPTS,
17
+ OperationNotFoundError,
18
+ ProjectLockedError,
19
+ ProjectNotFoundError,
20
+ PromiseTracker,
21
+ SystemSecretNames,
22
+ ValidationResolver,
23
+ WorkerVersionNotFoundError,
24
+ apiKeyMetaSchema,
25
+ apiKeyOutputSchema,
26
+ apiKeyQuerySchema,
27
+ applyLibraryUpdate,
28
+ artifactOutputSchema,
29
+ artifactQuerySchema,
30
+ backendUnlockMethodInputSchema,
31
+ backendUnlockMethodMetaSchema,
32
+ codebaseLibrary,
33
+ codebaseProjectModelStorage,
34
+ collectionQueryResult,
35
+ collectionQuerySchema,
36
+ createAsyncBatcher,
37
+ databaseProjectModelStorage,
38
+ diffLibraries,
39
+ entityDetailsOutputSchema,
40
+ entityOutputSchema,
41
+ entityQuerySchema,
42
+ entityReferenceOutputSchema,
43
+ entitySnapshotDetailsOutputSchema,
44
+ entitySnapshotListItemOutputSchema,
45
+ entitySnapshotOutputSchema,
46
+ extractDigestFromImage,
47
+ finalInstanceOperationStatuses,
48
+ finalOperationStatuses,
49
+ forSchema,
50
+ getAllDependents,
51
+ getMatchedInjectionInstanceInputs,
52
+ getResolvedHubInputs,
53
+ getResolvedInjectionInstanceInputs,
54
+ getResolvedInstanceInputs,
55
+ getResolvedInstanceOutputs,
56
+ getWorkerIdentity,
57
+ globalProjectSpace,
58
+ hasObjectMeta,
59
+ hostPulumiBackend,
60
+ instanceCustomStatusInputSchema,
61
+ instanceLockEventSchema,
62
+ instanceLockOutputSchema,
63
+ instanceStateEventSchema,
64
+ int32ToBytes,
65
+ isFinalOperationStatus,
66
+ isInstanceDeployed,
67
+ isTransientInstanceOperationStatus,
68
+ isTransientOperationStatus,
69
+ isVirtualGhostInstance,
70
+ librarySpecSchema,
71
+ operationEventSchema,
72
+ operationLaunchInputSchema,
73
+ operationMetaSchema,
74
+ operationOptionsSchema,
75
+ operationOutputSchema,
76
+ operationPhaseInstanceSchema,
77
+ operationPhaseSchema,
78
+ operationPhaseTypeSchema,
79
+ operationPlanInputSchema,
80
+ operationStatusSchema,
81
+ operationTypeSchema,
82
+ pageDetailsOutputSchema,
83
+ pageOutputSchema,
84
+ pageQuerySchema,
85
+ projectInputSchema,
86
+ projectModelEventSchema,
87
+ projectModelStorageSpecSchema,
88
+ projectOutputSchema,
89
+ projectUnlockStateSchema,
90
+ projectUnlockSuiteSchema,
91
+ pulumiBackendSpecSchema,
92
+ resolveEffectiveOutputType,
93
+ resolverFactories,
94
+ secretOutputSchema,
95
+ secretQuerySchema,
96
+ serviceAccountOutputSchema,
97
+ serviceAccountQuerySchema,
98
+ stableInstanceInputSchema,
99
+ stableJsonStringify,
100
+ terminalDetailsOutputSchema,
101
+ terminalOutputSchema,
102
+ terminalQuerySchema,
103
+ terminalSessionOutputSchema,
104
+ terminalStatusSchema,
105
+ toApiKeyOutput,
106
+ toCommonEntityMeta,
107
+ toPageOutput,
108
+ toSecretOutput,
109
+ toTerminalDetailsOutput,
110
+ toTerminalOutput,
111
+ toTerminalSessionOutput,
112
+ toWorkerOutput,
113
+ toWorkerVersionOutput,
114
+ triggerOutputSchema,
115
+ triggerQuerySchema,
116
+ unlockMethodInputSchema,
117
+ unlockMethodMetaSchema,
118
+ unlockMethodOutputSchema,
119
+ unlockMethodType,
120
+ waitAll,
121
+ workerOutputSchema,
122
+ workerQuerySchema,
123
+ workerUnitRegistrationEventSchema,
124
+ workerVersionOutputSchema,
125
+ workerVersionStatusEventSchema,
126
+ workerVersionStatusSchema
127
+ } from "../chunk-gxjwa93h.js";
128
+ import"../chunk-b05q6fm2.js";
129
+ export {
130
+ workerVersionStatusSchema,
131
+ workerVersionStatusEventSchema,
132
+ workerVersionOutputSchema,
133
+ workerUnitRegistrationEventSchema,
134
+ workerQuerySchema,
135
+ workerOutputSchema,
136
+ waitAll,
137
+ unlockMethodType,
138
+ unlockMethodOutputSchema,
139
+ unlockMethodMetaSchema,
140
+ unlockMethodInputSchema,
141
+ triggerQuerySchema,
142
+ triggerOutputSchema,
143
+ toWorkerVersionOutput,
144
+ toWorkerOutput,
145
+ toTerminalSessionOutput,
146
+ toTerminalOutput,
147
+ toTerminalDetailsOutput,
148
+ toSecretOutput,
149
+ toPageOutput,
150
+ toCommonEntityMeta,
151
+ toApiKeyOutput,
152
+ terminalStatusSchema,
153
+ terminalSessionOutputSchema,
154
+ terminalQuerySchema,
155
+ terminalOutputSchema,
156
+ terminalDetailsOutputSchema,
157
+ stableJsonStringify,
158
+ stableInstanceInputSchema,
159
+ serviceAccountQuerySchema,
160
+ serviceAccountOutputSchema,
161
+ secretQuerySchema,
162
+ secretOutputSchema,
163
+ resolverFactories,
164
+ resolveEffectiveOutputType,
165
+ pulumiBackendSpecSchema,
166
+ projectUnlockSuiteSchema,
167
+ projectUnlockStateSchema,
168
+ projectOutputSchema,
169
+ projectModelStorageSpecSchema,
170
+ projectModelEventSchema,
171
+ projectInputSchema,
172
+ pageQuerySchema,
173
+ pageOutputSchema,
174
+ pageDetailsOutputSchema,
175
+ operationTypeSchema,
176
+ operationStatusSchema,
177
+ operationPlanInputSchema,
178
+ operationPhaseTypeSchema,
179
+ operationPhaseSchema,
180
+ operationPhaseInstanceSchema,
181
+ operationOutputSchema,
182
+ operationOptionsSchema,
183
+ operationMetaSchema,
184
+ operationLaunchInputSchema,
185
+ operationEventSchema,
186
+ librarySpecSchema,
187
+ isVirtualGhostInstance,
188
+ isTransientOperationStatus,
189
+ isTransientInstanceOperationStatus,
190
+ isInstanceDeployed,
191
+ isFinalOperationStatus,
192
+ int32ToBytes,
193
+ instanceStateEventSchema,
194
+ instanceLockOutputSchema,
195
+ instanceLockEventSchema,
196
+ instanceCustomStatusInputSchema,
197
+ hostPulumiBackend,
198
+ hasObjectMeta,
199
+ globalProjectSpace,
200
+ getWorkerIdentity,
201
+ getResolvedInstanceOutputs,
202
+ getResolvedInstanceInputs,
203
+ getResolvedInjectionInstanceInputs,
204
+ getResolvedHubInputs,
205
+ getMatchedInjectionInstanceInputs,
206
+ getAllDependents,
207
+ forSchema,
208
+ finalOperationStatuses,
209
+ finalInstanceOperationStatuses,
210
+ extractDigestFromImage,
211
+ entitySnapshotOutputSchema,
212
+ entitySnapshotListItemOutputSchema,
213
+ entitySnapshotDetailsOutputSchema,
214
+ entityReferenceOutputSchema,
215
+ entityQuerySchema,
216
+ entityOutputSchema,
217
+ entityDetailsOutputSchema,
218
+ diffLibraries,
219
+ databaseProjectModelStorage,
220
+ createAsyncBatcher,
221
+ collectionQuerySchema,
222
+ collectionQueryResult,
223
+ codebaseProjectModelStorage,
224
+ codebaseLibrary,
225
+ backendUnlockMethodMetaSchema,
226
+ backendUnlockMethodInputSchema,
227
+ artifactQuerySchema,
228
+ artifactOutputSchema,
229
+ applyLibraryUpdate,
230
+ apiKeyQuerySchema,
231
+ apiKeyOutputSchema,
232
+ apiKeyMetaSchema,
233
+ WorkerVersionNotFoundError,
234
+ ValidationResolver,
235
+ SystemSecretNames,
236
+ PromiseTracker,
237
+ ProjectNotFoundError,
238
+ ProjectLockedError,
239
+ OperationNotFoundError,
240
+ MAX_WORKER_START_ATTEMPTS,
241
+ InvalidInstanceKindError,
242
+ InstanceStateNotFoundError,
243
+ InstanceNotFoundError,
244
+ InstanceLockedError,
245
+ InstanceLockLostError,
246
+ InputResolver,
247
+ InputHashResolver,
248
+ GraphResolver,
249
+ CannotDeleteLastUnlockMethodError,
250
+ CannotDeleteLastBackendUnlockMethodError,
251
+ BackendUnlockMethodNotFoundError,
252
+ BackendError,
253
+ AccessError
254
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/backend",
3
- "version": "0.19.1",
3
+ "version": "0.21.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -27,17 +27,28 @@
27
27
  "platform"
28
28
  ]
29
29
  },
30
+ "scripts": {
31
+ "build": "bun run --bun highstate build",
32
+ "typecheck": "tsgo --noEmit --skipLibCheck",
33
+ "biome": "biome check --write --unsafe --error-on-warnings",
34
+ "biome:check": "biome check --error-on-warnings",
35
+ "test": "bun run --bun vitest --run",
36
+ "generate:project": "prisma generate --schema prisma/project",
37
+ "generate:backend": "prisma generate --schema prisma/backend/postgresql && prisma generate --schema prisma/backend/sqlite",
38
+ "migrate": "prisma migrate deploy --config dist/database/local/prisma.config.js"
39
+ },
30
40
  "dependencies": {
31
41
  "@aws-crypto/crc32": "^5.2.0",
42
+ "@highstate/contract": "0.20.0",
32
43
  "@msgpack/msgpack": "^3.1.2",
33
44
  "@napi-rs/keyring": "^1.1.8",
34
45
  "@noble/ciphers": "^1.3.0",
35
46
  "@noble/hashes": "^1.8.0",
36
47
  "@paralleldrive/cuid2": "^2.2.2",
37
- "@prisma/adapter-libsql": "7.3.0",
38
- "@prisma/client": "7.3.0",
39
- "@prisma/driver-adapter-utils": "7.3.0",
40
- "@pulumi/pulumi": "3.198.0",
48
+ "@prisma/adapter-libsql": "7.4.1",
49
+ "@prisma/client": "7.4.1",
50
+ "@prisma/driver-adapter-utils": "7.4.1",
51
+ "@pulumi/pulumi": "3.232.0",
41
52
  "age-encryption": "^0.2.3",
42
53
  "ajv": "^8.17.1",
43
54
  "ansi-colors": "^4.1.3",
@@ -57,20 +68,18 @@
57
68
  "p-queue": "^8.0.0",
58
69
  "pino": "^9.6.0",
59
70
  "pkg-types": "^1.2.1",
60
- "prisma": "7.3.0",
71
+ "prisma": "7.4.1",
61
72
  "remeda": "^2.21.0",
62
73
  "ulid": "^3.0.1",
63
74
  "uuid": "^11.1.0",
64
75
  "watcher": "^2.3.1",
65
76
  "yaml": "^2.7.1",
66
- "zod": "^4.0.5",
67
- "@highstate/contract": "0.19.1"
77
+ "zod": "^4.0.5"
68
78
  },
69
79
  "devDependencies": {
70
80
  "@biomejs/biome": "2.2.0",
71
81
  "@typescript/native-preview": "^7.0.0-dev.20250920.1",
72
82
  "classic-level": "^3.0.0",
73
- "highstate-cli-bootstrap": "npm:@highstate/cli",
74
83
  "pino-pretty": "^13.0.0",
75
84
  "prisma-json-types-generator": "^3.5.2",
76
85
  "rollup": "^4.28.1",
@@ -80,15 +89,5 @@
80
89
  },
81
90
  "repository": {
82
91
  "url": "https://github.com/highstate-io/highstate"
83
- },
84
- "scripts": {
85
- "build": "highstate build",
86
- "typecheck": "tsgo --noEmit --skipLibCheck",
87
- "biome": "biome check --write --unsafe --error-on-warnings",
88
- "biome:check": "biome check --error-on-warnings",
89
- "test": "vitest --run",
90
- "generate:project": "prisma generate --schema prisma/project",
91
- "generate:backend": "prisma generate --schema prisma/backend/postgresql && prisma generate --schema prisma/backend/sqlite",
92
- "migrate": "prisma migrate deploy --config dist/database/local/prisma.config.js"
93
92
  }
94
- }
93
+ }
@@ -0,0 +1,12 @@
1
+ /// The object allows to track arbitrary object across multiple projects and search them globally by their IDs.
2
+ /// This also allow to correlate different entities across different projects.
3
+ model Object {
4
+ /// The CUIDv2(d) of the object.
5
+ id String
6
+
7
+ /// The ID of the project that knows this object.
8
+ /// Multiple projects can reference the same object, but each project can only reference an object once.
9
+ projectId String
10
+
11
+ @@id([id, projectId])
12
+ }
@@ -0,0 +1,7 @@
1
+ -- CreateTable
2
+ CREATE TABLE "Object" (
3
+ "id" TEXT NOT NULL,
4
+ "projectId" TEXT NOT NULL,
5
+
6
+ PRIMARY KEY ("id", "projectId")
7
+ );
@@ -49,4 +49,7 @@ model Artifact {
49
49
 
50
50
  /// The pages using this artifact.
51
51
  pages Page[]
52
+
53
+ /// The entity snapshots referenced this artifact.
54
+ entitySnapshots EntitySnapshot[]
52
55
  }