npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tari-project/tari-extension-query-builder

v0.0.17

Published

---

Readme

Tari Extension Query Builder


Last Updated: 2025-06-26 Version: 1.0.0 Verified Against: Current codebase Test Sources: execute/ExecutionPlanner.spec.ts Implementation: execute/ExecutionPlanner.ts


React-based visual query builder for creating and executing Tari blockchain transactions through a drag-and-drop interface using ReactFlow.

Features

  • Visual Transaction Builder: Drag-and-drop interface for creating transaction flows
  • Execution Planning: Intelligent ordering and validation of transaction steps
  • Node-Based Architecture: Generic nodes for various Tari operations (calls, parameters, logs)
  • Cycle Detection: Prevents invalid transaction flows with circular dependencies
  • Parameter Validation: Ensures all required inputs are connected or have values

Core Components

ExecutionPlanner

Manages transaction execution order and validates node connections.

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:15-22
// VERIFIED: 2025-06-26
const buildNode = (id: string, data: Partial<GenericNode["data"]> = {}): GenericNode => ({
  id,
  position: { x: 0, y: 0 },
  data: {
    type: GenericNodeType.CallNode,
    ...data,
  },
});

Basic Execution Order Example:

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:52-63
// VERIFIED: 2025-06-26
const nodes: GenericNode[] = [buildNode("A"), buildNode("B"), buildNode("C")];
const edges: Edge[] = [
  buildEdge({ nodeId: "A", handleId: NODE_EXIT }, { nodeId: "B", handleId: NODE_ENTRY }),
  buildEdge({ nodeId: "B", handleId: NODE_EXIT }, { nodeId: "C", handleId: NODE_ENTRY }),
];

const executor = new ExecutionPlanner(nodes, edges);
const order = executor.getExecutionOrder();

expect(order).toEqual(["A", "B", "C"]);

Parameter Connection Example:

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:65-82
// VERIFIED: 2025-06-26
const nodes: GenericNode[] = [
  buildNode("Start"),
  buildNode("A", { output: buildOutputParameter("output_a") }),
  buildNode("B", { inputs: [buildInputParameter("input_b")] }),
  buildNode("End"),
];
const edges: Edge[] = [
  buildEdge({ nodeId: "Start", handleId: NODE_EXIT }, { nodeId: "A", handleId: NODE_ENTRY }),
  buildEdge({ nodeId: "A", handleId: "output_a" }, { nodeId: "B", handleId: "input_b" }),
  buildEdge({ nodeId: "B", handleId: NODE_EXIT }, { nodeId: "End", handleId: NODE_ENTRY }),
];

const executor = new ExecutionPlanner(nodes, edges);
const order = executor.getExecutionOrder();

expect(order).toEqual(["Start", "A", "B", "End"]);

Error Handling

Cycle Detection

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:161-171
// VERIFIED: 2025-06-26
const nodes: GenericNode[] = [buildNode("A"), buildNode("B"), buildNode("C")];
const edges: Edge[] = [
  buildEdge({ nodeId: "A", handleId: NODE_EXIT }, { nodeId: "B", handleId: NODE_ENTRY }),
  buildEdge({ nodeId: "B", handleId: NODE_EXIT }, { nodeId: "C", handleId: NODE_ENTRY }),
  buildEdge({ nodeId: "C", handleId: NODE_EXIT }, { nodeId: "A", handleId: NODE_ENTRY }),
];

const executor = new ExecutionPlanner(nodes, edges);
expect(() => executor.getExecutionOrder()).toThrowError(CycleDetectedError);

Ambiguous Order Detection

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:87-108
// VERIFIED: 2025-06-26
const nodes: GenericNode[] = [
  buildNode("A", { output: buildOutputParameter("output_a") }),
  buildNode("B", { inputs: [buildInputParameter("input_b")] }),
  buildNode("C", { inputs: [buildInputParameter("input_c")] }),
];
const edges: Edge[] = [
  buildEdge({ nodeId: "A", handleId: "output_a" }, { nodeId: "B", handleId: "input_b" }),
  buildEdge({ nodeId: "A", handleId: "output_a" }, { nodeId: "C", handleId: "input_c" }),
];

const executor = new ExecutionPlanner(nodes, edges);
try {
  executor.getExecutionOrder();
  expect.fail("Expected AmbiguousOrderError to be thrown");
} catch (error) {
  expect(error).toBeInstanceOf(AmbiguousOrderError);
}

API Reference

ExecutionPlanner Class

Constructor:

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.ts:37-42
// VERIFIED: 2025-06-26
constructor(
  private customNodes: CustomNode[],
  private edges: Edge[],
) {
  this.init();
}

Key Methods:

  • getExecutionOrder(): Returns ordered array of node IDs for execution
  • buildTransactionDescription(): Creates transaction details from execution plan
  • buildTransaction(): Converts transaction details to executable transaction

Helper Functions

Building Input Parameters:

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:23-27
// VERIFIED: 2025-06-26
const buildInputParameter = (name: string): NonNullable<GenericNode["data"]["inputs"]>[0] => ({
  inputConnectionType: InputConnectionType.Parameter,
  type: "String",
  name,
});

Building Output Parameters:

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:28-31
// VERIFIED: 2025-06-26
const buildOutputParameter = (name: string): GenericNode["data"]["output"] => ({
  type: "String",
  name,
});

Building Edges:

// SOURCE: packages/tari-extension-query-builder/src/execute/ExecutionPlanner.spec.ts:32-38
// VERIFIED: 2025-06-26
const buildEdge = (source: ConnectionPoint, target: ConnectionPoint): Edge => ({
  id: `${source.nodeId}:${source.handleId}-${target.nodeId}:${target.handleId}`,
  source: source.nodeId,
  target: target.nodeId,
  sourceHandle: source.handleId,
  targetHandle: target.handleId,
});

Development

Building

pnpm install
pnpm build

Testing

pnpm test

Test Coverage:

  • Execution order calculation with various node configurations
  • Cycle detection in transaction flows
  • Ambiguous order error handling
  • Parameter connection validation

Integration

This package provides the core logic for the visual query builder used in the Tari VS Code extension, handling the complex task of converting visual node graphs into executable Tari transactions.