@company-six/qbosync 0.5.0 → 0.6.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 +325 -322
- package/dist/client.d.ts +7 -5
- package/dist/client.js +9 -6
- package/dist/contract/codes.d.ts +10 -2
- package/dist/contract/codes.js +10 -1
- package/package.json +44 -44
- package/sql/002_daily_report.sql +260 -260
- package/sql/003_daily_report_bills.sql +25 -0
package/dist/client.d.ts
CHANGED
|
@@ -138,9 +138,11 @@ export declare class QbosyncClient {
|
|
|
138
138
|
documents: ReportEntry[];
|
|
139
139
|
} | Failure>;
|
|
140
140
|
/**
|
|
141
|
-
* Lists the codes the app uses, each with a label, so
|
|
142
|
-
* document carries them: item codes under Setup -> Products, cost codes under Setup -> Cost
|
|
143
|
-
*
|
|
141
|
+
* Lists the codes the app uses for one company, each with a label, so that company sees them in QBO Sync's
|
|
142
|
+
* Setup before any document carries them: item codes under Setup -> Products, cost codes under Setup -> Cost
|
|
143
|
+
* codes. `company_key` names the company as the app's documents do; an app with a single company may leave it
|
|
144
|
+
* out, one with several must send it (0.6.0), and no company sees what was listed for another. Each kind sent is
|
|
145
|
+
* that company's whole list of that kind (a code left out is removed); a kind not sent is left as it is.
|
|
144
146
|
* Changes nothing about posting. Checked here first: a list that fails is not sent (`rejected`, `status` absent).
|
|
145
147
|
* Safe to call again with the same list, for example each time the app starts.
|
|
146
148
|
*/
|
|
@@ -148,8 +150,8 @@ export declare class QbosyncClient {
|
|
|
148
150
|
ok: true;
|
|
149
151
|
codes: DeclaredCodes;
|
|
150
152
|
} | Failure>;
|
|
151
|
-
/** The codes QBO Sync holds for the app, as last listed with `declareCodes`. */
|
|
152
|
-
declaredCodes(): Promise<{
|
|
153
|
+
/** The codes QBO Sync holds for the app and one company, as last listed with `declareCodes`. */
|
|
154
|
+
declaredCodes(companyKey?: string): Promise<{
|
|
153
155
|
ok: true;
|
|
154
156
|
codes: DeclaredCodes;
|
|
155
157
|
} | Failure>;
|
package/dist/client.js
CHANGED
|
@@ -221,9 +221,11 @@ export class QbosyncClient {
|
|
|
221
221
|
}
|
|
222
222
|
// ---- codes
|
|
223
223
|
/**
|
|
224
|
-
* Lists the codes the app uses, each with a label, so
|
|
225
|
-
* document carries them: item codes under Setup -> Products, cost codes under Setup -> Cost
|
|
226
|
-
*
|
|
224
|
+
* Lists the codes the app uses for one company, each with a label, so that company sees them in QBO Sync's
|
|
225
|
+
* Setup before any document carries them: item codes under Setup -> Products, cost codes under Setup -> Cost
|
|
226
|
+
* codes. `company_key` names the company as the app's documents do; an app with a single company may leave it
|
|
227
|
+
* out, one with several must send it (0.6.0), and no company sees what was listed for another. Each kind sent is
|
|
228
|
+
* that company's whole list of that kind (a code left out is removed); a kind not sent is left as it is.
|
|
227
229
|
* Changes nothing about posting. Checked here first: a list that fails is not sent (`rejected`, `status` absent).
|
|
228
230
|
* Safe to call again with the same list, for example each time the app starts.
|
|
229
231
|
*/
|
|
@@ -240,9 +242,10 @@ export class QbosyncClient {
|
|
|
240
242
|
});
|
|
241
243
|
return this.codesAnswer(called);
|
|
242
244
|
}
|
|
243
|
-
/** The codes QBO Sync holds for the app, as last listed with `declareCodes`. */
|
|
244
|
-
async declaredCodes() {
|
|
245
|
-
|
|
245
|
+
/** The codes QBO Sync holds for the app and one company, as last listed with `declareCodes`. */
|
|
246
|
+
async declaredCodes(companyKey) {
|
|
247
|
+
const query = companyKey ? `?company_key=${encodeURIComponent(companyKey)}` : "";
|
|
248
|
+
return this.codesAnswer(await this.call(`/api/v1/codes${query}`));
|
|
246
249
|
}
|
|
247
250
|
async codesAnswer(called) {
|
|
248
251
|
if (!called.ok)
|
package/dist/contract/codes.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ import { z } from "zod";
|
|
|
8
8
|
* Listing changes nothing about posting, and is optional: an app with real catalogue SKUs lists nothing, and an app
|
|
9
9
|
* may still send a code it never listed. Each kind sent is the app's whole list of that kind: a code left out is
|
|
10
10
|
* removed, a kind not sent is left as it is.
|
|
11
|
+
*
|
|
12
|
+
* A list is for ONE company (0.6.0): the `company_key` its documents carry. A company sees only the codes listed for
|
|
13
|
+
* it, never those an app listed for its other companies. An app with a single company may leave `company_key` out.
|
|
11
14
|
*/
|
|
12
15
|
/** Longest item code QBO Sync keeps (Setup -> Products). */
|
|
13
16
|
export declare const MAX_ITEM_CODE_LENGTH = 200;
|
|
@@ -31,8 +34,13 @@ export declare const declaredCostCodeSchema: z.ZodObject<{
|
|
|
31
34
|
}, z.core.$strict>;
|
|
32
35
|
export type DeclaredItemCode = z.infer<typeof declaredItemCodeSchema>;
|
|
33
36
|
export type DeclaredCostCode = z.infer<typeof declaredCostCodeSchema>;
|
|
34
|
-
/** What `PUT /api/v1/codes` takes. At least one kind; each kind sent replaces
|
|
37
|
+
/** What `PUT /api/v1/codes` takes. At least one kind; each kind sent replaces that company's list of that kind. */
|
|
35
38
|
export declare const codesDeclarationSchema: z.ZodObject<{
|
|
39
|
+
/**
|
|
40
|
+
* The company the lists are for, as the app's documents name it. Needed when the app sends for several
|
|
41
|
+
* companies; with one, it may be left out (0.6.0).
|
|
42
|
+
*/
|
|
43
|
+
company_key: z.ZodOptional<z.ZodString>;
|
|
36
44
|
item_codes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
45
|
/** Exactly as the app puts it on a line's `item_code`. */
|
|
38
46
|
code: z.ZodString;
|
|
@@ -49,7 +57,7 @@ export declare const codesDeclarationSchema: z.ZodObject<{
|
|
|
49
57
|
}, z.core.$strict>>>;
|
|
50
58
|
}, z.core.$strict>;
|
|
51
59
|
export type CodesDeclaration = z.infer<typeof codesDeclarationSchema>;
|
|
52
|
-
/** What QBO Sync holds for the app: `GET /api/v1/codes`, and the answer to a `PUT`. */
|
|
60
|
+
/** What QBO Sync holds for the app and one company: `GET /api/v1/codes`, and the answer to a `PUT`. */
|
|
53
61
|
export interface DeclaredCodes {
|
|
54
62
|
item_codes: DeclaredItemCode[];
|
|
55
63
|
cost_codes: DeclaredCostCode[];
|
package/dist/contract/codes.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { costCode } from "./bill.js";
|
|
3
|
+
import { text } from "./common.js";
|
|
3
4
|
/**
|
|
4
5
|
* The codes an app uses, listed ahead of any document (0.5.0). Each company maps an app's codes in QBO Sync's
|
|
5
6
|
* Setup: item codes to QuickBooks products (Setup -> Products), cost codes to QuickBooks accounts (Setup -> Cost
|
|
@@ -9,6 +10,9 @@ import { costCode } from "./bill.js";
|
|
|
9
10
|
* Listing changes nothing about posting, and is optional: an app with real catalogue SKUs lists nothing, and an app
|
|
10
11
|
* may still send a code it never listed. Each kind sent is the app's whole list of that kind: a code left out is
|
|
11
12
|
* removed, a kind not sent is left as it is.
|
|
13
|
+
*
|
|
14
|
+
* A list is for ONE company (0.6.0): the `company_key` its documents carry. A company sees only the codes listed for
|
|
15
|
+
* it, never those an app listed for its other companies. An app with a single company may leave `company_key` out.
|
|
12
16
|
*/
|
|
13
17
|
/** Longest item code QBO Sync keeps (Setup -> Products). */
|
|
14
18
|
export const MAX_ITEM_CODE_LENGTH = 200;
|
|
@@ -48,9 +52,14 @@ function noRepeats(list, ctx, field) {
|
|
|
48
52
|
seen.add(entry.code);
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
|
-
/** What `PUT /api/v1/codes` takes. At least one kind; each kind sent replaces
|
|
55
|
+
/** What `PUT /api/v1/codes` takes. At least one kind; each kind sent replaces that company's list of that kind. */
|
|
52
56
|
export const codesDeclarationSchema = z
|
|
53
57
|
.strictObject({
|
|
58
|
+
/**
|
|
59
|
+
* The company the lists are for, as the app's documents name it. Needed when the app sends for several
|
|
60
|
+
* companies; with one, it may be left out (0.6.0).
|
|
61
|
+
*/
|
|
62
|
+
company_key: text.optional(),
|
|
54
63
|
item_codes: z.array(declaredItemCodeSchema).max(MAX_DECLARED_CODES, `at most ${MAX_DECLARED_CODES} codes`).optional(),
|
|
55
64
|
cost_codes: z.array(declaredCostCodeSchema).max(MAX_DECLARED_CODES, `at most ${MAX_DECLARED_CODES} codes`).optional(),
|
|
56
65
|
})
|
package/package.json
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@company-six/qbosync",
|
|
3
|
-
"version": "0.
|
|
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
|
-
"license": "UNLICENSED",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"engines": {
|
|
9
|
-
"node": ">=20"
|
|
10
|
-
},
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"default": "./dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./contract": {
|
|
17
|
-
"types": "./dist/contract/index.d.ts",
|
|
18
|
-
"default": "./dist/contract/index.js"
|
|
19
|
-
},
|
|
20
|
-
"./supabase": {
|
|
21
|
-
"types": "./dist/supabase.d.ts",
|
|
22
|
-
"default": "./dist/supabase.js"
|
|
23
|
-
},
|
|
24
|
-
"./testing": {
|
|
25
|
-
"types": "./dist/testing.d.ts",
|
|
26
|
-
"default": "./dist/testing.js"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist",
|
|
31
|
-
"sql/*.sql",
|
|
32
|
-
"README.md"
|
|
33
|
-
],
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "tsc -p tsconfig.json",
|
|
36
|
-
"prepublishOnly": "npm run build"
|
|
37
|
-
},
|
|
38
|
-
"peerDependencies": {
|
|
39
|
-
"zod": "^4.1.13"
|
|
40
|
-
},
|
|
41
|
-
"publishConfig": {
|
|
42
|
-
"access": "public"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@company-six/qbosync",
|
|
3
|
+
"version": "0.6.0",
|
|
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
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./contract": {
|
|
17
|
+
"types": "./dist/contract/index.d.ts",
|
|
18
|
+
"default": "./dist/contract/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./supabase": {
|
|
21
|
+
"types": "./dist/supabase.d.ts",
|
|
22
|
+
"default": "./dist/supabase.js"
|
|
23
|
+
},
|
|
24
|
+
"./testing": {
|
|
25
|
+
"types": "./dist/testing.d.ts",
|
|
26
|
+
"default": "./dist/testing.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"sql/*.sql",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc -p tsconfig.json",
|
|
36
|
+
"prepublishOnly": "npm run build"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"zod": "^4.1.13"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
}
|
|
44
|
+
}
|