@deepintel-ltd/farmpro-contracts 1.8.0 → 1.10.0

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.
Files changed (44) hide show
  1. package/dist/index.d.ts +6 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +5 -0
  4. package/dist/routes/academy.routes.d.ts +575 -0
  5. package/dist/routes/academy.routes.d.ts.map +1 -0
  6. package/dist/routes/academy.routes.js +27 -0
  7. package/dist/routes/admin.routes.d.ts +755 -0
  8. package/dist/routes/admin.routes.d.ts.map +1 -1
  9. package/dist/routes/admin.routes.js +18 -1
  10. package/dist/routes/device-gateway-admin.routes.d.ts +378 -3
  11. package/dist/routes/device-gateway-admin.routes.d.ts.map +1 -1
  12. package/dist/routes/device-gateway-admin.routes.js +19 -4
  13. package/dist/routes/farm-gateway-device.routes.d.ts +46 -0
  14. package/dist/routes/farm-gateway-device.routes.d.ts.map +1 -0
  15. package/dist/routes/farm-gateway-device.routes.js +15 -0
  16. package/dist/routes/farm-gateway.routes.d.ts +302 -0
  17. package/dist/routes/farm-gateway.routes.d.ts.map +1 -0
  18. package/dist/routes/farm-gateway.routes.js +51 -0
  19. package/dist/routes/index.d.ts +9 -0
  20. package/dist/routes/index.d.ts.map +1 -1
  21. package/dist/routes/index.js +6 -0
  22. package/dist/routes/organizations.routes.d.ts +8 -0
  23. package/dist/routes/organizations.routes.d.ts.map +1 -1
  24. package/dist/routes/users.routes.d.ts +14 -0
  25. package/dist/routes/users.routes.d.ts.map +1 -1
  26. package/dist/schemas/academy.schemas.d.ts +343 -0
  27. package/dist/schemas/academy.schemas.d.ts.map +1 -0
  28. package/dist/schemas/academy.schemas.js +27 -0
  29. package/dist/schemas/admin.schemas.d.ts +55 -0
  30. package/dist/schemas/admin.schemas.d.ts.map +1 -1
  31. package/dist/schemas/admin.schemas.js +7 -0
  32. package/dist/schemas/device-gateway.schemas.d.ts +361 -0
  33. package/dist/schemas/device-gateway.schemas.d.ts.map +1 -1
  34. package/dist/schemas/device-gateway.schemas.js +28 -0
  35. package/dist/schemas/farm-gateway.schemas.d.ts +232 -0
  36. package/dist/schemas/farm-gateway.schemas.d.ts.map +1 -0
  37. package/dist/schemas/farm-gateway.schemas.js +45 -0
  38. package/dist/schemas/organizations.schemas.d.ts +25 -0
  39. package/dist/schemas/organizations.schemas.d.ts.map +1 -1
  40. package/dist/schemas/organizations.schemas.js +13 -1
  41. package/dist/schemas/users.schemas.d.ts +15 -0
  42. package/dist/schemas/users.schemas.d.ts.map +1 -1
  43. package/dist/schemas/users.schemas.js +1 -0
  44. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"admin.routes.d.ts","sourceRoot":"","sources":["../../src/routes/admin.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCtB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { initContract } from '@ts-rest/core';
2
2
  import { z } from 'zod';
3
- import { autonomousMonitoringStatsResponseSchema, } from '../schemas/admin.schemas';
3
+ import { adminCreateUserSchema, autonomousMonitoringStatsResponseSchema, } from '../schemas/admin.schemas';
4
+ import { userResponseSchema } from '../schemas/users.schemas';
4
5
  import { jsonApiErrorResponseSchema } from '../schemas/common.schemas';
5
6
  const c = initContract();
6
7
  export const adminRouter = c.router({
@@ -20,4 +21,20 @@ export const adminRouter = c.router({
20
21
  summary: 'Get autonomous monitoring analytics',
21
22
  description: 'Get comprehensive analytics for the autonomous multi-agent monitoring system',
22
23
  },
24
+ createUser: {
25
+ method: 'POST',
26
+ path: '/admin/users',
27
+ body: z.object({ data: adminCreateUserSchema }),
28
+ responses: {
29
+ 201: userResponseSchema,
30
+ 400: jsonApiErrorResponseSchema,
31
+ 401: jsonApiErrorResponseSchema,
32
+ 403: jsonApiErrorResponseSchema,
33
+ 409: jsonApiErrorResponseSchema,
34
+ 422: jsonApiErrorResponseSchema,
35
+ 500: jsonApiErrorResponseSchema,
36
+ },
37
+ summary: 'Create user (platform admin)',
38
+ description: 'Provision a platform user with email and password. Restricted to ADMIN_EMAILS.',
39
+ },
23
40
  });
@@ -11,7 +11,7 @@ export declare const deviceGatewayAdminRouter: {
11
11
  farmId: string;
12
12
  fieldId: string;
13
13
  }>;
14
- summary: "Register a greenhouse edge device and generate API key";
14
+ summary: "Register a field edge device and generate API key";
15
15
  method: "POST";
16
16
  body: z.ZodObject<{
17
17
  name: z.ZodString;
@@ -91,6 +91,9 @@ export declare const deviceGatewayAdminRouter: {
91
91
  } | undefined;
92
92
  gpioMap?: Record<string, number> | undefined;
93
93
  }>>;
94
+ fieldType: z.ZodOptional<z.ZodEnum<["GREENHOUSE", "OPEN_FIELD"]>>;
95
+ transport: z.ZodOptional<z.ZodEnum<["WIFI", "LORA", "CELLULAR_DIRECT"]>>;
96
+ gatewayId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
97
  }, "strip", z.ZodTypeAny, {
95
98
  name: string;
96
99
  config?: {
@@ -109,6 +112,9 @@ export declare const deviceGatewayAdminRouter: {
109
112
  } | undefined;
110
113
  gpioMap?: Record<string, number> | undefined;
111
114
  } | undefined;
115
+ fieldType?: "GREENHOUSE" | "OPEN_FIELD" | undefined;
116
+ transport?: "WIFI" | "LORA" | "CELLULAR_DIRECT" | undefined;
117
+ gatewayId?: string | null | undefined;
112
118
  }, {
113
119
  name: string;
114
120
  config?: {
@@ -127,6 +133,9 @@ export declare const deviceGatewayAdminRouter: {
127
133
  } | undefined;
128
134
  gpioMap?: Record<string, number> | undefined;
129
135
  } | undefined;
136
+ fieldType?: "GREENHOUSE" | "OPEN_FIELD" | undefined;
137
+ transport?: "WIFI" | "LORA" | "CELLULAR_DIRECT" | undefined;
138
+ gatewayId?: string | null | undefined;
130
139
  }>;
131
140
  path: "/farms/:farmId/fields/:fieldId/devices";
132
141
  responses: {
@@ -213,7 +222,7 @@ export declare const deviceGatewayAdminRouter: {
213
222
  farmId: string;
214
223
  fieldId: string;
215
224
  }>;
216
- summary: "List greenhouse devices for a field";
225
+ summary: "List field devices for a field";
217
226
  method: "GET";
218
227
  path: "/farms/:farmId/fields/:fieldId/devices";
219
228
  responses: {
@@ -223,6 +232,10 @@ export declare const deviceGatewayAdminRouter: {
223
232
  name: z.ZodString;
224
233
  fieldId: z.ZodString;
225
234
  farmId: z.ZodString;
235
+ fieldType: z.ZodEnum<["GREENHOUSE", "OPEN_FIELD"]>;
236
+ transport: z.ZodEnum<["WIFI", "LORA", "CELLULAR_DIRECT"]>;
237
+ gatewayId: z.ZodNullable<z.ZodString>;
238
+ gatewayName: z.ZodNullable<z.ZodString>;
226
239
  lastSeenAt: z.ZodNullable<z.ZodString>;
227
240
  bufferedReadingsCount: z.ZodNullable<z.ZodNumber>;
228
241
  bufferOverflow: z.ZodBoolean;
@@ -330,6 +343,10 @@ export declare const deviceGatewayAdminRouter: {
330
343
  } | undefined;
331
344
  gpioMap?: Record<string, number> | undefined;
332
345
  } | null;
346
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
347
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
348
+ gatewayId: string | null;
349
+ gatewayName: string | null;
333
350
  lastSeenAt: string | null;
334
351
  isOnline: boolean;
335
352
  }, {
@@ -357,6 +374,10 @@ export declare const deviceGatewayAdminRouter: {
357
374
  } | undefined;
358
375
  gpioMap?: Record<string, number> | undefined;
359
376
  } | null;
377
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
378
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
379
+ gatewayId: string | null;
380
+ gatewayName: string | null;
360
381
  lastSeenAt: string | null;
361
382
  isOnline: boolean;
362
383
  }>, "many">;
@@ -386,6 +407,10 @@ export declare const deviceGatewayAdminRouter: {
386
407
  } | undefined;
387
408
  gpioMap?: Record<string, number> | undefined;
388
409
  } | null;
