@adventurelabs/scout-core 1.0.40 → 1.0.41

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.
@@ -172,47 +172,25 @@ export async function server_get_events_and_tags_for_devices_batch(device_ids, l
172
172
  if (!eventsByDevice[device_id]) {
173
173
  eventsByDevice[device_id] = [];
174
174
  }
175
- // Find existing event or create new one
176
- let event = eventsByDevice[device_id].find((e) => e.id === row.event_id);
177
- if (!event) {
178
- event = {
179
- id: row.event_id,
180
- inserted_at: row.event_inserted_at,
181
- message: row.event_message,
182
- media_url: row.event_media_url,
183
- file_path: row.event_file_path,
184
- latitude: row.event_location
185
- ? JSON.parse(row.event_location).coordinates[1]
186
- : null,
187
- longitude: row.event_location
188
- ? JSON.parse(row.event_location).coordinates[0]
189
- : null,
190
- altitude: row.event_altitude,
191
- heading: row.event_heading,
192
- media_type: row.event_media_type,
193
- device_id: device_id,
194
- timestamp_observation: row.event_timestamp_observation,
195
- is_public: row.event_is_public,
196
- earthranger_url: row.event_earthranger_url,
197
- tags: [],
198
- };
199
- eventsByDevice[device_id].push(event);
200
- }
201
- // Add tag if it exists
202
- if (row.tag_id) {
203
- event.tags.push({
204
- id: row.tag_id,
205
- x: row.tag_x || 0,
206
- y: row.tag_y || 0,
207
- width: row.tag_width || 0,
208
- height: row.tag_height || 0,
209
- class_name: row.tag_class_name || "",
210
- conf: row.tag_conf || 0,
211
- observation_type: row.tag_observation_type || "manual",
212
- event_id: row.event_id,
213
- inserted_at: row.tag_inserted_at || row.event_inserted_at,
214
- });
215
- }
175
+ // Create event object from the new structure
176
+ const event = {
177
+ id: row.event_id,
178
+ inserted_at: row.inserted_at,
179
+ message: row.message,
180
+ media_url: row.media_url,
181
+ file_path: row.file_path,
182
+ latitude: row.latitude,
183
+ longitude: row.longitude,
184
+ altitude: row.altitude,
185
+ heading: row.heading,
186
+ media_type: row.media_type,
187
+ device_id: device_id,
188
+ timestamp_observation: row.timestamp_observation,
189
+ is_public: row.is_public,
190
+ earthranger_url: row.earthranger_url,
191
+ tags: Array.isArray(row.tags) ? row.tags : [],
192
+ };
193
+ eventsByDevice[device_id].push(event);
216
194
  });
217
195
  // Add signed URLs to all events
218
196
  const result = {};
@@ -760,29 +760,22 @@ export declare function useSupabase(): SupabaseClient<Database, "public", {
760
760
  limit_per_device: number;
761
761
  };
762
762
  Returns: {
763
- device_id: number;
764
763
  event_id: number;
765
- event_message: string | null;
766
- event_media_url: string | null;
767
- event_file_path: string | null;
768
- event_location: string | null;
769
- event_altitude: number;
770
- event_heading: number;
771
- event_media_type: string;
772
- event_timestamp_observation: string;
773
- event_is_public: boolean;
774
- event_earthranger_url: string | null;
775
- event_session_id: number | null;
776
- event_inserted_at: string;
777
- tag_id: number | null;
778
- tag_x: number | null;
779
- tag_y: number | null;
780
- tag_width: number | null;
781
- tag_height: number | null;
782
- tag_class_name: string | null;
783
- tag_conf: number | null;
784
- tag_observation_type: string | null;
785
- tag_inserted_at: string | null;
764
+ inserted_at: string;
765
+ message: string | null;
766
+ media_url: string | null;
767
+ file_path: string | null;
768
+ latitude: number | null;
769
+ longitude: number | null;
770
+ earthranger_url: string | null;
771
+ altitude: number;
772
+ heading: number;
773
+ media_type: string;
774
+ device_id: number;
775
+ timestamp_observation: string;
776
+ is_public: boolean;
777
+ tags: import("../types/supabase").Json;
778
+ herd_id: number | null;
786
779
  }[];
787
780
  };
788
781
  };
@@ -751,29 +751,22 @@ export declare function newServerClient(): Promise<import("@supabase/supabase-js
751
751
  limit_per_device: number;
752
752
  };
753
753
  Returns: {
754
- device_id: number;
755
754
  event_id: number;
756
- event_message: string | null;
757
- event_media_url: string | null;
758
- event_file_path: string | null;
759
- event_location: string | null;
760
- event_altitude: number;
761
- event_heading: number;
762
- event_media_type: string;
763
- event_timestamp_observation: string;
764
- event_is_public: boolean;
765
- event_earthranger_url: string | null;
766
- event_session_id: number | null;
767
- event_inserted_at: string;
768
- tag_id: number | null;
769
- tag_x: number | null;
770
- tag_y: number | null;
771
- tag_width: number | null;
772
- tag_height: number | null;
773
- tag_class_name: string | null;
774
- tag_conf: number | null;
775
- tag_observation_type: string | null;
776
- tag_inserted_at: string | null;
755
+ inserted_at: string;
756
+ message: string | null;
757
+ media_url: string | null;
758
+ file_path: string | null;
759
+ latitude: number | null;
760
+ longitude: number | null;
761
+ earthranger_url: string | null;
762
+ altitude: number;
763
+ heading: number;
764
+ media_type: string;
765
+ device_id: number;
766
+ timestamp_observation: string;
767
+ is_public: boolean;
768
+ tags: import("../types/supabase").Json;
769
+ herd_id: number | null;
777
770
  }[];
778
771
  };
779
772
  };
@@ -818,29 +818,22 @@ export type Database = {
818
818
  limit_per_device: number;
819
819
  };
820
820
  Returns: {
821
- device_id: number;
822
821
  event_id: number;
823
- event_message: string | null;
824
- event_media_url: string | null;
825
- event_file_path: string | null;
826
- event_location: string | null;
827
- event_altitude: number;
828
- event_heading: number;
829
- event_media_type: string;
830
- event_timestamp_observation: string;
831
- event_is_public: boolean;
832
- event_earthranger_url: string | null;
833
- event_session_id: number | null;
834
- event_inserted_at: string;
835
- tag_id: number | null;
836
- tag_x: number | null;
837
- tag_y: number | null;
838
- tag_width: number | null;
839
- tag_height: number | null;
840
- tag_class_name: string | null;
841
- tag_conf: number | null;
842
- tag_observation_type: string | null;
843
- tag_inserted_at: string | null;
822
+ inserted_at: string;
823
+ message: string | null;
824
+ media_url: string | null;
825
+ file_path: string | null;
826
+ latitude: number | null;
827
+ longitude: number | null;
828
+ earthranger_url: string | null;
829
+ altitude: number;
830
+ heading: number;
831
+ media_type: string;
832
+ device_id: number;
833
+ timestamp_observation: string;
834
+ is_public: boolean;
835
+ tags: Json;
836
+ herd_id: number | null;
844
837
  }[];
845
838
  };
846
839
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adventurelabs/scout-core",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
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",