From 67b0fa0f888aea86885916c328beb652051e8e79 Mon Sep 17 00:00:00 2001 From: Ryan Chang Date: Sat, 28 Sep 2024 03:51:47 +0800 Subject: [PATCH 1/2] refactor: graphql log message formatting --- src/github/graphql.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/github/graphql.ts b/src/github/graphql.ts index fb8c182..81e75a7 100644 --- a/src/github/graphql.ts +++ b/src/github/graphql.ts @@ -15,7 +15,7 @@ import { graphqlClient } from './client' import { getBlob } from '../blob' import { RepositoryWithCommitHistory } from '../github/types' -function formatLogMessage(...params: Record[]): string { +function mergeParams(params: Record[]) { const merged: Record = {} for (const param of params) { if (typeof param === 'object') { @@ -24,7 +24,11 @@ function formatLogMessage(...params: Record[]): string { } } } - return Object.entries(merged) + return merged +} + +function formatLogMessage(...params: Record[]): string { + return Object.entries(mergeParams(params)) .map(([key, value]) => { return `${String(key)}: ${typeof value === 'string' ? value : JSON.stringify(value)}` }) From 615fa2415a54ba774ef845facb9d3b34b796ef5c Mon Sep 17 00:00:00 2001 From: Ryan Chang Date: Sat, 28 Sep 2024 03:53:52 +0800 Subject: [PATCH 2/2] chore: update bundle dist --- dist/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index a65f261..0f2cac6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -30664,7 +30664,7 @@ const core = __importStar(__nccwpck_require__(2186)); const graphql_1 = __nccwpck_require__(8467); const client_1 = __nccwpck_require__(7047); const blob_1 = __nccwpck_require__(5312); -function formatLogMessage(...params) { +function mergeParams(params) { const merged = {}; for (const param of params) { if (typeof param === 'object') { @@ -30673,7 +30673,10 @@ function formatLogMessage(...params) { } } } - return Object.entries(merged) + return merged; +} +function formatLogMessage(...params) { + return Object.entries(mergeParams(params)) .map(([key, value]) => { return `${String(key)}: ${typeof value === 'string' ? value : JSON.stringify(value)}`; })