Specify Docs
Specify ↗︎Changelog ↗︎Guide ↗︎
V2
V2
  • Getting started
    • Introduction
    • What is Specify?
    • Pulling your first tokens with the CLI
    • Glossary
  • Collect
    • What is a Source?
    • Available sources
      • Figma Variables & Styles
      • Tokens Studio
  • Distribute
    • What is a Destination?
    • Available destinations
      • GitHub
      • Specify CLI
      • Specify SDK
      • HTTP API
  • Concepts
    • Overview
    • Parsers Engine
    • SDTF Client
      • SDTF Engine
    • Specify Design Token Format
  • Guides
    • Configuration file 101
    • Specify CLI usage 101
      • Getting started
      • Authentication
      • Generate Files
    • Specify SDK usage 101
      • Getting started
      • Retrieving and working with the tokens
      • Updating tokens
      • Converting a token to XXX
      • Executing generation parsers
    • Specify SDK Cheatsheet
    • Manage font files
    • Querying a SDTF graph
  • Reference
    • Parsers Engine
    • Parsers
      • change-case
      • convert-color
      • convert-dimension
      • make-line-height-relative
      • filter
      • register-view
      • select-modes
      • prefix-by
      • suffix-by
      • replace-string
      • to-css-custom-properties
      • to-css-text-style
      • to-css-font-import
      • to-flutter
      • to-javascript
      • to-json
      • to-json-list
      • to-kotlin
      • to-react-native
      • to-scss-mixin-text-style
      • to-scss-map
      • to-sdtf
      • to-style-dictionary
      • to-swift
      • to-tailwind
      • to-typescript
      • svgo
      • svg-to-jsx
      • svg-to-tsx
      • to-svg-file
      • to-bitmap-file
      • to-file
    • Specify SDK
      • SpecifyClient
      • SDTFClient
      • Converters
        • CSS
      • ParsersEngineResults
    • SDTF Engine
      • Query API
      • Mutation API
      • SDTF Query Language
      • SDTF QueryResult
      • TokenState
        • Stateful Value
    • HTTP API
      • POST /parsers-engine-rpc
    • Specify CLI
  • Resources
    • Parser Rules templates
      • CSS Custom Properties
      • Tailwind
      • React Native
      • Flutter
      • SDTF
      • JSON
    • Specify CLI VS Specify SDK
    • Playground
    • Best practices
  • Useful links
    • Discord
    • YouTube
    • Twitter
    • Help Center
    • Canny
Powered by GitBook
On this page
  • Properties
  • isContinuous
  • Methods
  • merge
  • hasNodeType
  • hasOnlyNodeType
  • render
  • getPaths
  • toJSON

Was this helpful?

Export as PDF
  1. Reference
  2. SDTF Engine

SDTF QueryResult

The QueryResult class API reference

The QueryResult class provides an abstraction to work with the tree node returned by a SDTF query.

Properties

isContinuous

Indicates whether the selected nodes are part of the same resulting JSON tree.

get isContinuous(): boolean;

Methods

merge

Produces a new tree state with the resulting nodes.

merge(dedupeFn?: MergeDedupeFn): {
    treeState: TreeState;
};

hasNodeType

Check if the result contains some nodes of the specified type.

hasNodeType(nodeType: 'collection' | 'group' | 'token'): boolean;

hasOnlyNodeType

Check if the result contains only nodes of the specified type.

hasOnlyNodeType(nodeType: 'collection' | 'group' | 'token'): boolean;

render

Produces an analysis of the resulting nodes.

type QueryResultDetail = {
  isRoot: boolean;
  parentPath: Array<string>;
  isComplete: boolean;
  nodes: Array<SDTFNodeState>;
  sdtf: SpecifyDesignTokenFormat;
};
render(): Array<QueryResultDetail>;

When the result is continuous, the render function returns an array of length 1

getPaths

Get the token tree path of the resulting nodes.

getPaths(type: 'string'): Array<string>;
getPaths(type: 'array'): Array<Array<string>>;
getPaths(type?: undefined): Array<string>;

toJSON

Renders the resulting nodes as a JSON object using the QueryResultDetail structure.

toJSON(): {
    isContinuous: boolean;
    graphs: {
        isRoot: boolean;
        parentPath: string[];
        isComplete: boolean;
        sdtf: SpecifyDesignTokenFormat;
    }[];
};
PreviousSDTF Query LanguageNextTokenState

Last updated 1 year ago

Was this helpful?