@adventurelabs/scout-core 1.0.67 → 1.0.68
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/helpers/chat.d.ts +16 -0
- package/dist/helpers/chat.js +46 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/hooks/useScoutDbListener.js +0 -57
- package/dist/providers/ScoutRefreshProvider.d.ts +71 -11
- package/dist/providers/ScoutRefreshProvider.js +7 -6
- package/dist/supabase/server.d.ts +71 -11
- package/dist/types/supabase.d.ts +76 -39
- package/dist/types/supabase.js +0 -3
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
2
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
3
|
+
import { TablesInsert } from "../types/supabase";
|
|
4
|
+
export type ChatMessageInsert = TablesInsert<"chat">;
|
|
5
|
+
export declare function server_insert_chat_message(message: string, sender?: string): Promise<IWebResponseCompatible<{
|
|
6
|
+
id: number;
|
|
7
|
+
}>>;
|
|
8
|
+
export declare function server_insert_chat_message_with_client(message: string, supabaseClient: SupabaseClient, sender?: string): Promise<IWebResponseCompatible<{
|
|
9
|
+
id: number;
|
|
10
|
+
}>>;
|
|
11
|
+
export declare function server_get_chat_messages(limit?: number, offset?: number): Promise<IWebResponseCompatible<Array<{
|
|
12
|
+
id: number;
|
|
13
|
+
message: string;
|
|
14
|
+
sender: string | null;
|
|
15
|
+
created_at: string;
|
|
16
|
+
}>>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { newServerClient } from "../supabase/server";
|
|
3
|
+
import { IWebResponse, } from "../types/requests";
|
|
4
|
+
export async function server_insert_chat_message(message, sender) {
|
|
5
|
+
const supabase = await newServerClient();
|
|
6
|
+
const chatMessage = {
|
|
7
|
+
message,
|
|
8
|
+
sender: sender || null,
|
|
9
|
+
};
|
|
10
|
+
const { data, error } = await supabase
|
|
11
|
+
.from("chat")
|
|
12
|
+
.insert(chatMessage)
|
|
13
|
+
.select("id")
|
|
14
|
+
.single();
|
|
15
|
+
if (error) {
|
|
16
|
+
return IWebResponse.error(`Failed to insert chat message: ${error.message}`).to_compatible();
|
|
17
|
+
}
|
|
18
|
+
return IWebResponse.success({ id: data.id }).to_compatible();
|
|
19
|
+
}
|
|
20
|
+
export async function server_insert_chat_message_with_client(message, supabaseClient, sender) {
|
|
21
|
+
const chatMessage = {
|
|
22
|
+
message,
|
|
23
|
+
sender: sender || null,
|
|
24
|
+
};
|
|
25
|
+
const { data, error } = await supabaseClient
|
|
26
|
+
.from("chat")
|
|
27
|
+
.insert(chatMessage)
|
|
28
|
+
.select("id")
|
|
29
|
+
.single();
|
|
30
|
+
if (error) {
|
|
31
|
+
return IWebResponse.error(`Failed to insert chat message: ${error.message}`).to_compatible();
|
|
32
|
+
}
|
|
33
|
+
return IWebResponse.success({ id: data.id }).to_compatible();
|
|
34
|
+
}
|
|
35
|
+
export async function server_get_chat_messages(limit = 50, offset = 0) {
|
|
36
|
+
const supabase = await newServerClient();
|
|
37
|
+
const { data, error } = await supabase
|
|
38
|
+
.from("chat")
|
|
39
|
+
.select("id, message, sender, created_at")
|
|
40
|
+
.order("created_at", { ascending: false })
|
|
41
|
+
.range(offset, offset + limit - 1);
|
|
42
|
+
if (error) {
|
|
43
|
+
return IWebResponse.error(`Failed to fetch chat messages: ${error.message}`).to_compatible();
|
|
44
|
+
}
|
|
45
|
+
return IWebResponse.success(data || []).to_compatible();
|
|
46
|
+
}
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers/index.js
CHANGED
|
@@ -6,12 +6,6 @@ export function useScoutDbListener(scoutSupabase) {
|
|
|
6
6
|
const supabase = useRef(null);
|
|
7
7
|
const channels = useRef([]);
|
|
8
8
|
const dispatch = useAppDispatch();
|
|
9
|
-
const reconnectTimeoutRef = useRef(null);
|
|
10
|
-
const reconnectAttemptsRef = useRef(0);
|
|
11
|
-
const maxReconnectAttempts = 10;
|
|
12
|
-
const baseDelay = 1000; // 1 second
|
|
13
|
-
const maxDelay = 5000; // 5 seconds
|
|
14
|
-
const lastChannelIdRef = useRef(null);
|
|
15
9
|
function handleTagInserts(payload) {
|
|
16
10
|
console.log("[DB Listener] Tag INSERT received:", payload.new);
|
|
17
11
|
dispatch(addTag(payload.new));
|
|
@@ -94,7 +88,6 @@ export function useScoutDbListener(scoutSupabase) {
|
|
|
94
88
|
.toString(36)
|
|
95
89
|
.substr(2, 9)}`;
|
|
96
90
|
const mainChannel = scoutSupabase.channel(channelId);
|
|
97
|
-
lastChannelIdRef.current = channelId;
|
|
98
91
|
console.log(`[DB Listener] Creating channel: ${channelId}`);
|
|
99
92
|
// Subscribe to all events
|
|
100
93
|
mainChannel
|
|
@@ -117,51 +110,10 @@ export function useScoutDbListener(scoutSupabase) {
|
|
|
117
110
|
console.log("[DB Listener] Subscription status:", status);
|
|
118
111
|
if (status === "SUBSCRIBED") {
|
|
119
112
|
console.log("[DB Listener] ✅ Successfully subscribed to real-time updates");
|
|
120
|
-
reconnectAttemptsRef.current = 0; // Reset reconnect attempts on successful connection
|
|
121
|
-
}
|
|
122
|
-
else if (status === "CHANNEL_ERROR") {
|
|
123
|
-
console.warn("[DB Listener] ❌ Channel error occurred. Reconnecting...");
|
|
124
|
-
handleReconnect();
|
|
125
|
-
}
|
|
126
|
-
else if (status === "TIMED_OUT") {
|
|
127
|
-
console.warn("[DB Listener] ⏰ Subscription timed out. Reconnecting...");
|
|
128
|
-
handleReconnect();
|
|
129
|
-
}
|
|
130
|
-
else if (status === "CLOSED") {
|
|
131
|
-
console.log(`[DB Listener] 🔒 Channel closed: ${lastChannelIdRef.current}`);
|
|
132
|
-
// Only reconnect if this isn't an immediate closure after subscription
|
|
133
|
-
if (reconnectAttemptsRef.current > 0) {
|
|
134
|
-
console.log("[DB Listener] Reconnecting...");
|
|
135
|
-
handleReconnect();
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
console.log("[DB Listener] Channel closed immediately after subscription, not reconnecting");
|
|
139
|
-
}
|
|
140
113
|
}
|
|
141
114
|
});
|
|
142
115
|
return mainChannel;
|
|
143
116
|
};
|
|
144
|
-
// Handle reconnection with exponential backoff
|
|
145
|
-
const handleReconnect = () => {
|
|
146
|
-
if (reconnectAttemptsRef.current >= maxReconnectAttempts) {
|
|
147
|
-
console.error("[DB Listener] 🚫 Max reconnection attempts reached");
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
// Clear any existing timeout
|
|
151
|
-
if (reconnectTimeoutRef.current) {
|
|
152
|
-
clearTimeout(reconnectTimeoutRef.current);
|
|
153
|
-
}
|
|
154
|
-
const delay = Math.min(baseDelay * (reconnectAttemptsRef.current + 1), maxDelay);
|
|
155
|
-
console.log(`[DB Listener] 🔄 Attempting reconnection in ${delay}ms (attempt ${reconnectAttemptsRef.current + 1}/${maxReconnectAttempts})`);
|
|
156
|
-
reconnectTimeoutRef.current = setTimeout(() => {
|
|
157
|
-
reconnectAttemptsRef.current++;
|
|
158
|
-
cleanupChannels();
|
|
159
|
-
const newChannel = setupChannel();
|
|
160
|
-
if (newChannel) {
|
|
161
|
-
channels.current.push(newChannel);
|
|
162
|
-
}
|
|
163
|
-
}, delay);
|
|
164
|
-
};
|
|
165
117
|
useEffect(() => {
|
|
166
118
|
if (!scoutSupabase) {
|
|
167
119
|
console.error("[DB Listener] No Supabase client available");
|
|
@@ -176,15 +128,6 @@ export function useScoutDbListener(scoutSupabase) {
|
|
|
176
128
|
// Cleanup function
|
|
177
129
|
return () => {
|
|
178
130
|
console.log("[DB Listener] 🧹 Cleaning up channels");
|
|
179
|
-
// Clear any pending reconnection attempts
|
|
180
|
-
if (reconnectTimeoutRef.current) {
|
|
181
|
-
clearTimeout(reconnectTimeoutRef.current);
|
|
182
|
-
reconnectTimeoutRef.current = null;
|
|
183
|
-
}
|
|
184
|
-
// Reset reconnect attempts and channel tracking
|
|
185
|
-
reconnectAttemptsRef.current = 0;
|
|
186
|
-
lastChannelIdRef.current = null;
|
|
187
|
-
// Clean up channels
|
|
188
131
|
cleanupChannels();
|
|
189
132
|
};
|
|
190
133
|
}, [scoutSupabase, dispatch]);
|
|
@@ -46,6 +46,69 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
46
46
|
referencedColumns: ["id"];
|
|
47
47
|
}];
|
|
48
48
|
};
|
|
49
|
+
artifacts: {
|
|
50
|
+
Row: {
|
|
51
|
+
created_at: string;
|
|
52
|
+
file_path: string;
|
|
53
|
+
id: number;
|
|
54
|
+
session_id: number | null;
|
|
55
|
+
};
|
|
56
|
+
Insert: {
|
|
57
|
+
created_at?: string;
|
|
58
|
+
file_path: string;
|
|
59
|
+
id?: number;
|
|
60
|
+
session_id?: number | null;
|
|
61
|
+
};
|
|
62
|
+
Update: {
|
|
63
|
+
created_at?: string;
|
|
64
|
+
file_path?: string;
|
|
65
|
+
id?: number;
|
|
66
|
+
session_id?: number | null;
|
|
67
|
+
};
|
|
68
|
+
Relationships: [{
|
|
69
|
+
foreignKeyName: "artifacts_session_id_fkey";
|
|
70
|
+
columns: ["session_id"];
|
|
71
|
+
isOneToOne: false;
|
|
72
|
+
referencedRelation: "sessions";
|
|
73
|
+
referencedColumns: ["id"];
|
|
74
|
+
}];
|
|
75
|
+
};
|
|
76
|
+
chat: {
|
|
77
|
+
Row: {
|
|
78
|
+
created_at: string;
|
|
79
|
+
herd_id: number | null;
|
|
80
|
+
id: number;
|
|
81
|
+
message: string;
|
|
82
|
+
sender: string | null;
|
|
83
|
+
};
|
|
84
|
+
Insert: {
|
|
85
|
+
created_at?: string;
|
|
86
|
+
herd_id?: number | null;
|
|
87
|
+
id?: number;
|
|
88
|
+
message: string;
|
|
89
|
+
sender?: string | null;
|
|
90
|
+
};
|
|
91
|
+
Update: {
|
|
92
|
+
created_at?: string;
|
|
93
|
+
herd_id?: number | null;
|
|
94
|
+
id?: number;
|
|
95
|
+
message?: string;
|
|
96
|
+
sender?: string | null;
|
|
97
|
+
};
|
|
98
|
+
Relationships: [{
|
|
99
|
+
foreignKeyName: "chat_herd_id_fkey";
|
|
100
|
+
columns: ["herd_id"];
|
|
101
|
+
isOneToOne: false;
|
|
102
|
+
referencedRelation: "herds";
|
|
103
|
+
referencedColumns: ["id"];
|
|
104
|
+
}, {
|
|
105
|
+
foreignKeyName: "chat_sender_fkey";
|
|
106
|
+
columns: ["sender"];
|
|
107
|
+
isOneToOne: false;
|
|
108
|
+
referencedRelation: "users";
|
|
109
|
+
referencedColumns: ["id"];
|
|
110
|
+
}];
|
|
111
|
+
};
|
|
49
112
|
connectivity: {
|
|
50
113
|
Row: {
|
|
51
114
|
altitude: number;
|
|
@@ -340,7 +403,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
340
403
|
distance_max_from_start: number;
|
|
341
404
|
distance_total: number;
|
|
342
405
|
earthranger_url: string | null;
|
|
343
|
-
file_paths: string[] | null;
|
|
344
406
|
id: number;
|
|
345
407
|
inserted_at: string;
|
|
346
408
|
locations: unknown;
|
|
@@ -359,7 +421,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
359
421
|
distance_max_from_start: number;
|
|
360
422
|
distance_total: number;
|
|
361
423
|
earthranger_url?: string | null;
|
|
362
|
-
file_paths?: string[] | null;
|
|
363
424
|
id?: number;
|
|
364
425
|
inserted_at?: string;
|
|
365
426
|
locations: unknown;
|
|
@@ -378,7 +439,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
378
439
|
distance_max_from_start?: number;
|
|
379
440
|
distance_total?: number;
|
|
380
441
|
earthranger_url?: string | null;
|
|
381
|
-
file_paths?: string[] | null;
|
|
382
442
|
id?: number;
|
|
383
443
|
inserted_at?: string;
|
|
384
444
|
locations?: unknown;
|
|
@@ -684,17 +744,17 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
684
744
|
};
|
|
685
745
|
get_events_and_tags_for_session: {
|
|
686
746
|
Args: {
|
|
687
|
-
session_id_caller: number;
|
|
688
747
|
limit_caller: number;
|
|
689
748
|
offset_caller: number;
|
|
749
|
+
session_id_caller: number;
|
|
690
750
|
};
|
|
691
751
|
Returns: Database["public"]["CompositeTypes"]["event_and_tags_pretty_location"][];
|
|
692
752
|
};
|
|
693
753
|
get_events_with_tags_for_herd: {
|
|
694
754
|
Args: {
|
|
695
755
|
herd_id_caller: number;
|
|
696
|
-
offset_caller: number;
|
|
697
756
|
limit_caller: number;
|
|
757
|
+
offset_caller: number;
|
|
698
758
|
};
|
|
699
759
|
Returns: Database["public"]["CompositeTypes"]["event_with_tags"][];
|
|
700
760
|
};
|
|
@@ -710,16 +770,16 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
710
770
|
};
|
|
711
771
|
Returns: Database["public"]["CompositeTypes"]["session_with_coordinates"][];
|
|
712
772
|
};
|
|
713
|
-
|
|
773
|
+
get_total_events_for_herd_with_session_filter: {
|
|
714
774
|
Args: {
|
|
715
|
-
|
|
775
|
+
exclude_session_events: boolean;
|
|
776
|
+
herd_id_caller: number;
|
|
716
777
|
};
|
|
717
778
|
Returns: number;
|
|
718
779
|
};
|
|
719
|
-
|
|
780
|
+
get_total_events_for_session: {
|
|
720
781
|
Args: {
|
|
721
|
-
|
|
722
|
-
exclude_session_events: boolean;
|
|
782
|
+
session_id_caller: number;
|
|
723
783
|
};
|
|
724
784
|
Returns: number;
|
|
725
785
|
};
|
|
@@ -742,9 +802,9 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
742
802
|
device_ids: number[];
|
|
743
803
|
};
|
|
744
804
|
Returns: {
|
|
745
|
-
device_id: number;
|
|
746
805
|
api_key_id: string;
|
|
747
806
|
api_key_key: string;
|
|
807
|
+
device_id: number;
|
|
748
808
|
}[];
|
|
749
809
|
};
|
|
750
810
|
load_api_keys_old: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useScoutRefresh } from "../hooks/useScoutRefresh";
|
|
4
4
|
import { useScoutDbListener } from "../hooks/useScoutDbListener";
|
|
5
|
-
import { createContext, useContext, useMemo } from "react";
|
|
5
|
+
import { createContext, useContext, useMemo, useRef } from "react";
|
|
6
6
|
import { createBrowserClient } from "@supabase/ssr";
|
|
7
7
|
// Create context for the Supabase client
|
|
8
8
|
const SupabaseContext = createContext(null);
|
|
@@ -24,13 +24,14 @@ export function useConnectionStatus() {
|
|
|
24
24
|
return connectionStatus;
|
|
25
25
|
}
|
|
26
26
|
export function ScoutRefreshProvider({ children }) {
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
27
|
+
// Use refs to store the URL and key to prevent unnecessary recreations
|
|
28
|
+
const urlRef = useRef(process.env.NEXT_PUBLIC_SUPABASE_URL || "");
|
|
29
|
+
const anonKeyRef = useRef(process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || "");
|
|
30
|
+
// Create a single Supabase client instance that only runs once
|
|
30
31
|
const supabaseClient = useMemo(() => {
|
|
31
32
|
console.log("[ScoutRefreshProvider] Creating Supabase client");
|
|
32
|
-
return createBrowserClient(
|
|
33
|
-
}, [
|
|
33
|
+
return createBrowserClient(urlRef.current, anonKeyRef.current);
|
|
34
|
+
}, []); // Empty dependency array ensures this only runs once
|
|
34
35
|
// Use the enhanced DB listener with connection status
|
|
35
36
|
useScoutDbListener(supabaseClient);
|
|
36
37
|
useScoutRefresh();
|
|
@@ -37,6 +37,69 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
37
37
|
referencedColumns: ["id"];
|
|
38
38
|
}];
|
|
39
39
|
};
|
|
40
|
+
artifacts: {
|
|
41
|
+
Row: {
|
|
42
|
+
created_at: string;
|
|
43
|
+
file_path: string;
|
|
44
|
+
id: number;
|
|
45
|
+
session_id: number | null;
|
|
46
|
+
};
|
|
47
|
+
Insert: {
|
|
48
|
+
created_at?: string;
|
|
49
|
+
file_path: string;
|
|
50
|
+
id?: number;
|
|
51
|
+
session_id?: number | null;
|
|
52
|
+
};
|
|
53
|
+
Update: {
|
|
54
|
+
created_at?: string;
|
|
55
|
+
file_path?: string;
|
|
56
|
+
id?: number;
|
|
57
|
+
session_id?: number | null;
|
|
58
|
+
};
|
|
59
|
+
Relationships: [{
|
|
60
|
+
foreignKeyName: "artifacts_session_id_fkey";
|
|
61
|
+
columns: ["session_id"];
|
|
62
|
+
isOneToOne: false;
|
|
63
|
+
referencedRelation: "sessions";
|
|
64
|
+
referencedColumns: ["id"];
|
|
65
|
+
}];
|
|
66
|
+
};
|
|
67
|
+
chat: {
|
|
68
|
+
Row: {
|
|
69
|
+
created_at: string;
|
|
70
|
+
herd_id: number | null;
|
|
71
|
+
id: number;
|
|
72
|
+
message: string;
|
|
73
|
+
sender: string | null;
|
|
74
|
+
};
|
|
75
|
+
Insert: {
|
|
76
|
+
created_at?: string;
|
|
77
|
+
herd_id?: number | null;
|
|
78
|
+
id?: number;
|
|
79
|
+
message: string;
|
|
80
|
+
sender?: string | null;
|
|
81
|
+
};
|
|
82
|
+
Update: {
|
|
83
|
+
created_at?: string;
|
|
84
|
+
herd_id?: number | null;
|
|
85
|
+
id?: number;
|
|
86
|
+
message?: string;
|
|
87
|
+
sender?: string | null;
|
|
88
|
+
};
|
|
89
|
+
Relationships: [{
|
|
90
|
+
foreignKeyName: "chat_herd_id_fkey";
|
|
91
|
+
columns: ["herd_id"];
|
|
92
|
+
isOneToOne: false;
|
|
93
|
+
referencedRelation: "herds";
|
|
94
|
+
referencedColumns: ["id"];
|
|
95
|
+
}, {
|
|
96
|
+
foreignKeyName: "chat_sender_fkey";
|
|
97
|
+
columns: ["sender"];
|
|
98
|
+
isOneToOne: false;
|
|
99
|
+
referencedRelation: "users";
|
|
100
|
+
referencedColumns: ["id"];
|
|
101
|
+
}];
|
|
102
|
+
};
|
|
40
103
|
connectivity: {
|
|
41
104
|
Row: {
|
|
42
105
|
altitude: number;
|
|
@@ -331,7 +394,6 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
331
394
|
distance_max_from_start: number;
|
|
332
395
|
distance_total: number;
|
|
333
396
|
earthranger_url: string | null;
|
|
334
|
-
file_paths: string[] | null;
|
|
335
397
|
id: number;
|
|
336
398
|
inserted_at: string;
|
|
337
399
|
locations: unknown;
|
|
@@ -350,7 +412,6 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
350
412
|
distance_max_from_start: number;
|
|
351
413
|
distance_total: number;
|
|
352
414
|
earthranger_url?: string | null;
|
|
353
|
-
file_paths?: string[] | null;
|
|
354
415
|
id?: number;
|
|
355
416
|
inserted_at?: string;
|
|
356
417
|
locations: unknown;
|
|
@@ -369,7 +430,6 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
369
430
|
distance_max_from_start?: number;
|
|
370
431
|
distance_total?: number;
|
|
371
432
|
earthranger_url?: string | null;
|
|
372
|
-
file_paths?: string[] | null;
|
|
373
433
|
id?: number;
|
|
374
434
|
inserted_at?: string;
|
|
375
435
|
locations?: unknown;
|
|
@@ -675,17 +735,17 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
675
735
|
};
|
|
676
736
|
get_events_and_tags_for_session: {
|
|
677
737
|
Args: {
|
|
678
|
-
session_id_caller: number;
|
|
679
738
|
limit_caller: number;
|
|
680
739
|
offset_caller: number;
|
|
740
|
+
session_id_caller: number;
|
|
681
741
|
};
|
|
682
742
|
Returns: Database["public"]["CompositeTypes"]["event_and_tags_pretty_location"][];
|
|
683
743
|
};
|
|
684
744
|
get_events_with_tags_for_herd: {
|
|
685
745
|
Args: {
|
|
686
746
|
herd_id_caller: number;
|
|
687
|
-
offset_caller: number;
|
|
688
747
|
limit_caller: number;
|
|
748
|
+
offset_caller: number;
|
|
689
749
|
};
|
|
690
750
|
Returns: Database["public"]["CompositeTypes"]["event_with_tags"][];
|
|
691
751
|
};
|
|
@@ -701,16 +761,16 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
701
761
|
};
|
|
702
762
|
Returns: Database["public"]["CompositeTypes"]["session_with_coordinates"][];
|
|
703
763
|
};
|
|
704
|
-
|
|
764
|
+
get_total_events_for_herd_with_session_filter: {
|
|
705
765
|
Args: {
|
|
706
|
-
|
|
766
|
+
exclude_session_events: boolean;
|
|
767
|
+
herd_id_caller: number;
|
|
707
768
|
};
|
|
708
769
|
Returns: number;
|
|
709
770
|
};
|
|
710
|
-
|
|
771
|
+
get_total_events_for_session: {
|
|
711
772
|
Args: {
|
|
712
|
-
|
|
713
|
-
exclude_session_events: boolean;
|
|
773
|
+
session_id_caller: number;
|
|
714
774
|
};
|
|
715
775
|
Returns: number;
|
|
716
776
|
};
|
|
@@ -733,9 +793,9 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
733
793
|
device_ids: number[];
|
|
734
794
|
};
|
|
735
795
|
Returns: {
|
|
736
|
-
device_id: number;
|
|
737
796
|
api_key_id: string;
|
|
738
797
|
api_key_key: string;
|
|
798
|
+
device_id: number;
|
|
739
799
|
}[];
|
|
740
800
|
};
|
|
741
801
|
load_api_keys_old: {
|
package/dist/types/supabase.d.ts
CHANGED
|
@@ -5,31 +5,6 @@ export type Database = {
|
|
|
5
5
|
__InternalSupabase: {
|
|
6
6
|
PostgrestVersion: "12.2.12 (cd3cf9e)";
|
|
7
7
|
};
|
|
8
|
-
graphql_public: {
|
|
9
|
-
Tables: {
|
|
10
|
-
[_ in never]: never;
|
|
11
|
-
};
|
|
12
|
-
Views: {
|
|
13
|
-
[_ in never]: never;
|
|
14
|
-
};
|
|
15
|
-
Functions: {
|
|
16
|
-
graphql: {
|
|
17
|
-
Args: {
|
|
18
|
-
operationName?: string;
|
|
19
|
-
query?: string;
|
|
20
|
-
variables?: Json;
|
|
21
|
-
extensions?: Json;
|
|
22
|
-
};
|
|
23
|
-
Returns: Json;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
Enums: {
|
|
27
|
-
[_ in never]: never;
|
|
28
|
-
};
|
|
29
|
-
CompositeTypes: {
|
|
30
|
-
[_ in never]: never;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
8
|
public: {
|
|
34
9
|
Tables: {
|
|
35
10
|
actions: {
|
|
@@ -71,6 +46,74 @@ export type Database = {
|
|
|
71
46
|
}
|
|
72
47
|
];
|
|
73
48
|
};
|
|
49
|
+
artifacts: {
|
|
50
|
+
Row: {
|
|
51
|
+
created_at: string;
|
|
52
|
+
file_path: string;
|
|
53
|
+
id: number;
|
|
54
|
+
session_id: number | null;
|
|
55
|
+
};
|
|
56
|
+
Insert: {
|
|
57
|
+
created_at?: string;
|
|
58
|
+
file_path: string;
|
|
59
|
+
id?: number;
|
|
60
|
+
session_id?: number | null;
|
|
61
|
+
};
|
|
62
|
+
Update: {
|
|
63
|
+
created_at?: string;
|
|
64
|
+
file_path?: string;
|
|
65
|
+
id?: number;
|
|
66
|
+
session_id?: number | null;
|
|
67
|
+
};
|
|
68
|
+
Relationships: [
|
|
69
|
+
{
|
|
70
|
+
foreignKeyName: "artifacts_session_id_fkey";
|
|
71
|
+
columns: ["session_id"];
|
|
72
|
+
isOneToOne: false;
|
|
73
|
+
referencedRelation: "sessions";
|
|
74
|
+
referencedColumns: ["id"];
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
};
|
|
78
|
+
chat: {
|
|
79
|
+
Row: {
|
|
80
|
+
created_at: string;
|
|
81
|
+
herd_id: number | null;
|
|
82
|
+
id: number;
|
|
83
|
+
message: string;
|
|
84
|
+
sender: string | null;
|
|
85
|
+
};
|
|
86
|
+
Insert: {
|
|
87
|
+
created_at?: string;
|
|
88
|
+
herd_id?: number | null;
|
|
89
|
+
id?: number;
|
|
90
|
+
message: string;
|
|
91
|
+
sender?: string | null;
|
|
92
|
+
};
|
|
93
|
+
Update: {
|
|
94
|
+
created_at?: string;
|
|
95
|
+
herd_id?: number | null;
|
|
96
|
+
id?: number;
|
|
97
|
+
message?: string;
|
|
98
|
+
sender?: string | null;
|
|
99
|
+
};
|
|
100
|
+
Relationships: [
|
|
101
|
+
{
|
|
102
|
+
foreignKeyName: "chat_herd_id_fkey";
|
|
103
|
+
columns: ["herd_id"];
|
|
104
|
+
isOneToOne: false;
|
|
105
|
+
referencedRelation: "herds";
|
|
106
|
+
referencedColumns: ["id"];
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
foreignKeyName: "chat_sender_fkey";
|
|
110
|
+
columns: ["sender"];
|
|
111
|
+
isOneToOne: false;
|
|
112
|
+
referencedRelation: "users";
|
|
113
|
+
referencedColumns: ["id"];
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
};
|
|
74
117
|
connectivity: {
|
|
75
118
|
Row: {
|
|
76
119
|
altitude: number;
|
|
@@ -379,7 +422,6 @@ export type Database = {
|
|
|
379
422
|
distance_max_from_start: number;
|
|
380
423
|
distance_total: number;
|
|
381
424
|
earthranger_url: string | null;
|
|
382
|
-
file_paths: string[] | null;
|
|
383
425
|
id: number;
|
|
384
426
|
inserted_at: string;
|
|
385
427
|
locations: unknown;
|
|
@@ -398,7 +440,6 @@ export type Database = {
|
|
|
398
440
|
distance_max_from_start: number;
|
|
399
441
|
distance_total: number;
|
|
400
442
|
earthranger_url?: string | null;
|
|
401
|
-
file_paths?: string[] | null;
|
|
402
443
|
id?: number;
|
|
403
444
|
inserted_at?: string;
|
|
404
445
|
locations: unknown;
|
|
@@ -417,7 +458,6 @@ export type Database = {
|
|
|
417
458
|
distance_max_from_start?: number;
|
|
418
459
|
distance_total?: number;
|
|
419
460
|
earthranger_url?: string | null;
|
|
420
|
-
file_paths?: string[] | null;
|
|
421
461
|
id?: number;
|
|
422
462
|
inserted_at?: string;
|
|
423
463
|
locations?: unknown;
|
|
@@ -744,17 +784,17 @@ export type Database = {
|
|
|
744
784
|
};
|
|
745
785
|
get_events_and_tags_for_session: {
|
|
746
786
|
Args: {
|
|
747
|
-
session_id_caller: number;
|
|
748
787
|
limit_caller: number;
|
|
749
788
|
offset_caller: number;
|
|
789
|
+
session_id_caller: number;
|
|
750
790
|
};
|
|
751
791
|
Returns: Database["public"]["CompositeTypes"]["event_and_tags_pretty_location"][];
|
|
752
792
|
};
|
|
753
793
|
get_events_with_tags_for_herd: {
|
|
754
794
|
Args: {
|
|
755
795
|
herd_id_caller: number;
|
|
756
|
-
offset_caller: number;
|
|
757
796
|
limit_caller: number;
|
|
797
|
+
offset_caller: number;
|
|
758
798
|
};
|
|
759
799
|
Returns: Database["public"]["CompositeTypes"]["event_with_tags"][];
|
|
760
800
|
};
|
|
@@ -770,16 +810,16 @@ export type Database = {
|
|
|
770
810
|
};
|
|
771
811
|
Returns: Database["public"]["CompositeTypes"]["session_with_coordinates"][];
|
|
772
812
|
};
|
|
773
|
-
|
|
813
|
+
get_total_events_for_herd_with_session_filter: {
|
|
774
814
|
Args: {
|
|
775
|
-
|
|
815
|
+
exclude_session_events: boolean;
|
|
816
|
+
herd_id_caller: number;
|
|
776
817
|
};
|
|
777
818
|
Returns: number;
|
|
778
819
|
};
|
|
779
|
-
|
|
820
|
+
get_total_events_for_session: {
|
|
780
821
|
Args: {
|
|
781
|
-
|
|
782
|
-
exclude_session_events: boolean;
|
|
822
|
+
session_id_caller: number;
|
|
783
823
|
};
|
|
784
824
|
Returns: number;
|
|
785
825
|
};
|
|
@@ -802,9 +842,9 @@ export type Database = {
|
|
|
802
842
|
device_ids: number[];
|
|
803
843
|
};
|
|
804
844
|
Returns: {
|
|
805
|
-
device_id: number;
|
|
806
845
|
api_key_id: string;
|
|
807
846
|
api_key_key: string;
|
|
847
|
+
device_id: number;
|
|
808
848
|
}[];
|
|
809
849
|
};
|
|
810
850
|
load_api_keys_old: {
|
|
@@ -1001,9 +1041,6 @@ export type CompositeTypes<PublicCompositeTypeNameOrOptions extends keyof Defaul
|
|
|
1001
1041
|
schema: keyof DatabaseWithoutInternals;
|
|
1002
1042
|
} ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] : never;
|
|
1003
1043
|
export declare const Constants: {
|
|
1004
|
-
readonly graphql_public: {
|
|
1005
|
-
readonly Enums: {};
|
|
1006
|
-
};
|
|
1007
1044
|
readonly public: {
|
|
1008
1045
|
readonly Enums: {
|
|
1009
1046
|
readonly app_permission: readonly ["herds.delete", "events.delete"];
|
package/dist/types/supabase.js
CHANGED