@deepintel-ltd/farmpro-contracts 1.7.19 → 1.7.20

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 (63) hide show
  1. package/dist/index.d.ts +16 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +15 -0
  4. package/dist/routes/agents.routes.d.ts +6 -6
  5. package/dist/routes/cooperative.routes.d.ts +1327 -0
  6. package/dist/routes/cooperative.routes.d.ts.map +1 -0
  7. package/dist/routes/cooperative.routes.js +47 -0
  8. package/dist/routes/extension.routes.d.ts +2431 -0
  9. package/dist/routes/extension.routes.d.ts.map +1 -0
  10. package/dist/routes/extension.routes.js +75 -0
  11. package/dist/routes/farms.routes.d.ts +775 -0
  12. package/dist/routes/farms.routes.d.ts.map +1 -1
  13. package/dist/routes/farms.routes.js +15 -1
  14. package/dist/routes/field-monitoring.routes.d.ts +505 -0
  15. package/dist/routes/field-monitoring.routes.d.ts.map +1 -1
  16. package/dist/routes/field-monitoring.routes.js +23 -1
  17. package/dist/routes/fields.routes.d.ts +156 -155
  18. package/dist/routes/fields.routes.d.ts.map +1 -1
  19. package/dist/routes/index.d.ts +15 -0
  20. package/dist/routes/index.d.ts.map +1 -1
  21. package/dist/routes/index.js +10 -0
  22. package/dist/routes/live-monitor.routes.d.ts +513 -0
  23. package/dist/routes/live-monitor.routes.d.ts.map +1 -0
  24. package/dist/routes/live-monitor.routes.js +81 -0
  25. package/dist/routes/livestock-map.routes.d.ts +4 -4
  26. package/dist/routes/monitoring-visualization.routes.d.ts +4 -4
  27. package/dist/routes/notifications.routes.d.ts +1350 -0
  28. package/dist/routes/notifications.routes.d.ts.map +1 -0
  29. package/dist/routes/notifications.routes.js +66 -0
  30. package/dist/routes/team-payments.routes.d.ts +9571 -0
  31. package/dist/routes/team-payments.routes.d.ts.map +1 -0
  32. package/dist/routes/team-payments.routes.js +262 -0
  33. package/dist/schemas/agents.schemas.d.ts +1 -0
  34. package/dist/schemas/agents.schemas.d.ts.map +1 -1
  35. package/dist/schemas/cooperative.schemas.d.ts +560 -0
  36. package/dist/schemas/cooperative.schemas.d.ts.map +1 -0
  37. package/dist/schemas/cooperative.schemas.js +71 -0
  38. package/dist/schemas/extension.schemas.d.ts +1204 -0
  39. package/dist/schemas/extension.schemas.d.ts.map +1 -0
  40. package/dist/schemas/extension.schemas.js +68 -0
  41. package/dist/schemas/farms.schemas.d.ts +591 -0
  42. package/dist/schemas/farms.schemas.d.ts.map +1 -1
  43. package/dist/schemas/farms.schemas.js +44 -0
  44. package/dist/schemas/field-monitoring.schemas.d.ts +276 -0
  45. package/dist/schemas/field-monitoring.schemas.d.ts.map +1 -1
  46. package/dist/schemas/field-monitoring.schemas.js +9 -0
  47. package/dist/schemas/field-observations.schemas.d.ts +1 -0
  48. package/dist/schemas/field-observations.schemas.d.ts.map +1 -1
  49. package/dist/schemas/fields.schemas.d.ts +188 -186
  50. package/dist/schemas/fields.schemas.d.ts.map +1 -1
  51. package/dist/schemas/fields.schemas.js +10 -2
  52. package/dist/schemas/live-monitor.schemas.d.ts +596 -0
  53. package/dist/schemas/live-monitor.schemas.d.ts.map +1 -0
  54. package/dist/schemas/live-monitor.schemas.js +107 -0
  55. package/dist/schemas/livestock-map.schemas.d.ts +10 -10
  56. package/dist/schemas/monitoring-visualization.schemas.d.ts +4 -4
  57. package/dist/schemas/notifications.schemas.d.ts +464 -0
  58. package/dist/schemas/notifications.schemas.d.ts.map +1 -0
  59. package/dist/schemas/notifications.schemas.js +40 -0
  60. package/dist/schemas/team-payments.schemas.d.ts +2604 -0
  61. package/dist/schemas/team-payments.schemas.d.ts.map +1 -0
  62. package/dist/schemas/team-payments.schemas.js +151 -0
  63. package/package.json +1 -1
