netlify-cli 17.22.1 → 17.23.1

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.
Files changed (39) hide show
  1. package/dist/commands/functions/functions-create.js +4 -4
  2. package/dist/lib/http-agent.js +1 -1
  3. package/dist/tsconfig.tsbuildinfo +1 -1
  4. package/dist/utils/deploy/deploy-site.d.ts.map +1 -1
  5. package/dist/utils/deploy/deploy-site.js +0 -1
  6. package/dist/utils/deploy/hash-fns.d.ts +13 -3
  7. package/dist/utils/deploy/hash-fns.d.ts.map +1 -1
  8. package/dist/utils/deploy/hash-fns.js +25 -12
  9. package/functions-templates/javascript/scheduled-function/package.json +1 -1
  10. package/functions-templates/typescript/hello-world/package-lock.json +53 -19
  11. package/functions-templates/typescript/hello-world/package.json +1 -1
  12. package/functions-templates/typescript/scheduled-function/package.json +1 -1
  13. package/npm-shrinkwrap.json +798 -507
  14. package/package.json +11 -11
  15. /package/functions-templates/go/hello-world/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  16. /package/functions-templates/javascript/hello/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  17. /package/functions-templates/javascript/hello-world/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  18. /package/functions-templates/javascript/identity-signup/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  19. /package/functions-templates/javascript/image-external/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  20. /package/functions-templates/javascript/localized-content/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  21. /package/functions-templates/javascript/sanity-create/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  22. /package/functions-templates/javascript/sanity-groq/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  23. /package/functions-templates/javascript/scheduled-function/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  24. /package/functions-templates/javascript/set-cookies/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  25. /package/functions-templates/javascript/set-req-header/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  26. /package/functions-templates/javascript/set-res-header/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  27. /package/functions-templates/javascript/submission-created/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  28. /package/functions-templates/javascript/transform-response/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  29. /package/functions-templates/rust/hello-world/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  30. /package/functions-templates/typescript/abtest/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  31. /package/functions-templates/typescript/geolocation/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  32. /package/functions-templates/typescript/hello-world/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  33. /package/functions-templates/typescript/json/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  34. /package/functions-templates/typescript/log/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  35. /package/functions-templates/typescript/scheduled-function/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  36. /package/functions-templates/typescript/set-cookies/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  37. /package/functions-templates/typescript/set-req-header/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  38. /package/functions-templates/typescript/set-res-header/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
  39. /package/functions-templates/typescript/transform-response/{.netlify-function-template.js → .netlify-function-template.mjs} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-site.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/deploy-site.ts"],"names":[],"mappings":"AAKA,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAwBvD,eAAO,MAAM,UAAU,YACZ,WAAW,OACf,QAAQ;;;;;;yBA4CS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;gBAI7D,MAAM;;;;;EAwIrB,CAAA"}
1
+ {"version":3,"file":"deploy-site.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/deploy-site.ts"],"names":[],"mappings":"AAKA,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAwBvD,eAAO,MAAM,UAAU,YACZ,WAAW,OACf,QAAQ;;;;;;yBA4CS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;gBAI7D,MAAM;;;;;EAuIrB,CAAA"}
@@ -89,7 +89,6 @@ skipFunctionsCache, statusCb = () => {
89
89
  throw new Error('No files or functions to deploy');
90
90
  }
