@go-labs-sg/bb 3.22.0 → 3.23.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 +14 -1
- package/command-manifest.json +167 -1
- package/command-reference.md +25 -1
- package/dist/index.js +730 -652
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5597,15 +5597,20 @@ var createProcessRuntime = __name2(() => ({ stdout: { write: __name2((value) =>
|
|
|
5597
5597
|
}
|
|
5598
5598
|
}, "confirmCurrentCommand");
|
|
5599
5599
|
import { contentType } from "mime-types";
|
|
5600
|
-
var BUDGET = ApprovalType2.BUDGET, BILL = ApprovalType2.BILL, SUPPLIER = ApprovalType2.SUPPLIER, QUOTATION = ApprovalType2.QUOTATION, CUSTOMER_INVOICE = ApprovalType2.CUSTOMER_INVOICE, ASANA_WON_LOST_SECTION_GIDS = /* @__PURE__ */ new Set(["1211678338364908", "1211678338364907"]), MAX_ASANA_LEAD_CANDIDATES = 5, ASANA_SEARCH_DETAIL_LIMIT = 15,
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5600
|
+
var BUDGET = ApprovalType2.BUDGET, BILL = ApprovalType2.BILL, SUPPLIER = ApprovalType2.SUPPLIER, QUOTATION = ApprovalType2.QUOTATION, CUSTOMER_INVOICE = ApprovalType2.CUSTOMER_INVOICE, ASANA_WON_LOST_SECTION_GIDS = /* @__PURE__ */ new Set(["1211678338364908", "1211678338364907"]), MAX_ASANA_LEAD_CANDIDATES = 5, ASANA_SEARCH_DETAIL_LIMIT = 15, getAllPendingApprovals = __name2(
|
|
5601
|
+
async () => {
|
|
5602
|
+
const approvals = [];
|
|
5603
|
+
let cursor;
|
|
5604
|
+
do {
|
|
5605
|
+
const page = await api2.budget.getPendingApprovals.query({ limit: 100, cursor });
|
|
5606
|
+
approvals.push(...page.items), cursor = page.pageInfo.nextCursor ?? void 0;
|
|
5607
|
+
} while (cursor);
|
|
5608
|
+
return approvals;
|
|
5609
|
+
},
|
|
5610
|
+
"getAllPendingApprovals"
|
|
5611
|
+
), getPendingApproval = __name2(async (approvalId) => {
|
|
5612
|
+
out(await api2.budget.getPendingApproval.query({ approvalId }));
|
|
5613
|
+
}, "getPendingApproval"), createApprovalEmailDeliveryReport = __name2((delivery) => {
|
|
5609
5614
|
if (!delivery) return { queued: !1, sent: !1, count: 0, queuedCount: 0, sentCount: 0, skippedCount: 0, error: "No approval email delivery was queued" };
|
|
5610
5615
|
const { queuedCount, sentCount, skippedCount, message, operationIds } = delivery;
|
|
5611
5616
|
return { queued: queuedCount > 0, sent: !1, count: queuedCount, queuedCount, sentCount, skippedCount, operationIds, message };
|
|
@@ -5657,7 +5662,9 @@ var out = __name2((data) => {
|
|
|
5657
5662
|
const sectionText = candidate.sections.map((section) => section.name ?? section.gid).filter(Boolean).join(", ") || "stage unavailable", dateText = candidate.modifiedAt ? "modified ".concat(new Date(candidate.modifiedAt).toISOString()) : candidate.createdAt ? "created ".concat(new Date(candidate.createdAt).toISOString()) : "date unavailable";
|
|
5658
5663
|
return "".concat(sectionText, "; ").concat(dateText, "; ").concat(candidate.gid);
|
|
5659
5664
|
}, "formatAsanaCandidateMetadata"), promptForAsanaLeadCandidate = __name2(async (candidates) => {
|
|
5660
|
-
if (candidates.length === 0) throw new Error(
|
|
5665
|
+
if (candidates.length === 0) throw new Error(
|
|
5666
|
+
"create-project requires an existing Asana deal task in the Deals project; none matched. For a new direct client, create the deal task using the website form first, then pass --asanaTaskId or --asanaSearch."
|
|
5667
|
+
);
|
|
5661
5668
|
if (!process.stdin.isTTY || !process.stderr.isTTY) throw new Error("create-project requires an existing Asana deal task: pass --asanaTaskId in non-interactive runs. Create the deal task using the website form first for a new direct client. Interactive runs can choose from matching tasks.");
|
|
5662
5669
|
console.error("Select the Asana lead task to link to this project:"), candidates.forEach((candidate, index) => {
|
|
5663
5670
|
console.error("".concat(index + 1, ". ").concat(candidate.name, " (").concat(formatAsanaCandidateMetadata(candidate), ")"));
|
|
@@ -5683,13 +5690,7 @@ var out = __name2((data) => {
|
|
|
5683
5690
|
}, "combineDateAndTime"), formatOptionalProjectPaxInput = __name2((pax) => typeof pax != "number" || !Number.isFinite(pax) || pax <= 0 ? "" : String(pax), "formatOptionalProjectPaxInput"), contentTypeHeaderForFileName = __name2((fileName) => {
|
|
5684
5691
|
const ct = contentType(fileName);
|
|
5685
5692
|
return typeof ct == "string" ? ct : "application/octet-stream";
|
|
5686
|
-
}, "contentTypeHeaderForFileName"), supportedAttachmentContentTypes = [
|
|
5687
|
-
"application/pdf",
|
|
5688
|
-
"image/gif",
|
|
5689
|
-
"image/jpeg",
|
|
5690
|
-
"image/png",
|
|
5691
|
-
"image/webp"
|
|
5692
|
-
], attachmentContentTypeForFileName = __name2((fileName) => {
|
|
5693
|
+
}, "contentTypeHeaderForFileName"), supportedAttachmentContentTypes = ["application/pdf", "image/gif", "image/jpeg", "image/png", "image/webp"], attachmentContentTypeForFileName = __name2((fileName) => {
|
|
5693
5694
|
const resolvedContentType = contentTypeHeaderForFileName(fileName), supportedContentType = supportedAttachmentContentTypes.find((contentTypeValue) => contentTypeValue === resolvedContentType);
|
|
5694
5695
|
if (supportedContentType) return supportedContentType;
|
|
5695
5696
|
throw new Error("Unsupported attachment type: ".concat(fileName));
|
|
@@ -5698,29 +5699,28 @@ var out = __name2((data) => {
|
|
|
5698
5699
|
if (resolvedContentType === "image/webp") throw new Error("Unsupported QuickBooks bill attachment type: ".concat(fileName, ". Use PDF, GIF, JPEG, or PNG."));
|
|
5699
5700
|
return resolvedContentType;
|
|
5700
5701
|
}, "billAttachmentContentTypeForFileName"), PAYMENT_PROOF_MAX_SIZE = 20 * 1024 * 1024, QUOTATION_ATTACHMENT_MAX_SIZE = 20 * 1024 * 1024, quotationAttachmentContentTypeForFileName = __name2((fileName) => {
|
|
5701
|
-
const resolvedContentType = contentTypeHeaderForFileName(
|
|
5702
|
+
const resolvedContentType = contentTypeHeaderForFileName(
|
|
5703
|
+
fileName
|
|
5704
|
+
);
|
|
5702
5705
|
if (resolvedContentType === "application/pdf" || resolvedContentType === "image/jpeg" || resolvedContentType === "image/png") return resolvedContentType;
|
|
5703
5706
|
throw new Error("Unsupported quotation attachment type: ".concat(fileName, ". Use PDF, JPEG, or PNG."));
|
|
5704
5707
|
}, "quotationAttachmentContentTypeForFileName"), LOCKED_BUDGET_STATUSES_REQUIRING_CONFIRMATION = /* @__PURE__ */ new Set([BudgetStatus2.ESTIMATE_CREATED, BudgetStatus2.ESTIMATE_SENT, BudgetStatus2.ESTIMATE_ACCEPTED, BudgetStatus2.ESTIMATE_REJECTED, BudgetStatus2.ESTIMATE_CLOSED]), lockedBudgetStatusLabels = { ESTIMATE_CREATED: "Estimate Created", ESTIMATE_SENT: "Estimate Sent", ESTIMATE_ACCEPTED: "Estimate Accepted", ESTIMATE_REJECTED: "Estimate Rejected", ESTIMATE_CLOSED: "Estimate Closed" }, lockedBudgetStatusLabel = __name2((status) => status in lockedBudgetStatusLabels ? lockedBudgetStatusLabels[status] : status, "lockedBudgetStatusLabel"), buildSensitiveWorkflowPreview = __name2(({ action, entity, details }) => {
|
|
5705
5708
|
const effects = details ?? "may change workflow state or send notifications";
|
|
5706
5709
|
return ["Budget Builder workflow preview", "Action: ".concat(action), "Target: ".concat(entity), "Effects: ".concat(effects)].join("\n");
|
|
5707
|
-
}, "buildSensitiveWorkflowPreview"), assertSensitiveWorkflowConfirmed = __name2(
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
},
|
|
5722
|
-
"assertSensitiveWorkflowConfirmed"
|
|
5723
|
-
), assertLockedBudgetChangeConfirmed = __name2(async ({ budget, action }) => {
|
|
5710
|
+
}, "buildSensitiveWorkflowPreview"), assertSensitiveWorkflowConfirmed = __name2(async (input) => {
|
|
5711
|
+
if (getActiveCliSession()?.invocation.legacy !== !0) {
|
|
5712
|
+
await confirmCurrentCommand({ action: input.action, target: input.entity, details: input.details, effects: input.effects });
|
|
5713
|
+
return;
|
|
5714
|
+
}
|
|
5715
|
+
const expected = "CONFIRM", preview = buildSensitiveWorkflowPreview(input);
|
|
5716
|
+
if (!process.stdin.isTTY || !process.stderr.isTTY) throw new Error("".concat(preview, '\nThis is a sensitive workflow change. Run it in an interactive terminal only after the user explicitly confirms this exact action, then type "').concat(expected, '" to continue.'));
|
|
5717
|
+
const rl = createInterface2({ input: process.stdin, output: process.stderr });
|
|
5718
|
+
try {
|
|
5719
|
+
if ((await rl.question("".concat(preview, '\nConfirm the user explicitly approved this exact action, then type "').concat(expected, '" to continue: '))).trim() !== expected) throw new Error("Aborted.");
|
|
5720
|
+
} finally {
|
|
5721
|
+
rl.close();
|
|
5722
|
+
}
|
|
5723
|
+
}, "assertSensitiveWorkflowConfirmed"), assertLockedBudgetChangeConfirmed = __name2(async ({ budget, action }) => {
|
|
5724
5724
|
if (!LOCKED_BUDGET_STATUSES_REQUIRING_CONFIRMATION.has(budget.status)) return;
|
|
5725
5725
|
const statusLabel = lockedBudgetStatusLabel(budget.status);
|
|
5726
5726
|
if (getActiveCliSession()?.invocation.legacy !== !0) {
|
|
@@ -5745,7 +5745,9 @@ var out = __name2((data) => {
|
|
|
5745
5745
|
return await api2.project.updateProject.mutate(input);
|
|
5746
5746
|
} catch (error2) {
|
|
5747
5747
|
if (input.confirmEstimateInvalidation === !0 || !(error2 instanceof Error) || !error2.message.startsWith("This project change affects")) throw error2;
|
|
5748
|
-
return await assertSensitiveWorkflowConfirmed(
|
|
5748
|
+
return await assertSensitiveWorkflowConfirmed(
|
|
5749
|
+
{ action: "Update project and reject existing estimates", entity: "project ".concat(input.id), details: error2.message }
|
|
5750
|
+
), api2.project.updateProject.mutate({ ...input, confirmEstimateInvalidation: !0 });
|
|
5749
5751
|
}
|
|
5750
5752
|
}, "updateProjectWithEstimateInvalidationConfirmation"), listBudgets = __name2(async (input) => {
|
|
5751
5753
|
out(await api2.budget.getAllBudgets.query(input));
|
|
@@ -5758,7 +5760,9 @@ async function getBudget(id, opts) {
|
|
|
5758
5760
|
}
|
|
5759
5761
|
__name(getBudget, "getBudget"), __name2(getBudget, "getBudget");
|
|
5760
5762
|
async function updateBudgetStatus(budgetId, status, opts) {
|
|
5761
|
-
await assertSensitiveWorkflowConfirmed({ action: "Update budget status", entity: "budget ".concat(budgetId), details: "to ".concat(
|
|
5763
|
+
await assertSensitiveWorkflowConfirmed({ action: "Update budget status", entity: "budget ".concat(budgetId), details: "to ".concat(
|
|
5764
|
+
status
|
|
5765
|
+
) }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Update budget status");
|
|
5762
5766
|
const result = await api2.budget.updateBudgetStatus.mutate({ id: budgetId, status, ...opts?.projectManagerId !== void 0 && { projectManagerId: opts.projectManagerId }, ...opts?.markProjectWon !== void 0 && { markProjectWon: opts.markProjectWon }, ...opts?.projectStatusOnCommercialRejection !== void 0 && { projectStatusOnCommercialRejection: opts.projectStatusOnCommercialRejection }, ...opts?.projectInvoiceSettings !== void 0 && { projectInvoiceSettings: opts.projectInvoiceSettings } });
|
|
5763
5767
|
out({ ...result, invoiceSetup: result.newStatus === BudgetStatus2.ESTIMATE_ACCEPTED && result.hasQuickbooksEstimate ? invoiceSplitSetupNextAction(budgetId) : null });
|
|
5764
5768
|
}
|
|
@@ -5772,19 +5776,20 @@ var assertBudgetActionReadiness = __name2(async ({ budgetId, requireQuickbooksPr
|
|
|
5772
5776
|
if (requireQuickbooksProject && !budget.project.quickbooksProjectId) throw new Error("Cannot create estimate: project is not linked to QuickBooks yet.");
|
|
5773
5777
|
}, "assertBudgetActionReadiness"), runBudgetPreflight = __name2(async (budgetId, preflight) => {
|
|
5774
5778
|
if (preflight && (preflight.company && await api2.company.updateCompany.mutate(preflight.company), preflight.contactPerson && await api2.contactPerson.updateContactPerson.mutate(preflight.contactPerson), preflight.eventDetails)) {
|
|
5775
|
-
const budget = await api2.budget.getBudget.query(
|
|
5776
|
-
{ id: budgetId }
|
|
5777
|
-
), project = await api2.project.getProjectById.query({ id: budget.projectId }), day = new Date(preflight.eventDetails.date), start = new Date(preflight.eventDetails.startTime), end = new Date(preflight.eventDetails.endTime), payload = { id: project.id, name: project.name, description: project.description ?? void 0, dateRange: { from: combineDateAndTime(day, start), to: combineDateAndTime(day, end) }, companyId: project.companyId, contactPersonId: project.contactPersonId, asanaTaskId: project.asanaTaskId ?? "", insideSalesId: project.insideSalesId ?? "", businessDevelopmentId: project.businessDevelopmentId ?? "", venue: project.venue ?? "", pax: formatOptionalProjectPaxInput(project.pax) };
|
|
5779
|
+
const budget = await api2.budget.getBudget.query({ id: budgetId }), project = await api2.project.getProjectById.query({ id: budget.projectId }), day = new Date(preflight.eventDetails.date), start = new Date(preflight.eventDetails.startTime), end = new Date(preflight.eventDetails.endTime), payload = { id: project.id, name: project.name, description: project.description ?? void 0, dateRange: { from: combineDateAndTime(day, start), to: combineDateAndTime(day, end) }, companyId: project.companyId, contactPersonId: project.contactPersonId, asanaTaskId: project.asanaTaskId ?? "", insideSalesId: project.insideSalesId ?? "", businessDevelopmentId: project.businessDevelopmentId ?? "", venue: project.venue ?? "", pax: formatOptionalProjectPaxInput(project.pax) };
|
|
5778
5780
|
await updateProjectWithEstimateInvalidationConfirmation(payload);
|
|
5779
5781
|
}
|
|
5780
5782
|
}, "runBudgetPreflight"), listBills = __name2(async (input) => {
|
|
5781
5783
|
out(await api2.bill.getAll.query({ ...input, statuses: billStatusesForApi(input.statuses), search: input.search?.trim() || void 0, createdByIds: input.createdByIds?.length ? input.createdByIds : void 0 }));
|
|
5782
|
-
}, "listBills"), countBills = __name2(
|
|
5783
|
-
|
|
5784
|
-
|
|
5784
|
+
}, "listBills"), countBills = __name2(
|
|
5785
|
+
async (input) => {
|
|
5786
|
+
out(await api2.bill.getCounts.query({ ...input, statuses: billStatusesForApi(input.statuses), search: input.search?.trim() || void 0, createdByIds: input.createdByIds?.length ? input.createdByIds : void 0 }));
|
|
5787
|
+
},
|
|
5788
|
+
"countBills"
|
|
5789
|
+
);
|
|
5785
5790
|
async function approveBill(billId, overBudgetOverrideReason) {
|
|
5786
5791
|
await assertSensitiveWorkflowConfirmed({ action: "Approve bill", entity: "bill ".concat(billId), details: "and send requester reply email" });
|
|
5787
|
-
const approval = (await
|
|
5792
|
+
const approval = (await getAllPendingApprovals()).filter((n) => isPendingRequest(n) && n.type === BILL && (n.billId === billId || n.bill?.id === billId))[0];
|
|
5788
5793
|
if (!approval) throw new Error("No pending bill approval found for this bill.");
|
|
5789
5794
|
const result = await api2.bill.updateApproval.mutate({ billApprovalId: approval.id, status: ApprovalStatus2.APPROVED, overBudgetOverrideReason });
|
|
5790
5795
|
if (result.processing) {
|
|
@@ -5796,20 +5801,18 @@ async function approveBill(billId, overBudgetOverrideReason) {
|
|
|
5796
5801
|
const delivery = result.emailDelivery;
|
|
5797
5802
|
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
5798
5803
|
} catch (error2) {
|
|
5799
|
-
email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(
|
|
5800
|
-
error2
|
|
5801
|
-
));
|
|
5804
|
+
email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(error2));
|
|
5802
5805
|
}
|
|
5803
5806
|
out({ ...result, email: email2 });
|
|
5804
5807
|
}
|
|
5805
5808
|
__name(approveBill, "approveBill"), __name2(approveBill, "approveBill");
|
|
5806
5809
|
var approvalIdentity = __name2((n) => n.type === BUDGET && n.budget ? { id: n.budgetId ?? n.id, name: n.budget.name } : n.type === BILL && n.bill ? { id: n.bill.id, name: "Bill ".concat(n.bill.invoiceNumber ?? n.bill.id.slice(0, 8)) } : n.type === SUPPLIER && n.supplier ? { id: n.supplier.id, name: n.supplier.name } : n.type === QUOTATION && n.supplierQuotation ? { id: n.supplierQuotation.id, name: "Quotation ".concat(n.supplierQuotation.supplier.name) } : n.type === CUSTOMER_INVOICE && n.customerInvoiceBatch ? { id: n.customerInvoiceBatch.id, name: "Customer invoice ".concat(n.customerInvoiceBatch.project.name) } : { id: n.id, name: "Unknown" }, "approvalIdentity"), approvalRequestedAt = __name2((createdAt) => typeof createdAt == "string" ? createdAt : createdAt instanceof Date ? createdAt.toISOString() : String(createdAt), "approvalRequestedAt");
|
|
5807
5810
|
async function listApprovals(opts) {
|
|
5808
|
-
const
|
|
5811
|
+
const page = await api2.budget.getPendingApprovals.query({ ...opts, type: opts.type === "ALL" ? void 0 : opts.type }), items = page.items.filter(isPendingRequest).map((n) => {
|
|
5809
5812
|
const { id, name } = approvalIdentity(n);
|
|
5810
5813
|
return { approvalId: n.id, type: n.type, id, name, requestedBy: n.requester?.name ?? n.requester?.email ?? "Unknown", requestedAt: approvalRequestedAt(n.createdAt) };
|
|
5811
5814
|
});
|
|
5812
|
-
out({ items });
|
|
5815
|
+
out({ items, pageInfo: page.pageInfo });
|
|
5813
5816
|
}
|
|
5814
5817
|
__name(listApprovals, "listApprovals"), __name2(listApprovals, "listApprovals");
|
|
5815
5818
|
var listSuppliers = __name2(async (opts) => {
|
|
@@ -5824,7 +5827,9 @@ async function createBillApproval(billId) {
|
|
|
5824
5827
|
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure("No approval ids returned");
|
|
5825
5828
|
else try {
|
|
5826
5829
|
const delivery = result.emailDelivery;
|
|
5827
|
-
email2 = createApprovalEmailDeliveryReport(
|
|
5830
|
+
email2 = createApprovalEmailDeliveryReport(
|
|
5831
|
+
delivery
|
|
5832
|
+
);
|
|
5828
5833
|
} catch (error2) {
|
|
5829
5834
|
email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(error2));
|
|
5830
5835
|
}
|
|
@@ -5838,12 +5843,14 @@ var validateBillStatusUpdateOptions = __name2((opts) => {
|
|
|
5838
5843
|
}, "validateBillStatusUpdateOptions"), deleteStagedPaymentProof = __name2(async (projectId, key) => {
|
|
5839
5844
|
await api2.attachment.deleteStagedBillAttachments.mutate({ projectId, keys: [key] });
|
|
5840
5845
|
}, "deleteStagedPaymentProof"), rethrowAfterStagedPaymentProofCleanup = __name2(async (error2, cleanup) => {
|
|
5841
|
-
if (cleanup)
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5846
|
+
if (cleanup) try {
|
|
5847
|
+
await cleanup();
|
|
5848
|
+
} catch (cleanupError) {
|
|
5849
|
+
throw new AggregateError(
|
|
5850
|
+
[error2, cleanupError],
|
|
5851
|
+
"Bill status update failed and its staged payment proof could not be cleaned up."
|
|
5852
|
+
);
|
|
5853
|
+
}
|
|
5847
5854
|
throw error2;
|
|
5848
5855
|
}, "rethrowAfterStagedPaymentProofCleanup"), stageBillPaymentProof = __name2(async (projectId, filePath) => {
|
|
5849
5856
|
const buffer = await readFile2(filePath), fileName = basename(filePath), size = buffer.byteLength, contentType2 = billAttachmentContentTypeForFileName(fileName);
|
|
@@ -5868,15 +5875,7 @@ async function updateBillStatus(opts) {
|
|
|
5868
5875
|
validateBillStatusUpdateOptions(opts), await assertSensitiveWorkflowConfirmed({ action: "Update bill status", entity: "bill ".concat(opts.id), details: "to ".concat(opts.status) });
|
|
5869
5876
|
const bill = opts.paymentProofPath ? await api2.bill.getPayment.query({ id: opts.id }) : null, paymentProof = bill && opts.paymentProofPath ? await stageBillPaymentProof(bill.projectId, opts.paymentProofPath) : void 0;
|
|
5870
5877
|
try {
|
|
5871
|
-
const result = await api2.bill.updateStatus.mutate({
|
|
5872
|
-
id: opts.id,
|
|
5873
|
-
status: opts.status,
|
|
5874
|
-
rejectionReason: opts.rejectionReason,
|
|
5875
|
-
paymentTrackingUrl: opts.paymentTrackingUrl,
|
|
5876
|
-
paymentReference: opts.paymentReference,
|
|
5877
|
-
paymentProofAttachments: paymentProof ? [paymentProof] : void 0,
|
|
5878
|
-
overBudgetOverrideReason: opts.overBudgetOverrideReason
|
|
5879
|
-
});
|
|
5878
|
+
const result = await api2.bill.updateStatus.mutate({ id: opts.id, status: opts.status, rejectionReason: opts.rejectionReason, paymentTrackingUrl: opts.paymentTrackingUrl, paymentReference: opts.paymentReference, paymentProofAttachments: paymentProof ? [paymentProof] : void 0, overBudgetOverrideReason: opts.overBudgetOverrideReason });
|
|
5880
5879
|
out(result);
|
|
5881
5880
|
} catch (error2) {
|
|
5882
5881
|
await rethrowAfterStagedPaymentProofCleanup(error2, bill && paymentProof ? async () => {
|
|
@@ -5890,10 +5889,7 @@ var listExternalBillPaymentAccounts = __name2(async () => {
|
|
|
5890
5889
|
}, "listExternalBillPaymentAccounts"), refreshExternalBillPaymentAccounts = __name2(async () => {
|
|
5891
5890
|
await confirmCurrentCommand({ action: "refresh QuickBooks payment accounts", target: "the cached external payment-account list", effects: ["state-change"], details: "Queue a read of QuickBooks bank and credit-card accounts; nothing is written to QuickBooks." }), out(await api2.bill.refreshExternalPaymentAccounts.mutate());
|
|
5892
5891
|
}, "refreshExternalBillPaymentAccounts"), recordExternalBillPayment = __name2(async (opts) => {
|
|
5893
|
-
if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp(
|
|
5894
|
-
"^\\d{4}-\\d{2}-\\d{2}$",
|
|
5895
|
-
""
|
|
5896
|
-
).test(opts.paymentDate) || new Date("".concat(opts.paymentDate, "T00:00:00Z")).toISOString().slice(0, 10) !== opts.paymentDate) throw new Error("Supply --paymentReference, --paymentDate YYYY-MM-DD, and --paymentAccount <QBO account ID>.");
|
|
5892
|
+
if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp("^\\d{4}-\\d{2}-\\d{2}$", "").test(opts.paymentDate) || new Date("".concat(opts.paymentDate, "T00:00:00Z")).toISOString().slice(0, 10) !== opts.paymentDate) throw new Error("Supply --paymentReference, --paymentDate YYYY-MM-DD, and --paymentAccount <QBO account ID>.");
|
|
5897
5893
|
await assertSensitiveWorkflowConfirmed({ action: "Record external payment (no email)", entity: "bill ".concat(opts.id), details: "already paid on ".concat(opts.paymentDate, "; reference ").concat(opts.paymentReference, "; QBO account ").concat(opts.paymentAccount, ". No money is transferred.") });
|
|
5898
5894
|
const bill = await api2.bill.getPayment.query({ id: opts.id }), proof = !bill.externalPayment && opts.paymentProofPath ? await stageBillPaymentProof(bill.projectId, opts.paymentProofPath) : void 0;
|
|
5899
5895
|
try {
|
|
@@ -5934,9 +5930,7 @@ var getBillAttachments = __name2(async (input) => {
|
|
|
5934
5930
|
async function stageBillAttachmentsFromPaths(projectId, filePaths) {
|
|
5935
5931
|
const attachments = [];
|
|
5936
5932
|
for (const filePath of filePaths) {
|
|
5937
|
-
const buffer = await readFile2(filePath), fileName = basename(filePath), size = buffer.byteLength, contentType2 = billAttachmentContentTypeForFileName(
|
|
5938
|
-
fileName
|
|
5939
|
-
), { uploadUrl, key } = await api2.attachment.requestStagedBillAttachmentUpload.mutate({ projectId, fileName, size, contentType: contentType2 }), response = await fetch(uploadUrl, { method: "PUT", body: buffer, headers: { "Content-Type": contentType2 } });
|
|
5933
|
+
const buffer = await readFile2(filePath), fileName = basename(filePath), size = buffer.byteLength, contentType2 = billAttachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestStagedBillAttachmentUpload.mutate({ projectId, fileName, size, contentType: contentType2 }), response = await fetch(uploadUrl, { method: "PUT", body: buffer, headers: { "Content-Type": contentType2 } });
|
|
5940
5934
|
if (!response.ok) throw new Error("S3 upload failed: HTTP ".concat(response.status, " ").concat((await response.text()).slice(0, 500)));
|
|
5941
5935
|
attachments.push({ id: randomUUID2(), key, name: fileName, size });
|
|
5942
5936
|
}
|
|
@@ -5960,12 +5954,15 @@ var uploadSingleBillAttachmentFromPath = __name2(async (billId, filePath, type =
|
|
|
5960
5954
|
async function uploadBillAttachmentsFromPaths(billId, filePaths, type = AttachmentType.BILL) {
|
|
5961
5955
|
if (filePaths.length === 0) throw new Error("At least one bill attachment file path is required");
|
|
5962
5956
|
const results = [];
|
|
5963
|
-
for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(
|
|
5957
|
+
for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(billId, filePath, type));
|
|
5958
|
+
out({
|
|
5959
|
+
success: !0,
|
|
5964
5960
|
billId,
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5961
|
+
type,
|
|
5962
|
+
count: results.length,
|
|
5963
|
+
attachments: results.map((result) => result.attachment),
|
|
5964
|
+
results
|
|
5965
|
+
});
|
|
5969
5966
|
}
|
|
5970
5967
|
__name(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths"), __name2(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths");
|
|
5971
5968
|
async function uploadBillDocumentsFromPaths({ billId, invoicePaths = [], paymentProofPaths = [] }) {
|
|
@@ -5974,12 +5971,12 @@ async function uploadBillDocumentsFromPaths({ billId, invoicePaths = [], payment
|
|
|
5974
5971
|
for (const filePath of invoicePaths) invoiceResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL));
|
|
5975
5972
|
const paymentProofResults = [];
|
|
5976
5973
|
for (const filePath of paymentProofPaths) paymentProofResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL_PAYMENT_PROOF));
|
|
5977
|
-
out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [
|
|
5978
|
-
...invoiceResults,
|
|
5979
|
-
...paymentProofResults
|
|
5980
|
-
] });
|
|
5974
|
+
out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [...invoiceResults, ...paymentProofResults] });
|
|
5981
5975
|
}
|
|
5982
|
-
__name(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths"), __name2(
|
|
5976
|
+
__name(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths"), __name2(
|
|
5977
|
+
uploadBillDocumentsFromPaths,
|
|
5978
|
+
"uploadBillDocumentsFromPaths"
|
|
5979
|
+
);
|
|
5983
5980
|
async function uploadQuotationAttachmentFromPath(projectId, filePath) {
|
|
5984
5981
|
const buf = await readFile2(filePath), fileName = basename(filePath);
|
|
5985
5982
|
if (buf.byteLength > QUOTATION_ATTACHMENT_MAX_SIZE) throw new Error("Quotation attachment must be 20MB or smaller.");
|
|
@@ -5996,23 +5993,25 @@ async function uploadBudgetAttachmentFromPath(budgetId, filePath) {
|
|
|
5996
5993
|
await confirmLockedBudgetChangeByBudgetId(budgetId, "Upload budget attachment");
|
|
5997
5994
|
const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetAttachmentUpload.mutate({ budgetId, contentType: attachmentContentType, fileName, size }), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
|
|
5998
5995
|
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
5999
|
-
const confirmed = await api2.attachment.confirmBudgetAttachment.mutate(
|
|
6000
|
-
{ budgetId, key, name: fileName, size }
|
|
6001
|
-
);
|
|
5996
|
+
const confirmed = await api2.attachment.confirmBudgetAttachment.mutate({ budgetId, key, name: fileName, size });
|
|
6002
5997
|
out(confirmed);
|
|
6003
5998
|
}
|
|
6004
|
-
__name(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath"), __name2(
|
|
5999
|
+
__name(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath"), __name2(
|
|
6000
|
+
uploadBudgetAttachmentFromPath,
|
|
6001
|
+
"uploadBudgetAttachmentFromPath"
|
|
6002
|
+
);
|
|
6005
6003
|
async function uploadBudgetWinProofFromPath(budgetId, filePath, opts) {
|
|
6006
6004
|
await assertSensitiveWorkflowConfirmed({ action: "Mark budget won", entity: "budget ".concat(budgetId), details: "by uploading proof and setting status to ESTIMATE_ACCEPTED" }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Mark budget won");
|
|
6007
6005
|
const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetWinProofUpload.mutate({ budgetId, contentType: attachmentContentType, fileName, size }), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
|
|
6008
6006
|
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
6009
|
-
await api2.attachment.confirmBudgetWinProofAttachment.mutate({
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6007
|
+
await api2.attachment.confirmBudgetWinProofAttachment.mutate({ budgetId, key, name: fileName, size });
|
|
6008
|
+
const result = await api2.budget.updateBudgetStatus.mutate({
|
|
6009
|
+
id: budgetId,
|
|
6010
|
+
status: BudgetStatus2.ESTIMATE_ACCEPTED,
|
|
6011
|
+
...opts?.projectManagerId !== void 0 && { projectManagerId: opts.projectManagerId },
|
|
6012
|
+
...opts?.markProjectWon !== void 0 && { markProjectWon: opts.markProjectWon },
|
|
6013
|
+
...opts?.projectInvoiceSettings !== void 0 && { projectInvoiceSettings: opts.projectInvoiceSettings }
|
|
6014
6014
|
});
|
|
6015
|
-
const result = await api2.budget.updateBudgetStatus.mutate({ id: budgetId, status: BudgetStatus2.ESTIMATE_ACCEPTED, ...opts?.projectManagerId !== void 0 && { projectManagerId: opts.projectManagerId }, ...opts?.markProjectWon !== void 0 && { markProjectWon: opts.markProjectWon }, ...opts?.projectInvoiceSettings !== void 0 && { projectInvoiceSettings: opts.projectInvoiceSettings } });
|
|
6016
6015
|
out({ ...result, invoiceSetup: result.hasQuickbooksEstimate ? invoiceSplitSetupNextAction(budgetId) : null });
|
|
6017
6016
|
}
|
|
6018
6017
|
__name(uploadBudgetWinProofFromPath, "uploadBudgetWinProofFromPath"), __name2(uploadBudgetWinProofFromPath, "uploadBudgetWinProofFromPath");
|
|
@@ -6026,7 +6025,10 @@ async function getBillDetails(id) {
|
|
|
6026
6025
|
}
|
|
6027
6026
|
__name(getBillDetails, "getBillDetails"), __name2(getBillDetails, "getBillDetails");
|
|
6028
6027
|
async function getBudgetItemsOnly(budgetId, opts) {
|
|
6029
|
-
const includeInactive = opts?.includeInactive ?? !1, [items, totals] = await Promise.all([api2.budget.getBudgetItems.query({ budgetId, includeInactive }), api2.budget.getBudgetItemTotals.query({
|
|
6028
|
+
const includeInactive = opts?.includeInactive ?? !1, [items, totals] = await Promise.all([api2.budget.getBudgetItems.query({ budgetId, includeInactive }), api2.budget.getBudgetItemTotals.query({
|
|
6029
|
+
budgetId,
|
|
6030
|
+
includeInactive
|
|
6031
|
+
})]);
|
|
6030
6032
|
out({ ...items, totals });
|
|
6031
6033
|
}
|
|
6032
6034
|
__name(getBudgetItemsOnly, "getBudgetItemsOnly"), __name2(getBudgetItemsOnly, "getBudgetItemsOnly");
|
|
@@ -6043,10 +6045,7 @@ async function updateBudgetItem(input) {
|
|
|
6043
6045
|
}
|
|
6044
6046
|
__name(updateBudgetItem, "updateBudgetItem"), __name2(updateBudgetItem, "updateBudgetItem");
|
|
6045
6047
|
async function removeBudgetItem(budgetItemId) {
|
|
6046
|
-
await confirmLockedBudgetChangeByBudgetItemId(
|
|
6047
|
-
budgetItemId,
|
|
6048
|
-
"Remove budget item"
|
|
6049
|
-
);
|
|
6048
|
+
await confirmLockedBudgetChangeByBudgetItemId(budgetItemId, "Remove budget item");
|
|
6050
6049
|
const result = await api2.budgetItem.removeBudgetItem.mutate({ budgetItemId });
|
|
6051
6050
|
out(result);
|
|
6052
6051
|
}
|
|
@@ -6077,7 +6076,9 @@ async function createBudgetApproval(budgetId, preflight) {
|
|
|
6077
6076
|
await assertSensitiveWorkflowConfirmed({ action: "Create budget approval request", entity: "budget ".concat(budgetId), details: "and send approval request emails" }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Create budget approval"), await runBudgetPreflight(budgetId, preflight), await assertBudgetActionReadiness({ budgetId, requireQuickbooksProject: !1, actionLabel: "request approval" });
|
|
6078
6077
|
const result = await api2.budget.createBudgetApproval.mutate({ budgetId }), approvalIds = (result.results ?? []).map((item) => ({ id: item.id }));
|
|
6079
6078
|
let email2;
|
|
6080
|
-
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure(
|
|
6079
|
+
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure(
|
|
6080
|
+
"No approval ids returned"
|
|
6081
|
+
);
|
|
6081
6082
|
else try {
|
|
6082
6083
|
const delivery = result.emailDelivery;
|
|
6083
6084
|
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
@@ -6110,14 +6111,14 @@ async function createBudgetFromPayload(raw) {
|
|
|
6110
6111
|
try {
|
|
6111
6112
|
result = await api2.budget.createBudget.mutate(input);
|
|
6112
6113
|
} catch (error2) {
|
|
6113
|
-
throw budgetCreateUncertainError(
|
|
6114
|
-
error2,
|
|
6115
|
-
input
|
|
6116
|
-
) || error2;
|
|
6114
|
+
throw budgetCreateUncertainError(error2, input) || error2;
|
|
6117
6115
|
}
|
|
6118
6116
|
out(result);
|
|
6119
6117
|
}
|
|
6120
|
-
__name(createBudgetFromPayload, "createBudgetFromPayload"), __name2(
|
|
6118
|
+
__name(createBudgetFromPayload, "createBudgetFromPayload"), __name2(
|
|
6119
|
+
createBudgetFromPayload,
|
|
6120
|
+
"createBudgetFromPayload"
|
|
6121
|
+
);
|
|
6121
6122
|
async function updateBudgetFromPayload(raw) {
|
|
6122
6123
|
const input = parseUpdateBudgetPayload(raw);
|
|
6123
6124
|
await confirmLockedBudgetChangeByBudgetId(input.id, "Update budget");
|
|
@@ -6187,7 +6188,9 @@ var deleteBudgetDiscount = __name2(async (budgetId) => {
|
|
|
6187
6188
|
const result = await api2.budget.deleteBudgetDiscount.mutate({ budgetId });
|
|
6188
6189
|
out(result);
|
|
6189
6190
|
}, "deleteBudgetDiscount"), deleteBudgetCommission = __name2(async (budgetId) => {
|
|
6190
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6191
|
+
await assertSensitiveWorkflowConfirmed(
|
|
6192
|
+
{ action: "Remove budget commission", entity: "budget ".concat(budgetId), details: "and return the budget to DRAFT" }
|
|
6193
|
+
);
|
|
6191
6194
|
const result = await api2.budget.deleteBudgetCommission.mutate({ budgetId });
|
|
6192
6195
|
out(result);
|
|
6193
6196
|
}, "deleteBudgetCommission"), setBudgetItemsNotUtilized = __name2(async (budgetItemIds, notUtilized) => {
|
|
@@ -6277,10 +6280,7 @@ async function getQuotationDetails(id) {
|
|
|
6277
6280
|
const result = await api2.quotation.getById.query({ id });
|
|
6278
6281
|
out(result);
|
|
6279
6282
|
}
|
|
6280
|
-
__name(getQuotationDetails, "getQuotationDetails"), __name2(
|
|
6281
|
-
getQuotationDetails,
|
|
6282
|
-
"getQuotationDetails"
|
|
6283
|
-
);
|
|
6283
|
+
__name(getQuotationDetails, "getQuotationDetails"), __name2(getQuotationDetails, "getQuotationDetails");
|
|
6284
6284
|
var getQuotationLineItems = __name2(async (input) => {
|
|
6285
6285
|
out(await api2.quotation.getLineItems.query(input));
|
|
6286
6286
|
}, "getQuotationLineItems");
|
|
@@ -6301,10 +6301,7 @@ async function submitQuotation(id, overBudgetOverrideReason) {
|
|
|
6301
6301
|
const result = await api2.quotation.submitForApproval.mutate({ id, overBudgetOverrideReason });
|
|
6302
6302
|
out(result);
|
|
6303
6303
|
}
|
|
6304
|
-
__name(submitQuotation, "submitQuotation"), __name2(
|
|
6305
|
-
submitQuotation,
|
|
6306
|
-
"submitQuotation"
|
|
6307
|
-
);
|
|
6304
|
+
__name(submitQuotation, "submitQuotation"), __name2(submitQuotation, "submitQuotation");
|
|
6308
6305
|
async function downloadQuotationPdf(id, fileRole) {
|
|
6309
6306
|
const result = await api2.quotation.getSignedDownloadUrl.query({ id, fileRole });
|
|
6310
6307
|
out(result);
|
|
@@ -6339,10 +6336,13 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6339
6336
|
out(await api2.customerInvoice.getHistory.query(input));
|
|
6340
6337
|
}, "getCustomerInvoiceHistory"), getCustomerInvoicePayments = __name2(async (invoiceId) => {
|
|
6341
6338
|
out(await api2.customerInvoice.getPayments.query({ invoiceId }));
|
|
6342
|
-
}, "getCustomerInvoicePayments"), getCustomerInvoiceEmailContext = __name2(
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6339
|
+
}, "getCustomerInvoicePayments"), getCustomerInvoiceEmailContext = __name2(
|
|
6340
|
+
async (batchId) => {
|
|
6341
|
+
const result = await api2.customerInvoice.getInvoiceEmailContext.query({ batchId });
|
|
6342
|
+
out(result);
|
|
6343
|
+
},
|
|
6344
|
+
"getCustomerInvoiceEmailContext"
|
|
6345
|
+
), previewQboCustomerInvoice = __name2(async (input) => {
|
|
6346
6346
|
const result = await api2.customerInvoice.previewExistingInvoice.mutate(input);
|
|
6347
6347
|
out(result);
|
|
6348
6348
|
}, "previewQboCustomerInvoice"), importQboCustomerInvoice = __name2(async (input) => {
|
|
@@ -6391,7 +6391,11 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6391
6391
|
}, "updateCustomerInvoiceDetails"), updateCustomerInvoiceQboDrift = __name2(async ({ invoiceId, requestId, resolution }) => {
|
|
6392
6392
|
const keepRequestId = resolution === "KEEP_BB" ? requestId ?? randomUUID2() : void 0;
|
|
6393
6393
|
await assertSensitiveWorkflowConfirmed({ action: resolution === "ACCEPT_QBO" ? "Accept QuickBooks invoice changes into BB" : "Keep BB invoice values over QuickBooks changes", entity: "invoice ".concat(invoiceId), 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 ".concat(keepRequestId) });
|
|
6394
|
-
const result = await api2.customerInvoice.resolveQboDrift.mutate({
|
|
6394
|
+
const result = await api2.customerInvoice.resolveQboDrift.mutate({
|
|
6395
|
+
invoiceId,
|
|
6396
|
+
resolution,
|
|
6397
|
+
...keepRequestId ? { requestId: keepRequestId } : {}
|
|
6398
|
+
});
|
|
6395
6399
|
out(result);
|
|
6396
6400
|
}, "updateCustomerInvoiceQboDrift"), markCustomerInvoiceSentExternally = __name2(async (input) => {
|
|
6397
6401
|
await assertSensitiveWorkflowConfirmed({ action: "Record customer invoice as sent externally", entity: "invoice ".concat(input.invoiceId), details: "records the invoice as SENT (source EXTERNAL) at ".concat(input.sentAt, " for ").concat(input.recipients.join(", "), "; sends no email and does not write to QuickBooks") });
|
|
@@ -6408,13 +6412,10 @@ async function updateBillFromPayload(raw) {
|
|
|
6408
6412
|
out(result);
|
|
6409
6413
|
}
|
|
6410
6414
|
__name(updateBillFromPayload, "updateBillFromPayload"), __name2(updateBillFromPayload, "updateBillFromPayload");
|
|
6411
|
-
var validateBillSelectionFromPayload = __name2(
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
},
|
|
6416
|
-
"validateBillSelectionFromPayload"
|
|
6417
|
-
), linkBillQuotations = __name2(async (billId, raw) => {
|
|
6415
|
+
var validateBillSelectionFromPayload = __name2(async (raw, quotationFlags) => {
|
|
6416
|
+
const input = parseValidateBillSelectionPayload(raw, quotationFlags), result = await api2.bill.validateSelection.mutate(input);
|
|
6417
|
+
out(result);
|
|
6418
|
+
}, "validateBillSelectionFromPayload"), linkBillQuotations = __name2(async (billId, raw) => {
|
|
6418
6419
|
const input = parseLinkBillQuotationsPayload(billId, raw), result = await api2.bill.linkQuotations.mutate(input);
|
|
6419
6420
|
out(result);
|
|
6420
6421
|
}, "linkBillQuotations"), updateBillPaymentEvidenceFromPayload = __name2(async (raw) => {
|
|
@@ -6461,7 +6462,9 @@ async function createSupplierFromPayload(raw) {
|
|
|
6461
6462
|
__name(createSupplierFromPayload, "createSupplierFromPayload"), __name2(createSupplierFromPayload, "createSupplierFromPayload");
|
|
6462
6463
|
async function updateSupplierFromPayload(raw) {
|
|
6463
6464
|
const input = parseSupplierUpdatePayload(raw);
|
|
6464
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6465
|
+
await assertSensitiveWorkflowConfirmed(
|
|
6466
|
+
{ action: "Update supplier", entity: "supplier ".concat(input.id), details: "Normal-user edits also request approval and queue approval emails." }
|
|
6467
|
+
);
|
|
6465
6468
|
const updated = await api2.supplier.updateSupplier.mutate(input);
|
|
6466
6469
|
out(updated);
|
|
6467
6470
|
}
|
|
@@ -6480,12 +6483,11 @@ async function createContactPersonFromPayload(raw) {
|
|
|
6480
6483
|
const input = parseContactCreatePayload(raw), result = await api2.contactPerson.createContactPerson.mutate(input);
|
|
6481
6484
|
out(result);
|
|
6482
6485
|
}
|
|
6483
|
-
__name(createContactPersonFromPayload, "createContactPersonFromPayload"), __name2(
|
|
6484
|
-
createContactPersonFromPayload,
|
|
6485
|
-
"createContactPersonFromPayload"
|
|
6486
|
-
);
|
|
6486
|
+
__name(createContactPersonFromPayload, "createContactPersonFromPayload"), __name2(createContactPersonFromPayload, "createContactPersonFromPayload");
|
|
6487
6487
|
async function updateContactPersonFromPayload(raw) {
|
|
6488
|
-
const input = parseContactUpdatePayload(
|
|
6488
|
+
const input = parseContactUpdatePayload(
|
|
6489
|
+
raw
|
|
6490
|
+
), result = await api2.contactPerson.updateContactPerson.mutate(input);
|
|
6489
6491
|
out(result);
|
|
6490
6492
|
}
|
|
6491
6493
|
__name(updateContactPersonFromPayload, "updateContactPersonFromPayload"), __name2(updateContactPersonFromPayload, "updateContactPersonFromPayload");
|
|
@@ -6505,7 +6507,7 @@ async function updateCompanyFromPayload(raw) {
|
|
|
6505
6507
|
__name(updateCompanyFromPayload, "updateCompanyFromPayload"), __name2(updateCompanyFromPayload, "updateCompanyFromPayload");
|
|
6506
6508
|
async function approveBudget(budgetId) {
|
|
6507
6509
|
await assertSensitiveWorkflowConfirmed({ action: "Approve budget", entity: "budget ".concat(budgetId), details: "and send requester reply email" });
|
|
6508
|
-
const approval = (await
|
|
6510
|
+
const approval = (await getAllPendingApprovals()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.BUDGET && (n.budgetId === budgetId || n.budget?.id === budgetId))[0];
|
|
6509
6511
|
if (!approval) throw new Error("No pending budget approval found for this budget and approver.");
|
|
6510
6512
|
const result = await api2.budget.updateBudgetApproval.mutate({ budgetApprovalId: approval.id, status: ExtendedApprovalStatus.APPROVED });
|
|
6511
6513
|
let email2;
|
|
@@ -6519,11 +6521,8 @@ async function approveBudget(budgetId) {
|
|
|
6519
6521
|
}
|
|
6520
6522
|
__name(approveBudget, "approveBudget"), __name2(approveBudget, "approveBudget");
|
|
6521
6523
|
async function rejectBudget(budgetId, reason) {
|
|
6522
|
-
await assertSensitiveWorkflowConfirmed({ action: "Reject budget", entity: "budget ".concat(budgetId), details: 'with reason "'.concat(
|
|
6523
|
-
|
|
6524
|
-
'" and send requester reply email'
|
|
6525
|
-
) });
|
|
6526
|
-
const approval = (await getAllNotifications()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.BUDGET && (n.budgetId === budgetId || n.budget?.id === budgetId))[0];
|
|
6524
|
+
await assertSensitiveWorkflowConfirmed({ action: "Reject budget", entity: "budget ".concat(budgetId), details: 'with reason "'.concat(reason, '" and send requester reply email') });
|
|
6525
|
+
const approval = (await getAllPendingApprovals()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.BUDGET && (n.budgetId === budgetId || n.budget?.id === budgetId))[0];
|
|
6527
6526
|
if (!approval) throw new Error("No pending budget approval found for this budget and approver.");
|
|
6528
6527
|
const result = await api2.budget.updateBudgetApproval.mutate({ budgetApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
|
|
6529
6528
|
let email2;
|
|
@@ -6550,22 +6549,26 @@ async function getSupplierItems(supplierId) {
|
|
|
6550
6549
|
__name(getSupplierItems, "getSupplierItems"), __name2(getSupplierItems, "getSupplierItems");
|
|
6551
6550
|
async function getSupplierDetails(supplierId) {
|
|
6552
6551
|
const supplier = await api2.supplier.getSupplierById.query({ id: supplierId }), respondedStatuses = /* @__PURE__ */ new Set([ExtendedApprovalStatus.APPROVED, ExtendedApprovalStatus.REJECTED]), latestRespondedApproval = [...supplier.approvals.filter((approval) => respondedStatuses.has(approval.status))].sort((a, b) => new Date(b.respondedAt ?? b.updatedAt).getTime() - new Date(a.respondedAt ?? a.updatedAt).getTime() || new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())[0], pendingApprovals = supplier.approvals.filter((approval) => approval.status === ExtendedApprovalStatus.PENDING_APPROVAL), supersededApprovals = supplier.approvals.filter((approval) => approval.status === ExtendedApprovalStatus.SUPERSEDED), respondedByApproval = latestRespondedApproval ?? null, responseUser = respondedByApproval ? respondedByApproval.responder ?? respondedByApproval.approver : null;
|
|
6553
|
-
out({ ...supplier, supplierApprovalSummary: {
|
|
6554
|
-
|
|
6552
|
+
out({ ...supplier, supplierApprovalSummary: {
|
|
6553
|
+
pendingApprovalCount: pendingApprovals.length,
|
|
6554
|
+
pendingApprovers: pendingApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, createdAt: approval.createdAt, updatedAt: approval.updatedAt })),
|
|
6555
|
+
supersededApprovalCount: supersededApprovals.length,
|
|
6556
|
+
supersededApprovers: supersededApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, respondedAt: approval.respondedAt, responder: approval.responder ? { id: approval.responder.id, name: approval.responder.name, email: approval.responder.email } : null })),
|
|
6557
|
+
respondedBy: respondedByApproval && responseUser ? { approvalId: respondedByApproval.id, status: respondedByApproval.status, approverId: respondedByApproval.approverId, responderId: respondedByApproval.responderId, name: responseUser.name, email: responseUser.email, respondedAt: respondedByApproval.respondedAt, updatedAt: respondedByApproval.updatedAt } : null
|
|
6558
|
+
} });
|
|
6555
6559
|
}
|
|
6556
|
-
__name(getSupplierDetails, "getSupplierDetails"), __name2(
|
|
6560
|
+
__name(getSupplierDetails, "getSupplierDetails"), __name2(
|
|
6561
|
+
getSupplierDetails,
|
|
6562
|
+
"getSupplierDetails"
|
|
6563
|
+
);
|
|
6557
6564
|
async function approveSupplier(supplierId) {
|
|
6558
6565
|
const supplier = await api2.supplier.getSupplierOverview.query({ id: supplierId });
|
|
6559
6566
|
if (supplier.status === ExtendedApprovalStatus.REJECTED) {
|
|
6560
6567
|
await assertSensitiveWorkflowConfirmed({ action: "Re-approve supplier", entity: "supplier ".concat(supplierId), effects: ["state-change", "external-write"], details: supplier.active ? "and queue its QuickBooks vendor sync (it is usable once QuickBooks confirms); append a new approval and retain earlier history; no requester reply email is sent" : "and queue its QuickBooks vendor sync; append a new approval and retain earlier history; it remains archived and no requester reply email is sent" }), out(await api2.supplier.reapproveSupplier.mutate({ supplierId }));
|
|
6561
6568
|
return;
|
|
6562
6569
|
}
|
|
6563
|
-
await assertSensitiveWorkflowConfirmed({
|
|
6564
|
-
|
|
6565
|
-
entity: "supplier ".concat(supplierId),
|
|
6566
|
-
details: "and send requester reply email"
|
|
6567
|
-
});
|
|
6568
|
-
const approval = (await getAllNotifications()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.SUPPLIER && (n.supplierId === supplierId || n.supplier?.id === supplierId))[0];
|
|
6570
|
+
await assertSensitiveWorkflowConfirmed({ action: "Approve supplier", entity: "supplier ".concat(supplierId), details: "and send requester reply email" });
|
|
6571
|
+
const approval = (await getAllPendingApprovals()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.SUPPLIER && (n.supplierId === supplierId || n.supplier?.id === supplierId))[0];
|
|
6569
6572
|
if (!approval) throw new Error("No pending supplier approval found.");
|
|
6570
6573
|
const result = await api2.supplier.updateSupplierApproval.mutate({ supplierApprovalId: approval.id, status: ExtendedApprovalStatus.APPROVED });
|
|
6571
6574
|
let email2;
|
|
@@ -6580,7 +6583,7 @@ async function approveSupplier(supplierId) {
|
|
|
6580
6583
|
__name(approveSupplier, "approveSupplier"), __name2(approveSupplier, "approveSupplier");
|
|
6581
6584
|
async function rejectSupplier(supplierId, reason) {
|
|
6582
6585
|
await assertSensitiveWorkflowConfirmed({ action: "Reject supplier", entity: "supplier ".concat(supplierId), details: 'with reason "'.concat(reason, '" and send requester reply email') });
|
|
6583
|
-
const approval = (await
|
|
6586
|
+
const approval = (await getAllPendingApprovals()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.SUPPLIER && (n.supplierId === supplierId || n.supplier?.id === supplierId))[0];
|
|
6584
6587
|
if (!approval) throw new Error("No pending supplier approval found.");
|
|
6585
6588
|
const result = await api2.supplier.updateSupplierApproval.mutate({ supplierApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
|
|
6586
6589
|
let email2;
|
|
@@ -6595,7 +6598,7 @@ async function rejectSupplier(supplierId, reason) {
|
|
|
6595
6598
|
__name(rejectSupplier, "rejectSupplier"), __name2(rejectSupplier, "rejectSupplier");
|
|
6596
6599
|
async function rejectBill(billId, reason) {
|
|
6597
6600
|
await assertSensitiveWorkflowConfirmed({ action: "Reject bill", entity: "bill ".concat(billId), details: 'with reason "'.concat(reason, '" and send requester reply email') });
|
|
6598
|
-
const approval = (await
|
|
6601
|
+
const approval = (await getAllPendingApprovals()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.BILL && (n.billId === billId || n.bill?.id === billId))[0];
|
|
6599
6602
|
if (!approval) throw new Error("No pending bill approval found.");
|
|
6600
6603
|
const result = await api2.bill.updateApproval.mutate({ billApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
|
|
6601
6604
|
if (result.processing) {
|
|
@@ -6614,7 +6617,7 @@ async function rejectBill(billId, reason) {
|
|
|
6614
6617
|
__name(rejectBill, "rejectBill"), __name2(rejectBill, "rejectBill");
|
|
6615
6618
|
async function approveQuotation(quotationId, overBudgetOverrideReason) {
|
|
6616
6619
|
await assertSensitiveWorkflowConfirmed({ action: "Approve quotation", entity: "quotation ".concat(quotationId) });
|
|
6617
|
-
const approval = (await
|
|
6620
|
+
const approval = (await getAllPendingApprovals()).filter((n) => isPendingRequest(n) && n.type === QUOTATION && (n.supplierQuotationId === quotationId || n.supplierQuotation?.id === quotationId))[0];
|
|
6618
6621
|
if (!approval) throw new Error("No pending quotation approval found.");
|
|
6619
6622
|
const result = await api2.quotation.approve.mutate({ quotationApprovalId: approval.id, overBudgetOverrideReason });
|
|
6620
6623
|
out(result);
|
|
@@ -6622,7 +6625,7 @@ async function approveQuotation(quotationId, overBudgetOverrideReason) {
|
|
|
6622
6625
|
__name(approveQuotation, "approveQuotation"), __name2(approveQuotation, "approveQuotation");
|
|
6623
6626
|
async function rejectQuotation(quotationId, reason) {
|
|
6624
6627
|
await assertSensitiveWorkflowConfirmed({ action: "Reject quotation", entity: "quotation ".concat(quotationId), details: 'with reason "'.concat(reason, '"') });
|
|
6625
|
-
const approval = (await
|
|
6628
|
+
const approval = (await getAllPendingApprovals()).filter((n) => isPendingRequest(n) && n.type === QUOTATION && (n.supplierQuotationId === quotationId || n.supplierQuotation?.id === quotationId))[0];
|
|
6626
6629
|
if (!approval) throw new Error("No pending quotation approval found.");
|
|
6627
6630
|
const result = await api2.quotation.reject.mutate({ quotationApprovalId: approval.id, rejectionReason: reason });
|
|
6628
6631
|
out(result);
|
|
@@ -6672,14 +6675,11 @@ var getProjectHubStatus = __name2(async (projectId) => {
|
|
|
6672
6675
|
await assertSensitiveWorkflowConfirmed({ action: "Set up Project Hub", entity: "project ".concat(projectId), details: "queue Asana, Drive, and client Hub provisioning" });
|
|
6673
6676
|
const result = await api2.project.setupProjectHub.mutate({ projectId });
|
|
6674
6677
|
out(result);
|
|
6675
|
-
}, "setupProjectHub"), syncProjectHubCommercialDocuments = __name2(
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
},
|
|
6681
|
-
"syncProjectHubCommercialDocuments"
|
|
6682
|
-
);
|
|
6678
|
+
}, "setupProjectHub"), syncProjectHubCommercialDocuments = __name2(async (projectId) => {
|
|
6679
|
+
await assertSensitiveWorkflowConfirmed({ action: "Sync Project Hub commercial documents", entity: "project ".concat(projectId), details: "queue a full Budget Builder to Google Drive and Asana reconciliation" });
|
|
6680
|
+
const result = await api2.project.syncProjectHubCommercialDocuments.mutate({ projectId });
|
|
6681
|
+
out(result);
|
|
6682
|
+
}, "syncProjectHubCommercialDocuments");
|
|
6683
6683
|
async function createProject(opts) {
|
|
6684
6684
|
const name = parseQuickBooksName(opts.name), asanaTaskId = await resolveCreateProjectAsanaTaskId({ name, asanaTaskId: opts.asanaTaskId, asanaSearch: opts.asanaSearch }), result = await api2.project.createProject.mutate({ name, description: opts.description, companyId: opts.companyId, contactPersonId: opts.contactPersonId, insideSalesId: opts.insideSalesId, businessDevelopmentId: opts.businessDevelopmentId, projectManagerId: opts.projectManagerId, venue: opts.venue, pax: opts.pax, asanaTaskId, dateRange: { from: new Date(opts.startDate), to: opts.endDate ? new Date(opts.endDate) : void 0 } });
|
|
6685
6685
|
out(result);
|
|
@@ -6728,10 +6728,13 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6728
6728
|
out(await api2.webhook.getDelivery.query({ deliveryId }));
|
|
6729
6729
|
}, "getWebhookDelivery"), replayWebhookDelivery = __name2(async (deliveryId) => {
|
|
6730
6730
|
out(await api2.webhook.replayDelivery.mutate({ deliveryId }));
|
|
6731
|
-
}, "replayWebhookDelivery"), listIntegrationOperations = __name2(
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6731
|
+
}, "replayWebhookDelivery"), listIntegrationOperations = __name2(
|
|
6732
|
+
async (input) => {
|
|
6733
|
+
const result = await api2.integration.listOperations.query(input);
|
|
6734
|
+
out(result);
|
|
6735
|
+
},
|
|
6736
|
+
"listIntegrationOperations"
|
|
6737
|
+
), getIntegrationOperation = __name2(async (operationId) => {
|
|
6735
6738
|
const result = await api2.integration.getOperation.query({ operationId });
|
|
6736
6739
|
out(result);
|
|
6737
6740
|
}, "getIntegrationOperation"), countIntegrationOperations = __name2(async (input) => {
|
|
@@ -6747,10 +6750,13 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6747
6750
|
}, "reconcileResourceOperation"), listInboundSources = __name2(async (input) => {
|
|
6748
6751
|
const result = await api2.inbound.listSources.query(input);
|
|
6749
6752
|
out(result);
|
|
6750
|
-
}, "listInboundSources"), countInboundSources = __name2(
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6753
|
+
}, "listInboundSources"), countInboundSources = __name2(
|
|
6754
|
+
async (input) => {
|
|
6755
|
+
const result = await api2.inbound.countSources.query(input);
|
|
6756
|
+
out(result);
|
|
6757
|
+
},
|
|
6758
|
+
"countInboundSources"
|
|
6759
|
+
), createInboundSource = __name2(async (input) => {
|
|
6754
6760
|
const result = await api2.inbound.createSource.mutate(input);
|
|
6755
6761
|
out(result);
|
|
6756
6762
|
}, "createInboundSource"), getInboundSource = __name2(async (sourceId) => {
|
|
@@ -6765,9 +6771,7 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6765
6771
|
}, "listInboundSubmissions"), countInboundSubmissions = __name2(async (input) => {
|
|
6766
6772
|
out(await api2.inbound.countSubmissions.query(input));
|
|
6767
6773
|
}, "countInboundSubmissions"), getInboundSubmission = __name2(async (submissionId) => {
|
|
6768
|
-
const result = await api2.inbound.getSubmission.query(
|
|
6769
|
-
{ submissionId }
|
|
6770
|
-
);
|
|
6774
|
+
const result = await api2.inbound.getSubmission.query({ submissionId });
|
|
6771
6775
|
out(result);
|
|
6772
6776
|
}, "getInboundSubmission"), saveInboundMappingVersion = __name2(async (sourceId, mappings) => {
|
|
6773
6777
|
const source = await api2.inbound.getSource.query({ sourceId }), result = await api2.inbound.saveMappingVersion.mutate({ expectedActiveMappingVersion: source.activeMappingVersion, mappings, sourceId });
|
|
@@ -6786,17 +6790,17 @@ async function listContacts(companyId) {
|
|
|
6786
6790
|
__name(listContacts, "listContacts"), __name2(listContacts, "listContacts");
|
|
6787
6791
|
var listItems = __name2(async (input) => {
|
|
6788
6792
|
out(await api2.item.getItems.query(input));
|
|
6789
|
-
}, "listItems"), countItems = __name2(
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
},
|
|
6793
|
-
"countItems"
|
|
6794
|
-
);
|
|
6793
|
+
}, "listItems"), countItems = __name2(async (input) => {
|
|
6794
|
+
out(await api2.item.getItemCounts.query(input));
|
|
6795
|
+
}, "countItems");
|
|
6795
6796
|
async function getItem(id) {
|
|
6796
6797
|
const item = await api2.item.getItem.query({ id });
|
|
6797
6798
|
out(item);
|
|
6798
6799
|
}
|
|
6799
|
-
__name(getItem, "getItem"), __name2(
|
|
6800
|
+
__name(getItem, "getItem"), __name2(
|
|
6801
|
+
getItem,
|
|
6802
|
+
"getItem"
|
|
6803
|
+
);
|
|
6800
6804
|
var getItemQuickBooksSyncStatus = __name2(async (itemId) => {
|
|
6801
6805
|
const result = await api2.item.getQuickBooksSyncStatus.query({ id: itemId });
|
|
6802
6806
|
out(result);
|
|
@@ -6848,7 +6852,10 @@ async function getDashboard(input) {
|
|
|
6848
6852
|
const result = await api2.dashboard.getDashboard.query({ userId: input.userId, role: input.role ?? "ALL", deals: input.deals ?? "ALL", timeFrame: input.timeFrame ?? "ALL", startDate: input.startDate, endDate: input.endDate });
|
|
6849
6853
|
out(result);
|
|
6850
6854
|
}
|
|
6851
|
-
__name(getDashboard, "getDashboard"), __name2(
|
|
6855
|
+
__name(getDashboard, "getDashboard"), __name2(
|
|
6856
|
+
getDashboard,
|
|
6857
|
+
"getDashboard"
|
|
6858
|
+
);
|
|
6852
6859
|
async function getMonthlyMetrics(input) {
|
|
6853
6860
|
const result = await api2.dashboard.getMonthlyMetrics.query({ userId: input.userId, role: input.role ?? "ALL", deals: input.deals ?? "ALL", timeFrame: input.timeFrame ?? "ALL", startDate: input.startDate, endDate: input.endDate });
|
|
6854
6861
|
out(result);
|
|
@@ -6895,9 +6902,7 @@ async function getApprovedBudgets(opts) {
|
|
|
6895
6902
|
const maxR = opts.maxRevenue;
|
|
6896
6903
|
filtered = filtered.filter((i) => i.revenue <= maxR);
|
|
6897
6904
|
}
|
|
6898
|
-
out(
|
|
6899
|
-
{ budgets: filtered, count: filtered.length, totalCount }
|
|
6900
|
-
);
|
|
6905
|
+
out({ budgets: filtered, count: filtered.length, totalCount });
|
|
6901
6906
|
}
|
|
6902
6907
|
__name(getApprovedBudgets, "getApprovedBudgets"), __name2(getApprovedBudgets, "getApprovedBudgets");
|
|
6903
6908
|
async function getBudgetCategoryBenchmarks(opts) {
|
|
@@ -6915,6 +6920,16 @@ async function getSupplierPricingHistory(opts) {
|
|
|
6915
6920
|
out(result);
|
|
6916
6921
|
}
|
|
6917
6922
|
__name(getSupplierPricingHistory, "getSupplierPricingHistory"), __name2(getSupplierPricingHistory, "getSupplierPricingHistory");
|
|
6923
|
+
async function getBillReview(billId) {
|
|
6924
|
+
out(await api2.ai.getBillReview.query({ billId }));
|
|
6925
|
+
}
|
|
6926
|
+
__name(getBillReview, "getBillReview"), __name2(getBillReview, "getBillReview");
|
|
6927
|
+
async function requestBillReview(billId, requestId) {
|
|
6928
|
+
out(await api2.ai.requestBillReview.mutate(
|
|
6929
|
+
{ billId, requestId }
|
|
6930
|
+
));
|
|
6931
|
+
}
|
|
6932
|
+
__name(requestBillReview, "requestBillReview"), __name2(requestBillReview, "requestBillReview");
|
|
6918
6933
|
function parseLongFlag(arg, next, flags) {
|
|
6919
6934
|
const eq = arg.indexOf("=");
|
|
6920
6935
|
if (eq > 0) return flags[arg.slice(2, eq)] = arg.slice(eq + 1), !1;
|
|
@@ -6979,64 +6994,124 @@ g, customerMemo: string}; isCustomPercentage: boolean", example: '{"budgetId":"<
|
|
|
6979
6994
|
mitted", example: '[{"canonicalField":"CONTACT_FIRST_NAME","typeformFieldId":"<typeform-field-id>"}]' }, "save-inbound-automation-config": { required: "positional <sourceId>; asanaCustomFields: object; asanaDefaultAssigneeId: string|null; asanaDefaultAssigneeName: string|null; asanaFollowerIds: string[]; asanaProjectId: string; asanaSectionId: string; asanaWonSectionId: string; asanaLostSectionId: string; googleCalendarId: string; googleCalendarTimeZone: string; goshBriefBaseUrl: URL", optional: "asanaDiscussionSectionId, asanaFirstContactSectionId, asanaFirstProposalSentSectionId, asanaProposalWipSectionId: string|null; googlePitchCalendarId: string|null (PITCH project events; must differ from googleCalendarId; null keeps them in googleCalendarId); asanaCustomFields.*: mapped IDs", example: '{"asanaCustomFields":{},"asanaDefaultAssigneeId":null,"asanaDefaultAssigneeName":null,"asanaFollowerIds":[],"asanaProjectId":"<asana-project-id>","asanaSectionId":"<asana-section-id>","asanaWonSec\
|
|
6980
6995
|
tionId":"<asana-won-id>","asanaLostSectionId":"<asana-lost-id>","googleCalendarId":"team@example.com","googleCalendarTimeZone":"Asia/Singapore","goshBriefBaseUrl":"https://example.com/brief"}' } }, formatPayloadHelp = __name2((command) => {
|
|
6981
6996
|
const help = payloadHelp[command];
|
|
6982
|
-
return help ? ["Payload fields (--payload JSON)", " Required: ".concat(help.required), " Optional: ".concat(help.optional), " Example: bb ".concat(command).concat(
|
|
6983
|
-
command === "link-bill-quotations" ? " <billId>" : command.startsWith("save-inbound-") ? " <sourceId>" : "",
|
|
6984
|
-
" --payload '"
|
|
6985
|
-
).concat(help.example, "'"), ""] : [];
|
|
6997
|
+
return help ? ["Payload fields (--payload JSON)", " Required: ".concat(help.required), " Optional: ".concat(help.optional), " Example: bb ".concat(command).concat(command === "link-bill-quotations" ? " <billId>" : command.startsWith("save-inbound-") ? " <sourceId>" : "", " --payload '").concat(help.example, "'"), ""] : [];
|
|
6986
6998
|
}, "formatPayloadHelp"), globalCommandOptions = [{ name: "--help", description: "Show help for this command." }, { name: "--quiet", description: "Suppress non-error diagnostics." }, { name: "--debug", description: "Emit sanitized diagnostic traces." }, { name: "--api-url", description: "Override the Budget Builder API base URL." }, { name: "--no-browser", description: "Print the authorization URL without opening a browser." }, { name: "--allow-state-change", description: "Allow a Budget Builder state change in non-interactive use." }, { name: "--allow-email", description: "Allow sending email in non-interactive use." }, { name: "--allow-external-write", description: "Allow writes to external systems in non-interactive use." }, { name: "--allow-delete", description: "Allow deleting data in non-interactive use." }, { name: "--allow-financial-write", description: "Allow financial-record changes in non-interactive use." }], mutationPrefixes = ["add-", "approve-", "archive-", "attach-", "cl\
|
|
6987
6999
|
eanup-", "complete-", "create-", "delete-", "discard-", "import-", "link-", "mark-", "patch-", "reactivate-", "reconcile-", "record-", "refresh-", "reject-", "remove-", "replace-", "rename-", "reorder-", "restore-", "retry-", "revoke-", "save-", "send-", "stage-", "setup-", "submit-", "sync-", "update-", "use-existing-", "upload-", "void-"], emailTargets = /* @__PURE__ */ new Set(["approve-bill", "approve-budget", "approve-customer-invoice", "approve-supplier", "create-bill", "create-bill-approval", "create-budget-approval", "create-customer-invoice", "create-supplier", "reject-bill", "reject-budget", "reject-customer-invoice", "reject-supplier", "send-estimate-email", "send-estimate-to-contact-person", "send-customer-invoice-to-contact-person", "update-bill-status", "update-supplier"]), externalWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-details", "update-customer-invoice-qbo-drift", "record-external-bill-payment", "approve-bill", "approve-customer-invoice", "appr\
|
|
6988
7000
|
ove-supplier", "complete-project", "create-bill", "create-company", "use-existing-company", "create-estimate", "create-placeholder-bill", "create-customer-invoice", "create-item", "create-item-category", "create-project", "create-supplier", "delete-bill", "delete-budget", "delete-company", "delete-customer-invoice", "delete-item", "delete-project", "delete-suppliers", "discard-customer-invoice", "import-qbo-project", "mark-budget-items-not-utilized", "mark-budget-won", "reconcile-project", "reject-customer-invoice", "reactivate-suppliers", "restore-budget-item", "restore-budget-version", "retry-integration-operation", "setup-project-hub", "sync-project-hub-commercial-documents", "sync-customer-invoice", "update-bill", "update-budget-status", "update-company", "update-item", "update-item-category", "update-project", "update-project-status", "update-supplier", "void-customer-invoice"]), financialWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-qbo-drift", "record-external\
|
|
6989
7001
|
-bill-payment", "import-qbo-customer-invoice", "link-bill-quotations", "approve-bill", "approve-customer-invoice", "complete-project", "create-bill", "create-customer-invoice", "create-estimate", "create-placeholder-bill", "delete-budget-commission", "delete-budget-discount", "delete-bill", "delete-budget", "delete-customer-invoice", "mark-budget-items-not-utilized", "mark-budget-won", "mark-customer-invoice-sent-externally", "patch-bill-payment", "reject-customer-invoice", "restore-budget-item", "restore-budget-version", "replace-budget-item", "sync-customer-invoice", "update-bill", "update-bill-payment-evidence", "update-bill-status", "update-budget-commission", "update-budget-discount", "update-budget-status", "update-project-status", "void-customer-invoice"]), deleteTargets = /* @__PURE__ */ new Set(["cleanup-staged-bill-attachments", "delete-webhook-endpoint", "cleanup-staged-quotation-attachments", "discard-customer-invoice", "complete-project", "mark-budget-items-not-utilized", "\
|
|
6990
|
-
remove-budget-item", "restore-budget-version", "update-project-status"]), explicitEffects = { "resubmit-customer-invoice": [
|
|
6991
|
-
"state-change",
|
|
6992
|
-
"external-write",
|
|
6993
|
-
"financial-write",
|
|
6994
|
-
"email"
|
|
6995
|
-
], "rotate-webhook-secret": ["state-change"], "replay-webhook-delivery": ["state-change", "external-write"] }, effectsFor = __name2((legacyTarget) => {
|
|
7002
|
+
remove-budget-item", "restore-budget-version", "update-project-status"]), explicitEffects = { "resubmit-customer-invoice": ["state-change", "external-write", "financial-write", "email"], "request-bill-review": ["state-change", "external-write"], "rotate-webhook-secret": ["state-change"], "replay-webhook-delivery": ["state-change", "external-write"] }, effectsFor = __name2((legacyTarget) => {
|
|
6996
7003
|
const explicit = explicitEffects[legacyTarget];
|
|
6997
7004
|
if (explicit) return explicit;
|
|
6998
7005
|
const effects = /* @__PURE__ */ new Set();
|
|
6999
7006
|
return mutationPrefixes.some((prefix) => legacyTarget.startsWith(prefix)) && effects.add("state-change"), (legacyTarget.startsWith("delete-") || deleteTargets.has(legacyTarget)) && effects.add("delete"), emailTargets.has(legacyTarget) && effects.add("email"), externalWriteTargets.has(legacyTarget) && effects.add("external-write"), financialWriteTargets.has(legacyTarget) && effects.add("financial-write"), [...effects];
|
|
7000
|
-
}, "effectsFor"), titleCase = __name2((value) => value.split("-").map((word) => "".concat(word.slice(0, 1).toUpperCase()).concat(
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
(
|
|
7007
|
+
}, "effectsFor"), titleCase = __name2((value) => value.split("-").map((word) => "".concat(word.slice(0, 1).toUpperCase()).concat(
|
|
7008
|
+
word.slice(1)
|
|
7009
|
+
)).join(" "), "titleCase"), SUMMARIES = /* @__PURE__ */ new Map([
|
|
7010
|
+
["update-budget-status", "Update budget status. APPROVED requires a current Lead/Admin role; budget management permission alone is insufficient. Ordinary users must request approval. Status changes invalidate old pending requests."],
|
|
7011
|
+
["approve-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."],
|
|
7012
|
+
["reject-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."],
|
|
7013
|
+
["create-budget-approval", "Request budget approval for the current content, superseding older pending requests. Existing Lead/Admin autoapproval remains available."],
|
|
7014
|
+
["update-budget-item-supplier", "Change a budget item's eligible supplier/GST snapshot as a material financial edit. Supersede pending approvals and apply the standard budget-to-DRAFT reset policy; inspect and request approval again. An unchanged supplier is a no-op."],
|
|
7015
|
+
["submit-quotation", "Submit a quotation for signing and approval. Claim the captured revision and exact allocation selection; concurrent edits, budget-item deletion or restore cascades conflict instead of attaching old signed PDFs. Refresh and resubmit the current content. The signed PDF is stamped by a queued job (pdfProcessing: PROCESSING until linked); a file whose PDF conversion failed must be uploaded again first. The result includes gstMismatch (null, or the basis, expected GST, saved GST and their difference; see create-quotation); it is a warning only and the approval email shows it to approvers."],
|
|
7016
|
+
["approve-quotation", "Approve your assigned pending quotation as a current Admin. Claim the captured revision and exact allocation selection after signing; concurrent changes conflict and roll back the decision, signed-PDF job and email/outbox. Refresh and review the current content before retrying. The final signed PDF is stamped by a queued job (pdfProcessing); a stopped earlier PDF step blocks approval until it is retried."],
|
|
7017
|
+
["approve-supplier", "Approve a pending supplier request and send a requester reply email, or directly re-approve a rejected supplier as Admin/Lead without a pending request or email. The QuickBooks vendor is created, linked or updated by a queued job (quickBooksSyncQueued, operationId); the supplier stays PENDING_APPROVAL until QuickBooks confirms, and archived suppliers remain archived. Argument: <supplierId>."],
|
|
7018
|
+
["list-approvals", "List one page of requests currently assigned to you and pending approval, oldest first. Returns { items, pageInfo }; follow nextCursor with unchanged --type. --page/--perPage are rejected."],
|
|
7019
|
+
["get-pending-approval", "Read one request still pending your approval, or null if it is no longer pending/assigned. Argument: <approvalId>."],
|
|
7020
|
+
["get-bill-review", "Read current advisory AI bill review and evidence. Passive; no provider calls. Argument: <billId>."],
|
|
7021
|
+
["request-bill-review", "Queue an advisory AI review of a bill pending your approval. No financial decision is made. <billId> [--requestId <id>]"],
|
|
7022
|
+
["get-bill-details", "Get a bill's summary as shown in the web app: status, amounts, people, payment and line totals. Use get-bill-line-items, get-bill-approvals, get-bill-attachments or get-bill-payment for more detail. Argument: <billId>."],
|
|
7023
|
+
["get-bill-line-items", "List a bill's line items with budget-item and quotation-allocation detail. <billId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
7024
|
+
["get-bill-approvals", "List a bill's approval requests with approver, requester and responder. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
7025
|
+
["get-bill-payment", "Get a bill's payment status, reference, date, tracking URL, QuickBooks link and external payment. Argument: <billId>."],
|
|
7026
|
+
["get-quotation", "Get a quotation as shown in the web app: status, documentOnly (true for a $0 supplier document that is never a bill quotation source and does not count as coverage), amounts, people, line totals, files and approvals. pdfProcessing is { status: PROCESSING | FAILED, step: NORMALIZE | STAMP, operationId, error } while a queued PDF conversion or signing step has not linked its PDF, else null. gstMismatch is null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when the saved GST is non-zero and more than $0.05 away from the expected GST (TAXABLE_LINES: the bill calculation for the quoted lines; FULL_SUBTOTAL: 9% of the subtotal); check it before approving. Use get-quotation-line-items for budget-item detail. Argument: <quotationId>."],
|
|
7027
|
+
["get-customer-invoice", "Get an invoice batch as shown in the web app: status, totals, people, approvals and invoice summaries. Use get-customer-invoice-invoices, get-customer-invoice-lines, get-customer-invoice-approvals or get-customer-invoice-history for more detail. Argument: <batchId>."],
|
|
7028
|
+
["get-customer-invoice-invoices", "List a batch's invoices with QuickBooks id/doc number, issue/due dates, amounts, sync state and sender. Argument: <batchId>."],
|
|
7029
|
+
["get-customer-invoice-lines", "List one invoice's lines (name, description, QuickBooks item/tax code, quantity, amounts). <invoiceId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
7030
|
+
["get-customer-invoice-approvals", "List an invoice batch's approval requests with approver, requester and responder. <batchId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
7031
|
+
["get-customer-invoice-history", "List an invoice batch's status history (batch/invoice status changes, source, note, actor). <batchId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
7032
|
+
["get-customer-invoice-payments", "List the payments QuickBooks applied to one invoice: payment id, date, reference, amount applied, total and attachment names. Argument: <invoiceId> (from get-customer-invoice-invoices). Live QuickBooks read."],
|
|
7033
|
+
["get-quotation-line-items", "List a quotation's line items with budget-item, supplier and budget detail. <quotationId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
7034
|
+
["get-bill-attachments", "List bill attachments with cursor pagination. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
7035
|
+
["get-budget-categories", "List budget categories with cursor pagination. [--q] [--limit 1-100] [--cursor <token>] Active categories, name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q."],
|
|
7036
|
+
["get-supplier-overview", "Get a supplier's profile, approvals, pending update, attachments and tab counts (usageCount, _count.items). Skips usage rows, spending and items; use get-supplier-usage or get-supplier-items for those."],
|
|
7037
|
+
["get-supplier-usage", "Get a supplier's usage rows (accepted/closed budget lines and lines with its actual spending) plus spending, actualSpending and estimatedSpending."],
|
|
7038
|
+
["get-supplier-items", "Get the inventory items catalogued under a supplier."],
|
|
7039
|
+
["get-supplier-analytics", "List supplier analytics rows with cursor pagination. [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame ALL|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortBy name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected."],
|
|
7040
|
+
["list-api-keys", "List API keys with cursor pagination. [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)"],
|
|
7041
|
+
[
|
|
7042
|
+
"list-claims",
|
|
7043
|
+
"List reimbursable claims with cursor pagination. Same flags as list-bills (--limit 1-100, --cursor, --direction forward|backward); ignores --isClaimable. Returns { items, pageInfo }."
|
|
7044
|
+
],
|
|
7045
|
+
["list-bills", "List bills with cursor pagination. [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--sortBy createdAt|amount|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; pass nextCursor with --direction forward or previousCursor with --direction backward, keeping the same filters and sort. --page/--pageSize/--perPage are rejected."],
|
|
7046
|
+
["list-customer-invoices", "List customer invoice batches with cursor pagination. [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected. No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds."],
|
|
7047
|
+
["list-quotations", "List quotations with cursor pagination. [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Newest first; returns { items, pageInfo }; each row carries documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy."],
|
|
7048
|
+
["list-users", "List users with cursor pagination. [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <token>] Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager. --page/--perPage are rejected."],
|
|
7049
|
+
["list-companies", "List companies with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Pass nextCursor forward or previousCursor backward unchanged. Legacy page/perPage flags are rejected."],
|
|
7050
|
+
["count-companies", "Count companies independently from list pagination. Returns { totalCount, counts: { active: { true, false } } }; accepts filters only and rejects pagination/sorting flags."],
|
|
7051
|
+
["list-projects", "List projects with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Supports legacy --status plus optional --statuses, WON-date filters (--wonFrom, --wonTo, --wonWithinDays) and --sortBy wonAt; pass nextCursor forward or previousCursor backward unchanged. Legacy page/perPage flags are rejected."],
|
|
7052
|
+
["count-projects", "Count projects independently from list pagination. Returns { totalCount, counts: { status, active: { true, false } } }; accepts project filters only and rejects pagination/sorting flags."],
|
|
7053
|
+
["search-existing-companies", "Search BB and QuickBooks companies without writes. --query <name> [--limit 1-50] [--cursor <token>]. Returns { items, totalCount, pageInfo }; follow pageInfo.nextCursor with the same --query. Legacy --page is rejected."],
|
|
7054
|
+
["use-existing-company", "Reuse a company in BB and QuickBooks, creating only its missing counterpart. Supply --companyId <bbId> and/or --quickbooksId <qboId>; both explicitly connect records with different names. Importing a QuickBooks-only company also needs --name <QuickBooks name from search-existing-companies>. --website <url> fills a missing QBO import website only. --confirmDistinct true confirms no similar record represents this entity. BB saves the company now; its QuickBooks customer is checked, found or created and linked by a queued job (quickBooksSyncQueued, operationId). Estimates, invoices and QuickBooks projects wait for that link."],
|
|
7055
|
+
["create-company", "Create or reuse a company in BB and QuickBooks. --name <name> --website <url> [--billingEmails '<json-array>'] (up to 50 invoice Cc defaults, stored in BB only for new companies; reused company defaults are preserved). Similar names require --confirmDistinct true; inactive companies are never reactivated. BB saves the company now; its QuickBooks customer is found or created by a queued job (quickBooksSyncQueued, operationId), which stops if similar QuickBooks customers exist without --confirmDistinct."],
|
|
7056
|
+
["create-project", "Create a project linked to an existing Asana Deals lead task. Supply --asanaTaskId in non-interactive use; interactive use searches for and selects a lead task (optionally --asanaSearch). For a new direct client, create the lead task using the website form first."],
|
|
7057
|
+
["create-supplier", "Create a supplier using --payload JSON; pending-approval suppliers also request approval and send emails. Reusing an archived name requires Admin; normal users and Leads must ask an Admin to reactivate it before editing. Recreation preserves the existing approval status and creator. Lead/Admin-created suppliers (and archived-name revivals) queue their QuickBooks vendor create or link (quickBooksSyncQueued, operationId) and become usable once QuickBooks confirms; the request makes no QuickBooks call."],
|
|
7058
|
+
["preview-qbo-customer-invoice", "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId>."],
|
|
7059
|
+
["preview-customer-invoice-amount", "Preview amount before GST, GST, and total for a percentage of an accepted estimate. Arguments: <budgetId> <percentage-of-estimate>."],
|
|
7060
|
+
["list-available-qbo-customer-invoices", "List unlinked QuickBooks invoices available for an accepted or closed estimate. Argument: <budgetId>."],
|
|
7061
|
+
["resubmit-customer-invoice", "Resubmit a confirmed expired-and-voided BB invoice as its original requester. Argument: <batchId>. Queues one replacement using the current estimate, original percentage, due date and details; retries return the same replacement. No customer email."],
|
|
7062
|
+
["create-customer-invoice", "Create one invoice from an eligible budget using --payload JSON with invoice date, due date, billing address, customer memo, and a percentage of the original estimate that does not exceed its remaining coverage."],
|
|
7063
|
+
["import-qbo-customer-invoice", "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."],
|
|
7064
|
+
["whoami", "Show the active API-key identity."],
|
|
7065
|
+
["list-budgets", "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."],
|
|
7066
|
+
["list-items", "List one cursor page of catalogue items ({ items, pageInfo }; --limit/--cursor/--direction, optional --sortBy/--sortDir). --page/--perPage are rejected."],
|
|
7067
|
+
["list-item-categories", "List one cursor page of active item categories ({ items, pageInfo }; --limit/--cursor/--direction, optional --name/--sortBy/--sortDir). --page/--perPage are rejected."],
|
|
7068
|
+
["create-item-category", "Admin only. Create (or reactivate) an item category. Budget Builder saves it now and a queued job creates or links the QuickBooks category (quickBooksSyncQueued, operationId); the request makes no QuickBooks call."],
|
|
7069
|
+
["update-item-category", "Rename an item category. Budget Builder saves the name immediately; a category linked to QuickBooks is renamed there by a queued job (quickBooksSyncQueued: true, operationId), never during the request."],
|
|
7070
|
+
["count-item-categories", "Count active item categories matching --name: { totalCount }."],
|
|
7071
|
+
["list-webhook-deliveries", "Admin-only: list webhook deliveries newest first. Returns { items, pageInfo }; follow pageInfo.nextCursor (or previousCursor with --direction backward). Cursors are opaque and filter-bound; raw delivery ids are rejected."],
|
|
7072
|
+
["list-integration-operations", "List one cursor page of integration operations, newest first ({ items, pageInfo }; --limit/--cursor/--direction). --page/--perPage are rejected. Admin only."],
|
|
7073
|
+
["count-integration-operations", "Provider filter options for integration operations: { filterOptions }. No total; filter flags are accepted but do not change the result. Admin only."],
|
|
7074
|
+
["count-items", "Count catalogue items matching filters: total plus category and supplier facets (each ignores its own filter)."],
|
|
7075
|
+
["count-budgets", "Count budgets matching filters: totalCount plus status and active facets. Omit --active for active budgets only."],
|
|
7076
|
+
["get-budget", "Get a budget by ID. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
|
|
7077
|
+
["get-budget-items", "Get line items for a budget. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
|
|
7078
|
+
["get-budget-details", "Get budget details. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
|
|
7079
|
+
["create-bill", "Create a bill or claim with an approved supplier. All amount fields exclude GST: amount is the portion billed; extractedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. --draft-only guarantees DRAFT without email or external writes; otherwise unpaid creation skips email permission but keeps external-write permission. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. It is a warning only and the write still succeeds. An Admin's unpaid bill is approved\
|
|
7080
|
+
on creation and its QuickBooks bill is created by a queued job: the result has quickBooksSyncQueued: true and operationId; follow it with list-integration-operations. The request itself never writes to QuickBooks. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."],
|
|
7081
|
+
["record-external-bill-payment", "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]. The account must be in the cached list (list-external-payment-accounts); the request makes no QuickBooks call. An inactive account (inactiveAccounts) only links the bill's existing QuickBooks payment when the bill is already settled; if there is none, the job is refused before anything is created and the bill goes back to APPROVED. Reuses settled QBO payment links or queues one dated payment from the selected account; the queued job re-checks the account in QuickBooks and stops in the Integration Queue if it is not active. Exact retries are safe; do not pay again while reconciliation is pending."],
|
|
7082
|
+
["mark-customer-invoice-sent-externally", "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>]."],
|
|
7083
|
+
["list-external-payment-accounts", "List active QuickBooks bank and credit-card account IDs for recording external payments (admin only), from Budget Builder's cached list: { accounts, cacheState, inactiveAccounts, refreshedAt, refresh }. inactiveAccounts can only link an already-settled bill's existing payment. No QuickBooks call. The worker refreshes the list automatically every day and after a QuickBooks company change; cacheState is READY, NOT_LOADED (first load pending), REALM_CHANGED (refreshing after a company change; no accounts served and external payments refused until it lands) or DISCONNECTED."],
|
|
7084
|
+
["refresh-external-payment-accounts", "Admin only. Queue a refresh of the cached QuickBooks payment-account list ({ operationId, status: QUEUED }); a refresh already waiting is reused. Optional: the worker already refreshes the list every day and after a QuickBooks company change. Check refreshedAt with list-external-payment-accounts."],
|
|
7085
|
+
["update-bill", "Update a bill or claim with a partial payload including id; omitted fields are preserved. Comment-only updates are allowed on approved/paid bills without altering financial data or QuickBooks. All amount fields exclude GST: amount is the portion billed; extractedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. Re-read and verify both amount fields and allocations after correcting a gross/net mistake. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. \
|
|
7086
|
+
It is a warning only and the write still succeeds. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."],
|
|
7087
|
+
["validate-bill-selection", "Validate the approved supplier and selected bill line items. Supplier bills need approved quotation sources (quotationIds, legacy quotationId, or quotationAllocations with lineAmounts) for every line that is not quotation-exempt (Go Internal lines, or projects/budgets created before the quotation cutoff). With billId, lines already on the bill keep their stored sources unless new sources are supplied. Exemption is decided by the server, so there is no --quotation-exempt flag here. Amounts (amount, lineAmounts, quotationAllocations) are ex-GST dollars with at most 2 decimal places. Returns { success, quotationOverBillingWarnings }: a non-empty warning list means the selection would bill a quotation above its quoted amount (counting other non-rejected bills); this is a warning only and does not fail validation. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by o\
|
|
7088
|
+
ne still counts as unquoted."],
|
|
7089
|
+
["create-quotation", 'Create a quotation with an approved supplier using --payload JSON. Include projectId, budgetId, supplierId, budgetItemIds, amountWithoutGst, gstAmount, and one uploaded attachment in attachments. Multiple budget items require lineAmounts: [{"budgetItemId":"<first-id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every selected budget-item ID exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. Example: amountWithoutGst: 1200 with line amounts 750 and 450. The upload is checked and converted to PDF by a queued job (pdfProcessing in the result and in get-quotation). The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); \
|
|
7090
|
+
FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Document-only quotation (a $0 supplier document, for example a supplier contract or proposal with no price): set documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and every lineAmounts amount 0 (lineAmounts may be omitted; the API fills zeros). It uses the normal draft, submit, sign and Admin approve flow with the attachment, appears in list/get output with documentOnly: true, counts in quotation lists and approval queues, but does not count as quotation coverage: a budget line covered only by it still counts as unquoted, and it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API). Without documentOnly (default false), amountWithoutGst must be positive.'],
|
|
7091
|
+
["cleanup-staged-quotation-attachments", "Queue independent cleanup operations for unattached staged quotation uploads; returns operation IDs and queued/skipped counts, not deletion confirmation. Arguments: <projectId> --keys <csv>."],
|
|
7092
|
+
["update-quotation", 'Update a DRAFT or REJECTED quotation using --payload JSON with id and the complete creation payload. Multiple budget items require lineAmounts: [{"budgetItemId":"<first-id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every budgetItemIds entry exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Update is a full replace: send documentOnly: true again when updating a document-only quotation (documentOnly: true wi\
|
|
7093
|
+
th amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts; default false requires a positive amountWithoutGst), or it is treated as a priced quotation. Document-only quotations are never valid bill quotation sources and do not count as quotation coverage.'],
|
|
7094
|
+
["download-customer-invoice-pdf", "Download a customer invoice PDF when permitted."],
|
|
7095
|
+
["send-customer-invoice-to-contact-person", "Send a customer invoice and update the project billing email. Omit payload cc to use company billing defaults; an explicit list replaces them and [] removes them. Required internal Cc still applies."],
|
|
7096
|
+
["update-company", "Save company fields in BB and queue independent QuickBooks name/website synchronization; returns operation ID, not provider completion. Optional payload billingEmails: email string array (max 50), omit to preserve defaults or [] to clear. Billing emails stay in BB; estimates are unchanged."],
|
|
7097
|
+
["get-company-quickbooks-sync-status", "Read saved company synchronization status without provider calls or polling; use companyId."],
|
|
7098
|
+
["get-item-quickbooks-sync-status", "Read saved item QuickBooks synchronization status without provider calls or polling; use itemId."],
|
|
7099
|
+
["create-webhook-endpoint", "Admin-only: subscribe an HTTPS endpoint to BB events. --name --url --events <type|prefix.*|*,...>. Prints the whsec_ signing secret once; deliveries use Standard Webhooks headers."],
|
|
7100
|
+
["rotate-webhook-secret", "Admin-only: issue a new signing secret; older secrets keep signing for --previousSecretTtlHours (default 24). Prints the new secret once. Argument: <endpointId>."],
|
|
7101
|
+
["send-webhook-test-event", "Admin-only: send a signed webhook.test event to one endpoint. Argument: <endpointId>."],
|
|
7102
|
+
["replay-webhook-delivery", "Admin-only: resend a finished webhook delivery with the same eventId on a fresh attempt chain. Argument: <deliveryId>."],
|
|
7103
|
+
["get-error", "Admin-only: one error log with full diagnostics (stack, cause, request details, metadata, AI summary, resolution). Argument: <errorId>. error recent list returns table columns only."],
|
|
7104
|
+
["get-webhook-delivery", "Admin-only: one webhook delivery with payload and attempts (status codes, errors, durations). Argument: <deliveryId>."],
|
|
7105
|
+
["list-webhook-event-types", "List the outbound webhook event catalogue with group and live/planned status."],
|
|
7106
|
+
["reconcile-resource-operation", "Admin-only check of a saved QuickBooks invoice/company/item job outcome; reads the provider only when uncertain. Applied changes are finished locally without repeating the provider mutation; provably unapplied ones are queued again. Argument: <operationId>."],
|
|
7107
|
+
["get-integration-operation", "Admin-only read of one integration job: who queued it, the records it is for with app links, saved QuickBooks progress, admin actions and Retry state. No provider calls. Argument: <operationId>."],
|
|
7108
|
+
["retry-integration-operation", "Admin-only retry of a failed integration job. QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, provably unapplied ones are sent again, unprovable ones stay stopped with the reason. Argument: <operationId>."]
|
|
7109
|
+
]), summaryFor = __name2((legacyTarget) => {
|
|
7030
7110
|
const summary = SUMMARIES.get(legacyTarget);
|
|
7031
7111
|
return summary !== void 0 ? summary : legacyTarget.startsWith("list-") ? "List ".concat(legacyTarget.slice(5).replaceAll("-", " "), ".") : legacyTarget.startsWith("get-") ? "Get ".concat(legacyTarget.slice(4).replaceAll("-", " "), ".") : "".concat(titleCase(legacyTarget), ".");
|
|
7032
|
-
}, "summaryFor"), aliasesFor = __name2((legacyTarget, aliases) => [...new Set([legacyTarget, ...aliases].flatMap((alias) => [alias, alias.replaceAll("-", "_")]))], "aliasesFor"), legacyCommand = __name2((legacyTarget, path2, aliases = [], commandOptions = []) => ({
|
|
7033
|
-
path: path2,
|
|
7034
|
-
legacyAliases: aliasesFor(legacyTarget, aliases),
|
|
7035
|
-
summary: summaryFor(legacyTarget),
|
|
7036
|
-
options: [...globalCommandOptions, ...commandOptions],
|
|
7037
|
-
effects: effectsFor(legacyTarget),
|
|
7112
|
+
}, "summaryFor"), aliasesFor = __name2((legacyTarget, aliases) => [...new Set([legacyTarget, ...aliases].flatMap((alias) => [alias, alias.replaceAll("-", "_")]))], "aliasesFor"), legacyCommand = __name2((legacyTarget, path2, aliases = [], commandOptions = []) => ({ path: path2, legacyAliases: aliasesFor(legacyTarget, aliases), summary: summaryFor(legacyTarget), options: [...globalCommandOptions, ...commandOptions], effects: effectsFor(
|
|
7038
7113
|
legacyTarget
|
|
7039
|
-
}), "legacyCommand"), budgetPreflightOptions = [{ name: "--companyPayload <json>", description: "Company update JSON object with id, name, and website fields." }, { name: "--contactPayload <json>", description: "Contact update JSON object with companyId, title, firstName, lastName, email, and mobile fields." }, { name: "--eventPayload <json>", description: "Event timing JSON object with date, startTime, and endTime fields." }], authCommand = __name2((action, summary) => ({ path: ["auth", action], legacyAliases: [], summary, options: globalCommandOptions, effects: [], load: __name2(async () => async () => ({}), "load") }), "authCommand"), registry2 = [
|
|
7114
|
+
), legacyTarget }), "legacyCommand"), budgetPreflightOptions = [{ name: "--companyPayload <json>", description: "Company update JSON object with id, name, and website fields." }, { name: "--contactPayload <json>", description: "Contact update JSON object with companyId, title, firstName, lastName, email, and mobile fields." }, { name: "--eventPayload <json>", description: "Event timing JSON object with date, startTime, and endTime fields." }], authCommand = __name2((action, summary) => ({ path: ["auth", action], legacyAliases: [], summary, options: globalCommandOptions, effects: [], load: __name2(async () => async () => ({}), "load") }), "authCommand"), registry2 = [
|
|
7040
7115
|
authCommand("login", "Authorize this device through Budget Builder in your browser."),
|
|
7041
7116
|
authCommand("status", "Show the active CLI authentication method and session status."),
|
|
7042
7117
|
authCommand("logout", "Revoke the interactive CLI session and remove its local credential."),
|
|
@@ -7079,15 +7154,18 @@ tatus codes, errors, durations). Argument: <deliveryId>."], ["list-webhook-event
|
|
|
7079
7154
|
legacyCommand("list-bills", ["bill", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
|
|
7080
7155
|
legacyCommand("list-claims", ["claim", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
|
|
7081
7156
|
legacyCommand("count-bills", ["bill", "count"]),
|
|
7082
|
-
legacyCommand(
|
|
7083
|
-
"count-claims",
|
|
7084
|
-
["claim", "count"]
|
|
7085
|
-
),
|
|
7157
|
+
legacyCommand("count-claims", ["claim", "count"]),
|
|
7086
7158
|
legacyCommand("create-bill-approval", ["bill", "approval", "create"]),
|
|
7087
|
-
legacyCommand("create-bill", ["bill", "create"], [], [{
|
|
7159
|
+
legacyCommand("create-bill", ["bill", "create"], [], [{
|
|
7160
|
+
name: "--draft-only",
|
|
7161
|
+
description: "Create a draft for every role; no approval, email, or QuickBooks writes. Conflicts with alreadyPaid: true."
|
|
7162
|
+
}, { name: "--quotation-exempt", description: "Explicitly request an eligible server-validated supplier-bill quotation exemption. Cannot be combined with quotation IDs." }]),
|
|
7088
7163
|
legacyCommand("validate-bill-selection", ["bill", "selection", "validate"], [], [{ name: "--quotationIds <csv>", description: "Approved quotation IDs for a supplier bill. Each selected budget item must be covered once." }, { name: "--quotationId <id>", description: "Legacy syntax for selecting one approved quotation." }]),
|
|
7089
7164
|
legacyCommand("link-bill-quotations", ["bill", "quotation", "link"], ["billId"], [{ name: "--payload <json>", description: "Explicit quotationAllocations for split source coverage on the bill's stored line amounts; documentOnly quotations are rejected." }, { name: "--quotationIds <csv>", description: "Approved quotation IDs to link across the bill's disjoint line coverage; documentOnly quotations are rejected." }]),
|
|
7090
|
-
legacyCommand(
|
|
7165
|
+
legacyCommand(
|
|
7166
|
+
"update-bill",
|
|
7167
|
+
["bill", "update"]
|
|
7168
|
+
),
|
|
7091
7169
|
legacyCommand("update-bill-payment-evidence", ["bill", "payment-evidence", "update"]),
|
|
7092
7170
|
legacyCommand("delete-bill", ["bill", "delete"]),
|
|
7093
7171
|
legacyCommand("update-bill-status", ["bill", "status", "update"]),
|
|
@@ -7098,11 +7176,16 @@ tatus codes, errors, durations). Argument: <deliveryId>."], ["list-webhook-event
|
|
|
7098
7176
|
legacyCommand("patch-bill-invoice-number", ["bill", "invoice-number", "patch"]),
|
|
7099
7177
|
legacyCommand("get-bill-attachments", ["bill", "attachment", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
|
|
7100
7178
|
legacyCommand("stage-bill-attachment", ["bill", "attachment", "stage"]),
|
|
7101
|
-
legacyCommand(
|
|
7179
|
+
legacyCommand(
|
|
7180
|
+
"cleanup-staged-bill-attachments",
|
|
7181
|
+
["bill", "attachment", "staged", "cleanup"]
|
|
7182
|
+
),
|
|
7102
7183
|
legacyCommand("upload-bill-attachment", ["bill", "attachment", "upload"], ["attach-bill-attachment"]),
|
|
7103
7184
|
legacyCommand("attach-bill-payment-receipt", ["bill", "payment-receipt", "attach"]),
|
|
7104
7185
|
legacyCommand("attach-bill-documents", ["bill", "document", "attach"]),
|
|
7105
7186
|
legacyCommand("get-bill-details", ["bill", "get"]),
|
|
7187
|
+
legacyCommand("get-bill-review", ["bill", "review"]),
|
|
7188
|
+
legacyCommand("request-bill-review", ["bill", "request-review"]),
|
|
7106
7189
|
legacyCommand("get-bill-line-items", ["bill", "line-item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
|
|
7107
7190
|
legacyCommand("get-bill-approvals", ["bill", "approval", "list"], [], [{ name: "--limit <1-50>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
|
|
7108
7191
|
legacyCommand("get-bill-payment", ["bill", "payment", "get"]),
|
|
@@ -7111,10 +7194,7 @@ tatus codes, errors, durations). Argument: <deliveryId>."], ["list-webhook-event
|
|
|
7111
7194
|
legacyCommand("get-quotation", ["quotation", "get"]),
|
|
7112
7195
|
legacyCommand("get-quotation-line-items", ["quotation", "line-item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
|
|
7113
7196
|
legacyCommand("upload-quotation-attachment", ["quotation", "attachment", "upload"]),
|
|
7114
|
-
legacyCommand(
|
|
7115
|
-
"cleanup-staged-quotation-attachments",
|
|
7116
|
-
["quotation", "attachment", "staged", "cleanup"]
|
|
7117
|
-
),
|
|
7197
|
+
legacyCommand("cleanup-staged-quotation-attachments", ["quotation", "attachment", "staged", "cleanup"]),
|
|
7118
7198
|
legacyCommand("create-quotation", ["quotation", "create"], [], [{ name: "--payload", description: "Quotation JSON including lineAmounts for multiple selected budget items; see the payload format above. Set documentOnly: true with zero amounts for a $0 supplier document.", required: !0 }]),
|
|
7119
7199
|
legacyCommand("update-quotation", ["quotation", "update"], [], [{ name: "--payload", description: "Complete quotation JSON plus id, including lineAmounts for multiple selected budget items. Send documentOnly: true again when updating a document-only quotation.", required: !0 }]),
|
|
7120
7200
|
legacyCommand("delete-quotation", ["quotation", "delete"]),
|
|
@@ -7148,12 +7228,10 @@ tatus codes, errors, durations). Argument: <deliveryId>."], ["list-webhook-event
|
|
|
7148
7228
|
legacyCommand("download-customer-invoice-pdf", ["customer-invoice", "pdf", "download"]),
|
|
7149
7229
|
legacyCommand("sync-customer-invoice", ["customer-invoice", "sync"]),
|
|
7150
7230
|
legacyCommand("update-customer-invoice-details", ["customer-invoice", "details", "update"]),
|
|
7151
|
-
legacyCommand(
|
|
7152
|
-
"update-customer-invoice-qbo-drift",
|
|
7153
|
-
["customer-invoice", "qbo-drift", "resolve"]
|
|
7154
|
-
),
|
|
7231
|
+
legacyCommand("update-customer-invoice-qbo-drift", ["customer-invoice", "qbo-drift", "resolve"]),
|
|
7155
7232
|
legacyCommand("mark-customer-invoice-sent-externally", ["customer-invoice", "mark-sent-externally"]),
|
|
7156
|
-
legacyCommand("list-approvals", ["approval", "list"], ["get-pending-approvals"]),
|
|
7233
|
+
legacyCommand("list-approvals", ["approval", "list"], ["get-pending-approvals"], [{ name: "--type <type>", description: "Filter budget, supplier, bill, quotation, customer_invoice, or all." }, { name: "--limit <number>", description: "Page size 1\u2013100; default 50." }, { name: "--cursor <token>", description: "Opaque cursor from pageInfo." }, { name: "--direction <direction>", description: "forward (default) or backward; backward requires a cursor." }]),
|
|
7234
|
+
legacyCommand("get-pending-approval", ["approval", "get"]),
|
|
7157
7235
|
legacyCommand("approve-bill", ["bill", "approve"]),
|
|
7158
7236
|
legacyCommand("reject-bill", ["bill", "reject"]),
|
|
7159
7237
|
legacyCommand("approve-budget", ["budget", "approve"]),
|
|
@@ -7161,7 +7239,10 @@ tatus codes, errors, durations). Argument: <deliveryId>."], ["list-webhook-event
|
|
|
7161
7239
|
legacyCommand("approve-supplier", ["supplier", "approve"]),
|
|
7162
7240
|
legacyCommand("reject-supplier", ["supplier", "reject"]),
|
|
7163
7241
|
legacyCommand("get-supplier-details", ["supplier", "detail", "get"]),
|
|
7164
|
-
legacyCommand(
|
|
7242
|
+
legacyCommand(
|
|
7243
|
+
"get-supplier-overview",
|
|
7244
|
+
["supplier", "overview", "get"]
|
|
7245
|
+
),
|
|
7165
7246
|
legacyCommand("get-supplier-usage", ["supplier", "usage", "get"]),
|
|
7166
7247
|
legacyCommand("get-supplier-items", ["supplier", "items", "get"]),
|
|
7167
7248
|
legacyCommand("list-companies", ["company", "list"], [], [{ name: "--name <text>", description: "Filter by company name substring." }, { name: "--createdBy <userId>", description: "Filter by one creator user ID." }, { name: "--createdByIds <csv>", description: "Filter by a comma-separated creator user ID list." }, { name: "--active <true|false>", description: "Filter by active status; omit to include both states." }, { name: "--sortBy <name|createdAt>", description: "Sort field (default createdAt)." }, { name: "--sortDir <asc|desc>", description: "Sort direction (default desc)." }, { name: "--limit <1-100>", description: "Bounded page size (default 20)." }, { name: "--cursor <token>", description: "Opaque pageInfo cursor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "--direction <forward|backward>", description: "Use forward by default; backward requires --cursor." }]),
|
|
@@ -7196,10 +7277,7 @@ sor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "
|
|
|
7196
7277
|
legacyCommand("list-suppliers", ["supplier", "list"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses; ALL means no status filter." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived." }, { name: "--limit <1-100>", description: "Bounded page size (default 10). Retired page/perPage flags are rejected." }, { name: "--cursor <token>", description: "Opaque nextCursor or previousCursor from items/pageInfo." }, { name: "--direction <forward|backward>", description: "Forward by default; backward requires a cursor." }, { name: "--sortBy <field>", description: "name, email, phone, gstRegistered, status, active, createdAt or updated\
|
|
7197
7278
|
At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by default." }, { name: "--sort <json>", description: "Ordered {id,desc} array for multi-column sorting; cannot combine with sortBy/sortDir." }]),
|
|
7198
7279
|
legacyCommand("count-suppliers", ["supplier", "count"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived. No pagination/sort flags." }]),
|
|
7199
|
-
legacyCommand(
|
|
7200
|
-
"create-supplier",
|
|
7201
|
-
["supplier", "create"]
|
|
7202
|
-
),
|
|
7280
|
+
legacyCommand("create-supplier", ["supplier", "create"]),
|
|
7203
7281
|
legacyCommand("update-supplier", ["supplier", "update"]),
|
|
7204
7282
|
legacyCommand("delete-suppliers", ["supplier", "delete"]),
|
|
7205
7283
|
legacyCommand("reactivate-suppliers", ["supplier", "reactivate"]),
|
|
@@ -7230,22 +7308,17 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7230
7308
|
legacyCommand("revoke-api-key", ["user", "api-key", "revoke"]),
|
|
7231
7309
|
legacyCommand("get-user-performance", ["user", "performance", "get"]),
|
|
7232
7310
|
legacyCommand("get-dashboard", ["dashboard", "get"]),
|
|
7233
|
-
legacyCommand(
|
|
7311
|
+
legacyCommand(
|
|
7312
|
+
"get-monthly-metrics",
|
|
7313
|
+
["dashboard", "monthly-metrics", "get"]
|
|
7314
|
+
),
|
|
7234
7315
|
legacyCommand("get-system-overview", ["dashboard", "system-overview", "get"]),
|
|
7235
7316
|
legacyCommand("get-estimate-performance", ["dashboard", "estimate-performance", "get"]),
|
|
7236
7317
|
legacyCommand("get-financial-overview", ["dashboard", "financial-overview", "get"]),
|
|
7237
|
-
legacyCommand("get-recent-errors", [
|
|
7238
|
-
"error",
|
|
7239
|
-
"recent",
|
|
7240
|
-
"list"
|
|
7241
|
-
], [], [{ name: "--cursor <token>", description: "Pass a returned pageInfo boundary unchanged, with the same filters." }, { name: "--direction <direction>", description: "forward (default) uses nextCursor; backward uses previousCursor." }, { name: "--limit <number>", description: "1\u2013100 rows (default 10). Returns items and pageInfo, without a total." }, { name: "--severity <severity>", description: "Error severity or ALL." }, { name: "--status <status>", description: "Error status or ALL." }, { name: "--timeFrame <period>", description: "all_time (default), last_30_days, last_3_months, last_6_months or last_1_year." }]),
|
|
7318
|
+
legacyCommand("get-recent-errors", ["error", "recent", "list"], [], [{ name: "--cursor <token>", description: "Pass a returned pageInfo boundary unchanged, with the same filters." }, { name: "--direction <direction>", description: "forward (default) uses nextCursor; backward uses previousCursor." }, { name: "--limit <number>", description: "1\u2013100 rows (default 10). Returns items and pageInfo, without a total." }, { name: "--severity <severity>", description: "Error severity or ALL." }, { name: "--status <status>", description: "Error status or ALL." }, { name: "--timeFrame <period>", description: "all_time (default), last_30_days, last_3_months, last_6_months or last_1_year." }]),
|
|
7242
7319
|
legacyCommand("count-errors", ["error", "recent", "count"], [], [{ name: "--severity <severity>", description: "Error severity or ALL." }, { name: "--status <status>", description: "Error status or ALL." }, { name: "--timeFrame <period>", description: "Same filters as error recent list; returns independent totalCount." }]),
|
|
7243
7320
|
legacyCommand("get-error", ["error", "get"]),
|
|
7244
|
-
legacyCommand("get-error-metrics", [
|
|
7245
|
-
"error",
|
|
7246
|
-
"metrics",
|
|
7247
|
-
"get"
|
|
7248
|
-
]),
|
|
7321
|
+
legacyCommand("get-error-metrics", ["error", "metrics", "get"]),
|
|
7249
7322
|
legacyCommand("list-integration-operations", ["integration", "operation", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
|
|
7250
7323
|
legacyCommand("count-integration-operations", ["integration", "operation", "count"]),
|
|
7251
7324
|
legacyCommand("get-integration-operation", ["integration", "operation", "get"]),
|
|
@@ -7277,7 +7350,10 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7277
7350
|
legacyCommand("get-budget-category-benchmarks", ["budget", "category", "benchmark", "get"]),
|
|
7278
7351
|
legacyCommand("get-item-pricing-history", ["item", "pricing-history", "list"]),
|
|
7279
7352
|
legacyCommand("get-supplier-pricing-history", ["supplier", "pricing-history", "list"])
|
|
7280
|
-
], normalizeToken = __name2((value) => value.replaceAll("_", "-"), "normalizeToken"), normalizedPath = __name2(
|
|
7353
|
+
], normalizeToken = __name2((value) => value.replaceAll("_", "-"), "normalizeToken"), normalizedPath = __name2(
|
|
7354
|
+
(path2) => path2.map(normalizeToken),
|
|
7355
|
+
"normalizedPath"
|
|
7356
|
+
), assertRegistry = __name2((commands) => {
|
|
7281
7357
|
const paths = /* @__PURE__ */ new Set(), aliases = /* @__PURE__ */ new Set();
|
|
7282
7358
|
for (const command of commands) {
|
|
7283
7359
|
const path2 = command.path.join(" ");
|
|
@@ -7296,19 +7372,17 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7296
7372
|
assertRegistry(registry2);
|
|
7297
7373
|
var commandRegistry = registry2, resolveCommand = __name2((argv) => {
|
|
7298
7374
|
const normalizedArgv = argv.map(normalizeToken), canonical = [...commandRegistry].sort((left, right) => right.path.length - left.path.length).find((command) => normalizedPath(command.path).every((segment, index) => normalizedArgv[index] === segment));
|
|
7299
|
-
if (canonical) return { command: canonical, argv: argv.slice(
|
|
7375
|
+
if (canonical) return { command: canonical, argv: argv.slice(
|
|
7376
|
+
canonical.path.length
|
|
7377
|
+
), invokedAs: argv.slice(0, canonical.path.length), isLegacyAlias: !1 };
|
|
7300
7378
|
const rawAlias = argv[0];
|
|
7301
7379
|
if (!rawAlias) return;
|
|
7302
7380
|
const normalizedAlias = normalizeToken(rawAlias), legacy = commandRegistry.find((command) => command.legacyAliases.some((alias) => normalizeToken(alias) === normalizedAlias));
|
|
7303
|
-
if (legacy) return { command: legacy, argv: argv.slice(1), invokedAs: [
|
|
7304
|
-
rawAlias
|
|
7305
|
-
], isLegacyAlias: !0 };
|
|
7381
|
+
if (legacy) return { command: legacy, argv: argv.slice(1), invokedAs: [rawAlias], isLegacyAlias: !0 };
|
|
7306
7382
|
}, "resolveCommand"), updateBeforeUse = "First step before each task: update to the latest published release with 'bun add --global @go-labs-sg/bb@latest', then run 'bb version' and 'bb --help' before using commands. Update once per task. If updating fails, stop and report it. Preserve an explicitly requested pinned or development/staging version.", createHumanHelp = __name2((command) => {
|
|
7307
7383
|
if (command) return [updateBeforeUse, "", "Usage: bb ".concat(command.path.join(" "), " [options] [args]"), "", command.summary, "", "Legacy aliases: ".concat(command.legacyAliases.join(", ")), "", "Options", ...command.options.map((option) => " ".concat(option.name, "\n ").concat(option.description)), "", ...formatPayloadHelp(command.legacyTarget ?? ""), "Use `bb help --legacy` for additional command arguments."].join("\n");
|
|
7308
7384
|
const lines = commandRegistry.map((command2) => {
|
|
7309
|
-
const canonical = "bb ".concat(command2.path.join(" ")), aliases = command2.legacyAliases.filter((alias) => alias.includes("-")).map((alias) => "bb ".concat(
|
|
7310
|
-
alias
|
|
7311
|
-
)).join(", ");
|
|
7385
|
+
const canonical = "bb ".concat(command2.path.join(" ")), aliases = command2.legacyAliases.filter((alias) => alias.includes("-")).map((alias) => "bb ".concat(alias)).join(", ");
|
|
7312
7386
|
return " ".concat(canonical, "\n ").concat(command2.summary).concat(aliases ? " Legacy: ".concat(aliases, ".") : "");
|
|
7313
7387
|
});
|
|
7314
7388
|
return ["bb \u2014 Budget Builder CLI", "", updateBeforeUse, "", "Usage: bb <resource> <operation> [options] [args]", "", "Global options", ...globalCommandOptions.map((option) => " ".concat(option.name, "\n ").concat(option.description)), "", "Canonical commands", ...lines, "", "Use `bb completion <shell>` to generate shell completion scripts."].join("\n");
|
|
@@ -7339,10 +7413,7 @@ function parsePositiveIntFlag(value, flagName) {
|
|
|
7339
7413
|
return parsed;
|
|
7340
7414
|
}
|
|
7341
7415
|
__name(parsePositiveIntFlag, "parsePositiveIntFlag"), __name2(parsePositiveIntFlag, "parsePositiveIntFlag");
|
|
7342
|
-
var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = [
|
|
7343
|
-
"asc",
|
|
7344
|
-
"desc"
|
|
7345
|
-
], COMPANY_PAGE_FLAGS = ["page", "perPage", "pageSize", "page-size", "per-page", "page_size", "per_page"], rejectBareFlag = __name2((flags, key) => {
|
|
7416
|
+
var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc", "desc"], COMPANY_PAGE_FLAGS = ["page", "perPage", "pageSize", "page-size", "per-page", "page_size", "per_page"], rejectBareFlag = __name2((flags, key) => {
|
|
7346
7417
|
if (flags[key] === !0) throw new Error("--".concat(key, " requires a value."));
|
|
7347
7418
|
}, "rejectBareFlag"), rejectCompanyPageFlags = __name2((flags, command) => {
|
|
7348
7419
|
for (const key of COMPANY_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is not supported by company ").concat(command, "; use --limit and --cursor for list or company count for totals."));
|
|
@@ -7351,14 +7422,11 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = [
|
|
|
7351
7422
|
const parsed = Number(String(value));
|
|
7352
7423
|
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) throw new Error("--limit must be an integer from 1 to 100.");
|
|
7353
7424
|
return parsed;
|
|
7354
|
-
}, "parseCompanyLimit"), parseCompanySortBy = __name2(
|
|
7355
|
-
(value)
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
},
|
|
7360
|
-
"parseCompanySortBy"
|
|
7361
|
-
), parseCompanySortDir = __name2((value) => {
|
|
7425
|
+
}, "parseCompanyLimit"), parseCompanySortBy = __name2((value) => {
|
|
7426
|
+
if (value === void 0) return "createdAt";
|
|
7427
|
+
if (!COMPANY_SORT_FIELDS.includes(value)) throw new Error('Invalid --sortBy "'.concat(value, '". Use one of: ').concat(COMPANY_SORT_FIELDS.join(", "), "."));
|
|
7428
|
+
return value;
|
|
7429
|
+
}, "parseCompanySortBy"), parseCompanySortDir = __name2((value) => {
|
|
7362
7430
|
if (value === void 0) return "desc";
|
|
7363
7431
|
if (!COMPANY_SORT_DIRECTIONS.includes(value)) throw new Error('Invalid --sortDir "'.concat(value, '". Use one of: ').concat(COMPANY_SORT_DIRECTIONS.join(", "), "."));
|
|
7364
7432
|
return value;
|
|
@@ -7368,23 +7436,18 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = [
|
|
|
7368
7436
|
return value;
|
|
7369
7437
|
}, "parseCompanyDirection"), parseCompanyListFlags = __name2((flags) => {
|
|
7370
7438
|
rejectCompanyPageFlags(flags, "list");
|
|
7371
|
-
for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"])
|
|
7439
|
+
for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"])
|
|
7440
|
+
rejectBareFlag(flags, key);
|
|
7372
7441
|
const cursor = getFlag(flags, "cursor"), direction = parseCompanyDirection(getFlag(flags, "direction"));
|
|
7373
7442
|
if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
|
|
7374
7443
|
if (cursor === "") throw new Error("--cursor requires a non-empty token.");
|
|
7375
|
-
return { name: getFlag(
|
|
7376
|
-
flags,
|
|
7377
|
-
"name"
|
|
7378
|
-
), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active"), limit: parseCompanyLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCompanySortBy(getFlag(flags, "sortBy")), sortDir: parseCompanySortDir(getFlag(flags, "sortDir")) };
|
|
7444
|
+
return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active"), limit: parseCompanyLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCompanySortBy(getFlag(flags, "sortBy")), sortDir: parseCompanySortDir(getFlag(flags, "sortDir")) };
|
|
7379
7445
|
}, "parseCompanyListFlags"), parseCompanyCountFlags = __name2((flags) => {
|
|
7380
7446
|
rejectCompanyPageFlags(flags, "count");
|
|
7381
7447
|
for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7382
7448
|
if (flags.limit !== void 0 || flags.cursor !== void 0 || flags.direction !== void 0) throw new Error("company count does not accept list pagination flags.");
|
|
7383
7449
|
if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("company count does not accept list sorting flags.");
|
|
7384
|
-
return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(
|
|
7385
|
-
flags,
|
|
7386
|
-
"active"
|
|
7387
|
-
) };
|
|
7450
|
+
return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active") };
|
|
7388
7451
|
}, "parseCompanyCountFlags"), PROJECT_SORT_FIELDS = ["name", "createdAt", "status", "companyName", "wonAt"], PROJECT_SORT_DIRECTIONS = ["asc", "desc"], PROJECT_PAGE_FLAGS = ["page", "perPage", "pageSize", "page-size", "per-page", "page_size", "per_page"], rejectProjectPageFlags = __name2((flags, command) => {
|
|
7389
7452
|
for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is not supported by project ").concat(command, "; use --limit and --cursor for list or project count for totals."));
|
|
7390
7453
|
}, "rejectProjectPageFlags"), parseProjectLimit = __name2((value) => {
|
|
@@ -7407,18 +7470,21 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = [
|
|
|
7407
7470
|
return parsed;
|
|
7408
7471
|
}, "parseProjectWonWithinDays"), parseProjectDirection = __name2((value) => {
|
|
7409
7472
|
if (value === void 0) return "forward";
|
|
7410
|
-
if (value !== "forward" && value !== "backward") throw new Error(
|
|
7473
|
+
if (value !== "forward" && value !== "backward") throw new Error(
|
|
7474
|
+
'--direction must be "forward" or "backward".'
|
|
7475
|
+
);
|
|
7411
7476
|
return value;
|
|
7412
7477
|
}, "parseProjectDirection"), parseProjectListFlags = __name2((flags) => {
|
|
7413
7478
|
rejectProjectPageFlags(flags, "list");
|
|
7414
|
-
for (const key of ["companyId", "name", "status", "statuses", "active", "wonFrom", "wonTo", "wonWithinDays", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(
|
|
7415
|
-
flags,
|
|
7416
|
-
key
|
|
7417
|
-
);
|
|
7479
|
+
for (const key of ["companyId", "name", "status", "statuses", "active", "wonFrom", "wonTo", "wonWithinDays", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7418
7480
|
const cursor = getFlag(flags, "cursor"), direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7419
7481
|
if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
|
|
7420
7482
|
if (cursor === "") throw new Error("--cursor requires a non-empty token.");
|
|
7421
|
-
return { companyId: getFlag(flags, "companyId"), name: getFlag(flags, "name"), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(flags, "active"), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(
|
|
7483
|
+
return { companyId: getFlag(flags, "companyId"), name: getFlag(flags, "name"), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(flags, "active"), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(
|
|
7484
|
+
getFlag(flags, "wonTo"),
|
|
7485
|
+
"--wonTo",
|
|
7486
|
+
{ endOfDay: !0 }
|
|
7487
|
+
), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseProjectSortBy(getFlag(flags, "sortBy")), sortDir: parseProjectSortDir(getFlag(flags, "sortDir")) };
|
|
7422
7488
|
}, "parseProjectListFlags"), parseProjectCountFlags = __name2((flags) => {
|
|
7423
7489
|
rejectProjectPageFlags(flags, "count");
|
|
7424
7490
|
for (const key of ["companyId", "name", "status", "statuses", "active", "wonFrom", "wonTo", "wonWithinDays", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
@@ -7463,7 +7529,8 @@ function parseCommercialRejectionProjectStatus(flags) {
|
|
|
7463
7529
|
}
|
|
7464
7530
|
__name(parseCommercialRejectionProjectStatus, "parseCommercialRejectionProjectStatus"), __name2(parseCommercialRejectionProjectStatus, "parseCommercialRejectionProjectStatus");
|
|
7465
7531
|
var rejectRetiredPageFlags = __name2((flags) => {
|
|
7466
|
-
for (const key of PROJECT_PAGE_FLAGS)
|
|
7532
|
+
for (const key of PROJECT_PAGE_FLAGS)
|
|
7533
|
+
if (flags[key] !== void 0) throw new Error("--".concat(key, " is retired; use --limit/--cursor, or the matching count command for totals."));
|
|
7467
7534
|
}, "rejectRetiredPageFlags"), parseDetailFeedPage = __name2((command, idLabel, positional, flags, maxLimit) => {
|
|
7468
7535
|
const id = positional[0];
|
|
7469
7536
|
if (!id) throw new Error("".concat(command, " requires ").concat(idLabel));
|
|
@@ -7486,9 +7553,7 @@ function parseListBillsFlags(flags) {
|
|
|
7486
7553
|
rejectRetiredPageFlags(flags);
|
|
7487
7554
|
for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7488
7555
|
const sortByRaw = getFlag(flags, "sortBy"), sortDirRaw = getFlag(flags, "sortDir"), cursor = getFlag(flags, "cursor");
|
|
7489
|
-
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error(
|
|
7490
|
-
"--cursor must be a non-empty opaque token of at most 8192 characters."
|
|
7491
|
-
);
|
|
7556
|
+
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
7492
7557
|
const direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7493
7558
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
7494
7559
|
return { ...parseBillFilterFlags(flags), sortBy: parseOptionalBillListSortBy(sortByRaw !== void 0 ? String(sortByRaw) : void 0), sortDir: parseOptionalBillListSortDir(sortDirRaw !== void 0 ? String(sortDirRaw) : void 0), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction };
|
|
@@ -7496,7 +7561,13 @@ function parseListBillsFlags(flags) {
|
|
|
7496
7561
|
__name(parseListBillsFlags, "parseListBillsFlags"), __name2(parseListBillsFlags, "parseListBillsFlags");
|
|
7497
7562
|
function parseCountBillsFlags(flags) {
|
|
7498
7563
|
rejectRetiredPageFlags(flags);
|
|
7499
|
-
for (const key of [
|
|
7564
|
+
for (const key of [
|
|
7565
|
+
"limit",
|
|
7566
|
+
"cursor",
|
|
7567
|
+
"direction",
|
|
7568
|
+
"sortBy",
|
|
7569
|
+
"sortDir"
|
|
7570
|
+
]) if (flags[key] !== void 0) throw new Error("bill count does not accept --".concat(key, "; totals use filters only."));
|
|
7500
7571
|
return { ...parseBillFilterFlags(flags), includeMetrics: parseOptionalBoolFlag(flags, "includeMetrics") ?? !1 };
|
|
7501
7572
|
}
|
|
7502
7573
|
__name(parseCountBillsFlags, "parseCountBillsFlags"), __name2(parseCountBillsFlags, "parseCountBillsFlags");
|
|
@@ -7510,11 +7581,12 @@ function parseOptionalSupplierSortBy(raw) {
|
|
|
7510
7581
|
__name(parseOptionalSupplierSortBy, "parseOptionalSupplierSortBy"), __name2(parseOptionalSupplierSortBy, "parseOptionalSupplierSortBy");
|
|
7511
7582
|
var parseSupplierFilters = __name2((flags) => {
|
|
7512
7583
|
for (const key of ["name", "createdBy", "gstRegistered", "status", "supplierTags", "active"]) rejectBareFlag(flags, key);
|
|
7513
|
-
return { name: getFlag(flags, "name"), createdBy: parseCommaSeparatedIds(getFlag(flags, "createdBy")), gstRegistered: parseOptionalBoolFlag(
|
|
7584
|
+
return { name: getFlag(flags, "name"), createdBy: parseCommaSeparatedIds(getFlag(flags, "createdBy")), gstRegistered: parseOptionalBoolFlag(
|
|
7585
|
+
flags,
|
|
7586
|
+
"gstRegistered"
|
|
7587
|
+
) ?? null, status: parseCommaSeparatedSupplierStatuses(getFlag(flags, "status")), supplierTags: parseCommaSeparatedIds(getFlag(flags, "supplierTags")), active: parseOptionalBoolFlag(flags, "active") ?? !0 };
|
|
7514
7588
|
}, "parseSupplierFilters"), rejectSupplierPageFlags = __name2((flags) => {
|
|
7515
|
-
for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error(
|
|
7516
|
-
"--".concat(key, " is retired for suppliers; use --limit/--cursor or supplier count for totals.")
|
|
7517
|
-
);
|
|
7589
|
+
for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is retired for suppliers; use --limit/--cursor or supplier count for totals."));
|
|
7518
7590
|
}, "rejectSupplierPageFlags"), parseSupplierListSortEntries = __name2((sortRaw) => {
|
|
7519
7591
|
const parsed = parseJsonFlag(sortRaw, "--sort");
|
|
7520
7592
|
if (!Array.isArray(parsed) || parsed.length > 8) throw new Error("--sort must be a JSON array of at most eight {id, desc} entries.");
|
|
@@ -7528,9 +7600,7 @@ var parseSupplierFilters = __name2((flags) => {
|
|
|
7528
7600
|
const sortRaw = getFlag(flags, "sort");
|
|
7529
7601
|
if (sortRaw !== void 0) {
|
|
7530
7602
|
if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("Use --sort or --sortBy/--sortDir, not both.");
|
|
7531
|
-
return parseSupplierListSortEntries(
|
|
7532
|
-
sortRaw
|
|
7533
|
-
);
|
|
7603
|
+
return parseSupplierListSortEntries(sortRaw);
|
|
7534
7604
|
}
|
|
7535
7605
|
const sortBy = parseOptionalSupplierSortBy(getFlag(flags, "sortBy")), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
|
|
7536
7606
|
return [{ id: sortBy ?? "createdAt", desc: (sortDir ?? "desc") === "desc" }];
|
|
@@ -7544,15 +7614,16 @@ var parseSupplierFilters = __name2((flags) => {
|
|
|
7544
7614
|
const sort = parseSupplierListSort(flags);
|
|
7545
7615
|
return { ...parseSupplierFilters(flags), limit, cursor, direction, sort };
|
|
7546
7616
|
}, "parseListSuppliersFlags"), parseCountSuppliersFlags = __name2((flags) => {
|
|
7547
|
-
rejectSupplierPageFlags(
|
|
7548
|
-
flags
|
|
7549
|
-
);
|
|
7617
|
+
rejectSupplierPageFlags(flags);
|
|
7550
7618
|
for (const key of ["limit", "cursor", "direction", "sort", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("supplier count does not accept --".concat(key, "; totals use filters only."));
|
|
7551
7619
|
return parseSupplierFilters(flags);
|
|
7552
7620
|
}, "parseCountSuppliersFlags");
|
|
7553
7621
|
function parseDashboardQueryFlags(flags) {
|
|
7554
7622
|
const roleRaw = getFlag(flags, "role"), timeFrameRaw = getFlag(flags, "timeFrame");
|
|
7555
|
-
return { userId: getFlag(flags, "userId"), role: parseOptionalDashboardRole(roleRaw !== void 0 ? String(roleRaw) : void 0), deals: parseOptionalDeals(getFlag(flags, "deals")), timeFrame: parseOptionalTimeFrame(timeFrameRaw !== void 0 ? String(timeFrameRaw) : void 0), startDate: getFlag(
|
|
7623
|
+
return { userId: getFlag(flags, "userId"), role: parseOptionalDashboardRole(roleRaw !== void 0 ? String(roleRaw) : void 0), deals: parseOptionalDeals(getFlag(flags, "deals")), timeFrame: parseOptionalTimeFrame(timeFrameRaw !== void 0 ? String(timeFrameRaw) : void 0), startDate: getFlag(
|
|
7624
|
+
flags,
|
|
7625
|
+
"startDate"
|
|
7626
|
+
), endDate: getFlag(flags, "endDate") };
|
|
7556
7627
|
}
|
|
7557
7628
|
__name(parseDashboardQueryFlags, "parseDashboardQueryFlags"), __name2(parseDashboardQueryFlags, "parseDashboardQueryFlags");
|
|
7558
7629
|
function printLegacyHelp(runtime) {
|
|
@@ -7567,32 +7638,32 @@ on backward, keeping the same filters and sort. --page/--pageSize/--perPage are
|
|
|
7567
7638
|
ations. Document-only quotations (documentOnly: true, $0) are never valid bill sources; create-bill, update-bill, validate-bill-selection and link-bill-quotations reject them, and a line covered only by one still counts as unquoted.\n Amounts for create/update (including drafts) exclude GST: amount = portion billed; extractedAmount = full invoice subtotal; lineAmounts[].amount and quotationAllocations[].amount also exclude GST. The CLI does not strip GST from input.\n Example: invoice subtotal 1800 + GST 162 = total 1962 -> amount: 1800, extractedAmount: 1800, allocations totaling 1800. BB calculates applicable GST separately. Re-read and verify both amount fields after writing.\n create-bill-approval <billId> (also queues approval request emails)\n create-bill --payload '<json>' [--draft-only] [--quotation-exempt] (bill.create; supplier bills use payload.quotationAllocations for split sources or quotationIds for disjoint coverage; explicit allocations require lin\
|
|
7568
7639
|
eAmounts; claims reject quotation sources; an Admin's unpaid bill queues its QuickBooks bill: quickBooksSyncQueued, operationId)\n validate-bill-selection --payload '<json>' [--quotationIds <csv> | --quotationId <id>] Validate an approved supplier and approved quotation coverage for each supplier-bill line. --quotationId is legacy single-quotation syntax.\n link-bill-quotations <billId> (--payload '<json>' | --quotationIds <csv>) Admin-only source-link repair; payload.quotationAllocations supports same-line splits.\n stage-bill-attachment <projectId> <filePath...> [--file <path>] [--files <csv>] Upload files before create-bill; returns attachment JSON for attachments/paymentProofAttachments\n cleanup-staged-bill-attachments <projectId> --keys <csv> Queue cleanup of unattached staged uploads; returns operation IDs.\n update-bill --payload '<json>' (bill.update; must include id)\n update-bill-payment-evidence --payload '<json>' Replace paymentReference/pay\
|
|
7569
7640
|
mentProofAttachments for an already-paid bill.\n delete-bill <billId>\n update-bill-status <id> <status> [--rejectionReason] [--paymentTrackingUrl] [--paymentReference] [--paymentProof <receipt.pdf>] [--overBudgetOverrideReason <text>]\n status (").concat(billStatusesForUpdateHelp.join(", "), ') \u2014 not PENDING_APPROVAL; use create-bill-approval\n PAID requires --paymentReference and a payment-proof PDF. Use --paymentProof to stage and submit the PDF atomically, or omit it only when BB already has a BILL_PAYMENT_PROOF attachment.\n Moving a bill or claim to PAID runs the server\'s paid-bill notification workflow.\n patch-bill-payment <billId> [--paymentTrackingUrl] [--paymentReference] [--quickbooksBillId] [--paymentDate <ISO>]\n Clear a field: --clearPaymentTrackingUrl true | --clearPaymentReference true | --clearQuickbooksBillId true | --clearPaymentDate true\n patch-bill-invoice-number <billId> <invoiceNumber>\n get-bill-attachments <billId> [--limit 1-50] [--cursor <token>]\
|
|
7570
|
-
\n Newest first. Returns { items, pageInfo }; follow nextCursor.\n upload-bill-attachment <billId> <filePath...> [--file <path>] [--files <csv>] Attach invoice/supporting files as BILL attachments to any bill status, including PAID bills\n attach-bill-payment-receipt <billId> <filePath...> [--file <path>] [--files <csv>] Attach Wise/payment-proof PDFs as BILL_PAYMENT_PROOF attachments\n attach-bill-documents <billId> [--invoice <path>] [--invoices <csv>] [--paymentProof|--payment-proof|--proof <path>] [--paymentProofs|--payment-proofs|--proofs <csv>] Attach invoice and/or payment proof files with separate BB attachment types\n get-bill-details <billId> Bill summary as shown in the web app (status, amounts, people, payment, line totals)\n get-bill-line-items <billId> [--limit 1-100] [--cursor <token>] Line
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
estimate total, invoiced/remaining percentages, and available amount.\n preview-customer-invoice-amount <budgetId> <percentage-of-estimate> Preview amount before GST, GST, and total for a percentage of the original estimate. The percentage cannot exceed the budget\'s remaining coverage.\n list-available-qbo-customer-invoices <budgetId> List unlinked QuickBooks invoices available for this accepted or closed estimate before previewing and importing one.\n list-customer-invoices [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
copies them into BB only; KEEP_BB queues BB\'s address and memo to QuickBooks.\n\nApprovals\n list-approvals | get-pending-approvals [--type budget|supplier|bill|quotation|customer_invoice|all]\n approve-bill <billId> [--overBudgetOverrideReason <text>] (also sends requester reply email)\n reject-bill <billId> --reason <text> (also sends requester reply email)\n approve-budget <budgetId> (also sends requester reply email)\n reject-budget <budgetId> --reason <text> (also sends requester reply email)\n approve-supplier <supplierId> (approve a pending request, or Admin/Lead re-approve a rejected supplier; QuickBooks vendor sync is queued)\n reject-supplier <
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
wonBy { id, name } and wonAtEstimated (true for backfilled dates).\n count-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N]\n Returns independent { totalCount, counts: { status, active: { true, false } } }; no pagination or sorting flags.\n list-project-hubs [--q] [--status CSV] [--sortBy startDate|name|companyName|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-project-hubs [--q] [--
|
|
7584
|
-
|
|
7585
|
-
<id> <status> [--projectManagerId <userId>] [--projectManagerEmail <email>]\n 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.\n Required when moving PITCH \u2192 WON: supply --projectManagerId or --projectManagerEmail.\n The project manager must be an active @getout.sg user; list eligible users with list-users --projectTeamOnly true.\n status: ').concat(projectStatusesForHelp.join(", "), "\n\nContacts\n list-contacts <companyId>\n create-contact-person --payload '<json>' (contactPerson.createContactPerson; title MR|MRS|MS|DR)\n
|
|
7586
|
-
sort JSON] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false]\n count-suppliers [--name] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false] (independent totals/facets; no pagination/sort flags)\n Defaults: --active true, --limit 10, --sortBy createdAt, --sortDir desc (same as the web list); pass --active false for archived suppliers.\n create-supplier --payload '<json>' (supplier.createSupplier; archived-name recreation is Admin-only; auto-requests approval + emails when status is PENDING_APPROVAL; Lead/Admin creates queue the
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
--q] [--projectTeamOnly true|false] totalCount for the same search\n create-user --email <email> [--name <name>] [--role ").concat(userRolesForHelp.join("|"), '] (admin; API-only service identity with no Google sign-in)\n create-api-key --name <label> [--userId <userId>] (defaults to the caller; admin required for another user; raw key is shown once)\n list-api-keys [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)\n revoke-api-key <apiKeyId> [--userId <userId>] (defaults to the caller; admin required for another user)\n
|
|
7592
|
-
|
|
7593
|
-
operations [same filter flags] provider filter options only (no total; filters do not change the result)\n get-integration-operation <operationId> (one job: who queued it, what it is for, saved progress, Retry state)\n retry-integration-operation <operationId> [--confirmExternalStateReconciled true|false] [--outboundEmailResolution ACCEPTED|NOT_ACCEPTED_RETRY] [--providerMessageId <id>] (QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, unapplied ones are sent again)\n reconcile-resource-operation <operationId> (admin: check a QuickBooks invoice/company/item job outcome without retrying; same check Retry runs
|
|
7594
|
-
|
|
7595
|
-
|
|
7641
|
+
\n Newest first. Returns { items, pageInfo }; follow nextCursor.\n upload-bill-attachment <billId> <filePath...> [--file <path>] [--files <csv>] Attach invoice/supporting files as BILL attachments to any bill status, including PAID bills\n attach-bill-payment-receipt <billId> <filePath...> [--file <path>] [--files <csv>] Attach Wise/payment-proof PDFs as BILL_PAYMENT_PROOF attachments\n attach-bill-documents <billId> [--invoice <path>] [--invoices <csv>] [--paymentProof|--payment-proof|--proof <path>] [--paymentProofs|--payment-proofs|--proofs <csv>] Attach invoice and/or payment proof files with separate BB attachment types\n get-bill-review <billId> Read advisory AI review and evidence (passive)\n request-bill-review <billId> [--requestId <id>] Queue AI review; never approves or pays\n get-bill-details <billId> Bill summary as shown in the web app (status, amounts, people, payment, line totals)\n get-bill-line-items <billId> [--limit 1-100] [--cursor <token>] Line item\
|
|
7642
|
+
s with budget-item/quotation detail; { items, pageInfo }\n get-bill-approvals <billId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }\n get-bill-payment <billId> Payment status, reference, date, tracking URL, QuickBooks link and external payment\n\nQuotations\n list-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Newest first; returns { items, pageInfo }; rows carry documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy.\n count-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount\
|
|
7643
|
+
metrics\n get-quotation <quotationId> Quotation as shown in the web app (status, documentOnly, amounts, people, line totals, files, approvals; pdfProcessing is PROCESSING or FAILED until queued PDF conversion/signing links the PDF; gstMismatch warns when GST differs from the expected GST)\n get-quotation-line-items <quotationId> [--limit 1-100] [--cursor <token>] Line items with budget-item detail; { items, pageInfo }\n upload-quotation-attachment <projectId> <filePath> Upload one PDF, JPEG, or PNG up to 20MB; returns attachment JSON for a quotation payload.\n cleanup-staged-quotation-attachments <projectId> --keys <csv> Queue cleanup of unattached quotation uploads; returns operation IDs.\n create-quotation --payload \'<json>\' (quotation.createDraft; requires amountWithoutGst, gstAmount, and lineAmounts [{budgetItemId, amount}] for multiple budgetItemIds; amounts before GST must sum to amountWithoutGst; result gstMismatch warns when gstAmount is not 0 or the expecte\
|
|
7644
|
+
d GST)\n Document-only ($0 supplier document, e.g. a contract or proposal with no price): set documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts (lineAmounts may be omitted). It goes through submit/sign/approve like any quotation and shows documentOnly: true in list/get output, but it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API) and does not count as quotation coverage: a budget line covered only by it still counts as unquoted. Without documentOnly (default false), amountWithoutGst must be positive.\n Example: --payload \'{"projectId":"<id>","budgetId":"<id>","supplierId":"<id>","budgetItemIds":["<id>"],"amountWithoutGst":0,"gstAmount":0,"documentOnly":true,"attachments":[<uploaded attachment>]}\'\n update-quotation --payload \'<json>\' Update a DRAFT or REJECTED quotation; same allocation payload plus id; use lineAmounts [{budgetItemId, amount}] for eve\
|
|
7645
|
+
ry selected item. Result gstMismatch warns when gstAmount is not 0 or the expected GST. Update is a full replace: send documentOnly: true again when updating a document-only quotation, or it is treated as a priced quotation and needs a positive amountWithoutGst.\n delete-quotation <quotationId>\n submit-quotation <quotationId> [--overBudgetOverrideReason <text>] (signed PDF is made by a queued job: pdfProcessing; gstMismatch warns when GST is not 0 or the expected GST)\n approve-quotation <quotationId> [--overBudgetOverrideReason <text>] (assigned pending request/current Admin; concurrent revision or allocation changes conflict; final signed PDF is queued: pdfProcessing)\n reject-quotation <quotationId> --reason <text>\n download-quotation-pdf <quotationId> [original|staff|final] (refused with "still processing" until the queued PDF step links it)\n\nCustomer invoices\n check-customer-invoice-readiness <budgetId> Readiness plus the full remaining-balance amount preview and l\
|
|
7646
|
+
ive QuickBooks validation.\n list-eligible-customer-invoice-budgets <projectId> Accepted budgets that are ready and still have invoice coverage remaining, including estimate total, invoiced/remaining percentages, and available amount.\n preview-customer-invoice-amount <budgetId> <percentage-of-estimate> Preview amount before GST, GST, and total for a percentage of the original estimate. The percentage cannot exceed the budget\'s remaining coverage.\n list-available-qbo-customer-invoices <budgetId> List unlinked QuickBooks invoices available for this accepted or closed estimate before previewing and importing one.\n list-customer-invoices [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCu\
|
|
7647
|
+
rsor with the same filters and sort. --page/--perPage are rejected.\n No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds.\n 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\n get-customer-invoice <batchId> Batch as shown in the web app: status, totals, people, approvals and invoice summaries\n get-customer-invoice-invoices <batchId> Invoices with QuickBooks identity, dates, sync state, bill email (from QuickBooks) and held QuickBooks changes (qboDetailsDrift)\n get-customer-invoice-lines <invoiceId> [--limit 1-100] [--cursor <token>] One invoice\'s lines; { items, pageInfo }\n get-customer-invoice-approvals <batchId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }\n \
|
|
7648
|
+
get-customer-invoice-history <batchId> [--limit 1-100] [--cursor <token>] Status history; { items, pageInfo }\n get-customer-invoice-payments <invoiceId> Payments QuickBooks applied to one invoice (date, reference, amount applied, attachment names). Live QuickBooks read.\n get-customer-invoice-email-context <batchId> Contact, required CC, budget, and project context for composing an invoice email.\n preview-qbo-customer-invoice <budgetId> <qboInvoiceId> Preview an invoice selected from list-available-qbo-customer-invoices; works on accepted/closed estimates.\n import-qbo-customer-invoice <budgetId> <qboInvoiceId> --token <previewToken> Confirm the reviewed BB-only link; requires --allow-state-change --allow-financial-write in automation.\n create-customer-invoice --payload \'<json>\' Create one invoice from an eligible budget. Include budgetId, a recommended UUID requestId, invoiceDate, details {billingAddress, customerMemo}, and exactly one split {label, percent\
|
|
7649
|
+
age, dueDate}. Percentage is of the original estimate and cannot exceed the remaining coverage. Never sends.\n discard-customer-invoice <batchId> Discard a reserved CREATING batch with no created QBO invoices.\n delete-customer-invoice <batchId> Delete QBO invoices and the local batch.\n void-customer-invoice <batchId> Void the invoice batch in QuickBooks.\n resubmit-customer-invoice <batchId> Original requester only. Queues one replacement after confirmed expiry voiding; retries return the same replacement. Never sends to the customer.\n approve-customer-invoice <batchId> Admin approval; rejects voided invoices, notifies the creator, and closes the estimate at cumulative 100% coverage.\n reject-customer-invoice <batchId> --reason <text> Admin rejection; voids QBO invoices and notifies the creator.\n send-customer-invoice-to-contact-person --payload \'<json>\' Queues same composer workflow as web; requires invoiceId, to, cc, replyT\
|
|
7650
|
+
o, subject, HTML content, and HTML signature.\n download-customer-invoice-pdf <invoiceId> [--output <path>]\n 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.\n 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.\n update-customer-invoice-details <invoiceId> --billingAddress <text> --customerMemo <text> [--requestId <uuid>]\n Save bill-to address and memo in BB and queue the QuickBooks update (external write). Bill email is managed in QuickBooks.\n update-customer-invoice-qbo-drift\
|
|
7651
|
+
<invoiceId> --resolution ACCEPT_QBO|KEEP_BB [--requestId <uuid>]\n Admin: resolve flagged QuickBooks changes. ACCEPT_QBO copies them into BB only; KEEP_BB queues BB\'s address and memo to QuickBooks.\n\nApprovals\n list-approvals | get-pending-approvals [--type budget|supplier|bill|quotation|customer_invoice|all] [--limit 1-100] [--cursor token] [--direction forward|backward]\n get-pending-approval <approvalId> Read one request still pending your approval.\n approve-bill <billId> [--overBudgetOverrideReason <text>] (also sends requester reply email)\n reject-bill <billId> --reason <text> (also sends requester reply email)\n approve-budget <budgetId> (also sends requester reply email)\n reject-budget <budgetId> --reason <text> (also sends requester reply email)\n approve-supplier <supplierId> (approve a pending request, or Admin/Lead re-approve a rejected supplier; QuickBooks vendor sync is queued)\n reject-supplier <supp\
|
|
7652
|
+
lierId> --reason <text> (also sends requester reply email)\n\nCompanies & projects\n list-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false] [--sortBy name|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor] [--direction forward|backward]\n Returns { items, pageInfo }; pass nextCursor with direction forward or previousCursor with direction backward. Omit --cursor to restart.\n count-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false]\n Returns independent { totalCount, counts: { active: { true, false } } }; no pagination or sorting flags.\n get-company <id>\n search-existing-companies --query <name> [--limit 1-50] [--cursor <token>] (BB + QuickBooks, read-only; follow pageInfo.nextCursor)\n use-existing-company --companyId <bbId> and/or --quickbooksId <qboId> [--name <qboName>] [--website <url>] [--confirmDistinct true]\n Supply both IDs to explicitly connect existing records with different names.\n\
|
|
7653
|
+
Reuses both records, creating only the missing counterpart. A QBO-only import needs --name (from search-existing-companies);\n website is needed only for a QBO import without one. The QuickBooks link is queued (quickBooksSyncQueued, operationId).\n create-company --name --website <url> [--confirmDistinct true] [--billingEmails \'<json-array>\'] (QuickBooks customer queued)\n Exact existing companies are reused. Similar names require explicit separate-entity confirmation.\n update-company --payload \'<json>\' (optional billingEmails: omit to preserve, [] to clear; returns queued QBO operation ID, not completion)\n get-company-quickbooks-sync-status <companyId> (saved status only; no provider call or polling)\n delete-company <id>\n list-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N] [--limit 1-100] [--cursor] [--direction forward|backward] [--sortBy name|created\
|
|
7654
|
+
At|status|companyName|wonAt] [--sortDir asc|desc]\n Returns { items, pageInfo }; pass nextCursor with direction forward or previousCursor with direction backward. Legacy --page/--perPage are rejected.\n --sortBy wonAt orders by when the project was marked WON (unwon projects last). Each project includes wonAt, wonBy { id, name } and wonAtEstimated (true for backfilled dates).\n count-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N]\n Returns independent { totalCount, counts: { status, active: { true, false } } }; no pagination or sorting flags.\n list-project-hubs [--q] [--status CSV] [--sortBy startDate|name|companyName|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-project-hubs [--q] [--s\
|
|
7655
|
+
tatus CSV] totalCount plus status facet\n List active projects that have a Project Hub integration.\n get-project <id>\n Budget overview totalRevenue includes Estimate Accepted and Estimate Closed budgets only.\n create-project --name --companyId --contactPersonId --insideSalesId --businessDevelopmentId --venue --startDate <ISO> [--projectManagerId <userId>] [--asanaTaskId] [--asanaSearch <text>] [--pax] [--endDate <ISO>] [--description]\n update-project --payload \'<json>\' (project.updateProject; warns before estimate-affecting changes reject linked estimates; a companyId change (with a contactPersonId from that company) does not itself reject estimates or touch invoices, but date/pax/venue changes in the same save still do; optional projectManagerId and requestQboAccountantNotification)\n delete-project <id>\n check-project-reconciliation <id> Run the same live reconciliation review as the web app without changing status.\n reconcile-project <id> \
|
|
7656
|
+
Rerun all checks transactionally and mark an eligible WON project RECONCILED.\n complete-project <id> Rerun reconciliation validation, mark a RECONCILED project COMPLETED, and queue QBO placeholder cleanup.\n import-qbo-project <projectId> --url <quickBooksProjectUrl>\n update-project-status <id> <status> [--projectManagerId <userId>] [--projectManagerEmail <email>]\n 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.\n Required when moving PITCH \u2192 WON: supply --projectManagerId or --projectManagerEmail.\n The project manager must be an active @getout.sg user; list eligible users with list-users --projectTeamOnly true.\n status: ').concat(projectStatusesForHelp.join(", "), "\n\nContacts\n list-contacts <companyId>\n create-contact-person --payload '<json>' (contactPerson.createContactPerson; title MR|MRS|MS|DR)\n updat\
|
|
7657
|
+
e-contact-person --payload '<json>' (contactPerson.updateContactPerson; must include id)\n\nSuppliers & items\n list-suppliers [--name] [--limit 1-100] [--cursor <token>] [--direction forward|backward] [--sortBy createdAt|updatedAt|name|email|phone|gstRegistered|status|active] [--sortDir asc|desc | --sort JSON] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false]\n count-suppliers [--name] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false] (independent totals/facets; no pagination/sort flags)\n Defaults: --active true, --limit 10, --sortBy createdAt, --sortDir desc (same as the web list); pass --active false for archived suppliers.\n create-supplier --payload '<json>' (supplier.createSupplier; archived-name recreation is Admin-only; auto-requests approval + emails when status is PENDING_APPROVAL; Lead/Admin creates queue the QuickBoo\
|
|
7658
|
+
ks vendor: quickBooksSyncQueued, operationId)\n update-supplier --payload '<json>' (authenticated; normal-user edits require server-enforced approval; Lead/Admin edits of a linked supplier queue the QuickBooks sync)\n delete-suppliers --ids <csv> (supplier.deleteSuppliers; admin; archives/deactivates supplier items)\n reactivate-suppliers --ids <csv> (supplier.reactivateSuppliers; admin; queues QuickBooks vendor reactivation, then the suppliers and their items become active: queuedSuppliers, operations)\n create-certification --name (supplier.createCertification)\n create-payment-method --name (supplier.createPaymentMethod)\n create-supplier-role --name (supplier.createSupplierRole)\n create-supplier-tag --name (supplier.createSupplierTag)\n create-item --payload '<json>' (item.createItem; saves the item and queues its QuickBooks create: quickBooksSyncQueued, operationId)\n update-item --payload '<\
|
|
7659
|
+
json>' (item.updateItem; must include id)\n archive-items --ids <csv> (item.archiveItems; Budget Builder only; max 100; users can archive their own items, leads/admins any item; open estimates retain snapshot lines and require resolution before send/acceptance)\n delete-item <id> (item.deleteItem; admin; archives in Budget Builder and makes the item inactive in QuickBooks; blocked while used by an open estimate)\n get-supplier-details <supplierId>\n get-supplier-overview <supplierId> (supplier.getSupplierOverview; profile, approvals, attachments and tab counts; no usage or items)\n get-supplier-usage <supplierId> (supplier.getSupplierUsage; usage rows and spending)\n get-supplier-items <supplierId> (supplier.getSupplierItems; inventory items)\n get-supplier-analytics [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame ALL|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortB\
|
|
7660
|
+
y name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-supplier-analytics [--name] [--status] [--gstRegistered] [--createdBy] [--timeFrame] [--startDate --endDate] Admin. totalCount for the same filters\n list-items [--name] [--includeQuickBooksDeactivationPending true] [--sortBy createdAt|updatedAt|name|cost|itemCategory|supplier] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-items [same filter flags as list-items] total plus category and supplier facets\n get-item <id>\n get-item-quickbooks-sync-status <itemId> (saved status only; no provi\
|
|
7661
|
+
der call or polling)\n list-item-categories [--name] [--sortBy createdAt|name|itemCount|createdBy] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Active categories only; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-item-categories [--name] totalCount of active categories\n create-item-category --name (admin; saves the category and queues its QuickBooks create: quickBooksSyncQueued, operationId)\n update-item-category --id --name (authenticated; renames in BB now and queues the QuickBooks rename: quickBooksSyncQueued, operationId)\n delete-item-categories --ids <csv> (itemCategory.deleteItemCategories; admin; empty categories only)\n\nDashboard & users\n whoami Show the user identity and role for the active API key.\n list-users [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <t\
|
|
7662
|
+
oken>]\n Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --page/--perPage are rejected.\n --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager.\n count-users [--q] [--projectTeamOnly true|false] totalCount for the same search\n create-user --email <email> [--name <name>] [--role ").concat(userRolesForHelp.join("|"), '] (admin; API-only service identity with no Google sign-in)\n create-api-key --name <label> [--userId <userId>] (defaults to the caller; admin required for another user; raw key is shown once)\n list-api-keys [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)\n revoke-api-key <apiKeyId> [--userId <userId>] (defaults to the caller; admin required for another user)\n g\
|
|
7663
|
+
et-user-performance [--userId] (admin)\n get-dashboard [--userId] [--role BD|CREATOR|INSIDE_SALES|ALL] [--deals ALL|SUCCESSFUL|LOST] [--timeFrame] [--startDate] [--endDate] (admin)\n get-monthly-metrics [same optional flags as get-dashboard] (admin; dashboard.getMonthlyMetrics)\n get-system-overview [same optional flags as get-dashboard] (admin; dashboard.getSystemOverview)\n get-estimate-performance [same optional flags as get-dashboard] (admin; dashboard.getEstimatePerformance)\n get-financial-overview [same optional flags as dashboard; role uses BudgetRole enum] (admin)\n\nErrors\n get-recent-errors [--cursor] [--direction forward|backward] [--limit] [--severity] [--status] [--timeFrame] (admin)\n count-errors [--severity] [--status] [--timeFrame] (admin)\n get-error <errorId> Full diagnostics: stack, cause, request, metadata (admin)\n get-error-metrics (admin)\n\nAutomation (admin)\n list-integration-\
|
|
7664
|
+
operations [--search] [--destination <provider,...>] [--status <PENDING|PROCESSING|FAILED|COMPLETED,...>] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Newest first; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters. --page/--perPage are rejected.\n count-integration-operations [same filter flags] provider filter options only (no total; filters do not change the result)\n get-integration-operation <operationId> (one job: who queued it, what it is for, saved progress, Retry state)\n retry-integration-operation <operationId> [--confirmExternalStateReconciled true|false] [--outboundEmailResolution ACCEPTED|NOT_ACCEPTED_RETRY] [--providerMessageId <id>] (QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, unapplied ones are sent again)\n reconcile-resource-operation <operationId> (admin: check a QuickBooks invoice/company/item job outcome without retrying; same check Retry runs\
|
|
7665
|
+
first)\n\nWebhooks (admin)\n list-webhook-event-types (event catalogue: type, group, live|planned)\n list-webhook-endpoints\n get-webhook-endpoint <endpointId>\n create-webhook-endpoint --name <name> --url <https-url> --events <type|prefix.*|*,...> [--enabled true|false] (prints the signing secret once)\n update-webhook-endpoint <endpointId> [--name] [--url] [--events <...>] [--enabled true|false]\n delete-webhook-endpoint <endpointId>\n rotate-webhook-secret <endpointId> [--previousSecretTtlHours <0-168>] (prints the new secret once)\n send-webhook-test-event <endpointId>\n list-webhook-deliveries [--endpointId] [--status <PENDING|SUCCEEDED|FAILED,...>] [--eventType] [--limit 1-100] [--cursor <token>] [--direction forward|backward] (newest first; prints items + pageInfo)\n get-webhook-delivery <deliveryId> (attempts with response codes)\n replay-webhook-delivery <deliveryId> (same eventId, new attempt chain)\n\nHistorical / benchmarks\n get-approved-budgets [--projectId] [--\
|
|
7666
|
+
limit] [--minRevenue] [--maxRevenue]\n get-budget-category-benchmarks <categoryId> [--limit]\n get-item-pricing-history [--itemName] [--categoryId] [--supplierId] [--limit]\n get-supplier-pricing-history <supplierId> [--itemCategoryId] [--limit]\n\nOutput: JSON to stdout. Errors to stderr; exit 1 on failure.\n\nMCP parity: every MCP tool maps to one command above. The CLI also exposes\n reorder-budget-items and update-budget-item-supplier (web UI\u2013oriented tRPC).\n You may use MCP-style snake_case (e.g. bb list_bills) \u2014 normalized to kebab-case.\n\nNote: MCP also exposes a Prisma schema resource; the CLI has no equivalent.\n\nNot covered vs MCP get_budget: "get-budget" also fetches line items in one call.\n').trim();
|
|
7596
7667
|
runtime.stdout.write("".concat(help, "\n"));
|
|
7597
7668
|
}
|
|
7598
7669
|
__name(printLegacyHelp, "printLegacyHelp"), __name2(printLegacyHelp, "printLegacyHelp");
|
|
@@ -7649,10 +7720,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7649
7720
|
const positionalTarget = resolvedCommand.argv.find((value) => value !== "--" && !value.startsWith("-"));
|
|
7650
7721
|
return positionalTarget !== void 0 && !positionalTarget.startsWith("{") && !positionalTarget.startsWith("[") ? positionalTarget : resolvedCommand.command.path.join(" ");
|
|
7651
7722
|
}, "commandConfirmationTarget"), PAGING_FLAG_KEYS = ["limit", "cursor", "direction", "sortBy", "sortDir"], rejectCountPagingFlags = __name2((flags, commandName) => {
|
|
7652
|
-
for (const key of PAGING_FLAG_KEYS) if (flags[key] !== void 0) throw new Error("".concat(
|
|
7653
|
-
commandName,
|
|
7654
|
-
" does not accept --"
|
|
7655
|
-
).concat(key, "; totals use filters only."));
|
|
7723
|
+
for (const key of PAGING_FLAG_KEYS) if (flags[key] !== void 0) throw new Error("".concat(commandName, " does not accept --").concat(key, "; totals use filters only."));
|
|
7656
7724
|
}, "rejectCountPagingFlags"), rejectBarePagingFlags = __name2((flags) => {
|
|
7657
7725
|
for (const key of PAGING_FLAG_KEYS) rejectBareFlag(flags, key);
|
|
7658
7726
|
}, "rejectBarePagingFlags"), parseCursorAndDirection = __name2((flags) => {
|
|
@@ -7668,10 +7736,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7668
7736
|
}, "parseAscDescSortDir"), commandWhoami = __name2(async () => {
|
|
7669
7737
|
await whoAmI();
|
|
7670
7738
|
}, "commandWhoami"), commandListBudgets = __name2(async ({ cmd, flags }) => {
|
|
7671
|
-
const statusStr = getFlag(
|
|
7672
|
-
flags
|
|
7673
|
-
|
|
7674
|
-
), statuses = parseCommaSeparatedBudgetStatuses(statusStr !== void 0 ? String(statusStr) : void 0), filters = { projectId: getFlag(flags, "projectId"), name: getFlag(flags, "name"), statuses, createdBy: getFlag(flags, "createdBy"), dateFrom: getFlag(flags, "dateFrom"), dateTo: getFlag(flags, "dateTo"), active: parseBudgetActiveFlag(flags) };
|
|
7739
|
+
const statusStr = getFlag(flags, "status"), statuses = parseCommaSeparatedBudgetStatuses(statusStr !== void 0 ? String(statusStr) : void 0), filters = { projectId: getFlag(flags, "projectId"), name: getFlag(flags, "name"), statuses, createdBy: getFlag(flags, "createdBy"), dateFrom: getFlag(flags, "dateFrom"), dateTo: getFlag(flags, "dateTo"), active: parseBudgetActiveFlag(
|
|
7740
|
+
flags
|
|
7741
|
+
) };
|
|
7675
7742
|
if (rejectRetiredPageFlags(flags), cmd === "count-budgets") {
|
|
7676
7743
|
for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("count-budgets does not accept --".concat(key, "; totals use filters only."));
|
|
7677
7744
|
await countBudgets(filters);
|
|
@@ -7683,18 +7750,24 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7683
7750
|
const direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7684
7751
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
7685
7752
|
await listBudgets({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: getFlag(flags, "sortBy"), sortDir: getFlag(flags, "sortDir"), includeDetails: flags.summary === !0 ? !1 : parseOptionalBoolFlag(flags, "includeDetails") ?? !0 });
|
|
7686
|
-
}, "commandListBudgets"), commandGetBudget = __name2(
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7753
|
+
}, "commandListBudgets"), commandGetBudget = __name2(
|
|
7754
|
+
async ({ flags, positional }) => {
|
|
7755
|
+
const id = positional[0];
|
|
7756
|
+
if (!id) throw new Error("get-budget requires <id>");
|
|
7757
|
+
await getBudget(id, { includeInactive: flags.includeInactive === !0 ? !0 : parseOptionalBoolFlag(flags, "includeInactive") ?? !1 });
|
|
7758
|
+
},
|
|
7759
|
+
"commandGetBudget"
|
|
7760
|
+
), commandUploadBudgetAttachment = __name2(async ({ positional }) => {
|
|
7691
7761
|
const [budgetId, filePath] = positional;
|
|
7692
7762
|
if (!budgetId || !filePath) throw new Error("upload-budget-attachment requires <budgetId> <filePath>");
|
|
7693
7763
|
await uploadBudgetAttachmentFromPath(budgetId, filePath);
|
|
7694
7764
|
}, "commandUploadBudgetAttachment"), commandMarkBudgetWon = __name2(async ({ flags, positional }) => {
|
|
7695
7765
|
const [budgetId, filePath] = positional;
|
|
7696
7766
|
if (!budgetId || !filePath) throw new Error("mark-budget-won requires <budgetId> <filePath>");
|
|
7697
|
-
await markBudgetWonWithProof(budgetId, filePath, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectInvoiceSettings: getFlag(flags, "invoiceSettings") !== void 0 ? parseJsonFlag(
|
|
7767
|
+
await markBudgetWonWithProof(budgetId, filePath, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectInvoiceSettings: getFlag(flags, "invoiceSettings") !== void 0 ? parseJsonFlag(
|
|
7768
|
+
String(getFlag(flags, "invoiceSettings")),
|
|
7769
|
+
"--invoiceSettings"
|
|
7770
|
+
) : void 0 });
|
|
7698
7771
|
}, "commandMarkBudgetWon"), commandGetBudgetItems = __name2(async ({ flags, positional }) => {
|
|
7699
7772
|
const id = positional[0];
|
|
7700
7773
|
if (!id) throw new Error("get-budget-items requires <budgetId>");
|
|
@@ -7715,8 +7788,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7715
7788
|
if (!id) throw new Error("get-budget-versions requires <budgetId>");
|
|
7716
7789
|
const limit = flags.limit === void 0 ? void 0 : Number(flags.limit);
|
|
7717
7790
|
if (flags.limit === !0 || limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 50)) throw new CliRuntimeError("USAGE", "--limit must be an integer from 1 to 50.");
|
|
7718
|
-
if (flags.cursor === !0 || flags.cursor === "")
|
|
7719
|
-
throw new CliRuntimeError("USAGE", "--cursor requires the nextCursor token from the previous page.");
|
|
7791
|
+
if (flags.cursor === !0 || flags.cursor === "") throw new CliRuntimeError("USAGE", "--cursor requires the nextCursor token from the previous page.");
|
|
7720
7792
|
await getBudgetVersions(id, { limit, cursor: flags.cursor, all: flags.all === !0 || (parseOptionalBoolFlag(flags, "all") ?? !1) });
|
|
7721
7793
|
}, "commandGetBudgetVersions"), commandRenameBudgetVersion = __name2(async ({ flags, positional }) => {
|
|
7722
7794
|
const versionId = positional[0], newName = getFlag(flags, "name");
|
|
@@ -7729,10 +7801,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7729
7801
|
}, "commandRestoreBudgetVersion"), commandUpdateBudgetStatus = __name2(async ({ flags, positional }) => {
|
|
7730
7802
|
const [id, status] = positional;
|
|
7731
7803
|
if (!id || !status) throw new Error("update-budget-status requires <id> <status>");
|
|
7732
|
-
if (!isBudgetStatusUpdate(status)) throw new Error(
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7804
|
+
if (!isBudgetStatusUpdate(status)) throw new Error("Invalid status. Use one of: ".concat(budgetStatusesForHelp.join(", ")));
|
|
7805
|
+
await updateBudgetStatus(id, status, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectStatusOnCommercialRejection: parseCommercialRejectionProjectStatus(
|
|
7806
|
+
flags
|
|
7807
|
+
), projectInvoiceSettings: getFlag(flags, "invoiceSettings") !== void 0 ? parseJsonFlag(String(getFlag(flags, "invoiceSettings")), "--invoiceSettings") : void 0 });
|
|
7736
7808
|
}, "commandUpdateBudgetStatus"), commandCreateBudgetApproval = __name2(async ({ flags, positional }) => {
|
|
7737
7809
|
const id = positional[0];
|
|
7738
7810
|
if (!id) throw new Error("create-budget-approval requires <budgetId>");
|
|
@@ -7745,13 +7817,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7745
7817
|
await createEstimate(id, { company: companyPayloadRaw !== void 0 ? parseJsonObjectFlag(String(companyPayloadRaw), "--companyPayload") : void 0, contactPerson: contactPayloadRaw !== void 0 ? parseJsonObjectFlag(String(contactPayloadRaw), "--contactPayload") : void 0, eventDetails: eventPayloadRaw !== void 0 ? parseJsonObjectFlag(String(eventPayloadRaw), "--eventPayload") : void 0 });
|
|
7746
7818
|
}, "commandCreateEstimate"), commandSendEstimateEmail = __name2(async ({ flags }) => {
|
|
7747
7819
|
const payloadRaw = getFlag(flags, "payload");
|
|
7748
|
-
if (!payloadRaw)
|
|
7749
|
-
throw new Error("send-estimate-to-contact-person requires --payload '<json>'");
|
|
7820
|
+
if (!payloadRaw) throw new Error("send-estimate-to-contact-person requires --payload '<json>'");
|
|
7750
7821
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
7751
7822
|
await sendEstimateToContactPersonFromPayload(raw);
|
|
7752
7823
|
}, "commandSendEstimateEmail"), commandCreateBudget = __name2(async ({ flags }) => {
|
|
7753
7824
|
const payloadRaw = getFlag(flags, "payload");
|
|
7754
|
-
if (!payloadRaw) throw new Error(
|
|
7825
|
+
if (!payloadRaw) throw new Error(
|
|
7826
|
+
"create-budget requires --payload '<json>'"
|
|
7827
|
+
);
|
|
7755
7828
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
7756
7829
|
await createBudgetFromPayload(raw);
|
|
7757
7830
|
}, "commandCreateBudget"), commandUpdateBudget = __name2(async ({ flags }) => {
|
|
@@ -7764,10 +7837,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7764
7837
|
if (!id) throw new Error("delete-budget requires <budgetId>");
|
|
7765
7838
|
await deleteBudgetById(id);
|
|
7766
7839
|
}, "commandDeleteBudget"), commandAddBudgetItems = __name2(async ({ flags }) => {
|
|
7767
|
-
const budgetId = getFlag(
|
|
7768
|
-
flags,
|
|
7769
|
-
"budgetId"
|
|
7770
|
-
);
|
|
7840
|
+
const budgetId = getFlag(flags, "budgetId");
|
|
7771
7841
|
if (!budgetId) throw new Error("add-budget-items requires --budgetId");
|
|
7772
7842
|
const items = parseJsonFlag(String(getFlag(flags, "items")), "--items");
|
|
7773
7843
|
await addBudgetItems({ budgetId: String(budgetId), items });
|
|
@@ -7787,10 +7857,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7787
7857
|
const budgetItemId = getFlag(flags, "budgetItemId"), reason = getFlag(flags, "reason");
|
|
7788
7858
|
if (!budgetItemId || !reason) throw new Error("approve-unavailable-item-exception requires --budgetItemId and --reason");
|
|
7789
7859
|
await approveUnavailableItemException({ budgetItemId: String(budgetItemId), reason: String(reason) });
|
|
7790
|
-
}, "commandApproveUnavailableItemException"), commandReorderBudgetItems = __name2(async ({
|
|
7791
|
-
flags,
|
|
7792
|
-
positional
|
|
7793
|
-
}) => {
|
|
7860
|
+
}, "commandApproveUnavailableItemException"), commandReorderBudgetItems = __name2(async ({ flags, positional }) => {
|
|
7794
7861
|
const budgetId = positional[0], itemIdsRaw = getFlag(flags, "itemIds");
|
|
7795
7862
|
if (!budgetId || itemIdsRaw === void 0) throw new Error("reorder-budget-items requires <budgetId> --itemIds <csv>");
|
|
7796
7863
|
const itemIds = parseCommaSeparatedIds(String(itemIdsRaw));
|
|
@@ -7803,9 +7870,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7803
7870
|
}, "commandUpdateBudgetItemSupplier"), commandCreateBudgetCategory = __name2(async ({ flags }) => {
|
|
7804
7871
|
const name = getFlag(flags, "name");
|
|
7805
7872
|
if (!name) throw new Error("create-budget-category requires --name");
|
|
7806
|
-
await createBudgetCategory(String(
|
|
7807
|
-
name
|
|
7808
|
-
));
|
|
7873
|
+
await createBudgetCategory(String(name));
|
|
7809
7874
|
}, "commandCreateBudgetCategory"), commandUpdateBudgetCategory = __name2(async ({ flags }) => {
|
|
7810
7875
|
const id = getFlag(flags, "id"), name = getFlag(flags, "name");
|
|
7811
7876
|
if (!id || !name) throw new Error("update-budget-category requires --id and --name");
|
|
@@ -7854,14 +7919,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7854
7919
|
await countBills({ ...parseCountBillsFlags(flags), isClaimable: !0 });
|
|
7855
7920
|
}, "commandCountClaims"), commandCreateBillApproval = __name2(async ({ positional }) => {
|
|
7856
7921
|
const id = positional[0];
|
|
7857
|
-
if (!id) throw new Error(
|
|
7858
|
-
"create-bill-approval requires <billId>"
|
|
7859
|
-
);
|
|
7922
|
+
if (!id) throw new Error("create-bill-approval requires <billId>");
|
|
7860
7923
|
await createBillApproval(id);
|
|
7861
7924
|
}, "commandCreateBillApproval"), commandCreateBill = __name2(async ({ flags }) => {
|
|
7862
7925
|
const payloadRaw = getFlag(flags, "payload");
|
|
7863
7926
|
if (!payloadRaw) throw new Error("create-bill requires --payload '<json>'");
|
|
7864
|
-
const raw = parseJsonFlag(String(
|
|
7927
|
+
const raw = parseJsonFlag(String(
|
|
7928
|
+
payloadRaw
|
|
7929
|
+
), "--payload"), draftOnly = flags["draft-only"] === !0 ? !0 : parseOptionalBoolFlag(flags, "draft-only"), quotationExempt = flags["quotation-exempt"] === !0;
|
|
7865
7930
|
if (flags["quotation-exempt"] !== void 0 && flags["quotation-exempt"] !== !0) throw new Error("--quotation-exempt does not take a value.");
|
|
7866
7931
|
await createBillFromPayload(raw, draftOnly, quotationExempt);
|
|
7867
7932
|
}, "commandCreateBill"), commandValidateBillSelection = __name2(async ({ flags }) => {
|
|
@@ -7873,15 +7938,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7873
7938
|
if (quotationId && quotationIds && (quotationIds.length !== 1 || quotationIds[0] !== quotationId)) throw new Error("--quotationId conflicts with --quotationIds.");
|
|
7874
7939
|
if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
|
|
7875
7940
|
await validateBillSelectionFromPayload(raw, { ...quotationId ? { quotationId } : {}, ...quotationIds ? { quotationIds } : {} });
|
|
7876
|
-
}, "commandValidateBillSelection"), commandLinkBillQuotations = __name2(
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
"--payload cannot be combined with --quotationIds."
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7941
|
+
}, "commandValidateBillSelection"), commandLinkBillQuotations = __name2(
|
|
7942
|
+
async ({ flags, positional }) => {
|
|
7943
|
+
const billId = positional[0], payloadRaw = getFlag(flags, "payload"), quotationIds = parseCommaSeparatedIds(getFlag(flags, "quotationIds"));
|
|
7944
|
+
if (!billId || !payloadRaw && (!quotationIds || quotationIds.length === 0)) throw new Error("link-bill-quotations requires <billId> and either --payload '<json>' or --quotationIds <csv>");
|
|
7945
|
+
if (payloadRaw && quotationIds) throw new Error("--payload cannot be combined with --quotationIds.");
|
|
7946
|
+
if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
|
|
7947
|
+
await linkBillQuotations(billId, payloadRaw ? parseJsonFlag(String(payloadRaw), "--payload") : { quotationIds });
|
|
7948
|
+
},
|
|
7949
|
+
"commandLinkBillQuotations"
|
|
7950
|
+
), commandUpdateBill = __name2(async ({ flags }) => {
|
|
7885
7951
|
const payloadRaw = getFlag(flags, "payload");
|
|
7886
7952
|
if (!payloadRaw) throw new Error("update-bill requires --payload '<json>'");
|
|
7887
7953
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
@@ -7893,9 +7959,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7893
7959
|
await updateBillPaymentEvidenceFromPayload(raw);
|
|
7894
7960
|
}, "commandUpdateBillPaymentEvidence"), commandDeleteBill = __name2(async ({ positional }) => {
|
|
7895
7961
|
const id = positional[0];
|
|
7896
|
-
if (!id) throw new Error(
|
|
7897
|
-
"delete-bill requires <billId>"
|
|
7898
|
-
);
|
|
7962
|
+
if (!id) throw new Error("delete-bill requires <billId>");
|
|
7899
7963
|
await deleteBillById(id);
|
|
7900
7964
|
}, "commandDeleteBill"), commandUpdateBillStatus = __name2(async ({ flags, positional }) => {
|
|
7901
7965
|
const [id, statusRaw] = positional;
|
|
@@ -7916,10 +7980,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7916
7980
|
const id = positional[0];
|
|
7917
7981
|
if (!id) throw new Error("patch-bill-payment requires <billId>");
|
|
7918
7982
|
const paymentTrackingUrl = (() => {
|
|
7919
|
-
const clear = parseOptionalBoolFlag(
|
|
7920
|
-
flags,
|
|
7921
|
-
"clearPaymentTrackingUrl"
|
|
7922
|
-
), raw = getFlag(flags, "paymentTrackingUrl");
|
|
7983
|
+
const clear = parseOptionalBoolFlag(flags, "clearPaymentTrackingUrl"), raw = getFlag(flags, "paymentTrackingUrl");
|
|
7923
7984
|
if (clear === !0 && raw !== void 0) throw new Error("Use either --paymentTrackingUrl or --clearPaymentTrackingUrl true, not both");
|
|
7924
7985
|
if (clear === !0) return null;
|
|
7925
7986
|
if (raw !== void 0) return String(raw);
|
|
@@ -7951,54 +8012,52 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7951
8012
|
const page = parseDetailFeedPage("get-bill-approvals", "<billId>", positional, flags, 50);
|
|
7952
8013
|
await getBillApprovals(page);
|
|
7953
8014
|
}, "commandGetBillApprovals"), commandGetBillLineItems = __name2(async ({ flags, positional }) => {
|
|
7954
|
-
const page = parseDetailFeedPage(
|
|
7955
|
-
"get-bill-line-items",
|
|
7956
|
-
"<billId>",
|
|
7957
|
-
positional,
|
|
7958
|
-
flags,
|
|
7959
|
-
100
|
|
7960
|
-
);
|
|
8015
|
+
const page = parseDetailFeedPage("get-bill-line-items", "<billId>", positional, flags, 100);
|
|
7961
8016
|
await getBillLineItems(page);
|
|
7962
8017
|
}, "commandGetBillLineItems"), commandGetBillPayment = __name2(async ({ positional }) => {
|
|
7963
8018
|
const id = positional[0];
|
|
7964
8019
|
if (!id) throw new Error("get-bill-payment requires <billId>");
|
|
7965
|
-
await getBillPayment(
|
|
8020
|
+
await getBillPayment(
|
|
8021
|
+
id
|
|
8022
|
+
);
|
|
7966
8023
|
}, "commandGetBillPayment"), commandStageBillAttachment = __name2(async ({ flags, positional }) => {
|
|
7967
8024
|
const [projectId, ...positionalFilePaths] = positional, fileFlag = getFlag(flags, "file"), filesFlag = getFlag(flags, "files"), filePaths = [...positionalFilePaths, ...fileFlag !== void 0 ? [String(fileFlag)] : [], ...filesFlag !== void 0 ? String(filesFlag).split(",").map((value) => value.trim()).filter(Boolean) : []];
|
|
7968
8025
|
if (!projectId || filePaths.length === 0) throw new Error("stage-bill-attachment requires <projectId> <filePath...> or --file/--files");
|
|
7969
8026
|
await stageBillAttachmentsFromPaths(projectId, filePaths);
|
|
7970
8027
|
}, "commandStageBillAttachment"), commandCleanupStagedBillAttachments = __name2(async ({ flags, positional }) => {
|
|
7971
|
-
const projectId = positional[0], keys = parseCommaSeparatedIds(getFlag(
|
|
7972
|
-
flags,
|
|
7973
|
-
"keys"
|
|
7974
|
-
));
|
|
8028
|
+
const projectId = positional[0], keys = parseCommaSeparatedIds(getFlag(flags, "keys"));
|
|
7975
8029
|
if (!projectId || !keys) throw new Error("cleanup-staged-bill-attachments requires <projectId> --keys <csv>");
|
|
7976
8030
|
await cleanupStagedBillAttachments(projectId, keys);
|
|
7977
|
-
}, "commandCleanupStagedBillAttachments"), commandUploadBillAttachment = __name2(
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
"
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
"
|
|
8001
|
-
|
|
8031
|
+
}, "commandCleanupStagedBillAttachments"), commandUploadBillAttachment = __name2(async ({ cmd, flags, positional }) => {
|
|
8032
|
+
const [billId, ...positionalFilePaths] = positional, fileFlag = getFlag(flags, "file"), filesFlag = getFlag(flags, "files"), filePaths = [...positionalFilePaths, ...fileFlag !== void 0 ? [String(fileFlag)] : [], ...filesFlag !== void 0 ? String(filesFlag).split(",").map((value) => value.trim()).filter(Boolean) : []];
|
|
8033
|
+
if (!billId || filePaths.length === 0) throw new Error("".concat(cmd, " requires <billId> <filePath...> or --file/--files"));
|
|
8034
|
+
const attachmentType = cmd === "attach-bill-payment-receipt" ? AttachmentType.BILL_PAYMENT_PROOF : AttachmentType.BILL, [firstFilePath] = filePaths;
|
|
8035
|
+
filePaths.length === 1 && firstFilePath !== void 0 ? await uploadBillAttachmentFromPath(billId, firstFilePath, attachmentType) : await uploadBillAttachmentsFromPaths(billId, filePaths, attachmentType);
|
|
8036
|
+
}, "commandUploadBillAttachment"), commandAttachBillDocuments = __name2(async ({ flags, positional }) => {
|
|
8037
|
+
const billId = positional[0];
|
|
8038
|
+
if (!billId) throw new Error("attach-bill-documents requires <billId>");
|
|
8039
|
+
const getFlagAlias = __name2((...flagNames) => {
|
|
8040
|
+
for (const flagName of flagNames) {
|
|
8041
|
+
const value = getFlag(
|
|
8042
|
+
flags,
|
|
8043
|
+
flagName
|
|
8044
|
+
);
|
|
8045
|
+
if (value !== void 0) return value;
|
|
8046
|
+
}
|
|
8047
|
+
}, "getFlagAlias"), parseFilesFlag = __name2((...flagNames) => {
|
|
8048
|
+
const raw = getFlagAlias(...flagNames);
|
|
8049
|
+
return raw === void 0 ? [] : String(raw).split(",").map((value) => value.trim()).filter(Boolean);
|
|
8050
|
+
}, "parseFilesFlag"), invoicePath = getFlagAlias("invoice", "invoice-file"), paymentProofPath = getFlagAlias("paymentProof", "payment-proof", "proof", "receipt"), invoicePaths = [...invoicePath !== void 0 ? [String(invoicePath)] : [], ...parseFilesFlag("invoices", "invoice-files")], paymentProofPaths = [...paymentProofPath !== void 0 ? [String(paymentProofPath)] : [], ...parseFilesFlag("paymentProofs", "payment-proofs", "proofs", "receipts")];
|
|
8051
|
+
await uploadBillDocumentsFromPaths({ billId, invoicePaths, paymentProofPaths });
|
|
8052
|
+
}, "commandAttachBillDocuments"), commandGetBillReview = __name2(async ({ positional }) => {
|
|
8053
|
+
const id = positional[0];
|
|
8054
|
+
if (!id) throw new Error("bill review requires <billId>");
|
|
8055
|
+
await getBillReview(id);
|
|
8056
|
+
}, "commandGetBillReview"), commandRequestBillReview = __name2(async ({ positional, flags }) => {
|
|
8057
|
+
const id = positional[0];
|
|
8058
|
+
if (!id) throw new Error("bill request-review requires <billId>");
|
|
8059
|
+
rejectBareFlag(flags, "requestId"), await requestBillReview(id, getFlag(flags, "requestId"));
|
|
8060
|
+
}, "commandRequestBillReview"), commandGetBillDetails = __name2(async ({ positional }) => {
|
|
8002
8061
|
const id = positional[0];
|
|
8003
8062
|
if (!id) throw new Error("get-bill-details requires <billId>");
|
|
8004
8063
|
await getBillDetails(id);
|
|
@@ -8012,9 +8071,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8012
8071
|
await listQuotations({ ...parseQuotationFilterFlags(flags), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction });
|
|
8013
8072
|
}, "commandListQuotations"), commandCountQuotations = __name2(async ({ flags }) => {
|
|
8014
8073
|
rejectRetiredPageFlags(flags);
|
|
8015
|
-
for (const key of ["limit", "cursor", "direction"]) if (flags[key] !== void 0) throw new Error(
|
|
8016
|
-
"count-quotations does not accept --".concat(key, "; totals use filters only.")
|
|
8017
|
-
);
|
|
8074
|
+
for (const key of ["limit", "cursor", "direction"]) if (flags[key] !== void 0) throw new Error("count-quotations does not accept --".concat(key, "; totals use filters only."));
|
|
8018
8075
|
await countQuotations({ ...parseQuotationFilterFlags(flags), includeMetrics: parseOptionalBoolFlag(flags, "includeMetrics") ?? !1 });
|
|
8019
8076
|
}, "commandCountQuotations"), commandGetQuotation = __name2(async ({ positional }) => {
|
|
8020
8077
|
const id = positional[0];
|
|
@@ -8027,10 +8084,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8027
8084
|
const [projectId, filePath] = positional;
|
|
8028
8085
|
if (!projectId || !filePath) throw new Error("upload-quotation-attachment requires <projectId> <filePath>");
|
|
8029
8086
|
await uploadQuotationAttachmentFromPath(projectId, filePath);
|
|
8030
|
-
}, "commandUploadQuotationAttachment"), commandCleanupStagedQuotationAttachments = __name2(async ({
|
|
8031
|
-
flags,
|
|
8032
|
-
positional
|
|
8033
|
-
}) => {
|
|
8087
|
+
}, "commandUploadQuotationAttachment"), commandCleanupStagedQuotationAttachments = __name2(async ({ flags, positional }) => {
|
|
8034
8088
|
const projectId = positional[0], keys = parseCommaSeparatedIds(getFlag(flags, "keys"));
|
|
8035
8089
|
if (!projectId || !keys) throw new Error("cleanup-staged-quotation-attachments requires <projectId> --keys <csv>");
|
|
8036
8090
|
await cleanupStagedQuotationAttachments(projectId, keys);
|
|
@@ -8043,7 +8097,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8043
8097
|
const payloadRaw = getFlag(flags, "payload");
|
|
8044
8098
|
if (!payloadRaw) throw new Error("update-quotation requires --payload '<json>'");
|
|
8045
8099
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8046
|
-
await updateQuotationFromPayload(
|
|
8100
|
+
await updateQuotationFromPayload(
|
|
8101
|
+
raw
|
|
8102
|
+
);
|
|
8047
8103
|
}, "commandUpdateQuotation"), commandDeleteQuotation = __name2(async ({ positional }) => {
|
|
8048
8104
|
const id = positional[0];
|
|
8049
8105
|
if (!id) throw new Error("delete-quotation requires <quotationId>");
|
|
@@ -8060,13 +8116,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8060
8116
|
const id = positional[0], reason = getFlag(flags, "reason");
|
|
8061
8117
|
if (!id || reason === void 0) throw new Error("reject-quotation requires <quotationId> --reason <text>");
|
|
8062
8118
|
await rejectQuotation(id, reason);
|
|
8063
|
-
}, "commandRejectQuotation"), commandDownloadQuotationPdf = __name2(
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8119
|
+
}, "commandRejectQuotation"), commandDownloadQuotationPdf = __name2(
|
|
8120
|
+
async ({ positional }) => {
|
|
8121
|
+
const id = positional[0];
|
|
8122
|
+
if (!id) throw new Error("download-quotation-pdf requires <quotationId> [original|staff|final]");
|
|
8123
|
+
const roleRaw = (positional[1] ?? "final").toLowerCase(), fileRole = roleRaw === "original" ? SupplierQuotationFileRole.ORIGINAL : roleRaw === "staff" ? SupplierQuotationFileRole.STAFF_SIGNED : roleRaw === "final" ? SupplierQuotationFileRole.FINAL_SIGNED : null;
|
|
8124
|
+
if (!fileRole) throw new Error("download-quotation-pdf role must be original, staff, or final");
|
|
8125
|
+
await downloadQuotationPdf(id, fileRole);
|
|
8126
|
+
},
|
|
8127
|
+
"commandDownloadQuotationPdf"
|
|
8128
|
+
), commandCheckCustomerInvoiceReadiness = __name2(async ({ positional }) => {
|
|
8070
8129
|
const budgetId = positional[0];
|
|
8071
8130
|
if (!budgetId) throw new Error("check-customer-invoice-readiness requires <budgetId>");
|
|
8072
8131
|
await checkCustomerInvoiceReadiness(budgetId);
|
|
@@ -8074,19 +8133,19 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8074
8133
|
const projectId = positional[0];
|
|
8075
8134
|
if (!projectId) throw new Error("list-eligible-customer-invoice-budgets requires <projectId>");
|
|
8076
8135
|
await listEligibleCustomerInvoiceBudgets(projectId);
|
|
8077
|
-
}, "commandListEligibleCustomerInvoiceBudgets"), commandPreviewCustomerInvoiceAmount = __name2(
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
},
|
|
8083
|
-
"commandPreviewCustomerInvoiceAmount"
|
|
8084
|
-
), commandListAvailableQboCustomerInvoices = __name2(async ({ positional }) => {
|
|
8136
|
+
}, "commandListEligibleCustomerInvoiceBudgets"), commandPreviewCustomerInvoiceAmount = __name2(async ({ positional }) => {
|
|
8137
|
+
const [budgetId, rawPercentage] = positional, percentage = Number(rawPercentage);
|
|
8138
|
+
if (!budgetId || !rawPercentage || positional.length !== 2 || !Number.isFinite(percentage) || percentage <= 0 || percentage > 100 || Math.round(percentage * 100) !== percentage * 100) throw new Error("preview-customer-invoice-amount requires <budgetId> <percentage-of-estimate> between 0.01 and 100");
|
|
8139
|
+
await previewCustomerInvoiceAmount(budgetId, percentage);
|
|
8140
|
+
}, "commandPreviewCustomerInvoiceAmount"), commandListAvailableQboCustomerInvoices = __name2(async ({ positional }) => {
|
|
8085
8141
|
const budgetId = positional[0];
|
|
8086
8142
|
if (!budgetId || positional.length !== 1) throw new Error("list-available-qbo-customer-invoices requires <budgetId>");
|
|
8087
8143
|
await listAvailableQboCustomerInvoices(budgetId);
|
|
8088
8144
|
}, "commandListAvailableQboCustomerInvoices"), customerInvoiceFiltersFromFlags = __name2((flags, positionalBudgetId) => {
|
|
8089
|
-
const projectId = getFlag(
|
|
8145
|
+
const projectId = getFlag(
|
|
8146
|
+
flags,
|
|
8147
|
+
"projectId"
|
|
8148
|
+
), projectIds = parseCommaSeparatedIds(getFlag(flags, "projectIds"));
|
|
8090
8149
|
if (projectId && projectIds) throw new Error("Use either --projectId for project scope or --projectIds for a global filter, not both.");
|
|
8091
8150
|
const budgetIds = [...positionalBudgetId ? [positionalBudgetId] : [], ...parseCommaSeparatedIds(getFlag(flags, "budgetIds")) ?? []], statusRaw = getFlag(flags, "status");
|
|
8092
8151
|
return { scope: projectId ? { type: "project", projectId } : { type: "global" }, q: getFlag(flags, "search") ?? "", statuses: parseCommaSeparatedCustomerInvoiceStatuses(statusRaw !== void 0 ? String(statusRaw) : void 0), companyIds: parseCommaSeparatedIds(getFlag(flags, "companyIds")), projectIds, budgetIds: budgetIds.length > 0 ? [...new Set(budgetIds)] : void 0, createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")) };
|
|
@@ -8097,10 +8156,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8097
8156
|
return;
|
|
8098
8157
|
}
|
|
8099
8158
|
rejectBarePagingFlags(flags);
|
|
8100
|
-
const {
|
|
8101
|
-
cursor,
|
|
8102
|
-
direction
|
|
8103
|
-
} = parseCursorAndDirection(flags), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
|
|
8159
|
+
const { cursor, direction } = parseCursorAndDirection(flags), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
|
|
8104
8160
|
await listCustomerInvoices({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCustomerInvoiceSortBy(getFlag(flags, "sortBy")), sortDir: sortDir ?? "desc" });
|
|
8105
8161
|
}, "commandListCustomerInvoices"), commandGetCustomerInvoice = __name2(async ({ positional }) => {
|
|
8106
8162
|
const batchId = positional[0];
|
|
@@ -8137,11 +8193,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8137
8193
|
if (!token || !new __cliRegExp("^[a-f0-9]{64}$", "").test(token)) throw new Error("import-qbo-customer-invoice requires --token <64-character preview token> from a reviewed preview-qbo result");
|
|
8138
8194
|
await importQboCustomerInvoice({ budgetId, qboInvoiceId, token });
|
|
8139
8195
|
}
|
|
8140
|
-
}, "commandPreviewQboCustomerInvoice"), commandCreateCustomerInvoice = __name2(
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8196
|
+
}, "commandPreviewQboCustomerInvoice"), commandCreateCustomerInvoice = __name2(
|
|
8197
|
+
async ({ flags }) => {
|
|
8198
|
+
const payloadRaw = getFlag(flags, "payload");
|
|
8199
|
+
if (!payloadRaw) throw new Error("create-customer-invoice requires --payload '<json>'");
|
|
8200
|
+
await createCustomerInvoice(parseJsonFlag(String(payloadRaw), "--payload"));
|
|
8201
|
+
},
|
|
8202
|
+
"commandCreateCustomerInvoice"
|
|
8203
|
+
), commandResubmitCustomerInvoice = __name2(async ({ positional }) => {
|
|
8145
8204
|
const batchId = positional[0];
|
|
8146
8205
|
if (!batchId) throw new Error("resubmit-customer-invoice requires <batchId>");
|
|
8147
8206
|
await resubmitCustomerInvoice(batchId);
|
|
@@ -8153,7 +8212,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8153
8212
|
const batchId = positional[0];
|
|
8154
8213
|
if (!batchId) throw new Error("delete-customer-invoice requires <batchId>");
|
|
8155
8214
|
await deleteCustomerInvoice(batchId);
|
|
8156
|
-
}, "commandDeleteCustomerInvoice"), commandVoidCustomerInvoice = __name2(async ({
|
|
8215
|
+
}, "commandDeleteCustomerInvoice"), commandVoidCustomerInvoice = __name2(async ({
|
|
8216
|
+
positional
|
|
8217
|
+
}) => {
|
|
8157
8218
|
const batchId = positional[0];
|
|
8158
8219
|
if (!batchId) throw new Error("void-customer-invoice requires <batchId>");
|
|
8159
8220
|
await voidCustomerInvoice(batchId);
|
|
@@ -8168,38 +8229,47 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8168
8229
|
}, "commandRejectCustomerInvoice"), commandSendCustomerInvoiceToContactPerson = __name2(async ({ flags }) => {
|
|
8169
8230
|
const payloadRaw = getFlag(flags, "payload");
|
|
8170
8231
|
if (!payloadRaw) throw new Error("send-customer-invoice-to-contact-person requires --payload '<json>'");
|
|
8171
|
-
await sendCustomerInvoiceToContactPersonFromPayload(parseJsonFlag(
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
"
|
|
8179
|
-
), commandUpdateCustomerInvoiceDetails = __name2(async ({ flags, positional }) => {
|
|
8232
|
+
await sendCustomerInvoiceToContactPersonFromPayload(parseJsonFlag(
|
|
8233
|
+
String(payloadRaw),
|
|
8234
|
+
"--payload"
|
|
8235
|
+
));
|
|
8236
|
+
}, "commandSendCustomerInvoiceToContactPerson"), commandDownloadCustomerInvoicePdf = __name2(async ({ flags, positional }) => {
|
|
8237
|
+
const invoiceId = positional[0];
|
|
8238
|
+
if (!invoiceId) throw new Error("download-customer-invoice-pdf requires <invoiceId> [--output <path>]");
|
|
8239
|
+
await downloadCustomerInvoicePdf(invoiceId, getFlag(flags, "output"));
|
|
8240
|
+
}, "commandDownloadCustomerInvoicePdf"), commandUpdateCustomerInvoiceDetails = __name2(async ({ flags, positional }) => {
|
|
8180
8241
|
const invoiceId = positional[0], billingAddress = getFlag(flags, "billingAddress"), customerMemo = getFlag(flags, "customerMemo");
|
|
8181
8242
|
if (!invoiceId || typeof billingAddress != "string" || typeof customerMemo != "string") 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.");
|
|
8182
8243
|
const requestId = getFlag(flags, "requestId");
|
|
8183
|
-
await updateCustomerInvoiceDetails({
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
"
|
|
8192
|
-
|
|
8244
|
+
await updateCustomerInvoiceDetails({
|
|
8245
|
+
billingAddress: billingAddress.replaceAll("\\n", "\n"),
|
|
8246
|
+
customerMemo,
|
|
8247
|
+
invoiceId,
|
|
8248
|
+
...typeof requestId == "string" ? { requestId } : {}
|
|
8249
|
+
});
|
|
8250
|
+
}, "commandUpdateCustomerInvoiceDetails"), commandUpdateCustomerInvoiceQboDrift = __name2(async ({ flags, positional }) => {
|
|
8251
|
+
const invoiceId = positional[0], resolution = getFlag(flags, "resolution");
|
|
8252
|
+
if (!invoiceId || resolution !== "ACCEPT_QBO" && resolution !== "KEEP_BB") throw new Error("update-customer-invoice-qbo-drift requires <invoiceId> --resolution ACCEPT_QBO|KEEP_BB");
|
|
8253
|
+
const requestId = getFlag(flags, "requestId");
|
|
8254
|
+
await updateCustomerInvoiceQboDrift({ invoiceId, resolution, ...typeof requestId == "string" ? { requestId } : {} });
|
|
8255
|
+
}, "commandUpdateCustomerInvoiceQboDrift"), commandMarkCustomerInvoiceSentExternally = __name2(async ({ flags, positional }) => {
|
|
8193
8256
|
const invoiceId = positional[0], sentAt = getFlag(flags, "sentAt"), recipients = getFlag(flags, "recipients");
|
|
8194
8257
|
if (!invoiceId || !sentAt || !recipients) throw new Error("mark-customer-invoice-sent-externally requires <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>]");
|
|
8195
|
-
await markCustomerInvoiceSentExternally({
|
|
8258
|
+
await markCustomerInvoiceSentExternally({
|
|
8259
|
+
invoiceId,
|
|
8260
|
+
sentAt,
|
|
8261
|
+
recipients: recipients.split(",").map((recipient) => recipient.trim()).filter(Boolean),
|
|
8262
|
+
note: getFlag(flags, "note")
|
|
8263
|
+
});
|
|
8196
8264
|
}, "commandMarkCustomerInvoiceSentExternally"), commandSyncCustomerInvoice = __name2(async ({ positional }) => {
|
|
8197
8265
|
const invoiceId = positional[0];
|
|
8198
8266
|
if (!invoiceId) throw new Error("sync-customer-invoice requires <invoiceId>");
|
|
8199
8267
|
await syncCustomerInvoice(invoiceId);
|
|
8200
8268
|
}, "commandSyncCustomerInvoice"), commandListApprovals = __name2(async ({ flags }) => {
|
|
8201
|
-
|
|
8202
|
-
|
|
8269
|
+
rejectBarePagingFlags(flags);
|
|
8270
|
+
for (const key of ["page", "perPage"]) if (flags[key] !== void 0) throw new Error("approval list does not accept --".concat(key, "; use --limit and --cursor."));
|
|
8271
|
+
const { cursor, direction } = parseCursorAndDirection(flags), typeRaw = getFlag(flags, "type");
|
|
8272
|
+
await listApprovals({ limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, type: parseApprovalTypeFlag(typeRaw !== void 0 ? String(typeRaw) : void 0) });
|
|
8203
8273
|
}, "commandListApprovals"), commandApproveBill = __name2(async ({ flags, positional }) => {
|
|
8204
8274
|
const id = positional[0];
|
|
8205
8275
|
if (!id) throw new Error("approve-bill requires <billId>");
|
|
@@ -8210,8 +8280,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8210
8280
|
await rejectBill(id, reason);
|
|
8211
8281
|
}, "commandRejectBill"), commandApproveBudget = __name2(async ({ positional }) => {
|
|
8212
8282
|
const id = positional[0];
|
|
8213
|
-
if (!id)
|
|
8214
|
-
throw new Error("approve-budget requires <budgetId>");
|
|
8283
|
+
if (!id) throw new Error("approve-budget requires <budgetId>");
|
|
8215
8284
|
await approveBudget(id);
|
|
8216
8285
|
}, "commandApproveBudget"), commandRejectBudget = __name2(async ({ flags, positional }) => {
|
|
8217
8286
|
const id = positional[0], reason = getFlag(flags, "reason");
|
|
@@ -8221,11 +8290,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8221
8290
|
const id = positional[0];
|
|
8222
8291
|
if (!id) throw new Error("approve-supplier requires <supplierId>");
|
|
8223
8292
|
await approveSupplier(id);
|
|
8224
|
-
}, "commandApproveSupplier"), commandRejectSupplier = __name2(
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8293
|
+
}, "commandApproveSupplier"), commandRejectSupplier = __name2(
|
|
8294
|
+
async ({ flags, positional }) => {
|
|
8295
|
+
const id = positional[0], reason = getFlag(flags, "reason");
|
|
8296
|
+
if (!id || reason === void 0) throw new Error("reject-supplier requires <supplierId> --reason <text>");
|
|
8297
|
+
await rejectSupplier(id, reason);
|
|
8298
|
+
},
|
|
8299
|
+
"commandRejectSupplier"
|
|
8300
|
+
), commandGetSupplierDetails = __name2(async ({ positional }) => {
|
|
8229
8301
|
const id = positional[0];
|
|
8230
8302
|
if (!id) throw new Error("get-supplier-details requires <supplierId>");
|
|
8231
8303
|
await getSupplierDetails(id);
|
|
@@ -8240,7 +8312,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8240
8312
|
}, "commandGetSupplierUsage"), commandGetSupplierItems = __name2(async ({ positional }) => {
|
|
8241
8313
|
const id = positional[0];
|
|
8242
8314
|
if (!id) throw new Error("get-supplier-items requires <supplierId>");
|
|
8243
|
-
await getSupplierItems(
|
|
8315
|
+
await getSupplierItems(
|
|
8316
|
+
id
|
|
8317
|
+
);
|
|
8244
8318
|
}, "commandGetSupplierItems"), commandListCompanies = __name2(async ({ flags }) => {
|
|
8245
8319
|
await listCompanies(parseCompanyListFlags(flags));
|
|
8246
8320
|
}, "commandListCompanies"), commandCountCompanies = __name2(async ({ flags }) => {
|
|
@@ -8248,9 +8322,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8248
8322
|
}, "commandCountCompanies"), commandGetCompany = __name2(async ({ positional }) => {
|
|
8249
8323
|
const id = positional[0];
|
|
8250
8324
|
if (!id) throw new Error("get-company requires <id>");
|
|
8251
|
-
await getCompany(
|
|
8252
|
-
id
|
|
8253
|
-
);
|
|
8325
|
+
await getCompany(id);
|
|
8254
8326
|
}, "commandGetCompany"), commandCreateCompany = __name2(async ({ flags }) => {
|
|
8255
8327
|
rejectBareFlag(flags, "billingEmails");
|
|
8256
8328
|
const billingEmailsRaw = getFlag(flags, "billingEmails"), billingEmails = billingEmailsRaw === void 0 ? void 0 : parseCompanyBillingEmails(parseJsonFlag(billingEmailsRaw, "--billingEmails")), name = getFlag(flags, "name"), website = getFlag(flags, "website");
|
|
@@ -8269,7 +8341,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8269
8341
|
}, "commandSearchExistingCompanies"), commandUseExistingCompany = __name2(async ({ flags }) => {
|
|
8270
8342
|
const companyId = getFlag(flags, "companyId"), quickbooksId = getFlag(flags, "quickbooksId");
|
|
8271
8343
|
if (!companyId && !quickbooksId) throw new Error("Supply --companyId and/or --quickbooksId");
|
|
8272
|
-
companyId ? await reuseExistingCompany(
|
|
8344
|
+
companyId ? await reuseExistingCompany(
|
|
8345
|
+
{ source: "bb", companyId, quickbooksId, confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct") }
|
|
8346
|
+
) : quickbooksId && await reuseExistingCompany({ source: "qbo", quickbooksId, name: getFlag(flags, "name"), website: getFlag(flags, "website"), confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct") });
|
|
8273
8347
|
}, "commandUseExistingCompany"), commandUpdateCompany = __name2(async ({ flags }) => {
|
|
8274
8348
|
const payloadRaw = getFlag(flags, "payload");
|
|
8275
8349
|
if (!payloadRaw) throw new Error("update-company requires --payload '<json>'");
|
|
@@ -8282,16 +8356,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8282
8356
|
}, "commandGetCompanyQuickbooksSyncStatus"), commandDeleteCompany = __name2(async ({ positional }) => {
|
|
8283
8357
|
const id = positional[0];
|
|
8284
8358
|
if (!id) throw new Error("delete-company requires <id>");
|
|
8285
|
-
await deleteCompanyById(
|
|
8359
|
+
await deleteCompanyById(
|
|
8360
|
+
id
|
|
8361
|
+
);
|
|
8286
8362
|
}, "commandDeleteCompany"), commandListProjects = __name2(async ({ flags }) => {
|
|
8287
8363
|
await listProjects(parseProjectListFlags(flags));
|
|
8288
8364
|
}, "commandListProjects"), commandCountProjects = __name2(async ({ flags }) => {
|
|
8289
8365
|
await countProjects(parseProjectCountFlags(flags));
|
|
8290
8366
|
}, "commandCountProjects"), commandListProjectHubs = __name2(async ({ cmd, flags }) => {
|
|
8291
8367
|
rejectRetiredPageFlags(flags);
|
|
8292
|
-
const filters = { q: getFlag(flags, "q"), statuses: parseCommaSeparatedProjectStatuses(
|
|
8293
|
-
getFlag(flags, "status")
|
|
8294
|
-
) };
|
|
8368
|
+
const filters = { q: getFlag(flags, "q"), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "status")) };
|
|
8295
8369
|
if (cmd === "count-project-hubs") {
|
|
8296
8370
|
for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("count-project-hubs does not accept --".concat(key, "; totals use filters only."));
|
|
8297
8371
|
await countProjectHubs(filters);
|
|
@@ -8300,7 +8374,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8300
8374
|
for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
8301
8375
|
const cursor = getFlag(flags, "cursor");
|
|
8302
8376
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
8303
|
-
const direction = parseProjectDirection(
|
|
8377
|
+
const direction = parseProjectDirection(
|
|
8378
|
+
getFlag(flags, "direction")
|
|
8379
|
+
);
|
|
8304
8380
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
8305
8381
|
await listProjectHubs({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseOptionalProjectHubSortBy(getFlag(flags, "sortBy")), sortDir: parseOptionalBillListSortDir(getFlag(flags, "sortDir")) });
|
|
8306
8382
|
}, "commandListProjectHubs"), commandGetProject = __name2(async ({ positional }) => {
|
|
@@ -8315,48 +8391,38 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8315
8391
|
const projectId = positional[0];
|
|
8316
8392
|
if (!projectId) throw new Error("setup-project-hub requires <projectId>");
|
|
8317
8393
|
await setupProjectHub(projectId);
|
|
8318
|
-
}, "commandSetupProjectHub"), commandSyncProjectHubCommercialDocuments = __name2(
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8394
|
+
}, "commandSetupProjectHub"), commandSyncProjectHubCommercialDocuments = __name2(
|
|
8395
|
+
async ({ positional }) => {
|
|
8396
|
+
const projectId = positional[0];
|
|
8397
|
+
if (!projectId) throw new Error("sync-project-hub-commercial-documents requires <projectId>");
|
|
8398
|
+
await syncProjectHubCommercialDocuments(projectId);
|
|
8399
|
+
},
|
|
8400
|
+
"commandSyncProjectHubCommercialDocuments"
|
|
8401
|
+
), commandCreateProject = __name2(async ({ flags }) => {
|
|
8323
8402
|
const name = getFlag(flags, "name"), companyId = getFlag(flags, "companyId"), contactPersonId = getFlag(flags, "contactPersonId"), insideSalesId = getFlag(flags, "insideSalesId"), businessDevelopmentId = getFlag(flags, "businessDevelopmentId"), projectManagerId = getFlag(flags, "projectManagerId"), venue = getFlag(flags, "venue"), pax = getFlag(flags, "pax"), asanaTaskId = getFlag(flags, "asanaTaskId"), asanaSearch = getFlag(flags, "asanaSearch"), startDate = getFlag(flags, "startDate");
|
|
8324
8403
|
if (getFlag(flags, "requestQboAccountantNotification") !== void 0) throw new Error("create-project does not allow --requestQboAccountantNotification; CLI project creation always requests the QuickBooks project import like the web app.");
|
|
8325
8404
|
if (!name || !companyId || !contactPersonId || !insideSalesId || !businessDevelopmentId || !venue || !startDate) throw new Error("create-project requires --name --companyId --contactPersonId --insideSalesId --businessDevelopmentId --venue --startDate (ISO/datetime flags as appropriate); optional --projectManagerId, --asanaTaskId, --asanaSearch, --pax and --endDate");
|
|
8326
|
-
await createProject({
|
|
8327
|
-
name,
|
|
8328
|
-
companyId,
|
|
8329
|
-
contactPersonId,
|
|
8330
|
-
insideSalesId,
|
|
8331
|
-
businessDevelopmentId,
|
|
8332
|
-
projectManagerId,
|
|
8333
|
-
venue,
|
|
8334
|
-
pax,
|
|
8335
|
-
asanaTaskId,
|
|
8336
|
-
asanaSearch,
|
|
8337
|
-
startDate,
|
|
8338
|
-
endDate: getFlag(flags, "endDate"),
|
|
8339
|
-
description: getFlag(flags, "description")
|
|
8340
|
-
});
|
|
8405
|
+
await createProject({ name, companyId, contactPersonId, insideSalesId, businessDevelopmentId, projectManagerId, venue, pax, asanaTaskId, asanaSearch, startDate, endDate: getFlag(flags, "endDate"), description: getFlag(flags, "description") });
|
|
8341
8406
|
}, "commandCreateProject"), commandUpdateProject = __name2(async ({ flags }) => {
|
|
8342
8407
|
const payloadRaw = getFlag(flags, "payload");
|
|
8343
8408
|
if (!payloadRaw) throw new Error("update-project requires --payload '<json>'");
|
|
8344
8409
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8345
8410
|
await updateProjectFromPayload(raw);
|
|
8346
|
-
}, "commandUpdateProject"), commandDeleteProject = __name2(
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8411
|
+
}, "commandUpdateProject"), commandDeleteProject = __name2(
|
|
8412
|
+
async ({ positional }) => {
|
|
8413
|
+
const id = positional[0];
|
|
8414
|
+
if (!id) throw new Error("delete-project requires <id>");
|
|
8415
|
+
await deleteProjectById(id);
|
|
8416
|
+
},
|
|
8417
|
+
"commandDeleteProject"
|
|
8418
|
+
), commandCheckProjectReconciliation = __name2(async ({ positional }) => {
|
|
8351
8419
|
const id = positional[0];
|
|
8352
8420
|
if (!id) throw new Error("check-project-reconciliation requires <id>");
|
|
8353
8421
|
await checkProjectReconciliation(id);
|
|
8354
8422
|
}, "commandCheckProjectReconciliation"), commandReconcileProject = __name2(async ({ positional }) => {
|
|
8355
8423
|
const id = positional[0];
|
|
8356
8424
|
if (!id) throw new Error("reconcile-project requires <id>");
|
|
8357
|
-
await reconcileProject(
|
|
8358
|
-
id
|
|
8359
|
-
);
|
|
8425
|
+
await reconcileProject(id);
|
|
8360
8426
|
}, "commandReconcileProject"), commandCompleteProject = __name2(async ({ positional }) => {
|
|
8361
8427
|
const id = positional[0];
|
|
8362
8428
|
if (!id) throw new Error("complete-project requires <id>");
|
|
@@ -8365,15 +8431,15 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8365
8431
|
const projectId = positional[0], projectUrl = getFlag(flags, "url");
|
|
8366
8432
|
if (!projectId || projectUrl === void 0) throw new Error("import-qbo-project requires <projectId> --url <quickBooksProjectUrl>");
|
|
8367
8433
|
await importQuickBooksProjectId(projectId, String(projectUrl));
|
|
8368
|
-
}, "commandImportQboProject"), commandUpdateProjectStatus = __name2(
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
), commandListContacts = __name2(async ({ positional }) => {
|
|
8434
|
+
}, "commandImportQboProject"), commandUpdateProjectStatus = __name2(async ({
|
|
8435
|
+
flags,
|
|
8436
|
+
positional
|
|
8437
|
+
}) => {
|
|
8438
|
+
const [id, statusRaw] = positional;
|
|
8439
|
+
if (!id || !statusRaw) throw new Error("update-project-status requires <id> <status>");
|
|
8440
|
+
const pmIdFlag = getFlag(flags, "projectManagerId"), pmEmailFlag = getFlag(flags, "projectManagerEmail");
|
|
8441
|
+
await updateProjectStatus(id, parseProjectStatusForUpdate(statusRaw), { ...pmIdFlag && { projectManagerId: String(pmIdFlag) }, ...pmEmailFlag && { projectManagerEmail: String(pmEmailFlag) } });
|
|
8442
|
+
}, "commandUpdateProjectStatus"), commandListContacts = __name2(async ({ positional }) => {
|
|
8377
8443
|
const id = positional[0];
|
|
8378
8444
|
if (!id) throw new Error("list-contacts requires <companyId>");
|
|
8379
8445
|
await listContacts(id);
|
|
@@ -8383,16 +8449,17 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8383
8449
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8384
8450
|
await createContactPersonFromPayload(raw);
|
|
8385
8451
|
}, "commandCreateContactPerson"), commandUpdateContactPerson = __name2(async ({ flags }) => {
|
|
8386
|
-
const payloadRaw = getFlag(
|
|
8452
|
+
const payloadRaw = getFlag(
|
|
8453
|
+
flags,
|
|
8454
|
+
"payload"
|
|
8455
|
+
);
|
|
8387
8456
|
if (!payloadRaw) throw new Error("update-contact-person requires --payload '<json>'");
|
|
8388
8457
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8389
8458
|
await updateContactPersonFromPayload(raw);
|
|
8390
8459
|
}, "commandUpdateContactPerson"), commandCountSuppliers = __name2(async ({ flags }) => {
|
|
8391
8460
|
await countSuppliers(parseCountSuppliersFlags(flags));
|
|
8392
8461
|
}, "commandCountSuppliers"), commandListSuppliers = __name2(async ({ flags }) => {
|
|
8393
|
-
await listSuppliers(
|
|
8394
|
-
parseListSuppliersFlags(flags)
|
|
8395
|
-
);
|
|
8462
|
+
await listSuppliers(parseListSuppliersFlags(flags));
|
|
8396
8463
|
}, "commandListSuppliers"), commandCreateSupplier = __name2(async ({ flags }) => {
|
|
8397
8464
|
const payloadRaw = getFlag(flags, "payload");
|
|
8398
8465
|
if (!payloadRaw) throw new Error("create-supplier requires --payload '<json>'");
|
|
@@ -8402,27 +8469,28 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8402
8469
|
const payloadRaw = getFlag(flags, "payload");
|
|
8403
8470
|
if (!payloadRaw) throw new Error("update-supplier requires --payload '<json>'");
|
|
8404
8471
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8405
|
-
await updateSupplierFromPayload(
|
|
8472
|
+
await updateSupplierFromPayload(
|
|
8473
|
+
raw
|
|
8474
|
+
);
|
|
8406
8475
|
}, "commandUpdateSupplier"), commandDeleteSuppliers = __name2(async ({ flags }) => {
|
|
8407
8476
|
const idsRaw = getFlag(flags, "ids");
|
|
8408
8477
|
if (idsRaw === void 0) throw new Error("delete-suppliers requires --ids <csv>");
|
|
8409
8478
|
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
8410
8479
|
if (!ids?.length) throw new Error("delete-suppliers requires non-empty --ids");
|
|
8411
8480
|
await deleteSuppliersByIds(ids);
|
|
8412
|
-
}, "commandDeleteSuppliers"), commandReactivateSuppliers = __name2(
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
},
|
|
8420
|
-
"commandReactivateSuppliers"
|
|
8421
|
-
), commandCreateCertification = __name2(async ({ flags }) => {
|
|
8481
|
+
}, "commandDeleteSuppliers"), commandReactivateSuppliers = __name2(async ({ flags }) => {
|
|
8482
|
+
const idsRaw = getFlag(flags, "ids");
|
|
8483
|
+
if (idsRaw === void 0) throw new Error("reactivate-suppliers requires --ids <csv>");
|
|
8484
|
+
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
8485
|
+
if (!ids?.length) throw new Error("reactivate-suppliers requires non-empty --ids");
|
|
8486
|
+
await reactivateSuppliersByIds(ids);
|
|
8487
|
+
}, "commandReactivateSuppliers"), commandCreateCertification = __name2(async ({ flags }) => {
|
|
8422
8488
|
const name = getFlag(flags, "name");
|
|
8423
8489
|
if (!name) throw new Error("create-certification requires --name");
|
|
8424
8490
|
await createSupplierCertification(String(name));
|
|
8425
|
-
}, "commandCreateCertification"), commandCreatePaymentMethod = __name2(async ({
|
|
8491
|
+
}, "commandCreateCertification"), commandCreatePaymentMethod = __name2(async ({
|
|
8492
|
+
flags
|
|
8493
|
+
}) => {
|
|
8426
8494
|
const name = getFlag(flags, "name");
|
|
8427
8495
|
if (!name) throw new Error("create-payment-method requires --name");
|
|
8428
8496
|
await createSupplierPaymentMethod(String(name));
|
|
@@ -8441,10 +8509,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8441
8509
|
const timeFrame = parseOptionalSupplierAnalyticsTimeFrame(tfRaw !== void 0 ? String(tfRaw) : void 0), startDate = getFlag(flags, "startDate"), endDate = getFlag(flags, "endDate");
|
|
8442
8510
|
if ((startDate || endDate) && timeFrame !== "CUSTOM") throw new Error("--startDate/--endDate need --timeFrame CUSTOM; other time frames ignore them.");
|
|
8443
8511
|
const status = getFlag(flags, "status")?.split(",").map((value) => value.trim()).filter(Boolean), badStatus = status?.find((value) => !Object.values(ApprovalStatus2).some((s) => s === value));
|
|
8444
|
-
if (badStatus) throw new Error("Invalid --status ".concat(
|
|
8445
|
-
badStatus,
|
|
8446
|
-
". Use a comma list of: "
|
|
8447
|
-
).concat(Object.values(ApprovalStatus2).join(", "), "."));
|
|
8512
|
+
if (badStatus) throw new Error("Invalid --status ".concat(badStatus, ". Use a comma list of: ").concat(Object.values(ApprovalStatus2).join(", "), "."));
|
|
8448
8513
|
const gstRaw = getFlag(flags, "gstRegistered");
|
|
8449
8514
|
if (gstRaw !== void 0 && gstRaw !== "true" && gstRaw !== "false") throw new Error("--gstRegistered must be true or false.");
|
|
8450
8515
|
return { name: getFlag(flags, "name"), timeFrame, status: status?.length ? status : void 0, gstRegistered: gstRaw === void 0 ? void 0 : gstRaw === "true", createdBy: getFlag(flags, "createdBy"), startDate, endDate };
|
|
@@ -8456,10 +8521,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8456
8521
|
}
|
|
8457
8522
|
rejectBarePagingFlags(flags);
|
|
8458
8523
|
const { cursor, direction } = parseCursorAndDirection(flags), sortBy = getFlag(flags, "sortBy");
|
|
8459
|
-
if (sortBy !== void 0 && !SUPPLIER_ANALYTICS_SORT_IDS.some((id) => id === sortBy)) throw new Error("--sortBy must be one of: ".concat(
|
|
8460
|
-
SUPPLIER_ANALYTICS_SORT_IDS.join(", "),
|
|
8461
|
-
"."
|
|
8462
|
-
));
|
|
8524
|
+
if (sortBy !== void 0 && !SUPPLIER_ANALYTICS_SORT_IDS.some((id) => id === sortBy)) throw new Error("--sortBy must be one of: ".concat(SUPPLIER_ANALYTICS_SORT_IDS.join(", "), "."));
|
|
8463
8525
|
await getSupplierAnalytics({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: SUPPLIER_ANALYTICS_SORT_IDS.find((id) => id === sortBy), sortDir: parseOptionalBillListSortDir(getFlag(flags, "sortDir")) });
|
|
8464
8526
|
}, "commandGetSupplierAnalytics"), commandListItems = __name2(async ({ cmd, flags }) => {
|
|
8465
8527
|
rejectRetiredPageFlags(flags);
|
|
@@ -8472,9 +8534,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8472
8534
|
const { cursor, direction } = parseCursorAndDirection(flags), sortBy = getFlag(flags, "sortBy"), sortId = INVENTORY_SORT_IDS.find((id) => id === sortBy);
|
|
8473
8535
|
if (sortBy !== void 0 && !sortId) throw new Error('Invalid --sortBy "'.concat(sortBy, '". Use one of: ').concat(INVENTORY_SORT_IDS.join(", "), "."));
|
|
8474
8536
|
const sortDir = parseAscDescSortDir(flags);
|
|
8475
|
-
await listItems(
|
|
8476
|
-
{ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sort: sortId ? [{ id: sortId, desc: sortDir !== "asc" }] : void 0 }
|
|
8477
|
-
);
|
|
8537
|
+
await listItems({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sort: sortId ? [{ id: sortId, desc: sortDir !== "asc" }] : void 0 });
|
|
8478
8538
|
}, "commandListItems"), commandGetItem = __name2(async ({ positional }) => {
|
|
8479
8539
|
const id = positional[0];
|
|
8480
8540
|
if (!id) throw new Error("get-item requires <id>");
|
|
@@ -8484,16 +8544,17 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8484
8544
|
if (!id) throw new Error("get-item-quickbooks-sync-status requires <itemId>");
|
|
8485
8545
|
await getItemQuickBooksSyncStatus(id);
|
|
8486
8546
|
}, "commandGetItemQuickbooksSyncStatus"), commandCreateItem = __name2(async ({ flags }) => {
|
|
8487
|
-
const payloadRaw = getFlag(
|
|
8547
|
+
const payloadRaw = getFlag(
|
|
8548
|
+
flags,
|
|
8549
|
+
"payload"
|
|
8550
|
+
);
|
|
8488
8551
|
if (!payloadRaw) throw new Error("create-item requires --payload '<json>'");
|
|
8489
8552
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8490
8553
|
await createItemFromPayload(raw);
|
|
8491
8554
|
}, "commandCreateItem"), commandUpdateItem = __name2(async ({ flags }) => {
|
|
8492
8555
|
const payloadRaw = getFlag(flags, "payload");
|
|
8493
8556
|
if (!payloadRaw) throw new Error("update-item requires --payload '<json>'");
|
|
8494
|
-
const raw = parseJsonFlag(String(
|
|
8495
|
-
payloadRaw
|
|
8496
|
-
), "--payload");
|
|
8557
|
+
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8497
8558
|
await updateItemFromPayload(raw);
|
|
8498
8559
|
}, "commandUpdateItem"), commandDeleteItem = __name2(async ({ positional }) => {
|
|
8499
8560
|
const id = positional[0];
|
|
@@ -8505,7 +8566,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8505
8566
|
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
8506
8567
|
if (!ids?.length) throw new Error("archive-items requires non-empty --ids");
|
|
8507
8568
|
await archiveItemsByIds(ids);
|
|
8508
|
-
}, "commandArchiveItems"), commandListItemCategories = __name2(async ({
|
|
8569
|
+
}, "commandArchiveItems"), commandListItemCategories = __name2(async ({
|
|
8570
|
+
cmd,
|
|
8571
|
+
flags
|
|
8572
|
+
}) => {
|
|
8509
8573
|
rejectRetiredPageFlags(flags);
|
|
8510
8574
|
const filters = { name: getFlag(flags, "name") };
|
|
8511
8575
|
if (cmd === "count-item-categories") {
|
|
@@ -8522,15 +8586,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8522
8586
|
if (!name) throw new Error("create-item-category requires --name");
|
|
8523
8587
|
await createItemCategory(String(name));
|
|
8524
8588
|
}, "commandCreateItemCategory"), commandUpdateItemCategory = __name2(async ({ flags }) => {
|
|
8525
|
-
const id = getFlag(
|
|
8589
|
+
const id = getFlag(
|
|
8590
|
+
flags,
|
|
8591
|
+
"id"
|
|
8592
|
+
), name = getFlag(flags, "name");
|
|
8526
8593
|
if (!id || !name) throw new Error("update-item-category requires --id and --name");
|
|
8527
8594
|
await updateItemCategory({ id: String(id), name: String(name) });
|
|
8528
8595
|
}, "commandUpdateItemCategory"), commandDeleteItemCategories = __name2(async ({ flags }) => {
|
|
8529
8596
|
const idsRaw = getFlag(flags, "ids");
|
|
8530
8597
|
if (idsRaw === void 0) throw new Error("delete-item-categories requires --ids <csv>");
|
|
8531
|
-
const ids = parseCommaSeparatedIds(
|
|
8532
|
-
String(idsRaw)
|
|
8533
|
-
);
|
|
8598
|
+
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
8534
8599
|
if (!ids?.length) throw new Error("delete-item-categories requires non-empty --ids");
|
|
8535
8600
|
await deleteItemCategoriesByIds(ids);
|
|
8536
8601
|
}, "commandDeleteItemCategories"), commandListUsers = __name2(async ({ cmd, flags }) => {
|
|
@@ -8547,9 +8612,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8547
8612
|
if (flags.direction !== void 0) throw new Error("list-users pages forward only; follow pageInfo.nextCursor with --cursor.");
|
|
8548
8613
|
const cursor = getFlag(flags, "cursor");
|
|
8549
8614
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
8550
|
-
await listUsers({ q, projectTeamOnly, limit: parseProjectLimit(
|
|
8551
|
-
getFlag(flags, "limit")
|
|
8552
|
-
), cursor });
|
|
8615
|
+
await listUsers({ q, projectTeamOnly, limit: parseProjectLimit(getFlag(flags, "limit")), cursor });
|
|
8553
8616
|
}, "commandListUsers"), commandCreateUser = __name2(async ({ flags }) => {
|
|
8554
8617
|
const email2 = getFlag(flags, "email");
|
|
8555
8618
|
if (!email2) throw new Error("create-user requires --email <email> [--name <name>] [--role ".concat(userRolesForHelp.join("|"), "]"));
|
|
@@ -8557,7 +8620,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8557
8620
|
}, "commandCreateUser"), commandCreateApiKey = __name2(async ({ flags }) => {
|
|
8558
8621
|
const userId = getFlag(flags, "userId"), name = getFlag(flags, "name");
|
|
8559
8622
|
if (!name) throw new Error("create-api-key requires --name <label> [--userId <userId>]");
|
|
8560
|
-
await createApiKeyForUser(
|
|
8623
|
+
await createApiKeyForUser(
|
|
8624
|
+
{ userId, name }
|
|
8625
|
+
);
|
|
8561
8626
|
}, "commandCreateApiKey"), commandListApiKeys = __name2(async ({ flags }) => {
|
|
8562
8627
|
rejectRetiredPageFlags(flags);
|
|
8563
8628
|
for (const key of ["limit", "cursor"]) rejectBareFlag(flags, key);
|
|
@@ -8582,7 +8647,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8582
8647
|
}, "commandGetSystemOverview"), commandGetEstimatePerformance = __name2(async ({ flags }) => {
|
|
8583
8648
|
await getEstimatePerformance(parseDashboardQueryFlags(flags));
|
|
8584
8649
|
}, "commandGetEstimatePerformance"), commandGetFinancialOverview = __name2(async ({ flags }) => {
|
|
8585
|
-
await getFinancialOverview({
|
|
8650
|
+
await getFinancialOverview({
|
|
8651
|
+
userId: getFlag(flags, "userId"),
|
|
8652
|
+
role: parseOptionalFinancialRole(getFlag(flags, "role")),
|
|
8653
|
+
deals: parseOptionalDeals(getFlag(flags, "deals")),
|
|
8654
|
+
timeFrame: parseOptionalTimeFrame(getFlag(flags, "timeFrame")),
|
|
8655
|
+
startDate: getFlag(flags, "startDate"),
|
|
8656
|
+
endDate: getFlag(flags, "endDate")
|
|
8657
|
+
});
|
|
8586
8658
|
}, "commandGetFinancialOverview"), commandGetRecentErrors = __name2(async ({ cmd, flags }) => {
|
|
8587
8659
|
if (getFlag(flags, "page") !== void 0 || getFlag(flags, "perPage") !== void 0) throw new Error("Error logs now use --cursor and --limit; --page/--perPage are no longer supported.");
|
|
8588
8660
|
const rawTimeFrame = getFlag(flags, "timeFrame"), timeFrame = Object.values(ChartTimeFrame).find((value) => value === rawTimeFrame);
|
|
@@ -8592,7 +8664,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8592
8664
|
else {
|
|
8593
8665
|
const direction = getFlag(flags, "direction");
|
|
8594
8666
|
if (direction !== void 0 && direction !== "forward" && direction !== "backward") throw new Error("--direction must be forward or backward.");
|
|
8595
|
-
await getRecentErrors({ ...filters, cursor: getFlag(flags, "cursor"), limit: parsePositiveIntFlag(
|
|
8667
|
+
await getRecentErrors({ ...filters, cursor: getFlag(flags, "cursor"), limit: parsePositiveIntFlag(
|
|
8668
|
+
getFlag(flags, "limit"),
|
|
8669
|
+
"--limit"
|
|
8670
|
+
), direction });
|
|
8596
8671
|
}
|
|
8597
8672
|
}, "commandGetRecentErrors"), commandGetError = __name2(async ({ positional }) => {
|
|
8598
8673
|
const id = positional[0];
|
|
@@ -8600,10 +8675,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8600
8675
|
await getError(id);
|
|
8601
8676
|
}, "commandGetError"), commandGetErrorMetrics = __name2(async () => {
|
|
8602
8677
|
await getErrorMetrics();
|
|
8603
|
-
}, "commandGetErrorMetrics"), commandListIntegrationOperations = __name2(async ({
|
|
8604
|
-
cmd,
|
|
8605
|
-
flags
|
|
8606
|
-
}) => {
|
|
8678
|
+
}, "commandGetErrorMetrics"), commandListIntegrationOperations = __name2(async ({ cmd, flags }) => {
|
|
8607
8679
|
rejectRetiredPageFlags(flags);
|
|
8608
8680
|
const filters = { destination: parseCommaSeparatedIds(getFlag(flags, "destination")), search: getFlag(flags, "search"), status: parseCommaSeparatedIntegrationOperationStatuses(getFlag(flags, "status")) };
|
|
8609
8681
|
if (cmd === "count-integration-operations") {
|
|
@@ -8638,14 +8710,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8638
8710
|
await getWebhookEndpoint(id);
|
|
8639
8711
|
}, "commandGetWebhookEndpoint"), commandCreateWebhookEndpoint = __name2(async ({ flags }) => {
|
|
8640
8712
|
const name = getFlag(flags, "name"), url = getFlag(flags, "url"), events = parseCommaSeparatedIds(getFlag(flags, "events"));
|
|
8641
|
-
if (!name || !url || !events?.length) throw new Error(
|
|
8713
|
+
if (!name || !url || !events?.length) throw new Error(
|
|
8714
|
+
"create-webhook-endpoint requires --name, --url and --events"
|
|
8715
|
+
);
|
|
8642
8716
|
await createWebhookEndpoint({ name, url, eventPatterns: events, enabled: parseOptionalBoolFlag(flags, "enabled") ?? !0 });
|
|
8643
8717
|
}, "commandCreateWebhookEndpoint"), commandUpdateWebhookEndpoint = __name2(async ({ flags, positional }) => {
|
|
8644
8718
|
const id = positional[0];
|
|
8645
8719
|
if (!id) throw new Error("update-webhook-endpoint requires <id>");
|
|
8646
|
-
const events = parseCommaSeparatedIds(
|
|
8647
|
-
getFlag(flags, "events")
|
|
8648
|
-
);
|
|
8720
|
+
const events = parseCommaSeparatedIds(getFlag(flags, "events"));
|
|
8649
8721
|
await updateWebhookEndpoint({ id, name: getFlag(flags, "name"), url: getFlag(flags, "url"), eventPatterns: events?.length ? events : void 0, enabled: parseOptionalBoolFlag(flags, "enabled") });
|
|
8650
8722
|
}, "commandUpdateWebhookEndpoint"), commandDeleteWebhookEndpoint = __name2(async ({ positional }) => {
|
|
8651
8723
|
const id = positional[0];
|
|
@@ -8654,22 +8726,29 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8654
8726
|
}, "commandDeleteWebhookEndpoint"), commandRotateWebhookSecret = __name2(async ({ flags, positional }) => {
|
|
8655
8727
|
const id = positional[0];
|
|
8656
8728
|
if (!id) throw new Error("rotate-webhook-secret requires <id>");
|
|
8657
|
-
const ttl = getFlag(
|
|
8729
|
+
const ttl = getFlag(
|
|
8730
|
+
flags,
|
|
8731
|
+
"previousSecretTtlHours"
|
|
8732
|
+
);
|
|
8658
8733
|
await rotateWebhookSecret({ id, previousSecretTtlHours: ttl === void 0 ? void 0 : Number.parseInt(ttl, 10) });
|
|
8659
8734
|
}, "commandRotateWebhookSecret"), commandSendWebhookTestEvent = __name2(async ({ positional }) => {
|
|
8660
8735
|
const id = positional[0];
|
|
8661
8736
|
if (!id) throw new Error("send-webhook-test-event requires <id>");
|
|
8662
8737
|
await sendWebhookTestEvent(id);
|
|
8663
|
-
}, "commandSendWebhookTestEvent"), commandListWebhookDeliveries = __name2(
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8738
|
+
}, "commandSendWebhookTestEvent"), commandListWebhookDeliveries = __name2(async ({ flags }) => {
|
|
8739
|
+
const statuses = (getFlag(flags, "status") ?? "").split(",").map((value) => value.trim()).filter(Boolean);
|
|
8740
|
+
for (const status of statuses) if (status !== "PENDING" && status !== "SUCCEEDED" && status !== "FAILED") throw new Error("--status must be PENDING, SUCCEEDED or FAILED (comma-separated)");
|
|
8741
|
+
const cursor = getFlag(flags, "cursor"), direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
8742
|
+
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
8743
|
+
await listWebhookDeliveries({
|
|
8744
|
+
endpointId: getFlag(flags, "endpointId"),
|
|
8745
|
+
...statuses.length ? { status: statuses } : {},
|
|
8746
|
+
eventType: getFlag(flags, "eventType"),
|
|
8747
|
+
cursor,
|
|
8748
|
+
direction,
|
|
8749
|
+
limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit")
|
|
8750
|
+
});
|
|
8751
|
+
}, "commandListWebhookDeliveries"), commandGetWebhookDelivery = __name2(async ({ positional }) => {
|
|
8673
8752
|
const id = positional[0];
|
|
8674
8753
|
if (!id) throw new Error("get-webhook-delivery requires <id>");
|
|
8675
8754
|
await getWebhookDelivery(id);
|
|
@@ -8698,9 +8777,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8698
8777
|
if (rawLimit === !0 || !Number.isInteger(limit) || limit < 1 || limit > 100) throw new Error("--limit must be an integer between 1 and 100.");
|
|
8699
8778
|
return { cursor, direction, limit };
|
|
8700
8779
|
}, "parseInboundSourcePaging"), commandListInboundSources = __name2(async ({ cmd, flags }) => {
|
|
8701
|
-
const filters = inboundSourceFiltersFromFlags(
|
|
8702
|
-
flags
|
|
8703
|
-
);
|
|
8780
|
+
const filters = inboundSourceFiltersFromFlags(flags);
|
|
8704
8781
|
if (cmd === "count-inbound-sources") {
|
|
8705
8782
|
if (["limit", "cursor", "direction"].some((key) => flags[key] !== void 0)) throw new Error("Source counts accept filters only, not pagination flags.");
|
|
8706
8783
|
await countInboundSources(filters);
|
|
@@ -8744,20 +8821,24 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8744
8821
|
if (!sourceId || !mode || enabled === void 0 || !Object.values(InboundProcessingMode).includes(String(mode))) throw new Error("update-inbound-processing requires <sourceId> --mode COLLECT_ONLY|SHADOW|ACTIVE --enabled true|false");
|
|
8745
8822
|
await updateInboundProcessing({ processingEnabled: enabled, processingMode: String(mode), sourceId });
|
|
8746
8823
|
}, "commandUpdateInboundProcessing"), commandGetApprovedBudgets = __name2(async ({ flags }) => {
|
|
8747
|
-
await getApprovedBudgets({ projectId: getFlag(flags, "projectId"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit"), minRevenue: parseOptionalNumber(getFlag(
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
"
|
|
8755
|
-
), commandGetItemPricingHistory = __name2(async ({ flags }) => {
|
|
8824
|
+
await getApprovedBudgets({ projectId: getFlag(flags, "projectId"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit"), minRevenue: parseOptionalNumber(getFlag(
|
|
8825
|
+
flags,
|
|
8826
|
+
"minRevenue"
|
|
8827
|
+
), "--minRevenue"), maxRevenue: parseOptionalNumber(getFlag(flags, "maxRevenue"), "--maxRevenue") });
|
|
8828
|
+
}, "commandGetApprovedBudgets"), commandGetBudgetCategoryBenchmarks = __name2(async ({ flags, positional }) => {
|
|
8829
|
+
const id = positional[0];
|
|
8830
|
+
if (!id) throw new Error("get-budget-category-benchmarks requires <categoryId> [--limit]");
|
|
8831
|
+
await getBudgetCategoryBenchmarks({ categoryId: id, limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8832
|
+
}, "commandGetBudgetCategoryBenchmarks"), commandGetItemPricingHistory = __name2(async ({ flags }) => {
|
|
8756
8833
|
await getItemPricingHistory({ itemName: getFlag(flags, "itemName"), categoryId: getFlag(flags, "categoryId"), supplierId: getFlag(flags, "supplierId"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8757
8834
|
}, "commandGetItemPricingHistory"), commandGetSupplierPricingHistory = __name2(async ({ flags, positional }) => {
|
|
8758
8835
|
const id = positional[0];
|
|
8759
8836
|
if (!id) throw new Error("get-supplier-pricing-history requires <supplierId> [--itemCategoryId] [--limit]");
|
|
8760
|
-
await getSupplierPricingHistory({
|
|
8837
|
+
await getSupplierPricingHistory({
|
|
8838
|
+
supplierId: id,
|
|
8839
|
+
itemCategoryId: getFlag(flags, "itemCategoryId"),
|
|
8840
|
+
limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit")
|
|
8841
|
+
});
|
|
8761
8842
|
}, "commandGetSupplierPricingHistory"), CLI_COMMAND_HANDLERS = /* @__PURE__ */ new Map([
|
|
8762
8843
|
["whoami", commandWhoami],
|
|
8763
8844
|
["list-budgets", commandListBudgets],
|
|
@@ -8765,10 +8846,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8765
8846
|
["get-budget", commandGetBudget],
|
|
8766
8847
|
["upload-budget-attachment", commandUploadBudgetAttachment],
|
|
8767
8848
|
["mark-budget-won", commandMarkBudgetWon],
|
|
8768
|
-
[
|
|
8769
|
-
"get-budget-items",
|
|
8770
|
-
commandGetBudgetItems
|
|
8771
|
-
],
|
|
8849
|
+
["get-budget-items", commandGetBudgetItems],
|
|
8772
8850
|
["get-budget-details", commandGetBudgetDetails],
|
|
8773
8851
|
["get-budget-categories", commandGetBudgetCategories],
|
|
8774
8852
|
["get-budget-versions", commandGetBudgetVersions],
|
|
@@ -8827,6 +8905,8 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8827
8905
|
["attach-bill-payment-receipt", commandUploadBillAttachment],
|
|
8828
8906
|
["attach-bill-documents", commandAttachBillDocuments],
|
|
8829
8907
|
["get-bill-details", commandGetBillDetails],
|
|
8908
|
+
["get-bill-review", commandGetBillReview],
|
|
8909
|
+
["request-bill-review", commandRequestBillReview],
|
|
8830
8910
|
["list-quotations", commandListQuotations],
|
|
8831
8911
|
["count-quotations", commandCountQuotations],
|
|
8832
8912
|
["get-quotation", commandGetQuotation],
|
|
@@ -8845,10 +8925,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8845
8925
|
["preview-customer-invoice-amount", commandPreviewCustomerInvoiceAmount],
|
|
8846
8926
|
["list-available-qbo-customer-invoices", commandListAvailableQboCustomerInvoices],
|
|
8847
8927
|
["list-customer-invoices", commandListCustomerInvoices],
|
|
8848
|
-
[
|
|
8849
|
-
"count-customer-invoices",
|
|
8850
|
-
commandListCustomerInvoices
|
|
8851
|
-
],
|
|
8928
|
+
["count-customer-invoices", commandListCustomerInvoices],
|
|
8852
8929
|
["get-customer-invoice", commandGetCustomerInvoice],
|
|
8853
8930
|
["get-customer-invoice-invoices", commandGetCustomerInvoiceInvoices],
|
|
8854
8931
|
["get-customer-invoice-lines", commandGetCustomerInvoiceLines],
|
|
@@ -8871,6 +8948,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8871
8948
|
["update-customer-invoice-qbo-drift", commandUpdateCustomerInvoiceQboDrift],
|
|
8872
8949
|
["mark-customer-invoice-sent-externally", commandMarkCustomerInvoiceSentExternally],
|
|
8873
8950
|
["sync-customer-invoice", commandSyncCustomerInvoice],
|
|
8951
|
+
["get-pending-approval", async ({
|
|
8952
|
+
positional
|
|
8953
|
+
}) => {
|
|
8954
|
+
const id = positional[0];
|
|
8955
|
+
if (!id) throw new Error("approval get requires <approvalId>");
|
|
8956
|
+
await getPendingApproval(id);
|
|
8957
|
+
}],
|
|
8874
8958
|
["list-approvals", commandListApprovals],
|
|
8875
8959
|
["get-pending-approvals", commandListApprovals],
|
|
8876
8960
|
["approve-bill", commandApproveBill],
|
|
@@ -8905,10 +8989,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8905
8989
|
["delete-project", commandDeleteProject],
|
|
8906
8990
|
["check-project-reconciliation", commandCheckProjectReconciliation],
|
|
8907
8991
|
["reconcile-project", commandReconcileProject],
|
|
8908
|
-
[
|
|
8909
|
-
"complete-project",
|
|
8910
|
-
commandCompleteProject
|
|
8911
|
-
],
|
|
8992
|
+
["complete-project", commandCompleteProject],
|
|
8912
8993
|
["import-qbo-project", commandImportQboProject],
|
|
8913
8994
|
["update-project-status", commandUpdateProjectStatus],
|
|
8914
8995
|
["list-contacts", commandListContacts],
|
|
@@ -8990,49 +9071,44 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8990
9071
|
const handler = CLI_COMMAND_HANDLERS.get(context.cmd);
|
|
8991
9072
|
if (!handler) throw new Error("Unknown command: ".concat(context.cmd, ". Run 'bb help'."));
|
|
8992
9073
|
await handler(context);
|
|
8993
|
-
}, "dispatchCliCommand"), startCliSession = __name2(
|
|
8994
|
-
|
|
8995
|
-
|
|
9074
|
+
}, "dispatchCliCommand"), startCliSession = __name2(
|
|
9075
|
+
(context, command) => {
|
|
9076
|
+
setActiveCliSession({ runtime: context.runtime, invocation: { command, cliVersion: context.version, apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, quiet: context.quiet, debug: context.debug }, effects: [], permissions: {} });
|
|
9077
|
+
},
|
|
9078
|
+
"startCliSession"
|
|
9079
|
+
), failCliSession = __name2((context, command, error2) => {
|
|
8996
9080
|
startCliSession(context, command);
|
|
8997
9081
|
const exitCode = emitCommandError(error2);
|
|
8998
9082
|
return clearActiveCliSession(), exitCode;
|
|
8999
9083
|
}, "failCliSession"), resolveRootArguments = __name2((rawArgv, runtime) => {
|
|
9000
9084
|
const rootArguments = parseRootArguments(rawArgv), apiBaseUrl = rootArguments.apiBaseUrl ?? runtime.env.BB_API_URL?.trim();
|
|
9001
9085
|
return configureBudgetBuilderApiBaseUrl(apiBaseUrl || DEFAULT_BUDGET_BUILDER_API_BASE_URL), rootArguments;
|
|
9002
|
-
}, "resolveRootArguments"), isHelpRequest = __name2((commandArgv) => commandArgv.length === 0 || commandArgv[0] === "help" || isEnabledFlag(commandArgv, "--help") || commandArgv.includes("-h"), "isHelpRequest"), printCliHelp = __name2(
|
|
9003
|
-
(commandArgv
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
},
|
|
9011
|
-
"printCliHelp"
|
|
9012
|
-
), runCompletionCommand = __name2((context, commandArgv) => {
|
|
9086
|
+
}, "resolveRootArguments"), isHelpRequest = __name2((commandArgv) => commandArgv.length === 0 || commandArgv[0] === "help" || isEnabledFlag(commandArgv, "--help") || commandArgv.includes("-h"), "isHelpRequest"), printCliHelp = __name2((commandArgv, runtime) => {
|
|
9087
|
+
if (commandArgv.includes("--legacy")) {
|
|
9088
|
+
printLegacyHelp(runtime);
|
|
9089
|
+
return;
|
|
9090
|
+
}
|
|
9091
|
+
const helpArgv = commandArgv.filter((argument, index) => argument !== "-h" && argument !== "--help" && !argument.startsWith("--help=") && !(commandArgv[index - 1] === "--help" && booleanFlagValues.has(argument))), helpCommand = resolveCommand(helpArgv[0] === "help" ? helpArgv.slice(1) : helpArgv)?.command;
|
|
9092
|
+
runtime.stdout.write("".concat(createHumanHelp(helpCommand), "\n"));
|
|
9093
|
+
}, "printCliHelp"), runCompletionCommand = __name2((context, commandArgv) => {
|
|
9013
9094
|
const shell = commandArgv[1];
|
|
9014
9095
|
return shell === void 0 || !isCompletionShell(shell) ? failCliSession(context, "completion", new CliRuntimeError("USAGE", "completion requires bash, zsh, fish, or powershell.")) : (context.runtime.stdout.write(createCompletionScript(shell)), 0);
|
|
9015
|
-
}, "runCompletionCommand"), isVersionRequest = __name2((commandArgv) => commandArgv[0] === "version" || isEnabledFlag(commandArgv, "--version") || commandArgv.includes("-v"), "isVersionRequest"), runVersionCommand = __name2((context) => (startCliSession(
|
|
9016
|
-
context,
|
|
9017
|
-
"version"
|
|
9018
|
-
), emitCommandResult(getVersionData()), clearActiveCliSession(), 0), "runVersionCommand"), createDefaultCredentialStore = __name2((runtime) => createBunCredentialStore({ account: resolveCliCredentialAccount(runtime.env), product: "budget-builder" }), "createDefaultCredentialStore"), authStatusResult = __name2(async (runtime, store) => {
|
|
9096
|
+
}, "runCompletionCommand"), isVersionRequest = __name2((commandArgv) => commandArgv[0] === "version" || isEnabledFlag(commandArgv, "--version") || commandArgv.includes("-v"), "isVersionRequest"), runVersionCommand = __name2((context) => (startCliSession(context, "version"), emitCommandResult(getVersionData()), clearActiveCliSession(), 0), "runVersionCommand"), createDefaultCredentialStore = __name2((runtime) => createBunCredentialStore({ account: resolveCliCredentialAccount(runtime.env), product: "budget-builder" }), "createDefaultCredentialStore"), authStatusResult = __name2(async (runtime, store) => {
|
|
9019
9097
|
const apiKeyActive = !!runtime.env.BB_API_KEY?.trim(), credentials = apiKeyActive ? null : await store.get();
|
|
9020
9098
|
return apiKeyActive ? { authenticated: !0, method: "api-key", storage: "environment" } : credentials && isCliCredentialForIssuer(credentials, BUDGET_BUILDER_API_BASE_URL) ? { authenticated: !0, method: "browser-session", accessTokenExpiresAt: credentials.accessTokenExpiresAt, refreshTokenExpiresAt: credentials.refreshTokenExpiresAt, session: credentials.session, storage: "Bun.secrets" } : { authenticated: !1, method: null, storage: "Bun.secrets" };
|
|
9021
9099
|
}, "authStatusResult"), runAuthAction = __name2(async (context, authAction, rawArgv, store) => {
|
|
9022
9100
|
const { runtime } = context;
|
|
9023
9101
|
if (authAction === "login") {
|
|
9024
|
-
const credentials = await loginWithBrowser(
|
|
9025
|
-
|
|
9026
|
-
|
|
9102
|
+
const credentials = await loginWithBrowser({ apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, clientVersion: context.version, onVerification: __name2(({ browserOpened, userCode, verificationUriComplete }) => runtime.stderr.write("".concat(browserOpened ? "Opened" : "Open", " ").concat(verificationUriComplete, "\nCode: ").concat(userCode, "\nWaiting for approval\u2026\n")), "onVerification"), ...isEnabledFlag(
|
|
9103
|
+
rawArgv,
|
|
9104
|
+
"--no-browser"
|
|
9105
|
+
) ? { openBrowser: __name2(async () => !1, "openBrowser") } : {}, store });
|
|
9027
9106
|
emitCommandResult({ authenticated: !0, method: "browser-session", session: credentials.session, storage: "Bun.secrets" });
|
|
9028
9107
|
} else emitCommandResult(authAction === "status" ? await authStatusResult(runtime, store) : { loggedOut: !0, ...await logoutCliSession({ apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, store }), apiKeyActive: !!runtime.env.BB_API_KEY?.trim() });
|
|
9029
9108
|
}, "runAuthAction"), runAuthCommand = __name2(async (context, authAction, commandArgv, rawArgv, credentialStore) => {
|
|
9030
9109
|
startCliSession(context, "auth ".concat(authAction));
|
|
9031
9110
|
try {
|
|
9032
|
-
if (commandArgv.length !== 2) throw new CliRuntimeError("USAGE", "auth ".concat(
|
|
9033
|
-
authAction,
|
|
9034
|
-
" accepts no positional arguments."
|
|
9035
|
-
));
|
|
9111
|
+
if (commandArgv.length !== 2) throw new CliRuntimeError("USAGE", "auth ".concat(authAction, " accepts no positional arguments."));
|
|
9036
9112
|
const store = credentialStore ?? createDefaultCredentialStore(context.runtime);
|
|
9037
9113
|
return await runAuthAction(context, authAction, rawArgv, store), 0;
|
|
9038
9114
|
} catch (error2) {
|
|
@@ -9054,11 +9130,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9054
9130
|
} catch (error2) {
|
|
9055
9131
|
throw getCliStorageError(error2) ? error2 : new CliRuntimeError("AUTHENTICATION", error2 instanceof Error ? error2.message : "Not authenticated. Run bb auth login first.");
|
|
9056
9132
|
}
|
|
9057
|
-
configureAccessToken(
|
|
9058
|
-
accessToken
|
|
9059
|
-
);
|
|
9133
|
+
configureAccessToken(accessToken);
|
|
9060
9134
|
}, "configureCliAuthentication"), CONFIRMATION_EXEMPT_COMMANDS = /* @__PURE__ */ new Set(["create-bill", "import-qbo-customer-invoice", "approve-supplier"]), confirmCanonicalMutation = __name2(async (resolvedCommand, cmd) => {
|
|
9061
|
-
resolvedCommand.isLegacyAlias || CONFIRMATION_EXEMPT_COMMANDS.has(cmd) || resolvedCommand.command.effects.length === 0 || await confirmCurrentCommand(
|
|
9135
|
+
resolvedCommand.isLegacyAlias || CONFIRMATION_EXEMPT_COMMANDS.has(cmd) || resolvedCommand.command.effects.length === 0 || await confirmCurrentCommand(
|
|
9136
|
+
{ action: resolvedCommand.command.path.join(" "), target: commandConfirmationTarget(resolvedCommand), details: "Canonical v2 mutation. Supply every effect-specific --allow-* flag for non-interactive execution." }
|
|
9137
|
+
);
|
|
9062
9138
|
}, "confirmCanonicalMutation"), runResolvedCommand = __name2(async (context, argv, rawArgv, resolvedCommand, credentialStore, configureAccessToken) => {
|
|
9063
9139
|
const { runtime, quiet, debug } = context, effectiveArgv = legacyArgvForCommand(argv, resolvedCommand), { command, positional, flags } = parseArgs(effectiveArgv);
|
|
9064
9140
|
consumeCliQuietFlags(flags), setCliQuiet(resolvedCommand.isLegacyAlias ? quiet : quiet || !debug), setActiveCliSession({ runtime, invocation: { command: resolvedCommand.command.path.join(" "), cliVersion: context.version, apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, legacy: resolvedCommand.isLegacyAlias, quiet, debug }, effects: resolvedCommand.command.effects, permissions: effectPermissionsFromArgv(rawArgv) }), resolvedCommand.isLegacyAlias && !quiet && runtime.stderr.write('[bb] Deprecated command "'.concat(resolvedCommand.invokedAs.join(" "), '"; use "bb ').concat(resolvedCommand.command.path.join(" "), '".\n'));
|
|
@@ -9087,7 +9163,9 @@ async function runCli(argv = process.argv, runtime = createProcessRuntime(), cre
|
|
|
9087
9163
|
if (isHelpRequest(commandArgv)) return printCliHelp(commandArgv, runtime), 0;
|
|
9088
9164
|
if (commandArgv[0] === "completion") return runCompletionCommand(context, commandArgv);
|
|
9089
9165
|
if (isVersionRequest(commandArgv)) return runVersionCommand(context);
|
|
9090
|
-
const authAction = authActionFromArgv(
|
|
9166
|
+
const authAction = authActionFromArgv(
|
|
9167
|
+
commandArgv
|
|
9168
|
+
);
|
|
9091
9169
|
if (authAction !== void 0) return await runAuthCommand(context, authAction, commandArgv, rawArgv, credentialStore);
|
|
9092
9170
|
const resolvedCommand = resolveCommand(commandArgv);
|
|
9093
9171
|
return resolvedCommand === void 0 ? failCliSession(context, commandArgv[0] ?? "unknown", new CliRuntimeError("USAGE", "Unknown command: ".concat(commandArgv.join(" "), ". Run 'bb help'."))) : await runResolvedCommand(context, argv, rawArgv, resolvedCommand, credentialStore, configureAccessToken);
|