@adventurelabs/scout-core 1.4.82 → 1.4.84
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_credentials.d.ts +9 -0
- package/dist/helpers/herd_credentials.js +85 -0
- package/dist/helpers/herds.js +1 -1
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +3 -0
- package/dist/helpers/models.d.ts +11 -0
- package/dist/helpers/models.js +95 -0
- package/dist/helpers/user_credentials.d.ts +9 -0
- package/dist/helpers/user_credentials.js +85 -0
- package/dist/hooks/useDeviceDisplayName.d.ts +8 -0
- package/dist/hooks/useDeviceDisplayName.js +49 -0
- package/dist/types/db.d.ts +11 -0
- package/dist/types/supabase.d.ts +146 -21
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Database } from "../types/supabase";
|
|
2
|
+
import { CredentialQueryArgs, IHerdCredential, HerdCredentialInsert, HerdCredentialUpdate } from "../types/db";
|
|
3
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
4
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
5
|
+
export declare function get_herd_credentials_by_herd_id(client: SupabaseClient<Database>, herd_id: number, args?: CredentialQueryArgs): Promise<IWebResponseCompatible<IHerdCredential[]>>;
|
|
6
|
+
export declare function get_herd_credential_by_id(client: SupabaseClient<Database>, credential_id: number): Promise<IWebResponseCompatible<IHerdCredential | null>>;
|
|
7
|
+
export declare function create_herd_credential(client: SupabaseClient<Database>, row: HerdCredentialInsert): Promise<IWebResponseCompatible<IHerdCredential | null>>;
|
|
8
|
+
export declare function update_herd_credential(client: SupabaseClient<Database>, credential_id: number, patch: HerdCredentialUpdate): Promise<IWebResponseCompatible<IHerdCredential | null>>;
|
|
9
|
+
export declare function delete_herd_credential(client: SupabaseClient<Database>, credential_id: number): Promise<IWebResponseCompatible<IHerdCredential | null>>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { IWebResponse } from "../types/requests";
|
|
2
|
+
export async function get_herd_credentials_by_herd_id(client, herd_id, args) {
|
|
3
|
+
let query = client
|
|
4
|
+
.from("herd_credentials")
|
|
5
|
+
.select("*")
|
|
6
|
+
.eq("herd_id", herd_id);
|
|
7
|
+
if (args?.type)
|
|
8
|
+
query = query.eq("type", args.type);
|
|
9
|
+
const { data, error } = await query.order("created_at", { ascending: false });
|
|
10
|
+
if (error) {
|
|
11
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
12
|
+
}
|
|
13
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
14
|
+
}
|
|
15
|
+
export async function get_herd_credential_by_id(client, credential_id) {
|
|
16
|
+
const { data, error } = await client
|
|
17
|
+
.from("herd_credentials")
|
|
18
|
+
.select("*")
|
|
19
|
+
.eq("id", credential_id)
|
|
20
|
+
.single();
|
|
21
|
+
if (error) {
|
|
22
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
23
|
+
}
|
|
24
|
+
if (!data) {
|
|
25
|
+
return IWebResponse.error("Herd credential not found").to_compatible();
|
|
26
|
+
}
|
|
27
|
+
return IWebResponse.success(data).to_compatible();
|
|
28
|
+
}
|
|
29
|
+
export async function create_herd_credential(client, row) {
|
|
30
|
+
if (!row.herd_id) {
|
|
31
|
+
return IWebResponse.error("herd_id is required").to_compatible();
|
|
32
|
+
}
|
|
33
|
+
if (!row.issuer?.trim()) {
|
|
34
|
+
return IWebResponse.error("issuer is required").to_compatible();
|
|
35
|
+
}
|
|
36
|
+
if (!row.type?.trim()) {
|
|
37
|
+
return IWebResponse.error("type is required").to_compatible();
|
|
38
|
+
}
|
|
39
|
+
const { data, error } = await client
|
|
40
|
+
.from("herd_credentials")
|
|
41
|
+
.insert([row])
|
|
42
|
+
.select("*")
|
|
43
|
+
.single();
|
|
44
|
+
if (error) {
|
|
45
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
46
|
+
}
|
|
47
|
+
if (!data) {
|
|
48
|
+
return IWebResponse.error("Failed to create herd credential").to_compatible();
|
|
49
|
+
}
|
|
50
|
+
return IWebResponse.success(data).to_compatible();
|
|
51
|
+
}
|
|
52
|
+
export async function update_herd_credential(client, credential_id, patch) {
|
|
53
|
+
const { id: _id, herd_id: _hid, created_at: _ca, ...updateData } = patch;
|
|
54
|
+
if (Object.keys(updateData).length === 0) {
|
|
55
|
+
return IWebResponse.error("No valid fields to update").to_compatible();
|
|
56
|
+
}
|
|
57
|
+
const { data, error } = await client
|
|
58
|
+
.from("herd_credentials")
|
|
59
|
+
.update(updateData)
|
|
60
|
+
.eq("id", credential_id)
|
|
61
|
+
.select("*")
|
|
62
|
+
.single();
|
|
63
|
+
if (error) {
|
|
64
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
65
|
+
}
|
|
66
|
+
if (!data) {
|
|
67
|
+
return IWebResponse.error("Herd credential not found").to_compatible();
|
|
68
|
+
}
|
|
69
|
+
return IWebResponse.success(data).to_compatible();
|
|
70
|
+
}
|
|
71
|
+
export async function delete_herd_credential(client, credential_id) {
|
|
72
|
+
const { data, error } = await client
|
|
73
|
+
.from("herd_credentials")
|
|
74
|
+
.delete()
|
|
75
|
+
.eq("id", credential_id)
|
|
76
|
+
.select("*")
|
|
77
|
+
.single();
|
|
78
|
+
if (error) {
|
|
79
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
80
|
+
}
|
|
81
|
+
if (!data) {
|
|
82
|
+
return IWebResponse.error("Herd credential not found").to_compatible();
|
|
83
|
+
}
|
|
84
|
+
return IWebResponse.success(data).to_compatible();
|
|
85
|
+
}
|
package/dist/helpers/herds.js
CHANGED
|
@@ -45,7 +45,7 @@ export async function get_herd_by_slug(slug) {
|
|
|
45
45
|
}
|
|
46
46
|
export async function deleteHerd(herd_id) {
|
|
47
47
|
const supabase = await newServerClient();
|
|
48
|
-
const { error } = await supabase.from("herds").delete().match({ id:
|
|
48
|
+
const { error } = await supabase.from("herds").delete().match({ id: herd_id });
|
|
49
49
|
if (error) {
|
|
50
50
|
return {
|
|
51
51
|
status: EnumWebResponse.ERROR,
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./bounding_boxes";
|
|
|
4
4
|
export * from "./chat";
|
|
5
5
|
export * from "./certificates";
|
|
6
6
|
export * from "./credentials";
|
|
7
|
+
export * from "./user_credentials";
|
|
8
|
+
export * from "./herd_credentials";
|
|
7
9
|
export * from "./db";
|
|
8
10
|
export * from "./devices";
|
|
9
11
|
export * from "./email";
|
|
@@ -14,6 +16,7 @@ export * from "./heartbeats";
|
|
|
14
16
|
export * from "./herds";
|
|
15
17
|
export * from "./location";
|
|
16
18
|
export * from "./lifecycle";
|
|
19
|
+
export * from "./models";
|
|
17
20
|
export * from "./plans";
|
|
18
21
|
export * from "./sessions";
|
|
19
22
|
export * from "./segmentations_sam3";
|
package/dist/helpers/index.js
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./bounding_boxes";
|
|
|
4
4
|
export * from "./chat";
|
|
5
5
|
export * from "./certificates";
|
|
6
6
|
export * from "./credentials";
|
|
7
|
+
export * from "./user_credentials";
|
|
8
|
+
export * from "./herd_credentials";
|
|
7
9
|
export * from "./db";
|
|
8
10
|
export * from "./devices";
|
|
9
11
|
export * from "./email";
|
|
@@ -14,6 +16,7 @@ export * from "./heartbeats";
|
|
|
14
16
|
export * from "./herds";
|
|
15
17
|
export * from "./location";
|
|
16
18
|
export * from "./lifecycle";
|
|
19
|
+
export * from "./models";
|
|
17
20
|
export * from "./plans";
|
|
18
21
|
export * from "./sessions";
|
|
19
22
|
export * from "./segmentations_sam3";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IModel, IModelsPerJobsPerHerd } from "../types/db";
|
|
2
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
3
|
+
export declare function server_get_model_by_id(model_id: number): Promise<IWebResponseCompatible<IModel | null>>;
|
|
4
|
+
export declare function server_get_models_by_ids(model_ids: number[]): Promise<IWebResponseCompatible<IModel[]>>;
|
|
5
|
+
export declare function server_get_models(options?: {
|
|
6
|
+
include_inactive?: boolean;
|
|
7
|
+
}): Promise<IWebResponseCompatible<IModel[]>>;
|
|
8
|
+
export declare function server_get_models_per_jobs_per_herd_by_herd(herd_id: number): Promise<IWebResponseCompatible<IModelsPerJobsPerHerd[]>>;
|
|
9
|
+
export declare function server_create_models_per_jobs_per_herd(activation: Omit<IModelsPerJobsPerHerd, "id" | "inserted_at">): Promise<IWebResponseCompatible<IModelsPerJobsPerHerd>>;
|
|
10
|
+
export declare function server_update_models_per_jobs_per_herd(id: number, updates: Partial<Omit<IModelsPerJobsPerHerd, "id" | "inserted_at">>): Promise<IWebResponseCompatible<IModelsPerJobsPerHerd>>;
|
|
11
|
+
export declare function server_delete_models_per_jobs_per_herd_by_ids(ids: number[]): Promise<IWebResponseCompatible<boolean>>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { newServerClient } from "../supabase/server";
|
|
3
|
+
import { EnumWebResponse, IWebResponse, } from "../types/requests";
|
|
4
|
+
// function that fetches a single model by id; null if not found
|
|
5
|
+
export async function server_get_model_by_id(model_id) {
|
|
6
|
+
const supabase = await newServerClient();
|
|
7
|
+
const { data, error } = await supabase
|
|
8
|
+
.from("models")
|
|
9
|
+
.select("*")
|
|
10
|
+
.eq("id", model_id)
|
|
11
|
+
.maybeSingle();
|
|
12
|
+
if (error) {
|
|
13
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: null };
|
|
14
|
+
}
|
|
15
|
+
return IWebResponse.success(data).to_compatible();
|
|
16
|
+
}
|
|
17
|
+
// function that fetches multiple models by id
|
|
18
|
+
export async function server_get_models_by_ids(model_ids) {
|
|
19
|
+
if (model_ids.length === 0) {
|
|
20
|
+
return IWebResponse.success([]).to_compatible();
|
|
21
|
+
}
|
|
22
|
+
const supabase = await newServerClient();
|
|
23
|
+
const { data, error } = await supabase
|
|
24
|
+
.from("models")
|
|
25
|
+
.select("*")
|
|
26
|
+
.in("id", model_ids);
|
|
27
|
+
if (error) {
|
|
28
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: [] };
|
|
29
|
+
}
|
|
30
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
31
|
+
}
|
|
32
|
+
// function that lists models, active only by default
|
|
33
|
+
export async function server_get_models(options) {
|
|
34
|
+
const supabase = await newServerClient();
|
|
35
|
+
let query = supabase.from("models").select("*").order("name");
|
|
36
|
+
if (!options?.include_inactive) {
|
|
37
|
+
query = query.eq("is_active", true);
|
|
38
|
+
}
|
|
39
|
+
const { data, error } = await query;
|
|
40
|
+
if (error) {
|
|
41
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: [] };
|
|
42
|
+
}
|
|
43
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
44
|
+
}
|
|
45
|
+
// function that fetches the model activations for a herd
|
|
46
|
+
export async function server_get_models_per_jobs_per_herd_by_herd(herd_id) {
|
|
47
|
+
const supabase = await newServerClient();
|
|
48
|
+
const { data, error } = await supabase
|
|
49
|
+
.from("models_per_jobs_per_herd")
|
|
50
|
+
.select("*")
|
|
51
|
+
.eq("herd_id", herd_id);
|
|
52
|
+
if (error) {
|
|
53
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: [] };
|
|
54
|
+
}
|
|
55
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
56
|
+
}
|
|
57
|
+
// function that creates a model activation
|
|
58
|
+
export async function server_create_models_per_jobs_per_herd(activation) {
|
|
59
|
+
const supabase = await newServerClient();
|
|
60
|
+
const { data, error } = await supabase
|
|
61
|
+
.from("models_per_jobs_per_herd")
|
|
62
|
+
.insert(activation)
|
|
63
|
+
.select("*")
|
|
64
|
+
.single();
|
|
65
|
+
if (error) {
|
|
66
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: null };
|
|
67
|
+
}
|
|
68
|
+
return IWebResponse.success(data).to_compatible();
|
|
69
|
+
}
|
|
70
|
+
// function that updates a model activation
|
|
71
|
+
export async function server_update_models_per_jobs_per_herd(id, updates) {
|
|
72
|
+
const supabase = await newServerClient();
|
|
73
|
+
const { data, error } = await supabase
|
|
74
|
+
.from("models_per_jobs_per_herd")
|
|
75
|
+
.update(updates)
|
|
76
|
+
.eq("id", id)
|
|
77
|
+
.select("*")
|
|
78
|
+
.single();
|
|
79
|
+
if (error) {
|
|
80
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: null };
|
|
81
|
+
}
|
|
82
|
+
return IWebResponse.success(data).to_compatible();
|
|
83
|
+
}
|
|
84
|
+
// function that deletes model activations by ids
|
|
85
|
+
export async function server_delete_models_per_jobs_per_herd_by_ids(ids) {
|
|
86
|
+
const supabase = await newServerClient();
|
|
87
|
+
const { error } = await supabase
|
|
88
|
+
.from("models_per_jobs_per_herd")
|
|
89
|
+
.delete()
|
|
90
|
+
.in("id", ids);
|
|
91
|
+
if (error) {
|
|
92
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: false };
|
|
93
|
+
}
|
|
94
|
+
return IWebResponse.success(true).to_compatible();
|
|
95
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Database } from "../types/supabase";
|
|
2
|
+
import { CredentialQueryArgs, IUserCredential, UserCredentialInsert, UserCredentialUpdate } from "../types/db";
|
|
3
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
4
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
5
|
+
export declare function get_user_credentials_by_user_id(client: SupabaseClient<Database>, user_id: string, args?: CredentialQueryArgs): Promise<IWebResponseCompatible<IUserCredential[]>>;
|
|
6
|
+
export declare function get_user_credential_by_id(client: SupabaseClient<Database>, credential_id: number): Promise<IWebResponseCompatible<IUserCredential | null>>;
|
|
7
|
+
export declare function create_user_credential(client: SupabaseClient<Database>, row: UserCredentialInsert): Promise<IWebResponseCompatible<IUserCredential | null>>;
|
|
8
|
+
export declare function update_user_credential(client: SupabaseClient<Database>, credential_id: number, patch: UserCredentialUpdate): Promise<IWebResponseCompatible<IUserCredential | null>>;
|
|
9
|
+
export declare function delete_user_credential(client: SupabaseClient<Database>, credential_id: number): Promise<IWebResponseCompatible<IUserCredential | null>>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { IWebResponse } from "../types/requests";
|
|
2
|
+
export async function get_user_credentials_by_user_id(client, user_id, args) {
|
|
3
|
+
let query = client
|
|
4
|
+
.from("user_credentials")
|
|
5
|
+
.select("*")
|
|
6
|
+
.eq("user_id", user_id);
|
|
7
|
+
if (args?.type)
|
|
8
|
+
query = query.eq("type", args.type);
|
|
9
|
+
const { data, error } = await query.order("created_at", { ascending: false });
|
|
10
|
+
if (error) {
|
|
11
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
12
|
+
}
|
|
13
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
14
|
+
}
|
|
15
|
+
export async function get_user_credential_by_id(client, credential_id) {
|
|
16
|
+
const { data, error } = await client
|
|
17
|
+
.from("user_credentials")
|
|
18
|
+
.select("*")
|
|
19
|
+
.eq("id", credential_id)
|
|
20
|
+
.single();
|
|
21
|
+
if (error) {
|
|
22
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
23
|
+
}
|
|
24
|
+
if (!data) {
|
|
25
|
+
return IWebResponse.error("User credential not found").to_compatible();
|
|
26
|
+
}
|
|
27
|
+
return IWebResponse.success(data).to_compatible();
|
|
28
|
+
}
|
|
29
|
+
export async function create_user_credential(client, row) {
|
|
30
|
+
if (!row.user_id) {
|
|
31
|
+
return IWebResponse.error("user_id is required").to_compatible();
|
|
32
|
+
}
|
|
33
|
+
if (!row.issuer?.trim()) {
|
|
34
|
+
return IWebResponse.error("issuer is required").to_compatible();
|
|
35
|
+
}
|
|
36
|
+
if (!row.type?.trim()) {
|
|
37
|
+
return IWebResponse.error("type is required").to_compatible();
|
|
38
|
+
}
|
|
39
|
+
const { data, error } = await client
|
|
40
|
+
.from("user_credentials")
|
|
41
|
+
.insert([row])
|
|
42
|
+
.select("*")
|
|
43
|
+
.single();
|
|
44
|
+
if (error) {
|
|
45
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
46
|
+
}
|
|
47
|
+
if (!data) {
|
|
48
|
+
return IWebResponse.error("Failed to create user credential").to_compatible();
|
|
49
|
+
}
|
|
50
|
+
return IWebResponse.success(data).to_compatible();
|
|
51
|
+
}
|
|
52
|
+
export async function update_user_credential(client, credential_id, patch) {
|
|
53
|
+
const { id: _id, user_id: _uid, created_at: _ca, ...updateData } = patch;
|
|
54
|
+
if (Object.keys(updateData).length === 0) {
|
|
55
|
+
return IWebResponse.error("No valid fields to update").to_compatible();
|
|
56
|
+
}
|
|
57
|
+
const { data, error } = await client
|
|
58
|
+
.from("user_credentials")
|
|
59
|
+
.update(updateData)
|
|
60
|
+
.eq("id", credential_id)
|
|
61
|
+
.select("*")
|
|
62
|
+
.single();
|
|
63
|
+
if (error) {
|
|
64
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
65
|
+
}
|
|
66
|
+
if (!data) {
|
|
67
|
+
return IWebResponse.error("User credential not found").to_compatible();
|
|
68
|
+
}
|
|
69
|
+
return IWebResponse.success(data).to_compatible();
|
|
70
|
+
}
|
|
71
|
+
export async function delete_user_credential(client, credential_id) {
|
|
72
|
+
const { data, error } = await client
|
|
73
|
+
.from("user_credentials")
|
|
74
|
+
.delete()
|
|
75
|
+
.eq("id", credential_id)
|
|
76
|
+
.select("*")
|
|
77
|
+
.single();
|
|
78
|
+
if (error) {
|
|
79
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
80
|
+
}
|
|
81
|
+
if (!data) {
|
|
82
|
+
return IWebResponse.error("User credential not found").to_compatible();
|
|
83
|
+
}
|
|
84
|
+
return IWebResponse.success(data).to_compatible();
|
|
85
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
import type { IDevice } from "../types/db";
|
|
3
|
+
import type { IHerdModule } from "../types/herd_module";
|
|
4
|
+
export declare function primeDeviceDisplayNameCache(devices: Iterable<IDevice>): void;
|
|
5
|
+
export declare function useDeviceDisplayName(deviceId: number | null | undefined, options?: {
|
|
6
|
+
herdModules?: IHerdModule[];
|
|
7
|
+
supabase?: SupabaseClient;
|
|
8
|
+
}): string | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { formatDeviceDisplayName } from "../helpers/ui";
|
|
4
|
+
const labelByDeviceId = new Map();
|
|
5
|
+
function rememberDevice(device) {
|
|
6
|
+
if (device.id == null)
|
|
7
|
+
return;
|
|
8
|
+
labelByDeviceId.set(device.id, formatDeviceDisplayName(device));
|
|
9
|
+
}
|
|
10
|
+
export function primeDeviceDisplayNameCache(devices) {
|
|
11
|
+
for (const device of devices)
|
|
12
|
+
rememberDevice(device);
|
|
13
|
+
}
|
|
14
|
+
export function useDeviceDisplayName(deviceId, options = {}) {
|
|
15
|
+
const [, setTick] = useState(0);
|
|
16
|
+
const bump = () => setTick(t => t + 1);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!options.herdModules?.length)
|
|
19
|
+
return;
|
|
20
|
+
for (const hm of options.herdModules) {
|
|
21
|
+
for (const device of hm.devices ?? [])
|
|
22
|
+
rememberDevice(device);
|
|
23
|
+
}
|
|
24
|
+
bump();
|
|
25
|
+
}, [options.herdModules]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (deviceId == null || labelByDeviceId.has(deviceId) || !options.supabase) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let cancelled = false;
|
|
31
|
+
options.supabase
|
|
32
|
+
.from("devices")
|
|
33
|
+
.select("id, name, domain_name, description")
|
|
34
|
+
.eq("id", deviceId)
|
|
35
|
+
.maybeSingle()
|
|
36
|
+
.then(({ data }) => {
|
|
37
|
+
if (cancelled || !data)
|
|
38
|
+
return;
|
|
39
|
+
rememberDevice(data);
|
|
40
|
+
bump();
|
|
41
|
+
});
|
|
42
|
+
return () => {
|
|
43
|
+
cancelled = true;
|
|
44
|
+
};
|
|
45
|
+
}, [deviceId, options.supabase]);
|
|
46
|
+
if (deviceId == null)
|
|
47
|
+
return null;
|
|
48
|
+
return labelByDeviceId.get(deviceId) ?? `Device ${deviceId}`;
|
|
49
|
+
}
|
package/dist/types/db.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export type IPin = Database["public"]["CompositeTypes"]["pins_pretty_location"];
|
|
|
19
19
|
export type IEvent = Database["public"]["Tables"]["events"]["Row"];
|
|
20
20
|
export type ITag = Database["public"]["Tables"]["tags"]["Row"];
|
|
21
21
|
export type ITagPrettyLocation = Database["public"]["CompositeTypes"]["tags_pretty_location"];
|
|
22
|
+
export type IModel = Database["public"]["Tables"]["models"]["Row"];
|
|
23
|
+
export type IModelsPerJobsPerHerd = Database["public"]["Tables"]["models_per_jobs_per_herd"]["Row"];
|
|
22
24
|
export type ISegmentationSam3 = Database["public"]["Tables"]["segmentations_sam3"]["Row"];
|
|
23
25
|
export type ISegmentationSam3Pretty = Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"];
|
|
24
26
|
export type IPlan = Database["public"]["Tables"]["plans"]["Row"];
|
|
@@ -57,6 +59,8 @@ export type IObservation = Database["public"]["Tables"]["observations"]["Row"];
|
|
|
57
59
|
export type IProvider = Database["public"]["Tables"]["providers"]["Row"];
|
|
58
60
|
export type IPart = Database["public"]["Tables"]["parts"]["Row"];
|
|
59
61
|
export type ICredential = Database["public"]["Tables"]["credentials"]["Row"];
|
|
62
|
+
export type IUserCredential = Database["public"]["Tables"]["user_credentials"]["Row"];
|
|
63
|
+
export type IHerdCredential = Database["public"]["Tables"]["herd_credentials"]["Row"];
|
|
60
64
|
export type IPointsForUser = Database["public"]["Tables"]["points_for_user"]["Row"];
|
|
61
65
|
export type ICertificate = Database["public"]["Tables"]["certificates"]["Row"];
|
|
62
66
|
export type IVersionsSoftware = Database["public"]["Tables"]["versions_software"]["Row"];
|
|
@@ -100,6 +104,13 @@ export type ISessionUsageOverTime = Database["public"]["Functions"]["get_session
|
|
|
100
104
|
export type PartInsert = Database["public"]["Tables"]["parts"]["Insert"];
|
|
101
105
|
export type CredentialInsert = Database["public"]["Tables"]["credentials"]["Insert"];
|
|
102
106
|
export type CredentialUpdate = Database["public"]["Tables"]["credentials"]["Update"];
|
|
107
|
+
export type UserCredentialInsert = Database["public"]["Tables"]["user_credentials"]["Insert"];
|
|
108
|
+
export type UserCredentialUpdate = Database["public"]["Tables"]["user_credentials"]["Update"];
|
|
109
|
+
export type HerdCredentialInsert = Database["public"]["Tables"]["herd_credentials"]["Insert"];
|
|
110
|
+
export type HerdCredentialUpdate = Database["public"]["Tables"]["herd_credentials"]["Update"];
|
|
111
|
+
export interface CredentialQueryArgs {
|
|
112
|
+
type?: string;
|
|
113
|
+
}
|
|
103
114
|
export type PointsForUserInsert = Database["public"]["Tables"]["points_for_user"]["Insert"];
|
|
104
115
|
export type PointsForUserUpdate = Database["public"]["Tables"]["points_for_user"]["Update"];
|
|
105
116
|
export type CertificateInsert = Database["public"]["Tables"]["certificates"]["Insert"];
|
package/dist/types/supabase.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type Json = string | number | boolean | null | {
|
|
|
3
3
|
} | Json[];
|
|
4
4
|
export type Database = {
|
|
5
5
|
__InternalSupabase: {
|
|
6
|
-
PostgrestVersion: "14.
|
|
6
|
+
PostgrestVersion: "14.5";
|
|
7
7
|
};
|
|
8
8
|
public: {
|
|
9
9
|
Tables: {
|
|
@@ -932,6 +932,69 @@ export type Database = {
|
|
|
932
932
|
}
|
|
933
933
|
];
|
|
934
934
|
};
|
|
935
|
+
herd_credentials: {
|
|
936
|
+
Row: {
|
|
937
|
+
created_at: string;
|
|
938
|
+
expiration: string | null;
|
|
939
|
+
file_uri: string | null;
|
|
940
|
+
herd_id: number;
|
|
941
|
+
id: number;
|
|
942
|
+
issuer: string;
|
|
943
|
+
lifecycle: Database["public"]["Enums"]["entity_lifecycle"];
|
|
944
|
+
lifecycle_changed_at: string;
|
|
945
|
+
lifecycle_changed_by: string | null;
|
|
946
|
+
lifecycle_reason: string | null;
|
|
947
|
+
tracking_number: string | null;
|
|
948
|
+
type: string;
|
|
949
|
+
updated_at: string;
|
|
950
|
+
};
|
|
951
|
+
Insert: {
|
|
952
|
+
created_at?: string;
|
|
953
|
+
expiration?: string | null;
|
|
954
|
+
file_uri?: string | null;
|
|
955
|
+
herd_id: number;
|
|
956
|
+
id?: number;
|
|
957
|
+
issuer: string;
|
|
958
|
+
lifecycle?: Database["public"]["Enums"]["entity_lifecycle"];
|
|
959
|
+
lifecycle_changed_at?: string;
|
|
960
|
+
lifecycle_changed_by?: string | null;
|
|
961
|
+
lifecycle_reason?: string | null;
|
|
962
|
+
tracking_number?: string | null;
|
|
963
|
+
type: string;
|
|
964
|
+
updated_at?: string;
|
|
965
|
+
};
|
|
966
|
+
Update: {
|
|
967
|
+
created_at?: string;
|
|
968
|
+
expiration?: string | null;
|
|
969
|
+
file_uri?: string | null;
|
|
970
|
+
herd_id?: number;
|
|
971
|
+
id?: number;
|
|
972
|
+
issuer?: string;
|
|
973
|
+
lifecycle?: Database["public"]["Enums"]["entity_lifecycle"];
|
|
974
|
+
lifecycle_changed_at?: string;
|
|
975
|
+
lifecycle_changed_by?: string | null;
|
|
976
|
+
lifecycle_reason?: string | null;
|
|
977
|
+
tracking_number?: string | null;
|
|
978
|
+
type?: string;
|
|
979
|
+
updated_at?: string;
|
|
980
|
+
};
|
|
981
|
+
Relationships: [
|
|
982
|
+
{
|
|
983
|
+
foreignKeyName: "herd_credentials_herd_id_fkey";
|
|
984
|
+
columns: ["herd_id"];
|
|
985
|
+
isOneToOne: false;
|
|
986
|
+
referencedRelation: "herds";
|
|
987
|
+
referencedColumns: ["id"];
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
foreignKeyName: "herd_credentials_lifecycle_changed_by_fkey";
|
|
991
|
+
columns: ["lifecycle_changed_by"];
|
|
992
|
+
isOneToOne: false;
|
|
993
|
+
referencedRelation: "users";
|
|
994
|
+
referencedColumns: ["id"];
|
|
995
|
+
}
|
|
996
|
+
];
|
|
997
|
+
};
|
|
935
998
|
herd_invitations: {
|
|
936
999
|
Row: {
|
|
937
1000
|
accepted_at: string | null;
|
|
@@ -1943,6 +2006,69 @@ export type Database = {
|
|
|
1943
2006
|
}
|
|
1944
2007
|
];
|
|
1945
2008
|
};
|
|
2009
|
+
user_credentials: {
|
|
2010
|
+
Row: {
|
|
2011
|
+
created_at: string;
|
|
2012
|
+
expiration: string | null;
|
|
2013
|
+
file_uri: string | null;
|
|
2014
|
+
id: number;
|
|
2015
|
+
issuer: string;
|
|
2016
|
+
lifecycle: Database["public"]["Enums"]["entity_lifecycle"];
|
|
2017
|
+
lifecycle_changed_at: string;
|
|
2018
|
+
lifecycle_changed_by: string | null;
|
|
2019
|
+
lifecycle_reason: string | null;
|
|
2020
|
+
tracking_number: string | null;
|
|
2021
|
+
type: string;
|
|
2022
|
+
updated_at: string;
|
|
2023
|
+
user_id: string;
|
|
2024
|
+
};
|
|
2025
|
+
Insert: {
|
|
2026
|
+
created_at?: string;
|
|
2027
|
+
expiration?: string | null;
|
|
2028
|
+
file_uri?: string | null;
|
|
2029
|
+
id?: number;
|
|
2030
|
+
issuer: string;
|
|
2031
|
+
lifecycle?: Database["public"]["Enums"]["entity_lifecycle"];
|
|
2032
|
+
lifecycle_changed_at?: string;
|
|
2033
|
+
lifecycle_changed_by?: string | null;
|
|
2034
|
+
lifecycle_reason?: string | null;
|
|
2035
|
+
tracking_number?: string | null;
|
|
2036
|
+
type: string;
|
|
2037
|
+
updated_at?: string;
|
|
2038
|
+
user_id: string;
|
|
2039
|
+
};
|
|
2040
|
+
Update: {
|
|
2041
|
+
created_at?: string;
|
|
2042
|
+
expiration?: string | null;
|
|
2043
|
+
file_uri?: string | null;
|
|
2044
|
+
id?: number;
|
|
2045
|
+
issuer?: string;
|
|
2046
|
+
lifecycle?: Database["public"]["Enums"]["entity_lifecycle"];
|
|
2047
|
+
lifecycle_changed_at?: string;
|
|
2048
|
+
lifecycle_changed_by?: string | null;
|
|
2049
|
+
lifecycle_reason?: string | null;
|
|
2050
|
+
tracking_number?: string | null;
|
|
2051
|
+
type?: string;
|
|
2052
|
+
updated_at?: string;
|
|
2053
|
+
user_id?: string;
|
|
2054
|
+
};
|
|
2055
|
+
Relationships: [
|
|
2056
|
+
{
|
|
2057
|
+
foreignKeyName: "user_credentials_lifecycle_changed_by_fkey";
|
|
2058
|
+
columns: ["lifecycle_changed_by"];
|
|
2059
|
+
isOneToOne: false;
|
|
2060
|
+
referencedRelation: "users";
|
|
2061
|
+
referencedColumns: ["id"];
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
foreignKeyName: "user_credentials_user_id_fkey";
|
|
2065
|
+
columns: ["user_id"];
|
|
2066
|
+
isOneToOne: false;
|
|
2067
|
+
referencedRelation: "users";
|
|
2068
|
+
referencedColumns: ["id"];
|
|
2069
|
+
}
|
|
2070
|
+
];
|
|
2071
|
+
};
|
|
1946
2072
|
users: {
|
|
1947
2073
|
Row: {
|
|
1948
2074
|
auto_approve_sessions: boolean;
|
|
@@ -2313,6 +2439,10 @@ export type Database = {
|
|
|
2313
2439
|
isSetofReturn: true;
|
|
2314
2440
|
};
|
|
2315
2441
|
};
|
|
2442
|
+
auto_assign_session_post_approver: {
|
|
2443
|
+
Args: never;
|
|
2444
|
+
Returns: number;
|
|
2445
|
+
};
|
|
2316
2446
|
check_realtime_schema_status: {
|
|
2317
2447
|
Args: never;
|
|
2318
2448
|
Returns: {
|
|
@@ -3237,16 +3367,6 @@ export type Database = {
|
|
|
3237
3367
|
};
|
|
3238
3368
|
};
|
|
3239
3369
|
get_session_summaries: {
|
|
3240
|
-
Args: {
|
|
3241
|
-
device_id_caller?: number;
|
|
3242
|
-
end_date_caller?: string;
|
|
3243
|
-
herd_id_caller?: number;
|
|
3244
|
-
min_distance_meters_caller?: number;
|
|
3245
|
-
min_duration_minutes_caller?: number;
|
|
3246
|
-
start_date_caller?: string;
|
|
3247
|
-
};
|
|
3248
|
-
Returns: Json;
|
|
3249
|
-
} | {
|
|
3250
3370
|
Args: {
|
|
3251
3371
|
device_id_caller?: number;
|
|
3252
3372
|
end_date_caller?: string;
|
|
@@ -3259,16 +3379,6 @@ export type Database = {
|
|
|
3259
3379
|
Returns: Json;
|
|
3260
3380
|
};
|
|
3261
3381
|
get_session_usage_over_time: {
|
|
3262
|
-
Args: {
|
|
3263
|
-
device_id_caller?: number;
|
|
3264
|
-
end_date_caller?: string;
|
|
3265
|
-
herd_id_caller?: number;
|
|
3266
|
-
min_distance_meters_caller?: number;
|
|
3267
|
-
min_duration_minutes_caller?: number;
|
|
3268
|
-
start_date_caller?: string;
|
|
3269
|
-
};
|
|
3270
|
-
Returns: Json;
|
|
3271
|
-
} | {
|
|
3272
3382
|
Args: {
|
|
3273
3383
|
device_id_caller?: number;
|
|
3274
3384
|
end_date_caller?: string;
|
|
@@ -3534,6 +3644,21 @@ export type Database = {
|
|
|
3534
3644
|
isSetofReturn: true;
|
|
3535
3645
|
};
|
|
3536
3646
|
};
|
|
3647
|
+
migrate_conservaition_users_to_sentala: {
|
|
3648
|
+
Args: {
|
|
3649
|
+
preview?: boolean;
|
|
3650
|
+
source_domains?: string[];
|
|
3651
|
+
target_domain?: string;
|
|
3652
|
+
};
|
|
3653
|
+
Returns: {
|
|
3654
|
+
action: string;
|
|
3655
|
+
detail: string;
|
|
3656
|
+
source_email: string;
|
|
3657
|
+
source_user_id: string;
|
|
3658
|
+
target_email: string;
|
|
3659
|
+
target_user_id: string;
|
|
3660
|
+
}[];
|
|
3661
|
+
};
|
|
3537
3662
|
preview_fix_all_sessions_missing_distance: {
|
|
3538
3663
|
Args: never;
|
|
3539
3664
|
Returns: {
|