@adventurelabs/scout-core 1.4.81 → 1.4.83

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.
@@ -14,6 +14,7 @@ export * from "./heartbeats";
14
14
  export * from "./herds";
15
15
  export * from "./location";
16
16
  export * from "./lifecycle";
17
+ export * from "./models";
17
18
  export * from "./plans";
18
19
  export * from "./sessions";
19
20
  export * from "./segmentations_sam3";
@@ -14,6 +14,7 @@ export * from "./heartbeats";
14
14
  export * from "./herds";
15
15
  export * from "./location";
16
16
  export * from "./lifecycle";
17
+ export * from "./models";
17
18
  export * from "./plans";
18
19
  export * from "./sessions";
19
20
  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
+ }
@@ -10,28 +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, detector filter, and max_elements (omit or null for no limit). */
13
+ /** Tags for an artifact with optional timestamp range, model_ids 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
17
  max_elements?: number | null;
18
- detection_models?: string[] | null;
18
+ model_ids?: number[] | null;
19
19
  }): Promise<IWebResponseCompatible<ITagPrettyLocation[]>>;
20
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[]>>;
21
+ export declare function server_get_tags_for_artifact_by_frame_index(artifactId: number, minConf: number, frameIndexStart: number, frameIndexEnd: number, model_ids?: number[] | null, maxElements?: number | null): Promise<IWebResponseCompatible<ITagPrettyLocation[]>>;
22
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). */
23
+ export declare function server_get_tags_for_artifact_by_subject_id(artifactId: number, subjectId: number, model_ids?: number[] | 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 / model_ids; max_elements caps subject rows (omit or null for no cap). */
25
25
  export declare function server_get_minimal_subjects_for_artifact(artifactId: number, options?: {
26
26
  min_avg_conf?: number | null;
27
27
  min_count?: number | null;
28
- detection_models?: string[] | null;
28
+ model_ids?: number[] | null;
29
29
  max_elements?: number | null;
30
30
  }): Promise<IWebResponseCompatible<IMinimalSubjectForArtifact[]>>;
31
- /** Tags for an event with optional timestamp range, detector filter, and max_elements (omit or null for no limit). */
31
+ /** Tags for an event with optional timestamp range, model_ids filter, and max_elements (omit or null for no limit). */
32
32
  export declare function server_get_tags_for_event(eventId: number, options?: {
33
33
  start_timestamp?: string | null;
34
34
  end_timestamp?: string | null;
35
35
  max_elements?: number | null;
36
- detection_models?: string[] | null;
36
+ model_ids?: number[] | null;
37
37
  }): Promise<IWebResponseCompatible<ITagPrettyLocation[]>>;
@@ -55,9 +55,9 @@ function extractLongitude(location) {
55
55
  }
56
56
  return null;
57
57
  }
58
- function rpcDetectorModelsParam(detection_models) {
59
- if (detection_models != null && detection_models.length > 0) {
60
- return { detector_models_caller: detection_models };
58
+ function rpcModelIdsParam(model_ids) {
59
+ if (model_ids != null && model_ids.length > 0) {
60
+ return { model_ids_caller: model_ids };
61
61
  }
62
62
  return {};
63
63
  }
@@ -426,7 +426,7 @@ export async function get_event_and_tags_by_event_id(event_id) {
426
426
  inserted_at: tag.inserted_at,
427
427
  artifact_id: tag.artifact_id,
428
428
  event_id: tag.event_id,
429
- detector: tag.detector,
429
+ model_id: tag.model_id,
430
430
  width: tag.width,
431
431
  height: tag.height,
432
432
  conf: tag.conf,
@@ -450,8 +450,6 @@ export async function get_event_and_tags_by_event_id(event_id) {
450
450
  subject_latitude: subjectLat,
451
451
  subject_longitude: subjectLon,
452
452
  subject_id: tag.subject_id ?? null,
453
- score: tag.score ?? null,
454
- score_source: tag.score_source ?? null,
455
453
  };
456
454
  }),
457
455
  earthranger_url: data[0].earthranger_url,
@@ -471,7 +469,7 @@ export async function get_event_and_tags_by_event_id(event_id) {
471
469
  }
472
470
  return IWebResponse.success(eventWithSignedUrl).to_compatible();
473
471
  }
