@deepintel-ltd/farmpro-contracts 1.5.5 → 1.5.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.
@@ -0,0 +1,401 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Seasonal Plans schemas - JSON:API compliant
4
+ *
5
+ * Seasonal plan progress tracks planned vs actual metrics for a season
6
+ * Data is calculated from tasks and field data
7
+ */
8
+ export declare const seasonalPlanItemSchema: z.ZodObject<{
9
+ id: z.ZodString;
10
+ title: z.ZodString;
11
+ planned: z.ZodNumber;
12
+ actual: z.ZodNumber;
13
+ unit: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ id: string;
16
+ title: string;
17
+ unit: string;
18
+ planned: number;
19
+ actual: number;
20
+ }, {
21
+ id: string;
22
+ title: string;
23
+ unit: string;
24
+ planned: number;
25
+ actual: number;
26
+ }>;
27
+ export declare const seasonalPlanAttributesSchema: z.ZodObject<{
28
+ farmId: z.ZodString;
29
+ season: z.ZodString;
30
+ startDate: z.ZodOptional<z.ZodString>;
31
+ endDate: z.ZodOptional<z.ZodString>;
32
+ items: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodString;
34
+ title: z.ZodString;
35
+ planned: z.ZodNumber;
36
+ actual: z.ZodNumber;
37
+ unit: z.ZodString;
38
+ }, "strip", z.ZodTypeAny, {
39
+ id: string;
40
+ title: string;
41
+ unit: string;
42
+ planned: number;
43
+ actual: number;
44
+ }, {
45
+ id: string;
46
+ title: string;
47
+ unit: string;
48
+ planned: number;
49
+ actual: number;
50
+ }>, "many">;
51
+ } & {
52
+ createdAt: z.ZodString;
53
+ updatedAt: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ season: string;
58
+ farmId: string;
59
+ items: {
60
+ id: string;
61
+ title: string;
62
+ unit: string;
63
+ planned: number;
64
+ actual: number;
65
+ }[];
66
+ startDate?: string | undefined;
67
+ endDate?: string | undefined;
68
+ }, {
69
+ createdAt: string;
70
+ updatedAt: string;
71
+ season: string;
72
+ farmId: string;
73
+ items: {
74
+ id: string;
75
+ title: string;
76
+ unit: string;
77
+ planned: number;
78
+ actual: number;
79
+ }[];
80
+ startDate?: string | undefined;
81
+ endDate?: string | undefined;
82
+ }>;
83
+ export declare const seasonalPlanResourceSchema: z.ZodObject<{
84
+ type: z.ZodLiteral<string>;
85
+ id: z.ZodString;
86
+ attributes: z.ZodObject<{
87
+ farmId: z.ZodString;
88
+ season: z.ZodString;
89
+ startDate: z.ZodOptional<z.ZodString>;
90
+ endDate: z.ZodOptional<z.ZodString>;
91
+ items: z.ZodArray<z.ZodObject<{
92
+ id: z.ZodString;
93
+ title: z.ZodString;
94
+ planned: z.ZodNumber;
95
+ actual: z.ZodNumber;
96
+ unit: z.ZodString;
97
+ }, "strip", z.ZodTypeAny, {
98
+ id: string;
99
+ title: string;
100
+ unit: string;
101
+ planned: number;
102
+ actual: number;
103
+ }, {
104
+ id: string;
105
+ title: string;
106
+ unit: string;
107
+ planned: number;
108
+ actual: number;
109
+ }>, "many">;
110
+ } & {
111
+ createdAt: z.ZodString;
112
+ updatedAt: z.ZodString;
113
+ }, "strip", z.ZodTypeAny, {
114
+ createdAt: string;
115
+ updatedAt: string;
116
+ season: string;
117
+ farmId: string;
118
+ items: {
119
+ id: string;
120
+ title: string;
121
+ unit: string;
122
+ planned: number;
123
+ actual: number;
124
+ }[];
125
+ startDate?: string | undefined;
126
+ endDate?: string | undefined;
127
+ }, {
128
+ createdAt: string;
129
+ updatedAt: string;
130
+ season: string;
131
+ farmId: string;
132
+ items: {
133
+ id: string;
134
+ title: string;
135
+ unit: string;
136
+ planned: number;
137
+ actual: number;
138
+ }[];
139
+ startDate?: string | undefined;
140
+ endDate?: string | undefined;
141
+ }>;
142
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
143
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
144
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
145
+ }, "strip", z.ZodTypeAny, {
146
+ type: string;
147
+ id: string;
148
+ attributes: {
149
+ createdAt: string;
150
+ updatedAt: string;
151
+ season: string;
152
+ farmId: string;
153
+ items: {
154
+ id: string;
155
+ title: string;
156
+ unit: string;
157
+ planned: number;
158
+ actual: number;
159
+ }[];
160
+ startDate?: string | undefined;
161
+ endDate?: string | undefined;
162
+ };
163
+ relationships?: Record<string, unknown> | undefined;
164
+ links?: Record<string, string> | undefined;
165
+ meta?: Record<string, unknown> | undefined;
166
+ }, {
167
+ type: string;
168
+ id: string;
169
+ attributes: {
170
+ createdAt: string;
171
+ updatedAt: string;
172
+ season: string;
173
+ farmId: string;
174
+ items: {
175
+ id: string;
176
+ title: string;
177
+ unit: string;
178
+ planned: number;
179
+ actual: number;
180
+ }[];
181
+ startDate?: string | undefined;
182
+ endDate?: string | undefined;
183
+ };
184
+ relationships?: Record<string, unknown> | undefined;
185
+ links?: Record<string, string> | undefined;
186
+ meta?: Record<string, unknown> | undefined;
187
+ }>;
188
+ export declare const seasonalPlanResponseSchema: z.ZodObject<{
189
+ data: z.ZodObject<{
190
+ type: z.ZodLiteral<string>;
191
+ id: z.ZodString;
192
+ attributes: z.ZodObject<{
193
+ farmId: z.ZodString;
194
+ season: z.ZodString;
195
+ startDate: z.ZodOptional<z.ZodString>;
196
+ endDate: z.ZodOptional<z.ZodString>;
197
+ items: z.ZodArray<z.ZodObject<{
198
+ id: z.ZodString;
199
+ title: z.ZodString;
200
+ planned: z.ZodNumber;
201
+ actual: z.ZodNumber;
202
+ unit: z.ZodString;
203
+ }, "strip", z.ZodTypeAny, {
204
+ id: string;
205
+ title: string;
206
+ unit: string;
207
+ planned: number;
208
+ actual: number;
209
+ }, {
210
+ id: string;
211
+ title: string;
212
+ unit: string;
213
+ planned: number;
214
+ actual: number;
215
+ }>, "many">;
216
+ } & {
217
+ createdAt: z.ZodString;
218
+ updatedAt: z.ZodString;
219
+ }, "strip", z.ZodTypeAny, {
220
+ createdAt: string;
221
+ updatedAt: string;
222
+ season: string;
223
+ farmId: string;
224
+ items: {
225
+ id: string;
226
+ title: string;
227
+ unit: string;
228
+ planned: number;
229
+ actual: number;
230
+ }[];
231
+ startDate?: string | undefined;
232
+ endDate?: string | undefined;
233
+ }, {
234
+ createdAt: string;
235
+ updatedAt: string;
236
+ season: string;
237
+ farmId: string;
238
+ items: {
239
+ id: string;
240
+ title: string;
241
+ unit: string;
242
+ planned: number;
243
+ actual: number;
244
+ }[];
245
+ startDate?: string | undefined;
246
+ endDate?: string | undefined;
247
+ }>;
248
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
249
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
250
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
251
+ }, "strip", z.ZodTypeAny, {
252
+ type: string;
253
+ id: string;
254
+ attributes: {
255
+ createdAt: string;
256
+ updatedAt: string;
257
+ season: string;
258
+ farmId: string;
259
+ items: {
260
+ id: string;
261
+ title: string;
262
+ unit: string;
263
+ planned: number;
264
+ actual: number;
265
+ }[];
266
+ startDate?: string | undefined;
267
+ endDate?: string | undefined;
268
+ };
269
+ relationships?: Record<string, unknown> | undefined;
270
+ links?: Record<string, string> | undefined;
271
+ meta?: Record<string, unknown> | undefined;
272
+ }, {
273
+ type: string;
274
+ id: string;
275
+ attributes: {
276
+ createdAt: string;
277
+ updatedAt: string;
278
+ season: string;
279
+ farmId: string;
280
+ items: {
281
+ id: string;
282
+ title: string;
283
+ unit: string;
284
+ planned: number;
285
+ actual: number;
286
+ }[];
287
+ startDate?: string | undefined;
288
+ endDate?: string | undefined;
289
+ };
290
+ relationships?: Record<string, unknown> | undefined;
291
+ links?: Record<string, string> | undefined;
292
+ meta?: Record<string, unknown> | undefined;
293
+ }>;
294
+ included: z.ZodOptional<z.ZodArray<z.ZodObject<{
295
+ type: z.ZodString;
296
+ id: z.ZodString;
297
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
298
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
299
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
300
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
301
+ }, "strip", z.ZodTypeAny, {
302
+ type: string;
303
+ id: string;
304
+ attributes?: Record<string, unknown> | undefined;
305
+ relationships?: Record<string, unknown> | undefined;
306
+ links?: Record<string, string> | undefined;
307
+ meta?: Record<string, unknown> | undefined;
308
+ }, {
309
+ type: string;
310
+ id: string;
311
+ attributes?: Record<string, unknown> | undefined;
312
+ relationships?: Record<string, unknown> | undefined;
313
+ links?: Record<string, string> | undefined;
314
+ meta?: Record<string, unknown> | undefined;
315
+ }>, "many">>;
316
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
317
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
318
+ }, "strip", z.ZodTypeAny, {
319
+ data: {
320
+ type: string;
321
+ id: string;
322
+ attributes: {
323
+ createdAt: string;
324
+ updatedAt: string;
325
+ season: string;
326
+ farmId: string;
327
+ items: {
328
+ id: string;
329
+ title: string;
330
+ unit: string;
331
+ planned: number;
332
+ actual: number;
333
+ }[];
334
+ startDate?: string | undefined;
335
+ endDate?: string | undefined;
336
+ };
337
+ relationships?: Record<string, unknown> | undefined;
338
+ links?: Record<string, string> | undefined;
339
+ meta?: Record<string, unknown> | undefined;
340
+ };
341
+ links?: Record<string, string> | undefined;
342
+ meta?: Record<string, unknown> | undefined;
343
+ included?: {
344
+ type: string;
345
+ id: string;
346
+ attributes?: Record<string, unknown> | undefined;
347
+ relationships?: Record<string, unknown> | undefined;
348
+ links?: Record<string, string> | undefined;
349
+ meta?: Record<string, unknown> | undefined;
350
+ }[] | undefined;
351
+ }, {
352
+ data: {
353
+ type: string;
354
+ id: string;
355
+ attributes: {
356
+ createdAt: string;
357
+ updatedAt: string;
358
+ season: string;
359
+ farmId: string;
360
+ items: {
361
+ id: string;
362
+ title: string;
363
+ unit: string;
364
+ planned: number;
365
+ actual: number;
366
+ }[];
367
+ startDate?: string | undefined;
368
+ endDate?: string | undefined;
369
+ };
370
+ relationships?: Record<string, unknown> | undefined;
371
+ links?: Record<string, string> | undefined;
372
+ meta?: Record<string, unknown> | undefined;
373
+ };
374
+ links?: Record<string, string> | undefined;
375
+ meta?: Record<string, unknown> | undefined;
376
+ included?: {
377
+ type: string;
378
+ id: string;
379
+ attributes?: Record<string, unknown> | undefined;
380
+ relationships?: Record<string, unknown> | undefined;
381
+ links?: Record<string, string> | undefined;
382
+ meta?: Record<string, unknown> | undefined;
383
+ }[] | undefined;
384
+ }>;
385
+ export declare const getSeasonalPlanQuerySchema: z.ZodObject<{
386
+ season: z.ZodOptional<z.ZodString>;
387
+ 'filter[startDate]': z.ZodOptional<z.ZodString>;
388
+ 'filter[endDate]': z.ZodOptional<z.ZodString>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ 'filter[startDate]'?: string | undefined;
391
+ 'filter[endDate]'?: string | undefined;
392
+ season?: string | undefined;
393
+ }, {
394
+ 'filter[startDate]'?: string | undefined;
395
+ 'filter[endDate]'?: string | undefined;
396
+ season?: string | undefined;
397
+ }>;
398
+ export type SeasonalPlanItem = z.infer<typeof seasonalPlanItemSchema>;
399
+ export type SeasonalPlanAttributes = z.infer<typeof seasonalPlanAttributesSchema>;
400
+ export type SeasonalPlanResponse = z.infer<typeof seasonalPlanResponseSchema>;
401
+ //# sourceMappingURL=seasonal-plans.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seasonal-plans.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/seasonal-plans.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;GAKG;AAGH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAGH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMf,CAAC;AAG3B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGtC,CAAC;AAGF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA0D,CAAC;AAGlG,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAIrC,CAAC;AAGH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSeasonalPlanQuerySchema = exports.seasonalPlanResponseSchema = exports.seasonalPlanResourceSchema = exports.seasonalPlanAttributesSchema = exports.seasonalPlanItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_schemas_1 = require("./common.schemas");
6
+ /**
7
+ * Seasonal Plans schemas - JSON:API compliant
8
+ *
9
+ * Seasonal plan progress tracks planned vs actual metrics for a season
10
+ * Data is calculated from tasks and field data
11
+ */
12
+ // Seasonal plan item schema (for progress tracking)
13
+ exports.seasonalPlanItemSchema = zod_1.z.object({
14
+ id: zod_1.z.string(),
15
+ title: zod_1.z.string(), // e.g., "Planted Hectares", "Harvested Hectares"
16
+ planned: zod_1.z.number(),
17
+ actual: zod_1.z.number(),
18
+ unit: zod_1.z.string(), // e.g., "Ha", "kg", "L"
19
+ });
20
+ // Seasonal plan attributes schema
21
+ exports.seasonalPlanAttributesSchema = zod_1.z.object({
22
+ farmId: zod_1.z.string().uuid(),
23
+ season: zod_1.z.string(), // e.g., "2024-2025"
24
+ startDate: zod_1.z.string().datetime().optional(),
25
+ endDate: zod_1.z.string().datetime().optional(),
26
+ items: zod_1.z.array(exports.seasonalPlanItemSchema), // Progress items
27
+ }).merge(common_schemas_1.timestampsSchema);
28
+ // Seasonal plan resource schema
29
+ exports.seasonalPlanResourceSchema = (0, common_schemas_1.createJsonApiResourceSchema)('seasonal-plans', exports.seasonalPlanAttributesSchema);
30
+ // Seasonal plan response schema
31
+ exports.seasonalPlanResponseSchema = (0, common_schemas_1.jsonApiSingleResponseSchema)(exports.seasonalPlanResourceSchema);
32
+ // Query parameters for getting seasonal plan
33
+ exports.getSeasonalPlanQuerySchema = zod_1.z.object({
34
+ season: zod_1.z.string().optional(), // e.g., "2024-2025"
35
+ 'filter[startDate]': zod_1.z.string().datetime().optional(),
36
+ 'filter[endDate]': zod_1.z.string().datetime().optional(),
37
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepintel-ltd/farmpro-contracts",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "Type-safe API contracts for FarmPro API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",