Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/memory/interface.ts
Original file line number Diff line number Diff line change
@@ -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<SchemaContext>;
};

export type { JSONValue, Reference };

export interface Clock {
now(): UTCUnixTimestampInSeconds;
Expand Down
7 changes: 2 additions & 5 deletions packages/runner/src/builder/types.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 4 additions & 10 deletions packages/runner/src/traverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<SchemaContext>;
};
export type { SchemaPathSelector };

/**
* A data structure that maps keys to sets of values, allowing multiple values
Expand Down