474
- /** Tags for an artifact with optional timestamp range, detector filter, and max_elements (omit or null for no limit). */
472
+ /** Tags for an artifact with optional timestamp range, model_ids filter, and max_elements (omit or null for no limit). */
475
473
  export async function server_get_tags_for_artifact(artifactId, options) {
476
474
  const supabase = await newServerClient();
477
475
  const { data, error } = await supabase.rpc("get_tags_for_artifact", {
@@ -482,7 +480,7 @@ export async function server_get_tags_for_artifact(artifactId, options) {
482
480
  ...(options?.end_timestamp != null && {
483
481
  end_timestamp_caller: options.end_timestamp,
484
482
  }),
485
- ...rpcDetectorModelsParam(options?.detection_models),
483
+ ...rpcModelIdsParam(options?.model_ids),
486
484
  ...(options?.max_elements != null && {
487
485
  max_elements_caller: options.max_elements,
488
486
  }),
@@ -498,14 +496,14 @@ export async function server_get_tags_for_artifact(artifactId, options) {
498
496
  return IWebResponse.success(data ?? []).to_compatible();
499
497
  }
500
498
  /** Tags for an artifact filtered by frame_index range and minimum confidence. Omit maxElements (or pass null) for no row limit. */
501
- export async function server_get_tags_for_artifact_by_frame_index(artifactId, minConf, frameIndexStart, frameIndexEnd, detection_models = null, maxElements = null) {
499
+ export async function server_get_tags_for_artifact_by_frame_index(artifactId, minConf, frameIndexStart, frameIndexEnd, model_ids = null, maxElements = null) {
502
500
  const supabase = await newServerClient();
503
501
  const { data, error } = await supabase.rpc("get_tags_for_artifact_by_frame_index", {
504
502
  artifact_id_caller: artifactId,
505
503
  min_conf_caller: minConf,
506
504
  frame_index_start_caller: frameIndexStart,
507
505
  frame_index_end_caller: frameIndexEnd,
508
- ...rpcDetectorModelsParam(detection_models),
506
+ ...rpcModelIdsParam(model_ids),
509
507
  ...(maxElements != null && { max_elements_caller: maxElements }),
510
508
  });
511
509
  if (error) {
@@ -519,12 +517,12 @@ export async function server_get_tags_for_artifact_by_frame_index(artifactId, mi
519
517
  return IWebResponse.success(data ?? []).to_compatible();
520
518
  }
521
519
  /** Tags for an artifact and subject_id. Omit maxElements (or pass null) for no row limit. */
522
- export async function server_get_tags_for_artifact_by_subject_id(artifactId, subjectId, detection_models = null, maxElements = null) {
520
+ export async function server_get_tags_for_artifact_by_subject_id(artifactId, subjectId, model_ids = null, maxElements = null) {
523
521
  const supabase = await newServerClient();
524
522
  const { data, error } = await supabase.rpc("get_tags_for_artifact_by_subject_id", {
525
523
  artifact_id_caller: artifactId,
526
524
  subject_id_caller: subjectId,
527
- ...rpcDetectorModelsParam(detection_models),
525
+ ...rpcModelIdsParam(model_ids),
528
526
  ...(maxElements != null && { max_elements_caller: maxElements }),
529
527
  });
530
528
  if (error) {
@@ -537,7 +535,7 @@ export async function server_get_tags_for_artifact_by_subject_id(artifactId, sub
537
535
  }
538
536
  return IWebResponse.success(data ?? []).to_compatible();
539
537
  }
540
- /** 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). */
538
+ /** Per-subject aggregates for tags on an artifact (rows with subject_id only). Optional min_avg_conf / min_count / model_ids; max_elements caps subject rows (omit or null for no cap). */
541
539
  export async function server_get_minimal_subjects_for_artifact(artifactId, options) {
542
540
  const supabase = await newServerClient();
543
541
  const { data, error } = await supabase.rpc("get_minimal_subjects_for_artifact", {
@@ -548,7 +546,7 @@ export async function server_get_minimal_subjects_for_artifact(artifactId, optio
548
546
  ...(options?.min_count != null && {
549
547
  min_count_caller: options.min_count,
550
548
  }),
551
- ...rpcDetectorModelsParam(options?.detection_models),
549
+ ...rpcModelIdsParam(options?.model_ids),
552
550
  ...(options?.max_elements != null && {
553
551
  max_elements_caller: options.max_elements,
554
552
  }),
@@ -563,7 +561,7 @@ export async function server_get_minimal_subjects_for_artifact(artifactId, optio
563
561
  }
564
562
  return IWebResponse.success(data ?? []).to_compatible();
565
563
  }
566
- /** Tags for an event with optional timestamp range, detector filter, and max_elements (omit or null for no limit). */
564
+ /** Tags for an event with optional timestamp range, model_ids filter, and max_elements (omit or null for no limit). */
567
565
  export async function server_get_tags_for_event(eventId, options) {
568
566
  const supabase = await newServerClient();
569
567
  const { data, error } = await supabase.rpc("get_tags_for_event", {
@@ -574,7 +572,7 @@ export async function server_get_tags_for_event(eventId, options) {
574
572
  ...(options?.end_timestamp != null && {
575
573
  end_timestamp_caller: options.end_timestamp,
576
574
  }),
577
- ...rpcDetectorModelsParam(options?.detection_models),
575
+ ...rpcModelIdsParam(options?.model_ids),
578
576
  ...(options?.max_elements != null && {
579
577
  max_elements_caller: options.max_elements,
580
578
  }),
@@ -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"];
@@ -3,7 +3,7 @@ export type Json = string | number | boolean | null | {
3
3
  } | Json[];
4
4
  export type Database = {
5
5
  __InternalSupabase: {
6
- PostgrestVersion: "13.0.5";
6
+ PostgrestVersion: "14.4";
7
7
  };
8
8
  public: {
9
9
  Tables: {
@@ -72,37 +72,62 @@ export type Database = {
72
72
  };
73
73
  analysis_jobs: {
74
74
  Row: {
75
+ assignee_user_id: string | null;
75
76
  id: number;
76
77
  inserted_at: string;
77
78
  job_type: string;
79
+ review_status: Database["public"]["Enums"]["review_status"];
80
+ reviewer_user_id: string | null;
78
81
  status: Database["public"]["Enums"]["analysis_work_status"];
79
82
  timestamp_finished: string | null;
80
83
  timestamp_requested: string;
81
84
  timestamp_started: string | null;
82
85
  };
83
86
  Insert: {
87
+ assignee_user_id?: string | null;
84
88
  id?: number;
85
89
  inserted_at?: string;
86
90
  job_type?: string;
91
+ review_status?: Database["public"]["Enums"]["review_status"];
92
+ reviewer_user_id?: string | null;
87
93
  status?: Database["public"]["Enums"]["analysis_work_status"];
88
94
  timestamp_finished?: string | null;
89
95
  timestamp_requested?: string;
90
96
  timestamp_started?: string | null;
91
97
  };
92
98
  Update: {
99
+ assignee_user_id?: string | null;
93
100
  id?: number;
94
101
  inserted_at?: string;
95
102
  job_type?: string;
103
+ review_status?: Database["public"]["Enums"]["review_status"];
104
+ reviewer_user_id?: string | null;
96
105
  status?: Database["public"]["Enums"]["analysis_work_status"];
97
106
  timestamp_finished?: string | null;
98
107
  timestamp_requested?: string;
99
108
  timestamp_started?: string | null;
100
109
  };
101
- Relationships: [];
110
+ Relationships: [
111
+ {
112
+ foreignKeyName: "analysis_jobs_assignee_user_id_fkey";
113
+ columns: ["assignee_user_id"];
114
+ isOneToOne: false;
115
+ referencedRelation: "users";
116
+ referencedColumns: ["id"];
117
+ },
118
+ {
119
+ foreignKeyName: "analysis_jobs_reviewer_user_id_fkey";
120
+ columns: ["reviewer_user_id"];
121
+ isOneToOne: false;
122
+ referencedRelation: "users";
123
+ referencedColumns: ["id"];
124
+ }
125
+ ];
102
126
  };
103
127
  analysis_tasks: {
104
128
  Row: {
105
129
  artifact_id: number | null;
130
+ assignee_user_id: string | null;
106
131
  cpu_core_seconds: number | null;
107
132
  cpu_memory_avg: number | null;
108
133
  event_id: number | null;
@@ -112,7 +137,9 @@ export type Database = {
112
137
  gpu_seconds: number | null;
113
138
  id: number;
114
139
  job_id: number;
115
- model: string | null;
140
+ model_id: number | null;
141
+ review_status: Database["public"]["Enums"]["review_status"];
142
+ reviewer_user_id: string | null;
116
143
  status: Database["public"]["Enums"]["analysis_work_status"];
117
144
  task_type: string;
118
145
  time_finished: string | null;
@@ -120,6 +147,7 @@ export type Database = {
120
147
  };
121
148
  Insert: {
122
149
  artifact_id?: number | null;
150
+ assignee_user_id?: string | null;
123
151
  cpu_core_seconds?: number | null;
124
152
  cpu_memory_avg?: number | null;
125
153
  event_id?: number | null;
@@ -129,7 +157,9 @@ export type Database = {
129
157
  gpu_seconds?: number | null;
130
158
  id?: number;
131
159
  job_id: number;
132
- model?: string | null;
160
+ model_id?: number | null;
161
+ review_status?: Database["public"]["Enums"]["review_status"];
162
+ reviewer_user_id?: string | null;
133
163
  status?: Database["public"]["Enums"]["analysis_work_status"];
134
164
  task_type: string;
135
165
  time_finished?: string | null;
@@ -137,6 +167,7 @@ export type Database = {
137
167
  };
138
168
  Update: {
139
169
  artifact_id?: number | null;
170
+ assignee_user_id?: string | null;
140
171
  cpu_core_seconds?: number | null;
141
172
  cpu_memory_avg?: number | null;
142
173
  event_id?: number | null;
@@ -146,7 +177,9 @@ export type Database = {
146
177
  gpu_seconds?: number | null;
147
178
  id?: number;
148
179
  job_id?: number;
149
- model?: string | null;
180
+ model_id?: number | null;
181
+ review_status?: Database["public"]["Enums"]["review_status"];
182
+ reviewer_user_id?: string | null;
150
183
  status?: Database["public"]["Enums"]["analysis_work_status"];
151
184
  task_type?: string;
152
185
  time_finished?: string | null;
@@ -160,6 +193,13 @@ export type Database = {
160
193
  referencedRelation: "artifacts";
161
194
  referencedColumns: ["id"];
162
195
  },
196
+ {
197
+ foreignKeyName: "analysis_tasks_assignee_user_id_fkey";
198
+ columns: ["assignee_user_id"];
199
+ isOneToOne: false;
200
+ referencedRelation: "users";
201
+ referencedColumns: ["id"];
202
+ },
163
203
  {
164
204
  foreignKeyName: "analysis_tasks_event_id_fkey";
165
205
  columns: ["event_id"];
@@ -187,6 +227,20 @@ export type Database = {
187
227
  isOneToOne: false;
188
228
  referencedRelation: "analysis_jobs";
189
229
  referencedColumns: ["id"];
230
+ },
231
+ {
232
+ foreignKeyName: "analysis_tasks_model_id_fkey";
233
+ columns: ["model_id"];
234
+ isOneToOne: false;
235
+ referencedRelation: "models";
236
+ referencedColumns: ["id"];
237
+ },
238
+ {
239
+ foreignKeyName: "analysis_tasks_reviewer_user_id_fkey";
240
+ columns: ["reviewer_user_id"];
241
+ isOneToOne: false;
242
+ referencedRelation: "users";
243
+ referencedColumns: ["id"];
190
244
  }
191
245
  ];
192
246
  };
@@ -1119,6 +1173,87 @@ export type Database = {
1119
1173
  }
1120
1174
  ];
1121
1175
  };
1176
+ models: {
1177
+ Row: {
1178
+ capabilities: string[];
1179
+ id: number;
1180
+ inserted_at: string;
1181
+ is_active: boolean;
1182
+ metadata: Json;
1183
+ name: string;
1184
+ version: string;
1185
+ weights_sha256: string | null;
1186
+ weights_uri: string | null;
1187
+ };
1188
+ Insert: {
1189
+ capabilities?: string[];
1190
+ id?: number;
1191
+ inserted_at?: string;
1192
+ is_active?: boolean;
1193
+ metadata?: Json;
1194
+ name: string;
1195
+ version?: string;
1196
+ weights_sha256?: string | null;
1197
+ weights_uri?: string | null;
1198
+ };
1199
+ Update: {
1200
+ capabilities?: string[];
1201
+ id?: number;
1202
+ inserted_at?: string;
1203
+ is_active?: boolean;
1204
+ metadata?: Json;
1205
+ name?: string;
1206
+ version?: string;
1207
+ weights_sha256?: string | null;
1208
+ weights_uri?: string | null;
1209
+ };
1210
+ Relationships: [];
1211
+ };
1212
+ models_per_jobs_per_herd: {
1213
+ Row: {
1214
+ enabled: boolean;
1215
+ herd_id: number;
1216
+ id: number;
1217
+ inserted_at: string;
1218
+ job_type: string;
1219
+ model_id: number;
1220
+ priority: number;
1221
+ };
1222
+ Insert: {
1223
+ enabled?: boolean;
1224
+ herd_id: number;
1225
+ id?: number;
1226
+ inserted_at?: string;
1227
+ job_type: string;
1228
+ model_id: number;
1229
+ priority?: number;
1230
+ };
1231
+ Update: {
1232
+ enabled?: boolean;
1233
+ herd_id?: number;
1234
+ id?: number;
1235
+ inserted_at?: string;
1236
+ job_type?: string;
1237
+ model_id?: number;
1238
+ priority?: number;
1239
+ };
1240
+ Relationships: [
1241
+ {
1242
+ foreignKeyName: "models_per_jobs_per_herd_herd_id_fkey";
1243
+ columns: ["herd_id"];
1244
+ isOneToOne: false;
1245
+ referencedRelation: "herds";
1246
+ referencedColumns: ["id"];
1247
+ },
1248
+ {
1249
+ foreignKeyName: "models_per_jobs_per_herd_model_id_fkey";
1250
+ columns: ["model_id"];
1251
+ isOneToOne: false;
1252
+ referencedRelation: "models";
1253
+ referencedColumns: ["id"];
1254
+ }
1255
+ ];
1256
+ };
1122
1257
  observations: {
1123
1258
  Row: {
1124
1259
  action_complete: boolean;
@@ -1693,20 +1828,18 @@ export type Database = {
1693
1828
  artifact_id: number | null;
1694
1829
  class: string;
1695
1830
  conf: number;
1696
- detector: string;
1697
1831
  event_id: number | null;
1698
1832
  frame_index: number;
1699
1833
  height: number;
1700
1834
  id: number;
1701
1835
  inserted_at: string;
1836
+ model_id: number | null;
1702
1837
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
1703
1838
  origin_heading: number | null;
1704
1839
  origin_height: number | null;
1705
1840
  origin_location: unknown;
1706
1841
  origin_pitch: number | null;
1707
1842
  origin_roll: number | null;
1708
- score: number | null;
1709
- score_source: string | null;
1710
1843
  sensor_pitch: number | null;
1711
1844
  sensor_roll: number | null;
1712
1845
  sensor_yaw: number | null;
@@ -1722,20 +1855,18 @@ export type Database = {
1722
1855
  artifact_id?: number | null;
1723
1856
  class: string;
1724
1857
  conf: number;
1725
- detector?: string;
1726
1858
  event_id?: number | null;
1727
1859
  frame_index?: number;
1728
1860
  height?: number;
1729
1861
  id?: number;
1730
1862
  inserted_at?: string;
1863
+ model_id?: number | null;
1731
1864
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
1732
1865
  origin_heading?: number | null;
1733
1866
  origin_height?: number | null;
1734
1867
  origin_location?: unknown;
1735
1868
  origin_pitch?: number | null;
1736
1869
  origin_roll?: number | null;
1737
- score?: number | null;
1738
- score_source?: string | null;
1739
1870
  sensor_pitch?: number | null;
1740
1871
  sensor_roll?: number | null;
1741
1872
  sensor_yaw?: number | null;
@@ -1751,20 +1882,18 @@ export type Database = {
1751
1882
  artifact_id?: number | null;
1752
1883
  class?: string;
1753
1884
  conf?: number;
1754
- detector?: string;
1755
1885
  event_id?: number | null;
1756
1886
  frame_index?: number;
1757
1887
  height?: number;
1758
1888
  id?: number;
1759
1889
  inserted_at?: string;
1890
+ model_id?: number | null;
1760
1891
  observation_type?: Database["public"]["Enums"]["tag_observation_type"];
1761
1892
  origin_heading?: number | null;
1762
1893
  origin_height?: number | null;
1763
1894
  origin_location?: unknown;
1764
1895
  origin_pitch?: number | null;
1765
1896
  origin_roll?: number | null;
1766
- score?: number | null;
1767
- score_source?: string | null;
1768
1897
  sensor_pitch?: number | null;
1769
1898
  sensor_roll?: number | null;
1770
1899
  sensor_yaw?: number | null;
@@ -1804,6 +1933,13 @@ export type Database = {
1804
1933
  isOneToOne: false;
1805
1934
  referencedRelation: "events_with_tags_by_session";
1806
1935
  referencedColumns: ["id"];
1936
+ },
1937
+ {
1938
+ foreignKeyName: "tags_model_id_fkey";
1939
+ columns: ["model_id"];
1940
+ isOneToOne: false;
1941
+ referencedRelation: "models";
1942
+ referencedColumns: ["id"];
1807
1943
  }
1808
1944
  ];
1809
1945
  };
@@ -2177,10 +2313,6 @@ export type Database = {
2177
2313
  isSetofReturn: true;
2178
2314
  };
2179
2315
  };
2180
- auto_assign_session_post_approver: {
2181
- Args: never;
2182
- Returns: number;
2183
- };
2184
2316
  check_realtime_schema_status: {
2185
2317
  Args: never;
2186
2318
  Returns: {
@@ -2995,10 +3127,10 @@ export type Database = {
2995
3127
  get_minimal_subjects_for_artifact: {
2996
3128
  Args: {
2997
3129
  artifact_id_caller: number;
2998
- detector_models_caller?: string[];
2999
3130
  max_elements_caller?: number;
3000
3131
  min_avg_conf_caller?: number;
3001
3132
  min_count_caller?: number;
3133
+ model_ids_caller?: number[];
3002
3134
  };
3003
3135
  Returns: {
3004
3136
  avg_conf: number;
@@ -3105,6 +3237,16 @@ export type Database = {
3105
3237
  };
3106
3238
  };
3107
3239
  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
+ } | {
3108
3250
  Args: {
3109
3251
  device_id_caller?: number;
3110
3252
  end_date_caller?: string;
@@ -3117,6 +3259,16 @@ export type Database = {
3117
3259
  Returns: Json;
3118
3260
  };
3119
3261
  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
+ } | {
3120
3272
  Args: {
3121
3273
  device_id_caller?: number;
3122
3274
  end_date_caller?: string;
@@ -3195,9 +3347,9 @@ export type Database = {
3195
3347
  get_tags_for_artifact: {
3196
3348
  Args: {
3197
3349
  artifact_id_caller: number;
3198
- detector_models_caller?: string[];
3199
3350
  end_timestamp_caller?: string;
3200
3351
  max_elements_caller?: number;
3352
+ model_ids_caller?: number[];
3201
3353
  start_timestamp_caller?: string;
3202
3354
  };
3203
3355
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
@@ -3211,11 +3363,11 @@ export type Database = {
3211
3363
  get_tags_for_artifact_by_frame_index: {
3212
3364
  Args: {
3213
3365
  artifact_id_caller: number;
3214
- detector_models_caller?: string[];
3215
3366
  frame_index_end_caller: number;
3216
3367
  frame_index_start_caller: number;
3217
3368
  max_elements_caller?: number;
3218
3369
  min_conf_caller: number;
3370
+ model_ids_caller?: number[];
3219
3371
  };
3220
3372
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
3221
3373
  SetofOptions: {
@@ -3228,8 +3380,8 @@ export type Database = {
3228
3380
  get_tags_for_artifact_by_subject_id: {
3229
3381
  Args: {
3230
3382
  artifact_id_caller: number;
3231
- detector_models_caller?: string[];
3232
3383
  max_elements_caller?: number;
3384
+ model_ids_caller?: number[];
3233
3385
  subject_id_caller: number;
3234
3386
  };
3235
3387
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
@@ -3242,10 +3394,10 @@ export type Database = {
3242
3394
  };
3243
3395
  get_tags_for_event: {
3244
3396
  Args: {
3245
- detector_models_caller?: string[];
3246
3397
  end_timestamp_caller?: string;
3247
3398
  event_id_caller: number;
3248
3399
  max_elements_caller?: number;
3400
+ model_ids_caller?: number[];
3249
3401
  start_timestamp_caller?: string;
3250
3402
  };
3251
3403
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
@@ -3382,21 +3534,6 @@ export type Database = {
3382
3534
  isSetofReturn: true;
3383
3535
  };
3384
3536
  };
3385
- migrate_conservaition_users_to_sentala: {
3386
- Args: {
3387
- preview?: boolean;
3388
- source_domains?: string[];
3389
- target_domain?: string;
3390
- };
3391
- Returns: {
3392
- action: string;
3393
- detail: string;
3394
- source_email: string;
3395
- source_user_id: string;
3396
- target_email: string;
3397
- target_user_id: string;
3398
- }[];
3399
- };
3400
3537
  preview_fix_all_sessions_missing_distance: {
3401
3538
  Args: never;
3402
3539
  Returns: {
@@ -3591,6 +3728,7 @@ export type Database = {
3591
3728
  herd_invitation_status: "pending" | "accepted" | "revoked" | "expired";
3592
3729
  media_type: "image" | "video" | "audio" | "text";
3593
3730
  plan_type: "mission" | "fence" | "rally" | "markov";
3731
+ review_status: "pending" | "annotating" | "in_review" | "completed" | "rejected";
3594
3732
  tag_observation_type: "manual" | "auto";
3595
3733
  user_status: "ONLINE" | "OFFLINE";
3596
3734
  };
@@ -3822,7 +3960,6 @@ export type Database = {
3822
3960
  inserted_at: string | null;
3823
3961
  artifact_id: number | null;
3824
3962
  event_id: number | null;
3825
- detector: string | null;
3826
3963
  width: number | null;
3827
3964
  height: number | null;
3828
3965
  conf: number | null;
@@ -3846,8 +3983,7 @@ export type Database = {
3846
3983
  subject_latitude: number | null;
3847
3984
  subject_longitude: number | null;
3848
3985
  subject_id: number | null;
3849
- score: number | null;
3850
- score_source: string | null;
3986
+ model_id: number | null;
3851
3987
  };
3852
3988
  zones_and_actions_pretty_location: {
3853
3989
  id: number | null;
@@ -3918,6 +4054,7 @@ export declare const Constants: {
3918
4054
  readonly herd_invitation_status: readonly ["pending", "accepted", "revoked", "expired"];
3919
4055
  readonly media_type: readonly ["image", "video", "audio", "text"];
3920
4056
  readonly plan_type: readonly ["mission", "fence", "rally", "markov"];
4057
+ readonly review_status: readonly ["pending", "annotating", "in_review", "completed", "rejected"];
3921
4058
  readonly tag_observation_type: readonly ["manual", "auto"];
3922
4059
  readonly user_status: readonly ["ONLINE", "OFFLINE"];
3923
4060
  };
@@ -27,6 +27,13 @@ export const Constants = {
27
27
  herd_invitation_status: ["pending", "accepted", "revoked", "expired"],
28
28
  media_type: ["image", "video", "audio", "text"],
29
29
  plan_type: ["mission", "fence", "rally", "markov"],
30
+ review_status: [
31
+ "pending",
32
+ "annotating",
33
+ "in_review",
34
+ "completed",
35
+ "rejected",
36
+ ],
30
37
  tag_observation_type: ["manual", "auto"],
31
38
  user_status: ["ONLINE", "OFFLINE"],
32
39
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adventurelabs/scout-core",
3
- "version": "1.4.81",
3
+ "version": "1.4.83",
4
4
  "description": "Core utilities and helpers for Adventure Labs Scout applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",