@company-six/qbosync 0.10.0 → 0.10.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.
package/README.md CHANGED
@@ -187,6 +187,7 @@ The SDK sends each file to QBO Sync first, adds it to the document's `attachment
187
187
  - **The files follow the document.** QBO Sync attaches them once the document is in QuickBooks. A problem with a file never holds the document back or fails it.
188
188
  - **What is accepted:** up to 10 files a document, 20 MB each, of the types QuickBooks takes (pdf, png, jpg, jpeg, gif, tif, tiff, csv, txt, rtf, xml, doc, docx, xls, xlsx, ods, ai, eps). Two files on the same document cannot share a name; any other document may reuse it. A file that fails these is not sent, nor is its document, and the result says why (`parked`).
189
189
  - **A file that could not be sent** (the file store was down) leaves its document unsent with `failure`: send both again later.
190
+ - **A QBO Sync older than files** (it answers 404 where files are sent) is the same: `failure`, never `parked`, so nothing is refused for good while QBO Sync waits to be updated (0.10.1). Any other refusal there is still `parked`.
190
191
 
191
192
  To do the two steps yourself, `uploadAttachment` sends one file and answers what to put in the document:
192
193
 
package/dist/client.js CHANGED
@@ -314,6 +314,17 @@ export class QbosyncClient {
314
314
  return called;
315
315
  const { res } = called;
316
316
  const body = (await res.json().catch(() => null));
317
+ // QBO Sync's upload route never answers 404 itself, so a 404 means this QBO Sync is older than files (0.9.0) and has
318
+ // no such route yet. Nothing is wrong with the file or its document: a refusal would park it for good, when it only
319
+ // needs QBO Sync to be updated. Try again later instead (0.10.1).
320
+ if (res.status === 404) {
321
+ return {
322
+ ok: false,
323
+ reason: "unavailable",
324
+ status: 404,
325
+ error: "QBO Sync cannot take files yet: it answered 404 where files are sent, so it runs an older version than this SDK. Nothing was refused; send again once QBO Sync is updated.",
326
+ };
327
+ }
317
328
  if (!res.ok)
318
329
  return failureOf(res, body);
319
330
  if (body?.held === true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-six/qbosync",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Connect an app to QBO Sync: send invoices, credit memos, bills and vendor credits to QuickBooks, and hear back what happened to them.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",