410
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
411
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
412
+ gatewayId: string | null;
413
+ gatewayName: string | null;
389
414
  lastSeenAt: string | null;
390
415
  isOnline: boolean;
391
416
  }[];
@@ -415,6 +440,10 @@ export declare const deviceGatewayAdminRouter: {
415
440
  } | undefined;
416
441
  gpioMap?: Record<string, number> | undefined;
417
442
  } | null;
443
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
444
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
445
+ gatewayId: string | null;
446
+ gatewayName: string | null;
418
447
  lastSeenAt: string | null;
419
448
  isOnline: boolean;
420
449
  }[];
@@ -545,6 +574,9 @@ export declare const deviceGatewayAdminRouter: {
545
574
  } | undefined;
546
575
  gpioMap?: Record<string, number> | undefined;
547
576
  }>>;
577
+ fieldType: z.ZodOptional<z.ZodEnum<["GREENHOUSE", "OPEN_FIELD"]>>;
578
+ transport: z.ZodOptional<z.ZodEnum<["WIFI", "LORA", "CELLULAR_DIRECT"]>>;
579
+ gatewayId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
548
580
  }, "strip", z.ZodTypeAny, {
549
581
  name?: string | undefined;
550
582
  config?: {
@@ -563,6 +595,9 @@ export declare const deviceGatewayAdminRouter: {
563
595
  } | undefined;
564
596
  gpioMap?: Record<string, number> | undefined;
565
597
  } | undefined;
598
+ fieldType?: "GREENHOUSE" | "OPEN_FIELD" | undefined;
599
+ transport?: "WIFI" | "LORA" | "CELLULAR_DIRECT" | undefined;
600
+ gatewayId?: string | null | undefined;
566
601
  }, {
567
602
  name?: string | undefined;
568
603
  config?: {
@@ -581,6 +616,9 @@ export declare const deviceGatewayAdminRouter: {
581
616
  } | undefined;
582
617
  gpioMap?: Record<string, number> | undefined;
583
618
  } | undefined;
619
+ fieldType?: "GREENHOUSE" | "OPEN_FIELD" | undefined;
620
+ transport?: "WIFI" | "LORA" | "CELLULAR_DIRECT" | undefined;
621
+ gatewayId?: string | null | undefined;
584
622
  }>;
