@deepintel-ltd/farmpro-contracts 1.5.8 → 1.5.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.
- package/dist/index.js +50 -92
- package/dist/routes/admin.routes.js +13 -16
- package/dist/routes/agent-workflows.routes.js +81 -84
- package/dist/routes/agents.routes.js +29 -32
- package/dist/routes/analytics.routes.js +11 -14
- package/dist/routes/auth.routes.js +55 -58
- package/dist/routes/categories.routes.js +23 -26
- package/dist/routes/documents.routes.js +67 -70
- package/dist/routes/equipment.routes.js +55 -58
- package/dist/routes/farms.routes.js +32 -35
- package/dist/routes/field-monitoring.routes.js +70 -73
- package/dist/routes/field-observations.routes.js +41 -44
- package/dist/routes/fields.routes.js +44 -47
- package/dist/routes/finance.routes.js +121 -124
- package/dist/routes/harvest.routes.js +46 -49
- package/dist/routes/health.routes.js +6 -9
- package/dist/routes/index.js +51 -54
- package/dist/routes/input-usage.routes.js +14 -17
- package/dist/routes/inventory.routes.js +57 -60
- package/dist/routes/seasonal-plans.routes.js +14 -17
- package/dist/routes/soil-tests.routes.js +45 -48
- package/dist/routes/suppliers.routes.js +70 -73
- package/dist/routes/tasks.routes.js +65 -68
- package/dist/routes/team.routes.js +57 -60
- package/dist/routes/users.routes.js +13 -16
- package/dist/routes/weather.routes.js +10 -13
- package/dist/schemas/admin.schemas.js +43 -46
- package/dist/schemas/agent-workflows.schemas.js +34 -37
- package/dist/schemas/agents.schemas.js +46 -49
- package/dist/schemas/analytics.schemas.js +51 -54
- package/dist/schemas/auth.schemas.js +96 -99
- package/dist/schemas/categories.schemas.js +27 -30
- package/dist/schemas/common.schemas.js +89 -95
- package/dist/schemas/documents.schemas.js +59 -62
- package/dist/schemas/equipment.schemas.js +86 -89
- package/dist/schemas/farms.schemas.js +40 -43
- package/dist/schemas/field-monitoring.schemas.js +207 -210
- package/dist/schemas/field-observations.schemas.js +93 -96
- package/dist/schemas/fields.schemas.js +82 -85
- package/dist/schemas/finance.schemas.js +134 -137
- package/dist/schemas/harvest.schemas.js +46 -49
- package/dist/schemas/health.schemas.js +14 -17
- package/dist/schemas/input-usage.schemas.js +21 -24
- package/dist/schemas/inventory.schemas.js +58 -61
- package/dist/schemas/recommendations.schemas.js +22 -25
- package/dist/schemas/seasonal-plans.schemas.js +21 -24
- package/dist/schemas/soil-tests.schemas.js +70 -73
- package/dist/schemas/suppliers.schemas.js +90 -93
- package/dist/schemas/tasks.schemas.js +93 -96
- package/dist/schemas/team.schemas.js +35 -38
- package/dist/schemas/users.schemas.js +19 -22
- package/dist/schemas/weather.schemas.js +32 -35
- package/package.json +9 -1
|
@@ -1,50 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const common_schemas_1 = require("./common.schemas");
|
|
6
|
-
const recommendations_schemas_1 = require("./recommendations.schemas");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createJsonApiResourceSchema, jsonApiSingleResponseSchema, } from './common.schemas';
|
|
3
|
+
import { recommendationSchema } from './recommendations.schemas';
|
|
7
4
|
/**
|
|
8
5
|
* Weather schemas - JSON:API compliant
|
|
9
6
|
*/
|
|
10
7
|
// Weather alert type enum
|
|
11
|
-
|
|
8
|
+
export const weatherAlertTypeSchema = z.enum(['drought', 'heavy-rain', 'frost', 'optimal', 'wind']);
|
|
12
9
|
// Weather alert severity enum
|
|
13
|
-
|
|
10
|
+
export const weatherAlertSeveritySchema = z.enum(['high', 'medium', 'low']);
|
|
14
11
|
// Current weather
|
|
15
|
-
|
|
16
|
-
temp:
|
|
17
|
-
condition:
|
|
18
|
-
icon:
|
|
19
|
-
rainfall:
|
|
20
|
-
humidity:
|
|
12
|
+
export const currentWeatherSchema = z.object({
|
|
13
|
+
temp: z.number(),
|
|
14
|
+
condition: z.string(), // e.g., "Sunny", "Partly Cloudy"
|
|
15
|
+
icon: z.string().url().optional(),
|
|
16
|
+
rainfall: z.number().nonnegative().optional(), // mm of rainfall
|
|
17
|
+
humidity: z.number().min(0).max(100).optional(), // percentage
|
|
21
18
|
});
|
|
22
19
|
// Weather forecast
|
|
23
|
-
|
|
24
|
-
day:
|
|
25
|
-
temp:
|
|
26
|
-
rain:
|
|
27
|
-
rainfall:
|
|
28
|
-
condition:
|
|
20
|
+
export const weatherForecastSchema = z.object({
|
|
21
|
+
day: z.string(), // e.g., "Today", "Tomorrow", "Sat"
|
|
22
|
+
temp: z.number(),
|
|
23
|
+
rain: z.number().min(0).max(100).optional(), // percentage chance
|
|
24
|
+
rainfall: z.number().nonnegative().optional(), // mm of rainfall
|
|
25
|
+
condition: z.string().optional(),
|
|
29
26
|
});
|
|
30
27
|
// Weather alert
|
|
31
|
-
|
|
32
|
-
id:
|
|
33
|
-
type:
|
|
34
|
-
severity:
|
|
35
|
-
message:
|
|
36
|
-
fieldId:
|
|
37
|
-
date:
|
|
38
|
-
recommendations:
|
|
28
|
+
export const weatherAlertSchema = z.object({
|
|
29
|
+
id: z.string().uuid(),
|
|
30
|
+
type: weatherAlertTypeSchema,
|
|
31
|
+
severity: weatherAlertSeveritySchema,
|
|
32
|
+
message: z.string(),
|
|
33
|
+
fieldId: z.string().uuid().nullable().optional(), // Field-specific alerts
|
|
34
|
+
date: z.string().datetime(),
|
|
35
|
+
recommendations: z.array(recommendationSchema).optional(),
|
|
39
36
|
});
|
|
40
37
|
// Weather attributes schema (for JSON:API attributes object)
|
|
41
|
-
|
|
42
|
-
farmId:
|
|
43
|
-
current:
|
|
44
|
-
forecast:
|
|
45
|
-
alerts:
|
|
38
|
+
export const weatherAttributesSchema = z.object({
|
|
39
|
+
farmId: z.string().uuid(),
|
|
40
|
+
current: currentWeatherSchema,
|
|
41
|
+
forecast: z.array(weatherForecastSchema),
|
|
42
|
+
alerts: z.array(weatherAlertSchema).optional(),
|
|
46
43
|
});
|
|
47
44
|
// Weather resource (JSON:API resource object)
|
|
48
|
-
|
|
45
|
+
export const weatherResourceSchema = createJsonApiResourceSchema('weather', weatherAttributesSchema);
|
|
49
46
|
// Weather response (JSON:API format)
|
|
50
|
-
|
|
47
|
+
export const weatherResponseSchema = jsonApiSingleResponseSchema(weatherResourceSchema);
|
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepintel-ltd/farmpro-contracts",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"description": "Type-safe API contracts for FarmPro API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
7
15
|
"files": [
|
|
8
16
|
"dist",
|
|
9
17
|
"README.md"
|