@deepintel-ltd/farmpro-contracts 1.9.0 → 1.10.1

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,343 @@
1
+ import { z } from 'zod';
2
+ /** Valid FarmPro Academy course IDs for server-side progress sync */
3
+ export declare const academyCourseIdSchema: z.ZodEnum<["greenhouse_construction", "greenhouse", "greenhouse_pepper", "pepper_management"]>;
4
+ export type AcademyCourseId = z.infer<typeof academyCourseIdSchema>;
5
+ /** Opaque progress blob — mirrors localStorage shape per course */
6
+ export declare const academyProgressDataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
7
+ export declare const academyProgressAttributesSchema: z.ZodObject<{
8
+ courseId: z.ZodEnum<["greenhouse_construction", "greenhouse", "greenhouse_pepper", "pepper_management"]>;
9
+ progress: z.ZodRecord<z.ZodString, z.ZodUnknown>;
10
+ } & {
11
+ createdAt: z.ZodString;
12
+ updatedAt: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ progress: Record<string, unknown>;
17
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
18
+ }, {
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ progress: Record<string, unknown>;
22
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
23
+ }>;
24
+ export declare const academyProgressResourceSchema: z.ZodObject<{
25
+ type: z.ZodLiteral<string>;
26
+ id: z.ZodString;
27
+ attributes: z.ZodObject<{
28
+ courseId: z.ZodEnum<["greenhouse_construction", "greenhouse", "greenhouse_pepper", "pepper_management"]>;
29
+ progress: z.ZodRecord<z.ZodString, z.ZodUnknown>;
30
+ } & {
31
+ createdAt: z.ZodString;
32
+ updatedAt: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ progress: Record<string, unknown>;
37
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
38
+ }, {
39
+ createdAt: string;
40
+ updatedAt: string;
41
+ progress: Record<string, unknown>;
42
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
43
+ }>;
44
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
45
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
46
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
47
+ }, "strip", z.ZodTypeAny, {
48
+ type: string;
49
+ id: string;
50
+ attributes: {
51
+ createdAt: string;
52
+ updatedAt: string;
53
+ progress: Record<string, unknown>;
54
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
55
+ };
56
+ relationships?: Record<string, unknown> | undefined;
57
+ links?: Record<string, string> | undefined;
58
+ meta?: Record<string, unknown> | undefined;
59
+ }, {
60
+ type: string;
61
+ id: string;
62
+ attributes: {
63
+ createdAt: string;
64
+ updatedAt: string;
65
+ progress: Record<string, unknown>;
66
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
67
+ };
68
+ relationships?: Record<string, unknown> | undefined;
69
+ links?: Record<string, string> | undefined;
70
+ meta?: Record<string, unknown> | undefined;
71
+ }>;
72
+ export declare const academyProgressResponseSchema: z.ZodObject<{
73
+ data: z.ZodObject<{
74
+ type: z.ZodLiteral<string>;
75
+ id: z.ZodString;
76
+ attributes: z.ZodObject<{
77
+ courseId: z.ZodEnum<["greenhouse_construction", "greenhouse", "greenhouse_pepper", "pepper_management"]>;
78
+ progress: z.ZodRecord<z.ZodString, z.ZodUnknown>;
79
+ } & {
80
+ createdAt: z.ZodString;
81
+ updatedAt: z.ZodString;
82
+ }, "strip", z.ZodTypeAny, {
83
+ createdAt: string;
84
+ updatedAt: string;
85
+ progress: Record<string, unknown>;
86
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
87
+ }, {
88
+ createdAt: string;
89
+ updatedAt: string;
90
+ progress: Record<string, unknown>;
91
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
92
+ }>;
93
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
94
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
95
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ type: string;
98
+ id: string;
99
+ attributes: {
100
+ createdAt: string;
101
+ updatedAt: string;
102
+ progress: Record<string, unknown>;
103
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
104
+ };
105
+ relationships?: Record<string, unknown> | undefined;
106
+ links?: Record<string, string> | undefined;
107
+ meta?: Record<string, unknown> | undefined;
108
+ }, {
109
+ type: string;
110
+ id: string;
111
+ attributes: {
112
+ createdAt: string;
113
+ updatedAt: string;
114
+ progress: Record<string, unknown>;
115
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
116
+ };
117
+ relationships?: Record<string, unknown> | undefined;
118
+ links?: Record<string, string> | undefined;
119
+ meta?: Record<string, unknown> | undefined;
120
+ }>;
121
+ included: z.ZodOptional<z.ZodArray<z.ZodObject<{
122
+ type: z.ZodString;
123
+ id: z.ZodString;
124
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
125
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
126
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
127
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ type: string;
130
+ id: string;
131
+ attributes?: Record<string, unknown> | undefined;
132
+ relationships?: Record<string, unknown> | undefined;
133
+ links?: Record<string, string> | undefined;
134
+ meta?: Record<string, unknown> | undefined;
135
+ }, {
136
+ type: string;
137
+ id: string;
138
+ attributes?: Record<string, unknown> | undefined;
139
+ relationships?: Record<string, unknown> | undefined;
140
+ links?: Record<string, string> | undefined;
141
+ meta?: Record<string, unknown> | undefined;
142
+ }>, "many">>;
143
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
144
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
145
+ }, "strip", z.ZodTypeAny, {
146
+ data: {
147
+ type: string;
148
+ id: string;
149
+ attributes: {
150
+ createdAt: string;
151
+ updatedAt: string;
152
+ progress: Record<string, unknown>;
153
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
154
+ };
155
+ relationships?: Record<string, unknown> | undefined;
156
+ links?: Record<string, string> | undefined;
157
+ meta?: Record<string, unknown> | undefined;
158
+ };
159
+ links?: Record<string, string> | undefined;
160
+ meta?: Record<string, unknown> | undefined;
161
+ included?: {
162
+ type: string;
163
+ id: string;
164
+ attributes?: Record<string, unknown> | undefined;
165
+ relationships?: Record<string, unknown> | undefined;
166
+ links?: Record<string, string> | undefined;
167
+ meta?: Record<string, unknown> | undefined;
168
+ }[] | undefined;
169
+ }, {
170
+ data: {
171
+ type: string;
172
+ id: string;
173
+ attributes: {
174
+ createdAt: string;
175
+ updatedAt: string;
176
+ progress: Record<string, unknown>;
177
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
178
+ };
179
+ relationships?: Record<string, unknown> | undefined;
180
+ links?: Record<string, string> | undefined;
181
+ meta?: Record<string, unknown> | undefined;
182
+ };
183
+ links?: Record<string, string> | undefined;
184
+ meta?: Record<string, unknown> | undefined;
185
+ included?: {
186
+ type: string;
187
+ id: string;
188
+ attributes?: Record<string, unknown> | undefined;
189
+ relationships?: Record<string, unknown> | undefined;
190
+ links?: Record<string, string> | undefined;
191
+ meta?: Record<string, unknown> | undefined;
192
+ }[] | undefined;
193
+ }>;
194
+ export declare const academyProgressListResponseSchema: z.ZodObject<{
195
+ data: z.ZodArray<z.ZodObject<{
196
+ type: z.ZodLiteral<string>;
197
+ id: z.ZodString;
198
+ attributes: z.ZodObject<{
199
+ courseId: z.ZodEnum<["greenhouse_construction", "greenhouse", "greenhouse_pepper", "pepper_management"]>;
200
+ progress: z.ZodRecord<z.ZodString, z.ZodUnknown>;
201
+ } & {
202
+ createdAt: z.ZodString;
203
+ updatedAt: z.ZodString;
204
+ }, "strip", z.ZodTypeAny, {
205
+ createdAt: string;
206
+ updatedAt: string;
207
+ progress: Record<string, unknown>;
208
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
209
+ }, {
210
+ createdAt: string;
211
+ updatedAt: string;
212
+ progress: Record<string, unknown>;
213
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
214
+ }>;
215
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
216
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
217
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
218
+ }, "strip", z.ZodTypeAny, {
219
+ type: string;
220
+ id: string;
221
+ attributes: {
222
+ createdAt: string;
223
+ updatedAt: string;
224
+ progress: Record<string, unknown>;
225
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
226
+ };
227
+ relationships?: Record<string, unknown> | undefined;
228
+ links?: Record<string, string> | undefined;
229
+ meta?: Record<string, unknown> | undefined;
230
+ }, {
231
+ type: string;
232
+ id: string;
233
+ attributes: {
234
+ createdAt: string;
235
+ updatedAt: string;
236
+ progress: Record<string, unknown>;
237
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
238
+ };
239
+ relationships?: Record<string, unknown> | undefined;
240
+ links?: Record<string, string> | undefined;
241
+ meta?: Record<string, unknown> | undefined;
242
+ }>, "many">;
243
+ included: z.ZodOptional<z.ZodArray<z.ZodObject<{
244
+ type: z.ZodString;
245
+ id: z.ZodString;
246
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
247
+ relationships: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
248
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
249
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
250
+ }, "strip", z.ZodTypeAny, {
251
+ type: string;
252
+ id: string;
253
+ attributes?: Record<string, unknown> | undefined;
254
+ relationships?: Record<string, unknown> | undefined;
255
+ links?: Record<string, string> | undefined;
256
+ meta?: Record<string, unknown> | undefined;
257
+ }, {
258
+ type: string;
259
+ id: string;
260
+ attributes?: Record<string, unknown> | undefined;
261
+ relationships?: Record<string, unknown> | undefined;
262
+ links?: Record<string, string> | undefined;
263
+ meta?: Record<string, unknown> | undefined;
264
+ }>, "many">>;
265
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
266
+ links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
267
+ }, "strip", z.ZodTypeAny, {
268
+ data: {
269
+ type: string;
270
+ id: string;
271
+ attributes: {
272
+ createdAt: string;
273
+ updatedAt: string;
274
+ progress: Record<string, unknown>;
275
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
276
+ };
277
+ relationships?: Record<string, unknown> | undefined;
278
+ links?: Record<string, string> | undefined;
279
+ meta?: Record<string, unknown> | undefined;
280
+ }[];
281
+ links?: Record<string, string> | undefined;
282
+ meta?: Record<string, unknown> | undefined;
283
+ included?: {
284
+ type: string;
285
+ id: string;
286
+ attributes?: Record<string, unknown> | undefined;
287
+ relationships?: Record<string, unknown> | undefined;
288
+ links?: Record<string, string> | undefined;
289
+ meta?: Record<string, unknown> | undefined;
290
+ }[] | undefined;
291
+ }, {
292
+ data: {
293
+ type: string;
294
+ id: string;
295
+ attributes: {
296
+ createdAt: string;
297
+ updatedAt: string;
298
+ progress: Record<string, unknown>;
299
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
300
+ };
301
+ relationships?: Record<string, unknown> | undefined;
302
+ links?: Record<string, string> | undefined;
303
+ meta?: Record<string, unknown> | undefined;
304
+ }[];
305
+ links?: Record<string, string> | undefined;
306
+ meta?: Record<string, unknown> | undefined;
307
+ included?: {
308
+ type: string;
309
+ id: string;
310
+ attributes?: Record<string, unknown> | undefined;
311
+ relationships?: Record<string, unknown> | undefined;
312
+ links?: Record<string, string> | undefined;
313
+ meta?: Record<string, unknown> | undefined;
314
+ }[] | undefined;
315
+ }>;
316
+ export declare const upsertAcademyProgressSchema: z.ZodObject<{
317
+ type: z.ZodLiteral<"academy-progress">;
318
+ attributes: z.ZodObject<{
319
+ courseId: z.ZodEnum<["greenhouse_construction", "greenhouse", "greenhouse_pepper", "pepper_management"]>;
320
+ progress: z.ZodRecord<z.ZodString, z.ZodUnknown>;
321
+ }, "strip", z.ZodTypeAny, {
322
+ progress: Record<string, unknown>;
323
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
324
+ }, {
325
+ progress: Record<string, unknown>;
326
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
327
+ }>;
328
+ }, "strip", z.ZodTypeAny, {
329
+ type: "academy-progress";
330
+ attributes: {
331
+ progress: Record<string, unknown>;
332
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
333
+ };
334
+ }, {
335
+ type: "academy-progress";
336
+ attributes: {
337
+ progress: Record<string, unknown>;
338
+ courseId: "greenhouse_construction" | "greenhouse" | "greenhouse_pepper" | "pepper_management";
339
+ };
340
+ }>;
341
+ export type AcademyProgressAttributes = z.infer<typeof academyProgressAttributesSchema>;
342
+ export type UpsertAcademyProgressInput = z.infer<typeof upsertAcademyProgressSchema>;
343
+ //# sourceMappingURL=academy.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"academy.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/academy.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,gGAKhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,mEAAmE;AACnE,eAAO,MAAM,yBAAyB,wCAAwB,CAAC;AAE/D,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;EAKlB,CAAC;AAE3B,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGzC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6D,CAAC;AAExG,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE7C,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;EAMtC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import { createJsonApiResourceSchema, jsonApiSingleResponseSchema, jsonApiCollectionResponseSchema, timestampsSchema, } from './common.schemas';
3
+ /** Valid FarmPro Academy course IDs for server-side progress sync */
4
+ export const academyCourseIdSchema = z.enum([
5
+ 'greenhouse_construction',
6
+ 'greenhouse',
7
+ 'greenhouse_pepper',
8
+ 'pepper_management',
9
+ ]);
10
+ /** Opaque progress blob — mirrors localStorage shape per course */
11
+ export const academyProgressDataSchema = z.record(z.unknown());
12
+ export const academyProgressAttributesSchema = z
13
+ .object({
14
+ courseId: academyCourseIdSchema,
15
+ progress: academyProgressDataSchema,
16
+ })
17
+ .merge(timestampsSchema);
18
+ export const academyProgressResourceSchema = createJsonApiResourceSchema('academy-progress', academyProgressAttributesSchema);
19
+ export const academyProgressResponseSchema = jsonApiSingleResponseSchema(academyProgressResourceSchema);
20
+ export const academyProgressListResponseSchema = jsonApiCollectionResponseSchema(academyProgressResourceSchema);
21
+ export const upsertAcademyProgressSchema = z.object({
22
+ type: z.literal('academy-progress'),
23
+ attributes: z.object({
24
+ courseId: academyCourseIdSchema,
25
+ progress: academyProgressDataSchema,
26
+ }),
27
+ });
@@ -1,7 +1,59 @@
1
1
  import { z } from 'zod';
