@deepintel-ltd/farmpro-contracts 1.25.1 → 1.26.0

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.
Files changed (47) hide show
  1. package/dist/routes/commodity-deals.routes.d.ts +10 -0
  2. package/dist/routes/commodity-deals.routes.d.ts.map +1 -1
  3. package/dist/routes/commodity-deals.routes.js +1 -0
  4. package/dist/routes/farm-enterprises.routes.d.ts +44 -44
  5. package/dist/routes/farms.routes.d.ts +9 -9
  6. package/dist/routes/geofences.routes.d.ts +2 -2
  7. package/dist/routes/livestock-groups.routes.d.ts +724 -54
  8. package/dist/routes/livestock-groups.routes.d.ts.map +1 -1
  9. package/dist/routes/livestock-groups.routes.js +17 -1
  10. package/dist/routes/livestock.routes.d.ts +3505 -42
  11. package/dist/routes/livestock.routes.d.ts.map +1 -1
  12. package/dist/routes/livestock.routes.js +111 -1
  13. package/dist/routes/organizations.routes.d.ts +122 -14
  14. package/dist/routes/organizations.routes.d.ts.map +1 -1
  15. package/dist/routes/organizations.routes.js +1 -0
  16. package/dist/routes/prescription-maps.routes.d.ts +279 -136
  17. package/dist/routes/prescription-maps.routes.d.ts.map +1 -1
  18. package/dist/routes/prescription-maps.routes.js +2 -1
  19. package/dist/routes/team.routes.d.ts +44 -44
  20. package/dist/routes/trade-cash-events.routes.d.ts +7668 -559
  21. package/dist/routes/trade-cash-events.routes.d.ts.map +1 -1
  22. package/dist/routes/trade-cash-events.routes.js +148 -2
  23. package/dist/schemas/farm-enterprises.schemas.d.ts +58 -58
  24. package/dist/schemas/farm-enterprises.schemas.d.ts.map +1 -1
  25. package/dist/schemas/farm-enterprises.schemas.js +1 -0
  26. package/dist/schemas/farms.schemas.d.ts +12 -12
  27. package/dist/schemas/farms.schemas.js +1 -1
  28. package/dist/schemas/geofences.schemas.d.ts +4 -4
  29. package/dist/schemas/livestock-groups.schemas.d.ts +166 -40
  30. package/dist/schemas/livestock-groups.schemas.d.ts.map +1 -1
  31. package/dist/schemas/livestock-groups.schemas.js +25 -0
  32. package/dist/schemas/livestock.schemas.d.ts +1796 -36
  33. package/dist/schemas/livestock.schemas.d.ts.map +1 -1
  34. package/dist/schemas/livestock.schemas.js +129 -0
  35. package/dist/schemas/organizations.schemas.d.ts +104 -16
  36. package/dist/schemas/organizations.schemas.d.ts.map +1 -1
  37. package/dist/schemas/organizations.schemas.js +8 -1
  38. package/dist/schemas/prescription-maps.schemas.d.ts +267 -134
  39. package/dist/schemas/prescription-maps.schemas.d.ts.map +1 -1
  40. package/dist/schemas/prescription-maps.schemas.js +6 -2
  41. package/dist/schemas/team.schemas.d.ts +43 -43
  42. package/dist/schemas/team.schemas.d.ts.map +1 -1
  43. package/dist/schemas/team.schemas.js +1 -0
  44. package/dist/schemas/trade-cash-events.schemas.d.ts +2605 -68
  45. package/dist/schemas/trade-cash-events.schemas.d.ts.map +1 -1
  46. package/dist/schemas/trade-cash-events.schemas.js +204 -0
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"trade-cash-events.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/trade-cash-events.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,wBAAwB,oGAMnC,CAAC;AAEH,eAAO,MAAM,wBAAwB,0EAOnC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBjB,CAAC;AAE3B,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa/C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;EAGzC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGhC,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,qCAAqC,CAC7C,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,wCAAwC,CAChD,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -6,6 +6,11 @@ export const tradeCashEventTypeSchema = z.enum([
6
6
  'commission_payout',
7
7
  'supplier_payment',
8
8
  'buyer_receipt',
9
+ 'advance_disburse',
10
+ 'advance_handoff',
11
+ 'advance_settle',
12
+ 'advance_return',
13
+ 'advance_writeoff',
9
14
  ]);
