diff --git a/package.json b/package.json index 55e546c..960f7b0 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,11 @@ "ubiquity", "open-source" ], - "dependencies": { - "@supabase/supabase-js": "^2.45.2" - }, + "dependencies": {}, "devDependencies": { "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", + "@supabase/supabase-js": "^2.45.3", "@types/jest": "^29.5.12", "@types/node": "^20.10.4", "@typescript-eslint/eslint-plugin": "^7.14.1", @@ -71,4 +70,4 @@ ] }, "packageManager": "yarn@1.22.22" -} +} \ No newline at end of file diff --git a/src/logs.ts b/src/logs.ts index 9f8ccea..81b2848 100644 --- a/src/logs.ts +++ b/src/logs.ts @@ -1,11 +1,10 @@ -import { createClient, SupabaseClient } from "@supabase/supabase-js"; +import { SupabaseClient } from "@supabase/supabase-js"; import { LOG_LEVEL } from "./constants"; import { PrettyLogs } from "./pretty-logs"; import { LogParams, LogReturn, Metadata, LogLevel } from "./types/log-types"; type SupabaseConfig = { - supabaseKey: string; - supabaseUrl: string; + supabaseClient: SupabaseClient; levelsToLog: LogLevel[]; } @@ -23,9 +22,7 @@ export class Logs { if (postingConfig) { this._levelsToLog = postingConfig.levelsToLog; - if (postingConfig.supabaseKey && postingConfig.supabaseUrl) { - this._supabase = createClient(postingConfig.supabaseUrl, postingConfig.supabaseKey); - } + this._supabase = postingConfig.supabaseClient; } } @@ -45,7 +42,7 @@ export class Logs { metadata ); - if (this._levelsToLog.includes(level)) { + if (this._supabase && this._levelsToLog.includes(level)) { this._logToSupabase(log); } diff --git a/yarn.lock b/yarn.lock index 9cfabce..f4cd1a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1323,10 +1323,10 @@ ignore "^5.1.8" p-map "^4.0.0" -"@supabase/auth-js@2.64.4": - version "2.64.4" - resolved "https://registry.yarnpkg.com/@supabase/auth-js/-/auth-js-2.64.4.tgz#f27fdabf1ebd1b532ceb57e8bbe66969ee09cfba" - integrity sha512-9ITagy4WP4FLl+mke1rchapOH0RQpf++DI+WSG2sO1OFOZ0rW3cwAM0nCrMOxu+Zw4vJ4zObc08uvQrXx590Tg== +"@supabase/auth-js@2.65.0": + version "2.65.0" + resolved "https://registry.yarnpkg.com/@supabase/auth-js/-/auth-js-2.65.0.tgz#e345c492f8cbc31cd6289968eae0e349ff0f39e9" + integrity sha512-+wboHfZufAE2Y612OsKeVP4rVOeGZzzMLD/Ac3HrTQkkY4qXNjI6Af9gtmxwccE5nFvTiF114FEbIQ1hRq5uUw== dependencies: "@supabase/node-fetch" "^2.6.14" @@ -1368,12 +1368,12 @@ dependencies: "@supabase/node-fetch" "^2.6.14" -"@supabase/supabase-js@^2.45.2": - version "2.45.2" - resolved "https://registry.yarnpkg.com/@supabase/supabase-js/-/supabase-js-2.45.2.tgz#75df2b651942a1aba2ff7e6b02393d5ab3b86d9e" - integrity sha512-kJKY3ISFusVKQWCP8Kqo20Ebxy2WLp6Ry/Suco0aQsPXH7bvn7clswsdhcfcH/5Tr0MYz/jcCjF0n/27SetiCw== +"@supabase/supabase-js@^2.45.3": + version "2.45.3" + resolved "https://registry.yarnpkg.com/@supabase/supabase-js/-/supabase-js-2.45.3.tgz#d32b7a7b379958a10dcce32af1182f82b5b82218" + integrity sha512-4wAux6cuVMrdH/qUjKn6p3p3L9AtAO3Une6ojIrtpCj1RaXKVoyIATiacSRAI+pKff6XZBVCGC29v+z4Jo/uSw== dependencies: - "@supabase/auth-js" "2.64.4" + "@supabase/auth-js" "2.65.0" "@supabase/functions-js" "2.4.1" "@supabase/node-fetch" "2.6.15" "@supabase/postgrest-js" "1.15.8"