json-function-engine 0.8.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 +509 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -0
- package/dist/engine/Executor.d.ts +92 -0
- package/dist/engine/Executor.d.ts.map +1 -0
- package/dist/engine/Executor.js +260 -0
- package/dist/engine/Executor.js.map +1 -0
- package/dist/engine/FileLoader.d.ts +51 -0
- package/dist/engine/FileLoader.d.ts.map +1 -0
- package/dist/engine/FileLoader.js +195 -0
- package/dist/engine/FileLoader.js.map +1 -0
- package/dist/engine/Pipeline.d.ts +54 -0
- package/dist/engine/Pipeline.d.ts.map +1 -0
- package/dist/engine/Pipeline.js +91 -0
- package/dist/engine/Pipeline.js.map +1 -0
- package/dist/engine/actions/BlockAction.d.ts +3 -0
- package/dist/engine/actions/BlockAction.d.ts.map +1 -0
- package/dist/engine/actions/BlockAction.js +13 -0
- package/dist/engine/actions/BlockAction.js.map +1 -0
- package/dist/engine/actions/FlagAction.d.ts +3 -0
- package/dist/engine/actions/FlagAction.d.ts.map +1 -0
- package/dist/engine/actions/FlagAction.js +29 -0
- package/dist/engine/actions/FlagAction.js.map +1 -0
- package/dist/engine/actions/NotifyAction.d.ts +3 -0
- package/dist/engine/actions/NotifyAction.d.ts.map +1 -0
- package/dist/engine/actions/NotifyAction.js +13 -0
- package/dist/engine/actions/NotifyAction.js.map +1 -0
- package/dist/engine/actions/TransformAction.d.ts +3 -0
- package/dist/engine/actions/TransformAction.d.ts.map +1 -0
- package/dist/engine/actions/TransformAction.js +13 -0
- package/dist/engine/actions/TransformAction.js.map +1 -0
- package/dist/engine/actions/index.d.ts +5 -0
- package/dist/engine/actions/index.d.ts.map +1 -0
- package/dist/engine/actions/index.js +5 -0
- package/dist/engine/actions/index.js.map +1 -0
- package/dist/engine/conditions/ArrayCondition.d.ts +3 -0
- package/dist/engine/conditions/ArrayCondition.d.ts.map +1 -0
- package/dist/engine/conditions/ArrayCondition.js +47 -0
- package/dist/engine/conditions/ArrayCondition.js.map +1 -0
- package/dist/engine/conditions/ComparisonCondition.d.ts +3 -0
- package/dist/engine/conditions/ComparisonCondition.d.ts.map +1 -0
- package/dist/engine/conditions/ComparisonCondition.js +42 -0
- package/dist/engine/conditions/ComparisonCondition.js.map +1 -0
- package/dist/engine/conditions/CompositeCondition.d.ts +3 -0
- package/dist/engine/conditions/CompositeCondition.d.ts.map +1 -0
- package/dist/engine/conditions/CompositeCondition.js +50 -0
- package/dist/engine/conditions/CompositeCondition.js.map +1 -0
- package/dist/engine/conditions/ExistsCondition.d.ts +3 -0
- package/dist/engine/conditions/ExistsCondition.d.ts.map +1 -0
- package/dist/engine/conditions/ExistsCondition.js +14 -0
- package/dist/engine/conditions/ExistsCondition.js.map +1 -0
- package/dist/engine/conditions/MathCondition.d.ts +3 -0
- package/dist/engine/conditions/MathCondition.d.ts.map +1 -0
- package/dist/engine/conditions/MathCondition.js +30 -0
- package/dist/engine/conditions/MathCondition.js.map +1 -0
- package/dist/engine/conditions/RegexCondition.d.ts +3 -0
- package/dist/engine/conditions/RegexCondition.d.ts.map +1 -0
- package/dist/engine/conditions/RegexCondition.js +10 -0
- package/dist/engine/conditions/RegexCondition.js.map +1 -0
- package/dist/engine/conditions/helpers.d.ts +3 -0
- package/dist/engine/conditions/helpers.d.ts.map +1 -0
- package/dist/engine/conditions/helpers.js +14 -0
- package/dist/engine/conditions/helpers.js.map +1 -0
- package/dist/engine/conditions/index.d.ts +7 -0
- package/dist/engine/conditions/index.d.ts.map +1 -0
- package/dist/engine/conditions/index.js +7 -0
- package/dist/engine/conditions/index.js.map +1 -0
- package/dist/engine/engine.d.ts +151 -0
- package/dist/engine/engine.d.ts.map +1 -0
- package/dist/engine/engine.js +246 -0
- package/dist/engine/engine.js.map +1 -0
- package/dist/engine/guards.d.ts +22 -0
- package/dist/engine/guards.d.ts.map +1 -0
- package/dist/engine/guards.js +84 -0
- package/dist/engine/guards.js.map +1 -0
- package/dist/engine/registry.d.ts +23 -0
- package/dist/engine/registry.d.ts.map +1 -0
- package/dist/engine/registry.js +93 -0
- package/dist/engine/registry.js.map +1 -0
- package/dist/engine/reporters/index.d.ts +12 -0
- package/dist/engine/reporters/index.d.ts.map +1 -0
- package/dist/engine/reporters/index.js +146 -0
- package/dist/engine/reporters/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +204 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +27 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cache.d.ts +17 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +52 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/errors.d.ts +45 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +84 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/factories.d.ts +23 -0
- package/dist/utils/factories.d.ts.map +1 -0
- package/dist/utils/factories.js +63 -0
- package/dist/utils/factories.js.map +1 -0
- package/dist/utils/metrics.d.ts +75 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/metrics.js +99 -0
- package/dist/utils/metrics.js.map +1 -0
- package/dist/utils/regex.d.ts +33 -0
- package/dist/utils/regex.d.ts.map +1 -0
- package/dist/utils/regex.js +226 -0
- package/dist/utils/regex.js.map +1 -0
- package/dist/utils/schema.d.ts +7 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +226 -0
- package/dist/utils/schema.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { runWithTimeout } from '../utils/regex.js';
|
|
2
|
+
import { Pipeline } from './Pipeline.js';
|
|
3
|
+
import { DEFAULT_TIMEOUT_MS } from '../constants.js';
|
|
4
|
+
import { createDefaultLogger } from '../utils/factories.js';
|
|
5
|
+
import { DefaultMetricsCollector } from '../utils/metrics.js';
|
|
6
|
+
export class Executor {
|
|
7
|
+
registry;
|
|
8
|
+
logger;
|
|
9
|
+
options;
|
|
10
|
+
pipeline;
|
|
11
|
+
metrics;
|
|
12
|
+
errors;
|
|
13
|
+
cancelled = false;
|
|
14
|
+
constructor(dependencies, options = {}) {
|
|
15
|
+
if (!dependencies.registry) {
|
|
16
|
+
throw new Error('Executor requires a Registry to be provided in dependencies');
|
|
17
|
+
}
|
|
18
|
+
this.registry = dependencies.registry;
|
|
19
|
+
this.logger = dependencies.logger ?? createDefaultLogger();
|
|
20
|
+
this.metrics = dependencies.metrics ?? new DefaultMetricsCollector();
|
|
21
|
+
this.options = {
|
|
22
|
+
timeout: options.timeout ?? DEFAULT_TIMEOUT_MS,
|
|
23
|
+
parallel: options.parallel ?? true
|
|
24
|
+
};
|
|
25
|
+
this.pipeline = new Pipeline();
|
|
26
|
+
this.errors = [];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Cancel the current execution
|
|
30
|
+
*/
|
|
31
|
+
cancel() {
|
|
32
|
+
this.cancelled = true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if execution was cancelled
|
|
36
|
+
*/
|
|
37
|
+
isCancelled() {
|
|
38
|
+
return this.cancelled;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Reset cancelled state for next execution
|
|
42
|
+
*/
|
|
43
|
+
resetCancellation() {
|
|
44
|
+
this.cancelled = false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the execution pipeline
|
|
48
|
+
*/
|
|
49
|
+
getPipeline() {
|
|
50
|
+
return this.pipeline;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Execute functions against files
|
|
54
|
+
*/
|
|
55
|
+
async execute(functions, files, context) {
|
|
56
|
+
this.resetCancellation(); // Reset cancelled state for new execution
|
|
57
|
+
const endTimer = this.metrics.startTimer('execute');
|
|
58
|
+
this.errors = []; // Reset errors for this execution
|
|
59
|
+
this.metrics.increment('functionsEnabled', functions.length);
|
|
60
|
+
this.metrics.increment('filesProcessed', files.length);
|
|
61
|
+
const enabledFunctions = functions.filter(f => f.enabled !== false);
|
|
62
|
+
// Run beforeExecute hooks
|
|
63
|
+
let pipelineData = { files, functions: enabledFunctions };
|
|
64
|
+
if (this.pipeline.hasHooks('beforeExecute')) {
|
|
65
|
+
pipelineData = await this.pipeline.execute('beforeExecute', context, pipelineData);
|
|
66
|
+
}
|
|
67
|
+
const allFindings = [];
|
|
68
|
+
try {
|
|
69
|
+
// Pre-split lines for each file
|
|
70
|
+
const filesWithLines = (pipelineData.files || files).map(f => ({
|
|
71
|
+
...f,
|
|
72
|
+
lines: f.content.split('\n')
|
|
73
|
+
}));
|
|
74
|
+
// Process files (parallel or sequential)
|
|
75
|
+
const fileResults = this.options.parallel
|
|
76
|
+
? await Promise.all(filesWithLines.map(f => this.processFile(f, enabledFunctions, context)))
|
|
77
|
+
: await this.sequentialProcess(filesWithLines, enabledFunctions, context);
|
|
78
|
+
for (const findings of fileResults) {
|
|
79
|
+
allFindings.push(...findings);
|
|
80
|
+
}
|
|
81
|
+
// Run afterExecute hooks
|
|
82
|
+
if (this.pipeline.hasHooks('afterExecute')) {
|
|
83
|
+
await this.pipeline.execute('afterExecute', context, { findings: allFindings });
|
|
84
|
+
}
|
|
85
|
+
// Track finding counts by severity
|
|
86
|
+
for (const finding of allFindings) {
|
|
87
|
+
this.metrics.increment('findings');
|
|
88
|
+
this.metrics.increment(`findings.${finding.severity}`);
|
|
89
|
+
}
|
|
90
|
+
return allFindings;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
// Run onError hooks
|
|
94
|
+
if (this.pipeline.hasHooks('onError') && error instanceof Error) {
|
|
95
|
+
await this.pipeline.execute('onError', context, { error, findings: allFindings });
|
|
96
|
+
}
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
endTimer();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get execution errors with classification
|
|
105
|
+
*/
|
|
106
|
+
getErrors() {
|
|
107
|
+
return [...this.errors];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get the metrics collector
|
|
111
|
+
*/
|
|
112
|
+
getMetrics() {
|
|
113
|
+
return this.metrics;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Classify an error based on its characteristics
|
|
117
|
+
*/
|
|
118
|
+
classifyError(error, functionId, file) {
|
|
119
|
+
const errorMessage = error.message.toLowerCase();
|
|
120
|
+
// Check for timeout errors
|
|
121
|
+
if (errorMessage.includes('timeout') || errorMessage.includes('timed out')) {
|
|
122
|
+
return {
|
|
123
|
+
functionId,
|
|
124
|
+
file,
|
|
125
|
+
error: error.message,
|
|
126
|
+
phase: 'condition',
|
|
127
|
+
type: 'timeout'
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
// Check for validation errors
|
|
131
|
+
if (errorMessage.includes('validation') || errorMessage.includes('invalid') || errorMessage.includes('schema')) {
|
|
132
|
+
return {
|
|
133
|
+
functionId,
|
|
134
|
+
file,
|
|
135
|
+
error: error.message,
|
|
136
|
+
phase: 'condition',
|
|
137
|
+
type: 'validation'
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
// Check for runtime errors
|
|
141
|
+
if (errorMessage.includes('typeerror') || errorMessage.includes('referenceerror') || errorMessage.includes('syntaxerror')) {
|
|
142
|
+
return {
|
|
143
|
+
functionId,
|
|
144
|
+
file,
|
|
145
|
+
error: error.message,
|
|
146
|
+
phase: 'action',
|
|
147
|
+
type: 'runtime'
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
// Default to unknown
|
|
151
|
+
return {
|
|
152
|
+
functionId,
|
|
153
|
+
file,
|
|
154
|
+
error: error.message,
|
|
155
|
+
phase: 'action',
|
|
156
|
+
type: 'unknown'
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Process files sequentially
|
|
161
|
+
*/
|
|
162
|
+
async sequentialProcess(files, fns, context) {
|
|
163
|
+
const results = [];
|
|
164
|
+
for (const file of files) {
|
|
165
|
+
// Check for cancellation between files
|
|
166
|
+
if (this.cancelled) {
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
const findings = await this.processFile(file, fns, context);
|
|
170
|
+
results.push(findings);
|
|
171
|
+
}
|
|
172
|
+
return results;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Process a single file through all enabled functions
|
|
176
|
+
*/
|
|
177
|
+
async processFile(file, fns, context) {
|
|
178
|
+
const findings = [];
|
|
179
|
+
const fileContext = { ...context, file: file.path, lines: file.lines };
|
|
180
|
+
for (const fn of fns) {
|
|
181
|
+
// Check for cancellation between functions
|
|
182
|
+
if (this.cancelled) {
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
this.metrics.increment('functionsExecuted');
|
|
186
|
+
try {
|
|
187
|
+
const result = await runWithTimeout(this.evaluateFunction(fn, file, fileContext), this.options.timeout, `Function ${fn.id} timed out`);
|
|
188
|
+
if (result.findings) {
|
|
189
|
+
for (const finding of result.findings) {
|
|
190
|
+
finding.functionId = fn.id;
|
|
191
|
+
}
|
|
192
|
+
findings.push(...result.findings);
|
|
193
|
+
}
|
|
194
|
+
if (result.blocked) {
|
|
195
|
+
this.logger.warn(`Execution blocked by function ${fn.id}: ${result.error}`);
|
|
196
|
+
this.metrics.increment('blocked');
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
if (error instanceof Error) {
|
|
202
|
+
this.logger.warn(`Error executing function ${fn.id}:`, error);
|
|
203
|
+
// Classify and track the error
|
|
204
|
+
this.errors.push(this.classifyError(error, fn.id, file.path));
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
const errorMessage = String(error);
|
|
208
|
+
this.logger.warn(`Error executing function ${fn.id}:`, error);
|
|
209
|
+
this.errors.push({
|
|
210
|
+
functionId: fn.id,
|
|
211
|
+
file: file.path,
|
|
212
|
+
error: errorMessage,
|
|
213
|
+
phase: 'action',
|
|
214
|
+
type: 'unknown'
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
this.metrics.increment('errors');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return findings;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Evaluate a function against a file
|
|
224
|
+
*/
|
|
225
|
+
async evaluateFunction(fn, file, context) {
|
|
226
|
+
// Inject evaluateCondition callback into context for composite conditions
|
|
227
|
+
const contextWithCallback = {
|
|
228
|
+
...context,
|
|
229
|
+
evaluateCondition: (config, ctx, f) => this.registry.evaluateCondition(config, ctx, f)
|
|
230
|
+
};
|
|
231
|
+
// Evaluate condition
|
|
232
|
+
const conditionResult = await this.registry.evaluateCondition(fn.condition, contextWithCallback, file);
|
|
233
|
+
// Execute action
|
|
234
|
+
const actionResult = await this.registry.executeAction(fn.action, contextWithCallback, conditionResult, file);
|
|
235
|
+
// Assign function ID to findings
|
|
236
|
+
if (actionResult.findings) {
|
|
237
|
+
for (const finding of actionResult.findings) {
|
|
238
|
+
finding.functionId = fn.id;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
findings: actionResult.findings,
|
|
243
|
+
blocked: actionResult.blocked,
|
|
244
|
+
error: actionResult.error
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Set the logger (acceptable to change at runtime)
|
|
249
|
+
*/
|
|
250
|
+
setLogger(logger) {
|
|
251
|
+
this.logger = logger;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Update options
|
|
255
|
+
*/
|
|
256
|
+
setOptions(options) {
|
|
257
|
+
this.options = { ...this.options, ...options };
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=Executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Executor.js","sourceRoot":"","sources":["../../src/engine/Executor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAgB,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAyB,MAAM,qBAAqB,CAAC;AAwBrF,MAAM,OAAO,QAAQ;IACX,QAAQ,CAAW;IACnB,MAAM,CAAS;IACf,OAAO,CAA4B;IACnC,QAAQ,CAAW;IACnB,OAAO,CAAmB;IAC1B,MAAM,CAAoB;IAC1B,SAAS,GAAY,KAAK,CAAC;IAEnC,YAAY,YAAkC,EAAE,UAA2B,EAAE;QAC3E,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,mBAAmB,EAAE,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,IAAI,uBAAuB,EAAE,CAAC;QACrE,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,kBAAkB;YAC9C,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI;SACnC,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAA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AAE,YAAY,CAAC,OAAO;YAC7B,KAAK,EAAE,YAAY,CAAC,KAAK;SAC1B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAiC;QAC1C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { FunctionDefinition, FileSystem, Logger } from '../types/index.js';
|
|
2
|
+
export interface FileLoaderDependencies {
|
|
3
|
+
fileSystem?: FileSystem;
|
|
4
|
+
logger?: Logger;
|
|
5
|
+
}
|
|
6
|
+
export interface ExpandedResult {
|
|
7
|
+
loaded: number;
|
|
8
|
+
errors: Array<{
|
|
9
|
+
path: string;
|
|
10
|
+
error: string;
|
|
11
|
+
}>;
|
|
12
|
+
functions: FunctionDefinition[];
|
|
13
|
+
}
|
|
14
|
+
export declare class FileLoader {
|
|
15
|
+
private fileSystem;
|
|
16
|
+
private logger;
|
|
17
|
+
constructor(dependencies?: FileLoaderDependencies);
|
|
18
|
+
/**
|
|
19
|
+
* Load functions from JSON files
|
|
20
|
+
*/
|
|
21
|
+
load(paths: string | string[], options?: {
|
|
22
|
+
include?: string[];
|
|
23
|
+
exclude?: string[];
|
|
24
|
+
}): Promise<ExpandedResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Load a single file and parse its functions
|
|
27
|
+
*/
|
|
28
|
+
loadFile(path: string): Promise<{
|
|
29
|
+
path: string;
|
|
30
|
+
error?: string;
|
|
31
|
+
functions: FunctionDefinition[];
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Expand glob pattern to list of file paths
|
|
35
|
+
*/
|
|
36
|
+
expandGlob(pattern: string): Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Match a name against a glob pattern
|
|
39
|
+
*/
|
|
40
|
+
private matchGlob;
|
|
41
|
+
/**
|
|
42
|
+
* Get compiled regex from shared cache
|
|
43
|
+
*/
|
|
44
|
+
private getCompiledRegex;
|
|
45
|
+
/**
|
|
46
|
+
* Clear the regex cache (delegates to shared cache)
|
|
47
|
+
* @deprecated Cache is now managed by the shared LRU cache in regex.ts
|
|
48
|
+
*/
|
|
49
|
+
clearCache(): void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=FileLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileLoader.d.ts","sourceRoot":"","sources":["../../src/engine/FileLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAe,UAAU,EAAE,MAAM,EAAyC,MAAM,mBAAmB,CAAC;AAMpI,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAgDD,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,MAAM,CAAS;gBAEX,YAAY,GAAE,sBAA2B;IAKrD;;OAEG;IACG,IAAI,CACR,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO,GACvD,OAAO,CAAC,cAAc,CAAC;IA6C1B;;OAEG;IACG,QAAQ,CACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAAC;IAqC7E;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAkDpD;;OAEG;IACH,OAAO,CAAC,SAAS;IAUjB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;OAGG;IACH,UAAU,IAAI,IAAI;CAInB"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { filterFunctionsByPattern, compileRegex } from '../utils/regex.js';
|
|
3
|
+
import { validateFunctionSet } from '../utils/schema.js';
|
|
4
|
+
import { createDefaultFileSystem, createDefaultLogger } from '../utils/factories.js';
|
|
5
|
+
import { FileError } from '../utils/errors.js';
|
|
6
|
+
/**
|
|
7
|
+
* Validate regex patterns in condition configurations
|
|
8
|
+
*/
|
|
9
|
+
function validateRegexPatterns(functions) {
|
|
10
|
+
const errors = [];
|
|
11
|
+
for (const fn of functions) {
|
|
12
|
+
if (!fn.condition)
|
|
13
|
+
continue;
|
|
14
|
+
const conditionErrors = validateConditionPatterns(fn.id, fn.condition);
|
|
15
|
+
errors.push(...conditionErrors);
|
|
16
|
+
}
|
|
17
|
+
return errors;
|
|
18
|
+
}
|
|
19
|
+
function validateConditionPatterns(functionId, config, path = '') {
|
|
20
|
+
const errors = [];
|
|
21
|
+
if (config.type === 'regex') {
|
|
22
|
+
const regexConfig = config;
|
|
23
|
+
if (regexConfig.pattern) {
|
|
24
|
+
try {
|
|
25
|
+
new RegExp(regexConfig.pattern);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
errors.push(`Invalid regex pattern in function '${functionId}'${path}: ${regexConfig.pattern}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Recursively validate composite conditions
|
|
33
|
+
if (config.type === 'composite' && 'conditions' in config) {
|
|
34
|
+
const compositeConfig = config;
|
|
35
|
+
for (let i = 0; i < compositeConfig.conditions.length; i++) {
|
|
36
|
+
const childErrors = validateConditionPatterns(functionId, compositeConfig.conditions[i], `${path}/conditions[${i}]`);
|
|
37
|
+
errors.push(...childErrors);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return errors;
|
|
41
|
+
}
|
|
42
|
+
export class FileLoader {
|
|
43
|
+
fileSystem;
|
|
44
|
+
logger;
|
|
45
|
+
constructor(dependencies = {}) {
|
|
46
|
+
this.fileSystem = dependencies.fileSystem ?? createDefaultFileSystem();
|
|
47
|
+
this.logger = dependencies.logger ?? createDefaultLogger();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Load functions from JSON files
|
|
51
|
+
*/
|
|
52
|
+
async load(paths, options = {}) {
|
|
53
|
+
const filePaths = Array.isArray(paths) ? paths : [paths];
|
|
54
|
+
const loadedFunctions = [];
|
|
55
|
+
const errors = [];
|
|
56
|
+
// Use parallel loading
|
|
57
|
+
const loadResults = await Promise.all(filePaths.map(async (filePath) => {
|
|
58
|
+
const expandedPaths = await this.expandGlob(filePath);
|
|
59
|
+
return Promise.all(expandedPaths.map(async (path) => {
|
|
60
|
+
try {
|
|
61
|
+
return await this.loadFile(path);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65
|
+
return { path, error: errorMessage, functions: [] };
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
}));
|
|
69
|
+
// Flatten results
|
|
70
|
+
for (const fileResults of loadResults) {
|
|
71
|
+
for (const result of fileResults) {
|
|
72
|
+
if (result.error) {
|
|
73
|
+
errors.push({ path: result.path, error: result.error });
|
|
74
|
+
this.logger.warn(`Failed to load functions from ${result.path}:`, result.error);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
loadedFunctions.push(...result.functions);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Filter by pattern
|
|
82
|
+
const filteredFunctions = filterFunctionsByPattern(loadedFunctions, options.include || [], options.exclude || []);
|
|
83
|
+
return { loaded: filteredFunctions.length, errors, functions: filteredFunctions };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Load a single file and parse its functions
|
|
87
|
+
*/
|
|
88
|
+
async loadFile(path) {
|
|
89
|
+
let content;
|
|
90
|
+
try {
|
|
91
|
+
content = await this.fileSystem.readFile(path, 'utf-8');
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
95
|
+
throw new FileError(`Failed to read file '${path}': ${error.message}`, path, error);
|
|
96
|
+
}
|
|
97
|
+
let parsed;
|
|
98
|
+
try {
|
|
99
|
+
parsed = JSON.parse(content);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
103
|
+
throw new FileError(`Failed to parse JSON in '${path}': ${error.message}`, path, error);
|
|
104
|
+
}
|
|
105
|
+
// Only accept "functions" key in JSON
|
|
106
|
+
const functions = (parsed.functions || []);
|
|
107
|
+
const functionSet = { version: parsed.version, functions: functions };
|
|
108
|
+
// Validate against schema
|
|
109
|
+
const validationErrors = validateFunctionSet(functionSet);
|
|
110
|
+
if (validationErrors.length > 0) {
|
|
111
|
+
const errorMessages = validationErrors.map(e => `${e.path}: ${e.message}`).join('; ');
|
|
112
|
+
return { path, error: `Schema validation failed: ${errorMessages}`, functions: [] };
|
|
113
|
+
}
|
|
114
|
+
// Validate regex patterns
|
|
115
|
+
const regexErrors = validateRegexPatterns(functions);
|
|
116
|
+
if (regexErrors.length > 0) {
|
|
117
|
+
return { path, error: `Invalid regex patterns: ${regexErrors.join('; ')}`, functions: [] };
|
|
118
|
+
}
|
|
119
|
+
return { path, functions };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Expand glob pattern to list of file paths
|
|
123
|
+
*/
|
|
124
|
+
async expandGlob(pattern) {
|
|
125
|
+
const parts = pattern.split('/');
|
|
126
|
+
let currentDir = '.';
|
|
127
|
+
// Find the directory part
|
|
128
|
+
const globIndex = parts.findIndex(p => p.includes('*') || p.includes('?'));
|
|
129
|
+
if (globIndex === -1) {
|
|
130
|
+
// No glob, return as-is if file exists
|
|
131
|
+
try {
|
|
132
|
+
await this.fileSystem.stat(pattern);
|
|
133
|
+
return [pattern];
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Join non-glob parts as directory
|
|
140
|
+
if (globIndex > 0) {
|
|
141
|
+
currentDir = join(...parts.slice(0, globIndex));
|
|
142
|
+
}
|
|
143
|
+
const globPart = parts[globIndex];
|
|
144
|
+
const remainingParts = parts.slice(globIndex + 1);
|
|
145
|
+
try {
|
|
146
|
+
const entries = await this.fileSystem.readdir(currentDir);
|
|
147
|
+
const matches = entries.filter(name => this.matchGlob(name, globPart));
|
|
148
|
+
if (remainingParts.length > 0) {
|
|
149
|
+
// Recurse into matched directories
|
|
150
|
+
const result = [];
|
|
151
|
+
for (const match of matches) {
|
|
152
|
+
const subPath = join(currentDir, match);
|
|
153
|
+
const stats = await this.fileSystem.stat(subPath);
|
|
154
|
+
if (stats.isDirectory()) {
|
|
155
|
+
const subResults = await this.expandGlob(join(subPath, ...remainingParts));
|
|
156
|
+
result.push(...subResults);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
return matches.map(m => join(currentDir, m));
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
// Log warning for failed glob expansion
|
|
165
|
+
this.logger.warn(`Failed to expand glob pattern '${pattern}':`, error);
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Match a name against a glob pattern
|
|
171
|
+
*/
|
|
172
|
+
matchGlob(name, pattern) {
|
|
173
|
+
const regexPattern = pattern
|
|
174
|
+
.replace(/\./g, '\\.')
|
|
175
|
+
.replace(/\*/g, '.*')
|
|
176
|
+
.replace(/\?/g, '.');
|
|
177
|
+
const regex = this.getCompiledRegex(`^${regexPattern}$`);
|
|
178
|
+
return regex.test(name);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get compiled regex from shared cache
|
|
182
|
+
*/
|
|
183
|
+
getCompiledRegex(pattern) {
|
|
184
|
+
return compileRegex(pattern);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Clear the regex cache (delegates to shared cache)
|
|
188
|
+
* @deprecated Cache is now managed by the shared LRU cache in regex.ts
|
|
189
|
+
*/
|
|
190
|
+
clearCache() {
|
|
191
|
+
// No-op: cache is now managed by the shared LRU cache in regex.ts
|
|
192
|
+
// This method is kept for API compatibility
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=FileLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileLoader.js","sourceRoot":"","sources":["../../src/engine/FileLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAa/C;;GAEG;AACH,SAAS,qBAAqB,CAAC,SAA+B;IAC5D,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,EAAE,CAAC,SAAS;YAAE,SAAS;QAE5B,MAAM,eAAe,GAAG,yBAAyB,CA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AC;IAC/B,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,kEAAkE;QAClE,4CAA4C;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { FunctionDefinition, FileInput, ExecutionContext, Finding, Logger } from '../types/index.js';
|
|
2
|
+
export type PipelineHookType = 'beforeLoad' | 'beforeExecute' | 'afterExecute' | 'onError';
|
|
3
|
+
export interface PipelineHook {
|
|
4
|
+
type: PipelineHookType;
|
|
5
|
+
name: string;
|
|
6
|
+
handler: PipelineHandler;
|
|
7
|
+
}
|
|
8
|
+
export type PipelineHandler = (context: ExecutionContext, data: PipelineData) => Promise<PipelineData> | PipelineData;
|
|
9
|
+
export interface PipelineData {
|
|
10
|
+
files?: FileInput[];
|
|
11
|
+
findings?: Finding[];
|
|
12
|
+
functions?: FunctionDefinition[];
|
|
13
|
+
error?: Error;
|
|
14
|
+
result?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface PipelineOptions {
|
|
17
|
+
logger?: Logger;
|
|
18
|
+
parallel?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class Pipeline {
|
|
21
|
+
private hooks;
|
|
22
|
+
private logger;
|
|
23
|
+
private parallel;
|
|
24
|
+
constructor(options?: PipelineOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Register a hook to the pipeline
|
|
27
|
+
*/
|
|
28
|
+
register(hook: PipelineHook): void;
|
|
29
|
+
/**
|
|
30
|
+
* Unregister a hook from the pipeline
|
|
31
|
+
*/
|
|
32
|
+
unregister(type: PipelineHookType, name: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Execute hooks of a specific type
|
|
35
|
+
*/
|
|
36
|
+
execute(type: PipelineHookType, context: ExecutionContext, data: PipelineData): Promise<PipelineData>;
|
|
37
|
+
/**
|
|
38
|
+
* Get all registered hooks
|
|
39
|
+
*/
|
|
40
|
+
getHooks(type?: PipelineHookType): PipelineHook[];
|
|
41
|
+
/**
|
|
42
|
+
* Clear all hooks
|
|
43
|
+
*/
|
|
44
|
+
clear(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Check if pipeline has hooks of a specific type
|
|
47
|
+
*/
|
|
48
|
+
hasHooks(type: PipelineHookType): boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create a pipeline hook helper
|
|
52
|
+
*/
|
|
53
|
+
export declare function createHook(type: PipelineHookType, name: string, handler: PipelineHandler): PipelineHook;
|
|
54
|
+
//# sourceMappingURL=Pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pipeline.d.ts","sourceRoot":"","sources":["../../src/engine/Pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG1G,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,eAAe,GAAG,cAAc,GAAG,SAAS,CAAC;AAE3F,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAE1C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,QAAQ;IACnB,OA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