@adventurelabs/scout-core 2.0.14 → 2.0.15
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.
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +2 -1
- package/dist/helpers/document_templates.d.ts +1 -0
- package/dist/helpers/document_templates.js +4 -1
- package/dist/helpers/document_templates.queries.d.ts +1 -0
- package/dist/helpers/document_templates.queries.js +11 -0
- package/dist/helpers/maintenance_requests_server.d.ts +7 -0
- package/dist/helpers/user_last_activity.d.ts +5 -0
- package/dist/helpers/user_last_activity.js +12 -0
- package/dist/helpers/user_last_activity_server.d.ts +5 -0
- package/dist/helpers/user_last_activity_server.js +6 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useInfiniteQuery.d.ts +9 -4
- package/dist/hooks/useInfiniteQuery.js +319 -905
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +2 -1
- package/dist/types/db.d.ts +1 -0
- package/dist/types/supabase.d.ts +59 -10
- package/package.json +1 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "../helpers/pubsub_token";
|
|
|
30
30
|
export * from "../helpers/sensor_poses";
|
|
31
31
|
export * from "../helpers/session_incidents";
|
|
32
32
|
export * from "../helpers/user_credentials";
|
|
33
|
+
export * from "../helpers/user_last_activity";
|
|
33
34
|
export * from "../helpers/versions_software";
|
|
34
35
|
export * from "../helpers/web";
|
|
35
36
|
export { createScoutBrowserClient } from "../supabase/client";
|
|
@@ -39,7 +40,7 @@ export { get_chat_messages_query as get_chat_messages, insert_chat_message_query
|
|
|
39
40
|
export { get_connectivity_by_device_id_query as get_connectivity_by_device_id, get_connectivity_by_session_id_query as get_connectivity_by_session_id, get_connectivity_for_artifact_query as get_connectivity_for_artifact, get_connectivity_for_herd_time_range_query as get_connectivity_for_herd_time_range, insert_connectivity_query as insert_connectivity, update_connectivity_query as update_connectivity, type HerdConnectivityTimeRangeResponse, } from "../helpers/connectivity.queries";
|
|
40
41
|
export { transfer_device_to_herd_query as transfer_device_to_herd } from "../helpers/deviceTransfer.queries";
|
|
41
42
|
export { create_device_query as create_device, delete_device_by_id_query as delete_device_by_id, get_devices_by_herd_query as get_devices_by_herd, update_device_query as update_device, } from "../helpers/devices.queries";
|
|
42
|
-
export { create_document_template_query as create_document_template, get_document_template_by_id_query as get_document_template_by_id, get_document_templates_by_localization_query as get_document_templates_by_localization, get_document_templates_query as get_document_templates, update_document_template_query as update_document_template, } from "../helpers/document_templates.queries";
|
|
43
|
+
export { create_document_template_query as create_document_template, get_document_template_by_id_query as get_document_template_by_id, get_document_templates_by_localization_query as get_document_templates_by_localization, get_document_templates_by_system_tag_query as get_document_templates_by_system_tag, get_document_templates_query as get_document_templates, update_document_template_query as update_document_template, } from "../helpers/document_templates.queries";
|
|
43
44
|
export { search_embeddings_vertex_multimodal_001_query as search_embeddings_vertex_multimodal_001 } from "../helpers/embeddings.queries";
|
|
44
45
|
export { delete_event_query as delete_event, get_event_by_id_query as get_event_by_id, get_total_events_by_herd_query as get_total_events_by_herd, insert_event_query as insert_event, match_events_by_vertex_embedding_query as match_events_by_vertex_embedding, update_event_query as update_event, } from "../helpers/events.queries";
|
|
45
46
|
export { create_battery_cycle_count_query as create_battery_cycle_count, delete_battery_cycle_count_query as delete_battery_cycle_count, get_battery_cycle_counts_by_battery_id_query as get_battery_cycle_counts_by_battery_id, update_battery_cycle_count_query as update_battery_cycle_count, } from "../helpers/battery_cycle_counts.queries";
|
package/dist/client/index.js
CHANGED
|
@@ -34,6 +34,7 @@ export * from "../helpers/pubsub_token";
|
|
|
34
34
|
export * from "../helpers/sensor_poses";
|
|
35
35
|
export * from "../helpers/session_incidents";
|
|
36
36
|
export * from "../helpers/user_credentials";
|
|
37
|
+
export * from "../helpers/user_last_activity";
|
|
37
38
|
export * from "../helpers/versions_software";
|
|
38
39
|
export * from "../helpers/web";
|
|
39
40
|
export { createScoutBrowserClient } from "../supabase/client";
|
|
@@ -44,7 +45,7 @@ export { get_chat_messages_query as get_chat_messages, insert_chat_message_query
|
|
|
44
45
|
export { get_connectivity_by_device_id_query as get_connectivity_by_device_id, get_connectivity_by_session_id_query as get_connectivity_by_session_id, get_connectivity_for_artifact_query as get_connectivity_for_artifact, get_connectivity_for_herd_time_range_query as get_connectivity_for_herd_time_range, insert_connectivity_query as insert_connectivity, update_connectivity_query as update_connectivity, } from "../helpers/connectivity.queries";
|
|
45
46
|
export { transfer_device_to_herd_query as transfer_device_to_herd } from "../helpers/deviceTransfer.queries";
|
|
46
47
|
export { create_device_query as create_device, delete_device_by_id_query as delete_device_by_id, get_devices_by_herd_query as get_devices_by_herd, update_device_query as update_device, } from "../helpers/devices.queries";
|
|
47
|
-
export { create_document_template_query as create_document_template, get_document_template_by_id_query as get_document_template_by_id, get_document_templates_by_localization_query as get_document_templates_by_localization, get_document_templates_query as get_document_templates, update_document_template_query as update_document_template, } from "../helpers/document_templates.queries";
|
|
48
|
+
export { create_document_template_query as create_document_template, get_document_template_by_id_query as get_document_template_by_id, get_document_templates_by_localization_query as get_document_templates_by_localization, get_document_templates_by_system_tag_query as get_document_templates_by_system_tag, get_document_templates_query as get_document_templates, update_document_template_query as update_document_template, } from "../helpers/document_templates.queries";
|
|
48
49
|
export { search_embeddings_vertex_multimodal_001_query as search_embeddings_vertex_multimodal_001 } from "../helpers/embeddings.queries";
|
|
49
50
|
export { delete_event_query as delete_event, get_event_by_id_query as get_event_by_id, get_total_events_by_herd_query as get_total_events_by_herd, insert_event_query as insert_event, match_events_by_vertex_embedding_query as match_events_by_vertex_embedding, update_event_query as update_event, } from "../helpers/events.queries";
|
|
50
51
|
export { create_battery_cycle_count_query as create_battery_cycle_count, delete_battery_cycle_count_query as delete_battery_cycle_count, get_battery_cycle_counts_by_battery_id_query as get_battery_cycle_counts_by_battery_id, update_battery_cycle_count_query as update_battery_cycle_count, } from "../helpers/battery_cycle_counts.queries";
|
|
@@ -3,5 +3,6 @@ import { IWebResponseCompatible } from "../types/requests";
|
|
|
3
3
|
export declare function server_get_document_templates(): Promise<IWebResponseCompatible<IDocumentTemplate[]>>;
|
|
4
4
|
export declare function server_get_document_template_by_id(template_id: number): Promise<IWebResponseCompatible<IDocumentTemplate | null>>;
|
|
5
5
|
export declare function server_get_document_templates_by_localization(localization_id: number): Promise<IWebResponseCompatible<IDocumentTemplate[]>>;
|
|
6
|
+
export declare function server_get_document_templates_by_system_tag(system_tag: string): Promise<IWebResponseCompatible<IDocumentTemplate[]>>;
|
|
6
7
|
export declare function server_create_document_template(row: DocumentTemplateInsert): Promise<IWebResponseCompatible<IDocumentTemplate | null>>;
|
|
7
8
|
export declare function server_update_document_template(template_id: number, updates: DocumentTemplateUpdate): Promise<IWebResponseCompatible<IDocumentTemplate | null>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { newServerClient } from "../supabase/server";
|
|
2
|
-
import { create_document_template_query, get_document_template_by_id_query, get_document_templates_by_localization_query, get_document_templates_query, update_document_template_query, } from "./document_templates.queries";
|
|
2
|
+
import { create_document_template_query, get_document_template_by_id_query, get_document_templates_by_localization_query, get_document_templates_by_system_tag_query, get_document_templates_query, update_document_template_query, } from "./document_templates.queries";
|
|
3
3
|
export async function server_get_document_templates() {
|
|
4
4
|
return get_document_templates_query(await newServerClient());
|
|
5
5
|
}
|
|
@@ -9,6 +9,9 @@ export async function server_get_document_template_by_id(template_id) {
|
|
|
9
9
|
export async function server_get_document_templates_by_localization(localization_id) {
|
|
10
10
|
return get_document_templates_by_localization_query(await newServerClient(), localization_id);
|
|
11
11
|
}
|
|
12
|
+
export async function server_get_document_templates_by_system_tag(system_tag) {
|
|
13
|
+
return get_document_templates_by_system_tag_query(await newServerClient(), system_tag);
|
|
14
|
+
}
|
|
12
15
|
export async function server_create_document_template(row) {
|
|
13
16
|
return create_document_template_query(await newServerClient(), row);
|
|
14
17
|
}
|
|
@@ -5,5 +5,6 @@ import { Database } from "../types/supabase";
|
|
|
5
5
|
export declare function get_document_templates_query(client: SupabaseClient<Database>): Promise<IWebResponseCompatible<IDocumentTemplate[]>>;
|
|
6
6
|
export declare function get_document_template_by_id_query(client: SupabaseClient<Database>, template_id: number): Promise<IWebResponseCompatible<IDocumentTemplate | null>>;
|
|
7
7
|
export declare function get_document_templates_by_localization_query(client: SupabaseClient<Database>, localization_id: number): Promise<IWebResponseCompatible<IDocumentTemplate[]>>;
|
|
8
|
+
export declare function get_document_templates_by_system_tag_query(client: SupabaseClient<Database>, system_tag: string): Promise<IWebResponseCompatible<IDocumentTemplate[]>>;
|
|
8
9
|
export declare function create_document_template_query(client: SupabaseClient<Database>, row: DocumentTemplateInsert): Promise<IWebResponseCompatible<IDocumentTemplate | null>>;
|
|
9
10
|
export declare function update_document_template_query(client: SupabaseClient<Database>, template_id: number, updates: DocumentTemplateUpdate): Promise<IWebResponseCompatible<IDocumentTemplate | null>>;
|
|
@@ -31,6 +31,17 @@ export async function get_document_templates_by_localization_query(client, local
|
|
|
31
31
|
}
|
|
32
32
|
return IWebResponse.success(data ?? []).to_compatible();
|
|
33
33
|
}
|
|
34
|
+
export async function get_document_templates_by_system_tag_query(client, system_tag) {
|
|
35
|
+
const { data, error } = await client
|
|
36
|
+
.from("document_templates")
|
|
37
|
+
.select("*")
|
|
38
|
+
.eq("system_tag", system_tag)
|
|
39
|
+
.order("name");
|
|
40
|
+
if (error) {
|
|
41
|
+
return { status: EnumWebResponse.ERROR, msg: error.message, data: [] };
|
|
42
|
+
}
|
|
43
|
+
return IWebResponse.success(data ?? []).to_compatible();
|
|
44
|
+
}
|
|
34
45
|
export async function create_document_template_query(client, row) {
|
|
35
46
|
const { data, error } = await client
|
|
36
47
|
.from("document_templates")
|
|
@@ -9,6 +9,7 @@ export declare function server_get_maintenance_requests_by_device_id(device_id:
|
|
|
9
9
|
image: string | null;
|
|
10
10
|
is_serviceable: boolean;
|
|
11
11
|
part_id: number | null;
|
|
12
|
+
post_remediation_media_uri: string | null;
|
|
12
13
|
remediation_completed_at: string | null;
|
|
13
14
|
remediation_completed_user_id: string | null;
|
|
14
15
|
remediation_notes: string | null;
|
|
@@ -26,6 +27,7 @@ export declare function server_get_maintenance_requests_by_part_id(part_id: numb
|
|
|
26
27
|
image: string | null;
|
|
27
28
|
is_serviceable: boolean;
|
|
28
29
|
part_id: number | null;
|
|
30
|
+
post_remediation_media_uri: string | null;
|
|
29
31
|
remediation_completed_at: string | null;
|
|
30
32
|
remediation_completed_user_id: string | null;
|
|
31
33
|
remediation_notes: string | null;
|
|
@@ -46,6 +48,7 @@ export declare function server_get_maintenance_requests_by_herd_id(herd_id: numb
|
|
|
46
48
|
image: string | null;
|
|
47
49
|
is_serviceable: boolean;
|
|
48
50
|
part_id: number | null;
|
|
51
|
+
post_remediation_media_uri: string | null;
|
|
49
52
|
remediation_completed_at: string | null;
|
|
50
53
|
remediation_completed_user_id: string | null;
|
|
51
54
|
remediation_notes: string | null;
|
|
@@ -64,6 +67,7 @@ export declare function server_get_maintenance_request_by_id(request_id: number)
|
|
|
64
67
|
image: string | null;
|
|
65
68
|
is_serviceable: boolean;
|
|
66
69
|
part_id: number | null;
|
|
70
|
+
post_remediation_media_uri: string | null;
|
|
67
71
|
remediation_completed_at: string | null;
|
|
68
72
|
remediation_completed_user_id: string | null;
|
|
69
73
|
remediation_notes: string | null;
|
|
@@ -81,6 +85,7 @@ export declare function server_create_maintenance_request(row: MaintenanceReques
|
|
|
81
85
|
image: string | null;
|
|
82
86
|
is_serviceable: boolean;
|
|
83
87
|
part_id: number | null;
|
|
88
|
+
post_remediation_media_uri: string | null;
|
|
84
89
|
remediation_completed_at: string | null;
|
|
85
90
|
remediation_completed_user_id: string | null;
|
|
86
91
|
remediation_notes: string | null;
|
|
@@ -98,6 +103,7 @@ export declare function server_update_maintenance_request(request_id: number, pa
|
|
|
98
103
|
image: string | null;
|
|
99
104
|
is_serviceable: boolean;
|
|
100
105
|
part_id: number | null;
|
|
106
|
+
post_remediation_media_uri: string | null;
|
|
101
107
|
remediation_completed_at: string | null;
|
|
102
108
|
remediation_completed_user_id: string | null;
|
|
103
109
|
remediation_notes: string | null;
|
|
@@ -115,6 +121,7 @@ export declare function server_delete_maintenance_request(request_id: number): P
|
|
|
115
121
|
image: string | null;
|
|
116
122
|
is_serviceable: boolean;
|
|
117
123
|
part_id: number | null;
|
|
124
|
+
post_remediation_media_uri: string | null;
|
|
118
125
|
remediation_completed_at: string | null;
|
|
119
126
|
remediation_completed_user_id: string | null;
|
|
120
127
|
remediation_notes: string | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Database } from "../types/supabase";
|
|
2
|
+
import { IUserLastActivity } from "../types/db";
|
|
3
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
4
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
5
|
+
export declare function get_user_last_activity_by_user_id(client: SupabaseClient<Database>, user_id: string): Promise<IWebResponseCompatible<IUserLastActivity | null>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IWebResponse } from "../types/requests";
|
|
2
|
+
export async function get_user_last_activity_by_user_id(client, user_id) {
|
|
3
|
+
const { data, error } = await client
|
|
4
|
+
.from("user_last_activity")
|
|
5
|
+
.select("*")
|
|
6
|
+
.eq("user_id", user_id)
|
|
7
|
+
.maybeSingle();
|
|
8
|
+
if (error) {
|
|
9
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
10
|
+
}
|
|
11
|
+
return IWebResponse.success(data).to_compatible();
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { newServerClient } from "../supabase/server";
|
|
2
|
+
import { get_user_last_activity_by_user_id } from "./user_last_activity";
|
|
3
|
+
export async function server_get_user_last_activity_by_user_id(user_id) {
|
|
4
|
+
const client = await newServerClient();
|
|
5
|
+
return get_user_last_activity_by_user_id(client, user_id);
|
|
6
|
+
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export { useScoutRealtimeMaintenanceRequests } from "./useScoutRealtimeMaintenan
|
|
|
18
18
|
export { useScoutRealtimeContacts } from "./useScoutRealtimeContacts";
|
|
19
19
|
export { useScoutRealtimeSessionIncidents } from "./useScoutRealtimeSessionIncidents";
|
|
20
20
|
export { useScoutRealtimeOperatingContexts, type ComplianceRealtimeData, type ComplianceRealtimeRow, type OperatingContextRealtimeData, type OperatingContextRealtimeRow, } from "./useScoutRealtimeOperatingContexts";
|
|
21
|
-
export { useInfiniteSessionsByHerd, useInfiniteSessionsByDevice, useInfiniteEventsByHerd, useInfiniteEventsByDevice, useInfiniteArtifactsByHerd, useInfiniteArtifactsByDevice, useInfiniteFeedByHerd, useInfiniteFeedByDevice, useInfiniteAnalysisJobs, useInfiniteAnalysisTasks, useIntersectionObserver, type UseInfiniteScrollOptions, type UseAnalysisJobsInfiniteOptions, type UseAnalysisTasksInfiniteOptions, } from "./useInfiniteQuery";
|
|
21
|
+
export { useInfiniteSessionsByHerd, useInfiniteSessionsByDevice, useInfiniteEventsByHerd, useInfiniteEventsByDevice, useInfiniteArtifactsByHerd, useInfiniteArtifactsByDevice, useInfiniteFeedByHerd, useInfiniteFeedByDevice, useInfiniteAnalysisJobs, useInfiniteAnalysisTasks, useIntersectionObserver, type InfiniteScrollData, type InfiniteRefetchOptions, type UseInfiniteScrollOptions, type UseAnalysisJobsInfiniteOptions, type UseAnalysisTasksInfiniteOptions, } from "./useInfiniteQuery";
|
|
22
22
|
export { useLoadingPerformance, useSessionSummariesByHerd, useHasSessionSummaries, } from "../store/hooks";
|
|
@@ -12,13 +12,20 @@ export interface UseInfiniteScrollOptions {
|
|
|
12
12
|
/** [Sessions only] minimum distance_total in meterz */
|
|
13
13
|
minFlightDistanceMeters?: number | null;
|
|
14
14
|
}
|
|
15
|
-
interface
|
|
15
|
+
export interface InfiniteRefetchOptions {
|
|
16
|
+
/** Refresh every loaded cursor in place instead of resetting to the first page. */
|
|
17
|
+
preservePages?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface InfiniteScrollData<T> {
|
|
16
20
|
items: T[];
|
|
21
|
+
/** True only for the initial load, when no pages are held yet. */
|
|
17
22
|
isLoading: boolean;
|
|
23
|
+
/** True while a `refetch` is in flight, including a preserve-pages refresh. */
|
|
24
|
+
isRefreshing: boolean;
|
|
18
25
|
isLoadingMore: boolean;
|
|
19
26
|
hasMore: boolean;
|
|
20
27
|
loadMore: () => void;
|
|
21
|
-
refetch: () => void;
|
|
28
|
+
refetch: (options?: InfiniteRefetchOptions) => void;
|
|
22
29
|
error: any;
|
|
23
30
|
}
|
|
24
31
|
export declare const useInfiniteSessionsByHerd: (herdId: number, options: UseInfiniteScrollOptions) => InfiniteScrollData<ISessionWithCoordinates>;
|
|
@@ -27,7 +34,6 @@ export declare const useInfiniteEventsByHerd: (herdId: number, options: UseInfin
|
|
|
27
34
|
export declare const useInfiniteEventsByDevice: (deviceId: number, options: UseInfiniteScrollOptions) => InfiniteScrollData<IEventAndTagsPrettyLocation>;
|
|
28
35
|
export declare const useInfiniteArtifactsByHerd: (herdId: number, options: UseInfiniteScrollOptions) => InfiniteScrollData<IArtifactWithMediaUrl>;
|
|
29
36
|
export declare const useInfiniteArtifactsByDevice: (deviceId: number, options: UseInfiniteScrollOptions) => InfiniteScrollData<IArtifactWithMediaUrl>;
|
|
30
|
-
/** useInfiniteFeedByHerd: logic matches useInfiniteFeedByHerdDummy verbatim; only the fetch is via API (RTK Query) instead of supabase.rpc. */
|
|
31
37
|
export declare const useInfiniteFeedByHerd: (herdId: number, options: UseInfiniteScrollOptions) => InfiniteScrollData<IFeedItem>;
|
|
32
38
|
export declare const useInfiniteFeedByDevice: (deviceId: number, options: UseInfiniteScrollOptions) => InfiniteScrollData<IFeedItem>;
|
|
33
39
|
export interface UseAnalysisJobsInfiniteOptions {
|
|
@@ -46,4 +52,3 @@ export interface UseAnalysisTasksInfiniteOptions {
|
|
|
46
52
|
}
|
|
47
53
|
export declare const useInfiniteAnalysisTasks: (options: UseAnalysisTasksInfiniteOptions) => InfiniteScrollData<IAnalysisTask>;
|
|
48
54
|
export declare const useIntersectionObserver: (callback: () => void, options?: IntersectionObserverInit) => import("react").Dispatch<import("react").SetStateAction<Element | null>>;
|
|
49
|
-
export {};
|