@vaultgradient/pipequery-lang 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<h1 align="center">| PipeQuery</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
A pipe-based query language for filtering, transforming, and aggregating data in JavaScript/TypeScript.
|
|
4
|
+
A pipe-based query language for filtering, transforming, and aggregating data in JavaScript/TypeScript — with a built-in <strong>MCP server</strong> that lets Claude, Cursor, and other AI agents query your live data.
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://github.com/andreadito/pipequery/releases/latest"><img src="https://img.shields.io/github/v/release/andreadito/pipequery?label=release&color=orange" alt="release" /></a>
|
|
9
|
-
<a href="https://
|
|
10
|
-
<a href="https://
|
|
9
|
+
<a href="https://www.npmjs.com/package/@vaultgradient/pipequery-lang"><img src="https://img.shields.io/npm/v/@vaultgradient/pipequery-lang?label=npm%20%28engine%29&color=cb3837&logo=npm" alt="engine package" /></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@vaultgradient/pipequery-cli"><img src="https://img.shields.io/npm/v/@vaultgradient/pipequery-cli?label=npm%20%28cli%29&color=cb3837&logo=npm" alt="cli package" /></a>
|
|
11
11
|
<a href="https://github.com/andreadito/pipequery/pkgs/container/pipequery"><img src="https://img.shields.io/badge/ghcr.io-pipequery-blue?logo=docker" alt="docker" /></a>
|
|
12
12
|
<a href="https://github.com/andreadito/pipequery/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" /></a>
|
|
13
13
|
<a href="https://github.com/andreadito/pipequery"><img src="https://img.shields.io/badge/TypeScript-100%25-blue.svg" alt="TypeScript" /></a>
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
21
|
- **Pipe-based syntax** — chain operations with `|`, inspired by Unix pipes and SQL
|
|
22
|
+
- **MCP server** — plug pipequery into Claude Desktop, Claude Code, Cursor, Copilot, or any MCP client with one command
|
|
22
23
|
- **Minimal dependencies** — lightweight core engine
|
|
23
24
|
- **TypeScript-first** — full type definitions included
|
|
24
25
|
- **25+ aggregate functions** — basic, statistical, and financial aggregations
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
## Install
|
|
30
31
|
|
|
31
32
|
```bash
|
|
32
|
-
npm install @
|
|
33
|
+
npm install @vaultgradient/pipequery-lang
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
## CLI — `pq`
|
|
@@ -37,7 +38,7 @@ npm install @andreadito/pipequery-lang
|
|
|
37
38
|
PipeQuery also ships a CLI tool for building data pipelines, REST APIs, and rich terminal dashboards.
|
|
38
39
|
|
|
39
40
|
```bash
|
|
40
|
-
npm install -g @
|
|
41
|
+
npm install -g @vaultgradient/pipequery-cli
|
|
41
42
|
|
|
42
43
|
pq init # scaffold a project
|
|
43
44
|
pq serve -d # start the server as a daemon
|
|
@@ -71,10 +72,20 @@ Works the same with a remote server — just `pq remote connect https://my-serve
|
|
|
71
72
|
|
|
72
73
|
The dashboard features a resizable 2-column grid with live SSE updates and 7 visualization types. See [`cli/README.md`](./cli/README.md) for full documentation.
|
|
73
74
|
|
|
75
|
+
## Use with AI (MCP)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pq mcp serve # stdio — plug into Claude Desktop / Cursor / Claude Code
|
|
79
|
+
pq mcp serve --http --port 3001 # HTTP/SSE — for remote clients or hosted deployments
|
|
80
|
+
pq mcp serve --attach http://localhost:3000 # attach to a running `pq serve`
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Your AI agent gets 5 tools: `query`, `list_sources`, `describe_source`, `list_endpoints`, `call_endpoint`. See [`cli/README.md`](./cli/README.md#use-with-ai-mcp) for client setup recipes.
|
|
84
|
+
|
|
74
85
|
## Quick Start
|
|
75
86
|
|
|
76
87
|
```ts
|
|
77
|
-
import { query } from '@
|
|
88
|
+
import { query } from '@vaultgradient/pipequery-lang';
|
|
78
89
|
|
|
79
90
|
const data = [
|
|
80
91
|
{ name: 'Laptop', price: 999, category: 'Electronics' },
|
|
@@ -167,7 +178,7 @@ nested.field.path // dot access
|
|
|
167
178
|
Execute a query on data. Accepts a raw array or a named `DataContext` for multi-table queries.
|
|
168
179
|
|
|
169
180
|
```ts
|
|
170
|
-
import { query } from '@
|
|
181
|
+
import { query } from '@vaultgradient/pipequery-lang';
|
|
171
182
|
|
|
172
183
|
// Array shorthand
|
|
173
184
|
query(items, 'where(price > 50) | sort(name asc)');
|
|
@@ -184,7 +195,7 @@ query(
|
|
|
184
195
|
Pre-compile a query for repeated use. Returns a reusable function.
|
|
185
196
|
|
|
186
197
|
```ts
|
|
187
|
-
import { compile } from '@
|
|
198
|
+
import { compile } from '@vaultgradient/pipequery-lang';
|
|
188
199
|
|
|
189
200
|
const fn = compile('where(price > 100) | sort(price desc)');
|
|
190
201
|
const result = fn({ _data: items });
|
|
@@ -195,7 +206,7 @@ const result = fn({ _data: items });
|
|
|
195
206
|
Parse a query into its AST without executing.
|
|
196
207
|
|
|
197
208
|
```ts
|
|
198
|
-
import { parseQuery } from '@
|
|
209
|
+
import { parseQuery } from '@vaultgradient/pipequery-lang';
|
|
199
210
|
|
|
200
211
|
const ast = parseQuery('items | where(price > 100)');
|
|
201
212
|
// Inspect tokens, operations, expressions
|
|
@@ -206,7 +217,7 @@ const ast = parseQuery('items | where(price > 100)');
|
|
|
206
217
|
Streaming query evaluator that accepts data patches and re-executes efficiently.
|
|
207
218
|
|
|
208
219
|
```ts
|
|
209
|
-
import { liveQuery } from '@
|
|
220
|
+
import { liveQuery } from '@vaultgradient/pipequery-lang';
|
|
210
221
|
|
|
211
222
|
const lq = liveQuery(initialData, 'where(active == true) | sort(updatedAt desc)', {
|
|
212
223
|
key: 'id',
|
|
@@ -229,7 +240,7 @@ lq.dispose();
|
|
|
229
240
|
Clear the internal compiled-query LRU cache (128 entries by default).
|
|
230
241
|
|
|
231
242
|
```ts
|
|
232
|
-
import { clearCache } from '@
|
|
243
|
+
import { clearCache } from '@vaultgradient/pipequery-lang';
|
|
233
244
|
|
|
234
245
|
clearCache();
|
|
235
246
|
```
|
|
@@ -239,7 +250,7 @@ clearCache();
|
|
|
239
250
|
All errors include position info (`position`, `line`, `column`) for editor integration.
|
|
240
251
|
|
|
241
252
|
```ts
|
|
242
|
-
import { LexerError, ParseError, RuntimeError, DataWeaveError } from '@
|
|
253
|
+
import { LexerError, ParseError, RuntimeError, DataWeaveError } from '@vaultgradient/pipequery-lang';
|
|
243
254
|
|
|
244
255
|
try {
|
|
245
256
|
query(data, 'where(price >)');
|
|
@@ -256,10 +267,10 @@ try {
|
|
|
256
267
|
|
|
257
268
|
```ts
|
|
258
269
|
// CodeMirror 6
|
|
259
|
-
import { pipeQuery } from '@
|
|
270
|
+
import { pipeQuery } from '@vaultgradient/pipequery-lang/highlighting';
|
|
260
271
|
|
|
261
272
|
// Monaco Editor
|
|
262
|
-
import { registerPipeQuery } from '@
|
|
273
|
+
import { registerPipeQuery } from '@vaultgradient/pipequery-lang/highlighting';
|
|
263
274
|
```
|
|
264
275
|
|
|
265
276
|
A TextMate grammar is included at `dist/highlighting/textmate/pipequery.tmLanguage.json` for VS Code, IntelliJ, and Sublime Text.
|
|
@@ -269,7 +280,7 @@ A TextMate grammar is included at `dist/highlighting/textmate/pipequery.tmLangua
|
|
|
269
280
|
### React Components
|
|
270
281
|
|
|
271
282
|
```tsx
|
|
272
|
-
import { PipeQueryBuilder } from '@
|
|
283
|
+
import { PipeQueryBuilder } from '@vaultgradient/pipequery-lang/react';
|
|
273
284
|
|
|
274
285
|
<PipeQueryBuilder
|
|
275
286
|
datasets={datasets}
|
package/package.json
CHANGED