@@ -0,0 +1,107 @@
1
+ import { z } from 'zod';
2
+ import { cameraSchema, sensorSchema, } from './monitoring-visualization.schemas';
3
+ // ============================================================================
4
+ // Live Monitor — Farm-level aggregation schemas
5
+ // ============================================================================
6
+ export const liveMonitorErrorSchema = z.object({
7
+ message: z.string(),
8
+ code: z.string(),
9
+ });
10
+ export const liveMonitorSummarySchema = z.object({
11
+ farmId: z.string().uuid(),
12
+ farmName: z.string(),
13
+ camerasOnline: z.number().int().min(0),
14
+ camerasOffline: z.number().int().min(0),
15
+ camerasTotal: z.number().int().min(0),
16
+ sensorsActive: z.number().int().min(0),
17
+ sensorsInactive: z.number().int().min(0),
18
+ sensorsTotal: z.number().int().min(0),
19
+ activeAlerts: z.number().int().min(0),
20
+ unreadAlerts: z.number().int().min(0),
21
+ fieldsWithMonitoring: z.number().int().min(0),
22
+ lastUpdatedAt: z.string().datetime(),
23
+ });
24
+ export const liveMonitorCameraSchema = cameraSchema.extend({
25
+ fieldId: z.string().uuid(),
26
+ fieldName: z.string(),
27
+ });
28
+ export const liveMonitorCamerasResponseSchema = z.object({
29
+ farmId: z.string().uuid(),
30
+ cameras: z.array(liveMonitorCameraSchema),
31
+ totalCameras: z.number().int().min(0),
32
+ });
33
+ export const liveMonitorSensorSchema = sensorSchema.extend({
34
+ fieldId: z.string().uuid(),
35
+ fieldName: z.string(),
36
+ });
37
+ export const liveMonitorSensorsResponseSchema = z.object({
38
+ farmId: z.string().uuid(),
39
+ sensors: z.array(liveMonitorSensorSchema),
40
+ totalSensors: z.number().int().min(0),
41
+ });
42
+ export const liveMonitorEventTypeSchema = z.enum([
43
+ 'alert',
44
+ 'camera_motion',
45
+ 'camera_snapshot',
46
+ 'camera_status',
47
+ 'sensor_threshold',
48
+ 'weather',
49
+ 'ndvi_change',
50
+ ]);
51
+ export const liveMonitorEventSeveritySchema = z.enum([
52
+ 'info',
53
+ 'low',
54
+ 'medium',
55
+ 'high',
56
+ 'critical',
57
+ ]);
58
+ export const liveMonitorEventSchema = z.object({
59
+ id: z.string(),
60
+ type: liveMonitorEventTypeSchema,
61
+ severity: liveMonitorEventSeveritySchema.optional(),
62
+ title: z.string(),
63
+ message: z.string(),
64
+ timestamp: z.string().datetime(),
65
+ fieldId: z.string().uuid().optional(),
66
+ fieldName: z.string().optional(),
67
+ cameraId: z.string().uuid().optional(),
68
+ sensorId: z.string().uuid().optional(),
69
+ icon: z.string().optional(),
70
+ });
71
+ export const liveMonitorEventsQuerySchema = z.object({
72
+ limit: z
73
+ .string()
74
+ .transform(Number)
75
+ .pipe(z.number().int().min(1).max(100))
76
+ .default('20'),
77
+ since: z.string().datetime().optional(),
78
+ });
79
+ export const liveMonitorEventsResponseSchema = z.object({
80
+ farmId: z.string().uuid(),
81
+ events: z.array(liveMonitorEventSchema),
82
+ totalEvents: z.number().int().min(0),
83
+ });
84
+ export const cameraStreamTokenResponseSchema = z.object({
85
+ cameraId: z.string().uuid(),
86
+ farmId: z.string().uuid(),
87
+ token: z.string(),
88
+ expiresAt: z.string().datetime(),
89
+ streamUrl: z.string().url().nullable(),
90
+ quality: z.enum(['low', 'medium', 'high']).default('medium'),
91
+ });
92
+ export const captureSnapshotQuerySchema = z.object({
93
+ dataSaver: z
94
+ .string()
95
+ .optional()
96
+ .transform((val) => val === 'true' || val === '1'),
97
+ });
98
+ export const captureSnapshotResponseSchema = z.object({
99
+ snapshotId: z.string().uuid(),
100
+ cameraId: z.string().uuid(),
101
+ farmId: z.string().uuid(),
102
+ imageUrl: z.string().url(),
103
+ capturedAt: z.string().datetime(),
104
+ triggerType: z.enum(['manual', 'scheduled', 'motion']),
105
+ dataSaver: z.boolean(),
106
+ resolution: z.string().nullable(),
107
+ });
@@ -49,13 +49,13 @@ export declare const movementTrailPointSchema: z.ZodObject<{
49
49
  lng: z.ZodNumber;
50
50
  timestamp: z.ZodString;
51
51
  }, "strip", z.ZodTypeAny, {
52
- timestamp: string;
53
52
  lat: number;
54
53
  lng: number;
55
- }, {
56
54
  timestamp: string;
55
+ }, {
57
56
  lat: number;
58
57
  lng: number;
58
+ timestamp: string;
59
59
  }>;
