diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index bc11ccdd518..f96181543c7 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -81,7 +81,7 @@ "multiparty": "^4.2.1", "netlify": "^12.0.0", "netlify-headers-parser": "^6.0.2", - "netlify-onegraph-internal": "0.6.2", + "netlify-onegraph-internal": "0.7.0", "netlify-redirect-parser": "^13.0.5", "netlify-redirector": "^0.2.1", "node-fetch": "^2.6.0", @@ -16318,9 +16318,9 @@ } }, "node_modules/netlify-onegraph-internal": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.6.2.tgz", - "integrity": "sha512-kOuHi8VqCxACnHNDaSrvssioCdd8cL1t89UjH5q4VRsTFhGBLoay/ck1bF1ALPgUpxHVpvgJMRUVy9Uw03Houw==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.7.0.tgz", + "integrity": "sha512-0RodCQ1rqNd58gJ6bjTY8GHG+CfZsk91haLEhFv0cJizB0T3Rm263F5IKZP/V76J28GfM2T3SbcT+PPHGU5xMw==", "dependencies": { "graphql": "16.5.0", "node-fetch": "^2.6.0", @@ -34793,9 +34793,9 @@ } }, "netlify-onegraph-internal": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.6.2.tgz", - "integrity": "sha512-kOuHi8VqCxACnHNDaSrvssioCdd8cL1t89UjH5q4VRsTFhGBLoay/ck1bF1ALPgUpxHVpvgJMRUVy9Uw03Houw==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.7.0.tgz", + "integrity": "sha512-0RodCQ1rqNd58gJ6bjTY8GHG+CfZsk91haLEhFv0cJizB0T3Rm263F5IKZP/V76J28GfM2T3SbcT+PPHGU5xMw==", "requires": { "graphql": "16.5.0", "node-fetch": "^2.6.0", diff --git a/package.json b/package.json index c65c4bac447..1ebbf11e590 100644 --- a/package.json +++ b/package.json @@ -291,7 +291,7 @@ "multiparty": "^4.2.1", "netlify": "^12.0.0", "netlify-headers-parser": "^6.0.2", - "netlify-onegraph-internal": "0.6.2", + "netlify-onegraph-internal": "0.7.0", "netlify-redirect-parser": "^13.0.5", "netlify-redirector": "^0.2.1", "node-fetch": "^2.6.0", diff --git a/src/lib/one-graph/cli-client.js b/src/lib/one-graph/cli-client.js index 75f78727636..9c16e4744e0 100644 --- a/src/lib/one-graph/cli-client.js +++ b/src/lib/one-graph/cli-client.js @@ -83,7 +83,7 @@ const monitorCLISessionEvents = (input) => { const frequency = 5000 // 30 minutes - const defaultHeartbeatFrequency = 1_800_000 + const defaultHeartbeatFrequency = 30_000 let shouldClose = false let nextMarkActiveHeartbeat = defaultHeartbeatFrequency @@ -95,8 +95,10 @@ const monitorCLISessionEvents = (input) => { appId, sessionId: currentSessionId, }) + const heartbeatIntervalms = fullSession.session.cliHeartbeatIntervalMs || defaultHeartbeatFrequency nextMarkActiveHeartbeat = heartbeatIntervalms + const markCLISessionActiveResult = await OneGraphClient.executeMarkCliSessionActiveHeartbeat( graphJwt.jwt, site.id, @@ -640,7 +642,11 @@ ${JSON.stringify(payload, null, 2)}`) sessionId, payload: { editor, - filePaths: files.map((file) => file.filePath), + // @ts-expect-error + files: files.map((file) => ({ + name: file.name, + filePath: file.filePath, + })), }, audience: 'UI', } diff --git a/src/lib/one-graph/cli-netlify-graph.js b/src/lib/one-graph/cli-netlify-graph.js index 0eb2d673965..b95a75c72f9 100644 --- a/src/lib/one-graph/cli-netlify-graph.js +++ b/src/lib/one-graph/cli-netlify-graph.js @@ -47,7 +47,7 @@ const setNetlifyTomlCodeGeneratorModule = ({ codegenModuleImportPath, siteRoot } let filepath try { - const filepathArr = [...siteRoot.split(path.sep), 'netlify.toml'] + const filepathArr = ['/', ...siteRoot.split(path.sep), 'netlify.toml'] filepath = path.resolve(...filepathArr) const configText = fs.readFileSync(filepath, 'utf-8') @@ -585,7 +585,7 @@ const generateHandlerSourceByOperationId = ({ * @param {string} input.operationId The operationId to use when generating the handler * @param {object} input.handlerOptions The options to use when generating the handler * @param {(message: string) => void=} input.logger A function that if provided will be used to log messages - * @returns {Array<{filePath: string, prettierSuccess: boolean}> | undefined} An array of the generated handler filepaths + * @returns {Array<{filePath: string, name:string, prettierSuccess: boolean}> | undefined} An array of the generated handler filepaths */ const generateHandlerByOperationId = ({ generate, handlerOptions, netlifyGraphConfig, operationId, schema }) => { let currentOperationsDoc = readGraphQLOperationsSourceFile(netlifyGraphConfig) @@ -618,6 +618,7 @@ const generateHandlerByOperationId = ({ generate, handlerOptions, netlifyGraphCo return } + /** @type {Array<{filePath: string, name:string, prettierSuccess: boolean}>} */ const results = [] exportedFiles.forEach((exportedFile) => { @@ -650,6 +651,7 @@ const generateHandlerByOperationId = ({ generate, handlerOptions, netlifyGraphCo runPrettier(absoluteFilename) results.push({ + name: filenameArr.slice(-1)[0], filePath: absoluteFilename, prettierSuccess: true, })