Skip to Content
Bear documentation

query-plan

Import from bear/engine/query-plan.

Type Aliases

PlanSelector

type PlanSelector = 
  | string
  | RegExp
  | {
  type: string;
}
  | {
  op: PropOp;
  prop: string;
  value: unknown;
};

Defined in: bear/engine/query-plan.ts:17

Union Members

string


RegExp


Type Literal
{
  type: string;
}

A part (node.type) or assembly component, by name.


Type Literal
{
  op: PropOp;
  prop: string;
  value: unknown;
}

node.props[prop] <op> value; in takes an array of values.


PropOp

type PropOp = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in";

Defined in: bear/engine/query-plan.ts:15


QueryStep

type QueryStep = 
  | ["find", ...PlanSelector[]]
  | ["named", ...(string | RegExp)[]]
  | ["ofType", string]
  | ["where", ...PlanSelector[]]
  | ["has", ...PlanSelector[]]
  | ["closest", ...PlanSelector[]]
  | ["geometry"]
  | ["assemblies"]
  | ["children"]
  | ["parent"]
  | ["ancestors"]
  | ["descendants"]
  | ["siblings"]
  | ["follow", string, EdgeDir?]
  | ["trace", string, EdgeDir?]
  | ["system", string]
  | ["nth", number]
  | ["nodes", ...string[]];

Defined in: bear/engine/query-plan.ts:27

Variables

LEAF_NODES

const LEAF_NODES: QueryStep[];

Defined in: bear/engine/query-plan.ts:49

Every geometry node below the root: what the parts list and BOM read.

Functions

runPlan()

function runPlan(model, steps): BearQuery<TreeNode>;

Defined in: bear/engine/query-plan.ts:152

Replay steps from the model's root; an empty plan is the root itself.

Parameters

ParameterType
modelModelView
stepsreadonly QueryStep[]

Returns

BearQuery<TreeNode>

On this page