@adventurelabs/scout-core 1.0.68 → 1.0.70
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
CHANGED
|
@@ -2,13 +2,10 @@ import { IWebResponseCompatible } from "../types/requests";
|
|
|
2
2
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
3
3
|
import { TablesInsert } from "../types/supabase";
|
|
4
4
|
export type ChatMessageInsert = TablesInsert<"chat">;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function insert_chat_message(supabaseClient: SupabaseClient, message: string, herd_id: number, sender?: string): Promise<IWebResponseCompatible<{
|
|
6
6
|
id: number;
|
|
7
7
|
}>>;
|
|
8
|
-
export declare function
|
|
9
|
-
id: number;
|
|
10
|
-
}>>;
|
|
11
|
-
export declare function server_get_chat_messages(limit?: number, offset?: number): Promise<IWebResponseCompatible<Array<{
|
|
8
|
+
export declare function get_chat_messages(supabaseClient: SupabaseClient, limit: number | undefined, offset: number | undefined, herd_id: number): Promise<IWebResponseCompatible<Array<{
|
|
12
9
|
id: number;
|
|
13
10
|
message: string;
|
|
14
11
|
sender: string | null;
|
package/dist/helpers/chat.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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) {
|
|
1
|
+
import { IWebResponse } from "../types/requests";
|
|
2
|
+
export async function insert_chat_message(supabaseClient, message, herd_id, sender) {
|
|
21
3
|
const chatMessage = {
|
|
22
4
|
message,
|
|
5
|
+
herd_id,
|
|
23
6
|
sender: sender || null,
|
|
24
7
|
};
|
|
25
8
|
const { data, error } = await supabaseClient
|
|
@@ -32,13 +15,13 @@ export async function server_insert_chat_message_with_client(message, supabaseCl
|
|
|
32
15
|
}
|
|
33
16
|
return IWebResponse.success({ id: data.id }).to_compatible();
|
|
34
17
|
}
|
|
35
|
-
export async function
|
|
36
|
-
const
|
|
37
|
-
const { data, error } = await supabase
|
|
18
|
+
export async function get_chat_messages(supabaseClient, limit = 50, offset = 0, herd_id) {
|
|
19
|
+
const { data, error } = await supabaseClient
|
|
38
20
|
.from("chat")
|
|
39
21
|
.select("id, message, sender, created_at")
|
|
40
22
|
.order("created_at", { ascending: false })
|
|
41
|
-
.range(offset, offset + limit - 1)
|
|
23
|
+
.range(offset, offset + limit - 1)
|
|
24
|
+
.eq("herd_id", herd_id);
|
|
42
25
|
if (error) {
|
|
43
26
|
return IWebResponse.error(`Failed to fetch chat messages: ${error.message}`).to_compatible();
|
|
44
27
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./types/bounding_boxes";
|
|
|
11
11
|
export * from "./types/events";
|
|
12
12
|
export * from "./helpers/auth";
|
|
13
13
|
export * from "./helpers/bounding_boxes";
|
|
14
|
+
export * from "./helpers/chat";
|
|
14
15
|
export * from "./helpers/db";
|
|
15
16
|
export * from "./helpers/devices";
|
|
16
17
|
export * from "./helpers/email";
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./types/events";
|
|
|
14
14
|
// Helpers
|
|
15
15
|
export * from "./helpers/auth";
|
|
16
16
|
export * from "./helpers/bounding_boxes";
|
|
17
|
+
export * from "./helpers/chat";
|
|
17
18
|
export * from "./helpers/db";
|
|
18
19
|
export * from "./helpers/devices";
|
|
19
20
|
export * from "./helpers/email";
|
|
@@ -76,21 +76,21 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
76
76
|
chat: {
|
|
77
77
|
Row: {
|
|
78
78
|
created_at: string;
|
|
79
|
-
herd_id: number
|
|
79
|
+
herd_id: number;
|
|
80
80
|
id: number;
|
|
81
81
|
message: string;
|
|
82
82
|
sender: string | null;
|
|
83
83
|
};
|
|
84
84
|
Insert: {
|
|
85
85
|
created_at?: string;
|
|
86
|
-
herd_id
|
|
86
|
+
herd_id: number;
|
|
87
87
|
id?: number;
|
|
88
88
|
message: string;
|
|
89
89
|
sender?: string | null;
|
|
90
90
|
};
|
|
91
91
|
Update: {
|
|
92
92
|
created_at?: string;
|
|
93
|
-
herd_id?: number
|
|
93
|
+
herd_id?: number;
|
|
94
94
|
id?: number;
|
|
95
95
|
message?: string;
|
|
96
96
|
sender?: string | null;
|
|
@@ -365,7 +365,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
365
365
|
Row: {
|
|
366
366
|
herd_id: number;
|
|
367
367
|
id: number;
|
|
368
|
-
inserted_at: string;
|
|
368
|
+
inserted_at: string | null;
|
|
369
369
|
instructions: string;
|
|
370
370
|
name: string;
|
|
371
371
|
plan_type: Database["public"]["Enums"]["plan_type"];
|
|
@@ -373,7 +373,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
373
373
|
Insert: {
|
|
374
374
|
herd_id: number;
|
|
375
375
|
id?: number;
|
|
376
|
-
inserted_at?: string;
|
|
376
|
+
inserted_at?: string | null;
|
|
377
377
|
instructions: string;
|
|
378
378
|
name: string;
|
|
379
379
|
plan_type?: Database["public"]["Enums"]["plan_type"];
|
|
@@ -381,7 +381,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
|
|
|
381
381
|
Update: {
|
|
382
382
|
herd_id?: number;
|
|
383
383
|
id?: number;
|
|
384
|
-
inserted_at?: string;
|
|
384
|
+
inserted_at?: string | null;
|
|
385
385
|
instructions?: string;
|
|
386
386
|
name?: string;
|
|
387
387
|
plan_type?: Database["public"]["Enums"]["plan_type"];
|
|
@@ -67,21 +67,21 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
67
67
|
chat: {
|
|
68
68
|
Row: {
|
|
69
69
|
created_at: string;
|
|
70
|
-
herd_id: number
|
|
70
|
+
herd_id: number;
|
|
71
71
|
id: number;
|
|
72
72
|
message: string;
|
|
73
73
|
sender: string | null;
|
|
74
74
|
};
|
|
75
75
|
Insert: {
|
|
76
76
|
created_at?: string;
|
|
77
|
-
herd_id
|
|
77
|
+
herd_id: number;
|
|
78
78
|
id?: number;
|
|
79
79
|
message: string;
|
|
80
80
|
sender?: string | null;
|
|
81
81
|
};
|
|
82
82
|
Update: {
|
|
83
83
|
created_at?: string;
|
|
84
|
-
herd_id?: number
|
|
84
|
+
herd_id?: number;
|
|
85
85
|
id?: number;
|
|
86
86
|
message?: string;
|
|
87
87
|
sender?: string | null;
|
|
@@ -356,7 +356,7 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
356
356
|
Row: {
|
|
357
357
|
herd_id: number;
|
|
358
358
|
id: number;
|
|
359
|
-
inserted_at: string;
|
|
359
|
+
inserted_at: string | null;
|
|
360
360
|
instructions: string;
|
|
361
361
|
name: string;
|
|
362
362
|
plan_type: Database["public"]["Enums"]["plan_type"];
|
|
@@ -364,7 +364,7 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
364
364
|
Insert: {
|
|
365
365
|
herd_id: number;
|
|
366
366
|
id?: number;
|
|
367
|
-
inserted_at?: string;
|
|
367
|
+
inserted_at?: string | null;
|
|
368
368
|
instructions: string;
|
|
369
369
|
name: string;
|
|
370
370
|
plan_type?: Database["public"]["Enums"]["plan_type"];
|
|
@@ -372,7 +372,7 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
|
|
|
372
372
|
Update: {
|
|
373
373
|
herd_id?: number;
|
|
374
374
|
id?: number;
|
|
375
|
-
inserted_at?: string;
|
|
375
|
+
inserted_at?: string | null;
|
|
376
376
|
instructions?: string;
|
|
377
377
|
name?: string;
|
|
378
378
|
plan_type?: Database["public"]["Enums"]["plan_type"];
|
package/dist/types/supabase.d.ts
CHANGED
|
@@ -78,21 +78,21 @@ export type Database = {
|
|
|
78
78
|
chat: {
|
|
79
79
|
Row: {
|
|
80
80
|
created_at: string;
|
|
81
|
-
herd_id: number
|
|
81
|
+
herd_id: number;
|
|
82
82
|
id: number;
|
|
83
83
|
message: string;
|
|
84
84
|
sender: string | null;
|
|
85
85
|
};
|
|
86
86
|
Insert: {
|
|
87
87
|
created_at?: string;
|
|
88
|
-
herd_id
|
|
88
|
+
herd_id: number;
|
|
89
89
|
id?: number;
|
|
90
90
|
message: string;
|
|
91
91
|
sender?: string | null;
|
|
92
92
|
};
|
|
93
93
|
Update: {
|
|
94
94
|
created_at?: string;
|
|
95
|
-
herd_id?: number
|
|
95
|
+
herd_id?: number;
|
|
96
96
|
id?: number;
|
|
97
97
|
message?: string;
|
|
98
98
|
sender?: string | null;
|
|
@@ -382,7 +382,7 @@ export type Database = {
|
|
|
382
382
|
Row: {
|
|
383
383
|
herd_id: number;
|
|
384
384
|
id: number;
|
|
385
|
-
inserted_at: string;
|
|
385
|
+
inserted_at: string | null;
|
|
386
386
|
instructions: string;
|
|
387
387
|
name: string;
|
|
388
388
|
plan_type: Database["public"]["Enums"]["plan_type"];
|
|
@@ -390,7 +390,7 @@ export type Database = {
|
|
|
390
390
|
Insert: {
|
|
391
391
|
herd_id: number;
|
|
392
392
|
id?: number;
|
|
393
|
-
inserted_at?: string;
|
|
393
|
+
inserted_at?: string | null;
|
|
394
394
|
instructions: string;
|
|
395
395
|
name: string;
|
|
396
396
|
plan_type?: Database["public"]["Enums"]["plan_type"];
|
|
@@ -398,7 +398,7 @@ export type Database = {
|
|
|
398
398
|
Update: {
|
|
399
399
|
herd_id?: number;
|
|
400
400
|
id?: number;
|
|
401
|
-
inserted_at?: string;
|
|
401
|
+
inserted_at?: string | null;
|
|
402
402
|
instructions?: string;
|
|
403
403
|
name?: string;
|
|
404
404
|
plan_type?: Database["public"]["Enums"]["plan_type"];
|