2
+ import { userResponseSchema } from './users.schemas';
2
3
  /**
3
4
  * Admin schemas for autonomous monitoring analytics
4
5
  */
6
+ export declare const adminCreateUserAttributesSchema: z.ZodObject<{
7
+ name: z.ZodString;
8
+ email: z.ZodString;
9
+ password: z.ZodString;
10
+ phone: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ email: string;
13
+ password: string;
14
+ name: string;
15
+ phone?: string | undefined;
16
+ }, {
17
+ email: string;
18
+ password: string;
19
+ name: string;
20
+ phone?: string | undefined;
21
+ }>;
22
+ export declare const adminCreateUserSchema: z.ZodObject<{
23
+ type: z.ZodLiteral<"users">;
24
+ attributes: z.ZodObject<{
25
+ name: z.ZodString;
26
+ email: z.ZodString;
27
+ password: z.ZodString;
28
+ phone: z.ZodOptional<z.ZodString>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ email: string;
31
+ password: string;
32
+ name: string;
33
+ phone?: string | undefined;
34
+ }, {
35
+ email: string;
36
+ password: string;
37
+ name: string;
38
+ phone?: string | undefined;
39
+ }>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ type: "users";
42
+ attributes: {
43
+ email: string;
44
+ password: string;
45
+ name: string;
46
+ phone?: string | undefined;
47
+ };
48
+ }, {
49
+ type: "users";
50
+ attributes: {
51
+ email: string;
52
+ password: string;
53
+ name: string;
54
+ phone?: string | undefined;
55
+ };
56
+ }>;
5
57
  export declare const sourceStatsSchema: z.ZodObject<{
6
58
  recommendations: z.ZodNumber;
7
59
  tasksCreated: z.ZodNumber;
@@ -1060,4 +1112,7 @@ export type Effectiveness = z.infer<typeof effectivenessSchema>;
1060
1112
  export type LearnedPattern = z.infer<typeof learnedPatternSchema>;
1061
1113
  export type AutonomousMonitoringStatsAttributes = z.infer<typeof autonomousMonitoringStatsAttributesSchema>;
1062
1114
  export type AutonomousMonitoringStatsResponse = z.infer<typeof autonomousMonitoringStatsResponseSchema>;
1115
+ export type AdminCreateUserAttributes = z.infer<typeof adminCreateUserAttributesSchema>;
1116
+ export type AdminCreateUserInput = z.infer<typeof adminCreateUserSchema>;
1117
+ export type AdminCreateUserResponse = z.infer<typeof userResponseSchema>;
1063
1118
  //# sourceMappingURL=admin.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/admin.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AAGH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AAGH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAGH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAM/B,CAAC;AAGH,eAAO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AAC,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAC;AACF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -1,8 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { createJsonApiResourceSchema, jsonApiSingleResponseSchema, } from './common.schemas';
3
+ import { signupAttributesSchema } from './auth.schemas';
3
4
  /**
4
5
  * Admin schemas for autonomous monitoring analytics
5
6
  */
7
+ // Admin create-user attributes (same rules as public signup)
8
+ export const adminCreateUserAttributesSchema = signupAttributesSchema;
9
+ export const adminCreateUserSchema = z.object({
10
+ type: z.literal('users'),
11
+ attributes: adminCreateUserAttributesSchema,
12
+ });
6
13
  // Source statistics
7
14
  export const sourceStatsSchema = z.object({
8
15
  recommendations: z.number(),
@@ -31,6 +31,8 @@ export declare const organizationAttributesSchema: z.ZodObject<{
31
31
  logo: string | null;
32
32
  commodityCommissionRate: number | null;
33
33
  }>;
34
+ /** Where to apply a new commodity commission rate. Paid deals are never rewritten. */
35
+ export declare const commodityCommissionApplyToSchema: z.ZodEnum<["future", "open_and_future"]>;
34
36
  export declare const createOrganizationAttributesSchema: z.ZodObject<{
35
37
  name: z.ZodString;
36
38
  email: z.ZodOptional<z.ZodString>;
@@ -60,6 +62,14 @@ export declare const updateOrganizationAttributesSchema: z.ZodObject<{
60
62
  address: z.ZodOptional<z.ZodOptional<z.ZodString>>;
61
63
  logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
62
64
  commodityCommissionRate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
65
+ } & {
66
+ /**
67
+ * When updating commodityCommissionRate:
68
+ * - future: org default only (new deals)
69
+ * - open_and_future: org default + snapshot onto currently open (non-paid) deals
70
+ * Defaults to future when omitted.
71
+ */
72
+ commodityCommissionApplyTo: z.ZodOptional<z.ZodEnum<["future", "open_and_future"]>>;
63
73
  }, "strip", z.ZodTypeAny, {
64
74
  email?: string | undefined;
65
75
  name?: string | undefined;
@@ -67,6 +77,7 @@ export declare const updateOrganizationAttributesSchema: z.ZodObject<{
67
77
  address?: string | undefined;
68
78
  logo?: string | undefined;
69
79
  commodityCommissionRate?: number | undefined;
80
+ commodityCommissionApplyTo?: "future" | "open_and_future" | undefined;
70
81
  }, {
71
82
  email?: string | undefined;
72
83
  name?: string | undefined;
@@ -74,6 +85,7 @@ export declare const updateOrganizationAttributesSchema: z.ZodObject<{
74
85
  address?: string | undefined;
75
86
  logo?: string | undefined;
76
87
  commodityCommissionRate?: number | undefined;
88
+ commodityCommissionApplyTo?: "future" | "open_and_future" | undefined;
77
89
  }>;
78
90
  export declare const createOrganizationSchema: z.ZodObject<{
79
91
  type: z.ZodLiteral<"organizations">;
@@ -130,6 +142,14 @@ export declare const updateOrganizationSchema: z.ZodObject<{
130
142
  address: z.ZodOptional<z.ZodOptional<z.ZodString>>;
131
143
  logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
132
144
  commodityCommissionRate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
145
+ } & {
146
+ /**
147
+ * When updating commodityCommissionRate:
148
+ * - future: org default only (new deals)
149
+ * - open_and_future: org default + snapshot onto currently open (non-paid) deals
150
+ * Defaults to future when omitted.
151
+ */
152
+ commodityCommissionApplyTo: z.ZodOptional<z.ZodEnum<["future", "open_and_future"]>>;
133
153
  }, "strip", z.ZodTypeAny, {
134
154
  email?: string | undefined;
135
155
  name?: string | undefined;
@@ -137,6 +157,7 @@ export declare const updateOrganizationSchema: z.ZodObject<{
137
157
  address?: string | undefined;
138
158
  logo?: string | undefined;
139
159
  commodityCommissionRate?: number | undefined;
160
+ commodityCommissionApplyTo?: "future" | "open_and_future" | undefined;
140
161
  }, {
141
162
  email?: string | undefined;
142
163
  name?: string | undefined;
@@ -144,6 +165,7 @@ export declare const updateOrganizationSchema: z.ZodObject<{
144
165
  address?: string | undefined;
145
166
  logo?: string | undefined;
146
167
  commodityCommissionRate?: number | undefined;
168
+ commodityCommissionApplyTo?: "future" | "open_and_future" | undefined;
147
169
  }>;
148
170
  }, "strip", z.ZodTypeAny, {
149
171
  type: "organizations";
@@ -154,6 +176,7 @@ export declare const updateOrganizationSchema: z.ZodObject<{
154
176
  address?: string | undefined;
155
177
  logo?: string | undefined;
156
178
  commodityCommissionRate?: number | undefined;
179
+ commodityCommissionApplyTo?: "future" | "open_and_future" | undefined;
157
180
  };
158
181
  id?: string | undefined;
159
182
  }, {
@@ -165,6 +188,7 @@ export declare const updateOrganizationSchema: z.ZodObject<{
165
188
  address?: string | undefined;
166
189
  logo?: string | undefined;
167
190
  commodityCommissionRate?: number | undefined;
191
+ commodityCommissionApplyTo?: "future" | "open_and_future" | undefined;
168
192
  };
169
193
  id?: string | undefined;
170
194
  }>;
@@ -536,6 +560,7 @@ export declare const organizationListResponseSchema: z.ZodObject<{
536
560
  meta?: Record<string, unknown> | undefined;
537
561
  }[] | undefined;
538
562
  }>;
563
+ export type CommodityCommissionApplyTo = z.infer<typeof commodityCommissionApplyToSchema>;
539
564
  export type CreateOrganizationAttributes = z.infer<typeof createOrganizationAttributesSchema>;
540
565
  export type UpdateOrganizationAttributes = z.infer<typeof updateOrganizationAttributesSchema>;
541
566
  export type CreateOrganizationInput = z.infer<typeof createOrganizationSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"organizations.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/organizations.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;GAEG;AAGH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOf,CAAC;AAG3B,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;EAO7C,CAAC;AAGH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;EAA+C,CAAC;AAG/F,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGnC,CAAC;AAGH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInC,CAAC;AAGH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6E,CAAC;AAGrH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA0D,CAAC;AAClG,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8D,CAAC;AAG1G,MAAM,MAAM,4BAA4B,GAAG,CA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;;;;;;;;;;;;;;;;;;;;EAA6D,CAAC;AAGxG,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAC5F,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAC5F,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
@@ -12,6 +12,8 @@ export const organizationAttributesSchema = z.object({
12
12
  logo: z.string().url().nullable(),
13
13
  commodityCommissionRate: z.number().min(0).max(100).nullable(),
14
14
  }).merge(timestampsSchema);
15
+ /** Where to apply a new commodity commission rate. Paid deals are never rewritten. */
16
+ export const commodityCommissionApplyToSchema = z.enum(['future', 'open_and_future']);
15
17
  // Organization attributes for creation (input)
16
18
  export const createOrganizationAttributesSchema = z.object({
17
19
  name: z.string().min(1).max(200),
@@ -22,7 +24,17 @@ export const createOrganizationAttributesSchema = z.object({
22
24
  commodityCommissionRate: z.number().min(0).max(100).optional(),
23
25
  });
24
26
  // Organization attributes for update (input)
25
- export const updateOrganizationAttributesSchema = createOrganizationAttributesSchema.partial();
27
+ export const updateOrganizationAttributesSchema = createOrganizationAttributesSchema
28
+ .partial()
29
+ .extend({
30
+ /**
31
+ * When updating commodityCommissionRate:
32
+ * - future: org default only (new deals)
33
+ * - open_and_future: org default + snapshot onto currently open (non-paid) deals
34
+ * Defaults to future when omitted.
35
+ */
36
+ commodityCommissionApplyTo: commodityCommissionApplyToSchema.optional(),
37
+ });
26
38
  // Create organization input (JSON:API format)
27
39
  export const createOrganizationSchema = z.object({
28
40
  type: z.literal('organizations'),