netlify-cli 10.11.2 → 10.13.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.
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "10.11.2",
3
+ "version": "10.13.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "10.11.2",
9
+ "version": "10.13.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@netlify/build": "^27.5.0",
13
+ "@netlify/build": "^27.7.0",
14
14
  "@netlify/config": "^18.1.2",
15
- "@netlify/edge-bundler": "^1.7.0",
15
+ "@netlify/edge-bundler": "^1.8.0",
16
16
  "@netlify/framework-info": "^9.1.1",
17
17
  "@netlify/local-functions-proxy": "^1.1.1",
18
18
  "@netlify/plugins-list": "^6.35.0",
@@ -81,7 +81,7 @@
81
81
  "multiparty": "^4.2.1",
82
82
  "netlify": "^12.0.0",
83
83
  "netlify-headers-parser": "^6.0.2",
84
- "netlify-onegraph-internal": "0.3.6",
84
+ "netlify-onegraph-internal": "0.3.10",
85
85
  "netlify-redirect-parser": "^13.0.5",
86
86
  "netlify-redirector": "^0.2.1",
87
87
  "node-fetch": "^2.6.0",
@@ -1189,14 +1189,14 @@
1189
1189
  "integrity": "sha512-4wMPu9iN3/HL97QblBsBay3E1etIciR84izI3U+4iALY+JHCrI+a2jO0qbAZ/nxKoegypYEaiiqWXylm+/zfrw=="
1190
1190
  },
1191
1191
  "node_modules/@netlify/build": {
1192
- "version": "27.5.0",
1193
- "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.5.0.tgz",
1194
- "integrity": "sha512-xsoaYmJEmnyWKMPk+W//WbBrBuZm9Oee9lXj+W8oQTtFaYdmPk4X/QN2+YfkmKOf+E303uRERtDuNOrBIkPOPw==",
1192
+ "version": "27.7.0",
1193
+ "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.7.0.tgz",
1194
+ "integrity": "sha512-Vc7g12oNtLxPaU0qfYg0oKwqy5Y55w4cyW9AA45sC+9mTHJ1g1Rpa4KhdV365+oAjBqulfDEPdjgxV8/DBiayw==",
1195
1195
  "dependencies": {
1196
1196
  "@bugsnag/js": "^7.0.0",
1197
1197
  "@netlify/cache-utils": "^4.0.0",
1198
1198
  "@netlify/config": "^18.1.2",
1199
- "@netlify/edge-bundler": "^1.7.0",
1199
+ "@netlify/edge-bundler": "^1.8.0",
1200
1200
  "@netlify/functions-utils": "^4.2.2",
1201
1201
  "@netlify/git-utils": "^4.0.0",
1202
1202
  "@netlify/plugins-list": "^6.35.0",
@@ -1204,6 +1204,8 @@
1204
1204
  "@netlify/zip-it-and-ship-it": "5.13.2",
1205
1205
  "@sindresorhus/slugify": "^2.0.0",
1206
1206
  "@types/node": "^16.0.0",
1207
+ "ajv": "^8.11.0",
1208
+ "ajv-errors": "^3.0.0",
1207
1209
  "ansi-escapes": "^5.0.0",
1208
1210
  "chalk": "^5.0.0",
1209
1211
  "clean-stack": "^4.0.0",
@@ -1310,6 +1312,29 @@
1310
1312
  "url": "https://github.com/sponsors/sindresorhus"
1311
1313
  }
1312
1314
  },
