@deepintel-ltd/farmpro-contracts 1.36.2 → 1.36.3

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":"fertilizer-stock.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/fertilizer-stock.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB,uCAAqC,CAAC;AACxE,eAAO,MAAM,oBAAoB,8CAA4C,CAAC;AAI9E,mGAAmG;AACnG,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;IAehC,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOvF,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;IAiB/B,4DAA4D;;IAE5D,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE5C,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;QAPnC,4DAA4D;;QAE5D,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK4C,CAAC;AAE3F,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;IAezC,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAElF,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;EAKzC,CAAC;AASH,eAAO,MAAM,oBAAoB;;;;;;;;;;;IAM/B,6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ema = z.enum(['soluble', 'granular', 'liquid']);
4
+ const percent = z.number().min(0).max(100);
5
+ /** What reading a bag photo returns. Nothing in it reaches a plan until the farmer confirms it. */
6
+ export const fertilizerDraftSchema = z.object({
7
+ name: z.string(),
8
+ brand: z.string().nullable(),
9
+ nitrogen: percent,
10
+ phosphorus: percent,
11
+ potassium: percent,
12
+ calcium: percent,
13
+ magnesium: percent,
14
+ sulfate: z.boolean(),
15
+ micronutrients: z.record(z.string(), z.number()).nullable(),
16
+ form: fertilizerFormSchema,
17
+ applicationModes: z.array(applicationModeSchema),
18
+ labelNote: z.string().nullable(),
19
+ bagSizeKg: z.number().nullable(),
20
+ catalogueProductId: z.string().nullable(),
21
+ /** Whether the analysis was printed on the bag or filled in from the standard salt. */
22
+ analysisFrom: z.enum(['bag', 'catalogue']),
23
+ legibility: z.enum(['clear', 'partial', 'poor']),
24
+ roles: z.array(z.string()),
25
+ questions: z.array(z.object({ id: z.enum(['use-unclear', 'analysis-missing', 'stock']), text: z.string() })),
26
+ });
27
+ export const farmFertilizerSchema = z.object({
28
+ id: z.string(),
29
+ name: z.string(),
30
+ brand: z.string().nullable(),
31
+ catalogueProductId: z.string().nullable(),
32
+ nitrogen: percent,
33
+ phosphorus: percent,
34
+ potassium: percent,
35
+ calcium: percent,
36
+ magnesium: percent,
37
+ sulfate: z.boolean(),
38
+ micronutrients: z.record(z.string(), z.number()).nullable(),
39
+ form: fertilizerFormSchema,
40
+ applicationModes: z.array(applicationModeSchema),
41
+ roles: z.array(z.string()),
42
+ labelNote: z.string().nullable(),
43
+ bagSizeKg: z.number().nullable(),
44
+ /** Kilograms on hand, or null when stock is not tracked. */
45
+ stockKg: z.number().nullable(),
46
+ /** The plan may put it through the drip. */
47
+ dripSafe: z.boolean(),
48
+ });
49
+ export const farmFertilizerListSchema = z.object({ items: z.array(farmFertilizerSchema) });
50
+ export const createFarmFertilizerBodySchema = z.object({
51
+ name: z.string().trim().min(1).max(200),
52
+ brand: z.string().trim().max(100).nullable().optional(),
53
+ nitrogen: percent,
54
+ phosphorus: percent,
55
+ potassium: percent,
56
+ calcium: percent,
57
+ magnesium: percent,
58
+ sulfate: z.boolean().default(false),
59
+ micronutrients: z.record(z.string(), z.number().min(0).max(100)).nullable().optional(),
60
+ form: fertilizerFormSchema.default('soluble'),
61
+ applicationModes: z.array(applicationModeSchema).min(1),
62
+ labelNote: z.string().max(1000).nullable().optional(),
63
+ bagSizeKg: z.number().positive().max(1000).nullable().optional(),
64
+ catalogueProductId: z.string().max(60).nullable().optional(),
65
+ /** Kilograms on hand now (bags times bag size). Omit to leave stock untracked. */
66
+ stockKg: z.number().min(0).max(1_000_000).nullable().optional(),
67
+ });
68
+ export const updateFarmFertilizerBodySchema = z.object({
69
+ name: z.string().trim().min(1).max(200).optional(),
70
+ applicationModes: z.array(applicationModeSchema).min(1).optional(),
71
+ bagSizeKg: z.number().positive().max(1000).nullable().optional(),
72
+ stockKg: z.number().min(0).max(1_000_000).optional(),
73
+ });
74
+ const guideSchema = z.object({
75
+ why: z.string(),
76
+ when: z.string(),
77
+ how: z.array(z.string()),
78
+ warning: z.string().nullable(),
79
+ });
80
+ export const fertilizerCardSchema = guideSchema.extend({
81
+ id: z.string(),
82
+ name: z.string(),
83
+ brand: z.string().nullable(),
84
+ role: z.string().nullable(),
85
+ tank: z.enum(['A', 'B']).nullable(),
86
+ /** on-farm: confirmed and counted. unknown: the plan's own suggestion, the farm has not said what it has. */
87
+ status: z.enum(['on-farm', 'unknown']),
88
+ perPlantPerFeedG: z.number().nullable(),
89
+ fieldKgPerFeed: z.number().nullable(),
90
+ perPlantPerWeekG: z.number().nullable(),
91
+ weeklyFieldKg: z.number().nullable(),
92
+ /** Kilograms the field needs over the weeks ahead at this stage's rate. */
93
+ needKg: z.number().nullable(),
94
+ stockKg: z.number().nullable(),
95
+ weeksOfStock: z.number().nullable(),
96
+ buyKg: z.number().nullable(),
97
+ bags: z.number().nullable(),
98
+ bagSizeKg: z.number().nullable(),
99
+ /** Anything else the bag supplies, e.g. "Boron 0.3%". */
100
+ alsoSupplies: z.string().nullable(),
101
+ /** The label's own words on use and rate. */
102
+ labelNote: z.string().nullable(),
103
+ });
104
+ export const fertilizerGapSchema = z.object({
105
+ role: z.string(),
106
+ text: z.string(),
107
+ suggestion: z.string().nullable(),
108
+ });
109
+ export const fertilizerCardsResponseSchema = z.object({
110
+ fieldId: z.string(),
111
+ status: z.enum(['ok', 'no-plan']),
112
+ message: z.string().nullable(),
113
+ stage: z.object({ id: z.string(), label: z.string() }).nullable(),
114
+ fertilizerSet: z.object({ id: z.string(), name: z.string() }).nullable(),
115
+ /** True when the plan is built from the fertilizers this farm confirmed. */
116
+ usingFarmStock: z.boolean(),
117
+ plantCount: z.number().nullable(),
118
+ weeks: z.number(),
119
+ drip: z.array(fertilizerCardSchema),
120
+ foliar: z.array(fertilizerCardSchema),
121
+ soil: z.array(fertilizerCardSchema),
122
+ gaps: z.array(fertilizerGapSchema),
123
+ warnings: z.array(z.string()),
124
+ });
@@ -1692,7 +1692,7 @@ export declare const orchardPlanResponseSchema: z.ZodObject<{
1692
1692
  };
1693
1693
  }>>;
1694
1694
  }, "strip", z.ZodTypeAny, {
1695
- status: "ok" | "not-planted" | "no-plan";
1695
+ status: "ok" | "no-plan" | "not-planted";
1696
1696
  message: string | null;
1697
1697
  crop: string | null;
1698
1698
  fieldId: string;
@@ -1805,7 +1805,7 @@ export declare const orchardPlanResponseSchema: z.ZodObject<{
1805
1805
  };
1806
1806
  } | null;
1807
1807
  }, {
1808
- status: "ok" | "not-planted" | "no-plan";
1808
+ status: "ok" | "no-plan" | "not-planted";
1809
1809
  message: string | null;
1810
1810
  crop: string | null;
1811
1811
  fieldId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepintel-ltd/farmpro-contracts",
3
- "version": "1.36.2",
3
+ "version": "1.36.3",
4
4
  "description": "Type-safe API contracts for FarmPro API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",