10
15
  export const tradeCashPartyTypeSchema = z.enum([
11
16
  'investor',
@@ -14,6 +19,31 @@ export const tradeCashPartyTypeSchema = z.enum([
14
19
  'buyer',
15
20
  'broker',
16
21
  'other',
22
+ 'company',
23
+ ]);
24
+ export const tradeCashFunderTypeSchema = z.enum([
25
+ 'company',
26
+ 'staff',
27
+ 'investor',
28
+ 'unattributed',
29
+ ]);
30
+ export const tradeSourcingAdvanceStatusSchema = z.enum([
31
+ 'pending_receipt',
32
+ 'open',
33
+ 'settled',
34
+ 'written_off',
35
+ 'cancelled',
36
+ ]);
37
+ export const tradeSourcingAdvanceHolderTypeSchema = z.enum([
38
+ 'staff',
39
+ 'supplier',
40
+ 'other',
41
+ ]);
42
+ export const advanceSettlementOutcomeSchema = z.enum([
43
+ 'spent',
44
+ 'returned',
45
+ 'written_off',
46
+ 'overspend',
17
47
  ]);
18
48
  export const tradeCashEventAttributesSchema = z
19
49
  .object({
@@ -30,6 +60,13 @@ export const tradeCashEventAttributesSchema = z
30
60
  dealId: z.string().uuid().nullable().optional(),
31
61
  invoiceId: z.string().uuid().nullable().optional(),
32
62
  notes: z.string().nullable().optional(),
63
+ funderType: tradeCashFunderTypeSchema.optional().default('unattributed'),
64
+ funderId: z.string().max(100).nullable().optional(),
65
+ funderName: z.string().max(200).nullable().optional(),
66
+ advanceId: z.string().uuid().nullable().optional(),
67
+ voidedAt: z.string().datetime().nullable().optional(),
68
+ voidedById: z.string().uuid().nullable().optional(),
69
+ voidReason: z.string().nullable().optional(),
33
70
  })
34
71
  .merge(timestampsSchema);
35
72
  export const createTradeCashEventAttributesSchema = z.object({
@@ -45,6 +82,14 @@ export const createTradeCashEventAttributesSchema = z.object({
45
82
  dealId: z.string().uuid().optional().nullable(),
46
83
  invoiceId: z.string().uuid().optional().nullable(),
47
84
  notes: z.string().optional().nullable(),
85
+ /** Required for supplier_payment and advance events; derived for capital_in/out. */
86
+ funderType: tradeCashFunderTypeSchema.optional(),
87
+ funderId: z.string().max(100).optional().nullable(),
88
+ funderName: z.string().max(200).optional().nullable(),
89
+ advanceId: z.string().uuid().optional().nullable(),
90
+ });
91
+ export const voidTradeCashEventAttributesSchema = z.object({
92
+ reason: z.string().min(1).max(500),
48
93
  });
49
94
  export const tradeCashEventResourceSchema = createJsonApiResourceSchema('trade-cash-events', tradeCashEventAttributesSchema);
50
95
  export const tradeCashEventResponseSchema = jsonApiSingleResponseSchema(tradeCashEventResourceSchema);
@@ -53,6 +98,10 @@ export const createTradeCashEventSchema = z.object({
53
98
  type: z.literal('trade-cash-events'),
54
99
  attributes: createTradeCashEventAttributesSchema,
55
100
  });
101
+ export const voidTradeCashEventSchema = z.object({
102
+ type: z.literal('trade-cash-events'),
103
+ attributes: voidTradeCashEventAttributesSchema,
104
+ });
56
105
  export const investorBalanceAttributesSchema = z.object({
57
106
  partyId: z.string(),
58
107
  partyName: z.string().nullable().optional(),
@@ -70,6 +119,65 @@ export const investorBalancesResponseSchema = z.object({
70
119
  }),
71
120
  }),
72
121
  });
122
+ export const funderBreakdownSchema = z.object({
123
+ funderType: tradeCashFunderTypeSchema,
124
+ funderId: z.string().nullable().optional(),
125
+ funderName: z.string().nullable().optional(),
126
+ amount: z.number(),
127
+ });
128
+ export const advancePositionSchema = z.object({
129
+ advanceId: z.string().uuid(),
130
+ holderType: tradeSourcingAdvanceHolderTypeSchema,
131
+ holderId: z.string().nullable().optional(),
132
+ holderName: z.string(),
133
+ funderType: tradeCashFunderTypeSchema,
134
+ funderId: z.string().nullable().optional(),
135
+ funderName: z.string().nullable().optional(),
136
+ remaining: z.number(),
137
+ amount: z.number(),
138
+ status: tradeSourcingAdvanceStatusSchema,
139
+ openedAt: z.string().datetime(),
140
+ expectedSettleBy: z.string().datetime().nullable().optional(),
141
+ overdue: z.boolean(),
142
+ ageDays: z.number(),
143
+ });
144
+ export const tradeTreasuryAttributesSchema = z.object({
145
+ asOf: z.string().datetime(),
146
+ computedAt: z.string().datetime(),
147
+ currency: z.string().length(3),
148
+ received: z.number(),
149
+ returnedToFunders: z.number(),
150
+ available: z.number(),
151
+ inSourcing: z.number(),
152
+ unallocatedSpend: z.number(),
153
+ goodsNotDelivered: z.number(),
154
+ deliveredUnpaid: z.number(),
155
+ receivable: z.number(),
156
+ capitalOutstanding: z.number(),
157
+ buyerReceipts: z.number(),
158
+ /** received − returned vs available + capitalOutstanding */
159
+ reconciliation: z.object({
160
+ capitalBase: z.number(),
161
+ deployedAndHeld: z.number(),
162
+ profitLossAndCostsRetained: z.number(),
163
+ }),
164
+ byFunder: z.object({
165
+ received: z.array(funderBreakdownSchema),
166
+ returned: z.array(funderBreakdownSchema),
167
+ inSourcing: z.array(funderBreakdownSchema),
168
+ unallocatedSpend: z.array(funderBreakdownSchema),
169
+ goodsNotDelivered: z.array(funderBreakdownSchema),
170
+ deliveredUnpaid: z.array(funderBreakdownSchema),
171
+ }),
172
+ openAdvances: z.array(advancePositionSchema),
173
+ });
174
+ export const tradeTreasuryResponseSchema = z.object({
175
+ data: z.object({
176
+ type: z.literal('trade-treasury'),
177
+ id: z.string(),
178
+ attributes: tradeTreasuryAttributesSchema,
179
+ }),
180
+ });
73
181
  export const tradeControlBoardResponseSchema = z.object({
74
182
  data: z.object({
75
183
  type: z.literal('trade-control-board'),
@@ -130,3 +238,99 @@ export const createInvoicePaymentSchema = z.object({
130
238
  type: z.literal('invoice-payments'),
131
239
  attributes: createInvoicePaymentAttributesSchema,
132
240
  });
241
+ // ── Sourcing advances ────────────────────────────────────────────────────────
242
+ export const tradeSourcingAdvanceAttributesSchema = z
243
+ .object({
244
+ organizationId: z.string().uuid(),
245
+ holderType: tradeSourcingAdvanceHolderTypeSchema,
246
+ holderId: z.string().max(100).nullable().optional(),
247
+ holderName: z.string().max(200),
248
+ funderType: tradeCashFunderTypeSchema,
249
+ funderId: z.string().max(100).nullable().optional(),
250
+ funderName: z.string().max(200).nullable().optional(),
251
+ parentAdvanceId: z.string().uuid().nullable().optional(),
252
+ amount: z.number().positive(),
253
+ remaining: z.number(),
254
+ currency: z.string().length(3).default('NGN'),
255
+ status: tradeSourcingAdvanceStatusSchema,
256
+ expectedSettleBy: z.string().datetime().nullable().optional(),
257
+ dealId: z.string().uuid().nullable().optional(),
258
+ purchaseOrderId: z.string().uuid().nullable().optional(),
259
+ purpose: z.string().max(500).nullable().optional(),
260
+ notes: z.string().nullable().optional(),
261
+ confirmedAt: z.string().datetime().nullable().optional(),
262
+ overdue: z.boolean().optional(),
263
+ })
264
+ .merge(timestampsSchema);
265
+ export const createSourcingAdvanceAttributesSchema = z.object({
266
+ holderType: tradeSourcingAdvanceHolderTypeSchema,
267
+ holderId: z.string().max(100).optional().nullable(),
268
+ holderName: z.string().min(1).max(200),
269
+ funderType: z.enum(['company', 'staff', 'investor']),
270
+ funderId: z.string().max(100).optional().nullable(),
271
+ funderName: z.string().max(200).optional().nullable(),
272
+ amount: z.number().positive(),
273
+ currency: z.string().length(3).optional().default('NGN'),
274
+ occurredAt: z.string().datetime(),
275
+ expectedSettleBy: z.string().datetime().optional().nullable(),
276
+ dealId: z.string().uuid().optional().nullable(),
277
+ purchaseOrderId: z.string().uuid().optional().nullable(),
278
+ purpose: z.string().max(500).optional().nullable(),
279
+ notes: z.string().optional().nullable(),
280
+ method: z.string().max(100).optional().nullable(),
281
+ reference: z.string().max(200).optional().nullable(),
282
+ });
283
+ export const handoffAdvanceAttributesSchema = z.object({
284
+ amount: z.number().positive(),
285
+ holderType: tradeSourcingAdvanceHolderTypeSchema,
286
+ holderId: z.string().max(100).optional().nullable(),
287
+ holderName: z.string().min(1).max(200),
288
+ occurredAt: z.string().datetime(),
289
+ notes: z.string().optional().nullable(),
290
+ });
291
+ export const advanceSettlementLineSchema = z.object({
292
+ outcome: advanceSettlementOutcomeSchema,
293
+ amount: z.number().positive(),
294
+ supplierName: z.string().max(200).optional().nullable(),
295
+ supplierId: z.string().max(100).optional().nullable(),
296
+ dealId: z.string().uuid().optional().nullable(),
297
+ purchaseOrderId: z.string().uuid().optional().nullable(),
298
+ proofRef: z.string().max(200).optional().nullable(),
299
+ notes: z.string().optional().nullable(),
300
+ });
301
+ export const submitAdvanceSettlementAttributesSchema = z.object({
302
+ lines: z.array(advanceSettlementLineSchema).min(1),
303
+ notes: z.string().optional().nullable(),
304
+ });
305
+ export const approveAdvanceSettlementAttributesSchema = z.object({
306
+ occurredAt: z.string().datetime(),
307
+ notes: z.string().optional().nullable(),
308
+ });
309
+ export const writeoffAdvanceAttributesSchema = z.object({
310
+ amount: z.number().positive(),
311
+ reason: z.string().min(1).max(500),
312
+ occurredAt: z.string().datetime(),
313
+ });
314
+ export const tradeSourcingAdvanceResourceSchema = createJsonApiResourceSchema('trade-sourcing-advances', tradeSourcingAdvanceAttributesSchema);
315
+ export const tradeSourcingAdvanceResponseSchema = jsonApiSingleResponseSchema(tradeSourcingAdvanceResourceSchema);
316
+ export const tradeSourcingAdvanceListResponseSchema = jsonApiCollectionResponseSchema(tradeSourcingAdvanceResourceSchema);
317
+ export const createSourcingAdvanceSchema = z.object({
318
+ type: z.literal('trade-sourcing-advances'),
319
+ attributes: createSourcingAdvanceAttributesSchema,
320
+ });
321
+ export const handoffAdvanceSchema = z.object({
322
+ type: z.literal('trade-sourcing-advances'),
323
+ attributes: handoffAdvanceAttributesSchema,
324
+ });
325
+ export const submitAdvanceSettlementSchema = z.object({
326
+ type: z.literal('trade-sourcing-settlement-requests'),
327
+ attributes: submitAdvanceSettlementAttributesSchema,
328
+ });
329
+ export const approveAdvanceSettlementSchema = z.object({
330
+ type: z.literal('trade-sourcing-settlement-requests'),
331
+ attributes: approveAdvanceSettlementAttributesSchema,
332
+ });
333
+ export const writeoffAdvanceSchema = z.object({
334
+ type: z.literal('trade-sourcing-advances'),
335
+ attributes: writeoffAdvanceAttributesSchema,
336
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepintel-ltd/farmpro-contracts",
3
- "version": "1.25.1",
3
+ "version": "1.26.0",
4
4
  "description": "Type-safe API contracts for FarmPro API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",