@company-six/qbosync 0.12.0 → 0.12.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 +3 -1
- package/dist/contract/common.d.ts +13 -2
- package/dist/contract/common.js +17 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,7 +146,9 @@ Apps send invoices, credit memos, bills and vendor credits. Payments, refunds an
|
|
|
146
146
|
- **It is not `order_ref`.** `order_ref` is how a payment finds its invoice; `sale_group` is how a bill finds its sale's invoice. A document may carry both, either or neither, with the same id or different ones, and neither is used in the other's place.
|
|
147
147
|
- **Send it on invoices, bills and vendor credits.** A credit memo may carry it, but nothing reads it there: a credit memo keeps applying to its invoice as before.
|
|
148
148
|
- **It is an object** so later versions can add facts about the sale beside `ref`. Today `ref` is its only key and any other is refused. It carries no instructions: what a company does with a sale's costs is its own setting in QBO Sync.
|
|
149
|
-
-
|
|
149
|
+
- **What QBO Sync does with it is each company's own setting.** With no setting, the field is stored and nothing else changes. A company may choose to keep a bill's cost aside (in a Costs in progress account) until the sale's first invoice is in QuickBooks, and then move it to cost; for that, the bill and the invoice must carry the same `ref`. A QBO Sync that does not know the field yet refuses a document that carries it, so start sending it only once QBO Sync has been updated.
|
|
150
|
+
- **A document already sent keeps what it was first sent with.** Sending it again at the same `version` with `sale_group` added is a changed document and is refused (`version_conflict`), and a document already in QuickBooks takes no new version. So start with sales whose documents are all still to be sent, and do not name a sale on a bill when that sale's invoice was sent without it: the bill would find no invoice of its sale, and a company that keeps that cost aside keeps it aside until an invoice that names the sale reaches QuickBooks.
|
|
151
|
+
- **`ref` is at most 200 characters** (0.12.1); a longer one is refused.
|
|
150
152
|
|
|
151
153
|
### Bills and vendor credits (0.5.0)
|
|
152
154
|
|
|
@@ -27,6 +27,8 @@ export declare const text: z.ZodString;
|
|
|
27
27
|
export declare const isoDate: z.ZodString;
|
|
28
28
|
/** An ISO 4217 currency code, upper case: "USD". */
|
|
29
29
|
export declare const currency: z.ZodString;
|
|
30
|
+
/** `sale_group.ref` is at most this many characters (0.12.1). */
|
|
31
|
+
export declare const MAX_SALE_GROUP_REF = 200;
|
|
30
32
|
/**
|
|
31
33
|
* `order_ref`: "<system>:<id>", e.g. "shopify:5551234567". Two apps' order ids can
|
|
32
34
|
* collide; the system prefix is what keeps them apart, so it is required.
|
|
@@ -54,8 +56,17 @@ export declare const orderRef: z.ZodString;
|
|
|
54
56
|
* is refused today.
|
|
55
57
|
*
|
|
56
58
|
* Meant for invoices, bills and vendor credits. A credit memo may carry it, but nothing reads it there: a credit
|
|
57
|
-
* memo keeps applying to its invoice as before.
|
|
58
|
-
*
|
|
59
|
+
* memo keeps applying to its invoice as before.
|
|
60
|
+
*
|
|
61
|
+
* What QBO Sync does with a sale's documents is each company's own setting. With no setting, the field is stored
|
|
62
|
+
* and nothing else changes. A company may choose to keep a bill's cost aside until the sale's invoice is in
|
|
63
|
+
* QuickBooks; for that, the bill and the invoice must carry the same `ref`.
|
|
64
|
+
*
|
|
65
|
+
* A document already sent keeps what it was first sent with: the same version sent again with `sale_group` added
|
|
66
|
+
* is a changed document and is refused, and a document already in QuickBooks takes no new version. So name sales
|
|
67
|
+
* on documents still to be sent, and never on a bill whose sale's invoice was sent without it.
|
|
68
|
+
*
|
|
69
|
+
* `ref` is at most `MAX_SALE_GROUP_REF` characters (0.12.1): QBO Sync indexes it.
|
|
59
70
|
*/
|
|
60
71
|
export declare const saleGroup: z.ZodObject<{
|
|
61
72
|
ref: z.ZodString;
|
package/dist/contract/common.js
CHANGED
|
@@ -33,6 +33,8 @@ export const isoDate = z.string().refine((s) => {
|
|
|
33
33
|
export const currency = z.string().regex(/^[A-Z]{3}$/, "must be a three-letter currency code such as USD");
|
|
34
34
|
/** The form `order_ref` and `sale_group.ref` share: a lower-case system name, a colon, an id with no spaces. */
|
|
35
35
|
const SYSTEM_AND_ID = /^[a-z][a-z0-9_-]*:\S+$/;
|
|
36
|
+
/** `sale_group.ref` is at most this many characters (0.12.1). */
|
|
37
|
+
export const MAX_SALE_GROUP_REF = 200;
|
|
36
38
|
/**
|
|
37
39
|
* `order_ref`: "<system>:<id>", e.g. "shopify:5551234567". Two apps' order ids can
|
|
38
40
|
* collide; the system prefix is what keeps them apart, so it is required.
|
|
@@ -60,11 +62,23 @@ export const orderRef = z.string().regex(SYSTEM_AND_ID, 'must be "<system>:<id>"
|
|
|
60
62
|
* is refused today.
|
|
61
63
|
*
|
|
62
64
|
* Meant for invoices, bills and vendor credits. A credit memo may carry it, but nothing reads it there: a credit
|
|
63
|
-
* memo keeps applying to its invoice as before.
|
|
64
|
-
*
|
|
65
|
+
* memo keeps applying to its invoice as before.
|
|
66
|
+
*
|
|
67
|
+
* What QBO Sync does with a sale's documents is each company's own setting. With no setting, the field is stored
|
|
68
|
+
* and nothing else changes. A company may choose to keep a bill's cost aside until the sale's invoice is in
|
|
69
|
+
* QuickBooks; for that, the bill and the invoice must carry the same `ref`.
|
|
70
|
+
*
|
|
71
|
+
* A document already sent keeps what it was first sent with: the same version sent again with `sale_group` added
|
|
72
|
+
* is a changed document and is refused, and a document already in QuickBooks takes no new version. So name sales
|
|
73
|
+
* on documents still to be sent, and never on a bill whose sale's invoice was sent without it.
|
|
74
|
+
*
|
|
75
|
+
* `ref` is at most `MAX_SALE_GROUP_REF` characters (0.12.1): QBO Sync indexes it.
|
|
65
76
|
*/
|
|
66
77
|
export const saleGroup = z.strictObject({
|
|
67
|
-
ref: z
|
|
78
|
+
ref: z
|
|
79
|
+
.string()
|
|
80
|
+
.max(MAX_SALE_GROUP_REF, `must be at most ${MAX_SALE_GROUP_REF} characters`)
|
|
81
|
+
.regex(SYSTEM_AND_ID, 'must be "<system>:<id>", e.g. "myapp:project:2207"'),
|
|
68
82
|
});
|
|
69
83
|
/** At most this many `extra_order_refs` on one document. */
|
|
70
84
|
export const MAX_EXTRA_ORDER_REFS = 10;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@company-six/qbosync",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.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",
|