1315
+ "node_modules/@netlify/build/node_modules/ajv": {
1316
+ "version": "8.11.0",
1317
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
1318
+ "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
1319
+ "dependencies": {
1320
+ "fast-deep-equal": "^3.1.1",
1321
+ "json-schema-traverse": "^1.0.0",
1322
+ "require-from-string": "^2.0.2",
1323
+ "uri-js": "^4.2.2"
1324
+ },
1325
+ "funding": {
1326
+ "type": "github",
1327
+ "url": "https://github.com/sponsors/epoberezkin"
1328
+ }
1329
+ },
1330
+ "node_modules/@netlify/build/node_modules/ajv-errors": {
1331
+ "version": "3.0.0",
1332
+ "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz",
1333
+ "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==",
1334
+ "peerDependencies": {
1335
+ "ajv": "^8.0.1"
1336
+ }
1337
+ },
1313
1338
  "node_modules/@netlify/build/node_modules/ansi-regex": {
1314
1339
  "version": "6.0.1",
1315
1340
  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
@@ -1553,6 +1578,11 @@
1553
1578
  "url": "https://github.com/sponsors/sindresorhus"
1554
1579
  }
1555
1580
  },
1581
+ "node_modules/@netlify/build/node_modules/json-schema-traverse": {
1582
+ "version": "1.0.0",
1583
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
1584
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
1585
+ },
1556
1586
  "node_modules/@netlify/build/node_modules/locate-path": {
1557
1587
  "version": "7.1.1",
1558
1588
  "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz",
@@ -2313,9 +2343,9 @@
2313
2343
  }
2314
2344
  },
2315
2345
  "node_modules/@netlify/edge-bundler": {
2316
- "version": "1.7.0",
2317
- "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.7.0.tgz",
2318
- "integrity": "sha512-aNTATeSkaFn+4+Lnyq0NUUq5IV2087TNtRm+jFqCKHBRLJQGogwKmBsqda5qDQxh8qxfGDOnhozEXyLNKXflSw==",
2346
+ "version": "1.8.0",
2347
+ "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.8.0.tgz",
2348
+ "integrity": "sha512-A9AqvNCpskKq1ScphTRwEP/iv0CnvUStWVfGVIrLHzzM3qegZeHJyiWUZ81CYScLceaVrj1DtQ68vNEhP+9JSA==",
2319
2349
  "dependencies": {
2320
2350
  "common-path-prefix": "^3.0.0",
2321
2351
  "del": "^6.0.0",
@@ -6217,9 +6247,9 @@
6217
6247
  }
6218
6248
  },
6219
6249
  "node_modules/c8": {
6220
- "version": "7.11.3",
6221
- "resolved": "https://registry.npmjs.org/c8/-/c8-7.11.3.tgz",
6222
- "integrity": "sha512-6YBmsaNmqRm9OS3ZbIiL2EZgi1+Xc4O24jL3vMYGE6idixYuGdy76rIfIdltSKDj9DpLNrcXSonUTR1miBD0wA==",
6250
+ "version": "7.12.0",
6251
+ "resolved": "https://registry.npmjs.org/c8/-/c8-7.12.0.tgz",
6252
+ "integrity": "sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==",
6223
6253
  "dev": true,
6224
6254
  "dependencies": {
6225
6255
  "@bcoe/v8-coverage": "^0.2.3",
@@ -16038,9 +16068,9 @@
16038
16068
  }
16039
16069
  },