585
623
  path: "/farms/:farmId/fields/:fieldId/devices/:deviceId";
586
624
  responses: {
@@ -590,6 +628,10 @@ export declare const deviceGatewayAdminRouter: {
590
628
  name: z.ZodString;
591
629
  fieldId: z.ZodString;
592
630
  farmId: z.ZodString;
631
+ fieldType: z.ZodEnum<["GREENHOUSE", "OPEN_FIELD"]>;
632
+ transport: z.ZodEnum<["WIFI", "LORA", "CELLULAR_DIRECT"]>;
633
+ gatewayId: z.ZodNullable<z.ZodString>;
634
+ gatewayName: z.ZodNullable<z.ZodString>;
593
635
  lastSeenAt: z.ZodNullable<z.ZodString>;
594
636
  bufferedReadingsCount: z.ZodNullable<z.ZodNumber>;
595
637
  bufferOverflow: z.ZodBoolean;
@@ -697,6 +739,10 @@ export declare const deviceGatewayAdminRouter: {
697
739
  } | undefined;
698
740
  gpioMap?: Record<string, number> | undefined;
699
741
  } | null;
742
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
743
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
744
+ gatewayId: string | null;
745
+ gatewayName: string | null;
700
746
  lastSeenAt: string | null;
701
747
  isOnline: boolean;
702
748
  }, {
@@ -724,6 +770,10 @@ export declare const deviceGatewayAdminRouter: {
724
770
  } | undefined;
725
771
  gpioMap?: Record<string, number> | undefined;
726
772
  } | null;
