@adventurelabs/scout-core 1.4.94 → 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[]>>;
|
package/dist/helpers/sessions.js
CHANGED
|
@@ -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());
|
package/dist/types/supabase.d.ts
CHANGED
|
@@ -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
|
|
520
|
+
noise?: number | null;
|
|
521
|
+
quality_normalized?: number | null;
|
|
518
522
|
session_id?: number | null;
|
|
519
|
-
signal
|
|
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: [
|
|
@@ -4552,6 +4558,47 @@ export type Database = {
|
|
|
4552
4558
|
isSetofReturn: true;
|
|
4553
4559
|
};
|
|
4554
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
|
+
};
|
|
4555
4602
|
migrate_conservaition_users_to_sentala: {
|
|
4556
4603
|
Args: {
|
|
4557
4604
|
preview?: boolean;
|
|
@@ -4761,6 +4808,7 @@ export type Database = {
|
|
|
4761
4808
|
entity_lifecycle: "active" | "retired" | "deleted";
|
|
4762
4809
|
health_item: "healthy" | "repairable" | "unrepairable";
|
|
4763
4810
|
herd_invitation_status: "pending" | "accepted" | "revoked" | "expired";
|
|
4811
|
+
link_type: "wifi" | "ocusync" | "lte" | "satellite" | "mesh" | "lora" | "unknown";
|
|
4764
4812
|
media_type: "image" | "video" | "audio" | "text";
|
|
4765
4813
|
plan_type: "mission" | "fence" | "rally" | "markov";
|
|
4766
4814
|
review_status: "pending" | "annotating" | "in_review" | "completed" | "rejected";
|
|
@@ -4793,6 +4841,8 @@ export type Database = {
|
|
|
4793
4841
|
associated_station: string | null;
|
|
4794
4842
|
mode: string | null;
|
|
4795
4843
|
battery_volts: number | null;
|
|
4844
|
+
link_type: Database["public"]["Enums"]["link_type"] | null;
|
|
4845
|
+
quality_normalized: number | null;
|
|
4796
4846
|
};
|
|
4797
4847
|
device_heartbeat_analysis: {
|
|
4798
4848
|
device_id: number | null;
|
|
@@ -5090,6 +5140,7 @@ export declare const Constants: {
|
|
|
5090
5140
|
readonly entity_lifecycle: readonly ["active", "retired", "deleted"];
|
|
5091
5141
|
readonly health_item: readonly ["healthy", "repairable", "unrepairable"];
|
|
5092
5142
|
readonly herd_invitation_status: readonly ["pending", "accepted", "revoked", "expired"];
|
|
5143
|
+
readonly link_type: readonly ["wifi", "ocusync", "lte", "satellite", "mesh", "lora", "unknown"];
|
|
5093
5144
|
readonly media_type: readonly ["image", "video", "audio", "text"];
|
|
5094
5145
|
readonly plan_type: readonly ["mission", "fence", "rally", "markov"];
|
|
5095
5146
|
readonly review_status: readonly ["pending", "annotating", "in_review", "completed", "rejected"];
|
package/dist/types/supabase.js
CHANGED
|
@@ -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: [
|