@graph-compose/client 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/README.md +646 -0
- package/dist/core/builder.d.ts +313 -0
- package/dist/core/builder.d.ts.map +1 -0
- package/dist/core/builder.js +538 -0
- package/dist/core/builder.js.map +1 -0
- package/dist/core/node-builder.d.ts +180 -0
- package/dist/core/node-builder.d.ts.map +1 -0
- package/dist/core/node-builder.js +387 -0
- package/dist/core/node-builder.js.map +1 -0
- package/dist/core/tool-builder.d.ts +130 -0
- package/dist/core/tool-builder.d.ts.map +1 -0
- package/dist/core/tool-builder.js +343 -0
- package/dist/core/tool-builder.js.map +1 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +39 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/node-builder.d.ts +64 -0
- package/dist/node-builder.d.ts.map +1 -0
- package/dist/node-builder.js +261 -0
- package/dist/node-builder.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/validation/index.d.ts +34 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +304 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ValidationResponseSchema = void 0;
|
|
7
|
+
exports.validateWorkflow = validateWorkflow;
|
|
8
|
+
exports.validateExpression = validateExpression;
|
|
9
|
+
exports.validateTemplate = validateTemplate;
|
|
10
|
+
const core_1 = require("@graph-compose/core");
|
|
11
|
+
const jsonata_1 = __importDefault(require("jsonata"));
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
const errors_1 = require("../errors");
|
|
14
|
+
exports.ValidationResponseSchema = zod_1.z.object({
|
|
15
|
+
isValid: zod_1.z.boolean(),
|
|
16
|
+
errors: zod_1.z.array(zod_1.z.instanceof(Error)), // Use the Zod schema here
|
|
17
|
+
});
|
|
18
|
+
function isValidUrl(url) {
|
|
19
|
+
try {
|
|
20
|
+
new URL(url);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const validateTemplateExpression = (expr, nodeId) => {
|
|
28
|
+
console.log(`Validating expression: "${expr}" for node ${nodeId}`);
|
|
29
|
+
// First check for mismatched {{ }}
|
|
30
|
+
const openCount = (expr.match(/\{\{/g) || []).length;
|
|
31
|
+
const closeCount = (expr.match(/\}\}/g) || []).length;
|
|
32
|
+
console.log(`Found ${openCount} opening and ${closeCount} closing braces`);
|
|
33
|
+
if (openCount !== closeCount) {
|
|
34
|
+
return new errors_1.ValidationError(`Unclosed template expression in node "${nodeId}": ${expr}`);
|
|
35
|
+
}
|
|
36
|
+
// If no template expressions, return
|
|
37
|
+
if (openCount === 0) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
// Now extract and validate each template expression
|
|
41
|
+
const templateRegex = /\{\{(.*?)\}\}/g;
|
|
42
|
+
let match;
|
|
43
|
+
while ((match = templateRegex.exec(expr)) !== null) {
|
|
44
|
+
const template = match[0];
|
|
45
|
+
const innerExpr = match[1].trim();
|
|
46
|
+
console.log(`Validating template: "${template}" with inner expression: "${innerExpr}"`);
|
|
47
|
+
// Check for empty expressions
|
|
48
|
+
if (!innerExpr) {
|
|
49
|
+
return new errors_1.ValidationError(`Empty template expression in node "${nodeId}": ${template}`);
|
|
50
|
+
}
|
|
51
|
+
// Check for balanced parentheses
|
|
52
|
+
let parenCount = 0;
|
|
53
|
+
for (const char of innerExpr) {
|
|
54
|
+
if (char === "(")
|
|
55
|
+
parenCount++;
|
|
56
|
+
if (char === ")")
|
|
57
|
+
parenCount--;
|
|
58
|
+
if (parenCount < 0) {
|
|
59
|
+
return new errors_1.ValidationError(`Unbalanced parentheses in node "${nodeId}" expression: ${innerExpr}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (parenCount !== 0) {
|
|
63
|
+
return new errors_1.ValidationError(`Unbalanced parentheses in node "${nodeId}" expression: ${innerExpr}`);
|
|
64
|
+
}
|
|
65
|
+
// Validate JSONata expression
|
|
66
|
+
try {
|
|
67
|
+
console.log(`Attempting to parse JSONata expression: "${innerExpr}"`);
|
|
68
|
+
(0, jsonata_1.default)(innerExpr);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
console.log(`JSONata parse error:`, e);
|
|
72
|
+
return new errors_1.ValidationError(`Invalid JSONata expression in node "${nodeId}": ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
};
|
|
77
|
+
const validateNestedExpressions = (obj, nodeId, errors) => {
|
|
78
|
+
if (typeof obj === "string") {
|
|
79
|
+
const error = validateTemplateExpression(obj, nodeId);
|
|
80
|
+
if (error) {
|
|
81
|
+
errors.push(error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (typeof obj === "object" && obj !== null) {
|
|
85
|
+
Object.values(obj).forEach((value) => {
|
|
86
|
+
if (typeof value === "string") {
|
|
87
|
+
const error = validateTemplateExpression(value, nodeId);
|
|
88
|
+
if (error) {
|
|
89
|
+
errors.push(error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (typeof value === "object" && value !== null) {
|
|
93
|
+
validateNestedExpressions(value, nodeId, errors);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Validates a workflow definition
|
|
100
|
+
*/
|
|
101
|
+
function validateWorkflow(workflow) {
|
|
102
|
+
const errors = [];
|
|
103
|
+
try {
|
|
104
|
+
// Validate entire workflow against schema
|
|
105
|
+
core_1.WorkflowGraphSchema.parse(workflow);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.log("Caught error constructor:", error?.constructor?.name);
|
|
109
|
+
console.log(error);
|
|
110
|
+
// Duck-typing check for ZodError properties (name and issues array)
|
|
111
|
+
if (error &&
|
|
112
|
+
typeof error === "object" &&
|
|
113
|
+
error.name === "ZodError" &&
|
|
114
|
+
Array.isArray(error.issues)) {
|
|
115
|
+
console.log("Looks like a ZodError (duck typing with name check)");
|
|
116
|
+
// Safely access .issues since we've confirmed it's an array
|
|
117
|
+
const message = error.issues.map((e) => e.message).join(", ");
|
|
118
|
+
errors.push(new errors_1.ValidationError(message));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.log("Does not look like a ZodError");
|
|
122
|
+
errors.push(error);
|
|
123
|
+
}
|
|
124
|
+
return { isValid: false, errors };
|
|
125
|
+
}
|
|
126
|
+
// Additional validation for business rules
|
|
127
|
+
for (const node of workflow.nodes) {
|
|
128
|
+
// Validate node IDs
|
|
129
|
+
if (!/^[a-zA-Z0-9_]+$/.test(node.id)) {
|
|
130
|
+
errors.push(new errors_1.InvalidNodeIdError(node.id));
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
// Validate HTTP configuration
|
|
134
|
+
if (node.type === "http") {
|
|
135
|
+
const httpNode = node;
|
|
136
|
+
if (!isValidUrl(httpNode.http.url)) {
|
|
137
|
+
errors.push(new errors_1.ValidationError(`Invalid URL in node "${node.id}": ${httpNode.http.url}`));
|
|
138
|
+
}
|
|
139
|
+
// Validate GET requests don't have body
|
|
140
|
+
if (httpNode.http.method === "GET" && httpNode.http.body) {
|
|
141
|
+
errors.push(new errors_1.ValidationError(`GET request in node "${node.id}" cannot have a body`));
|
|
142
|
+
}
|
|
143
|
+
// Validate JSONata expressions in body
|
|
144
|
+
if (httpNode.http.body) {
|
|
145
|
+
validateNestedExpressions(httpNode.http.body, node.id, errors);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Validate agent configuration
|
|
149
|
+
if (node.type === "agent") {
|
|
150
|
+
const agentNode = node;
|
|
151
|
+
// Validate max iterations is set and valid
|
|
152
|
+
if (agentNode.http.config?.max_iterations === undefined) {
|
|
153
|
+
errors.push(new errors_1.ValidationError(`Agent node "${node.id}" must have max_iterations set. Use .withMaxIterations() to configure it.`));
|
|
154
|
+
}
|
|
155
|
+
else if (agentNode.http.config.max_iterations < 1) {
|
|
156
|
+
errors.push(new errors_1.ValidationError(`Max iterations in agent node "${node.id}" must be greater than 0`));
|
|
157
|
+
}
|
|
158
|
+
// Validate tools exist in global tools
|
|
159
|
+
if (agentNode.tools.length > 0 && workflow.tools) {
|
|
160
|
+
const availableTools = new Set(workflow.tools.map((t) => t.id));
|
|
161
|
+
const missingTools = agentNode.tools.filter((tool) => !availableTools.has(tool));
|
|
162
|
+
if (missingTools.length > 0) {
|
|
163
|
+
errors.push(new errors_1.ValidationError(`Tools not found in global tools for agent node "${node.id}": ${missingTools.join(", ")}`));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Validate URL
|
|
167
|
+
if (!isValidUrl(agentNode.http.url)) {
|
|
168
|
+
errors.push(new errors_1.ValidationError(`Invalid URL in agent node "${node.id}": ${agentNode.http.url}`));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Validate dependencies
|
|
173
|
+
const nodeIds = new Set(workflow.nodes.map((n) => n.id));
|
|
174
|
+
for (const node of workflow.nodes) {
|
|
175
|
+
if ("dependencies" in node) {
|
|
176
|
+
const missingDeps = node.dependencies.filter((dep) => !nodeIds.has(dep));
|
|
177
|
+
if (missingDeps.length > 0) {
|
|
178
|
+
errors.push(new errors_1.MissingDependencyError(node.id, missingDeps));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Validate error boundary protected nodes
|
|
182
|
+
if (node.type === "error_boundary" && "protectedNodes" in node) {
|
|
183
|
+
const missingNodes = node.protectedNodes.filter((n) => !nodeIds.has(n));
|
|
184
|
+
if (missingNodes.length > 0) {
|
|
185
|
+
errors.push(new errors_1.MissingDependencyError(node.id, missingNodes));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Check for circular dependencies
|
|
190
|
+
const visited = new Set();
|
|
191
|
+
const stack = new Set();
|
|
192
|
+
function detectCycle(nodeId) {
|
|
193
|
+
if (stack.has(nodeId)) {
|
|
194
|
+
const cycle = Array.from(stack);
|
|
195
|
+
const startIndex = cycle.indexOf(nodeId);
|
|
196
|
+
return cycle.slice(startIndex);
|
|
197
|
+
}
|
|
198
|
+
if (visited.has(nodeId)) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
visited.add(nodeId);
|
|
202
|
+
stack.add(nodeId);
|
|
203
|
+
const node = workflow.nodes.find((n) => n.id === nodeId);
|
|
204
|
+
if (node && "dependencies" in node) {
|
|
205
|
+
for (const dep of node.dependencies) {
|
|
206
|
+
const cyclePath = detectCycle(dep);
|
|
207
|
+
if (cyclePath) {
|
|
208
|
+
return cyclePath;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
stack.delete(nodeId);
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
for (const node of workflow.nodes) {
|
|
216
|
+
const cycle = detectCycle(node.id);
|
|
217
|
+
if (cycle) {
|
|
218
|
+
errors.push(new errors_1.CircularDependencyError(cycle));
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
isValid: errors.length === 0,
|
|
224
|
+
errors,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Validates a JSONata expression within a node's configuration
|
|
229
|
+
* @param expr - The JSONata expression to validate
|
|
230
|
+
* @param nodeId - The ID of the node containing the expression
|
|
231
|
+
* @returns A validation result indicating success or failure
|
|
232
|
+
*/
|
|
233
|
+
function validateExpression(expr, nodeId) {
|
|
234
|
+
try {
|
|
235
|
+
// First check for mismatched {{ }}
|
|
236
|
+
const openCount = (expr.match(/\{\{/g) || []).length;
|
|
237
|
+
const closeCount = (expr.match(/\}\}/g) || []).length;
|
|
238
|
+
if (openCount !== closeCount) {
|
|
239
|
+
return {
|
|
240
|
+
isValid: false,
|
|
241
|
+
errors: [new errors_1.ValidationError(`Mismatched braces in expression for node ${nodeId}`)],
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return { isValid: true, errors: [] };
|
|
245
|
+
}
|
|
246
|
+
catch (e) {
|
|
247
|
+
console.error(`Error validating expression for node ${nodeId}:`, e);
|
|
248
|
+
return {
|
|
249
|
+
isValid: false,
|
|
250
|
+
errors: [
|
|
251
|
+
new errors_1.ValidationError(`Invalid expression for node ${nodeId}: ${e instanceof Error ? e.message : String(e)}`),
|
|
252
|
+
],
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Validates a template string containing JSONata expressions
|
|
258
|
+
* @param template - The template string to validate
|
|
259
|
+
* @param nodeId - The ID of the node containing the template
|
|
260
|
+
* @returns A validation result indicating success or failure
|
|
261
|
+
*/
|
|
262
|
+
function validateTemplate(template, nodeId) {
|
|
263
|
+
try {
|
|
264
|
+
// First check for mismatched {{ }}
|
|
265
|
+
const openCount = (template.match(/\{\{/g) || []).length;
|
|
266
|
+
const closeCount = (template.match(/\}\}/g) || []).length;
|
|
267
|
+
if (openCount !== closeCount) {
|
|
268
|
+
return {
|
|
269
|
+
isValid: false,
|
|
270
|
+
errors: [new errors_1.ValidationError(`Mismatched braces in template for node ${nodeId}`)],
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
// Extract and validate JSONata expressions
|
|
274
|
+
const matches = template.match(/\{\{(.*?)\}\}/g);
|
|
275
|
+
if (matches) {
|
|
276
|
+
for (const match of matches) {
|
|
277
|
+
const innerExpr = match.slice(2, -2).trim();
|
|
278
|
+
try {
|
|
279
|
+
(0, jsonata_1.default)(innerExpr);
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
console.error(`JSONata parse error in node ${nodeId}:`, e);
|
|
283
|
+
return {
|
|
284
|
+
isValid: false,
|
|
285
|
+
errors: [
|
|
286
|
+
new errors_1.ValidationError(`Invalid JSONata expression in template for node ${nodeId}: ${e instanceof Error ? e.message : String(e)}`),
|
|
287
|
+
],
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return { isValid: true, errors: [] };
|
|
293
|
+
}
|
|
294
|
+
catch (e) {
|
|
295
|
+
console.error(`Error validating template for node ${nodeId}:`, e);
|
|
296
|
+
return {
|
|
297
|
+
isValid: false,
|
|
298
|
+
errors: [
|
|
299
|
+
new errors_1.ValidationError(`Invalid template for node ${nodeId}: ${e instanceof Error ? e.message : String(e)}`),
|
|
300
|
+
],
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":";;;;;;AAiHA,4CA4JC;AA0FQ,gDAAkB;AAAE,4CAAgB;AAvW7C,8CAA8F;AAC9F,sDAA8B;AAC9B,6BAAwB;AACxB,sCAKmB;AAEN,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;IACpB,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,0BAA0B;CACjE,CAAC,CAAC;AAIH,SAAS,U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;yBACF;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,sCAAsC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;QAClE,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE;gBACN,IAAI,wBAAe,CACjB,6BAA6B,MAAM,KAAK,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACrF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@graph-compose/client",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Client SDK for Graph Compose",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"graph",
|
|
16
|
+
"compose",
|
|
17
|
+
"client",
|
|
18
|
+
"sdk"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/graph-compose/graph-compose.git",
|
|
23
|
+
"directory": "packages/client"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"graphlib": "^2.1.8",
|
|
27
|
+
"zod": "^3.24.3",
|
|
28
|
+
"zod-openapi": "^4.2.4",
|
|
29
|
+
"zod-to-json-schema": "^3.24.1",
|
|
30
|
+
"@graph-compose/core": "1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/graphlib": "^2.1.8",
|
|
34
|
+
"@types/jest": "^29.5.12",
|
|
35
|
+
"@types/node": "^20.11.24",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
37
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
38
|
+
"eslint": "^8.57.0",
|
|
39
|
+
"jest": "^29.7.0",
|
|
40
|
+
"jest-summary-reporter": "^0.0.2",
|
|
41
|
+
"prettier": "^3.2.5",
|
|
42
|
+
"rimraf": "^5.0.5",
|
|
43
|
+
"ts-jest": "^29.1.2",
|
|
44
|
+
"typescript": "^5.3.3"
|
|
45
|
+
},
|
|
46
|
+
"jest": {
|
|
47
|
+
"preset": "ts-jest",
|
|
48
|
+
"testEnvironment": "node",
|
|
49
|
+
"testMatch": [
|
|
50
|
+
"**/__tests__/**/*.test.ts"
|
|
51
|
+
],
|
|
52
|
+
"moduleFileExtensions": [
|
|
53
|
+
"ts",
|
|
54
|
+
"js",
|
|
55
|
+
"json"
|
|
56
|
+
],
|
|
57
|
+
"transform": {
|
|
58
|
+
"^.+\\.ts$": [
|
|
59
|
+
"ts-jest",
|
|
60
|
+
{
|
|
61
|
+
"tsconfig": "tsconfig.json"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"verbose": true,
|
|
66
|
+
"reporters": [
|
|
67
|
+
"default",
|
|
68
|
+
"jest-summary-reporter"
|
|
69
|
+
],
|
|
70
|
+
"collectCoverage": false,
|
|
71
|
+
"coverageDirectory": "coverage",
|
|
72
|
+
"coverageReporters": [
|
|
73
|
+
"text",
|
|
74
|
+
"lcov"
|
|
75
|
+
],
|
|
76
|
+
"coveragePathIgnorePatterns": [
|
|
77
|
+
"/node_modules/",
|
|
78
|
+
"/__tests__/fixtures/",
|
|
79
|
+
"/__tests__/performance/"
|
|
80
|
+
],
|
|
81
|
+
"testTimeout": 30000
|
|
82
|
+
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"build": "tsc",
|
|
85
|
+
"watch": "tsc -w",
|
|
86
|
+
"test": "GRAPH_COMPOSE_TOKEN=test-token jest --verbose --reporters=default --reporters=jest-summary-reporter",
|
|
87
|
+
"test:single": "clear && jest --verbose --runInBand \"./src/__tests__/$1.test.ts\"",
|
|
88
|
+
"test:agent": "clear && jest --verbose \"./src/__tests__/agent/**/*.test.ts\"",
|
|
89
|
+
"clean": "rimraf dist",
|
|
90
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
91
|
+
"lint": "eslint \"src/**/*.ts\""
|
|
92
|
+
}
|
|
93
|
+
}
|