773
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
774
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
775
+ gatewayId: string | null;
776
+ gatewayName: string | null;
727
777
  lastSeenAt: string | null;
728
778
  isOnline: boolean;
729
779
  }>;
@@ -753,6 +803,10 @@ export declare const deviceGatewayAdminRouter: {
753
803
  } | undefined;
754
804
  gpioMap?: Record<string, number> | undefined;
755
805
  } | null;
806
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
807
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
808
+ gatewayId: string | null;
809
+ gatewayName: string | null;
756
810
  lastSeenAt: string | null;
757
811
  isOnline: boolean;
758
812
  };
@@ -782,6 +836,10 @@ export declare const deviceGatewayAdminRouter: {
782
836
  } | undefined;
783
837
  gpioMap?: Record<string, number> | undefined;
784
838
  } | null;
839
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
840
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
841
+ gatewayId: string | null;
842
+ gatewayName: string | null;
785
843
  lastSeenAt: string | null;
786
844
  isOnline: boolean;
787
845
  };
@@ -832,7 +890,7 @@ export declare const deviceGatewayAdminRouter: {
832
890
  fieldId: string;
833
891
  deviceId: string;
834
892
  }>;
835
- summary: "Register an actuator on a greenhouse device";
893
+ summary: "Register an actuator on a field device";
836
894
  method: "POST";
837
895
  body: z.ZodObject<{
838
896
  type: z.ZodEnum<["IRRIGATION_VALVE", "FERT_PUMP_A", "FERT_PUMP_B", "FAN"]>;
@@ -1131,5 +1189,322 @@ export declare const deviceGatewayAdminRouter: {
1131
1189
  }>;
1132
1190
  };
1133
1191
  };
