@baseworks/invoice 1.1.0 → 1.2.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.
- package/README.md +20 -1
- package/dist/{chunk-335MPCTE.js → chunk-THLNZVGO.js} +29 -0
- package/dist/cli.js +39 -10
- package/dist/client.d.ts +50 -1
- package/dist/client.js +13 -0
- package/dist/events.d.ts +96 -1
- package/dist/events.js +3 -1
- package/dist/mcp.js +34 -6
- package/dist/projections.js +8 -3
- package/package.json +1 -1
- package/src/__tests__/cli.test.ts +37 -1
- package/src/__tests__/client.test.ts +19 -0
- package/src/__tests__/mcp.test.ts +42 -6
- package/src/cli.ts +57 -8
- package/src/client.ts +17 -0
- package/src/events.ts +28 -0
- package/src/mcp.ts +43 -7
- package/src/projections.ts +5 -0
- package/src/types.ts +46 -0
package/src/types.ts
CHANGED
|
@@ -33,6 +33,10 @@ export interface InvoiceRow {
|
|
|
33
33
|
fiscal_external_id: string | null
|
|
34
34
|
fiscal_message: string | null
|
|
35
35
|
fiscal_updated_at: number | null
|
|
36
|
+
// 1.2.0
|
|
37
|
+
number_text: string | null
|
|
38
|
+
series_key: string | null
|
|
39
|
+
external_number: string | null
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
// ── REST DTOs (snake_case, as every service in the realm speaks: ADR-0003) ───
|
|
@@ -125,6 +129,13 @@ export interface InvoiceDto {
|
|
|
125
129
|
tax_cents: number
|
|
126
130
|
payment_status: PaymentStatus
|
|
127
131
|
fiscal: Fiscal | null
|
|
132
|
+
/**
|
|
133
|
+
* The number as printed: `BSF2026000000148` in a series, `7` without one, the external number when the invoice has one.
|
|
134
|
+
* `null` while a draft. `number` is the series' counter (`null` when the number is the external one).
|
|
135
|
+
*/
|
|
136
|
+
number_text: string | null
|
|
137
|
+
/** A number given by another system (an e-Fatura portal, say), up to 64 characters. Unique among non-void invoices. */
|
|
138
|
+
external_number: string | null
|
|
128
139
|
/** Only `GET /invoices/:ref` includes the payments. */
|
|
129
140
|
payments?: InvoicePayment[]
|
|
130
141
|
}
|
|
@@ -174,6 +185,8 @@ export interface CreateInvoiceInput {
|
|
|
174
185
|
currency: string
|
|
175
186
|
lines: InvoiceLineInput[]
|
|
176
187
|
metadata?: Metadata
|
|
188
|
+
/** A number from another system; the invoice keeps it and takes none from the series at finalize. */
|
|
189
|
+
external_number?: string
|
|
177
190
|
/** @deprecated Send `customer_id`. */
|
|
178
191
|
customerId?: string
|
|
179
192
|
}
|
|
@@ -183,6 +196,8 @@ export interface UpdateInvoiceInput {
|
|
|
183
196
|
lines?: InvoiceLineInput[]
|
|
184
197
|
/** Replaces the invoice's metadata. */
|
|
185
198
|
metadata?: Metadata
|
|
199
|
+
/** Sets (or, with null, clears) the external number of a draft. */
|
|
200
|
+
external_number?: string | null
|
|
186
201
|
/** @deprecated Send `customer_id`. */
|
|
187
202
|
customerId?: string
|
|
188
203
|
}
|
|
@@ -192,6 +207,8 @@ export interface FinalizeInvoiceInput {
|
|
|
192
207
|
issued_at?: number
|
|
193
208
|
/** Epoch millis; 0/omitted = no due date. */
|
|
194
209
|
due_at?: number
|
|
210
|
+
/** The number another system gave it. Then it is the invoice's number and the series does not advance. */
|
|
211
|
+
external_number?: string
|
|
195
212
|
/** @deprecated Send `issued_at`. */
|
|
196
213
|
issuedAt?: number
|
|
197
214
|
/** @deprecated Send `due_at`. */
|
|
@@ -219,6 +236,8 @@ export interface ListInvoicesOptions {
|
|
|
219
236
|
source?: InvoiceSource
|
|
220
237
|
fiscal_status?: FiscalStatus
|
|
221
238
|
customer_id?: string
|
|
239
|
+
/** Exact. */
|
|
240
|
+
external_number?: string
|
|
222
241
|
}
|
|
223
242
|
|
|
224
243
|
/** The provider's whole document, for `PUT /invoices/mirror`. */
|
|
@@ -249,6 +268,33 @@ export interface MirrorResult {
|
|
|
249
268
|
stale?: boolean
|
|
250
269
|
}
|
|
251
270
|
|
|
271
|
+
/** An organization's numbering series. `number_text` is `${prefix}${issue year}${counter, zero-padded to digits}`. */
|
|
272
|
+
export interface Numbering {
|
|
273
|
+
prefix: string
|
|
274
|
+
digits: number
|
|
275
|
+
yearly: boolean
|
|
276
|
+
/** IANA name (`Europe/Istanbul`); `UTC` when none is set. The year in the number and the yearly reset follow the issue date in it. */
|
|
277
|
+
time_zone: string
|
|
278
|
+
/** The counter the next invoice finalized now would get. */
|
|
279
|
+
next: number
|
|
280
|
+
/** What that number would read, for the current year. */
|
|
281
|
+
next_text: string
|
|
282
|
+
updated_at: number
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface NumberingInput {
|
|
286
|
+
/** 3 uppercase letters or digits. */
|
|
287
|
+
prefix: string
|
|
288
|
+
/** 1 to 12; 9 for e-Fatura. */
|
|
289
|
+
digits: number
|
|
290
|
+
/** true: the counter restarts each calendar year (of the issue date). */
|
|
291
|
+
yearly: boolean
|
|
292
|
+
/** IANA name. Omitted: stays as it was (UTC if never set). */
|
|
293
|
+
time_zone?: string
|
|
294
|
+
/** The counter to continue from (this year's, when yearly). Omitted: the series continues where it is. It can only go forward. */
|
|
295
|
+
next?: number
|
|
296
|
+
}
|
|
297
|
+
|
|
252
298
|
export interface FiscalInput {
|
|
253
299
|
status: FiscalStatus
|
|
254
300
|
system?: string
|