jsonata-mcp 1.0.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/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +236 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Simon Jang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# jsonata-mcp
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that provides tools to evaluate and validate [JSONata](https://jsonata.org/) expressions. JSONata is a lightweight query and transformation language for JSON data.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Evaluate JSONata expressions** against JSON data with a 5-second timeout for safety
|
|
8
|
+
- **Validate JSONata syntax** without execution
|
|
9
|
+
- **Access JSONata function reference** documentation for built-in functions
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
No manual install needed — use `npx` to run directly:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx jsonata-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install globally:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g jsonata-mcp
|
|
23
|
+
jsonata-mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The server communicates over stdio, so it's designed to be launched by an MCP client rather than run directly.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Claude Desktop
|
|
31
|
+
|
|
32
|
+
Add to your Claude Desktop config (`claude_desktop_config.json`):
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"jsonata": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["jsonata-mcp"]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Claude Code
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
claude mcp add jsonata -- npx jsonata-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Tools
|
|
52
|
+
|
|
53
|
+
### `evaluate_jsonata`
|
|
54
|
+
|
|
55
|
+
Evaluate a JSONata expression against optional JSON data.
|
|
56
|
+
|
|
57
|
+
**Parameters:**
|
|
58
|
+
- `expression` (string, required) — the JSONata expression to evaluate
|
|
59
|
+
- `data` (any, optional) — JSON data to evaluate against
|
|
60
|
+
|
|
61
|
+
**Example request:**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"name": "evaluate_jsonata",
|
|
65
|
+
"arguments": {
|
|
66
|
+
"expression": "items[price > 10].name",
|
|
67
|
+
"data": {
|
|
68
|
+
"items": [
|
|
69
|
+
{"name": "Apple", "price": 5},
|
|
70
|
+
{"name": "Laptop", "price": 1200},
|
|
71
|
+
{"name": "Book", "price": 15}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Example response:**
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"content": [
|
|
82
|
+
{
|
|
83
|
+
"type": "text",
|
|
84
|
+
"text": "{\"success\":true,\"result\":[\"Laptop\",\"Book\"],\"expression\":\"items[price > 10].name\",\"data\":{\"items\":[{\"name\":\"Apple\",\"price\":5},{\"name\":\"Laptop\",\"price\":1200},{\"name\":\"Book\",\"price\":15}]}}"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `validate_jsonata`
|
|
91
|
+
|
|
92
|
+
Validate if a string is valid JSONata syntax without evaluating it.
|
|
93
|
+
|
|
94
|
+
**Parameters:**
|
|
95
|
+
- `expression` (string, required) — the JSONata expression to validate
|
|
96
|
+
|
|
97
|
+
**Example request:**
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"name": "validate_jsonata",
|
|
101
|
+
"arguments": {
|
|
102
|
+
"expression": "users[age >= 18].{\"name\": name, \"adult\": true}"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Example response:**
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"content": [
|
|
111
|
+
{
|
|
112
|
+
"type": "text",
|
|
113
|
+
"text": "{\"valid\":true,\"expression\":\"users[age >= 18].{\\\"name\\\": name, \\\"adult\\\": true}\",\"message\":\"Expression is valid JSONata syntax\"}"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### `jsonata_function_reference`
|
|
120
|
+
|
|
121
|
+
Get reference information about JSONata built-in functions.
|
|
122
|
+
|
|
123
|
+
**Parameters:**
|
|
124
|
+
- `functionName` (string, optional) — specific function to look up (e.g. `$sum`, `$map`)
|
|
125
|
+
|
|
126
|
+
**Example request:**
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"name": "jsonata_function_reference",
|
|
130
|
+
"arguments": {
|
|
131
|
+
"functionName": "$sum"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Example response:**
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"content": [
|
|
140
|
+
{
|
|
141
|
+
"type": "text",
|
|
142
|
+
"text": "{\"function\":\"$sum\",\"description\":\"Returns the sum of an array of numbers\",\"category\":\"numeric\"}"
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Resources
|
|
149
|
+
|
|
150
|
+
- [JSONata Documentation](https://jsonata.org/)
|
|
151
|
+
- [JSONata Exerciser](https://try.jsonata.org/) — interactive playground
|
|
152
|
+
- [JSONata GitHub](https://github.com/jsonata-js/jsonata)
|
|
153
|
+
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm run dev # watch mode (recompiles on change)
|
|
158
|
+
npm test # run tests
|
|
159
|
+
npm run build # compile TypeScript
|
|
160
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import jsonata from "jsonata";
|
|
6
|
+
export function createServer() {
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: "jsonata-mcp",
|
|
9
|
+
version: "1.0.0"
|
|
10
|
+
});
|
|
11
|
+
// Add a tool for evaluating JSONata expressions
|
|
12
|
+
server.tool("evaluate_jsonata", "Evaluate a JSONata expression against JSON data", {
|
|
13
|
+
expression: z.string().describe("The JSONata expression to evaluate"),
|
|
14
|
+
data: z.unknown().optional().describe("The JSON data to evaluate the expression against (optional)")
|
|
15
|
+
}, async ({ expression, data }) => {
|
|
16
|
+
try {
|
|
17
|
+
// Compile the JSONata expression
|
|
18
|
+
const compiled = jsonata(expression);
|
|
19
|
+
// Evaluate with a 5 second timeout to prevent runaway expressions
|
|
20
|
+
let timeout;
|
|
21
|
+
const result = await Promise.race([
|
|
22
|
+
compiled.evaluate(data),
|
|
23
|
+
new Promise((_, reject) => {
|
|
24
|
+
timeout = setTimeout(() => reject(new Error("Expression evaluation timed out (5s limit)")), 5000);
|
|
25
|
+
})
|
|
26
|
+
]).finally(() => clearTimeout(timeout));
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: JSON.stringify({
|
|
32
|
+
success: true,
|
|
33
|
+
result: result,
|
|
34
|
+
expression: expression,
|
|
35
|
+
data: data
|
|
36
|
+
}, null, 2)
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
// Handle errors gracefully (JSONata errors are plain objects, not Error instances)
|
|
43
|
+
const err = error;
|
|
44
|
+
const errorMessage = err?.message ?? String(error);
|
|
45
|
+
const errorDetails = {
|
|
46
|
+
success: false,
|
|
47
|
+
error: errorMessage,
|
|
48
|
+
expression: expression
|
|
49
|
+
};
|
|
50
|
+
// Include error position if available
|
|
51
|
+
if (err?.position !== undefined) {
|
|
52
|
+
errorDetails.position = err.position;
|
|
53
|
+
}
|
|
54
|
+
if (data !== undefined) {
|
|
55
|
+
errorDetails.data = data;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
content: [
|
|
59
|
+
{
|
|
60
|
+
type: "text",
|
|
61
|
+
text: JSON.stringify(errorDetails, null, 2)
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
isError: true
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
// Add a tool for validating JSONata expressions
|
|
69
|
+
server.tool("validate_jsonata", "Validate whether a string is valid JSONata syntax without evaluating it", {
|
|
70
|
+
expression: z.string().describe("The JSONata expression to validate")
|
|
71
|
+
}, async ({ expression }) => {
|
|
72
|
+
try {
|
|
73
|
+
// Try to compile the expression
|
|
74
|
+
jsonata(expression);
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: "text",
|
|
79
|
+
text: JSON.stringify({
|
|
80
|
+
valid: true,
|
|
81
|
+
expression: expression,
|
|
82
|
+
message: "Expression is valid JSONata syntax"
|
|
83
|
+
}, null, 2)
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
// Return validation error details (JSONata errors are plain objects, not Error instances)
|
|
90
|
+
const err = error;
|
|
91
|
+
const errorMessage = err?.message ?? String(error);
|
|
92
|
+
const errorDetails = {
|
|
93
|
+
valid: false,
|
|
94
|
+
expression: expression,
|
|
95
|
+
error: errorMessage
|
|
96
|
+
};
|
|
97
|
+
// Include error position if available
|
|
98
|
+
if (err?.position !== undefined) {
|
|
99
|
+
errorDetails.position = err.position;
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: "text",
|
|
105
|
+
text: JSON.stringify(errorDetails, null, 2)
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
isError: true
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
// Add a tool to get JSONata function reference
|
|
113
|
+
server.tool("jsonata_function_reference", "Get reference documentation for JSONata built-in functions", {
|
|
114
|
+
functionName: z.string().optional().describe("Specific function name to get reference for (optional)")
|
|
115
|
+
}, async ({ functionName }) => {
|
|
116
|
+
const functionReference = {
|
|
117
|
+
"string": {
|
|
118
|
+
"$string": "Converts input to a string",
|
|
119
|
+
"$length": "Returns the length of a string",
|
|
120
|
+
"$substring": "Extracts a substring",
|
|
121
|
+
"$substringBefore": "Returns substring before a delimiter",
|
|
122
|
+
"$substringAfter": "Returns substring after a delimiter",
|
|
123
|
+
"$uppercase": "Converts string to uppercase",
|
|
124
|
+
"$lowercase": "Converts string to lowercase",
|
|
125
|
+
"$trim": "Removes whitespace from both ends",
|
|
126
|
+
"$pad": "Pads a string to a given length",
|
|
127
|
+
"$contains": "Checks if string contains substring",
|
|
128
|
+
"$split": "Splits string into array",
|
|
129
|
+
"$join": "Joins array elements into string",
|
|
130
|
+
"$match": "Matches string against regex",
|
|
131
|
+
"$replace": "Replaces pattern in string"
|
|
132
|
+
},
|
|
133
|
+
"numeric": {
|
|
134
|
+
"$number": "Converts input to a number",
|
|
135
|
+
"$abs": "Returns absolute value",
|
|
136
|
+
"$floor": "Rounds down to integer",
|
|
137
|
+
"$ceil": "Rounds up to integer",
|
|
138
|
+
"$round": "Rounds to nearest integer",
|
|
139
|
+
"$power": "Raises to a power",
|
|
140
|
+
"$sqrt": "Returns square root",
|
|
141
|
+
"$random": "Returns random number",
|
|
142
|
+
"$sum": "Sums array of numbers",
|
|
143
|
+
"$max": "Returns maximum value",
|
|
144
|
+
"$min": "Returns minimum value",
|
|
145
|
+
"$average": "Returns average of array"
|
|
146
|
+
},
|
|
147
|
+
"array": {
|
|
148
|
+
"$count": "Returns number of items",
|
|
149
|
+
"$append": "Appends items to array",
|
|
150
|
+
"$sort": "Sorts array items",
|
|
151
|
+
"$reverse": "Reverses array order",
|
|
152
|
+
"$shuffle": "Randomly shuffles array",
|
|
153
|
+
"$distinct": "Returns unique values",
|
|
154
|
+
"$zip": "Combines multiple arrays"
|
|
155
|
+
},
|
|
156
|
+
"object": {
|
|
157
|
+
"$keys": "Returns object keys",
|
|
158
|
+
"$lookup": "Looks up value by key",
|
|
159
|
+
"$spread": "Spreads object properties",
|
|
160
|
+
"$merge": "Merges objects",
|
|
161
|
+
"$each": "Applies expression to each value",
|
|
162
|
+
"$sift": "Filters object properties"
|
|
163
|
+
},
|
|
164
|
+
"datetime": {
|
|
165
|
+
"$now": "Returns current timestamp",
|
|
166
|
+
"$millis": "Converts to milliseconds",
|
|
167
|
+
"$fromMillis": "Converts from milliseconds",
|
|
168
|
+
"$toMillis": "Converts to milliseconds"
|
|
169
|
+
},
|
|
170
|
+
"boolean": {
|
|
171
|
+
"$boolean": "Converts to boolean",
|
|
172
|
+
"$not": "Logical NOT",
|
|
173
|
+
"$exists": "Checks if value exists"
|
|
174
|
+
},
|
|
175
|
+
"higher-order": {
|
|
176
|
+
"$map": "Maps expression over array",
|
|
177
|
+
"$filter": "Filters array by predicate",
|
|
178
|
+
"$reduce": "Reduces array to single value",
|
|
179
|
+
"$single": "Returns single matching item"
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
let response;
|
|
183
|
+
if (functionName) {
|
|
184
|
+
// Search for specific function
|
|
185
|
+
let found = false;
|
|
186
|
+
for (const [category, functions] of Object.entries(functionReference)) {
|
|
187
|
+
for (const [func, desc] of Object.entries(functions)) {
|
|
188
|
+
if (func.toLowerCase() === functionName.toLowerCase() ||
|
|
189
|
+
func.toLowerCase() === `$${functionName.toLowerCase()}`) {
|
|
190
|
+
response = {
|
|
191
|
+
function: func,
|
|
192
|
+
description: desc,
|
|
193
|
+
category: category
|
|
194
|
+
};
|
|
195
|
+
found = true;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (found)
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
if (!found) {
|
|
203
|
+
response = {
|
|
204
|
+
error: `Function '${functionName}' not found in reference`,
|
|
205
|
+
suggestion: "Use without functionName parameter to see all available functions"
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
// Return all functions
|
|
211
|
+
response = functionReference;
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
content: [
|
|
215
|
+
{
|
|
216
|
+
type: "text",
|
|
217
|
+
text: JSON.stringify(response, null, 2)
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
return server;
|
|
223
|
+
}
|
|
224
|
+
// Create and start the stdio transport
|
|
225
|
+
async function main() {
|
|
226
|
+
const server = createServer();
|
|
227
|
+
const transport = new StdioServerTransport();
|
|
228
|
+
await server.connect(transport);
|
|
229
|
+
console.error('JSONata MCP server running on stdio');
|
|
230
|
+
}
|
|
231
|
+
// Handle errors gracefully
|
|
232
|
+
main().catch((error) => {
|
|
233
|
+
console.error('Server error:', error);
|
|
234
|
+
process.exit(1);
|
|
235
|
+
});
|
|
236
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,gDAAgD;IAChD,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,iDAAiD,EACjD;QACE,UAA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,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jsonata-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP Server to evaluate JSONata",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"jsonata-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"start": "node dist/index.js",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:integration": "npm run build && vitest run src/integration.test.ts",
|
|
19
|
+
"prepublishOnly": "npm test && npm run build",
|
|
20
|
+
"version:patch": "npm version patch",
|
|
21
|
+
"version:minor": "npm version minor",
|
|
22
|
+
"version:major": "npm version major",
|
|
23
|
+
"release": "npm publish --access public"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/SimonJang/jsonata-mcp.git"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [],
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/SimonJang/jsonata-mcp/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/SimonJang/jsonata-mcp#readme",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
38
|
+
"jsonata": "^2.0.6",
|
|
39
|
+
"zod": "^4.3.6"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^25.3.3",
|
|
43
|
+
"typescript": "^5.8.3",
|
|
44
|
+
"vitest": "^4.0.18"
|
|
45
|
+
}
|
|
46
|
+
}
|