@deepintel-ltd/farmpro-contracts 1.22.4 → 1.23.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 (40) 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/commodity-deals.routes.d.ts +175 -0
  5. package/dist/routes/commodity-deals.routes.d.ts.map +1 -1
  6. package/dist/routes/index.d.ts +9 -0
  7. package/dist/routes/index.d.ts.map +1 -1
  8. package/dist/routes/index.js +6 -0
  9. package/dist/routes/invoices.routes.d.ts +189 -42
  10. package/dist/routes/invoices.routes.d.ts.map +1 -1
  11. package/dist/routes/organization-capabilities.routes.d.ts +1671 -0
  12. package/dist/routes/organization-capabilities.routes.d.ts.map +1 -0
  13. package/dist/routes/organization-capabilities.routes.js +74 -0
  14. package/dist/routes/purchase-orders.routes.d.ts +2061 -0
  15. package/dist/routes/purchase-orders.routes.d.ts.map +1 -0
  16. package/dist/routes/purchase-orders.routes.js +55 -0
  17. package/dist/routes/trade-cash-events.routes.d.ts +3837 -0
  18. package/dist/routes/trade-cash-events.routes.d.ts.map +1 -0
  19. package/dist/routes/trade-cash-events.routes.js +126 -0
  20. package/dist/routes/waybills.routes.d.ts +210 -0
  21. package/dist/routes/waybills.routes.d.ts.map +1 -1
  22. package/dist/schemas/commodity-deals.schemas.d.ts +98 -0
  23. package/dist/schemas/commodity-deals.schemas.d.ts.map +1 -1
  24. package/dist/schemas/commodity-deals.schemas.js +7 -0
  25. package/dist/schemas/invoices.schemas.d.ts +144 -30
  26. package/dist/schemas/invoices.schemas.d.ts.map +1 -1
  27. package/dist/schemas/invoices.schemas.js +8 -2
  28. package/dist/schemas/organization-capabilities.schemas.d.ts +355 -0
  29. package/dist/schemas/organization-capabilities.schemas.d.ts.map +1 -0
  30. package/dist/schemas/organization-capabilities.schemas.js +19 -0
  31. package/dist/schemas/purchase-orders.schemas.d.ts +1031 -0
  32. package/dist/schemas/purchase-orders.schemas.d.ts.map +1 -0
  33. package/dist/schemas/purchase-orders.schemas.js +49 -0
  34. package/dist/schemas/trade-cash-events.schemas.d.ts +1524 -0
  35. package/dist/schemas/trade-cash-events.schemas.d.ts.map +1 -0
  36. package/dist/schemas/trade-cash-events.schemas.js +131 -0
  37. package/dist/schemas/waybills.schemas.d.ts +168 -0
  38. package/dist/schemas/waybills.schemas.d.ts.map +1 -1
  39. package/dist/schemas/waybills.schemas.js +9 -0
  40. 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
+ });