91
91
  if (functionsWithNativeModules.length !== 0) {
92
- // @ts-expect-error TS(7031) FIXME: Binding element 'name' implicitly has an 'any' typ... Remove this comment to see the full error message
93
92
  const functionsWithNativeModulesMessage = functionsWithNativeModules.map(({ name }) => `- ${name}`).join('\n');
94
93
  warn(`Modules with native dependencies\n
95
94
  ${functionsWithNativeModulesMessage}
@@ -20,11 +20,21 @@ declare const hashFns: (command: BaseCommand, directories: string[], config: {
20
20
  fnShaMap?: undefined;
21
21
  fnConfig?: undefined;
22
22
  } | {
23
- functionSchedules: any;
23
+ functionSchedules: ("" | {
24
+ name: string;
25
+ cron: string;
26
+ } | undefined)[];
24
27
  functions: {};
25
- functionsWithNativeModules: any;
28
+ functionsWithNativeModules: (Omit<import("@netlify/zip-it-and-ship-it/dist/function.js").FunctionArchive, "runtime"> & {
29
+ routes?: import("@netlify/zip-it-and-ship-it/dist/utils/routes.js").Route[] | undefined;
30
+ runtime: import("@netlify/zip-it-and-ship-it").RuntimeName;
31
+ schedule?: string | undefined;
32
+ runtimeAPIVersion?: number | undefined;
33
+ } & {
34
+ buildData?: unknown;
35
+ })[];
26
36
  fnShaMap: {};
27
- fnConfig: any;
37
+ fnConfig: {};
28
38
  shaMap?: undefined;
29
39
  }>;
30
40
  export default hashFns;
@@ -1 +1 @@
1
- {"version":3,"file":"hash-fns.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/hash-fns.ts"],"names":[],"mappings":"AAUA,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA+ElD,QAAA,MAAM,OAAO,YACF,WAAW,eACP,MAAM,EAAE,UACb;IACN,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,QAAQ,CAAA;IACzB,wBAAwB;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,QAAQ,CAAA;IACtB,OAAO,EAAE,QAAQ,CAAA;IACjB,kBAAkB,EAAE,QAAQ,CAAA;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,QAAQ,CAAA;CACjB;;;;;;;;;;;;;;EA0FF,CAAA;AAED,eAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"hash-fns.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/hash-fns.ts"],"names":[],"mappings":"AAYA,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAoGlD,QAAA,MAAM,OAAO,YACF,WAAW,eACP,MAAM,EAAE,UACb;IACN,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,QAAQ,CAAA;IACzB,wBAAwB;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,QAAQ,CAAA;IACtB,OAAO,EAAE,QAAQ,CAAA;IACjB,kBAAkB,EAAE,QAAQ,CAAA;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,QAAQ,CAAA;CACjB;;;;;;;;;;;;;;;;;;;oBAvFyC,OAAO;;;;;EA4LlD,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -57,6 +57,25 @@ const getFunctionZips = async ({ command, directories, functionsConfig, manifest
57
57
  config: functionsConfig,
58
58
  });
59
59
  };
60
+ const trafficRulesConfig = (trafficRules) => {
61
+ if (!trafficRules) {
62
+ return;
63
+ }
64
+ return {
65
+ action: {
66
+ type: trafficRules?.action?.type,
67
+ config: {
68
+ rate_limit_config: {
69
+ algorithm: trafficRules?.action?.config?.rateLimitConfig?.algorithm,
70
+ window_size: trafficRules?.action?.config?.rateLimitConfig?.windowSize,
71
+ window_limit: trafficRules?.action?.config?.rateLimitConfig?.windowLimit,
72
+ },
73
+ aggregate: trafficRules?.action?.config?.aggregate,
74
+ to: trafficRules?.action?.config?.to,
75
+ },
76
+ },
77
+ };
78
+ };
60
79
  const hashFns = async (command, directories, config) => {
61
80
  const { assetType = 'function', concurrentHash, functionsConfig, hashAlgorithm = 'sha256', manifestPath, rootDir, skipFunctionsCache, statusCb, tmpDir, } = config || {};
62
81
  // Early out if no functions directories are configured.
@@ -76,9 +95,7 @@ const hashFns = async (command, directories, config) => {
76
95
  statusCb,
77
96
  tmpDir,
78
97
  });
79
- const fileObjs = functionZips.map(
80
- // @ts-expect-error TS(7031) FIXME: Binding element 'buildData' implicitly has an 'any... Remove this comment to see the full error message
81
- ({ buildData, displayName, generator, invocationMode, path: functionPath, priority, runtime, runtimeVersion }) => ({
98
+ const fileObjs = functionZips.map(({ buildData, displayName, generator, invocationMode, path: functionPath, priority, runtime, runtimeVersion, trafficRules, }) => ({
82
99
  filepath: functionPath,
83
100
  root: tmpDir,
84
101
  relname: path.relative(tmpDir, functionPath),
@@ -93,13 +110,11 @@ const hashFns = async (command, directories, config) => {
93
110
  invocationMode,
94
111
  buildData,
95
112
  priority,
113
+ trafficRules,
96
114
  }));
97
115
  const fnConfig = functionZips
98
- // @ts-expect-error TS(7006) FIXME: Parameter 'func' implicitly has an 'any' type.
99
- .filter((func) => Boolean(func.displayName || func.generator || func.routes || func.buildData))
100
- .reduce(
101
- // @ts-expect-error TS(7006) FIXME: Parameter 'funcs' implicitly has an 'any' type.
102
- (funcs, curr) => ({
116
+ .filter((func) => Boolean(func.displayName || func.generator || func.routes || func.buildData || func.priority || func.trafficRules))
117
+ .reduce((funcs, curr) => ({
103
118
  ...funcs,
104
119
  [curr.name]: {
105
120
  display_name: curr.displayName,
@@ -107,15 +122,13 @@ const hashFns = async (command, directories, config) => {
107
122
  routes: curr.routes,
108
123
  build_data: curr.buildData,
109
124
  priority: curr.priority,
125
+ traffic_rules: trafficRulesConfig(curr.trafficRules),
110
126
  },
111
127
  }), {});
112
128
  const functionSchedules = functionZips
113
- // @ts-expect-error TS(7031) FIXME: Binding element 'name' implicitly has an 'any' typ... Remove this comment to see the full error message
114
129
  .map(({ name, schedule }) => schedule && { name, cron: schedule })
115
130
  .filter(Boolean);
116
- const functionsWithNativeModules = functionZips.filter(
117
- // @ts-expect-error TS(7031) FIXME: Binding element 'nativeNodeModules' implicitly has... Remove this comment to see the full error message
118
- ({ nativeNodeModules }) => nativeNodeModules !== undefined && Object.keys(nativeNodeModules).length !== 0);
131
+ const functionsWithNativeModules = functionZips.filter(({ nativeNodeModules }) => nativeNodeModules !== undefined && Object.keys(nativeNodeModules).length !== 0);
119
132
  const functionStream = fromArray.obj(fileObjs);
120
133
  const hasher = hasherCtor({ concurrentHash, hashAlgorithm });
121
134
  // Written to by manifestCollector
@@ -15,6 +15,6 @@
15
15
  "author": "Netlify",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@netlify/functions": "^1.6.0"
18
+ "@netlify/functions": "^2.6.0"
19
19
  }
20
20
  }
@@ -9,32 +9,47 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@netlify/functions": "^1.6.0",
12
+ "@netlify/functions": "^2.6.0",
13
13
  "@types/node": "^14.0.0",
14
14
  "typescript": "^4.0.0"
15
15
  }
16
16
  },
17
17
  "node_modules/@netlify/functions": {
18
- "version": "1.6.0",
19
- "resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-1.6.0.tgz",
20
- "integrity": "sha512-6G92AlcpFrQG72XU8YH8pg94eDnq7+Q0YJhb8x4qNpdGsvuzvrfHWBmqFGp/Yshmv4wex9lpsTRZOocdrA2erQ==",
18
+ "version": "2.6.0",
19
+ "resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-2.6.0.tgz",
20
+ "integrity": "sha512-vU20tij0fb4nRGACqb+5SQvKd50JYyTyEhQetCMHdakcJFzjLDivvRR16u1G2Oy4A7xNAtGJF1uz8reeOtTVcQ==",
21
21
  "dependencies": {
22
- "is-promise": "^4.0.0"
22
+ "@netlify/serverless-functions-api": "1.14.0"
23
23
  },
24
24
  "engines": {
25
25
  "node": ">=14.0.0"
26
26
  }
27
27
  },
28
+ "node_modules/@netlify/node-cookies": {
29
+ "version": "0.1.0",
30
+ "resolved": "https://registry.npmjs.org/@netlify/node-cookies/-/node-cookies-0.1.0.tgz",
31
+ "integrity": "sha512-OAs1xG+FfLX0LoRASpqzVntVV/RpYkgpI0VrUnw2u0Q1qiZUzcPffxRK8HF3gc4GjuhG5ahOEMJ9bswBiZPq0g==",
32
+ "engines": {
33
+ "node": "^14.16.0 || >=16.0.0"
34
+ }
35
+ },
36
+ "node_modules/@netlify/serverless-functions-api": {
37
+ "version": "1.14.0",
38
+ "resolved": "https://registry.npmjs.org/@netlify/serverless-functions-api/-/serverless-functions-api-1.14.0.tgz",
39
+ "integrity": "sha512-HUNETLNvNiC2J+SB/YuRwJA9+agPrc0azSoWVk8H85GC+YE114hcS5JW+dstpKwVerp2xILE3vNWN7IMXP5Q5Q==",
40
+ "dependencies": {
41
+ "@netlify/node-cookies": "^0.1.0",
42
+ "urlpattern-polyfill": "8.0.2"
43
+ },
44
+ "engines": {
45
+ "node": "^14.18.0 || >=16.0.0"
46
+ }
47
+ },
28
48
  "node_modules/@types/node": {
29
49
  "version": "14.18.63",
30
50
  "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz",
31
51
  "integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ=="
32
52
  },
33
- "node_modules/is-promise": {
34
- "version": "4.0.0",
35
- "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
36
- "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
37
- },
38
53
  "node_modules/typescript": {
39
54
  "version": "4.9.5",
40
55
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
@@ -46,15 +61,34 @@
46
61
  "engines": {
47
62
  "node": ">=4.2.0"
48
63
  }
64
+ },
65
+ "node_modules/urlpattern-polyfill": {
66
+ "version": "8.0.2",
67
+ "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-8.0.2.tgz",
68
+ "integrity": "sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ=="
49
69
  }
50
70
  },
51
71
  "dependencies": {
52
72
  "@netlify/functions": {
53
- "version": "1.6.0",
54
- "resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-1.6.0.tgz",
55
- "integrity": "sha512-6G92AlcpFrQG72XU8YH8pg94eDnq7+Q0YJhb8x4qNpdGsvuzvrfHWBmqFGp/Yshmv4wex9lpsTRZOocdrA2erQ==",
73
+ "version": "2.6.0",
74
+ "resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-2.6.0.tgz",
75
+ "integrity": "sha512-vU20tij0fb4nRGACqb+5SQvKd50JYyTyEhQetCMHdakcJFzjLDivvRR16u1G2Oy4A7xNAtGJF1uz8reeOtTVcQ==",
76
+ "requires": {
77
+ "@netlify/serverless-functions-api": "1.14.0"
78
+ }
79
+ },
80
+ "@netlify/node-cookies": {
81
+ "version": "0.1.0",
82
+ "resolved": "https://registry.npmjs.org/@netlify/node-cookies/-/node-cookies-0.1.0.tgz",
83
+ "integrity": "sha512-OAs1xG+FfLX0LoRASpqzVntVV/RpYkgpI0VrUnw2u0Q1qiZUzcPffxRK8HF3gc4GjuhG5ahOEMJ9bswBiZPq0g=="
84
+ },
85
+ "@netlify/serverless-functions-api": {
86
+ "version": "1.14.0",
87
+ "resolved": "https://registry.npmjs.org/@netlify/serverless-functions-api/-/serverless-functions-api-1.14.0.tgz",
88
+ "integrity": "sha512-HUNETLNvNiC2J+SB/YuRwJA9+agPrc0azSoWVk8H85GC+YE114hcS5JW+dstpKwVerp2xILE3vNWN7IMXP5Q5Q==",
56
89
  "requires": {
57
- "is-promise": "^4.0.0"
90
+ "@netlify/node-cookies": "^0.1.0",
91
+ "urlpattern-polyfill": "8.0.2"
58
92
  }
59
93
  },
60
94
  "@types/node": {
@@ -62,15 +96,15 @@
62
96
  "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz",
63
97
  "integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ=="
64
98
  },
65
- "is-promise": {
66
- "version": "4.0.0",
67
- "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
68
- "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
69
- },
70
99
  "typescript": {
71
100
  "version": "4.9.5",
72
101
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
73
102
  "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g=="
103
+ },
104
+ "urlpattern-polyfill": {
105
+ "version": "8.0.2",
106
+ "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-8.0.2.tgz",
107
+ "integrity": "sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ=="
74
108
  }
75
109
  }
76
110
  }
@@ -14,7 +14,7 @@
14
14
  "author": "Netlify",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@netlify/functions": "^1.6.0",
17
+ "@netlify/functions": "^2.6.0",
18
18
  "@types/node": "^14.0.0",
19
19
  "typescript": "^4.0.0"
20
20
  }
@@ -15,7 +15,7 @@
15
15
  "author": "Netlify",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@netlify/functions": "^1.6.0",
18
+ "@netlify/functions": "^2.6.0",
19
19
  "@types/node": "^18.0.0",
20
20
  "typescript": "^4.5.5"
21
21
  }