Skip to content

Commit

Permalink
chore: init with client not key and url, move to devDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Sep 7, 2024
1 parent 3fddab4 commit fd34f13
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -71,4 +70,4 @@
]
},
"packageManager": "[email protected]"
}
}
11 changes: 4 additions & 7 deletions src/logs.ts
Original file line number Diff line number Diff line change
@@ -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[];
}

Expand All @@ -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;
}
}

Expand All @@ -45,7 +42,7 @@ export class Logs {
metadata
);

if (this._levelsToLog.includes(level)) {
if (this._supabase && this._levelsToLog.includes(level)) {
this._logToSupabase(log);
}

Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fd34f13

Please sign in to comment.