iobroker.e-invoices 0.9.0 → 0.9.2

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 CHANGED
@@ -245,7 +245,7 @@ starts five days after the due date and stays quiet for a day after a reminder.
245
245
 
246
246
  - `info.connection`, `info.invoiceCount`, `info.draftCount`,
247
247
  `info.issuedCount`, `info.lastNumber`, `info.lastIssuedAt`,
248
- `info.dbVersion`, `info.lastBackup`
248
+ `info.dbVersion`, `info.lastBackup`, `info.backupWarning` (empty = backup is current)
249
249
  - `control.createDraft` (button: creates an empty draft, id lands in
250
250
  `control.lastDraftId`), `control.issueId` + `control.issue` (button:
251
251
  issues a draft), `control.refresh`, `control.backup`,
@@ -257,15 +257,40 @@ Issued artifacts (PDF/XML/XLSX), logos and backup ZIPs live below the
257
257
  `e-invoices.0.storage` file mount. The database file `invoices.db` lives in
258
258
  the instance data directory.
259
259
 
260
- For disaster recovery, back up both: the instance (covers the database and
261
- the storage files, which are kept as user files) and, additionally, create
262
- adapter backups from the PWA Backup page or the `control.backup` state.
263
- To move to another system, restore an adapter backup ZIP there via the PWA
264
- or `control.restoreId` + `control.restore`. The restore verifies checksums
265
- first and replaces the database in one transaction.
266
-
267
- When using the BackItUp adapter, include this adapter instance and its
268
- files in the backup job.
260
+ #### BackItUp (ioBroker backup) versus the adapter backup
261
+
262
+ | | ioBroker backup (e.g. BackItUp) | Adapter backup (ZIP) |
263
+ | --- | --- | --- |
264
+ | Contains the PDFs, XML, Excel files and logos | yes (`files/e-invoices.0.storage`) | yes |
265
+ | Contains the **invoice database** | **no** — `invoices.db` lives in the instance data directory, which is not part of an ioBroker backup | yes, as `dump.json` |
266
+ | Verified on restore | no | SHA-256 manifest, restore preview, safety copy |
267
+ | Restore | restore ioBroker, then the files | PWA *Backup* page or `control.restore` |
268
+
269
+ **The database reaches an ioBroker backup only through the adapter ZIP.** The ZIPs are written to
270
+ `e-invoices.0.storage/backups/`, which is part of the files an ioBroker backup takes. Without a ZIP, a
271
+ restore of an ioBroker backup brings back the documents but not the invoice numbers, the number
272
+ counters, the status and the reminders. Therefore:
273
+
274
+ - The **automatic backup is on by default** (every 1440 minutes = daily, setting *Backup interval in
275
+ minutes*, 0 = off). The interval counts from the last automatic backup, so restarting the adapter
276
+ neither skips nor repeats one; if one is overdue, it runs a minute after the start.
277
+ - The newest **7 automatic backups are kept** (setting *Automatic backups to keep*, 0 = keep all). Only
278
+ files named `e-invoices-auto-….zip` are ever deleted. Backups you made by hand
279
+ (`e-invoices-backup-….zip`) and the safety copies before a restore (`…-prerestore-…`) are never
280
+ deleted.
281
+ - The *Backup* page and the state `info.backupWarning` warn when there is no backup at all or the
282
+ newest one is older than twice the interval (at least two days; one week when the automatic backup is
283
+ off). The state is empty when everything is fine, so it can drive a notification.
284
+ - Instances that were installed before 0.9.2 keep their saved interval (the old default was 0 = off):
285
+ set it in the instance settings.
286
+
287
+ For disaster recovery use **both**: an ioBroker backup of the whole system and the adapter ZIPs (they
288
+ travel inside it). To move to another system, restore an adapter backup ZIP there via the PWA or
289
+ `control.restoreId` + `control.restore`. The restore verifies checksums first and replaces the database
290
+ in one transaction.
291
+
292
+ When using the BackItUp adapter, include this adapter instance and its files in the backup job — and
293
+ check once in the archive that `files/e-invoices.0.storage/backups/` holds a ZIP.
269
294
 
270
295
  ### API
271
296
 
@@ -425,6 +450,14 @@ validation and hybrid embedding, `pdfkit`, `exceljs`, `jszip`,
425
450
  Placeholder for the next version (at the beginning of the line):
426
451
  ### **WORK IN PROGRESS**
427
452
  -->
