@deepintel-ltd/farmpro-contracts 1.36.7 → 1.36.9

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 @@
1
+ {"version":3,"file":"care-pillar.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/care-pillar.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,YAAY,iDAA+C,CAAC;AAEzE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;EAO1B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYvB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;IAG5B,mFAAmF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEnF,2FAA2F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK3F,CAAC;AAEH,8GAA8G;AAC9G,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAV/B,mFAAmF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAEnF,2FAA2F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoB3F,oDAAoD;;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,OAAO,iBAAiB,CAAC,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAWtE,mDAAmD;AACnD,eAAO,MAAM,yBAAyB;;IAEpC,yDAAyD;;IAEzD,wDAAwD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOxD,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,114 @@
1
+ import { z } from 'zod';
2
+ import { careActionSchema } from './crop-care.schemas';
3
+ const gradeSchema = z.enum(['A', 'B', 'C']);
4
+ export const pillarSchema = z.enum(['ipm', 'water', 'weeds', 'pruning']);
5
+ export const pillarSourceSchema = z.object({
6
+ id: z.string(),
7
+ org: z.string(),
8
+ title: z.string(),
9
+ url: z.string().optional(),
10
+ grade: gradeSchema,
11
+ });
12
+ export const responseStepSchema = z.object({
13
+ tier: z.enum(['prevent', 'cultural', 'biological', 'chemical']),
14
+ text: z.string(),
15
+ productClass: z.enum(['fungicide', 'insecticide', 'miticide', 'biopesticide', 'herbicide']).optional(),
16
+ activeIngredient: z.string().optional(),
17
+ resistanceGroup: z.object({ system: z.enum(['IRAC', 'FRAC', 'HRAC']), code: z.string() }).optional(),
18
+ grade: gradeSchema,
19
+ sourceIds: z.array(z.string()),
20
+ });
21
+ export const thresholdSchema = z.object({
22
+ metric: z.string(),
23
+ text: z.string(),
24
+ value: z.number().optional(),
25
+ unit: z.string().optional(),
26
+ grade: gradeSchema,
27
+ sourceIds: z.array(z.string()),
28
+ });
29
+ export const threatSchema = z.object({
30
+ id: z.string(),
31
+ name: z.string(),
32
+ kind: z.enum(['insect', 'mite', 'fungal', 'bacterial', 'viral', 'physiological', 'water', 'weed', 'canopy']),
33
+ localNames: z.array(z.string()).optional(),
34
+ symptoms: z.array(z.string()),
35
+ confusedWith: z.array(z.string()).optional(),
36
+ weatherTriggers: z.array(z.enum(['wet', 'humid', 'hot', 'dry', 'windy', 'warm'])).optional(),
37
+ vectorOf: z.array(z.string()).optional(),
38
+ scoutHow: z.string(),
39
+ thresholds: z.array(thresholdSchema),
40
+ responses: z.array(responseStepSchema),
41
+ });
42
+ export const scoutProtocolSchema = z.object({
43
+ perWeek: z.number(),
44
+ perWeekWet: z.number(),
45
+ samplePlants: z.number(),
46
+ pattern: z.enum(['W', 'Z']),
47
+ grade: gradeSchema,
48
+ sourceIds: z.array(z.string()),
49
+ });
50
+ export const pillarStageSchema = z.object({
51
+ stageId: z.string(),
52
+ summary: z.string(),
53
+ /** The stage's short jobs: what, how often, by when. The card leads with these. */
54
+ actions: z.array(careActionSchema).optional(),
55
+ /** FAO-56 crop coefficient for the stage; crop water use is ET0 x Kc. Water plans only. */
56
+ kc: z.number().optional(),
57
+ prevent: z.array(z.string()),
58
+ scout: scoutProtocolSchema.optional(),
59
+ watch: z.array(z.string()),
60
+ });
61
+ /** The plan's own header, without every stage: the client already has the crop-care card for the calendar. */
62
+ export const resolvedPillarSchema = z.object({
63
+ pillar: pillarSchema,
64
+ origin: z.enum(['file', 'generic']),
65
+ planId: z.string(),
66
+ oneLineRule: z.string(),
67
+ guidelineLabel: z.string(),
68
+ sources: z.array(pillarSourceSchema),
69
+ phase: z.enum(['nursery', 'field']),
70
+ day: z.number().nullable(),
71
+ stageId: z.string(),
72
+ stage: pillarStageSchema.nullable(),
73
+ stageFallback: z.boolean(),
74
+ /** Threats for this stage, most important first. */
75
+ watch: z.array(threatSchema),
76
+ needsDate: z.boolean(),
77
+ });
78
+ export const pillarAdjustmentSchema = z.object({
79
+ id: z.string(),
80
+ pillar: pillarSchema,
81
+ severity: z.enum(['info', 'watch', 'act']),
82
+ title: z.string(),
83
+ detail: z.string(),
84
+ source: z.string(),
85
+ });
86
+ export const pillarAdjustmentsResponseSchema = z.object({
87
+ pillar: pillarSchema,
88
+ crop: z.string().nullable().optional(),
89
+ stage: z.string().nullable().optional(),
90
+ adjustments: z.array(pillarAdjustmentSchema),
91
+ weatherAvailable: z.boolean(),
92
+ generatedAt: z.string().datetime(),
93
+ });
94
+ const holdTreatmentSchema = z.object({
95
+ productName: z.string(),
96
+ activeIngredient: z.string().optional(),
97
+ appliedOn: z.string(),
98
+ phiDays: z.number(),
99
+ safeHarvestDate: z.string(),
100
+ daysRemaining: z.number(),
101
+ });
102
+ /** What a harvest on a given day must wait for. */
103
+ export const harvestHoldResponseSchema = z.object({
104
+ date: z.string(),
105
+ /** A recorded waiting period has not ended by `date`. */
106
+ hold: z.boolean(),
107
+ /** A recent spray never recorded its waiting period. */
108
+ unknown: z.boolean(),
109
+ safeHarvestDate: z.string().nullable(),
110
+ daysRemaining: z.number().nullable(),
111
+ message: z.string().nullable(),
112
+ treatments: z.array(holdTreatmentSchema),
113
+ unknownTreatments: z.array(z.object({ productName: z.string(), appliedOn: z.string() })),
114
+ });