@go-labs-sg/bb 1.2.6 → 1.2.8
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/dist/commands.js +35 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Global options and flags use `--key=value` or `--key value` (see `bb help`).
|
|
|
61
61
|
| **Approvals** | `list-approvals` / `get-pending-approvals`, `approve-bill`, `reject-bill`, `approve-budget`, `reject-budget`, `approve-supplier`, `reject-supplier` |
|
|
62
62
|
| **Companies & projects** | `list-companies`, `get-company`, `create-company`, `update-company` (`--payload`), `delete-company`, `list-projects`, `get-project`, `create-project` (`--asanaTaskId`, `--slackChannelId`, `--slackChannelUrl`, `--slackChannelName`, …; optional `--requestQboAccountantNotification false` to skip QBO accountant emails), `update-project` (`--payload`, optional `requestQboAccountantNotification` in JSON), `delete-project`, `update-project-status` (`<id>` `<status>`: `PITCH` \| `EVENT` \| `COMPLETED` \| `LOST`) |
|
|
63
63
|
| **Contacts** | `list-contacts`, `create-contact-person` (`--payload`), `update-contact-person` (`--payload`) |
|
|
64
|
-
| **Suppliers & items** | `list-suppliers`, `create-supplier` (`--payload`), `update-supplier` (`--payload`), `delete-suppliers` (`--ids` CSV; admin), `create-certification` / `create-payment-method` / `create-supplier-role` / `create-supplier-tag` (`--name`), `get-supplier-details`, `get-supplier-analytics`, `list-items`, `create-item` (`--payload`), `update-item` (`--payload`), `delete-item`, `get-item`, `list-item-categories`, `create-item-category`, `update-item-category`, `delete-item-categories` (`--ids` CSV; admin) |
|
|
64
|
+
| **Suppliers & items** | `list-suppliers`, `create-supplier` (`--payload`; when supplier status is `PENDING_APPROVAL`, also runs `supplier.createSupplierApproval` and `email.sendSupplierApprovalRequestEmail`), `update-supplier` (`--payload`), `delete-suppliers` (`--ids` CSV; admin), `create-certification` / `create-payment-method` / `create-supplier-role` / `create-supplier-tag` (`--name`), `get-supplier-details`, `get-supplier-analytics`, `list-items`, `create-item` (`--payload`), `update-item` (`--payload`), `delete-item`, `get-item`, `list-item-categories`, `create-item-category`, `update-item-category`, `delete-item-categories` (`--ids` CSV; admin) |
|
|
65
65
|
| **Dashboard & users** | `list-users`, `get-user-performance`, `get-dashboard`, `get-monthly-metrics`, `get-system-overview`, `get-estimate-performance`, `get-financial-overview` |
|
|
66
66
|
| **Errors** | `get-recent-errors`, `get-error-metrics` |
|
|
67
67
|
| **Historical / benchmarks** | `get-approved-budgets`, `get-budget-category-benchmarks`, `get-item-pricing-history`, `get-supplier-pricing-history` |
|
package/dist/commands.js
CHANGED
|
@@ -374,8 +374,41 @@ export async function deleteBillById(id) {
|
|
|
374
374
|
}
|
|
375
375
|
export async function createSupplierFromPayload(raw) {
|
|
376
376
|
const input = parseSupplierCreatePayload(raw);
|
|
377
|
-
const
|
|
378
|
-
|
|
377
|
+
const created = await api.supplier.createSupplier.mutate(input);
|
|
378
|
+
const supplier = created.result;
|
|
379
|
+
if (supplier.status !== "PENDING_APPROVAL") {
|
|
380
|
+
out(created);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const approval = await api.supplier.createSupplierApproval.mutate({
|
|
384
|
+
supplierId: supplier.id,
|
|
385
|
+
});
|
|
386
|
+
let emailResult;
|
|
387
|
+
const approvalIds = (approval.results ?? []).map((item) => ({ id: item.id }));
|
|
388
|
+
if (approvalIds.length === 0) {
|
|
389
|
+
emailResult = { sent: false, count: 0, error: "No approval ids returned" };
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
try {
|
|
393
|
+
await api.email.sendSupplierApprovalRequestEmail.mutate(approvalIds);
|
|
394
|
+
emailResult = { sent: true, count: approvalIds.length };
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
emailResult = {
|
|
398
|
+
sent: false,
|
|
399
|
+
count: approvalIds.length,
|
|
400
|
+
error: error instanceof Error ? error.message : String(error),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
out({
|
|
405
|
+
...created,
|
|
406
|
+
supplierApproval: {
|
|
407
|
+
requested: true,
|
|
408
|
+
approvalCount: approvalIds.length,
|
|
409
|
+
email: emailResult,
|
|
410
|
+
},
|
|
411
|
+
});
|
|
379
412
|
}
|
|
380
413
|
export async function updateSupplierFromPayload(raw) {
|
|
381
414
|
const input = parseSupplierUpdatePayload(raw);
|
package/dist/index.js
CHANGED
|
@@ -138,7 +138,7 @@ Contacts
|
|
|
138
138
|
|
|
139
139
|
Suppliers & items
|
|
140
140
|
list-suppliers [--name] [--page] [--perPage]
|
|
141
|
-
create-supplier --payload '<json>' (supplier.createSupplier)
|
|
141
|
+
create-supplier --payload '<json>' (supplier.createSupplier; auto-requests approval + emails when status is PENDING_APPROVAL)
|
|
142
142
|
update-supplier --payload '<json>' (supplier.updateSupplier; must include id)
|
|
143
143
|
delete-suppliers --ids <csv> (supplier.deleteSuppliers; admin)
|
|
144
144
|
create-certification --name (supplier.createCertification)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@go-labs-sg/bb",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"description": "Budget Builder CLI — list budgets, bills, approvals, suppliers; approve bills; change status. For AI agents (e.g. Chuck/OpenClaw).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|