453
+ ### 0.9.2 (2026-10-04)
454
+
455
+ * (alex) Backup: the automatic backup is now **on by default** (daily) and keeps the newest 7 automatic backups (new setting *Automatic backups to keep*); only automatic backups are ever deleted, never those made by hand or the safety copies before a restore. The schedule counts from the last automatic backup, so a restart neither skips nor repeats one. The backup page and the new state `info.backupWarning` warn when there is no backup or it is old. Reason: an ioBroker backup (BackItUp) does not contain the invoice database `invoices.db` — it reaches the backup only through the adapter ZIP in `e-invoices.0.storage/backups/`. README compares BackItUp and the adapter backup. Instances installed earlier keep their saved interval (0 = off), set it in the instance settings.
456
+
457
+ ### 0.9.1 (2026-10-04)
458
+
459
+ * (alex) Fix: the file-based migration tests got a 30 s mocha timeout (they timed out on slow CI runners). Code documentation: all JSDoc warnings of the web app and the tests are fixed, `npm run lint` reports nothing. No functional change.
460
+
428
461
  ### 0.9.0 (2026-10-04)
429
462
 
430
463
  * (alex) Test print of the print templates with three sample documents: full invoice (two VAT rates, line discount, Skonto), small business (§ 19 UStG) and credit note.
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Mahnintervall in Stunden",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = aus. Der Adapter zählt überfällige Rechnungen nur in info.overdue*, er versendet selbst keine Mails.",
36
36
  "Web app language": "Sprache der Web-App",
37
- "auto = language of the browser; German and English are available": "auto = Sprache des Browsers; Deutsch und Englisch stehen zur Verfügung"
37
+ "auto = language of the browser; German and English are available": "auto = Sprache des Browsers; Deutsch und Englisch stehen zur Verfügung",
38
+ "Automatic backups to keep": "Automatische Backups behalten",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Ältere automatische Backups werden gelöscht, 0 = alle behalten. Manuelle Backups werden nie gelöscht."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Dunning check interval in hours",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.",
36
36
  "Web app language": "Web app language",
37
- "auto = language of the browser; German and English are available": "auto = language of the browser; German and English are available"
37
+ "auto = language of the browser; German and English are available": "auto = language of the browser; German and English are available",
38
+ "Automatic backups to keep": "Automatic backups to keep",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Intervalo de cobro en horas",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = desactivado. El adaptador solo cuenta las facturas vencidas en info.overdue*, no envía correos por sí mismo.",
36
36
  "Web app language": "Idioma de la aplicación web",
37
- "auto = language of the browser; German and English are available": "auto = idioma del navegador; alemán e inglés disponibles"
37
+ "auto = language of the browser; German and English are available": "auto = idioma del navegador; alemán e inglés disponibles",
38
+ "Automatic backups to keep": "Copias de seguridad automáticas a conservar",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Las copias automáticas más antiguas se eliminan, 0 = conservar todas. Las copias manuales nunca se eliminan."
38
40
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "0 = off, otherwise an automatic backup into the storage mount": "0 = désactivé ; sinon sauvegarde automatique dans le point de stockage",
3
3
  "127.0.0.1 = only this machine, 0.0.0.0 = all interfaces": "127.0.0.1 = uniquement cette machine, 0.0.0.0 = toutes les interfaces",
4
- "API port": "Port de l\u0027API",
4
+ "API port": "Port de l'API",
5
5
  "API token (optional)": "Jeton API (facultatif)",
6
6
  "Backup interval in minutes": "Intervalle de sauvegarde en minutes",
7
7
  "BIC": "BIC",
@@ -32,7 +32,9 @@
32
32
  "VAT ID (USt-IdNr.)": "N° de TVA",
33
33
  "Website": "Site web",
34
34
  "Dunning check interval in hours": "Intervalle de relance en heures",
35
- "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = désactivé. L\u0027adaptateur ne compte que les factures échues dans info.overdue*, il n\u0027envoie aucun e-mail lui-même.",
35
+ "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = désactivé. L'adaptateur ne compte que les factures échues dans info.overdue*, il n'envoie aucun e-mail lui-même.",
36
36
  "Web app language": "Langue de l'application web",
37
- "auto = language of the browser; German and English are available": "auto = langue du navigateur ; allemand et anglais disponibles"
37
+ "auto = language of the browser; German and English are available": "auto = langue du navigateur ; allemand et anglais disponibles",
38
+ "Automatic backups to keep": "Sauvegardes automatiques à conserver",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Les anciennes sauvegardes automatiques sont supprimées, 0 = tout conserver. Les sauvegardes manuelles ne sont jamais supprimées."
38
40
  }
@@ -15,7 +15,7 @@
15
15
  "Company zip code": "CAP",
16
16
  "Default payment terms": "Condizioni di pagamento predefinite",
17
17
  "Default VAT rate": "Aliquota IVA predefinita",
