@deepintel-ltd/farmpro-contracts 1.16.6 → 1.16.7
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/routes/field-observations.routes.d.ts +42 -16
- package/dist/routes/field-observations.routes.d.ts.map +1 -1
- package/dist/schemas/field-observations.schemas.d.ts +34 -8
- package/dist/schemas/field-observations.schemas.d.ts.map +1 -1
- package/dist/schemas/field-observations.schemas.js +39 -40
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export declare const fieldObservationsRouter: {
|
|
|
4
4
|
summary: "Upload farm observation photo for AI analysis";
|
|
5
5
|
method: "POST";
|
|
6
6
|
contentType: "multipart/form-data";
|
|
7
|
-
body: z.ZodObject<{
|
|
7
|
+
body: z.ZodObject<Omit<{
|
|
8
8
|
fieldId: z.ZodOptional<z.ZodString>;
|
|
9
9
|
observationType: z.ZodEnum<["disease", "pest", "nutrient", "weed", "general", "health_check"]>;
|
|
10
10
|
userNotes: z.ZodOptional<z.ZodString>;
|
|
@@ -23,8 +23,25 @@ export declare const fieldObservationsRouter: {
|
|
|
23
23
|
accuracy?: number | undefined;
|
|
24
24
|
}>>;
|
|
25
25
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
26
|
-
} & {
|
|
27
|
-
photo: z.ZodAny
|
|
26
|
+
}, "location"> & {
|
|
27
|
+
photo: z.ZodOptional<z.ZodAny>;
|
|
28
|
+
location: z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
29
|
+
lat: z.ZodNumber;
|
|
30
|
+
lng: z.ZodNumber;
|
|
31
|
+
accuracy: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
lat: number;
|
|
34
|
+
lng: number;
|
|
35
|
+
accuracy?: number | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
lat: number;
|
|
38
|
+
lng: number;
|
|
39
|
+
accuracy?: number | undefined;
|
|
40
|
+
}>>, {
|
|
41
|
+
lat: number;
|
|
42
|
+
lng: number;
|
|
43
|
+
accuracy?: number | undefined;
|
|
44
|
+
} | undefined, unknown>;
|
|
28
45
|
}, "strip", z.ZodTypeAny, {
|
|
29
46
|
observationType: "general" | "disease" | "pest" | "nutrient" | "weed" | "health_check";
|
|
30
47
|
location?: {
|
|
@@ -39,11 +56,7 @@ export declare const fieldObservationsRouter: {
|
|
|
39
56
|
photo?: any;
|
|
40
57
|
}, {
|
|
41
58
|
observationType: "general" | "disease" | "pest" | "nutrient" | "weed" | "health_check";
|
|
42
|
-
location?:
|
|
43
|
-
lat: number;
|
|
44
|
-
lng: number;
|
|
45
|
-
accuracy?: number | undefined;
|
|
46
|
-
} | undefined;
|
|
59
|
+
location?: unknown;
|
|
47
60
|
fieldId?: string | undefined;
|
|
48
61
|
capturedAt?: string | undefined;
|
|
49
62
|
userNotes?: string | undefined;
|
|
@@ -164,7 +177,7 @@ export declare const fieldObservationsRouter: {
|
|
|
164
177
|
summary: "Upload field observation photo for AI analysis";
|
|
165
178
|
method: "POST";
|
|
166
179
|
contentType: "multipart/form-data";
|
|
167
|
-
body: z.ZodObject<{
|
|
180
|
+
body: z.ZodObject<Omit<{
|
|
168
181
|
fieldId: z.ZodOptional<z.ZodString>;
|
|
169
182
|
observationType: z.ZodEnum<["disease", "pest", "nutrient", "weed", "general", "health_check"]>;
|
|
170
183
|
userNotes: z.ZodOptional<z.ZodString>;
|
|
@@ -183,8 +196,25 @@ export declare const fieldObservationsRouter: {
|
|
|
183
196
|
accuracy?: number | undefined;
|
|
184
197
|
}>>;
|
|
185
198
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
186
|
-
} & {
|
|
187
|
-
photo: z.ZodAny
|
|
199
|
+
}, "location"> & {
|
|
200
|
+
photo: z.ZodOptional<z.ZodAny>;
|
|
201
|
+
location: z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
202
|
+
lat: z.ZodNumber;
|
|
203
|
+
lng: z.ZodNumber;
|
|
204
|
+
accuracy: z.ZodOptional<z.ZodNumber>;
|
|
205
|
+
}, "strip", z.ZodTypeAny, {
|
|
206
|
+
lat: number;
|
|
207
|
+
lng: number;
|
|
208
|
+
accuracy?: number | undefined;
|
|
209
|
+
}, {
|
|
210
|
+
lat: number;
|
|
211
|
+
lng: number;
|
|
212
|
+
accuracy?: number | undefined;
|
|
213
|
+
}>>, {
|
|
214
|
+
lat: number;
|
|
215
|
+
lng: number;
|
|
216
|
+
accuracy?: number | undefined;
|
|
217
|
+
} | undefined, unknown>;
|
|
188
218
|
}, "strip", z.ZodTypeAny, {
|
|
189
219
|
observationType: "general" | "disease" | "pest" | "nutrient" | "weed" | "health_check";
|
|
190
220
|
location?: {
|
|
@@ -199,11 +229,7 @@ export declare const fieldObservationsRouter: {
|
|
|
199
229
|
photo?: any;
|
|
200
230
|
}, {
|
|
201
231
|
observationType: "general" | "disease" | "pest" | "nutrient" | "weed" | "health_check";
|
|
202
|
-
location?:
|
|
203
|
-
lat: number;
|
|
204
|
-
lng: number;
|
|
205
|
-
accuracy?: number | undefined;
|
|
206
|
-
} | undefined;
|
|
232
|
+
location?: unknown;
|
|
207
233
|
fieldId?: string | undefined;
|
|
208
234
|
capturedAt?: string | undefined;
|
|
209
235
|
userNotes?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-observations.routes.d.ts","sourceRoot":"","sources":["../../src/routes/field-observations.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"field-observations.routes.d.ts","sourceRoot":"","sources":["../../src/routes/field-observations.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsHlC,CAAC"}
|
|
@@ -393,6 +393,19 @@ export declare const observationAttributesSchema: z.ZodObject<{
|
|
|
393
393
|
modelVersion: string | null;
|
|
394
394
|
phase: string | null;
|
|
395
395
|
}>;
|
|
396
|
+
export declare const observationLocationInputSchema: z.ZodObject<{
|
|
397
|
+
lat: z.ZodNumber;
|
|
398
|
+
lng: z.ZodNumber;
|
|
399
|
+
accuracy: z.ZodOptional<z.ZodNumber>;
|
|
400
|
+
}, "strip", z.ZodTypeAny, {
|
|
401
|
+
lat: number;
|
|
402
|
+
lng: number;
|
|
403
|
+
accuracy?: number | undefined;
|
|
404
|
+
}, {
|
|
405
|
+
lat: number;
|
|
406
|
+
lng: number;
|
|
407
|
+
accuracy?: number | undefined;
|
|
408
|
+
}>;
|
|
396
409
|
export declare const createObservationAttributesSchema: z.ZodObject<{
|
|
397
410
|
fieldId: z.ZodOptional<z.ZodString>;
|
|
398
411
|
observationType: z.ZodEnum<["disease", "pest", "nutrient", "weed", "general", "health_check"]>;
|
|
@@ -1111,7 +1124,7 @@ export declare const createObservationInputSchema: z.ZodObject<{
|
|
|
1111
1124
|
links?: Record<string, string> | undefined;
|
|
1112
1125
|
meta?: Record<string, unknown> | undefined;
|
|
1113
1126
|
}>;
|
|
1114
|
-
export declare const uploadObservationBodySchema: z.ZodObject<{
|
|
1127
|
+
export declare const uploadObservationBodySchema: z.ZodObject<Omit<{
|
|
1115
1128
|
fieldId: z.ZodOptional<z.ZodString>;
|
|
1116
1129
|
observationType: z.ZodEnum<["disease", "pest", "nutrient", "weed", "general", "health_check"]>;
|
|
1117
1130
|
userNotes: z.ZodOptional<z.ZodString>;
|
|
@@ -1130,8 +1143,25 @@ export declare const uploadObservationBodySchema: z.ZodObject<{
|
|
|
1130
1143
|
accuracy?: number | undefined;
|
|
1131
1144
|
}>>;
|
|
1132
1145
|
capturedAt: z.ZodOptional<z.ZodString>;
|
|
1133
|
-
} & {
|
|
1134
|
-
photo: z.ZodAny
|
|
1146
|
+
}, "location"> & {
|
|
1147
|
+
photo: z.ZodOptional<z.ZodAny>;
|
|
1148
|
+
location: z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
1149
|
+
lat: z.ZodNumber;
|
|
1150
|
+
lng: z.ZodNumber;
|
|
1151
|
+
accuracy: z.ZodOptional<z.ZodNumber>;
|
|
1152
|
+
}, "strip", z.ZodTypeAny, {
|
|
1153
|
+
lat: number;
|
|
1154
|
+
lng: number;
|
|
1155
|
+
accuracy?: number | undefined;
|
|
1156
|
+
}, {
|
|
1157
|
+
lat: number;
|
|
1158
|
+
lng: number;
|
|
1159
|
+
accuracy?: number | undefined;
|
|
1160
|
+
}>>, {
|
|
1161
|
+
lat: number;
|
|
1162
|
+
lng: number;
|
|
1163
|
+
accuracy?: number | undefined;
|
|
1164
|
+
} | undefined, unknown>;
|
|
1135
1165
|
}, "strip", z.ZodTypeAny, {
|
|
1136
1166
|
observationType: "general" | "disease" | "pest" | "nutrient" | "weed" | "health_check";
|
|
1137
1167
|
location?: {
|
|
@@ -1146,11 +1176,7 @@ export declare const uploadObservationBodySchema: z.ZodObject<{
|
|
|
1146
1176
|
photo?: any;
|
|
1147
1177
|
}, {
|
|
1148
1178
|
observationType: "general" | "disease" | "pest" | "nutrient" | "weed" | "health_check";
|
|
1149
|
-
location?:
|
|
1150
|
-
lat: number;
|
|
1151
|
-
lng: number;
|
|
1152
|
-
accuracy?: number | undefined;
|
|
1153
|
-
} | undefined;
|
|
1179
|
+
location?: unknown;
|
|
1154
1180
|
fieldId?: string | undefined;
|
|
1155
1181
|
capturedAt?: string | undefined;
|
|
1156
1182
|
userNotes?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-observations.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/field-observations.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB;;GAEG;AAGH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -5,7 +5,8 @@ import { recommendationSchema } from './recommendations.schemas';
|
|
|
5
5
|
* Field Observation schemas - JSON:API compliant
|
|
6
6
|
*/
|
|
7
7
|
// Observation attributes schema
|
|
8
|
-
export const observationAttributesSchema = z
|
|
8
|
+
export const observationAttributesSchema = z
|
|
9
|
+
.object({
|
|
9
10
|
fieldId: z.string().uuid().nullable(),
|
|
10
11
|
farmId: z.string().uuid(),
|
|
11
12
|
uploadedBy: z.string().uuid(),
|
|
@@ -19,14 +20,7 @@ export const observationAttributesSchema = z.object({
|
|
|
19
20
|
})
|
|
20
21
|
.nullable(),
|
|
21
22
|
capturedAt: z.date(),
|
|
22
|
-
observationType: z.enum([
|
|
23
|
-
'disease',
|
|
24
|
-
'pest',
|
|
25
|
-
'nutrient',
|
|
26
|
-
'weed',
|
|
27
|
-
'general',
|
|
28
|
-
'health_check',
|
|
29
|
-
]),
|
|
23
|
+
observationType: z.enum(['disease', 'pest', 'nutrient', 'weed', 'general', 'health_check']),
|
|
30
24
|
userNotes: z.string().nullable(),
|
|
31
25
|
cropStageAtTime: z
|
|
32
26
|
.enum([
|
|
@@ -46,9 +40,7 @@ export const observationAttributesSchema = z.object({
|
|
|
46
40
|
diagnosisType: z.string().nullable(),
|
|
47
41
|
diagnosisConfidence: z.number().min(0).max(1).nullable(),
|
|
48
42
|
severity: z.enum(['low', 'medium', 'high', 'critical']).nullable(),
|
|
49
|
-
affectedArea: z
|
|
50
|
-
.enum(['localized', 'widespread', 'entire_field'])
|
|
51
|
-
.nullable(),
|
|
43
|
+
affectedArea: z.enum(['localized', 'widespread', 'entire_field']).nullable(),
|
|
52
44
|
healthScore: z.number().min(0).max(100).nullable(),
|
|
53
45
|
analysisDetails: z
|
|
54
46
|
.object({
|
|
@@ -94,37 +86,23 @@ export const observationAttributesSchema = z.object({
|
|
|
94
86
|
processingTime: z.number().nullable(),
|
|
95
87
|
modelVersion: z.string().nullable(),
|
|
96
88
|
phase: z.string().nullable(),
|
|
97
|
-
})
|
|
89
|
+
})
|
|
90
|
+
.merge(timestampsSchema);
|
|
91
|
+
export const observationLocationInputSchema = z.object({
|
|
92
|
+
lat: z.number().min(-90).max(90),
|
|
93
|
+
lng: z.number().min(-180).max(180),
|
|
94
|
+
// Geolocation accuracy is non-negative; Android reports 0 when unknown.
|
|
95
|
+
accuracy: z.number().nonnegative().optional(),
|
|
96
|
+
});
|
|
98
97
|
// Observation attributes for creation (input)
|
|
99
98
|
export const createObservationAttributesSchema = z.object({
|
|
100
99
|
fieldId: z.string().uuid().optional(),
|
|
101
|
-
observationType: z.enum([
|
|
102
|
-
'disease',
|
|
103
|
-
'pest',
|
|
104
|
-
'nutrient',
|
|
105
|
-
'weed',
|
|
106
|
-
'general',
|
|
107
|
-
'health_check',
|
|
108
|
-
]),
|
|
100
|
+
observationType: z.enum(['disease', 'pest', 'nutrient', 'weed', 'general', 'health_check']),
|
|
109
101
|
userNotes: z.string().max(1000).optional(),
|
|
110
102
|
cropStageAtTime: z
|
|
111
|
-
.enum([
|
|
112
|
-
'planted',
|
|
113
|
-
'germination',
|
|
114
|
-
'vegetative',
|
|
115
|
-
'flowering',
|
|
116
|
-
'fruiting',
|
|
117
|
-
'mature',
|
|
118
|
-
'harvested',
|
|
119
|
-
])
|
|
120
|
-
.optional(),
|
|
121
|
-
location: z
|
|
122
|
-
.object({
|
|
123
|
-
lat: z.number().min(-90).max(90),
|
|
124
|
-
lng: z.number().min(-180).max(180),
|
|
125
|
-
accuracy: z.number().positive().optional(),
|
|
126
|
-
})
|
|
103
|
+
.enum(['planted', 'germination', 'vegetative', 'flowering', 'fruiting', 'mature', 'harvested'])
|
|
127
104
|
.optional(),
|
|
105
|
+
location: observationLocationInputSchema.optional(),
|
|
128
106
|
capturedAt: z.string().datetime().optional(),
|
|
129
107
|
});
|
|
130
108
|
// Observation attributes for update (input)
|
|
@@ -136,9 +114,30 @@ export const updateObservationActionAttributesSchema = z.object({
|
|
|
136
114
|
// JSON:API resource schemas
|
|
137
115
|
export const observationResourceSchema = createJsonApiResourceSchema('observations', observationAttributesSchema);
|
|
138
116
|
export const createObservationInputSchema = createJsonApiResourceSchema('observations', createObservationAttributesSchema);
|
|
139
|
-
export const uploadObservationBodySchema = createObservationAttributesSchema
|
|
140
|
-
|
|
141
|
-
|
|
117
|
+
export const uploadObservationBodySchema = createObservationAttributesSchema
|
|
118
|
+
.omit({ location: true })
|
|
119
|
+
.extend({
|
|
120
|
+
// Multer puts the file on req.file, not body.photo
|
|
121
|
+
photo: z.any().optional(),
|
|
122
|
+
// FormData JSON.stringifies objects; accept the string and parse it.
|
|
123
|
+
location: z.preprocess((value) => {
|
|
124
|
+
if (typeof value !== 'string')
|
|
125
|
+
return value;
|
|
126
|
+
const trimmed = value.trim();
|
|
127
|
+
if (!trimmed)
|
|
128
|
+
return undefined;
|
|
129
|
+
try {
|
|
130
|
+
const parsed = JSON.parse(trimmed);
|
|
131
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return parsed;
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
}, observationLocationInputSchema.optional()),
|
|
140
|
+
});
|
|
142
141
|
export const updateObservationActionInputSchema = createJsonApiResourceSchema('observations', updateObservationActionAttributesSchema);
|
|
143
142
|
// Response schemas
|
|
144
143
|
export const observationResponseSchema = jsonApiSingleResponseSchema(observationResourceSchema);
|