16040
16070
  "node_modules/netlify-onegraph-internal": {
16041
- "version": "0.3.6",
16042
- "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.6.tgz",
16043
- "integrity": "sha512-nNqCWT2jzPmqw/3/sKf1RFicL2JEFjmxXTpnIzJKt5U+bnS633cOy5pImNnfBGTd50NTNvdZ0GXMhQ7AwH16Qg==",
16071
+ "version": "0.3.10",
16072
+ "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.10.tgz",
16073
+ "integrity": "sha512-8GeKcWbYPV3CCMJEj2LwkhP0eFCDDrt3XDTZuweWHAa5DTkRd6cSEnnH0BjTBBetoFfPKXDjbFmSiD9xobcnPA==",
16044
16074
  "dependencies": {
16045
16075
  "graphql": "16.0.0",
16046
16076
  "node-fetch": "^2.6.0",
@@ -23814,14 +23844,14 @@
23814
23844
  "integrity": "sha512-4wMPu9iN3/HL97QblBsBay3E1etIciR84izI3U+4iALY+JHCrI+a2jO0qbAZ/nxKoegypYEaiiqWXylm+/zfrw=="
23815
23845
  },
23816
23846
  "@netlify/build": {
23817
- "version": "27.5.0",
23818
- "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.5.0.tgz",
23819
- "integrity": "sha512-xsoaYmJEmnyWKMPk+W//WbBrBuZm9Oee9lXj+W8oQTtFaYdmPk4X/QN2+YfkmKOf+E303uRERtDuNOrBIkPOPw==",
23847
+ "version": "27.7.0",
23848
+ "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.7.0.tgz",
23849
+ "integrity": "sha512-Vc7g12oNtLxPaU0qfYg0oKwqy5Y55w4cyW9AA45sC+9mTHJ1g1Rpa4KhdV365+oAjBqulfDEPdjgxV8/DBiayw==",
23820
23850
  "requires": {
23821
23851
  "@bugsnag/js": "^7.0.0",
23822
23852
  "@netlify/cache-utils": "^4.0.0",
23823
23853
  "@netlify/config": "^18.1.2",
23824
- "@netlify/edge-bundler": "^1.7.0",
23854
+ "@netlify/edge-bundler": "^1.8.0",
23825
23855
  "@netlify/functions-utils": "^4.2.2",
23826
23856
  "@netlify/git-utils": "^4.0.0",
23827
23857
  "@netlify/plugins-list": "^6.35.0",
@@ -23829,6 +23859,8 @@
23829
23859
  "@netlify/zip-it-and-ship-it": "5.13.2",
23830
23860
  "@sindresorhus/slugify": "^2.0.0",
23831
23861
  "@types/node": "^16.0.0",
23862
+ "ajv": "^8.11.0",
23863
+ "ajv-errors": "^3.0.0",
23832
23864
  "ansi-escapes": "^5.0.0",
23833
23865
  "chalk": "^5.0.0",
23834
23866
  "clean-stack": "^4.0.0",
@@ -23905,6 +23937,23 @@
23905
23937
  "indent-string": "^5.0.0"
23906
23938
  }
23907
23939
  },
23940
+ "ajv": {
23941
+ "version": "8.11.0",
23942
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
23943
+ "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
23944
+ "requires": {
23945
+ "fast-deep-equal": "^3.1.1",
23946
+ "json-schema-traverse": "^1.0.0",
23947
+ "require-from-string": "^2.0.2",
23948
+ "uri-js": "^4.2.2"
23949
+ }
23950
+ },
23951
+ "ajv-errors": {
23952
+ "version": "3.0.0",
23953
+ "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz",
23954
+ "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==",
23955
+ "requires": {}
23956
+ },
23908
23957
  "ansi-regex": {
23909
23958
  "version": "6.0.1",
23910
23959
  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
@@ -24054,6 +24103,11 @@
24054
24103
  "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz",
24055
24104
  "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ=="
24056
24105
  },
24106
+ "json-schema-traverse": {
24107
+ "version": "1.0.0",
24108
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
24109
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
24110
+ },
24057
24111
  "locate-path": {
24058
24112
  "version": "7.1.1",
24059
24113
  "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz",
@@ -24491,9 +24545,9 @@
24491
24545
  }
24492
24546
  },
