From be6209f2832b578110b55de53055d98c620cd255 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Mon, 23 Jun 2025 12:21:42 +0500 Subject: [PATCH 01/12] gcp_logging --- build.sh | 8 + gcp-key.json | 13 + package.json | 1 + src/logger.ts | 213 +++----- src/utils/logging_service/aws_logging.ts | 125 +++++ src/utils/logging_service/gcp_logging.ts | 81 +++ src/utils/setup_utils.ts | 3 +- yarn.lock | 604 ++++++++++++++++++++++- 8 files changed, 883 insertions(+), 165 deletions(-) create mode 100644 gcp-key.json create mode 100644 src/utils/logging_service/aws_logging.ts create mode 100644 src/utils/logging_service/gcp_logging.ts diff --git a/build.sh b/build.sh index 982df529..96387705 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,10 @@ +#!/bin/bash + +# Build with esbuild yarn esbuild + +# Copy static files cp -r src/server/static dist/ + +# Copy GCP service account key to dist (if needed) +cp gcp-key.json dist/ \ No newline at end of file diff --git a/gcp-key.json b/gcp-key.json new file mode 100644 index 00000000..7e328884 --- /dev/null +++ b/gcp-key.json @@ -0,0 +1,13 @@ +{ + "type": "service_account", + "project_id": "codesync-280105", + "private_key_id": "9ffbe72cd13ab5e12650fb49f84c82ec2ef41117", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDFlRo2DrB5Is9+\nGUGFgZLrK19pE6vWosala63s2IywN/MIuC+jB1DJCbNMXSkouem931MmJqJyoWIY\nzhMQJ3zrVSTQmYw+ryEB3TiZvx/vO9ko9/jzMi1Whu6dEs3x7qqpoJdY3X40CEDQ\n+OsGdUvYU8G2r1CAnpnnlYLGvMhG0PQiMzNrQ7iFNNcohct1wGTlh8xUvBSgQx72\nozbCsZv/hxY41wuwanyAbB726oP24KiYKn4rmDHqO8uhZF4zvtc38SOJmID7c7JM\ndqPacGwByq8m2e4uLK3l7uSD6NdePLk75EBTILsiBMhIMlAUhvmAwg8wyUYdc0tQ\ntfIu1YRvAgMBAAECggEAFpLP4VAxUk2rVhVNmpKwteSJLIieT9HeDyUrxE0DWdiy\nkBL3AlHCJY3Rqc5U9v2ymkpLBidQ1PbiLcJRhD12tK5QG/MHBlxc0Yk0P8CJxfvY\n9ijKjQJ1Epcs6M4usE7bubCKyhDYK9qriRR/SYgaJ7d+AMCr2l4EaGR5AfqsiQZ/\nyHz6ZH6VqDJnvvsawQUU5txLxWi33eZnOhzegq599zSNAtH0OYVPvaATSu9ub0tp\nKWhLWpVhiwevzFWjTWPXbezAkgn6vZnfS84jh294nCmsu2sngxJUX7/gWHkufB+d\n479GrZckSvD8/GMs9M5fBOnL0uONsWB18pjnHHz5dQKBgQD5+I6TnVrGSMV9ci8m\nhSP+ITtZRvS9APHD6zOiWtXgmBkPZb9vRpy/PdF4W3Gr+bEyO62Ecf07FsVz3g+0\nu8rZquNkvXq0qp6CYtGdb7RrX0e8IQAJ0wEsIF3IAMh+qczRzmeMfeTW3nqNliop\navn3IYbKG5aHyfQnY7WmS6p6mwKBgQDKWRK8/Jj8q+1t3xBxjC64uRPTZScDsrqJ\nrgHtWZ4zl+TdY+xxteA6MZnIIWwLO4lmxtay9IqZinDlNScHw7bDAhBYC6Pqyy3P\n3bKE0OUhwrnlkNaylZtLRQlw4cgEak8dc/pE2xHOr9hkDYllURJ6JeaShH3s2C8b\nV492FPsAvQKBgQDaVgNa5hdyl/9/2etbLvHIOAiZq0N7jsadROQdzE+B0/gXndy+\n+iNRW1KKWP0JpJfkc4HU7KeuI+6ljPGVAG5m/z+NL39tLJY09tF2PSqOmnOS3BQn\ngJlGjKK9XgnBsNiI7Us+yHvIPh03bFE5Sgo5lJwiDkTGKFzMxufT78VhPwKBgQCc\npKPa5XjRcY8WFS63mBu7KJtudMnlFQFPAAPB6DSOIDIuKOKrjG6O3kL8KNNpRqex\nhpBCbQi2n/ORnLogSqQ7Bmf8oNY+Nxe56Rf/tW8L2aDrVFrAWQylEkaiukaLFHk2\nhcficeyxInPT0J7ibgZtxNVf621IYnrlIb2PXeKJyQKBgQDXqzFopWxspeUCSCN/\n5qyqrh3S98KJmejxqJZhHXXDhSPlZbsrifAqT9h3U5sdUrHGndjw28rvdrxEhHSP\npKhN4mVjZRAPuIX1LmAHLFx4wFiPQMKI3gcY3hHcza0HORcqBb/2NnTkCQtFiB1o\nlDM6xjlwJLcuYtrJ5+TEVwGKJw==\n-----END PRIVATE KEY-----\n", + "client_email": "testlogging@codesync-280105.iam.gserviceaccount.com", + "client_id": "109698424839775124311", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/testlogging%40codesync-280105.iam.gserviceaccount.com", + "universe_domain": "googleapis.com" +} diff --git a/package.json b/package.json index e4a50d5a..8b53f677 100644 --- a/package.json +++ b/package.json @@ -318,6 +318,7 @@ }, "dependencies": { "@aws-sdk/client-cloudwatch-logs": "^3.379.1", + "@google-cloud/logging": "^11.2.0", "@types/detect-port": "^1.3.0", "@types/express": "^4.17.21", "@types/node-fetch": "^2.5.12", diff --git a/src/logger.ts b/src/logger.ts index 3caeeaf4..9fe7c8af 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,38 +1,41 @@ -import fs from 'fs'; -import os from 'os'; -import macaddress from "macaddress"; -import { - CloudWatchLogsClient, - CloudWatchLogsClientConfig, - PutLogEventsCommand, - PutLogEventsRequest -} from "@aws-sdk/client-cloudwatch-logs"; - -import { - VSCODE, - LOG_AFTER_X_TIMES, - VERSION -} from './constants'; -import { readYML, isEmpty } from './utils/common'; -import { generateSettings, PLUGIN_USER } from "./settings"; -import { UserState } from './utils/user_utils'; -import { getSystemConfig } from './utils/setup_utils'; - -let macAddress = ""; -macaddress.one().then(mac => macAddress = mac); - -let cloudWatchClient = {}; +import { putLogEvent as AWSputLogEvent } from "./utils/logging_service/aws_logging"; +import { putLogEvent as GCPputLogEvent } from "./utils/logging_service/gcp_logging"; +import { LOG_AFTER_X_TIMES } from "./constants"; + + +// const isGCPEnabled = process.env.GCP_LOGGING_ENABLED === "true"; +// const isAWSEnabled = process.env.AWS_LOGGING_ENABLED === "true"; + +const isGCPEnabled = true; +const isAWSEnabled = false; + +const putLogEvent = async ( + msg: string, + eventType: string, + additionalMsg = "", + logStream?: string +) => { + console.log("xD: testing"); + if (isGCPEnabled) { + return GCPputLogEvent(msg, eventType, additionalMsg, logStream); + } else if (isAWSEnabled) { + return AWSputLogEvent(msg, eventType, additionalMsg, logStream); + } else { + console.warn("⚠️ No logging provider enabled."); + return; + } +}; const logErrorMsgTypes = { - CRITICAL: "CRITICAL", - ERROR: "ERROR", - WARNING: "WARNING", - INFO: "INFO", - DEBUG: "DEBUG" + CRITICAL: "CRITICAL", + ERROR: "ERROR", + WARNING: "WARNING", + INFO: "INFO", + DEBUG: "DEBUG", }; export class CodeSyncLogger { - /* + /* DEBUG: for developer oriented messages, only usable for brief testing of new features and should be removed once new features are fully tested. INFO: Informational messages, could be useful while debugging but can be ignore during normal execution. WARNING: Mild errors that do not affect the user but should be fixed in some time frame @@ -40,137 +43,35 @@ export class CodeSyncLogger { CRITICAL: Errors that are blocking for the normal operation of the plugin and should be fixed immediately. */ - static async debug (msg: string, additionalMsg="", logStream?: string) { - await putLogEvent(msg, logErrorMsgTypes.DEBUG, additionalMsg, logStream); - } - - static async info (msg: string, additionalMsg="", logStream?: string) { - await putLogEvent(msg, logErrorMsgTypes.INFO, additionalMsg, logStream); - } + static async debug(msg: string, additionalMsg = "", logStream?: string) { + await putLogEvent(msg, logErrorMsgTypes.DEBUG, additionalMsg, logStream); + } - static async warning (msg: string, additionalMsg="", logStream?: string) { - await putLogEvent(msg, logErrorMsgTypes.WARNING, additionalMsg, logStream); - } + static async info(msg: string, additionalMsg = "", logStream?: string) { + await putLogEvent(msg, logErrorMsgTypes.INFO, additionalMsg, logStream); + } - static async error (msg: string, additionalMsg="", logStream?: string) { - await putLogEvent(msg, logErrorMsgTypes.ERROR, additionalMsg, logStream); - } + static async warning(msg: string, additionalMsg = "", logStream?: string) { + await putLogEvent(msg, logErrorMsgTypes.WARNING, additionalMsg, logStream); + } - static async critical (msg: string, additionalMsg="", logStream?: string) { - await putLogEvent(msg, logErrorMsgTypes.CRITICAL, additionalMsg, logStream); - } + static async error(msg: string, additionalMsg = "", logStream?: string) { + await putLogEvent(msg, logErrorMsgTypes.ERROR, additionalMsg, logStream); + } + static async critical(msg: string, additionalMsg = "", logStream?: string) { + await putLogEvent(msg, logErrorMsgTypes.CRITICAL, additionalMsg, logStream); + } } -const putLogEvent = async (msg: string, eventType: string, additionalMsg="", logStream?: string) => { - let eventMsg = msg; - if (additionalMsg) { - eventMsg = `${msg}, ${additionalMsg}`; - } - console.log(eventMsg); - - let email = ""; - let accessKey = ""; - let secretKey = ""; - - const settings = generateSettings(); - - if (!fs.existsSync(settings.USER_PATH)) return; - - const users = readYML(settings.USER_PATH); - - if (logStream) { - const user = users[logStream]; - if (user && user.is_active) { - email = logStream; - accessKey = user.access_key; - secretKey = user.secret_key; - } - } else { - const userState = new UserState(); - const activeUser = userState.getUser(); - if (activeUser) { - email = activeUser.email; - accessKey = users[email].access_key; - secretKey = users[email].secret_key; - } - } - - // Set default user for logging - if (!(accessKey && secretKey && email)) { - email = PLUGIN_USER.logStream; - const pluginUser = users[email]; - if (!pluginUser) return; - accessKey = pluginUser.access_key; - secretKey = pluginUser.secret_key; - } - - if (isEmpty(cloudWatchClient)) { - cloudWatchClient = __createClient(accessKey, secretKey); - } else { - // Recreate client if accessKey is changed - const credentials = await cloudWatchClient.config.credentials(); - if (credentials.accessKeyId !== accessKey) { - cloudWatchClient = __createClient(accessKey, secretKey); - } - } - - const logGroupName = getSystemConfig().CW_LOGS_GROUP; - const logStreamName = email; - - const CWEventMsg = { - msg: eventMsg, - type: eventType, - source: VSCODE, - version: VERSION, - platform: os.platform(), - mac_address: macAddress - }; - const logEvents = [ /* required */ - { - message: JSON.stringify(CWEventMsg), /* required */ - timestamp: new Date().getTime() /* required */ - } - ]; - - const params = { - logEvents, - logGroupName, - logStreamName - }; - - const command = new PutLogEventsCommand(params); - try { - await cloudWatchClient.send(command); - } catch (err) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - console.log(`Failed to log: ${err}`); - } -}; - - export const logErrorMsg = (msg: string, errCount: number) => { - if (errCount === 0 || errCount > LOG_AFTER_X_TIMES) { - CodeSyncLogger.error(msg); - } - if (errCount > LOG_AFTER_X_TIMES) { - errCount = 0; - return errCount; - } - errCount += 1; - return errCount; + if (errCount === 0 || errCount > LOG_AFTER_X_TIMES) { + CodeSyncLogger.error(msg); + } + if (errCount > LOG_AFTER_X_TIMES) { + errCount = 0; + return errCount; + } + errCount += 1; + return errCount; }; - - -const __createClient = (accessKeyId: string, secretAccessKey: string) => { - const config: CloudWatchLogsClientConfig = - { - region: getSystemConfig().AWS_REGION, - credentials: { - accessKeyId, - secretAccessKey - } - }; - return new CloudWatchLogsClient(config); -}; \ No newline at end of file diff --git a/src/utils/logging_service/aws_logging.ts b/src/utils/logging_service/aws_logging.ts new file mode 100644 index 00000000..177e7040 --- /dev/null +++ b/src/utils/logging_service/aws_logging.ts @@ -0,0 +1,125 @@ +import fs from "fs"; +import os from "os"; +import macaddress from "macaddress"; +import { + CloudWatchLogsClient, + CloudWatchLogsClientConfig, + PutLogEventsCommand, + PutLogEventsRequest, +} from "@aws-sdk/client-cloudwatch-logs"; + +import { VSCODE, VERSION } from "../../constants"; +import { readYML, isEmpty } from "../../utils/common"; +import { generateSettings, PLUGIN_USER } from "../../settings"; +import { UserState } from "../../utils/user_utils"; +import { getSystemConfig } from "../../utils/setup_utils"; + +let macAddress = ""; +macaddress.one().then((mac) => (macAddress = mac)); + +let cloudWatchClient = {}; + +export const putLogEvent = async ( + msg: string, + eventType: string, + additionalMsg = "", + logStream?: string +) => { + let eventMsg = msg; + if (additionalMsg) { + eventMsg = `${msg}, ${additionalMsg}`; + } + // console.log(eventMsg); + + let email = ""; + let accessKey = ""; + let secretKey = ""; + + const settings = generateSettings(); + + if (!fs.existsSync(settings.USER_PATH)) return; + + const users = readYML(settings.USER_PATH); + + if (logStream) { + const user = users[logStream]; + if (user && user.is_active) { + email = logStream; + accessKey = user.access_key; + secretKey = user.secret_key; + } + } else { + const userState = new UserState(); + const activeUser = userState.getUser(); + if (activeUser) { + email = activeUser.email; + accessKey = users[email].access_key; + secretKey = users[email].secret_key; + } + } + + // Set default user for logging + if (!(accessKey && secretKey && email)) { + email = PLUGIN_USER.logStream; + const pluginUser = users[email]; + // console.log("xD pluginUser:", pluginUser); + if (!pluginUser) return; + accessKey = pluginUser.access_key; + secretKey = pluginUser.secret_key; + } + + if (isEmpty(cloudWatchClient)) { + cloudWatchClient = __createClient(accessKey, secretKey); + } else { + // Recreate client if accessKey is changed + const credentials = await cloudWatchClient.config.credentials(); + if (credentials.accessKeyId !== accessKey) { + cloudWatchClient = __createClient(accessKey, secretKey); + } + } + + const logGroupName = getSystemConfig().CW_LOGS_GROUP; + const logStreamName = email; + + const CWEventMsg = { + msg: eventMsg, + type: eventType, + source: VSCODE, + version: VERSION, + platform: os.platform(), + mac_address: macAddress, + }; + const logEvents = [ + /* required */ + { + message: JSON.stringify(CWEventMsg) /* required */, + timestamp: new Date().getTime() /* required */, + }, + ]; + + const params = { + logEvents, + logGroupName, + logStreamName, + }; + + const command = new PutLogEventsCommand(params); + try { + await cloudWatchClient.send(command); + } catch (err) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + console.log(`Failed to log: ${err}`); + } +}; + +const __createClient = (accessKeyId: string, secretAccessKey: string) => { + const config: CloudWatchLogsClientConfig = { + region: getSystemConfig().AWS_REGION, + credentials: { + accessKeyId, + secretAccessKey, + }, + }; + return new CloudWatchLogsClient(config); +}; diff --git a/src/utils/logging_service/gcp_logging.ts b/src/utils/logging_service/gcp_logging.ts new file mode 100644 index 00000000..e163d8af --- /dev/null +++ b/src/utils/logging_service/gcp_logging.ts @@ -0,0 +1,81 @@ +import { Logging } from "@google-cloud/logging"; +import os from "os"; +import macaddress from "macaddress"; +import { VSCODE, VERSION } from "../../constants"; +import { generateSettings, PLUGIN_USER } from "../../settings"; +import { readYML } from "../../utils/common"; +import { UserState } from "../../utils/user_utils"; +import fs from "fs"; +import path from "path"; + +// const logging = new Logging({ +// projectId: "codesync-280105", +// keyFilename: path.join(__dirname, "/gcp-key.json"), +// }); + +const logging = new Logging({ projectId: "codesync-280105" }); + +let macAddress = ""; + +macaddress.one().then((mac) => (macAddress = mac)); + +export const putLogEvent = async ( + msg: string, + eventType: string, + additionalMsg = "", + logName?: string +) => { + const eventMsg = additionalMsg ? `${msg}, ${additionalMsg}` : msg; + + let email = ""; + const settings = generateSettings(); + if (!fs.existsSync(settings.USER_PATH)) return; + + const users = readYML(settings.USER_PATH); + + if (logName && users[logName]?.is_active) { + email = logName; + } else { + const userState = new UserState(); + const activeUser = userState.getUser(); + if (activeUser) email = activeUser.email; + } + + // Fallback to plugin user + if (!email) { + email = PLUGIN_USER.logStream; + if (!users[email]) return; + } + const log = logging.log("vs-code"); // Custom log name + + const metadata = { + resource: { type: "global" }, + severity: eventType, + labels: { email, type: eventType }, + }; + + const logEntry = log.entry(metadata, { + msg: eventMsg, + type: eventType, + source: VSCODE, + version: VERSION, + platform: os.platform(), + mac_address: macAddress, + timestamp: new Date().toISOString(), + }); + + try { + console.log("xD: Writing log entry:", eventMsg); + await log.write(logEntry); + console.log("xD: ✅ Log entry written successfully:", eventMsg); + } catch (err: any) { + console.error("xD: ❌ Error writing log entry:", err.message); + if (err.code === 7) { + console.error( + "xD: ❌ Not authorized. Ask user to run `gcloud auth application-default login`." + ); + } else { + console.error("xD: ❌ Logging failed:", err.message); + } + } +}; diff --git a/src/utils/setup_utils.ts b/src/utils/setup_utils.ts index bfcab5c5..c261e063 100644 --- a/src/utils/setup_utils.ts +++ b/src/utils/setup_utils.ts @@ -175,7 +175,8 @@ export const setupCodeSync = async (repoPath: string) => { // Check is accessToken is valid const isUserActive = await isAccountActive(activeUser.email, activeUser.access_token); if (!isUserActive) return; - CodeSyncLogger.debug(`User's access token is active, user=${activeUser.email}`); + CodeSyncLogger.debug(`User's access token is active, user=${activeUser.email}`); + CodeSyncLogger.warning(`xD User's access token is active, user=${activeUser.email}`); // Show Repo Status showRepoStatusMsg(repoPath); }; diff --git a/yarn.lock b/yarn.lock index 307d70f0..beba5965 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1587,6 +1587,79 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@google-cloud/common@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@google-cloud/common/-/common-5.0.2.tgz#423ad94b125d44263cbed2b5eb1ce1d4d53dc038" + integrity sha512-V7bmBKYQyu0eVG2BFejuUjlBt+zrya6vtsKdY+JxMM/dNntPF41vZ9+LhOshEUH01zOHEqBSvI7Dad7ZS6aUeA== + dependencies: + "@google-cloud/projectify" "^4.0.0" + "@google-cloud/promisify" "^4.0.0" + arrify "^2.0.1" + duplexify "^4.1.1" + extend "^3.0.2" + google-auth-library "^9.0.0" + html-entities "^2.5.2" + retry-request "^7.0.0" + teeny-request "^9.0.0" + +"@google-cloud/logging@^11.2.0": + version "11.2.0" + resolved "https://registry.yarnpkg.com/@google-cloud/logging/-/logging-11.2.0.tgz#d282f136467cc4500932f1fa6d4fe58325eb2db2" + integrity sha512-Ma94jvuoMpbgNniwtelOt8w82hxK62FuOXZonEv0Hyk3B+/YVuLG/SWNyY9yMso/RXnPEc1fP2qo9kDrjf/b2w== + dependencies: + "@google-cloud/common" "^5.0.0" + "@google-cloud/paginator" "^5.0.0" + "@google-cloud/projectify" "^4.0.0" + "@google-cloud/promisify" "^4.0.0" + "@opentelemetry/api" "^1.7.0" + arrify "^2.0.1" + dot-prop "^6.0.0" + eventid "^2.0.0" + extend "^3.0.2" + gcp-metadata "^6.0.0" + google-auth-library "^9.0.0" + google-gax "^4.0.3" + on-finished "^2.3.0" + pumpify "^2.0.1" + stream-events "^1.0.5" + uuid "^9.0.0" + +"@google-cloud/paginator@^5.0.0": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@google-cloud/paginator/-/paginator-5.0.2.tgz#86ad773266ce9f3b82955a8f75e22cd012ccc889" + integrity sha512-DJS3s0OVH4zFDB1PzjxAsHqJT6sKVbRwwML0ZBP9PbU7Yebtu/7SWMRzvO2J3nUi9pRNITCfu4LJeooM2w4pjg== + dependencies: + arrify "^2.0.0" + extend "^3.0.2" + +"@google-cloud/projectify@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@google-cloud/projectify/-/projectify-4.0.0.tgz#d600e0433daf51b88c1fa95ac7f02e38e80a07be" + integrity sha512-MmaX6HeSvyPbWGwFq7mXdo0uQZLGBYCwziiLIGq5JVX+/bdI3SAq6bP98trV5eTWfLuvsMcIC1YJOF2vfteLFA== + +"@google-cloud/promisify@^4.0.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@google-cloud/promisify/-/promisify-4.1.0.tgz#df8b060f0121c6462233f5420738dcda09c6df4a" + integrity sha512-G/FQx5cE/+DqBbOpA5jKsegGwdPniU6PuIEMt+qxWgFxvxuFOzVmp6zYchtYuwAWV5/8Dgs0yAmjvNZv3uXLQg== + +"@grpc/grpc-js@^1.10.9": + version "1.13.4" + resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.13.4.tgz#922fbc496e229c5fa66802d2369bf181c1df1c5a" + integrity sha512-GsFaMXCkMqkKIvwCQjCrwH+GHbPKBjhwo/8ZuUkWHqbI73Kky9I+pQltrlT0+MWpedCoosda53lgjYfyEPgxBg== + dependencies: + "@grpc/proto-loader" "^0.7.13" + "@js-sdsl/ordered-map" "^4.4.2" + +"@grpc/proto-loader@^0.7.13": + version "0.7.15" + resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.7.15.tgz#4cdfbf35a35461fc843abe8b9e2c0770b5095e60" + integrity sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ== + dependencies: + lodash.camelcase "^4.3.0" + long "^5.0.0" + protobufjs "^7.2.5" + yargs "^17.7.2" + "@humanwhocodes/config-array@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" @@ -1841,6 +1914,11 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@js-sdsl/ordered-map@^4.4.2": + version "4.4.2" + resolved "https://registry.yarnpkg.com/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz#9299f82874bab9e4c7f9c48d865becbfe8d6907c" + integrity sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw== + "@leichtgewicht/ip-codec@^2.0.1": version "2.0.5" resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1" @@ -1867,6 +1945,64 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@opentelemetry/api@^1.7.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.9.0.tgz#d03eba68273dc0f7509e2a3d5cba21eae10379fe" + integrity sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg== + +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -2336,6 +2472,11 @@ dependencies: defer-to-connect "^2.0.1" +"@tootallnate/once@2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" + integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + "@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -2377,6 +2518,11 @@ "@types/connect" "*" "@types/node" "*" +"@types/caseless@*": + version "0.12.5" + resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.5.tgz#db9468cb1b1b5a925b8f34822f1669df0c5472f5" + integrity sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg== + "@types/connect@*": version "3.4.38" resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" @@ -2477,6 +2623,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== +"@types/long@^4.0.0": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" + integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== + "@types/mime@^1": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" @@ -2497,6 +2648,13 @@ dependencies: undici-types "~6.19.2" +"@types/node@>=13.7.0": + version "24.0.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.1.tgz#e9bfcb1c35547437c294403b7bec497772a88b0a" + integrity sha512-MX4Zioh39chHlDJbKmEgydJDS3tspMP/lnQC67G3SWsTnb9NeYVWOjkxpOSy4oMfPs4StcWHwBrvUb4ybfnuaw== + dependencies: + undici-types "~7.8.0" + "@types/node@^20.12.5": version "20.16.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.1.tgz#0b44b15271d0e2191ca68faf1fbe506e06aed732" @@ -2521,6 +2679,16 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== +"@types/request@^2.48.8": + version "2.48.12" + resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.12.tgz#0f590f615a10f87da18e9790ac94c29ec4c5ef30" + integrity sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw== + dependencies: + "@types/caseless" "*" + "@types/node" "*" + "@types/tough-cookie" "*" + form-data "^2.5.0" + "@types/retry@*": version "0.12.5" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.5.tgz#f090ff4bd8d2e5b940ff270ab39fd5ca1834a07e" @@ -2563,6 +2731,11 @@ resolved "https://registry.yarnpkg.com/@types/string-similarity/-/string-similarity-4.0.2.tgz#a730ba46d112bced8ccfc33d3f70182f607511a3" integrity sha512-LkJQ/jsXtCVMK+sKYAmX/8zEq+/46f1PTQw7YtmQwb74jemS1SlNLmARM2Zml9DgdDTWKAtc5L13WorpHPDjDA== +"@types/tough-cookie@*": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" + integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== + "@types/vscode@^1.86.0": version "1.92.0" resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.92.0.tgz#b4d6bc180e7206defe643a1a5f38a1367947d418" @@ -2721,6 +2894,13 @@ "@typescript-eslint/types" "6.21.0" eslint-visitor-keys "^3.4.1" +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -2744,6 +2924,18 @@ address@^1.0.1: resolved "https://registry.yarnpkg.com/address/-/address-1.2.2.tgz#2b5248dac5485a6390532c6a517fda2e3faac89e" integrity sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA== +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +agent-base@^7.1.2: + version "7.1.3" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.3.tgz#29435eb821bc4194633a5b89e5bc4703bafc25a1" + integrity sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw== + aggregate-error@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-4.0.1.tgz#25091fe1573b9e0be892aeda15c7c66a545f758e" @@ -2838,6 +3030,11 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== +arrify@^2.0.0, arrify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -2945,6 +3142,16 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base64-js@^1.3.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bignumber.js@^9.0.0: + version "9.3.0" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.3.0.tgz#bdba7e2a4c1a2eba08290e8dcad4f36393c92acd" + integrity sha512-EM7aMFTXbptt/wZdMlBv2t8IViwQL+h6SLHosp8Yf0dqJMTnY6iL32opnAB6kAdL0SZPuvcAzFr31o0c/R3/RA== + body-parser@1.20.2: version "1.20.2" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" @@ -3007,6 +3214,11 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" +buffer-equal-constant-time@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA== + buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" @@ -3042,6 +3254,14 @@ cacheable-request@^10.2.8: normalize-url "^8.0.0" responselike "^3.0.0" +call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" + integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + call-bind@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" @@ -3390,6 +3610,39 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dot-prop@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083" + integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA== + dependencies: + is-obj "^2.0.0" + +dunder-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" + integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== + dependencies: + call-bind-apply-helpers "^1.0.1" + es-errors "^1.3.0" + gopd "^1.2.0" + +duplexify@^4.0.0, duplexify@^4.1.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.3.tgz#a07e1c0d0a2c001158563d32592ba58bddb0236f" + integrity sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA== + dependencies: + end-of-stream "^1.4.1" + inherits "^2.0.3" + readable-stream "^3.1.1" + stream-shift "^1.0.2" + +ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -3415,7 +3668,7 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== -end-of-stream@^1.1.0: +end-of-stream@^1.1.0, end-of-stream@^1.4.1: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== @@ -3444,11 +3697,33 @@ es-define-property@^1.0.0: dependencies: get-intrinsic "^1.2.4" +es-define-property@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" + integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== + es-errors@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== +es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" + integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + dependencies: + es-errors "^1.3.0" + +es-set-tostringtag@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" + integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== + dependencies: + es-errors "^1.3.0" + get-intrinsic "^1.2.6" + has-tostringtag "^1.0.2" + hasown "^2.0.2" + es5-ext@^0.10.35, es5-ext@^0.10.62, es5-ext@^0.10.63, es5-ext@^0.10.64, es5-ext@~0.10.14: version "0.10.64" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.64.tgz#12e4ffb48f1ba2ea777f1fcdd1918ef73ea21714" @@ -3684,6 +3959,18 @@ event-emitter@^0.3.5: d "1" es5-ext "~0.10.14" +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +eventid@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/eventid/-/eventid-2.0.1.tgz#574e860149457a79a2efe788c459f0c3062d02ec" + integrity sha512-sPNTqiMokAvV048P2c9+foqVJzk49o6d4e0D/sq5jog3pw+4kBgyR0gaM1FM7Mx6Kzd9dztesh9oYz1LWWOpzw== + dependencies: + uuid "^8.0.0" + execa@^0.6.1: version "0.6.3" resolved "https://registry.yarnpkg.com/execa/-/execa-0.6.3.tgz#57b69a594f081759c69e5370f0d17b9cb11658fe" @@ -3787,6 +4074,11 @@ ext@^1.7.0: dependencies: type "^2.7.2" +extend@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -3901,6 +4193,17 @@ form-data-encoder@^2.1.2: resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" integrity sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw== +form-data@^2.5.0: + version "2.5.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.3.tgz#f9bcf87418ce748513c0c3494bb48ec270c97acc" + integrity sha512-XHIrMD0NpDrNM/Ckf7XJiBbLl57KEhT3+i3yY+eWm+cqYZJQTZrKo8Y8AWKnuV5GT4scfuUGt9LzNoIx3dU1nQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + es-set-tostringtag "^2.1.0" + mime-types "^2.1.35" + safe-buffer "^5.2.1" + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -3947,6 +4250,26 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== +gaxios@^6.0.0, gaxios@^6.1.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-6.7.1.tgz#ebd9f7093ede3ba502685e73390248bb5b7f71fb" + integrity sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ== + dependencies: + extend "^3.0.2" + https-proxy-agent "^7.0.1" + is-stream "^2.0.0" + node-fetch "^2.6.9" + uuid "^9.0.1" + +gcp-metadata@^6.0.0, gcp-metadata@^6.1.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-6.1.1.tgz#f65aa69f546bc56e116061d137d3f5f90bdec494" + integrity sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A== + dependencies: + gaxios "^6.1.1" + google-logging-utils "^0.0.2" + json-bigint "^1.0.0" + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -3968,11 +4291,35 @@ get-intrinsic@^1.1.3, get-intrinsic@^1.2.4: has-symbols "^1.0.3" hasown "^2.0.0" +get-intrinsic@^1.2.6: + version "1.3.0" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" + integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== + dependencies: + call-bind-apply-helpers "^1.0.2" + es-define-property "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.1.1" + function-bind "^1.1.2" + get-proto "^1.0.1" + gopd "^1.2.0" + has-symbols "^1.1.0" + hasown "^2.0.2" + math-intrinsics "^1.1.0" + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== +get-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" + integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== + dependencies: + dunder-proto "^1.0.1" + es-object-atoms "^1.0.0" + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -4052,6 +4399,41 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" +google-auth-library@^9.0.0, google-auth-library@^9.3.0: + version "9.15.1" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-9.15.1.tgz#0c5d84ed1890b2375f1cd74f03ac7b806b392928" + integrity sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng== + dependencies: + base64-js "^1.3.0" + ecdsa-sig-formatter "^1.0.11" + gaxios "^6.1.1" + gcp-metadata "^6.1.0" + gtoken "^7.0.0" + jws "^4.0.0" + +google-gax@^4.0.3: + version "4.6.1" + resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-4.6.1.tgz#57f8e3d893d4c708a71167cdcf47eb3afab95929" + integrity sha512-V6eky/xz2mcKfAd1Ioxyd6nmA61gao3n01C+YeuIwu3vzM9EDR6wcVzMSIbLMDXWeoi9SHYctXuKYC5uJUT3eQ== + dependencies: + "@grpc/grpc-js" "^1.10.9" + "@grpc/proto-loader" "^0.7.13" + "@types/long" "^4.0.0" + abort-controller "^3.0.0" + duplexify "^4.0.0" + google-auth-library "^9.3.0" + node-fetch "^2.7.0" + object-hash "^3.0.0" + proto3-json-serializer "^2.0.2" + protobufjs "^7.3.2" + retry-request "^7.0.0" + uuid "^9.0.1" + +google-logging-utils@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/google-logging-utils/-/google-logging-utils-0.0.2.tgz#5fd837e06fa334da450433b9e3e1870c1594466a" + integrity sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ== + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -4059,6 +4441,11 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" +gopd@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" + integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== + got@^12.0.0, got@^12.1.0: version "12.6.1" resolved "https://registry.yarnpkg.com/got/-/got-12.6.1.tgz#8869560d1383353204b5a9435f782df9c091f549" @@ -4086,6 +4473,14 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== +gtoken@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-7.1.0.tgz#d61b4ebd10132222817f7222b1e6064bd463fc26" + integrity sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw== + dependencies: + gaxios "^6.0.0" + jws "^4.0.0" + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -4113,6 +4508,18 @@ has-symbols@^1.0.3: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== +has-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" + integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== + +has-tostringtag@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== + dependencies: + has-symbols "^1.0.3" + hasown@^2.0.0, hasown@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" @@ -4120,6 +4527,11 @@ hasown@^2.0.0, hasown@^2.0.2: dependencies: function-bind "^1.1.2" +html-entities@^2.5.2: + version "2.6.0" + resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.6.0.tgz#7c64f1ea3b36818ccae3d3fb48b6974208e984f8" + integrity sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ== + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -4141,6 +4553,15 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" +http-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" + integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== + dependencies: + "@tootallnate/once" "2" + agent-base "6" + debug "4" + http2-wrapper@^2.1.10: version "2.2.1" resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.1.tgz#310968153dcdedb160d8b72114363ef5fce1f64a" @@ -4149,6 +4570,22 @@ http2-wrapper@^2.1.10: quick-lru "^5.1.1" resolve-alpn "^1.2.0" +https-proxy-agent@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + +https-proxy-agent@^7.0.1: + version "7.0.6" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9" + integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw== + dependencies: + agent-base "^7.1.2" + debug "4" + human-signals@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" @@ -4210,7 +4647,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -4279,6 +4716,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-obj@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" + integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== + is-online@^10.0.0: version "10.0.0" resolved "https://registry.yarnpkg.com/is-online/-/is-online-10.0.0.tgz#5e02cee9f822fd9c19b060f0ecbdc798d37295a3" @@ -4763,6 +5205,13 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== + dependencies: + bignumber.js "^9.0.0" + json-buffer@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" @@ -4793,6 +5242,23 @@ json5@^2.2.3: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== +jwa@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.1.tgz#bf8176d1ad0cd72e0f3f58338595a13e110bc804" + integrity sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg== + dependencies: + buffer-equal-constant-time "^1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" + integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== + dependencies: + jwa "^2.0.0" + safe-buffer "^5.0.1" + keyv@^4.5.3: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" @@ -4830,6 +5296,11 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -4845,6 +5316,11 @@ lodash.truncate@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== +long@^5.0.0: + version "5.3.2" + resolved "https://registry.yarnpkg.com/long/-/long-5.3.2.tgz#1d84463095999262d7d7b7f8bfd4a8cc55167f83" + integrity sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA== + lowercase-keys@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" @@ -4889,6 +5365,11 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" +math-intrinsics@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" + integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -4927,7 +5408,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12, mime-types@^2.1.35, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -5020,7 +5501,7 @@ node-domexception@^1.0.0: resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== -node-fetch@^2.6.12: +node-fetch@^2.6.12, node-fetch@^2.6.9, node-fetch@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -5080,12 +5561,17 @@ object-assign@^4: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== +object-hash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" + integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== + object-inspect@^1.13.1: version "1.13.2" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== -on-finished@2.4.1: +on-finished@2.4.1, on-finished@^2.3.0: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== @@ -5303,6 +5789,31 @@ proper-lockfile@^4.1.2: retry "^0.12.0" signal-exit "^3.0.2" +proto3-json-serializer@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/proto3-json-serializer/-/proto3-json-serializer-2.0.2.tgz#5b705203b4d58f3880596c95fad64902617529dd" + integrity sha512-SAzp/O4Yh02jGdRc+uIrGoe87dkN/XtwxfZ4ZyafJHymd79ozp5VG5nyZ7ygqPM5+cpLDjjGnYFUkngonyDPOQ== + dependencies: + protobufjs "^7.2.5" + +protobufjs@^7.2.5, protobufjs@^7.3.2: + version "7.5.3" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.5.3.tgz#13f95a9e3c84669995ec3652db2ac2fb00b89363" + integrity sha512-sildjKwVqOI2kmFDiXQ6aEB0fjYTafpEvIBs8tOR8qI4spuL9OPROLVu2qZqi/xgCfsHIwVqlaF8JBjWFHnKbw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/node" ">=13.7.0" + long "^5.0.0" + proxy-addr@~2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" @@ -5333,6 +5844,15 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" +pumpify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-2.0.1.tgz#abfc7b5a621307c728b551decbbefb51f0e4aa1e" + integrity sha512-m7KOje7jZxrmutanlkS1daj1dS6z6BgslzOXmcSEpIlCxM3VJH7lG5QLeck/6hgF6F4crFf01UtQmNsJfweTAw== + dependencies: + duplexify "^4.1.1" + inherits "^2.0.3" + pump "^3.0.0" + punycode@^2.1.0: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" @@ -5380,6 +5900,15 @@ react-is@^18.0.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== +readable-stream@^3.1.1: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + regenerate-unicode-properties@^10.1.0: version "10.1.1" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz#6b0e05489d9076b04c436f318d9b067bba459480" @@ -5481,6 +6010,15 @@ responselike@^3.0.0: dependencies: lowercase-keys "^3.0.0" +retry-request@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/retry-request/-/retry-request-7.0.2.tgz#60bf48cfb424ec01b03fca6665dee91d06dd95f3" + integrity sha512-dUOvLMJ0/JJYEn8NrpOaGNE7X3vpI5XlZS/u0ANjqtcZVKnIxP7IgCFwrKTxENw29emmwug53awKtaMm4i9g5w== + dependencies: + "@types/request" "^2.48.8" + extend "^3.0.2" + teeny-request "^9.0.0" + retry@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" @@ -5505,7 +6043,7 @@ run-parallel@^1.1.9, run-parallel@^1.2.0: dependencies: queue-microtask "^1.2.2" -safe-buffer@5.2.1: +safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -5659,6 +6197,18 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== +stream-events@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/stream-events/-/stream-events-1.0.5.tgz#bbc898ec4df33a4902d892333d47da9bf1c406d5" + integrity sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg== + dependencies: + stubs "^3.0.0" + +stream-shift@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.3.tgz#85b8fab4d71010fc3ba8772e8046cc49b8a3864b" + integrity sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -5681,6 +6231,13 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -5713,6 +6270,11 @@ strnum@^1.0.5: resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== +stubs@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/stubs/-/stubs-3.0.0.tgz#e8d2ba1fa9c90570303c030b6900f7d5f89abe5b" + integrity sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -5750,6 +6312,17 @@ table@^6.0.9: string-width "^4.2.3" strip-ansi "^6.0.1" +teeny-request@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/teeny-request/-/teeny-request-9.0.0.tgz#18140de2eb6595771b1b02203312dfad79a4716d" + integrity sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g== + dependencies: + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.0" + node-fetch "^2.6.9" + stream-events "^1.0.5" + uuid "^9.0.0" + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -5865,6 +6438,11 @@ undici-types@~6.19.2: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.6.tgz#e218c3df0987f4c0e0008ca00d6b6472d9b89b36" integrity sha512-e/vggGopEfTKSvj4ihnOLTsqhrKRN3LeO6qSN/GxohhuRv8qH9bNQ4B8W7e/vFL+0XTnmHPB4/kegunZGA4Org== +undici-types@~7.8.0: + version "7.8.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" + integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== + unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" @@ -5920,12 +6498,22 @@ utf-8-validate@^5.0.2: dependencies: node-gyp-build "^4.3.0" +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== -uuid@^9.0.1: +uuid@^8.0.0: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + +uuid@^9.0.0, uuid@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== @@ -6052,7 +6640,7 @@ yargs-parser@^21.1.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^17.3.1: +yargs@^17.3.1, yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 01d97f9fba2c535281171f11abbf28cde43fcbe0 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Mon, 23 Jun 2025 12:24:52 +0500 Subject: [PATCH 02/12] remove gcp_key --- gcp-key.json | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 gcp-key.json diff --git a/gcp-key.json b/gcp-key.json deleted file mode 100644 index 7e328884..00000000 --- a/gcp-key.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "type": "service_account", - "project_id": "codesync-280105", - "private_key_id": "9ffbe72cd13ab5e12650fb49f84c82ec2ef41117", - "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDFlRo2DrB5Is9+\nGUGFgZLrK19pE6vWosala63s2IywN/MIuC+jB1DJCbNMXSkouem931MmJqJyoWIY\nzhMQJ3zrVSTQmYw+ryEB3TiZvx/vO9ko9/jzMi1Whu6dEs3x7qqpoJdY3X40CEDQ\n+OsGdUvYU8G2r1CAnpnnlYLGvMhG0PQiMzNrQ7iFNNcohct1wGTlh8xUvBSgQx72\nozbCsZv/hxY41wuwanyAbB726oP24KiYKn4rmDHqO8uhZF4zvtc38SOJmID7c7JM\ndqPacGwByq8m2e4uLK3l7uSD6NdePLk75EBTILsiBMhIMlAUhvmAwg8wyUYdc0tQ\ntfIu1YRvAgMBAAECggEAFpLP4VAxUk2rVhVNmpKwteSJLIieT9HeDyUrxE0DWdiy\nkBL3AlHCJY3Rqc5U9v2ymkpLBidQ1PbiLcJRhD12tK5QG/MHBlxc0Yk0P8CJxfvY\n9ijKjQJ1Epcs6M4usE7bubCKyhDYK9qriRR/SYgaJ7d+AMCr2l4EaGR5AfqsiQZ/\nyHz6ZH6VqDJnvvsawQUU5txLxWi33eZnOhzegq599zSNAtH0OYVPvaATSu9ub0tp\nKWhLWpVhiwevzFWjTWPXbezAkgn6vZnfS84jh294nCmsu2sngxJUX7/gWHkufB+d\n479GrZckSvD8/GMs9M5fBOnL0uONsWB18pjnHHz5dQKBgQD5+I6TnVrGSMV9ci8m\nhSP+ITtZRvS9APHD6zOiWtXgmBkPZb9vRpy/PdF4W3Gr+bEyO62Ecf07FsVz3g+0\nu8rZquNkvXq0qp6CYtGdb7RrX0e8IQAJ0wEsIF3IAMh+qczRzmeMfeTW3nqNliop\navn3IYbKG5aHyfQnY7WmS6p6mwKBgQDKWRK8/Jj8q+1t3xBxjC64uRPTZScDsrqJ\nrgHtWZ4zl+TdY+xxteA6MZnIIWwLO4lmxtay9IqZinDlNScHw7bDAhBYC6Pqyy3P\n3bKE0OUhwrnlkNaylZtLRQlw4cgEak8dc/pE2xHOr9hkDYllURJ6JeaShH3s2C8b\nV492FPsAvQKBgQDaVgNa5hdyl/9/2etbLvHIOAiZq0N7jsadROQdzE+B0/gXndy+\n+iNRW1KKWP0JpJfkc4HU7KeuI+6ljPGVAG5m/z+NL39tLJY09tF2PSqOmnOS3BQn\ngJlGjKK9XgnBsNiI7Us+yHvIPh03bFE5Sgo5lJwiDkTGKFzMxufT78VhPwKBgQCc\npKPa5XjRcY8WFS63mBu7KJtudMnlFQFPAAPB6DSOIDIuKOKrjG6O3kL8KNNpRqex\nhpBCbQi2n/ORnLogSqQ7Bmf8oNY+Nxe56Rf/tW8L2aDrVFrAWQylEkaiukaLFHk2\nhcficeyxInPT0J7ibgZtxNVf621IYnrlIb2PXeKJyQKBgQDXqzFopWxspeUCSCN/\n5qyqrh3S98KJmejxqJZhHXXDhSPlZbsrifAqT9h3U5sdUrHGndjw28rvdrxEhHSP\npKhN4mVjZRAPuIX1LmAHLFx4wFiPQMKI3gcY3hHcza0HORcqBb/2NnTkCQtFiB1o\nlDM6xjlwJLcuYtrJ5+TEVwGKJw==\n-----END PRIVATE KEY-----\n", - "client_email": "testlogging@codesync-280105.iam.gserviceaccount.com", - "client_id": "109698424839775124311", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/testlogging%40codesync-280105.iam.gserviceaccount.com", - "universe_domain": "googleapis.com" -} From ce533afbf4de316bb7ae9535a88e15bd1e541de9 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Tue, 24 Jun 2025 22:05:49 +0500 Subject: [PATCH 03/12] Use prive_key insted of json file --- build.sh | 3 -- src/utils/logging_service/gcp_logging.ts | 41 +++++++++++------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/build.sh b/build.sh index 96387705..80a7de61 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,3 @@ yarn esbuild # Copy static files cp -r src/server/static dist/ - -# Copy GCP service account key to dist (if needed) -cp gcp-key.json dist/ \ No newline at end of file diff --git a/src/utils/logging_service/gcp_logging.ts b/src/utils/logging_service/gcp_logging.ts index e163d8af..6cd152a3 100644 --- a/src/utils/logging_service/gcp_logging.ts +++ b/src/utils/logging_service/gcp_logging.ts @@ -6,17 +6,20 @@ import { generateSettings, PLUGIN_USER } from "../../settings"; import { readYML } from "../../utils/common"; import { UserState } from "../../utils/user_utils"; import fs from "fs"; -import path from "path"; -// const logging = new Logging({ -// projectId: "codesync-280105", -// keyFilename: path.join(__dirname, "/gcp-key.json"), -// }); - -const logging = new Logging({ projectId: "codesync-280105" }); +const logging = new Logging({ + projectId: "codesync-280105", + credentials: { + client_email: "testlogging@codesync-280105.iam.gserviceaccount.com", + private_key: + "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDHjxDAdcFtjiKx\ngdtLajcffAqNIP7aRhKJg6hLhBk9Iqq6eNybdB6ydUDrpDFQxo3DTG/3wExxPiJ3\n1TWqTxSx4p49jLQfsqiQkWIuNQDKUIvcE2PtPAYmYngrPlK3AVQXJR7xKjbxRsCk\noDcHzaP9vonlz6Z718pHMIg7WtdeMuVp228H3zzOqFmquQLt6M5WNxksFhsj2axx\njmton0NTS+wW88HZrgRZXPB1Gf9igA+0e3w2egoYrWZ9ObEK5i4Zgp+MSvcV8FOI\nQfB745lB/YaPpTUtlkxkEnE0Xs85q/xt7UnPC4sa/pKAY1agLhYn1ZHz4rx2AGfL\n8D+w4W3jAgMBAAECggEAMo8Qk3JCG1uTdp2LzcOPS67FjZP6fZqbP7PXg6poKpEJ\n6EyOt+PnkxcZ55ml1O05JW3MQFy8AUTYvruJ6Sg3+gmMRdPMHuvIwTfURBixppBZ\nntxayNQYSslP4MTdd/giMer5t+gWG3Ltg8gDqTp0fek0TsEZUO8PFJI7Ma6GOhsA\nYrDRBi0BvLeMh0shnamrXYlgxfJSEHR5zzBJKthSYGwcgamgeOWYCXLRu4QsJe7l\n9+l/97BAEh1/kg8wLTY6z/BheCm5sEHazNaoOvfz/Kt/gAUWewzunvOrcZ7Q3CSl\nsHdwhhrWcajFlF+Qe3G6cBre9eUgCFcCcAog4qPBAQKBgQDqJ7b9bXGLr++RhHN2\nwY5Jq/fAsTnG/Hd1ONMj1SKNZ3ujrrpnKylnHSGnU2lJfa9gCsg0iZLYEyHIFSsN\nS0sRuPkxU5I9YgP5oYLtEI/tTrj2qk81zq7MZ+kIzQ1bcsaXUBA2Z/H/iagicAZf\nDZ0jqwnwZMrHMr9BSuZIKfKs4QKBgQDaLRf9jWJoQkliGbIjQdOQdOPJ93Or3sG1\n5p0toCspXASgwW4skus4yVrAPuS0gSsJebpP+5fTz+2mrWVBETjtyAjidvX/q3sy\novI/B+iv4z22wa42IhrYy1gOd1Fp/LZfbPiguxtTQO36MPhOLNXOQgB/kOF42RH9\ngcUwQN0PQwKBgQCpCTiZ5Ps2OzE4HKT6Eyqz1nhJW+d41eMq9XW/BWsnJ5BjDo00\nUz1VWftkftugGSKUs9Pp0XL3l4Aon9dvhm5QAfeq+0i0FWEHQehxWSZ9yvnN4A7E\nqksX9t+M4fKFlOr2au75R7q0ndyJ19NRpVNOX3gSWcDlYqYc7YQmjlnJIQKBgADj\njCR5TfxUwM3IgwRHwV/mSgNJocwCdVGTZfKIo4Rgnpg1EYjW9GRf1aHQ38eoew9n\n0o1+3eh8AWDbdf0k39GALiEWEPyAq1jSdyAwnQ8SYu76rQYFb4yQj4RHkipXYDrV\nS9ID0SGuswmA55IR9rEHbc8XPQPsBnm87Ju8t+nXAoGBAMax+/8sRIoU9sOk5/lD\nBheDpOHvJTTQAM6H9ybZJIOT5j548rY+RqHmFbqE1g3yTUVpZy4zffC7x0Uq5+0Y\nsRT+fn7qGLAfiJQv2GTnta1Hjl3O01lT8XjmyjwpcNifboxaSmxgc7f2CBzvZKbv\nzhWwMBoytTj+Y3f+IoLMAVnb\n-----END PRIVATE KEY-----\n".replace( + /\\n/g, + "\n" + ), + }, +}); let macAddress = ""; - macaddress.one().then((mac) => (macAddress = mac)); export const putLogEvent = async ( @@ -26,6 +29,7 @@ export const putLogEvent = async ( logName?: string ) => { const eventMsg = additionalMsg ? `${msg}, ${additionalMsg}` : msg; + console.log(eventMsg); let email = ""; const settings = generateSettings(); @@ -50,10 +54,12 @@ export const putLogEvent = async ( const metadata = { resource: { type: "global" }, - severity: eventType, - labels: { email, type: eventType }, + severity: eventType, // e.g., INFO, ERROR, etc. + labels: { + email, + type: eventType, + }, }; - const logEntry = log.entry(metadata, { msg: eventMsg, type: eventType, @@ -65,17 +71,8 @@ export const putLogEvent = async ( }); try { - console.log("xD: Writing log entry:", eventMsg); await log.write(logEntry); - console.log("xD: ✅ Log entry written successfully:", eventMsg); - } catch (err: any) { - console.error("xD: ❌ Error writing log entry:", err.message); - if (err.code === 7) { - console.error( - "xD: ❌ Not authorized. Ask user to run `gcloud auth application-default login`." - ); - } else { - console.error("xD: ❌ Logging failed:", err.message); - } + } catch (err) { + console.log(`Failed to log to GCP: ${err}`); } }; From efa5c4b481bb7a89740c4f5dfe2d1aa04e5e098d Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Tue, 24 Jun 2025 22:43:54 +0500 Subject: [PATCH 04/12] remove redundent consoles --- build.sh | 7 +------ src/utils/logging_service/aws_logging.ts | 2 -- src/utils/logging_service/gcp_logging.ts | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/build.sh b/build.sh index 80a7de61..e62ea095 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,2 @@ -#!/bin/bash - -# Build with esbuild yarn esbuild - -# Copy static files -cp -r src/server/static dist/ +cp -r src/server/static dist/ \ No newline at end of file diff --git a/src/utils/logging_service/aws_logging.ts b/src/utils/logging_service/aws_logging.ts index 177e7040..4119b1b4 100644 --- a/src/utils/logging_service/aws_logging.ts +++ b/src/utils/logging_service/aws_logging.ts @@ -29,7 +29,6 @@ export const putLogEvent = async ( if (additionalMsg) { eventMsg = `${msg}, ${additionalMsg}`; } - // console.log(eventMsg); let email = ""; let accessKey = ""; @@ -62,7 +61,6 @@ export const putLogEvent = async ( if (!(accessKey && secretKey && email)) { email = PLUGIN_USER.logStream; const pluginUser = users[email]; - // console.log("xD pluginUser:", pluginUser); if (!pluginUser) return; accessKey = pluginUser.access_key; secretKey = pluginUser.secret_key; diff --git a/src/utils/logging_service/gcp_logging.ts b/src/utils/logging_service/gcp_logging.ts index 6cd152a3..16f278f1 100644 --- a/src/utils/logging_service/gcp_logging.ts +++ b/src/utils/logging_service/gcp_logging.ts @@ -29,7 +29,6 @@ export const putLogEvent = async ( logName?: string ) => { const eventMsg = additionalMsg ? `${msg}, ${additionalMsg}` : msg; - console.log(eventMsg); let email = ""; const settings = generateSettings(); From 36896d90df3b034afb0a53d1819f02e5d4f119aa Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Mon, 30 Jun 2025 22:04:32 +0500 Subject: [PATCH 05/12] remove redundent logs --- src/logger.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/logger.ts b/src/logger.ts index 9fe7c8af..3dd0c127 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -15,7 +15,6 @@ const putLogEvent = async ( additionalMsg = "", logStream?: string ) => { - console.log("xD: testing"); if (isGCPEnabled) { return GCPputLogEvent(msg, eventType, additionalMsg, logStream); } else if (isAWSEnabled) { From 84d5014c41f41bc9e74d77adb45854c88a37beb9 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Mon, 14 Jul 2025 17:35:32 +0500 Subject: [PATCH 06/12] upload files to pre assigned URl --- src/connect_repo/s3_uploader.ts | 63 ++++--- src/connect_repo/utils.ts | 308 ++++++++++++++++++++------------ src/logger.ts | 4 - src/settings.ts | 5 +- src/utils/upload_utils.ts | 63 ++++++- 5 files changed, 300 insertions(+), 143 deletions(-) diff --git a/src/connect_repo/s3_uploader.ts b/src/connect_repo/s3_uploader.ts index 774d2ab6..0ecb7325 100644 --- a/src/connect_repo/s3_uploader.ts +++ b/src/connect_repo/s3_uploader.ts @@ -11,11 +11,12 @@ import { generateSettings } from "../settings"; import { uuidv4 } from '../utils/setup_utils'; import { removeFile } from '../utils/file_utils'; import { pathUtils } from '../utils/path_utils'; -import { uploadFileTos3 } from '../utils/upload_utils'; +import { uploadFileTos3, uploadFileToGCS } from '../utils/upload_utils'; import { CodeSyncLogger } from '../logger'; import { CODESYNC_STATES, CodeSyncState } from '../utils/state_utils'; import { IS3UploaderFile, IS3UploaderPreProcess } from '../interface'; import { S3_UPLOADR_RETRY_AFTER } from '../constants'; +import { UserUtils } from "../utils/user_utils"; export class s3UploaderUtils { @@ -272,26 +273,46 @@ class s3Uploader extends s3UploaderUtils { return await this.processTasks(0); } - createTasks = async (content: IS3UploaderFile) => { - // Proceess the given file and create parallelTasks - const pathUtils_ = new pathUtils(this.repoPath, content.branch); - this.originalsRepoBranchPath = pathUtils_.getOriginalsRepoBranchPath(); - const fileRelPaths = Object.keys(content.file_path_and_urls); - if (!fileRelPaths || isEmpty(content.file_path_and_urls)) return; - this.filePathAndURLs = {}; - // Skip files which don't exist in .originals or don't have URL - fileRelPaths.sort().forEach(fileRelPath => { - const originalsFilePath = path.join(this.originalsRepoBranchPath, fileRelPath); - if (!fs.existsSync(originalsFilePath)) return; - const presignedURL = content.file_path_and_urls[fileRelPath]; - if (!presignedURL) return removeFile(originalsFilePath, "s3Uploader.deleting-originals-file"); - this.filePathAndURLs[fileRelPath] = presignedURL; - this.tasks.push(async function (callback: any) { - const json = await uploadFileTos3(originalsFilePath, presignedURL); - callback(json.error, originalsFilePath); - }); - }); - } + createTasks = async (content: IS3UploaderFile) => { + // Proceess the given file and create parallelTasks + const pathUtils_ = new pathUtils(this.repoPath, content.branch); + this.originalsRepoBranchPath = pathUtils_.getOriginalsRepoBranchPath(); + const fileRelPaths = Object.keys(content.file_path_and_urls); + if (!fileRelPaths || isEmpty(content.file_path_and_urls)) return; + this.filePathAndURLs = {}; + // Skip files which don't exist in .originals or don't have URL + fileRelPaths.sort().forEach((fileRelPath) => { + const originalsFilePath = path.join( + this.originalsRepoBranchPath, + fileRelPath + ); + if (!fs.existsSync(originalsFilePath)) return; + const presignedURL = content.file_path_and_urls[fileRelPath]; + if (!presignedURL) + return removeFile( + originalsFilePath, + "s3Uploader.deleting-originals-file" + ); + this.filePathAndURLs[fileRelPath] = presignedURL; + this.tasks.push(async function (callback: any) { + const userUtils = new UserUtils(); + const activeUser: any = userUtils.getActiveUser(); + let users = {}; + users = readYML(generateSettings().USER_PATH) || {}; + let json: any = null; + let key: any= null; + if (activeUser && activeUser?.email in users) { + key = users[activeUser.email].gcp_private_key; + } + if (key) { + json = await uploadFileToGCS(originalsFilePath, presignedURL); + } else { + json = await uploadFileTos3(originalsFilePath, presignedURL); + } + callback(json.error, originalsFilePath); + }); + }); + }; processTasks = async (startIndex: number) => { if (!await this.shouldProceed()) return; diff --git a/src/connect_repo/utils.ts b/src/connect_repo/utils.ts index 060fe138..aa8f5476 100644 --- a/src/connect_repo/utils.ts +++ b/src/connect_repo/utils.ts @@ -19,6 +19,7 @@ import { s3UploaderUtils } from './s3_uploader'; import gitCommitInfo from 'git-commit-info'; import { RepoPlanLimitsState, RepoState } from '../utils/repo_state_utils'; import { captureTabs } from '../utils/tab_utils'; +import { UserUtils } from "../utils/user_utils"; export class initUtils { repoPath: string; @@ -95,26 +96,49 @@ export class initUtils { CodeSyncLogger.error("Unable to copy for rename", `${from} -> ${to}`); } } - saveIamUser (user: any) { - // save iam credentials if not saved already - const iamUser = { - access_key: user.iam_access_key, - secret_key: user.iam_secret_key, - }; - let users = {}; - if (!fs.existsSync(this.settings.USER_PATH)) { - users[user.email] = iamUser; - } else { - users = readYML(this.settings.USER_PATH) || {}; - if (user.email in users) { - users[user.email].access_key = iamUser.access_key; - users[user.email].secret_key = iamUser.secret_key; - } else { - users[user.email] = iamUser; - } - } - fs.writeFileSync(this.settings.USER_PATH, yaml.dump(users)); - } + saveIamUser(user: any) { + // save iam credentials if not saved already + let users = {}; + users = readYML(this.settings.USER_PATH) || {}; + if (user?.gcp_private_key) { + // user object will look like + // { + // email: "zahidtestinggcpflow@codesync-280105.iam.gserviceaccount.com" + // gcp_private_key: "-----BEGIN PRIVATE KEY-----\n RandomString...-----END" + // gcp_project_id: "codesync-280105" + // } + + const userUtils = new UserUtils(); + const activeUser = userUtils.getActiveUser(); + + // users = readYML(this.settings.USER_PATH) || {}; + if (activeUser && activeUser?.email in users) { + // users[activeUser.email].client_email = user.email; + users[activeUser.email].client_email = user.email; + users[activeUser.email].gcp_private_key = user.gcp_private_key; + users[activeUser.email].gcp_project_id = user.gcp_project_id; + } + } else { + // TODO refector this code + const iamUser = { + access_key: user.iam_access_key, + secret_key: user.iam_secret_key, + }; + + if (!fs.existsSync(this.settings.USER_PATH)) { + users[user.email] = iamUser; + } else { + // users = readYML(this.settings.USER_PATH) || {}; + if (user.email in users) { + users[user.email].access_key = iamUser.access_key; + users[user.email].secret_key = iamUser.secret_key; + } else { + users[user.email] = iamUser; + } + } + } + fs.writeFileSync(this.settings.USER_PATH, yaml.dump(users)); + } saveFileIds(branch: string, userEmail: string, uploadResponse: any) { // Save file IDs, repoId and email against repo path @@ -147,110 +171,164 @@ export class initUtils { vscode.window.showInformationMessage(NOTIFICATION.REPO_CONNECTED); } - async uploadRepo(branch: string, token: string, itemPaths: IFileToUpload[], - userEmail: string, isPublic=false, repoId=null, orgId=null, teamId=null) { - // Check plan limits - const repoLimitsState = new RepoPlanLimitsState(this.repoPath).get(); - if (repoLimitsState.planLimitReached && !repoLimitsState.canRetry) return false; - const repoName = path.basename(this.repoPath); - const repoStateUtils = new RepoState(this.repoPath); - const repoState = repoStateUtils.get(); - const configJSON = repoStateUtils.config; - const branchFiles = {}; - const filesData = {}; - itemPaths.forEach((fileToUpload) => { - branchFiles[fileToUpload.rel_path] = null; - filesData[fileToUpload.rel_path] = { - is_binary: fileToUpload.is_binary, - size: fileToUpload.size, - created_at: fileToUpload.created_at ? fileToUpload.created_at / 1000 : "" - }; - }); - if (!repoState.IS_CONNECTED) { - configJSON.repos[this.repoPath] = { - branches: {}, - email: userEmail, - orgId: orgId, - teamId: teamId - }; - configJSON.repos[this.repoPath].branches[branch] = branchFiles; - fs.writeFileSync(this.settings.CONFIG_PATH, yaml.dump(configJSON)); - } else if (!(branch in configJSON.repos[this.repoPath].branches)) { - configJSON.repos[this.repoPath].branches[branch] = branchFiles; - fs.writeFileSync(this.settings.CONFIG_PATH, yaml.dump(configJSON)); - } + async uploadRepoToGCS( + branch: string, + uploadResponse: any, + syncingBranchKey: string + ) { + console.log("CodeSync: Uploading to GCP"); + /* + Save URLs in YML file for GCS Uploader + */ + const filePathAndURLs = uploadResponse.urls; + const uploaderUtils = new s3UploaderUtils(); + uploaderUtils.saveURLs(this.repoPath, branch, filePathAndURLs); + // Reset state values + CodeSyncState.set(syncingBranchKey, false); + CodeSyncState.set(CODESYNC_STATES.IS_SYNCING_BRANCH, false); + // Hide Connect Repo + vscode.commands.executeCommand( + "setContext", + contextVariables.showConnectRepoView, + false + ); + if (this.viaDaemon) return; + // Show success notification + vscode.window.showInformationMessage(NOTIFICATION.REPO_CONNECTED); + } + + async uploadRepo( + branch: string, + token: string, + itemPaths: IFileToUpload[], + userEmail: string, + isPublic = false, + repoId = null, + orgId = null, + teamId = null + ) { + // Check plan limits + const repoLimitsState = new RepoPlanLimitsState(this.repoPath).get(); + + if (repoLimitsState.planLimitReached && !repoLimitsState.canRetry) + return false; + const repoName = path.basename(this.repoPath); + const repoStateUtils = new RepoState(this.repoPath); + const repoState = repoStateUtils.get(); + const configJSON = repoStateUtils.config; + const branchFiles = {}; + const filesData = {}; - const isServerDown = await checkServerDown(); - if (isServerDown) { - if (!this.viaDaemon) CodeSyncLogger.error(CONNECTION_ERROR_MESSAGE); - return false; - } + itemPaths.forEach((fileToUpload) => { + branchFiles[fileToUpload.rel_path] = null; + filesData[fileToUpload.rel_path] = { + is_binary: fileToUpload.is_binary, + size: fileToUpload.size, + created_at: fileToUpload.created_at + ? fileToUpload.created_at / 1000 + : "", + }; + }); + if (!repoState.IS_CONNECTED) { + configJSON.repos[this.repoPath] = { + branches: {}, + email: userEmail, + orgId: orgId, + teamId: teamId, + }; + configJSON.repos[this.repoPath].branches[branch] = branchFiles; + fs.writeFileSync(this.settings.CONFIG_PATH, yaml.dump(configJSON)); + } else if (!(branch in configJSON.repos[this.repoPath].branches)) { + configJSON.repos[this.repoPath].branches[branch] = branchFiles; + fs.writeFileSync(this.settings.CONFIG_PATH, yaml.dump(configJSON)); + } - // Check if branch is already being synced, skip it - const syncingBranchKey = `${CODESYNC_STATES.SYNCING_BRANCH}:${this.repoPath}:${branch}`; - const isSyncInProcess = CodeSyncState.canSkipRun(syncingBranchKey, BRANCH_SYNC_TIMEOUT); - if (isSyncInProcess) return false; + const isServerDown = await checkServerDown(); + if (isServerDown) { + if (!this.viaDaemon) CodeSyncLogger.error(CONNECTION_ERROR_MESSAGE); + return false; + } - // Set key here that Branch is being synced - CodeSyncState.set(syncingBranchKey, new Date().getTime()); - CodeSyncState.set(CODESYNC_STATES.IS_SYNCING_BRANCH, new Date().getTime()); - const instanceUUID = CodeSyncState.get(CODESYNC_STATES.INSTANCE_UUID); - CodeSyncLogger.info(`Uploading branch=${branch}, repo=${this.repoPath}, uuid=${instanceUUID}`); + // Check if branch is already being synced, skip it + const syncingBranchKey = `${CODESYNC_STATES.SYNCING_BRANCH}:${this.repoPath}:${branch}`; + const isSyncInProcess = CodeSyncState.canSkipRun( + syncingBranchKey, + BRANCH_SYNC_TIMEOUT + ); + if (isSyncInProcess) return false; - const commit_hash = gitCommitInfo({cwd: this.repoPath}).hash || null; + // Set key here that Branch is being synced + CodeSyncState.set(syncingBranchKey, new Date().getTime()); + CodeSyncState.set(CODESYNC_STATES.IS_SYNCING_BRANCH, new Date().getTime()); + const instanceUUID = CodeSyncState.get(CODESYNC_STATES.INSTANCE_UUID); + CodeSyncLogger.info( + `Uploading branch=${branch}, repo=${this.repoPath}, uuid=${instanceUUID}` + ); - const data = { - repo_path: this.repoPath, - name: repoName, - is_public: isPublic, - branch, - commit_hash, - files_data: JSON.stringify(filesData), - source: VSCODE, - platform: os.platform(), - org_id: configJSON.repos[this.repoPath].orgId, - team_id: configJSON.repos[this.repoPath].teamId - }; + const commit_hash = gitCommitInfo({ cwd: this.repoPath }).hash || null; - const json = await uploadRepoToServer(token, data, repoId); - if (json.error) { - // Reset the key here and try again in next attempt - CodeSyncState.set(syncingBranchKey, false); - CodeSyncState.set(CODESYNC_STATES.IS_SYNCING_BRANCH, false); - let error = this.viaDaemon ? NOTIFICATION.ERROR_SYNCING_BRANCH : NOTIFICATION.ERROR_CONNECTING_REPO; - error = `${error}, branch=${branch}, repo=${this.repoPath}`; - CodeSyncLogger.error(error, json.error, userEmail); - if (!this.viaDaemon && !json.msgShown) vscode.window.showErrorMessage(NOTIFICATION.REPO_CONNECTE_FAILED); - return false; - } - /* - Response from server looks like - { - 'repo_id': repo_id, - 'branch_id': branch_id, - 'file_path_and_ids': {file_path_and_id}, - 'urls': {presigned_urls_for_files}, - 'user': { - 'email': email, - 'iam_access_key': , - 'iam_secret_key': - } - } - */ + const data = { + repo_path: this.repoPath, + name: repoName, + is_public: isPublic, + branch, + commit_hash, + files_data: JSON.stringify(filesData), + source: VSCODE, + platform: os.platform(), + org_id: configJSON.repos[this.repoPath].orgId, + team_id: configJSON.repos[this.repoPath].teamId, + }; - const user = json.response.user; + // return; + const json = await uploadRepoToServer(token, data, repoId); + if (json.error) { + // Reset the key here and try again in next attempt + CodeSyncState.set(syncingBranchKey, false); + CodeSyncState.set(CODESYNC_STATES.IS_SYNCING_BRANCH, false); + let error = this.viaDaemon + ? NOTIFICATION.ERROR_SYNCING_BRANCH + : NOTIFICATION.ERROR_CONNECTING_REPO; + error = `${error}, branch=${branch}, repo=${this.repoPath}`; + CodeSyncLogger.error(error, json.error, userEmail); + if (!this.viaDaemon && !json.msgShown) + vscode.window.showErrorMessage(NOTIFICATION.REPO_CONNECTE_FAILED); + return false; + } + /* + Response from server looks like + { + 'repo_id': repo_id, + 'branch_id': branch_id, + 'file_path_and_ids': {file_path_and_id}, + 'urls': {presigned_urls_for_files}, + 'user': { + 'email': email, + 'iam_access_key': , + 'iam_secret_key': + } + } + */ - // Save IAM credentials - this.saveIamUser(user); + const user = json.response.user; - // Save file paths and IDs in config - this.saveFileIds(branch, user.email, json.response); + // Save IAM credentials + this.saveIamUser(user); - // Upload to s3 - await this.uploadRepoToS3(branch, json.response, syncingBranchKey); + // Save file paths and IDs in config + this.saveFileIds(branch, user.email, json.response); + + if (user?.gcp_private_key) { + // Upload to GCS + await this.uploadRepoToGCS(branch, json.response, syncingBranchKey); + } else { + // Upload to s3 + await this.uploadRepoToS3(branch, json.response, syncingBranchKey); + } + + // Capture tabs for newly connected repo/branch + captureTabs(this.repoPath); + return true; + } - // Capture tabs for newly connected repo/branch - captureTabs(this.repoPath); - return true; - } } diff --git a/src/logger.ts b/src/logger.ts index 3dd0c127..44af6936 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -2,10 +2,6 @@ import { putLogEvent as AWSputLogEvent } from "./utils/logging_service/aws_loggi import { putLogEvent as GCPputLogEvent } from "./utils/logging_service/gcp_logging"; import { LOG_AFTER_X_TIMES } from "./constants"; - -// const isGCPEnabled = process.env.GCP_LOGGING_ENABLED === "true"; -// const isAWSEnabled = process.env.AWS_LOGGING_ENABLED === "true"; - const isGCPEnabled = true; const isAWSEnabled = false; diff --git a/src/settings.ts b/src/settings.ts index c9c2fb17..0c838cf0 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -6,7 +6,7 @@ import { devConfig } from "./config/dev"; import { formatDatetime } from "./utils/common"; // Set this to true for Development -const DEBUG = false; +const DEBUG = true; const useStaging = false; const DevConfig = { ROOT_REPO: useStaging ? stagingConfig.ROOT_REPO: devConfig.ROOT_REPO, @@ -81,7 +81,8 @@ export const generateSettings = () => { SHADOW_REPO: path.join(rootRepo, ".shadow"), DELETED_REPO: path.join(rootRepo, ".deleted"), LOCKS_REPO: path.join(rootRepo, ".locks"), - S3_UPLOADER: path.join(rootRepo, ".s3_uploader"), + // S3_UPLOADER: path.join(rootRepo, ".s3_uploader"), + S3_UPLOADER: path.join(rootRepo, ".cloud_uploader"), CONFIG_PATH: path.join(rootRepo, "config.yml"), ON_PREM_CONFIG: path.join(rootRepo, "on_prem_config.json"), USER_PATH: path.join(rootRepo, "user.yml"), diff --git a/src/utils/upload_utils.ts b/src/utils/upload_utils.ts index f63b3e08..894d2c1a 100644 --- a/src/utils/upload_utils.ts +++ b/src/utils/upload_utils.ts @@ -8,6 +8,9 @@ import { formatDatetime, readFile } from './common'; import { s3UploaderUtils } from '../connect_repo/s3_uploader'; import { RepoPlanLimitsState } from './repo_state_utils'; +import * as https from "https"; +import * as http from "http"; +import { URL } from "url"; export const uploadRepoToServer = async (accessToken: string, data: any, repoId=null) => { /* @@ -153,12 +156,70 @@ export const uploadFileTos3 = async (filePath: string, presignedUrl: any) => { // Actual file has to be appended last. formData.append("file", content); formData.submit(presignedUrl.url, function(err, res) { - if (err) resolve({error: err}); + if (err){ + resolve({error: err}); + } resolve({error: null}); }); }); }; +export const uploadFileToGCS = async (filePath: string, signedUrl: any) => { + if (!fs.existsSync(filePath)) { + return { + error: `uploadFileToGCS: File=${filePath} not found` + }; + } + + return await new Promise((resolve) => { + let content; + try { + content = fs.readFileSync(filePath); + } catch (e) { + return resolve({ error: `Could not read file: ${filePath}` }); + } + + let urlParts; + try { + urlParts = new URL(signedUrl.url); + } catch (e) { + return resolve({ error: "Invalid signed URL" }); + } + + const { hostname, pathname, search, protocol } = urlParts; + + const options: https.RequestOptions = { + method: "PUT", + hostname, + path: pathname + search, + headers: { + "Content-Length": content.length, + "Content-Type": "application/octet-stream", // Match the content type used to generate the signed URL + } + }; + + const requestFn = protocol === "https:" ? https.request : http.request; + + const req = requestFn(options, (res) => { + let body = ""; + res.on("data", chunk => body += chunk); + res.on("end", () => { + if (res.statusCode === 200) { + resolve({ error: null }); + } else { + resolve({ error: `GCS Upload failed: ${res.statusCode} - ${body}` }); + } + }); + }); + + req.on("error", err => { + resolve({ error: err }); + }); + + req.write(content); + req.end(); + }); +}; export const uploadFileToServer = async (accessToken: string, repoId: number, branch: string, filePath: string, relPath: string, addedAt: string, repoPath: string, commitHash: string|null) => { From 2d5f193d2d9c9bf53fd3fb47d18eaf443250baa7 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Wed, 16 Jul 2025 19:20:21 +0500 Subject: [PATCH 07/12] add loger for debugging --- src/connect_repo/utils.ts | 5 ++-- src/logger.ts | 48 +++++++++++++++++++++++++++++++++++++-- src/utils/state_utils.ts | 1 + src/utils/upload_utils.ts | 3 +++ src/utils/user_utils.ts | 8 +++++++ 5 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/connect_repo/utils.ts b/src/connect_repo/utils.ts index aa8f5476..031d5032 100644 --- a/src/connect_repo/utils.ts +++ b/src/connect_repo/utils.ts @@ -113,7 +113,7 @@ export class initUtils { // users = readYML(this.settings.USER_PATH) || {}; if (activeUser && activeUser?.email in users) { - // users[activeUser.email].client_email = user.email; + users[activeUser.email].cloud_service = "gcp"; users[activeUser.email].client_email = user.email; users[activeUser.email].gcp_private_key = user.gcp_private_key; users[activeUser.email].gcp_project_id = user.gcp_project_id; @@ -132,11 +132,13 @@ export class initUtils { if (user.email in users) { users[user.email].access_key = iamUser.access_key; users[user.email].secret_key = iamUser.secret_key; + users[user.email].cloud_service = "aws"; } else { users[user.email] = iamUser; } } } + console.log("CodeSync: users in IamUser", users); fs.writeFileSync(this.settings.USER_PATH, yaml.dump(users)); } @@ -176,7 +178,6 @@ export class initUtils { uploadResponse: any, syncingBranchKey: string ) { - console.log("CodeSync: Uploading to GCP"); /* Save URLs in YML file for GCS Uploader */ diff --git a/src/logger.ts b/src/logger.ts index 44af6936..a3ba20ee 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,23 +1,47 @@ +import fs from "fs"; +import yaml from "js-yaml"; +import { readYML } from "./utils/common"; import { putLogEvent as AWSputLogEvent } from "./utils/logging_service/aws_logging"; import { putLogEvent as GCPputLogEvent } from "./utils/logging_service/gcp_logging"; import { LOG_AFTER_X_TIMES } from "./constants"; +import { UserUtils } from "./utils/user_utils"; +import { IUser } from "./interface"; +import { generateSettings } from "./settings"; const isGCPEnabled = true; const isAWSEnabled = false; +// let cachedUser: IUser | null = null; + +// const getActiveUser = () => { +// if (cachedUser) return cachedUser; +// const userUtils = UserUtils.getInstance(); +// cachedUser = userUtils.getActiveUser(); +// return cachedUser; +// }; + const putLogEvent = async ( msg: string, eventType: string, additionalMsg = "", logStream?: string ) => { + // const activeUser = getActiveUser(); + + // if (!activeUser) { + // console.warn("⚠️ Logging skipped: No active user."); + // return; + // } + + const isGCPEnabled = true; + const isAWSEnabled = false; + if (isGCPEnabled) { return GCPputLogEvent(msg, eventType, additionalMsg, logStream); } else if (isAWSEnabled) { return AWSputLogEvent(msg, eventType, additionalMsg, logStream); } else { - console.warn("⚠️ No logging provider enabled."); - return; + console.warn("⚠️ No logging provider enabled for active user."); } }; @@ -37,6 +61,26 @@ export class CodeSyncLogger { ERROR: Errors that cause a bad UX and should be fixed soon. CRITICAL: Errors that are blocking for the normal operation of the plugin and should be fixed immediately. */ + private cloudService = ""; + + constructor() { + console.log("CodeSync: Initializing CodeSyncLogger..."); + let users = {}; + users = readYML(generateSettings().USER_PATH) || {}; + + const userUtils = new UserUtils(); + const activeUser: any = userUtils.getActiveUser(); + + if (!activeUser || !users) { + console.warn("⚠️ No active user or users data found."); + return; + } + + console.log("CodeSync: Active user found", activeUser); + if (activeUser && activeUser?.email in users) { + this.cloudService = users[activeUser.email].cloud_service; + } + } static async debug(msg: string, additionalMsg = "", logStream?: string) { await putLogEvent(msg, logErrorMsgTypes.DEBUG, additionalMsg, logStream); diff --git a/src/utils/state_utils.ts b/src/utils/state_utils.ts index aa69803b..054b9475 100644 --- a/src/utils/state_utils.ts +++ b/src/utils/state_utils.ts @@ -35,6 +35,7 @@ export const CODESYNC_STATES = { AUTHENTICATION_INITIATED_AT: "authInitiatedAt" }, ACTIVE_TAB_PATH: "activeTabPath", + ACTIVE_CLOUD_SERVICE: null, }; export class CodeSyncState { diff --git a/src/utils/upload_utils.ts b/src/utils/upload_utils.ts index 894d2c1a..8f68aa58 100644 --- a/src/utils/upload_utils.ts +++ b/src/utils/upload_utils.ts @@ -7,6 +7,7 @@ import { PlanLimitsHandler } from './pricing_utils'; import { formatDatetime, readFile } from './common'; import { s3UploaderUtils } from '../connect_repo/s3_uploader'; import { RepoPlanLimitsState } from './repo_state_utils'; +import { CodeSyncLogger } from '../logger'; import * as https from "https"; import * as http from "http"; @@ -186,6 +187,8 @@ export const uploadFileToGCS = async (filePath: string, signedUrl: any) => { return resolve({ error: "Invalid signed URL" }); } + // console.log("CodeSync: signedUrl.url", signedUrl.url); + CodeSyncLogger.debug("CodeSync: signedUrl.url", signedUrl.url); const { hostname, pathname, search, protocol } = urlParts; const options: https.RequestOptions = { diff --git a/src/utils/user_utils.ts b/src/utils/user_utils.ts index bd6d5359..bb6843d1 100644 --- a/src/utils/user_utils.ts +++ b/src/utils/user_utils.ts @@ -74,6 +74,7 @@ export class UserState { export class UserUtils { users = {}; + // private static instance: UserUtils; constructor() { const settings = generateSettings(); @@ -81,6 +82,13 @@ export class UserUtils { this.users = readYML(settings.USER_PATH) || {}; } +// public static getInstance() { +// if (!UserUtils.instance) { +// UserUtils.instance = new UserUtils(); +// } +// return UserUtils.instance; +// } + isUserActive = (email: string) : boolean => { if (!this.users) return false; const user = this.users[email]; From 092bce344a08bb7459d6416d1dcac81f8cd2612b Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Wed, 16 Jul 2025 20:12:43 +0500 Subject: [PATCH 08/12] add logs for debugginh --- src/connect_repo/s3_uploader.ts | 5 +++++ src/connect_repo/utils.ts | 2 +- src/logger.ts | 6 ++++-- src/utils/setup_utils.ts | 4 +--- src/utils/upload_utils.ts | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/connect_repo/s3_uploader.ts b/src/connect_repo/s3_uploader.ts index 0ecb7325..359b2399 100644 --- a/src/connect_repo/s3_uploader.ts +++ b/src/connect_repo/s3_uploader.ts @@ -274,6 +274,7 @@ class s3Uploader extends s3UploaderUtils { } createTasks = async (content: IS3UploaderFile) => { + CodeSyncLogger.debug(`CodeSync: createTasks`); // Proceess the given file and create parallelTasks const pathUtils_ = new pathUtils(this.repoPath, content.branch); this.originalsRepoBranchPath = pathUtils_.getOriginalsRepoBranchPath(); @@ -297,13 +298,17 @@ class s3Uploader extends s3UploaderUtils { this.tasks.push(async function (callback: any) { const userUtils = new UserUtils(); const activeUser: any = userUtils.getActiveUser(); + CodeSyncLogger.debug(`CodeSync: activeUser`, activeUser); let users = {}; users = readYML(generateSettings().USER_PATH) || {}; let json: any = null; let key: any= null; if (activeUser && activeUser?.email in users) { key = users[activeUser.email].gcp_private_key; + CodeSyncLogger.debug(`CodeSync: key `, key); } + + CodeSyncLogger.debug(`CodeSync: key before use`, key); if (key) { json = await uploadFileToGCS(originalsFilePath, presignedURL); } else { diff --git a/src/connect_repo/utils.ts b/src/connect_repo/utils.ts index 031d5032..f3dd4ce9 100644 --- a/src/connect_repo/utils.ts +++ b/src/connect_repo/utils.ts @@ -138,7 +138,7 @@ export class initUtils { } } } - console.log("CodeSync: users in IamUser", users); + CodeSyncLogger.debug("CodeSync: users in IamUser", users); fs.writeFileSync(this.settings.USER_PATH, yaml.dump(users)); } diff --git a/src/logger.ts b/src/logger.ts index a3ba20ee..f3d7ea72 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -61,7 +61,8 @@ export class CodeSyncLogger { ERROR: Errors that cause a bad UX and should be fixed soon. CRITICAL: Errors that are blocking for the normal operation of the plugin and should be fixed immediately. */ - private cloudService = ""; + private cloudService = null; + // static cloudService: string; constructor() { console.log("CodeSync: Initializing CodeSyncLogger..."); @@ -72,7 +73,7 @@ export class CodeSyncLogger { const activeUser: any = userUtils.getActiveUser(); if (!activeUser || !users) { - console.warn("⚠️ No active user or users data found."); + console.warn("CodeSync: ⚠️ No active user or users data found."); return; } @@ -83,6 +84,7 @@ export class CodeSyncLogger { } static async debug(msg: string, additionalMsg = "", logStream?: string) { + // const cloudService = this.cloudService ?? "s"; await putLogEvent(msg, logErrorMsgTypes.DEBUG, additionalMsg, logStream); } diff --git a/src/utils/setup_utils.ts b/src/utils/setup_utils.ts index c261e063..bcbf4a82 100644 --- a/src/utils/setup_utils.ts +++ b/src/utils/setup_utils.ts @@ -174,9 +174,7 @@ export const setupCodeSync = async (repoPath: string) => { } // Check is accessToken is valid const isUserActive = await isAccountActive(activeUser.email, activeUser.access_token); - if (!isUserActive) return; - CodeSyncLogger.debug(`User's access token is active, user=${activeUser.email}`); - CodeSyncLogger.warning(`xD User's access token is active, user=${activeUser.email}`); + if (!isUserActive) return; // Show Repo Status showRepoStatusMsg(repoPath); }; diff --git a/src/utils/upload_utils.ts b/src/utils/upload_utils.ts index 8f68aa58..b2a60886 100644 --- a/src/utils/upload_utils.ts +++ b/src/utils/upload_utils.ts @@ -166,6 +166,7 @@ export const uploadFileTos3 = async (filePath: string, presignedUrl: any) => { }; export const uploadFileToGCS = async (filePath: string, signedUrl: any) => { + CodeSyncLogger.debug("CodeSync: uploadFileToGCS"); if (!fs.existsSync(filePath)) { return { error: `uploadFileToGCS: File=${filePath} not found` From f4c4b65ebc8fc335e3558386d7c3de096044468b Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Wed, 16 Jul 2025 20:14:08 +0500 Subject: [PATCH 09/12] fix --- src/utils/upload_utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/upload_utils.ts b/src/utils/upload_utils.ts index b2a60886..c0fb25e3 100644 --- a/src/utils/upload_utils.ts +++ b/src/utils/upload_utils.ts @@ -189,6 +189,7 @@ export const uploadFileToGCS = async (filePath: string, signedUrl: any) => { } // console.log("CodeSync: signedUrl.url", signedUrl.url); + // const a = new CodeSyncLogger(); CodeSyncLogger.debug("CodeSync: signedUrl.url", signedUrl.url); const { hostname, pathname, search, protocol } = urlParts; From f18ea38d001b54a7d2a1158b48681055c343d122 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Sat, 19 Jul 2025 22:42:00 +0500 Subject: [PATCH 10/12] Consolidates logic to handle active users and their cloud service configurations effectively --- src/connect_repo/s3_uploader.ts | 5 +- src/connect_repo/utils.ts | 9 +-- src/constants.ts | 5 ++ src/logger.ts | 81 ++++++++++-------------- src/utils/logging_service/gcp_logging.ts | 75 ++++++++++++---------- src/utils/upload_utils.ts | 4 -- 6 files changed, 85 insertions(+), 94 deletions(-) diff --git a/src/connect_repo/s3_uploader.ts b/src/connect_repo/s3_uploader.ts index 359b2399..afcdd4c6 100644 --- a/src/connect_repo/s3_uploader.ts +++ b/src/connect_repo/s3_uploader.ts @@ -274,7 +274,6 @@ class s3Uploader extends s3UploaderUtils { } createTasks = async (content: IS3UploaderFile) => { - CodeSyncLogger.debug(`CodeSync: createTasks`); // Proceess the given file and create parallelTasks const pathUtils_ = new pathUtils(this.repoPath, content.branch); this.originalsRepoBranchPath = pathUtils_.getOriginalsRepoBranchPath(); @@ -298,17 +297,15 @@ class s3Uploader extends s3UploaderUtils { this.tasks.push(async function (callback: any) { const userUtils = new UserUtils(); const activeUser: any = userUtils.getActiveUser(); - CodeSyncLogger.debug(`CodeSync: activeUser`, activeUser); + let users = {}; users = readYML(generateSettings().USER_PATH) || {}; let json: any = null; let key: any= null; if (activeUser && activeUser?.email in users) { key = users[activeUser.email].gcp_private_key; - CodeSyncLogger.debug(`CodeSync: key `, key); } - CodeSyncLogger.debug(`CodeSync: key before use`, key); if (key) { json = await uploadFileToGCS(originalsFilePath, presignedURL); } else { diff --git a/src/connect_repo/utils.ts b/src/connect_repo/utils.ts index f3dd4ce9..ddb63f68 100644 --- a/src/connect_repo/utils.ts +++ b/src/connect_repo/utils.ts @@ -20,6 +20,7 @@ import gitCommitInfo from 'git-commit-info'; import { RepoPlanLimitsState, RepoState } from '../utils/repo_state_utils'; import { captureTabs } from '../utils/tab_utils'; import { UserUtils } from "../utils/user_utils"; +import { CLOUD_SERVICE } from "../constants"; export class initUtils { repoPath: string; @@ -113,8 +114,8 @@ export class initUtils { // users = readYML(this.settings.USER_PATH) || {}; if (activeUser && activeUser?.email in users) { - users[activeUser.email].cloud_service = "gcp"; - users[activeUser.email].client_email = user.email; + users[activeUser.email].cloud_service = CLOUD_SERVICE?.GCP; + users[activeUser.email].gcp_client_email = user.email; users[activeUser.email].gcp_private_key = user.gcp_private_key; users[activeUser.email].gcp_project_id = user.gcp_project_id; } @@ -132,13 +133,13 @@ export class initUtils { if (user.email in users) { users[user.email].access_key = iamUser.access_key; users[user.email].secret_key = iamUser.secret_key; - users[user.email].cloud_service = "aws"; + users[user.email].cloud_service = CLOUD_SERVICE?.AWS; } else { users[user.email] = iamUser; } } } - CodeSyncLogger.debug("CodeSync: users in IamUser", users); + fs.writeFileSync(this.settings.USER_PATH, yaml.dump(users)); } diff --git a/src/constants.ts b/src/constants.ts index 8959f073..f36194fa 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -20,6 +20,11 @@ export const TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone; export const DATETIME_FORMAT = 'UTC:yyyy-mm-dd HH:MM:ss.l'; export const RESTART_DAEMON_AFTER = 5 * 1000; +export const CLOUD_SERVICE = { + GCP: "GCP", + AWS: "AWS" +}; + export const API_PATH = { REPOS: "/repos" }; diff --git a/src/logger.ts b/src/logger.ts index f3d7ea72..f253f971 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,24 +1,28 @@ -import fs from "fs"; -import yaml from "js-yaml"; import { readYML } from "./utils/common"; +import { CLOUD_SERVICE } from "./constants"; +import { generateSettings } from "./settings"; +import { UserUtils } from "./utils/user_utils"; +import { LOG_AFTER_X_TIMES } from "./constants"; import { putLogEvent as AWSputLogEvent } from "./utils/logging_service/aws_logging"; import { putLogEvent as GCPputLogEvent } from "./utils/logging_service/gcp_logging"; -import { LOG_AFTER_X_TIMES } from "./constants"; -import { UserUtils } from "./utils/user_utils"; -import { IUser } from "./interface"; -import { generateSettings } from "./settings"; -const isGCPEnabled = true; -const isAWSEnabled = false; +const handleUser = () => { + let users = {}; + users = readYML(generateSettings().USER_PATH) || {}; + + const userUtils = new UserUtils(); + const activeUser: any = userUtils.getActiveUser(); -// let cachedUser: IUser | null = null; + if (!activeUser || !users) { + console.warn("⚠️ No active user or users data found."); + return; + } -// const getActiveUser = () => { -// if (cachedUser) return cachedUser; -// const userUtils = UserUtils.getInstance(); -// cachedUser = userUtils.getActiveUser(); -// return cachedUser; -// }; + if (activeUser && activeUser?.email in users) { + users[activeUser.email].user_email = activeUser.email; + return users[activeUser.email]; + } +}; const putLogEvent = async ( msg: string, @@ -26,19 +30,19 @@ const putLogEvent = async ( additionalMsg = "", logStream?: string ) => { - // const activeUser = getActiveUser(); - - // if (!activeUser) { - // console.warn("⚠️ Logging skipped: No active user."); - // return; - // } - - const isGCPEnabled = true; - const isAWSEnabled = false; - - if (isGCPEnabled) { - return GCPputLogEvent(msg, eventType, additionalMsg, logStream); - } else if (isAWSEnabled) { + const user = handleUser(); + const { cloud_service } = user; + + if (cloud_service === CLOUD_SERVICE.GCP) { + const info = { + projectId: user?.gcp_project_id, + clientEmail: user?.gcp_client_email, + privateKey: user?.gcp_private_key, + userEmail: user?.user_email, + }; + + return GCPputLogEvent(msg, eventType, additionalMsg, info, logStream); + } else if (cloud_service === CLOUD_SERVICE.AWS) { return AWSputLogEvent(msg, eventType, additionalMsg, logStream); } else { console.warn("⚠️ No logging provider enabled for active user."); @@ -61,27 +65,6 @@ export class CodeSyncLogger { ERROR: Errors that cause a bad UX and should be fixed soon. CRITICAL: Errors that are blocking for the normal operation of the plugin and should be fixed immediately. */ - private cloudService = null; - // static cloudService: string; - - constructor() { - console.log("CodeSync: Initializing CodeSyncLogger..."); - let users = {}; - users = readYML(generateSettings().USER_PATH) || {}; - - const userUtils = new UserUtils(); - const activeUser: any = userUtils.getActiveUser(); - - if (!activeUser || !users) { - console.warn("CodeSync: ⚠️ No active user or users data found."); - return; - } - - console.log("CodeSync: Active user found", activeUser); - if (activeUser && activeUser?.email in users) { - this.cloudService = users[activeUser.email].cloud_service; - } - } static async debug(msg: string, additionalMsg = "", logStream?: string) { // const cloudService = this.cloudService ?? "s"; diff --git a/src/utils/logging_service/gcp_logging.ts b/src/utils/logging_service/gcp_logging.ts index 16f278f1..728bf0da 100644 --- a/src/utils/logging_service/gcp_logging.ts +++ b/src/utils/logging_service/gcp_logging.ts @@ -1,64 +1,72 @@ -import { Logging } from "@google-cloud/logging"; import os from "os"; import macaddress from "macaddress"; +import { Logging } from "@google-cloud/logging"; + import { VSCODE, VERSION } from "../../constants"; -import { generateSettings, PLUGIN_USER } from "../../settings"; -import { readYML } from "../../utils/common"; import { UserState } from "../../utils/user_utils"; -import fs from "fs"; - -const logging = new Logging({ - projectId: "codesync-280105", - credentials: { - client_email: "testlogging@codesync-280105.iam.gserviceaccount.com", - private_key: - "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDHjxDAdcFtjiKx\ngdtLajcffAqNIP7aRhKJg6hLhBk9Iqq6eNybdB6ydUDrpDFQxo3DTG/3wExxPiJ3\n1TWqTxSx4p49jLQfsqiQkWIuNQDKUIvcE2PtPAYmYngrPlK3AVQXJR7xKjbxRsCk\noDcHzaP9vonlz6Z718pHMIg7WtdeMuVp228H3zzOqFmquQLt6M5WNxksFhsj2axx\njmton0NTS+wW88HZrgRZXPB1Gf9igA+0e3w2egoYrWZ9ObEK5i4Zgp+MSvcV8FOI\nQfB745lB/YaPpTUtlkxkEnE0Xs85q/xt7UnPC4sa/pKAY1agLhYn1ZHz4rx2AGfL\n8D+w4W3jAgMBAAECggEAMo8Qk3JCG1uTdp2LzcOPS67FjZP6fZqbP7PXg6poKpEJ\n6EyOt+PnkxcZ55ml1O05JW3MQFy8AUTYvruJ6Sg3+gmMRdPMHuvIwTfURBixppBZ\nntxayNQYSslP4MTdd/giMer5t+gWG3Ltg8gDqTp0fek0TsEZUO8PFJI7Ma6GOhsA\nYrDRBi0BvLeMh0shnamrXYlgxfJSEHR5zzBJKthSYGwcgamgeOWYCXLRu4QsJe7l\n9+l/97BAEh1/kg8wLTY6z/BheCm5sEHazNaoOvfz/Kt/gAUWewzunvOrcZ7Q3CSl\nsHdwhhrWcajFlF+Qe3G6cBre9eUgCFcCcAog4qPBAQKBgQDqJ7b9bXGLr++RhHN2\nwY5Jq/fAsTnG/Hd1ONMj1SKNZ3ujrrpnKylnHSGnU2lJfa9gCsg0iZLYEyHIFSsN\nS0sRuPkxU5I9YgP5oYLtEI/tTrj2qk81zq7MZ+kIzQ1bcsaXUBA2Z/H/iagicAZf\nDZ0jqwnwZMrHMr9BSuZIKfKs4QKBgQDaLRf9jWJoQkliGbIjQdOQdOPJ93Or3sG1\n5p0toCspXASgwW4skus4yVrAPuS0gSsJebpP+5fTz+2mrWVBETjtyAjidvX/q3sy\novI/B+iv4z22wa42IhrYy1gOd1Fp/LZfbPiguxtTQO36MPhOLNXOQgB/kOF42RH9\ngcUwQN0PQwKBgQCpCTiZ5Ps2OzE4HKT6Eyqz1nhJW+d41eMq9XW/BWsnJ5BjDo00\nUz1VWftkftugGSKUs9Pp0XL3l4Aon9dvhm5QAfeq+0i0FWEHQehxWSZ9yvnN4A7E\nqksX9t+M4fKFlOr2au75R7q0ndyJ19NRpVNOX3gSWcDlYqYc7YQmjlnJIQKBgADj\njCR5TfxUwM3IgwRHwV/mSgNJocwCdVGTZfKIo4Rgnpg1EYjW9GRf1aHQ38eoew9n\n0o1+3eh8AWDbdf0k39GALiEWEPyAq1jSdyAwnQ8SYu76rQYFb4yQj4RHkipXYDrV\nS9ID0SGuswmA55IR9rEHbc8XPQPsBnm87Ju8t+nXAoGBAMax+/8sRIoU9sOk5/lD\nBheDpOHvJTTQAM6H9ybZJIOT5j548rY+RqHmFbqE1g3yTUVpZy4zffC7x0Uq5+0Y\nsRT+fn7qGLAfiJQv2GTnta1Hjl3O01lT8XjmyjwpcNifboxaSmxgc7f2CBzvZKbv\nzhWwMBoytTj+Y3f+IoLMAVnb\n-----END PRIVATE KEY-----\n".replace( - /\\n/g, - "\n" - ), - }, -}); +// Utility to get MAC address once let macAddress = ""; macaddress.one().then((mac) => (macAddress = mac)); +// Log Levels +export const logErrorMsgTypes = { + CRITICAL: "CRITICAL", + ERROR: "ERROR", + WARNING: "WARNING", + INFO: "INFO", + DEBUG: "DEBUG", +}; + +// Helper to return a Logging instance (optionally using dynamic credentials) +const getLoggerInstance = (info: { + projectId: string; + clientEmail: string; + privateKey: string; +}) => + new Logging({ + projectId: info.projectId, + credentials: { + client_email: info.clientEmail, + private_key: info.privateKey.replace(/\\n/g, "\n"), + }, + }); + export const putLogEvent = async ( msg: string, eventType: string, additionalMsg = "", + info: { + projectId: string; + clientEmail: string; + privateKey: string; + userEmail: string; + }, logName?: string ) => { const eventMsg = additionalMsg ? `${msg}, ${additionalMsg}` : msg; - + const userState = new UserState(); + const activeUser = userState.getUser(); let email = ""; - const settings = generateSettings(); - if (!fs.existsSync(settings.USER_PATH)) return; - const users = readYML(settings.USER_PATH); - - if (logName && users[logName]?.is_active) { + if (logName && activeUser?.email === logName) { email = logName; } else { - const userState = new UserState(); - const activeUser = userState.getUser(); - if (activeUser) email = activeUser.email; + email = info?.userEmail; } - // Fallback to plugin user - if (!email) { - email = PLUGIN_USER.logStream; - if (!users[email]) return; - } - const log = logging.log("vs-code"); // Custom log name + const logging = getLoggerInstance(info); + const log = logging.log("vs-code"); const metadata = { resource: { type: "global" }, - severity: eventType, // e.g., INFO, ERROR, etc. + severity: eventType, labels: { email, type: eventType, }, }; + const logEntry = log.entry(metadata, { msg: eventMsg, type: eventType, @@ -71,7 +79,8 @@ export const putLogEvent = async ( try { await log.write(logEntry); + console.log(`✅ Logged to GCP: ${eventType} - ${msg}`); } catch (err) { - console.log(`Failed to log to GCP: ${err}`); + console.error("❌ Failed to log to GCP:", err); } }; diff --git a/src/utils/upload_utils.ts b/src/utils/upload_utils.ts index c0fb25e3..0479f7af 100644 --- a/src/utils/upload_utils.ts +++ b/src/utils/upload_utils.ts @@ -166,7 +166,6 @@ export const uploadFileTos3 = async (filePath: string, presignedUrl: any) => { }; export const uploadFileToGCS = async (filePath: string, signedUrl: any) => { - CodeSyncLogger.debug("CodeSync: uploadFileToGCS"); if (!fs.existsSync(filePath)) { return { error: `uploadFileToGCS: File=${filePath} not found` @@ -188,9 +187,6 @@ export const uploadFileToGCS = async (filePath: string, signedUrl: any) => { return resolve({ error: "Invalid signed URL" }); } - // console.log("CodeSync: signedUrl.url", signedUrl.url); - // const a = new CodeSyncLogger(); - CodeSyncLogger.debug("CodeSync: signedUrl.url", signedUrl.url); const { hostname, pathname, search, protocol } = urlParts; const options: https.RequestOptions = { From 4007f8107a577618f2714082ddc651f5e176b826 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Mon, 21 Jul 2025 22:36:04 +0500 Subject: [PATCH 11/12] Improves file sorting for better consistency in uploads --- src/connect_repo/s3_uploader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connect_repo/s3_uploader.ts b/src/connect_repo/s3_uploader.ts index afcdd4c6..43b8820d 100644 --- a/src/connect_repo/s3_uploader.ts +++ b/src/connect_repo/s3_uploader.ts @@ -281,7 +281,7 @@ class s3Uploader extends s3UploaderUtils { if (!fileRelPaths || isEmpty(content.file_path_and_urls)) return; this.filePathAndURLs = {}; // Skip files which don't exist in .originals or don't have URL - fileRelPaths.sort().forEach((fileRelPath) => { + fileRelPaths.sort((a, b) => a.localeCompare(b)).forEach((fileRelPath) => { const originalsFilePath = path.join( this.originalsRepoBranchPath, fileRelPath From 69e1b61e7bb85b3f7effbd96c7d8ebaebccccdd9 Mon Sep 17 00:00:00 2001 From: Zahid Saeed Date: Mon, 21 Jul 2025 22:58:34 +0500 Subject: [PATCH 12/12] Adds unit tests for putLogEvent function --- tests/test_utils/putLogEvent.test.js | 115 +++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 tests/test_utils/putLogEvent.test.js diff --git a/tests/test_utils/putLogEvent.test.js b/tests/test_utils/putLogEvent.test.js new file mode 100644 index 00000000..bce549c4 --- /dev/null +++ b/tests/test_utils/putLogEvent.test.js @@ -0,0 +1,115 @@ +import { Logging } from "@google-cloud/logging"; +import { + putLogEvent, + logErrorMsgTypes, +} from "../../src/utils/logging_service/gcp_logging"; +import { UserState } from "../../src/utils/user_utils"; +import * as macaddress from "macaddress"; + +// Mocks +jest.mock("@google-cloud/logging"); +jest.mock("../../src/utils/user_utils"); +jest.mock("macaddress", () => ({ + one: jest.fn(() => Promise.resolve("00:11:22:33:44:55")), +})); + +// Constants +const mockLog = { + entry: jest.fn(), + write: jest.fn(), +}; +const mockLoggingInstance = { + log: jest.fn(() => mockLog), +}; + +const userEmail = "test@codesync.com"; + +describe("putLogEvent", () => { + beforeEach(() => { + jest.clearAllMocks(); + + UserState.mockImplementation(() => ({ + getUser: () => ({ email: userEmail }), + })); + + Logging.mockImplementation(() => mockLoggingInstance); + }); + + it("should log event successfully", async () => { + const info = { + projectId: "test-project", + clientEmail: "client@test.com", + privateKey: "some\\nkey", + userEmail, + }; + + const message = "This is a test log"; + const severity = logErrorMsgTypes.INFO; + + mockLog.entry.mockReturnValue("mockEntry"); + + await putLogEvent(message, severity, "Extra details", info); + + expect(Logging).toHaveBeenCalledWith({ + projectId: "test-project", + credentials: { + client_email: "client@test.com", + private_key: "some\nkey", + }, + }); + + expect(mockLoggingInstance.log).toHaveBeenCalledWith("vs-code"); + + expect(mockLog.entry).toHaveBeenCalledWith( + expect.objectContaining({ + resource: { type: "global" }, + severity: severity, + labels: { + email: userEmail, + type: severity, + }, + }), + expect.objectContaining({ + msg: `${message}, Extra details`, + type: severity, + source: expect.any(String), + version: expect.any(String), + platform: expect.any(String), + mac_address: "00:11:22:33:44:55", + timestamp: expect.any(String), + }) + ); + + expect(mockLog.write).toHaveBeenCalledWith("mockEntry"); + }); + + it("should handle logging error", async () => { + const info = { + projectId: "test-project", + clientEmail: "client@test.com", + privateKey: "some\\nkey", + userEmail, + }; + + mockLog.entry.mockReturnValue("mockEntry"); + mockLog.write.mockRejectedValue(new Error("Failed")); + + // const consoleErrorSpy = jest + // .spyOn(console, "error") + // .mockImplementation(() => {}); + + const consoleErrorSpy = jest + // eslint-disable-next-line no-undef + .spyOn(global.console, "error") + .mockImplementation(() => {}); + + await putLogEvent("msg", logErrorMsgTypes.ERROR, "", info); + + expect(consoleErrorSpy).toHaveBeenCalledWith( + "❌ Failed to log to GCP:", + expect.any(Error) + ); + + consoleErrorSpy.mockRestore(); + }); +});