60
60
  export declare const livestockMovementTrailSchema: z.ZodObject<{
61
61
  livestockId: z.ZodString;
@@ -64,13 +64,13 @@ export declare const livestockMovementTrailSchema: z.ZodObject<{
64
64
  lng: z.ZodNumber;
65
65
  timestamp: z.ZodString;
66
66
  }, "strip", z.ZodTypeAny, {
67
- timestamp: string;
68
67
  lat: number;
69
68
  lng: number;
70
- }, {
71
69
  timestamp: string;
70
+ }, {
72
71
  lat: number;
73
72
  lng: number;
73
+ timestamp: string;
74
74
  }>, "many">;
75
75
  dateRange: z.ZodObject<{
76
76
  start: z.ZodString;
@@ -89,9 +89,9 @@ export declare const livestockMovementTrailSchema: z.ZodObject<{
89
89
  };
90
90
  livestockId: string;
91
91
  points: {
92
- timestamp: string;
93
92
  lat: number;
94
93
  lng: number;
94
+ timestamp: string;
95
95
  }[];
96
96
  }, {
97
97
  dateRange: {
@@ -100,9 +100,9 @@ export declare const livestockMovementTrailSchema: z.ZodObject<{
100
100
  };
101
101
  livestockId: string;
102
102
  points: {
103
- timestamp: string;
104
103
  lat: number;
105
104
  lng: number;
105
+ timestamp: string;
106
106
  }[];
107
107
  }>;
108
108
  export declare const heatmapPointSchema: z.ZodObject<{
@@ -229,13 +229,13 @@ export declare const movementTrailListResponseSchema: z.ZodArray<z.ZodObject<{
229
229
  lng: z.ZodNumber;
230
230
  timestamp: z.ZodString;
231
231
  }, "strip", z.ZodTypeAny, {
232
- timestamp: string;
233
232
  lat: number;
234
233
  lng: number;
235
- }, {
236
234
  timestamp: string;
235
+ }, {
237
236
  lat: number;
238
237
  lng: number;
238
+ timestamp: string;
239
239
  }>, "many">;
240
240
  dateRange: z.ZodObject<{
241
241
  start: z.ZodString;
@@ -254,9 +254,9 @@ export declare const movementTrailListResponseSchema: z.ZodArray<z.ZodObject<{
254
254
  };
255
255
  livestockId: string;
256
256
  points: {
257
- timestamp: string;
258
257
  lat: number;
259
258
  lng: number;
259
+ timestamp: string;
260
260
  }[];
261
261
  }, {
262
262
  dateRange: {
@@ -265,9 +265,9 @@ export declare const movementTrailListResponseSchema: z.ZodArray<z.ZodObject<{
265
265
  };
266
266
  livestockId: string;
267
267
  points: {
268
- timestamp: string;
269
268
  lat: number;
270
269
  lng: number;
270
+ timestamp: string;
271
271
  }[];
272
272
  }>, "many">;
273
273
  export declare const heatmapResponseSchema: z.ZodArray<z.ZodObject<{
@@ -1795,13 +1795,13 @@ export declare const sensorReadingHistorySchema: z.ZodObject<{
1795
1795
  }, "strip", z.ZodTypeAny, {
1796
1796
  value: number;
1797
1797
  unit: string;
1798
- quality: "poor" | "fair" | "good" | null;
1799
1798
  readAt: string;
1799
+ quality: "poor" | "fair" | "good" | null;
1800
1800
  }, {
1801
1801
  value: number;
1802
1802
  unit: string;
1803
- quality: "poor" | "fair" | "good" | null;
1804
1803
  readAt: string;
1804
+ quality: "poor" | "fair" | "good" | null;
1805
1805
  }>, "many">;
1806
1806
  statistics: z.ZodObject<{
1807
1807
  min: z.ZodNumber;
@@ -1823,8 +1823,8 @@ export declare const sensorReadingHistorySchema: z.ZodObject<{
1823
1823
  readings: {
1824
1824
  value: number;
1825
1825
  unit: string;
1826
- quality: "poor" | "fair" | "good" | null;
1827
1826
  readAt: string;
1827
+ quality: "poor" | "fair" | "good" | null;
1828
1828
  }[];
1829
1829
  statistics: {
1830
1830
  min: number;
@@ -1837,8 +1837,8 @@ export declare const sensorReadingHistorySchema: z.ZodObject<{
1837
1837
  readings: {
1838
1838
  value: number;
1839
1839
  unit: string;
1840
- quality: "poor" | "fair" | "good" | null;
1841
1840
  readAt: string;
1841
+ quality: "poor" | "fair" | "good" | null;
1842
1842
  }[];
1843
1843
  statistics: {
1844
1844
  min: number;