@adventurelabs/scout-core 1.4.80 → 1.4.82

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.
@@ -1,8 +1,9 @@
1
1
  import { SupabaseClient } from "@supabase/supabase-js";
2
2
  import { Database } from "../types/supabase";
3
- import { IAbility, IHerdRole, IHerdRoleAbilityRow, IHerdRoleWithAbilities } from "../types/db";
3
+ import { IAbility, IHerdRole, IHerdRoleAbilityRow, IHerdRoleWithAbilities, IPlatformDefaultRoleAbilitiesGroup } from "../types/db";
4
4
  import { IWebResponseCompatible } from "../types/requests";
5
5
  export declare function server_list_abilities(supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IAbility[]>>;
6
+ export declare function server_get_abilities_by_ids(ids: number[], supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IAbility[]>>;
6
7
  export declare function server_get_herd_roles(herd_id: number, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdRole[]>>;
7
8
  export declare function server_get_herd_roles_with_abilities(herd_id: number, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdRoleWithAbilities[]>>;
8
9
  export declare function server_get_herd_role_by_system_name(herd_id: number, system_name: string, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdRole | null>>;
@@ -12,3 +13,6 @@ export declare function server_update_herd_role(herd_role_id: number, patch: {
12
13
  }, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdRole | null>>;
13
14
  export declare function server_delete_herd_role(herd_role_id: number, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<null>>;
14
15
  export declare function server_set_herd_role_abilities(herd_role_id: number, ability_ids: number[], supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IHerdRoleAbilityRow[]>>;
16
+ export declare function server_get_platform_default_role_abilities(supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<IPlatformDefaultRoleAbilitiesGroup[]>>;
17
+ export declare function server_set_platform_default_role_abilities(system_name: string, ability_keys: string[], supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<null>>;
18
+ export declare function server_reset_herd_default_role_abilities(herd_id: number, supabaseClient?: SupabaseClient<Database>): Promise<IWebResponseCompatible<null>>;
@@ -12,6 +12,21 @@ export async function server_list_abilities(supabaseClient) {
12
12
  }
13
13
  return IWebResponse.success(data ?? []).to_compatible();
14
14
  }
15
+ export async function server_get_abilities_by_ids(ids, supabaseClient) {
16
+ if (ids.length === 0) {
17
+ return IWebResponse.success([]).to_compatible();
18
+ }
19
+ const supabase = supabaseClient ?? (await newServerClient());
20
+ const { data, error } = await supabase
21
+ .from("abilities")
22
+ .select("*")
23
+ .in("id", ids)
24
+ .order("key", { ascending: true });
25
+ if (error) {
26
+ return IWebResponse.error(error.message).to_compatible();
27
+ }
28
+ return IWebResponse.success(data ?? []).to_compatible();
29
+ }
15
30
  export async function server_get_herd_roles(herd_id, supabaseClient) {
16
31
  const supabase = supabaseClient ?? (await newServerClient());
17
32
  const { data, error } = await supabase
@@ -132,3 +147,35 @@ export async function server_set_herd_role_abilities(herd_role_id, ability_ids,
132
147
  }
133
148
  return IWebResponse.success(data ?? []).to_compatible();
134
149
  }
150
+ export async function server_get_platform_default_role_abilities(supabaseClient) {
151
+ const supabase = supabaseClient ?? (await newServerClient());
152
+ const { data, error } = await supabase.rpc("get_platform_default_role_abilities");
153
+ if (error) {
154
+ return IWebResponse.error(error.message).to_compatible();
155
+ }
156
+ const groups = Array.isArray(data)
157
+ ? data
158
+ : [];
159
+ return IWebResponse.success(groups).to_compatible();
160
+ }
161
+ export async function server_set_platform_default_role_abilities(system_name, ability_keys, supabaseClient) {
162
+ const supabase = supabaseClient ?? (await newServerClient());
163
+ const { error } = await supabase.rpc("set_platform_default_role_abilities", {
164
+ p_system_name: system_name,
165
+ p_ability_keys: ability_keys,
166
+ });
167
+ if (error) {
168
+ return IWebResponse.error(error.message).to_compatible();
169
+ }
170
+ return IWebResponse.success(null).to_compatible();
171
+ }
172
+ export async function server_reset_herd_default_role_abilities(herd_id, supabaseClient) {
173
+ const supabase = supabaseClient ?? (await newServerClient());
174
+ const { error } = await supabase.rpc("reset_herd_default_role_abilities", {
175
+ p_herd_id: herd_id,
176
+ });
177
+ if (error) {
178
+ return IWebResponse.error(error.message).to_compatible();
179
+ }
180
+ return IWebResponse.success(null).to_compatible();
181
+ }
@@ -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
  }),
@@ -33,6 +33,15 @@ export type IHerdRoleWithAbilities = IHerdRole & {
33
33
  abilities: IAbility[];
34
34
  ability_ids: number[];
35
35
  };
36
+ export type IPlatformDefaultRoleAbilityRow = Database["public"]["Tables"]["platform_default_role_abilities"]["Row"];
37
+ /** One system role's default ability set from `get_platform_default_role_abilities`. */
38
+ export interface IPlatformDefaultRoleAbilitiesGroup {
39
+ system_name: string;
40
+ abilities: {
41
+ id: number;
42
+ key: string;
43
+ }[];
44
+ }
36
45
  /** Stable machine id on `herd_roles` (e.g. admin, editor, viewer). Not `herds.slug`. */
37
46
  export type HerdRoleSystemName = string;
38
47
  export type IHerdInvitation = Database["public"]["Tables"]["herd_invitations"]["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;
@@ -1352,6 +1487,35 @@ export type Database = {
1352
1487
  }
1353
1488
  ];
1354
1489
  };
1490
+ platform_default_role_abilities: {
1491
+ Row: {
1492
+ ability_id: number;
1493
+ id: number;
1494
+ inserted_at: string;
1495
+ system_name: string;
1496
+ };
1497
+ Insert: {
1498
+ ability_id: number;
1499
+ id?: number;
1500
+ inserted_at?: string;
1501
+ system_name: string;
1502
+ };
1503
+ Update: {
1504
+ ability_id?: number;
1505
+ id?: number;
1506
+ inserted_at?: string;
1507
+ system_name?: string;
1508
+ };
1509
+ Relationships: [
1510
+ {
1511
+ foreignKeyName: "platform_default_role_abilities_ability_id_fkey";
1512
+ columns: ["ability_id"];
1513
+ isOneToOne: false;
1514
+ referencedRelation: "abilities";
1515
+ referencedColumns: ["id"];
1516
+ }
1517
+ ];
1518
+ };
1355
1519
  platform_superadmins: {
1356
1520
  Row: {
1357
1521
  inserted_at: string;
@@ -1664,20 +1828,18 @@ export type Database = {
1664
1828
  artifact_id: number | null;
1665
1829
  class: string;
1666
1830
  conf: number;
1667
- detector: string;
1668
1831
  event_id: number | null;
1669
1832
  frame_index: number;
1670
1833
  height: number;
1671
1834
  id: number;
1672
1835
  inserted_at: string;
1836
+ model_id: number | null;
1673
1837
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
1674
1838
  origin_heading: number | null;
1675
1839
  origin_height: number | null;
1676
1840
  origin_location: unknown;
1677
1841
  origin_pitch: number | null;
1678
1842
  origin_roll: number | null;
1679
- score: number | null;
1680
- score_source: string | null;
1681
1843
  sensor_pitch: number | null;
1682
1844
  sensor_roll: number | null;
1683
1845
  sensor_yaw: number | null;
@@ -1693,20 +1855,18 @@ export type Database = {
1693
1855
  artifact_id?: number | null;
1694
1856
  class: string;
1695
1857
  conf: number;
1696
- detector?: string;
1697
1858
  event_id?: number | null;
1698
1859
  frame_index?: number;
1699
1860
  height?: number;
1700
1861
  id?: number;
1701
1862
  inserted_at?: string;
1863
+ model_id?: number | null;
1702
1864
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
1703
1865
  origin_heading?: number | null;
1704
1866
  origin_height?: number | null;
1705
1867
  origin_location?: unknown;
1706
1868
  origin_pitch?: number | null;
1707
1869
  origin_roll?: number | null;
1708
- score?: number | null;
1709
- score_source?: string | null;
1710
1870
  sensor_pitch?: number | null;
1711
1871
  sensor_roll?: number | null;
1712
1872
  sensor_yaw?: number | null;
@@ -1722,20 +1882,18 @@ export type Database = {
1722
1882
  artifact_id?: number | null;
1723
1883
  class?: string;
1724
1884
  conf?: number;
1725
- detector?: string;
1726
1885
  event_id?: number | null;
1727
1886
  frame_index?: number;
1728
1887
  height?: number;
1729
1888
  id?: number;
1730
1889
  inserted_at?: string;
1890
+ model_id?: number | null;
1731
1891
  observation_type?: Database["public"]["Enums"]["tag_observation_type"];
1732
1892
  origin_heading?: number | null;
1733
1893
  origin_height?: number | null;
1734
1894
  origin_location?: unknown;
1735
1895
  origin_pitch?: number | null;
1736
1896
  origin_roll?: number | null;
1737
- score?: number | null;
1738
- score_source?: string | null;
1739
1897
  sensor_pitch?: number | null;
1740
1898
  sensor_roll?: number | null;
1741
1899
  sensor_yaw?: number | null;
@@ -1775,6 +1933,13 @@ export type Database = {
1775
1933
  isOneToOne: false;
1776
1934
  referencedRelation: "events_with_tags_by_session";
1777
1935
  referencedColumns: ["id"];
1936
+ },
1937
+ {
1938
+ foreignKeyName: "tags_model_id_fkey";
1939
+ columns: ["model_id"];
1940
+ isOneToOne: false;
1941
+ referencedRelation: "models";
1942
+ referencedColumns: ["id"];
1778
1943
  }
1779
1944
  ];
1780
1945
  };
@@ -2148,10 +2313,6 @@ export type Database = {
2148
2313
  isSetofReturn: true;
2149
2314
  };
2150
2315
  };
2151
- auto_assign_session_post_approver: {
2152
- Args: never;
2153
- Returns: number;
2154
- };
2155
2316
  check_realtime_schema_status: {
2156
2317
  Args: never;
2157
2318
  Returns: {
@@ -2966,10 +3127,10 @@ export type Database = {
2966
3127
  get_minimal_subjects_for_artifact: {
2967
3128
  Args: {
2968
3129
  artifact_id_caller: number;
2969
- detector_models_caller?: string[];
2970
3130
  max_elements_caller?: number;
2971
3131
  min_avg_conf_caller?: number;
2972
3132
  min_count_caller?: number;
3133
+ model_ids_caller?: number[];
2973
3134
  };
2974
3135
  Returns: {
2975
3136
  avg_conf: number;
@@ -2991,6 +3152,10 @@ export type Database = {
2991
3152
  isSetofReturn: true;
2992
3153
  };
2993
3154
  };
3155
+ get_platform_default_role_abilities: {
3156
+ Args: never;
3157
+ Returns: Json;
3158
+ };
2994
3159
  get_pubsub_jwt_public_keys: {
2995
3160
  Args: never;
2996
3161
  Returns: Json;
@@ -3072,6 +3237,16 @@ export type Database = {
3072
3237
  };
3073
3238
  };
3074
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
+ } | {
3075
3250
  Args: {
3076
3251
  device_id_caller?: number;
3077
3252
  end_date_caller?: string;
@@ -3084,6 +3259,16 @@ export type Database = {
3084
3259
  Returns: Json;
3085
3260
  };
3086
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
+ } | {
3087
3272
  Args: {
3088
3273
  device_id_caller?: number;
3089
3274
  end_date_caller?: string;
@@ -3162,9 +3347,9 @@ export type Database = {
3162
3347
  get_tags_for_artifact: {
3163
3348
  Args: {
3164
3349
  artifact_id_caller: number;
3165
- detector_models_caller?: string[];
3166
3350
  end_timestamp_caller?: string;
3167
3351
  max_elements_caller?: number;
3352
+ model_ids_caller?: number[];
3168
3353
  start_timestamp_caller?: string;
3169
3354
  };
3170
3355
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
@@ -3178,11 +3363,11 @@ export type Database = {
3178
3363
  get_tags_for_artifact_by_frame_index: {
3179
3364
  Args: {
3180
3365
  artifact_id_caller: number;
3181
- detector_models_caller?: string[];
3182
3366
  frame_index_end_caller: number;
3183
3367
  frame_index_start_caller: number;
3184
3368
  max_elements_caller?: number;
3185
3369
  min_conf_caller: number;
3370
+ model_ids_caller?: number[];
3186
3371
  };
3187
3372
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
3188
3373
  SetofOptions: {
@@ -3195,8 +3380,8 @@ export type Database = {
3195
3380
  get_tags_for_artifact_by_subject_id: {
3196
3381
  Args: {
3197
3382
  artifact_id_caller: number;
3198
- detector_models_caller?: string[];
3199
3383
  max_elements_caller?: number;
3384
+ model_ids_caller?: number[];
3200
3385
  subject_id_caller: number;
3201
3386
  };
3202
3387
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
@@ -3209,10 +3394,10 @@ export type Database = {
3209
3394
  };
3210
3395
  get_tags_for_event: {
3211
3396
  Args: {
3212
- detector_models_caller?: string[];
3213
3397
  end_timestamp_caller?: string;
3214
3398
  event_id_caller: number;
3215
3399
  max_elements_caller?: number;
3400
+ model_ids_caller?: number[];
3216
3401
  start_timestamp_caller?: string;
3217
3402
  };
3218
3403
  Returns: Database["public"]["CompositeTypes"]["tags_pretty_location"][];
@@ -3349,21 +3534,6 @@ export type Database = {
3349
3534
  isSetofReturn: true;
3350
3535
  };
3351
3536
  };
3352
- migrate_conservaition_users_to_sentala: {
3353
- Args: {
3354
- preview?: boolean;
3355
- source_domains?: string[];
3356
- target_domain?: string;
3357
- };
3358
- Returns: {
3359
- action: string;
3360
- detail: string;
3361
- source_email: string;
3362
- source_user_id: string;
3363
- target_email: string;
3364
- target_user_id: string;
3365
- }[];
3366
- };
3367
3537
  preview_fix_all_sessions_missing_distance: {
3368
3538
  Args: never;
3369
3539
  Returns: {
@@ -3438,6 +3608,12 @@ export type Database = {
3438
3608
  isSetofReturn: false;
3439
3609
  };
3440
3610
  };
3611
+ reset_herd_default_role_abilities: {
3612
+ Args: {
3613
+ p_herd_id: number;
3614
+ };
3615
+ Returns: undefined;
3616
+ };
3441
3617
  revoke_client_abilities_jwt_public_key: {
3442
3618
  Args: {
3443
3619
  p_kid: string;
@@ -3501,6 +3677,13 @@ export type Database = {
3501
3677
  };
3502
3678
  Returns: undefined;
3503
3679
  };
3680
+ set_platform_default_role_abilities: {
3681
+ Args: {
3682
+ p_ability_keys: string[];
3683
+ p_system_name: string;
3684
+ };
3685
+ Returns: undefined;
3686
+ };
3504
3687
  sync_orphan_session_links: {
3505
3688
  Args: {
3506
3689
  preview?: boolean;
@@ -3545,6 +3728,7 @@ export type Database = {
3545
3728
  herd_invitation_status: "pending" | "accepted" | "revoked" | "expired";
3546
3729
  media_type: "image" | "video" | "audio" | "text";
3547
3730
  plan_type: "mission" | "fence" | "rally" | "markov";
3731
+ review_status: "pending" | "annotating" | "in_review" | "completed" | "rejected";
3548
3732
  tag_observation_type: "manual" | "auto";
3549
3733
  user_status: "ONLINE" | "OFFLINE";
3550
3734
  };
@@ -3776,7 +3960,6 @@ export type Database = {
3776
3960
  inserted_at: string | null;
3777
3961
  artifact_id: number | null;
3778
3962
  event_id: number | null;
3779
- detector: string | null;
3780
3963
  width: number | null;
3781
3964
  height: number | null;
3782
3965
  conf: number | null;
@@ -3800,8 +3983,7 @@ export type Database = {
3800
3983
  subject_latitude: number | null;
3801
3984
  subject_longitude: number | null;
3802
3985
  subject_id: number | null;
3803
- score: number | null;
3804
- score_source: string | null;
3986
+ model_id: number | null;
3805
3987
  };
3806
3988
  zones_and_actions_pretty_location: {
3807
3989
  id: number | null;
@@ -3872,6 +4054,7 @@ export declare const Constants: {
3872
4054
  readonly herd_invitation_status: readonly ["pending", "accepted", "revoked", "expired"];
3873
4055
  readonly media_type: readonly ["image", "video", "audio", "text"];
3874
4056
  readonly plan_type: readonly ["mission", "fence", "rally", "markov"];
4057
+ readonly review_status: readonly ["pending", "annotating", "in_review", "completed", "rejected"];
3875
4058
  readonly tag_observation_type: readonly ["manual", "auto"];
3876
4059
  readonly user_status: readonly ["ONLINE", "OFFLINE"];
3877
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.80",
3
+ "version": "1.4.82",
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",