@voyant-travel/finance 0.119.5

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 (294) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +192 -0
  3. package/dist/action-ledger-drift.d.ts +29 -0
  4. package/dist/action-ledger-drift.d.ts.map +1 -0
  5. package/dist/action-ledger-drift.js +166 -0
  6. package/dist/booking-tax.d.ts +124 -0
  7. package/dist/booking-tax.d.ts.map +1 -0
  8. package/dist/booking-tax.js +264 -0
  9. package/dist/checkout-routes.d.ts +1154 -0
  10. package/dist/checkout-routes.d.ts.map +1 -0
  11. package/dist/checkout-routes.js +116 -0
  12. package/dist/checkout-service-plan.d.ts +137 -0
  13. package/dist/checkout-service-plan.d.ts.map +1 -0
  14. package/dist/checkout-service-plan.js +119 -0
  15. package/dist/checkout-service.d.ts +9 -0
  16. package/dist/checkout-service.d.ts.map +1 -0
  17. package/dist/checkout-service.js +324 -0
  18. package/dist/checkout-validation.d.ts +1682 -0
  19. package/dist/checkout-validation.d.ts.map +1 -0
  20. package/dist/checkout-validation.js +228 -0
  21. package/dist/document-download.d.ts +3 -0
  22. package/dist/document-download.d.ts.map +1 -0
  23. package/dist/document-download.js +1 -0
  24. package/dist/fx-money.d.ts +17 -0
  25. package/dist/fx-money.d.ts.map +1 -0
  26. package/dist/fx-money.js +194 -0
  27. package/dist/index.d.ts +65 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +108 -0
  30. package/dist/invoice-fx.d.ts +134 -0
  31. package/dist/invoice-fx.d.ts.map +1 -0
  32. package/dist/invoice-fx.js +240 -0
  33. package/dist/invoice-number-errors.d.ts +2 -0
  34. package/dist/invoice-number-errors.d.ts.map +1 -0
  35. package/dist/invoice-number-errors.js +58 -0
  36. package/dist/markets-ref.d.ts +149 -0
  37. package/dist/markets-ref.d.ts.map +1 -0
  38. package/dist/markets-ref.js +17 -0
  39. package/dist/payment-link.d.ts +23 -0
  40. package/dist/payment-link.d.ts.map +1 -0
  41. package/dist/payment-link.js +30 -0
  42. package/dist/payment-policy.d.ts +113 -0
  43. package/dist/payment-policy.d.ts.map +1 -0
  44. package/dist/payment-policy.js +193 -0
  45. package/dist/route-runtime.d.ts +22 -0
  46. package/dist/route-runtime.d.ts.map +1 -0
  47. package/dist/route-runtime.js +18 -0
  48. package/dist/routes-action-ledger.d.ts +181 -0
  49. package/dist/routes-action-ledger.d.ts.map +1 -0
  50. package/dist/routes-action-ledger.js +142 -0
  51. package/dist/routes-booking-billing.d.ts +852 -0
  52. package/dist/routes-booking-billing.d.ts.map +1 -0
  53. package/dist/routes-booking-billing.js +223 -0
  54. package/dist/routes-booking-create.d.ts +3 -0
  55. package/dist/routes-booking-create.d.ts.map +1 -0
  56. package/dist/routes-booking-create.js +194 -0
  57. package/dist/routes-booking-reads.d.ts +46 -0
  58. package/dist/routes-booking-reads.d.ts.map +1 -0
  59. package/dist/routes-booking-reads.js +20 -0
  60. package/dist/routes-documents.d.ts +195 -0
  61. package/dist/routes-documents.d.ts.map +1 -0
  62. package/dist/routes-documents.js +93 -0
  63. package/dist/routes-invoice-core.d.ts +794 -0
  64. package/dist/routes-invoice-core.d.ts.map +1 -0
  65. package/dist/routes-invoice-core.js +238 -0
  66. package/dist/routes-invoice-documents.d.ts +401 -0
  67. package/dist/routes-invoice-documents.d.ts.map +1 -0
  68. package/dist/routes-invoice-documents.js +91 -0
  69. package/dist/routes-invoice-issue.d.ts +384 -0
  70. package/dist/routes-invoice-issue.d.ts.map +1 -0
  71. package/dist/routes-invoice-issue.js +208 -0
  72. package/dist/routes-payment-processing.d.ts +1193 -0
  73. package/dist/routes-payment-processing.d.ts.map +1 -0
  74. package/dist/routes-payment-processing.js +238 -0
  75. package/dist/routes-payments.d.ts +309 -0
  76. package/dist/routes-payments.d.ts.map +1 -0
  77. package/dist/routes-payments.js +94 -0
  78. package/dist/routes-public.d.ts +1948 -0
  79. package/dist/routes-public.d.ts.map +1 -0
  80. package/dist/routes-public.js +275 -0
  81. package/dist/routes-reference-data.d.ts +977 -0
  82. package/dist/routes-reference-data.d.ts.map +1 -0
  83. package/dist/routes-reference-data.js +191 -0
  84. package/dist/routes-reports.d.ts +344 -0
  85. package/dist/routes-reports.d.ts.map +1 -0
  86. package/dist/routes-reports.js +93 -0
  87. package/dist/routes-runtime.d.ts +71 -0
  88. package/dist/routes-runtime.d.ts.map +1 -0
  89. package/dist/routes-runtime.js +59 -0
  90. package/dist/routes-settlement.d.ts +67 -0
  91. package/dist/routes-settlement.d.ts.map +1 -0
  92. package/dist/routes-settlement.js +23 -0
  93. package/dist/routes-shared.d.ts +35 -0
  94. package/dist/routes-shared.d.ts.map +1 -0
  95. package/dist/routes-shared.js +10 -0
  96. package/dist/routes-supplier-invoices.d.ts +778 -0
  97. package/dist/routes-supplier-invoices.d.ts.map +1 -0
  98. package/dist/routes-supplier-invoices.js +159 -0
  99. package/dist/routes-vouchers.d.ts +228 -0
  100. package/dist/routes-vouchers.d.ts.map +1 -0
  101. package/dist/routes-vouchers.js +54 -0
  102. package/dist/routes.d.ts +5577 -0
  103. package/dist/routes.d.ts.map +1 -0
  104. package/dist/routes.js +44 -0
  105. package/dist/schema/booking-billing.d.ts +1006 -0
  106. package/dist/schema/booking-billing.d.ts.map +1 -0
  107. package/dist/schema/booking-billing.js +106 -0
  108. package/dist/schema/enums.d.ts +48 -0
  109. package/dist/schema/enums.d.ts.map +1 -0
  110. package/dist/schema/enums.js +237 -0
  111. package/dist/schema/invoice-documents.d.ts +1245 -0
  112. package/dist/schema/invoice-documents.d.ts.map +1 -0
  113. package/dist/schema/invoice-documents.js +140 -0
  114. package/dist/schema/payment-instruments.d.ts +418 -0
  115. package/dist/schema/payment-instruments.d.ts.map +1 -0
  116. package/dist/schema/payment-instruments.js +45 -0
  117. package/dist/schema/payment-processing.d.ts +563 -0
  118. package/dist/schema/payment-processing.d.ts.map +1 -0
  119. package/dist/schema/payment-processing.js +65 -0
  120. package/dist/schema/payment-sessions.d.ts +728 -0
  121. package/dist/schema/payment-sessions.d.ts.map +1 -0
  122. package/dist/schema/payment-sessions.js +79 -0
  123. package/dist/schema/receivables.d.ts +1474 -0
  124. package/dist/schema/receivables.d.ts.map +1 -0
  125. package/dist/schema/receivables.js +179 -0
  126. package/dist/schema/relations.d.ts +82 -0
  127. package/dist/schema/relations.d.ts.map +1 -0
  128. package/dist/schema/relations.js +144 -0
  129. package/dist/schema/supplier-invoices.d.ts +1619 -0
  130. package/dist/schema/supplier-invoices.d.ts.map +1 -0
  131. package/dist/schema/supplier-invoices.js +228 -0
  132. package/dist/schema/tax.d.ts +712 -0
  133. package/dist/schema/tax.d.ts.map +1 -0
  134. package/dist/schema/tax.js +98 -0
  135. package/dist/schema/vouchers.d.ts +444 -0
  136. package/dist/schema/vouchers.d.ts.map +1 -0
  137. package/dist/schema/vouchers.js +64 -0
  138. package/dist/schema.d.ts +12 -0
  139. package/dist/schema.d.ts.map +1 -0
  140. package/dist/schema.js +11 -0
  141. package/dist/service-accountant-shares.d.ts +106 -0
  142. package/dist/service-accountant-shares.d.ts.map +1 -0
  143. package/dist/service-accountant-shares.js +331 -0
  144. package/dist/service-action-ledger-accounting.d.ts +104 -0
  145. package/dist/service-action-ledger-accounting.d.ts.map +1 -0
  146. package/dist/service-action-ledger-accounting.js +386 -0
  147. package/dist/service-action-ledger-booking-payments.d.ts +48 -0
  148. package/dist/service-action-ledger-booking-payments.d.ts.map +1 -0
  149. package/dist/service-action-ledger-booking-payments.js +178 -0
  150. package/dist/service-action-ledger-bookings.d.ts +44 -0
  151. package/dist/service-action-ledger-bookings.d.ts.map +1 -0
  152. package/dist/service-action-ledger-bookings.js +81 -0
  153. package/dist/service-action-ledger-payment-authorizations.d.ts +48 -0
  154. package/dist/service-action-ledger-payment-authorizations.d.ts.map +1 -0
  155. package/dist/service-action-ledger-payment-authorizations.js +209 -0
  156. package/dist/service-action-ledger-payment-sessions.d.ts +83 -0
  157. package/dist/service-action-ledger-payment-sessions.d.ts.map +1 -0
  158. package/dist/service-action-ledger-payment-sessions.js +294 -0
  159. package/dist/service-action-ledger-supplier-invoices.d.ts +27 -0
  160. package/dist/service-action-ledger-supplier-invoices.d.ts.map +1 -0
  161. package/dist/service-action-ledger-supplier-invoices.js +111 -0
  162. package/dist/service-action-ledger-supplier-payments.d.ts +21 -0
  163. package/dist/service-action-ledger-supplier-payments.d.ts.map +1 -0
  164. package/dist/service-action-ledger-supplier-payments.js +97 -0
  165. package/dist/service-action-ledger.d.ts +7 -0
  166. package/dist/service-action-ledger.d.ts.map +1 -0
  167. package/dist/service-action-ledger.js +6 -0
  168. package/dist/service-aggregates.d.ts +96 -0
  169. package/dist/service-aggregates.d.ts.map +1 -0
  170. package/dist/service-aggregates.js +294 -0
  171. package/dist/service-booking-billing.d.ts +2322 -0
  172. package/dist/service-booking-billing.d.ts.map +1 -0
  173. package/dist/service-booking-billing.js +8 -0
  174. package/dist/service-booking-create.d.ts +410 -0
  175. package/dist/service-booking-create.d.ts.map +1 -0
  176. package/dist/service-booking-create.js +1256 -0
  177. package/dist/service-booking-guarantees.d.ts +725 -0
  178. package/dist/service-booking-guarantees.d.ts.map +1 -0
  179. package/dist/service-booking-guarantees.js +153 -0
  180. package/dist/service-booking-item-billing.d.ts +1062 -0
  181. package/dist/service-booking-item-billing.d.ts.map +1 -0
  182. package/dist/service-booking-item-billing.js +77 -0
  183. package/dist/service-booking-payment-schedules.d.ts +557 -0
  184. package/dist/service-booking-payment-schedules.d.ts.map +1 -0
  185. package/dist/service-booking-payment-schedules.js +372 -0
  186. package/dist/service-bookings-dual-create.d.ts +308 -0
  187. package/dist/service-bookings-dual-create.d.ts.map +1 -0
  188. package/dist/service-bookings-dual-create.js +131 -0
  189. package/dist/service-boundary-sql.d.ts +6 -0
  190. package/dist/service-boundary-sql.d.ts.map +1 -0
  191. package/dist/service-boundary-sql.js +15 -0
  192. package/dist/service-cost-categories.d.ts +26 -0
  193. package/dist/service-cost-categories.d.ts.map +1 -0
  194. package/dist/service-cost-categories.js +76 -0
  195. package/dist/service-documents.d.ts +80 -0
  196. package/dist/service-documents.d.ts.map +1 -0
  197. package/dist/service-documents.js +228 -0
  198. package/dist/service-invoice-artifacts.d.ts +246 -0
  199. package/dist/service-invoice-artifacts.d.ts.map +1 -0
  200. package/dist/service-invoice-artifacts.js +277 -0
  201. package/dist/service-invoice-core.d.ts +405 -0
  202. package/dist/service-invoice-core.d.ts.map +1 -0
  203. package/dist/service-invoice-core.js +290 -0
  204. package/dist/service-invoice-credit-notes.d.ts +973 -0
  205. package/dist/service-invoice-credit-notes.d.ts.map +1 -0
  206. package/dist/service-invoice-credit-notes.js +142 -0
  207. package/dist/service-invoice-from-booking.d.ts +41 -0
  208. package/dist/service-invoice-from-booking.d.ts.map +1 -0
  209. package/dist/service-invoice-from-booking.js +267 -0
  210. package/dist/service-invoice-line-items.d.ts +432 -0
  211. package/dist/service-invoice-line-items.d.ts.map +1 -0
  212. package/dist/service-invoice-line-items.js +102 -0
  213. package/dist/service-invoice-numbering.d.ts +227 -0
  214. package/dist/service-invoice-numbering.d.ts.map +1 -0
  215. package/dist/service-invoice-numbering.js +260 -0
  216. package/dist/service-invoice-payments.d.ts +673 -0
  217. package/dist/service-invoice-payments.d.ts.map +1 -0
  218. package/dist/service-invoice-payments.js +398 -0
  219. package/dist/service-invoices.d.ts +2501 -0
  220. package/dist/service-invoices.d.ts.map +1 -0
  221. package/dist/service-invoices.js +12 -0
  222. package/dist/service-issue.d.ts +207 -0
  223. package/dist/service-issue.d.ts.map +1 -0
  224. package/dist/service-issue.js +431 -0
  225. package/dist/service-payment-authorizations.d.ts +164 -0
  226. package/dist/service-payment-authorizations.d.ts.map +1 -0
  227. package/dist/service-payment-authorizations.js +227 -0
  228. package/dist/service-payment-instruments.d.ts +116 -0
  229. package/dist/service-payment-instruments.d.ts.map +1 -0
  230. package/dist/service-payment-instruments.js +99 -0
  231. package/dist/service-payment-processing.d.ts +676 -0
  232. package/dist/service-payment-processing.d.ts.map +1 -0
  233. package/dist/service-payment-processing.js +10 -0
  234. package/dist/service-payment-session-completion.d.ts +48 -0
  235. package/dist/service-payment-session-completion.d.ts.map +1 -0
  236. package/dist/service-payment-session-completion.js +238 -0
  237. package/dist/service-payment-sessions.d.ts +361 -0
  238. package/dist/service-payment-sessions.d.ts.map +1 -0
  239. package/dist/service-payment-sessions.js +280 -0
  240. package/dist/service-profitability.d.ts +114 -0
  241. package/dist/service-profitability.d.ts.map +1 -0
  242. package/dist/service-profitability.js +794 -0
  243. package/dist/service-public.d.ts +553 -0
  244. package/dist/service-public.d.ts.map +1 -0
  245. package/dist/service-public.js +583 -0
  246. package/dist/service-reference-data.d.ts +272 -0
  247. package/dist/service-reference-data.d.ts.map +1 -0
  248. package/dist/service-reference-data.js +280 -0
  249. package/dist/service-rendition-wait.d.ts +38 -0
  250. package/dist/service-rendition-wait.d.ts.map +1 -0
  251. package/dist/service-rendition-wait.js +67 -0
  252. package/dist/service-reports.d.ts +37 -0
  253. package/dist/service-reports.d.ts.map +1 -0
  254. package/dist/service-reports.js +62 -0
  255. package/dist/service-settlement.d.ts +46 -0
  256. package/dist/service-settlement.d.ts.map +1 -0
  257. package/dist/service-settlement.js +185 -0
  258. package/dist/service-shared.d.ts +541 -0
  259. package/dist/service-shared.d.ts.map +1 -0
  260. package/dist/service-shared.js +764 -0
  261. package/dist/service-supplier-invoices.d.ts +871 -0
  262. package/dist/service-supplier-invoices.d.ts.map +1 -0
  263. package/dist/service-supplier-invoices.js +744 -0
  264. package/dist/service-supplier-payments.d.ts +69 -0
  265. package/dist/service-supplier-payments.d.ts.map +1 -0
  266. package/dist/service-supplier-payments.js +136 -0
  267. package/dist/service-vouchers-migration.d.ts +44 -0
  268. package/dist/service-vouchers-migration.d.ts.map +1 -0
  269. package/dist/service-vouchers-migration.js +148 -0
  270. package/dist/service-vouchers.d.ts +157 -0
  271. package/dist/service-vouchers.d.ts.map +1 -0
  272. package/dist/service-vouchers.js +191 -0
  273. package/dist/service.d.ts +6490 -0
  274. package/dist/service.d.ts.map +1 -0
  275. package/dist/service.js +29 -0
  276. package/dist/validation-billing.d.ts +2 -0
  277. package/dist/validation-billing.d.ts.map +1 -0
  278. package/dist/validation-billing.js +1 -0
  279. package/dist/validation-payments.d.ts +2 -0
  280. package/dist/validation-payments.d.ts.map +1 -0
  281. package/dist/validation-payments.js +1 -0
  282. package/dist/validation-public.d.ts +2 -0
  283. package/dist/validation-public.d.ts.map +1 -0
  284. package/dist/validation-public.js +1 -0
  285. package/dist/validation-shared.d.ts +2 -0
  286. package/dist/validation-shared.d.ts.map +1 -0
  287. package/dist/validation-shared.js +1 -0
  288. package/dist/validation-vouchers.d.ts +2 -0
  289. package/dist/validation-vouchers.d.ts.map +1 -0
  290. package/dist/validation-vouchers.js +1 -0
  291. package/dist/validation.d.ts +2 -0
  292. package/dist/validation.d.ts.map +1 -0
  293. package/dist/validation.js +1 -0
  294. package/package.json +121 -0
