@go-labs-sg/bb 3.6.0 → 3.8.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 +1 -1
- package/command-manifest.json +159 -0
- package/command-reference.md +25 -1
- package/dist/index.js +125 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -706,7 +706,7 @@ Admin/Lead users can run `bb supplier approve <supplierId>` to directly re-appro
|
|
|
706
706
|
| **Budgets** | `list-budgets` (full payload by default; `--summary` or `--includeDetails false` for slim list), `get-budget`, `get-budget-items`, `get-budget-details`, `get-budget-categories` (forward cursor pages of active categories, name A–Z: `--q` / `--limit` / `--cursor`; returns `{ items, pageInfo }`), `get-budget-versions`, `rename-budget-version`, `restore-budget-version`, `update-budget-status` (`ESTIMATE_ACCEPTED` requires win proof, auto-marks `PITCH` or `LOST` projects `WON`, and auto-creates an Asana Event Ops section from Prompt 5 tasks when enabled; Prompt 5 skips quantity-zero items, combines matching non-GO-internal suppliers, keeps each GO internal item separate, removes generated work that repeats another line item or group, adds 5 mandatory supplier subtasks ending in "Get bill and upload to Budget Builder", and sets no subtask due dates; `--projectStatusOnCommercialRejection PITCH\|LOST` is required when rejecting the only accepted/closed budget on a commercial project), `mark-budget-won` (`<budgetId>` + proof file path; `PITCH` or `LOST` projects become `WON` automatically), `create-budget` / `update-budget` (`--payload`; cloned unavailable lines require `unavailableItemReviewAcknowledged: true`), `delete-budget`, `create-budget-approval` (also sends approval request emails), `create-estimate`, `send-estimate-to-contact-person` (same contact-person email workflow as web), `add-budget-items`, `update-budget-item`, `replace-budget-item`, `approve-unavailable-item-exception` (Lead/Admin), `remove-budget-item`, `reorder-budget-items`, `update-budget-item-supplier`, `mark-budget-items-not-utilized`, `restore-budget-item`, `create-placeholder-bill` (admin recovery), `create-budget-category`, `update-budget-category`, `delete-budget-category`, `update-budget-commission`, `delete-budget-commission`, `update-budget-discount`, `delete-budget-discount` (`--payload` where noted), `upload-budget-attachment` (`<budgetId>` + local file path; uses `attachment.requestBudgetAttachmentUpload` + PUT + `attachment.confirmBudgetAttachment`) |
|
|
707
707
|
| **Bills / claims** | `list-bills` (`--isClaimable false` for bills, `--isClaimable true` for claims, omit for both), `list-claims` (claims only), `validate-bill-selection` (`--payload`, plus `--quotationIds q1,q2` or legacy `--quotationId q1`; validates the approved supplier and quotation coverage), `link-bill-quotations` (`<billId> --quotationIds q1,q2`; Admin source-link repair for eligible supplier bills), `stage-bill-attachment` (securely uploads invoice/payment-proof files before creation and returns attachment JSON; ownership and one-hour expiry are enforced by a server-side staged-upload record rather than encoded in the object key), `cleanup-staged-bill-attachments`, `create-bill` (`--payload`; set `isClaimable=false` for a bill and provide approved `quotationIds`, or use `--quotation-exempt` for an eligible server-validated exemption; set `isClaimable=true` for a claim without quotations; supplier bills require positive **before-GST** `extractedAmount` (full invoice subtotal) and `amount` (portion billed), with `amount <= extractedAmount`; line and quotation allocation amounts also exclude GST; an already-paid supplier bill sets `alreadyPaid=true` and requires `paymentReference` plus a staged PDF in `paymentProofAttachments`; admin creation automatically queues QBO finalization while other roles remain pending approval), `update-bill` (`--payload`), `update-bill-payment-evidence` (`--payload`; replaces the payment reference and payment-proof PDFs for an already-paid bill), `delete-bill`, `create-bill-approval` (also sends approval request emails), `update-bill-status` (`PAID` requires `--paymentReference`; pass `--paymentProof <receipt.pdf>` to stage and submit a PDF up to 20MB atomically, or omit it only when BB already has payment proof; moving to `PAID` runs the server's paid-bill notification workflow), `patch-bill-payment` (PAID bills: `--paymentTrackingUrl`, `--paymentReference`, `--quickbooksBillId`, `--paymentDate` ISO; clearing a paid bill's QuickBooks link is not allowed), `patch-bill-invoice-number`, `get-bill-attachments` (newest-first cursor pages: `--limit` 1–50, `--cursor`; returns `{ items, pageInfo }`), `upload-bill-attachment` (`<billId>` + local path), `get-bill-details` (the web bill summary: status, amounts, people, payment, line totals), `get-bill-line-items` / `get-bill-approvals` (newest-first cursor pages: `--limit`, `--cursor`; `{ items, pageInfo }`), `get-bill-payment` (payment status, reference, date, tracking URL, QuickBooks link, external payment) |
|
|
708
708
|
| **Quotations** | `list-quotations` (project, budget, supplier, status, requester and text-search filters; newest-first cursor pages via `--limit` / `--cursor` / `--direction` returning `{ items, pageInfo }`; `--page` / `--perPage` / `--pageSize` are rejected), `count-quotations` (`quotation.getCounts`: filters only, returns `totalCount`, status facets that ignore their own status filter, and `--includeMetrics true` amount metrics), `get-quotation` (web quotation shape), `get-quotation-line-items` (`<quotationId>`; newest-first cursor pages, `--limit 1-100`, `--cursor`), `upload-quotation-attachment` (`<projectId>` + PDF/JPEG/PNG path up to 20MB; returns attachment JSON for payload use), `cleanup-staged-quotation-attachments`, `create-quotation` (`--payload` for `quotation.createDraft`; include `amountWithoutGst`, `gstAmount`, and `lineAmounts` entries `{ budgetItemId, amount }` for multiple selected items), `update-quotation` (`--payload`; updates a `DRAFT` or `REJECTED` quotation), `delete-quotation`, `submit-quotation`, `approve-quotation`, `reject-quotation`, `download-quotation-pdf` (`original`, `staff`, or `final`) |
|
|
709
|
-
| **Customer invoices** | `check-customer-invoice-readiness`, `list-eligible-customer-invoice-budgets`, `preview-customer-invoice-amount`, `list-available-qbo-customer-invoices`, `list-customer-invoices` (global/project/budget filters; cursor pages via `--limit` / `--cursor` / `--direction` returning `{ items, pageInfo }`, `--page` / `--perPage` rejected; `--sortBy totalInvoiceAmount` sorts provider-confirmed totals including GST, with unknown amounts last), `count-customer-invoices` (`customerInvoice.getCounts`: filters only; `totalCount`, lifecycle status facets that ignore their own status filter, and amount metrics), `get-customer-invoice` (web-shaped batch), `get-customer-invoice-invoices`, `get-customer-invoice-lines`, `get-customer-invoice-approvals`, `get-customer-invoice-history`, `get-customer-invoice-email-context`, `preview-qbo-customer-invoice`, `import-qbo-customer-invoice` (BB-only link with reviewed token), `create-customer-invoice`, `resubmit-customer-invoice` (original requester only; one replacement after confirmed expiry voiding; repeated calls return the same replacement), `discard-customer-invoice`, `delete-customer-invoice`, `void-customer-invoice`, `approve-customer-invoice` (admin), `reject-customer-invoice` (admin), `send-customer-invoice-to-contact-person`, `download-customer-invoice-pdf` (non-admins cannot download while approval is pending), `sync-customer-invoice` |
|
|
709
|
+
| **Customer invoices** | `check-customer-invoice-readiness`, `list-eligible-customer-invoice-budgets`, `preview-customer-invoice-amount`, `list-available-qbo-customer-invoices`, `list-customer-invoices` (global/project/budget filters; cursor pages via `--limit` / `--cursor` / `--direction` returning `{ items, pageInfo }`, `--page` / `--perPage` rejected; `--sortBy totalInvoiceAmount` sorts provider-confirmed totals including GST, with unknown amounts last), `count-customer-invoices` (`customerInvoice.getCounts`: filters only; `totalCount`, lifecycle status facets that ignore their own status filter, and amount metrics), `get-customer-invoice` (web-shaped batch), `get-customer-invoice-invoices`, `get-customer-invoice-lines`, `get-customer-invoice-approvals`, `get-customer-invoice-history`, `get-customer-invoice-email-context`, `preview-qbo-customer-invoice`, `import-qbo-customer-invoice` (BB-only link with reviewed token), `create-customer-invoice`, `resubmit-customer-invoice` (original requester only; one replacement after confirmed expiry voiding; repeated calls return the same replacement), `discard-customer-invoice`, `delete-customer-invoice`, `void-customer-invoice`, `approve-customer-invoice` (admin), `reject-customer-invoice` (admin), `send-customer-invoice-to-contact-person`, `download-customer-invoice-pdf` (non-admins cannot download while approval is pending), `mark-customer-invoice-sent-externally` (admin; `--sentAt` ISO, `--recipients` comma list, optional `--note`; records an APPROVED invoice as SENT/EXTERNAL, sends no email), `sync-customer-invoice` (status only: QuickBooks edits to bill-to address, memo, bill email or total are held as `qboDetailsDrift` and admins are emailed once per QuickBooks revision), `update-customer-invoice-details` (bill-to address and memo; external QuickBooks write; bill email is managed in QuickBooks), `update-customer-invoice-qbo-drift` (admin; `--resolution ACCEPT_QBO` writes BB only, `KEEP_BB` queues BB's address and memo to QuickBooks) |
|
|
710
710
|
| **Approvals** | `list-approvals` / `get-pending-approvals` (`--type budget\|supplier\|bill\|quotation\|customer_invoice\|all`), `approve-bill` / `reject-bill` (send reply email), `approve-budget` / `reject-budget` (send reply email), `approve-supplier` / `reject-supplier` (send reply email), `approve-quotation` / `reject-quotation`, `approve-customer-invoice` / `reject-customer-invoice` |
|
|
711
711
|
| **Companies & projects** | `list-companies`, `get-company`, `create-company`, `update-company` (`--payload`), `delete-company`, `list-projects`, `get-project` (its budget overview returns `totalRevenue`, calculated only from Estimate Accepted and Estimate Closed budgets), `get-project-hub-status`, `setup-project-hub`, `sync-project-hub-commercial-documents`, `create-project` (required: `--name`, `--companyId`, `--contactPersonId`, `--insideSalesId`, `--businessDevelopmentId`, `--venue`, `--startDate` as ISO datetime for project/window start; when `--asanaTaskId` is omitted, the CLI searches open Asana lead tasks in the Deals project, prompts for one of the top five matches, and resolves Slack channel fields from the selected deal card; optional `--asanaSearch`, `--pax`, `--endDate`, `--description`, `--projectManagerId`; always requests QBO project import like the web app), `update-project` (`--payload` with `dateRange.from` / `dateRange.to` for the project window; optional `projectManagerId` and `requestQboAccountantNotification` in JSON), `delete-project`, `check-project-reconciliation <id>` (runs the web app's live checks without changing status), `reconcile-project <id>` (reruns checks transactionally and marks an eligible project `RECONCILED`), `complete-project <id>` (reruns validation, marks a reconciled project `COMPLETED`, and queues QuickBooks placeholder cleanup), `import-qbo-project`, `update-project-status` (`<id>` `<status>`: `PITCH` \| `WON` \| `COMPLETED` \| `RECONCILED` \| `LOST`; close-out follows `WON` → `RECONCILED` → `COMPLETED`, and reconciliation requires every accepted/closed budget line to have an Approved/Paid bill or claim or be explicitly Not Utilized; marking `COMPLETED` queues deletion of every remaining project placeholder bill from QuickBooks; for `PITCH` → `WON` also pass a Budget Builder user `--projectManagerId` or `--projectManagerEmail`; when marking `WON` without an accepted/closed budget or proof, pass `--wonOverrideReason`) |
|
|
712
712
|
| **Contacts** | `list-contacts`, `create-contact-person` (`--payload`), `update-contact-person` (`--payload`) |
|
package/command-manifest.json
CHANGED
|
@@ -5393,6 +5393,165 @@
|
|
|
5393
5393
|
"effects": ["state-change", "external-write", "financial-write"],
|
|
5394
5394
|
"legacyTarget": "sync-customer-invoice"
|
|
5395
5395
|
},
|
|
5396
|
+
{
|
|
5397
|
+
"path": ["customer-invoice", "details", "update"],
|
|
5398
|
+
"legacyAliases": [
|
|
5399
|
+
"update-customer-invoice-details",
|
|
5400
|
+
"update_customer_invoice_details"
|
|
5401
|
+
],
|
|
5402
|
+
"summary": "Update Customer Invoice Details.",
|
|
5403
|
+
"globalOptions": [
|
|
5404
|
+
{
|
|
5405
|
+
"name": "--help",
|
|
5406
|
+
"description": "Show help for this command."
|
|
5407
|
+
},
|
|
5408
|
+
{
|
|
5409
|
+
"name": "--quiet",
|
|
5410
|
+
"description": "Suppress non-error diagnostics."
|
|
5411
|
+
},
|
|
5412
|
+
{
|
|
5413
|
+
"name": "--debug",
|
|
5414
|
+
"description": "Emit sanitized diagnostic traces."
|
|
5415
|
+
},
|
|
5416
|
+
{
|
|
5417
|
+
"name": "--api-url",
|
|
5418
|
+
"description": "Override the Budget Builder API base URL."
|
|
5419
|
+
},
|
|
5420
|
+
{
|
|
5421
|
+
"name": "--no-browser",
|
|
5422
|
+
"description": "Print the authorization URL without opening a browser."
|
|
5423
|
+
},
|
|
5424
|
+
{
|
|
5425
|
+
"name": "--allow-state-change",
|
|
5426
|
+
"description": "Allow a Budget Builder state change in non-interactive use."
|
|
5427
|
+
},
|
|
5428
|
+
{
|
|
5429
|
+
"name": "--allow-email",
|
|
5430
|
+
"description": "Allow sending email in non-interactive use."
|
|
5431
|
+
},
|
|
5432
|
+
{
|
|
5433
|
+
"name": "--allow-external-write",
|
|
5434
|
+
"description": "Allow writes to external systems in non-interactive use."
|
|
5435
|
+
},
|
|
5436
|
+
{
|
|
5437
|
+
"name": "--allow-delete",
|
|
5438
|
+
"description": "Allow deleting data in non-interactive use."
|
|
5439
|
+
},
|
|
5440
|
+
{
|
|
5441
|
+
"name": "--allow-financial-write",
|
|
5442
|
+
"description": "Allow financial-record changes in non-interactive use."
|
|
5443
|
+
}
|
|
5444
|
+
],
|
|
5445
|
+
"argumentMode": "legacy-passthrough",
|
|
5446
|
+
"effects": ["state-change", "external-write"],
|
|
5447
|
+
"legacyTarget": "update-customer-invoice-details"
|
|
5448
|
+
},
|
|
5449
|
+
{
|
|
5450
|
+
"path": ["customer-invoice", "qbo-drift", "resolve"],
|
|
5451
|
+
"legacyAliases": [
|
|
5452
|
+
"update-customer-invoice-qbo-drift",
|
|
5453
|
+
"update_customer_invoice_qbo_drift"
|
|
5454
|
+
],
|
|
5455
|
+
"summary": "Update Customer Invoice Qbo Drift.",
|
|
5456
|
+
"globalOptions": [
|
|
5457
|
+
{
|
|
5458
|
+
"name": "--help",
|
|
5459
|
+
"description": "Show help for this command."
|
|
5460
|
+
},
|
|
5461
|
+
{
|
|
5462
|
+
"name": "--quiet",
|
|
5463
|
+
"description": "Suppress non-error diagnostics."
|
|
5464
|
+
},
|
|
5465
|
+
{
|
|
5466
|
+
"name": "--debug",
|
|
5467
|
+
"description": "Emit sanitized diagnostic traces."
|
|
5468
|
+
},
|
|
5469
|
+
{
|
|
5470
|
+
"name": "--api-url",
|
|
5471
|
+
"description": "Override the Budget Builder API base URL."
|
|
5472
|
+
},
|
|
5473
|
+
{
|
|
5474
|
+
"name": "--no-browser",
|
|
5475
|
+
"description": "Print the authorization URL without opening a browser."
|
|
5476
|
+
},
|
|
5477
|
+
{
|
|
5478
|
+
"name": "--allow-state-change",
|
|
5479
|
+
"description": "Allow a Budget Builder state change in non-interactive use."
|
|
5480
|
+
},
|
|
5481
|
+
{
|
|
5482
|
+
"name": "--allow-email",
|
|
5483
|
+
"description": "Allow sending email in non-interactive use."
|
|
5484
|
+
},
|
|
5485
|
+
{
|
|
5486
|
+
"name": "--allow-external-write",
|
|
5487
|
+
"description": "Allow writes to external systems in non-interactive use."
|
|
5488
|
+
},
|
|
5489
|
+
{
|
|
5490
|
+
"name": "--allow-delete",
|
|
5491
|
+
"description": "Allow deleting data in non-interactive use."
|
|
5492
|
+
},
|
|
5493
|
+
{
|
|
5494
|
+
"name": "--allow-financial-write",
|
|
5495
|
+
"description": "Allow financial-record changes in non-interactive use."
|
|
5496
|
+
}
|
|
5497
|
+
],
|
|
5498
|
+
"argumentMode": "legacy-passthrough",
|
|
5499
|
+
"effects": ["state-change", "external-write", "financial-write"],
|
|
5500
|
+
"legacyTarget": "update-customer-invoice-qbo-drift"
|
|
5501
|
+
},
|
|
5502
|
+
{
|
|
5503
|
+
"path": ["customer-invoice", "mark-sent-externally"],
|
|
5504
|
+
"legacyAliases": [
|
|
5505
|
+
"mark-customer-invoice-sent-externally",
|
|
5506
|
+
"mark_customer_invoice_sent_externally"
|
|
5507
|
+
],
|
|
5508
|
+
"summary": "Admin only. Record an APPROVED customer invoice as SENT (source EXTERNAL) because it was emailed to the customer outside Budget Builder. Sends no email and writes nothing to QuickBooks. Requires <invoiceId> --sentAt <ISO datetime, not in the future, not before approval> --recipients a@x.com,b@y.com [--note <message reference>].",
|
|
5509
|
+
"globalOptions": [
|
|
5510
|
+
{
|
|
5511
|
+
"name": "--help",
|
|
5512
|
+
"description": "Show help for this command."
|
|
5513
|
+
},
|
|
5514
|
+
{
|
|
5515
|
+
"name": "--quiet",
|
|
5516
|
+
"description": "Suppress non-error diagnostics."
|
|
5517
|
+
},
|
|
5518
|
+
{
|
|
5519
|
+
"name": "--debug",
|
|
5520
|
+
"description": "Emit sanitized diagnostic traces."
|
|
5521
|
+
},
|
|
5522
|
+
{
|
|
5523
|
+
"name": "--api-url",
|
|
5524
|
+
"description": "Override the Budget Builder API base URL."
|
|
5525
|
+
},
|
|
5526
|
+
{
|
|
5527
|
+
"name": "--no-browser",
|
|
5528
|
+
"description": "Print the authorization URL without opening a browser."
|
|
5529
|
+
},
|
|
5530
|
+
{
|
|
5531
|
+
"name": "--allow-state-change",
|
|
5532
|
+
"description": "Allow a Budget Builder state change in non-interactive use."
|
|
5533
|
+
},
|
|
5534
|
+
{
|
|
5535
|
+
"name": "--allow-email",
|
|
5536
|
+
"description": "Allow sending email in non-interactive use."
|
|
5537
|
+
},
|
|
5538
|
+
{
|
|
5539
|
+
"name": "--allow-external-write",
|
|
5540
|
+
"description": "Allow writes to external systems in non-interactive use."
|
|
5541
|
+
},
|
|
5542
|
+
{
|
|
5543
|
+
"name": "--allow-delete",
|
|
5544
|
+
"description": "Allow deleting data in non-interactive use."
|
|
5545
|
+
},
|
|
5546
|
+
{
|
|
5547
|
+
"name": "--allow-financial-write",
|
|
5548
|
+
"description": "Allow financial-record changes in non-interactive use."
|
|
5549
|
+
}
|
|
5550
|
+
],
|
|
5551
|
+
"argumentMode": "legacy-passthrough",
|
|
5552
|
+
"effects": ["state-change", "financial-write"],
|
|
5553
|
+
"legacyTarget": "mark-customer-invoice-sent-externally"
|
|
5554
|
+
},
|
|
5396
5555
|
{
|
|
5397
5556
|
"path": ["approval", "list"],
|
|
5398
5557
|
"legacyAliases": [
|
package/command-reference.md
CHANGED
|
@@ -903,6 +903,30 @@ Legacy aliases: `sync-customer-invoice`, `sync_customer_invoice`.
|
|
|
903
903
|
|
|
904
904
|
Effects: state-change, external-write, financial-write.
|
|
905
905
|
|
|
906
|
+
## `bb customer-invoice details update`
|
|
907
|
+
|
|
908
|
+
Update Customer Invoice Details.
|
|
909
|
+
|
|
910
|
+
Legacy aliases: `update-customer-invoice-details`, `update_customer_invoice_details`.
|
|
911
|
+
|
|
912
|
+
Effects: state-change, external-write.
|
|
913
|
+
|
|
914
|
+
## `bb customer-invoice qbo-drift resolve`
|
|
915
|
+
|
|
916
|
+
Update Customer Invoice Qbo Drift.
|
|
917
|
+
|
|
918
|
+
Legacy aliases: `update-customer-invoice-qbo-drift`, `update_customer_invoice_qbo_drift`.
|
|
919
|
+
|
|
920
|
+
Effects: state-change, external-write, financial-write.
|
|
921
|
+
|
|
922
|
+
## `bb customer-invoice mark-sent-externally`
|
|
923
|
+
|
|
924
|
+
Admin only. Record an APPROVED customer invoice as SENT (source EXTERNAL) because it was emailed to the customer outside Budget Builder. Sends no email and writes nothing to QuickBooks. Requires <invoiceId> --sentAt <ISO datetime, not in the future, not before approval> --recipients a@x.com,b@y.com [--note <message reference>].
|
|
925
|
+
|
|
926
|
+
Legacy aliases: `mark-customer-invoice-sent-externally`, `mark_customer_invoice_sent_externally`.
|
|
927
|
+
|
|
928
|
+
Effects: state-change, financial-write.
|
|
929
|
+
|
|
906
930
|
## `bb approval list`
|
|
907
931
|
|
|
908
932
|
List approvals.
|
|
@@ -1195,7 +1219,7 @@ Effects: state-change.
|
|
|
1195
1219
|
|
|
1196
1220
|
Payload fields (--payload JSON)
|
|
1197
1221
|
Required: companyId: string; title: MR|MRS|MS|DR; firstName: string; lastName: string|null; email: string; mobile: string
|
|
1198
|
-
Optional: address: {streetAddress1?, city?, state?, postalCode?,
|
|
1222
|
+
Optional: address: {streetAddress1?, city?, state?, postalCode?, countryCode? (ISO 3166-1 alpha-2, e.g. SG)}
|
|
1199
1223
|
Example: bb create-contact-person --payload '{"companyId":"<company-id>","title":"MS","firstName":"Jane","lastName":"Tan","email":"jane@example.com","mobile":"+65 9123 4567"}'
|
|
1200
1224
|
|
|
1201
1225
|
## `bb contact update`
|
package/dist/index.js
CHANGED
|
@@ -10145,6 +10145,55 @@ var syncCustomerInvoice = async (invoiceId) => {
|
|
|
10145
10145
|
});
|
|
10146
10146
|
out(result);
|
|
10147
10147
|
};
|
|
10148
|
+
var updateCustomerInvoiceDetails = async ({
|
|
10149
|
+
billingAddress,
|
|
10150
|
+
customerMemo,
|
|
10151
|
+
invoiceId,
|
|
10152
|
+
requestId = randomUUID2()
|
|
10153
|
+
}) => {
|
|
10154
|
+
await assertSensitiveWorkflowConfirmed({
|
|
10155
|
+
action: "Update customer invoice billing details",
|
|
10156
|
+
entity: `invoice ${invoiceId}`,
|
|
10157
|
+
details: `saves the bill-to address and memo in BB, then queues a QuickBooks invoice update (external write); the bill email is managed in QuickBooks and is not changed; retry a lost response with --requestId ${requestId}`
|
|
10158
|
+
});
|
|
10159
|
+
const result = await api2.customerInvoice.updateInvoiceDetails.mutate({
|
|
10160
|
+
billingAddress,
|
|
10161
|
+
customerMemo,
|
|
10162
|
+
invoiceId,
|
|
10163
|
+
requestId
|
|
10164
|
+
});
|
|
10165
|
+
out({
|
|
10166
|
+
invoices: result.batch.invoices.filter((invoice) => invoice.id === invoiceId),
|
|
10167
|
+
operation: result.operation
|
|
10168
|
+
});
|
|
10169
|
+
};
|
|
10170
|
+
var updateCustomerInvoiceQboDrift = async ({
|
|
10171
|
+
invoiceId,
|
|
10172
|
+
requestId,
|
|
10173
|
+
resolution
|
|
10174
|
+
}) => {
|
|
10175
|
+
const keepRequestId = resolution === "KEEP_BB" ? requestId ?? randomUUID2() : undefined;
|
|
10176
|
+
await assertSensitiveWorkflowConfirmed({
|
|
10177
|
+
action: resolution === "ACCEPT_QBO" ? "Accept QuickBooks invoice changes into BB" : "Keep BB invoice values over QuickBooks changes",
|
|
10178
|
+
entity: `invoice ${invoiceId}`,
|
|
10179
|
+
details: resolution === "ACCEPT_QBO" ? "copies the held QuickBooks bill-to address, memo, bill email and total into BB; QuickBooks is not changed" : `keeps BB's values; queues BB's bill-to address and memo to QuickBooks (external write); bill email and total are not changed in QuickBooks; retry a lost response with --requestId ${keepRequestId}`
|
|
10180
|
+
});
|
|
10181
|
+
const result = await api2.customerInvoice.resolveQboDrift.mutate({
|
|
10182
|
+
invoiceId,
|
|
10183
|
+
resolution,
|
|
10184
|
+
...keepRequestId ? { requestId: keepRequestId } : {}
|
|
10185
|
+
});
|
|
10186
|
+
out(result);
|
|
10187
|
+
};
|
|
10188
|
+
var markCustomerInvoiceSentExternally = async (input) => {
|
|
10189
|
+
await assertSensitiveWorkflowConfirmed({
|
|
10190
|
+
action: "Record customer invoice as sent externally",
|
|
10191
|
+
entity: `invoice ${input.invoiceId}`,
|
|
10192
|
+
details: `records the invoice as SENT (source EXTERNAL) at ${input.sentAt} for ${input.recipients.join(", ")}; sends no email and does not write to QuickBooks`
|
|
10193
|
+
});
|
|
10194
|
+
const result = await api2.customerInvoice.markSentExternally.mutate(input);
|
|
10195
|
+
out(result);
|
|
10196
|
+
};
|
|
10148
10197
|
var describeCustomerInvoiceEmailConfirmation = (input) => `emails the QBO invoice PDF to ${input.to} and saves that address as the project's billing email; requested CC ${input.cc === undefined ? "company billing defaults" : input.cc.length > 0 ? input.cc.join(", ") : "none (company billing defaults removed)"}; reply-to ${input.replyTo}; subject "${input.subject}"; server-required admin, creator, business-development, and inside-sales CC recipients are added; success marks the invoice SENT; do not retry blindly after an ambiguous delivery failure`;
|
|
10149
10198
|
var sendCustomerInvoiceToContactPersonFromPayload = async (raw) => {
|
|
10150
10199
|
const input = parseSendCustomerInvoiceToContactPersonPayload(raw);
|
|
@@ -10630,9 +10679,6 @@ async function updateProjectStatus(id, status, opts) {
|
|
|
10630
10679
|
...opts?.projectManagerId && { projectManagerId: opts.projectManagerId },
|
|
10631
10680
|
...opts?.projectManagerEmail && {
|
|
10632
10681
|
projectManagerEmail: opts.projectManagerEmail
|
|
10633
|
-
},
|
|
10634
|
-
...opts?.wonOverrideReason && {
|
|
10635
|
-
wonOverrideReason: opts.wonOverrideReason
|
|
10636
10682
|
}
|
|
10637
10683
|
});
|
|
10638
10684
|
out(result);
|
|
@@ -11098,7 +11144,7 @@ var payloadHelp = {
|
|
|
11098
11144
|
},
|
|
11099
11145
|
"create-contact-person": {
|
|
11100
11146
|
required: "companyId: string; title: MR|MRS|MS|DR; firstName: string; lastName: string|null; email: string; mobile: string",
|
|
11101
|
-
optional: "address: {streetAddress1?, city?, state?, postalCode?,
|
|
11147
|
+
optional: "address: {streetAddress1?, city?, state?, postalCode?, countryCode? (ISO 3166-1 alpha-2, e.g. SG)}",
|
|
11102
11148
|
example: '{"companyId":"<company-id>","title":"MS","firstName":"Jane","lastName":"Tan","email":"jane@example.com","mobile":"+65 9123 4567"}'
|
|
11103
11149
|
},
|
|
11104
11150
|
"update-contact-person": {
|
|
@@ -11301,6 +11347,8 @@ var emailTargets = new Set([
|
|
|
11301
11347
|
"update-supplier"
|
|
11302
11348
|
]);
|
|
11303
11349
|
var externalWriteTargets = new Set([
|
|
11350
|
+
"update-customer-invoice-details",
|
|
11351
|
+
"update-customer-invoice-qbo-drift",
|
|
11304
11352
|
"record-external-bill-payment",
|
|
11305
11353
|
"approve-bill",
|
|
11306
11354
|
"approve-customer-invoice",
|
|
@@ -11347,6 +11395,7 @@ var externalWriteTargets = new Set([
|
|
|
11347
11395
|
"void-customer-invoice"
|
|
11348
11396
|
]);
|
|
11349
11397
|
var financialWriteTargets = new Set([
|
|
11398
|
+
"update-customer-invoice-qbo-drift",
|
|
11350
11399
|
"record-external-bill-payment",
|
|
11351
11400
|
"import-qbo-customer-invoice",
|
|
11352
11401
|
"link-bill-quotations",
|
|
@@ -11364,6 +11413,7 @@ var financialWriteTargets = new Set([
|
|
|
11364
11413
|
"delete-customer-invoice",
|
|
11365
11414
|
"mark-budget-items-not-utilized",
|
|
11366
11415
|
"mark-budget-won",
|
|
11416
|
+
"mark-customer-invoice-sent-externally",
|
|
11367
11417
|
"patch-bill-payment",
|
|
11368
11418
|
"reject-customer-invoice",
|
|
11369
11419
|
"restore-budget-item",
|
|
@@ -11542,6 +11592,8 @@ var summaryFor = (legacyTarget) => {
|
|
|
11542
11592
|
}
|
|
11543
11593
|
if (legacyTarget === "record-external-bill-payment")
|
|
11544
11594
|
return "Record an already-made payment on an APPROVED bill or claim, with no email and no money transfer. Requires <billId> --paymentReference --paymentDate YYYY-MM-DD --paymentAccount <QBO account ID> [--paymentProof receipt.pdf]. Reuses settled QBO payment links or queues one dated payment from the selected account. Exact retries are safe; do not pay again while reconciliation is pending.";
|
|
11595
|
+
if (legacyTarget === "mark-customer-invoice-sent-externally")
|
|
11596
|
+
return "Admin only. Record an APPROVED customer invoice as SENT (source EXTERNAL) because it was emailed to the customer outside Budget Builder. Sends no email and writes nothing to QuickBooks. Requires <invoiceId> --sentAt <ISO datetime, not in the future, not before approval> --recipients a@x.com,b@y.com [--note <message reference>].";
|
|
11545
11597
|
if (legacyTarget === "list-external-payment-accounts")
|
|
11546
11598
|
return "List active QuickBooks bank and credit-card account IDs for recording external payments (admin only).";
|
|
11547
11599
|
if (legacyTarget === "update-bill") {
|
|
@@ -12044,6 +12096,20 @@ var registry2 = [
|
|
|
12044
12096
|
"download"
|
|
12045
12097
|
]),
|
|
12046
12098
|
legacyCommand("sync-customer-invoice", ["customer-invoice", "sync"]),
|
|
12099
|
+
legacyCommand("update-customer-invoice-details", [
|
|
12100
|
+
"customer-invoice",
|
|
12101
|
+
"details",
|
|
12102
|
+
"update"
|
|
12103
|
+
]),
|
|
12104
|
+
legacyCommand("update-customer-invoice-qbo-drift", [
|
|
12105
|
+
"customer-invoice",
|
|
12106
|
+
"qbo-drift",
|
|
12107
|
+
"resolve"
|
|
12108
|
+
]),
|
|
12109
|
+
legacyCommand("mark-customer-invoice-sent-externally", [
|
|
12110
|
+
"customer-invoice",
|
|
12111
|
+
"mark-sent-externally"
|
|
12112
|
+
]),
|
|
12047
12113
|
legacyCommand("list-approvals", ["approval", "list"], ["get-pending-approvals"]),
|
|
12048
12114
|
legacyCommand("approve-bill", ["bill", "approve"]),
|
|
12049
12115
|
legacyCommand("reject-bill", ["bill", "reject"]),
|
|
@@ -13481,7 +13547,7 @@ Customer invoices
|
|
|
13481
13547
|
No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds.
|
|
13482
13548
|
count-customer-invoices [budgetId] [same filter flags as list-customer-invoices] totalCount, lifecycle status facets (ignore --status) and amount metrics; no paging or sort flags
|
|
13483
13549
|
get-customer-invoice <batchId> Batch as shown in the web app: status, totals, people, approvals and invoice summaries
|
|
13484
|
-
get-customer-invoice-invoices <batchId> Invoices with QuickBooks identity, dates and
|
|
13550
|
+
get-customer-invoice-invoices <batchId> Invoices with QuickBooks identity, dates, sync state, bill email (from QuickBooks) and held QuickBooks changes (qboDetailsDrift)
|
|
13485
13551
|
get-customer-invoice-lines <invoiceId> [--limit 1-100] [--cursor <token>] One invoice's lines; { items, pageInfo }
|
|
13486
13552
|
get-customer-invoice-approvals <batchId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }
|
|
13487
13553
|
get-customer-invoice-history <batchId> [--limit 1-100] [--cursor <token>] Status history; { items, pageInfo }
|
|
@@ -13497,7 +13563,12 @@ Customer invoices
|
|
|
13497
13563
|
reject-customer-invoice <batchId> --reason <text> Admin rejection; voids QBO invoices and notifies the creator.
|
|
13498
13564
|
send-customer-invoice-to-contact-person --payload '<json>' Queues same composer workflow as web; requires invoiceId, to, cc, replyTo, subject, HTML content, and HTML signature.
|
|
13499
13565
|
download-customer-invoice-pdf <invoiceId> [--output <path>]
|
|
13500
|
-
|
|
13566
|
+
mark-customer-invoice-sent-externally <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>] Admin only. Record an APPROVED invoice as SENT because it was emailed outside Budget Builder; sends no email.
|
|
13567
|
+
sync-customer-invoice <invoiceId> Refresh local status and balance from QuickBooks; paid invoices become PAID, reversals restore delivery/approval, and QBO voids can reopen an estimate. QuickBooks edits to bill-to address, memo, bill email or total are not applied: they are flagged as qboDetailsDrift and admins are emailed.
|
|
13568
|
+
update-customer-invoice-details <invoiceId> --billingAddress <text> --customerMemo <text> [--requestId <uuid>]
|
|
13569
|
+
Save bill-to address and memo in BB and queue the QuickBooks update (external write). Bill email is managed in QuickBooks.
|
|
13570
|
+
update-customer-invoice-qbo-drift <invoiceId> --resolution ACCEPT_QBO|KEEP_BB [--requestId <uuid>]
|
|
13571
|
+
Admin: resolve flagged QuickBooks changes. ACCEPT_QBO copies them into BB only; KEEP_BB queues BB's address and memo to QuickBooks.
|
|
13501
13572
|
|
|
13502
13573
|
Approvals
|
|
13503
13574
|
list-approvals | get-pending-approvals [--type budget|supplier|bill|quotation|customer_invoice|all]
|
|
@@ -13541,9 +13612,9 @@ Companies & projects
|
|
|
13541
13612
|
reconcile-project <id> Rerun all checks transactionally and mark an eligible WON project RECONCILED.
|
|
13542
13613
|
complete-project <id> Rerun reconciliation validation, mark a RECONCILED project COMPLETED, and queue QBO placeholder cleanup.
|
|
13543
13614
|
import-qbo-project <projectId> --url <quickBooksProjectUrl>
|
|
13544
|
-
update-project-status <id> <status> [--projectManagerId <userId>] [--projectManagerEmail <email>]
|
|
13615
|
+
update-project-status <id> <status> [--projectManagerId <userId>] [--projectManagerEmail <email>]
|
|
13616
|
+
PITCH \u2192 WON requires an accepted/closed estimate. To win a pitch, accept its estimate with mark-budget-won <budgetId> <signed-quote.pdf>, which moves the project to WON.
|
|
13545
13617
|
Required when moving PITCH \u2192 WON: supply --projectManagerId or --projectManagerEmail.
|
|
13546
|
-
Required when moving to WON without accepted/closed budget or win proof: --wonOverrideReason (10+ chars).
|
|
13547
13618
|
status: ${projectStatusesForHelp.join(", ")}
|
|
13548
13619
|
|
|
13549
13620
|
Contacts
|
|
@@ -15053,6 +15124,52 @@ Waiting for approval\u2026
|
|
|
15053
15124
|
await downloadCustomerInvoicePdf(invoiceId, getFlag(flags, "output"));
|
|
15054
15125
|
break;
|
|
15055
15126
|
}
|
|
15127
|
+
case "update-customer-invoice-details": {
|
|
15128
|
+
const invoiceId = positional[0];
|
|
15129
|
+
const billingAddress = getFlag(flags, "billingAddress");
|
|
15130
|
+
const customerMemo = getFlag(flags, "customerMemo");
|
|
15131
|
+
if (!invoiceId || typeof billingAddress !== "string" || typeof customerMemo !== "string") {
|
|
15132
|
+
throw new Error("update-customer-invoice-details requires <invoiceId> --billingAddress <text> --customerMemo <text> (send both; use \\n for address lines). The bill email is managed in QuickBooks.");
|
|
15133
|
+
}
|
|
15134
|
+
const requestId = getFlag(flags, "requestId");
|
|
15135
|
+
await updateCustomerInvoiceDetails({
|
|
15136
|
+
billingAddress: billingAddress.replaceAll("\\n", `
|
|
15137
|
+
`),
|
|
15138
|
+
customerMemo,
|
|
15139
|
+
invoiceId,
|
|
15140
|
+
...typeof requestId === "string" ? { requestId } : {}
|
|
15141
|
+
});
|
|
15142
|
+
break;
|
|
15143
|
+
}
|
|
15144
|
+
case "update-customer-invoice-qbo-drift": {
|
|
15145
|
+
const invoiceId = positional[0];
|
|
15146
|
+
const resolution = getFlag(flags, "resolution");
|
|
15147
|
+
if (!invoiceId || resolution !== "ACCEPT_QBO" && resolution !== "KEEP_BB") {
|
|
15148
|
+
throw new Error("update-customer-invoice-qbo-drift requires <invoiceId> --resolution ACCEPT_QBO|KEEP_BB");
|
|
15149
|
+
}
|
|
15150
|
+
const requestId = getFlag(flags, "requestId");
|
|
15151
|
+
await updateCustomerInvoiceQboDrift({
|
|
15152
|
+
invoiceId,
|
|
15153
|
+
resolution,
|
|
15154
|
+
...typeof requestId === "string" ? { requestId } : {}
|
|
15155
|
+
});
|
|
15156
|
+
break;
|
|
15157
|
+
}
|
|
15158
|
+
case "mark-customer-invoice-sent-externally": {
|
|
15159
|
+
const invoiceId = positional[0];
|
|
15160
|
+
const sentAt = getFlag(flags, "sentAt");
|
|
15161
|
+
const recipients = getFlag(flags, "recipients");
|
|
15162
|
+
if (!invoiceId || !sentAt || !recipients) {
|
|
15163
|
+
throw new Error("mark-customer-invoice-sent-externally requires <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>]");
|
|
15164
|
+
}
|
|
15165
|
+
await markCustomerInvoiceSentExternally({
|
|
15166
|
+
invoiceId,
|
|
15167
|
+
sentAt,
|
|
15168
|
+
recipients: recipients.split(",").map((recipient) => recipient.trim()).filter(Boolean),
|
|
15169
|
+
note: getFlag(flags, "note")
|
|
15170
|
+
});
|
|
15171
|
+
break;
|
|
15172
|
+
}
|
|
15056
15173
|
case "sync-customer-invoice": {
|
|
15057
15174
|
const invoiceId = positional[0];
|
|
15058
15175
|
if (!invoiceId) {
|
|
@@ -15389,14 +15506,10 @@ Waiting for approval\u2026
|
|
|
15389
15506
|
}
|
|
15390
15507
|
const pmIdFlag = getFlag(flags, "projectManagerId");
|
|
15391
15508
|
const pmEmailFlag = getFlag(flags, "projectManagerEmail");
|
|
15392
|
-
const wonOverrideReasonFlag = getFlag(flags, "wonOverrideReason");
|
|
15393
15509
|
await updateProjectStatus(id, parseProjectStatusForUpdate(statusRaw), {
|
|
15394
15510
|
...pmIdFlag && { projectManagerId: String(pmIdFlag) },
|
|
15395
15511
|
...pmEmailFlag && {
|
|
15396
15512
|
projectManagerEmail: String(pmEmailFlag)
|
|
15397
|
-
},
|
|
15398
|
-
...wonOverrideReasonFlag && {
|
|
15399
|
-
wonOverrideReason: String(wonOverrideReasonFlag)
|
|
15400
15513
|
}
|
|
15401
15514
|
});
|
|
15402
15515
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@go-labs-sg/bb",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Budget Builder CLI for AI agents — manage budgets, bills, claims, quotations, and customer invoices with explicit workflow previews for sensitive changes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"command-manifest.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@trpc/client": "^11.
|
|
22
|
+
"@trpc/client": "^11.22.1",
|
|
23
23
|
"dotenv": "^18.0.9",
|
|
24
24
|
"mime-types": "^3.0.2",
|
|
25
25
|
"superjson": "^2.2.6"
|