@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.routes.d.ts","sourceRoot":"","sources":["../../src/routes/trade-cash-events.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HhC,CAAC"}
@@ -0,0 +1,126 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import { createInvoicePaymentSchema, createTradeCashEventSchema, investorBalancesResponseSchema, invoicePaymentListResponseSchema, invoicePaymentResponseSchema, tradeCashEventListResponseSchema, tradeCashEventResponseSchema, tradeCashEventTypeSchema, tradeControlBoardResponseSchema, } from '../schemas/trade-cash-events.schemas';
4
+ import { jsonApiErrorResponseSchema, idParamSchema } from '../schemas/common.schemas';
5
+ const c = initContract();
6
+ const organizationIdParamSchema = z.object({
7
+ organizationId: z.string().uuid(),
8
+ });
9
+ export const tradeCashEventsRouter = c.router({
10
+ listTradeCashEvents: {
11
+ method: 'GET',
12
+ path: '/organizations/:organizationId/trade-cash-events',
13
+ pathParams: organizationIdParamSchema,
14
+ query: z.object({
15
+ type: tradeCashEventTypeSchema.optional(),
16
+ dealId: z.string().uuid().optional(),
17
+ invoiceId: z.string().uuid().optional(),
18
+ partyId: z.string().optional(),
19
+ page: z.coerce.number().int().positive().optional(),
20
+ pageSize: z.coerce.number().int().positive().max(100).optional(),
21
+ }),
22
+ responses: {
23
+ 200: tradeCashEventListResponseSchema,
24
+ 401: jsonApiErrorResponseSchema,
25
+ 403: jsonApiErrorResponseSchema,
26
+ 404: jsonApiErrorResponseSchema,
27
+ },
28
+ summary: 'List trade cash events (requires COMMODITY_TRADE pack)',
29
+ },
30
+ createTradeCashEvent: {
31
+ method: 'POST',
32
+ path: '/organizations/:organizationId/trade-cash-events',
33
+ pathParams: organizationIdParamSchema,
34
+ body: z.object({ data: createTradeCashEventSchema }),
35
+ responses: {
36
+ 201: tradeCashEventResponseSchema,
37
+ 400: jsonApiErrorResponseSchema,
38
+ 401: jsonApiErrorResponseSchema,
39
+ 403: jsonApiErrorResponseSchema,
40
+ 404: jsonApiErrorResponseSchema,
41
+ },
42
+ summary: 'Record a trade cash event',
43
+ },
44
+ deleteTradeCashEvent: {
45
+ method: 'DELETE',
46
+ path: '/organizations/:organizationId/trade-cash-events/:id',
47
+ pathParams: organizationIdParamSchema.merge(idParamSchema),
48
+ responses: {
49
+ 204: z.undefined(),
50
+ 401: jsonApiErrorResponseSchema,
51
+ 403: jsonApiErrorResponseSchema,
52
+ 404: jsonApiErrorResponseSchema,
53
+ },
54
+ summary: 'Delete a trade cash event',
55
+ },
56
+ getInvestorBalances: {
57
+ method: 'GET',
58
+ path: '/organizations/:organizationId/trade-cash-events/investor-balances',
59
+ pathParams: organizationIdParamSchema,
60
+ responses: {
61
+ 200: investorBalancesResponseSchema,
62
+ 401: jsonApiErrorResponseSchema,
63
+ 403: jsonApiErrorResponseSchema,
64
+ 404: jsonApiErrorResponseSchema,
65
+ },
66
+ summary: 'Investor capital in/out running balances',
67
+ },
68
+ getMyInvestorCash: {
69
+ method: 'GET',
70
+ path: '/organizations/:organizationId/trade-cash-events/my-investor-cash',
71
+ pathParams: organizationIdParamSchema,
72
+ responses: {
73
+ 200: investorBalancesResponseSchema,
74
+ 401: jsonApiErrorResponseSchema,
75
+ 403: jsonApiErrorResponseSchema,
76
+ 404: jsonApiErrorResponseSchema,
77
+ },
78
+ summary: 'Current user investor cash ledger summary',
79
+ },
80
+ getTradeControlBoard: {
81
+ method: 'GET',
82
+ path: '/organizations/:organizationId/trade-control-board',
83
+ pathParams: organizationIdParamSchema,
84
+ query: z.object({
85
+ from: z.string().datetime().optional(),
86
+ to: z.string().datetime().optional(),
87
+ }),
88
+ responses: {
89
+ 200: tradeControlBoardResponseSchema,
90
+ 401: jsonApiErrorResponseSchema,
91
+ 403: jsonApiErrorResponseSchema,
92
+ 404: jsonApiErrorResponseSchema,
93
+ },
94
+ summary: 'Trade desk control board (qty/money in/out)',
95
+ },
96
+ listInvoicePayments: {
97
+ method: 'GET',
98
+ path: '/organizations/:organizationId/invoices/:invoiceId/payments',
99
+ pathParams: organizationIdParamSchema.extend({
100
+ invoiceId: z.string().uuid(),
101
+ }),
102
+ responses: {
103
+ 200: invoicePaymentListResponseSchema,
104
+ 401: jsonApiErrorResponseSchema,
105
+ 403: jsonApiErrorResponseSchema,
106
+ 404: jsonApiErrorResponseSchema,
107
+ },
108
+ summary: 'List payments on an invoice',
109
+ },
110
+ createInvoicePayment: {
111
+ method: 'POST',
112
+ path: '/organizations/:organizationId/invoices/:invoiceId/payments',
113
+ pathParams: organizationIdParamSchema.extend({
114
+ invoiceId: z.string().uuid(),
115
+ }),
116
+ body: z.object({ data: createInvoicePaymentSchema }),
117
+ responses: {
118
+ 201: invoicePaymentResponseSchema,
119
+ 400: jsonApiErrorResponseSchema,
120
+ 401: jsonApiErrorResponseSchema,
121
+ 403: jsonApiErrorResponseSchema,
122
+ 404: jsonApiErrorResponseSchema,
123
+ },
124
+ summary: 'Record a (partial) buyer payment on an invoice',
125
+ },
126
+ });