1192
+ getFieldSummary: {
1193
+ pathParams: z.ZodObject<{
1194
+ farmId: z.ZodString;
1195
+ fieldId: z.ZodString;
1196
+ }, "strip", z.ZodTypeAny, {
1197
+ farmId: string;
1198
+ fieldId: string;
1199
+ }, {
1200
+ farmId: string;
1201
+ fieldId: string;
1202
+ }>;
1203
+ summary: "Field automation dashboard aggregate";
1204
+ method: "GET";
1205
+ path: "/farms/:farmId/fields/:fieldId/field/summary";
1206
+ responses: {
1207
+ 200: z.ZodObject<{
1208
+ fieldId: z.ZodString;
1209
+ fieldType: z.ZodNullable<z.ZodEnum<["GREENHOUSE", "OPEN_FIELD"]>>;
1210
+ devices: z.ZodArray<z.ZodObject<{
1211
+ id: z.ZodString;
1212
+ name: z.ZodString;
1213
+ fieldId: z.ZodString;
1214
+ farmId: z.ZodString;
1215
+ fieldType: z.ZodEnum<["GREENHOUSE", "OPEN_FIELD"]>;
1216
+ transport: z.ZodEnum<["WIFI", "LORA", "CELLULAR_DIRECT"]>;
1217
+ gatewayId: z.ZodNullable<z.ZodString>;
1218
+ gatewayName: z.ZodNullable<z.ZodString>;
1219
+ lastSeenAt: z.ZodNullable<z.ZodString>;
1220
+ bufferedReadingsCount: z.ZodNullable<z.ZodNumber>;
1221
+ bufferOverflow: z.ZodBoolean;
1222
+ firmwareVersion: z.ZodNullable<z.ZodString>;
1223
+ isOnline: z.ZodBoolean;
1224
+ config: z.ZodNullable<z.ZodObject<{
1225
+ heartbeatIntervalSec: z.ZodOptional<z.ZodNumber>;
1226
+ commandPollIntervalSec: z.ZodOptional<z.ZodNumber>;
1227
+ sensorIntervals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1228
+ pumpCalibration: z.ZodOptional<z.ZodObject<{
1229
+ fert_pump_a: z.ZodOptional<z.ZodObject<{
1230
+ mlPerSecond: z.ZodNumber;
1231
+ calibratedAt: z.ZodOptional<z.ZodString>;
1232
+ }, "strip", z.ZodTypeAny, {
1233
+ mlPerSecond: number;
1234
+ calibratedAt?: string | undefined;
1235
+ }, {
1236
+ mlPerSecond: number;
1237
+ calibratedAt?: string | undefined;
1238
+ }>>;
1239
+ fert_pump_b: z.ZodOptional<z.ZodObject<{
1240
+ mlPerSecond: z.ZodNumber;
1241
+ calibratedAt: z.ZodOptional<z.ZodString>;
1242
+ }, "strip", z.ZodTypeAny, {
1243
+ mlPerSecond: number;
1244
+ calibratedAt?: string | undefined;
1245
+ }, {
1246
+ mlPerSecond: number;
1247
+ calibratedAt?: string | undefined;
1248
+ }>>;
1249
+ }, "strip", z.ZodTypeAny, {
1250
+ fert_pump_a?: {
1251
+ mlPerSecond: number;
1252
+ calibratedAt?: string | undefined;
1253
+ } | undefined;
1254
+ fert_pump_b?: {
1255
+ mlPerSecond: number;
1256
+ calibratedAt?: string | undefined;
1257
+ } | undefined;
1258
+ }, {
1259
+ fert_pump_a?: {
1260
+ mlPerSecond: number;
1261
+ calibratedAt?: string | undefined;
1262
+ } | undefined;
1263
+ fert_pump_b?: {
1264
+ mlPerSecond: number;
1265
+ calibratedAt?: string | undefined;
1266
+ } | undefined;
1267
+ }>>;
1268
+ gpioMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1269
+ }, "strip", z.ZodTypeAny, {
1270
+ heartbeatIntervalSec?: number | undefined;
1271
+ commandPollIntervalSec?: number | undefined;
1272
+ sensorIntervals?: Record<string, number> | undefined;
1273
+ pumpCalibration?: {
1274
+ fert_pump_a?: {
1275
+ mlPerSecond: number;
1276
+ calibratedAt?: string | undefined;
1277
+ } | undefined;
1278
+ fert_pump_b?: {
1279
+ mlPerSecond: number;
1280
+ calibratedAt?: string | undefined;
1281
+ } | undefined;
1282
+ } | undefined;
1283
+ gpioMap?: Record<string, number> | undefined;
1284
+ }, {
1285
+ heartbeatIntervalSec?: number | undefined;
1286
+ commandPollIntervalSec?: number | undefined;
1287
+ sensorIntervals?: Record<string, number> | undefined;
1288
+ pumpCalibration?: {
1289
+ fert_pump_a?: {
1290
+ mlPerSecond: number;
1291
+ calibratedAt?: string | undefined;
1292
+ } | undefined;
1293
+ fert_pump_b?: {
1294
+ mlPerSecond: number;
1295
+ calibratedAt?: string | undefined;
1296
+ } | undefined;
1297
+ } | undefined;
1298
+ gpioMap?: Record<string, number> | undefined;
1299
+ }>>;
1300
+ createdAt: z.ZodString;
1301
+ }, "strip", z.ZodTypeAny, {
1302
+ id: string;
1303
+ createdAt: string;
1304
+ name: string;
1305
+ farmId: string;
1306
+ fieldId: string;
1307
+ firmwareVersion: string | null;
1308
+ bufferedReadingsCount: number | null;
1309
+ bufferOverflow: boolean;
1310
+ config: {
1311
+ heartbeatIntervalSec?: number | undefined;
1312
+ commandPollIntervalSec?: number | undefined;
1313
+ sensorIntervals?: Record<string, number> | undefined;
1314
+ pumpCalibration?: {
1315
+ fert_pump_a?: {
1316
+ mlPerSecond: number;
1317
+ calibratedAt?: string | undefined;
1318
+ } | undefined;
1319
+ fert_pump_b?: {
1320
+ mlPerSecond: number;
1321
+ calibratedAt?: string | undefined;
1322
+ } | undefined;
1323
+ } | undefined;
1324
+ gpioMap?: Record<string, number> | undefined;
1325
+ } | null;
1326
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
1327
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
1328
+ gatewayId: string | null;
1329
+ gatewayName: string | null;
1330
+ lastSeenAt: string | null;
1331
+ isOnline: boolean;
1332
+ }, {
1333
+ id: string;
1334
+ createdAt: string;
1335
+ name: string;
1336
+ farmId: string;
1337
+ fieldId: string;
1338
+ firmwareVersion: string | null;
1339
+ bufferedReadingsCount: number | null;
1340
+ bufferOverflow: boolean;
1341
+ config: {
1342
+ heartbeatIntervalSec?: number | undefined;
1343
+ commandPollIntervalSec?: number | undefined;
1344
+ sensorIntervals?: Record<string, number> | undefined;
1345
+ pumpCalibration?: {
1346
+ fert_pump_a?: {
1347
+ mlPerSecond: number;
1348
+ calibratedAt?: string | undefined;
1349
+ } | undefined;
1350
+ fert_pump_b?: {
1351
+ mlPerSecond: number;
1352
+ calibratedAt?: string | undefined;
1353
+ } | undefined;
1354
+ } | undefined;
1355
+ gpioMap?: Record<string, number> | undefined;
1356
+ } | null;
1357
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
1358
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
1359
+ gatewayId: string | null;
1360
+ gatewayName: string | null;
1361
+ lastSeenAt: string | null;
1362
+ isOnline: boolean;
1363
+ }>, "many">;
1364
+ actuatorCount: z.ZodNumber;
1365
+ openAlertCount: z.ZodNumber;
1366
+ hasCameras: z.ZodBoolean;
1367
+ sensors: z.ZodArray<z.ZodObject<{
1368
+ id: z.ZodString;
1369
+ name: z.ZodString;
1370
+ type: z.ZodString;
1371
+ lastValue: z.ZodNullable<z.ZodNumber>;
1372
+ unit: z.ZodNullable<z.ZodString>;
1373
+ }, "strip", z.ZodTypeAny, {
1374
+ type: string;
1375
+ id: string;
1376
+ name: string;
1377
+ unit: string | null;
1378
+ lastValue: number | null;
1379
+ }, {
1380
+ type: string;
1381
+ id: string;
1382
+ name: string;
1383
+ unit: string | null;
1384
+ lastValue: number | null;
1385
+ }>, "many">;
1386
+ }, "strip", z.ZodTypeAny, {
1387
+ fieldId: string;
1388
+ sensors: {
1389
+ type: string;
1390
+ id: string;
1391
+ name: string;
1392
+ unit: string | null;
1393
+ lastValue: number | null;
1394
+ }[];
1395
+ fieldType: "GREENHOUSE" | "OPEN_FIELD" | null;
1396
+ devices: {
1397
+ id: string;
1398
+ createdAt: string;
1399
+ name: string;
1400
+ farmId: string;
1401
+ fieldId: string;
1402
+ firmwareVersion: string | null;
1403
+ bufferedReadingsCount: number | null;
1404
+ bufferOverflow: boolean;
1405
+ config: {
1406
+ heartbeatIntervalSec?: number | undefined;
1407
+ commandPollIntervalSec?: number | undefined;
1408
+ sensorIntervals?: Record<string, number> | undefined;
1409
+ pumpCalibration?: {
1410
+ fert_pump_a?: {
1411
+ mlPerSecond: number;
1412
+ calibratedAt?: string | undefined;
1413
+ } | undefined;
1414
+ fert_pump_b?: {
1415
+ mlPerSecond: number;
1416
+ calibratedAt?: string | undefined;
1417
+ } | undefined;
1418
+ } | undefined;
1419
+ gpioMap?: Record<string, number> | undefined;
1420
+ } | null;
1421
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
1422
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
1423
+ gatewayId: string | null;
1424
+ gatewayName: string | null;
1425
+ lastSeenAt: string | null;
1426
+ isOnline: boolean;
1427
+ }[];
1428
+ actuatorCount: number;
1429
+ openAlertCount: number;
1430
+ hasCameras: boolean;
1431
+ }, {
1432
+ fieldId: string;
1433
+ sensors: {
1434
+ type: string;
1435
+ id: string;
1436
+ name: string;
1437
+ unit: string | null;
1438
+ lastValue: number | null;
1439
+ }[];
1440
+ fieldType: "GREENHOUSE" | "OPEN_FIELD" | null;
1441
+ devices: {
1442
+ id: string;
1443
+ createdAt: string;
1444
+ name: string;
1445
+ farmId: string;
1446
+ fieldId: string;
1447
+ firmwareVersion: string | null;
1448
+ bufferedReadingsCount: number | null;
1449
+ bufferOverflow: boolean;
1450
+ config: {
1451
+ heartbeatIntervalSec?: number | undefined;
1452
+ commandPollIntervalSec?: number | undefined;
1453
+ sensorIntervals?: Record<string, number> | undefined;
1454
+ pumpCalibration?: {
1455
+ fert_pump_a?: {
1456
+ mlPerSecond: number;
1457
+ calibratedAt?: string | undefined;
1458
+ } | undefined;
1459
+ fert_pump_b?: {
1460
+ mlPerSecond: number;
1461
+ calibratedAt?: string | undefined;
1462
+ } | undefined;
1463
+ } | undefined;
1464
+ gpioMap?: Record<string, number> | undefined;
1465
+ } | null;
1466
+ fieldType: "GREENHOUSE" | "OPEN_FIELD";
1467
+ transport: "WIFI" | "LORA" | "CELLULAR_DIRECT";
1468
+ gatewayId: string | null;
1469
+ gatewayName: string | null;
1470
+ lastSeenAt: string | null;
1471
+ isOnline: boolean;
1472
+ }[];
1473
+ actuatorCount: number;
1474
+ openAlertCount: number;
1475
+ hasCameras: boolean;
1476
+ }>;
1477
+ 401: z.ZodObject<{
1478
+ message: z.ZodString;
1479
+ code: z.ZodString;
1480
+ }, "strip", z.ZodTypeAny, {
1481
+ code: string;
1482
+ message: string;
1483
+ }, {
1484
+ code: string;
1485
+ message: string;
1486
+ }>;
1487
+ 403: z.ZodObject<{
1488
+ message: z.ZodString;
1489
+ code: z.ZodString;
1490
+ }, "strip", z.ZodTypeAny, {
1491
+ code: string;
1492
+ message: string;
1493
+ }, {
1494
+ code: string;
1495
+ message: string;
1496
+ }>;
1497
+ 404: z.ZodObject<{
1498
+ message: z.ZodString;
1499
+ code: z.ZodString;
1500
+ }, "strip", z.ZodTypeAny, {
1501
+ code: string;
1502
+ message: string;
1503
+ }, {
1504
+ code: string;
1505
+ message: string;
1506
+ }>;
1507
+ };
1508
+ };
1134
1509
  };
