@adventurelabs/scout-core 1.4.69 → 1.4.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/herd_allowed_domains.d.ts +5 -0
- package/dist/helpers/herd_allowed_domains.js +15 -0
- package/dist/helpers/herds.d.ts +4 -1
- package/dist/helpers/herds.js +1 -5
- package/dist/helpers/invitations.d.ts +8 -0
- package/dist/helpers/invitations.js +47 -0
- package/dist/helpers/users.d.ts +4 -1
- package/dist/helpers/users.js +15 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/providers/ScoutRefreshProvider.d.ts +144 -11
- package/dist/types/db.d.ts +3 -0
- package/dist/types/supabase.d.ts +150 -13
- package/dist/types/supabase.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Database } from "../types/supabase";
|
|
2
|
+
import { IHerdAllowedDomain } from "../types/db";
|
|
3
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
4
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
5
|
+
export declare function server_get_herd_allowed_domains(herd_id: number, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdAllowedDomain[]>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { newServerClient } from "../supabase/server";
|
|
3
|
+
import { IWebResponse } from "../types/requests";
|
|
4
|
+
export async function server_get_herd_allowed_domains(herd_id, supabaseClient) {
|
|
5
|
+
const supabase = supabaseClient ?? (await newServerClient());
|
|
6
|
+
const { data, error } = await supabase
|
|
7
|
+
.from("herd_allowed_domains")
|
|
8
|
+
.select("*")
|
|
9
|
+
.eq("herd_id", herd_id)
|
|
10
|
+
.order("domain", { ascending: true });
|
|
11
|
+
if (error) {
|
|
12
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
13
|
+
}
|
|
14
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
15
|
+
}
|
package/dist/helpers/herds.d.ts
CHANGED
|
@@ -7,5 +7,8 @@ export declare function get_herds(client: SupabaseClient<Database>): Promise<IWe
|
|
|
7
7
|
export declare function get_herds_with_location(client: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdPrettyLocation[]>>;
|
|
8
8
|
export declare function get_herd_by_slug(slug: string): Promise<IWebResponseCompatible<IHerd>>;
|
|
9
9
|
export declare function deleteHerd(herd_id: number): Promise<IWebResponseCompatible<boolean>>;
|
|
10
|
-
export declare function createHerd(newHerd:
|
|
10
|
+
export declare function createHerd(newHerd: Omit<IHerd, "id" | "inserted_at"> & {
|
|
11
|
+
id?: number;
|
|
12
|
+
inserted_at?: string;
|
|
13
|
+
}): Promise<IWebResponseCompatible<boolean>>;
|
|
11
14
|
export declare function server_load_herd_modules(): Promise<IHerdModulesResponseWithStatus>;
|
package/dist/helpers/herds.js
CHANGED
|
@@ -66,11 +66,7 @@ export async function deleteHerd(herd_id) {
|
|
|
66
66
|
}
|
|
67
67
|
export async function createHerd(newHerd) {
|
|
68
68
|
const supabase = await newServerClient();
|
|
69
|
-
const
|
|
70
|
-
const userId = user?.data?.user?.id;
|
|
71
|
-
newHerd.created_by = userId;
|
|
72
|
-
// strip id field from herd object
|
|
73
|
-
const { data, error } = await supabase.from("herds").insert([newHerd]);
|
|
69
|
+
const { error } = await supabase.from("herds").insert([newHerd]);
|
|
74
70
|
if (error) {
|
|
75
71
|
return {
|
|
76
72
|
status: EnumWebResponse.ERROR,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Database } from "../types/supabase";
|
|
2
|
+
import { IHerdInvitation, Role } from "../types/db";
|
|
3
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
4
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
5
|
+
export declare function server_create_herd_invitation(herd_id: number, email: string, role: Role, expires_at?: string | null): Promise<IWebResponseCompatible<IHerdInvitation | null>>;
|
|
6
|
+
export declare function accept_herd_invitations_for_current_user(invitation_ids: number[], supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdInvitation[]>>;
|
|
7
|
+
export declare function server_get_herd_invitations_for_current_user(): Promise<IWebResponseCompatible<IHerdInvitation[]>>;
|
|
8
|
+
export declare function server_get_herd_invitations_by_herd(herd_id: number, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdInvitation[]>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { newServerClient } from "../supabase/server";
|
|
3
|
+
import { IWebResponse } from "../types/requests";
|
|
4
|
+
export async function server_create_herd_invitation(herd_id, email, role, expires_at) {
|
|
5
|
+
const supabase = await newServerClient();
|
|
6
|
+
const { data, error } = await supabase.rpc("create_herd_invitation", {
|
|
7
|
+
p_herd_id: herd_id,
|
|
8
|
+
p_email: email,
|
|
9
|
+
p_role: role,
|
|
10
|
+
p_expires_at: expires_at ?? undefined,
|
|
11
|
+
});
|
|
12
|
+
if (error) {
|
|
13
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
14
|
+
}
|
|
15
|
+
return IWebResponse.success(data).to_compatible();
|
|
16
|
+
}
|
|
17
|
+
export async function accept_herd_invitations_for_current_user(invitation_ids, supabaseClient) {
|
|
18
|
+
if (invitation_ids.length === 0) {
|
|
19
|
+
return IWebResponse.error("At least one invitation id is required").to_compatible();
|
|
20
|
+
}
|
|
21
|
+
const supabase = supabaseClient ?? (await newServerClient());
|
|
22
|
+
const { data, error } = await supabase.rpc("accept_herd_invitations_for_current_user", { p_invitation_ids: invitation_ids });
|
|
23
|
+
if (error) {
|
|
24
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
25
|
+
}
|
|
26
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
27
|
+
}
|
|
28
|
+
export async function server_get_herd_invitations_for_current_user() {
|
|
29
|
+
const supabase = await newServerClient();
|
|
30
|
+
const { data, error } = await supabase.rpc("get_herd_invitations_for_current_user");
|
|
31
|
+
if (error) {
|
|
32
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
33
|
+
}
|
|
34
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
35
|
+
}
|
|
36
|
+
export async function server_get_herd_invitations_by_herd(herd_id, supabaseClient) {
|
|
37
|
+
const supabase = supabaseClient ?? (await newServerClient());
|
|
38
|
+
const { data, error } = await supabase
|
|
39
|
+
.from("herd_invitations")
|
|
40
|
+
.select("*")
|
|
41
|
+
.eq("herd_id", herd_id)
|
|
42
|
+
.order("created_at", { ascending: false });
|
|
43
|
+
if (error) {
|
|
44
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
45
|
+
}
|
|
46
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
47
|
+
}
|
package/dist/helpers/users.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { IUser, IUserAndRole, IUserRolePerHerd, Role } from "../types/db";
|
|
1
|
+
import { IUser, IUserAndRole, IUserProfileRow, IUserRolePerHerd, Role } from "../types/db";
|
|
2
2
|
import { IWebResponseCompatible } from "../types/requests";
|
|
3
3
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
4
|
+
import { Database } from "../types/supabase";
|
|
4
5
|
export declare function server_get_user_roles(herd_id: number): Promise<IWebResponseCompatible<IUserRolePerHerd[]>>;
|
|
5
6
|
export declare function server_get_user(): Promise<IWebResponseCompatible<IUser | null>>;
|
|
6
7
|
export declare function server_get_users_with_herd_access(herd_id: number, supabaseClient?: SupabaseClient): Promise<IWebResponseCompatible<IUserAndRole[]>>;
|
|
7
8
|
export declare function server_upsert_user_with_role(herd_id: number, username: string, role: Role): Promise<IWebResponseCompatible<IUserAndRole | null>>;
|
|
9
|
+
export type UserProfileUpdate = Database["public"]["Tables"]["users"]["Update"];
|
|
10
|
+
export declare function update_user_profile(client: SupabaseClient<Database>, user_id: string, patch: UserProfileUpdate): Promise<IWebResponseCompatible<IUserProfileRow | null>>;
|
package/dist/helpers/users.js
CHANGED
|
@@ -74,3 +74,18 @@ export async function server_upsert_user_with_role(herd_id, username, role) {
|
|
|
74
74
|
}
|
|
75
75
|
return IWebResponse.success({ user, role }).to_compatible();
|
|
76
76
|
}
|
|
77
|
+
export async function update_user_profile(client, user_id, patch) {
|
|
78
|
+
const { data, error } = await client
|
|
79
|
+
.from("users")
|
|
80
|
+
.update(patch)
|
|
81
|
+
.eq("id", user_id)
|
|
82
|
+
.select("*")
|
|
83
|
+
.single();
|
|
84
|
+
if (error) {
|
|
85
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
86
|
+
}
|
|
87
|
+
if (!data) {
|
|
88
|
+
return IWebResponse.error("User not found or profile update failed").to_compatible();
|
|
89
|
+
}
|
|
90
|
+
return IWebResponse.success(data).to_compatible();
|
|
91
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export * from "./helpers/tags";
|
|
|
36
36
|
export * from "./helpers/time";
|
|
37
37
|
export * from "./helpers/ui";
|
|
38
38
|
export * from "./helpers/users";
|
|
39
|
+
export * from "./helpers/invitations";
|
|
40
|
+
export * from "./helpers/herd_allowed_domains";
|
|
39
41
|
export * from "./helpers/web";
|
|
40
42
|
export * from "./helpers/zones";
|
|
41
43
|
export * from "./helpers/storage";
|
|
@@ -73,5 +75,5 @@ export * from "./supabase/middleware";
|
|
|
73
75
|
export * from "./supabase/server";
|
|
74
76
|
export * from "./api_keys/actions";
|
|
75
77
|
export type { HerdModule, IHerdModule } from "./types/herd_module";
|
|
76
|
-
export type { IDevice, IEvent, IUser, IHerd, IHerdPrettyLocation, IEventWithTags, IZoneWithActions, ICredential, CredentialInsert, CredentialUpdate, ICertificate, CertificateInsert, CertificateUpdate, IUserAndRole, IUserProfileRow, IApiKeyScout, ILayer, IHeartbeat, IProvider, IConnectivity, ISession, ISessionWithCoordinates, IConnectivityWithCoordinates, IObservation, ObservationInsert, ObservationUpdate, IAnalysisJob, IAnalysisTask, AnalysisWorkStatus, } from "./types/db";
|
|
78
|
+
export type { IDevice, IEvent, IUser, IHerd, IHerdPrettyLocation, IEventWithTags, IZoneWithActions, ICredential, CredentialInsert, CredentialUpdate, ICertificate, CertificateInsert, CertificateUpdate, IUserAndRole, IUserProfileRow, IHerdInvitation, IHerdAllowedDomain, HerdInvitationStatus, IApiKeyScout, ILayer, IHeartbeat, IProvider, IConnectivity, ISession, ISessionWithCoordinates, IConnectivityWithCoordinates, IObservation, ObservationInsert, ObservationUpdate, IAnalysisJob, IAnalysisTask, AnalysisWorkStatus, } from "./types/db";
|
|
77
79
|
export { EnumSessionsVisibility } from "./types/events";
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,8 @@ export * from "./helpers/tags";
|
|
|
39
39
|
export * from "./helpers/time";
|
|
40
40
|
export * from "./helpers/ui";
|
|
41
41
|
export * from "./helpers/users";
|
|
42
|
+
export * from "./helpers/invitations";
|
|
43
|
+
export * from "./helpers/herd_allowed_domains";
|
|
42
44
|
export * from "./helpers/web";
|
|
43
45
|
export * from "./helpers/zones";
|
|
44
46
|
export * from "./helpers/storage";
|
|
@@ -749,11 +749,85 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
749
749
|
referencedColumns: ["id"];
|
|
750
750
|
}];
|
|
751
751
|
};
|
|
752
|
+
herd_allowed_domains: {
|
|
753
|
+
Row: {
|
|
754
|
+
created_at: string;
|
|
755
|
+
domain: string;
|
|
756
|
+
herd_id: number;
|
|
757
|
+
id: number;
|
|
758
|
+
};
|
|
759
|
+
Insert: {
|
|
760
|
+
created_at?: string;
|
|
761
|
+
domain: string;
|
|
762
|
+
herd_id: number;
|
|
763
|
+
id?: number;
|
|
764
|
+
};
|
|
765
|
+
Update: {
|
|
766
|
+
created_at?: string;
|
|
767
|
+
domain?: string;
|
|
768
|
+
herd_id?: number;
|
|
769
|
+
id?: number;
|
|
770
|
+
};
|
|
771
|
+
Relationships: [{
|
|
772
|
+
foreignKeyName: "herd_allowed_domains_herd_id_fkey";
|
|
773
|
+
columns: ["herd_id"];
|
|
774
|
+
isOneToOne: false;
|
|
775
|
+
referencedRelation: "herds";
|
|
776
|
+
referencedColumns: ["id"];
|
|
777
|
+
}];
|
|
778
|
+
};
|
|
779
|
+
herd_invitations: {
|
|
780
|
+
Row: {
|
|
781
|
+
accepted_at: string | null;
|
|
782
|
+
created_at: string;
|
|
783
|
+
email: string;
|
|
784
|
+
expires_at: string | null;
|
|
785
|
+
herd_id: number;
|
|
786
|
+
id: number;
|
|
787
|
+
invited_by: string;
|
|
788
|
+
role: Database["public"]["Enums"]["role"];
|
|
789
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
790
|
+
};
|
|
791
|
+
Insert: {
|
|
792
|
+
accepted_at?: string | null;
|
|
793
|
+
created_at?: string;
|
|
794
|
+
email: string;
|
|
795
|
+
expires_at?: string | null;
|
|
796
|
+
herd_id: number;
|
|
797
|
+
id?: number;
|
|
798
|
+
invited_by: string;
|
|
799
|
+
role: Database["public"]["Enums"]["role"];
|
|
800
|
+
status?: Database["public"]["Enums"]["herd_invitation_status"];
|
|
801
|
+
};
|
|
802
|
+
Update: {
|
|
803
|
+
accepted_at?: string | null;
|
|
804
|
+
created_at?: string;
|
|
805
|
+
email?: string;
|
|
806
|
+
expires_at?: string | null;
|
|
807
|
+
herd_id?: number;
|
|
808
|
+
id?: number;
|
|
809
|
+
invited_by?: string;
|
|
810
|
+
role?: Database["public"]["Enums"]["role"];
|
|
811
|
+
status?: Database["public"]["Enums"]["herd_invitation_status"];
|
|
812
|
+
};
|
|
813
|
+
Relationships: [{
|
|
814
|
+
foreignKeyName: "herd_invitations_herd_id_fkey";
|
|
815
|
+
columns: ["herd_id"];
|
|
816
|
+
isOneToOne: false;
|
|
817
|
+
referencedRelation: "herds";
|
|
818
|
+
referencedColumns: ["id"];
|
|
819
|
+
}, {
|
|
820
|
+
foreignKeyName: "herd_invitations_invited_by_fkey";
|
|
821
|
+
columns: ["invited_by"];
|
|
822
|
+
isOneToOne: false;
|
|
823
|
+
referencedRelation: "users";
|
|
824
|
+
referencedColumns: ["id"];
|
|
825
|
+
}];
|
|
826
|
+
};
|
|
752
827
|
herds: {
|
|
753
828
|
Row: {
|
|
754
829
|
auto_delete_media_with_humans: boolean | null;
|
|
755
830
|
auto_delete_media_with_no_tracks: boolean | null;
|
|
756
|
-
created_by: string;
|
|
757
831
|
description: string;
|
|
758
832
|
earthranger_domain: string | null;
|
|
759
833
|
earthranger_token: string | null;
|
|
@@ -769,7 +843,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
769
843
|
Insert: {
|
|
770
844
|
auto_delete_media_with_humans?: boolean | null;
|
|
771
845
|
auto_delete_media_with_no_tracks?: boolean | null;
|
|
772
|
-
created_by: string;
|
|
773
846
|
description: string;
|
|
774
847
|
earthranger_domain?: string | null;
|
|
775
848
|
earthranger_token?: string | null;
|
|
@@ -785,7 +858,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
785
858
|
Update: {
|
|
786
859
|
auto_delete_media_with_humans?: boolean | null;
|
|
787
860
|
auto_delete_media_with_no_tracks?: boolean | null;
|
|
788
|
-
created_by?: string;
|
|
789
861
|
description?: string;
|
|
790
862
|
earthranger_domain?: string | null;
|
|
791
863
|
earthranger_token?: string | null;
|
|
@@ -798,13 +870,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
798
870
|
video_server_url?: string | null;
|
|
799
871
|
video_subscriber_token?: string | null;
|
|
800
872
|
};
|
|
801
|
-
Relationships: [
|
|
802
|
-
foreignKeyName: "herds_created_by_fkey";
|
|
803
|
-
columns: ["created_by"];
|
|
804
|
-
isOneToOne: false;
|
|
805
|
-
referencedRelation: "users";
|
|
806
|
-
referencedColumns: ["id"];
|
|
807
|
-
}];
|
|
873
|
+
Relationships: [];
|
|
808
874
|
};
|
|
809
875
|
layers: {
|
|
810
876
|
Row: {
|
|
@@ -1732,6 +1798,28 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
1732
1798
|
};
|
|
1733
1799
|
};
|
|
1734
1800
|
Functions: {
|
|
1801
|
+
accept_herd_invitations_for_current_user: {
|
|
1802
|
+
Args: {
|
|
1803
|
+
p_invitation_ids: number[];
|
|
1804
|
+
};
|
|
1805
|
+
Returns: {
|
|
1806
|
+
accepted_at: string | null;
|
|
1807
|
+
created_at: string;
|
|
1808
|
+
email: string;
|
|
1809
|
+
expires_at: string | null;
|
|
1810
|
+
herd_id: number;
|
|
1811
|
+
id: number;
|
|
1812
|
+
invited_by: string;
|
|
1813
|
+
role: Database["public"]["Enums"]["role"];
|
|
1814
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
1815
|
+
}[];
|
|
1816
|
+
SetofOptions: {
|
|
1817
|
+
from: "*";
|
|
1818
|
+
to: "herd_invitations";
|
|
1819
|
+
isOneToOne: false;
|
|
1820
|
+
isSetofReturn: true;
|
|
1821
|
+
};
|
|
1822
|
+
};
|
|
1735
1823
|
ack_queue_message: {
|
|
1736
1824
|
Args: {
|
|
1737
1825
|
message_id: number;
|
|
@@ -1782,6 +1870,31 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
1782
1870
|
table_name: string;
|
|
1783
1871
|
}[];
|
|
1784
1872
|
};
|
|
1873
|
+
create_herd_invitation: {
|
|
1874
|
+
Args: {
|
|
1875
|
+
p_email: string;
|
|
1876
|
+
p_expires_at?: string;
|
|
1877
|
+
p_herd_id: number;
|
|
1878
|
+
p_role: Database["public"]["Enums"]["role"];
|
|
1879
|
+
};
|
|
1880
|
+
Returns: {
|
|
1881
|
+
accepted_at: string | null;
|
|
1882
|
+
created_at: string;
|
|
1883
|
+
email: string;
|
|
1884
|
+
expires_at: string | null;
|
|
1885
|
+
herd_id: number;
|
|
1886
|
+
id: number;
|
|
1887
|
+
invited_by: string;
|
|
1888
|
+
role: Database["public"]["Enums"]["role"];
|
|
1889
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
1890
|
+
};
|
|
1891
|
+
SetofOptions: {
|
|
1892
|
+
from: "*";
|
|
1893
|
+
to: "herd_invitations";
|
|
1894
|
+
isOneToOne: true;
|
|
1895
|
+
isSetofReturn: false;
|
|
1896
|
+
};
|
|
1897
|
+
};
|
|
1785
1898
|
delete_all_orphaned_sessions: {
|
|
1786
1899
|
Args: {
|
|
1787
1900
|
min_age_seconds?: number;
|
|
@@ -2510,6 +2623,26 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
2510
2623
|
min_value: number;
|
|
2511
2624
|
}[];
|
|
2512
2625
|
};
|
|
2626
|
+
get_herd_invitations_for_current_user: {
|
|
2627
|
+
Args: never;
|
|
2628
|
+
Returns: {
|
|
2629
|
+
accepted_at: string | null;
|
|
2630
|
+
created_at: string;
|
|
2631
|
+
email: string;
|
|
2632
|
+
expires_at: string | null;
|
|
2633
|
+
herd_id: number;
|
|
2634
|
+
id: number;
|
|
2635
|
+
invited_by: string;
|
|
2636
|
+
role: Database["public"]["Enums"]["role"];
|
|
2637
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
2638
|
+
}[];
|
|
2639
|
+
SetofOptions: {
|
|
2640
|
+
from: "*";
|
|
2641
|
+
to: "herd_invitations";
|
|
2642
|
+
isOneToOne: false;
|
|
2643
|
+
isSetofReturn: true;
|
|
2644
|
+
};
|
|
2645
|
+
};
|
|
2513
2646
|
get_herd_uptime_summary: {
|
|
2514
2647
|
Args: {
|
|
2515
2648
|
p_device_types?: Database["public"]["Enums"]["device_type"][];
|
|
@@ -3001,6 +3134,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
3001
3134
|
app_permission: "herds.delete" | "events.delete";
|
|
3002
3135
|
device_type: "trail_camera" | "drone_fixed_wing" | "drone_quad" | "gps_tracker" | "sentry_tower" | "smart_buoy" | "radio_mesh_base_station" | "radio_mesh_repeater" | "unknown" | "gps_tracker_vehicle" | "gps_tracker_person" | "radio_mesh_base_station_gateway";
|
|
3003
3136
|
entity_lifecycle: "active" | "retired" | "deleted";
|
|
3137
|
+
herd_invitation_status: "pending" | "accepted" | "revoked" | "expired";
|
|
3004
3138
|
media_type: "image" | "video" | "audio" | "text";
|
|
3005
3139
|
plan_type: "mission" | "fence" | "rally" | "markov";
|
|
3006
3140
|
role: "admin" | "editor" | "viewer";
|
|
@@ -3150,7 +3284,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
3150
3284
|
inserted_at: string | null;
|
|
3151
3285
|
slug: string | null;
|
|
3152
3286
|
description: string | null;
|
|
3153
|
-
created_by: string | null;
|
|
3154
3287
|
is_public: boolean | null;
|
|
3155
3288
|
earthranger_domain: string | null;
|
|
3156
3289
|
earthranger_token: string | null;
|
package/dist/types/db.d.ts
CHANGED
|
@@ -27,6 +27,9 @@ export type ILayer = Database["public"]["Tables"]["layers"]["Row"];
|
|
|
27
27
|
export type IAction = Database["public"]["Tables"]["actions"]["Row"];
|
|
28
28
|
export type IZone = Database["public"]["Tables"]["zones"]["Row"];
|
|
29
29
|
export type IUserRolePerHerd = Database["public"]["Tables"]["users_roles_per_herd"]["Row"];
|
|
30
|
+
export type IHerdInvitation = Database["public"]["Tables"]["herd_invitations"]["Row"];
|
|
31
|
+
export type IHerdAllowedDomain = Database["public"]["Tables"]["herd_allowed_domains"]["Row"];
|
|
32
|
+
export type HerdInvitationStatus = Database["public"]["Enums"]["herd_invitation_status"];
|
|
30
33
|
export type IHerd = Database["public"]["Tables"]["herds"]["Row"];
|
|
31
34
|
export type ISession = Database["public"]["Tables"]["sessions"]["Row"];
|
|
32
35
|
export type IConnectivity = Database["public"]["Tables"]["connectivity"]["Row"];
|
package/dist/types/supabase.d.ts
CHANGED
|
@@ -785,11 +785,90 @@ export type Database = {
|
|
|
785
785
|
}
|
|
786
786
|
];
|
|
787
787
|
};
|
|
788
|
+
herd_allowed_domains: {
|
|
789
|
+
Row: {
|
|
790
|
+
created_at: string;
|
|
791
|
+
domain: string;
|
|
792
|
+
herd_id: number;
|
|
793
|
+
id: number;
|
|
794
|
+
};
|
|
795
|
+
Insert: {
|
|
796
|
+
created_at?: string;
|
|
797
|
+
domain: string;
|
|
798
|
+
herd_id: number;
|
|
799
|
+
id?: number;
|
|
800
|
+
};
|
|
801
|
+
Update: {
|
|
802
|
+
created_at?: string;
|
|
803
|
+
domain?: string;
|
|
804
|
+
herd_id?: number;
|
|
805
|
+
id?: number;
|
|
806
|
+
};
|
|
807
|
+
Relationships: [
|
|
808
|
+
{
|
|
809
|
+
foreignKeyName: "herd_allowed_domains_herd_id_fkey";
|
|
810
|
+
columns: ["herd_id"];
|
|
811
|
+
isOneToOne: false;
|
|
812
|
+
referencedRelation: "herds";
|
|
813
|
+
referencedColumns: ["id"];
|
|
814
|
+
}
|
|
815
|
+
];
|
|
816
|
+
};
|
|
817
|
+
herd_invitations: {
|
|
818
|
+
Row: {
|
|
819
|
+
accepted_at: string | null;
|
|
820
|
+
created_at: string;
|
|
821
|
+
email: string;
|
|
822
|
+
expires_at: string | null;
|
|
823
|
+
herd_id: number;
|
|
824
|
+
id: number;
|
|
825
|
+
invited_by: string;
|
|
826
|
+
role: Database["public"]["Enums"]["role"];
|
|
827
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
828
|
+
};
|
|
829
|
+
Insert: {
|
|
830
|
+
accepted_at?: string | null;
|
|
831
|
+
created_at?: string;
|
|
832
|
+
email: string;
|
|
833
|
+
expires_at?: string | null;
|
|
834
|
+
herd_id: number;
|
|
835
|
+
id?: number;
|
|
836
|
+
invited_by: string;
|
|
837
|
+
role: Database["public"]["Enums"]["role"];
|
|
838
|
+
status?: Database["public"]["Enums"]["herd_invitation_status"];
|
|
839
|
+
};
|
|
840
|
+
Update: {
|
|
841
|
+
accepted_at?: string | null;
|
|
842
|
+
created_at?: string;
|
|
843
|
+
email?: string;
|
|
844
|
+
expires_at?: string | null;
|
|
845
|
+
herd_id?: number;
|
|
846
|
+
id?: number;
|
|
847
|
+
invited_by?: string;
|
|
848
|
+
role?: Database["public"]["Enums"]["role"];
|
|
849
|
+
status?: Database["public"]["Enums"]["herd_invitation_status"];
|
|
850
|
+
};
|
|
851
|
+
Relationships: [
|
|
852
|
+
{
|
|
853
|
+
foreignKeyName: "herd_invitations_herd_id_fkey";
|
|
854
|
+
columns: ["herd_id"];
|
|
855
|
+
isOneToOne: false;
|
|
856
|
+
referencedRelation: "herds";
|
|
857
|
+
referencedColumns: ["id"];
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
foreignKeyName: "herd_invitations_invited_by_fkey";
|
|
861
|
+
columns: ["invited_by"];
|
|
862
|
+
isOneToOne: false;
|
|
863
|
+
referencedRelation: "users";
|
|
864
|
+
referencedColumns: ["id"];
|
|
865
|
+
}
|
|
866
|
+
];
|
|
867
|
+
};
|
|
788
868
|
herds: {
|
|
789
869
|
Row: {
|
|
790
870
|
auto_delete_media_with_humans: boolean | null;
|
|
791
871
|
auto_delete_media_with_no_tracks: boolean | null;
|
|
792
|
-
created_by: string;
|
|
793
872
|
description: string;
|
|
794
873
|
earthranger_domain: string | null;
|
|
795
874
|
earthranger_token: string | null;
|
|
@@ -805,7 +884,6 @@ export type Database = {
|
|
|
805
884
|
Insert: {
|
|
806
885
|
auto_delete_media_with_humans?: boolean | null;
|
|
807
886
|
auto_delete_media_with_no_tracks?: boolean | null;
|
|
808
|
-
created_by: string;
|
|
809
887
|
description: string;
|
|
810
888
|
earthranger_domain?: string | null;
|
|
811
889
|
earthranger_token?: string | null;
|
|
@@ -821,7 +899,6 @@ export type Database = {
|
|
|
821
899
|
Update: {
|
|
822
900
|
auto_delete_media_with_humans?: boolean | null;
|
|
823
901
|
auto_delete_media_with_no_tracks?: boolean | null;
|
|
824
|
-
created_by?: string;
|
|
825
902
|
description?: string;
|
|
826
903
|
earthranger_domain?: string | null;
|
|
827
904
|
earthranger_token?: string | null;
|
|
@@ -834,15 +911,7 @@ export type Database = {
|
|
|
834
911
|
video_server_url?: string | null;
|
|
835
912
|
video_subscriber_token?: string | null;
|
|
836
913
|
};
|
|
837
|
-
Relationships: [
|
|
838
|
-
{
|
|
839
|
-
foreignKeyName: "herds_created_by_fkey";
|
|
840
|
-
columns: ["created_by"];
|
|
841
|
-
isOneToOne: false;
|
|
842
|
-
referencedRelation: "users";
|
|
843
|
-
referencedColumns: ["id"];
|
|
844
|
-
}
|
|
845
|
-
];
|
|
914
|
+
Relationships: [];
|
|
846
915
|
};
|
|
847
916
|
layers: {
|
|
848
917
|
Row: {
|
|
@@ -1824,6 +1893,28 @@ export type Database = {
|
|
|
1824
1893
|
};
|
|
1825
1894
|
};
|
|
1826
1895
|
Functions: {
|
|
1896
|
+
accept_herd_invitations_for_current_user: {
|
|
1897
|
+
Args: {
|
|
1898
|
+
p_invitation_ids: number[];
|
|
1899
|
+
};
|
|
1900
|
+
Returns: {
|
|
1901
|
+
accepted_at: string | null;
|
|
1902
|
+
created_at: string;
|
|
1903
|
+
email: string;
|
|
1904
|
+
expires_at: string | null;
|
|
1905
|
+
herd_id: number;
|
|
1906
|
+
id: number;
|
|
1907
|
+
invited_by: string;
|
|
1908
|
+
role: Database["public"]["Enums"]["role"];
|
|
1909
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
1910
|
+
}[];
|
|
1911
|
+
SetofOptions: {
|
|
1912
|
+
from: "*";
|
|
1913
|
+
to: "herd_invitations";
|
|
1914
|
+
isOneToOne: false;
|
|
1915
|
+
isSetofReturn: true;
|
|
1916
|
+
};
|
|
1917
|
+
};
|
|
1827
1918
|
ack_queue_message: {
|
|
1828
1919
|
Args: {
|
|
1829
1920
|
message_id: number;
|
|
@@ -1874,6 +1965,31 @@ export type Database = {
|
|
|
1874
1965
|
table_name: string;
|
|
1875
1966
|
}[];
|
|
1876
1967
|
};
|
|
1968
|
+
create_herd_invitation: {
|
|
1969
|
+
Args: {
|
|
1970
|
+
p_email: string;
|
|
1971
|
+
p_expires_at?: string;
|
|
1972
|
+
p_herd_id: number;
|
|
1973
|
+
p_role: Database["public"]["Enums"]["role"];
|
|
1974
|
+
};
|
|
1975
|
+
Returns: {
|
|
1976
|
+
accepted_at: string | null;
|
|
1977
|
+
created_at: string;
|
|
1978
|
+
email: string;
|
|
1979
|
+
expires_at: string | null;
|
|
1980
|
+
herd_id: number;
|
|
1981
|
+
id: number;
|
|
1982
|
+
invited_by: string;
|
|
1983
|
+
role: Database["public"]["Enums"]["role"];
|
|
1984
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
1985
|
+
};
|
|
1986
|
+
SetofOptions: {
|
|
1987
|
+
from: "*";
|
|
1988
|
+
to: "herd_invitations";
|
|
1989
|
+
isOneToOne: true;
|
|
1990
|
+
isSetofReturn: false;
|
|
1991
|
+
};
|
|
1992
|
+
};
|
|
1877
1993
|
delete_all_orphaned_sessions: {
|
|
1878
1994
|
Args: {
|
|
1879
1995
|
min_age_seconds?: number;
|
|
@@ -2602,6 +2718,26 @@ export type Database = {
|
|
|
2602
2718
|
min_value: number;
|
|
2603
2719
|
}[];
|
|
2604
2720
|
};
|
|
2721
|
+
get_herd_invitations_for_current_user: {
|
|
2722
|
+
Args: never;
|
|
2723
|
+
Returns: {
|
|
2724
|
+
accepted_at: string | null;
|
|
2725
|
+
created_at: string;
|
|
2726
|
+
email: string;
|
|
2727
|
+
expires_at: string | null;
|
|
2728
|
+
herd_id: number;
|
|
2729
|
+
id: number;
|
|
2730
|
+
invited_by: string;
|
|
2731
|
+
role: Database["public"]["Enums"]["role"];
|
|
2732
|
+
status: Database["public"]["Enums"]["herd_invitation_status"];
|
|
2733
|
+
}[];
|
|
2734
|
+
SetofOptions: {
|
|
2735
|
+
from: "*";
|
|
2736
|
+
to: "herd_invitations";
|
|
2737
|
+
isOneToOne: false;
|
|
2738
|
+
isSetofReturn: true;
|
|
2739
|
+
};
|
|
2740
|
+
};
|
|
2605
2741
|
get_herd_uptime_summary: {
|
|
2606
2742
|
Args: {
|
|
2607
2743
|
p_device_types?: Database["public"]["Enums"]["device_type"][];
|
|
@@ -3093,6 +3229,7 @@ export type Database = {
|
|
|
3093
3229
|
app_permission: "herds.delete" | "events.delete";
|
|
3094
3230
|
device_type: "trail_camera" | "drone_fixed_wing" | "drone_quad" | "gps_tracker" | "sentry_tower" | "smart_buoy" | "radio_mesh_base_station" | "radio_mesh_repeater" | "unknown" | "gps_tracker_vehicle" | "gps_tracker_person" | "radio_mesh_base_station_gateway";
|
|
3095
3231
|
entity_lifecycle: "active" | "retired" | "deleted";
|
|
3232
|
+
herd_invitation_status: "pending" | "accepted" | "revoked" | "expired";
|
|
3096
3233
|
media_type: "image" | "video" | "audio" | "text";
|
|
3097
3234
|
plan_type: "mission" | "fence" | "rally" | "markov";
|
|
3098
3235
|
role: "admin" | "editor" | "viewer";
|
|
@@ -3242,7 +3379,6 @@ export type Database = {
|
|
|
3242
3379
|
inserted_at: string | null;
|
|
3243
3380
|
slug: string | null;
|
|
3244
3381
|
description: string | null;
|
|
3245
|
-
created_by: string | null;
|
|
3246
3382
|
is_public: boolean | null;
|
|
3247
3383
|
earthranger_domain: string | null;
|
|
3248
3384
|
earthranger_token: string | null;
|
|
@@ -3408,6 +3544,7 @@ export declare const Constants: {
|
|
|
3408
3544
|
readonly app_permission: readonly ["herds.delete", "events.delete"];
|
|
3409
3545
|
readonly device_type: readonly ["trail_camera", "drone_fixed_wing", "drone_quad", "gps_tracker", "sentry_tower", "smart_buoy", "radio_mesh_base_station", "radio_mesh_repeater", "unknown", "gps_tracker_vehicle", "gps_tracker_person", "radio_mesh_base_station_gateway"];
|
|
3410
3546
|
readonly entity_lifecycle: readonly ["active", "retired", "deleted"];
|
|
3547
|
+
readonly herd_invitation_status: readonly ["pending", "accepted", "revoked", "expired"];
|
|
3411
3548
|
readonly media_type: readonly ["image", "video", "audio", "text"];
|
|
3412
3549
|
readonly plan_type: readonly ["mission", "fence", "rally", "markov"];
|
|
3413
3550
|
readonly role: readonly ["admin", "editor", "viewer"];
|
package/dist/types/supabase.js
CHANGED
|
@@ -24,6 +24,7 @@ export const Constants = {
|
|
|
24
24
|
"radio_mesh_base_station_gateway",
|
|
25
25
|
],
|
|
26
26
|
entity_lifecycle: ["active", "retired", "deleted"],
|
|
27
|
+
herd_invitation_status: ["pending", "accepted", "revoked", "expired"],
|
|
27
28
|
media_type: ["image", "video", "audio", "text"],
|
|
28
29
|
plan_type: ["mission", "fence", "rally", "markov"],
|
|
29
30
|
role: ["admin", "editor", "viewer"],
|