24493
24547
  "@netlify/edge-bundler": {
24494
- "version": "1.7.0",
24495
- "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.7.0.tgz",
24496
- "integrity": "sha512-aNTATeSkaFn+4+Lnyq0NUUq5IV2087TNtRm+jFqCKHBRLJQGogwKmBsqda5qDQxh8qxfGDOnhozEXyLNKXflSw==",
24548
+ "version": "1.8.0",
24549
+ "resolved": "https://registry.npmjs.org/@netlify/edge-bundler/-/edge-bundler-1.8.0.tgz",
24550
+ "integrity": "sha512-A9AqvNCpskKq1ScphTRwEP/iv0CnvUStWVfGVIrLHzzM3qegZeHJyiWUZ81CYScLceaVrj1DtQ68vNEhP+9JSA==",
24497
24551
  "requires": {
24498
24552
  "common-path-prefix": "^3.0.0",
24499
24553
  "del": "^6.0.0",
@@ -27214,9 +27268,9 @@
27214
27268
  "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
27215
27269
  },
27216
27270
  "c8": {
27217
- "version": "7.11.3",
27218
- "resolved": "https://registry.npmjs.org/c8/-/c8-7.11.3.tgz",
27219
- "integrity": "sha512-6YBmsaNmqRm9OS3ZbIiL2EZgi1+Xc4O24jL3vMYGE6idixYuGdy76rIfIdltSKDj9DpLNrcXSonUTR1miBD0wA==",
27271
+ "version": "7.12.0",
27272
+ "resolved": "https://registry.npmjs.org/c8/-/c8-7.12.0.tgz",
27273
+ "integrity": "sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==",
27220
27274
  "dev": true,
27221
27275
  "requires": {
27222
27276
  "@bcoe/v8-coverage": "^0.2.3",
@@ -34703,9 +34757,9 @@
34703
34757
  }
34704
34758
  },
34705
34759
  "netlify-onegraph-internal": {
34706
- "version": "0.3.6",
34707
- "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.6.tgz",
34708
- "integrity": "sha512-nNqCWT2jzPmqw/3/sKf1RFicL2JEFjmxXTpnIzJKt5U+bnS633cOy5pImNnfBGTd50NTNvdZ0GXMhQ7AwH16Qg==",
34760
+ "version": "0.3.10",
34761
+ "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.10.tgz",
34762
+ "integrity": "sha512-8GeKcWbYPV3CCMJEj2LwkhP0eFCDDrt3XDTZuweWHAa5DTkRd6cSEnnH0BjTBBetoFfPKXDjbFmSiD9xobcnPA==",
34709
34763
  "requires": {
34710
34764
  "graphql": "16.0.0",
34711
34765
  "node-fetch": "^2.6.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "10.11.2",
4
+ "version": "10.13.0",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
@@ -69,7 +69,7 @@
69
69
  "Joshua T. (http://localhost:8080)",
70
70
  "João Antunes <me@jgantunes.com> (https://twitter.com/jgantunes)",
71
71
  "Karagulamos (https://twitter.com/karagulamos)",
72
- "Karin Hendrikse (khendrikse.netlify.app)",
72
+ "Karin Hendrikse <khendrikse.netlify.app>",
73
73
  "Kaspar Emanuel <kaspar@monostable.co.uk> (https://twitter.com/kaspar_e)",
74
74
  "Keiko Oda (https://keikooda.net/)",
75
75
  "Krasimir Nedelchev (https://github.com/kaykayehnn)",
@@ -219,9 +219,9 @@
219
219
  "prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
220
220
  },
221
221
  "dependencies": {
222
- "@netlify/build": "^27.5.0",
222
+ "@netlify/build": "^27.7.0",
223
223
  "@netlify/config": "^18.1.2",
224
- "@netlify/edge-bundler": "^1.7.0",
224
+ "@netlify/edge-bundler": "^1.8.0",
225
225
  "@netlify/framework-info": "^9.1.1",
226
226
  "@netlify/local-functions-proxy": "^1.1.1",
227
227
  "@netlify/plugins-list": "^6.35.0",
@@ -290,7 +290,7 @@
290
290
  "multiparty": "^4.2.1",
291
291
  "netlify": "^12.0.0",
292
292
  "netlify-headers-parser": "^6.0.2",
293
- "netlify-onegraph-internal": "0.3.6",
293
+ "netlify-onegraph-internal": "0.3.10",
294
294
  "netlify-redirect-parser": "^13.0.5",
295
295
  "netlify-redirector": "^0.2.1",
296
296
  "node-fetch": "^2.6.0",
@@ -240,6 +240,7 @@ const FRAMEWORK_PORT_TIMEOUT = 6e5
240
240
  * @param {*} params.settings
241
241
  * @param {boolean} params.offline
242
242
  * @param {*} params.site
243
+ * @param {*} params.siteInfo
243
244
  * @param {import('../../utils/state-config').StateConfig} params.state
244
245
  * @returns
245
246
  */
@@ -253,6 +254,7 @@ const startProxyServer = async ({
253
254
  offline,
254
255
  settings,
255
256
  site,
257
+ siteInfo,
256
258
  state,
257
259
  }) => {
258
260
  const url = await startProxy({
@@ -267,8 +269,8 @@ const startProxyServer = async ({
267
269
  projectDir: site.root,
268
270
  settings,
269
271
  state,
272
+ siteInfo,
270
273
  })
271
-
272
274
  if (!url) {
273
275
  log(NETLIFYDEVERR, `Unable to start proxy server on port '${settings.port}'`)
274
276
  exit(1)
@@ -484,6 +486,7 @@ const dev = async (options, command) => {
484
486
  offline: options.offline,
485
487
  settings,
486
488
  site,
489
+ siteInfo,
487
490
  state,
488
491
  })
489
492
 
@@ -598,6 +601,7 @@ const createDevCommand = (program) => {
598
601
 
599
602
  return program
600
603
  .command('dev')
604
+ .alias('develop')
601
605
  .description(
602
606
  `Local dev server\nThe dev command will run a local dev server with Netlify's proxy and redirect rules`,
603
607
  )
@@ -33,9 +33,15 @@ const graphPull = async (options, command) => {
33
33
 
34
34
  const { jwt } = await OneGraphCliClient.getGraphJwtForSite({ siteId, nfToken: netlifyToken })
35
35
 
36
- await refetchAndGenerateFromOneGraph({ logger: log, netlifyGraphConfig, jwt, state, siteId })
37
-
38
36
  const oneGraphSessionId = loadCLISession(state)
37
+ await refetchAndGenerateFromOneGraph({
38
+ logger: log,
39
+ netlifyGraphConfig,
40
+ jwt,
41
+ state,
42
+ siteId,
43
+ sessionId: oneGraphSessionId,
44
+ })
39
45
 
40
46
  if (!oneGraphSessionId) {
41
47
  warn(
@@ -7,6 +7,10 @@ const { runRecipe } = require('../../commands/recipes')
7
7
  const STATE_PROMPT_PROPERTY = 'promptVSCodeSettings'
8
8
 
9
9
  const promptEditorHelper = async ({ NETLIFYDEVLOG, chalk, config, log, repositoryRoot, state }) => {
10
+ // This prevents tests from hanging when running them inside the VS Code
11
+ // terminal, as otherwise we'll show the prompt and wait for a response.
12
+ if (env.NODE_ENV === 'test') return
13
+
10
14
  const isVSCode = env.TERM_PROGRAM === 'vscode'
11
15
  const hasShownPrompt = Boolean(state.get(STATE_PROMPT_PROPERTY))
12
16
  const hasEdgeFunctions = Boolean(config.edge_functions && config.edge_functions.length !== 0)
@@ -6,4 +6,5 @@ module.exports = {
6
6
  Passthrough: 'x-deno-pass',
7
7
  RequestID: 'X-NF-Request-ID',
8
8
  IP: 'x-nf-client-connection-ip',
9
+ Site: 'X-NF-Site-Info',
9
10
  }
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ const { Buffer } = require('buffer')
2
3
  const { relative } = require('path')
3
4
  const { cwd, env } = require('process')
4
5
 
@@ -45,6 +46,13 @@ const handleProxyRequest = (req, proxyReq) => {
45
46
  })
46
47
  }
47
48
 
49
+ const createSiteInfoHeader = (siteInfo = {}) => {
50
+ const { id, name, url } = siteInfo
51
+ const site = { id, name, url }
52
+ const siteString = JSON.stringify(site)
53
+ return Buffer.from(siteString).toString('base64')
54
+ }
55
+
48
56
  const initializeProxy = async ({
49
57
  config,
50
58
  configPath,
@@ -55,6 +63,7 @@ const initializeProxy = async ({
55
63
  offline,
56
64
  projectDir,
57
65
  settings,
66
+ siteInfo,
58
67
  state,
59
68
  }) => {
60
69
  const { functions: internalFunctions, importMap, path: internalFunctionsPath } = await getInternalFunctions()
@@ -91,8 +100,9 @@ const initializeProxy = async ({
91
100
 
92
101
  if (!registry) return
93
102
 
94
- // Setting header with geolocation.
103
+ // Setting header with geolocation and site info.
95
104
  req.headers[headers.Geo] = JSON.stringify(geoLocation)
105
+ req.headers[headers.Site] = createSiteInfoHeader(siteInfo)
96
106
 
97
107
  await registry.initialize()
98
108
 
@@ -182,4 +192,4 @@ const prepareServer = async ({
182
192
  }
183
193
  }
184
194
 
185
- module.exports = { handleProxyRequest, initializeProxy, isEdgeFunctionsRequest }
195
+ module.exports = { handleProxyRequest, initializeProxy, isEdgeFunctionsRequest, createSiteInfoHeader }
@@ -61,7 +61,8 @@ InternalConsole.registerConsole(internalConsole)
61
61
  * @returns
62
62
  */
63
63
  const monitorCLISessionEvents = (input) => {
64
- const { appId, netlifyGraphConfig, netlifyToken, onClose, onError, onEvents, sessionId, site, state } = input
64
+ const { appId, netlifyGraphConfig, netlifyToken, onClose, onError, onEvents, site, state } = input
65
+ const currentSessionId = input.sessionId
65
66
 
66
67
  const frequency = 5000
67
68
  // 30 minutes
@@ -71,11 +72,15 @@ const monitorCLISessionEvents = (input) => {
71
72
 
72
73
  const markActiveHelper = async () => {
73
74
  const graphJwt = await OneGraphClient.getGraphJwtForSite({ siteId: appId, nfToken: netlifyToken })
74
- const fullSession = await OneGraphClient.fetchCliSession({ jwt: graphJwt.jwt, appId, sessionId })
75
+ const fullSession = await OneGraphClient.fetchCliSession({ jwt: graphJwt.jwt, appId, sessionId: currentSessionId })
75
76
  // @ts-ignore
76
77
  const heartbeatIntervalms = fullSession.session.cliHeartbeatIntervalMs || defaultHeartbeatFrequency
77
78
  nextMarkActiveHeartbeat = heartbeatIntervalms
78
- const markCLISessionActiveResult = await executeMarkCliSessionActiveHeartbeat(graphJwt.jwt, site.id, sessionId)
79
+ const markCLISessionActiveResult = await executeMarkCliSessionActiveHeartbeat(
80
+ graphJwt.jwt,
81
+ site.id,
82
+ currentSessionId,
83
+ )
79
84
  if (markCLISessionActiveResult.errors && markCLISessionActiveResult.errors.length !== 0) {
80
85
  warn(`Failed to mark CLI session active: ${markCLISessionActiveResult.errors.join(', ')}`)
81
86
  }
@@ -84,10 +89,10 @@ const monitorCLISessionEvents = (input) => {
84
89
 
85
90
  setTimeout(markActiveHelper, nextMarkActiveHeartbeat)
86
91
 
87
- const enabledServiceWatcher = async (jwt, siteId) => {
92
+ const enabledServiceWatcher = async (jwt, { appId: siteId, sessionId }) => {
88
93
  const enabledServices = state.get('oneGraphEnabledServices') || ['onegraph']
89
94
 
90
- const enabledServicesInfo = await OneGraphClient.fetchEnabledServices(jwt, siteId)
95
+ const enabledServicesInfo = await OneGraphClient.fetchEnabledServicesForSession(jwt, siteId, sessionId)
91
96
  if (!enabledServicesInfo) {
92
97
  warn('Unable to fetch enabled services for site for code generation')
93
98
  return
@@ -102,7 +107,7 @@ const monitorCLISessionEvents = (input) => {
102
107
  'Reloading',
103
108
  )} Netlify Graph schema..., ${enabledServicesCompareKey} => ${newEnabledServicesCompareKey}`,
104
109
  )
105
- await refetchAndGenerateFromOneGraph({ netlifyGraphConfig, state, jwt, siteId })
110
+ await refetchAndGenerateFromOneGraph({ netlifyGraphConfig, state, jwt, siteId, sessionId })
106
111
  log(`${chalk.green('Reloaded')} Netlify Graph schema and regenerated functions`)
107
112
  }
108
113
  }
@@ -120,7 +125,7 @@ const monitorCLISessionEvents = (input) => {
120
125
  }
121
126
 
122
127
  const graphJwt = await OneGraphClient.getGraphJwtForSite({ siteId: appId, nfToken: netlifyToken })
123
- const next = await OneGraphClient.fetchCliSessionEvents({ appId, jwt: graphJwt.jwt, sessionId })
128
+ const next = await OneGraphClient.fetchCliSessionEvents({ appId, jwt: graphJwt.jwt, sessionId: currentSessionId })
124
129
 
125
130
  if (next && next.errors) {
126
131
  next.errors.forEach((fetchEventError) => {
@@ -137,11 +142,16 @@ const monitorCLISessionEvents = (input) => {
137
142
  } catch (eventHandlerError) {
138
143
  warn(`Error handling event: ${eventHandlerError}`)
139
144
  } finally {
140
- await OneGraphClient.ackCLISessionEvents({ appId, jwt: graphJwt.jwt, sessionId, eventIds: ackIds })
145
+ await OneGraphClient.ackCLISessionEvents({
146
+ appId,
147
+ jwt: graphJwt.jwt,
148
+ sessionId: currentSessionId,
149
+ eventIds: ackIds,
150
+ })
141
151
  }
142
152
  }
143
153
 
144
- await enabledServiceWatcher(graphJwt.jwt, appId)
154
+ await enabledServiceWatcher(graphJwt.jwt, { appId, sessionId: currentSessionId })
145
155
 
146
156
  handle = setTimeout(helper, frequency)
147
157
  }
@@ -178,6 +188,7 @@ const monitorOperationFile = async ({ netlifyGraphConfig, onAdd, onChange, onUnl
178
188
  * @param {object} input
179
189
  * @param {string} input.siteId The id of the site to query against
180
190
  * @param {string} input.jwt The Graph JWT
191
+ * @param {string} input.sessionId The session ID for the current session
181
192
  * @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
182
193
  * @param {StateConfig} input.state A function to call to set/get the current state of the local Netlify project
183
194
  * @param {(message: string) => void=} input.logger A function that if provided will be used to log messages
@@ -188,7 +199,7 @@ const refetchAndGenerateFromOneGraph = async (input) => {
188
199
 
189
200
  await OneGraphClient.ensureAppForSite(jwt, siteId)
190
201
 
191
- const enabledServicesInfo = await OneGraphClient.fetchEnabledServices(jwt, siteId)
202
+ const enabledServicesInfo = await OneGraphClient.fetchEnabledServicesForSession(jwt, siteId, input.sessionId)
192
203
  if (!enabledServicesInfo) {
193
204
  warn('Unable to fetch enabled services for site for code generation')
194
205
  return
@@ -472,6 +472,7 @@ const startProxy = async function ({
472
472
  offline,
473
473
  projectDir,
474
474
  settings,
475
+ siteInfo,
475
476
  state,
476
477
  }) {
477
478
  const functionsServer = settings.functionsPort ? `http://127.0.0.1:${settings.functionsPort}` : null
@@ -485,6 +486,7 @@ const startProxy = async function ({
485
486
  offline,
486
487
  projectDir,
487
488
  settings,
489
+ siteInfo,
488
490
  state,
489
491
  })
490
492
  const proxy = await initializeProxy({