@adventurelabs/scout-core 1.4.93 → 1.4.95

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.
@@ -2,6 +2,8 @@ import { ISessionWithCoordinates, ISessionUsageOverTime, IEventAndTagsPrettyLoca
2
2
  import { IWebResponseCompatible } from "../types/requests";
3
3
  import { SupabaseClient } from "@supabase/supabase-js";
4
4
  export declare function server_get_session_by_id(sessionId: number, client?: SupabaseClient): Promise<IWebResponseCompatible<ISessionWithCoordinates | null>>;
5
+ /** Existing sessions within tolerance of start/end timestamps. */
6
+ export declare function server_match_sessions(deviceId: number, timestampStart: string, timestampEnd: string, toleranceSec: number, client?: SupabaseClient): Promise<IWebResponseCompatible<ISession[]>>;
5
7
  export declare function server_get_session_usage_over_time_by_herd(herd_id: number, client?: SupabaseClient, min_duration_minutes_caller?: number, min_distance_meters_caller?: number, product_numbers_caller?: string[]): Promise<IWebResponseCompatible<ISessionUsageOverTime>>;
6
8
  export declare function server_get_session_usage_over_time_by_device(device_id: number, client?: SupabaseClient, min_duration_minutes_caller?: number, min_distance_meters_caller?: number, product_numbers_caller?: string[]): Promise<IWebResponseCompatible<ISessionUsageOverTime>>;
7
9
  export declare function server_get_events_and_tags_by_session_id(sessionId: number, limit?: number, offset?: number): Promise<IWebResponseCompatible<IEventAndTagsPrettyLocation[]>>;
@@ -21,6 +21,20 @@ export async function server_get_session_by_id(sessionId, client) {
21
21
  const session = data && data.length > 0 ? data[0] : null;
22
22
  return IWebResponse.success(session).to_compatible();
23
23
  }
24
+ /** Existing sessions within tolerance of start/end timestamps. */
25
+ export async function server_match_sessions(deviceId, timestampStart, timestampEnd, toleranceSec, client) {
26
+ const supabase = client || (await newServerClient());
27
+ const { data, error } = await supabase.rpc("match_sessions", {
28
+ device_id_caller: deviceId,
29
+ timestamp_start_caller: timestampStart,
30
+ timestamp_end_caller: timestampEnd,
31
+ tolerance_sec_caller: toleranceSec,
32
+ });
33
+ if (error) {
34
+ return IWebResponse.error(error.message).to_compatible();
35
+ }
36
+ return IWebResponse.success(data || []).to_compatible();
37
+ }
24
38
  // Get session usage over time by herd
25
39
  export async function server_get_session_usage_over_time_by_herd(herd_id, client, min_duration_minutes_caller, min_distance_meters_caller, product_numbers_caller) {
26
40
  const supabase = client || (await newServerClient());
@@ -490,11 +490,13 @@ export type Database = {
490
490
  heading: number;
491
491
  id: number;
492
492
  inserted_at: string;
493
+ link_type: Database["public"]["Enums"]["link_type"];
493
494
  location: unknown;
494
495
  mode: string | null;
495
- noise: number;
496
+ noise: number | null;
497
+ quality_normalized: number | null;
496
498
  session_id: number | null;
497
- signal: number;
499
+ signal: number | null;
498
500
  timestamp_start: string;
499
501
  };
500
502
  Insert: {
@@ -512,11 +514,13 @@ export type Database = {
512
514
  heading: number;
513
515
  id?: number;
514
516
  inserted_at?: string;
517
+ link_type?: Database["public"]["Enums"]["link_type"];
515
518
  location: unknown;
516
519
  mode?: string | null;
517
- noise: number;
520
+ noise?: number | null;
521
+ quality_normalized?: number | null;
518
522
  session_id?: number | null;
519
- signal: number;
523
+ signal?: number | null;
520
524
  timestamp_start: string;
521
525
  };
522
526
  Update: {
@@ -534,11 +538,13 @@ export type Database = {
534
538
  heading?: number;
535
539
  id?: number;
536
540
  inserted_at?: string;
541
+ link_type?: Database["public"]["Enums"]["link_type"];
537
542
  location?: unknown;
538
543
  mode?: string | null;
539
- noise?: number;
544
+ noise?: number | null;
545
+ quality_normalized?: number | null;
540
546
  session_id?: number | null;
541
- signal?: number;
547
+ signal?: number | null;
542
548
  timestamp_start?: string;
543
549
  };
544
550
  Relationships: [
@@ -1449,6 +1455,7 @@ export type Database = {
1449
1455
  localization_id: number | null;
1450
1456
  location: unknown;
1451
1457
  slug: string;
1458
+ video_server_url: string | null;
1452
1459
  };
1453
1460
  Insert: {
1454
1461
  auto_delete_media_with_humans?: boolean | null;
@@ -1461,6 +1468,7 @@ export type Database = {
1461
1468
  localization_id?: number | null;
1462
1469
  location?: unknown;
1463
1470
  slug: string;
1471
+ video_server_url?: string | null;
1464
1472
  };
1465
1473
  Update: {
1466
1474
  auto_delete_media_with_humans?: boolean | null;
@@ -1473,6 +1481,7 @@ export type Database = {
1473
1481
  localization_id?: number | null;
1474
1482
  location?: unknown;
1475
1483
  slug?: string;
1484
+ video_server_url?: string | null;
1476
1485
  };
1477
1486
  Relationships: [
1478
1487
  {
@@ -4549,6 +4558,47 @@ export type Database = {
4549
4558
  isSetofReturn: true;
4550
4559
  };
4551
4560
  };
4561
+ match_sessions: {
4562
+ Args: {
4563
+ device_id_caller: number;
4564
+ timestamp_end_caller: string;
4565
+ timestamp_start_caller: string;
4566
+ tolerance_sec_caller: number;
4567
+ };
4568
+ Returns: {
4569
+ altitude_average: number;
4570
+ altitude_max: number;
4571
+ altitude_min: number;
4572
+ battery_id: number | null;
4573
+ device_id: number;
4574
+ distance_max_from_start: number;
4575
+ distance_total: number;
4576
+ end_approver: string | null;
4577
+ end_reason: Database["public"]["Enums"]["session_end_reason"] | null;
4578
+ id: number;
4579
+ inserted_at: string;
4580
+ lifecycle: Database["public"]["Enums"]["entity_lifecycle"];
4581
+ lifecycle_changed_at: string;
4582
+ lifecycle_changed_by: string | null;
4583
+ lifecycle_reason: string | null;
4584
+ locations: unknown;
4585
+ post_approver: string | null;
4586
+ software_version: string;
4587
+ start_approver: string | null;
4588
+ status: Database["public"]["Enums"]["session_status"];
4589
+ timestamp_end: string | null;
4590
+ timestamp_start: string;
4591
+ velocity_average: number;
4592
+ velocity_max: number;
4593
+ velocity_min: number;
4594
+ }[];
4595
+ SetofOptions: {
4596
+ from: "*";
4597
+ to: "sessions";
4598
+ isOneToOne: false;
4599
+ isSetofReturn: true;
4600
+ };
4601
+ };
4552
4602
  migrate_conservaition_users_to_sentala: {
4553
4603
  Args: {
4554
4604
  preview?: boolean;
@@ -4758,6 +4808,7 @@ export type Database = {
4758
4808
  entity_lifecycle: "active" | "retired" | "deleted";
4759
4809
  health_item: "healthy" | "repairable" | "unrepairable";
4760
4810
  herd_invitation_status: "pending" | "accepted" | "revoked" | "expired";
4811
+ link_type: "wifi" | "ocusync" | "lte" | "satellite" | "mesh" | "lora" | "unknown";
4761
4812
  media_type: "image" | "video" | "audio" | "text";
4762
4813
  plan_type: "mission" | "fence" | "rally" | "markov";
4763
4814
  review_status: "pending" | "annotating" | "in_review" | "completed" | "rejected";
@@ -4790,6 +4841,8 @@ export type Database = {
4790
4841
  associated_station: string | null;
4791
4842
  mode: string | null;
4792
4843
  battery_volts: number | null;
4844
+ link_type: Database["public"]["Enums"]["link_type"] | null;
4845
+ quality_normalized: number | null;
4793
4846
  };
4794
4847
  device_heartbeat_analysis: {
4795
4848
  device_id: number | null;
@@ -4931,6 +4984,7 @@ export type Database = {
4931
4984
  auto_delete_media_with_no_tracks: boolean | null;
4932
4985
  localization_id: number | null;
4933
4986
  localization_region: string | null;
4987
+ video_server_url: string | null;
4934
4988
  };
4935
4989
  pins_pretty_location: {
4936
4990
  id: number | null;
@@ -5086,6 +5140,7 @@ export declare const Constants: {
5086
5140
  readonly entity_lifecycle: readonly ["active", "retired", "deleted"];
5087
5141
  readonly health_item: readonly ["healthy", "repairable", "unrepairable"];
5088
5142
  readonly herd_invitation_status: readonly ["pending", "accepted", "revoked", "expired"];
5143
+ readonly link_type: readonly ["wifi", "ocusync", "lte", "satellite", "mesh", "lora", "unknown"];
5089
5144
  readonly media_type: readonly ["image", "video", "audio", "text"];
5090
5145
  readonly plan_type: readonly ["mission", "fence", "rally", "markov"];
5091
5146
  readonly review_status: readonly ["pending", "annotating", "in_review", "completed", "rejected"];
@@ -31,6 +31,15 @@ export const Constants = {
31
31
  entity_lifecycle: ["active", "retired", "deleted"],
32
32
  health_item: ["healthy", "repairable", "unrepairable"],
33
33
  herd_invitation_status: ["pending", "accepted", "revoked", "expired"],
34
+ link_type: [
35
+ "wifi",
36
+ "ocusync",
37
+ "lte",
38
+ "satellite",
39
+ "mesh",
40
+ "lora",
41
+ "unknown",
42
+ ],
34
43
  media_type: ["image", "video", "audio", "text"],
35
44
  plan_type: ["mission", "fence", "rally", "markov"],
36
45
  review_status: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adventurelabs/scout-core",
3
- "version": "1.4.93",
3
+ "version": "1.4.95",
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",