@go-labs-sg/bb 3.23.0 → 3.25.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 CHANGED
@@ -80,7 +80,7 @@ Roll out the API and maintained CLI together: `suppliers`/`pageCount` and offset
80
80
 
81
81
  **Customer-invoice readiness and quotation list loading:** `customerInvoice.getInvoiceReadiness`, `getInvoiceAmountPreview`, `getEligibleBudgets` and `getProjectInvoiceReadiness` read the budget through one selected shape (only the budget, project, contact, invoice-settings, discount and item fields the readiness and amount helpers use) with Prisma's default join instead of forced per-relation queries. The quotation list page and metrics reads also use the default join. Their outputs are unchanged.
82
82
 
83
- **Bill item, quotation download and invoice-candidate reads:** `bill.getBudgetItemsForBill` / `getBudgetItemsForProject` rows now carry only the budget-item fields the bill, claim, quotation and line-item screens use: `item { id, catalogueCode }`, `supplier { id, name, gstRegistered, lowerCaseName }` (plus `address` on the project list for supplier verification), `itemCategory { id, name }`, and, on the project list only, `actualSpendings[] { id, amount, supplier }` (the bill list has no spendings). Neither is called by the CLI. `bb quotation pdf download` / `download-quotation-pdf` (`quotation.getSignedDownloadUrl`) returns `attachment { id, name, size, supplierQuotationFileRole }` with the signed `url`, without the internal storage key and row bookkeeping. `bb customer-invoice existing list` / `list-available-qbo-customer-invoices` (`customerInvoice.getExistingInvoiceCandidates`) reads only the budget state and project access fields; its output is unchanged.
83
+ **Bill item, quotation download and invoice-candidate reads:** `bill.getBudgetItemsForBill` / `getBudgetItemsForProject` rows now carry only the budget-item fields the bill, claim, quotation and line-item screens use: `item { id, catalogueCode }`, `supplier { id, name, gstRegistered, lowerCaseName }` (plus `address` on the project list for supplier verification), `itemCategory { id, name }`, and, on the project list only, `actualSpendings[] { id, amount, supplier }` (the bill list has no spendings). Neither is called by the CLI. `bb quotation pdf download` / `download-quotation-pdf` (`quotation.getSignedDownloadUrl`) returns `attachment { id, name, size, supplierQuotationFileRole }` with the signed `url`, without the internal storage key and row bookkeeping. `bb customer-invoice existing list` / `list-available-qbo-customer-invoices` (`customerInvoice.getExistingInvoiceCandidates`) reads only the budget state and project access fields. Each item also carries `requiresEstimateLineageConfirmation` (see [Link an existing QuickBooks invoice](#link-an-existing-quickbooks-invoice)).
84
84
 
85
85
  **Project and item-category list read shapes:** `bb project list` / `bb list-projects` (`project.getAllProjects`) items keep every column the project table, cards and edit dialog use. They drop the deal-automation, calendar, win-override and lost-reason bookkeeping columns. Their relations narrow to `contactPerson { id, displayName, email }`, `company { id, name }`, `createdBy { id, name, email, image }` and `wonBy { id, name }`; `asanaProjectGid`/`asanaProjectUrl` are unchanged. Use `bb get-project <id>` for project details. `bb list-item-categories` rows carry `createdBy { id, name, email, image }` instead of the full user row.
86
86
 
@@ -191,7 +191,7 @@ Deployment prerequisite: apply the Budget Builder Prisma schema additions (`Bill
191
191
 
192
192
  ## Payload help and uncertain writes
193
193
 
194
- Run `bb <command> --help` (for example, `bb create-item --help`) to see required and optional `--payload` fields and an example JSON object. Item creation and updates accept a finite numeric `cost` and convert it to the API's decimal-string input. Validation errors identify the affected field; unsupported QuickBooks name characters are listed explicitly.
194
+ Run `bb <command> --help` (for example, `bb create-item --help`) to see required and optional `--payload` fields and an example JSON object. Item creation and updates accept a finite numeric `cost` and convert it to the API's plain decimal-string input; a string `cost` must already be a plain decimal such as `1119.50` (no commas, exponents or spaces). Validation errors identify the affected field; unsupported QuickBooks name characters are listed explicitly.
195
195
 
196
196
  If `create-budget` reports an uncertain outcome (including Prisma P2028 or a network interruption), **do not retry immediately**. Run `bb list-budgets --projectId <project-id>` and check for the budget name first; the write may have committed even though the CLI did not receive a successful response. This check is not an idempotency guarantee when another budget has the same name.
197
197
 
@@ -318,6 +318,20 @@ user; targeting another user requires a Budget Builder admin. Revocation affects
318
318
  only that device's CLI session and tokens, not automation API keys. Existing
319
319
  `bb auth login`, `status`, `whoami`, and `logout` commands are unchanged.
320
320
 
321
+ ### Android approval notifications
322
+
323
+ `bb mobile-push status` shows service configuration and your active Android
324
+ registrations. To clear a registration, copy its session ID from that output.
325
+
326
+ ```sh
327
+ bb mobile-push status
328
+ bb mobile-push unregister <sessionId> --allow-state-change
329
+ ```
330
+
331
+ The app can register again when it refreshes its token. Use Android notification
332
+ settings to turn notifications off on the phone, or revoke the session under
333
+ **CLI Sessions** to sign the device out remotely.
334
+
321
335
  Credentials use macOS Keychain, Windows Credential Manager, or Linux Secret Service, not plaintext files.
322
336
  The per-user lock directory contains only random ownership markers used to serialize
323
337
  login, refresh, and logout. macOS/Linux enforce owner-only POSIX permissions there;
@@ -669,6 +683,29 @@ Authenticate and run `bb auth whoami` first. Preview and import use the same pro
669
683
 
670
684
  Use the **BB budget ID** whose existing estimate should receive the invoice, and the numeric **QBO invoice transaction ID**, not the displayed invoice number or an estimate number. Accepted and closed estimates are supported; linking does not reopen them. Fully invoiced means all estimate coverage has been billed; it does not mean the invoices are fully paid.
671
685
 
686
+ QuickBooks often drops the estimate link on invoices created directly in QBO. Such an unlinked invoice blocks readiness and billing on every budget of its project ("ambiguous estimate lineage") until it is linked to its budget. Budget Builder assigns it on its own only under the existing final-balance rule: an unlinked invoice that completes the estimate's coverage after its earlier invoices, on a project with one accepted estimate or after a native deposit, can still be linked without confirmation. `existing list` marks an unlinked invoice that matches the budget's estimate line by line (the same items, unit prices, tax and a uniform share of every line, discount, GST and total) with `requiresEstimateLineageConfirmation: true` (the final invoice that already completes coverage under the final-balance rule is listed without the mark). After checking which estimate it bills, pass `--confirmEstimateLineage true` (or a bare `--confirmEstimateLineage`) to both `preview-qbo` and `import-qbo`. The preview then reports `estimateLineage: "REVIEWER_CONFIRMED"` and lists:
687
+
688
+ - `alsoMatchesEstimates`: other estimates of the project the invoice also matches. Budget Builder cannot tell these apart; link only after confirming which one it bills.
689
+ - `unresolvedInvoices`: other unlinked invoices that match another estimate of the project line by line, but not this one. They do not stop this link unless one could complete this estimate's coverage (see below), but they keep new billing blocked until each is linked to its budget. They are not counted toward this estimate's allocation, so review them before relying on its coverage.
690
+
691
+ The confirmed preview is refused when:
692
+
693
+ - another estimate held by the budgets of this project or of any project mapped to the same QuickBooks project (archived ones included) has a QuickBooks link to the invoice, at estimate or line level;
694
+ - QuickBooks links an invoice to both this estimate and another one (resolve that in QuickBooks first);
695
+ - one of those estimates cannot be read. A budget whose QuickBooks estimate was deleted blocks reviewed links on its project until its estimate reference is corrected;
696
+ - the project's budgets hold more than 30 other estimates;
697
+ - another unlinked invoice of the project matches neither this estimate nor any other estimate of the project line by line (reconcile it first). This includes the last invoice of a split whose rounding differs from a uniform share of every line: such splits cannot be confirmed and still need manual reconciliation;
698
+ - QuickBooks already links the selected invoice to an estimate (preview it without the flag), or another budget already owns it;
699
+ - an invoice tied to this estimate (linked from either side, at estimate or line level, or carrying this budget's Budget Builder marker) cannot be counted toward its allocation, because it does not match the estimate line by line or belongs to another project, estimate or budget;
700
+ - another invoice could complete this estimate's coverage on its own or with the invoices already linked here, or an uncounted one would complete it together with the selection or with the other invoices counted toward the cap (reconcile that invoice first);
701
+ - the QuickBooks totals of the invoices counted for this estimate would exceed its total by more than one cent;
702
+ - a Budget Builder invoice creation is still in progress anywhere;
703
+ - the selected invoice carries a Budget Builder marker (resolve it through the budget it names, or in QuickBooks).
704
+
705
+ Re-running a link that already exists skips the last five checks.
706
+
707
+ Only a confirmed preview or import checks every estimate held by the project's budgets (an ordinary preview of a final balance still compares it with the other accepted estimates, as before). During a confirmed one, an invoice another estimate claims cannot be taken as this estimate's final balance, and other unlinked invoices that also match this estimate count toward its 100% allocation. Invoices whose own QuickBooks link names another estimate are skipped. Invoices linked only from another estimate's side are neither counted nor listed, but still block this budget's billing until they are linked to that estimate's budget. Previews and imports without the flag behave as before. Once linked, the project's other budgets skip the invoice. Estimates in the same QuickBooks project that no Budget Builder budget holds are not checked.
708
+
672
709
  ```bash
673
710
  bb customer-invoice preview-qbo <budgetId> <qboInvoiceId>
674
711
  bb customer-invoice import-qbo <budgetId> <qboInvoiceId> --token <previewToken>
@@ -196,6 +196,106 @@
196
196
  "effects": [],
197
197
  "legacyTarget": "whoami"
198
198
  },
199
+ {
200
+ "path": ["mobile-push", "status"],
201
+ "legacyAliases": [],
202
+ "summary": "Show push availability and your active Android push registrations.",
203
+ "globalOptions": [
204
+ {
205
+ "name": "--help",
206
+ "description": "Show help for this command."
207
+ },
208
+ {
209
+ "name": "--quiet",
210
+ "description": "Suppress non-error diagnostics."
211
+ },
212
+ {
213
+ "name": "--debug",
214
+ "description": "Emit sanitized diagnostic traces."
215
+ },
216
+ {
217
+ "name": "--api-url",
218
+ "description": "Override the Budget Builder API base URL."
219
+ },
220
+ {
221
+ "name": "--no-browser",
222
+ "description": "Print the authorization URL without opening a browser."
223
+ },
224
+ {
225
+ "name": "--allow-state-change",
226
+ "description": "Allow a Budget Builder state change in non-interactive use."
227
+ },
228
+ {
229
+ "name": "--allow-email",
230
+ "description": "Allow sending email in non-interactive use."
231
+ },
232
+ {
233
+ "name": "--allow-external-write",
234
+ "description": "Allow writes to external systems in non-interactive use."
235
+ },
236
+ {
237
+ "name": "--allow-delete",
238
+ "description": "Allow deleting data in non-interactive use."
239
+ },
240
+ {
241
+ "name": "--allow-financial-write",
242
+ "description": "Allow financial-record changes in non-interactive use."
243
+ }
244
+ ],
245
+ "argumentMode": "legacy-passthrough",
246
+ "effects": [],
247
+ "legacyTarget": "mobile-push-status"
248
+ },
249
+ {
250
+ "path": ["mobile-push", "unregister"],
251
+ "legacyAliases": [],
252
+ "summary": "Unregister notifications for one of your active Android devices. Argument: <sessionId>.",
253
+ "globalOptions": [
254
+ {
255
+ "name": "--help",
256
+ "description": "Show help for this command."
257
+ },
258
+ {
259
+ "name": "--quiet",
260
+ "description": "Suppress non-error diagnostics."
261
+ },
262
+ {
263
+ "name": "--debug",
264
+ "description": "Emit sanitized diagnostic traces."
265
+ },
266
+ {
267
+ "name": "--api-url",
268
+ "description": "Override the Budget Builder API base URL."
269
+ },
270
+ {
271
+ "name": "--no-browser",
272
+ "description": "Print the authorization URL without opening a browser."
273
+ },
274
+ {
275
+ "name": "--allow-state-change",
276
+ "description": "Allow a Budget Builder state change in non-interactive use."
277
+ },
278
+ {
279
+ "name": "--allow-email",
280
+ "description": "Allow sending email in non-interactive use."
281
+ },
282
+ {
283
+ "name": "--allow-external-write",
284
+ "description": "Allow writes to external systems in non-interactive use."
285
+ },
286
+ {
287
+ "name": "--allow-delete",
288
+ "description": "Allow deleting data in non-interactive use."
289
+ },
290
+ {
291
+ "name": "--allow-financial-write",
292
+ "description": "Allow financial-record changes in non-interactive use."
293
+ }
294
+ ],
295
+ "argumentMode": "legacy-passthrough",
296
+ "effects": ["state-change"],
297
+ "legacyTarget": "mobile-push-unregister"
298
+ },
199
299
  {
200
300
  "path": ["budget", "list"],
201
301
  "legacyAliases": ["list-budgets", "list_budgets"],
@@ -4993,7 +5093,7 @@
4993
5093
  "preview-qbo-customer-invoice",
4994
5094
  "preview_qbo_customer_invoice"
4995
5095
  ],
4996
- "summary": "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId>.",
5096
+ "summary": "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId> [--confirmEstimateLineage true]. Use --confirmEstimateLineage only after confirming an invoice with no QuickBooks estimate link belongs to this budget's estimate.",
4997
5097
  "globalOptions": [
4998
5098
  {
4999
5099
  "name": "--help",
@@ -5046,7 +5146,7 @@
5046
5146
  "import-qbo-customer-invoice",
5047
5147
  "import_qbo_customer_invoice"
5048
5148
  ],
5049
- "summary": "Link an existing QuickBooks invoice in BB only after reviewing preview-qbo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken>. Supports closed estimates; no QBO writes or emails.",
5149
+ "summary": "Link an existing QuickBooks invoice in BB only after reviewing preview-qbo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken> [--confirmEstimateLineage true] (repeat the preview's flag). Supports closed estimates; no QBO writes or emails.",
5050
5150
  "globalOptions": [
5051
5151
  {
5052
5152
  "name": "--help",
@@ -49,6 +49,22 @@ Legacy aliases: `whoami`.
49
49
 
50
50
  Effects: none.
51
51
 
52
+ ## `bb mobile-push status`
53
+
54
+ Show push availability and your active Android push registrations.
55
+
56
+ Legacy aliases: .
57
+
58
+ Effects: none.
59
+
60
+ ## `bb mobile-push unregister`
61
+
62
+ Unregister notifications for one of your active Android devices. Argument: <sessionId>.
63
+
64
+ Legacy aliases: .
65
+
66
+ Effects: state-change.
67
+
52
68
  ## `bb budget list`
53
69
 
54
70
  List one cursor page of budgets ({ items, pageInfo }; --limit/--cursor/--direction). Omit --active for active budgets only; use --active false or --active all for Admin-only historical reads.
@@ -831,7 +847,7 @@ Effects: none.
831
847
 
832
848
  ## `bb customer-invoice preview-qbo`
833
849
 
834
- Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId>.
850
+ Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId> [--confirmEstimateLineage true]. Use --confirmEstimateLineage only after confirming an invoice with no QuickBooks estimate link belongs to this budget's estimate.
835
851
 
836
852
  Legacy aliases: `preview-qbo-customer-invoice`, `preview_qbo_customer_invoice`.
837
853
 
@@ -839,7 +855,7 @@ Effects: none.
839
855
 
840
856
  ## `bb customer-invoice import-qbo`
841
857
 
842
- Link an existing QuickBooks invoice in BB only after reviewing preview-qbo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken>. Supports closed estimates; no QBO writes or emails.
858
+ Link an existing QuickBooks invoice in BB only after reviewing preview-qbo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken> [--confirmEstimateLineage true] (repeat the preview's flag). Supports closed estimates; no QBO writes or emails.
843
859
 
844
860
  Legacy aliases: `import-qbo-customer-invoice`, `import_qbo_customer_invoice`.
845
861