@adventurelabs/scout-core 1.4.47 → 1.4.49
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/auth.d.ts +3 -0
- package/dist/helpers/auth.js +8 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/segmentations_sam3.d.ts +18 -0
- package/dist/helpers/segmentations_sam3.js +91 -0
- package/dist/helpers/sessions.js +18 -1
- package/dist/helpers/tags.d.ts +18 -5
- package/dist/helpers/tags.js +82 -4
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useScoutRealtimeAnalysisJobs.d.ts +5 -0
- package/dist/hooks/useScoutRealtimeAnalysisJobs.js +61 -0
- package/dist/hooks/useScoutRealtimeAnalysisTasks.d.ts +5 -0
- package/dist/hooks/useScoutRealtimeAnalysisTasks.js +61 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/providers/ScoutRefreshProvider.d.ts +145 -0
- package/dist/types/db.d.ts +3 -0
- package/dist/types/supabase.d.ts +145 -0
- package/package.json +1 -1
package/dist/helpers/auth.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
import { Database } from "../types/supabase";
|
|
1
3
|
export declare function isEmailValidForLogin(email: string, approved_domains?: string[]): boolean;
|
|
4
|
+
export declare function isCurrentUserPlatformSuperadmin(client: SupabaseClient<Database>): Promise<boolean>;
|
package/dist/helpers/auth.js
CHANGED
|
@@ -6,3 +6,11 @@ export function isEmailValidForLogin(email, approved_domains = APPROVED_DOMAINS)
|
|
|
6
6
|
function isEmailFromApprovedDomain(email, approved_domains = APPROVED_DOMAINS) {
|
|
7
7
|
return approved_domains.filter((domain) => email.endsWith(domain)).length > 0;
|
|
8
8
|
}
|
|
9
|
+
export async function isCurrentUserPlatformSuperadmin(client) {
|
|
10
|
+
const { data, error } = await client.rpc("is_platform_superadmin_current_user");
|
|
11
|
+
if (error) {
|
|
12
|
+
console.warn("[scout-core auth] Failed to check platform superadmin status:", error.message);
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return data === true;
|
|
16
|
+
}
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers/index.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ISegmentationSam3Pretty } from "../types/db";
|
|
2
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
3
|
+
/** SAM3 masks for an artifact; optional timestamp_observation range and max_elements (omit or null for no limit). */
|
|
4
|
+
export declare function server_get_segmentations_sam3_for_artifact(artifactId: number, options?: {
|
|
5
|
+
start_timestamp?: string | null;
|
|
6
|
+
end_timestamp?: string | null;
|
|
7
|
+
max_elements?: number | null;
|
|
8
|
+
}): Promise<IWebResponseCompatible<ISegmentationSam3Pretty[]>>;
|
|
9
|
+
/** SAM3 masks for an event; optional timestamp_observation range and max_elements (omit or null for no limit). */
|
|
10
|
+
export declare function server_get_segmentations_sam3_for_event(eventId: number, options?: {
|
|
11
|
+
start_timestamp?: string | null;
|
|
12
|
+
end_timestamp?: string | null;
|
|
13
|
+
max_elements?: number | null;
|
|
14
|
+
}): Promise<IWebResponseCompatible<ISegmentationSam3Pretty[]>>;
|
|
15
|
+
/** SAM3 masks for an artifact by inclusive frame_index range; optional min_conf and max_elements (omit or null for no limit on rows). */
|
|
16
|
+
export declare function server_get_segmentations_sam3_for_artifact_by_frame_index(artifactId: number, frameIndexStart: number, frameIndexEnd: number, minConf?: number | null, maxElements?: number | null): Promise<IWebResponseCompatible<ISegmentationSam3Pretty[]>>;
|
|
17
|
+
/** SAM3 masks for an artifact and subject_id; omit maxElements (or null) for no row limit. */
|
|
18
|
+
export declare function server_get_segmentations_sam3_for_artifact_by_subject_id(artifactId: number, subjectId: number, maxElements?: number | null): Promise<IWebResponseCompatible<ISegmentationSam3Pretty[]>>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { newServerClient } from "../supabase/server";
|
|
3
|
+
import { EnumWebResponse, IWebResponse, } from "../types/requests";
|
|
4
|
+
/** SAM3 masks for an artifact; optional timestamp_observation range and max_elements (omit or null for no limit). */
|
|
5
|
+
export async function server_get_segmentations_sam3_for_artifact(artifactId, options) {
|
|
6
|
+
const supabase = await newServerClient();
|
|
7
|
+
const { data, error } = await supabase.rpc("get_segmentations_sam3_for_artifact", {
|
|
8
|
+
artifact_id_caller: artifactId,
|
|
9
|
+
...(options?.start_timestamp != null && {
|
|
10
|
+
start_timestamp_caller: options.start_timestamp,
|
|
11
|
+
}),
|
|
12
|
+
...(options?.end_timestamp != null && {
|
|
13
|
+
end_timestamp_caller: options.end_timestamp,
|
|
14
|
+
}),
|
|
15
|
+
...(options?.max_elements != null && {
|
|
16
|
+
max_elements_caller: options.max_elements,
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
if (error) {
|
|
20
|
+
console.warn("Error fetching segmentations_sam3 for artifact:", error.message);
|
|
21
|
+
return {
|
|
22
|
+
status: EnumWebResponse.ERROR,
|
|
23
|
+
msg: error.message,
|
|
24
|
+
data: [],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
28
|
+
}
|
|
29
|
+
/** SAM3 masks for an event; optional timestamp_observation range and max_elements (omit or null for no limit). */
|
|
30
|
+
export async function server_get_segmentations_sam3_for_event(eventId, options) {
|
|
31
|
+
const supabase = await newServerClient();
|
|
32
|
+
const { data, error } = await supabase.rpc("get_segmentations_sam3_for_event", {
|
|
33
|
+
event_id_caller: eventId,
|
|
34
|
+
...(options?.start_timestamp != null && {
|
|
35
|
+
start_timestamp_caller: options.start_timestamp,
|
|
36
|
+
}),
|
|
37
|
+
...(options?.end_timestamp != null && {
|
|
38
|
+
end_timestamp_caller: options.end_timestamp,
|
|
39
|
+
}),
|
|
40
|
+
...(options?.max_elements != null && {
|
|
41
|
+
max_elements_caller: options.max_elements,
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
if (error) {
|
|
45
|
+
console.warn("Error fetching segmentations_sam3 for event:", error.message);
|
|
46
|
+
return {
|
|
47
|
+
status: EnumWebResponse.ERROR,
|
|
48
|
+
msg: error.message,
|
|
49
|
+
data: [],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
53
|
+
}
|
|
54
|
+
/** SAM3 masks for an artifact by inclusive frame_index range; optional min_conf and max_elements (omit or null for no limit on rows). */
|
|
55
|
+
export async function server_get_segmentations_sam3_for_artifact_by_frame_index(artifactId, frameIndexStart, frameIndexEnd, minConf = null, maxElements = null) {
|
|
56
|
+
const supabase = await newServerClient();
|
|
57
|
+
const { data, error } = await supabase.rpc("get_segmentations_sam3_for_artifact_by_frame_index", {
|
|
58
|
+
artifact_id_caller: artifactId,
|
|
59
|
+
frame_index_start_caller: frameIndexStart,
|
|
60
|
+
frame_index_end_caller: frameIndexEnd,
|
|
61
|
+
...(minConf != null && { min_conf_caller: minConf }),
|
|
62
|
+
...(maxElements != null && { max_elements_caller: maxElements }),
|
|
63
|
+
});
|
|
64
|
+
if (error) {
|
|
65
|
+
console.warn("Error fetching segmentations_sam3 for artifact by frame index:", error.message);
|
|
66
|
+
return {
|
|
67
|
+
status: EnumWebResponse.ERROR,
|
|
68
|
+
msg: error.message,
|
|
69
|
+
data: [],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
73
|
+
}
|
|
74
|
+
/** SAM3 masks for an artifact and subject_id; omit maxElements (or null) for no row limit. */
|
|
75
|
+
export async function server_get_segmentations_sam3_for_artifact_by_subject_id(artifactId, subjectId, maxElements = null) {
|
|
76
|
+
const supabase = await newServerClient();
|
|
77
|
+
const { data, error } = await supabase.rpc("get_segmentations_sam3_for_artifact_by_subject_id", {
|
|
78
|
+
artifact_id_caller: artifactId,
|
|
79
|
+
subject_id_caller: subjectId,
|
|
80
|
+
...(maxElements != null && { max_elements_caller: maxElements }),
|
|
81
|
+
});
|
|
82
|
+
if (error) {
|
|
83
|
+
console.warn("Error fetching segmentations_sam3 for artifact by subject id:", error.message);
|
|
84
|
+
return {
|
|
85
|
+
status: EnumWebResponse.ERROR,
|
|
86
|
+
msg: error.message,
|
|
87
|
+
data: [],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
91
|
+
}
|
package/dist/helpers/sessions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { newServerClient } from "../supabase/server";
|
|
3
3
|
import { EnumWebResponse, IWebResponse, } from "../types/requests";
|
|
4
|
+
import { generateSignedUrlsBatch } from "./storage";
|
|
4
5
|
// Get session by ID with coordinates
|
|
5
6
|
export async function server_get_session_by_id(sessionId, client) {
|
|
6
7
|
const supabase = client || (await newServerClient());
|
|
@@ -69,7 +70,23 @@ export async function server_get_events_and_tags_by_session_id(sessionId, limit
|
|
|
69
70
|
data: [],
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
const eventData = (data || []);
|
|
74
|
+
const filePaths = eventData
|
|
75
|
+
.map((event) => event.file_path)
|
|
76
|
+
.filter((path) => !!path);
|
|
77
|
+
let eventsWithSignedUrls = eventData;
|
|
78
|
+
if (filePaths.length > 0) {
|
|
79
|
+
const signedUrls = await generateSignedUrlsBatch(filePaths, undefined, supabase);
|
|
80
|
+
const urlMap = new Map();
|
|
81
|
+
filePaths.forEach((path, index) => {
|
|
82
|
+
urlMap.set(path, signedUrls[index]);
|
|
83
|
+
});
|
|
84
|
+
eventsWithSignedUrls = eventData.map((event) => ({
|
|
85
|
+
...event,
|
|
86
|
+
media_url: event.file_path ? urlMap.get(event.file_path) || null : null,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
return IWebResponse.success(eventsWithSignedUrls).to_compatible();
|
|
73
90
|
}
|
|
74
91
|
// Insert new sessions (accepts array for batch operations)
|
|
75
92
|
export async function server_insert_session(sessions, client) {
|
package/dist/helpers/tags.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEventAndTagsPrettyLocation, ITag, ITagPrettyLocation } from "../types/db";
|
|
1
|
+
import { IEventAndTagsPrettyLocation, IMinimalSubjectForArtifact, ITag, ITagPrettyLocation } from "../types/db";
|
|
2
2
|
import { IWebResponseCompatible } from "../types/requests";
|
|
3
3
|
export declare function test_event_loading(device_id: number): Promise<boolean>;
|
|
4
4
|
export declare function server_create_tags(tags: ITag[]): Promise<IWebResponseCompatible<ITag[]>>;
|
|
@@ -10,15 +10,28 @@ export declare function server_get_events_and_tags_for_devices_batch(device_ids:
|
|
|
10
10
|
[device_id: number]: IEventAndTagsPrettyLocation[];
|
|
11
11
|
}>>;
|
|
12
12
|
export declare function get_event_and_tags_by_event_id(event_id: number): Promise<IWebResponseCompatible<IEventAndTagsPrettyLocation>>;
|
|
13
|
-
/** Tags for an artifact with optional timestamp range and
|
|
13
|
+
/** Tags for an artifact with optional timestamp range, detector filter, and max_elements (omit or null for no limit). */
|
|
14
14
|
export declare function server_get_tags_for_artifact(artifactId: number, options?: {
|
|
15
15
|
start_timestamp?: string | null;
|
|
16
16
|
end_timestamp?: string | null;
|
|
17
|
-
max_elements?: number;
|
|
17
|
+
max_elements?: number | null;
|
|
18
|
+
detection_models?: string[] | null;
|
|
18
19
|
}): Promise<IWebResponseCompatible<ITagPrettyLocation[]>>;
|
|
19
|
-
/** Tags for an
|
|
20
|
+
/** Tags for an artifact filtered by frame_index range and minimum confidence. Omit maxElements (or pass null) for no row limit. */
|
|
21
|
+
export declare function server_get_tags_for_artifact_by_frame_index(artifactId: number, minConf: number, frameIndexStart: number, frameIndexEnd: number, detection_models?: string[] | null, maxElements?: number | null): Promise<IWebResponseCompatible<ITagPrettyLocation[]>>;
|
|
22
|
+
/** Tags for an artifact and subject_id. Omit maxElements (or pass null) for no row limit. */
|
|
23
|
+
export declare function server_get_tags_for_artifact_by_subject_id(artifactId: number, subjectId: number, detection_models?: string[] | null, maxElements?: number | null): Promise<IWebResponseCompatible<ITagPrettyLocation[]>>;
|
|
24
|
+
/** Per-subject aggregates for tags on an artifact (rows with subject_id only). Optional min_avg_conf / min_count / detection_models; max_elements caps subject rows (omit or null for no cap). */
|
|
25
|
+
export declare function server_get_minimal_subjects_for_artifact(artifactId: number, options?: {
|
|
26
|
+
min_avg_conf?: number | null;
|
|
27
|
+
min_count?: number | null;
|
|
28
|
+
detection_models?: string[] | null;
|
|
29
|
+
max_elements?: number | null;
|
|
30
|
+
}): Promise<IWebResponseCompatible<IMinimalSubjectForArtifact[]>>;
|
|
31
|
+
/** Tags for an event with optional timestamp range, detector filter, and max_elements (omit or null for no limit). */
|
|
20
32
|
export declare function server_get_tags_for_event(eventId: number, options?: {
|
|
21
33
|
start_timestamp?: string | null;
|
|
22
34
|
end_timestamp?: string | null;
|
|
23
|
-
max_elements?: number;
|
|
35
|
+
max_elements?: number | null;
|
|
36
|
+
detection_models?: string[] | null;
|
|
24
37
|
}): Promise<IWebResponseCompatible<ITagPrettyLocation[]>>;
|
package/dist/helpers/tags.js
CHANGED
|
@@ -54,6 +54,12 @@ function extractLongitude(location) {
|
|
|
54
54
|
}
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
|
+
function rpcDetectorModelsParam(detection_models) {
|
|
58
|
+
if (detection_models != null && detection_models.length > 0) {
|
|
59
|
+
return { detector_models_caller: detection_models };
|
|
60
|
+
}
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
57
63
|
// Test function to verify individual event loading works
|
|
58
64
|
export async function test_event_loading(device_id) {
|
|
59
65
|
try {
|
|
@@ -457,18 +463,21 @@ export async function get_event_and_tags_by_event_id(event_id) {
|
|
|
457
463
|
}
|
|
458
464
|
return IWebResponse.success(eventWithSignedUrl).to_compatible();
|
|
459
465
|
}
|
|
460
|
-
/** Tags for an artifact with optional timestamp range and
|
|
466
|
+
/** Tags for an artifact with optional timestamp range, detector filter, and max_elements (omit or null for no limit). */
|
|
461
467
|
export async function server_get_tags_for_artifact(artifactId, options) {
|
|
462
468
|
const supabase = await newServerClient();
|
|
463
469
|
const { data, error } = await supabase.rpc("get_tags_for_artifact", {
|
|
464
470
|
artifact_id_caller: artifactId,
|
|
465
|
-
max_elements_caller: options?.max_elements ?? 1000,
|
|
466
471
|
...(options?.start_timestamp != null && {
|
|
467
472
|
start_timestamp_caller: options.start_timestamp,
|
|
468
473
|
}),
|
|
469
474
|
...(options?.end_timestamp != null && {
|
|
470
475
|
end_timestamp_caller: options.end_timestamp,
|
|
471
476
|
}),
|
|
477
|
+
...rpcDetectorModelsParam(options?.detection_models),
|
|
478
|
+
...(options?.max_elements != null && {
|
|
479
|
+
max_elements_caller: options.max_elements,
|
|
480
|
+
}),
|
|
472
481
|
});
|
|
473
482
|
if (error) {
|
|
474
483
|
console.warn("Error fetching tags for artifact:", error.message);
|
|
@@ -480,18 +489,87 @@ export async function server_get_tags_for_artifact(artifactId, options) {
|
|
|
480
489
|
}
|
|
481
490
|
return IWebResponse.success(data ?? []).to_compatible();
|
|
482
491
|
}
|
|
483
|
-
/** Tags for an
|
|
492
|
+
/** Tags for an artifact filtered by frame_index range and minimum confidence. Omit maxElements (or pass null) for no row limit. */
|
|
493
|
+
export async function server_get_tags_for_artifact_by_frame_index(artifactId, minConf, frameIndexStart, frameIndexEnd, detection_models = null, maxElements = null) {
|
|
494
|
+
const supabase = await newServerClient();
|
|
495
|
+
const { data, error } = await supabase.rpc("get_tags_for_artifact_by_frame_index", {
|
|
496
|
+
artifact_id_caller: artifactId,
|
|
497
|
+
min_conf_caller: minConf,
|
|
498
|
+
frame_index_start_caller: frameIndexStart,
|
|
499
|
+
frame_index_end_caller: frameIndexEnd,
|
|
500
|
+
...rpcDetectorModelsParam(detection_models),
|
|
501
|
+
...(maxElements != null && { max_elements_caller: maxElements }),
|
|
502
|
+
});
|
|
503
|
+
if (error) {
|
|
504
|
+
console.warn("Error fetching tags for artifact by frame index:", error.message);
|
|
505
|
+
return {
|
|
506
|
+
status: EnumWebResponse.ERROR,
|
|
507
|
+
msg: error.message,
|
|
508
|
+
data: [],
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
512
|
+
}
|
|
513
|
+
/** Tags for an artifact and subject_id. Omit maxElements (or pass null) for no row limit. */
|
|
514
|
+
export async function server_get_tags_for_artifact_by_subject_id(artifactId, subjectId, detection_models = null, maxElements = null) {
|
|
515
|
+
const supabase = await newServerClient();
|
|
516
|
+
const { data, error } = await supabase.rpc("get_tags_for_artifact_by_subject_id", {
|
|
517
|
+
artifact_id_caller: artifactId,
|
|
518
|
+
subject_id_caller: subjectId,
|
|
519
|
+
...rpcDetectorModelsParam(detection_models),
|
|
520
|
+
...(maxElements != null && { max_elements_caller: maxElements }),
|
|
521
|
+
});
|
|
522
|
+
if (error) {
|
|
523
|
+
console.warn("Error fetching tags for artifact by subject id:", error.message);
|
|
524
|
+
return {
|
|
525
|
+
status: EnumWebResponse.ERROR,
|
|
526
|
+
msg: error.message,
|
|
527
|
+
data: [],
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
531
|
+
}
|
|
532
|
+
/** Per-subject aggregates for tags on an artifact (rows with subject_id only). Optional min_avg_conf / min_count / detection_models; max_elements caps subject rows (omit or null for no cap). */
|
|
533
|
+
export async function server_get_minimal_subjects_for_artifact(artifactId, options) {
|
|
534
|
+
const supabase = await newServerClient();
|
|
535
|
+
const { data, error } = await supabase.rpc("get_minimal_subjects_for_artifact", {
|
|
536
|
+
artifact_id_caller: artifactId,
|
|
537
|
+
...(options?.min_avg_conf != null && {
|
|
538
|
+
min_avg_conf_caller: options.min_avg_conf,
|
|
539
|
+
}),
|
|
540
|
+
...(options?.min_count != null && {
|
|
541
|
+
min_count_caller: options.min_count,
|
|
542
|
+
}),
|
|
543
|
+
...rpcDetectorModelsParam(options?.detection_models),
|
|
544
|
+
...(options?.max_elements != null && {
|
|
545
|
+
max_elements_caller: options.max_elements,
|
|
546
|
+
}),
|
|
547
|
+
});
|
|
548
|
+
if (error) {
|
|
549
|
+
console.warn("Error fetching minimal subjects for artifact:", error.message);
|
|
550
|
+
return {
|
|
551
|
+
status: EnumWebResponse.ERROR,
|
|
552
|
+
msg: error.message,
|
|
553
|
+
data: [],
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
557
|
+
}
|
|
558
|
+
/** Tags for an event with optional timestamp range, detector filter, and max_elements (omit or null for no limit). */
|
|
484
559
|
export async function server_get_tags_for_event(eventId, options) {
|
|
485
560
|
const supabase = await newServerClient();
|
|
486
561
|
const { data, error } = await supabase.rpc("get_tags_for_event", {
|
|
487
562
|
event_id_caller: eventId,
|
|
488
|
-
max_elements_caller: options?.max_elements ?? 1000,
|
|
489
563
|
...(options?.start_timestamp != null && {
|
|
490
564
|
start_timestamp_caller: options.start_timestamp,
|
|
491
565
|
}),
|
|
492
566
|
...(options?.end_timestamp != null && {
|
|
493
567
|
end_timestamp_caller: options.end_timestamp,
|
|
494
568
|
}),
|
|
569
|
+
...rpcDetectorModelsParam(options?.detection_models),
|
|
570
|
+
...(options?.max_elements != null && {
|
|
571
|
+
max_elements_caller: options.max_elements,
|
|
572
|
+
}),
|
|
495
573
|
});
|
|
496
574
|
if (error) {
|
|
497
575
|
console.warn("Error fetching tags for event:", error.message);
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -8,5 +8,7 @@ export { useScoutRealtimeSessions } from "./useScoutRealtimeSessions";
|
|
|
8
8
|
export { useScoutRealtimePlans } from "./useScoutRealtimePlans";
|
|
9
9
|
export { useScoutRealtimePins } from "./useScoutRealtimePins";
|
|
10
10
|
export { useScoutRealtimeParts } from "./useScoutRealtimeParts";
|
|
11
|
+
export { useScoutRealtimeAnalysisJobs } from "./useScoutRealtimeAnalysisJobs";
|
|
12
|
+
export { useScoutRealtimeAnalysisTasks } from "./useScoutRealtimeAnalysisTasks";
|
|
11
13
|
export { useInfiniteSessionsByHerd, useInfiniteSessionsByDevice, useInfiniteEventsByHerd, useInfiniteEventsByDevice, useInfiniteArtifactsByHerd, useInfiniteArtifactsByDevice, useInfiniteFeedByHerd, useInfiniteFeedByDevice, useInfiniteAnalysisJobs, useInfiniteAnalysisTasks, useIntersectionObserver, type UseInfiniteScrollOptions, type UseAnalysisJobsInfiniteOptions, type UseAnalysisTasksInfiniteOptions, } from "./useInfiniteQuery";
|
|
12
14
|
export { useLoadingPerformance, useSessionSummariesByHerd, useHasSessionSummaries, } from "../store/hooks";
|
package/dist/hooks/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export { useScoutRealtimeSessions } from "./useScoutRealtimeSessions";
|
|
|
8
8
|
export { useScoutRealtimePlans } from "./useScoutRealtimePlans";
|
|
9
9
|
export { useScoutRealtimePins } from "./useScoutRealtimePins";
|
|
10
10
|
export { useScoutRealtimeParts } from "./useScoutRealtimeParts";
|
|
11
|
+
export { useScoutRealtimeAnalysisJobs } from "./useScoutRealtimeAnalysisJobs";
|
|
12
|
+
export { useScoutRealtimeAnalysisTasks } from "./useScoutRealtimeAnalysisTasks";
|
|
11
13
|
// RTK Query infinite scroll hooks
|
|
12
14
|
export { useInfiniteSessionsByHerd, useInfiniteSessionsByDevice, useInfiniteEventsByHerd, useInfiniteEventsByDevice, useInfiniteArtifactsByHerd, useInfiniteArtifactsByDevice, useInfiniteFeedByHerd, useInfiniteFeedByDevice, useInfiniteAnalysisJobs, useInfiniteAnalysisTasks, useIntersectionObserver, } from "./useInfiniteQuery";
|
|
13
15
|
// Session summaries and performance hooks
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
import { Database } from "../types/supabase";
|
|
3
|
+
import { IAnalysisJob } from "../types/db";
|
|
4
|
+
import { RealtimeData } from "../types/realtime";
|
|
5
|
+
export declare function useScoutRealtimeAnalysisJobs(scoutSupabase: SupabaseClient<Database>): [RealtimeData<IAnalysisJob> | null, () => void];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useCallback, useState } from "react";
|
|
3
|
+
import { EnumRealtimeOperation } from "../types/realtime";
|
|
4
|
+
export function useScoutRealtimeAnalysisJobs(scoutSupabase) {
|
|
5
|
+
const channels = useRef([]);
|
|
6
|
+
const [latestJobUpdate, setLatestJobUpdate] = useState(null);
|
|
7
|
+
const handleAnalysisJobBroadcast = useCallback((payload) => {
|
|
8
|
+
const { payload: data } = payload;
|
|
9
|
+
const jobData = data.record || data.old_record;
|
|
10
|
+
if (!jobData) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let operation;
|
|
14
|
+
switch (data.operation) {
|
|
15
|
+
case "INSERT":
|
|
16
|
+
operation = EnumRealtimeOperation.INSERT;
|
|
17
|
+
break;
|
|
18
|
+
case "UPDATE":
|
|
19
|
+
operation = EnumRealtimeOperation.UPDATE;
|
|
20
|
+
break;
|
|
21
|
+
case "DELETE":
|
|
22
|
+
operation = EnumRealtimeOperation.DELETE;
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log(`[scout-core realtime] ANALYSIS_JOB ${data.operation} received for job ${jobData.id}:`, JSON.stringify(jobData));
|
|
28
|
+
const realtimeData = {
|
|
29
|
+
data: jobData,
|
|
30
|
+
operation,
|
|
31
|
+
};
|
|
32
|
+
setLatestJobUpdate(realtimeData);
|
|
33
|
+
}, []);
|
|
34
|
+
const clearLatestUpdate = useCallback(() => {
|
|
35
|
+
setLatestJobUpdate(null);
|
|
36
|
+
}, []);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!scoutSupabase)
|
|
39
|
+
return;
|
|
40
|
+
channels.current.forEach((channel) => scoutSupabase.removeChannel(channel));
|
|
41
|
+
channels.current = [];
|
|
42
|
+
clearLatestUpdate();
|
|
43
|
+
const channel = scoutSupabase
|
|
44
|
+
.channel("analysis_jobs_changes", { config: { private: true } })
|
|
45
|
+
.on("broadcast", { event: "*" }, handleAnalysisJobBroadcast)
|
|
46
|
+
.subscribe((status) => {
|
|
47
|
+
if (status === "SUBSCRIBED") {
|
|
48
|
+
console.log("[ANALYSIS_JOBS] ✅ Connected to analysis jobs broadcasts");
|
|
49
|
+
}
|
|
50
|
+
else if (status === "CHANNEL_ERROR") {
|
|
51
|
+
console.warn("[ANALYSIS_JOBS] 🟡 Failed to connect to analysis jobs broadcasts");
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
channels.current.push(channel);
|
|
55
|
+
return () => {
|
|
56
|
+
channels.current.forEach((ch) => scoutSupabase.removeChannel(ch));
|
|
57
|
+
channels.current = [];
|
|
58
|
+
};
|
|
59
|
+
}, [scoutSupabase, handleAnalysisJobBroadcast, clearLatestUpdate]);
|
|
60
|
+
return [latestJobUpdate, clearLatestUpdate];
|
|
61
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
import { Database } from "../types/supabase";
|
|
3
|
+
import { IAnalysisTask } from "../types/db";
|
|
4
|
+
import { RealtimeData } from "../types/realtime";
|
|
5
|
+
export declare function useScoutRealtimeAnalysisTasks(scoutSupabase: SupabaseClient<Database>): [RealtimeData<IAnalysisTask> | null, () => void];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useCallback, useState } from "react";
|
|
3
|
+
import { EnumRealtimeOperation } from "../types/realtime";
|
|
4
|
+
export function useScoutRealtimeAnalysisTasks(scoutSupabase) {
|
|
5
|
+
const channels = useRef([]);
|
|
6
|
+
const [latestTaskUpdate, setLatestTaskUpdate] = useState(null);
|
|
7
|
+
const handleAnalysisTaskBroadcast = useCallback((payload) => {
|
|
8
|
+
const { payload: data } = payload;
|
|
9
|
+
const taskData = data.record || data.old_record;
|
|
10
|
+
if (!taskData) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let operation;
|
|
14
|
+
switch (data.operation) {
|
|
15
|
+
case "INSERT":
|
|
16
|
+
operation = EnumRealtimeOperation.INSERT;
|
|
17
|
+
break;
|
|
18
|
+
case "UPDATE":
|
|
19
|
+
operation = EnumRealtimeOperation.UPDATE;
|
|
20
|
+
break;
|
|
21
|
+
case "DELETE":
|
|
22
|
+
operation = EnumRealtimeOperation.DELETE;
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log(`[scout-core realtime] ANALYSIS_TASK ${data.operation} received for task ${taskData.id} (job ${taskData.job_id}):`, JSON.stringify(taskData));
|
|
28
|
+
const realtimeData = {
|
|
29
|
+
data: taskData,
|
|
30
|
+
operation,
|
|
31
|
+
};
|
|
32
|
+
setLatestTaskUpdate(realtimeData);
|
|
33
|
+
}, []);
|
|
34
|
+
const clearLatestUpdate = useCallback(() => {
|
|
35
|
+
setLatestTaskUpdate(null);
|
|
36
|
+
}, []);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!scoutSupabase)
|
|
39
|
+
return;
|
|
40
|
+
channels.current.forEach((channel) => scoutSupabase.removeChannel(channel));
|
|
41
|
+
channels.current = [];
|
|
42
|
+
clearLatestUpdate();
|
|
43
|
+
const channel = scoutSupabase
|
|
44
|
+
.channel("analysis_tasks_changes", { config: { private: true } })
|
|
45
|
+
.on("broadcast", { event: "*" }, handleAnalysisTaskBroadcast)
|
|
46
|
+
.subscribe((status) => {
|
|
47
|
+
if (status === "SUBSCRIBED") {
|
|
48
|
+
console.log("[ANALYSIS_TASKS] ✅ Connected to analysis tasks broadcasts");
|
|
49
|
+
}
|
|
50
|
+
else if (status === "CHANNEL_ERROR") {
|
|
51
|
+
console.warn("[ANALYSIS_TASKS] 🟡 Failed to connect to analysis tasks broadcasts");
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
channels.current.push(channel);
|
|
55
|
+
return () => {
|
|
56
|
+
channels.current.forEach((ch) => scoutSupabase.removeChannel(ch));
|
|
57
|
+
channels.current = [];
|
|
58
|
+
};
|
|
59
|
+
}, [scoutSupabase, handleAnalysisTaskBroadcast, clearLatestUpdate]);
|
|
60
|
+
return [latestTaskUpdate, clearLatestUpdate];
|
|
61
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from "./helpers/pins";
|
|
|
28
28
|
export * from "./helpers/plans";
|
|
29
29
|
export * from "./helpers/layers";
|
|
30
30
|
export * from "./helpers/sessions";
|
|
31
|
+
export * from "./helpers/segmentations_sam3";
|
|
31
32
|
export * from "./helpers/tags";
|
|
32
33
|
export * from "./helpers/time";
|
|
33
34
|
export * from "./helpers/ui";
|
|
@@ -54,6 +55,8 @@ export * from "./hooks/useScoutRealtimeSessions";
|
|
|
54
55
|
export * from "./hooks/useScoutRealtimeParts";
|
|
55
56
|
export * from "./hooks/useScoutRealtimePlans";
|
|
56
57
|
export * from "./hooks/useScoutRealtimePins";
|
|
58
|
+
export * from "./hooks/useScoutRealtimeAnalysisJobs";
|
|
59
|
+
export * from "./hooks/useScoutRealtimeAnalysisTasks";
|
|
57
60
|
export * from "./hooks/useScoutRefresh";
|
|
58
61
|
export * from "./hooks/useInfiniteQuery";
|
|
59
62
|
export * from "./providers";
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export * from "./helpers/pins";
|
|
|
31
31
|
export * from "./helpers/plans";
|
|
32
32
|
export * from "./helpers/layers";
|
|
33
33
|
export * from "./helpers/sessions";
|
|
34
|
+
export * from "./helpers/segmentations_sam3";
|
|
34
35
|
export * from "./helpers/tags";
|
|
35
36
|
export * from "./helpers/time";
|
|
36
37
|
export * from "./helpers/ui";
|
|
@@ -58,6 +59,8 @@ export * from "./hooks/useScoutRealtimeSessions";
|
|
|
58
59
|
export * from "./hooks/useScoutRealtimeParts";
|
|
59
60
|
export * from "./hooks/useScoutRealtimePlans";
|
|
60
61
|
export * from "./hooks/useScoutRealtimePins";
|
|
62
|
+
export * from "./hooks/useScoutRealtimeAnalysisJobs";
|
|
63
|
+
export * from "./hooks/useScoutRealtimeAnalysisTasks";
|
|
61
64
|
export * from "./hooks/useScoutRefresh";
|
|
62
65
|
export * from "./hooks/useInfiniteQuery";
|
|
63
66
|
// Providers
|
|
@@ -1076,6 +1076,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
1076
1076
|
segmentations_sam3: {
|
|
1077
1077
|
Row: {
|
|
1078
1078
|
artifact_id: number | null;
|
|
1079
|
+
conf: number | null;
|
|
1079
1080
|
created_at: string;
|
|
1080
1081
|
event_id: number | null;
|
|
1081
1082
|
frame_index: number;
|
|
@@ -1090,11 +1091,13 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
1090
1091
|
sensor_roll: number | null;
|
|
1091
1092
|
sensor_yaw: number | null;
|
|
1092
1093
|
subject_height: number | null;
|
|
1094
|
+
subject_id: number | null;
|
|
1093
1095
|
subject_location: unknown;
|
|
1094
1096
|
timestamp_observation: string | null;
|
|
1095
1097
|
};
|
|
1096
1098
|
Insert: {
|
|
1097
1099
|
artifact_id?: number | null;
|
|
1100
|
+
conf?: number | null;
|
|
1098
1101
|
created_at?: string;
|
|
1099
1102
|
event_id?: number | null;
|
|
1100
1103
|
frame_index?: number;
|
|
@@ -1109,11 +1112,13 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
1109
1112
|
sensor_roll?: number | null;
|
|
1110
1113
|
sensor_yaw?: number | null;
|
|
1111
1114
|
subject_height?: number | null;
|
|
1115
|
+
subject_id?: number | null;
|
|
1112
1116
|
subject_location?: unknown;
|
|
1113
1117
|
timestamp_observation?: string | null;
|
|
1114
1118
|
};
|
|
1115
1119
|
Update: {
|
|
1116
1120
|
artifact_id?: number | null;
|
|
1121
|
+
conf?: number | null;
|
|
1117
1122
|
created_at?: string;
|
|
1118
1123
|
event_id?: number | null;
|
|
1119
1124
|
frame_index?: number;
|
|
@@ -1128,6 +1133,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
1128
1133
|
sensor_roll?: number | null;
|
|
1129
1134
|
sensor_yaw?: number | null;
|
|
1130
1135
|
subject_height?: number | null;
|
|
1136
|
+
subject_id?: number | null;
|
|
1131
1137
|
subject_location?: unknown;
|
|
1132
1138
|
timestamp_observation?: string | null;
|
|
1133
1139
|
};
|
|
@@ -2337,6 +2343,22 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
2337
2343
|
isSetofReturn: true;
|
|
2338
2344
|
};
|
|
2339
2345
|
};
|
|
2346
|
+
get_minimal_subjects_for_artifact: {
|
|
2347
|
+
Args: {
|
|
2348
|
+
artifact_id_caller: number;
|
|
2349
|
+
detector_models_caller?: string[];
|
|
2350
|
+
max_elements_caller?: number;
|
|
2351
|
+
min_avg_conf_caller?: number;
|
|
2352
|
+
min_count_caller?: number;
|
|
2353
|
+
};
|
|
2354
|
+
Returns: {
|
|
2355
|
+
avg_conf: number;
|
|
2356
|
+
first_tag_frame_index: number;
|
|
2357
|
+
last_tag_frame_index: number;
|
|
2358
|
+
num_tags: number;
|
|
2359
|
+
subject_id: number;
|
|
2360
|
+
}[];
|
|
2361
|
+
};
|
|
2340
2362
|
get_pins_for_herd: {
|
|
2341
2363
|
Args: {
|
|
2342
2364
|
herd_id_caller: number;
|
|
@@ -2349,6 +2371,66 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
2349
2371
|
isSetofReturn: true;
|
|
2350
2372
|
};
|
|
2351
2373
|
};
|
|
2374
|
+
get_segmentations_sam3_for_artifact: {
|
|
2375
|
+
Args: {
|
|
2376
|
+
artifact_id_caller: number;
|
|
2377
|
+
end_timestamp_caller?: string;
|
|
2378
|
+
max_elements_caller?: number;
|
|
2379
|
+
start_timestamp_caller?: string;
|
|
2380
|
+
};
|
|
2381
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2382
|
+
SetofOptions: {
|
|
2383
|
+
from: "*";
|
|
2384
|
+
to: "segmentations_sam3_pretty";
|
|
2385
|
+
isOneToOne: false;
|
|
2386
|
+
isSetofReturn: true;
|
|
2387
|
+
};
|
|
2388
|
+
};
|
|
2389
|
+
get_segmentations_sam3_for_artifact_by_frame_index: {
|
|
2390
|
+
Args: {
|
|
2391
|
+
artifact_id_caller: number;
|
|
2392
|
+
frame_index_end_caller: number;
|
|
2393
|
+
frame_index_start_caller: number;
|
|
2394
|
+
max_elements_caller?: number;
|
|
2395
|
+
min_conf_caller?: number;
|
|
2396
|
+
};
|
|
2397
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2398
|
+
SetofOptions: {
|
|
2399
|
+
from: "*";
|
|
2400
|
+
to: "segmentations_sam3_pretty";
|
|
2401
|
+
isOneToOne: false;
|
|
2402
|
+
isSetofReturn: true;
|
|
2403
|
+
};
|
|
2404
|
+
};
|
|
2405
|
+
get_segmentations_sam3_for_artifact_by_subject_id: {
|
|
2406
|
+
Args: {
|
|
2407
|
+
artifact_id_caller: number;
|
|
2408
|
+
max_elements_caller?: number;
|
|
2409
|
+
subject_id_caller: number;
|
|
2410
|
+
};
|
|
2411
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2412
|
+
SetofOptions: {
|
|
2413
|
+
from: "*";
|
|
2414
|
+
to: "segmentations_sam3_pretty";
|
|
2415
|
+
isOneToOne: false;
|
|
2416
|
+
isSetofReturn: true;
|
|
2417
|
+
};
|
|
2418
|
+
};
|
|
2419
|
+
get_segmentations_sam3_for_event: {
|
|
2420
|
+
Args: {
|
|
2421
|
+
end_timestamp_caller?: string;
|
|
2422
|
+
event_id_caller: number;
|
|
2423
|
+
max_elements_caller?: number;
|
|
2424
|
+
start_timestamp_caller?: string;
|
|
2425
|
+
};
|
|
2426
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2427
|
+
SetofOptions: {
|
|
2428
|
+
from: "*";
|
|
2429
|
+
to: "segmentations_sam3_pretty";
|
|
2430
|
+
isOneToOne: false;
|
|
2431
|
+
isSetofReturn: true;
|
|
2432
|
+
};
|
|
2433
|
+
};
|
|
2352
2434
|
get_session_by_id: {
|
|
2353
2435
|
Args: {
|
|
2354
2436
|
session_id_caller: number;
|
|
@@ -2444,6 +2526,7 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
2444
2526
|
get_tags_for_artifact: {
|
|
2445
2527
|
Args: {
|
|
2446
2528
|
artifact_id_caller: number;
|
|
2529
|
+
detector_models_caller?: string[];
|
|
2447
2530
|
end_timestamp_caller?: string;
|
|
2448
2531
|
max_elements_caller?: number;
|
|
2449
2532
|
start_timestamp_caller?: string;
|
|
@@ -2456,8 +2539,41 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
2456
2539
|
isSetofReturn: true;
|
|
2457
2540
|
};
|
|
2458
2541
|
};
|
|
2542
|
+
get_tags_for_artifact_by_frame_index: {
|
|
2543
|
+
Args: {
|
|
2544
|
+
artifact_id_caller: number;
|
|
2545
|
+
detector_models_caller?: string[];
|
|
2546
|
+
frame_index_end_caller: number;
|
|
2547
|
+
frame_index_start_caller: number;
|
|
2548
|
+
max_elements_caller?: number;
|
|
2549
|
+
min_conf_caller: number;
|
|
2550
|
+
};
|
|
2551
|
+
Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
|
|
2552
|
+
SetofOptions: {
|
|
2553
|
+
from: "*";
|
|
2554
|
+
to: "tags_pretty_location";
|
|
2555
|
+
isOneToOne: false;
|
|
2556
|
+
isSetofReturn: true;
|
|
2557
|
+
};
|
|
2558
|
+
};
|
|
2559
|
+
get_tags_for_artifact_by_subject_id: {
|
|
2560
|
+
Args: {
|
|
2561
|
+
artifact_id_caller: number;
|
|
2562
|
+
detector_models_caller?: string[];
|
|
2563
|
+
max_elements_caller?: number;
|
|
2564
|
+
subject_id_caller: number;
|
|
2565
|
+
};
|
|
2566
|
+
Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
|
|
2567
|
+
SetofOptions: {
|
|
2568
|
+
from: "*";
|
|
2569
|
+
to: "tags_pretty_location";
|
|
2570
|
+
isOneToOne: false;
|
|
2571
|
+
isSetofReturn: true;
|
|
2572
|
+
};
|
|
2573
|
+
};
|
|
2459
2574
|
get_tags_for_event: {
|
|
2460
2575
|
Args: {
|
|
2576
|
+
detector_models_caller?: string[];
|
|
2461
2577
|
end_timestamp_caller?: string;
|
|
2462
2578
|
event_id_caller: number;
|
|
2463
2579
|
max_elements_caller?: number;
|
|
@@ -2504,6 +2620,10 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
2504
2620
|
isSetofReturn: true;
|
|
2505
2621
|
};
|
|
2506
2622
|
};
|
|
2623
|
+
is_platform_superadmin_current_user: {
|
|
2624
|
+
Args: never;
|
|
2625
|
+
Returns: boolean;
|
|
2626
|
+
};
|
|
2507
2627
|
load_api_keys: {
|
|
2508
2628
|
Args: {
|
|
2509
2629
|
id_of_device: number;
|
|
@@ -2809,6 +2929,31 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
|
|
|
2809
2929
|
latitude: number | null;
|
|
2810
2930
|
longitude: number | null;
|
|
2811
2931
|
};
|
|
2932
|
+
segmentations_sam3_pretty: {
|
|
2933
|
+
id: number | null;
|
|
2934
|
+
created_at: string | null;
|
|
2935
|
+
event_id: number | null;
|
|
2936
|
+
artifact_id: number | null;
|
|
2937
|
+
frame_index: number | null;
|
|
2938
|
+
mask_rle: import("../types/supabase").Json | null;
|
|
2939
|
+
conf: number | null;
|
|
2940
|
+
timestamp_observation: string | null;
|
|
2941
|
+
origin_location: unknown;
|
|
2942
|
+
origin_pitch: number | null;
|
|
2943
|
+
origin_heading: number | null;
|
|
2944
|
+
origin_roll: number | null;
|
|
2945
|
+
sensor_pitch: number | null;
|
|
2946
|
+
sensor_yaw: number | null;
|
|
2947
|
+
sensor_roll: number | null;
|
|
2948
|
+
origin_height: number | null;
|
|
2949
|
+
subject_location: unknown;
|
|
2950
|
+
subject_height: number | null;
|
|
2951
|
+
origin_latitude: number | null;
|
|
2952
|
+
origin_longitude: number | null;
|
|
2953
|
+
subject_latitude: number | null;
|
|
2954
|
+
subject_longitude: number | null;
|
|
2955
|
+
subject_id: number | null;
|
|
2956
|
+
};
|
|
2812
2957
|
session_with_coordinates: {
|
|
2813
2958
|
id: number | null;
|
|
2814
2959
|
device_id: number | null;
|
package/dist/types/db.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type IPin = Database["public"]["CompositeTypes"]["pins_pretty_location"];
|
|
|
15
15
|
export type IEvent = Database["public"]["Tables"]["events"]["Row"];
|
|
16
16
|
export type ITag = Database["public"]["Tables"]["tags"]["Row"];
|
|
17
17
|
export type ITagPrettyLocation = Database["public"]["CompositeTypes"]["tags_pretty_location"];
|
|
18
|
+
export type ISegmentationSam3 = Database["public"]["Tables"]["segmentations_sam3"]["Row"];
|
|
19
|
+
export type ISegmentationSam3Pretty = Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"];
|
|
18
20
|
export type IPlan = Database["public"]["Tables"]["plans"]["Row"];
|
|
19
21
|
export type ILayer = Database["public"]["Tables"]["layers"]["Row"];
|
|
20
22
|
export type IAction = Database["public"]["Tables"]["actions"]["Row"];
|
|
@@ -32,6 +34,7 @@ export type IVersionsSoftware = Database["public"]["Tables"]["versions_software"
|
|
|
32
34
|
export type IArtifact = Database["public"]["Tables"]["artifacts"]["Row"];
|
|
33
35
|
export type IHealthMetric = Database["public"]["Tables"]["health_metrics"]["Row"];
|
|
34
36
|
export type IHealthMetricSummaryRow = Database["public"]["Functions"]["get_health_metrics_summary"]["Returns"][number];
|
|
37
|
+
export type IMinimalSubjectForArtifact = Database["public"]["Functions"]["get_minimal_subjects_for_artifact"]["Returns"][number];
|
|
35
38
|
export type IAnalysisJob = Database["public"]["Tables"]["analysis_jobs"]["Row"];
|
|
36
39
|
export type IAnalysisTask = Database["public"]["Tables"]["analysis_tasks"]["Row"];
|
|
37
40
|
export type IArtifactWithMediaUrl = IArtifact & {
|
package/dist/types/supabase.d.ts
CHANGED
|
@@ -1132,6 +1132,7 @@ export type Database = {
|
|
|
1132
1132
|
segmentations_sam3: {
|
|
1133
1133
|
Row: {
|
|
1134
1134
|
artifact_id: number | null;
|
|
1135
|
+
conf: number | null;
|
|
1135
1136
|
created_at: string;
|
|
1136
1137
|
event_id: number | null;
|
|
1137
1138
|
frame_index: number;
|
|
@@ -1146,11 +1147,13 @@ export type Database = {
|
|
|
1146
1147
|
sensor_roll: number | null;
|
|
1147
1148
|
sensor_yaw: number | null;
|
|
1148
1149
|
subject_height: number | null;
|
|
1150
|
+
subject_id: number | null;
|
|
1149
1151
|
subject_location: unknown;
|
|
1150
1152
|
timestamp_observation: string | null;
|
|
1151
1153
|
};
|
|
1152
1154
|
Insert: {
|
|
1153
1155
|
artifact_id?: number | null;
|
|
1156
|
+
conf?: number | null;
|
|
1154
1157
|
created_at?: string;
|
|
1155
1158
|
event_id?: number | null;
|
|
1156
1159
|
frame_index?: number;
|
|
@@ -1165,11 +1168,13 @@ export type Database = {
|
|
|
1165
1168
|
sensor_roll?: number | null;
|
|
1166
1169
|
sensor_yaw?: number | null;
|
|
1167
1170
|
subject_height?: number | null;
|
|
1171
|
+
subject_id?: number | null;
|
|
1168
1172
|
subject_location?: unknown;
|
|
1169
1173
|
timestamp_observation?: string | null;
|
|
1170
1174
|
};
|
|
1171
1175
|
Update: {
|
|
1172
1176
|
artifact_id?: number | null;
|
|
1177
|
+
conf?: number | null;
|
|
1173
1178
|
created_at?: string;
|
|
1174
1179
|
event_id?: number | null;
|
|
1175
1180
|
frame_index?: number;
|
|
@@ -1184,6 +1189,7 @@ export type Database = {
|
|
|
1184
1189
|
sensor_roll?: number | null;
|
|
1185
1190
|
sensor_yaw?: number | null;
|
|
1186
1191
|
subject_height?: number | null;
|
|
1192
|
+
subject_id?: number | null;
|
|
1187
1193
|
subject_location?: unknown;
|
|
1188
1194
|
timestamp_observation?: string | null;
|
|
1189
1195
|
};
|
|
@@ -2422,6 +2428,22 @@ export type Database = {
|
|
|
2422
2428
|
isSetofReturn: true;
|
|
2423
2429
|
};
|
|
2424
2430
|
};
|
|
2431
|
+
get_minimal_subjects_for_artifact: {
|
|
2432
|
+
Args: {
|
|
2433
|
+
artifact_id_caller: number;
|
|
2434
|
+
detector_models_caller?: string[];
|
|
2435
|
+
max_elements_caller?: number;
|
|
2436
|
+
min_avg_conf_caller?: number;
|
|
2437
|
+
min_count_caller?: number;
|
|
2438
|
+
};
|
|
2439
|
+
Returns: {
|
|
2440
|
+
avg_conf: number;
|
|
2441
|
+
first_tag_frame_index: number;
|
|
2442
|
+
last_tag_frame_index: number;
|
|
2443
|
+
num_tags: number;
|
|
2444
|
+
subject_id: number;
|
|
2445
|
+
}[];
|
|
2446
|
+
};
|
|
2425
2447
|
get_pins_for_herd: {
|
|
2426
2448
|
Args: {
|
|
2427
2449
|
herd_id_caller: number;
|
|
@@ -2434,6 +2456,66 @@ export type Database = {
|
|
|
2434
2456
|
isSetofReturn: true;
|
|
2435
2457
|
};
|
|
2436
2458
|
};
|
|
2459
|
+
get_segmentations_sam3_for_artifact: {
|
|
2460
|
+
Args: {
|
|
2461
|
+
artifact_id_caller: number;
|
|
2462
|
+
end_timestamp_caller?: string;
|
|
2463
|
+
max_elements_caller?: number;
|
|
2464
|
+
start_timestamp_caller?: string;
|
|
2465
|
+
};
|
|
2466
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2467
|
+
SetofOptions: {
|
|
2468
|
+
from: "*";
|
|
2469
|
+
to: "segmentations_sam3_pretty";
|
|
2470
|
+
isOneToOne: false;
|
|
2471
|
+
isSetofReturn: true;
|
|
2472
|
+
};
|
|
2473
|
+
};
|
|
2474
|
+
get_segmentations_sam3_for_artifact_by_frame_index: {
|
|
2475
|
+
Args: {
|
|
2476
|
+
artifact_id_caller: number;
|
|
2477
|
+
frame_index_end_caller: number;
|
|
2478
|
+
frame_index_start_caller: number;
|
|
2479
|
+
max_elements_caller?: number;
|
|
2480
|
+
min_conf_caller?: number;
|
|
2481
|
+
};
|
|
2482
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2483
|
+
SetofOptions: {
|
|
2484
|
+
from: "*";
|
|
2485
|
+
to: "segmentations_sam3_pretty";
|
|
2486
|
+
isOneToOne: false;
|
|
2487
|
+
isSetofReturn: true;
|
|
2488
|
+
};
|
|
2489
|
+
};
|
|
2490
|
+
get_segmentations_sam3_for_artifact_by_subject_id: {
|
|
2491
|
+
Args: {
|
|
2492
|
+
artifact_id_caller: number;
|
|
2493
|
+
max_elements_caller?: number;
|
|
2494
|
+
subject_id_caller: number;
|
|
2495
|
+
};
|
|
2496
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2497
|
+
SetofOptions: {
|
|
2498
|
+
from: "*";
|
|
2499
|
+
to: "segmentations_sam3_pretty";
|
|
2500
|
+
isOneToOne: false;
|
|
2501
|
+
isSetofReturn: true;
|
|
2502
|
+
};
|
|
2503
|
+
};
|
|
2504
|
+
get_segmentations_sam3_for_event: {
|
|
2505
|
+
Args: {
|
|
2506
|
+
end_timestamp_caller?: string;
|
|
2507
|
+
event_id_caller: number;
|
|
2508
|
+
max_elements_caller?: number;
|
|
2509
|
+
start_timestamp_caller?: string;
|
|
2510
|
+
};
|
|
2511
|
+
Returns: Database["public"]["CompositeTypes"]["segmentations_sam3_pretty"][];
|
|
2512
|
+
SetofOptions: {
|
|
2513
|
+
from: "*";
|
|
2514
|
+
to: "segmentations_sam3_pretty";
|
|
2515
|
+
isOneToOne: false;
|
|
2516
|
+
isSetofReturn: true;
|
|
2517
|
+
};
|
|
2518
|
+
};
|
|
2437
2519
|
get_session_by_id: {
|
|
2438
2520
|
Args: {
|
|
2439
2521
|
session_id_caller: number;
|
|
@@ -2529,6 +2611,7 @@ export type Database = {
|
|
|
2529
2611
|
get_tags_for_artifact: {
|
|
2530
2612
|
Args: {
|
|
2531
2613
|
artifact_id_caller: number;
|
|
2614
|
+
detector_models_caller?: string[];
|
|
2532
2615
|
end_timestamp_caller?: string;
|
|
2533
2616
|
max_elements_caller?: number;
|
|
2534
2617
|
start_timestamp_caller?: string;
|
|
@@ -2541,8 +2624,41 @@ export type Database = {
|
|
|
2541
2624
|
isSetofReturn: true;
|
|
2542
2625
|
};
|
|
2543
2626
|
};
|
|
2627
|
+
get_tags_for_artifact_by_frame_index: {
|
|
2628
|
+
Args: {
|
|
2629
|
+
artifact_id_caller: number;
|
|
2630
|
+
detector_models_caller?: string[];
|
|
2631
|
+
frame_index_end_caller: number;
|
|
2632
|
+
frame_index_start_caller: number;
|
|
2633
|
+
max_elements_caller?: number;
|
|
2634
|
+
min_conf_caller: number;
|
|
2635
|
+
};
|
|
2636
|
+
Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
|
|
2637
|
+
SetofOptions: {
|
|
2638
|
+
from: "*";
|
|
2639
|
+
to: "tags_pretty_location";
|
|
2640
|
+
isOneToOne: false;
|
|
2641
|
+
isSetofReturn: true;
|
|
2642
|
+
};
|
|
2643
|
+
};
|
|
2644
|
+
get_tags_for_artifact_by_subject_id: {
|
|
2645
|
+
Args: {
|
|
2646
|
+
artifact_id_caller: number;
|
|
2647
|
+
detector_models_caller?: string[];
|
|
2648
|
+
max_elements_caller?: number;
|
|
2649
|
+
subject_id_caller: number;
|
|
2650
|
+
};
|
|
2651
|
+
Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
|
|
2652
|
+
SetofOptions: {
|
|
2653
|
+
from: "*";
|
|
2654
|
+
to: "tags_pretty_location";
|
|
2655
|
+
isOneToOne: false;
|
|
2656
|
+
isSetofReturn: true;
|
|
2657
|
+
};
|
|
2658
|
+
};
|
|
2544
2659
|
get_tags_for_event: {
|
|
2545
2660
|
Args: {
|
|
2661
|
+
detector_models_caller?: string[];
|
|
2546
2662
|
end_timestamp_caller?: string;
|
|
2547
2663
|
event_id_caller: number;
|
|
2548
2664
|
max_elements_caller?: number;
|
|
@@ -2589,6 +2705,10 @@ export type Database = {
|
|
|
2589
2705
|
isSetofReturn: true;
|
|
2590
2706
|
};
|
|
2591
2707
|
};
|
|
2708
|
+
is_platform_superadmin_current_user: {
|
|
2709
|
+
Args: never;
|
|
2710
|
+
Returns: boolean;
|
|
2711
|
+
};
|
|
2592
2712
|
load_api_keys: {
|
|
2593
2713
|
Args: {
|
|
2594
2714
|
id_of_device: number;
|
|
@@ -2894,6 +3014,31 @@ export type Database = {
|
|
|
2894
3014
|
latitude: number | null;
|
|
2895
3015
|
longitude: number | null;
|
|
2896
3016
|
};
|
|
3017
|
+
segmentations_sam3_pretty: {
|
|
3018
|
+
id: number | null;
|
|
3019
|
+
created_at: string | null;
|
|
3020
|
+
event_id: number | null;
|
|
3021
|
+
artifact_id: number | null;
|
|
3022
|
+
frame_index: number | null;
|
|
3023
|
+
mask_rle: Json | null;
|
|
3024
|
+
conf: number | null;
|
|
3025
|
+
timestamp_observation: string | null;
|
|
3026
|
+
origin_location: unknown;
|
|
3027
|
+
origin_pitch: number | null;
|
|
3028
|
+
origin_heading: number | null;
|
|
3029
|
+
origin_roll: number | null;
|
|
3030
|
+
sensor_pitch: number | null;
|
|
3031
|
+
sensor_yaw: number | null;
|
|
3032
|
+
sensor_roll: number | null;
|
|
3033
|
+
origin_height: number | null;
|
|
3034
|
+
subject_location: unknown;
|
|
3035
|
+
subject_height: number | null;
|
|
3036
|
+
origin_latitude: number | null;
|
|
3037
|
+
origin_longitude: number | null;
|
|
3038
|
+
subject_latitude: number | null;
|
|
3039
|
+
subject_longitude: number | null;
|
|
3040
|
+
subject_id: number | null;
|
|
3041
|
+
};
|
|
2897
3042
|
session_with_coordinates: {
|
|
2898
3043
|
id: number | null;
|
|
2899
3044
|
device_id: number | null;
|