@netlify/config
Advanced tools
Comparing version 20.5.1 to 20.5.2
@@ -6,3 +6,3 @@ import { isString, validProperties } from './validate/helpers.js'; | ||
property: 'edge_functions.*', | ||
...validProperties(['path', 'function', 'cache'], []), | ||
...validProperties(['path', 'excludedPath', 'pattern', 'excludedPattern', 'function', 'cache'], []), | ||
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }), | ||
@@ -12,4 +12,4 @@ }, | ||
property: 'edge_functions.*', | ||
check: (edgeFunction) => edgeFunction.path !== undefined, | ||
message: '"path" property is required.', | ||
check: (edgeFunction) => edgeFunction.path !== undefined || edgeFunction.pattern !== undefined, | ||
message: 'either "path" or "pattern" is required.', | ||
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }), | ||
@@ -19,2 +19,8 @@ }, | ||
property: 'edge_functions.*', | ||
check: (edgeFunction) => !(edgeFunction.path !== undefined && edgeFunction.pattern !== undefined), | ||
message: '"path" and "pattern" are mutually exclusive.', | ||
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }), | ||
}, | ||
{ | ||
property: 'edge_functions.*', | ||
check: (edgeFunction) => edgeFunction.function !== undefined, | ||
@@ -31,2 +37,40 @@ message: '"function" property is required.', | ||
{ | ||
property: 'edge_functions.*.excludedPath', | ||
check: (value) => isString(value) || (Array.isArray(value) && value.every(isString)), | ||
message: 'must be a string or array of strings.', | ||
example: () => ({ | ||
edge_functions: [{ path: '/products/*', excludedPath: ['/products/*.jpg'], function: 'customise' }], | ||
}), | ||
}, | ||
{ | ||
property: 'edge_functions.*', | ||
check: (value) => value.excludedPath === undefined || value.path !== undefined, | ||
message: '"excludedPath" can only be specified together with "path".', | ||
example: () => ({ | ||
edge_functions: [{ path: '/products/*', excludedPath: ['/products/*.jpg'], function: 'customise' }], | ||
}), | ||
}, | ||
{ | ||
property: 'edge_functions.*.pattern', | ||
check: isString, | ||
message: 'must be a string.', | ||
example: () => ({ edge_functions: [{ pattern: '/hello/(.*)', function: 'hello' }] }), | ||
}, | ||
{ | ||
property: 'edge_functions.*.excludedPattern', | ||
check: (value) => isString(value) || (Array.isArray(value) && value.every(isString)), | ||
message: 'must be a string or array of strings.', | ||
example: () => ({ | ||
edge_functions: [{ path: '/products/(.*)', excludedPath: ['/products/(.*)\\.jpg'], function: 'customise' }], | ||
}), | ||
}, | ||
{ | ||
property: 'edge_functions.*.excludedPattern', | ||
check: (value) => value.excludedPattern === undefined || value.pattern !== undefined, | ||
message: '"excludedPattern" can only be specified together with "pattern".', | ||
example: () => ({ | ||
edge_functions: [{ path: '/products/(.*)', excludedPath: ['/products/(.*)\\.jpg'], function: 'customise' }], | ||
}), | ||
}, | ||
{ | ||
property: 'edge_functions.*.function', | ||
@@ -33,0 +77,0 @@ check: isString, |
{ | ||
"name": "@netlify/config", | ||
"version": "20.5.1", | ||
"version": "20.5.2", | ||
"description": "Netlify config module", | ||
@@ -96,3 +96,3 @@ "type": "module", | ||
}, | ||
"gitHead": "a6c1b829ea47b4600dae206cdc5df2dda7296eed" | ||
"gitHead": "2bb08a1fb4ad1bca50cee1131b70cbd94a9f08a3" | ||
} |
128622
2785