@deepintel-ltd/farmpro-contracts 1.0.1 → 1.0.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.
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/routes/analytics.routes.d.ts +754 -0
- package/dist/routes/analytics.routes.d.ts.map +1 -0
- package/dist/routes/analytics.routes.js +24 -0
- package/dist/routes/auth.routes.d.ts +3836 -0
- package/dist/routes/auth.routes.d.ts.map +1 -0
- package/dist/routes/auth.routes.js +158 -0
- package/dist/routes/documents.routes.d.ts +2476 -0
- package/dist/routes/documents.routes.d.ts.map +1 -0
- package/dist/routes/documents.routes.js +100 -0
- package/dist/routes/equipment.routes.d.ts +3617 -0
- package/dist/routes/equipment.routes.d.ts.map +1 -0
- package/dist/routes/equipment.routes.js +118 -0
- package/dist/routes/farms.routes.d.ts +2202 -0
- package/dist/routes/farms.routes.d.ts.map +1 -0
- package/dist/routes/farms.routes.js +111 -0
- package/dist/routes/fields.routes.d.ts +3389 -0
- package/dist/routes/fields.routes.d.ts.map +1 -0
- package/dist/routes/fields.routes.js +95 -0
- package/dist/routes/finance.routes.d.ts +6855 -0
- package/dist/routes/finance.routes.d.ts.map +1 -0
- package/dist/routes/finance.routes.js +259 -0
- package/dist/routes/harvest.routes.d.ts +2337 -0
- package/dist/routes/harvest.routes.d.ts.map +1 -0
- package/dist/routes/harvest.routes.js +99 -0
- package/dist/routes/index.d.ts +68 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +43 -0
- package/dist/routes/inventory.routes.d.ts +2853 -0
- package/dist/routes/inventory.routes.d.ts.map +1 -0
- package/dist/routes/inventory.routes.js +121 -0
- package/dist/routes/soil-tests.routes.d.ts +3005 -0
- package/dist/routes/soil-tests.routes.d.ts.map +1 -0
- package/dist/routes/soil-tests.routes.js +98 -0
- package/dist/routes/suppliers.routes.d.ts +4190 -0
- package/dist/routes/suppliers.routes.d.ts.map +1 -0
- package/dist/routes/suppliers.routes.js +146 -0
- package/dist/routes/tasks.routes.d.ts +4192 -0
- package/dist/routes/tasks.routes.d.ts.map +1 -0
- package/dist/routes/tasks.routes.js +138 -0
- package/dist/routes/team.routes.d.ts +2210 -0
- package/dist/routes/team.routes.d.ts.map +1 -0
- package/dist/routes/team.routes.js +98 -0
- package/dist/routes/users.routes.d.ts +721 -0
- package/dist/routes/users.routes.d.ts.map +1 -0
- package/dist/routes/users.routes.js +35 -0
- package/dist/routes/weather.routes.d.ts +500 -0
- package/dist/routes/weather.routes.d.ts.map +1 -0
- package/dist/routes/weather.routes.js +23 -0
- package/dist/schemas/analytics.schemas.d.ts +1344 -0
- package/dist/schemas/analytics.schemas.d.ts.map +1 -0
- package/dist/schemas/analytics.schemas.js +73 -0
- package/dist/schemas/auth.schemas.d.ts +1093 -0
- package/dist/schemas/auth.schemas.d.ts.map +1 -0
- package/dist/schemas/auth.schemas.js +159 -0
- package/dist/schemas/common.schemas.d.ts +562 -0
- package/dist/schemas/common.schemas.d.ts.map +1 -0
- package/dist/schemas/common.schemas.js +122 -0
- package/dist/schemas/documents.schemas.d.ts +850 -0
- package/dist/schemas/documents.schemas.d.ts.map +1 -0
- package/dist/schemas/documents.schemas.js +75 -0
- package/dist/schemas/equipment.schemas.d.ts +1618 -0
- package/dist/schemas/equipment.schemas.d.ts.map +1 -0
- package/dist/schemas/equipment.schemas.js +125 -0
- package/dist/schemas/farms.schemas.d.ts +1171 -0
- package/dist/schemas/farms.schemas.d.ts.map +1 -0
- package/dist/schemas/farms.schemas.js +62 -0
- package/dist/schemas/fields.schemas.d.ts +2508 -0
- package/dist/schemas/fields.schemas.d.ts.map +1 -0
- package/dist/schemas/fields.schemas.js +125 -0
- package/dist/schemas/finance.schemas.d.ts +2869 -0
- package/dist/schemas/finance.schemas.d.ts.map +1 -0
- package/dist/schemas/finance.schemas.js +196 -0
- package/dist/schemas/harvest.schemas.d.ts +1051 -0
- package/dist/schemas/harvest.schemas.d.ts.map +1 -0
- package/dist/schemas/harvest.schemas.js +71 -0
- package/dist/schemas/inventory.schemas.d.ts +1138 -0
- package/dist/schemas/inventory.schemas.d.ts.map +1 -0
- package/dist/schemas/inventory.schemas.js +89 -0
- package/dist/schemas/soil-tests.schemas.d.ts +1885 -0
- package/dist/schemas/soil-tests.schemas.d.ts.map +1 -0
- package/dist/schemas/soil-tests.schemas.js +102 -0
- package/dist/schemas/suppliers.schemas.d.ts +1774 -0
- package/dist/schemas/suppliers.schemas.d.ts.map +1 -0
- package/dist/schemas/suppliers.schemas.js +121 -0
- package/dist/schemas/tasks.schemas.d.ts +1761 -0
- package/dist/schemas/tasks.schemas.d.ts.map +1 -0
- package/dist/schemas/tasks.schemas.js +121 -0
- package/dist/schemas/team.schemas.d.ts +583 -0
- package/dist/schemas/team.schemas.d.ts.map +1 -0
- package/dist/schemas/team.schemas.js +60 -0
- package/dist/schemas/users.schemas.d.ts +288 -0
- package/dist/schemas/users.schemas.d.ts.map +1 -0
- package/dist/schemas/users.schemas.js +32 -0
- package/dist/schemas/weather.schemas.d.ts +682 -0
- package/dist/schemas/weather.schemas.d.ts.map +1 -0
- package/dist/schemas/weather.schemas.js +49 -0
- package/package.json +1 -1
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Common schemas used across all API contracts - JSON:API compliant
|
|
4
|
+
*/
|
|
5
|
+
export declare const geoJSONGeometrySchema: z.ZodObject<{
|
|
6
|
+
type: z.ZodEnum<["Polygon", "MultiPolygon", "Point", "LineString"]>;
|
|
7
|
+
coordinates: z.ZodUnion<[z.ZodArray<z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">, "many">, z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">, "many">, "many">, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodArray<z.ZodNumber, "many">, "many">]>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
type: "Polygon" | "MultiPolygon" | "Point" | "LineString";
|
|
10
|
+
coordinates: number[] | number[][] | number[][][] | number[][][][];
|
|
11
|
+
}, {
|
|
12
|
+
type: "Polygon" | "MultiPolygon" | "Point" | "LineString";
|
|
13
|
+
coordinates: number[] | number[][] | number[][][] | number[][][][];
|
|
14
|
+
}>;
|
|
15
|
+
export declare const jsonApiResourceSchema: z.ZodObject<{
|
|
16
|
+
type: z.ZodString;
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
19
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
21
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
type: string;
|
|
24
|
+
id: string;
|
|
25
|
+
attributes?: Record<string, unknown> | undefined;
|
|
26
|
+
relationships?: Record<string, unknown> | undefined;
|
|
27
|
+
links?: Record<string, string> | undefined;
|
|
28
|
+
meta?: Record<string, unknown> | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
type: string;
|
|
31
|
+
id: string;
|
|
32
|
+
attributes?: Record<string, unknown> | undefined;
|
|
33
|
+
relationships?: Record<string, unknown> | undefined;
|
|
34
|
+
links?: Record<string, string> | undefined;
|
|
35
|
+
meta?: Record<string, unknown> | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const jsonApiSingleResponseSchema: <T extends z.ZodTypeAny>(resourceSchema: T) => z.ZodObject<{
|
|
38
|
+
data: T;
|
|
39
|
+
included: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
+
type: z.ZodString;
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
43
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
44
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
45
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
type: string;
|
|
48
|
+
id: string;
|
|
49
|
+
attributes?: Record<string, unknown> | undefined;
|
|
50
|
+
relationships?: Record<string, unknown> | undefined;
|
|
51
|
+
links?: Record<string, string> | undefined;
|
|
52
|
+
meta?: Record<string, unknown> | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
type: string;
|
|
55
|
+
id: string;
|
|
56
|
+
attributes?: Record<string, unknown> | undefined;
|
|
57
|
+
relationships?: Record<string, unknown> | undefined;
|
|
58
|
+
links?: Record<string, string> | undefined;
|
|
59
|
+
meta?: Record<string, unknown> | undefined;
|
|
60
|
+
}>, "many">>;
|
|
61
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
62
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
64
|
+
data: T;
|
|
65
|
+
included: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
type: z.ZodString;
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
69
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
70
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
type: string;
|
|
74
|
+
id: string;
|
|
75
|
+
attributes?: Record<string, unknown> | undefined;
|
|
76
|
+
relationships?: Record<string, unknown> | undefined;
|
|
77
|
+
links?: Record<string, string> | undefined;
|
|
78
|
+
meta?: Record<string, unknown> | undefined;
|
|
79
|
+
}, {
|
|
80
|
+
type: string;
|
|
81
|
+
id: string;
|
|
82
|
+
attributes?: Record<string, unknown> | undefined;
|
|
83
|
+
relationships?: Record<string, unknown> | undefined;
|
|
84
|
+
links?: Record<string, string> | undefined;
|
|
85
|
+
meta?: Record<string, unknown> | undefined;
|
|
86
|
+
}>, "many">>;
|
|
87
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
88
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
89
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
90
|
+
data: T;
|
|
91
|
+
included: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
92
|
+
type: z.ZodString;
|
|
93
|
+
id: z.ZodString;
|
|
94
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
95
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
97
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
type: string;
|
|
100
|
+
id: string;
|
|
101
|
+
attributes?: Record<string, unknown> | undefined;
|
|
102
|
+
relationships?: Record<string, unknown> | undefined;
|
|
103
|
+
links?: Record<string, string> | undefined;
|
|
104
|
+
meta?: Record<string, unknown> | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
type: string;
|
|
107
|
+
id: string;
|
|
108
|
+
attributes?: Record<string, unknown> | undefined;
|
|
109
|
+
relationships?: Record<string, unknown> | undefined;
|
|
110
|
+
links?: Record<string, string> | undefined;
|
|
111
|
+
meta?: Record<string, unknown> | undefined;
|
|
112
|
+
}>, "many">>;
|
|
113
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
114
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
115
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
116
|
+
export declare const jsonApiCollectionResponseSchema: <T extends z.ZodTypeAny>(resourceSchema: T) => z.ZodObject<{
|
|
117
|
+
data: z.ZodArray<T, "many">;
|
|
118
|
+
included: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
119
|
+
type: z.ZodString;
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
122
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
123
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
124
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
type: string;
|
|
127
|
+
id: string;
|
|
128
|
+
attributes?: Record<string, unknown> | undefined;
|
|
129
|
+
relationships?: Record<string, unknown> | undefined;
|
|
130
|
+
links?: Record<string, string> | undefined;
|
|
131
|
+
meta?: Record<string, unknown> | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
type: string;
|
|
134
|
+
id: string;
|
|
135
|
+
attributes?: Record<string, unknown> | undefined;
|
|
136
|
+
relationships?: Record<string, unknown> | undefined;
|
|
137
|
+
links?: Record<string, string> | undefined;
|
|
138
|
+
meta?: Record<string, unknown> | undefined;
|
|
139
|
+
}>, "many">>;
|
|
140
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
141
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
data: T["_output"][];
|
|
144
|
+
links?: Record<string, string> | undefined;
|
|
145
|
+
meta?: Record<string, unknown> | undefined;
|
|
146
|
+
included?: {
|
|
147
|
+
type: string;
|
|
148
|
+
id: string;
|
|
149
|
+
attributes?: Record<string, unknown> | undefined;
|
|
150
|
+
relationships?: Record<string, unknown> | undefined;
|
|
151
|
+
links?: Record<string, string> | undefined;
|
|
152
|
+
meta?: Record<string, unknown> | undefined;
|
|
153
|
+
}[] | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
data: T["_input"][];
|
|
156
|
+
links?: Record<string, string> | undefined;
|
|
157
|
+
meta?: Record<string, unknown> | undefined;
|
|
158
|
+
included?: {
|
|
159
|
+
type: string;
|
|
160
|
+
id: string;
|
|
161
|
+
attributes?: Record<string, unknown> | undefined;
|
|
162
|
+
relationships?: Record<string, unknown> | undefined;
|
|
163
|
+
links?: Record<string, string> | undefined;
|
|
164
|
+
meta?: Record<string, unknown> | undefined;
|
|
165
|
+
}[] | undefined;
|
|
166
|
+
}>;
|
|
167
|
+
export declare const jsonApiPaginationQuerySchema: z.ZodObject<{
|
|
168
|
+
'page[number]': z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
169
|
+
'page[size]': z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
'page[number]'?: number | undefined;
|
|
172
|
+
'page[size]'?: number | undefined;
|
|
173
|
+
}, {
|
|
174
|
+
'page[number]'?: number | undefined;
|
|
175
|
+
'page[size]'?: number | undefined;
|
|
176
|
+
}>;
|
|
177
|
+
export declare const jsonApiPaginationLinksSchema: z.ZodObject<{
|
|
178
|
+
first: z.ZodOptional<z.ZodString>;
|
|
179
|
+
last: z.ZodOptional<z.ZodString>;
|
|
180
|
+
prev: z.ZodOptional<z.ZodString>;
|
|
181
|
+
next: z.ZodOptional<z.ZodString>;
|
|
182
|
+
self: z.ZodString;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
self: string;
|
|
185
|
+
first?: string | undefined;
|
|
186
|
+
last?: string | undefined;
|
|
187
|
+
prev?: string | undefined;
|
|
188
|
+
next?: string | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
self: string;
|
|
191
|
+
first?: string | undefined;
|
|
192
|
+
last?: string | undefined;
|
|
193
|
+
prev?: string | undefined;
|
|
194
|
+
next?: string | undefined;
|
|
195
|
+
}>;
|
|
196
|
+
export declare const jsonApiPaginationMetaSchema: z.ZodObject<{
|
|
197
|
+
totalRecords: z.ZodNumber;
|
|
198
|
+
totalPages: z.ZodNumber;
|
|
199
|
+
currentPage: z.ZodNumber;
|
|
200
|
+
pageSize: z.ZodNumber;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
totalRecords: number;
|
|
203
|
+
totalPages: number;
|
|
204
|
+
currentPage: number;
|
|
205
|
+
pageSize: number;
|
|
206
|
+
}, {
|
|
207
|
+
totalRecords: number;
|
|
208
|
+
totalPages: number;
|
|
209
|
+
currentPage: number;
|
|
210
|
+
pageSize: number;
|
|
211
|
+
}>;
|
|
212
|
+
export declare const jsonApiSortQuerySchema: z.ZodObject<{
|
|
213
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
sort?: string | undefined;
|
|
216
|
+
}, {
|
|
217
|
+
sort?: string | undefined;
|
|
218
|
+
}>;
|
|
219
|
+
export declare const jsonApiFilterQuerySchema: z.ZodObject<{
|
|
220
|
+
'filter[startDate]': z.ZodOptional<z.ZodString>;
|
|
221
|
+
'filter[endDate]': z.ZodOptional<z.ZodString>;
|
|
222
|
+
'filter[status]': z.ZodOptional<z.ZodString>;
|
|
223
|
+
'filter[crop]': z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
'filter[startDate]'?: string | undefined;
|
|
226
|
+
'filter[endDate]'?: string | undefined;
|
|
227
|
+
'filter[status]'?: string | undefined;
|
|
228
|
+
'filter[crop]'?: string | undefined;
|
|
229
|
+
}, {
|
|
230
|
+
'filter[startDate]'?: string | undefined;
|
|
231
|
+
'filter[endDate]'?: string | undefined;
|
|
232
|
+
'filter[status]'?: string | undefined;
|
|
233
|
+
'filter[crop]'?: string | undefined;
|
|
234
|
+
}>;
|
|
235
|
+
export declare const jsonApiFieldsQuerySchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
236
|
+
export declare const jsonApiIncludeQuerySchema: z.ZodObject<{
|
|
237
|
+
include: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, "strip", z.ZodTypeAny, {
|
|
239
|
+
include?: string | undefined;
|
|
240
|
+
}, {
|
|
241
|
+
include?: string | undefined;
|
|
242
|
+
}>;
|
|
243
|
+
export declare const jsonApiErrorSchema: z.ZodObject<{
|
|
244
|
+
id: z.ZodOptional<z.ZodString>;
|
|
245
|
+
links: z.ZodOptional<z.ZodObject<{
|
|
246
|
+
about: z.ZodOptional<z.ZodString>;
|
|
247
|
+
}, "strip", z.ZodTypeAny, {
|
|
248
|
+
about?: string | undefined;
|
|
249
|
+
}, {
|
|
250
|
+
about?: string | undefined;
|
|
251
|
+
}>>;
|
|
252
|
+
status: z.ZodOptional<z.ZodString>;
|
|
253
|
+
code: z.ZodOptional<z.ZodString>;
|
|
254
|
+
title: z.ZodOptional<z.ZodString>;
|
|
255
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
256
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
257
|
+
pointer: z.ZodOptional<z.ZodString>;
|
|
258
|
+
parameter: z.ZodOptional<z.ZodString>;
|
|
259
|
+
}, "strip", z.ZodTypeAny, {
|
|
260
|
+
pointer?: string | undefined;
|
|
261
|
+
parameter?: string | undefined;
|
|
262
|
+
}, {
|
|
263
|
+
pointer?: string | undefined;
|
|
264
|
+
parameter?: string | undefined;
|
|
265
|
+
}>>;
|
|
266
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
status?: string | undefined;
|
|
269
|
+
code?: string | undefined;
|
|
270
|
+
id?: string | undefined;
|
|
271
|
+
links?: {
|
|
272
|
+
about?: string | undefined;
|
|
273
|
+
} | undefined;
|
|
274
|
+
meta?: Record<string, unknown> | undefined;
|
|
275
|
+
title?: string | undefined;
|
|
276
|
+
detail?: string | undefined;
|
|
277
|
+
source?: {
|
|
278
|
+
pointer?: string | undefined;
|
|
279
|
+
parameter?: string | undefined;
|
|
280
|
+
} | undefined;
|
|
281
|
+
}, {
|
|
282
|
+
status?: string | undefined;
|
|
283
|
+
code?: string | undefined;
|
|
284
|
+
id?: string | undefined;
|
|
285
|
+
links?: {
|
|
286
|
+
about?: string | undefined;
|
|
287
|
+
} | undefined;
|
|
288
|
+
meta?: Record<string, unknown> | undefined;
|
|
289
|
+
title?: string | undefined;
|
|
290
|
+
detail?: string | undefined;
|
|
291
|
+
source?: {
|
|
292
|
+
pointer?: string | undefined;
|
|
293
|
+
parameter?: string | undefined;
|
|
294
|
+
} | undefined;
|
|
295
|
+
}>;
|
|
296
|
+
export declare const jsonApiErrorResponseSchema: z.ZodObject<{
|
|
297
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
298
|
+
id: z.ZodOptional<z.ZodString>;
|
|
299
|
+
links: z.ZodOptional<z.ZodObject<{
|
|
300
|
+
about: z.ZodOptional<z.ZodString>;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
about?: string | undefined;
|
|
303
|
+
}, {
|
|
304
|
+
about?: string | undefined;
|
|
305
|
+
}>>;
|
|
306
|
+
status: z.ZodOptional<z.ZodString>;
|
|
307
|
+
code: z.ZodOptional<z.ZodString>;
|
|
308
|
+
title: z.ZodOptional<z.ZodString>;
|
|
309
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
310
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
311
|
+
pointer: z.ZodOptional<z.ZodString>;
|
|
312
|
+
parameter: z.ZodOptional<z.ZodString>;
|
|
313
|
+
}, "strip", z.ZodTypeAny, {
|
|
314
|
+
pointer?: string | undefined;
|
|
315
|
+
parameter?: string | undefined;
|
|
316
|
+
}, {
|
|
317
|
+
pointer?: string | undefined;
|
|
318
|
+
parameter?: string | undefined;
|
|
319
|
+
}>>;
|
|
320
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
321
|
+
}, "strip", z.ZodTypeAny, {
|
|
322
|
+
status?: string | undefined;
|
|
323
|
+
code?: string | undefined;
|
|
324
|
+
id?: string | undefined;
|
|
325
|
+
links?: {
|
|
326
|
+
about?: string | undefined;
|
|
327
|
+
} | undefined;
|
|
328
|
+
meta?: Record<string, unknown> | undefined;
|
|
329
|
+
title?: string | undefined;
|
|
330
|
+
detail?: string | undefined;
|
|
331
|
+
source?: {
|
|
332
|
+
pointer?: string | undefined;
|
|
333
|
+
parameter?: string | undefined;
|
|
334
|
+
} | undefined;
|
|
335
|
+
}, {
|
|
336
|
+
status?: string | undefined;
|
|
337
|
+
code?: string | undefined;
|
|
338
|
+
id?: string | undefined;
|
|
339
|
+
links?: {
|
|
340
|
+
about?: string | undefined;
|
|
341
|
+
} | undefined;
|
|
342
|
+
meta?: Record<string, unknown> | undefined;
|
|
343
|
+
title?: string | undefined;
|
|
344
|
+
detail?: string | undefined;
|
|
345
|
+
source?: {
|
|
346
|
+
pointer?: string | undefined;
|
|
347
|
+
parameter?: string | undefined;
|
|
348
|
+
} | undefined;
|
|
349
|
+
}>, "many">;
|
|
350
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
351
|
+
}, "strip", z.ZodTypeAny, {
|
|
352
|
+
errors: {
|
|
353
|
+
status?: string | undefined;
|
|
354
|
+
code?: string | undefined;
|
|
355
|
+
id?: string | undefined;
|
|
356
|
+
links?: {
|
|
357
|
+
about?: string | undefined;
|
|
358
|
+
} | undefined;
|
|
359
|
+
meta?: Record<string, unknown> | undefined;
|
|
360
|
+
title?: string | undefined;
|
|
361
|
+
detail?: string | undefined;
|
|
362
|
+
source?: {
|
|
363
|
+
pointer?: string | undefined;
|
|
364
|
+
parameter?: string | undefined;
|
|
365
|
+
} | undefined;
|
|
366
|
+
}[];
|
|
367
|
+
meta?: Record<string, unknown> | undefined;
|
|
368
|
+
}, {
|
|
369
|
+
errors: {
|
|
370
|
+
status?: string | undefined;
|
|
371
|
+
code?: string | undefined;
|
|
372
|
+
id?: string | undefined;
|
|
373
|
+
links?: {
|
|
374
|
+
about?: string | undefined;
|
|
375
|
+
} | undefined;
|
|
376
|
+
meta?: Record<string, unknown> | undefined;
|
|
377
|
+
title?: string | undefined;
|
|
378
|
+
detail?: string | undefined;
|
|
379
|
+
source?: {
|
|
380
|
+
pointer?: string | undefined;
|
|
381
|
+
parameter?: string | undefined;
|
|
382
|
+
} | undefined;
|
|
383
|
+
}[];
|
|
384
|
+
meta?: Record<string, unknown> | undefined;
|
|
385
|
+
}>;
|
|
386
|
+
export declare const jsonApiSuccessResponseSchema: z.ZodObject<{
|
|
387
|
+
meta: z.ZodObject<{
|
|
388
|
+
message: z.ZodString;
|
|
389
|
+
}, "strip", z.ZodTypeAny, {
|
|
390
|
+
message: string;
|
|
391
|
+
}, {
|
|
392
|
+
message: string;
|
|
393
|
+
}>;
|
|
394
|
+
}, "strip", z.ZodTypeAny, {
|
|
395
|
+
meta: {
|
|
396
|
+
message: string;
|
|
397
|
+
};
|
|
398
|
+
}, {
|
|
399
|
+
meta: {
|
|
400
|
+
message: string;
|
|
401
|
+
};
|
|
402
|
+
}>;
|
|
403
|
+
export declare const idParamSchema: z.ZodObject<{
|
|
404
|
+
id: z.ZodString;
|
|
405
|
+
}, "strip", z.ZodTypeAny, {
|
|
406
|
+
id: string;
|
|
407
|
+
}, {
|
|
408
|
+
id: string;
|
|
409
|
+
}>;
|
|
410
|
+
export declare const timestampsSchema: z.ZodObject<{
|
|
411
|
+
createdAt: z.ZodString;
|
|
412
|
+
updatedAt: z.ZodString;
|
|
413
|
+
}, "strip", z.ZodTypeAny, {
|
|
414
|
+
createdAt: string;
|
|
415
|
+
updatedAt: string;
|
|
416
|
+
}, {
|
|
417
|
+
createdAt: string;
|
|
418
|
+
updatedAt: string;
|
|
419
|
+
}>;
|
|
420
|
+
export declare const createJsonApiResourceSchema: <T extends z.ZodTypeAny>(resourceType: string, attributesSchema: T) => z.ZodObject<{
|
|
421
|
+
type: z.ZodLiteral<string>;
|
|
422
|
+
id: z.ZodString;
|
|
423
|
+
attributes: T;
|
|
424
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
425
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
426
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
427
|
+
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
428
|
+
type: z.ZodLiteral<string>;
|
|
429
|
+
id: z.ZodString;
|
|
430
|
+
attributes: T;
|
|
431
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
432
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
433
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
434
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
435
|
+
type: z.ZodLiteral<string>;
|
|
436
|
+
id: z.ZodString;
|
|
437
|
+
attributes: T;
|
|
438
|
+
relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
439
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
440
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
441
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
442
|
+
export declare const errorResponseSchema: z.ZodObject<{
|
|
443
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
444
|
+
id: z.ZodOptional<z.ZodString>;
|
|
445
|
+
links: z.ZodOptional<z.ZodObject<{
|
|
446
|
+
about: z.ZodOptional<z.ZodString>;
|
|
447
|
+
}, "strip", z.ZodTypeAny, {
|
|
448
|
+
about?: string | undefined;
|
|
449
|
+
}, {
|
|
450
|
+
about?: string | undefined;
|
|
451
|
+
}>>;
|
|
452
|
+
status: z.ZodOptional<z.ZodString>;
|
|
453
|
+
code: z.ZodOptional<z.ZodString>;
|
|
454
|
+
title: z.ZodOptional<z.ZodString>;
|
|
455
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
456
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
457
|
+
pointer: z.ZodOptional<z.ZodString>;
|
|
458
|
+
parameter: z.ZodOptional<z.ZodString>;
|
|
459
|
+
}, "strip", z.ZodTypeAny, {
|
|
460
|
+
pointer?: string | undefined;
|
|
461
|
+
parameter?: string | undefined;
|
|
462
|
+
}, {
|
|
463
|
+
pointer?: string | undefined;
|
|
464
|
+
parameter?: string | undefined;
|
|
465
|
+
}>>;
|
|
466
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
467
|
+
}, "strip", z.ZodTypeAny, {
|
|
468
|
+
status?: string | undefined;
|
|
469
|
+
code?: string | undefined;
|
|
470
|
+
id?: string | undefined;
|
|
471
|
+
links?: {
|
|
472
|
+
about?: string | undefined;
|
|
473
|
+
} | undefined;
|
|
474
|
+
meta?: Record<string, unknown> | undefined;
|
|
475
|
+
title?: string | undefined;
|
|
476
|
+
detail?: string | undefined;
|
|
477
|
+
source?: {
|
|
478
|
+
pointer?: string | undefined;
|
|
479
|
+
parameter?: string | undefined;
|
|
480
|
+
} | undefined;
|
|
481
|
+
}, {
|
|
482
|
+
status?: string | undefined;
|
|
483
|
+
code?: string | undefined;
|
|
484
|
+
id?: string | undefined;
|
|
485
|
+
links?: {
|
|
486
|
+
about?: string | undefined;
|
|
487
|
+
} | undefined;
|
|
488
|
+
meta?: Record<string, unknown> | undefined;
|
|
489
|
+
title?: string | undefined;
|
|
490
|
+
detail?: string | undefined;
|
|
491
|
+
source?: {
|
|
492
|
+
pointer?: string | undefined;
|
|
493
|
+
parameter?: string | undefined;
|
|
494
|
+
} | undefined;
|
|
495
|
+
}>, "many">;
|
|
496
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
497
|
+
}, "strip", z.ZodTypeAny, {
|
|
498
|
+
errors: {
|
|
499
|
+
status?: string | undefined;
|
|
500
|
+
code?: string | undefined;
|
|
501
|
+
id?: string | undefined;
|
|
502
|
+
links?: {
|
|
503
|
+
about?: string | undefined;
|
|
504
|
+
} | undefined;
|
|
505
|
+
meta?: Record<string, unknown> | undefined;
|
|
506
|
+
title?: string | undefined;
|
|
507
|
+
detail?: string | undefined;
|
|
508
|
+
source?: {
|
|
509
|
+
pointer?: string | undefined;
|
|
510
|
+
parameter?: string | undefined;
|
|
511
|
+
} | undefined;
|
|
512
|
+
}[];
|
|
513
|
+
meta?: Record<string, unknown> | undefined;
|
|
514
|
+
}, {
|
|
515
|
+
errors: {
|
|
516
|
+
status?: string | undefined;
|
|
517
|
+
code?: string | undefined;
|
|
518
|
+
id?: string | undefined;
|
|
519
|
+
links?: {
|
|
520
|
+
about?: string | undefined;
|
|
521
|
+
} | undefined;
|
|
522
|
+
meta?: Record<string, unknown> | undefined;
|
|
523
|
+
title?: string | undefined;
|
|
524
|
+
detail?: string | undefined;
|
|
525
|
+
source?: {
|
|
526
|
+
pointer?: string | undefined;
|
|
527
|
+
parameter?: string | undefined;
|
|
528
|
+
} | undefined;
|
|
529
|
+
}[];
|
|
530
|
+
meta?: Record<string, unknown> | undefined;
|
|
531
|
+
}>;
|
|
532
|
+
export declare const paginationQuerySchema: z.ZodObject<{
|
|
533
|
+
'page[number]': z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
534
|
+
'page[size]': z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
535
|
+
}, "strip", z.ZodTypeAny, {
|
|
536
|
+
'page[number]'?: number | undefined;
|
|
537
|
+
'page[size]'?: number | undefined;
|
|
538
|
+
}, {
|
|
539
|
+
'page[number]'?: number | undefined;
|
|
540
|
+
'page[size]'?: number | undefined;
|
|
541
|
+
}>;
|
|
542
|
+
export declare const dateRangeQuerySchema: z.ZodObject<{
|
|
543
|
+
'filter[startDate]': z.ZodOptional<z.ZodString>;
|
|
544
|
+
'filter[endDate]': z.ZodOptional<z.ZodString>;
|
|
545
|
+
}, "strip", z.ZodTypeAny, {
|
|
546
|
+
'filter[startDate]'?: string | undefined;
|
|
547
|
+
'filter[endDate]'?: string | undefined;
|
|
548
|
+
}, {
|
|
549
|
+
'filter[startDate]'?: string | undefined;
|
|
550
|
+
'filter[endDate]'?: string | undefined;
|
|
551
|
+
}>;
|
|
552
|
+
export type GeoJSONGeometry = z.infer<typeof geoJSONGeometrySchema>;
|
|
553
|
+
export type JsonApiResource = z.infer<typeof jsonApiResourceSchema>;
|
|
554
|
+
export type JsonApiError = z.infer<typeof jsonApiErrorSchema>;
|
|
555
|
+
export type JsonApiErrorResponse = z.infer<typeof jsonApiErrorResponseSchema>;
|
|
556
|
+
export type JsonApiPaginationQuery = z.infer<typeof jsonApiPaginationQuerySchema>;
|
|
557
|
+
export type JsonApiPaginationLinks = z.infer<typeof jsonApiPaginationLinksSchema>;
|
|
558
|
+
export type JsonApiPaginationMeta = z.infer<typeof jsonApiPaginationMetaSchema>;
|
|
559
|
+
export type IdParam = z.infer<typeof idParamSchema>;
|
|
560
|
+
export type ErrorResponse = z.infer<typeof errorResponseSchema>;
|
|
561
|
+
export type PaginationQuery = z.infer<typeof paginationQuerySchema>;
|
|
562
|
+
//# sourceMappingURL=common.schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/common.schemas.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateRangeQuerySchema = exports.paginationQuerySchema = exports.errorResponseSchema = exports.createJsonApiResourceSchema = exports.timestampsSchema = exports.idParamSchema = exports.jsonApiSuccessResponseSchema = exports.jsonApiErrorResponseSchema = exports.jsonApiErrorSchema = exports.jsonApiIncludeQuerySchema = exports.jsonApiFieldsQuerySchema = exports.jsonApiFilterQuerySchema = exports.jsonApiSortQuerySchema = exports.jsonApiPaginationMetaSchema = exports.jsonApiPaginationLinksSchema = exports.jsonApiPaginationQuerySchema = exports.jsonApiCollectionResponseSchema = exports.jsonApiSingleResponseSchema = exports.jsonApiResourceSchema = exports.geoJSONGeometrySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Common schemas used across all API contracts - JSON:API compliant
|
|
7
|
+
*/
|
|
8
|
+
// GeoJSON Geometry Schema (Polygon, MultiPolygon, Point, LineString)
|
|
9
|
+
exports.geoJSONGeometrySchema = zod_1.z.object({
|
|
10
|
+
type: zod_1.z.enum(['Polygon', 'MultiPolygon', 'Point', 'LineString']),
|
|
11
|
+
coordinates: zod_1.z.union([
|
|
12
|
+
zod_1.z.array(zod_1.z.array(zod_1.z.array(zod_1.z.number()))), // Polygon: [[[lng, lat], ...]]
|
|
13
|
+
zod_1.z.array(zod_1.z.array(zod_1.z.array(zod_1.z.array(zod_1.z.number())))), // MultiPolygon: [[[[lng, lat], ...]]]
|
|
14
|
+
zod_1.z.array(zod_1.z.number()), // Point: [lng, lat]
|
|
15
|
+
zod_1.z.array(zod_1.z.array(zod_1.z.number())), // LineString: [[lng, lat], ...]
|
|
16
|
+
]),
|
|
17
|
+
});
|
|
18
|
+
// JSON:API Resource Object Base
|
|
19
|
+
exports.jsonApiResourceSchema = zod_1.z.object({
|
|
20
|
+
type: zod_1.z.string(),
|
|
21
|
+
id: zod_1.z.string(),
|
|
22
|
+
attributes: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
23
|
+
relationships: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
24
|
+
links: zod_1.z.record(zod_1.z.string()).optional(),
|
|
25
|
+
meta: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
26
|
+
});
|
|
27
|
+
// JSON:API Single Resource Response
|
|
28
|
+
const jsonApiSingleResponseSchema = (resourceSchema) => zod_1.z.object({
|
|
29
|
+
data: resourceSchema,
|
|
30
|
+
included: zod_1.z.array(exports.jsonApiResourceSchema).optional(),
|
|
31
|
+
meta: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
32
|
+
links: zod_1.z.record(zod_1.z.string()).optional(),
|
|
33
|
+
});
|
|
34
|
+
exports.jsonApiSingleResponseSchema = jsonApiSingleResponseSchema;
|
|
35
|
+
// JSON:API Collection Response
|
|
36
|
+
const jsonApiCollectionResponseSchema = (resourceSchema) => zod_1.z.object({
|
|
37
|
+
data: zod_1.z.array(resourceSchema),
|
|
38
|
+
included: zod_1.z.array(exports.jsonApiResourceSchema).optional(),
|
|
39
|
+
meta: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
40
|
+
links: zod_1.z.record(zod_1.z.string()).optional(),
|
|
41
|
+
});
|
|
42
|
+
exports.jsonApiCollectionResponseSchema = jsonApiCollectionResponseSchema;
|
|
43
|
+
exports.jsonApiPaginationQuerySchema = zod_1.z.object({
|
|
44
|
+
'page[number]': zod_1.z.coerce.number().int().positive().default(1).optional(),
|
|
45
|
+
'page[size]': zod_1.z.coerce.number().int().positive().max(100).default(20).optional(),
|
|
46
|
+
});
|
|
47
|
+
exports.jsonApiPaginationLinksSchema = zod_1.z.object({
|
|
48
|
+
first: zod_1.z.string().optional(),
|
|
49
|
+
last: zod_1.z.string().optional(),
|
|
50
|
+
prev: zod_1.z.string().optional(),
|
|
51
|
+
next: zod_1.z.string().optional(),
|
|
52
|
+
self: zod_1.z.string(),
|
|
53
|
+
});
|
|
54
|
+
exports.jsonApiPaginationMetaSchema = zod_1.z.object({
|
|
55
|
+
totalRecords: zod_1.z.number().int().nonnegative(),
|
|
56
|
+
totalPages: zod_1.z.number().int().nonnegative(),
|
|
57
|
+
currentPage: zod_1.z.number().int().positive(),
|
|
58
|
+
pageSize: zod_1.z.number().int().positive(),
|
|
59
|
+
});
|
|
60
|
+
exports.jsonApiSortQuerySchema = zod_1.z.object({
|
|
61
|
+
sort: zod_1.z.string().optional(), // e.g., "name,-createdAt"
|
|
62
|
+
});
|
|
63
|
+
exports.jsonApiFilterQuerySchema = zod_1.z.object({
|
|
64
|
+
'filter[startDate]': zod_1.z.string().datetime().optional(),
|
|
65
|
+
'filter[endDate]': zod_1.z.string().datetime().optional(),
|
|
66
|
+
'filter[status]': zod_1.z.string().optional(),
|
|
67
|
+
'filter[crop]': zod_1.z.string().optional(),
|
|
68
|
+
});
|
|
69
|
+
exports.jsonApiFieldsQuerySchema = zod_1.z.record(zod_1.z.string(), // resource type
|
|
70
|
+
zod_1.z.string() // comma-separated field names
|
|
71
|
+
).optional();
|
|
72
|
+
exports.jsonApiIncludeQuerySchema = zod_1.z.object({
|
|
73
|
+
include: zod_1.z.string().optional(), // e.g., "fields,team"
|
|
74
|
+
});
|
|
75
|
+
exports.jsonApiErrorSchema = zod_1.z.object({
|
|
76
|
+
id: zod_1.z.string().optional(),
|
|
77
|
+
links: zod_1.z.object({
|
|
78
|
+
about: zod_1.z.string().optional(),
|
|
79
|
+
}).optional(),
|
|
80
|
+
status: zod_1.z.string().optional(), // HTTP status code as string
|
|
81
|
+
code: zod_1.z.string().optional(), // Application-specific error code
|
|
82
|
+
title: zod_1.z.string().optional(), // Short, human-readable summary
|
|
83
|
+
detail: zod_1.z.string().optional(), // Human-readable explanation
|
|
84
|
+
source: zod_1.z.object({
|
|
85
|
+
pointer: zod_1.z.string().optional(), // JSON Pointer to associated field
|
|
86
|
+
parameter: zod_1.z.string().optional(), // Query parameter that caused the error
|
|
87
|
+
}).optional(),
|
|
88
|
+
meta: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
89
|
+
});
|
|
90
|
+
exports.jsonApiErrorResponseSchema = zod_1.z.object({
|
|
91
|
+
errors: zod_1.z.array(exports.jsonApiErrorSchema),
|
|
92
|
+
meta: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
93
|
+
});
|
|
94
|
+
exports.jsonApiSuccessResponseSchema = zod_1.z.object({
|
|
95
|
+
meta: zod_1.z.object({
|
|
96
|
+
message: zod_1.z.string(),
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
exports.idParamSchema = zod_1.z.object({
|
|
100
|
+
id: zod_1.z.string().uuid(),
|
|
101
|
+
});
|
|
102
|
+
exports.timestampsSchema = zod_1.z.object({
|
|
103
|
+
createdAt: zod_1.z.string().datetime(),
|
|
104
|
+
updatedAt: zod_1.z.string().datetime(),
|
|
105
|
+
});
|
|
106
|
+
// Helper to create a JSON:API resource schema
|
|
107
|
+
const createJsonApiResourceSchema = (resourceType, attributesSchema) => zod_1.z.object({
|
|
108
|
+
type: zod_1.z.literal(resourceType),
|
|
109
|
+
id: zod_1.z.string(),
|
|
110
|
+
attributes: attributesSchema,
|
|
111
|
+
relationships: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
112
|
+
links: zod_1.z.record(zod_1.z.string()).optional(),
|
|
113
|
+
meta: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
114
|
+
});
|
|
115
|
+
exports.createJsonApiResourceSchema = createJsonApiResourceSchema;
|
|
116
|
+
// Backward compatibility exports (deprecated - use JSON:API versions)
|
|
117
|
+
exports.errorResponseSchema = exports.jsonApiErrorResponseSchema;
|
|
118
|
+
exports.paginationQuerySchema = exports.jsonApiPaginationQuerySchema;
|
|
119
|
+
exports.dateRangeQuerySchema = zod_1.z.object({
|
|
120
|
+
'filter[startDate]': zod_1.z.string().datetime().optional(),
|
|
121
|
+
'filter[endDate]': zod_1.z.string().datetime().optional(),
|
|
122
|
+
});
|