@@ -0,0 +1,871 @@
1
+ import { type ActionLedgerRequestContextValues } from "@voyant-travel/action-ledger";
2
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
+ import type { z } from "zod";
4
+ import { type InvoiceFxOptions } from "./invoice-fx.js";
5
+ import { supplierInvoices } from "./schema.js";
6
+ import type { insertSupplierInvoiceAttachmentSchema, insertSupplierInvoiceSchema, setSupplierCostAllocationsSchema, setSupplierInvoiceLinesSchema, supplierInvoiceLineInputSchema, supplierInvoiceListQuerySchema, updateSupplierInvoiceSchema } from "./validation.js";
7
+ type CreateSupplierInvoiceInput = z.infer<typeof insertSupplierInvoiceSchema>;
8
+ type UpdateSupplierInvoiceInput = z.infer<typeof updateSupplierInvoiceSchema>;
9
+ type SupplierInvoiceListQuery = z.infer<typeof supplierInvoiceListQuerySchema>;
10
+ type SupplierInvoiceLineInput = z.infer<typeof supplierInvoiceLineInputSchema>;
11
+ type SetLinesInput = z.infer<typeof setSupplierInvoiceLinesSchema>;
12
+ type SetAllocationsInput = z.infer<typeof setSupplierCostAllocationsSchema>;
13
+ type CreateAttachmentInput = z.infer<typeof insertSupplierInvoiceAttachmentSchema>;
14
+ export type SupplierInvoiceErrorCode = "supplier_invoice_not_found" | "mixed_allocation_modes" | "over_allocated" | "unknown_allocation_line" | "allocate_lines_after_create";
15
+ /**
16
+ * Raised by the supplier-invoice (AP) service. Route handlers map `code` to HTTP.
17
+ */
18
+ export declare class SupplierInvoiceServiceError extends Error {
19
+ readonly code: SupplierInvoiceErrorCode;
20
+ constructor(code: SupplierInvoiceErrorCode, message?: string);
21
+ }
22
+ export interface SupplierInvoiceServiceRuntime extends InvoiceFxOptions {
23
+ actionLedgerContext?: ActionLedgerRequestContextValues;
24
+ actionLedgerAuthorizationSource?: string | null;
25
+ }
26
+ export interface InvoiceTotals {
27
+ subtotalCents: number;
28
+ taxCents: number;
29
+ totalCents: number;
30
+ }
31
+ /**
32
+ * Totals derived from lines. `total` is the sum of line totals (which already
33
+ * include tax); `tax` is the sum of line tax; `subtotal = total − tax`. This is
34
+ * internally consistent regardless of per-line unit×qty rounding.
35
+ */
36
+ export declare function recomputeTotalsFromLines(lines: readonly SupplierInvoiceLineInput[]): InvoiceTotals;
37
+ export interface AllocationCheckLine {
38
+ id: string;
39
+ totalAmountCents: number;
40
+ }
41
+ export interface AllocationCheckEntry {
42
+ supplierInvoiceLineId?: string | null;
43
+ amountCents: number;
44
+ }
45
+ export type AllocationCheckResult = {
46
+ ok: true;
47
+ } | {
48
+ ok: false;
49
+ code: SupplierInvoiceErrorCode;
50
+ message: string;
51
+ };
52
+ /**
53
+ * Allocation invariants (§6.1):
54
+ * 1. One mode per invoice — either every allocation is whole-invoice
55
+ * (no line id) OR every allocation is per-line. Never mixed.
56
+ * 2. Exactly-one-target is enforced upstream by the zod schema + DB check.
57
+ * 3. No over-allocation — Σ per line ≤ that line's total; for whole-invoice
58
+ * mode, Σ ≤ the invoice total.
59
+ * 4. Under-allocation is allowed (the remainder is reported as `unattributed`
60
+ * by the read model, not stored).
61
+ */
62
+ export declare function validateAllocations(params: {
63
+ invoiceTotalCents: number;
64
+ lines: readonly AllocationCheckLine[];
65
+ allocations: readonly AllocationCheckEntry[];
66
+ }): AllocationCheckResult;
67
+ type SupplierInvoiceStatus = (typeof supplierInvoices.$inferSelect)["status"];
68
+ /**
69
+ * Next status given paid vs total. Manual/terminal states (draft, disputed,
70
+ * void) are never auto-changed. `paid` only flips automatically among the
71
+ * settlement states.
72
+ */
73
+ export declare function nextStatusForBalance(current: SupplierInvoiceStatus, totalCents: number, paidCents: number): SupplierInvoiceStatus;
74
+ /**
75
+ * Recompute `paidCents` / `balanceDueCents` / `status` for a supplier invoice
76
+ * from its completed payments. Currency-aware: a payment counts in the invoice
77
+ * currency directly, or via its base amount when the base currency matches
78
+ * (mirrors the AR settlement approach). §5.4 / §10.
79
+ */
80
+ export declare function recomputeSupplierInvoiceBalance(db: PostgresJsDatabase, supplierInvoiceId: string): Promise<{
81
+ id: string;
82
+ supplierId: string;
83
+ supplierInvoiceNo: string;
84
+ internalRef: string | null;
85
+ status: "void" | "paid" | "draft" | "partially_paid" | "received" | "approved" | "disputed";
86
+ currency: string;
87
+ baseCurrency: string | null;
88
+ fxRateSetId: string | null;
89
+ subtotalCents: number;
90
+ taxCents: number;
91
+ totalCents: number;
92
+ baseSubtotalCents: number | null;
93
+ baseTaxCents: number | null;
94
+ baseTotalCents: number | null;
95
+ paidCents: number;
96
+ balanceDueCents: number;
97
+ taxRegimeId: string | null;
98
+ issueDate: string;
99
+ dueDate: string | null;
100
+ receivedAt: Date | null;
101
+ approvedAt: Date | null;
102
+ approvedBy: string | null;
103
+ storageKey: string | null;
104
+ extractionId: string | null;
105
+ notes: string | null;
106
+ voidedAt: Date | null;
107
+ voidReason: string | null;
108
+ createdAt: Date;
109
+ updatedAt: Date;
110
+ deletedAt: Date | null;
111
+ } | null>;
112
+ export declare const supplierInvoicesService: {
113
+ list(db: PostgresJsDatabase, query: SupplierInvoiceListQuery): Promise<{
114
+ data: {
115
+ id: string;
116
+ supplierId: string;
117
+ supplierInvoiceNo: string;
118
+ internalRef: string | null;
119
+ status: "void" | "paid" | "draft" | "partially_paid" | "received" | "approved" | "disputed";
120
+ currency: string;
121
+ baseCurrency: string | null;
122
+ fxRateSetId: string | null;
123
+ subtotalCents: number;
124
+ taxCents: number;
125
+ totalCents: number;
126
+ baseSubtotalCents: number | null;
127
+ baseTaxCents: number | null;
128
+ baseTotalCents: number | null;
129
+ paidCents: number;
130
+ balanceDueCents: number;
131
+ taxRegimeId: string | null;
132
+ issueDate: string;
133
+ dueDate: string | null;
134
+ receivedAt: Date | null;
135
+ approvedAt: Date | null;
136
+ approvedBy: string | null;
137
+ storageKey: string | null;
138
+ extractionId: string | null;
139
+ notes: string | null;
140
+ voidedAt: Date | null;
141
+ voidReason: string | null;
142
+ createdAt: Date;
143
+ updatedAt: Date;
144
+ deletedAt: Date | null;
145
+ }[];
146
+ total: number;
147
+ limit: number;
148
+ offset: number;
149
+ }>;
150
+ getById(db: PostgresJsDatabase, id: string): Promise<{
151
+ lines: {
152
+ id: string;
153
+ supplierInvoiceId: string;
154
+ description: string;
155
+ serviceType: "accommodation" | "other" | "transport" | "flight" | "guide" | "meal" | "experience" | "insurance";
156
+ costCategoryId: string | null;
157
+ supplierServiceId: string | null;
158
+ quantity: number;
159
+ unitAmountCents: number;
160
+ taxRateBps: number | null;
161
+ taxAmountCents: number;
162
+ totalAmountCents: number;
163
+ sortOrder: number;
164
+ createdAt: Date;
165
+ updatedAt: Date;
166
+ }[];
167
+ allocations: {
168
+ targetLabel: string | null;
169
+ id: string;
170
+ supplierInvoiceId: string;
171
+ supplierInvoiceLineId: string | null;
172
+ targetType: "booking" | "traveler" | "departure" | "product" | "unattributed";
173
+ departureId: string | null;
174
+ productId: string | null;
175
+ bookingId: string | null;
176
+ bookingItemId: string | null;
177
+ travelerId: string | null;
178
+ amountCents: number;
179
+ baseAmountCents: number | null;
180
+ splitMethod: "manual" | "per_pax" | "equal" | "weighted";
181
+ createdAt: Date;
182
+ updatedAt: Date;
183
+ }[];
184
+ id: string;
185
+ supplierId: string;
186
+ supplierInvoiceNo: string;
187
+ internalRef: string | null;
188
+ status: "void" | "paid" | "draft" | "partially_paid" | "received" | "approved" | "disputed";
189
+ currency: string;
190
+ baseCurrency: string | null;
191
+ fxRateSetId: string | null;
192
+ subtotalCents: number;
193
+ taxCents: number;
194
+ totalCents: number;
195
+ baseSubtotalCents: number | null;
196
+ baseTaxCents: number | null;
197
+ baseTotalCents: number | null;
198
+ paidCents: number;
199
+ balanceDueCents: number;
200
+ taxRegimeId: string | null;
201
+ issueDate: string;
202
+ dueDate: string | null;
203
+ receivedAt: Date | null;
204
+ approvedAt: Date | null;
205
+ approvedBy: string | null;
206
+ storageKey: string | null;
207
+ extractionId: string | null;
208
+ notes: string | null;
209
+ voidedAt: Date | null;
210
+ voidReason: string | null;
211
+ createdAt: Date;
212
+ updatedAt: Date;
213
+ deletedAt: Date | null;
214
+ } | null>;
215
+ create(db: PostgresJsDatabase, input: CreateSupplierInvoiceInput, runtime?: SupplierInvoiceServiceRuntime): Promise<{
216
+ lines: {
217
+ id: string;
218
+ supplierInvoiceId: string;
219
+ description: string;
220
+ serviceType: "accommodation" | "other" | "transport" | "flight" | "guide" | "meal" | "experience" | "insurance";
221
+ costCategoryId: string | null;
222
+ supplierServiceId: string | null;
223
+ quantity: number;
224
+ unitAmountCents: number;
225
+ taxRateBps: number | null;
226
+ taxAmountCents: number;
227
+ totalAmountCents: number;
228
+ sortOrder: number;
229
+ createdAt: Date;
230
+ updatedAt: Date;
231
+ }[];
232
+ allocations: {
233
+ targetLabel: string | null;
234
+ id: string;
235
+ supplierInvoiceId: string;
236
+ supplierInvoiceLineId: string | null;
237
+ targetType: "booking" | "traveler" | "departure" | "product" | "unattributed";
238
+ departureId: string | null;
239
+ productId: string | null;
240
+ bookingId: string | null;
241
+ bookingItemId: string | null;
242
+ travelerId: string | null;
243
+ amountCents: number;
244
+ baseAmountCents: number | null;
245
+ splitMethod: "manual" | "per_pax" | "equal" | "weighted";
246
+ createdAt: Date;
247
+ updatedAt: Date;
248
+ }[];
249
+ id: string;
250
+ supplierId: string;
251
+ supplierInvoiceNo: string;
252
+ internalRef: string | null;
253
+ status: "void" | "paid" | "draft" | "partially_paid" | "received" | "approved" | "disputed";
254
+ currency: string;
255
+ baseCurrency: string | null;
256
+ fxRateSetId: string | null;
257
+ subtotalCents: number;
258
+ taxCents: number;
259
+ totalCents: number;
260
+ baseSubtotalCents: number | null;
261
+ baseTaxCents: number | null;
262
+ baseTotalCents: number | null;
263
+ paidCents: number;
264
+ balanceDueCents: number;
265
+ taxRegimeId: string | null;
266
+ issueDate: string;
267
+ dueDate: string | null;
268
+ receivedAt: Date | null;
269
+ approvedAt: Date | null;
270
+ approvedBy: string | null;
271
+ storageKey: string | null;
272
+ extractionId: string | null;
273
+ notes: string | null;
274
+ voidedAt: Date | null;
275
+ voidReason: string | null;
276
+ createdAt: Date;
277
+ updatedAt: Date;
278
+ deletedAt: Date | null;
279
+ } | null>;
280
+ update(db: PostgresJsDatabase, id: string, input: UpdateSupplierInvoiceInput, runtime?: SupplierInvoiceServiceRuntime): Promise<{
281
+ lines: {
282
+ id: string;
283
+ supplierInvoiceId: string;
284
+ description: string;
285
+ serviceType: "accommodation" | "other" | "transport" | "flight" | "guide" | "meal" | "experience" | "insurance";
286
+ costCategoryId: string | null;
287
+ supplierServiceId: string | null;
288
+ quantity: number;
289
+ unitAmountCents: number;
290
+ taxRateBps: number | null;
291
+ taxAmountCents: number;
292
+ totalAmountCents: number;
293
+ sortOrder: number;
294
+ createdAt: Date;
295
+ updatedAt: Date;
296
+ }[];
297
+ allocations: {
298
+ targetLabel: string | null;
299
+ id: string;
300
+ supplierInvoiceId: string;
301
+ supplierInvoiceLineId: string | null;
302
+ targetType: "booking" | "traveler" | "departure" | "product" | "unattributed";
303
+ departureId: string | null;
304
+ productId: string | null;
305
+ bookingId: string | null;
306
+ bookingItemId: string | null;
307
+ travelerId: string | null;
308
+ amountCents: number;
309
+ baseAmountCents: number | null;
310
+ splitMethod: "manual" | "per_pax" | "equal" | "weighted";
311
+ createdAt: Date;
312
+ updatedAt: Date;
313
+ }[];
314
+ id: string;
315
+ supplierId: string;
316
+ supplierInvoiceNo: string;
317
+ internalRef: string | null;
318
+ status: "void" | "paid" | "draft" | "partially_paid" | "received" | "approved" | "disputed";
319
+ currency: string;
320
+ baseCurrency: string | null;
321
+ fxRateSetId: string | null;
322
+ subtotalCents: number;
323
+ taxCents: number;
324
+ totalCents: number;
325
+ baseSubtotalCents: number | null;
326
+ baseTaxCents: number | null;
327
+ baseTotalCents: number | null;
328
+ paidCents: number;
329
+ balanceDueCents: number;
330
+ taxRegimeId: string | null;
331
+ issueDate: string;
332
+ dueDate: string | null;
333
+ receivedAt: Date | null;
334
+ approvedAt: Date | null;
335
+ approvedBy: string | null;
336
+ storageKey: string | null;
337
+ extractionId: string | null;
338
+ notes: string | null;
339
+ voidedAt: Date | null;
340
+ voidReason: string | null;
341
+ createdAt: Date;
342
+ updatedAt: Date;
343
+ deletedAt: Date | null;
344
+ } | null>;
345
+ /**
346
+ * Replace the invoice's lines and recompute header totals. Note: deleting a
347
+ * line cascades to any per-line allocations bound to it (FK on delete cascade)
348
+ * — re-set allocations after editing lines.
349
+ */
350
+ setLines(db: PostgresJsDatabase, id: string, input: SetLinesInput, runtime?: SupplierInvoiceServiceRuntime): Promise<{
351
+ lines: {
352
+ id: string;
353
+ supplierInvoiceId: string;
354
+ description: string;
355
+ serviceType: "accommodation" | "other" | "transport" | "flight" | "guide" | "meal" | "experience" | "insurance";
356
+ costCategoryId: string | null;
357
+ supplierServiceId: string | null;
358
+ quantity: number;
359
+ unitAmountCents: number;
360
+ taxRateBps: number | null;
361
+ taxAmountCents: number;
362
+ totalAmountCents: number;
363
+ sortOrder: number;
364
+ createdAt: Date;
365
+ updatedAt: Date;
366
+ }[];
367
+ allocations: {
368
+ targetLabel: string | null;
369
+ id: string;
370
+ supplierInvoiceId: string;
371
+ supplierInvoiceLineId: string | null;
372
+ targetType: "booking" | "traveler" | "departure" | "product" | "unattributed";
373
+ departureId: string | null;
374
+ productId: string | null;
375
+ bookingId: string | null;
376
+ bookingItemId: string | null;
377
+ travelerId: string | null;
378
+ amountCents: number;
379
+ baseAmountCents: number | null;
380
+ splitMethod: "manual" | "per_pax" | "equal" | "weighted";
381
+ createdAt: Date;
382
+ updatedAt: Date;
383
+ }[];
384
+ id: string;
385
+ supplierId: string;
386
+ supplierInvoiceNo: string;
387
+ internalRef: string | null;
388
+ status: "void" | "paid" | "draft" | "partially_paid" | "received" | "approved" | "disputed";
389
+ currency: string;
390
+ baseCurrency: string | null;
391
+ fxRateSetId: string | null;
392
+ subtotalCents: number;
393
+ taxCents: number;
394
+ totalCents: number;
395
+ baseSubtotalCents: number | null;
396
+ baseTaxCents: number | null;
397
+ baseTotalCents: number | null;
398
+ paidCents: number;
399
+ balanceDueCents: number;
400
+ taxRegimeId: string | null;
401
+ issueDate: string;
402
+ dueDate: string | null;
403
+ receivedAt: Date | null;
404
+ approvedAt: Date | null;
405
+ approvedBy: string | null;
406
+ storageKey: string | null;
407
+ extractionId: string | null;
408
+ notes: string | null;
409
+ voidedAt: Date | null;
410
+ voidReason: string | null;
411
+ createdAt: Date;
412
+ updatedAt: Date;
413
+ deletedAt: Date | null;
414
+ } | null>;
415
+ /**
416
+ * Replace the invoice's cost allocations after validating the §6.1 invariants
417
+ * against the current lines + invoice total.
418
+ */
419
+ setAllocations(db: PostgresJsDatabase, id: string, input: SetAllocationsInput, runtime?: SupplierInvoiceServiceRuntime): Promise<{
420
+ lines: {
421
+ id: string;
422
+ supplierInvoiceId: string;
423
+ description: string;
424
+ serviceType: "accommodation" | "other" | "transport" | "flight" | "guide" | "meal" | "experience" | "insurance";
425
+ costCategoryId: string | null;
426
+ supplierServiceId: string | null;
427
+ quantity: number;
428
+ unitAmountCents: number;
429
+ taxRateBps: number | null;
430
+ taxAmountCents: number;
431
+ totalAmountCents: number;
432
+ sortOrder: number;
433
+ createdAt: Date;
434
+ updatedAt: Date;
435
+ }[];
436
+ allocations: {
437
+ targetLabel: string | null;
438
+ id: string;
439
+ supplierInvoiceId: string;
440
+ supplierInvoiceLineId: string | null;
441
+ targetType: "booking" | "traveler" | "departure" | "product" | "unattributed";
442
+ departureId: string | null;
443
+ productId: string | null;
444
+ bookingId: string | null;
445
+ bookingItemId: string | null;
446
+ travelerId: string | null;
447
+ amountCents: number;
448
+ baseAmountCents: number | null;
449
+ splitMethod: "manual" | "per_pax" | "equal" | "weighted";
450
+ createdAt: Date;
451
+ updatedAt: Date;
452
+ }[];
453
+ id: string;
454
+ supplierId: string;
455
+ supplierInvoiceNo: string;
456
+ internalRef: string | null;
457
+ status: "void" | "paid" | "draft" | "partially_paid" | "received" | "approved" | "disputed";
458
+ currency: string;
459
+ baseCurrency: string | null;
460
+ fxRateSetId: string | null;
461
+ subtotalCents: number;
462
+ taxCents: number;
463
+ totalCents: number;
464
+ baseSubtotalCents: number | null;
465
+ baseTaxCents: number | null;
466
+ baseTotalCents: number | null;
467
+ paidCents: number;
468
+ balanceDueCents: number;
469
+ taxRegimeId: string | null;
470
+ issueDate: string;
471
+ dueDate: string | null;
472
+ receivedAt: Date | null;
473
+ approvedAt: Date | null;
474
+ approvedBy: string | null;
475
+ storageKey: string | null;
476
+ extractionId: string | null;
477
+ notes: string | null;
478
+ voidedAt: Date | null;
479
+ voidReason: string | null;
480
+ createdAt: Date;
481
+ updatedAt: Date;
482
+ deletedAt: Date | null;
483
+ } | null>;
484
+ /** Soft-delete: keeps the audit trail; excluded from list + uniqueness. */
485
+ softDelete(db: PostgresJsDatabase, id: string, runtime?: SupplierInvoiceServiceRuntime): Promise<{
486
+ id: string;
487
+ } | null>;
488
+ listAttachments(db: PostgresJsDatabase, supplierInvoiceId: string): Omit<import("drizzle-orm/pg-core").PgSelectBase<"supplier_invoice_attachments", {
489
+ id: import("drizzle-orm/pg-core").PgColumn<{
490
+ name: string;
491
+ tableName: "supplier_invoice_attachments";
492
+ dataType: "string";
493
+ columnType: "PgText";
494
+ data: string;
495
+ driverParam: string;
496
+ notNull: true;
497
+ hasDefault: true;
498
+ isPrimaryKey: true;
499
+ isAutoincrement: false;
500
+ hasRuntimeDefault: true;
501
+ enumValues: [string, ...string[]];
502
+ baseColumn: never;
503
+ identity: undefined;
504
+ generated: undefined;
505
+ }, {}, {}>;
506
+ supplierInvoiceId: import("drizzle-orm/pg-core").PgColumn<{
507
+ name: string;
508
+ tableName: "supplier_invoice_attachments";
509
+ dataType: "string";
510
+ columnType: "PgText";
511
+ data: string;
512
+ driverParam: string;
513
+ notNull: true;
514
+ hasDefault: false;
515
+ isPrimaryKey: false;
516
+ isAutoincrement: false;
517
+ hasRuntimeDefault: false;
518
+ enumValues: [string, ...string[]];
519
+ baseColumn: never;
520
+ identity: undefined;
521
+ generated: undefined;
522
+ }, {}, {}>;
523
+ kind: import("drizzle-orm/pg-core").PgColumn<{
524
+ name: "kind";
525
+ tableName: "supplier_invoice_attachments";
526
+ dataType: "string";
527
+ columnType: "PgText";
528
+ data: string;
529
+ driverParam: string;
530
+ notNull: true;
531
+ hasDefault: true;
532
+ isPrimaryKey: false;
533
+ isAutoincrement: false;
534
+ hasRuntimeDefault: false;
535
+ enumValues: [string, ...string[]];
536
+ baseColumn: never;
537
+ identity: undefined;
538
+ generated: undefined;
539
+ }, {}, {}>;
540
+ name: import("drizzle-orm/pg-core").PgColumn<{
541
+ name: "name";
542
+ tableName: "supplier_invoice_attachments";
543
+ dataType: "string";
544
+ columnType: "PgText";
545
+ data: string;
546
+ driverParam: string;
547
+ notNull: true;
548
+ hasDefault: false;
549
+ isPrimaryKey: false;
550
+ isAutoincrement: false;
551
+ hasRuntimeDefault: false;
552
+ enumValues: [string, ...string[]];
553
+ baseColumn: never;
554
+ identity: undefined;
555
+ generated: undefined;
556
+ }, {}, {}>;
557
+ mimeType: import("drizzle-orm/pg-core").PgColumn<{
558
+ name: "mime_type";
559
+ tableName: "supplier_invoice_attachments";
560
+ dataType: "string";
561
+ columnType: "PgText";
562
+ data: string;
563
+ driverParam: string;
564
+ notNull: false;
565
+ hasDefault: false;
566
+ isPrimaryKey: false;
567
+ isAutoincrement: false;
568
+ hasRuntimeDefault: false;
569
+ enumValues: [string, ...string[]];
570
+ baseColumn: never;
571
+ identity: undefined;
572
+ generated: undefined;
573
+ }, {}, {}>;
574
+ fileSize: import("drizzle-orm/pg-core").PgColumn<{
575
+ name: "file_size";
576
+ tableName: "supplier_invoice_attachments";
577
+ dataType: "number";
578
+ columnType: "PgInteger";
579
+ data: number;
580
+ driverParam: string | number;
581
+ notNull: false;
582
+ hasDefault: false;
583
+ isPrimaryKey: false;
584
+ isAutoincrement: false;
585
+ hasRuntimeDefault: false;
586
+ enumValues: undefined;
587
+ baseColumn: never;
588
+ identity: undefined;
589
+ generated: undefined;
590
+ }, {}, {}>;
591
+ storageKey: import("drizzle-orm/pg-core").PgColumn<{
592
+ name: "storage_key";
593
+ tableName: "supplier_invoice_attachments";
594
+ dataType: "string";
595
+ columnType: "PgText";
596
+ data: string;
597
+ driverParam: string;
598
+ notNull: false;
599
+ hasDefault: false;
600
+ isPrimaryKey: false;
601
+ isAutoincrement: false;
602
+ hasRuntimeDefault: false;
603
+ enumValues: [string, ...string[]];
604
+ baseColumn: never;
605
+ identity: undefined;
606
+ generated: undefined;
607
+ }, {}, {}>;
608
+ checksum: import("drizzle-orm/pg-core").PgColumn<{
609
+ name: "checksum";
610
+ tableName: "supplier_invoice_attachments";
611
+ dataType: "string";
612
+ columnType: "PgText";
613
+ data: string;
614
+ driverParam: string;
615
+ notNull: false;
616
+ hasDefault: false;
617
+ isPrimaryKey: false;
618
+ isAutoincrement: false;
619
+ hasRuntimeDefault: false;
620
+ enumValues: [string, ...string[]];
621
+ baseColumn: never;
622
+ identity: undefined;
623
+ generated: undefined;
624
+ }, {}, {}>;
625
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
626
+ name: "metadata";
627
+ tableName: "supplier_invoice_attachments";
628
+ dataType: "json";
629
+ columnType: "PgJsonb";
630
+ data: unknown;
631
+ driverParam: unknown;
632
+ notNull: false;
633
+ hasDefault: false;
634
+ isPrimaryKey: false;
635
+ isAutoincrement: false;
636
+ hasRuntimeDefault: false;
637
+ enumValues: undefined;
638
+ baseColumn: never;
639
+ identity: undefined;
640
+ generated: undefined;
641
+ }, {}, {}>;
642
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
643
+ name: "created_at";
644
+ tableName: "supplier_invoice_attachments";
645
+ dataType: "date";
646
+ columnType: "PgTimestamp";
647
+ data: Date;
648
+ driverParam: string;
649
+ notNull: true;
650
+ hasDefault: true;
651
+ isPrimaryKey: false;
652
+ isAutoincrement: false;
653
+ hasRuntimeDefault: false;
654
+ enumValues: undefined;
655
+ baseColumn: never;
656
+ identity: undefined;
657
+ generated: undefined;
658
+ }, {}, {}>;
659
+ }, "single", Record<"supplier_invoice_attachments", "not-null">, false, "where" | "orderBy", {
660
+ id: string;
661
+ supplierInvoiceId: string;
662
+ kind: string;
663
+ name: string;
664
+ mimeType: string | null;
665
+ fileSize: number | null;
666
+ storageKey: string | null;
667
+ checksum: string | null;
668
+ metadata: unknown;
669
+ createdAt: Date;
670
+ }[], {
671
+ id: import("drizzle-orm/pg-core").PgColumn<{
672
+ name: string;
673
+ tableName: "supplier_invoice_attachments";
674
+ dataType: "string";
675
+ columnType: "PgText";
676
+ data: string;
677
+ driverParam: string;
678
+ notNull: true;
679
+ hasDefault: true;
680
+ isPrimaryKey: true;
681
+ isAutoincrement: false;
682
+ hasRuntimeDefault: true;
683
+ enumValues: [string, ...string[]];
684
+ baseColumn: never;
685
+ identity: undefined;
686
+ generated: undefined;
687
+ }, {}, {}>;
688
+ supplierInvoiceId: import("drizzle-orm/pg-core").PgColumn<{
689
+ name: string;
690
+ tableName: "supplier_invoice_attachments";
691
+ dataType: "string";
692
+ columnType: "PgText";
693
+ data: string;
694
+ driverParam: string;
695
+ notNull: true;
696
+ hasDefault: false;
697
+ isPrimaryKey: false;
698
+ isAutoincrement: false;
699
+ hasRuntimeDefault: false;
700
+ enumValues: [string, ...string[]];
701
+ baseColumn: never;
702
+ identity: undefined;
703
+ generated: undefined;
704
+ }, {}, {}>;
705
+ kind: import("drizzle-orm/pg-core").PgColumn<{
706
+ name: "kind";
707
+ tableName: "supplier_invoice_attachments";
708
+ dataType: "string";
709
+ columnType: "PgText";
710
+ data: string;
711
+ driverParam: string;
712
+ notNull: true;
713
+ hasDefault: true;
714
+ isPrimaryKey: false;
715
+ isAutoincrement: false;
716
+ hasRuntimeDefault: false;
717
+ enumValues: [string, ...string[]];
718
+ baseColumn: never;
719
+ identity: undefined;
720
+ generated: undefined;
721
+ }, {}, {}>;
722
+ name: import("drizzle-orm/pg-core").PgColumn<{
723
+ name: "name";
724
+ tableName: "supplier_invoice_attachments";
725
+ dataType: "string";
726
+ columnType: "PgText";
727
+ data: string;
728
+ driverParam: string;
729
+ notNull: true;
730
+ hasDefault: false;
731
+ isPrimaryKey: false;
732
+ isAutoincrement: false;
733
+ hasRuntimeDefault: false;
734
+ enumValues: [string, ...string[]];
735
+ baseColumn: never;
736
+ identity: undefined;
737
+ generated: undefined;
738
+ }, {}, {}>;
739
+ mimeType: import("drizzle-orm/pg-core").PgColumn<{
740
+ name: "mime_type";
741
+ tableName: "supplier_invoice_attachments";
742
+ dataType: "string";
743
+ columnType: "PgText";
744
+ data: string;
745
+ driverParam: string;
746
+ notNull: false;
747
+ hasDefault: false;
748
+ isPrimaryKey: false;
749
+ isAutoincrement: false;
750
+ hasRuntimeDefault: false;
751
+ enumValues: [string, ...string[]];
752
+ baseColumn: never;
753
+ identity: undefined;
754
+ generated: undefined;
755
+ }, {}, {}>;
756
+ fileSize: import("drizzle-orm/pg-core").PgColumn<{
757
+ name: "file_size";
758
+ tableName: "supplier_invoice_attachments";
759
+ dataType: "number";
760
+ columnType: "PgInteger";
761
+ data: number;
762
+ driverParam: string | number;
763
+ notNull: false;
764
+ hasDefault: false;
765
+ isPrimaryKey: false;
766
+ isAutoincrement: false;
767
+ hasRuntimeDefault: false;
768
+ enumValues: undefined;
769
+ baseColumn: never;
770
+ identity: undefined;
771
+ generated: undefined;
772
+ }, {}, {}>;
773
+ storageKey: import("drizzle-orm/pg-core").PgColumn<{
774
+ name: "storage_key";
775
+ tableName: "supplier_invoice_attachments";
776
+ dataType: "string";
777
+ columnType: "PgText";
778
+ data: string;
779
+ driverParam: string;
780
+ notNull: false;
781
+ hasDefault: false;
782
+ isPrimaryKey: false;
783
+ isAutoincrement: false;
784
+ hasRuntimeDefault: false;
785
+ enumValues: [string, ...string[]];
786
+ baseColumn: never;
787
+ identity: undefined;
788
+ generated: undefined;
789
+ }, {}, {}>;
790
+ checksum: import("drizzle-orm/pg-core").PgColumn<{
791
+ name: "checksum";
792
+ tableName: "supplier_invoice_attachments";
793
+ dataType: "string";
794
+ columnType: "PgText";
795
+ data: string;
796
+ driverParam: string;
797
+ notNull: false;
798
+ hasDefault: false;
799
+ isPrimaryKey: false;
800
+ isAutoincrement: false;
801
+ hasRuntimeDefault: false;
802
+ enumValues: [string, ...string[]];
803
+ baseColumn: never;
804
+ identity: undefined;
805
+ generated: undefined;
806
+ }, {}, {}>;
807
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
808
+ name: "metadata";
809
+ tableName: "supplier_invoice_attachments";
810
+ dataType: "json";
811
+ columnType: "PgJsonb";
812
+ data: unknown;
813
+ driverParam: unknown;
814
+ notNull: false;
815
+ hasDefault: false;
816
+ isPrimaryKey: false;
817
+ isAutoincrement: false;
818
+ hasRuntimeDefault: false;
819
+ enumValues: undefined;
820
+ baseColumn: never;
821
+ identity: undefined;
822
+ generated: undefined;
823
+ }, {}, {}>;
824
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
825
+ name: "created_at";
826
+ tableName: "supplier_invoice_attachments";
827
+ dataType: "date";
828
+ columnType: "PgTimestamp";
829
+ data: Date;
830
+ driverParam: string;
831
+ notNull: true;
832
+ hasDefault: true;
833
+ isPrimaryKey: false;
834
+ isAutoincrement: false;
835
+ hasRuntimeDefault: false;
836
+ enumValues: undefined;
837
+ baseColumn: never;
838
+ identity: undefined;
839
+ generated: undefined;
840
+ }, {}, {}>;
841
+ }>, "where" | "orderBy">;
842
+ getAttachmentById(db: PostgresJsDatabase, attachmentId: string): Promise<{
843
+ id: string;
844
+ supplierInvoiceId: string;
845
+ kind: string;
846
+ name: string;
847
+ mimeType: string | null;
848
+ fileSize: number | null;
849
+ storageKey: string | null;
850
+ checksum: string | null;
851
+ metadata: unknown;
852
+ createdAt: Date;
853
+ } | null>;
854
+ createAttachment(db: PostgresJsDatabase, supplierInvoiceId: string, input: CreateAttachmentInput): Promise<{
855
+ id: string;
856
+ name: string;
857
+ createdAt: Date;
858
+ metadata: unknown;
859
+ supplierInvoiceId: string;
860
+ kind: string;
861
+ storageKey: string | null;
862
+ fileSize: number | null;
863
+ checksum: string | null;
864
+ mimeType: string | null;
865
+ } | null>;
866
+ deleteAttachment(db: PostgresJsDatabase, supplierInvoiceId: string, attachmentId: string): Promise<{
867
+ id: string;
868
+ } | null>;
869
+ };
870
+ export {};
871
+ //# sourceMappingURL=service-supplier-invoices.d.ts.map