@highstate/backend 0.7.9 → 0.7.11

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.
@@ -47,7 +47,7 @@ import {
47
47
  projectOperationSchema,
48
48
  resolverFactories,
49
49
  terminalSessionSchema
50
- } from "../chunk-TDCHA47F.js";
50
+ } from "../chunk-JEOPTUKC.js";
51
51
  export {
52
52
  CircularDependencyError,
53
53
  applyLibraryUpdate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/backend",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
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.7.9",
29
+ "@highstate/contract": "^0.7.11",
30
30
  "@types/node": "^22.10.1",
31
31
  "ajv": "^8.17.1",
32
32
  "better-lock": "^3.2.0",
@@ -43,6 +43,7 @@
43
43
  "rev-dep": "^1.5.4",
44
44
  "uuidv7": "^1.0.2",
45
45
  "watcher": "^2.3.1",
46
+ "yaml": "^2.7.1",
46
47
  "zod": "^3.23.8"
47
48
  },
48
49
  "peerDependencies": {
@@ -64,5 +65,5 @@
64
65
  "rollup": "^4.28.1",
65
66
  "typescript": "^5.7.2"
66
67
  },
67
- "gitHead": "339633006df48d9ed3fcc181c8c4279d3dc1a12c"
68
+ "gitHead": "f425f2be2d5800fdee3512c848129adab1b0186e"
68
69
  }
@@ -272,11 +272,8 @@ export class LocalLibraryBackend implements LibraryBackend {
272
272
  }
273
273
 
274
274
  // TODO: resolve the path
275
- const relativePath = unit.source.path
276
- ? `./dist/${unit.source.path}/index.js`
277
- : `./dist/index.js`
278
-
279
- const sourceHash = manifest?.sourceHashes?.[relativePath]
275
+ const relativePath = unit.source.path ? `./dist/${unit.source.path}` : `./dist`
276
+ const sourceHash = manifest?.sourceHashes?.[`${relativePath}/index.js`]
280
277
 
281
278
  if (!sourceHash) {
282
279
  this.logger.warn(`source hash not found for unit: "%s"`, unit.type)
@@ -8,6 +8,7 @@ import {
8
8
  type InstanceInput,
9
9
  type InstanceModel,
10
10
  } from "@highstate/contract"
11
+ import { stringify, parse } from "yaml"
11
12
  import {
12
13
  type HubModel,
13
14
  type HubModelPatch,
@@ -38,7 +39,7 @@ export class LocalProjectBackend implements ProjectBackend {
38
39
  try {
39
40
  const files = await readdir(this.projectsDir)
40
41
 
41
- return files.filter(file => file.endsWith(".json")).map(file => file.replace(/\.json$/, ""))
42
+ return files.filter(file => file.endsWith(".yaml")).map(file => file.replace(/\.yaml$/, ""))
42
43
  } catch (error) {
43
44
  throw new Error("Failed to get project names", { cause: error })
44
45
  }
@@ -345,7 +346,7 @@ export class LocalProjectBackend implements ProjectBackend {
345
346
  }
346
347
 
347
348
  private getProjectPath(projectId: string) {
348
- return `${this.projectsDir}/${projectId}.json`
349
+ return `${this.projectsDir}/${projectId}.yaml`
349
350
  }
350
351
 
351
352
  private async loadProject(projectId: string) {
@@ -354,7 +355,7 @@ export class LocalProjectBackend implements ProjectBackend {
354
355
  try {
355
356
  const content = await readFile(projectPath, "utf-8")
356
357
 
357
- return projectModelSchema.parse(JSON.parse(content))
358
+ return projectModelSchema.parse(parse(content))
358
359
  } catch (error) {
359
360
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
360
361
  return { instances: {}, hubs: {} }
@@ -366,7 +367,7 @@ export class LocalProjectBackend implements ProjectBackend {
366
367
 
367
368
  private async writeProject(projectId: string, project: z.infer<typeof projectModelSchema>) {
368
369
  const projectPath = this.getProjectPath(projectId)
369
- const content = JSON.stringify(project, undefined, 2)
370
+ const content = stringify(project, undefined, 2)
370
371
 
371
372
  await writeFile(projectPath, content)
372
373
  }
@@ -45,7 +45,7 @@ export const createValidationResolver = defineGraphResolver<
45
45
  },
46
46
 
47
47
  process({ instance, component, resolvedInputs }, dependencies, logger) {
48
- const ajv = new Ajv()
48
+ const ajv = new Ajv({ strict: false })
49
49
 
50
50
  logger.debug({ instanceId: instance.id }, "validating instance")
51
51