@adventurelabs/scout-core 1.5.3 → 1.5.5
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/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/parts.js +3 -1
- package/dist/helpers/product_compatibilities.d.ts +7 -0
- package/dist/helpers/product_compatibilities.js +89 -0
- package/dist/helpers/product_numbers.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/db.d.ts +3 -0
- package/dist/types/supabase.d.ts +69 -0
- package/package.json +1 -1
package/dist/helpers/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./models";
|
|
|
19
19
|
export * from "./manufacturers";
|
|
20
20
|
export * from "./products";
|
|
21
21
|
export * from "./product_numbers";
|
|
22
|
+
export * from "./product_compatibilities";
|
|
22
23
|
export * from "./localizations";
|
|
23
24
|
export * from "./issuers";
|
|
24
25
|
export * from "./document_templates";
|
package/dist/helpers/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./models";
|
|
|
19
19
|
export * from "./manufacturers";
|
|
20
20
|
export * from "./products";
|
|
21
21
|
export * from "./product_numbers";
|
|
22
|
+
export * from "./product_compatibilities";
|
|
22
23
|
export * from "./localizations";
|
|
23
24
|
export * from "./issuers";
|
|
24
25
|
export * from "./document_templates";
|
package/dist/helpers/parts.js
CHANGED
|
@@ -246,7 +246,9 @@ export async function get_parts_by_herd_ids(client, herd_ids) {
|
|
|
246
246
|
.select(`
|
|
247
247
|
*,
|
|
248
248
|
devices!parts_device_id_fkey(herd_id),
|
|
249
|
-
product_numbers!parts_product_number_fkey(
|
|
249
|
+
product_numbers!parts_product_number_fkey(
|
|
250
|
+
products!product_numbers_product_id_fkey(*)
|
|
251
|
+
)
|
|
250
252
|
`)
|
|
251
253
|
.in("devices.herd_id", herd_ids)
|
|
252
254
|
.eq("lifecycle", "active")
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IProductCompatibility, ProductCompatibilityInsert, ProductCompatibilityUpdate } from "../types/db";
|
|
2
|
+
import { IWebResponseCompatible } from "../types/requests";
|
|
3
|
+
export declare function server_get_product_compatibilities(primary_product_number: string, role: string): Promise<IWebResponseCompatible<IProductCompatibility[]>>;
|
|
4
|
+
export declare function server_get_auto_assign_accessory_product_number(primary_product_number: string, role: string): Promise<IWebResponseCompatible<string | null>>;
|
|
5
|
+
export declare function server_create_product_compatibility(compatibility: ProductCompatibilityInsert): Promise<IWebResponseCompatible<IProductCompatibility | null>>;
|
|
6
|
+
export declare function server_update_product_compatibility(primary_product_id: number, role: string, accessory_product_number: string, updates: ProductCompatibilityUpdate): Promise<IWebResponseCompatible<IProductCompatibility | null>>;
|
|
7
|
+
export declare function server_delete_product_compatibility(primary_product_id: number, role: string, accessory_product_number: string): Promise<IWebResponseCompatible<boolean>>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { newServerClient } from "../supabase/server";
|
|
3
|
+
import { EnumWebResponse, IWebResponse, } from "../types/requests";
|
|
4
|
+
export async function server_get_product_compatibilities(primary_product_number, role) {
|
|
5
|
+
const supabase = await newServerClient();
|
|
6
|
+
const { data: primary, error: primaryError } = await supabase
|
|
7
|
+
.from("product_numbers")
|
|
8
|
+
.select("product_id, products!product_numbers_product_id_fkey!inner(manufacturers!inner(id))")
|
|
9
|
+
.eq("product_number", primary_product_number)
|
|
10
|
+
.eq("lifecycle", "active")
|
|
11
|
+
.eq("products.lifecycle", "active")
|
|
12
|
+
.eq("products.manufacturers.lifecycle", "active")
|
|
13
|
+
.maybeSingle();
|
|
14
|
+
if (primaryError) {
|
|
15
|
+
return IWebResponse.error(primaryError.message).to_compatible();
|
|
16
|
+
}
|
|
17
|
+
if (!primary) {
|
|
18
|
+
return IWebResponse.success([]).to_compatible();
|
|
19
|
+
}
|
|
20
|
+
const { data, error } = await supabase
|
|
21
|
+
.from("product_compatibilities")
|
|
22
|
+
.select("*, product_numbers!product_compatibilities_accessory_product_number_fkey!inner(products!product_numbers_product_id_fkey!inner(manufacturers!inner(id)))")
|
|
23
|
+
.eq("primary_product_id", primary.product_id)
|
|
24
|
+
.eq("role", role)
|
|
25
|
+
.eq("product_numbers.lifecycle", "active")
|
|
26
|
+
.eq("product_numbers.products.lifecycle", "active")
|
|
27
|
+
.eq("product_numbers.products.manufacturers.lifecycle", "active")
|
|
28
|
+
.order("accessory_product_number");
|
|
29
|
+
if (error) {
|
|
30
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
31
|
+
}
|
|
32
|
+
const compatibilities = (data ?? []).map(({ primary_product_id, role, accessory_product_number, auto_assign, inserted_at, }) => ({
|
|
33
|
+
primary_product_id,
|
|
34
|
+
role,
|
|
35
|
+
accessory_product_number,
|
|
36
|
+
auto_assign,
|
|
37
|
+
inserted_at,
|
|
38
|
+
}));
|
|
39
|
+
return IWebResponse.success(compatibilities).to_compatible();
|
|
40
|
+
}
|
|
41
|
+
export async function server_get_auto_assign_accessory_product_number(primary_product_number, role) {
|
|
42
|
+
const response = await server_get_product_compatibilities(primary_product_number, role);
|
|
43
|
+
if (response.status !== EnumWebResponse.SUCCESS) {
|
|
44
|
+
return IWebResponse.error(response.msg ?? "Unable to load product compatibilities").to_compatible();
|
|
45
|
+
}
|
|
46
|
+
const productNumber = response.data?.find((compatibility) => compatibility.auto_assign)
|
|
47
|
+
?.accessory_product_number ?? null;
|
|
48
|
+
return IWebResponse.success(productNumber).to_compatible();
|
|
49
|
+
}
|
|
50
|
+
export async function server_create_product_compatibility(compatibility) {
|
|
51
|
+
const supabase = await newServerClient();
|
|
52
|
+
const { data, error } = await supabase
|
|
53
|
+
.from("product_compatibilities")
|
|
54
|
+
.insert(compatibility)
|
|
55
|
+
.select("*")
|
|
56
|
+
.single();
|
|
57
|
+
if (error) {
|
|
58
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
59
|
+
}
|
|
60
|
+
return IWebResponse.success(data).to_compatible();
|
|
61
|
+
}
|
|
62
|
+
export async function server_update_product_compatibility(primary_product_id, role, accessory_product_number, updates) {
|
|
63
|
+
const supabase = await newServerClient();
|
|
64
|
+
const { data, error } = await supabase
|
|
65
|
+
.from("product_compatibilities")
|
|
66
|
+
.update(updates)
|
|
67
|
+
.eq("primary_product_id", primary_product_id)
|
|
68
|
+
.eq("role", role)
|
|
69
|
+
.eq("accessory_product_number", accessory_product_number)
|
|
70
|
+
.select("*")
|
|
71
|
+
.single();
|
|
72
|
+
if (error) {
|
|
73
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
74
|
+
}
|
|
75
|
+
return IWebResponse.success(data).to_compatible();
|
|
76
|
+
}
|
|
77
|
+
export async function server_delete_product_compatibility(primary_product_id, role, accessory_product_number) {
|
|
78
|
+
const supabase = await newServerClient();
|
|
79
|
+
const { error } = await supabase
|
|
80
|
+
.from("product_compatibilities")
|
|
81
|
+
.delete()
|
|
82
|
+
.eq("primary_product_id", primary_product_id)
|
|
83
|
+
.eq("role", role)
|
|
84
|
+
.eq("accessory_product_number", accessory_product_number);
|
|
85
|
+
if (error) {
|
|
86
|
+
return IWebResponse.error(error.message).to_compatible();
|
|
87
|
+
}
|
|
88
|
+
return IWebResponse.success(true).to_compatible();
|
|
89
|
+
}
|
|
@@ -30,7 +30,7 @@ export async function server_get_product_for_product_number(product_number) {
|
|
|
30
30
|
const supabase = await newServerClient();
|
|
31
31
|
const { data, error } = await supabase
|
|
32
32
|
.from("product_numbers")
|
|
33
|
-
.select("products(*)")
|
|
33
|
+
.select("products!product_numbers_product_id_fkey(*)")
|
|
34
34
|
.eq("product_number", product_number)
|
|
35
35
|
.maybeSingle();
|
|
36
36
|
if (error) {
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export * from "./helpers/sensor_poses";
|
|
|
66
66
|
export * from "./helpers/manufacturers";
|
|
67
67
|
export * from "./helpers/products";
|
|
68
68
|
export * from "./helpers/product_numbers";
|
|
69
|
+
export * from "./helpers/product_compatibilities";
|
|
69
70
|
export * from "./helpers/localizations";
|
|
70
71
|
export * from "./helpers/issuers";
|
|
71
72
|
export * from "./helpers/document_templates";
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ export * from "./helpers/sensor_poses";
|
|
|
69
69
|
export * from "./helpers/manufacturers";
|
|
70
70
|
export * from "./helpers/products";
|
|
71
71
|
export * from "./helpers/product_numbers";
|
|
72
|
+
export * from "./helpers/product_compatibilities";
|
|
72
73
|
export * from "./helpers/localizations";
|
|
73
74
|
export * from "./helpers/issuers";
|
|
74
75
|
export * from "./helpers/document_templates";
|
package/dist/types/db.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export type IPart = Database["public"]["Tables"]["parts"]["Row"];
|
|
|
62
62
|
export type IManufacturer = Database["public"]["Tables"]["manufacturers"]["Row"];
|
|
63
63
|
export type IProduct = Database["public"]["Tables"]["products"]["Row"];
|
|
64
64
|
export type IProductNumber = Database["public"]["Tables"]["product_numbers"]["Row"];
|
|
65
|
+
export type IProductCompatibility = Database["public"]["Tables"]["product_compatibilities"]["Row"];
|
|
65
66
|
export type ISensorPose = Database["public"]["Tables"]["sensor_poses"]["Row"];
|
|
66
67
|
export type ICalibration = Database["public"]["Tables"]["calibrations"]["Row"];
|
|
67
68
|
export type ILocalization = Database["public"]["Tables"]["localizations"]["Row"];
|
|
@@ -190,6 +191,8 @@ export type ProductInsert = Database["public"]["Tables"]["products"]["Insert"];
|
|
|
190
191
|
export type ProductUpdate = Database["public"]["Tables"]["products"]["Update"];
|
|
191
192
|
export type ProductNumberInsert = Database["public"]["Tables"]["product_numbers"]["Insert"];
|
|
192
193
|
export type ProductNumberUpdate = Database["public"]["Tables"]["product_numbers"]["Update"];
|
|
194
|
+
export type ProductCompatibilityInsert = Database["public"]["Tables"]["product_compatibilities"]["Insert"];
|
|
195
|
+
export type ProductCompatibilityUpdate = Database["public"]["Tables"]["product_compatibilities"]["Update"];
|
|
193
196
|
export type SensorPoseInsert = Database["public"]["Tables"]["sensor_poses"]["Insert"];
|
|
194
197
|
export type SensorPoseUpdate = Database["public"]["Tables"]["sensor_poses"]["Update"];
|
|
195
198
|
export type CalibrationInsert = Database["public"]["Tables"]["calibrations"]["Insert"];
|
package/dist/types/supabase.d.ts
CHANGED
|
@@ -257,6 +257,8 @@ export type Database = {
|
|
|
257
257
|
lifecycle_changed_by: string | null;
|
|
258
258
|
lifecycle_reason: string | null;
|
|
259
259
|
modality: string | null;
|
|
260
|
+
processing_blocked_at: string | null;
|
|
261
|
+
processing_blocked_reason: string | null;
|
|
260
262
|
proxy_file_path: string | null;
|
|
261
263
|
proxy_generated_at: string | null;
|
|
262
264
|
segmented_at: string | null;
|
|
@@ -281,6 +283,8 @@ export type Database = {
|
|
|
281
283
|
lifecycle_changed_by?: string | null;
|
|
282
284
|
lifecycle_reason?: string | null;
|
|
283
285
|
modality?: string | null;
|
|
286
|
+
processing_blocked_at?: string | null;
|
|
287
|
+
processing_blocked_reason?: string | null;
|
|
284
288
|
proxy_file_path?: string | null;
|
|
285
289
|
proxy_generated_at?: string | null;
|
|
286
290
|
segmented_at?: string | null;
|
|
@@ -305,6 +309,8 @@ export type Database = {
|
|
|
305
309
|
lifecycle_changed_by?: string | null;
|
|
306
310
|
lifecycle_reason?: string | null;
|
|
307
311
|
modality?: string | null;
|
|
312
|
+
processing_blocked_at?: string | null;
|
|
313
|
+
processing_blocked_reason?: string | null;
|
|
308
314
|
proxy_file_path?: string | null;
|
|
309
315
|
proxy_generated_at?: string | null;
|
|
310
316
|
segmented_at?: string | null;
|
|
@@ -1146,6 +1152,8 @@ export type Database = {
|
|
|
1146
1152
|
origin_location: unknown;
|
|
1147
1153
|
origin_pitch: number | null;
|
|
1148
1154
|
origin_roll: number | null;
|
|
1155
|
+
processing_blocked_at: string | null;
|
|
1156
|
+
processing_blocked_reason: string | null;
|
|
1149
1157
|
segmented_at: string | null;
|
|
1150
1158
|
sensor_pitch: number | null;
|
|
1151
1159
|
sensor_roll: number | null;
|
|
@@ -1178,6 +1186,8 @@ export type Database = {
|
|
|
1178
1186
|
origin_location?: unknown;
|
|
1179
1187
|
origin_pitch?: number | null;
|
|
1180
1188
|
origin_roll?: number | null;
|
|
1189
|
+
processing_blocked_at?: string | null;
|
|
1190
|
+
processing_blocked_reason?: string | null;
|
|
1181
1191
|
segmented_at?: string | null;
|
|
1182
1192
|
sensor_pitch?: number | null;
|
|
1183
1193
|
sensor_roll?: number | null;
|
|
@@ -1210,6 +1220,8 @@ export type Database = {
|
|
|
1210
1220
|
origin_location?: unknown;
|
|
1211
1221
|
origin_pitch?: number | null;
|
|
1212
1222
|
origin_roll?: number | null;
|
|
1223
|
+
processing_blocked_at?: string | null;
|
|
1224
|
+
processing_blocked_reason?: string | null;
|
|
1213
1225
|
segmented_at?: string | null;
|
|
1214
1226
|
sensor_pitch?: number | null;
|
|
1215
1227
|
sensor_roll?: number | null;
|
|
@@ -3057,6 +3069,45 @@ export type Database = {
|
|
|
3057
3069
|
}
|
|
3058
3070
|
];
|
|
3059
3071
|
};
|
|
3072
|
+
product_compatibilities: {
|
|
3073
|
+
Row: {
|
|
3074
|
+
accessory_product_number: string;
|
|
3075
|
+
auto_assign: boolean;
|
|
3076
|
+
inserted_at: string;
|
|
3077
|
+
primary_product_id: number;
|
|
3078
|
+
role: string;
|
|
3079
|
+
};
|
|
3080
|
+
Insert: {
|
|
3081
|
+
accessory_product_number: string;
|
|
3082
|
+
auto_assign?: boolean;
|
|
3083
|
+
inserted_at?: string;
|
|
3084
|
+
primary_product_id: number;
|
|
3085
|
+
role: string;
|
|
3086
|
+
};
|
|
3087
|
+
Update: {
|
|
3088
|
+
accessory_product_number?: string;
|
|
3089
|
+
auto_assign?: boolean;
|
|
3090
|
+
inserted_at?: string;
|
|
3091
|
+
primary_product_id?: number;
|
|
3092
|
+
role?: string;
|
|
3093
|
+
};
|
|
3094
|
+
Relationships: [
|
|
3095
|
+
{
|
|
3096
|
+
foreignKeyName: "product_compatibilities_accessory_product_number_fkey";
|
|
3097
|
+
columns: ["accessory_product_number"];
|
|
3098
|
+
isOneToOne: false;
|
|
3099
|
+
referencedRelation: "product_numbers";
|
|
3100
|
+
referencedColumns: ["product_number"];
|
|
3101
|
+
},
|
|
3102
|
+
{
|
|
3103
|
+
foreignKeyName: "product_compatibilities_primary_product_id_fkey";
|
|
3104
|
+
columns: ["primary_product_id"];
|
|
3105
|
+
isOneToOne: false;
|
|
3106
|
+
referencedRelation: "products";
|
|
3107
|
+
referencedColumns: ["id"];
|
|
3108
|
+
}
|
|
3109
|
+
];
|
|
3110
|
+
};
|
|
3060
3111
|
product_numbers: {
|
|
3061
3112
|
Row: {
|
|
3062
3113
|
gtin: string | null;
|
|
@@ -4301,6 +4352,8 @@ export type Database = {
|
|
|
4301
4352
|
lifecycle_changed_by: string | null;
|
|
4302
4353
|
lifecycle_reason: string | null;
|
|
4303
4354
|
modality: string | null;
|
|
4355
|
+
processing_blocked_at: string | null;
|
|
4356
|
+
processing_blocked_reason: string | null;
|
|
4304
4357
|
proxy_file_path: string | null;
|
|
4305
4358
|
proxy_generated_at: string | null;
|
|
4306
4359
|
segmented_at: string | null;
|
|
@@ -4337,6 +4390,8 @@ export type Database = {
|
|
|
4337
4390
|
lifecycle_changed_by: string | null;
|
|
4338
4391
|
lifecycle_reason: string | null;
|
|
4339
4392
|
modality: string | null;
|
|
4393
|
+
processing_blocked_at: string | null;
|
|
4394
|
+
processing_blocked_reason: string | null;
|
|
4340
4395
|
proxy_file_path: string | null;
|
|
4341
4396
|
proxy_generated_at: string | null;
|
|
4342
4397
|
segmented_at: string | null;
|
|
@@ -4374,6 +4429,8 @@ export type Database = {
|
|
|
4374
4429
|
lifecycle_changed_by: string | null;
|
|
4375
4430
|
lifecycle_reason: string | null;
|
|
4376
4431
|
modality: string | null;
|
|
4432
|
+
processing_blocked_at: string | null;
|
|
4433
|
+
processing_blocked_reason: string | null;
|
|
4377
4434
|
proxy_file_path: string | null;
|
|
4378
4435
|
proxy_generated_at: string | null;
|
|
4379
4436
|
segmented_at: string | null;
|
|
@@ -4411,6 +4468,8 @@ export type Database = {
|
|
|
4411
4468
|
lifecycle_changed_by: string | null;
|
|
4412
4469
|
lifecycle_reason: string | null;
|
|
4413
4470
|
modality: string | null;
|
|
4471
|
+
processing_blocked_at: string | null;
|
|
4472
|
+
processing_blocked_reason: string | null;
|
|
4414
4473
|
proxy_file_path: string | null;
|
|
4415
4474
|
proxy_generated_at: string | null;
|
|
4416
4475
|
segmented_at: string | null;
|
|
@@ -4449,6 +4508,8 @@ export type Database = {
|
|
|
4449
4508
|
lifecycle_changed_by: string | null;
|
|
4450
4509
|
lifecycle_reason: string | null;
|
|
4451
4510
|
modality: string | null;
|
|
4511
|
+
processing_blocked_at: string | null;
|
|
4512
|
+
processing_blocked_reason: string | null;
|
|
4452
4513
|
proxy_file_path: string | null;
|
|
4453
4514
|
proxy_generated_at: string | null;
|
|
4454
4515
|
segmented_at: string | null;
|
|
@@ -4487,6 +4548,8 @@ export type Database = {
|
|
|
4487
4548
|
lifecycle_changed_by: string | null;
|
|
4488
4549
|
lifecycle_reason: string | null;
|
|
4489
4550
|
modality: string | null;
|
|
4551
|
+
processing_blocked_at: string | null;
|
|
4552
|
+
processing_blocked_reason: string | null;
|
|
4490
4553
|
proxy_file_path: string | null;
|
|
4491
4554
|
proxy_generated_at: string | null;
|
|
4492
4555
|
segmented_at: string | null;
|
|
@@ -4526,6 +4589,8 @@ export type Database = {
|
|
|
4526
4589
|
lifecycle_changed_by: string | null;
|
|
4527
4590
|
lifecycle_reason: string | null;
|
|
4528
4591
|
modality: string | null;
|
|
4592
|
+
processing_blocked_at: string | null;
|
|
4593
|
+
processing_blocked_reason: string | null;
|
|
4529
4594
|
proxy_file_path: string | null;
|
|
4530
4595
|
proxy_generated_at: string | null;
|
|
4531
4596
|
segmented_at: string | null;
|
|
@@ -4564,6 +4629,8 @@ export type Database = {
|
|
|
4564
4629
|
lifecycle_changed_by: string | null;
|
|
4565
4630
|
lifecycle_reason: string | null;
|
|
4566
4631
|
modality: string | null;
|
|
4632
|
+
processing_blocked_at: string | null;
|
|
4633
|
+
processing_blocked_reason: string | null;
|
|
4567
4634
|
proxy_file_path: string | null;
|
|
4568
4635
|
proxy_generated_at: string | null;
|
|
4569
4636
|
segmented_at: string | null;
|
|
@@ -4603,6 +4670,8 @@ export type Database = {
|
|
|
4603
4670
|
lifecycle_changed_by: string | null;
|
|
4604
4671
|
lifecycle_reason: string | null;
|
|
4605
4672
|
modality: string | null;
|
|
4673
|
+
processing_blocked_at: string | null;
|
|
4674
|
+
processing_blocked_reason: string | null;
|
|
4606
4675
|
proxy_file_path: string | null;
|
|
4607
4676
|
proxy_generated_at: string | null;
|
|
4608
4677
|
segmented_at: string | null;
|