1135
1510
  //# sourceMappingURL=device-gateway-admin.routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-gateway-admin.routes.d.ts","sourceRoot":"","sources":["../../src/routes/device-gateway-admin.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHnC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { initContract } from '@ts-rest/core';
2
2
  import { z } from 'zod';
3
- import { createDeviceRequestSchema, createDeviceResponseSchema, listDevicesResponseSchema, updateDeviceRequestSchema, updateDeviceResponseSchema, createActuatorRequestSchema, listActuatorsResponseSchema, actuatorSchema, actuatorCommandRequestSchema, actuatorCommandResponseSchema, deviceErrorSchema, } from '../schemas/device-gateway.schemas';
3
+ import { createDeviceRequestSchema, createDeviceResponseSchema, listDevicesResponseSchema, updateDeviceRequestSchema, updateDeviceResponseSchema, createActuatorRequestSchema, listActuatorsResponseSchema, actuatorSchema, actuatorCommandRequestSchema, actuatorCommandResponseSchema, fieldSummaryResponseSchema, deviceErrorSchema, } from '../schemas/device-gateway.schemas';
4
4
  const c = initContract();
5
5
  export const deviceGatewayAdminRouter = c.router({
6
6
  createDevice: {
@@ -17,7 +17,7 @@ export const deviceGatewayAdminRouter = c.router({
17
17
  403: deviceErrorSchema,
18
18
  404: deviceErrorSchema,
19
19
  },
20
- summary: 'Register a greenhouse edge device and generate API key',
20
+ summary: 'Register a field edge device and generate API key',
21
21
  },
22
22
  listDevices: {
23
23
  method: 'GET',
@@ -32,7 +32,7 @@ export const deviceGatewayAdminRouter = c.router({
32
32
  403: deviceErrorSchema,
33
33
  404: deviceErrorSchema,
34
34
  },
35
- summary: 'List greenhouse devices for a field',
35
+ summary: 'List field devices for a field',
36
36
  },
37
37
  updateDevice: {
38
38
  method: 'PATCH',
@@ -66,7 +66,7 @@ export const deviceGatewayAdminRouter = c.router({
66
66
  403: deviceErrorSchema,
67
67
  404: deviceErrorSchema,
68
68
  },
69
- summary: 'Register an actuator on a greenhouse device',
69
+ summary: 'Register an actuator on a field device',
70
70
  },
71
71
  listActuators: {
72
72
  method: 'GET',
@@ -102,4 +102,19 @@ export const deviceGatewayAdminRouter = c.router({
102
102
  },
103
103
  summary: 'Queue a manual actuator command (Run now)',
104
104
  },
105
+ getFieldSummary: {
106
+ method: 'GET',
107
+ path: '/farms/:farmId/fields/:fieldId/field/summary',
108
+ pathParams: z.object({
109
+ farmId: z.string().uuid(),
110
+ fieldId: z.string().uuid(),
111
+ }),
112
+ responses: {
113
+ 200: fieldSummaryResponseSchema,
114
+ 401: deviceErrorSchema,
115
+ 403: deviceErrorSchema,
116
+ 404: deviceErrorSchema,
117
+ },
118
+ summary: 'Field automation dashboard aggregate',
119
+ },
105
120
  });
@@ -0,0 +1,46 @@
1
+ export declare const farmGatewayDeviceRouter: {
2
+ heartbeat: {
3
+ summary: "Farm gateway observability heartbeat";
4
+ method: "POST";
5
+ body: import("zod").ZodObject<{
6
+ gatewayId: import("zod").ZodString;
7
+ firmwareVersion: import("zod").ZodOptional<import("zod").ZodString>;
8
+ relayedDeviceCount: import("zod").ZodOptional<import("zod").ZodNumber>;
9
+ wanConnected: import("zod").ZodOptional<import("zod").ZodBoolean>;
10
+ }, "strip", import("zod").ZodTypeAny, {
11
+ gatewayId: string;
12
+ firmwareVersion?: string | undefined;
13
+ relayedDeviceCount?: number | undefined;
14
+ wanConnected?: boolean | undefined;
15
+ }, {
16
+ gatewayId: string;
17
+ firmwareVersion?: string | undefined;
18
+ relayedDeviceCount?: number | undefined;
19
+ wanConnected?: boolean | undefined;
20
+ }>;
21
+ path: "/gateway/heartbeat";
22
+ responses: {
23
+ 200: import("zod").ZodObject<{
24
+ serverTime: import("zod").ZodString;
25
+ farmId: import("zod").ZodString;
26
+ }, "strip", import("zod").ZodTypeAny, {
27
+ farmId: string;
28
+ serverTime: string;
29
+ }, {
30
+ farmId: string;
31
+ serverTime: string;
32
+ }>;
33
+ 401: import("zod").ZodObject<{
34
+ message: import("zod").ZodString;
35
+ code: import("zod").ZodString;
36
+ }, "strip", import("zod").ZodTypeAny, {
37
+ code: string;
38
+ message: string;
39
+ }, {
40
+ code: string;
41
+ message: string;
42
+ }>;
43
+ };
44
+ };
45
+ };
46
+ //# sourceMappingURL=farm-gateway-device.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"farm-gateway-device.routes.d.ts","sourceRoot":"","sources":["../../src/routes/farm-gateway-device.routes.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWlC,CAAC"}