From 382b472df6aa44b66c94e07eb0cbd1c1c48940da Mon Sep 17 00:00:00 2001 From: Hiroki Miyaji Date: Sat, 9 Dec 2023 00:17:58 +0900 Subject: [PATCH 1/4] fix miro log --- packages/ui/src/miro.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/miro.ts b/packages/ui/src/miro.ts index d155ff0..17752e3 100644 --- a/packages/ui/src/miro.ts +++ b/packages/ui/src/miro.ts @@ -66,7 +66,12 @@ export async function generateDandoriMiroCards( ); const logger = getLogger(); const miroApi = new MiroApi(key, undefined, (...thing) => { - logger[getLogLevel()](thing); + // miro api sdk has no log level setting, so dandori only log debug level. + // https://github.com/miroapp/api-clients/blob/main/packages/miro-api/api/apis.ts#L4905-L4926 + const logLevel = getLogLevel(); + if (logLevel === "debug") { + logger[logLevel](thing); + } }); const miroBoard = await miroApi.getBoard(options.boardId); const taskFlat: (DandoriTask & { [taskParentPropName]?: string })[] = tasks From d90856f9e66b30f9bd61bbc4931faf573da22740 Mon Sep 17 00:00:00 2001 From: Hiroki Miyaji Date: Sat, 9 Dec 2023 00:22:41 +0900 Subject: [PATCH 2/4] apiKey allow undefined and null --- packages/libs/src/checkApiKey.ts | 2 +- packages/ui/src/miro.ts | 2 +- packages/ui/src/notion.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/libs/src/checkApiKey.ts b/packages/libs/src/checkApiKey.ts index 331e4f4..1977b9c 100644 --- a/packages/libs/src/checkApiKey.ts +++ b/packages/libs/src/checkApiKey.ts @@ -1,7 +1,7 @@ export function checkApiKey( keyName: string, targetKey?: string, - alternativeKey?: string, + alternativeKey?: string | undefined | null, ): string { if (targetKey) { return targetKey; diff --git a/packages/ui/src/miro.ts b/packages/ui/src/miro.ts index 17752e3..d13ce0f 100644 --- a/packages/ui/src/miro.ts +++ b/packages/ui/src/miro.ts @@ -12,7 +12,7 @@ import { export type GenerateDandoriMiroCardsOptions = { boardId: Parameters[0]; isAppCard?: boolean; - apiKey?: string; + apiKey?: Parameters[2]; }; // miro settings diff --git a/packages/ui/src/notion.ts b/packages/ui/src/notion.ts index aca45b4..7026f9c 100644 --- a/packages/ui/src/notion.ts +++ b/packages/ui/src/notion.ts @@ -61,7 +61,7 @@ export type DatabasePropertiesMap = export type GenerateDandoriNotionPagesOptions = { databaseId: string; databasePropertiesMap?: DatabasePropertiesMap; - apiKey?: string; + apiKey?: Parameters[2]; }; const hasStatusProperty = ( From ed5f9a8a1fe73deaf8531e7d67de46b8571ad785 Mon Sep 17 00:00:00 2001 From: Hiroki Miyaji Date: Sat, 9 Dec 2023 00:23:13 +0900 Subject: [PATCH 3/4] Create cuddly-lobsters-march.md --- .changeset/cuddly-lobsters-march.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/cuddly-lobsters-march.md diff --git a/.changeset/cuddly-lobsters-march.md b/.changeset/cuddly-lobsters-march.md new file mode 100644 index 0000000..4e9bb6d --- /dev/null +++ b/.changeset/cuddly-lobsters-march.md @@ -0,0 +1,6 @@ +--- +"@dandori/libs": patch +"@dandori/ui": patch +--- + +fix miro log From c442622333c372ff573f44bd62ced9c00158978d Mon Sep 17 00:00:00 2001 From: Hiroki Miyaji Date: Thu, 14 Dec 2023 12:48:57 +0900 Subject: [PATCH 4/4] fix type --- packages/libs/src/logger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/libs/src/logger.ts b/packages/libs/src/logger.ts index c715b09..60d5c22 100644 --- a/packages/libs/src/logger.ts +++ b/packages/libs/src/logger.ts @@ -14,7 +14,7 @@ export const setLogger = (newLogger: Logger): void => { logger = newLogger; }; -type LogLevel = "debug" | "info" | "warn" | "error"; +export type LogLevel = typeof process.env.LOG_LEVEL; export const getLogLevel = (): LogLevel => { return process.env.LOG_LEVEL ?? "info";