diff --git a/packages/memory/interface.ts b/packages/memory/interface.ts index a2c0554a5..bbac90ac7 100644 --- a/packages/memory/interface.ts +++ b/packages/memory/interface.ts @@ -1,8 +1,17 @@ import type { Reference } from "merkle-reference"; -import { JSONValue, SchemaContext } from "@commontools/runner"; -import { SchemaPathSelector } from "@commontools/runner/traverse"; +import type { JSONSchema, JSONValue } from "@commontools/api"; -export type { JSONValue, Reference, SchemaContext, SchemaPathSelector }; +export type SchemaContext = { + schema: JSONSchema; + rootSchema: JSONSchema; +}; + +export type SchemaPathSelector = { + path: readonly string[]; + schemaContext?: Readonly; +}; + +export type { JSONValue, Reference }; export interface Clock { now(): UTCUnixTimestampInSeconds; diff --git a/packages/runner/src/builder/types.ts b/packages/runner/src/builder/types.ts index 646c93b5b..feb34cba4 100644 --- a/packages/runner/src/builder/types.ts +++ b/packages/runner/src/builder/types.ts @@ -1,5 +1,6 @@ import { isObject, type Mutable } from "@commontools/utils/types"; import { toOpaqueRef } from "../back-to-cell.ts"; +import type { SchemaContext } from "@commontools/memory/interface"; import type { ByRefFunction, @@ -158,11 +159,7 @@ export type NodeRef = { frame: Frame | undefined; }; -// This is a schema, together with its rootSchema for resolving $ref entries -export type SchemaContext = { - schema: JSONSchema; - rootSchema: JSONSchema; -}; +export type { SchemaContext }; export type StreamValue = { $stream: true; diff --git a/packages/runner/src/traverse.ts b/packages/runner/src/traverse.ts index e7f36ba57..b7157f016 100644 --- a/packages/runner/src/traverse.ts +++ b/packages/runner/src/traverse.ts @@ -11,12 +11,11 @@ import { } from "../../utils/src/types.ts"; import { getLogger } from "../../utils/src/logger.ts"; import { ContextualFlowControl } from "./cfc.ts"; +import type { JSONObject, JSONSchema, JSONValue } from "./builder/types.ts"; import type { - JSONObject, - JSONSchema, - JSONValue, SchemaContext, -} from "./builder/types.ts"; + SchemaPathSelector, +} from "@commontools/memory/interface"; import { deepEqual } from "./path-utils.ts"; import { isAnyCellLink, parseLink } from "./link-utils.ts"; import { fromURI } from "./uri-utils.ts"; @@ -25,12 +24,7 @@ import type { IAttestation, IMemoryAddress } from "./storage/interface.ts"; const logger = getLogger("traverse", { enabled: true, level: "warn" }); export type { IAttestation, IMemoryAddress } from "./storage/interface.ts"; - -// Both path and schemaContext are relative to the fact.is.value -export type SchemaPathSelector = { - path: readonly string[]; - schemaContext?: Readonly; -}; +export type { SchemaPathSelector }; /** * A data structure that maps keys to sets of values, allowing multiple values