MCPcopy
hub / github.com/breejs/bree / validateStringJob

Function validateStringJob

src/job-validator.js:23–51  ·  view source on GitHub ↗
(job, i, config)

Source from the content-addressed store, hash-verified

21};
22
23const validateStringJob = async (job, i, config) => {
24 const errors = [];
25
26 const jobNameError = validateReservedJobName(job);
27 if (jobNameError) {
28 throw jobNameError;
29 }
30
31 if (!config.root) {
32 errors.push(
33 new Error(
34 `Job #${
35 i + 1
36 } "${job}" requires root directory option to auto-populate path`
37 )
38 );
39 throw combineErrors(errors);
40 }
41
42 const path = join(
43 config.root,
44 getJobPath(job, config.acceptedExtensions, config.defaultExtension)
45 );
46
47 const stats = await fs.promises.stat(path);
48 if (!stats.isFile()) {
49 throw new Error(`Job #${i + 1} "${job}" path missing: ${path}`);
50 }
51};
52
53const validateFunctionJob = (job, i) => {
54 const errors = [];

Callers 1

validateFunction · 0.85

Calls 2

validateReservedJobNameFunction · 0.85
getJobPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…