18
- "e-invoices adapter settings": "Impostazioni dell\u0027adattatore per e-invoices",
18
+ "e-invoices adapter settings": "Impostazioni dell'adattatore per e-invoices",
19
19
  "empty = own data directory; otherwise an existing ioBroker file mount, e.g. e-invoices": "vuoto = directory propria; altrimenti un mount di file ioBroker esistente, ad es. e-invoices",
20
20
  "Empty means no authentication (LAN trust)": "Vuoto significa nessuna autenticazione (fiducia LAN)",
21
21
  "IBAN": "IBAN",
@@ -32,7 +32,9 @@
32
32
  "VAT ID (USt-IdNr.)": "P. IVA",
33
33
  "Website": "Sito web",
34
34
  "Dunning check interval in hours": "Intervallo di sollecitazione in ore",
35
- "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = disattivato. L\u0027adattatore conta solo le fatture scadute in info.overdue*, non invia email per conto proprio.",
35
+ "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = disattivato. L'adattatore conta solo le fatture scadute in info.overdue*, non invia email per conto proprio.",
36
36
  "Web app language": "Lingua dell'app web",
37
- "auto = language of the browser; German and English are available": "auto = lingua del browser; tedesco e inglese disponibili"
37
+ "auto = language of the browser; German and English are available": "auto = lingua del browser; tedesco e inglese disponibili",
38
+ "Automatic backups to keep": "Backup automatici da conservare",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "I backup automatici più vecchi vengono eliminati, 0 = conserva tutti. I backup manuali non vengono mai eliminati."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Herinneringsinterval in uren",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = uit. De adapter telt alleen vervallen facturen in info.overdue*, hij verzendt zelf geen e-mails.",
36
36
  "Web app language": "Taal van de web-app",
37
- "auto = language of the browser; German and English are available": "auto = taal van de browser; Duits en Engels beschikbaar"
37
+ "auto = language of the browser; German and English are available": "auto = taal van de browser; Duits en Engels beschikbaar",
38
+ "Automatic backups to keep": "Automatische back-ups om te bewaren",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Oudere automatische back-ups worden verwijderd, 0 = alles bewaren. Handmatige back-ups worden nooit verwijderd."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Interwał przypomnień w godzinach",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = wyłączone. Adapter liczy tylko zaległe faktury w info.overdue*, sam nie wysyła e-maili.",
36
36
  "Web app language": "Język aplikacji webowej",
37
- "auto = language of the browser; German and English are available": "auto = język przeglądarki; dostępne niemiecki i angielski"
37
+ "auto = language of the browser; German and English are available": "auto = język przeglądarki; dostępne niemiecki i angielski",
38
+ "Automatic backups to keep": "Liczba automatycznych kopii do zachowania",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Starsze automatyczne kopie są usuwane, 0 = zachowaj wszystkie. Kopie ręczne nigdy nie są usuwane."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Intervalo de cobrança em horas",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = desligado. O adaptador apenas conta faturas vencidas em info.overdue*, não envia e-mails por si próprio.",
36
36
  "Web app language": "Idioma da aplicação web",
37
- "auto = language of the browser; German and English are available": "auto = idioma do navegador; alemão e inglês disponíveis"
37
+ "auto = language of the browser; German and English are available": "auto = idioma do navegador; alemão e inglês disponíveis",
38
+ "Automatic backups to keep": "Backups automáticos a manter",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Os backups automáticos mais antigos são eliminados, 0 = manter todos. Os backups manuais nunca são eliminados."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Интервал напоминаний в часах",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = выключено. Адаптер только считает просроченные счета в info.overdue*, сам письма не отправляет.",
36
36
  "Web app language": "Язык веб-приложения",
37
- "auto = language of the browser; German and English are available": "auto = язык браузера; доступны немецкий и английский"
37
+ "auto = language of the browser; German and English are available": "auto = язык браузера; доступны немецкий и английский",
38
+ "Automatic backups to keep": "Сколько автоматических резервных копий хранить",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Более старые автоматические копии удаляются, 0 = хранить все. Копии, созданные вручную, не удаляются никогда."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "Інтервал нагадувань у годинах",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = вимкнено. Адаптер лише рахує прострочені рахунки в info.overdue*, сам листа не надсилає.",
36
36
  "Web app language": "Мова веб-застосунку",
37
- "auto = language of the browser; German and English are available": "auto = мова браузера; доступні німецька та англійська"
37
+ "auto = language of the browser; German and English are available": "auto = мова браузера; доступні німецька та англійська",
38
+ "Automatic backups to keep": "Скільки автоматичних резервних копій зберігати",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "Старіші автоматичні копії видаляються, 0 = зберігати всі. Копії, створені вручну, не видаляються ніколи."
38
40
  }
