@adventurelabs/scout-core 1.0.100 → 1.0.101

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.
@@ -10,7 +10,9 @@ export function convertDateToTimeString(date) {
10
10
  return `${date.toLocaleTimeString()}, ${date.toLocaleDateString()} UTC`;
11
11
  }
12
12
  // Format a Date object as a PostgreSQL-compatible timestamp string
13
- // Returns format: "YYYY-MM-DDTHH:MM:SS.SSSZ" (ISO 8601 with timezone)
13
+ // Returns ISO 8601 format: "YYYY-MM-DDTHH:MM:SS.SSSZ"
14
+ // PostgreSQL automatically converts this to its internal format: "YYYY-MM-DD HH:MM:SS.SSSSSS+00"
15
+ // This ensures compatibility with both PostgreSQL storage and RPC function expectations
14
16
  export function formatTimestampForDatabase(date) {
15
17
  return date.toISOString();
16
18
  }
@@ -5,7 +5,7 @@ import { useEffect, useRef, useCallback, useMemo } from "react";
5
5
  import { setActiveHerdGpsTrackersConnectivity } from "../store/scout";
6
6
  import { server_get_connectivity_by_device_id } from "../helpers/connectivity";
7
7
  import { EnumWebResponse } from "../types/requests";
8
- import { getDaysAgoTimestamp } from "../helpers/time";
8
+ import { getHoursAgoTimestamp } from "../helpers/time";
9
9
  export function useScoutRealtimeConnectivity(scoutSupabase) {
10
10
  const channels = useRef([]);
11
11
  const dispatch = useAppDispatch();
@@ -39,6 +39,7 @@ export function useScoutRealtimeConnectivity(scoutSupabase) {
39
39
  const updatedConnectivity = { ...connectivity };
40
40
  switch (data.operation) {
41
41
  case "INSERT":
42
+ console.log(`[CONNECTIVITY] INSERT for ${deviceId}, ${JSON.stringify(connectivityData)}`);
42
43
  if (!updatedConnectivity[deviceId]) {
43
44
  updatedConnectivity[deviceId] = {
44
45
  most_recent: connectivityData,
@@ -111,7 +112,7 @@ export function useScoutRealtimeConnectivity(scoutSupabase) {
111
112
  if (deviceIds.length === 0) {
112
113
  return;
113
114
  }
114
- const timestampFilter = getDaysAgoTimestamp(1);
115
+ const timestampFilter = getHoursAgoTimestamp(1);
115
116
  const connectivityData = {};
116
117
  await Promise.all(deviceIds.map(async (deviceId) => {
117
118
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adventurelabs/scout-core",
3
- "version": "1.0.100",
3
+ "version": "1.0.101",
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",