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
  • addToken
  • renameToken
  • updateTokenDescription
  • updateTokenExtensions
  • updateTokenValue
  • updateTokenModeValue
  • renameTokenMode
  • createTokenModeValue
  • deleteTokenModeValue
  • deleteToken
  • moveToken
  • addCollection
  • renameCollection
  • updateCollectionDescription
  • updateCollectionExtensions
  • renameCollectionMode
  • truncateCollection
  • deleteCollection
  • deleteCollectionMode
  • moveCollection
  • addGroup
  • renameGroup
  • updateGroupDescription
  • updateGroupExtensions
  • truncateGroup
  • deleteGroup
  • moveGroup

Was this helpful?

Export as PDF
  1. Reference
  2. SDTF Engine

Mutation API

Methods for locally mutating the token tree.

You access each of the mutation methods over:

sdtfEngine.mutation.[method]

addToken

Add a new token to the token tree.

function addToken(param:{
  parentPath: Array<string>,
  name: string,
  tokenProperties: {
    $type: string;
    $value: unknown;
    $description?: string;
    $extensions?: Record<string, unknown>;
  },
}): void;

renameToken

Rename a token.

function renameToken(param: { atPath: Array<string>; name: string }): void;

updateTokenDescription

Update the description of a token.

function updateTokenDescription(param: {
  atPath: Array<string>;
  description: string;
}): void;

updateTokenExtensions

Update the extensions of a token.

function updateTokenExtensions(param: {
  atPath: Array<string>;
  extensions: treeNodeExtensionsSchema;
}): void;

updateTokenValue

Update the value of a token.

function updateTokenValue(param:{
  atPath: Array<string>,
  // We cannot know with type of the value since no type is enforced
  value: unknown,
}): void;

updateTokenModeValue

Update the value of a token for a given mode.

function updateTokenModeValue(param:{
    mode: string,
    // We cannot know with type of the value since no type is enforced
    value: unknown,
}): void;

renameTokenMode

Rename a token mode.

function renameTokenMode(param: {
  atPath: Array<string>;
  fromMode: string;
  toMode: string;
}): void;

createTokenModeValue

Create a new token mode value.

function createTokenModeValue(param:{
  atPath: Array<string>,
  mode: string,
  // We cannot know with type of the value since no type is enforced
  value: unknown,
}): void;

deleteTokenModeValue

Delete a token mode value.

function deleteTokenModeValue(param: {
  atPath: Array<string>;
  mode: string;
}): void;

deleteToken

Delete a token.

function deleteToken(param: { atPath: Array<string> }): void;

moveToken

Move a token.

function moveToken(param: {
  atPath: Array<string>;
  toPath: Array<string>;
}): void;

addCollection

Add a new collection to the token tree.

function addCollection(param: {
  parentPath: Array<string>;
  name: string;
  collectionProperties: { 
    $collection: {$modes: Array<string>};
    $description?: string;
    $extensions?: Record<string, unknown>;
  };
}): void;

renameCollection

Rename a collection.

function renameCollection(param: {
  atPath: Array<string>;
  name: string;
}): void;

updateCollectionDescription

Update the description of a collection.

function updateCollectionDescription(param: {
  atPath: Array<string>;
  description: string;
}): void;

updateCollectionExtensions

Update the extensions of a collection.

function updateCollectionExtensions(param: {
  atPath: Array<string>;
  extensions: treeNodeExtensionsSchema;
}): void;

renameCollectionMode

Rename a collection mode.

function renameCollectionMode(param: {
  atPath: Array<string>;
  fromMode: string;
  toMode: string;
}): void;

truncateCollection

Truncate a collection.

function truncateCollection(param: { atPath: Array<string> }): void;

deleteCollection

Delete a collection.

function deleteCollection(param: { atPath: Array<string> }): void;

deleteCollectionMode

Delete a collection mode.

function deleteCollectionMode(param: {
  atPath: Array<string>;
  mode: string;
}): void;

moveCollection

Move a collection.

function moveCollection(param: {
  atPath: Array<string>;
  toPath: Array<string>;
}): void;

addGroup

Add a new group to the token tree.

function addGroup(param: {
  parentPath: Array<string>;
  name: string;
  groupProperties: specifyGroupPropertiesSchema;
}): void;

renameGroup

Rename a group.

function renameGroup(param: { atPath: Array<string>; name: string }): void;

updateGroupDescription

Update the description of a group.

function updateGroupDescription(param: {
  atPath: Array<string>;
  description: string;
}): void;

updateGroupExtensions

Update the extensions of a group.

function updateGroupExtensions(param: {
  atPath: Array<string>;
  extensions: treeNodeExtensionsSchema;
}): void;

truncateGroup

Truncate a group.

function truncateGroup(param: { atPath: Array<string> }): void;

deleteGroup

Delete a group.

function deleteGroup(param: { atPath: Array<string> }): void;

moveGroup

Move a group.

function moveGroup(param: {
  atPath: Array<string>;
  toPath: Array<string>;
}): void;
PreviousQuery APINextSDTF Query Language

Last updated 1 year ago

Was this helpful?