bonbox 0.2.0 → 0.3.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 +27 -0
- package/dist/cli.js +296 -50
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,8 +17,11 @@ node packages/cli/dist/cli.js --help
|
|
|
17
17
|
| `bonbox logout` | Remove the stored session |
|
|
18
18
|
| `bonbox whoami` | Show the signed-in account and plan |
|
|
19
19
|
| `bonbox customers ls [--archived]` | List customers |
|
|
20
|
+
| `bonbox customers create --name <name> --address <street> --postal-code <zip> --city <city> […]` | Create a customer |
|
|
21
|
+
| `bonbox customers update <name-or-id> [--name] [--address] [--postal-code] [--city] [--country] [--department]` | Update a customer (only given fields change) |
|
|
20
22
|
| `bonbox invoices ls [--status created\|paid] [--quotes]` | List invoices or quotes |
|
|
21
23
|
| `bonbox invoices create --customer <name-or-id> --item "…"` | Create an invoice or quote |
|
|
24
|
+
| `bonbox invoices update <number-or-id> [--customer] [--item "…"] [--date] [--payment-days] [--currency] [--language] [--subtitle] [--reference] [--vat-rate] [--custom-notes]` | Update an invoice or quote (only given fields change) |
|
|
22
25
|
| `bonbox invoices pdf <number-or-id> [-o file]` | Download the PDF |
|
|
23
26
|
| `bonbox invoices paid <number-or-id> [--date] [--no-receipt]` | Mark an invoice as paid |
|
|
24
27
|
| `bonbox invoices unpaid <number-or-id>` | Undo a payment |
|
|
@@ -43,6 +46,30 @@ bonbox invoices create \
|
|
|
43
46
|
`--customer` accepts an ID, an exact name, or a unique name prefix. If a prefix
|
|
44
47
|
matches several customers the CLI lists them and stops.
|
|
45
48
|
|
|
49
|
+
### Updating a customer
|
|
50
|
+
|
|
51
|
+
`customers update` takes the same flags as `create`, but only the flags you
|
|
52
|
+
pass are changed — everything else is left as-is. `--country` and
|
|
53
|
+
`--department` are optional fields: passing them as an empty string
|
|
54
|
+
(`--country ""`) clears that field. `--name`, `--address`, `--postal-code` and
|
|
55
|
+
`--city` are required fields and cannot be cleared this way — the API rejects
|
|
56
|
+
an empty value for those.
|
|
57
|
+
|
|
58
|
+
### Updating an invoice
|
|
59
|
+
|
|
60
|
+
`invoices update <number-or-id>` accepts `--customer`, `--item`, `--date`,
|
|
61
|
+
`--payment-days`, `--currency`, `--language`, `--subtitle`, `--reference`,
|
|
62
|
+
`--vat-rate` and `--custom-notes` — only the flags you pass are changed,
|
|
63
|
+
everything else (including existing line items) is left as-is. There is no
|
|
64
|
+
`--quote` flag; whether an invoice is a quote can't be changed after creation.
|
|
65
|
+
Unlike `create`, `--date` has no "today by default" — omit it to leave the
|
|
66
|
+
invoice date untouched. `--subtitle`, `--reference`, `--custom-notes` and
|
|
67
|
+
`--vat-rate` are optional fields: passing them as an empty string
|
|
68
|
+
(`--vat-rate ""`) clears that field. Passing `--item` at all REPLACES the
|
|
69
|
+
entire line-item list with the given items, the same way the apps do when you
|
|
70
|
+
edit an invoice — it is not a way to add a single item. A paid invoice cannot
|
|
71
|
+
be updated; run `bonbox invoices unpaid` first.
|
|
72
|
+
|
|
46
73
|
### Marking an invoice paid
|
|
47
74
|
|
|
48
75
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -38,9 +38,12 @@ var en_default = {
|
|
|
38
38
|
cli_cmd_whoami: "Show the account you are signed in with",
|
|
39
39
|
cli_cmd_customers: "Work with your customers",
|
|
40
40
|
cli_cmd_customers_ls: "List your customers",
|
|
41
|
+
cli_cmd_customers_create: "Create a customer",
|
|
42
|
+
cli_cmd_customers_update: "Update a customer",
|
|
41
43
|
cli_cmd_invoices: "Work with your invoices and quotes",
|
|
42
44
|
cli_cmd_invoices_ls: "List invoices and quotes",
|
|
43
45
|
cli_cmd_invoices_create: "Create an invoice or a quote",
|
|
46
|
+
cli_cmd_invoices_update: "Update an invoice or quote",
|
|
44
47
|
cli_cmd_invoices_pdf: "Download the PDF of an invoice or quote",
|
|
45
48
|
cli_cmd_invoices_paid: "Mark an invoice as paid",
|
|
46
49
|
cli_cmd_invoices_unpaid: "Mark an invoice as unpaid again",
|
|
@@ -54,14 +57,23 @@ var en_default = {
|
|
|
54
57
|
cli_flag_status: "Filter by status: created or paid",
|
|
55
58
|
cli_flag_quotes: "Show quotes instead of invoices",
|
|
56
59
|
cli_flag_customer_ref: "Customer name or ID",
|
|
60
|
+
cli_flag_name: "Customer name",
|
|
61
|
+
cli_flag_department: "Department",
|
|
62
|
+
cli_flag_address: "Street address",
|
|
63
|
+
cli_flag_postal_code: "Postal code",
|
|
64
|
+
cli_flag_city: "City",
|
|
65
|
+
cli_flag_country: "Country code, for example CH",
|
|
57
66
|
cli_flag_item: "Line item as description:quantity:unitPrice[:discount%], can be repeated",
|
|
58
67
|
cli_flag_quote: "Create a quote instead of an invoice",
|
|
59
68
|
cli_flag_invoice_date: "Invoice date (YYYY-MM-DD), today by default",
|
|
69
|
+
cli_flag_invoice_date_update: "Invoice date (YYYY-MM-DD)",
|
|
60
70
|
cli_flag_payment_days: "Payment term in days",
|
|
61
71
|
cli_flag_currency: "Currency code, for example CHF",
|
|
62
72
|
cli_flag_language: "Document language: de, en, fr or it",
|
|
63
73
|
cli_flag_subtitle: "Subtitle shown on the document",
|
|
64
74
|
cli_flag_reference: "Your reference for this document",
|
|
75
|
+
cli_flag_vat_rate: "VAT rate in percent, for example 8.1",
|
|
76
|
+
cli_flag_custom_notes: "Custom notes shown on the document",
|
|
65
77
|
cli_flag_pdf: "Also save the PDF to this file",
|
|
66
78
|
cli_flag_output: "Save the PDF to this file",
|
|
67
79
|
cli_flag_paid_date: "Payment date (YYYY-MM-DD), today by default",
|
|
@@ -77,6 +89,7 @@ var en_default = {
|
|
|
77
89
|
cli_flag_tax_category: "Tax category",
|
|
78
90
|
cli_flag_booking_text: "Booking text",
|
|
79
91
|
cli_arg_invoice_ref: "Invoice number or ID",
|
|
92
|
+
cli_arg_customer_ref: "Customer name or ID",
|
|
80
93
|
cli_arg_scan_files: "Image or PDF files, all pages of one receipt",
|
|
81
94
|
cli_error_unauthorized: "You are not signed in. Run: bonbox login",
|
|
82
95
|
cli_error_pro_required: "This needs bonbox Pro. You can upgrade at %1$s",
|
|
@@ -87,6 +100,11 @@ var en_default = {
|
|
|
87
100
|
cli_error_item_number: 'Invalid number in item "%1$s"',
|
|
88
101
|
cli_error_items_required: "Add at least one line item with --item",
|
|
89
102
|
cli_error_customer_required: "Name a customer with --customer",
|
|
103
|
+
cli_error_name_required: "Give a name with --name",
|
|
104
|
+
cli_error_address_required: "Give an address with --address",
|
|
105
|
+
cli_error_postal_code_required: "Give a postal code with --postal-code",
|
|
106
|
+
cli_error_city_required: "Give a city with --city",
|
|
107
|
+
cli_error_update_fields_required: "Give at least one field to update",
|
|
90
108
|
cli_error_price_required: "Give an amount with --price",
|
|
91
109
|
cli_error_seller_required: "Give a seller with --seller",
|
|
92
110
|
cli_error_price_invalid: "Invalid amount: %1$s",
|
|
@@ -136,9 +154,13 @@ var en_default = {
|
|
|
136
154
|
cli_empty_invoices: "No invoices yet.",
|
|
137
155
|
cli_empty_quotes: "No quotes yet.",
|
|
138
156
|
cli_empty_receipts: "No receipts found.",
|
|
157
|
+
cli_customer_created: "Customer %1$s created.",
|
|
158
|
+
cli_customer_updated: "Customer %1$s updated.",
|
|
139
159
|
cli_invoice_created: "Invoice %1$s created, %2$s",
|
|
140
160
|
cli_quote_created: "Quote %1$s created, %2$s",
|
|
141
161
|
cli_pdf_saved: "Saved to %1$s",
|
|
162
|
+
cli_invoice_updated: "Invoice %1$s updated.",
|
|
163
|
+
cli_quote_updated: "Quote %1$s updated.",
|
|
142
164
|
cli_invoice_paid: "%1$s marked as paid.",
|
|
143
165
|
cli_invoice_unpaid: "%1$s marked as unpaid.",
|
|
144
166
|
cli_receipt_added: "Receipt saved: %1$s, %2$s",
|
|
@@ -154,9 +176,12 @@ var de_default = {
|
|
|
154
176
|
cli_cmd_whoami: "Zeigt das angemeldete Konto",
|
|
155
177
|
cli_cmd_customers: "Kunden verwalten",
|
|
156
178
|
cli_cmd_customers_ls: "Kunden auflisten",
|
|
179
|
+
cli_cmd_customers_create: "Kunde erstellen",
|
|
180
|
+
cli_cmd_customers_update: "Kunde aktualisieren",
|
|
157
181
|
cli_cmd_invoices: "Rechnungen und Offerten verwalten",
|
|
158
182
|
cli_cmd_invoices_ls: "Rechnungen und Offerten auflisten",
|
|
159
183
|
cli_cmd_invoices_create: "Rechnung oder Offerte erstellen",
|
|
184
|
+
cli_cmd_invoices_update: "Rechnung oder Offerte aktualisieren",
|
|
160
185
|
cli_cmd_invoices_pdf: "PDF einer Rechnung oder Offerte herunterladen",
|
|
161
186
|
cli_cmd_invoices_paid: "Rechnung als bezahlt markieren",
|
|
162
187
|
cli_cmd_invoices_unpaid: "Rechnung wieder als offen markieren",
|
|
@@ -170,14 +195,23 @@ var de_default = {
|
|
|
170
195
|
cli_flag_status: "Nach Status filtern: created oder paid",
|
|
171
196
|
cli_flag_quotes: "Offerten statt Rechnungen anzeigen",
|
|
172
197
|
cli_flag_customer_ref: "Kundenname oder Kunden-ID",
|
|
198
|
+
cli_flag_name: "Kundenname",
|
|
199
|
+
cli_flag_department: "Abteilung",
|
|
200
|
+
cli_flag_address: "Strasse und Hausnummer",
|
|
201
|
+
cli_flag_postal_code: "Postleitzahl",
|
|
202
|
+
cli_flag_city: "Ort",
|
|
203
|
+
cli_flag_country: "L\xE4ndercode, zum Beispiel CH",
|
|
173
204
|
cli_flag_item: "Position als Beschreibung:Menge:Einzelpreis[:Rabatt%], mehrfach m\xF6glich",
|
|
174
205
|
cli_flag_quote: "Offerte statt Rechnung erstellen",
|
|
175
206
|
cli_flag_invoice_date: "Rechnungsdatum (JJJJ-MM-TT), standardm\xE4ssig heute",
|
|
207
|
+
cli_flag_invoice_date_update: "Rechnungsdatum (JJJJ-MM-TT)",
|
|
176
208
|
cli_flag_payment_days: "Zahlungsfrist in Tagen",
|
|
177
209
|
cli_flag_currency: "W\xE4hrung, zum Beispiel CHF",
|
|
178
210
|
cli_flag_language: "Sprache des Dokuments: de, en, fr oder it",
|
|
179
211
|
cli_flag_subtitle: "Untertitel auf dem Dokument",
|
|
180
212
|
cli_flag_reference: "Ihre Referenz f\xFCr dieses Dokument",
|
|
213
|
+
cli_flag_vat_rate: "Mehrwertsteuersatz in Prozent, zum Beispiel 8.1",
|
|
214
|
+
cli_flag_custom_notes: "Eigene Notizen auf dem Dokument",
|
|
181
215
|
cli_flag_pdf: "PDF zus\xE4tzlich in diese Datei speichern",
|
|
182
216
|
cli_flag_output: "PDF in diese Datei speichern",
|
|
183
217
|
cli_flag_paid_date: "Zahlungsdatum (JJJJ-MM-TT), standardm\xE4ssig heute",
|
|
@@ -193,6 +227,7 @@ var de_default = {
|
|
|
193
227
|
cli_flag_tax_category: "Steuerkategorie",
|
|
194
228
|
cli_flag_booking_text: "Buchungstext",
|
|
195
229
|
cli_arg_invoice_ref: "Rechnungsnummer oder ID",
|
|
230
|
+
cli_arg_customer_ref: "Kundenname oder ID",
|
|
196
231
|
cli_arg_scan_files: "Bild- oder PDF-Dateien, alle Seiten eines Belegs",
|
|
197
232
|
cli_error_unauthorized: "Sie sind nicht angemeldet. F\xFChren Sie aus: bonbox login",
|
|
198
233
|
cli_error_pro_required: "Daf\xFCr wird bonbox Pro ben\xF6tigt. Upgrade unter %1$s",
|
|
@@ -203,6 +238,11 @@ var de_default = {
|
|
|
203
238
|
cli_error_item_number: 'Ung\xFCltige Zahl in Position "%1$s"',
|
|
204
239
|
cli_error_items_required: "Erfassen Sie mindestens eine Position mit --item",
|
|
205
240
|
cli_error_customer_required: "Geben Sie einen Kunden mit --customer an",
|
|
241
|
+
cli_error_name_required: "Geben Sie einen Namen mit --name an",
|
|
242
|
+
cli_error_address_required: "Geben Sie eine Adresse mit --address an",
|
|
243
|
+
cli_error_postal_code_required: "Geben Sie eine Postleitzahl mit --postal-code an",
|
|
244
|
+
cli_error_city_required: "Geben Sie einen Ort mit --city an",
|
|
245
|
+
cli_error_update_fields_required: "Geben Sie mindestens ein zu \xE4nderndes Feld an",
|
|
206
246
|
cli_error_price_required: "Geben Sie einen Betrag mit --price an",
|
|
207
247
|
cli_error_seller_required: "Geben Sie einen Anbieter mit --seller an",
|
|
208
248
|
cli_error_price_invalid: "Ung\xFCltiger Betrag: %1$s",
|
|
@@ -252,9 +292,13 @@ var de_default = {
|
|
|
252
292
|
cli_empty_invoices: "Noch keine Rechnungen.",
|
|
253
293
|
cli_empty_quotes: "Noch keine Offerten.",
|
|
254
294
|
cli_empty_receipts: "Keine Belege gefunden.",
|
|
295
|
+
cli_customer_created: "Kunde %1$s erstellt.",
|
|
296
|
+
cli_customer_updated: "Kunde %1$s aktualisiert.",
|
|
255
297
|
cli_invoice_created: "Rechnung %1$s erstellt, %2$s",
|
|
256
298
|
cli_quote_created: "Offerte %1$s erstellt, %2$s",
|
|
257
299
|
cli_pdf_saved: "Gespeichert unter %1$s",
|
|
300
|
+
cli_invoice_updated: "Rechnung %1$s aktualisiert.",
|
|
301
|
+
cli_quote_updated: "Offerte %1$s aktualisiert.",
|
|
258
302
|
cli_invoice_paid: "%1$s als bezahlt markiert.",
|
|
259
303
|
cli_invoice_unpaid: "%1$s als offen markiert.",
|
|
260
304
|
cli_receipt_added: "Beleg gespeichert: %1$s, %2$s",
|
|
@@ -270,9 +314,12 @@ var fr_default = {
|
|
|
270
314
|
cli_cmd_whoami: "Afficher le compte connect\xE9",
|
|
271
315
|
cli_cmd_customers: "G\xE9rer vos clients",
|
|
272
316
|
cli_cmd_customers_ls: "Lister vos clients",
|
|
317
|
+
cli_cmd_customers_create: "Cr\xE9er un client",
|
|
318
|
+
cli_cmd_customers_update: "Mettre \xE0 jour un client",
|
|
273
319
|
cli_cmd_invoices: "G\xE9rer vos factures et devis",
|
|
274
320
|
cli_cmd_invoices_ls: "Lister les factures et devis",
|
|
275
321
|
cli_cmd_invoices_create: "Cr\xE9er une facture ou un devis",
|
|
322
|
+
cli_cmd_invoices_update: "Mettre \xE0 jour une facture ou un devis",
|
|
276
323
|
cli_cmd_invoices_pdf: "T\xE9l\xE9charger le PDF d'une facture ou d'un devis",
|
|
277
324
|
cli_cmd_invoices_paid: "Marquer une facture comme pay\xE9e",
|
|
278
325
|
cli_cmd_invoices_unpaid: "Remettre une facture en attente de paiement",
|
|
@@ -286,14 +333,23 @@ var fr_default = {
|
|
|
286
333
|
cli_flag_status: "Filtrer par statut : created ou paid",
|
|
287
334
|
cli_flag_quotes: "Afficher les devis au lieu des factures",
|
|
288
335
|
cli_flag_customer_ref: "Nom ou identifiant du client",
|
|
336
|
+
cli_flag_name: "Nom du client",
|
|
337
|
+
cli_flag_department: "Service",
|
|
338
|
+
cli_flag_address: "Adresse",
|
|
339
|
+
cli_flag_postal_code: "Code postal",
|
|
340
|
+
cli_flag_city: "Ville",
|
|
341
|
+
cli_flag_country: "Code pays, par exemple CH",
|
|
289
342
|
cli_flag_item: "Poste au format description:quantit\xE9:prix unitaire[:remise%], r\xE9p\xE9table",
|
|
290
343
|
cli_flag_quote: "Cr\xE9er un devis au lieu d'une facture",
|
|
291
344
|
cli_flag_invoice_date: "Date de la facture (AAAA-MM-JJ), aujourd'hui par d\xE9faut",
|
|
345
|
+
cli_flag_invoice_date_update: "Date de la facture (AAAA-MM-JJ)",
|
|
292
346
|
cli_flag_payment_days: "D\xE9lai de paiement en jours",
|
|
293
347
|
cli_flag_currency: "Monnaie, par exemple CHF",
|
|
294
348
|
cli_flag_language: "Langue du document : de, en, fr ou it",
|
|
295
349
|
cli_flag_subtitle: "Sous-titre affich\xE9 sur le document",
|
|
296
350
|
cli_flag_reference: "Votre r\xE9f\xE9rence pour ce document",
|
|
351
|
+
cli_flag_vat_rate: "Taux de TVA en pourcent, par exemple 8.1",
|
|
352
|
+
cli_flag_custom_notes: "Notes personnalis\xE9es affich\xE9es sur le document",
|
|
297
353
|
cli_flag_pdf: "Enregistrer aussi le PDF dans ce fichier",
|
|
298
354
|
cli_flag_output: "Enregistrer le PDF dans ce fichier",
|
|
299
355
|
cli_flag_paid_date: "Date du paiement (AAAA-MM-JJ), aujourd'hui par d\xE9faut",
|
|
@@ -309,6 +365,7 @@ var fr_default = {
|
|
|
309
365
|
cli_flag_tax_category: "Cat\xE9gorie fiscale",
|
|
310
366
|
cli_flag_booking_text: "Libell\xE9 comptable",
|
|
311
367
|
cli_arg_invoice_ref: "Num\xE9ro de facture ou identifiant",
|
|
368
|
+
cli_arg_customer_ref: "Nom ou identifiant du client",
|
|
312
369
|
cli_arg_scan_files: "Fichiers image ou PDF, toutes les pages d'un justificatif",
|
|
313
370
|
cli_error_unauthorized: "Vous n'\xEAtes pas connect\xE9. Ex\xE9cutez : bonbox login",
|
|
314
371
|
cli_error_pro_required: "Cette action n\xE9cessite bonbox Pro. Passez \xE0 Pro sur %1$s",
|
|
@@ -319,6 +376,11 @@ var fr_default = {
|
|
|
319
376
|
cli_error_item_number: 'Nombre invalide dans le poste "%1$s"',
|
|
320
377
|
cli_error_items_required: "Ajoutez au moins un poste avec --item",
|
|
321
378
|
cli_error_customer_required: "Indiquez un client avec --customer",
|
|
379
|
+
cli_error_name_required: "Indiquez un nom avec --name",
|
|
380
|
+
cli_error_address_required: "Indiquez une adresse avec --address",
|
|
381
|
+
cli_error_postal_code_required: "Indiquez un code postal avec --postal-code",
|
|
382
|
+
cli_error_city_required: "Indiquez une ville avec --city",
|
|
383
|
+
cli_error_update_fields_required: "Indiquez au moins un champ \xE0 mettre \xE0 jour",
|
|
322
384
|
cli_error_price_required: "Indiquez un montant avec --price",
|
|
323
385
|
cli_error_seller_required: "Indiquez un fournisseur avec --seller",
|
|
324
386
|
cli_error_price_invalid: "Montant invalide : %1$s",
|
|
@@ -368,9 +430,13 @@ var fr_default = {
|
|
|
368
430
|
cli_empty_invoices: "Aucune facture pour l'instant.",
|
|
369
431
|
cli_empty_quotes: "Aucun devis pour l'instant.",
|
|
370
432
|
cli_empty_receipts: "Aucun justificatif trouv\xE9.",
|
|
433
|
+
cli_customer_created: "Client %1$s cr\xE9\xE9.",
|
|
434
|
+
cli_customer_updated: "Client %1$s mis \xE0 jour.",
|
|
371
435
|
cli_invoice_created: "Facture %1$s cr\xE9\xE9e, %2$s",
|
|
372
436
|
cli_quote_created: "Devis %1$s cr\xE9\xE9, %2$s",
|
|
373
437
|
cli_pdf_saved: "Enregistr\xE9 sous %1$s",
|
|
438
|
+
cli_invoice_updated: "Facture %1$s mise \xE0 jour.",
|
|
439
|
+
cli_quote_updated: "Devis %1$s mis \xE0 jour.",
|
|
374
440
|
cli_invoice_paid: "%1$s marqu\xE9e comme pay\xE9e.",
|
|
375
441
|
cli_invoice_unpaid: "%1$s remise en attente de paiement.",
|
|
376
442
|
cli_receipt_added: "Justificatif enregistr\xE9 : %1$s, %2$s",
|
|
@@ -386,9 +452,12 @@ var it_default = {
|
|
|
386
452
|
cli_cmd_whoami: "Mostra l'account con cui hai effettuato l'accesso",
|
|
387
453
|
cli_cmd_customers: "Gestisci i tuoi clienti",
|
|
388
454
|
cli_cmd_customers_ls: "Elenca i tuoi clienti",
|
|
455
|
+
cli_cmd_customers_create: "Crea un cliente",
|
|
456
|
+
cli_cmd_customers_update: "Aggiorna un cliente",
|
|
389
457
|
cli_cmd_invoices: "Gestisci fatture e preventivi",
|
|
390
458
|
cli_cmd_invoices_ls: "Elenca fatture e preventivi",
|
|
391
459
|
cli_cmd_invoices_create: "Crea una fattura o un preventivo",
|
|
460
|
+
cli_cmd_invoices_update: "Aggiorna una fattura o un preventivo",
|
|
392
461
|
cli_cmd_invoices_pdf: "Scarica il PDF di una fattura o di un preventivo",
|
|
393
462
|
cli_cmd_invoices_paid: "Segna una fattura come pagata",
|
|
394
463
|
cli_cmd_invoices_unpaid: "Riporta una fattura fra quelle aperte",
|
|
@@ -402,14 +471,23 @@ var it_default = {
|
|
|
402
471
|
cli_flag_status: "Filtra per stato: created o paid",
|
|
403
472
|
cli_flag_quotes: "Mostra i preventivi invece delle fatture",
|
|
404
473
|
cli_flag_customer_ref: "Nome o ID del cliente",
|
|
474
|
+
cli_flag_name: "Nome del cliente",
|
|
475
|
+
cli_flag_department: "Reparto",
|
|
476
|
+
cli_flag_address: "Indirizzo",
|
|
477
|
+
cli_flag_postal_code: "Codice postale",
|
|
478
|
+
cli_flag_city: "Citt\xE0",
|
|
479
|
+
cli_flag_country: "Codice paese, ad esempio CH",
|
|
405
480
|
cli_flag_item: "Voce nel formato descrizione:quantit\xE0:prezzo unitario[:sconto%], ripetibile",
|
|
406
481
|
cli_flag_quote: "Crea un preventivo invece di una fattura",
|
|
407
482
|
cli_flag_invoice_date: "Data della fattura (AAAA-MM-GG), per impostazione predefinita oggi",
|
|
483
|
+
cli_flag_invoice_date_update: "Data della fattura (AAAA-MM-GG)",
|
|
408
484
|
cli_flag_payment_days: "Termine di pagamento in giorni",
|
|
409
485
|
cli_flag_currency: "Valuta, ad esempio CHF",
|
|
410
486
|
cli_flag_language: "Lingua del documento: de, en, fr o it",
|
|
411
487
|
cli_flag_subtitle: "Sottotitolo mostrato sul documento",
|
|
412
488
|
cli_flag_reference: "Il tuo riferimento per questo documento",
|
|
489
|
+
cli_flag_vat_rate: "Aliquota IVA in percento, ad esempio 8.1",
|
|
490
|
+
cli_flag_custom_notes: "Note personalizzate mostrate sul documento",
|
|
413
491
|
cli_flag_pdf: "Salva anche il PDF in questo file",
|
|
414
492
|
cli_flag_output: "Salva il PDF in questo file",
|
|
415
493
|
cli_flag_paid_date: "Data del pagamento (AAAA-MM-GG), per impostazione predefinita oggi",
|
|
@@ -425,6 +503,7 @@ var it_default = {
|
|
|
425
503
|
cli_flag_tax_category: "Categoria fiscale",
|
|
426
504
|
cli_flag_booking_text: "Testo di registrazione",
|
|
427
505
|
cli_arg_invoice_ref: "Numero della fattura o ID",
|
|
506
|
+
cli_arg_customer_ref: "Nome o ID del cliente",
|
|
428
507
|
cli_arg_scan_files: "File immagine o PDF, tutte le pagine di un giustificativo",
|
|
429
508
|
cli_error_unauthorized: "Non hai effettuato l'accesso. Esegui: bonbox login",
|
|
430
509
|
cli_error_pro_required: "Serve bonbox Pro. Puoi passare a Pro qui: %1$s",
|
|
@@ -435,6 +514,11 @@ var it_default = {
|
|
|
435
514
|
cli_error_item_number: 'Numero non valido nella voce "%1$s"',
|
|
436
515
|
cli_error_items_required: "Aggiungi almeno una voce con --item",
|
|
437
516
|
cli_error_customer_required: "Indica un cliente con --customer",
|
|
517
|
+
cli_error_name_required: "Indica un nome con --name",
|
|
518
|
+
cli_error_address_required: "Indica un indirizzo con --address",
|
|
519
|
+
cli_error_postal_code_required: "Indica un codice postale con --postal-code",
|
|
520
|
+
cli_error_city_required: "Indica una citt\xE0 con --city",
|
|
521
|
+
cli_error_update_fields_required: "Indica almeno un campo da aggiornare",
|
|
438
522
|
cli_error_price_required: "Indica un importo con --price",
|
|
439
523
|
cli_error_seller_required: "Indica un fornitore con --seller",
|
|
440
524
|
cli_error_price_invalid: "Importo non valido: %1$s",
|
|
@@ -484,9 +568,13 @@ var it_default = {
|
|
|
484
568
|
cli_empty_invoices: "Ancora nessuna fattura.",
|
|
485
569
|
cli_empty_quotes: "Ancora nessun preventivo.",
|
|
486
570
|
cli_empty_receipts: "Nessun giustificativo trovato.",
|
|
571
|
+
cli_customer_created: "Cliente %1$s creato.",
|
|
572
|
+
cli_customer_updated: "Cliente %1$s aggiornato.",
|
|
487
573
|
cli_invoice_created: "Fattura %1$s creata, %2$s",
|
|
488
574
|
cli_quote_created: "Preventivo %1$s creato, %2$s",
|
|
489
575
|
cli_pdf_saved: "Salvato in %1$s",
|
|
576
|
+
cli_invoice_updated: "Fattura %1$s aggiornata.",
|
|
577
|
+
cli_quote_updated: "Preventivo %1$s aggiornato.",
|
|
490
578
|
cli_invoice_paid: "%1$s segnata come pagata.",
|
|
491
579
|
cli_invoice_unpaid: "%1$s riportata fra quelle aperte.",
|
|
492
580
|
cli_receipt_added: "Giustificativo salvato: %1$s, %2$s",
|
|
@@ -688,6 +776,14 @@ var ApiClient = class {
|
|
|
688
776
|
});
|
|
689
777
|
return await this.parseJson(response);
|
|
690
778
|
}
|
|
779
|
+
async patch(path, body) {
|
|
780
|
+
const response = await this.send(path, {
|
|
781
|
+
method: "PATCH",
|
|
782
|
+
headers: { "Content-Type": "application/json" },
|
|
783
|
+
body: JSON.stringify(body ?? {})
|
|
784
|
+
});
|
|
785
|
+
return await this.parseJson(response);
|
|
786
|
+
}
|
|
691
787
|
async postMultipart(path, form) {
|
|
692
788
|
const response = await this.send(path, { method: "POST", body: form });
|
|
693
789
|
return await this.parseJson(response);
|
|
@@ -818,53 +914,6 @@ function table(columns, rows) {
|
|
|
818
914
|
return [render(columns.map((column) => column.header)), ...rows.map(render)].join("\n");
|
|
819
915
|
}
|
|
820
916
|
|
|
821
|
-
// src/commands/customers.ts
|
|
822
|
-
function listCommand() {
|
|
823
|
-
return defineCommand2({
|
|
824
|
-
meta: { name: "ls", description: t("cli_cmd_customers_ls") },
|
|
825
|
-
args: {
|
|
826
|
-
...commonArgs(),
|
|
827
|
-
archived: { type: "boolean", description: t("cli_flag_archived"), default: false }
|
|
828
|
-
},
|
|
829
|
-
async run({ args }) {
|
|
830
|
-
const items = await client().getAllPages("/customers", {
|
|
831
|
-
includeArchived: args.archived ? "true" : void 0
|
|
832
|
-
});
|
|
833
|
-
if (args.json) {
|
|
834
|
-
printJson({ items });
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
if (items.length === 0) {
|
|
838
|
-
out(t("cli_empty_customers"));
|
|
839
|
-
return;
|
|
840
|
-
}
|
|
841
|
-
const columns = [
|
|
842
|
-
{ header: t("cli_col_name") },
|
|
843
|
-
{ header: t("cli_col_city") },
|
|
844
|
-
...args.archived ? [{ header: t("cli_col_archived") }] : [],
|
|
845
|
-
{ header: t("cli_col_id") }
|
|
846
|
-
];
|
|
847
|
-
const rows = items.map((customer) => [
|
|
848
|
-
customer.name,
|
|
849
|
-
[customer.postalCode, customer.city].filter(Boolean).join(" "),
|
|
850
|
-
...args.archived ? [customer.archived ? t("cli_yes") : t("cli_no")] : [],
|
|
851
|
-
customer.id
|
|
852
|
-
]);
|
|
853
|
-
out(table(columns, rows));
|
|
854
|
-
}
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
function customersCommand() {
|
|
858
|
-
return defineCommand2({
|
|
859
|
-
meta: { name: "customers", description: t("cli_cmd_customers") },
|
|
860
|
-
subCommands: { ls: listCommand() }
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
// src/commands/invoices.ts
|
|
865
|
-
import { defineCommand as defineCommand3 } from "citty";
|
|
866
|
-
import { writeFile } from "fs/promises";
|
|
867
|
-
|
|
868
917
|
// src/lib/args.ts
|
|
869
918
|
function toArray(value) {
|
|
870
919
|
if (value === void 0 || value === null || value === false) return [];
|
|
@@ -877,6 +926,10 @@ function optional(value) {
|
|
|
877
926
|
const text = String(value).trim();
|
|
878
927
|
return text.length > 0 ? text : void 0;
|
|
879
928
|
}
|
|
929
|
+
function providedValue(value) {
|
|
930
|
+
if (value === void 0 || value === null) return void 0;
|
|
931
|
+
return String(value).trim();
|
|
932
|
+
}
|
|
880
933
|
function requireDate(value) {
|
|
881
934
|
if (value === void 0) return void 0;
|
|
882
935
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
@@ -903,6 +956,10 @@ function monthRange(month) {
|
|
|
903
956
|
}
|
|
904
957
|
|
|
905
958
|
// src/lib/customers.ts
|
|
959
|
+
var UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
960
|
+
function isUuid(value) {
|
|
961
|
+
return UUID_RE.test(value);
|
|
962
|
+
}
|
|
906
963
|
function matchCustomer(reference, customers) {
|
|
907
964
|
const needle = reference.trim().toLowerCase();
|
|
908
965
|
if (!needle) return { kind: "none" };
|
|
@@ -929,6 +986,137 @@ ${list}`);
|
|
|
929
986
|
throw new UsageError(t("cli_error_customer_not_found", reference));
|
|
930
987
|
}
|
|
931
988
|
|
|
989
|
+
// src/commands/customers.ts
|
|
990
|
+
function customerFieldArgs() {
|
|
991
|
+
return {
|
|
992
|
+
name: { type: "string", description: t("cli_flag_name") },
|
|
993
|
+
department: { type: "string", description: t("cli_flag_department") },
|
|
994
|
+
address: { type: "string", description: t("cli_flag_address") },
|
|
995
|
+
"postal-code": { type: "string", description: t("cli_flag_postal_code") },
|
|
996
|
+
city: { type: "string", description: t("cli_flag_city") },
|
|
997
|
+
country: { type: "string", description: t("cli_flag_country") }
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
function listCommand() {
|
|
1001
|
+
return defineCommand2({
|
|
1002
|
+
meta: { name: "ls", description: t("cli_cmd_customers_ls") },
|
|
1003
|
+
args: {
|
|
1004
|
+
...commonArgs(),
|
|
1005
|
+
archived: { type: "boolean", description: t("cli_flag_archived"), default: false }
|
|
1006
|
+
},
|
|
1007
|
+
async run({ args }) {
|
|
1008
|
+
const items = await client().getAllPages("/customers", {
|
|
1009
|
+
includeArchived: args.archived ? "true" : void 0
|
|
1010
|
+
});
|
|
1011
|
+
if (args.json) {
|
|
1012
|
+
printJson({ items });
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
if (items.length === 0) {
|
|
1016
|
+
out(t("cli_empty_customers"));
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
const columns = [
|
|
1020
|
+
{ header: t("cli_col_name") },
|
|
1021
|
+
{ header: t("cli_col_city") },
|
|
1022
|
+
...args.archived ? [{ header: t("cli_col_archived") }] : [],
|
|
1023
|
+
{ header: t("cli_col_id") }
|
|
1024
|
+
];
|
|
1025
|
+
const rows = items.map((customer) => [
|
|
1026
|
+
customer.name,
|
|
1027
|
+
[customer.postalCode, customer.city].filter(Boolean).join(" "),
|
|
1028
|
+
...args.archived ? [customer.archived ? t("cli_yes") : t("cli_no")] : [],
|
|
1029
|
+
customer.id
|
|
1030
|
+
]);
|
|
1031
|
+
out(table(columns, rows));
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
function buildCreateBody(fields) {
|
|
1036
|
+
const name = optional(fields.name);
|
|
1037
|
+
const address = optional(fields.address);
|
|
1038
|
+
const postalCode = optional(fields["postal-code"]);
|
|
1039
|
+
const city = optional(fields.city);
|
|
1040
|
+
if (!name) throw new UsageError(t("cli_error_name_required"));
|
|
1041
|
+
if (!address) throw new UsageError(t("cli_error_address_required"));
|
|
1042
|
+
if (!postalCode) throw new UsageError(t("cli_error_postal_code_required"));
|
|
1043
|
+
if (!city) throw new UsageError(t("cli_error_city_required"));
|
|
1044
|
+
return {
|
|
1045
|
+
name,
|
|
1046
|
+
address,
|
|
1047
|
+
postalCode,
|
|
1048
|
+
city,
|
|
1049
|
+
country: optional(fields.country),
|
|
1050
|
+
department: optional(fields.department)
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
function createCommand() {
|
|
1054
|
+
return defineCommand2({
|
|
1055
|
+
meta: { name: "create", description: t("cli_cmd_customers_create") },
|
|
1056
|
+
args: {
|
|
1057
|
+
...commonArgs(),
|
|
1058
|
+
...customerFieldArgs()
|
|
1059
|
+
},
|
|
1060
|
+
async run({ args }) {
|
|
1061
|
+
const customer = await client().post("/customers", buildCreateBody(args));
|
|
1062
|
+
if (args.json) printJson(customer);
|
|
1063
|
+
else out(t("cli_customer_created", customer.name));
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
function updatePayload(fields) {
|
|
1068
|
+
const payload = {};
|
|
1069
|
+
const name = providedValue(fields.name);
|
|
1070
|
+
const address = providedValue(fields.address);
|
|
1071
|
+
const postalCode = providedValue(fields["postal-code"]);
|
|
1072
|
+
const city = providedValue(fields.city);
|
|
1073
|
+
const country = providedValue(fields.country);
|
|
1074
|
+
const department = providedValue(fields.department);
|
|
1075
|
+
if (name !== void 0) payload.name = name;
|
|
1076
|
+
if (address !== void 0) payload.address = address;
|
|
1077
|
+
if (postalCode !== void 0) payload.postalCode = postalCode;
|
|
1078
|
+
if (city !== void 0) payload.city = city;
|
|
1079
|
+
if (country !== void 0) payload.country = country;
|
|
1080
|
+
if (department !== void 0) payload.department = department;
|
|
1081
|
+
return payload;
|
|
1082
|
+
}
|
|
1083
|
+
function ensureUpdatePayload(fields) {
|
|
1084
|
+
const payload = updatePayload(fields);
|
|
1085
|
+
if (Object.keys(payload).length === 0) {
|
|
1086
|
+
throw new UsageError(t("cli_error_update_fields_required"));
|
|
1087
|
+
}
|
|
1088
|
+
return payload;
|
|
1089
|
+
}
|
|
1090
|
+
function updateCommand() {
|
|
1091
|
+
return defineCommand2({
|
|
1092
|
+
meta: { name: "update", description: t("cli_cmd_customers_update") },
|
|
1093
|
+
args: {
|
|
1094
|
+
customer: { type: "positional", description: t("cli_arg_customer_ref"), required: true },
|
|
1095
|
+
...commonArgs(),
|
|
1096
|
+
...customerFieldArgs()
|
|
1097
|
+
},
|
|
1098
|
+
async run({ args }) {
|
|
1099
|
+
const payload = ensureUpdatePayload(args);
|
|
1100
|
+
const ref = String(args.customer);
|
|
1101
|
+
const api = client();
|
|
1102
|
+
const customerId = isUuid(ref) ? ref : resolveCustomer(ref, await api.getAllPages("/customers")).id;
|
|
1103
|
+
const customer = await api.patch(`/customers/${customerId}`, payload);
|
|
1104
|
+
if (args.json) printJson(customer);
|
|
1105
|
+
else out(t("cli_customer_updated", customer.name));
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
function customersCommand() {
|
|
1110
|
+
return defineCommand2({
|
|
1111
|
+
meta: { name: "customers", description: t("cli_cmd_customers") },
|
|
1112
|
+
subCommands: { ls: listCommand(), create: createCommand(), update: updateCommand() }
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
// src/commands/invoices.ts
|
|
1117
|
+
import { defineCommand as defineCommand3 } from "citty";
|
|
1118
|
+
import { writeFile } from "fs/promises";
|
|
1119
|
+
|
|
932
1120
|
// src/lib/items.ts
|
|
933
1121
|
var NUMBER = /^-?\d+(?:[.,]\d+)?$/;
|
|
934
1122
|
function toNumber(raw) {
|
|
@@ -1021,7 +1209,7 @@ async function savePdf(api, reference, target) {
|
|
|
1021
1209
|
await writeFile(filename, pdf.data);
|
|
1022
1210
|
return filename;
|
|
1023
1211
|
}
|
|
1024
|
-
function
|
|
1212
|
+
function createCommand2() {
|
|
1025
1213
|
return defineCommand3({
|
|
1026
1214
|
meta: { name: "create", description: t("cli_cmd_invoices_create") },
|
|
1027
1215
|
args: {
|
|
@@ -1069,6 +1257,63 @@ function createCommand() {
|
|
|
1069
1257
|
}
|
|
1070
1258
|
});
|
|
1071
1259
|
}
|
|
1260
|
+
function updateCommand2() {
|
|
1261
|
+
return defineCommand3({
|
|
1262
|
+
meta: { name: "update", description: t("cli_cmd_invoices_update") },
|
|
1263
|
+
args: {
|
|
1264
|
+
invoice: { type: "positional", description: t("cli_arg_invoice_ref"), required: true },
|
|
1265
|
+
...commonArgs(),
|
|
1266
|
+
customer: { type: "string", description: t("cli_flag_customer_ref") },
|
|
1267
|
+
item: { type: "string", description: t("cli_flag_item") },
|
|
1268
|
+
date: { type: "string", description: t("cli_flag_invoice_date_update") },
|
|
1269
|
+
"payment-days": { type: "string", description: t("cli_flag_payment_days") },
|
|
1270
|
+
currency: { type: "string", description: t("cli_flag_currency") },
|
|
1271
|
+
language: { type: "string", description: t("cli_flag_language") },
|
|
1272
|
+
subtitle: { type: "string", description: t("cli_flag_subtitle") },
|
|
1273
|
+
reference: { type: "string", description: t("cli_flag_reference") },
|
|
1274
|
+
"vat-rate": { type: "string", description: t("cli_flag_vat_rate") },
|
|
1275
|
+
"custom-notes": { type: "string", description: t("cli_flag_custom_notes") }
|
|
1276
|
+
},
|
|
1277
|
+
async run({ args }) {
|
|
1278
|
+
const customerRef = optional(args.customer);
|
|
1279
|
+
const rawItems = toArray(args.item);
|
|
1280
|
+
const items = rawItems.length > 0 ? parseItems(rawItems) : void 0;
|
|
1281
|
+
const api = client();
|
|
1282
|
+
const customerId = customerRef ? resolveCustomer(customerRef, await api.getAllPages("/customers")).id : void 0;
|
|
1283
|
+
const payload = {};
|
|
1284
|
+
if (customerId !== void 0) payload.customerId = customerId;
|
|
1285
|
+
if (items !== void 0) payload.items = items;
|
|
1286
|
+
const date = requireDate(optional(args.date));
|
|
1287
|
+
if (date !== void 0) payload.date = date;
|
|
1288
|
+
const paymentDays = requireNumber(optional(args["payment-days"]), "cli_error_price_invalid");
|
|
1289
|
+
if (paymentDays !== void 0) payload.paymentDays = paymentDays;
|
|
1290
|
+
const currency = optional(args.currency);
|
|
1291
|
+
if (currency !== void 0) payload.currency = currency;
|
|
1292
|
+
const language = optional(args.language);
|
|
1293
|
+
if (language !== void 0) payload.language = language;
|
|
1294
|
+
const subtitle = providedValue(args.subtitle);
|
|
1295
|
+
if (subtitle !== void 0) payload.subtitle = subtitle;
|
|
1296
|
+
const reference = providedValue(args.reference);
|
|
1297
|
+
if (reference !== void 0) payload.reference = reference;
|
|
1298
|
+
const customNotes = providedValue(args["custom-notes"]);
|
|
1299
|
+
if (customNotes !== void 0) payload.customNotes = customNotes;
|
|
1300
|
+
const vatRateRaw = providedValue(args["vat-rate"]);
|
|
1301
|
+
if (vatRateRaw === "") payload.vatRate = "";
|
|
1302
|
+
else if (vatRateRaw !== void 0) {
|
|
1303
|
+
payload.vatRate = requireNumber(vatRateRaw, "cli_error_price_invalid");
|
|
1304
|
+
}
|
|
1305
|
+
if (Object.keys(payload).length === 0) {
|
|
1306
|
+
throw new UsageError(t("cli_error_update_fields_required"));
|
|
1307
|
+
}
|
|
1308
|
+
const invoice = await api.patch(
|
|
1309
|
+
`/invoices/${encodeURIComponent(String(args.invoice))}`,
|
|
1310
|
+
payload
|
|
1311
|
+
);
|
|
1312
|
+
if (args.json) printJson(invoice);
|
|
1313
|
+
else out(invoice.isQuote ? t("cli_quote_updated", invoice.invoiceNumber) : t("cli_invoice_updated", invoice.invoiceNumber));
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1072
1317
|
function pdfCommand() {
|
|
1073
1318
|
return defineCommand3({
|
|
1074
1319
|
meta: { name: "pdf", description: t("cli_cmd_invoices_pdf") },
|
|
@@ -1127,7 +1372,8 @@ function invoicesCommand() {
|
|
|
1127
1372
|
meta: { name: "invoices", description: t("cli_cmd_invoices") },
|
|
1128
1373
|
subCommands: {
|
|
1129
1374
|
ls: listCommand2(),
|
|
1130
|
-
create:
|
|
1375
|
+
create: createCommand2(),
|
|
1376
|
+
update: updateCommand2(),
|
|
1131
1377
|
pdf: pdfCommand(),
|
|
1132
1378
|
paid: paidCommand(),
|
|
1133
1379
|
unpaid: unpaidCommand()
|
|
@@ -1399,7 +1645,7 @@ function receiptsCommand() {
|
|
|
1399
1645
|
}
|
|
1400
1646
|
|
|
1401
1647
|
// src/cli.ts
|
|
1402
|
-
var VERSION = "0.
|
|
1648
|
+
var VERSION = "0.3.0";
|
|
1403
1649
|
var argv = process.argv.slice(2);
|
|
1404
1650
|
setLocale(resolveLocale(langFromArgv(argv)));
|
|
1405
1651
|
function withoutLangFlag(rawArgs) {
|