@workglow/util 0.2.5 → 0.2.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"directedGraph.d.ts","sourceRoot":"","sources":["../../src/graph/directedGraph.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;;;;GASG;AACH,qBAAa,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,CAAE,SAAQ,KAAK,CAC7F,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,MAAM,CACP;IACC,+EAA+E;IAC/E,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAa;IAEpD;;;;OAIG;IACH,SAAS,IAAI,OAAO,CAwCnB;IAED;;;;;;OAMG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUrC;IAED;;;;;;;;OAQG;IACM,OAAO,CACd,kBAAkB,EAAE,MAAM,EAC1B,kBAAkB,EAAE,MAAM,EAC1B,IAAI,CAAC,EAAE,IAAI,EACX,uBAAuB,GAAE,OAAe,GACvC,MAAM,CAWR;IAED;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAgBxD;IAED;;;;;;OAMG;IACH,0BAA0B,CAAC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAM1F;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAwC5F;IAED,OAAO,CAAC,MAAM;IAad;;OAEG;IACM,QAAQ,IAAI,KAAK,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE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ACH,0BAA0B,CAAC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAM1F;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAwC5F;IAED,OAAO,CAAC,MAAM;IAad;;OAEG;IACM,QAAQ,IAAI,KAAK,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAE/F;IAED;;;;;;;OAOG;IACM,UAAU,CACjB,kBAAkB,EAAE,MAAM,EAC1B,kBAAkB,EAAE,MAAM,EAC1B,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,CAKN;IAED;;;;;OAKG;IACM,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAK1C;IAED;;;OAGG;IACM,QAAQ,CACf,KAAK,EAAE,KAAK,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,GAC9F,MAAM,EAAE,CAEV;CACF"}
@@ -431,6 +431,9 @@ class DirectedGraph extends Graph {
431
431
  const nodeKeys = Array.from(this.nodes.keys());
432
432
  const startNodeIndex = this.getNodeIndex(startNode);
433
433
  const endNodeIndex = this.getNodeIndex(endNode);
434
+ if (startNodeIndex < 0 || endNodeIndex < 0) {
435
+ return false;
436
+ }
434
437
  if (this.adjacency[startNodeIndex][endNodeIndex] != null) {
435
438
  return true;
436
439
  }
@@ -594,4 +597,4 @@ export {
594
597
  CycleError
595
598
  };
596
599
 
597
- //# debugId=98DAB3A067D5213F64756E2164756E21
600
+ //# debugId=03421654E7B2D66E64756E2164756E21
@@ -6,10 +6,10 @@
6
6
  "// original source: https://github.com/SegFaultx64/typescript-graph\n// previous fork: https://github.com/sroussey/typescript-graph\n// license: MIT\n\nimport { BaseError } from \"../utilities/BaseError\";\n\n/**\n * # NodeAlreadyExistsError\n *\n * This error is thrown when trying to create a node with the same identity as an existing node.\n *\n * @category Errors\n */\nexport class NodeAlreadyExistsError<T> extends BaseError {\n public static override type: string = \"NodeAlreadyExistsError\";\n public newNode: T;\n public oldNode: T;\n public identity: unknown;\n\n constructor(newNode: T, oldNode: T, identity: unknown) {\n super(\n `${JSON.stringify(newNode)} shares an identity (${String(identity)}) with ${JSON.stringify(\n oldNode\n )}`\n );\n this.newNode = newNode;\n this.oldNode = oldNode;\n this.identity = identity;\n this.name = \"NodeAlreadyExistsError\";\n\n // This bs is due to a limitation of Typescript: https://github.com/facebook/jest/issues/8279\n Object.setPrototypeOf(this, NodeAlreadyExistsError.prototype);\n }\n}\n\n/**\n * # NodeDoesntExistError\n * This error is thrown when trying to access a node in a graph by it's identity when that node doesn't exist\n *\n * @category Errors\n */\nexport class NodeDoesntExistError extends BaseError {\n public static override type: string = \"NodeDoesntExistError\";\n public identity: unknown;\n\n constructor(identity: unknown) {\n super(`A node with identity ${String(identity)} doesn't exist in the graph`);\n this.identity = identity;\n this.name = \"NodeDoesntExistError\";\n\n // This bs is due to a limitation of Typescript: https://github.com/facebook/jest/issues/8279\n Object.setPrototypeOf(this, NodeDoesntExistError.prototype);\n }\n}\n\n/**\n * # CycleError\n *\n * This error is thrown when attempting to create or update a Directed Acyclic Graph that contains a cycle.\n *\n * @category Errors\n */\nexport class CycleError extends BaseError {\n public static override type: string = \"CycleError\";\n constructor(message: string) {\n super(message);\n this.name = \"CycleError\";\n\n // This bs is due to a limitation of Typescript: https://github.com/facebook/jest/issues/8279\n Object.setPrototypeOf(this, CycleError.prototype);\n }\n}\n",
7
7
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A type that represents a listener function for an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\ntype EventListener<Events, EventType extends keyof Events> = Events[EventType];\n\n/**\n * A type that represents a list of listener functions for an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\ntype EventListeners<Events, EventType extends keyof Events> = Array<{\n listener: EventListener<Events, EventType>;\n once?: boolean;\n}>;\n\n/**\n * A type that represents the parameters of an event.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\nexport type EventParameters<Events, EventType extends keyof Events> = {\n [Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any\n ? P\n : never;\n}[EventType];\n\n/**\n * A type that represents the return type of the emitted method.\n * @template Events - A record of event names and their corresponding listener functions\n * @template EventType - The name of the event\n */\nexport type EmittedReturnType<Events, EventType extends keyof Events> = EventParameters<\n Events,\n EventType\n>;\n\n/**\n * A class that implements an event emitter pattern.\n * @template EventListenerTypes - A record of event names and their corresponding listener functions\n */\nexport class EventEmitter<EventListenerTypes extends Record<string, (...args: any) => any>> {\n private listeners: {\n [Event in keyof EventListenerTypes]?: EventListeners<EventListenerTypes, Event>;\n } = {};\n private maxListeners: number = 0;\n private warnedEvents = new Set<keyof EventListenerTypes>();\n\n /**\n * Set the maximum number of listeners per event before a warning is emitted.\n * 0 means unlimited (default).\n */\n setMaxListeners(n: number): this {\n if (!Number.isFinite(n) || n < 0) {\n throw new RangeError(`\"n\" must be a non-negative finite number. Got ${n}.`);\n }\n this.maxListeners = Math.trunc(n);\n this.warnedEvents.clear();\n return this;\n }\n\n /**\n * Get the number of listeners for a specific event\n */\n listenerCount<Event extends keyof EventListenerTypes>(event: Event): number {\n return this.listeners[event]?.length ?? 0;\n }\n\n /**\n * Get all event names that have registered listeners\n */\n eventNames(): Array<keyof EventListenerTypes> {\n return (Object.keys(this.listeners) as Array<keyof EventListenerTypes>).filter(\n (k) => (this.listeners[k]?.length ?? 0) > 0\n );\n }\n\n /**\n * Remove all listeners for a specific event or all events\n * @param event - Optional event name. If not provided, removes all listeners for all events\n * @returns this, so that calls can be chained\n */\n removeAllListeners<Event extends keyof EventListenerTypes>(event?: Event): this {\n if (event) {\n delete this.listeners[event];\n this.warnedEvents.delete(event);\n } else {\n this.listeners = {};\n this.warnedEvents.clear();\n }\n return this;\n }\n\n /**\n * Adds a listener function for the event\n * @param event - The event name to listen for\n * @param listener - The listener function to add\n * @returns this, so that calls can be chained\n */\n on<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners: EventListeners<EventListenerTypes, Event> =\n this.listeners[event] || (this.listeners[event] = []);\n listeners.push({ listener });\n this.checkMaxListeners(event, listeners.length);\n return this;\n }\n\n /**\n * Removes a listener function for the event\n * @param event - The event name to remove the listener from\n * @param listener - The listener function to remove\n * @returns this, so that calls can be chained\n */\n off<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners = this.listeners[event];\n if (!listeners) return this;\n\n const index = listeners.findIndex((l) => l.listener === listener);\n if (index >= 0) {\n listeners.splice(index, 1);\n if (this.maxListeners > 0 && listeners.length <= this.maxListeners) {\n this.warnedEvents.delete(event);\n }\n }\n return this;\n }\n\n /**\n * Adds a listener function for the event that will be called only once\n * @param event - The event name to listen for\n * @param listener - The listener function to add\n * @returns this, so that calls can be chained\n */\n once<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): this {\n const listeners: EventListeners<EventListenerTypes, Event> =\n this.listeners[event] || (this.listeners[event] = []);\n listeners.push({ listener, once: true });\n this.checkMaxListeners(event, listeners.length);\n return this;\n }\n\n /**\n * Returns a promise that resolves when the event is emitted\n * @param event - The event name to listen for\n * @returns a promise that resolves to an array of all parameters of the event (empty array for events with no parameters)\n */\n waitOn<Event extends keyof EventListenerTypes>(\n event: Event\n ): Promise<EmittedReturnType<EventListenerTypes, Event>> {\n return new Promise((resolve) => {\n // Create an anonymous function that captures all arguments and passes them to resolve\n const listener = ((...args: any[]) => {\n // Always resolve with the array of arguments (which may be empty)\n resolve(args as any);\n }) as EventListener<EventListenerTypes, Event>;\n\n this.once(event, listener);\n });\n }\n\n /**\n * Emits an event with the specified name and arguments\n * @param event - The event name to emit\n * @param args - Arguments to pass to the event listeners\n */\n public emit<Event extends keyof EventListenerTypes>(\n this: EventEmitter<EventListenerTypes>,\n event: Event,\n ...args: EventParameters<EventListenerTypes, Event>\n ) {\n const listeners: EventListeners<EventListenerTypes, Event> | undefined = this.listeners[event];\n if (listeners) {\n // Snapshot the listener array to avoid issues with concurrent modification\n const snapshot = [...listeners];\n const errors: unknown[] = [];\n for (const { listener } of snapshot) {\n try {\n listener(...args);\n } catch (e) {\n errors.push(e);\n }\n }\n // Remove once listeners we just called\n this.listeners[event] = listeners.filter((l) => !l.once);\n if (this.maxListeners > 0 && (this.listeners[event]?.length ?? 0) <= this.maxListeners) {\n this.warnedEvents.delete(event);\n }\n // Re-throw errors after all listeners have been called\n if (errors.length > 1) {\n throw new AggregateError(\n errors,\n `${errors.length} listener(s) threw on \"${String(event)}\"`\n );\n } else if (errors.length === 1) {\n throw errors[0];\n }\n }\n }\n\n private checkMaxListeners<Event extends keyof EventListenerTypes>(\n event: Event,\n count: number\n ): void {\n if (this.maxListeners > 0 && count > this.maxListeners && !this.warnedEvents.has(event)) {\n this.warnedEvents.add(event);\n console.warn(\n `MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ` +\n `${count} listeners added for event \"${String(event)}\". ` +\n `Use setMaxListeners() to increase limit (current: ${this.maxListeners}).`\n );\n }\n }\n\n /**\n * Subscribes to an event and returns a function to unsubscribe\n * @param event - The event name to subscribe to\n * @param listener - The listener function to add\n * @returns a function to unsubscribe from the event\n */\n public subscribe<Event extends keyof EventListenerTypes>(\n event: Event,\n listener: EventListener<EventListenerTypes, Event>\n ): () => void {\n this.on(event, listener);\n return () => this.off(event, listener);\n }\n}\n",
8
8
  "// original source: https://github.com/SegFaultx64/typescript-graph\n// previous fork: https://github.com/sroussey/typescript-graph\n// license: MIT\n\nimport { EventEmitter } from \"../events/EventEmitter\";\nimport { NodeAlreadyExistsError, NodeDoesntExistError } from \"./errors\";\n\n/**\n * This is the default [[Graph.constructor | `nodeIdentity`]] function it is simply imported from [object-hash](https://www.npmjs.com/package/object-hash)\n */\n\n/**\n * # Graph\n *\n * A `Graph` is is a simple undirected graph. On it's own it isn't too useful but it forms the basic functionality for the [[`DirectedGraph`]] and [[`DirectedAcyclicGraph`]].\n *\n * ## Creating a Graph\n *\n * You can create a graph to contain any type of node, for example:\n *\n * ```typescript\n * type NodeType = { a: Number, b: string }\n * const graph = new Graph<NodeType>()\n *\n * // Add a node of the defined type\n * const node: string = graph.insert({ a: 10, b: 'string' })\n *\n * // Get the node back\n * const nodeValue: NodeType | undefined = graph.getNode(node);\n * ```\n *\n * ### Defining a custom node identity\n *\n * When you create a graph you likely want to create include a custom `nodeIdentity` function.\n * This function tells the graph how to uniquely identify nodes in a graph,\n * default is to simply use an [[hash]] which means that functionality like [[`replace`]] will not work.\n *\n * ```typescript\n * type NodeType = { count: number, name: string }\n * const graph = new Graph<NodeType>((n) => n.name)\n *\n * // Add a node\n * graph.insert({ count: 5, name: 'node1' })\n * // This will throw an error even though `count` is different because they share a name.\n * graph.insert({ count: 20, name: 'node1' })\n * ```\n *\n * ### Adding an edge\n *\n * Graphs without edges aren't very useful. Inserting edges is done using the node identity string returned by the node identity function.\n *\n * ```typescript\n * const node1: string = graph.insert({ count: 5, name: 'node1' })\n * const node2: string = graph.insert({ count: 20, name: 'node2' })\n *\n * graph.addEdge(node1, node2)\n *\n * // This will throw an error since there is no node with the later name.\n * graph.addEdge(node1, 'not a real node')\n * ```\n *\n * In an undirected graph the order in which you input the node names doesn't matter,\n * but in directed graphs the \"from node\" comes first and the \"to node\" will come second.\n *\n * ### Replacing a node\n *\n * If a node already exists you can update it using [[`replace`]]. `nodeIdentity(newNode)` must be equal to `nodeIdentity(oldNode)`.\n *\n * ```typescript\n * const node1: string = graph.insert({ count: 5, name: 'node1' })\n * const node2: string = graph.insert({ count: 20, name: 'node2' })\n *\n * // This will work because the name has not changed.\n * graph.replace({ count: 15, name: 'node1' })\n *\n * // This will not work because the name has changed.\n * graph.replace({ count: 20, name: 'node3' })\n * ```\n *\n * [[`replace`]] will throw a [[`NodeDoesntExistError`]] exception if you are trying to replace a node that is missing from the graph.\n *\n * ### Upsert\n *\n * Often you will want to create a node node if it doesn't exist and update it does. This can be achieved using [[`upsert`]].\n *\n * ```typescript\n * const node1: string = graph.insert({ count: 5, name: 'node1' })\n *\n * // Both of these will work, the first updating node1 and the second creating a node.\n * const node2: string = graph.upsert({ count: 15, name: 'node1' })\n * const node3: string = graph.upsert({ count: 25, name: 'node3' })\n * ```\n *\n * [[`upsert`]] always return the node identity string of the inserted or updated node. At presented there is no way to tell if the node was created or updated.\n *\n * @typeParam Node `Node` is the node type of the graph. Nodes can be anything in all the included examples they are simple objects.\n * @typeParam Edge `Edge` is the edge type of the graph. Edges can be of any type, but must be truethy and by default they are `true` which is a simple boolean.\n * @typeParam NodeId `NodeId` is the identity type of the node, by default it is a `unknown`, though most will use `string` or `number`.\n * @typeParam EdgeId `EdgeId` is the identity type of the edge, by default it is a `unknown`, though most will use `string` or `number`.\n */\n\nexport type AdjacencyValue<Edge> = null | Array<Edge>;\nexport type AdjacencyMatrix<Edge> = Array<Array<AdjacencyValue<Edge>>>;\n\n/**\n * Events that can be emitted by the TaskGraph\n */\nexport type GraphEvents<NodeId, EdgeId> = keyof GraphEventListeners<NodeId, EdgeId>;\n\nexport type GraphEventListeners<NodeId, EdgeId> = {\n \"node-added\": (node: NodeId) => void;\n \"node-removed\": (node: NodeId) => void;\n \"node-replaced\": (node: NodeId) => void;\n \"edge-added\": (edge: EdgeId) => void;\n \"edge-removed\": (edge: EdgeId) => void;\n \"edge-replaced\": (edge: EdgeId) => void;\n};\n\nexport type GraphEventListener<\n NodeId,\n EdgeId,\n Event extends GraphEvents<NodeId, EdgeId>,\n> = GraphEventListeners<NodeId, EdgeId>[Event];\n\nexport type GraphEventParameters<\n NodeId,\n EdgeId,\n Event extends GraphEvents<NodeId, EdgeId>,\n> = Parameters<GraphEventListeners<NodeId, EdgeId>[Event]>;\n\nexport class Graph<Node, Edge = true, NodeId = unknown, EdgeId = unknown> {\n protected nodes: Map<NodeId, Node>;\n protected adjacency: AdjacencyMatrix<Edge>;\n protected nodeIdentity: (t: Node) => NodeId;\n protected edgeIdentity: (t: Edge, n1: NodeId, n2: NodeId) => EdgeId;\n /** O(1) lookup of node identity → adjacency matrix index. */\n protected nodeIndexMap: Map<NodeId, number> = new Map();\n\n constructor(\n nodeIdentity: (node: Node) => NodeId,\n edgeIdentity: (edge: Edge, node1Identity: NodeId, node2Identit: NodeId) => EdgeId\n ) {\n this.nodes = new Map();\n this.adjacency = [];\n this.nodeIdentity = nodeIdentity;\n this.edgeIdentity = edgeIdentity;\n }\n\n /** Returns the adjacency matrix index for a node, or -1 if not found. */\n protected getNodeIndex(nodeIdentity: NodeId): number {\n return this.nodeIndexMap.get(nodeIdentity) ?? -1;\n }\n\n events = new EventEmitter<GraphEventListeners<NodeId, EdgeId>>();\n on<Event extends GraphEvents<NodeId, EdgeId>>(\n name: Event,\n fn: GraphEventListener<NodeId, EdgeId, Event>\n ) {\n this.events.on.call(this.events, name, fn);\n }\n off<Event extends GraphEvents<NodeId, EdgeId>>(\n name: Event,\n fn: GraphEventListener<NodeId, EdgeId, Event>\n ) {\n this.events.off.call(this.events, name, fn);\n }\n emit<Event extends GraphEvents<NodeId, EdgeId>>(\n name: Event,\n ...args: Parameters<GraphEventListener<NodeId, EdgeId, Event>>\n ) {\n this.events.emit<Event>(name, ...args);\n }\n\n /**\n * Add a node to the graph if it doesn't already exist. If it does, throw a [[`NodeAlreadyExistsError`]].\n *\n * @param node The node to be added\n * @returns A `string` that is the identity of the newly inserted node. This is created by applying the [[constructor | `nodeIdentity`]].\n */\n insert(node: Node): NodeId {\n const id = this.nodeIdentity(node);\n const isOverwrite = this.nodes.has(id);\n\n if (isOverwrite) {\n throw new NodeAlreadyExistsError(node, this.nodes.get(id), id);\n }\n\n this.nodeIndexMap.set(id, this.adjacency.length);\n this.nodes.set(id, node);\n this.adjacency.map((adj) => adj.push(null));\n this.adjacency.push(new Array<AdjacencyValue<Edge>>(this.adjacency.length + 1).fill(null));\n\n this.emit(\"node-added\", id);\n\n return id;\n }\n\n /**\n * This replaces an existing node in the graph with an updated version.\n * Throws a [[`NodeDoesNotExistsError`]] if no node with the same identity already exists.\n *\n * __Caveat_:_ The default identity function means that this will never work since if the node changes it will have a different [[`hash`]].\n *\n * @param node The new node that is replacing the old one.\n */\n replace(node: Node): void {\n const id = this.nodeIdentity(node);\n const isOverwrite = this.nodes.has(id);\n\n if (!isOverwrite) {\n throw new NodeDoesntExistError(id);\n }\n\n this.nodes.set(id, node);\n\n this.emit(\"node-replaced\", id);\n }\n\n /**\n * This essentially combines the behavior of [[`insert`]] and [[`replace`]].\n * If the node doesn't exist, create it. If the node already exists, replace it with the updated version.\n *\n * @param node The node to insert or update\n * @returns The identity string of the node inserted or updated.\n */\n upsert(node: Node): NodeId {\n const id = this.nodeIdentity(node);\n const isOverwrite = this.nodes.has(id);\n\n this.nodes.set(id, node);\n\n if (!isOverwrite) {\n this.nodeIndexMap.set(id, this.adjacency.length);\n this.adjacency.map((adj) => adj.push(null));\n this.adjacency.push(new Array<AdjacencyValue<Edge>>(this.adjacency.length + 1).fill(null));\n this.emit(\"node-added\", id);\n } else {\n this.emit(\"node-replaced\", id);\n }\n\n return id;\n }\n\n /**\n * Create an edge between two nodes in the graph.\n * Throws a [[`NodeDoesNotExistsError`]] if no either of the nodes you are attempting to connect do not exist.\n *\n * @param node1Identity The first node to connect (in [[`DirectedGraph`]]s and [[`DirectedAcyclicGraph`]]s this is the `source` node.)\n * @param node2Identity The second node to connect (in [[`DirectedGraph`]]s and [[`DirectedAcyclicGraph`]]s this is the `target` node)\n * @param edge The edge to be added. By default this is `true` but it can be any type.\n */\n addEdge(node1Identity: NodeId, node2Identity: NodeId, edge?: Edge): EdgeId {\n if (edge === undefined) {\n edge = true as Edge;\n }\n const node1Exists = this.nodes.has(node1Identity);\n const node2Exists = this.nodes.has(node2Identity);\n\n if (!node1Exists) {\n throw new NodeDoesntExistError(node1Identity);\n }\n\n if (!node2Exists) {\n throw new NodeDoesntExistError(node2Identity);\n }\n\n const node1Index = this.getNodeIndex(node1Identity);\n const node2Index = this.getNodeIndex(node2Identity);\n\n if (this.adjacency[node1Index][node2Index] === null) {\n this.adjacency[node1Index][node2Index] = [edge];\n } else {\n if (!this.adjacency[node1Index][node2Index]!.includes(edge)) {\n this.adjacency[node1Index][node2Index]!.push(edge);\n }\n }\n\n const id = this.edgeIdentity(edge, node1Identity, node2Identity);\n this.emit(\"edge-added\", id);\n\n return id;\n }\n\n /**\n * This simply returns all the nodes stored in the graph\n *\n * @param compareFunc An optional function that indicates the sort order of the returned array\n */\n getNodes(compareFunc?: (a: Node, b: Node) => number): Node[] {\n const temp = Array.from(this.nodes.values());\n\n if (compareFunc !== undefined) {\n return temp.sort(compareFunc);\n }\n\n return temp;\n }\n\n /**\n * Returns a specific node given the node identity returned from the [[`insert`]] function\n */\n getNode(nodeIdentity: NodeId): Node | undefined {\n return this.nodes.get(nodeIdentity);\n }\n\n /**\n * Returns true if the node exists in the graph.\n */\n hasNode(nodeIdentity: NodeId): boolean {\n return this.nodes.has(nodeIdentity);\n }\n\n /**\n * Returns all edges in the graph as an array of tuples.\n */\n getEdges(): Array<[node1Identity: NodeId, node2Identity: NodeId, edge: Edge]> {\n const toReturn: Array<[node1Identity: NodeId, node2Identity: NodeId, edge: Edge]> = [];\n\n const nodeKeys = Array.from(this.nodes.keys());\n this.adjacency.forEach((row, rowIndex) => {\n const node1Identity = nodeKeys[rowIndex];\n if (node1Identity != null) {\n row.forEach((edges, colIndex) => {\n if (edges !== null) {\n const node2Identity = nodeKeys[colIndex];\n if (node2Identity != null) {\n for (const edge of edges) {\n toReturn.push([node1Identity, node2Identity, edge]);\n }\n }\n }\n });\n }\n });\n\n return toReturn;\n }\n\n /**\n * Returns the out edges for a specific node.\n */\n outEdges(\n node1Identity: NodeId\n ): Array<[node1Identity: NodeId, node2Identity: NodeId, edge: Edge]> {\n const nodeKeys = Array.from(this.nodes.keys());\n const nodeIndex = this.getNodeIndex(node1Identity);\n\n const toReturn: Array<[node1Identity: NodeId, node2Identity: NodeId, edge: Edge]> = [];\n\n this.adjacency[nodeIndex].forEach((edges, colIndex) => {\n if (edges !== null) {\n const node2Identity = nodeKeys[colIndex];\n if (node2Identity != null) {\n for (const edge of edges) {\n toReturn.push([node1Identity, node2Identity, edge]);\n }\n }\n }\n });\n\n return toReturn;\n }\n\n /**\n * Returns the in edges for a specific node.\n */\n inEdges(\n node2Identity: NodeId\n ): Array<[node1Identity: NodeId, node2Identity: NodeId, edge: Edge]> {\n const nodeKeys = Array.from(this.nodes.keys());\n const node2Index = this.getNodeIndex(node2Identity);\n\n const toReturn: Array<[node1Identity: NodeId, node2Identity: NodeId, edge: Edge]> = [];\n\n this.adjacency.forEach((row, rowIndex) => {\n const node1Identity = nodeKeys[rowIndex];\n const edges = row[node2Index];\n if (edges !== null) {\n for (const edge of edges) {\n toReturn.push([node1Identity, node2Identity, edge]);\n }\n }\n });\n\n return toReturn;\n }\n\n /**\n * Returns the edges for a specific node.\n */\n nodeEdges(\n nodeIdentity: NodeId\n ): Array<[node1Identity: NodeId, node2Identity: NodeId, edge: Edge]> {\n return [...this.outEdges(nodeIdentity), ...this.inEdges(nodeIdentity)];\n }\n\n /**\n * Deletes an edge between two nodes in the graph.\n * Throws a [[`NodeDoesNotExistsError`]] if either of the nodes do not exist.\n *\n * @param node1Identity The identity of the first node (in [[`DirectedGraph`]]s and [[`DirectedAcyclicGraph`]]s this is the `from` node.)\n * @param node2Identity The identity of the second node (in [[`DirectedGraph`]]s and [[`DirectedAcyclicGraph`]]s this is the `to` node)\n * @param edgeIdentity The identity of the edge to be deleted. If not provided, all edges between the two nodes will be deleted.\n */\n removeEdge(node1Identity: NodeId, node2Identity: NodeId, edgeIdentity?: EdgeId): void {\n const node1Exists = this.nodes.has(node1Identity);\n const node2Exists = this.nodes.has(node2Identity);\n\n if (!node1Exists) {\n throw new NodeDoesntExistError(node1Identity);\n }\n\n if (!node2Exists) {\n throw new NodeDoesntExistError(node2Identity);\n }\n\n const node1Index = this.getNodeIndex(node1Identity);\n const node2Index = this.getNodeIndex(node2Identity);\n\n if (edgeIdentity === undefined) {\n this.adjacency[node1Index][node2Index] = null;\n } else {\n // Remove the specific edge matching edgeIdentity from this node pair\n const edgeList = this.adjacency[node1Index][node2Index];\n if (edgeList !== null) {\n for (let edgeIndex = 0; edgeIndex < edgeList.length; edgeIndex++) {\n if (\n this.edgeIdentity(edgeList[edgeIndex], node1Identity, node2Identity) === edgeIdentity\n ) {\n edgeList.splice(edgeIndex, 1);\n break;\n }\n }\n if (edgeList.length === 0) {\n this.adjacency[node1Index][node2Index] = null;\n }\n }\n }\n this.emit(\"edge-removed\", edgeIdentity as EdgeId);\n }\n\n /**\n * Deletes a node from the graph, along with any edges associated with it.\n * Throws a [[`NodeDoesNotExistsError`]] if the node does not exist.\n *\n * @param nodeIdentity The identity of the node to be deleted.\n */\n remove(nodeIdentity: NodeId): void {\n if (!this.nodes.has(nodeIdentity)) {\n throw new NodeDoesntExistError(nodeIdentity);\n }\n\n // Find the index of the node in the adjacency matrix BEFORE deleting\n const nodeIndex = this.getNodeIndex(nodeIdentity);\n\n // Remove the node from the nodes map and index map\n this.nodes.delete(nodeIdentity);\n this.nodeIndexMap.delete(nodeIdentity);\n\n // Decrement indices for all nodes that came after the removed one\n for (const [id, idx] of this.nodeIndexMap) {\n if (idx > nodeIndex) {\n this.nodeIndexMap.set(id, idx - 1);\n }\n }\n\n // Remove the corresponding row from the adjacency matrix\n this.adjacency.splice(nodeIndex, 1);\n\n // Remove the corresponding column from the adjacency matrix\n this.adjacency.forEach((row) => row.splice(nodeIndex, 1));\n\n this.emit(\"node-removed\", nodeIdentity);\n }\n\n /**\n * @alias remove\n */\n removeNode(nodeIdentity: NodeId): void {\n return this.remove(nodeIdentity);\n }\n\n /**\n * @alias insert\n */\n addNode(node: Node): NodeId {\n return this.insert(node);\n }\n\n /**\n * Add nodes in bulk\n */\n addNodes(nodes: Node[]): NodeId[] {\n return nodes.map((node) => this.insert(node));\n }\n\n /**\n * Add edges\n * @param edges An array of tuples, each tuple containing the identity of the source node, the identity of the target node, and the edge to add.\n */\n addEdges(\n edges: Array<[node1Identity: NodeId, node2Identity: NodeId, edge?: Edge | undefined]>\n ): EdgeId[] {\n return edges.map(([node1Identity, node2Identity, edge]) =>\n this.addEdge(node1Identity, node2Identity, edge)\n );\n }\n}\n",
9
- "// original source: https://github.com/SegFaultx64/typescript-graph\n// previous fork: https://github.com/sroussey/typescript-graph\n// license: MIT\n\nimport { NodeDoesntExistError } from \"./errors\";\nimport { Graph } from \"./graph\";\nimport type { AdjacencyMatrix } from \"./graph\";\n\n/**\n * # DirectedGraph\n *\n * A DirectedGraph is similar a [[`Graph`]] but with additional functionality.\n *\n * @typeParam Node `Node` is the node type of the graph. Nodes can be anything in all the included examples they are simple objects.\n * @typeParam Edge `Edge` is the edge type of the graph. Edges can be of any type, but must be truethy and by default they are `true` which is a simple boolean.\n * @typeParam NodeId `NodeId` is the identity type of the node, by default it is a `unknown`, though most will use `string` or `number`.\n * @typeParam EdgeId `EdgeId` is the identity type of the edge, by default it is a `unknown`, though most will use `string` or `number`.\n */\nexport class DirectedGraph<Node, Edge = true, NodeId = unknown, EdgeId = unknown> extends Graph<\n Node,\n Edge,\n NodeId,\n EdgeId\n> {\n /** Caches if the graph contains a cycle. If `undefined` then it is unknown. */\n protected hasCycle: boolean | undefined = undefined;\n\n /**\n * Returns `true` if there are no cycles in the graph.\n * This relies on a cached value so calling it multiple times without adding edges to the graph should be O(1) after the first call.\n * Non-cached calls are potentially expensive, the implementation is based on Kahn's algorithim which is O(|EdgeCount| + |NodeCount|).\n */\n isAcyclic(): boolean {\n if (this.hasCycle !== undefined) {\n return !this.hasCycle;\n }\n\n const nodeIndices = Array.from(this.nodes.keys());\n const nodeInDegrees = new Map(\n Array.from(this.nodes.keys()).map((n) => [n, this.indegreeOfNode(n)])\n );\n\n const toSearch = Array.from(nodeInDegrees).filter((pair) => pair[1] === 0);\n\n let visitedNodes = 0;\n\n while (toSearch.length > 0) {\n const cur = toSearch.pop();\n if (cur === undefined) {\n continue;\n }\n\n const nodeIndex = this.getNodeIndex(cur[0]);\n this.adjacency[nodeIndex].forEach((hasAdj, index) => {\n if (hasAdj !== null && hasAdj.length > 0) {\n const edgeCount = hasAdj.length;\n const currentInDegree = nodeInDegrees.get(nodeIndices[index]);\n if (currentInDegree !== undefined) {\n nodeInDegrees.set(nodeIndices[index], currentInDegree - edgeCount);\n if (currentInDegree - edgeCount === 0) {\n toSearch.push([nodeIndices[index], currentInDegree - edgeCount]);\n }\n }\n }\n });\n\n visitedNodes++;\n }\n\n this.hasCycle = !(visitedNodes === this.nodes.size);\n\n return visitedNodes === this.nodes.size;\n }\n\n /**\n * The indegree of a node is the number of edges that point to it. This will always be an integer.\n *\n * Throws a [[`NodeDoesntExistError`]] the node does not exist.\n *\n * @param nodeID The string of the node identity of the node to calculate indegree for.\n */\n indegreeOfNode(nodeID: NodeId): number {\n const indexOfNode = this.getNodeIndex(nodeID);\n\n if (indexOfNode === -1) {\n throw new NodeDoesntExistError(nodeID);\n }\n\n return this.adjacency.reduce<number>((carry, row) => {\n return carry + (row[indexOfNode] == null ? 0 : row[indexOfNode].length);\n }, 0);\n }\n\n /**\n * Add a directed edge to the graph.\n *\n * @param sourceNodeIdentity The identity string of the node the edge should run from.\n * @param targetNodeIdentity The identity string of the node the edge should run to.\n * @param edge The edge to add to the graph. If not provided it defaults to `true`.\n * @param skipUpdatingCyclicality This boolean indicates if the cache of the cyclicality of the graph should be updated.\n * If `false` is passed the cycle cache will be invalidated because we can not assure that a cycle has not been created.\n */\n override addEdge(\n sourceNodeIdentity: NodeId,\n targetNodeIdentity: NodeId,\n edge?: Edge,\n skipUpdatingCyclicality: boolean = false\n ): EdgeId {\n if (edge === undefined) {\n edge = true as Edge;\n }\n if (this.hasCycle === false && !skipUpdatingCyclicality) {\n this.hasCycle = this.wouldAddingEdgeCreateCycle(sourceNodeIdentity, targetNodeIdentity);\n } else if (skipUpdatingCyclicality) {\n this.hasCycle = undefined;\n }\n\n return super.addEdge(sourceNodeIdentity, targetNodeIdentity, edge);\n }\n\n /**\n * Depth first search to see if one node is reachable from another following the directed edges.\n *\n * __Caveat:__ This will return false if `startNode` and `endNode` are the same node and there is not a cycle or a loop edge connecting them.\n *\n * @param startNode The string identity of the node to start at.\n * @param endNode The string identity of the node we are attempting to reach.\n */\n canReachFrom(startNode: NodeId, endNode: NodeId): boolean {\n const nodeKeys = Array.from(this.nodes.keys());\n const startNodeIndex = this.getNodeIndex(startNode);\n const endNodeIndex = this.getNodeIndex(endNode);\n\n if (this.adjacency[startNodeIndex][endNodeIndex] != null) {\n return true;\n }\n\n return this.adjacency[startNodeIndex].reduce<boolean>((carry, edge, index) => {\n if (carry || edge === null) {\n return carry;\n }\n\n return this.canReachFrom(nodeKeys[index], endNode);\n }, false);\n }\n\n /**\n * Checks if adding the specified edge would create a cycle.\n * Returns true in O(1) if the graph already contains a known cycle, or if `sourceNodeIdentity` and `targetNodeIdentity` are the same.\n *\n * @param sourceNodeIdentity The string identity of the node the edge is from.\n * @param targetNodeIdentity The string identity of the node the edge is to.\n */\n wouldAddingEdgeCreateCycle(sourceNodeIdentity: NodeId, targetNodeIdentity: NodeId): boolean {\n return (\n this.hasCycle ||\n sourceNodeIdentity === targetNodeIdentity ||\n this.canReachFrom(targetNodeIdentity, sourceNodeIdentity)\n );\n }\n\n /**\n * Given a starting node this returns a new [[`DirectedGraph`]] containing all the nodes that can be reached.\n * Throws a [[`NodeDoesntExistError`]] if the start node does not exist.\n *\n * @param startNodeIdentity The string identity of the node from which the subgraph search should start.\n */\n getSubGraphStartingFrom(startNodeIdentity: NodeId): DirectedGraph<Node, Edge, NodeId, EdgeId> {\n const nodeIndices = Array.from(this.nodes.keys());\n const initalNode = this.nodes.get(startNodeIdentity);\n\n if (initalNode == null) {\n throw new NodeDoesntExistError(startNodeIdentity);\n }\n\n const recur = (startNodeIdentity: NodeId, nodesToInclude: Node[]): Node[] => {\n let toReturn = [...nodesToInclude];\n const nodeIndex = this.getNodeIndex(startNodeIdentity);\n this.adjacency[nodeIndex].forEach((hasAdj, index) => {\n if (\n hasAdj !== null &&\n nodesToInclude.find((n) => this.nodeIdentity(n) === nodeIndices[index]) == null\n ) {\n const newNode = this.nodes.get(nodeIndices[index]);\n\n if (newNode != null) {\n toReturn = [...recur(nodeIndices[index], toReturn), newNode];\n }\n }\n });\n\n return toReturn;\n };\n\n const newGraph = new DirectedGraph<Node, Edge, NodeId, EdgeId>(\n this.nodeIdentity,\n this.edgeIdentity\n );\n const nodeList = recur(startNodeIdentity, [initalNode]);\n const includeIdents = nodeList.map((t) => this.nodeIdentity(t));\n Array.from(this.nodes.values()).forEach((n) => {\n if (includeIdents.includes(this.nodeIdentity(n))) {\n newGraph.insert(n);\n }\n });\n newGraph.adjacency = this.subAdj(nodeList);\n return newGraph;\n }\n\n private subAdj(include: Node[]): AdjacencyMatrix<Edge> {\n const includeIdents = include.map((t) => this.nodeIdentity(t));\n const nodeIndices = Array.from(this.nodes.keys());\n\n return this.adjacency.reduce<AdjacencyMatrix<Edge>>((carry, cur, index) => {\n if (includeIdents.includes(nodeIndices[index])) {\n return [...carry, cur.filter((_, index) => includeIdents.includes(nodeIndices[index]))];\n } else {\n return carry;\n }\n }, []);\n }\n\n /**\n * Returns all edges in the graph as an array of tuples.\n */\n override getEdges(): Array<[sourceNodeIdentity: NodeId, targetNodeIdentity: NodeId, edge: Edge]> {\n return super.getEdges();\n }\n\n /**\n * Deletes an edge between two nodes in the graph.\n * Throws a [[`NodeDoesNotExistsError`]] if either of the nodes do not exist.\n *\n * @param sourceNodeIdentity The identity of the source node\n * @param targetNodeIdentity The identity of the target node\n * @param edgeIdentity The identity of the edge to be deleted. If not provided, all edges between the two nodes will be deleted.\n */\n override removeEdge(\n sourceNodeIdentity: NodeId,\n targetNodeIdentity: NodeId,\n edgeIdentity?: EdgeId\n ): void {\n super.removeEdge(sourceNodeIdentity, targetNodeIdentity, edgeIdentity);\n\n // Invalidate the cycle cache as the graph structure has changed\n this.hasCycle = undefined;\n }\n\n /**\n * Deletes a node from the graph, along with any edges associated with it.\n * Throws a [[`NodeDoesNotExistsError`]] if the node does not exist.\n *\n * @param nodeIdentity The identity of the node to be deleted.\n */\n override remove(nodeIdentity: NodeId): void {\n super.remove(nodeIdentity);\n\n // Invalidate the cycle cache as the graph structure has changed\n this.hasCycle = undefined;\n }\n\n /**\n * Add edges\n * @param edges An array of tuples, each tuple containing the identity of the source node, the identity of the target node, and the edge to add.\n */\n override addEdges(\n edges: Array<[sourceNodeIdentity: NodeId, targetNodeIdentity: NodeId, edge?: Edge | undefined]>\n ): EdgeId[] {\n return super.addEdges(edges);\n }\n}\n",
9
+ "// original source: https://github.com/SegFaultx64/typescript-graph\n// previous fork: https://github.com/sroussey/typescript-graph\n// license: MIT\n\nimport { NodeDoesntExistError } from \"./errors\";\nimport type { AdjacencyMatrix } from \"./graph\";\nimport { Graph } from \"./graph\";\n\n/**\n * # DirectedGraph\n *\n * A DirectedGraph is similar a [[`Graph`]] but with additional functionality.\n *\n * @typeParam Node `Node` is the node type of the graph. Nodes can be anything in all the included examples they are simple objects.\n * @typeParam Edge `Edge` is the edge type of the graph. Edges can be of any type, but must be truethy and by default they are `true` which is a simple boolean.\n * @typeParam NodeId `NodeId` is the identity type of the node, by default it is a `unknown`, though most will use `string` or `number`.\n * @typeParam EdgeId `EdgeId` is the identity type of the edge, by default it is a `unknown`, though most will use `string` or `number`.\n */\nexport class DirectedGraph<Node, Edge = true, NodeId = unknown, EdgeId = unknown> extends Graph<\n Node,\n Edge,\n NodeId,\n EdgeId\n> {\n /** Caches if the graph contains a cycle. If `undefined` then it is unknown. */\n protected hasCycle: boolean | undefined = undefined;\n\n /**\n * Returns `true` if there are no cycles in the graph.\n * This relies on a cached value so calling it multiple times without adding edges to the graph should be O(1) after the first call.\n * Non-cached calls are potentially expensive, the implementation is based on Kahn's algorithim which is O(|EdgeCount| + |NodeCount|).\n */\n isAcyclic(): boolean {\n if (this.hasCycle !== undefined) {\n return !this.hasCycle;\n }\n\n const nodeIndices = Array.from(this.nodes.keys());\n const nodeInDegrees = new Map(\n Array.from(this.nodes.keys()).map((n) => [n, this.indegreeOfNode(n)])\n );\n\n const toSearch = Array.from(nodeInDegrees).filter((pair) => pair[1] === 0);\n\n let visitedNodes = 0;\n\n while (toSearch.length > 0) {\n const cur = toSearch.pop();\n if (cur === undefined) {\n continue;\n }\n\n const nodeIndex = this.getNodeIndex(cur[0]);\n this.adjacency[nodeIndex].forEach((hasAdj, index) => {\n if (hasAdj !== null && hasAdj.length > 0) {\n const edgeCount = hasAdj.length;\n const currentInDegree = nodeInDegrees.get(nodeIndices[index]);\n if (currentInDegree !== undefined) {\n nodeInDegrees.set(nodeIndices[index], currentInDegree - edgeCount);\n if (currentInDegree - edgeCount === 0) {\n toSearch.push([nodeIndices[index], currentInDegree - edgeCount]);\n }\n }\n }\n });\n\n visitedNodes++;\n }\n\n this.hasCycle = !(visitedNodes === this.nodes.size);\n\n return visitedNodes === this.nodes.size;\n }\n\n /**\n * The indegree of a node is the number of edges that point to it. This will always be an integer.\n *\n * Throws a [[`NodeDoesntExistError`]] the node does not exist.\n *\n * @param nodeID The string of the node identity of the node to calculate indegree for.\n */\n indegreeOfNode(nodeID: NodeId): number {\n const indexOfNode = this.getNodeIndex(nodeID);\n\n if (indexOfNode === -1) {\n throw new NodeDoesntExistError(nodeID);\n }\n\n return this.adjacency.reduce<number>((carry, row) => {\n return carry + (row[indexOfNode] == null ? 0 : row[indexOfNode].length);\n }, 0);\n }\n\n /**\n * Add a directed edge to the graph.\n *\n * @param sourceNodeIdentity The identity string of the node the edge should run from.\n * @param targetNodeIdentity The identity string of the node the edge should run to.\n * @param edge The edge to add to the graph. If not provided it defaults to `true`.\n * @param skipUpdatingCyclicality This boolean indicates if the cache of the cyclicality of the graph should be updated.\n * If `false` is passed the cycle cache will be invalidated because we can not assure that a cycle has not been created.\n */\n override addEdge(\n sourceNodeIdentity: NodeId,\n targetNodeIdentity: NodeId,\n edge?: Edge,\n skipUpdatingCyclicality: boolean = false\n ): EdgeId {\n if (edge === undefined) {\n edge = true as Edge;\n }\n if (this.hasCycle === false && !skipUpdatingCyclicality) {\n this.hasCycle = this.wouldAddingEdgeCreateCycle(sourceNodeIdentity, targetNodeIdentity);\n } else if (skipUpdatingCyclicality) {\n this.hasCycle = undefined;\n }\n\n return super.addEdge(sourceNodeIdentity, targetNodeIdentity, edge);\n }\n\n /**\n * Depth first search to see if one node is reachable from another following the directed edges.\n *\n * __Caveat:__ This will return false if `startNode` and `endNode` are the same node and there is not a cycle or a loop edge connecting them.\n *\n * @param startNode The string identity of the node to start at.\n * @param endNode The string identity of the node we are attempting to reach.\n */\n canReachFrom(startNode: NodeId, endNode: NodeId): boolean {\n const nodeKeys = Array.from(this.nodes.keys());\n const startNodeIndex = this.getNodeIndex(startNode);\n const endNodeIndex = this.getNodeIndex(endNode);\n\n // Missing endpoints: no path. Also avoids `adjacency[-1]` which is undefined\n // and would throw when indexed (e.g. DAG.addEdge runs cycle check before\n // Graph.addEdge validates that both nodes exist).\n if (startNodeIndex < 0 || endNodeIndex < 0) {\n return false;\n }\n\n if (this.adjacency[startNodeIndex][endNodeIndex] != null) {\n return true;\n }\n\n return this.adjacency[startNodeIndex].reduce<boolean>((carry, edge, index) => {\n if (carry || edge === null) {\n return carry;\n }\n\n return this.canReachFrom(nodeKeys[index], endNode);\n }, false);\n }\n\n /**\n * Checks if adding the specified edge would create a cycle.\n * Returns true in O(1) if the graph already contains a known cycle, or if `sourceNodeIdentity` and `targetNodeIdentity` are the same.\n *\n * @param sourceNodeIdentity The string identity of the node the edge is from.\n * @param targetNodeIdentity The string identity of the node the edge is to.\n */\n wouldAddingEdgeCreateCycle(sourceNodeIdentity: NodeId, targetNodeIdentity: NodeId): boolean {\n return (\n this.hasCycle ||\n sourceNodeIdentity === targetNodeIdentity ||\n this.canReachFrom(targetNodeIdentity, sourceNodeIdentity)\n );\n }\n\n /**\n * Given a starting node this returns a new [[`DirectedGraph`]] containing all the nodes that can be reached.\n * Throws a [[`NodeDoesntExistError`]] if the start node does not exist.\n *\n * @param startNodeIdentity The string identity of the node from which the subgraph search should start.\n */\n getSubGraphStartingFrom(startNodeIdentity: NodeId): DirectedGraph<Node, Edge, NodeId, EdgeId> {\n const nodeIndices = Array.from(this.nodes.keys());\n const initalNode = this.nodes.get(startNodeIdentity);\n\n if (initalNode == null) {\n throw new NodeDoesntExistError(startNodeIdentity);\n }\n\n const recur = (startNodeIdentity: NodeId, nodesToInclude: Node[]): Node[] => {\n let toReturn = [...nodesToInclude];\n const nodeIndex = this.getNodeIndex(startNodeIdentity);\n this.adjacency[nodeIndex].forEach((hasAdj, index) => {\n if (\n hasAdj !== null &&\n nodesToInclude.find((n) => this.nodeIdentity(n) === nodeIndices[index]) == null\n ) {\n const newNode = this.nodes.get(nodeIndices[index]);\n\n if (newNode != null) {\n toReturn = [...recur(nodeIndices[index], toReturn), newNode];\n }\n }\n });\n\n return toReturn;\n };\n\n const newGraph = new DirectedGraph<Node, Edge, NodeId, EdgeId>(\n this.nodeIdentity,\n this.edgeIdentity\n );\n const nodeList = recur(startNodeIdentity, [initalNode]);\n const includeIdents = nodeList.map((t) => this.nodeIdentity(t));\n Array.from(this.nodes.values()).forEach((n) => {\n if (includeIdents.includes(this.nodeIdentity(n))) {\n newGraph.insert(n);\n }\n });\n newGraph.adjacency = this.subAdj(nodeList);\n return newGraph;\n }\n\n private subAdj(include: Node[]): AdjacencyMatrix<Edge> {\n const includeIdents = include.map((t) => this.nodeIdentity(t));\n const nodeIndices = Array.from(this.nodes.keys());\n\n return this.adjacency.reduce<AdjacencyMatrix<Edge>>((carry, cur, index) => {\n if (includeIdents.includes(nodeIndices[index])) {\n return [...carry, cur.filter((_, index) => includeIdents.includes(nodeIndices[index]))];\n } else {\n return carry;\n }\n }, []);\n }\n\n /**\n * Returns all edges in the graph as an array of tuples.\n */\n override getEdges(): Array<[sourceNodeIdentity: NodeId, targetNodeIdentity: NodeId, edge: Edge]> {\n return super.getEdges();\n }\n\n /**\n * Deletes an edge between two nodes in the graph.\n * Throws a [[`NodeDoesNotExistsError`]] if either of the nodes do not exist.\n *\n * @param sourceNodeIdentity The identity of the source node\n * @param targetNodeIdentity The identity of the target node\n * @param edgeIdentity The identity of the edge to be deleted. If not provided, all edges between the two nodes will be deleted.\n */\n override removeEdge(\n sourceNodeIdentity: NodeId,\n targetNodeIdentity: NodeId,\n edgeIdentity?: EdgeId\n ): void {\n super.removeEdge(sourceNodeIdentity, targetNodeIdentity, edgeIdentity);\n\n // Invalidate the cycle cache as the graph structure has changed\n this.hasCycle = undefined;\n }\n\n /**\n * Deletes a node from the graph, along with any edges associated with it.\n * Throws a [[`NodeDoesNotExistsError`]] if the node does not exist.\n *\n * @param nodeIdentity The identity of the node to be deleted.\n */\n override remove(nodeIdentity: NodeId): void {\n super.remove(nodeIdentity);\n\n // Invalidate the cycle cache as the graph structure has changed\n this.hasCycle = undefined;\n }\n\n /**\n * Add edges\n * @param edges An array of tuples, each tuple containing the identity of the source node, the identity of the target node, and the edge to add.\n */\n override addEdges(\n edges: Array<[sourceNodeIdentity: NodeId, targetNodeIdentity: NodeId, edge?: Edge | undefined]>\n ): EdgeId[] {\n return super.addEdges(edges);\n }\n}\n",
10
10
  "// original source: https://github.com/SegFaultx64/typescript-graph\n// previous fork: https://github.com/sroussey/typescript-graph\n// license: MIT\n\nimport { DirectedGraph } from \"./directedGraph\";\nimport { CycleError } from \"./errors\";\n\n/**\n * # DirectedAcyclicGraph\n *\n * A DirectedAcyclicGraph is builds on a [[`DirectedGraph`]] but enforces acyclicality. You cannot add an edge to a DirectedAcyclicGraph that would create a cycle.\n *\n * @typeParam Node `Node` is the node type of the graph. Nodes can be anything in all the included examples they are simple objects.\n * @typeParam Edge `Edge` is the edge type of the graph. Edges can be of any type, but must be truethy and by default they are `true` which is a simple boolean.\n * @typeParam NodeId `NodeId` is the identity type of the node, by default it is a `unknown`, though most will use `string` or `number`.\n * @typeParam EdgeId `EdgeId` is the identity type of the edge, by default it is a `unknown`, though most will use `string` or `number`.\n */\nexport class DirectedAcyclicGraph<\n Node,\n Edge = true,\n NodeId = unknown,\n EdgeId = unknown,\n> extends DirectedGraph<Node, Edge, NodeId, EdgeId> {\n private _topologicallySortedNodes?: Node[];\n\n /**\n * Converts an existing directed graph into a directed acyclic graph.\n * Throws a {@linkcode CycleError} if the graph attempting to be converted contains a cycle.\n * @param graph The source directed graph to convert into a DAG\n */\n static fromDirectedGraph<Node, Edge, NodeId, EdgeId>(\n graph: DirectedGraph<Node, Edge, NodeId, EdgeId>\n ): DirectedAcyclicGraph<Node, Edge, NodeId, EdgeId> {\n if (!graph.isAcyclic()) {\n throw new CycleError(\"Can't convert that graph to a DAG because it contains a cycle\");\n }\n const toRet = new DirectedAcyclicGraph<Node, Edge, NodeId, EdgeId>(\n // @ts-expect-error\n graph.nodeIdentity,\n // @ts-expect-error\n graph.edgeIdentity\n );\n\n toRet.nodes = (graph as any).nodes;\n toRet.adjacency = (graph as any).adjacency;\n toRet.nodeIndexMap = (graph as any).nodeIndexMap;\n\n return toRet;\n }\n\n /**\n * Adds an edge to the graph similarly to [[`DirectedGraph.addEdge`]] but maintains correctness of the acyclic graph.\n * Thows a [[`CycleError`]] if adding the requested edge would create a cycle.\n * Adding an edge invalidates the cache of topologically sorted nodes, rather than updating it.\n *\n * @param sourceNodeIdentity The identity string of the node the edge should run from.\n * @param targetNodeIdentity The identity string of the node the edge should run to.\n * @param edge The edge to add to the graph. If not provided it defaults to `true`.\n */\n override addEdge(sourceNodeIdentity: NodeId, targetNodeIdentity: NodeId, edge?: Edge): EdgeId {\n if (edge === undefined) {\n edge = true as Edge;\n }\n if (this.wouldAddingEdgeCreateCycle(sourceNodeIdentity, targetNodeIdentity)) {\n throw new CycleError(\n `Can't add edge from ${String(sourceNodeIdentity)} to ${String(\n targetNodeIdentity\n )} it would create a cycle`\n );\n }\n\n // Invalidate cache of toposorted nodes\n this._topologicallySortedNodes = undefined;\n return super.addEdge(sourceNodeIdentity, targetNodeIdentity, edge, true);\n }\n\n /**\n * Inserts a node into the graph and maintains topologic sort cache by prepending the node\n * (since all newly created nodes have an [[ indegreeOfNode | indegree ]] of zero.)\n *\n * @param node The node to insert\n */\n override insert(node: Node): NodeId {\n if (this._topologicallySortedNodes !== undefined) {\n this._topologicallySortedNodes = [node, ...this._topologicallySortedNodes];\n }\n\n return super.insert(node);\n }\n\n /**\n * Topologically sort the nodes using Kahn's algorithm. Uses a cache which means that repeated calls should be O(1) after the first call.\n * Non-cached calls are potentially expensive, Kahn's algorithim is O(|EdgeCount| + |NodeCount|).\n * There may be more than one valid topological sort order for a single graph,\n * so just because two graphs are the same does not mean that order of the resultant arrays will be.\n *\n * @returns An array of nodes sorted by the topological order.\n */\n topologicallySortedNodes(): Node[] {\n if (this._topologicallySortedNodes !== undefined) {\n return this._topologicallySortedNodes;\n }\n\n const nodeIndices = Array.from(this.nodes.keys());\n const nodeInDegrees = new Map(\n Array.from(this.nodes.keys()).map((n) => [n, this.indegreeOfNode(n)])\n );\n\n const adjCopy = this.adjacency.map((a) => [...a]);\n\n const toSearch = Array.from(nodeInDegrees).filter((pair) => pair[1] === 0);\n\n if (toSearch.length === this.nodes.size) {\n const arrayOfNodes = Array.from(this.nodes.values());\n this._topologicallySortedNodes = arrayOfNodes;\n return arrayOfNodes;\n }\n\n const toReturn: Node[] = [];\n\n while (toSearch.length > 0) {\n const n = toSearch.pop();\n if (n === undefined) {\n throw new Error(\"Unexpected empty array\");\n }\n const curNode = this.nodes.get(n[0]);\n if (curNode == null) {\n throw new Error(\"This should never happen\");\n }\n toReturn.push(curNode);\n\n adjCopy[this.getNodeIndex(n[0])]?.forEach((edge, index) => {\n if (edge !== null && edge.length > 0) {\n const edgeCount = edge.length;\n adjCopy[this.getNodeIndex(n[0])][index] = null;\n const target = nodeInDegrees.get(nodeIndices[index]);\n if (target !== undefined) {\n nodeInDegrees.set(nodeIndices[index], target - edgeCount);\n if (target - edgeCount === 0) {\n toSearch.push([nodeIndices[index], 0]);\n }\n } else {\n throw new Error(\"This should never happen\");\n }\n }\n });\n }\n\n // Update cache\n this._topologicallySortedNodes = toReturn;\n\n // we shouldn't need to account for the error case of there being a cycle because it shouldn't\n // be possible to instantiate this class in a state (or put it in a state) where there is a cycle.\n\n return toReturn;\n }\n\n /**\n * Given a starting node this returns a new [[`DirectedA`]] containing all the nodes that can be reached.\n * Throws a [[`NodeDoesntExistError`]] if the start node does not exist.\n *\n * @param startNodeIdentity The string identity of the node from which the subgraph search should start.\n */\n override getSubGraphStartingFrom(\n startNodeIdentity: NodeId\n ): DirectedAcyclicGraph<Node, Edge, NodeId, EdgeId> {\n return DirectedAcyclicGraph.fromDirectedGraph(super.getSubGraphStartingFrom(startNodeIdentity));\n }\n\n /**\n * Deletes an edge between two nodes in the graph.\n * Throws a [[`NodeDoesNotExistsError`]] if either of the nodes do not exist.\n *\n * @param sourceNodeIdentity The identity of the source node\n * @param targetNodeIdentity The identity of the target node\n * @param edgeIdentity The identity of the edge to be deleted. If not provided, all edges between the two nodes will be deleted.\n */\n override removeEdge(\n sourceNodeIdentity: NodeId,\n targetNodeIdentity: NodeId,\n edgeIdentity?: EdgeId\n ): void {\n super.removeEdge(sourceNodeIdentity, targetNodeIdentity, edgeIdentity);\n\n // Invalidate the topologically sorted nodes cache\n this._topologicallySortedNodes = undefined;\n }\n\n /**\n * Deletes a node from the graph, along with any edges associated with it.\n * Throws a [[`NodeDoesNotExistsError`]] if the node does not exist.\n *\n * @param nodeIdentity The identity of the node to be deleted.\n */\n override remove(nodeIdentity: NodeId): void {\n super.remove(nodeIdentity);\n\n // Invalidate the topologically sorted nodes cache\n this._topologicallyS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,OAAO;AAAA,MAErB,QAAQ,KAAK,aAAa,EAAE,EAAE,IAAI,QAAQ,CAAC,MAAM,UAAU;AAAA,QACzD,IAAI,SAAS,QAAQ,KAAK,SAAS,GAAG;AAAA,UACpC,MAAM,YAAY,KAAK;AAAA,UACvB,QAAQ,KAAK,aAAa,EAAE,EAAE,GAAG,SAAS;AAAA,UAC1C,MAAM,SAAS,cAAc,IAAI,YAAY,MAAM;AAAA,UACnD,IAAI,WAAW,WAAW;AAAA,YACxB,cAAc,IAAI,YAAY,QAAQ,SAAS,SAAS;AAAA,YACxD,IAAI,SAAS,cAAc,GAAG;AAAA,cAC5B,SAAS,KAAK,CAAC,YAAY,QAAQ,CAAC,CAAC;AAAA,YACvC;AAAA,UACF,EAAO;AAAA,YACL,MAAM,IAAI,MAAM,0BAA0B;AAAA;AAAA,QAE9C;AAAA,OACD;AAAA,IACH;AAAA,IAGA,KAAK,4BAA4B;AAAA,IAKjC,OAAO;AAAA;AAAA,EASA,uBAAuB,CAC9B,mBACkD;AAAA,IAClD,OAAO,qBAAqB,kBAAkB,MAAM,wBAAwB,iBAAiB,CAAC;AAAA;AAAA,EAWvF,UAAU,CACjB,oBACA,oBACA,cACM;AAAA,IACN,MAAM,WAAW,oBAAoB,oBAAoB,YAAY;AAAA,IAGrE,KAAK,4BAA4B;AAAA;AAAA,EAS1B,MAAM,CAAC,cAA4B;AAAA,IAC1C,MAAM,OAAO,YAAY;AAAA,IAGzB,KAAK,4BAA4B;AAAA;AAErC;",
13
+ "debugId": "03421654E7B2D66E64756E2164756E21",
14
14
  "names": []
15
15
  }
@@ -12,7 +12,8 @@
12
12
  *
13
13
  * Strategy:
14
14
  * 1. Try JSON.parse directly (handles complete JSON)
15
- * 2. If that fails, attempt to close open delimiters and re-parse
15
+ * 2. If that fails, scan the object while tracking brackets/strings, then
16
+ * strip trailing incomplete tokens and close any still-open delimiters
16
17
  *
17
18
  * @param text - The (possibly incomplete) JSON string
18
19
  * @returns The parsed partial object, or undefined if text is too incomplete
@@ -1 +1 @@
1
- {"version":3,"file":"parsePartialJson.d.ts","sourceRoot":"","sources":["../../src/json-schema/parsePartialJson.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CA8BlF"}
1
+ {"version":3,"file":"parsePartialJson.d.ts","sourceRoot":"","sources":["../../src/json-schema/parsePartialJson.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CA8BlF"}
@@ -548,7 +548,6 @@ function repairJson(text) {
548
548
  const stack = [];
549
549
  let inString = false;
550
550
  let escaped = false;
551
- let lastSafeEnd = 0;
552
551
  while (i < len) {
553
552
  const ch = text[i];
554
553
  if (escaped) {
@@ -568,7 +567,6 @@ function repairJson(text) {
568
567
  inString = false;
569
568
  result += ch;
570
569
  i++;
571
- lastSafeEnd = result.length;
572
570
  continue;
573
571
  }
574
572
  result += ch;
@@ -596,7 +594,6 @@ function repairJson(text) {
596
594
  stack.pop();
597
595
  result += ch;
598
596
  i++;
599
- lastSafeEnd = result.length;
600
597
  } else {
601
598
  return closeStack(result, stack);
602
599
  }
@@ -606,7 +603,6 @@ function repairJson(text) {
606
603
  stack.pop();
607
604
  result += ch;
608
605
  i++;
609
- lastSafeEnd = result.length;
610
606
  } else {
611
607
  return closeStack(result, stack);
612
608
  }
@@ -671,11 +667,7 @@ function cleanTrailing(text) {
671
667
  return s;
672
668
  }
673
669
  function closeStack(text, stack) {
674
- let result = text;
675
- for (let i = stack.length - 1;i >= 0; i--) {
676
- result += stack[i];
677
- }
678
- return result;
670
+ return text + [...stack].reverse().join("");
679
671
  }
680
672
  // src/vector/TypedArray.ts
681
673
  if (typeof globalThis.Float16Array === "undefined") {
@@ -936,4 +928,4 @@ export {
936
928
  FromSchemaDefaultOptions
937
929
  };
938
930
 
939
- //# debugId=019AD218BA631A3064756E2164756E21
931
+ //# debugId=3151F1BBE117DDD664756E2164756E21
@@ -5,14 +5,14 @@
5
5
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type {\n FromExtendedSchema,\n FromExtendedSchemaOptions,\n FromSchemaOptions,\n} from \"@sroussey/json-schema-to-ts\";\nimport type { JsonSchema, JsonSchemaCustomProps } from \"./JsonSchema\";\n\nexport { FromSchemaOptions };\n\n/**\n * Removes the [$JSONSchema] symbol property from a type\n * This is needed because json-schema-to-ts adds this property which cannot be serialized\n */\nexport type StripJSONSchema<T> = T extends object\n ? {\n [K in keyof T as K extends symbol ? never : K]: T[K];\n }\n : T;\n\nexport const FromSchemaDefaultOptions = {\n parseNotKeyword: true,\n parseIfThenElseKeywords: true,\n keepDefaultedPropertiesOptional: true,\n references: false,\n deserialize: false,\n} as const satisfies FromSchemaOptions;\n\nexport type FromSchema<\n SCHEMA extends JsonSchema<EXTENSION>,\n OPTIONS extends FromExtendedSchemaOptions<EXTENSION> = typeof FromSchemaDefaultOptions,\n EXTENSION extends JsonSchemaCustomProps = JsonSchemaCustomProps,\n> = StripJSONSchema<FromExtendedSchema<EXTENSION, SCHEMA, OPTIONS>>;\n\n/**\n * IncludeProps - Returns a new schema with only the specified properties\n *\n * This is a schema transformer that returns a new schema object.\n * Use with FromSchema like: FromSchema<IncludeProps<typeof schema, typeof [\"prop1\", \"prop2\"]>>\n *\n * @template Schema - The JSON schema object (with 'as const')\n * @template Keys - Readonly array type of property keys to include (use typeof [\"key1\", \"key2\"] as const)\n *\n * @example\n * const schema = {\n * type: \"object\",\n * properties: {\n * name: { type: \"string\" },\n * age: { type: \"number\" },\n * email: { type: \"string\" }\n * },\n * required: [\"name\"],\n * additionalProperties: false\n * } as const;\n *\n * type Filtered = FromSchema<IncludeProps<typeof schema, typeof [\"name\", \"age\"]>>;\n * // => { name: string, age?: number }\n */\nexport type IncludeProps<\n Schema extends { readonly type: \"object\"; readonly properties: Record<string, unknown> },\n Keys extends readonly (keyof Schema[\"properties\"])[],\n> = Omit<Schema, \"properties\" | \"required\"> & {\n readonly properties: {\n readonly [K in Extract<keyof Schema[\"properties\"], Keys[number]>]: Schema[\"properties\"][K];\n };\n} & (Schema extends { readonly required: readonly (infer R extends string)[] }\n ? { readonly required: readonly Extract<R, Keys[number]>[] }\n : {});\n\n/**\n * ExcludeProps - Returns a new schema without the specified properties\n *\n * This is a schema transformer that returns a new schema object.\n * Use with FromSchema like: FromSchema<ExcludeProps<typeof schema, typeof [\"prop1\", \"prop2\"]>>\n *\n * @template Schema - The JSON schema object (with 'as const')\n * @template Keys - Readonly array type of property keys to exclude (use typeof [\"key1\", \"key2\"] as const)\n *\n * @example\n * const schema = {\n * type: \"object\",\n * properties: {\n * name: { type: \"string\" },\n * age: { type: \"number\" },\n * email: { type: \"string\" }\n * },\n * required: [\"name\"],\n * additionalProperties: false\n * } as const;\n *\n * type Filtered = FromSchema<ExcludeProps<typeof schema, typeof [\"email\"]>>;\n * // => { name: string, age?: number }\n */\nexport type ExcludeProps<\n Schema extends { readonly type: \"object\"; readonly properties: Record<string, unknown> },\n Keys extends readonly (keyof Schema[\"properties\"])[],\n> = Omit<Schema, \"properties\" | \"required\"> & {\n readonly properties: {\n readonly [K in Exclude<keyof Schema[\"properties\"], Keys[number]>]: Schema[\"properties\"][K];\n };\n} & (Schema extends { readonly required: readonly (infer R extends string)[] }\n ? { readonly required: readonly Exclude<R, Keys[number]>[] }\n : {});\n",
6
6
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Semantic Compatibility Utilities for Task Graph Dataflows\n *\n * In this project, task graphs have connections between tasks called dataflows.\n * These dataflows have different kinds of compatibility checks:\n *\n * **Static Compatibility:**\n * Static rules help decide if an edge should be connected at all. A connection\n * is statically compatible if:\n * - The source and target are the same exact type\n * - The source connects to the equivalent of \"any\" (target accepts anything)\n * - The source type is acceptable to the target (e.g., a string to something\n * that accepts oneOf[string[], string])\n *\n * **Runtime Compatibility:**\n * Assuming the connection is allowed at design time (passes static check),\n * runtime rules determine if they are compatible during execution.\n *\n * Currently, there is one runtime compatibility check:\n * - If both input and output schemas have 'format' annotations attached,\n * the format annotation has the format /\\w+(:\\w+)?/ where the first part\n * is the \"name\" and if alone matches any other with the same \"name\".\n * If there is a second part, then that narrows the type.\n * - Format checks apply to all types (strings, arrays, etc.), not just strings\n * - A schema with format can connect to a schema with no format (source has format, target doesn't)\n * - A schema with no format cannot connect to a schema with format (source doesn't have format, target does)\n *\n * Example: In the AI package, 'format':'model' and 'format': 'model:EmbeddingTask'\n * are used on string types. An input with property `model` and 'format':'model'\n * connects to a target with property `model` and 'format':'model:EmbeddingTask' --\n * this compatibility is called \"runtime\". It first passes the static check as\n * compatible and then notices a difference in format runtime.\n *\n * Format is also used on array types, e.g., 'format':'Float64Array' on arrays\n * containing Float64 numbers.\n *\n * Only connections that pass the runtime check will pass data at runtime.\n */\n\nimport type { JsonSchema } from \"./JsonSchema\";\n\n/**\n * Checks if two format strings are compatible.\n * Format: /\\w+(:\\w+)?/ where first part is the \"name\" and optional second part narrows the type.\n * - Same name without narrowing: static compatible\n * - Source name matches target narrowed name: runtime compatible\n * - Different names or incompatible narrowing: incompatible\n */\nfunction areFormatStringsCompatible(\n sourceFormat: string,\n targetFormat: string\n): \"static\" | \"runtime\" | \"incompatible\" {\n // Allow letters (must start), numbers, underscore, and dash; e.g., my-type:another_type\n const formatPattern = /^[a-zA-Z][a-zA-Z0-9_-]*(?::[a-zA-Z][a-zA-Z0-9_-]*)?$/;\n if (!formatPattern.test(sourceFormat) || !formatPattern.test(targetFormat)) {\n return \"incompatible\";\n }\n\n const [sourceName, sourceNarrow] = sourceFormat.split(\":\");\n const [targetName, targetNarrow] = targetFormat.split(\":\");\n\n // Different base names are incompatible\n if (sourceName !== targetName) {\n return \"incompatible\";\n }\n\n // Same name, no narrowing on either: static compatible\n if (!sourceNarrow && !targetNarrow) {\n return \"static\";\n }\n\n // Source has narrowing, target doesn't: static compatible (source is more specific)\n if (sourceNarrow && !targetNarrow) {\n return \"static\";\n }\n\n // Target has narrowing, source doesn't: runtime compatible (target is more specific)\n if (!sourceNarrow && targetNarrow) {\n return \"runtime\";\n }\n\n // Both have narrowing: must match exactly for static, otherwise incompatible\n if (sourceNarrow === targetNarrow) {\n return \"static\";\n }\n\n return \"incompatible\";\n}\n\n/**\n * Checks if a source type is statically compatible with a target type.\n * Handles cases like string to oneOf[string[], string] or string to any.\n */\nfunction isTypeStaticallyCompatible(sourceType: unknown, targetType: unknown): boolean {\n // Target accepts any type (no type constraint)\n if (!targetType) {\n return true;\n }\n\n // Source has no type constraint\n if (!sourceType) {\n return false;\n }\n\n // Convert to arrays for comparison\n const sourceTypes = Array.isArray(sourceType) ? sourceType : [sourceType];\n const targetTypes = Array.isArray(targetType) ? targetType : [targetType];\n\n // Check if any source type matches any target type\n return sourceTypes.some((st) => targetTypes.includes(st as any));\n}\n\n/**\n * Merges allOf schemas into a single schema representing their intersection.\n * For example: allOf: [{ type: \"string\", format: \"model\" }, { type: \"string\" }]\n * becomes: { type: \"string\", format: \"model\" }\n */\nfunction mergeAllOfSchemas(schemas: JsonSchema[]): JsonSchema | null {\n if (schemas.length === 0) return null;\n if (schemas.length === 1) return schemas[0] as JsonSchema;\n\n let merged: Record<string, unknown> = {};\n\n for (const schema of schemas) {\n if (typeof schema === \"boolean\") {\n if (schema === false) return false; // false in allOf makes the whole thing false\n // true in allOf doesn't add constraints, so we can skip it\n continue;\n }\n\n // At this point, schema is an object\n const schemaObj = schema as Record<string, unknown>;\n\n // Merge type\n if (schemaObj.type !== undefined) {\n if (merged.type === undefined) {\n merged.type = schemaObj.type;\n } else if (merged.type !== schemaObj.type) {\n // Types must be compatible - if they're different primitives, it's incompatible\n const mergedTypes = Array.isArray(merged.type) ? merged.type : [merged.type];\n const schemaTypes = Array.isArray(schemaObj.type) ? schemaObj.type : [schemaObj.type];\n const commonTypes = mergedTypes.filter((t: unknown) => schemaTypes.includes(t));\n if (commonTypes.length === 0) {\n return false; // Incompatible types\n }\n merged.type = commonTypes.length === 1 ? commonTypes[0] : commonTypes;\n }\n }\n\n // Merge format - use the most specific one (the one with narrowing if any)\n const schemaFormat = schemaObj.format as string | undefined;\n const mergedFormat = merged.format as string | undefined;\n if (schemaFormat) {\n if (!mergedFormat) {\n merged.format = schemaFormat;\n } else {\n // Both have formats - check if they're compatible\n const formatCompat = areFormatStringsCompatible(mergedFormat, schemaFormat);\n if (formatCompat === \"incompatible\") {\n return false; // Incompatible formats\n }\n // Use the more specific format (the one with narrowing, or either if both same)\n const mergedHasNarrow = mergedFormat.includes(\":\");\n const schemaHasNarrow = schemaFormat.includes(\":\");\n if (schemaHasNarrow && !mergedHasNarrow) {\n merged.format = schemaFormat;\n } else if (!schemaHasNarrow && mergedHasNarrow) {\n // Keep merged format (it's more specific)\n } else if (mergedFormat !== schemaFormat) {\n // Both have narrowing and they're different - should be caught by areFormatStringsCompatible\n return false;\n }\n }\n }\n\n // Merge properties for objects\n if (schemaObj.properties && typeof schemaObj.properties === \"object\") {\n if (!merged.properties) {\n merged.properties = {};\n }\n const mergedProps = merged.properties as Record<string, JsonSchema>;\n const schemaProps = schemaObj.properties as Record<string, JsonSchema>;\n for (const [key, value] of Object.entries(schemaProps)) {\n if (mergedProps[key]) {\n // Recursively merge nested schemas\n const nestedMerged = mergeAllOfSchemas([mergedProps[key], value]);\n if (nestedMerged === null || nestedMerged === false) {\n return false;\n }\n mergedProps[key] = nestedMerged as JsonSchema;\n } else {\n mergedProps[key] = value;\n }\n }\n }\n\n // Merge required arrays\n if (schemaObj.required && Array.isArray(schemaObj.required)) {\n if (!merged.required) {\n merged.required = [];\n }\n const mergedRequired = merged.required as string[];\n const schemaRequired = schemaObj.required as string[];\n // Intersection of required arrays\n merged.required = mergedRequired.filter((r) => schemaRequired.includes(r));\n }\n\n // Merge additionalProperties - most restrictive wins\n if (schemaObj.additionalProperties !== undefined) {\n if (merged.additionalProperties === undefined) {\n merged.additionalProperties = schemaObj.additionalProperties;\n } else if (merged.additionalProperties === true && schemaObj.additionalProperties === false) {\n merged.additionalProperties = false; // false is more restrictive\n }\n }\n\n // Merge items for arrays\n if (schemaObj.items !== undefined) {\n if (merged.items === undefined) {\n merged.items = schemaObj.items;\n } else {\n // Recursively merge item schemas\n const mergedItems = mergeAllOfSchemas([\n merged.items as JsonSchema,\n schemaObj.items as JsonSchema,\n ]);\n if (mergedItems === null || mergedItems === false) {\n return false;\n }\n merged.items = mergedItems;\n }\n }\n }\n\n return merged as JsonSchema;\n}\n\n/**\n * Checks if a source schema is compatible with a target schema in a oneOf/anyOf union.\n */\nfunction isCompatibleWithUnion(\n sourceSchema: JsonSchema,\n unionSchemas: JsonSchema[]\n): \"static\" | \"runtime\" | \"incompatible\" {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const unionSchema of unionSchemas) {\n const compatibility = areSemanticallyCompatible(sourceSchema, unionSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n if (hasStatic) return \"static\";\n if (hasRuntime) return \"runtime\";\n return \"incompatible\";\n}\n\n/**\n * Checks if two JSON schemas are semantically compatible.\n * Returns:\n * - \"static\": Compatible at design time, no runtime check needed\n * - \"runtime\": Compatible at design time, but needs runtime semantic check\n * - \"incompatible\": Not compatible\n */\nexport function areSemanticallyCompatible(\n sourceSchema: JsonSchema,\n targetSchema: JsonSchema\n): \"static\" | \"runtime\" | \"incompatible\" {\n // Handle undefined schemas (non-existent ports)\n if (sourceSchema === undefined || targetSchema === undefined) {\n return \"incompatible\";\n }\n\n // Handle boolean schemas\n if (typeof targetSchema === \"boolean\") {\n if (targetSchema === false) return \"incompatible\";\n if (targetSchema === true) return \"static\"; // target accepts anything\n return \"incompatible\";\n }\n\n if (typeof sourceSchema === \"boolean\") {\n if (sourceSchema === false) return \"incompatible\";\n // sourceSchema === true means source can be anything, which is compatible with any target, but may not be at runtime\n if (sourceSchema === true) return \"runtime\";\n }\n\n // Handle allOf in source (intersection types - merge all schemas first)\n if (sourceSchema.allOf && Array.isArray(sourceSchema.allOf)) {\n const mergedSchema = mergeAllOfSchemas(sourceSchema.allOf);\n if (mergedSchema === null || mergedSchema === false) {\n return \"incompatible\";\n }\n // Check compatibility of the merged schema against the target\n return areSemanticallyCompatible(mergedSchema, targetSchema);\n }\n\n // Check type compatibility first\n const sourceType = sourceSchema.type;\n const targetType = targetSchema.type;\n\n // Handle oneOf/anyOf in source first\n if (sourceSchema.oneOf && Array.isArray(sourceSchema.oneOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const sourceOption of sourceSchema.oneOf) {\n const compatibility = areSemanticallyCompatible(sourceOption as JsonSchema, targetSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n // If any option requires runtime check, the whole thing requires runtime check\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n if (sourceSchema.anyOf && Array.isArray(sourceSchema.anyOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const sourceOption of sourceSchema.anyOf) {\n const compatibility = areSemanticallyCompatible(sourceOption as JsonSchema, targetSchema);\n if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n // If any option requires runtime check, the whole thing requires runtime check\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n // Handle oneOf/anyOf in target (e.g., oneOf[string[], string])\n if (targetSchema.oneOf && Array.isArray(targetSchema.oneOf)) {\n return isCompatibleWithUnion(sourceSchema, targetSchema.oneOf);\n }\n\n if (targetSchema.anyOf && Array.isArray(targetSchema.anyOf)) {\n return isCompatibleWithUnion(sourceSchema, targetSchema.anyOf);\n }\n\n // Handle allOf in target (intersection types - source must be compatible with all)\n if (targetSchema.allOf && Array.isArray(targetSchema.allOf)) {\n let hasStatic = false;\n let hasRuntime = false;\n\n for (const allOfSchema of targetSchema.allOf) {\n const compatibility = areSemanticallyCompatible(sourceSchema, allOfSchema as JsonSchema);\n if (compatibility === \"incompatible\") {\n return \"incompatible\";\n } else if (compatibility === \"static\") {\n hasStatic = true;\n } else if (compatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n\n if (hasRuntime) return \"runtime\";\n if (hasStatic) return \"static\";\n return \"incompatible\";\n }\n\n // Handle object types - check if properties are compatible\n if (sourceType === \"object\" && targetType === \"object\") {\n const sourceProperties = sourceSchema.properties;\n const targetProperties = targetSchema.properties;\n\n // If target has no properties constraint, it accepts any object\n if (!targetProperties) {\n return \"static\";\n }\n\n // If source has no properties but target does, check if target allows additional properties\n if (!sourceProperties) {\n // If target doesn't allow additional properties, incompatible\n if (targetSchema.additionalProperties === false) {\n return \"incompatible\";\n }\n // Otherwise, source (any object) is compatible with target that allows additional properties\n return \"static\";\n }\n\n // Check if all required target properties are present and compatible in source\n const targetRequired = targetSchema.required || [];\n let hasRuntime = false;\n\n for (const propName of targetRequired) {\n const targetProp = (targetProperties as Record<string, JsonSchema>)?.[propName];\n const sourceProp = (sourceProperties as Record<string, JsonSchema>)?.[propName];\n\n // If target requires a property that source doesn't have, incompatible\n if (!sourceProp) {\n return \"incompatible\";\n }\n\n // Check compatibility of the property\n if (targetProp) {\n const propCompatibility = areSemanticallyCompatible(sourceProp, targetProp);\n if (propCompatibility === \"incompatible\") {\n return \"incompatible\";\n } else if (propCompatibility === \"runtime\") {\n hasRuntime = true;\n }\n }\n }\n\n // Check if target allows additional properties\n if (targetSchema.additionalProperties === false) {\n // Target doesn't allow additional properties, so source can't have extra properties\n const sourcePropNames = Object.keys(sourceProperties as Record<string, JsonSchema>);\n const targetPropNames = Object.keys(targetProperties as Record<string, JsonSchema>);\n const extraProps = sourcePropNames.filter((name) => !targetPropNames.includes(name));\n if (extraProps.length > 0) {\n return \"incompatible\";\n }\n }\n\n if (hasRuntime) return \"runtime\";\n return \"static\";\n }\n\n // Handle array types - check compatibility of array items and array format\n if (sourceType === \"array\" && targetType === \"array\") {\n // First check format on the array schema itself (e.g., format: \"Float64Array\")\n const sourceFormat = (sourceSchema as any)?.format;\n const targetFormat = (targetSchema as any)?.format;\n\n let formatCompatibility: \"static\" | \"runtime\" | \"incompatible\" | null = null;\n\n // Both have format: check compatibility using prefix matching\n if (sourceFormat && targetFormat) {\n formatCompatibility = areFormatStringsCompatible(sourceFormat, targetFormat);\n // If formats are incompatible, the arrays are incompatible\n if (formatCompatibility === \"incompatible\") {\n return \"incompatible\";\n }\n }\n\n // Source has format, target doesn't: static compatible (source is more specific)\n if (sourceFormat && !targetFormat) {\n return \"static\";\n }\n\n // Source doesn't have format, target does: incompatible (target requires format)\n if (!sourceFormat && targetFormat) {\n return \"incompatible\";\n }\n\n const sourceItems = sourceSchema.items;\n const targetItems = targetSchema.items;\n\n // If both have items schemas, recursively check compatibility\n if (\n sourceItems &&\n typeof sourceItems === \"object\" &&\n !Array.isArray(sourceItems) &&\n targetItems &&\n typeof targetItems === \"object\" &&\n !Array.isArray(targetItems)\n ) {\n const itemsCompatibility = areSemanticallyCompatible(\n sourceItems as JsonSchema,\n targetItems as JsonSchema\n );\n // If format requires runtime check, return runtime (more restrictive)\n if (formatCompatibility === \"runtime\") {\n return \"runtime\";\n }\n return itemsCompatibility;\n }\n\n // If target accepts any array items, it's statically compatible\n if (!targetItems) {\n return \"static\";\n }\n\n // If source has no items but target does, incompatible\n if (!sourceItems) {\n return \"incompatible\";\n }\n\n // If target items is an array (tuple), check if source is compatible with any item\n if (Array.isArray(targetItems)) {\n return isCompatibleWithUnion(sourceItems as JsonSchema, targetItems as JsonSchema[]);\n }\n\n // Fallback to static if we can't determine\n return \"static\";\n }\n\n // If source has no type constraint, it can be anything (compatible with any target)\n // But we need to check if target has constraints that might require runtime checks\n if (!sourceType) {\n // Source accepts any type, but target might have format requiring runtime check\n const targetFormat = (targetSchema as any)?.format;\n if (targetFormat) {\n return \"runtime\";\n }\n return \"static\";\n }\n\n // Check if types are statically compatible\n if (!targetType) {\n // Target has no type constraint, it accepts anything\n // But we still need to check format - if target requires format, source must have it\n const targetFormat = (targetSchema as any)?.format;\n if (targetFormat) {\n // Target requires format, check if source has it\n const sourceFormat = (sourceSchema as any)?.format;\n if (!sourceFormat) {\n return \"incompatible\";\n }\n // Both have format, check compatibility\n return areFormatStringsCompatible(sourceFormat, targetFormat);\n }\n return \"static\";\n }\n\n if (!isTypeStaticallyCompatible(sourceType, targetType)) {\n return \"incompatible\";\n }\n\n // If types are compatible, check format compatibility\n // Format checks apply to all types, not just strings\n // Access format field directly (it's a standard JSON Schema field)\n const sourceFormat = (sourceSchema as any)?.format;\n const targetFormat = (targetSchema as any)?.format;\n\n // Both have format: check compatibility using prefix matching\n if (sourceFormat && targetFormat) {\n return areFormatStringsCompatible(sourceFormat, targetFormat);\n }\n\n // Source has format, target doesn't: static compatible (source is more specific)\n if (sourceFormat && !targetFormat) {\n return \"static\";\n }\n\n // Source doesn't have format, target does: incompatible (target requires format)\n if (!sourceFormat && targetFormat) {\n return \"incompatible\";\n }\n\n // Neither has format: static compatible\n return \"static\";\n}\n\n/**\n * Checks if two object schemas are semantically compatible.\n * This is a helper function for checking object-level schema compatibility.\n */\nexport function areObjectSchemasSemanticallyCompatible(\n sourceSchema: JsonSchema,\n targetSchema: JsonSchema\n): \"static\" | \"runtime\" | \"incompatible\" {\n return areSemanticallyCompatible(sourceSchema, targetSchema);\n}\n",
7
7
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { compileSchema } from \"@sroussey/json-schema-library\";\nexport type { SchemaNode } from \"@sroussey/json-schema-library\";\n\nimport type { DataPortSchema } from \"./DataPortSchema\";\nimport type { JsonSchema } from \"./JsonSchema\";\n\n// ========================================================================\n// Schema Validation Types\n// ========================================================================\n\nexport interface SchemaValidationError {\n readonly path: string;\n readonly message: string;\n}\n\nexport interface SchemaValidationResult {\n readonly valid: boolean;\n readonly errors: readonly SchemaValidationError[];\n}\n\nconst VALID_RESULT: SchemaValidationResult = Object.freeze({\n valid: true,\n errors: Object.freeze([] as SchemaValidationError[]),\n});\n\n/**\n * Pattern for format annotations used in dataflow compatibility checking.\n * Format: /\\w+(:\\w+)?/ where first part is the \"name\" and optional second part narrows the type.\n * Reused from SchemaUtils.ts areFormatStringsCompatible().\n */\nconst FORMAT_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*(?::[a-zA-Z][a-zA-Z0-9_-]*)?$/;\n\nconst VALID_JSON_SCHEMA_TYPES = new Set([\n \"string\",\n \"number\",\n \"integer\",\n \"boolean\",\n \"object\",\n \"array\",\n \"null\",\n]);\n\n// ========================================================================\n// Schema Structure Validation\n// ========================================================================\n\n/**\n * Validates that a schema is a well-formed DataPortSchema.\n *\n * A DataPortSchema must be either a boolean or an object with `type: \"object\"`\n * and a `properties` record where no property value is a boolean.\n */\nexport function validateDataPortSchema(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n const errors: SchemaValidationError[] = [];\n\n if (typeof schema !== \"object\" || schema === null) {\n return { valid: false, errors: [{ path: \"\", message: \"Schema must be a boolean or object\" }] };\n }\n\n if (schema.type !== \"object\") {\n errors.push({\n path: \"/type\",\n message: `DataPortSchema must have type \"object\", got \"${String(schema.type)}\"`,\n });\n }\n\n if (\n !schema.properties ||\n typeof schema.properties !== \"object\" ||\n Array.isArray(schema.properties)\n ) {\n errors.push({\n path: \"/properties\",\n message: \"DataPortSchema must have a properties object\",\n });\n } else {\n for (const [key, value] of Object.entries(schema.properties)) {\n if (typeof value === \"boolean\") {\n errors.push({\n path: `/properties/${key}`,\n message: `Property \"${key}\" must not be a boolean schema`,\n });\n continue;\n }\n collectJsonSchemaErrors(value as JsonSchema, `/properties/${key}`, errors);\n }\n }\n\n return errors.length === 0 ? VALID_RESULT : { valid: false, errors };\n}\n\n/**\n * Validates structural correctness of a JsonSchema value (property, items, etc.).\n * Checks that `type` (if present) is a known JSON Schema type.\n */\nfunction collectJsonSchemaErrors(\n schema: JsonSchema,\n path: string,\n errors: SchemaValidationError[]\n): void {\n if (typeof schema === \"boolean\") {\n return;\n }\n\n if (schema === null || schema === undefined) {\n errors.push({ path, message: `Expected schema object, got ${typeof schema}` });\n return;\n }\n\n if (typeof schema !== \"object\") {\n errors.push({ path, message: `Expected schema object, got ${typeof schema}` });\n return;\n }\n\n // Validate type field\n if (schema.type !== undefined) {\n if (typeof schema.type === \"string\") {\n if (!VALID_JSON_SCHEMA_TYPES.has(schema.type)) {\n errors.push({\n path: `${path}/type`,\n message: `Unknown JSON Schema type \"${schema.type}\"`,\n });\n }\n } else if (Array.isArray(schema.type)) {\n for (const t of schema.type) {\n if (!VALID_JSON_SCHEMA_TYPES.has(t as string)) {\n errors.push({\n path: `${path}/type`,\n message: `Unknown JSON Schema type \"${String(t)}\" in type array`,\n });\n }\n }\n }\n }\n\n // Recurse into nested schemas\n if (schema.properties && typeof schema.properties === \"object\") {\n for (const [key, value] of Object.entries(schema.properties)) {\n if (typeof value === \"boolean\") {\n continue; // boolean schemas are valid in nested JSON Schema\n }\n collectJsonSchemaErrors(value as JsonSchema, `${path}/properties/${key}`, errors);\n }\n }\n\n if (schema.items && typeof schema.items === \"object\" && !Array.isArray(schema.items)) {\n collectJsonSchemaErrors(schema.items as JsonSchema, `${path}/items`, errors);\n }\n\n if (Array.isArray(schema.items)) {\n for (let i = 0; i < schema.items.length; i++) {\n collectJsonSchemaErrors(schema.items[i] as JsonSchema, `${path}/items/${i}`, errors);\n }\n }\n\n for (const keyword of [\"oneOf\", \"anyOf\", \"allOf\"] as const) {\n const arr = (schema as Record<string, unknown>)[keyword];\n if (Array.isArray(arr)) {\n for (let i = 0; i < arr.length; i++) {\n collectJsonSchemaErrors(arr[i] as JsonSchema, `${path}/${keyword}/${i}`, errors);\n }\n }\n }\n}\n\n// ========================================================================\n// Format Annotation Validation\n// ========================================================================\n\n/**\n * Validates that all `format` annotations in a schema match the expected pattern.\n *\n * Format annotations use the pattern `/^[a-zA-Z][a-zA-Z0-9_-]*(:[a-zA-Z][a-zA-Z0-9_-]*)?$/`\n * (e.g., `\"model\"`, `\"model:EmbeddingTask\"`, `\"storage:tabular\"`).\n *\n * Standard JSON Schema formats (e.g., `\"date-time\"`, `\"uri\"`, `\"email\"`) also pass\n * since they match the pattern.\n */\nexport function validateFormatAnnotations(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n if (typeof schema !== \"object\" || schema === null || Array.isArray(schema)) {\n return {\n valid: false,\n errors: [{ path: \"\", message: \"Schema must be a JSON Schema object or boolean\" }],\n };\n }\n\n const errors: SchemaValidationError[] = [];\n collectFormatErrors(schema as JsonSchema, \"\", errors);\n return errors.length === 0 ? VALID_RESULT : { valid: false, errors };\n}\n\nfunction collectFormatErrors(\n schema: JsonSchema,\n path: string,\n errors: SchemaValidationError[]\n): void {\n if (typeof schema !== \"object\" || schema === null) {\n return;\n }\n\n // Check format on this schema node\n const format = (schema as Record<string, unknown>).format;\n if (typeof format === \"string\" && !FORMAT_PATTERN.test(format)) {\n errors.push({\n path: `${path}/format`,\n message: `Invalid format annotation \"${format}\" — must match pattern ${FORMAT_PATTERN.source}`,\n });\n }\n\n // Recurse into properties\n if (schema.properties && typeof schema.properties === \"object\") {\n for (const [key, value] of Object.entries(schema.properties)) {\n collectFormatErrors(value as JsonSchema, `${path}/properties/${key}`, errors);\n }\n }\n\n // Recurse into items\n if (schema.items && typeof schema.items === \"object\" && !Array.isArray(schema.items)) {\n collectFormatErrors(schema.items as JsonSchema, `${path}/items`, errors);\n }\n\n if (Array.isArray(schema.items)) {\n for (let i = 0; i < schema.items.length; i++) {\n collectFormatErrors(schema.items[i] as JsonSchema, `${path}/items/${i}`, errors);\n }\n }\n\n // Recurse into oneOf/anyOf/allOf\n for (const keyword of [\"oneOf\", \"anyOf\", \"allOf\"] as const) {\n const arr = (schema as Record<string, unknown>)[keyword];\n if (Array.isArray(arr)) {\n for (let i = 0; i < arr.length; i++) {\n collectFormatErrors(arr[i] as JsonSchema, `${path}/${keyword}/${i}`, errors);\n }\n }\n }\n}\n\n// ========================================================================\n// Combined Validation\n// ========================================================================\n\n/**\n * Validates a DataPortSchema for both structural correctness and valid format annotations.\n * Convenience function combining {@link validateDataPortSchema} and {@link validateFormatAnnotations}.\n */\nexport function validateSchema(schema: DataPortSchema): SchemaValidationResult {\n if (typeof schema === \"boolean\") {\n return VALID_RESULT;\n }\n\n const structureResult = validateDataPortSchema(schema);\n const formatResult = validateFormatAnnotations(schema);\n\n const allErrors = [...structureResult.errors, ...formatResult.errors];\n return allErrors.length === 0 ? VALID_RESULT : { valid: false, errors: allErrors };\n}\n",
8
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Attempts to parse a potentially incomplete JSON string into a partial object.\n *\n * Useful for progressive rendering of streamed JSON output from AI providers.\n * Each call returns the most complete object that can be parsed from the\n * accumulated text so far.\n *\n * Strategy:\n * 1. Try JSON.parse directly (handles complete JSON)\n * 2. If that fails, attempt to close open delimiters and re-parse\n *\n * @param text - The (possibly incomplete) JSON string\n * @returns The parsed partial object, or undefined if text is too incomplete\n */\nexport function parsePartialJson(text: string): Record<string, unknown> | undefined {\n const trimmed = text.trim();\n if (!trimmed) return undefined;\n\n // Fast path: try parsing as-is\n try {\n const result = JSON.parse(trimmed);\n if (typeof result === \"object\" && result !== null && !Array.isArray(result)) {\n return result as Record<string, unknown>;\n }\n return undefined;\n } catch {\n // Fall through to repair logic\n }\n\n // Must start with '{' for an object\n if (trimmed[0] !== \"{\") return undefined;\n\n const repaired = repairJson(trimmed);\n if (repaired === undefined) return undefined;\n\n try {\n const result = JSON.parse(repaired);\n if (typeof result === \"object\" && result !== null && !Array.isArray(result)) {\n return result as Record<string, unknown>;\n }\n return undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Attempts to repair incomplete JSON by closing open structures.\n * Returns the repaired string, or undefined if the text is too malformed.\n */\nfunction repairJson(text: string): string | undefined {\n let result = \"\";\n let i = 0;\n const len = text.length;\n\n // Track open delimiters for closing\n const stack: string[] = [];\n let inString = false;\n let escaped = false;\n // Track position of last structurally complete point\n let lastSafeEnd = 0;\n\n while (i < len) {\n const ch = text[i];\n\n if (escaped) {\n escaped = false;\n result += ch;\n i++;\n continue;\n }\n\n if (ch === \"\\\\\") {\n escaped = true;\n result += ch;\n i++;\n continue;\n }\n\n if (inString) {\n if (ch === '\"') {\n inString = false;\n result += ch;\n i++;\n lastSafeEnd = result.length;\n continue;\n }\n result += ch;\n i++;\n continue;\n }\n\n // Not in a string\n switch (ch) {\n case '\"':\n inString = true;\n result += ch;\n i++;\n break;\n case \"{\":\n stack.push(\"}\");\n result += ch;\n i++;\n break;\n case \"[\":\n stack.push(\"]\");\n result += ch;\n i++;\n break;\n case \"}\":\n if (stack.length > 0 && stack[stack.length - 1] === \"}\") {\n stack.pop();\n result += ch;\n i++;\n lastSafeEnd = result.length;\n } else {\n // Mismatched brace, truncate here\n return closeStack(result, stack);\n }\n break;\n case \"]\":\n if (stack.length > 0 && stack[stack.length - 1] === \"]\") {\n stack.pop();\n result += ch;\n i++;\n lastSafeEnd = result.length;\n } else {\n return closeStack(result, stack);\n }\n break;\n default:\n result += ch;\n i++;\n break;\n }\n }\n\n // Reached the end with unclosed structures\n if (inString) {\n // Close the unclosed string, then close the stack\n result += '\"';\n }\n\n if (stack.length === 0) {\n // Already valid\n return result;\n }\n\n return closeStack(cleanTrailing(result), stack);\n}\n\n/**\n * Removes trailing incomplete tokens that would prevent JSON parsing.\n * Strips trailing commas, colons, and incomplete key/value fragments.\n */\nfunction cleanTrailing(text: string): string {\n // Remove trailing whitespace\n let s = text.trimEnd();\n\n // Repeatedly strip trailing problematic characters\n let changed = true;\n while (changed) {\n changed = false;\n const trimmed = s.trimEnd();\n\n // Trailing comma\n if (trimmed.endsWith(\",\")) {\n s = trimmed.slice(0, -1);\n changed = true;\n continue;\n }\n\n // Trailing colon (incomplete key-value pair)\n if (trimmed.endsWith(\":\")) {\n // Remove the colon and the preceding key\n const withoutColon = trimmed.slice(0, -1).trimEnd();\n // Remove the key (should be a string ending with \")\n if (withoutColon.endsWith('\"')) {\n const keyStart = withoutColon.lastIndexOf('\"', withoutColon.length - 2);\n if (keyStart >= 0) {\n // Also remove any preceding comma\n let before = withoutColon.slice(0, keyStart).trimEnd();\n if (before.endsWith(\",\")) {\n before = before.slice(0, -1);\n }\n s = before;\n changed = true;\n continue;\n }\n }\n // Can't find the key, just remove the colon\n s = withoutColon;\n changed = true;\n continue;\n }\n\n // Trailing incomplete value after a colon (e.g., `\"key\": tru` or `\"key\": 12`)\n // Check if there's an incomplete bare token at the end\n const bareTokenMatch = trimmed.match(\n /,\\s*\"[^\"]*\"\\s*:\\s*(?:tru|fal|nul|true|false|null|[\\d.eE+-]+)$/\n );\n if (bareTokenMatch) {\n // Check if the bare value is complete\n const valueStr = trimmed.slice(trimmed.lastIndexOf(\":\") + 1).trim();\n try {\n JSON.parse(valueStr);\n // Value is complete, keep it\n } catch {\n // Value is incomplete, remove the whole key-value pair\n s = trimmed.slice(0, bareTokenMatch.index!).trimEnd();\n if (s.endsWith(\",\")) s = s.slice(0, -1);\n changed = true;\n continue;\n }\n }\n }\n\n return s;\n}\n\n/**\n * Closes all open delimiters in the stack.\n */\nfunction closeStack(text: string, stack: string[]): string {\n let result = text;\n for (let i = stack.length - 1; i >= 0; i--) {\n result += stack[i];\n }\n return result;\n}\n",
9
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { FromSchema, FromSchemaDefaultOptions, FromSchemaOptions } from \"../json-schema/FromSchema\";\nimport { JsonSchema } from \"../json-schema/JsonSchema\";\n\n/**\n * Polyfill Float16Array for runtimes that don't support it yet (Node < 24).\n * Float16Array is referenced at module-load time in the schema options below,\n * so the polyfill must run before any usage.\n */\nif (typeof globalThis.Float16Array === \"undefined\") {\n // @ts-expect-error — intentional minimal shim\n globalThis.Float16Array = class Float16Array extends Uint16Array {\n static override readonly BYTES_PER_ELEMENT = 2;\n };\n}\n\n/**\n * Supported typed array types\n * - Float16Array: 16-bit floating point (medium precision)\n * - Float32Array: Standard 32-bit floating point (most common)\n * - Float64Array: 64-bit floating point (high precision)\n * - Int8Array: 8-bit signed integer (binary quantization)\n * - Uint8Array: 8-bit unsigned integer (quantization)\n * - Int16Array: 16-bit signed integer (quantization)\n * - Uint16Array: 16-bit unsigned integer (quantization)\n */\nexport type TypedArray =\n | Float32Array\n | Float16Array\n | Float64Array\n | Int8Array\n | Uint8Array\n | Int16Array\n | Uint16Array;\n\nexport type TypedArrayString =\n | \"TypedArray\"\n | \"TypedArray:Float16Array\"\n | \"TypedArray:Float32Array\"\n | \"TypedArray:Float64Array\"\n | \"TypedArray:Int8Array\"\n | \"TypedArray:Uint8Array\"\n | \"TypedArray:Int16Array\"\n | \"TypedArray:Uint16Array\";\n\nexport function isTypedArray(value: unknown): value is TypedArray {\n return ArrayBuffer.isView(value) && !(value instanceof DataView);\n}\n\n// Type-only value for use in deserialize patterns\nconst TypedArrayType = null as any as TypedArray;\n\nconst TypedArraySchemaOptions = {\n ...FromSchemaDefaultOptions,\n deserialize: [\n {\n pattern: { type: \"array\", format: \"TypedArray:Float64Array\" },\n output: Float64Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Float32Array\" },\n output: Float32Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Float16Array\" },\n output: Float16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Int16Array\" },\n output: Int16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Int8Array\" },\n output: Int8Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Uint8Array\" },\n output: Uint8Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Uint16Array\" },\n output: Uint16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray\" },\n output: TypedArrayType,\n },\n ],\n} as const satisfies FromSchemaOptions;\n\nexport type TypedArraySchemaOptions = typeof TypedArraySchemaOptions;\n\nexport type VectorFromSchema<SCHEMA extends JsonSchema> = FromSchema<\n SCHEMA,\n TypedArraySchemaOptions\n>;\n\nexport const TypedArraySchema = (annotations: Record<string, unknown> = {}) => {\n return {\n type: \"array\",\n format: \"TypedArray\",\n title: \"Typed Array\",\n description: \"A typed array (Float32Array, Int8Array, etc.)\",\n ...annotations,\n } as const satisfies JsonSchema;\n};\n",
8
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Attempts to parse a potentially incomplete JSON string into a partial object.\n *\n * Useful for progressive rendering of streamed JSON output from AI providers.\n * Each call returns the most complete object that can be parsed from the\n * accumulated text so far.\n *\n * Strategy:\n * 1. Try JSON.parse directly (handles complete JSON)\n * 2. If that fails, scan the object while tracking brackets/strings, then\n * strip trailing incomplete tokens and close any still-open delimiters\n *\n * @param text - The (possibly incomplete) JSON string\n * @returns The parsed partial object, or undefined if text is too incomplete\n */\nexport function parsePartialJson(text: string): Record<string, unknown> | undefined {\n const trimmed = text.trim();\n if (!trimmed) return undefined;\n\n // Fast path: try parsing as-is\n try {\n const result = JSON.parse(trimmed);\n if (typeof result === \"object\" && result !== null && !Array.isArray(result)) {\n return result as Record<string, unknown>;\n }\n return undefined;\n } catch {\n // Fall through to repair logic\n }\n\n // Must start with '{' for an object\n if (trimmed[0] !== \"{\") return undefined;\n\n const repaired = repairJson(trimmed);\n if (repaired === undefined) return undefined;\n\n try {\n const result = JSON.parse(repaired);\n if (typeof result === \"object\" && result !== null && !Array.isArray(result)) {\n return result as Record<string, unknown>;\n }\n return undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Attempts to repair incomplete JSON by closing open structures.\n * Returns the repaired string, or undefined if the text is too malformed.\n */\nfunction repairJson(text: string): string | undefined {\n let result = \"\";\n let i = 0;\n const len = text.length;\n\n // Track open delimiters for closing\n const stack: string[] = [];\n let inString = false;\n let escaped = false;\n\n while (i < len) {\n const ch = text[i];\n\n if (escaped) {\n escaped = false;\n result += ch;\n i++;\n continue;\n }\n\n if (ch === \"\\\\\") {\n escaped = true;\n result += ch;\n i++;\n continue;\n }\n\n if (inString) {\n if (ch === '\"') {\n inString = false;\n result += ch;\n i++;\n continue;\n }\n result += ch;\n i++;\n continue;\n }\n\n // Not in a string\n switch (ch) {\n case '\"':\n inString = true;\n result += ch;\n i++;\n break;\n case \"{\":\n stack.push(\"}\");\n result += ch;\n i++;\n break;\n case \"[\":\n stack.push(\"]\");\n result += ch;\n i++;\n break;\n case \"}\":\n if (stack.length > 0 && stack[stack.length - 1] === \"}\") {\n stack.pop();\n result += ch;\n i++;\n } else {\n // Mismatched brace, truncate here\n return closeStack(result, stack);\n }\n break;\n case \"]\":\n if (stack.length > 0 && stack[stack.length - 1] === \"]\") {\n stack.pop();\n result += ch;\n i++;\n } else {\n return closeStack(result, stack);\n }\n break;\n default:\n result += ch;\n i++;\n break;\n }\n }\n\n // Reached the end with unclosed structures\n if (inString) {\n // Close the unclosed string, then close the stack\n result += '\"';\n }\n\n if (stack.length === 0) {\n // Already valid\n return result;\n }\n\n return closeStack(cleanTrailing(result), stack);\n}\n\n/**\n * Removes trailing incomplete tokens that would prevent JSON parsing.\n * Strips trailing commas, colons, and incomplete key/value fragments.\n */\nfunction cleanTrailing(text: string): string {\n // Remove trailing whitespace\n let s = text.trimEnd();\n\n // Repeatedly strip trailing problematic characters\n let changed = true;\n while (changed) {\n changed = false;\n const trimmed = s.trimEnd();\n\n // Trailing comma\n if (trimmed.endsWith(\",\")) {\n s = trimmed.slice(0, -1);\n changed = true;\n continue;\n }\n\n // Trailing colon (incomplete key-value pair)\n if (trimmed.endsWith(\":\")) {\n // Remove the colon and the preceding key\n const withoutColon = trimmed.slice(0, -1).trimEnd();\n // Remove the key (should be a string ending with \")\n if (withoutColon.endsWith('\"')) {\n const keyStart = withoutColon.lastIndexOf('\"', withoutColon.length - 2);\n if (keyStart >= 0) {\n // Also remove any preceding comma\n let before = withoutColon.slice(0, keyStart).trimEnd();\n if (before.endsWith(\",\")) {\n before = before.slice(0, -1);\n }\n s = before;\n changed = true;\n continue;\n }\n }\n // Can't find the key, just remove the colon\n s = withoutColon;\n changed = true;\n continue;\n }\n\n // Trailing incomplete value after a colon (e.g., `\"key\": tru` or `\"key\": 12`)\n // Check if there's an incomplete bare token at the end\n const bareTokenMatch = trimmed.match(\n /,\\s*\"[^\"]*\"\\s*:\\s*(?:tru|fal|nul|true|false|null|[\\d.eE+-]+)$/\n );\n if (bareTokenMatch) {\n // Check if the bare value is complete\n const valueStr = trimmed.slice(trimmed.lastIndexOf(\":\") + 1).trim();\n try {\n JSON.parse(valueStr);\n // Value is complete, keep it\n } catch {\n // Value is incomplete, remove the whole key-value pair\n s = trimmed.slice(0, bareTokenMatch.index!).trimEnd();\n if (s.endsWith(\",\")) s = s.slice(0, -1);\n changed = true;\n continue;\n }\n }\n }\n\n return s;\n}\n\n/**\n * Closes all open delimiters in the stack.\n */\nfunction closeStack(text: string, stack: string[]): string {\n return text + [...stack].reverse().join(\"\");\n}\n",
9
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { FromSchema, FromSchemaDefaultOptions, FromSchemaOptions } from \"../json-schema/FromSchema\";\nimport { JsonSchema } from \"../json-schema/JsonSchema\";\n\n/**\n * Polyfill Float16Array for runtimes that don't support it yet (Node < 24).\n * Float16Array is referenced at module-load time in the schema options below,\n * so the polyfill must run before any usage.\n */\nif (typeof globalThis.Float16Array === \"undefined\") {\n // @ts-expect-error — intentional minimal shim\n globalThis.Float16Array = class Float16Array extends Uint16Array {\n static override readonly BYTES_PER_ELEMENT = 2;\n };\n}\n\n/**\n * Supported typed array types\n * - Float16Array: 16-bit floating point (medium precision)\n * - Float32Array: Standard 32-bit floating point (most common)\n * - Float64Array: 64-bit floating point (high precision)\n * - Int8Array: 8-bit signed integer (binary quantization)\n * - Uint8Array: 8-bit unsigned integer (quantization)\n * - Int16Array: 16-bit signed integer (quantization)\n * - Uint16Array: 16-bit unsigned integer (quantization)\n */\nexport type TypedArray =\n | Float32Array\n | Float16Array\n | Float64Array\n | Int8Array\n | Uint8Array\n | Int16Array\n | Uint16Array;\n\nexport type TypedArrayConstructor =\n | typeof Float16Array\n | typeof Float32Array\n | typeof Float64Array\n | typeof Int8Array\n | typeof Uint8Array\n | typeof Int16Array\n | typeof Uint16Array;\n\nexport type TypedArrayString =\n | \"TypedArray\"\n | \"TypedArray:Float16Array\"\n | \"TypedArray:Float32Array\"\n | \"TypedArray:Float64Array\"\n | \"TypedArray:Int8Array\"\n | \"TypedArray:Uint8Array\"\n | \"TypedArray:Int16Array\"\n | \"TypedArray:Uint16Array\";\n\nexport function isTypedArray(value: unknown): value is TypedArray {\n return ArrayBuffer.isView(value) && !(value instanceof DataView);\n}\n\n// Type-only value for use in deserialize patterns\nconst TypedArrayType = null as any as TypedArray;\n\nconst TypedArraySchemaOptions = {\n ...FromSchemaDefaultOptions,\n deserialize: [\n {\n pattern: { type: \"array\", format: \"TypedArray:Float64Array\" },\n output: Float64Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Float32Array\" },\n output: Float32Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Float16Array\" },\n output: Float16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Int16Array\" },\n output: Int16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Int8Array\" },\n output: Int8Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Uint8Array\" },\n output: Uint8Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray:Uint16Array\" },\n output: Uint16Array,\n },\n {\n pattern: { type: \"array\", format: \"TypedArray\" },\n output: TypedArrayType,\n },\n ],\n} as const satisfies FromSchemaOptions;\n\nexport type TypedArraySchemaOptions = typeof TypedArraySchemaOptions;\n\nexport type VectorFromSchema<SCHEMA extends JsonSchema> = FromSchema<\n SCHEMA,\n TypedArraySchemaOptions\n>;\n\nexport const TypedArraySchema = (annotations: Record<string, unknown> = {}) => {\n return {\n type: \"array\",\n format: \"TypedArray\",\n title: \"Typed Array\",\n description: \"A typed array (Float32Array, Int8Array, etc.)\",\n ...annotations,\n } as const satisfies JsonSchema;\n};\n",
10
10
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { FromSchema } from \"../json-schema/FromSchema\";\nimport { JsonSchema } from \"../json-schema/JsonSchema\";\nimport { TypedArraySchema, TypedArraySchemaOptions } from \"./TypedArray\";\n\nexport const TensorType = {\n FLOAT16: \"float16\",\n FLOAT32: \"float32\",\n FLOAT64: \"float64\",\n INT8: \"int8\",\n UINT8: \"uint8\",\n INT16: \"int16\",\n UINT16: \"uint16\",\n} as const;\n\nexport type TensorType = (typeof TensorType)[keyof typeof TensorType];\n\n/**\n * Tensor schema for representing tensors as arrays of numbers\n * @param annotations - Additional annotations for the schema\n * @returns The tensor schema\n */\nexport const TensorSchema = (annotations: Record<string, unknown> = {}) =>\n ({\n type: \"object\",\n properties: {\n type: {\n type: \"string\",\n enum: Object.values(TensorType),\n title: \"Type\",\n description: \"The type of the tensor\",\n },\n data: TypedArraySchema({\n title: \"Data\",\n description: \"The data of the tensor\",\n }),\n shape: {\n type: \"array\",\n items: { type: \"number\" },\n title: \"Shape\",\n description: \"The shape of the tensor (dimensions)\",\n minItems: 1,\n default: [1],\n },\n normalized: {\n type: \"boolean\",\n title: \"Normalized\",\n description: \"Whether the tensor data is normalized\",\n default: false,\n },\n },\n required: [\"data\"],\n additionalProperties: false,\n ...annotations,\n }) as const satisfies JsonSchema;\n\nexport type Tensor = FromSchema<ReturnType<typeof TensorSchema>, TypedArraySchemaOptions>;\n",
11
11
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TypedArray } from \"./TypedArray\";\n\n/** Width ranking: higher = wider type (more precision). Float64 > Float32 > Float16 > Int16 > Int8. */\nconst WIDTH_RANK: Record<string, number> = {\n Float64Array: 6,\n Float32Array: 5,\n Float16Array: 4,\n Int16Array: 3,\n Uint16Array: 3,\n Int8Array: 2,\n Uint8Array: 2,\n};\n\nfunction getWidthRank(arr: TypedArray): number {\n return WIDTH_RANK[arr.constructor.name] ?? 0;\n}\n\n/**\n * Returns the widest (highest-precision) TypedArray constructor among the given sources.\n * E.g. Int8Array × Float32Array → Float32Array.\n */\nfunction widestConstructor(sources: TypedArray[]): new (len: number) => TypedArray {\n let best = sources[0];\n for (let i = 1; i < sources.length; i++) {\n if (getWidthRank(sources[i]) > getWidthRank(best)) best = sources[i];\n }\n return best.constructor as new (len: number) => TypedArray;\n}\n\n/**\n * Creates a new TypedArray with the widest type among the given sources,\n * filled with the provided values. Use when combining multiple vectors\n * (e.g. a * b) so output precision matches the widest input.\n */\nexport function createTypedArrayFrom(sources: TypedArray[], values: number[]): TypedArray {\n const Ctor = widestConstructor(sources);\n const result = new Ctor(values.length);\n for (let i = 0; i < values.length; i++) result[i] = values[i];\n return result;\n}\n",
12
12
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TypedArray } from \"./TypedArray\";\n\n/**\n * Calculates cosine similarity between two vectors\n * Returns a value between -1 and 1, where 1 means identical direction\n */\nexport function cosineSimilarity(a: TypedArray, b: TypedArray): number {\n if (a.length !== b.length) {\n throw new Error(\"Vectors must have the same length\");\n }\n let dotProduct = 0;\n let normA = 0;\n let normB = 0;\n for (let i = 0; i < a.length; i++) {\n dotProduct += a[i] * b[i];\n normA += a[i] * a[i];\n normB += b[i] * b[i];\n }\n const denominator = Math.sqrt(normA) * Math.sqrt(normB);\n if (denominator === 0) {\n return 0;\n }\n return dotProduct / denominator;\n}\n\n/**\n * Calculates Jaccard similarity between two vectors\n * Uses the formula: sum(min(a[i], b[i])) / sum(max(a[i], b[i]))\n * Returns a value between 0 and 1\n * For negative values, normalizes by finding the global min and shifting to non-negative range\n */\nexport function jaccardSimilarity(a: TypedArray, b: TypedArray): number {\n if (a.length !== b.length) {\n throw new Error(\"Vectors must have the same length\");\n }\n\n // Find global min across both vectors to handle negative values\n let globalMin = a[0];\n for (let i = 0; i < a.length; i++) {\n globalMin = Math.min(globalMin, a[i], b[i]);\n }\n\n // Shift values to non-negative range if needed\n const shift = globalMin < 0 ? -globalMin : 0;\n\n let minSum = 0;\n let maxSum = 0;\n\n for (let i = 0; i < a.length; i++) {\n const shiftedA = a[i] + shift;\n const shiftedB = b[i] + shift;\n minSum += Math.min(shiftedA, shiftedB);\n maxSum += Math.max(shiftedA, shiftedB);\n }\n\n return maxSum === 0 ? 0 : minSum / maxSum;\n}\n\n/**\n * Calculates Hamming distance between two vectors (normalized)\n * Counts the number of positions where vectors differ\n * Returns a value between 0 and 1 (0 = identical, 1 = completely different)\n */\nexport function hammingDistance(a: TypedArray, b: TypedArray): number {\n if (a.length !== b.length) {\n throw new Error(\"Vectors must have the same length\");\n }\n\n let differences = 0;\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n differences++;\n }\n }\n\n return differences / a.length;\n}\n\n/**\n * Calculates Hamming similarity (inverse of distance)\n * Returns a value between 0 and 1 (1 = identical, 0 = completely different)\n */\nexport function hammingSimilarity(a: TypedArray, b: TypedArray): number {\n return 1 - hammingDistance(a, b);\n}\n",
13
13
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { TypedArray } from \"./TypedArray\";\n\n/**\n * Calculates the magnitude (L2 norm) of a vector\n */\nexport function magnitude(arr: TypedArray | number[]): number {\n // @ts-ignore - Vector reduce works but TS doesn't recognize it\n return Math.sqrt(arr.reduce((acc, val) => acc + val * val, 0));\n}\n\n/**\n * Calculates the inner (dot) product of two vectors\n */\nexport function inner(arr1: TypedArray, arr2: TypedArray): number {\n if (arr1.length !== arr2.length) {\n throw new Error(\"Vectors must have the same length to compute inner product.\");\n }\n // @ts-ignore - Vector reduce works but TS doesn't recognize it\n return arr1.reduce((acc, val, i) => acc + val * arr2[i], 0);\n}\n\n/**\n * Normalizes a vector to unit length (L2 normalization)\n *\n * @param vector - The vector to normalize\n * @param throwOnZero - If true, throws an error for zero vectors. If false, returns the original vector.\n * @param float32 - If true, always returns a Float32Array regardless of input type. When false (default),\n * the return type matches the input type. Note: for integer typed arrays (Int8Array, Uint8Array,\n * Int16Array, Uint16Array), normalized float values are truncated to integers when stored back in\n * the original type — use `float32=true` to preserve precision for integer inputs.\n * @returns Normalized vector. Float arrays preserve their type. Integer arrays preserve their type\n * (with truncation). Pass `float32=true` to always get a Float32Array.\n */\nexport function normalize(vector: TypedArray, throwOnZero = true, float32 = false): TypedArray {\n const mag = magnitude(vector);\n\n if (mag === 0) {\n if (throwOnZero) {\n throw new Error(\"Cannot normalize a zero vector.\");\n }\n return vector;\n }\n\n const normalized = Array.from(vector).map((val) => Number(val) / mag);\n\n if (float32) {\n return new Float32Array(normalized);\n }\n\n if (vector instanceof Float64Array) {\n return new Float64Array(normalized);\n }\n if (vector instanceof Float16Array) {\n return new Float16Array(normalized);\n }\n if (vector instanceof Float32Array) {\n return new Float32Array(normalized);\n }\n if (vector instanceof Int8Array) {\n return new Int8Array(normalized);\n }\n if (vector instanceof Uint8Array) {\n return new Uint8Array(normalized);\n }\n if (vector instanceof Int16Array) {\n return new Int16Array(normalized);\n }\n if (vector instanceof Uint16Array) {\n return new Uint16Array(normalized);\n }\n return new Float32Array(normalized);\n}\n\n/**\n * Normalizes an array of numbers to unit length (L2 normalization)\n *\n * @param values - The array of numbers to normalize\n * @param throwOnZero - If true, throws an error for zero vectors. If false, returns the original array.\n * @returns Normalized array of numbers\n */\nexport function normalizeNumberArray(values: number[], throwOnZero = false): number[] {\n const norm = magnitude(values);\n\n if (norm === 0) {\n if (throwOnZero) {\n throw new Error(\"Cannot normalize a zero vector.\");\n }\n return values;\n }\n\n return values.map((v) => v / norm);\n}\n"
14
14
  ],
15
- "mappings": ";AAyBO,IAAM,2BAA2B;AAAA,EACtC,iBAAiB;AAAA,EACjB,yBAAyB;AAAA,EACzB,iCAAiC;AAAA,EACjC,YAAY;AAAA,EACZ,aAAa;AACf;;ACuBA,SAAS,0BAA0B,CACjC,cACA,cACuC;AAAA,EAEvC,MAAM,gBAAgB;AAAA,EACtB,IAAI,CAAC,cAAc,KAAK,YAAY,KAAK,CAAC,cAAc,KAAK,YAAY,GAAG;AAAA,IAC1E,OAAO;AAAA,EACT;AAAA,EAEA,OAAO,YAAY,gBAAgB,aAAa,MAAM,GAAG;AAAA,EACzD,OAAO,YAAY,gBAAgB,aAAa,MAAM,GAAG;AAAA,EAGzD,IAAI,eAAe,YAAY;AAAA,IAC7B,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,CAAC,gBAAgB,CAAC,cAAc;AAAA,IAClC,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,gBAAgB,CAAC,cAAc;AAAA,IACjC,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,CAAC,gBAAgB,cAAc;AAAA,IACjC,OAAO;AAAA,EACT;AAAA,EAGA,IAAI,iBAAiB,cAAc;AAAA,IACjC,OAAO;AAAA,EACT;AAAA,EAEA,OAAO;AAAA;AAOT,SAAS,0BAA0B,CAAC,YAAqB,YAA8B;AAAA,EAErF,IAAI,CAAC,YAAY;AAAA,IACf,OAAO;AAAA,EACT;AAAA,EAGA,IA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AW,UAAU;AAAA,EAClC;AAAA,EACA,IAAI,kBAAkB,YAAY;AAAA,IAChC,OAAO,IAAI,WAAW,UAAU;AAAA,EAClC;AAAA,EACA,IAAI,kBAAkB,aAAa;AAAA,IACjC,OAAO,IAAI,YAAY,UAAU;AAAA,EACnC;AAAA,EACA,OAAO,IAAI,aAAa,UAAU;AAAA;AAU7B,SAAS,oBAAoB,CAAC,QAAkB,cAAc,OAAiB;AAAA,EACpF,MAAM,OAAO,UAAU,MAAM;AAAA,EAE7B,IAAI,SAAS,GAAG;AAAA,IACd,IAAI,aAAa;AAAA,MACf,MAAM,IAAI,MAAM,iCAAiC;AAAA,IACnD;AAAA,IACA,OAAO;AAAA,EACT;AAAA,EAEA,OAAO,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI;AAAA;",
16
+ "debugId": "3151F1BBE117DDD664756E2164756E21",
17
17
  "names": []
18
18
  }
@@ -16,6 +16,7 @@ import { JsonSchema } from "../json-schema/JsonSchema";
16
16
  * - Uint16Array: 16-bit unsigned integer (quantization)
17
17
  */
18
18
  export type TypedArray = Float32Array | Float16Array | Float64Array | Int8Array | Uint8Array | Int16Array | Uint16Array;
19
+ export type TypedArrayConstructor = typeof Float16Array | typeof Float32Array | typeof Float64Array | typeof Int8Array | typeof Uint8Array | typeof Int16Array | typeof Uint16Array;
19
20
  export type TypedArrayString = "TypedArray" | "TypedArray:Float16Array" | "TypedArray:Float32Array" | "TypedArray:Float64Array" | "TypedArray:Int8Array" | "TypedArray:Uint8Array" | "TypedArray:Int16Array" | "TypedArray:Uint16Array";
20
21
  export declare function isTypedArray(value: unknown): value is TypedArray;
21
22
  declare const TypedArraySchemaOptions: {