@perceo/supabase 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +11 -4
- package/dist/index.js +23 -20
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -471,7 +471,7 @@ declare class PerceoDataClient {
|
|
|
471
471
|
private channels;
|
|
472
472
|
constructor(config: PerceoClientConfig | PerceoClientFromSupabaseConfig);
|
|
473
473
|
/**
|
|
474
|
-
* Create a client from environment variables
|
|
474
|
+
* Create a client from environment variables. Uses embedded Perceo Cloud URL and anon key when unset.
|
|
475
475
|
*/
|
|
476
476
|
static fromEnv(projectId?: string): PerceoDataClient;
|
|
477
477
|
/**
|
|
@@ -681,6 +681,15 @@ declare class PerceoDataClient {
|
|
|
681
681
|
cleanup(): Promise<void>;
|
|
682
682
|
}
|
|
683
683
|
|
|
684
|
+
/**
|
|
685
|
+
* Embedded Perceo Cloud defaults. Packaged with every consumer so URL and anon key
|
|
686
|
+
* work without env. Override via PERCEO_SUPABASE_URL and PERCEO_SUPABASE_ANON_KEY.
|
|
687
|
+
*/
|
|
688
|
+
declare const DEFAULT_SUPABASE_URL = "https://lygslnolucoidnhaitdn.supabase.co";
|
|
689
|
+
declare const DEFAULT_SUPABASE_ANON_KEY = "sb_publishable_8Wj8bSM7drJH6mXp6NM7SQ_GcyE9pZb";
|
|
690
|
+
declare function getSupabaseUrl(): string;
|
|
691
|
+
declare function getSupabaseAnonKey(): string;
|
|
692
|
+
|
|
684
693
|
/**
|
|
685
694
|
* Session data returned from magic-link auth flow.
|
|
686
695
|
* Callers add scope (project/global) when persisting.
|
|
@@ -691,8 +700,6 @@ interface SupabaseAuthSession {
|
|
|
691
700
|
expires_at: number;
|
|
692
701
|
supabaseUrl: string;
|
|
693
702
|
}
|
|
694
|
-
declare function getSupabaseUrl(): string;
|
|
695
|
-
declare function getSupabaseAnonKey(): string;
|
|
696
703
|
declare function getSupabaseServiceRoleKey(): string | undefined;
|
|
697
704
|
/**
|
|
698
705
|
* Create a Supabase client for auth. Uses PERCEO_SUPABASE_URL and PERCEO_SUPABASE_ANON_KEY.
|
|
@@ -709,4 +716,4 @@ declare function sendMagicLink(supabase: SupabaseClient, email: string, redirect
|
|
|
709
716
|
error: Error | null;
|
|
710
717
|
}>;
|
|
711
718
|
|
|
712
|
-
export { type AnalyticsConnection, type AnalyticsEvent, type AnalyticsProvider, type ApiKeyScope, type CodeChange, type CodeChangeInsert, type Database, type EventSource, type Flow, type FlowInsert, type FlowMetrics, type FlowPriority, type FlowUpdate, type FlowWithMetrics, type FlowWithSteps, type Insight, type InsightInsert, type InsightSeverity, type InsightStatus, type InsightType, type InsightUpdate, type InsightWithFlow, type PerceoClientConfig, PerceoDataClient, type PerceoEvent, type PerceoEventInsert, type Persona, type PersonaInsert, type Prediction, type PredictionBasis, type Project, type ProjectApiKey, type ProjectApiKeyAudit, type ProjectApiKeyInsert, type ProjectApiKeyUpdate, type ProjectInsert, type ProjectMember, type ProjectRole, type RealtimeEventType, type RealtimePayload, type RiskLevel, type Step, type StepAction, type StepExpectedState, type StepInsert, type SupabaseAuthSession, type SyncStatus, type TestRun, type TestRunInsert, type TestRunUpdate, type TestRunWithFlow, type TestStatus, type TestTrigger, type Timestamp, type UUID, createSupabaseAuthClient, getSupabaseAnonKey, getSupabaseServiceRoleKey, getSupabaseUrl, sendMagicLink, sessionFromRedirectUrl };
|
|
719
|
+
export { type AnalyticsConnection, type AnalyticsEvent, type AnalyticsProvider, type ApiKeyScope, type CodeChange, type CodeChangeInsert, DEFAULT_SUPABASE_ANON_KEY, DEFAULT_SUPABASE_URL, type Database, type EventSource, type Flow, type FlowInsert, type FlowMetrics, type FlowPriority, type FlowUpdate, type FlowWithMetrics, type FlowWithSteps, type Insight, type InsightInsert, type InsightSeverity, type InsightStatus, type InsightType, type InsightUpdate, type InsightWithFlow, type PerceoClientConfig, PerceoDataClient, type PerceoEvent, type PerceoEventInsert, type Persona, type PersonaInsert, type Prediction, type PredictionBasis, type Project, type ProjectApiKey, type ProjectApiKeyAudit, type ProjectApiKeyInsert, type ProjectApiKeyUpdate, type ProjectInsert, type ProjectMember, type ProjectRole, type RealtimeEventType, type RealtimePayload, type RiskLevel, type Step, type StepAction, type StepExpectedState, type StepInsert, type SupabaseAuthSession, type SyncStatus, type TestRun, type TestRunInsert, type TestRunUpdate, type TestRunWithFlow, type TestStatus, type TestTrigger, type Timestamp, type UUID, createSupabaseAuthClient, getSupabaseAnonKey, getSupabaseServiceRoleKey, getSupabaseUrl, sendMagicLink, sessionFromRedirectUrl };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,24 @@ import { createClient as createClient2 } from "@supabase/supabase-js";
|
|
|
3
3
|
|
|
4
4
|
// src/client.ts
|
|
5
5
|
import { createClient } from "@supabase/supabase-js";
|
|
6
|
+
|
|
7
|
+
// src/defaults.ts
|
|
8
|
+
var DEFAULT_SUPABASE_URL = "https://lygslnolucoidnhaitdn.supabase.co";
|
|
9
|
+
var DEFAULT_SUPABASE_ANON_KEY = "sb_publishable_8Wj8bSM7drJH6mXp6NM7SQ_GcyE9pZb";
|
|
10
|
+
function getSupabaseUrl() {
|
|
11
|
+
return process.env.PERCEO_SUPABASE_URL || DEFAULT_SUPABASE_URL;
|
|
12
|
+
}
|
|
13
|
+
function getSupabaseAnonKey() {
|
|
14
|
+
const key = process.env.PERCEO_SUPABASE_ANON_KEY || DEFAULT_SUPABASE_ANON_KEY;
|
|
15
|
+
if (!key) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
"PERCEO_SUPABASE_ANON_KEY is not configured. This should be embedded in the package for Perceo Cloud users. For self-hosted, set PERCEO_SUPABASE_ANON_KEY environment variable."
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return key;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/client.ts
|
|
6
24
|
import { createHash, randomBytes } from "crypto";
|
|
7
25
|
var PerceoDataClient = class _PerceoDataClient {
|
|
8
26
|
supabase;
|
|
@@ -23,14 +41,11 @@ var PerceoDataClient = class _PerceoDataClient {
|
|
|
23
41
|
}
|
|
24
42
|
}
|
|
25
43
|
/**
|
|
26
|
-
* Create a client from environment variables
|
|
44
|
+
* Create a client from environment variables. Uses embedded Perceo Cloud URL and anon key when unset.
|
|
27
45
|
*/
|
|
28
46
|
static fromEnv(projectId) {
|
|
29
|
-
const supabaseUrl =
|
|
30
|
-
const supabaseKey = process.env.PERCEO_SUPABASE_SERVICE_ROLE_KEY ||
|
|
31
|
-
if (!supabaseUrl || !supabaseKey) {
|
|
32
|
-
throw new Error("PERCEO_SUPABASE_URL and PERCEO_SUPABASE_ANON_KEY (or SERVICE_ROLE_KEY) are required");
|
|
33
|
-
}
|
|
47
|
+
const supabaseUrl = getSupabaseUrl();
|
|
48
|
+
const supabaseKey = process.env.PERCEO_SUPABASE_SERVICE_ROLE_KEY || getSupabaseAnonKey();
|
|
34
49
|
return new _PerceoDataClient({
|
|
35
50
|
supabaseUrl,
|
|
36
51
|
supabaseKey,
|
|
@@ -741,20 +756,6 @@ var PerceoDataClient = class _PerceoDataClient {
|
|
|
741
756
|
};
|
|
742
757
|
|
|
743
758
|
// src/index.ts
|
|
744
|
-
var DEFAULT_SUPABASE_URL = "https://lygslnolucoidnhaitdn.supabase.co";
|
|
745
|
-
var DEFAULT_SUPABASE_ANON_KEY = process.env.PERCEO_SUPABASE_ANON_KEY || "sb_publishable_8Wj8bSM7drJH6mXp6NM7SQ_GcyE9pZb";
|
|
746
|
-
function getSupabaseUrl() {
|
|
747
|
-
return process.env.PERCEO_SUPABASE_URL || DEFAULT_SUPABASE_URL;
|
|
748
|
-
}
|
|
749
|
-
function getSupabaseAnonKey() {
|
|
750
|
-
const key = process.env.PERCEO_SUPABASE_ANON_KEY || DEFAULT_SUPABASE_ANON_KEY;
|
|
751
|
-
if (!key) {
|
|
752
|
-
throw new Error(
|
|
753
|
-
"PERCEO_SUPABASE_ANON_KEY is not configured. This should be embedded in the package for Perceo Cloud users. For self-hosted, set PERCEO_SUPABASE_ANON_KEY environment variable."
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
return key;
|
|
757
|
-
}
|
|
758
759
|
function getSupabaseServiceRoleKey() {
|
|
759
760
|
return process.env.PERCEO_SUPABASE_SERVICE_ROLE_KEY;
|
|
760
761
|
}
|
|
@@ -811,6 +812,8 @@ async function sendMagicLink(supabase, email, redirectUrl) {
|
|
|
811
812
|
return { error: error ?? null };
|
|
812
813
|
}
|
|
813
814
|
export {
|
|
815
|
+
DEFAULT_SUPABASE_ANON_KEY,
|
|
816
|
+
DEFAULT_SUPABASE_URL,
|
|
814
817
|
PerceoDataClient,
|
|
815
818
|
createSupabaseAuthClient,
|
|
816
819
|
getSupabaseAnonKey,
|