@netlify/config 23.1.0 → 23.2.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/lib/edge_functions.js +21 -1
- package/package.json +2 -2
package/lib/edge_functions.js
CHANGED
|
@@ -2,10 +2,12 @@ import { isString, validProperties } from './validate/helpers.js';
|
|
|
2
2
|
const cacheValues = ['manual', 'off'];
|
|
3
3
|
const methodValues = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
|
|
4
4
|
const isMethod = (value) => typeof value === 'string' && methodValues.includes(value.toUpperCase());
|
|
5
|
+
const isValidHeaderValue = (value) => typeof value === 'boolean' || typeof value === 'string';
|
|
6
|
+
const isValidHeaders = (value) => typeof value === 'object' && value !== null && !Array.isArray(value) && Object.values(value).every(isValidHeaderValue);
|
|
5
7
|
export const validations = [
|
|
6
8
|
{
|
|
7
9
|
property: 'edge_functions.*',
|
|
8
|
-
...validProperties(['path', 'excludedPath', 'pattern', 'excludedPattern', 'function', 'cache', 'method'], []),
|
|
10
|
+
...validProperties(['path', 'excludedPath', 'pattern', 'excludedPattern', 'function', 'cache', 'method', 'header'], []),
|
|
9
11
|
example: () => ({ edge_functions: [{ path: '/hello', function: 'hello' }] }),
|
|
10
12
|
},
|
|
11
13
|
{
|
|
@@ -84,4 +86,22 @@ export const validations = [
|
|
|
84
86
|
message: `must be one of or array of: ${methodValues.join(', ')}`,
|
|
85
87
|
example: () => ({ edge_functions: [{ method: ['PUT', 'DELETE'], path: '/hello', function: 'hello' }] }),
|
|
86
88
|
},
|
|
89
|
+
{
|
|
90
|
+
property: 'edge_functions.*.header',
|
|
91
|
+
check: isValidHeaders,
|
|
92
|
+
message: 'must be an object with string keys and boolean or string values.',
|
|
93
|
+
example: () => ({
|
|
94
|
+
edge_functions: [
|
|
95
|
+
{
|
|
96
|
+
path: '/hello',
|
|
97
|
+
function: 'hello',
|
|
98
|
+
header: {
|
|
99
|
+
'x-must-be-present': true,
|
|
100
|
+
'x-must-not-be-present': false,
|
|
101
|
+
'x-must-match-value': '^(value1|value2)$',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
}),
|
|
106
|
+
},
|
|
87
107
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.2.0",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": ">=18.14.0"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "243d65788aca4867c78403ac15c267f76feb6c00"
|
|
99
99
|
}
|