@netlify/config 25.4.1 → 25.5.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.
@@ -423,5 +423,27 @@ export const POST_NORMALIZE_VALIDATIONS: ({
423
423
  size: string;
424
424
  };
425
425
  };
426
+ } | {
427
+ property: string;
428
+ check: (value: any) => boolean;
429
+ message: string;
430
+ example: () => {
431
+ server: {
432
+ scale: {
433
+ min: number;
434
+ };
435
+ };
436
+ };
437
+ } | {
438
+ property: string;
439
+ check: (value: any) => boolean;
440
+ message: string;
441
+ example: () => {
442
+ server: {
443
+ scale: {
444
+ max: number;
445
+ };
446
+ };
447
+ };
426
448
  })[];
427
449
  import isPlainObj from 'is-plain-obj';
@@ -31,9 +31,11 @@ const isValidFunctionMemory = (value) => {
31
31
  }
32
32
  return Number.isInteger(megabytes) && megabytes >= FUNCTION_MEMORY_MIN_MB && megabytes <= FUNCTION_MEMORY_MAX_MB;
33
33
  };
34
- const SERVER_PROPERTIES = ['excludedPath', 'includedFiles', 'path', 'region', 'size'];
34
+ const SERVER_PROPERTIES = ['excludedPath', 'includedFiles', 'path', 'region', 'scale', 'size'];
35
35
  const SERVER_REGIONS = ['cmh', 'fra'];
36
36
  const SERVER_SIZES = ['small', 'medium', 'large'];
37
+ const SERVER_SCALE_PROPERTIES = ['min', 'max'];
38
+ const isIntegerFrom = (min) => (value) => Number.isInteger(value) && value >= min;
37
39
  const isServerPath = (value) => isString(value) && value.startsWith('/');
38
40
  const isServerPaths = (value) => isServerPath(value) || (Array.isArray(value) && value.every(isServerPath));
39
41
  // List of validations performed on the configuration file.
@@ -387,5 +389,34 @@ export const POST_NORMALIZE_VALIDATIONS = [
387
389
  message: `must be one of: ${SERVER_SIZES.join(', ')}`,
388
390
  example: () => ({ server: { size: SERVER_SIZES[0] } }),
389
391
  },
392
+ {
393
+ property: 'server.scale',
394
+ check: isPlainObj,
395
+ message: 'must be a plain object.',
396
+ example: () => ({ server: { scale: { min: 0, max: 3 } } }),
397
+ },
398
+ {
399
+ property: 'server.scale',
400
+ ...validProperties(SERVER_SCALE_PROPERTIES, []),
401
+ example: () => ({ server: { scale: { min: 0, max: 3 } } }),
402
+ },
403
+ {
404
+ property: 'server.scale.min',
405
+ check: isIntegerFrom(0),
406
+ message: 'must be an integer greater than or equal to 0.',
407
+ example: () => ({ server: { scale: { min: 0 } } }),
408
+ },
409
+ {
410
+ property: 'server.scale.max',
411
+ check: isIntegerFrom(1),
412
+ message: 'must be an integer greater than or equal to 1.',
413
+ example: () => ({ server: { scale: { max: 3 } } }),
414
+ },
415
+ {
416
+ property: 'server.scale',
417
+ check: ({ min, max }) => min === undefined || max === undefined || min <= max,
418
+ message: 'must have a "min" less than or equal to its "max".',
419
+ example: () => ({ server: { scale: { min: 0, max: 3 } } }),
420
+ },
390
421
  ...edgeFunctionValidations,
391
422
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/config",
3
- "version": "25.4.1",
3
+ "version": "25.5.0",
4
4
  "description": "Netlify config module",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -94,5 +94,5 @@
94
94
  "engines": {
95
95
  "node": ">=22.12.0"
96
96
  },
97
- "gitHead": "33d74df3817de0bc8b237e82f2d7b10b4983c93c"
97
+ "gitHead": "a2dde99b2116c8dbea79e4ca18886d1466577a1c"
98
98
  }