@deepintel-ltd/farmpro-contracts 1.22.4 → 1.23.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.
Files changed (80) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -0
  4. package/dist/routes/categories.routes.d.ts +26 -26
  5. package/dist/routes/commodity-deals.routes.d.ts +217 -42
  6. package/dist/routes/commodity-deals.routes.d.ts.map +1 -1
  7. package/dist/routes/crop-profile.routes.d.ts +8 -8
  8. package/dist/routes/farm-enterprises.routes.d.ts +395 -0
  9. package/dist/routes/farm-enterprises.routes.d.ts.map +1 -1
  10. package/dist/routes/farm-enterprises.routes.js +14 -1
  11. package/dist/routes/farms.routes.d.ts +73 -20
  12. package/dist/routes/farms.routes.d.ts.map +1 -1
  13. package/dist/routes/fertigation.routes.d.ts +96 -96
  14. package/dist/routes/field-monitoring.routes.d.ts +2 -2
  15. package/dist/routes/finance.routes.d.ts +8 -8
  16. package/dist/routes/index.d.ts +9 -0
  17. package/dist/routes/index.d.ts.map +1 -1
  18. package/dist/routes/index.js +6 -0
  19. package/dist/routes/invoices.routes.d.ts +210 -60
  20. package/dist/routes/invoices.routes.d.ts.map +1 -1
  21. package/dist/routes/invoices.routes.js +4 -1
  22. package/dist/routes/monitoring-visualization.routes.d.ts +2 -2
  23. package/dist/routes/notifications.routes.d.ts +12 -12
  24. package/dist/routes/organization-capabilities.routes.d.ts +1671 -0
  25. package/dist/routes/organization-capabilities.routes.d.ts.map +1 -0
  26. package/dist/routes/organization-capabilities.routes.js +74 -0
  27. package/dist/routes/organizations.routes.d.ts +90 -47
  28. package/dist/routes/organizations.routes.d.ts.map +1 -1
  29. package/dist/routes/purchase-orders.routes.d.ts +2061 -0
  30. package/dist/routes/purchase-orders.routes.d.ts.map +1 -0
  31. package/dist/routes/purchase-orders.routes.js +55 -0
  32. package/dist/routes/suppliers.routes.d.ts +96 -96
  33. package/dist/routes/team-payments.routes.d.ts +105 -105
  34. package/dist/routes/team.routes.d.ts +125 -25
  35. package/dist/routes/team.routes.d.ts.map +1 -1
  36. package/dist/routes/trade-cash-events.routes.d.ts +3837 -0
  37. package/dist/routes/trade-cash-events.routes.d.ts.map +1 -0
  38. package/dist/routes/trade-cash-events.routes.js +126 -0
  39. package/dist/routes/waybills.routes.d.ts +229 -15
  40. package/dist/routes/waybills.routes.d.ts.map +1 -1
  41. package/dist/routes/waybills.routes.js +4 -1
  42. package/dist/schemas/categories.schemas.d.ts +21 -21
  43. package/dist/schemas/commodity-deals.schemas.d.ts +116 -18
  44. package/dist/schemas/commodity-deals.schemas.d.ts.map +1 -1
  45. package/dist/schemas/commodity-deals.schemas.js +7 -0
  46. package/dist/schemas/crop-profile.schemas.d.ts +12 -12
  47. package/dist/schemas/farm-enterprises.schemas.d.ts +185 -0
  48. package/dist/schemas/farm-enterprises.schemas.d.ts.map +1 -1
  49. package/dist/schemas/farm-enterprises.schemas.js +21 -0
  50. package/dist/schemas/farms.schemas.d.ts +121 -19
  51. package/dist/schemas/farms.schemas.d.ts.map +1 -1
  52. package/dist/schemas/farms.schemas.js +15 -1
  53. package/dist/schemas/fertigation.schemas.d.ts +36 -36
  54. package/dist/schemas/field-monitoring.schemas.d.ts +2 -2
  55. package/dist/schemas/finance.schemas.d.ts +8 -8
  56. package/dist/schemas/invoices.schemas.d.ts +153 -39
  57. package/dist/schemas/invoices.schemas.d.ts.map +1 -1
  58. package/dist/schemas/invoices.schemas.js +8 -2
  59. package/dist/schemas/notifications.schemas.d.ts +18 -18
  60. package/dist/schemas/organization-capabilities.schemas.d.ts +355 -0
  61. package/dist/schemas/organization-capabilities.schemas.d.ts.map +1 -0
  62. package/dist/schemas/organization-capabilities.schemas.js +19 -0
  63. package/dist/schemas/organizations.schemas.d.ts +105 -46
  64. package/dist/schemas/organizations.schemas.d.ts.map +1 -1
  65. package/dist/schemas/organizations.schemas.js +8 -1
  66. package/dist/schemas/purchase-orders.schemas.d.ts +1031 -0
  67. package/dist/schemas/purchase-orders.schemas.d.ts.map +1 -0
  68. package/dist/schemas/purchase-orders.schemas.js +49 -0
  69. package/dist/schemas/suppliers.schemas.d.ts +96 -96
  70. package/dist/schemas/team-payments.schemas.d.ts +87 -87
  71. package/dist/schemas/team.schemas.d.ts +137 -20
  72. package/dist/schemas/team.schemas.d.ts.map +1 -1
  73. package/dist/schemas/team.schemas.js +29 -1
  74. package/dist/schemas/trade-cash-events.schemas.d.ts +1524 -0
  75. package/dist/schemas/trade-cash-events.schemas.d.ts.map +1 -0
  76. package/dist/schemas/trade-cash-events.schemas.js +131 -0
  77. package/dist/schemas/waybills.schemas.d.ts +177 -9
  78. package/dist/schemas/waybills.schemas.d.ts.map +1 -1
  79. package/dist/schemas/waybills.schemas.js +9 -0
  80. package/package.json +1 -1
