@fayz-ai/financial 0.1.14 → 0.2.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.
@@ -5,7 +5,7 @@ import { createIdempotencyKey } from './chunk-IP5YH4S5.js';
5
5
  import { NAME_AMOUNT_TOLERANCE, matchStatementLines, scorePair } from './chunk-ZFUQBYBG.js';
6
6
  import { emptyStatement, ledgerBalance, buildStatement } from './chunk-HJPUHTI2.js';
7
7
  import { transferLegs } from './chunk-YUNLQYOZ.js';
8
- import { cancellationReason, invoiceTotal, itemsDescription, summarizeInvoiceLines, lineTotal } from './chunk-5RMPZIMO.js';
8
+ import { cancellationReason, invoiceTotal, itemsDescription, summarizeInvoiceLines, lineTotal } from './chunk-ZWPYYIZW.js';
9
9
  import { paymentFee, ledgerMethod, toLedgerDirection, fromLedgerDirection } from './chunk-4GXBOEI3.js';
10
10
  import { sessionCashFlow } from './chunk-56NQHYL7.js';
11
11
  import { runReconcileAsBill, runReconcileLink } from './chunk-FNXIAIUZ.js';
@@ -252,6 +252,7 @@ function rowToInvoiceLine(r) {
252
252
  totalInstallments: Number(r.installment_count) || 1,
253
253
  contactId: r.counterparty_person_id ?? void 0,
254
254
  contactName: r.counterparty_name ?? r.metadata?.contactName,
255
+ priceTableId: r.metadata?.priceTableId ?? void 0,
255
256
  observations: r.notes ?? void 0,
256
257
  itemsSummary: r.description ?? r.metadata?.itemsSummary,
257
258
  unitId: r.unit_id ?? void 0,
@@ -276,6 +277,7 @@ function rowToInvoice(r) {
276
277
  totalInstallments: Number(r.installment_count) || 1,
277
278
  contactId: r.counterparty_person_id ?? void 0,
278
279
  contactName: r.counterparty_name ?? r.metadata?.contactName,
280
+ priceTableId: r.metadata?.priceTableId ?? void 0,
279
281
  observations: r.notes ?? void 0,
280
282
  itemsSummary: r.description ?? r.metadata?.itemsSummary,
281
283
  unitId: r.unit_id ?? void 0,
@@ -678,7 +680,8 @@ function createSupabaseFinancialProvider() {
678
680
  p_metadata: {
679
681
  contactName: input.contactName,
680
682
  ...input.fiscalNumber ? { fiscalNumber: input.fiscalNumber } : {},
681
- ...input.currency ? { currency: input.currency } : {}
683
+ ...input.currency ? { currency: input.currency } : {},
684
+ ...input.priceTableId ? { priceTableId: input.priceTableId } : {}
682
685
  },
683
686
  p_idempotency_key: genId()
684
687
  });
@@ -720,12 +723,13 @@ function createSupabaseFinancialProvider() {
720
723
  if (partial.contactId !== void 0) row.counterparty_person_id = partial.contactId ?? null;
721
724
  if (partial.unitId !== void 0) row.unit_id = partial.unitId ?? null;
722
725
  if (partial.totalAmount !== void 0) row.total = partial.totalAmount;
723
- if (partial.contactName !== void 0 || "fiscalNumber" in partial) {
726
+ if (partial.contactName !== void 0 || "fiscalNumber" in partial || "priceTableId" in partial) {
724
727
  const { data: cur } = await pub.from("plg_financial_invoices").select("metadata").eq("id", id).maybeSingle();
725
728
  row.metadata = {
726
729
  ...cur?.metadata ?? {},
727
730
  ...partial.contactName !== void 0 ? { contactName: partial.contactName } : {},
728
- ..."fiscalNumber" in partial ? { fiscalNumber: partial.fiscalNumber ?? null } : {}
731
+ ..."fiscalNumber" in partial ? { fiscalNumber: partial.fiscalNumber ?? null } : {},
732
+ ..."priceTableId" in partial ? { priceTableId: partial.priceTableId ?? null } : {}
729
733
  };
730
734
  }
731
735
  if (Object.keys(row).length > 0) {
@@ -2819,5 +2823,5 @@ function createSupabaseFinancialProvider() {
2819
2823
  }
2820
2824
 
2821
2825
  export { createSupabaseFinancialProvider, invoiceLineOrFilter };
2822
- //# sourceMappingURL=chunk-VADZZHEA.js.map
2823
- //# sourceMappingURL=chunk-VADZZHEA.js.map
2826
+ //# sourceMappingURL=chunk-5OIB54V6.js.map
2827
+ //# sourceMappingURL=chunk-5OIB54V6.js.map