@netlify/config
Advanced tools
Comparing version 20.8.0 to 20.8.1
import { isString, validProperties } from './validate/helpers.js'; | ||
const cacheValues = ['manual', 'off']; | ||
const methodValues = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']; | ||
const isMethod = (value) => typeof value === 'string' && methodValues.includes(value.toUpperCase()); | ||
export const validations = [ | ||
{ | ||
property: 'edge_functions.*', | ||
...validProperties(['path', 'excludedPath', 'pattern', 'excludedPattern', 'function', 'cache'], []), | ||
...validProperties(['path', 'excludedPath', 'pattern', 'excludedPattern', 'function', 'cache', 'method'], []), | ||
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }), | ||
@@ -79,2 +81,8 @@ }, | ||
}, | ||
{ | ||
property: 'edge_functions.*.method', | ||
check: (value) => isMethod(value) || (Array.isArray(value) && value.length !== 0 && value.every(isMethod)), | ||
message: `must be one of or array of: ${methodValues.join(', ')}`, | ||
example: () => ({ edge_functions: [{ method: ['PUT', 'DELETE'], path: '/hello', function: 'hello' }] }), | ||
}, | ||
]; |
@@ -9,2 +9,3 @@ import { existsSync } from 'fs'; | ||
* - a local path with the --config CLI flag | ||
* - a `netlify.*` file in the `repositoryRoot/{base}/{packagePath}` | ||
* - a `netlify.*` file in the `repositoryRoot/{base}` | ||
@@ -11,0 +12,0 @@ * - a `netlify.*` file in the `repositoryRoot` |
{ | ||
"name": "@netlify/config", | ||
"version": "20.8.0", | ||
"version": "20.8.1", | ||
"description": "Netlify config module", | ||
@@ -97,3 +97,3 @@ "type": "module", | ||
}, | ||
"gitHead": "0c6f5c014958f692559ea720c38415a0e63b7522" | ||
"gitHead": "0eb6dbbfd00ba11941b1ef638811eded8a030a17" | ||
} |
130990
2876