@deepintel-ltd/farmpro-contracts 1.1.0 → 1.2.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.
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fieldMonitoringErrorResponseSchema = exports.triggerAnalysisResponseSchema = exports.alertsQuerySchema = exports.ndviTrendQuerySchema = exports.farmMonitoringStatsSchema = exports.fieldComparisonSchema = exports.fieldAlertSchema = exports.weeklyNDVIStatsSchema = exports.ndviTrendDataPointSchema = exports.fieldMonitoringSummarySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Field Monitoring Summary Schema
6
+ exports.fieldMonitoringSummarySchema = zod_1.z.object({
7
+ id: zod_1.z.string().uuid(),
8
+ fieldId: zod_1.z.string().uuid(),
9
+ fieldName: zod_1.z.string(),
10
+ latestDate: zod_1.z.string().datetime(),
11
+ currentNDVI: zod_1.z.number().min(-1).max(1).nullable(),
12
+ currentNDWI: zod_1.z.number().min(-1).max(1).nullable(),
13
+ currentEVI: zod_1.z.number().nullable(),
14
+ currentCropHealth: zod_1.z
15
+ .enum(['poor', 'fair', 'good', 'excellent'])
16
+ .nullable(),
17
+ currentWaterStress: zod_1.z
18
+ .enum(['none', 'low', 'medium', 'high'])
19
+ .nullable(),
20
+ overallStatus: zod_1.z.enum(['ok', 'warning', 'critical']),
21
+ activeAlertCount: zod_1.z.number(),
22
+ lastAlertDate: zod_1.z.string().datetime().nullable(),
23
+ dataQuality: zod_1.z.enum(['excellent', 'good', 'fair', 'poor']).nullable(),
24
+ cloudCover: zod_1.z.number().nullable(),
25
+ lastProcessedAt: zod_1.z.string().datetime(),
26
+ });
27
+ // NDVI Trend Data Point Schema
28
+ exports.ndviTrendDataPointSchema = zod_1.z.object({
29
+ time: zod_1.z.string().datetime(),
30
+ ndvi: zod_1.z.number().min(-1).max(1),
31
+ cloudCover: zod_1.z.number(),
32
+ });
33
+ // Weekly NDVI Stats Schema
34
+ exports.weeklyNDVIStatsSchema = zod_1.z.object({
35
+ week: zod_1.z.string().datetime(),
36
+ avgNdvi: zod_1.z.number(),
37
+ maxNdvi: zod_1.z.number(),
38
+ minNdvi: zod_1.z.number(),
39
+ });
40
+ // Field Alert Schema
41
+ exports.fieldAlertSchema = zod_1.z.object({
42
+ id: zod_1.z.string().uuid(),
43
+ fieldId: zod_1.z.string().uuid(),
44
+ fieldName: zod_1.z.string().optional(),
45
+ type: zod_1.z.string(),
46
+ severity: zod_1.z.enum(['low', 'medium', 'high', 'critical']),
47
+ title: zod_1.z.string(),
48
+ message: zod_1.z.string(),
49
+ recommendation: zod_1.z.string().nullable(),
50
+ status: zod_1.z.enum(['active', 'acknowledged', 'resolved']),
51
+ acknowledgedAt: zod_1.z.string().datetime().nullable(),
52
+ acknowledgedBy: zod_1.z.string().nullable(),
53
+ resolvedAt: zod_1.z.string().datetime().nullable(),
54
+ confidence: zod_1.z.number().min(0).max(1).nullable(),
55
+ generatedBy: zod_1.z.string(),
56
+ createdAt: zod_1.z.string().datetime(),
57
+ });
58
+ // Field Comparison Schema
59
+ exports.fieldComparisonSchema = zod_1.z.object({
60
+ fieldId: zod_1.z.string().uuid(),
61
+ fieldName: zod_1.z.string(),
62
+ avgNDVI: zod_1.z.number(),
63
+ avgHealthScore: zod_1.z.number(),
64
+ rank: zod_1.z.number(),
65
+ });
66
+ // Farm Monitoring Stats Schema
67
+ exports.farmMonitoringStatsSchema = zod_1.z.object({
68
+ totalFields: zod_1.z.number(),
69
+ healthyFields: zod_1.z.number(),
70
+ warningFields: zod_1.z.number(),
71
+ criticalFields: zod_1.z.number(),
72
+ avgNDVI: zod_1.z.number(),
73
+ totalActiveAlerts: zod_1.z.number(),
74
+ });
75
+ // Query Schemas
76
+ exports.ndviTrendQuerySchema = zod_1.z.object({
77
+ startDate: zod_1.z.string().datetime(),
78
+ endDate: zod_1.z.string().datetime(),
79
+ interval: zod_1.z.enum(['daily', 'weekly']).default('daily'),
80
+ });
81
+ exports.alertsQuerySchema = zod_1.z.object({
82
+ status: zod_1.z.enum(['active', 'acknowledged', 'resolved']).optional(),
83
+ });
84
+ // Response Schemas
85
+ exports.triggerAnalysisResponseSchema = zod_1.z.object({
86
+ message: zod_1.z.string(),
87
+ jobId: zod_1.z.string(),
88
+ });
89
+ exports.fieldMonitoringErrorResponseSchema = zod_1.z.object({
90
+ message: zod_1.z.string(),
91
+ code: zod_1.z.string().optional(),
92
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepintel-ltd/farmpro-contracts",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Type-safe API contracts for FarmPro API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",