@@ -34,5 +34,7 @@
34
34
  "Dunning check interval in hours": "催款检查间隔(小时)",
35
35
  "0 = off. The adapter only counts overdue invoices into info.overdue*, it never sends mails by itself.": "0 = 关闭。适配器只统计逾期发票到 info.overdue*,不会自行发送邮件。",
36
36
  "Web app language": "网页应用语言",
37
- "auto = language of the browser; German and English are available": "auto = 浏览器语言;提供德语和英语"
37
+ "auto = language of the browser; German and English are available": "auto = 浏览器语言;提供德语和英语",
38
+ "Automatic backups to keep": "保留的自动备份数量",
39
+ "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.": "较旧的自动备份将被删除,0 = 全部保留。手动备份永远不会被删除。"
38
40
  }
@@ -54,6 +54,19 @@
54
54
  "lg": 4,
55
55
  "xl": 4
56
56
  },
57
+ "backupKeep": {
58
+ "type": "number",
59
+ "label": "Automatic backups to keep",
60
+ "help": "Older automatic backups are deleted, 0 = keep all. Manual backups are never deleted.",
61
+ "min": 0,
62
+ "max": 365,
63
+ "newLine": false,
64
+ "xs": 12,
65
+ "sm": 12,
66
+ "md": 6,
67
+ "lg": 4,
68
+ "xl": 4
69
+ },
57
70
  "reminderCheckHours": {
58
71
  "type": "number",
59
72
  "label": "Dunning check interval in hours",
@@ -264,7 +264,7 @@ function secretEquals(provided, expected) {
264
264
  return (0, import_node_crypto.timingSafeEqual)(a, b);
265
265
  }
266
266
  function createApiServer(deps) {
267
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
267
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
268
268
  const { db, storage, log, version, authToken } = deps;
269
269
  const settings = {
270
270
  defaultVatRate: import_invoice_model.ALLOWED_VAT_RATES.includes(Number((_a = deps.settings) == null ? void 0 : _a.defaultVatRate)) ? Number((_b = deps.settings) == null ? void 0 : _b.defaultVatRate) : 19,
@@ -276,11 +276,12 @@ function createApiServer(deps) {
276
276
  // matching format next to the invoice one.
277
277
  quoteNumberFormat: ((_k = (_j = deps.settings) == null ? void 0 : _j.quoteNumberFormat) == null ? void 0 : _k.trim()) || import_invoice_model.DEFAULT_QUOTE_NUMBER_FORMAT,
278
278
  storageMount: (_n = (_m = (_l = deps.settings) == null ? void 0 : _l.storageMount) == null ? void 0 : _m.trim()) != null ? _n : "",
279
- backupIntervalMinutes: Math.max(0, Math.round(Number((_o = deps.settings) == null ? void 0 : _o.backupIntervalMinutes) || 0))
279
+ backupIntervalMinutes: Math.max(0, Math.round(Number((_o = deps.settings) == null ? void 0 : _o.backupIntervalMinutes) || 0)),
280
+ backupKeep: Math.max(0, Math.round(Number((_p = deps.settings) == null ? void 0 : _p.backupKeep) || 0))
280
281
  };
281
282
  const limits = {
282
- api: Math.max(1, Math.round((_q = (_p = deps.limits) == null ? void 0 : _p.api) != null ? _q : 600)),
283
- restore: Math.max(1, Math.round((_s = (_r = deps.limits) == null ? void 0 : _r.restore) != null ? _s : 10))
283
+ api: Math.max(1, Math.round((_r = (_q = deps.limits) == null ? void 0 : _q.api) != null ? _r : 600)),
284
+ restore: Math.max(1, Math.round((_t = (_s = deps.limits) == null ? void 0 : _s.restore) != null ? _t : 10))
284
285
  };
285
286
  const app = (0, import_express.default)();
286
287
  app.disable("x-powered-by");
@@ -1359,6 +1360,9 @@ ${(0, import_csv.renderDatevRows)(filteredInvoices(db, req.query, "invoice"))}`)
1359
1360
  app.get("/api/backups", (_req, res) => {
1360
1361
  res.json(db.listBackups());
1361
1362
  });
1363
+ app.get("/api/backups/status", (_req, res) => {
1364
+ res.json((0, import_backup.backupStatus)(db.listBackups(), settings.backupIntervalMinutes, settings.backupKeep, Date.now()));
1365
+ });
1362
1366
  app.get(
1363
1367
  "/api/backups/file/:name",
1364
1368
  route(async (req, res) => {