@deepintel-ltd/farmpro-contracts 1.4.2 → 1.5.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.
@@ -735,21 +735,231 @@ export declare const fieldMonitoringRouter: {
735
735
  }>;
736
736
  };
737
737
  };
738
+ resolveAlert: {
739
+ summary: "Resolve an alert";
740
+ method: "PATCH";
741
+ body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
742
+ path: "/farms/:farmId/monitoring/alerts/:alertId/resolve";
743
+ responses: {
744
+ 200: z.ZodObject<{
745
+ id: z.ZodString;
746
+ fieldId: z.ZodString;
747
+ fieldName: z.ZodOptional<z.ZodString>;
748
+ type: z.ZodString;
749
+ severity: z.ZodEnum<["low", "medium", "high", "critical"]>;
750
+ title: z.ZodString;
751
+ message: z.ZodString;
752
+ recommendations: z.ZodNullable<z.ZodArray<z.ZodObject<{
753
+ priority: z.ZodNumber;
754
+ action: z.ZodString;
755
+ details: z.ZodString;
756
+ timing: z.ZodString;
757
+ severity: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
758
+ confidence: z.ZodOptional<z.ZodNumber>;
759
+ materials: z.ZodOptional<z.ZodArray<z.ZodObject<{
760
+ inventoryItemId: z.ZodOptional<z.ZodString>;
761
+ name: z.ZodString;
762
+ quantity: z.ZodNumber;
763
+ unit: z.ZodString;
764
+ costPerUnit: z.ZodOptional<z.ZodNumber>;
765
+ totalCost: z.ZodOptional<z.ZodNumber>;
766
+ availability: z.ZodOptional<z.ZodString>;
767
+ }, "strip", z.ZodTypeAny, {
768
+ name: string;
769
+ unit: string;
770
+ quantity: number;
771
+ inventoryItemId?: string | undefined;
772
+ totalCost?: number | undefined;
773
+ costPerUnit?: number | undefined;
774
+ availability?: string | undefined;
775
+ }, {
776
+ name: string;
777
+ unit: string;
778
+ quantity: number;
779
+ inventoryItemId?: string | undefined;
780
+ totalCost?: number | undefined;
781
+ costPerUnit?: number | undefined;
782
+ availability?: string | undefined;
783
+ }>, "many">>;
784
+ applicationMethod: z.ZodOptional<z.ZodString>;
785
+ expectedOutcome: z.ZodOptional<z.ZodString>;
786
+ preventiveMeasures: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
787
+ estimatedTime: z.ZodOptional<z.ZodString>;
788
+ riskLevel: z.ZodOptional<z.ZodString>;
789
+ }, "strip", z.ZodTypeAny, {
790
+ priority: number;
791
+ action: string;
792
+ details: string;
793
+ timing: string;
794
+ severity?: "critical" | "low" | "medium" | "high" | undefined;
795
+ confidence?: number | undefined;
796
+ materials?: {
797
+ name: string;
798
+ unit: string;
799
+ quantity: number;
800
+ inventoryItemId?: string | undefined;
801
+ totalCost?: number | undefined;
802
+ costPerUnit?: number | undefined;
803
+ availability?: string | undefined;
804
+ }[] | undefined;
805
+ applicationMethod?: string | undefined;
806
+ expectedOutcome?: string | undefined;
807
+ preventiveMeasures?: string[] | undefined;
808
+ estimatedTime?: string | undefined;
809
+ riskLevel?: string | undefined;
810
+ }, {
811
+ priority: number;
812
+ action: string;
813
+ details: string;
814
+ timing: string;
815
+ severity?: "critical" | "low" | "medium" | "high" | undefined;
816
+ confidence?: number | undefined;
817
+ materials?: {
818
+ name: string;
819
+ unit: string;
820
+ quantity: number;
821
+ inventoryItemId?: string | undefined;
822
+ totalCost?: number | undefined;
823
+ costPerUnit?: number | undefined;
824
+ availability?: string | undefined;
825
+ }[] | undefined;
826
+ applicationMethod?: string | undefined;
827
+ expectedOutcome?: string | undefined;
828
+ preventiveMeasures?: string[] | undefined;
829
+ estimatedTime?: string | undefined;
830
+ riskLevel?: string | undefined;
831
+ }>, "many">>;
832
+ status: z.ZodEnum<["active", "acknowledged", "resolved"]>;
833
+ acknowledgedAt: z.ZodNullable<z.ZodString>;
834
+ acknowledgedBy: z.ZodNullable<z.ZodString>;
835
+ resolvedAt: z.ZodNullable<z.ZodString>;
836
+ confidence: z.ZodNullable<z.ZodNumber>;
837
+ generatedBy: z.ZodString;
838
+ createdAt: z.ZodString;
839
+ }, "strip", z.ZodTypeAny, {
840
+ type: string;
841
+ status: "active" | "acknowledged" | "resolved";
842
+ message: string;
843
+ id: string;
844
+ title: string;
845
+ createdAt: string;
846
+ fieldId: string;
847
+ recommendations: {
848
+ priority: number;
849
+ action: string;
850
+ details: string;
851
+ timing: string;
852
+ severity?: "critical" | "low" | "medium" | "high" | undefined;
853
+ confidence?: number | undefined;
854
+ materials?: {
855
+ name: string;
856
+ unit: string;
857
+ quantity: number;
858
+ inventoryItemId?: string | undefined;
859
+ totalCost?: number | undefined;
860
+ costPerUnit?: number | undefined;
861
+ availability?: string | undefined;
862
+ }[] | undefined;
863
+ applicationMethod?: string | undefined;
864
+ expectedOutcome?: string | undefined;
865
+ preventiveMeasures?: string[] | undefined;
866
+ estimatedTime?: string | undefined;
867
+ riskLevel?: string | undefined;
868
+ }[] | null;
869
+ severity: "critical" | "low" | "medium" | "high";
870
+ confidence: number | null;
871
+ acknowledgedAt: string | null;
872
+ acknowledgedBy: string | null;
873
+ resolvedAt: string | null;
874
+ generatedBy: string;
875
+ fieldName?: string | undefined;
876
+ }, {
877
+ type: string;
878
+ status: "active" | "acknowledged" | "resolved";
879
+ message: string;
880
+ id: string;
881
+ title: string;
882
+ createdAt: string;
883
+ fieldId: string;
884
+ recommendations: {
885
+ priority: number;
886
+ action: string;
887
+ details: string;
888
+ timing: string;
889
+ severity?: "critical" | "low" | "medium" | "high" | undefined;
890
+ confidence?: number | undefined;
891
+ materials?: {
892
+ name: string;
893
+ unit: string;
894
+ quantity: number;
895
+ inventoryItemId?: string | undefined;
896
+ totalCost?: number | undefined;
897
+ costPerUnit?: number | undefined;
898
+ availability?: string | undefined;
899
+ }[] | undefined;
900
+ applicationMethod?: string | undefined;
901
+ expectedOutcome?: string | undefined;
902
+ preventiveMeasures?: string[] | undefined;
903
+ estimatedTime?: string | undefined;
904
+ riskLevel?: string | undefined;
905
+ }[] | null;
906
+ severity: "critical" | "low" | "medium" | "high";
907
+ confidence: number | null;
908
+ acknowledgedAt: string | null;
909
+ acknowledgedBy: string | null;
910
+ resolvedAt: string | null;
911
+ generatedBy: string;
912
+ fieldName?: string | undefined;
913
+ }>;
914
+ 404: z.ZodObject<{
915
+ message: z.ZodString;
916
+ code: z.ZodOptional<z.ZodString>;
917
+ }, "strip", z.ZodTypeAny, {
918
+ message: string;
919
+ code?: string | undefined;
920
+ }, {
921
+ message: string;
922
+ code?: string | undefined;
923
+ }>;
924
+ };
925
+ };
738
926
  triggerAnalysis: {
739
927
  summary: "Manually trigger field analysis";
740
928
  method: "POST";
741
- body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
929
+ body: z.ZodObject<{
930
+ force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
931
+ }, "strip", z.ZodTypeAny, {
932
+ force: boolean;
933
+ }, {
934
+ force?: boolean | undefined;
935
+ }>;
742
936
  path: "/farms/:farmId/fields/:fieldId/monitoring/analyze";
743
937
  responses: {
938
+ 200: z.ZodObject<{
939
+ message: z.ZodString;
940
+ jobId: z.ZodNullable<z.ZodString>;
941
+ nextAvailableAt: z.ZodOptional<z.ZodString>;
942
+ }, "strip", z.ZodTypeAny, {
943
+ message: string;
944
+ jobId: string | null;
945
+ nextAvailableAt?: string | undefined;
946
+ }, {
947
+ message: string;
948
+ jobId: string | null;
949
+ nextAvailableAt?: string | undefined;
950
+ }>;
744
951
  202: z.ZodObject<{
745
952
  message: z.ZodString;
746
- jobId: z.ZodString;
953
+ jobId: z.ZodNullable<z.ZodString>;
954
+ nextAvailableAt: z.ZodOptional<z.ZodString>;
747
955
  }, "strip", z.ZodTypeAny, {
748
956
  message: string;
749
- jobId: string;
957
+ jobId: string | null;
958
+ nextAvailableAt?: string | undefined;
750
959
  }, {
751
960
  message: string;
752
- jobId: string;
961
+ jobId: string | null;
962
+ nextAvailableAt?: string | undefined;
753
963
  }>;
754
964
  404: z.ZodObject<{
755
965
  message: z.ZodString;
@@ -783,6 +993,79 @@ export declare const fieldMonitoringRouter: {
783
993
  }>;
784
994
  };
785
995
  };
996
+ retryFailedJobs: {
997
+ summary: "Retry all failed field analysis jobs";
998
+ method: "POST";
999
+ body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
1000
+ path: "/farms/:farmId/monitoring/queue/retry-failed";
1001
+ responses: {
1002
+ 200: z.ZodObject<{
1003
+ message: z.ZodString;
1004
+ retriedCount: z.ZodNumber;
1005
+ failedJobIds: z.ZodArray<z.ZodString, "many">;
1006
+ skippedCount: z.ZodNumber;
1007
+ skippedJobIds: z.ZodArray<z.ZodString, "many">;
1008
+ }, "strip", z.ZodTypeAny, {
1009
+ message: string;
1010
+ retriedCount: number;
1011
+ failedJobIds: string[];
1012
+ skippedCount: number;
1013
+ skippedJobIds: string[];
1014
+ }, {
1015
+ message: string;
1016
+ retriedCount: number;
1017
+ failedJobIds: string[];
1018
+ skippedCount: number;
1019
+ skippedJobIds: string[];
1020
+ }>;
1021
+ 500: z.ZodObject<{
1022
+ message: z.ZodString;
1023
+ code: z.ZodOptional<z.ZodString>;
1024
+ }, "strip", z.ZodTypeAny, {
1025
+ message: string;
1026
+ code?: string | undefined;
1027
+ }, {
1028
+ message: string;
1029
+ code?: string | undefined;
1030
+ }>;
1031
+ };
1032
+ };
1033
+ getQueueStats: {
1034
+ summary: "Get queue statistics";
1035
+ method: "GET";
1036
+ path: "/farms/:farmId/monitoring/queue/stats";
1037
+ responses: {
1038
+ 200: z.ZodObject<{
1039
+ waiting: z.ZodNumber;
1040
+ active: z.ZodNumber;
1041
+ delayed: z.ZodNumber;
1042
+ failed: z.ZodNumber;
1043
+ completed: z.ZodNumber;
1044
+ }, "strip", z.ZodTypeAny, {
1045
+ completed: number;
1046
+ failed: number;
1047
+ active: number;
1048
+ waiting: number;
1049
+ delayed: number;
1050
+ }, {
1051
+ completed: number;
1052
+ failed: number;
1053
+ active: number;
1054
+ waiting: number;
1055
+ delayed: number;
1056
+ }>;
1057
+ 500: z.ZodObject<{
1058
+ message: z.ZodString;
1059
+ code: z.ZodOptional<z.ZodString>;
1060
+ }, "strip", z.ZodTypeAny, {
1061
+ message: string;
1062
+ code?: string | undefined;
1063
+ }, {
1064
+ message: string;
1065
+ code?: string | undefined;
1066
+ }>;
1067
+ };
1068
+ };
786
1069
  getSoilCurrent: {
787
1070
  summary: "Get current soil moisture and temperature";
788
1071
  method: "GET";
@@ -936,6 +1219,7 @@ export declare const fieldMonitoringRouter: {
936
1219
  responses: {
937
1220
  200: z.ZodArray<z.ZodObject<{
938
1221
  date: z.ZodString;
1222
+ time: z.ZodOptional<z.ZodString>;
939
1223
  ndvi: z.ZodNumber;
940
1224
  source: z.ZodEnum<["sentinel-2", "landsat-8", "modis"]>;
941
1225
  cloudCoverage: z.ZodNumber;
@@ -946,12 +1230,14 @@ export declare const fieldMonitoringRouter: {
946
1230
  ndvi: number;
947
1231
  cloudCoverage: number;
948
1232
  imageCoverage: number;
1233
+ time?: string | undefined;
949
1234
  }, {
950
1235
  date: string;
951
1236
  source: "sentinel-2" | "landsat-8" | "modis";
952
1237
  ndvi: number;
953
1238
  cloudCoverage: number;
954
1239
  imageCoverage: number;
1240
+ time?: string | undefined;
955
1241
  }>, "many">;
956
1242
  404: z.ZodObject<{
957
1243
  message: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"field-monitoring.routes.d.ts","sourceRoot":"","sources":["../../src/routes/field-monitoring.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoNhC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC"}
@@ -79,12 +79,26 @@ exports.fieldMonitoringRouter = c.router({
79
79
  },
80
80
  summary: 'Acknowledge an alert',
81
81
  },
82
+ // Resolve alert
83
+ resolveAlert: {
84
+ method: 'PATCH',
85
+ path: '/farms/:farmId/monitoring/alerts/:alertId/resolve',
86
+ body: zod_1.z.object({}),
87
+ responses: {
88
+ 200: field_monitoring_schemas_1.fieldAlertSchema,
89
+ 404: field_monitoring_schemas_1.fieldMonitoringErrorResponseSchema,
90
+ },
91
+ summary: 'Resolve an alert',
92
+ },
82
93
  // Trigger manual field analysis
83
94
  triggerAnalysis: {
84
95
  method: 'POST',
85
96
  path: '/farms/:farmId/fields/:fieldId/monitoring/analyze',
86
- body: zod_1.z.object({}),
97
+ body: zod_1.z.object({
98
+ force: zod_1.z.boolean().optional().default(false),
99
+ }),
87
100
  responses: {
101
+ 200: field_monitoring_schemas_1.triggerAnalysisResponseSchema,
88
102
  202: field_monitoring_schemas_1.triggerAnalysisResponseSchema,
89
103
  404: field_monitoring_schemas_1.fieldMonitoringErrorResponseSchema,
90
104
  500: field_monitoring_schemas_1.fieldMonitoringErrorResponseSchema,
@@ -92,6 +106,39 @@ exports.fieldMonitoringRouter = c.router({
92
106
  },
93
107
  summary: 'Manually trigger field analysis',
94
108
  },
109
+ // Retry all failed jobs
110
+ retryFailedJobs: {
111
+ method: 'POST',
112
+ path: '/farms/:farmId/monitoring/queue/retry-failed',
113
+ body: zod_1.z.object({}),
114
+ responses: {
115
+ 200: zod_1.z.object({
116
+ message: zod_1.z.string(),
117
+ retriedCount: zod_1.z.number(),
118
+ failedJobIds: zod_1.z.array(zod_1.z.string()),
119
+ skippedCount: zod_1.z.number(),
120
+ skippedJobIds: zod_1.z.array(zod_1.z.string()),
121
+ }),
122
+ 500: field_monitoring_schemas_1.fieldMonitoringErrorResponseSchema,
123
+ },
124
+ summary: 'Retry all failed field analysis jobs',
125
+ },
126
+ // Get queue statistics
127
+ getQueueStats: {
128
+ method: 'GET',
129
+ path: '/farms/:farmId/monitoring/queue/stats',
130
+ responses: {
131
+ 200: zod_1.z.object({
132
+ waiting: zod_1.z.number(),
133
+ active: zod_1.z.number(),
134
+ delayed: zod_1.z.number(),
135
+ failed: zod_1.z.number(),
136
+ completed: zod_1.z.number(),
137
+ }),
138
+ 500: field_monitoring_schemas_1.fieldMonitoringErrorResponseSchema,
139
+ },
140
+ summary: 'Get queue statistics',
141
+ },
95
142
  // Soil Monitoring Endpoints
96
143
  getSoilCurrent: {
97
144
  method: 'GET',