@adventurelabs/scout-core 1.4.62 → 1.4.64

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,7 +1,8 @@
1
1
  "use server";
2
2
  import { newServerClient } from "../supabase/server";
3
3
  import { IWebResponse } from "../types/requests";
4
- import { generateSignedUrlsBatch, generateSignedUrl, isNonEmptyStorageFilePath, } from "./storage";
4
+ import { generateSignedUrlsBatch, generateSignedUrl, } from "./storage";
5
+ import { isNonEmptyStorageFilePath } from "./storagePath";
5
6
  export async function server_get_artifact_by_id(id, client) {
6
7
  const supabase = client || (await newServerClient());
7
8
  const { data, error } = await supabase
@@ -2,7 +2,8 @@
2
2
  import { newServerClient } from "../supabase/server";
3
3
  import { EnumWebResponse, IWebResponse, } from "../types/requests";
4
4
  import { EnumSessionsVisibility } from "../types/events";
5
- import { generateSignedUrl, isNonEmptyStorageFilePath } from "./storage";
5
+ import { generateSignedUrl } from "./storage";
6
+ import { isNonEmptyStorageFilePath } from "./storagePath";
6
7
  export async function server_get_event_by_id(id, client) {
7
8
  const supabase = client || (await newServerClient());
8
9
  const { data, error } = await supabase
@@ -28,3 +28,4 @@ export * from "./versions_software";
28
28
  export * from "./versions_software_server";
29
29
  export * from "./artifacts";
30
30
  export * from "./pins";
31
+ export * from "./storagePath";
@@ -28,3 +28,4 @@ export * from "./versions_software";
28
28
  export * from "./versions_software_server";
29
29
  export * from "./artifacts";
30
30
  export * from "./pins";
31
+ export * from "./storagePath";
@@ -1,7 +1,8 @@
1
1
  "use server";
2
2
  import { newServerClient } from "../supabase/server";
3
3
  import { EnumWebResponse, IWebResponse, } from "../types/requests";
4
- import { generateSignedUrlsBatch, isNonEmptyStorageFilePath, } from "./storage";
4
+ import { generateSignedUrlsBatch, } from "./storage";
5
+ import { isNonEmptyStorageFilePath } from "./storagePath";
5
6
  // Get session by ID with coordinates
6
7
  export async function server_get_session_by_id(sessionId, client) {
7
8
  const supabase = client || (await newServerClient());
@@ -1,5 +1,4 @@
1
1
  import { SupabaseClient } from "@supabase/supabase-js";
2
2
  import { Database } from "../types/supabase";
3
- export { parseStorageFilePath, isNonEmptyStorageFilePath } from "./storagePath";
4
3
  export declare function generateSignedUrl(filePath: string, expiresIn?: number, supabaseClient?: SupabaseClient<Database>): Promise<string | null>;
5
4
  export declare function generateSignedUrlsBatch(filePaths: string[], expiresIn?: number, supabaseClient?: SupabaseClient<Database>): Promise<(string | null)[]>;
@@ -2,7 +2,6 @@
2
2
  import { newServerClient } from "../supabase/server";
3
3
  import { SIGNED_URL_EXPIRATION_SECONDS } from "../constants/db";
4
4
  import { parseStorageFilePath } from "./storagePath";
5
- export { parseStorageFilePath, isNonEmptyStorageFilePath } from "./storagePath";
6
5
  export async function generateSignedUrl(filePath, expiresIn = SIGNED_URL_EXPIRATION_SECONDS, supabaseClient) {
7
6
  try {
8
7
  const supabase = supabaseClient || (await newServerClient());
@@ -2,7 +2,8 @@
2
2
  // add tag to db
3
3
  import { newServerClient } from "../supabase/server";
4
4
  import { EnumWebResponse, IWebResponse, } from "../types/requests";
5
- import { generateSignedUrlsBatch, generateSignedUrl, isNonEmptyStorageFilePath, } from "./storage";
5
+ import { generateSignedUrlsBatch, generateSignedUrl, } from "./storage";
6
+ import { isNonEmptyStorageFilePath } from "./storagePath";
6
7
  // Helper functions to extract coordinates from location field
7
8
  function extractLatitude(location) {
8
9
  try {
@@ -123,16 +124,11 @@ export async function server_update_tags(tags) {
123
124
  // Update each tag individually since we need to preserve the id
124
125
  const updatedTags = [];
125
126
  for (const tag of tags) {
126
- const { id, ...updateData } = tag;
127
+ const { id, inserted_at: _ignoredInsertedAt, ...updateData } = tag;
127
128
  const { data, error } = await supabase
128
129
  .from("tags")
129
130
  .update({
130
- x: updateData.x,
131
- y: updateData.y,
132
- width: updateData.width,
133
- height: updateData.height,
134
- class: updateData.class,
135
- conf: updateData.conf,
131
+ ...updateData,
136
132
  observation_type: updateData.observation_type,
137
133
  })
138
134
  .eq("id", id)
@@ -290,6 +286,9 @@ export async function server_get_events_and_tags_for_devices_batch(device_ids, l
290
286
  earthranger_url: row.earthranger_url,
291
287
  herd_id: row.herd_id,
292
288
  tags: Array.isArray(row.tags) ? row.tags : [],
289
+ embedded_at: row.embedded_at ?? null,
290
+ segmented_at: row.segmented_at ?? null,
291
+ tagged_at: row.tagged_at ?? null,
293
292
  };
294
293
  eventsByDevice[device_id].push(event);
295
294
  });
@@ -451,6 +450,8 @@ export async function get_event_and_tags_by_event_id(event_id) {
451
450
  subject_latitude: subjectLat,
452
451
  subject_longitude: subjectLon,
453
452
  subject_id: tag.subject_id ?? null,
453
+ score: tag.score ?? null,
454
+ score_source: tag.score_source ?? null,
454
455
  };
455
456
  }),
456
457
  earthranger_url: data[0].earthranger_url,
@@ -33,7 +33,8 @@ export async function server_get_users_with_herd_access(herd_id, supabaseClient)
33
33
  role,
34
34
  users (
35
35
  id,
36
- username
36
+ username,
37
+ earthranger_id
37
38
  )
38
39
  `)
39
40
  .eq("herd_id", herd_id);
package/dist/index.d.ts CHANGED
@@ -46,6 +46,7 @@ export * from "./helpers/operators";
46
46
  export * from "./helpers/versions_software";
47
47
  export * from "./helpers/versions_software_server";
48
48
  export * from "./helpers/parts";
49
+ export * from "./helpers/storagePath";
49
50
  export * from "./hooks/useScoutRealtimeConnectivity";
50
51
  export * from "./hooks/useScoutRealtimeDevices";
51
52
  export * from "./hooks/useScoutRealtimeVersionsSoftware";
package/dist/index.js CHANGED
@@ -49,6 +49,7 @@ export * from "./helpers/operators";
49
49
  export * from "./helpers/versions_software";
50
50
  export * from "./helpers/versions_software_server";
51
51
  export * from "./helpers/parts";
52
+ export * from "./helpers/storagePath";
52
53
  // Hooks
53
54
  export * from "./hooks/useScoutRealtimeConnectivity";
54
55
  export * from "./hooks/useScoutRealtimeDevices";
@@ -1267,6 +1267,8 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1267
1267
  origin_location: unknown;
1268
1268
  origin_pitch: number | null;
1269
1269
  origin_roll: number | null;
1270
+ score: number | null;
1271
+ score_source: string | null;
1270
1272
  sensor_pitch: number | null;
1271
1273
  sensor_roll: number | null;
1272
1274
  sensor_yaw: number | null;
@@ -1294,6 +1296,8 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1294
1296
  origin_location?: unknown;
1295
1297
  origin_pitch?: number | null;
1296
1298
  origin_roll?: number | null;
1299
+ score?: number | null;
1300
+ score_source?: string | null;
1297
1301
  sensor_pitch?: number | null;
1298
1302
  sensor_roll?: number | null;
1299
1303
  sensor_yaw?: number | null;
@@ -1321,6 +1325,8 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1321
1325
  origin_location?: unknown;
1322
1326
  origin_pitch?: number | null;
1323
1327
  origin_roll?: number | null;
1328
+ score?: number | null;
1329
+ score_source?: string | null;
1324
1330
  sensor_pitch?: number | null;
1325
1331
  sensor_roll?: number | null;
1326
1332
  sensor_yaw?: number | null;
@@ -1360,14 +1366,17 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1360
1366
  };
1361
1367
  users: {
1362
1368
  Row: {
1369
+ earthranger_id: string | null;
1363
1370
  id: string;
1364
1371
  username: string | null;
1365
1372
  };
1366
1373
  Insert: {
1374
+ earthranger_id?: string | null;
1367
1375
  id: string;
1368
1376
  username?: string | null;
1369
1377
  };
1370
1378
  Update: {
1379
+ earthranger_id?: string | null;
1371
1380
  id?: string;
1372
1381
  username?: string | null;
1373
1382
  };
@@ -3030,6 +3039,8 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
3030
3039
  subject_latitude: number | null;
3031
3040
  subject_longitude: number | null;
3032
3041
  subject_id: number | null;
3042
+ score: number | null;
3043
+ score_source: string | null;
3033
3044
  };
3034
3045
  zones_and_actions_pretty_location: {
3035
3046
  id: number | null;
package/dist/store/api.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createApi, fakeBaseQuery } from "@reduxjs/toolkit/query/react";
2
- import { generateSignedUrlsBatch, isNonEmptyStorageFilePath, } from "../helpers/storage";
2
+ import { generateSignedUrlsBatch, } from "../helpers/storage";
3
+ import { isNonEmptyStorageFilePath } from "../helpers/storagePath";
3
4
  async function signedUrlMapForFeedRows(rows) {
4
5
  const seen = new Set();
5
6
  const paths = [];
@@ -125,10 +125,7 @@ export interface IEventWithSession extends IEvent {
125
125
  session: ISession | null;
126
126
  }
127
127
  export type IUserAndRole = {
128
- user: {
129
- id: string;
130
- username: string | null;
131
- } | null;
128
+ user: Pick<Database["public"]["Tables"]["users"]["Row"], "id" | "username" | "earthranger_id"> | null;
132
129
  role: Role;
133
130
  };
134
131
  export interface IApiKeyScout {
@@ -1332,6 +1332,8 @@ export type Database = {
1332
1332
  origin_location: unknown;
1333
1333
  origin_pitch: number | null;
1334
1334
  origin_roll: number | null;
1335
+ score: number | null;
1336
+ score_source: string | null;
1335
1337
  sensor_pitch: number | null;
1336
1338
  sensor_roll: number | null;
1337
1339
  sensor_yaw: number | null;
@@ -1359,6 +1361,8 @@ export type Database = {
1359
1361
  origin_location?: unknown;
1360
1362
  origin_pitch?: number | null;
1361
1363
  origin_roll?: number | null;
1364
+ score?: number | null;
1365
+ score_source?: string | null;
1362
1366
  sensor_pitch?: number | null;
1363
1367
  sensor_roll?: number | null;
1364
1368
  sensor_yaw?: number | null;
@@ -1386,6 +1390,8 @@ export type Database = {
1386
1390
  origin_location?: unknown;
1387
1391
  origin_pitch?: number | null;
1388
1392
  origin_roll?: number | null;
1393
+ score?: number | null;
1394
+ score_source?: string | null;
1389
1395
  sensor_pitch?: number | null;
1390
1396
  sensor_roll?: number | null;
1391
1397
  sensor_yaw?: number | null;
@@ -1430,14 +1436,17 @@ export type Database = {
1430
1436
  };
1431
1437
  users: {
1432
1438
  Row: {
1439
+ earthranger_id: string | null;
1433
1440
  id: string;
1434
1441
  username: string | null;
1435
1442
  };
1436
1443
  Insert: {
1444
+ earthranger_id?: string | null;
1437
1445
  id: string;
1438
1446
  username?: string | null;
1439
1447
  };
1440
1448
  Update: {
1449
+ earthranger_id?: string | null;
1441
1450
  id?: string;
1442
1451
  username?: string | null;
1443
1452
  };
@@ -3115,6 +3124,8 @@ export type Database = {
3115
3124
  subject_latitude: number | null;
3116
3125
  subject_longitude: number | null;
3117
3126
  subject_id: number | null;
3127
+ score: number | null;
3128
+ score_source: string | null;
3118
3129
  };
3119
3130
  zones_and_actions_pretty_location: {
3120
3131
  id: number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adventurelabs/scout-core",
3
- "version": "1.4.62",
3
+ "version": "1.4.64",
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",