@spaceinvoices/js-sdk 11.0.1 → 11.1.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.
@@ -11,7 +11,7 @@ import type { Error, StatsQueryBatchRequest, StatsQueryBatchResponse, Validation
11
11
 
12
12
  Send an array of 1-25 queries. Queries share one read-only database snapshot and results are returned in the same order.
13
13
 
14
- **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes
14
+ **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes, expenses
15
15
 
16
16
  **Metric types**: count, sum, avg, min, max
17
17
 
@@ -22,10 +22,12 @@ Send an array of 1-25 queries. Queries share one read-only database snapshot and
22
22
  - Sum `financial_gross_converted` for gross invoice-date sales in the entity currency; subtract the equivalent eligible credit-note sum for net sales after credits. This is tax-inclusive sales, not service-period revenue recognition. Invoice `total_due_converted` reports invoice-only outstanding balances.
23
23
  - Sum `collection_amount_converted` for direct invoice cash receipts or positive credit-note refund magnitudes, capped per document. Applied credits and advance allocations are excluded. Include `collection_conversion_missing` to detect unusable cash conversions as well as missing document conversion. Subtract refunds from invoice collections, and eligible credits from invoiced gross; bound collected cash to zero through net invoiced gross before calculating the rate. A nonpositive denominator has a zero rate.
24
24
  - Payment charts use `active_invoice_cash_receipt: true` and `cash_amount_converted`. These are receipts on active invoices, excluding supplier payments, refunds and noncash allocations.
25
+ - Sum `expense_cash_amount_converted` with `expense_cash_payment: true` for cash paid to suppliers in the entity currency, and include `expense_cash_conversion_missing` the same way as the receipt counter.
25
26
  - On `invoice_taxes` and `credit_note_taxes`, use `financial_eligible: true` and `reverse_charge: false`, sum `tax_converted` by `rate`, then subtract eligible credit-note tax. This measures tax charged by document date, not cash tax collections or tax liability after expenses. `base_converted` provides the corresponding taxable base.
26
27
  - Include a sum of `financial_conversion_missing` in every financial query. A positive result means the aggregate is incomplete and must be shown as unavailable, rather than treating omitted conversion values as zero. For limited rankings, check missing conversions across the whole eligible population in a separate query before presenting the ranking. Historical copied foreign amounts without conversion evidence are not treated as valid 1:1 conversions.
27
28
  - Group invoice sales by `customer_key` and `customer_display_name` to keep linked customers stable across name changes; unlinked snapshots use a normalized-name fallback.
28
29
  - Date filters are inclusive calendar dates. Invoice overdue fields use the entity timezone; callers should construct reporting periods in that same timezone.
30
+ - Expenses use the same `financial_eligible`, `financial_gross_converted`, `financial_conversion_missing`, `total_due_converted` and `overdue_bucket` fields as invoices, by expense date; `supplier_key`/`supplier_display_name` group by stable supplier identity.
29
31
 
30
32
  **Virtual fields for group_by**:
31
33
  - `day` - Calendar day (YYYY-MM-DD)
@@ -11,7 +11,7 @@ import type { Error, StatsQueryBatchRequest, StatsQueryBatchResponse, Validation
11
11
 
12
12
  Send an array of 1-25 queries. Queries share one read-only database snapshot and results are returned in the same order.
13
13
 
14
- **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes
14
+ **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes, expenses
15
15
 
16
16
  **Metric types**: count, sum, avg, min, max
17
17
 
@@ -22,10 +22,12 @@ Send an array of 1-25 queries. Queries share one read-only database snapshot and
22
22
  - Sum `financial_gross_converted` for gross invoice-date sales in the entity currency; subtract the equivalent eligible credit-note sum for net sales after credits. This is tax-inclusive sales, not service-period revenue recognition. Invoice `total_due_converted` reports invoice-only outstanding balances.
23
23
  - Sum `collection_amount_converted` for direct invoice cash receipts or positive credit-note refund magnitudes, capped per document. Applied credits and advance allocations are excluded. Include `collection_conversion_missing` to detect unusable cash conversions as well as missing document conversion. Subtract refunds from invoice collections, and eligible credits from invoiced gross; bound collected cash to zero through net invoiced gross before calculating the rate. A nonpositive denominator has a zero rate.
24
24
  - Payment charts use `active_invoice_cash_receipt: true` and `cash_amount_converted`. These are receipts on active invoices, excluding supplier payments, refunds and noncash allocations.
25
+ - Sum `expense_cash_amount_converted` with `expense_cash_payment: true` for cash paid to suppliers in the entity currency, and include `expense_cash_conversion_missing` the same way as the receipt counter.
25
26
  - On `invoice_taxes` and `credit_note_taxes`, use `financial_eligible: true` and `reverse_charge: false`, sum `tax_converted` by `rate`, then subtract eligible credit-note tax. This measures tax charged by document date, not cash tax collections or tax liability after expenses. `base_converted` provides the corresponding taxable base.
26
27
  - Include a sum of `financial_conversion_missing` in every financial query. A positive result means the aggregate is incomplete and must be shown as unavailable, rather than treating omitted conversion values as zero. For limited rankings, check missing conversions across the whole eligible population in a separate query before presenting the ranking. Historical copied foreign amounts without conversion evidence are not treated as valid 1:1 conversions.
27
28
  - Group invoice sales by `customer_key` and `customer_display_name` to keep linked customers stable across name changes; unlinked snapshots use a normalized-name fallback.
28
29
  - Date filters are inclusive calendar dates. Invoice overdue fields use the entity timezone; callers should construct reporting periods in that same timezone.
30
+ - Expenses use the same `financial_eligible`, `financial_gross_converted`, `financial_conversion_missing`, `total_due_converted` and `overdue_bucket` fields as invoices, by expense date; `supplier_key`/`supplier_display_name` group by stable supplier identity.
29
31
 
30
32
  **Virtual fields for group_by**:
31
33
  - `day` - Calendar day (YYYY-MM-DD)
@@ -19,4 +19,5 @@ export declare const StatsQueryRequestTable: {
19
19
  readonly items: "items";
20
20
  readonly invoice_taxes: "invoice_taxes";
21
21
  readonly credit_note_taxes: "credit_note_taxes";
22
+ readonly expenses: "expenses";
22
23
  };
@@ -19,4 +19,5 @@ export declare const StatsQueryRequestTable: {
19
19
  readonly items: "items";
20
20
  readonly invoice_taxes: "invoice_taxes";
21
21
  readonly credit_note_taxes: "credit_note_taxes";
22
+ readonly expenses: "expenses";
22
23
  };
@@ -11,7 +11,7 @@ import * as zod from "zod";
11
11
 
12
12
  Send an array of 1-25 queries. Queries share one read-only database snapshot and results are returned in the same order.
13
13
 
14
- **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes
14
+ **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes, expenses
15
15
 
16
16
  **Metric types**: count, sum, avg, min, max
17
17
 
@@ -22,10 +22,12 @@ Send an array of 1-25 queries. Queries share one read-only database snapshot and
22
22
  - Sum `financial_gross_converted` for gross invoice-date sales in the entity currency; subtract the equivalent eligible credit-note sum for net sales after credits. This is tax-inclusive sales, not service-period revenue recognition. Invoice `total_due_converted` reports invoice-only outstanding balances.
23
23
  - Sum `collection_amount_converted` for direct invoice cash receipts or positive credit-note refund magnitudes, capped per document. Applied credits and advance allocations are excluded. Include `collection_conversion_missing` to detect unusable cash conversions as well as missing document conversion. Subtract refunds from invoice collections, and eligible credits from invoiced gross; bound collected cash to zero through net invoiced gross before calculating the rate. A nonpositive denominator has a zero rate.
24
24
  - Payment charts use `active_invoice_cash_receipt: true` and `cash_amount_converted`. These are receipts on active invoices, excluding supplier payments, refunds and noncash allocations.
25
+ - Sum `expense_cash_amount_converted` with `expense_cash_payment: true` for cash paid to suppliers in the entity currency, and include `expense_cash_conversion_missing` the same way as the receipt counter.
25
26
  - On `invoice_taxes` and `credit_note_taxes`, use `financial_eligible: true` and `reverse_charge: false`, sum `tax_converted` by `rate`, then subtract eligible credit-note tax. This measures tax charged by document date, not cash tax collections or tax liability after expenses. `base_converted` provides the corresponding taxable base.
26
27
  - Include a sum of `financial_conversion_missing` in every financial query. A positive result means the aggregate is incomplete and must be shown as unavailable, rather than treating omitted conversion values as zero. For limited rankings, check missing conversions across the whole eligible population in a separate query before presenting the ranking. Historical copied foreign amounts without conversion evidence are not treated as valid 1:1 conversions.
27
28
  - Group invoice sales by `customer_key` and `customer_display_name` to keep linked customers stable across name changes; unlinked snapshots use a normalized-name fallback.
28
29
  - Date filters are inclusive calendar dates. Invoice overdue fields use the entity timezone; callers should construct reporting periods in that same timezone.
30
+ - Expenses use the same `financial_eligible`, `financial_gross_converted`, `financial_conversion_missing`, `total_due_converted` and `overdue_bucket` fields as invoices, by expense date; `supplier_key`/`supplier_display_name` group by stable supplier identity.
29
31
 
30
32
  **Virtual fields for group_by**:
31
33
  - `day` - Calendar day (YYYY-MM-DD)
@@ -85,6 +87,7 @@ export declare const QueryEntityStatsBodyItem: zod.ZodObject<{
85
87
  items: "items";
86
88
  invoice_taxes: "invoice_taxes";
87
89
  credit_note_taxes: "credit_note_taxes";
90
+ expenses: "expenses";
88
91
  }>;
89
92
  date_from: zod.ZodOptional<zod.ZodString>;
90
93
  date_to: zod.ZodOptional<zod.ZodString>;
@@ -121,6 +124,7 @@ export declare const QueryEntityStatsBody: zod.ZodArray<zod.ZodObject<{
121
124
  items: "items";
122
125
  invoice_taxes: "invoice_taxes";
123
126
  credit_note_taxes: "credit_note_taxes";
127
+ expenses: "expenses";
124
128
  }>;
125
129
  date_from: zod.ZodOptional<zod.ZodString>;
126
130
  date_to: zod.ZodOptional<zod.ZodString>;
@@ -11,7 +11,7 @@ import * as zod from "zod";
11
11
 
12
12
  Send an array of 1-25 queries. Queries share one read-only database snapshot and results are returned in the same order.
13
13
 
14
- **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes
14
+ **Available tables**: invoices, estimates, credit_notes, advance_invoices, payments, customers, items, invoice_taxes, credit_note_taxes, expenses
15
15
 
16
16
  **Metric types**: count, sum, avg, min, max
17
17
 
@@ -22,10 +22,12 @@ Send an array of 1-25 queries. Queries share one read-only database snapshot and
22
22
  - Sum `financial_gross_converted` for gross invoice-date sales in the entity currency; subtract the equivalent eligible credit-note sum for net sales after credits. This is tax-inclusive sales, not service-period revenue recognition. Invoice `total_due_converted` reports invoice-only outstanding balances.
23
23
  - Sum `collection_amount_converted` for direct invoice cash receipts or positive credit-note refund magnitudes, capped per document. Applied credits and advance allocations are excluded. Include `collection_conversion_missing` to detect unusable cash conversions as well as missing document conversion. Subtract refunds from invoice collections, and eligible credits from invoiced gross; bound collected cash to zero through net invoiced gross before calculating the rate. A nonpositive denominator has a zero rate.
24
24
  - Payment charts use `active_invoice_cash_receipt: true` and `cash_amount_converted`. These are receipts on active invoices, excluding supplier payments, refunds and noncash allocations.
25
+ - Sum `expense_cash_amount_converted` with `expense_cash_payment: true` for cash paid to suppliers in the entity currency, and include `expense_cash_conversion_missing` the same way as the receipt counter.
25
26
  - On `invoice_taxes` and `credit_note_taxes`, use `financial_eligible: true` and `reverse_charge: false`, sum `tax_converted` by `rate`, then subtract eligible credit-note tax. This measures tax charged by document date, not cash tax collections or tax liability after expenses. `base_converted` provides the corresponding taxable base.
26
27
  - Include a sum of `financial_conversion_missing` in every financial query. A positive result means the aggregate is incomplete and must be shown as unavailable, rather than treating omitted conversion values as zero. For limited rankings, check missing conversions across the whole eligible population in a separate query before presenting the ranking. Historical copied foreign amounts without conversion evidence are not treated as valid 1:1 conversions.
27
28
  - Group invoice sales by `customer_key` and `customer_display_name` to keep linked customers stable across name changes; unlinked snapshots use a normalized-name fallback.
28
29
  - Date filters are inclusive calendar dates. Invoice overdue fields use the entity timezone; callers should construct reporting periods in that same timezone.
30
+ - Expenses use the same `financial_eligible`, `financial_gross_converted`, `financial_conversion_missing`, `total_due_converted` and `overdue_bucket` fields as invoices, by expense date; `supplier_key`/`supplier_display_name` group by stable supplier identity.
29
31
 
30
32
  **Virtual fields for group_by**:
31
33
  - `day` - Calendar day (YYYY-MM-DD)
@@ -85,6 +87,7 @@ export declare const QueryEntityStatsBodyItem: zod.ZodObject<{
85
87
  items: "items";
86
88
  invoice_taxes: "invoice_taxes";
87
89
  credit_note_taxes: "credit_note_taxes";
90
+ expenses: "expenses";
88
91
  }>;
89
92
  date_from: zod.ZodOptional<zod.ZodString>;
90
93
  date_to: zod.ZodOptional<zod.ZodString>;
@@ -121,6 +124,7 @@ export declare const QueryEntityStatsBody: zod.ZodArray<zod.ZodObject<{
121
124
  items: "items";
122
125
  invoice_taxes: "invoice_taxes";
123
126
  credit_note_taxes: "credit_note_taxes";
127
+ expenses: "expenses";
124
128
  }>;
125
129
  date_from: zod.ZodOptional<zod.ZodString>;
126
130
  date_to: zod.ZodOptional<zod.ZodString>;