@deepintel-ltd/farmpro-contracts 1.7.10 → 1.7.11

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.
@@ -233,6 +233,68 @@ export declare const cropProfilesRouter: {
233
233
  }>;
234
234
  };
235
235
  };
236
+ getNdviThresholds: {
237
+ pathParams: z.ZodObject<{
238
+ cropType: z.ZodString;
239
+ }, "strip", z.ZodTypeAny, {
240
+ cropType: string;
241
+ }, {
242
+ cropType: string;
243
+ }>;
244
+ query: z.ZodObject<{
245
+ daysSincePlanting: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
246
+ }, "strip", z.ZodTypeAny, {
247
+ daysSincePlanting?: number | undefined;
248
+ }, {
249
+ daysSincePlanting?: string | undefined;
250
+ }>;
251
+ summary: "Get NDVI thresholds for crop and optional growth stage";
252
+ method: "GET";
253
+ path: "/crop-profiles/:cropType/ndvi-thresholds";
254
+ responses: {
255
+ 200: z.ZodObject<{
256
+ cropType: z.ZodString;
257
+ stageName: z.ZodNullable<z.ZodString>;
258
+ daysSincePlanting: z.ZodNullable<z.ZodNumber>;
259
+ criticalBelow: z.ZodNumber;
260
+ warningBelow: z.ZodNumber;
261
+ healthyMin: z.ZodNumber;
262
+ healthyMax: z.ZodNumber;
263
+ excessiveAbove: z.ZodNumber;
264
+ source: z.ZodEnum<["crop-profile", "default"]>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ source: "default" | "crop-profile";
267
+ daysSincePlanting: number | null;
268
+ criticalBelow: number;
269
+ cropType: string;
270
+ stageName: string | null;
271
+ warningBelow: number;
272
+ healthyMin: number;
273
+ healthyMax: number;
274
+ excessiveAbove: number;
275
+ }, {
276
+ source: "default" | "crop-profile";
277
+ daysSincePlanting: number | null;
278
+ criticalBelow: number;
279
+ cropType: string;
280
+ stageName: string | null;
281
+ warningBelow: number;
282
+ healthyMin: number;
283
+ healthyMax: number;
284
+ excessiveAbove: number;
285
+ }>;
286
+ 404: z.ZodObject<{
287
+ message: z.ZodString;
288
+ code: z.ZodString;
289
+ }, "strip", z.ZodTypeAny, {
290
+ code: string;
291
+ message: string;
292
+ }, {
293
+ code: string;
294
+ message: string;
295
+ }>;
296
+ };
297
+ };
236
298
  getFieldCropProfile: {
237
299
  pathParams: z.ZodObject<{
238
300
  farmId: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"crop-profile.routes.d.ts","sourceRoot":"","sources":["../../src/routes/crop-profile.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoD7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC"}
1
+ {"version":3,"file":"crop-profile.routes.d.ts","sourceRoot":"","sources":["../../src/routes/crop-profile.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4E7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { initContract } from '@ts-rest/core';
2
2
  import { z } from 'zod';
3
- import { cropProfileListResponseSchema, cropProfileResponseSchema, fieldCropProfileResponseSchema, cropProfileErrorSchema, } from '../schemas/crop-profile.schemas';
3
+ import { cropProfileListResponseSchema, cropProfileResponseSchema, fieldCropProfileResponseSchema, cropProfileErrorSchema, ndviThresholdsResponseSchema, } from '../schemas/crop-profile.schemas';
4
4
  const c = initContract();
5
5
  export const cropProfilesRouter = c.router({
6
6
  /**
@@ -35,6 +35,29 @@ export const cropProfilesRouter = c.router({
35
35
  },
36
36
  summary: 'Get crop profile by crop type',
37
37
  },
38
+ /**
39
+ * Get NDVI thresholds for a crop (and optional growth stage by days since planting).
40
+ * Lightweight endpoint for crop-aware legend / UI without requiring a field.
41
+ */
42
+ getNdviThresholds: {
43
+ method: 'GET',
44
+ path: '/crop-profiles/:cropType/ndvi-thresholds',
45
+ pathParams: z.object({
46
+ cropType: z.string(),
47
+ }),
48
+ query: z.object({
49
+ daysSincePlanting: z
50
+ .string()
51
+ .transform(Number)
52
+ .pipe(z.number().int().min(0))
53
+ .optional(),
54
+ }),
55
+ responses: {
56
+ 200: ndviThresholdsResponseSchema,
57
+ 404: cropProfileErrorSchema,
58
+ },
59
+ summary: 'Get NDVI thresholds for crop and optional growth stage',
60
+ },
38
61
  /**
39
62
  * Get crop profile for a specific field's current crop
40
63
  * Returns the profile with current stage assessment based on planting date
@@ -783,6 +783,37 @@ export declare const fieldCropProfileResponseSchema: z.ZodObject<{
783
783
  } | null;
784
784
  hasPlantingData: boolean;
785
785
  }>;
786
+ export declare const ndviThresholdsResponseSchema: z.ZodObject<{
787
+ cropType: z.ZodString;
788
+ stageName: z.ZodNullable<z.ZodString>;
789
+ daysSincePlanting: z.ZodNullable<z.ZodNumber>;
790
+ criticalBelow: z.ZodNumber;
791
+ warningBelow: z.ZodNumber;
792
+ healthyMin: z.ZodNumber;
793
+ healthyMax: z.ZodNumber;
794
+ excessiveAbove: z.ZodNumber;
795
+ source: z.ZodEnum<["crop-profile", "default"]>;
796
+ }, "strip", z.ZodTypeAny, {
797
+ source: "default" | "crop-profile";
798
+ daysSincePlanting: number | null;
799
+ criticalBelow: number;
800
+ cropType: string;
801
+ stageName: string | null;
802
+ warningBelow: number;
803
+ healthyMin: number;
804
+ healthyMax: number;
805
+ excessiveAbove: number;
806
+ }, {
807
+ source: "default" | "crop-profile";
808
+ daysSincePlanting: number | null;
809
+ criticalBelow: number;
810
+ cropType: string;
811
+ stageName: string | null;
812
+ warningBelow: number;
813
+ healthyMin: number;
814
+ healthyMax: number;
815
+ excessiveAbove: number;
816
+ }>;
786
817
  export declare const cropProfileErrorSchema: z.ZodObject<{
787
818
  message: z.ZodString;
788
819
  code: z.ZodString;
@@ -799,6 +830,7 @@ export type CropProfile = z.infer<typeof cropProfileSchema>;
799
830
  export type CropProfileListResponse = z.infer<typeof cropProfileListResponseSchema>;
800
831
  export type CurrentStageAssessment = z.infer<typeof currentStageAssessmentSchema>;
801
832
  export type FieldCropProfileResponse = z.infer<typeof fieldCropProfileResponseSchema>;
833
+ export type NdviThresholdsResponse = z.infer<typeof ndviThresholdsResponseSchema>;
802
834
  export type NdviAlertCondition = z.infer<typeof ndviAlertConditionSchema>;
803
835
  export type StageTransitionTolerance = z.infer<typeof stageTransitionToleranceSchema>;
804
836
  export type EnhancedAlertConfig = z.infer<typeof enhancedAlertConfigSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"crop-profile.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/crop-profile.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;EAQ1C,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAK5B,CAAC;AAMH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EAcnC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;EAKzC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAgBpC,CAAC;AAMH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU5B,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;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F,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -129,6 +129,20 @@ export const fieldCropProfileResponseSchema = z.object({
129
129
  plantingDate: z.string().datetime().nullable(),
130
130
  });
131
131
  // ============================================================================
132
+ // NDVI Thresholds (standalone for legend / crop-aware UI)
133
+ // ============================================================================
134
+ export const ndviThresholdsResponseSchema = z.object({
135
+ cropType: z.string(),
136
+ stageName: z.string().nullable(),
137
+ daysSincePlanting: z.number().nullable(),
138
+ criticalBelow: z.number(),
139
+ warningBelow: z.number(),
140
+ healthyMin: z.number(),
141
+ healthyMax: z.number(),
142
+ excessiveAbove: z.number(),
143
+ source: z.enum(['crop-profile', 'default']),
144
+ });
145
+ // ============================================================================
132
146
  // Error Schema
133
147
  // ============================================================================
134
148
  export const cropProfileErrorSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepintel-ltd/farmpro-contracts",
3
- "version": "1.7.10",
3
+ "version": "1.7.11",
4
4
  "description": "Type-safe API contracts for FarmPro API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",