thng-query
DSL for working with EVRYTHNG Platform API
tq --key $OPERATOR_KEY 'products tagged embedded where photos~gif'
const tq = ; tq; tq ;
Query syntax
Each query consist of stages:
| fetch stage | filter stage |'thngs with name Advanced* where identifiers.ser^673'
Each stage is independent from the other in terms of data processing. Think about it as about stream. That also means independent syntax for each one of them.
Stages
Fetch
'target selector''quantifier target selector'
quantifier
- int string (14, 203, 1) target:
thng(s)
product(s)
selector:with name
|named
with tag
|tagged
Filter
'where filterExpression'
filterExpression
filterField filterOperator filterValue
filterField- string path to a property of entity filterOperator
=
- exact match~
- inclusion check^
- starts with$
- ends with filterValue- string
Interface
As library
const tq = ; /** * Runs a given query. Throws if any errors during parsing * @param */tq; /** * Consumes global settings for tq * @param */tq
As CLI app
# To see all available options tq --help # Will dump output json straight to stdout tq -k $OPERATOR_KEY 'thngs where properties.online = true'# Could be used with formatters, like jq tq -k $OPERATOR_KEY 'products with tag overcomplicated' | jq .
Settings
tq;
Development
# Will complile current grammar and run nearley-test # against given expression npm run debug -- 'thngs where createdAt $ 65' # Will complile nearley grammar to parser npm run compile # Will produce a random string which will be valid # when feed to the runner # i.e. "PrOdUCTs with nAMe j where YG ~pol" npm run unparse