@@ -0,0 +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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eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE5C,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGrC,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"}
@@ -0,0 +1,131 @@
1
+ import { z } from 'zod';
2
+ import { timestampsSchema, createJsonApiResourceSchema, jsonApiSingleResponseSchema, jsonApiCollectionResponseSchema, } from './common.schemas';
3
+ export const tradeCashEventTypeSchema = z.enum([
4
+ 'capital_in',
5
+ 'capital_out',
6
+ 'commission_payout',
7
+ 'supplier_payment',
8
+ 'buyer_receipt',
9
+ ]);
10
+ export const tradeCashPartyTypeSchema = z.enum([
11
+ 'investor',
12
+ 'staff',
13
+ 'supplier',
14
+ 'buyer',
15
+ 'broker',
16
+ 'other',
17
+ ]);
18
+ export const tradeCashEventAttributesSchema = z
19
+ .object({
20
+ organizationId: z.string().uuid(),
21
+ type: tradeCashEventTypeSchema,
22
+ partyType: tradeCashPartyTypeSchema,
23
+ partyId: z.string().min(1).max(100),
24
+ partyName: z.string().max(200).nullable().optional(),
25
+ amount: z.number().positive(),
26
+ currency: z.string().length(3).default('NGN'),
27
+ occurredAt: z.string().datetime(),
28
+ method: z.string().max(100).nullable().optional(),
29
+ reference: z.string().max(200).nullable().optional(),
30
+ dealId: z.string().uuid().nullable().optional(),
31
+ invoiceId: z.string().uuid().nullable().optional(),
32
+ notes: z.string().nullable().optional(),
33
+ })
34
+ .merge(timestampsSchema);
35
+ export const createTradeCashEventAttributesSchema = z.object({
36
+ type: tradeCashEventTypeSchema,
37
+ partyType: tradeCashPartyTypeSchema,
38
+ partyId: z.string().min(1).max(100),
39
+ partyName: z.string().max(200).optional().nullable(),
40
+ amount: z.number().positive(),
41
+ currency: z.string().length(3).optional().default('NGN'),
42
+ occurredAt: z.string().datetime(),
43
+ method: z.string().max(100).optional().nullable(),
44
+ reference: z.string().max(200).optional().nullable(),
45
+ dealId: z.string().uuid().optional().nullable(),
46
+ invoiceId: z.string().uuid().optional().nullable(),
47
+ notes: z.string().optional().nullable(),
48
+ });
49
+ export const tradeCashEventResourceSchema = createJsonApiResourceSchema('trade-cash-events', tradeCashEventAttributesSchema);
50
+ export const tradeCashEventResponseSchema = jsonApiSingleResponseSchema(tradeCashEventResourceSchema);
51
+ export const tradeCashEventListResponseSchema = jsonApiCollectionResponseSchema(tradeCashEventResourceSchema);
52
+ export const createTradeCashEventSchema = z.object({
53
+ type: z.literal('trade-cash-events'),
54
+ attributes: createTradeCashEventAttributesSchema,
55
+ });
56
+ export const investorBalanceAttributesSchema = z.object({
57
+ partyId: z.string(),
58
+ partyName: z.string().nullable().optional(),
59
+ capitalIn: z.number(),
60
+ capitalOut: z.number(),
61
+ balance: z.number(),
62
+ dealCount: z.number().optional(),
63
+ });
64
+ export const investorBalancesResponseSchema = z.object({
65
+ data: z.object({
66
+ type: z.literal('investor-balances'),
67
+ id: z.string(),
68
+ attributes: z.object({
69
+ balances: z.array(investorBalanceAttributesSchema),
70
+ }),
71
+ }),
72
+ });
73
+ export const tradeControlBoardResponseSchema = z.object({
74
+ data: z.object({
75
+ type: z.literal('trade-control-board'),
76
+ id: z.string(),
77
+ attributes: z.object({
78
+ periodStart: z.string().datetime().nullable(),
79
+ periodEnd: z.string().datetime().nullable(),
80
+ purchaseTotal: z.number(),
81
+ transportTotal: z.number(),
82
+ storageTotal: z.number(),
83
+ miscellaneousTotal: z.number(),
84
+ saleTotal: z.number(),
85
+ buyerReceipts: z.number(),
86
+ supplierPayments: z.number(),
87
+ commissionPayouts: z.number(),
88
+ capitalIn: z.number(),
89
+ capitalOut: z.number(),
90
+ grossProfit: z.number(),
91
+ dealCount: z.number(),
92
+ byBuyer: z.array(z.object({
93
+ buyerName: z.string(),
94
+ saleTotal: z.number(),
95
+ dealCount: z.number(),
96
+ })),
97
+ bySupplier: z.array(z.object({
98
+ supplierName: z.string(),
99
+ purchaseTotal: z.number(),
100
+ dealCount: z.number(),
101
+ })),
102
+ }),
103
+ }),
104
+ });
105
+ export const invoicePaymentAttributesSchema = z
106
+ .object({
107
+ organizationId: z.string().uuid(),
108
+ invoiceId: z.string().uuid(),
109
+ amount: z.number().positive(),
110
+ currency: z.string().length(3).default('NGN'),
111
+ occurredAt: z.string().datetime(),
112
+ method: z.string().max(100).nullable().optional(),
113
+ reference: z.string().max(200).nullable().optional(),
114
+ notes: z.string().nullable().optional(),
115
+ })
116
+ .merge(timestampsSchema);
117
+ export const createInvoicePaymentAttributesSchema = z.object({
118
+ amount: z.number().positive(),
119
+ currency: z.string().length(3).optional().default('NGN'),
120
+ occurredAt: z.string().datetime(),
121
+ method: z.string().max(100).optional().nullable(),
122
+ reference: z.string().max(200).optional().nullable(),
123
+ notes: z.string().optional().nullable(),
124
+ });
125
+ export const invoicePaymentResourceSchema = createJsonApiResourceSchema('invoice-payments', invoicePaymentAttributesSchema);
126
+ export const invoicePaymentResponseSchema = jsonApiSingleResponseSchema(invoicePaymentResourceSchema);
127
+ export const invoicePaymentListResponseSchema = jsonApiCollectionResponseSchema(invoicePaymentResourceSchema);
128
+ export const createInvoicePaymentSchema = z.object({
129
+ type: z.literal('invoice-payments'),
130
+ attributes: createInvoicePaymentAttributesSchema,
131
+ });