@go-labs-sg/bb 3.23.0 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -2
- package/command-manifest.json +102 -2
- package/command-reference.md +18 -2
- package/dist/index.js +645 -652
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5481,7 +5481,7 @@ function parseSupplierUpdatePayload(raw) {
|
|
|
5481
5481
|
}
|
|
5482
5482
|
__name(parseSupplierUpdatePayload, "parseSupplierUpdatePayload"), __name2(parseSupplierUpdatePayload, "parseSupplierUpdatePayload");
|
|
5483
5483
|
var normalizeItemPayload = __name2((input) => {
|
|
5484
|
-
const normalized = { ...input, name: parseQuickBooksName(input.name), ...typeof input.cost == "number" && Number.isFinite(input.cost) ? { cost:
|
|
5484
|
+
const normalized = { ...input, name: parseQuickBooksName(input.name), ...typeof input.cost == "number" && Number.isFinite(input.cost) ? { cost: input.cost.toLocaleString("en-US", { useGrouping: !1, maximumFractionDigits: 20 }) } : {} };
|
|
5485
5485
|
return normalizePlainTextRichTextField({ input: normalized, textField: "description", richTextField: "descriptionRichText" });
|
|
5486
5486
|
}, "normalizeItemPayload");
|
|
5487
5487
|
function parseItemCreatePayload(raw) {
|
|
@@ -5501,9 +5501,10 @@ function parseContactUpdatePayload(raw) {
|
|
|
5501
5501
|
}
|
|
5502
5502
|
__name(parseContactUpdatePayload, "parseContactUpdatePayload"), __name2(parseContactUpdatePayload, "parseContactUpdatePayload");
|
|
5503
5503
|
function parseCompanyUpdatePayload(raw) {
|
|
5504
|
-
const input = requireObject(
|
|
5505
|
-
|
|
5506
|
-
|
|
5504
|
+
const input = requireObject(
|
|
5505
|
+
raw,
|
|
5506
|
+
"update-company payload"
|
|
5507
|
+
), billingEmails = parseCompanyBillingEmails(input.billingEmails);
|
|
5507
5508
|
if (input.confirmDistinct !== void 0 && typeof input.confirmDistinct != "boolean") throw validationError("confirmDistinct must be a boolean.");
|
|
5508
5509
|
return { id: requiredString(input.id, "id"), name: parseQuickBooksName(input.name), website: requiredString(input.website, "website"), ...input.confirmDistinct === void 0 ? {} : { confirmDistinct: input.confirmDistinct }, ...billingEmails === void 0 ? {} : { billingEmails } };
|
|
5509
5510
|
}
|
|
@@ -5539,17 +5540,15 @@ var parseCompanyBillingEmails = __name2((raw) => {
|
|
|
5539
5540
|
const missing = requiredPermissions.map((effect) => "--allow-".concat(effect));
|
|
5540
5541
|
throw new CliRuntimeError("CONFIRMATION_REQUIRED", "Non-interactive sensitive commands require an explicit target and all applicable allow flags.", { details: { action: request.action, effects: requiredPermissions, missingFlags: missing } });
|
|
5541
5542
|
}
|
|
5542
|
-
if (requiredPermissions.length === 0) return {
|
|
5543
|
-
confirmed: !0,
|
|
5544
|
-
requiredPermissions
|
|
5545
|
-
};
|
|
5543
|
+
if (requiredPermissions.length === 0) return { confirmed: !0, requiredPermissions };
|
|
5546
5544
|
const preview = formatConfirmationPreview(request);
|
|
5547
5545
|
if (runtime.stderr.write("".concat(preview, "\n")), runtime.prompt === void 0) throw new CliRuntimeError("CONFIRMATION_REQUIRED", "This command needs an interactive confirmation prompt.");
|
|
5548
5546
|
if (await runtime.prompt("Type CONFIRM to continue: ") !== "CONFIRM") throw new CliRuntimeError("ABORTED", "Command aborted by user.");
|
|
5549
5547
|
return { confirmed: !0, preview, requiredPermissions };
|
|
5550
|
-
}, "confirmSensitiveCommand"), sensitiveKeys = /* @__PURE__ */ new Set(["apikey", "authorization", "bb_api_key", "password", "paymentproof", "paymentproofattachments", "paymentproofpath", "paymentreference", "payload", "proof", "receipt", "secret", "token"]), serialize = __name2((value) => "".concat(JSON.stringify(value, null, 2), "\n"), "serialize"), createSuccessEnvelope = __name2((data, invocation) => ({ ok: !0, data, meta: { command: invocation.command, cliVersion: invocation.cliVersion, apiBaseUrl: invocation.apiBaseUrl } }), "createSuccessEnvelope"), emitCliSuccess = __name2(
|
|
5551
|
-
invocation.legacy ? data : createSuccessEnvelope(data, invocation)
|
|
5552
|
-
|
|
5548
|
+
}, "confirmSensitiveCommand"), sensitiveKeys = /* @__PURE__ */ new Set(["apikey", "authorization", "bb_api_key", "password", "paymentproof", "paymentproofattachments", "paymentproofpath", "paymentreference", "payload", "proof", "receipt", "secret", "token"]), serialize = __name2((value) => "".concat(JSON.stringify(value, null, 2), "\n"), "serialize"), createSuccessEnvelope = __name2((data, invocation) => ({ ok: !0, data, meta: { command: invocation.command, cliVersion: invocation.cliVersion, apiBaseUrl: invocation.apiBaseUrl } }), "createSuccessEnvelope"), emitCliSuccess = __name2(
|
|
5549
|
+
(runtime, invocation, data) => (runtime.stdout.write(serialize(invocation.legacy ? data : createSuccessEnvelope(data, invocation))), 0),
|
|
5550
|
+
"emitCliSuccess"
|
|
5551
|
+
), emitCliError = __name2((runtime, invocation, error2) => {
|
|
5553
5552
|
const normalized = normalizeCliError(error2);
|
|
5554
5553
|
if (invocation.legacy) runtime.stderr.write(serialize({ error: normalized.message }));
|
|
5555
5554
|
else {
|
|
@@ -5570,12 +5569,9 @@ var createProcessRuntime = __name2(() => ({ stdout: { write: __name2((value) =>
|
|
|
5570
5569
|
} finally {
|
|
5571
5570
|
prompt.close();
|
|
5572
5571
|
}
|
|
5573
|
-
}, "prompt"), now: __name2(() => /* @__PURE__ */ new Date(), "now") }), "createProcessRuntime"), activeSession, setActiveCliSession = __name2(
|
|
5574
|
-
(
|
|
5575
|
-
|
|
5576
|
-
},
|
|
5577
|
-
"setActiveCliSession"
|
|
5578
|
-
), clearActiveCliSession = __name2(() => {
|
|
5572
|
+
}, "prompt"), now: __name2(() => /* @__PURE__ */ new Date(), "now") }), "createProcessRuntime"), activeSession, setActiveCliSession = __name2((session) => {
|
|
5573
|
+
activeSession = { ...session, confirmedEffects: /* @__PURE__ */ new Set() };
|
|
5574
|
+
}, "setActiveCliSession"), clearActiveCliSession = __name2(() => {
|
|
5579
5575
|
activeSession = void 0;
|
|
5580
5576
|
}, "clearActiveCliSession"), getActiveCliSession = __name2(() => activeSession, "getActiveCliSession"), requireSession = __name2(() => {
|
|
5581
5577
|
if (activeSession === void 0) throw new Error("Budget Builder CLI runtime session is not configured.");
|
|
@@ -5589,26 +5585,26 @@ var createProcessRuntime = __name2(() => ({ stdout: { write: __name2((value) =>
|
|
|
5589
5585
|
}, "emitCommandResult"), emitCommandError = __name2((error2) => {
|
|
5590
5586
|
const session = requireSession();
|
|
5591
5587
|
return emitCliError(session.runtime, session.invocation, error2);
|
|
5592
|
-
}, "emitCommandError"), confirmCurrentCommand = __name2(
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
}
|
|
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, 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;
|
|
5588
|
+
}, "emitCommandError"), confirmCurrentCommand = __name2(
|
|
5589
|
+
async (input) => {
|
|
5590
|
+
const session = requireSession(), unconfirmedEffects = (input.effects ?? session.effects).filter((effect) => !session.confirmedEffects.has(effect));
|
|
5591
|
+
if (unconfirmedEffects.length !== 0) {
|
|
5592
|
+
await confirmSensitiveCommand(session.runtime, { action: input.action, target: input.target, details: input.details, effects: unconfirmedEffects, permissions: session.permissions });
|
|
5593
|
+
for (const effect of unconfirmedEffects) session.confirmedEffects.add(effect);
|
|
5594
|
+
}
|
|
5609
5595
|
},
|
|
5610
|
-
"
|
|
5611
|
-
)
|
|
5596
|
+
"confirmCurrentCommand"
|
|
5597
|
+
);
|
|
5598
|
+
import { contentType } from "mime-types";
|
|
5599
|
+
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(async () => {
|
|
5600
|
+
const approvals = [];
|
|
5601
|
+
let cursor;
|
|
5602
|
+
do {
|
|
5603
|
+
const page = await api2.budget.getPendingApprovals.query({ limit: 100, cursor });
|
|
5604
|
+
approvals.push(...page.items), cursor = page.pageInfo.nextCursor ?? void 0;
|
|
5605
|
+
} while (cursor);
|
|
5606
|
+
return approvals;
|
|
5607
|
+
}, "getAllPendingApprovals"), getPendingApproval = __name2(async (approvalId) => {
|
|
5612
5608
|
out(await api2.budget.getPendingApproval.query({ approvalId }));
|
|
5613
5609
|
}, "getPendingApproval"), createApprovalEmailDeliveryReport = __name2((delivery) => {
|
|
5614
5610
|
if (!delivery) return { queued: !1, sent: !1, count: 0, queuedCount: 0, sentCount: 0, skippedCount: 0, error: "No approval email delivery was queued" };
|
|
@@ -5621,7 +5617,10 @@ function isPendingRequest(n) {
|
|
|
5621
5617
|
__name(isPendingRequest, "isPendingRequest"), __name2(isPendingRequest, "isPendingRequest");
|
|
5622
5618
|
var out = __name2((data) => {
|
|
5623
5619
|
emitCommandResult(data);
|
|
5624
|
-
}, "out"), isRecord2 = __name2(
|
|
5620
|
+
}, "out"), isRecord2 = __name2(
|
|
5621
|
+
(value) => typeof value == "object" && value !== null && !Array.isArray(value),
|
|
5622
|
+
"isRecord2"
|
|
5623
|
+
), stringField = __name2((record, key) => {
|
|
5625
5624
|
const value = record[key];
|
|
5626
5625
|
return typeof value == "string" && value.trim() ? value.trim() : void 0;
|
|
5627
5626
|
}, "stringField"), asanaSectionsForTask = __name2((task) => !isRecord2(task) || !Array.isArray(task.memberships) ? [] : task.memberships.flatMap((membership) => !isRecord2(membership) || !isRecord2(membership.section) ? [] : [{ gid: stringField(membership.section, "gid"), name: stringField(membership.section, "name") }]), "asanaSectionsForTask"), isWonOrLostAsanaTask = __name2((task) => asanaSectionsForTask(task).some((section) => {
|
|
@@ -5662,9 +5661,7 @@ var out = __name2((data) => {
|
|
|
5662
5661
|
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";
|
|
5663
5662
|
return "".concat(sectionText, "; ").concat(dateText, "; ").concat(candidate.gid);
|
|
5664
5663
|
}, "formatAsanaCandidateMetadata"), promptForAsanaLeadCandidate = __name2(async (candidates) => {
|
|
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
|
-
);
|
|
5664
|
+
if (candidates.length === 0) throw new Error("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.");
|
|
5668
5665
|
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.");
|
|
5669
5666
|
console.error("Select the Asana lead task to link to this project:"), candidates.forEach((candidate, index) => {
|
|
5670
5667
|
console.error("".concat(index + 1, ". ").concat(candidate.name, " (").concat(formatAsanaCandidateMetadata(candidate), ")"));
|
|
@@ -5673,7 +5670,9 @@ var out = __name2((data) => {
|
|
|
5673
5670
|
try {
|
|
5674
5671
|
for (; ; ) {
|
|
5675
5672
|
const trimmed = (await rl.question("Choose 1-".concat(candidates.length, ", or q to abort: "))).trim().toLowerCase();
|
|
5676
|
-
if (trimmed === "q" || trimmed === "quit") throw new Error(
|
|
5673
|
+
if (trimmed === "q" || trimmed === "quit") throw new Error(
|
|
5674
|
+
"Aborted."
|
|
5675
|
+
);
|
|
5677
5676
|
const selected = Number.parseInt(trimmed, 10);
|
|
5678
5677
|
if (Number.isInteger(selected) && selected >= 1 && selected <= candidates.length) {
|
|
5679
5678
|
const candidate = candidates[selected - 1];
|
|
@@ -5698,13 +5697,14 @@ var out = __name2((data) => {
|
|
|
5698
5697
|
const resolvedContentType = attachmentContentTypeForFileName(fileName);
|
|
5699
5698
|
if (resolvedContentType === "image/webp") throw new Error("Unsupported QuickBooks bill attachment type: ".concat(fileName, ". Use PDF, GIF, JPEG, or PNG."));
|
|
5700
5699
|
return resolvedContentType;
|
|
5701
|
-
}, "billAttachmentContentTypeForFileName"), PAYMENT_PROOF_MAX_SIZE = 20 * 1024 * 1024, QUOTATION_ATTACHMENT_MAX_SIZE = 20 * 1024 * 1024, quotationAttachmentContentTypeForFileName = __name2(
|
|
5702
|
-
|
|
5703
|
-
fileName
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5700
|
+
}, "billAttachmentContentTypeForFileName"), PAYMENT_PROOF_MAX_SIZE = 20 * 1024 * 1024, QUOTATION_ATTACHMENT_MAX_SIZE = 20 * 1024 * 1024, quotationAttachmentContentTypeForFileName = __name2(
|
|
5701
|
+
(fileName) => {
|
|
5702
|
+
const resolvedContentType = contentTypeHeaderForFileName(fileName);
|
|
5703
|
+
if (resolvedContentType === "application/pdf" || resolvedContentType === "image/jpeg" || resolvedContentType === "image/png") return resolvedContentType;
|
|
5704
|
+
throw new Error("Unsupported quotation attachment type: ".concat(fileName, ". Use PDF, JPEG, or PNG."));
|
|
5705
|
+
},
|
|
5706
|
+
"quotationAttachmentContentTypeForFileName"
|
|
5707
|
+
), 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 }) => {
|
|
5708
5708
|
const effects = details ?? "may change workflow state or send notifications";
|
|
5709
5709
|
return ["Budget Builder workflow preview", "Action: ".concat(action), "Target: ".concat(entity), "Effects: ".concat(effects)].join("\n");
|
|
5710
5710
|
}, "buildSensitiveWorkflowPreview"), assertSensitiveWorkflowConfirmed = __name2(async (input) => {
|
|
@@ -5745,9 +5745,7 @@ 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(
|
|
5749
|
-
{ action: "Update project and reject existing estimates", entity: "project ".concat(input.id), details: error2.message }
|
|
5750
|
-
), api2.project.updateProject.mutate({ ...input, confirmEstimateInvalidation: !0 });
|
|
5748
|
+
return await assertSensitiveWorkflowConfirmed({ action: "Update project and reject existing estimates", entity: "project ".concat(input.id), details: error2.message }), api2.project.updateProject.mutate({ ...input, confirmEstimateInvalidation: !0 });
|
|
5751
5749
|
}
|
|
5752
5750
|
}, "updateProjectWithEstimateInvalidationConfirmation"), listBudgets = __name2(async (input) => {
|
|
5753
5751
|
out(await api2.budget.getAllBudgets.query(input));
|
|
@@ -5760,9 +5758,7 @@ async function getBudget(id, opts) {
|
|
|
5760
5758
|
}
|
|
5761
5759
|
__name(getBudget, "getBudget"), __name2(getBudget, "getBudget");
|
|
5762
5760
|
async function updateBudgetStatus(budgetId, status, opts) {
|
|
5763
|
-
await assertSensitiveWorkflowConfirmed({ action: "Update budget status", entity: "budget ".concat(budgetId), details: "to ".concat(
|
|
5764
|
-
status
|
|
5765
|
-
) }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Update budget status");
|
|
5761
|
+
await assertSensitiveWorkflowConfirmed({ action: "Update budget status", entity: "budget ".concat(budgetId), details: "to ".concat(status) }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Update budget status");
|
|
5766
5762
|
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 } });
|
|
5767
5763
|
out({ ...result, invoiceSetup: result.newStatus === BudgetStatus2.ESTIMATE_ACCEPTED && result.hasQuickbooksEstimate ? invoiceSplitSetupNextAction(budgetId) : null });
|
|
5768
5764
|
}
|
|
@@ -5781,12 +5777,9 @@ var assertBudgetActionReadiness = __name2(async ({ budgetId, requireQuickbooksPr
|
|
|
5781
5777
|
}
|
|
5782
5778
|
}, "runBudgetPreflight"), listBills = __name2(async (input) => {
|
|
5783
5779
|
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 }));
|
|
5784
|
-
}, "listBills"), countBills = __name2(
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
},
|
|
5788
|
-
"countBills"
|
|
5789
|
-
);
|
|
5780
|
+
}, "listBills"), countBills = __name2(async (input) => {
|
|
5781
|
+
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 }));
|
|
5782
|
+
}, "countBills");
|
|
5790
5783
|
async function approveBill(billId, overBudgetOverrideReason) {
|
|
5791
5784
|
await assertSensitiveWorkflowConfirmed({ action: "Approve bill", entity: "bill ".concat(billId), details: "and send requester reply email" });
|
|
5792
5785
|
const approval = (await getAllPendingApprovals()).filter((n) => isPendingRequest(n) && n.type === BILL && (n.billId === billId || n.bill?.id === billId))[0];
|
|
@@ -5801,7 +5794,9 @@ async function approveBill(billId, overBudgetOverrideReason) {
|
|
|
5801
5794
|
const delivery = result.emailDelivery;
|
|
5802
5795
|
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
5803
5796
|
} catch (error2) {
|
|
5804
|
-
email2 = createApprovalEmailDeliveryFailure(
|
|
5797
|
+
email2 = createApprovalEmailDeliveryFailure(
|
|
5798
|
+
error2 instanceof Error ? error2.message : String(error2)
|
|
5799
|
+
);
|
|
5805
5800
|
}
|
|
5806
5801
|
out({ ...result, email: email2 });
|
|
5807
5802
|
}
|
|
@@ -5827,9 +5822,7 @@ async function createBillApproval(billId) {
|
|
|
5827
5822
|
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure("No approval ids returned");
|
|
5828
5823
|
else try {
|
|
5829
5824
|
const delivery = result.emailDelivery;
|
|
5830
|
-
email2 = createApprovalEmailDeliveryReport(
|
|
5831
|
-
delivery
|
|
5832
|
-
);
|
|
5825
|
+
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
5833
5826
|
} catch (error2) {
|
|
5834
5827
|
email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(error2));
|
|
5835
5828
|
}
|
|
@@ -5846,10 +5839,7 @@ var validateBillStatusUpdateOptions = __name2((opts) => {
|
|
|
5846
5839
|
if (cleanup) try {
|
|
5847
5840
|
await cleanup();
|
|
5848
5841
|
} 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
|
-
);
|
|
5842
|
+
throw new AggregateError([error2, cleanupError], "Bill status update failed and its staged payment proof could not be cleaned up.");
|
|
5853
5843
|
}
|
|
5854
5844
|
throw error2;
|
|
5855
5845
|
}, "rethrowAfterStagedPaymentProofCleanup"), stageBillPaymentProof = __name2(async (projectId, filePath) => {
|
|
@@ -5889,7 +5879,10 @@ var listExternalBillPaymentAccounts = __name2(async () => {
|
|
|
5889
5879
|
}, "listExternalBillPaymentAccounts"), refreshExternalBillPaymentAccounts = __name2(async () => {
|
|
5890
5880
|
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());
|
|
5891
5881
|
}, "refreshExternalBillPaymentAccounts"), recordExternalBillPayment = __name2(async (opts) => {
|
|
5892
|
-
if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp(
|
|
5882
|
+
if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp(
|
|
5883
|
+
"^\\d{4}-\\d{2}-\\d{2}$",
|
|
5884
|
+
""
|
|
5885
|
+
).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>.");
|
|
5893
5886
|
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.") });
|
|
5894
5887
|
const bill = await api2.bill.getPayment.query({ id: opts.id }), proof = !bill.externalPayment && opts.paymentProofPath ? await stageBillPaymentProof(bill.projectId, opts.paymentProofPath) : void 0;
|
|
5895
5888
|
try {
|
|
@@ -5954,15 +5947,12 @@ var uploadSingleBillAttachmentFromPath = __name2(async (billId, filePath, type =
|
|
|
5954
5947
|
async function uploadBillAttachmentsFromPaths(billId, filePaths, type = AttachmentType.BILL) {
|
|
5955
5948
|
if (filePaths.length === 0) throw new Error("At least one bill attachment file path is required");
|
|
5956
5949
|
const results = [];
|
|
5957
|
-
for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(
|
|
5958
|
-
out({
|
|
5959
|
-
success: !0,
|
|
5950
|
+
for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(
|
|
5960
5951
|
billId,
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
});
|
|
5952
|
+
filePath,
|
|
5953
|
+
type
|
|
5954
|
+
));
|
|
5955
|
+
out({ success: !0, billId, type, count: results.length, attachments: results.map((result) => result.attachment), results });
|
|
5966
5956
|
}
|
|
5967
5957
|
__name(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths"), __name2(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths");
|
|
5968
5958
|
async function uploadBillDocumentsFromPaths({ billId, invoicePaths = [], paymentProofPaths = [] }) {
|
|
@@ -5971,12 +5961,12 @@ async function uploadBillDocumentsFromPaths({ billId, invoicePaths = [], payment
|
|
|
5971
5961
|
for (const filePath of invoicePaths) invoiceResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL));
|
|
5972
5962
|
const paymentProofResults = [];
|
|
5973
5963
|
for (const filePath of paymentProofPaths) paymentProofResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL_PAYMENT_PROOF));
|
|
5974
|
-
out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [
|
|
5964
|
+
out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [
|
|
5965
|
+
...invoiceResults,
|
|
5966
|
+
...paymentProofResults
|
|
5967
|
+
] });
|
|
5975
5968
|
}
|
|
5976
|
-
__name(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths"), __name2(
|
|
5977
|
-
uploadBillDocumentsFromPaths,
|
|
5978
|
-
"uploadBillDocumentsFromPaths"
|
|
5979
|
-
);
|
|
5969
|
+
__name(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths"), __name2(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths");
|
|
5980
5970
|
async function uploadQuotationAttachmentFromPath(projectId, filePath) {
|
|
5981
5971
|
const buf = await readFile2(filePath), fileName = basename(filePath);
|
|
5982
5972
|
if (buf.byteLength > QUOTATION_ATTACHMENT_MAX_SIZE) throw new Error("Quotation attachment must be 20MB or smaller.");
|
|
@@ -5993,25 +5983,23 @@ async function uploadBudgetAttachmentFromPath(budgetId, filePath) {
|
|
|
5993
5983
|
await confirmLockedBudgetChangeByBudgetId(budgetId, "Upload budget attachment");
|
|
5994
5984
|
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 } });
|
|
5995
5985
|
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
5996
|
-
const confirmed = await api2.attachment.confirmBudgetAttachment.mutate(
|
|
5986
|
+
const confirmed = await api2.attachment.confirmBudgetAttachment.mutate(
|
|
5987
|
+
{ budgetId, key, name: fileName, size }
|
|
5988
|
+
);
|
|
5997
5989
|
out(confirmed);
|
|
5998
5990
|
}
|
|
5999
|
-
__name(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath"), __name2(
|
|
6000
|
-
uploadBudgetAttachmentFromPath,
|
|
6001
|
-
"uploadBudgetAttachmentFromPath"
|
|
6002
|
-
);
|
|
5991
|
+
__name(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath"), __name2(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath");
|
|
6003
5992
|
async function uploadBudgetWinProofFromPath(budgetId, filePath, opts) {
|
|
6004
5993
|
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");
|
|
6005
5994
|
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 } });
|
|
6006
5995
|
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
6007
|
-
await api2.attachment.confirmBudgetWinProofAttachment.mutate({
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
...opts?.markProjectWon !== void 0 && { markProjectWon: opts.markProjectWon },
|
|
6013
|
-
...opts?.projectInvoiceSettings !== void 0 && { projectInvoiceSettings: opts.projectInvoiceSettings }
|
|
5996
|
+
await api2.attachment.confirmBudgetWinProofAttachment.mutate({
|
|
5997
|
+
budgetId,
|
|
5998
|
+
key,
|
|
5999
|
+
name: fileName,
|
|
6000
|
+
size
|
|
6014
6001
|
});
|
|
6002
|
+
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 } });
|
|
6015
6003
|
out({ ...result, invoiceSetup: result.hasQuickbooksEstimate ? invoiceSplitSetupNextAction(budgetId) : null });
|
|
6016
6004
|
}
|
|
6017
6005
|
__name(uploadBudgetWinProofFromPath, "uploadBudgetWinProofFromPath"), __name2(uploadBudgetWinProofFromPath, "uploadBudgetWinProofFromPath");
|
|
@@ -6025,10 +6013,7 @@ async function getBillDetails(id) {
|
|
|
6025
6013
|
}
|
|
6026
6014
|
__name(getBillDetails, "getBillDetails"), __name2(getBillDetails, "getBillDetails");
|
|
6027
6015
|
async function getBudgetItemsOnly(budgetId, opts) {
|
|
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
|
-
})]);
|
|
6016
|
+
const includeInactive = opts?.includeInactive ?? !1, [items, totals] = await Promise.all([api2.budget.getBudgetItems.query({ budgetId, includeInactive }), api2.budget.getBudgetItemTotals.query({ budgetId, includeInactive })]);
|
|
6032
6017
|
out({ ...items, totals });
|
|
6033
6018
|
}
|
|
6034
6019
|
__name(getBudgetItemsOnly, "getBudgetItemsOnly"), __name2(getBudgetItemsOnly, "getBudgetItemsOnly");
|
|
@@ -6045,7 +6030,10 @@ async function updateBudgetItem(input) {
|
|
|
6045
6030
|
}
|
|
6046
6031
|
__name(updateBudgetItem, "updateBudgetItem"), __name2(updateBudgetItem, "updateBudgetItem");
|
|
6047
6032
|
async function removeBudgetItem(budgetItemId) {
|
|
6048
|
-
await confirmLockedBudgetChangeByBudgetItemId(
|
|
6033
|
+
await confirmLockedBudgetChangeByBudgetItemId(
|
|
6034
|
+
budgetItemId,
|
|
6035
|
+
"Remove budget item"
|
|
6036
|
+
);
|
|
6049
6037
|
const result = await api2.budgetItem.removeBudgetItem.mutate({ budgetItemId });
|
|
6050
6038
|
out(result);
|
|
6051
6039
|
}
|
|
@@ -6076,9 +6064,7 @@ async function createBudgetApproval(budgetId, preflight) {
|
|
|
6076
6064
|
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" });
|
|
6077
6065
|
const result = await api2.budget.createBudgetApproval.mutate({ budgetId }), approvalIds = (result.results ?? []).map((item) => ({ id: item.id }));
|
|
6078
6066
|
let email2;
|
|
6079
|
-
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure(
|
|
6080
|
-
"No approval ids returned"
|
|
6081
|
-
);
|
|
6067
|
+
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure("No approval ids returned");
|
|
6082
6068
|
else try {
|
|
6083
6069
|
const delivery = result.emailDelivery;
|
|
6084
6070
|
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
@@ -6111,14 +6097,14 @@ async function createBudgetFromPayload(raw) {
|
|
|
6111
6097
|
try {
|
|
6112
6098
|
result = await api2.budget.createBudget.mutate(input);
|
|
6113
6099
|
} catch (error2) {
|
|
6114
|
-
throw budgetCreateUncertainError(
|
|
6100
|
+
throw budgetCreateUncertainError(
|
|
6101
|
+
error2,
|
|
6102
|
+
input
|
|
6103
|
+
) || error2;
|
|
6115
6104
|
}
|
|
6116
6105
|
out(result);
|
|
6117
6106
|
}
|
|
6118
|
-
__name(createBudgetFromPayload, "createBudgetFromPayload"), __name2(
|
|
6119
|
-
createBudgetFromPayload,
|
|
6120
|
-
"createBudgetFromPayload"
|
|
6121
|
-
);
|
|
6107
|
+
__name(createBudgetFromPayload, "createBudgetFromPayload"), __name2(createBudgetFromPayload, "createBudgetFromPayload");
|
|
6122
6108
|
async function updateBudgetFromPayload(raw) {
|
|
6123
6109
|
const input = parseUpdateBudgetPayload(raw);
|
|
6124
6110
|
await confirmLockedBudgetChangeByBudgetId(input.id, "Update budget");
|
|
@@ -6188,9 +6174,7 @@ var deleteBudgetDiscount = __name2(async (budgetId) => {
|
|
|
6188
6174
|
const result = await api2.budget.deleteBudgetDiscount.mutate({ budgetId });
|
|
6189
6175
|
out(result);
|
|
6190
6176
|
}, "deleteBudgetDiscount"), deleteBudgetCommission = __name2(async (budgetId) => {
|
|
6191
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6192
|
-
{ action: "Remove budget commission", entity: "budget ".concat(budgetId), details: "and return the budget to DRAFT" }
|
|
6193
|
-
);
|
|
6177
|
+
await assertSensitiveWorkflowConfirmed({ action: "Remove budget commission", entity: "budget ".concat(budgetId), details: "and return the budget to DRAFT" });
|
|
6194
6178
|
const result = await api2.budget.deleteBudgetCommission.mutate({ budgetId });
|
|
6195
6179
|
out(result);
|
|
6196
6180
|
}, "deleteBudgetCommission"), setBudgetItemsNotUtilized = __name2(async (budgetItemIds, notUtilized) => {
|
|
@@ -6280,7 +6264,10 @@ async function getQuotationDetails(id) {
|
|
|
6280
6264
|
const result = await api2.quotation.getById.query({ id });
|
|
6281
6265
|
out(result);
|
|
6282
6266
|
}
|
|
6283
|
-
__name(getQuotationDetails, "getQuotationDetails"), __name2(
|
|
6267
|
+
__name(getQuotationDetails, "getQuotationDetails"), __name2(
|
|
6268
|
+
getQuotationDetails,
|
|
6269
|
+
"getQuotationDetails"
|
|
6270
|
+
);
|
|
6284
6271
|
var getQuotationLineItems = __name2(async (input) => {
|
|
6285
6272
|
out(await api2.quotation.getLineItems.query(input));
|
|
6286
6273
|
}, "getQuotationLineItems");
|
|
@@ -6301,7 +6288,10 @@ async function submitQuotation(id, overBudgetOverrideReason) {
|
|
|
6301
6288
|
const result = await api2.quotation.submitForApproval.mutate({ id, overBudgetOverrideReason });
|
|
6302
6289
|
out(result);
|
|
6303
6290
|
}
|
|
6304
|
-
__name(submitQuotation, "submitQuotation"), __name2(
|
|
6291
|
+
__name(submitQuotation, "submitQuotation"), __name2(
|
|
6292
|
+
submitQuotation,
|
|
6293
|
+
"submitQuotation"
|
|
6294
|
+
);
|
|
6305
6295
|
async function downloadQuotationPdf(id, fileRole) {
|
|
6306
6296
|
const result = await api2.quotation.getSignedDownloadUrl.query({ id, fileRole });
|
|
6307
6297
|
out(result);
|
|
@@ -6336,18 +6326,17 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6336
6326
|
out(await api2.customerInvoice.getHistory.query(input));
|
|
6337
6327
|
}, "getCustomerInvoiceHistory"), getCustomerInvoicePayments = __name2(async (invoiceId) => {
|
|
6338
6328
|
out(await api2.customerInvoice.getPayments.query({ invoiceId }));
|
|
6339
|
-
}, "getCustomerInvoicePayments"), getCustomerInvoiceEmailContext = __name2(
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
},
|
|
6344
|
-
"getCustomerInvoiceEmailContext"
|
|
6345
|
-
), previewQboCustomerInvoice = __name2(async (input) => {
|
|
6329
|
+
}, "getCustomerInvoicePayments"), getCustomerInvoiceEmailContext = __name2(async (batchId) => {
|
|
6330
|
+
const result = await api2.customerInvoice.getInvoiceEmailContext.query({ batchId });
|
|
6331
|
+
out(result);
|
|
6332
|
+
}, "getCustomerInvoiceEmailContext"), previewQboCustomerInvoice = __name2(async (input) => {
|
|
6346
6333
|
const result = await api2.customerInvoice.previewExistingInvoice.mutate(input);
|
|
6347
6334
|
out(result);
|
|
6348
6335
|
}, "previewQboCustomerInvoice"), importQboCustomerInvoice = __name2(async (input) => {
|
|
6349
|
-
await confirmCurrentCommand({ action: "Link existing QuickBooks invoice", target: "QuickBooks invoice ".concat(input.qboInvoiceId, " to budget ").concat(input.budgetId), details: "records the reviewed invoice in Budget Builder only; QuickBooks access is read-only; preserves original evidence and revalidates the preview token" });
|
|
6350
|
-
const result = await api2.customerInvoice.linkExistingInvoice.mutate(
|
|
6336
|
+
await confirmCurrentCommand({ action: "Link existing QuickBooks invoice", target: "QuickBooks invoice ".concat(input.qboInvoiceId, " to budget ").concat(input.budgetId), details: "records the reviewed invoice in Budget Builder only; QuickBooks access is read-only; preserves original evidence and revalidates the preview token".concat(input.confirmEstimateLineage ? "; you confirm this invoice, which has no QuickBooks estimate link, belongs to this budget's estimate" : "") });
|
|
6337
|
+
const result = await api2.customerInvoice.linkExistingInvoice.mutate(
|
|
6338
|
+
input
|
|
6339
|
+
);
|
|
6351
6340
|
out(result);
|
|
6352
6341
|
}, "importQboCustomerInvoice"), createCustomerInvoice = __name2(async (raw) => {
|
|
6353
6342
|
const input = parseCreateCustomerInvoicePayload(raw), readiness = await api2.customerInvoice.getInvoiceReadiness.query({ budgetId: input.budgetId, includePreview: !0 });
|
|
@@ -6362,7 +6351,9 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6362
6351
|
const result = await api2.customerInvoice.discardCreatingInvoiceBatch.mutate({ batchId });
|
|
6363
6352
|
out(result);
|
|
6364
6353
|
}, "discardCreatingCustomerInvoice"), deleteCustomerInvoice = __name2(async (batchId) => {
|
|
6365
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6354
|
+
await assertSensitiveWorkflowConfirmed(
|
|
6355
|
+
{ action: "Delete customer invoice", entity: "invoice batch ".concat(batchId), details: "queues deletion of its invoices in QuickBooks; the local batch is removed once QuickBooks confirms; paid invoices are blocked until their QBO payments are reversed; removing approved coverage may reopen the estimate" }
|
|
6356
|
+
);
|
|
6366
6357
|
const result = await api2.customerInvoice.deleteInvoiceBatch.mutate({ batchId });
|
|
6367
6358
|
out(result);
|
|
6368
6359
|
}, "deleteCustomerInvoice"), voidCustomerInvoice = __name2(async (batchId) => {
|
|
@@ -6391,11 +6382,7 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6391
6382
|
}, "updateCustomerInvoiceDetails"), updateCustomerInvoiceQboDrift = __name2(async ({ invoiceId, requestId, resolution }) => {
|
|
6392
6383
|
const keepRequestId = resolution === "KEEP_BB" ? requestId ?? randomUUID2() : void 0;
|
|
6393
6384
|
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({
|
|
6395
|
-
invoiceId,
|
|
6396
|
-
resolution,
|
|
6397
|
-
...keepRequestId ? { requestId: keepRequestId } : {}
|
|
6398
|
-
});
|
|
6385
|
+
const result = await api2.customerInvoice.resolveQboDrift.mutate({ invoiceId, resolution, ...keepRequestId ? { requestId: keepRequestId } : {} });
|
|
6399
6386
|
out(result);
|
|
6400
6387
|
}, "updateCustomerInvoiceQboDrift"), markCustomerInvoiceSentExternally = __name2(async (input) => {
|
|
6401
6388
|
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") });
|
|
@@ -6429,7 +6416,9 @@ async function deleteBillById(id) {
|
|
|
6429
6416
|
__name(deleteBillById, "deleteBillById"), __name2(deleteBillById, "deleteBillById");
|
|
6430
6417
|
async function createSupplierFromPayload(raw) {
|
|
6431
6418
|
const input = parseSupplierCreatePayload(raw);
|
|
6432
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6419
|
+
await assertSensitiveWorkflowConfirmed(
|
|
6420
|
+
{ action: "Create supplier and request approval if required", entity: "supplier ".concat(input.name), details: "creates the supplier first; pending-approval suppliers also request approval and send emails" }
|
|
6421
|
+
);
|
|
6433
6422
|
let created;
|
|
6434
6423
|
try {
|
|
6435
6424
|
created = await api2.supplier.createSupplier.mutate(input);
|
|
@@ -6457,14 +6446,16 @@ async function createSupplierFromPayload(raw) {
|
|
|
6457
6446
|
} catch (error2) {
|
|
6458
6447
|
emailResult = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(error2));
|
|
6459
6448
|
}
|
|
6460
|
-
out({ ...created, supplierApproval: {
|
|
6449
|
+
out({ ...created, supplierApproval: {
|
|
6450
|
+
requested: !0,
|
|
6451
|
+
approvalCount: approvalIds.length,
|
|
6452
|
+
email: emailResult
|
|
6453
|
+
} });
|
|
6461
6454
|
}
|
|
6462
6455
|
__name(createSupplierFromPayload, "createSupplierFromPayload"), __name2(createSupplierFromPayload, "createSupplierFromPayload");
|
|
6463
6456
|
async function updateSupplierFromPayload(raw) {
|
|
6464
6457
|
const input = parseSupplierUpdatePayload(raw);
|
|
6465
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6466
|
-
{ action: "Update supplier", entity: "supplier ".concat(input.id), details: "Normal-user edits also request approval and queue approval emails." }
|
|
6467
|
-
);
|
|
6458
|
+
await assertSensitiveWorkflowConfirmed({ action: "Update supplier", entity: "supplier ".concat(input.id), details: "Normal-user edits also request approval and queue approval emails." });
|
|
6468
6459
|
const updated = await api2.supplier.updateSupplier.mutate(input);
|
|
6469
6460
|
out(updated);
|
|
6470
6461
|
}
|
|
@@ -6480,14 +6471,14 @@ async function updateItemFromPayload(raw) {
|
|
|
6480
6471
|
}
|
|
6481
6472
|
__name(updateItemFromPayload, "updateItemFromPayload"), __name2(updateItemFromPayload, "updateItemFromPayload");
|
|
6482
6473
|
async function createContactPersonFromPayload(raw) {
|
|
6483
|
-
const input = parseContactCreatePayload(
|
|
6474
|
+
const input = parseContactCreatePayload(
|
|
6475
|
+
raw
|
|
6476
|
+
), result = await api2.contactPerson.createContactPerson.mutate(input);
|
|
6484
6477
|
out(result);
|
|
6485
6478
|
}
|
|
6486
6479
|
__name(createContactPersonFromPayload, "createContactPersonFromPayload"), __name2(createContactPersonFromPayload, "createContactPersonFromPayload");
|
|
6487
6480
|
async function updateContactPersonFromPayload(raw) {
|
|
6488
|
-
const input = parseContactUpdatePayload(
|
|
6489
|
-
raw
|
|
6490
|
-
), result = await api2.contactPerson.updateContactPerson.mutate(input);
|
|
6481
|
+
const input = parseContactUpdatePayload(raw), result = await api2.contactPerson.updateContactPerson.mutate(input);
|
|
6491
6482
|
out(result);
|
|
6492
6483
|
}
|
|
6493
6484
|
__name(updateContactPersonFromPayload, "updateContactPersonFromPayload"), __name2(updateContactPersonFromPayload, "updateContactPersonFromPayload");
|
|
@@ -6521,7 +6512,9 @@ async function approveBudget(budgetId) {
|
|
|
6521
6512
|
}
|
|
6522
6513
|
__name(approveBudget, "approveBudget"), __name2(approveBudget, "approveBudget");
|
|
6523
6514
|
async function rejectBudget(budgetId, reason) {
|
|
6524
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6515
|
+
await assertSensitiveWorkflowConfirmed(
|
|
6516
|
+
{ action: "Reject budget", entity: "budget ".concat(budgetId), details: 'with reason "'.concat(reason, '" and send requester reply email') }
|
|
6517
|
+
);
|
|
6525
6518
|
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];
|
|
6526
6519
|
if (!approval) throw new Error("No pending budget approval found for this budget and approver.");
|
|
6527
6520
|
const result = await api2.budget.updateBudgetApproval.mutate({ budgetApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
|
|
@@ -6549,18 +6542,10 @@ async function getSupplierItems(supplierId) {
|
|
|
6549
6542
|
__name(getSupplierItems, "getSupplierItems"), __name2(getSupplierItems, "getSupplierItems");
|
|
6550
6543
|
async function getSupplierDetails(supplierId) {
|
|
6551
6544
|
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;
|
|
6552
|
-
out({ ...supplier, supplierApprovalSummary: {
|
|
6553
|
-
|
|
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
|
-
} });
|
|
6545
|
+
out({ ...supplier, supplierApprovalSummary: { pendingApprovalCount: pendingApprovals.length, pendingApprovers: pendingApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, createdAt: approval.createdAt, updatedAt: approval.updatedAt })), supersededApprovalCount: supersededApprovals.length, 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 })), respondedBy: respondedByApproval && responseUser ? { approvalId: respondedByApproval.id, status: respondedByApproval.status, approverId: respondedByApproval.approverId, responderId: respondedByApproval.responderId, name: responseUser.name, email: responseUser.
|
|
6546
|
+
email, respondedAt: respondedByApproval.respondedAt, updatedAt: respondedByApproval.updatedAt } : null } });
|
|
6559
6547
|
}
|
|
6560
|
-
__name(getSupplierDetails, "getSupplierDetails"), __name2(
|
|
6561
|
-
getSupplierDetails,
|
|
6562
|
-
"getSupplierDetails"
|
|
6563
|
-
);
|
|
6548
|
+
__name(getSupplierDetails, "getSupplierDetails"), __name2(getSupplierDetails, "getSupplierDetails");
|
|
6564
6549
|
async function approveSupplier(supplierId) {
|
|
6565
6550
|
const supplier = await api2.supplier.getSupplierOverview.query({ id: supplierId });
|
|
6566
6551
|
if (supplier.status === ExtendedApprovalStatus.REJECTED) {
|
|
@@ -6582,7 +6567,11 @@ async function approveSupplier(supplierId) {
|
|
|
6582
6567
|
}
|
|
6583
6568
|
__name(approveSupplier, "approveSupplier"), __name2(approveSupplier, "approveSupplier");
|
|
6584
6569
|
async function rejectSupplier(supplierId, reason) {
|
|
6585
|
-
await assertSensitiveWorkflowConfirmed({
|
|
6570
|
+
await assertSensitiveWorkflowConfirmed({
|
|
6571
|
+
action: "Reject supplier",
|
|
6572
|
+
entity: "supplier ".concat(supplierId),
|
|
6573
|
+
details: 'with reason "'.concat(reason, '" and send requester reply email')
|
|
6574
|
+
});
|
|
6586
6575
|
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];
|
|
6587
6576
|
if (!approval) throw new Error("No pending supplier approval found.");
|
|
6588
6577
|
const result = await api2.supplier.updateSupplierApproval.mutate({ supplierApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
|
|
@@ -6631,10 +6620,13 @@ async function rejectQuotation(quotationId, reason) {
|
|
|
6631
6620
|
out(result);
|
|
6632
6621
|
}
|
|
6633
6622
|
__name(rejectQuotation, "rejectQuotation"), __name2(rejectQuotation, "rejectQuotation");
|
|
6634
|
-
var listCompanies = __name2(
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6623
|
+
var listCompanies = __name2(
|
|
6624
|
+
async (input) => {
|
|
6625
|
+
const result = await api2.company.getCompanies.query(input);
|
|
6626
|
+
out(result);
|
|
6627
|
+
},
|
|
6628
|
+
"listCompanies"
|
|
6629
|
+
), countCompanies = __name2(async (input) => {
|
|
6638
6630
|
const result = await api2.company.getCompanyCounts.query(input);
|
|
6639
6631
|
out(result);
|
|
6640
6632
|
}, "countCompanies");
|
|
@@ -6681,7 +6673,9 @@ var getProjectHubStatus = __name2(async (projectId) => {
|
|
|
6681
6673
|
out(result);
|
|
6682
6674
|
}, "syncProjectHubCommercialDocuments");
|
|
6683
6675
|
async function createProject(opts) {
|
|
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(
|
|
6676
|
+
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(
|
|
6677
|
+
opts.startDate
|
|
6678
|
+
), to: opts.endDate ? new Date(opts.endDate) : void 0 } });
|
|
6685
6679
|
out(result);
|
|
6686
6680
|
}
|
|
6687
6681
|
__name(createProject, "createProject"), __name2(createProject, "createProject");
|
|
@@ -6705,7 +6699,11 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6705
6699
|
out(result);
|
|
6706
6700
|
}, "importQuickBooksProjectId"), listWebhookEventTypes = __name2(async () => {
|
|
6707
6701
|
out(await api2.webhook.listEventTypes.query());
|
|
6708
|
-
}, "listWebhookEventTypes"),
|
|
6702
|
+
}, "listWebhookEventTypes"), listMobilePushDevices = __name2(async () => {
|
|
6703
|
+
out(await api2.mobilePush.listDevices.query({}));
|
|
6704
|
+
}, "listMobilePushDevices"), unregisterMobilePushDevice = __name2(async (sessionId) => {
|
|
6705
|
+
out(await api2.mobilePush.unregisterDevice.mutate({ sessionId }));
|
|
6706
|
+
}, "unregisterMobilePushDevice"), listWebhookEndpoints = __name2(async () => {
|
|
6709
6707
|
out(await api2.webhook.listEndpoints.query());
|
|
6710
6708
|
}, "listWebhookEndpoints"), getWebhookEndpoint = __name2(async (id) => {
|
|
6711
6709
|
out(await api2.webhook.getEndpoint.query({ id }));
|
|
@@ -6728,13 +6726,10 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6728
6726
|
out(await api2.webhook.getDelivery.query({ deliveryId }));
|
|
6729
6727
|
}, "getWebhookDelivery"), replayWebhookDelivery = __name2(async (deliveryId) => {
|
|
6730
6728
|
out(await api2.webhook.replayDelivery.mutate({ deliveryId }));
|
|
6731
|
-
}, "replayWebhookDelivery"), listIntegrationOperations = __name2(
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
},
|
|
6736
|
-
"listIntegrationOperations"
|
|
6737
|
-
), getIntegrationOperation = __name2(async (operationId) => {
|
|
6729
|
+
}, "replayWebhookDelivery"), listIntegrationOperations = __name2(async (input) => {
|
|
6730
|
+
const result = await api2.integration.listOperations.query(input);
|
|
6731
|
+
out(result);
|
|
6732
|
+
}, "listIntegrationOperations"), getIntegrationOperation = __name2(async (operationId) => {
|
|
6738
6733
|
const result = await api2.integration.getOperation.query({ operationId });
|
|
6739
6734
|
out(result);
|
|
6740
6735
|
}, "getIntegrationOperation"), countIntegrationOperations = __name2(async (input) => {
|
|
@@ -6744,19 +6739,20 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6744
6739
|
const result = await api2.integration.retryOperation.mutate({ operationId, confirmExternalStateReconciled, outboundEmailResolution, providerMessageId });
|
|
6745
6740
|
out(result);
|
|
6746
6741
|
}, "retryIntegrationOperation"), reconcileResourceOperation = __name2(async (operationId) => {
|
|
6747
|
-
await assertSensitiveWorkflowConfirmed({
|
|
6742
|
+
await assertSensitiveWorkflowConfirmed({
|
|
6743
|
+
action: "Verify QuickBooks resource outcome",
|
|
6744
|
+
entity: "operation ".concat(operationId),
|
|
6745
|
+
details: "verify the saved receipt or read QuickBooks when the attempt is uncertain, then queue local update/archive/reactivation finalization without repeating the provider mutation"
|
|
6746
|
+
});
|
|
6748
6747
|
const result = await api2.integration.reconcileResourceOperation.mutate({ operationId });
|
|
6749
6748
|
out(result);
|
|
6750
6749
|
}, "reconcileResourceOperation"), listInboundSources = __name2(async (input) => {
|
|
6751
6750
|
const result = await api2.inbound.listSources.query(input);
|
|
6752
6751
|
out(result);
|
|
6753
|
-
}, "listInboundSources"), countInboundSources = __name2(
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
},
|
|
6758
|
-
"countInboundSources"
|
|
6759
|
-
), createInboundSource = __name2(async (input) => {
|
|
6752
|
+
}, "listInboundSources"), countInboundSources = __name2(async (input) => {
|
|
6753
|
+
const result = await api2.inbound.countSources.query(input);
|
|
6754
|
+
out(result);
|
|
6755
|
+
}, "countInboundSources"), createInboundSource = __name2(async (input) => {
|
|
6760
6756
|
const result = await api2.inbound.createSource.mutate(input);
|
|
6761
6757
|
out(result);
|
|
6762
6758
|
}, "createInboundSource"), getInboundSource = __name2(async (sourceId) => {
|
|
@@ -6779,10 +6775,13 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6779
6775
|
}, "saveInboundMappingVersion"), saveInboundAutomationConfig = __name2(async (input) => {
|
|
6780
6776
|
const result = await api2.inbound.saveAutomationConfig.mutate(input);
|
|
6781
6777
|
out(result);
|
|
6782
|
-
}, "saveInboundAutomationConfig"), updateInboundProcessing = __name2(
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6778
|
+
}, "saveInboundAutomationConfig"), updateInboundProcessing = __name2(
|
|
6779
|
+
async (input) => {
|
|
6780
|
+
const result = await api2.inbound.updateProcessing.mutate(input);
|
|
6781
|
+
out(result);
|
|
6782
|
+
},
|
|
6783
|
+
"updateInboundProcessing"
|
|
6784
|
+
);
|
|
6786
6785
|
async function listContacts(companyId) {
|
|
6787
6786
|
const contacts = await api2.contactPerson.getContactPersonByCompanyId.query({ companyId });
|
|
6788
6787
|
out(contacts);
|
|
@@ -6797,10 +6796,7 @@ async function getItem(id) {
|
|
|
6797
6796
|
const item = await api2.item.getItem.query({ id });
|
|
6798
6797
|
out(item);
|
|
6799
6798
|
}
|
|
6800
|
-
__name(getItem, "getItem"), __name2(
|
|
6801
|
-
getItem,
|
|
6802
|
-
"getItem"
|
|
6803
|
-
);
|
|
6799
|
+
__name(getItem, "getItem"), __name2(getItem, "getItem");
|
|
6804
6800
|
var getItemQuickBooksSyncStatus = __name2(async (itemId) => {
|
|
6805
6801
|
const result = await api2.item.getQuickBooksSyncStatus.query({ id: itemId });
|
|
6806
6802
|
out(result);
|
|
@@ -6809,7 +6805,9 @@ var getItemQuickBooksSyncStatus = __name2(async (itemId) => {
|
|
|
6809
6805
|
}, "listItemCategories"), countItemCategories = __name2(async (input) => {
|
|
6810
6806
|
out(await api2.itemCategory.getCounts.query(input));
|
|
6811
6807
|
}, "countItemCategories"), getSupplierAnalytics = __name2(async (input) => {
|
|
6812
|
-
out(await api2.dashboard.getSupplierTableData.query(
|
|
6808
|
+
out(await api2.dashboard.getSupplierTableData.query(
|
|
6809
|
+
input
|
|
6810
|
+
));
|
|
6813
6811
|
}, "getSupplierAnalytics"), countSupplierAnalytics = __name2(async (input) => {
|
|
6814
6812
|
out(await api2.dashboard.getSupplierTableCounts.query(input));
|
|
6815
6813
|
}, "countSupplierAnalytics");
|
|
@@ -6852,10 +6850,7 @@ async function getDashboard(input) {
|
|
|
6852
6850
|
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 });
|
|
6853
6851
|
out(result);
|
|
6854
6852
|
}
|
|
6855
|
-
__name(getDashboard, "getDashboard"), __name2(
|
|
6856
|
-
getDashboard,
|
|
6857
|
-
"getDashboard"
|
|
6858
|
-
);
|
|
6853
|
+
__name(getDashboard, "getDashboard"), __name2(getDashboard, "getDashboard");
|
|
6859
6854
|
async function getMonthlyMetrics(input) {
|
|
6860
6855
|
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 });
|
|
6861
6856
|
out(result);
|
|
@@ -6880,9 +6875,12 @@ var getRecentErrors = __name2(async (input) => {
|
|
|
6880
6875
|
out(await api2.errorLog.getRecentErrors.query(input));
|
|
6881
6876
|
}, "getRecentErrors"), getError = __name2(async (errorId) => {
|
|
6882
6877
|
out(await api2.errorLog.getErrorById.query({ errorId }));
|
|
6883
|
-
}, "getError"), countErrors = __name2(
|
|
6884
|
-
|
|
6885
|
-
|
|
6878
|
+
}, "getError"), countErrors = __name2(
|
|
6879
|
+
async (input) => {
|
|
6880
|
+
out(await api2.errorLog.countErrors.query(input));
|
|
6881
|
+
},
|
|
6882
|
+
"countErrors"
|
|
6883
|
+
);
|
|
6886
6884
|
async function getErrorMetrics() {
|
|
6887
6885
|
const result = await api2.errorLog.getErrorMetrics.query({});
|
|
6888
6886
|
out(result);
|
|
@@ -6925,9 +6923,7 @@ async function getBillReview(billId) {
|
|
|
6925
6923
|
}
|
|
6926
6924
|
__name(getBillReview, "getBillReview"), __name2(getBillReview, "getBillReview");
|
|
6927
6925
|
async function requestBillReview(billId, requestId) {
|
|
6928
|
-
out(await api2.ai.requestBillReview.mutate(
|
|
6929
|
-
{ billId, requestId }
|
|
6930
|
-
));
|
|
6926
|
+
out(await api2.ai.requestBillReview.mutate({ billId, requestId }));
|
|
6931
6927
|
}
|
|
6932
6928
|
__name(requestBillReview, "requestBillReview"), __name2(requestBillReview, "requestBillReview");
|
|
6933
6929
|
function parseLongFlag(arg, next, flags) {
|
|
@@ -6996,131 +6992,110 @@ tionId":"<asana-won-id>","asanaLostSectionId":"<asana-lost-id>","googleCalendarI
|
|
|
6996
6992
|
const help = payloadHelp[command];
|
|
6997
6993
|
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, "'"), ""] : [];
|
|
6998
6994
|
}, "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\
|
|
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([
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
6995
|
+
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([
|
|
6996
|
+
"update-customer-invoice-details",
|
|
6997
|
+
"update-customer-invoice-qbo-drift",
|
|
6998
|
+
"record-external-bill-payment",
|
|
6999
|
+
"approve-bill",
|
|
7000
|
+
"approve-customer-invoice",
|
|
7001
|
+
"approve-supplier",
|
|
7002
|
+
"complete-project",
|
|
7003
|
+
"create-bill",
|
|
7004
|
+
"create-company",
|
|
7005
|
+
"use-existing-company",
|
|
7006
|
+
"create-estimate",
|
|
7007
|
+
"create-placeholder-bill",
|
|
7008
|
+
"create-customer-invoice",
|
|
7009
|
+
"create-item",
|
|
7010
|
+
"create-item-category",
|
|
7011
|
+
"create-project",
|
|
7012
|
+
"create-supplier",
|
|
7013
|
+
"delete-bill",
|
|
7014
|
+
"delete-budget",
|
|
7015
|
+
"delete-company",
|
|
7016
|
+
"delete-customer-invoice",
|
|
7017
|
+
"delete-item",
|
|
7018
|
+
"delete-project",
|
|
7019
|
+
"delete-suppliers",
|
|
7020
|
+
"discard-customer-invoice",
|
|
7021
|
+
"import-qbo-project",
|
|
7022
|
+
"mark-budget-items-not-utilized",
|
|
7023
|
+
"mark-budget-won",
|
|
7024
|
+
"reconcile-project",
|
|
7025
|
+
"reject-customer-invoice",
|
|
7026
|
+
"reactivate-suppliers",
|
|
7027
|
+
"restore-budget-item",
|
|
7028
|
+
"restore-budget-version",
|
|
7029
|
+
"retry-integration-operation",
|
|
7030
|
+
"setup-project-hub",
|
|
7031
|
+
"sync-project-hub-commercial-documents",
|
|
7032
|
+
"sync-customer-invoice",
|
|
7033
|
+
"update-bill",
|
|
7034
|
+
"update-budget-status",
|
|
7035
|
+
"update-company",
|
|
7036
|
+
"update-item",
|
|
7037
|
+
"update-item-category",
|
|
7038
|
+
"update-project",
|
|
7039
|
+
"update-project-status",
|
|
7040
|
+
"update-supplier",
|
|
7041
|
+
"void-customer-invoice"
|
|
7042
|
+
]), financialWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-qbo-drift", "record-external-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-\
|
|
7043
|
+
quotation-attachments", "discard-customer-invoice", "complete-project", "mark-budget-items-not-utilized", "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) => {
|
|
7003
7044
|
const explicit = explicitEffects[legacyTarget];
|
|
7004
7045
|
if (explicit) return explicit;
|
|
7005
7046
|
const effects = /* @__PURE__ */ new Set();
|
|
7006
|
-
return mutationPrefixes.some((prefix) => legacyTarget.startsWith(
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
)).join(" "), "titleCase"), SUMMARIES = /* @__PURE__ */ new Map([
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
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) => {
|
|
7047
|
+
return mutationPrefixes.some((prefix) => legacyTarget.startsWith(
|
|
7048
|
+
prefix
|
|
7049
|
+
)) && 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];
|
|
7050
|
+
}, "effectsFor"), titleCase = __name2((value) => value.split("-").map((word) => "".concat(word.slice(0, 1).toUpperCase()).concat(word.slice(1))).join(" "), "titleCase"), SUMMARIES = /* @__PURE__ */ new Map([["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."], ["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."], ["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."], ["create-budget-approval", "Request budget approval for the current content, superseding older pending requests. Existing Lead/Admin autoapproval remains available."], [
|
|
7051
|
+
"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."], ["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."], ["approve-quotation", "Approve your assigned pending quotation as a current Admin. Claim the captured revision and\
|
|
7052
|
+
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."], ["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>."], ["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."], ["get-pending-approval", "Read one request still \
|
|
7053
|
+
pending your approval, or null if it is no longer pending/assigned. Argument: <approvalId>."], ["get-bill-review", "Read current advisory AI bill review and evidence. Passive; no provider calls. Argument: <billId>."], ["request-bill-review", "Queue an advisory AI review of a bill pending your approval. No financial decision is made. <billId> [--requestId <id>]"], ["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>."], ["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."], ["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 };\
|
|
7054
|
+
follow nextCursor."], ["get-bill-payment", "Get a bill's payment status, reference, date, tracking URL, QuickBooks link and external payment. Argument: <billId>."], ["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>."], ["get-customer-invoice", "Get an invoice batch as \
|
|
7055
|
+
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>."], ["get-customer-invoice-invoices", "List a batch's invoices with QuickBooks id/doc number, issue/due dates, amounts, sync state and sender. Argument: <batchId>."], ["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."], ["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."], ["get-customer-invoice-history", "List an invoice batch's status history (batch/invoice status changes, source, note, actor). <ba\
|
|
7056
|
+
tchId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["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."], ["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."], ["get-bill-attachments", "List bill attachments with cursor pagination. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."], ["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."], ["get-supplier-overview", "Ge\
|
|
7057
|
+
t 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."], ["get-supplier-usage", "Get a supplier's usage rows (accepted/closed budget lines and lines with its actual spending) plus spending, actualSpending and estimatedSpending."], ["get-supplier-items", "Get the inventory items catalogued under a supplier."], ["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."],
|
|
7058
|
+
["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)"], ["list-claims", "List reimbursable claims with cursor pagination. Same flags as list-bills (--limit 1-100, --cursor, --direction forward|backward); ignores --isClaimable. Returns { items, pageInfo }."], ["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."], ["list-customer-invoices", "List customer invoice batches with cursor pagination. [budgetId] [--projectId <id>]\
|
|
7059
|
+
[--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."], ["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 \
|
|
7060
|
+
remains an alias for --createdBy."], ["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."], ["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."], ["count-companies", "Count companies independently from list pagination. Returns { totalCount, counts: { active: { true, false } } }; accepts filters only and rejects pagination/sorting flags."], ["list-projects", "List projects with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descen\
|
|
7061
|
+
ding 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."], ["count-projects", "Count projects independently from list pagination. Returns { totalCount, counts: { status, active: { true, false } } }; accepts project filters only and rejects pagination/sorting flags."], ["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."], ["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 f\
|
|
7062
|
+
rom 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."], ["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."], ["create-project", "Create a project linked to an existing Asana Deals lead task. Supply --asanaT\
|
|
7063
|
+
askId 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."], ["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."], ["preview-qbo-customer-invoice", "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId> [--confirmEstimateLineage true]. Use --confirmEstimateLineage only after confirming an invoice with no QuickBooks est\
|
|
7064
|
+
imate link belongs to this budget's estimate."], ["preview-customer-invoice-amount", "Preview amount before GST, GST, and total for a percentage of an accepted estimate. Arguments: <budgetId> <percentage-of-estimate>."], ["list-available-qbo-customer-invoices", "List unlinked QuickBooks invoices available for an accepted or closed estimate. Argument: <budgetId>."], ["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."], ["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."], ["import-qbo-customer-invoice", "Link an existing QuickBooks invoice in BB only after reviewing preview-q\
|
|
7065
|
+
bo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken> [--confirmEstimateLineage true] (repeat the preview's flag). Supports closed estimates; no QBO writes or emails."], ["whoami", "Show the active API-key identity."], ["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."], ["list-items", "List one cursor page of catalogue items ({ items, pageInfo }; --limit/--cursor/--direction, optional --sortBy/--sortDir). --page/--perPage are rejected."], ["list-item-categories", "List one cursor page of active item categories ({ items, pageInfo }; --limit/--cursor/--direction, optional --name/--sortBy/--sortDir). --page/--perPage are rejected."], ["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, op\
|
|
7066
|
+
erationId); the request makes no QuickBooks call."], ["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."], ["count-item-categories", "Count active item categories matching --name: { totalCount }."], ["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."], ["list-integration-operations", "List one cursor page of integration operations, newest first ({ items, pageInfo }; --limit/--cursor/--direction). --page/--perPage are rejected. Admin only."], ["count-integration-operations", "Provider filter options for integration operations: { filterOptions }. No total; filter flags are accepted but do not change the result. Admin o\
|
|
7067
|
+
nly."], ["count-items", "Count catalogue items matching filters: total plus category and supplier facets (each ignores its own filter)."], ["count-budgets", "Count budgets matching filters: totalCount plus status and active facets. Omit --active for active budgets only."], ["get-budget", "Get a budget by ID. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."], ["get-budget-items", "Get line items for a budget. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."], ["get-budget-details", "Get budget details. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."], ["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\
|
|
7068
|
+
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 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 val\
|
|
7069
|
+
id bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."], ["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."], ["mark-customer-invoice-sent-\
|
|
7070
|
+
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>]."], ["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."], ["refresh-external-payment-accounts",
|
|
7071
|
+
"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."], ["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; upda\
|
|
7072
|
+
tes 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. 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."], ["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,\
|
|
7073
|
+
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 one still counts as unquoted."], ["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. Amo\
|
|
7074
|
+
unts 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); 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,\
|
|
7075
|
+
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.'], ["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>."], ["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\
|
|
7076
|
+
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 with 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.'], ["download-customer-invoice-pdf",
|
|
7077
|
+
"Download a customer invoice PDF when permitted."], ["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."], ["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."], ["get-company-quickbooks-sync-status", "Read saved company synchronization status without provider calls or polling; use companyId."], ["get-item-quickbooks-sync-status", "Read saved item QuickBooks synchronization status without provider calls or polling; use itemId."], ["create-webhook-endpoint", "Admin-only: subscribe an HTTPS endpoint to BB events. --name --url --events <type|pref\
|
|
7078
|
+
ix.*|*,...>. Prints the whsec_ signing secret once; deliveries use Standard Webhooks headers."], ["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>."], ["send-webhook-test-event", "Admin-only: send a signed webhook.test event to one endpoint. Argument: <endpointId>."], ["replay-webhook-delivery", "Admin-only: resend a finished webhook delivery with the same eventId on a fresh attempt chain. Argument: <deliveryId>."], ["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."], ["get-webhook-delivery", "Admin-only: one webhook delivery with payload and attempts (status codes, errors, durations). Argument: <deliveryId>."], ["list-webhook-event-types", "List the outbound webhook event catalogue with group and live/pla\
|
|
7079
|
+
nned status."], ["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>."], ["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>."], ["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>."]]), summaryFor = __name2((legacyTarget) => {
|
|
7110
7080
|
const summary = SUMMARIES.get(legacyTarget);
|
|
7111
7081
|
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), ".");
|
|
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(
|
|
7113
|
-
|
|
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 = [
|
|
7082
|
+
}, "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(legacyTarget), 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,
|
|
7083
|
+
effects: [], load: __name2(async () => async () => ({}), "load") }), "authCommand"), registry2 = [
|
|
7115
7084
|
authCommand("login", "Authorize this device through Budget Builder in your browser."),
|
|
7116
7085
|
authCommand("status", "Show the active CLI authentication method and session status."),
|
|
7117
7086
|
authCommand("logout", "Revoke the interactive CLI session and remove its local credential."),
|
|
7118
7087
|
legacyCommand("whoami", ["auth", "whoami"]),
|
|
7088
|
+
{ path: ["mobile-push", "status"], legacyAliases: [], summary: "Show push availability and your active Android push registrations.", options: globalCommandOptions, effects: [], legacyTarget: "mobile-push-status" },
|
|
7089
|
+
{ path: ["mobile-push", "unregister"], legacyAliases: [], summary: "Unregister notifications for one of your active Android devices. Argument: <sessionId>.", options: globalCommandOptions, effects: ["state-change"], legacyTarget: "mobile-push-unregister" },
|
|
7119
7090
|
legacyCommand("list-budgets", ["budget", "list"], [], [{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }, { 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." }]),
|
|
7120
7091
|
legacyCommand("count-budgets", ["budget", "count"], [], [{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }]),
|
|
7121
7092
|
legacyCommand("get-budget", ["budget", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
|
|
7122
7093
|
legacyCommand("upload-budget-attachment", ["budget", "attachment", "upload"]),
|
|
7123
|
-
legacyCommand("mark-budget-won", [
|
|
7094
|
+
legacyCommand("mark-budget-won", [
|
|
7095
|
+
"budget",
|
|
7096
|
+
"won",
|
|
7097
|
+
"mark"
|
|
7098
|
+
]),
|
|
7124
7099
|
legacyCommand("get-budget-items", ["budget", "item", "list"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
|
|
7125
7100
|
legacyCommand("get-budget-details", ["budget", "detail", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
|
|
7126
7101
|
legacyCommand("get-budget-categories", ["budget", "category", "list"], [], [{ name: "--q <text>", description: "Search active category names (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { 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." }]),
|
|
@@ -7155,17 +7130,14 @@ th amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts; default false require
|
|
|
7155
7130
|
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." }]),
|
|
7156
7131
|
legacyCommand("count-bills", ["bill", "count"]),
|
|
7157
7132
|
legacyCommand("count-claims", ["claim", "count"]),
|
|
7158
|
-
legacyCommand("create-bill-approval", ["bill", "approval", "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." }]),
|
|
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." }]),
|
|
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." }]),
|
|
7165
7133
|
legacyCommand(
|
|
7166
|
-
"
|
|
7167
|
-
["bill", "
|
|
7134
|
+
"create-bill-approval",
|
|
7135
|
+
["bill", "approval", "create"]
|
|
7168
7136
|
),
|
|
7137
|
+
legacyCommand("create-bill", ["bill", "create"], [], [{ name: "--draft-only", description: "Create a draft for every role; no approval, email, or QuickBooks writes. Conflicts with alreadyPaid: true." }, { name: "--quotation-exempt", description: "Explicitly request an eligible server-validated supplier-bill quotation exemption. Cannot be combined with quotation IDs." }]),
|
|
7138
|
+
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." }]),
|
|
7139
|
+
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." }]),
|
|
7140
|
+
legacyCommand("update-bill", ["bill", "update"]),
|
|
7169
7141
|
legacyCommand("update-bill-payment-evidence", ["bill", "payment-evidence", "update"]),
|
|
7170
7142
|
legacyCommand("delete-bill", ["bill", "delete"]),
|
|
7171
7143
|
legacyCommand("update-bill-status", ["bill", "status", "update"]),
|
|
@@ -7176,10 +7148,7 @@ th amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts; default false require
|
|
|
7176
7148
|
legacyCommand("patch-bill-invoice-number", ["bill", "invoice-number", "patch"]),
|
|
7177
7149
|
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." }]),
|
|
7178
7150
|
legacyCommand("stage-bill-attachment", ["bill", "attachment", "stage"]),
|
|
7179
|
-
legacyCommand(
|
|
7180
|
-
"cleanup-staged-bill-attachments",
|
|
7181
|
-
["bill", "attachment", "staged", "cleanup"]
|
|
7182
|
-
),
|
|
7151
|
+
legacyCommand("cleanup-staged-bill-attachments", ["bill", "attachment", "staged", "cleanup"]),
|
|
7183
7152
|
legacyCommand("upload-bill-attachment", ["bill", "attachment", "upload"], ["attach-bill-attachment"]),
|
|
7184
7153
|
legacyCommand("attach-bill-payment-receipt", ["bill", "payment-receipt", "attach"]),
|
|
7185
7154
|
legacyCommand("attach-bill-documents", ["bill", "document", "attach"]),
|
|
@@ -7237,12 +7206,12 @@ th amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts; default false require
|
|
|
7237
7206
|
legacyCommand("approve-budget", ["budget", "approve"]),
|
|
7238
7207
|
legacyCommand("reject-budget", ["budget", "reject"]),
|
|
7239
7208
|
legacyCommand("approve-supplier", ["supplier", "approve"]),
|
|
7240
|
-
legacyCommand("reject-supplier", ["supplier", "reject"]),
|
|
7241
|
-
legacyCommand("get-supplier-details", ["supplier", "detail", "get"]),
|
|
7242
7209
|
legacyCommand(
|
|
7243
|
-
"
|
|
7244
|
-
["supplier", "
|
|
7210
|
+
"reject-supplier",
|
|
7211
|
+
["supplier", "reject"]
|
|
7245
7212
|
),
|
|
7213
|
+
legacyCommand("get-supplier-details", ["supplier", "detail", "get"]),
|
|
7214
|
+
legacyCommand("get-supplier-overview", ["supplier", "overview", "get"]),
|
|
7246
7215
|
legacyCommand("get-supplier-usage", ["supplier", "usage", "get"]),
|
|
7247
7216
|
legacyCommand("get-supplier-items", ["supplier", "items", "get"]),
|
|
7248
7217
|
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." }]),
|
|
@@ -7276,7 +7245,12 @@ sor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "
|
|
|
7276
7245
|
legacyCommand("update-contact-person", ["contact", "update"]),
|
|
7277
7246
|
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\
|
|
7278
7247
|
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." }]),
|
|
7279
|
-
legacyCommand(
|
|
7248
|
+
legacyCommand(
|
|
7249
|
+
"count-suppliers",
|
|
7250
|
+
["supplier", "count"],
|
|
7251
|
+
[],
|
|
7252
|
+
[{ 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." }]
|
|
7253
|
+
),
|
|
7280
7254
|
legacyCommand("create-supplier", ["supplier", "create"]),
|
|
7281
7255
|
legacyCommand("update-supplier", ["supplier", "update"]),
|
|
7282
7256
|
legacyCommand("delete-suppliers", ["supplier", "delete"]),
|
|
@@ -7290,7 +7264,10 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7290
7264
|
legacyCommand("list-items", ["item", "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." }]),
|
|
7291
7265
|
legacyCommand("count-items", ["item", "count"]),
|
|
7292
7266
|
legacyCommand("get-item", ["item", "get"]),
|
|
7293
|
-
legacyCommand(
|
|
7267
|
+
legacyCommand(
|
|
7268
|
+
"get-item-quickbooks-sync-status",
|
|
7269
|
+
["item", "sync", "status"]
|
|
7270
|
+
),
|
|
7294
7271
|
legacyCommand("create-item", ["item", "create"]),
|
|
7295
7272
|
legacyCommand("update-item", ["item", "update"]),
|
|
7296
7273
|
legacyCommand("archive-items", ["item", "archive"]),
|
|
@@ -7300,7 +7277,12 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7300
7277
|
legacyCommand("create-item-category", ["item", "category", "create"]),
|
|
7301
7278
|
legacyCommand("update-item-category", ["item", "category", "update"]),
|
|
7302
7279
|
legacyCommand("delete-item-categories", ["item", "category", "delete"]),
|
|
7303
|
-
legacyCommand(
|
|
7280
|
+
legacyCommand(
|
|
7281
|
+
"list-users",
|
|
7282
|
+
["user", "list"],
|
|
7283
|
+
[],
|
|
7284
|
+
[{ name: "--q <text>", description: "Search user names and emails (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--projectTeamOnly <true|false>", description: "true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager." }, { 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." }]
|
|
7285
|
+
),
|
|
7304
7286
|
legacyCommand("count-users", ["user", "count"]),
|
|
7305
7287
|
legacyCommand("create-user", ["user", "create"]),
|
|
7306
7288
|
legacyCommand("create-api-key", ["user", "api-key", "create"]),
|
|
@@ -7308,10 +7290,7 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7308
7290
|
legacyCommand("revoke-api-key", ["user", "api-key", "revoke"]),
|
|
7309
7291
|
legacyCommand("get-user-performance", ["user", "performance", "get"]),
|
|
7310
7292
|
legacyCommand("get-dashboard", ["dashboard", "get"]),
|
|
7311
|
-
legacyCommand(
|
|
7312
|
-
"get-monthly-metrics",
|
|
7313
|
-
["dashboard", "monthly-metrics", "get"]
|
|
7314
|
-
),
|
|
7293
|
+
legacyCommand("get-monthly-metrics", ["dashboard", "monthly-metrics", "get"]),
|
|
7315
7294
|
legacyCommand("get-system-overview", ["dashboard", "system-overview", "get"]),
|
|
7316
7295
|
legacyCommand("get-estimate-performance", ["dashboard", "estimate-performance", "get"]),
|
|
7317
7296
|
legacyCommand("get-financial-overview", ["dashboard", "financial-overview", "get"]),
|
|
@@ -7350,10 +7329,7 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7350
7329
|
legacyCommand("get-budget-category-benchmarks", ["budget", "category", "benchmark", "get"]),
|
|
7351
7330
|
legacyCommand("get-item-pricing-history", ["item", "pricing-history", "list"]),
|
|
7352
7331
|
legacyCommand("get-supplier-pricing-history", ["supplier", "pricing-history", "list"])
|
|
7353
|
-
], normalizeToken = __name2((value) => value.replaceAll("_", "-"), "normalizeToken"), normalizedPath = __name2(
|
|
7354
|
-
(path2) => path2.map(normalizeToken),
|
|
7355
|
-
"normalizedPath"
|
|
7356
|
-
), assertRegistry = __name2((commands) => {
|
|
7332
|
+
], normalizeToken = __name2((value) => value.replaceAll("_", "-"), "normalizeToken"), normalizedPath = __name2((path2) => path2.map(normalizeToken), "normalizedPath"), assertRegistry = __name2((commands) => {
|
|
7357
7333
|
const paths = /* @__PURE__ */ new Set(), aliases = /* @__PURE__ */ new Set();
|
|
7358
7334
|
for (const command of commands) {
|
|
7359
7335
|
const path2 = command.path.join(" ");
|
|
@@ -7371,41 +7347,61 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7371
7347
|
}, "assertRegistry");
|
|
7372
7348
|
assertRegistry(registry2);
|
|
7373
7349
|
var commandRegistry = registry2, resolveCommand = __name2((argv) => {
|
|
7374
|
-
const normalizedArgv = argv.map(normalizeToken), canonical = [...commandRegistry].sort((left, right) => right.path.length - left.path.length).find((command) => normalizedPath(
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
), invokedAs: argv.slice(0, canonical.path.length), isLegacyAlias: !1 };
|
|
7350
|
+
const normalizedArgv = argv.map(normalizeToken), canonical = [...commandRegistry].sort((left, right) => right.path.length - left.path.length).find((command) => normalizedPath(
|
|
7351
|
+
command.path
|
|
7352
|
+
).every((segment, index) => normalizedArgv[index] === segment));
|
|
7353
|
+
if (canonical) return { command: canonical, argv: argv.slice(canonical.path.length), invokedAs: argv.slice(0, canonical.path.length), isLegacyAlias: !1 };
|
|
7378
7354
|
const rawAlias = argv[0];
|
|
7379
7355
|
if (!rawAlias) return;
|
|
7380
7356
|
const normalizedAlias = normalizeToken(rawAlias), legacy = commandRegistry.find((command) => command.legacyAliases.some((alias) => normalizeToken(alias) === normalizedAlias));
|
|
7381
7357
|
if (legacy) return { command: legacy, argv: argv.slice(1), invokedAs: [rawAlias], isLegacyAlias: !0 };
|
|
7382
7358
|
}, "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) => {
|
|
7383
|
-
if (command) return [
|
|
7359
|
+
if (command) return [
|
|
7360
|
+
updateBeforeUse,
|
|
7361
|
+
"",
|
|
7362
|
+
"Usage: bb ".concat(command.path.join(" "), " [options] [args]"),
|
|
7363
|
+
"",
|
|
7364
|
+
command.summary,
|
|
7365
|
+
"",
|
|
7366
|
+
"Legacy aliases: ".concat(command.legacyAliases.join(", ")),
|
|
7367
|
+
"",
|
|
7368
|
+
"Options",
|
|
7369
|
+
...command.options.map((option) => " ".concat(option.name, "\n ").concat(option.description)),
|
|
7370
|
+
"",
|
|
7371
|
+
...formatPayloadHelp(command.legacyTarget ?? ""),
|
|
7372
|
+
"Use `bb help --legacy` for additional command arguments."
|
|
7373
|
+
].join("\n");
|
|
7384
7374
|
const lines = commandRegistry.map((command2) => {
|
|
7385
7375
|
const canonical = "bb ".concat(command2.path.join(" ")), aliases = command2.legacyAliases.filter((alias) => alias.includes("-")).map((alias) => "bb ".concat(alias)).join(", ");
|
|
7386
7376
|
return " ".concat(canonical, "\n ").concat(command2.summary).concat(aliases ? " Legacy: ".concat(aliases, ".") : "");
|
|
7387
7377
|
});
|
|
7388
7378
|
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");
|
|
7389
|
-
}, "createHumanHelp"), completionWords = __name2(
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
for (const
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7379
|
+
}, "createHumanHelp"), completionWords = __name2(
|
|
7380
|
+
() => {
|
|
7381
|
+
const words = /* @__PURE__ */ new Set();
|
|
7382
|
+
for (const command of commandRegistry) {
|
|
7383
|
+
for (const segment of command.path) words.add(segment);
|
|
7384
|
+
for (const alias of command.legacyAliases) words.add(alias);
|
|
7385
|
+
}
|
|
7386
|
+
return words.add("help"), words.add("version"), words.add("completion"), [...words].sort();
|
|
7387
|
+
},
|
|
7388
|
+
"completionWords"
|
|
7389
|
+
), createCompletionScript = __name2(
|
|
7390
|
+
(shell) => {
|
|
7391
|
+
const words = completionWords().join(" ");
|
|
7392
|
+
switch (shell) {
|
|
7393
|
+
case "bash":
|
|
7394
|
+
return "# bash completion for bb\n_bb() {\n COMPREPLY=( $(compgen -W '".concat(words, '\' -- "${COMP_WORDS[COMP_CWORD]}") )\n}\ncomplete -F _bb bb\n');
|
|
7395
|
+
case "zsh":
|
|
7396
|
+
return "#compdef bb\n_bb() {\n local -a commands\n commands=(".concat(words, ")\n _describe 'bb command' commands\n}\ncompdef _bb bb\n");
|
|
7397
|
+
case "fish":
|
|
7398
|
+
return completionWords().map((word) => "complete -c bb -f -a '".concat(word, "'")).join("\n").concat("\n");
|
|
7399
|
+
case "powershell":
|
|
7400
|
+
return "Register-ArgumentCompleter -Native -CommandName bb -ScriptBlock {\n param($wordToComplete)\n '".concat(words, "'.Split(' ') | Where-Object { $_ -like \"$wordToComplete*\" }\n}\n");
|
|
7401
|
+
}
|
|
7402
|
+
},
|
|
7403
|
+
"createCompletionScript"
|
|
7404
|
+
), SUPPLIER_ANALYTICS_SORT_IDS = ["name", "gstRegistered", "status", "phone", "email", "updatedAt", "createdAt"];
|
|
7409
7405
|
function parsePositiveIntFlag(value, flagName) {
|
|
7410
7406
|
if (value === void 0) return;
|
|
7411
7407
|
const parsed = Number.parseInt(String(value), 10);
|
|
@@ -7434,15 +7430,17 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
|
|
|
7434
7430
|
if (value === void 0) return "forward";
|
|
7435
7431
|
if (value !== "forward" && value !== "backward") throw new Error('--direction must be "forward" or "backward".');
|
|
7436
7432
|
return value;
|
|
7437
|
-
}, "parseCompanyDirection"), parseCompanyListFlags = __name2(
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
rejectBareFlag(flags, key);
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
},
|
|
7433
|
+
}, "parseCompanyDirection"), parseCompanyListFlags = __name2(
|
|
7434
|
+
(flags) => {
|
|
7435
|
+
rejectCompanyPageFlags(flags, "list");
|
|
7436
|
+
for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7437
|
+
const cursor = getFlag(flags, "cursor"), direction = parseCompanyDirection(getFlag(flags, "direction"));
|
|
7438
|
+
if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
|
|
7439
|
+
if (cursor === "") throw new Error("--cursor requires a non-empty token.");
|
|
7440
|
+
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")) };
|
|
7441
|
+
},
|
|
7442
|
+
"parseCompanyListFlags"
|
|
7443
|
+
), parseCompanyCountFlags = __name2((flags) => {
|
|
7446
7444
|
rejectCompanyPageFlags(flags, "count");
|
|
7447
7445
|
for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7448
7446
|
if (flags.limit !== void 0 || flags.cursor !== void 0 || flags.direction !== void 0) throw new Error("company count does not accept list pagination flags.");
|
|
@@ -7463,16 +7461,17 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
|
|
|
7463
7461
|
if (value === void 0) return "desc";
|
|
7464
7462
|
if (!PROJECT_SORT_DIRECTIONS.includes(value)) throw new Error('Invalid --sortDir "'.concat(value, '". Use one of: ').concat(PROJECT_SORT_DIRECTIONS.join(", "), "."));
|
|
7465
7463
|
return value;
|
|
7466
|
-
}, "parseProjectSortDir"), parseProjectWonWithinDays = __name2(
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7464
|
+
}, "parseProjectSortDir"), parseProjectWonWithinDays = __name2(
|
|
7465
|
+
(value) => {
|
|
7466
|
+
if (value === void 0) return;
|
|
7467
|
+
const parsed = Number(value);
|
|
7468
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 3650) throw new Error("--wonWithinDays must be an integer from 1 to 3650.");
|
|
7469
|
+
return parsed;
|
|
7470
|
+
},
|
|
7471
|
+
"parseProjectWonWithinDays"
|
|
7472
|
+
), parseProjectDirection = __name2((value) => {
|
|
7472
7473
|
if (value === void 0) return "forward";
|
|
7473
|
-
if (value !== "forward" && value !== "backward") throw new Error(
|
|
7474
|
-
'--direction must be "forward" or "backward".'
|
|
7475
|
-
);
|
|
7474
|
+
if (value !== "forward" && value !== "backward") throw new Error('--direction must be "forward" or "backward".');
|
|
7476
7475
|
return value;
|
|
7477
7476
|
}, "parseProjectDirection"), parseProjectListFlags = __name2((flags) => {
|
|
7478
7477
|
rejectProjectPageFlags(flags, "list");
|
|
@@ -7480,17 +7479,19 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
|
|
|
7480
7479
|
const cursor = getFlag(flags, "cursor"), direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7481
7480
|
if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
|
|
7482
7481
|
if (cursor === "") throw new Error("--cursor requires a non-empty token.");
|
|
7483
|
-
return { companyId: getFlag(flags, "companyId"), name: getFlag(flags, "name"), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(
|
|
7484
|
-
|
|
7485
|
-
"
|
|
7486
|
-
|
|
7487
|
-
), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseProjectSortBy(getFlag(flags, "sortBy")), sortDir: parseProjectSortDir(getFlag(flags, "sortDir")) };
|
|
7482
|
+
return { companyId: getFlag(flags, "companyId"), name: getFlag(flags, "name"), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(
|
|
7483
|
+
flags,
|
|
7484
|
+
"active"
|
|
7485
|
+
), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(getFlag(flags, "wonTo"), "--wonTo", { endOfDay: !0 }), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseProjectSortBy(getFlag(flags, "sortBy")), sortDir: parseProjectSortDir(getFlag(flags, "sortDir")) };
|
|
7488
7486
|
}, "parseProjectListFlags"), parseProjectCountFlags = __name2((flags) => {
|
|
7489
7487
|
rejectProjectPageFlags(flags, "count");
|
|
7490
7488
|
for (const key of ["companyId", "name", "status", "statuses", "active", "wonFrom", "wonTo", "wonWithinDays", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7491
7489
|
if (flags.limit !== void 0 || flags.cursor !== void 0 || flags.direction !== void 0) throw new Error("project count does not accept list pagination flags.");
|
|
7492
7490
|
if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("project count does not accept list sorting flags.");
|
|
7493
|
-
return { companyId: getFlag(flags, "companyId"), name: getFlag(
|
|
7491
|
+
return { companyId: getFlag(flags, "companyId"), name: getFlag(
|
|
7492
|
+
flags,
|
|
7493
|
+
"name"
|
|
7494
|
+
), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(flags, "active"), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(getFlag(flags, "wonTo"), "--wonTo", { endOfDay: !0 }), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")) };
|
|
7494
7495
|
}, "parseProjectCountFlags");
|
|
7495
7496
|
function parseOptionalBoolFlag(flags, key) {
|
|
7496
7497
|
const v = flags[key];
|
|
@@ -7507,7 +7508,8 @@ function parseBudgetActiveFlag(flags) {
|
|
|
7507
7508
|
if (raw === !0) throw new Error("--active requires true, false, or all.");
|
|
7508
7509
|
const value = String(raw).toLowerCase();
|
|
7509
7510
|
if (value === "all") return "all";
|
|
7510
|
-
if (value === "true" || value === "1")
|
|
7511
|
+
if (value === "true" || value === "1")
|
|
7512
|
+
return !0;
|
|
7511
7513
|
if (value === "false" || value === "0") return !1;
|
|
7512
7514
|
throw new Error("--active must be true, false, or all.");
|
|
7513
7515
|
}
|
|
@@ -7529,8 +7531,7 @@ function parseCommercialRejectionProjectStatus(flags) {
|
|
|
7529
7531
|
}
|
|
7530
7532
|
__name(parseCommercialRejectionProjectStatus, "parseCommercialRejectionProjectStatus"), __name2(parseCommercialRejectionProjectStatus, "parseCommercialRejectionProjectStatus");
|
|
7531
7533
|
var rejectRetiredPageFlags = __name2((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."));
|
|
7534
|
+
for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is retired; use --limit/--cursor, or the matching count command for totals."));
|
|
7534
7535
|
}, "rejectRetiredPageFlags"), parseDetailFeedPage = __name2((command, idLabel, positional, flags, maxLimit) => {
|
|
7535
7536
|
const id = positional[0];
|
|
7536
7537
|
if (!id) throw new Error("".concat(command, " requires ").concat(idLabel));
|
|
@@ -7547,7 +7548,9 @@ var rejectRetiredPageFlags = __name2((flags) => {
|
|
|
7547
7548
|
return { projectId: getFlag(flags, "projectId"), budgetId: getFlag(flags, "budgetId"), statuses: parseCommaSeparatedBillStatuses(statusRaw !== void 0 ? String(statusRaw) : void 0), search: searchRaw !== void 0 ? String(searchRaw) : void 0, isClaimable: parseOptionalBoolFlag(flags, "isClaimable"), createdByIds: parseCommaSeparatedIds(createdByIdsRaw !== void 0 ? String(createdByIdsRaw) : void 0) };
|
|
7548
7549
|
}, "parseBillFilterFlags"), parseQuotationFilterFlags = __name2((flags) => {
|
|
7549
7550
|
const createdByRaw = getFlag(flags, "createdBy") ?? getFlag(flags, "requesterIds"), searchRaw = getFlag(flags, "search");
|
|
7550
|
-
return { projectId: getFlag(flags, "projectId"), budgetId: getFlag(flags, "budgetId"), supplierId: getFlag(flags, "supplierId"), status: parseCommaSeparatedQuotationStatuses(
|
|
7551
|
+
return { projectId: getFlag(flags, "projectId"), budgetId: getFlag(flags, "budgetId"), supplierId: getFlag(flags, "supplierId"), status: parseCommaSeparatedQuotationStatuses(
|
|
7552
|
+
getFlag(flags, "status")
|
|
7553
|
+
), createdBy: parseCommaSeparatedIds(createdByRaw), search: searchRaw !== void 0 && String(searchRaw).trim() || void 0 };
|
|
7551
7554
|
}, "parseQuotationFilterFlags");
|
|
7552
7555
|
function parseListBillsFlags(flags) {
|
|
7553
7556
|
rejectRetiredPageFlags(flags);
|
|
@@ -7558,16 +7561,13 @@ function parseListBillsFlags(flags) {
|
|
|
7558
7561
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
7559
7562
|
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 };
|
|
7560
7563
|
}
|
|
7561
|
-
__name(parseListBillsFlags, "parseListBillsFlags"), __name2(
|
|
7564
|
+
__name(parseListBillsFlags, "parseListBillsFlags"), __name2(
|
|
7565
|
+
parseListBillsFlags,
|
|
7566
|
+
"parseListBillsFlags"
|
|
7567
|
+
);
|
|
7562
7568
|
function parseCountBillsFlags(flags) {
|
|
7563
7569
|
rejectRetiredPageFlags(flags);
|
|
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."));
|
|
7570
|
+
for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("bill count does not accept --".concat(key, "; totals use filters only."));
|
|
7571
7571
|
return { ...parseBillFilterFlags(flags), includeMetrics: parseOptionalBoolFlag(flags, "includeMetrics") ?? !1 };
|
|
7572
7572
|
}
|
|
7573
7573
|
__name(parseCountBillsFlags, "parseCountBillsFlags"), __name2(parseCountBillsFlags, "parseCountBillsFlags");
|
|
@@ -7580,11 +7580,11 @@ function parseOptionalSupplierSortBy(raw) {
|
|
|
7580
7580
|
}
|
|
7581
7581
|
__name(parseOptionalSupplierSortBy, "parseOptionalSupplierSortBy"), __name2(parseOptionalSupplierSortBy, "parseOptionalSupplierSortBy");
|
|
7582
7582
|
var parseSupplierFilters = __name2((flags) => {
|
|
7583
|
-
for (const key of ["name", "createdBy", "gstRegistered", "status", "supplierTags", "active"]) rejectBareFlag(
|
|
7584
|
-
return { name: getFlag(flags, "name"), createdBy: parseCommaSeparatedIds(getFlag(flags, "createdBy")), gstRegistered: parseOptionalBoolFlag(
|
|
7583
|
+
for (const key of ["name", "createdBy", "gstRegistered", "status", "supplierTags", "active"]) rejectBareFlag(
|
|
7585
7584
|
flags,
|
|
7586
|
-
|
|
7587
|
-
)
|
|
7585
|
+
key
|
|
7586
|
+
);
|
|
7587
|
+
return { name: getFlag(flags, "name"), createdBy: parseCommaSeparatedIds(getFlag(flags, "createdBy")), gstRegistered: parseOptionalBoolFlag(flags, "gstRegistered") ?? null, status: parseCommaSeparatedSupplierStatuses(getFlag(flags, "status")), supplierTags: parseCommaSeparatedIds(getFlag(flags, "supplierTags")), active: parseOptionalBoolFlag(flags, "active") ?? !0 };
|
|
7588
7588
|
}, "parseSupplierFilters"), rejectSupplierPageFlags = __name2((flags) => {
|
|
7589
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."));
|
|
7590
7590
|
}, "rejectSupplierPageFlags"), parseSupplierListSortEntries = __name2((sortRaw) => {
|
|
@@ -7620,10 +7620,9 @@ var parseSupplierFilters = __name2((flags) => {
|
|
|
7620
7620
|
}, "parseCountSuppliersFlags");
|
|
7621
7621
|
function parseDashboardQueryFlags(flags) {
|
|
7622
7622
|
const roleRaw = getFlag(flags, "role"), timeFrameRaw = getFlag(flags, "timeFrame");
|
|
7623
|
-
return { userId: getFlag(flags, "userId"), role: parseOptionalDashboardRole(roleRaw !== void 0 ? String(roleRaw) : void 0), deals: parseOptionalDeals(
|
|
7624
|
-
flags,
|
|
7625
|
-
|
|
7626
|
-
), endDate: getFlag(flags, "endDate") };
|
|
7623
|
+
return { userId: getFlag(flags, "userId"), role: parseOptionalDashboardRole(roleRaw !== void 0 ? String(roleRaw) : void 0), deals: parseOptionalDeals(
|
|
7624
|
+
getFlag(flags, "deals")
|
|
7625
|
+
), timeFrame: parseOptionalTimeFrame(timeFrameRaw !== void 0 ? String(timeFrameRaw) : void 0), startDate: getFlag(flags, "startDate"), endDate: getFlag(flags, "endDate") };
|
|
7627
7626
|
}
|
|
7628
7627
|
__name(parseDashboardQueryFlags, "parseDashboardQueryFlags"), __name2(parseDashboardQueryFlags, "parseDashboardQueryFlags");
|
|
7629
7628
|
function printLegacyHelp(runtime) {
|
|
@@ -7705,7 +7704,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7705
7704
|
continue;
|
|
7706
7705
|
}
|
|
7707
7706
|
if (isRuntimeOnlyArgument(value)) {
|
|
7708
|
-
booleanFlagValues.has(
|
|
7707
|
+
booleanFlagValues.has(
|
|
7708
|
+
argv[index + 1] ?? ""
|
|
7709
|
+
) && index++;
|
|
7709
7710
|
continue;
|
|
7710
7711
|
}
|
|
7711
7712
|
commandArgv.push(value);
|
|
@@ -7716,29 +7717,33 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7716
7717
|
const legacyTarget = resolvedCommand.command.legacyTarget;
|
|
7717
7718
|
if (legacyTarget === void 0) throw new CliRuntimeError("INTERNAL", "Command ".concat(resolvedCommand.command.path.join(" "), " has no dispatcher target."));
|
|
7718
7719
|
return [argv[0] ?? "node", argv[1] ?? "bb", legacyTarget, ...resolvedCommand.argv.filter((value) => !isRuntimeOnlyArgument(value))];
|
|
7719
|
-
}, "legacyArgvForCommand"), normalizeDispatcherError = __name2(
|
|
7720
|
+
}, "legacyArgvForCommand"), normalizeDispatcherError = __name2(
|
|
7721
|
+
(error2) => error2 instanceof Error && new __cliRegExp("\\brequires\\b|\\bmust be\\b|\\bmust include\\b|^Invalid\\b|^Missing\\b|^--", "").test(error2.message) ? new CliRuntimeError("VALIDATION", error2.message) : error2,
|
|
7722
|
+
"normalizeDispatcherError"
|
|
7723
|
+
), commandConfirmationTarget = __name2((resolvedCommand) => {
|
|
7720
7724
|
const positionalTarget = resolvedCommand.argv.find((value) => value !== "--" && !value.startsWith("-"));
|
|
7721
7725
|
return positionalTarget !== void 0 && !positionalTarget.startsWith("{") && !positionalTarget.startsWith("[") ? positionalTarget : resolvedCommand.command.path.join(" ");
|
|
7722
7726
|
}, "commandConfirmationTarget"), PAGING_FLAG_KEYS = ["limit", "cursor", "direction", "sortBy", "sortDir"], rejectCountPagingFlags = __name2((flags, commandName) => {
|
|
7723
7727
|
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."));
|
|
7724
7728
|
}, "rejectCountPagingFlags"), rejectBarePagingFlags = __name2((flags) => {
|
|
7725
7729
|
for (const key of PAGING_FLAG_KEYS) rejectBareFlag(flags, key);
|
|
7726
|
-
}, "rejectBarePagingFlags"), parseCursorAndDirection = __name2(
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7730
|
+
}, "rejectBarePagingFlags"), parseCursorAndDirection = __name2(
|
|
7731
|
+
(flags) => {
|
|
7732
|
+
const cursor = getFlag(flags, "cursor");
|
|
7733
|
+
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
7734
|
+
const direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7735
|
+
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
7736
|
+
return { cursor, direction };
|
|
7737
|
+
},
|
|
7738
|
+
"parseCursorAndDirection"
|
|
7739
|
+
), parseAscDescSortDir = __name2((flags) => {
|
|
7733
7740
|
const sortDir = getFlag(flags, "sortDir");
|
|
7734
7741
|
if (sortDir !== void 0 && sortDir !== "asc" && sortDir !== "desc") throw new Error('--sortDir must be "asc" or "desc".');
|
|
7735
7742
|
return sortDir;
|
|
7736
7743
|
}, "parseAscDescSortDir"), commandWhoami = __name2(async () => {
|
|
7737
7744
|
await whoAmI();
|
|
7738
7745
|
}, "commandWhoami"), commandListBudgets = __name2(async ({ cmd, 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
|
-
) };
|
|
7746
|
+
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(flags) };
|
|
7742
7747
|
if (rejectRetiredPageFlags(flags), cmd === "count-budgets") {
|
|
7743
7748
|
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."));
|
|
7744
7749
|
await countBudgets(filters);
|
|
@@ -7749,25 +7754,25 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7749
7754
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
7750
7755
|
const direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7751
7756
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
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(
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
"
|
|
7760
|
-
), commandUploadBudgetAttachment = __name2(async ({ positional }) => {
|
|
7757
|
+
await listBudgets({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: getFlag(flags, "sortBy"), sortDir: getFlag(flags, "sortDir"), includeDetails: flags.summary === !0 ? !1 : parseOptionalBoolFlag(
|
|
7758
|
+
flags,
|
|
7759
|
+
"includeDetails"
|
|
7760
|
+
) ?? !0 });
|
|
7761
|
+
}, "commandListBudgets"), commandGetBudget = __name2(async ({ flags, positional }) => {
|
|
7762
|
+
const id = positional[0];
|
|
7763
|
+
if (!id) throw new Error("get-budget requires <id>");
|
|
7764
|
+
await getBudget(id, { includeInactive: flags.includeInactive === !0 ? !0 : parseOptionalBoolFlag(flags, "includeInactive") ?? !1 });
|
|
7765
|
+
}, "commandGetBudget"), commandUploadBudgetAttachment = __name2(async ({ positional }) => {
|
|
7761
7766
|
const [budgetId, filePath] = positional;
|
|
7762
7767
|
if (!budgetId || !filePath) throw new Error("upload-budget-attachment requires <budgetId> <filePath>");
|
|
7763
7768
|
await uploadBudgetAttachmentFromPath(budgetId, filePath);
|
|
7764
7769
|
}, "commandUploadBudgetAttachment"), commandMarkBudgetWon = __name2(async ({ flags, positional }) => {
|
|
7765
7770
|
const [budgetId, filePath] = positional;
|
|
7766
7771
|
if (!budgetId || !filePath) throw new Error("mark-budget-won requires <budgetId> <filePath>");
|
|
7767
|
-
await markBudgetWonWithProof(budgetId, filePath, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectInvoiceSettings: getFlag(
|
|
7768
|
-
|
|
7769
|
-
"
|
|
7770
|
-
) : void 0 });
|
|
7772
|
+
await markBudgetWonWithProof(budgetId, filePath, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectInvoiceSettings: getFlag(
|
|
7773
|
+
flags,
|
|
7774
|
+
"invoiceSettings"
|
|
7775
|
+
) !== void 0 ? parseJsonFlag(String(getFlag(flags, "invoiceSettings")), "--invoiceSettings") : void 0 });
|
|
7771
7776
|
}, "commandMarkBudgetWon"), commandGetBudgetItems = __name2(async ({ flags, positional }) => {
|
|
7772
7777
|
const id = positional[0];
|
|
7773
7778
|
if (!id) throw new Error("get-budget-items requires <budgetId>");
|
|
@@ -7790,11 +7795,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7790
7795
|
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.");
|
|
7791
7796
|
if (flags.cursor === !0 || flags.cursor === "") throw new CliRuntimeError("USAGE", "--cursor requires the nextCursor token from the previous page.");
|
|
7792
7797
|
await getBudgetVersions(id, { limit, cursor: flags.cursor, all: flags.all === !0 || (parseOptionalBoolFlag(flags, "all") ?? !1) });
|
|
7793
|
-
}, "commandGetBudgetVersions"), commandRenameBudgetVersion = __name2(
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
+
}, "commandGetBudgetVersions"), commandRenameBudgetVersion = __name2(
|
|
7799
|
+
async ({ flags, positional }) => {
|
|
7800
|
+
const versionId = positional[0], newName = getFlag(flags, "name");
|
|
7801
|
+
if (!versionId || newName === void 0) throw new Error("rename-budget-version requires <versionId> --name <text>");
|
|
7802
|
+
await renameBudgetVersion(versionId, String(newName));
|
|
7803
|
+
},
|
|
7804
|
+
"commandRenameBudgetVersion"
|
|
7805
|
+
), commandRestoreBudgetVersion = __name2(async ({ positional }) => {
|
|
7798
7806
|
const versionId = positional[0];
|
|
7799
7807
|
if (!versionId) throw new Error("restore-budget-version requires <versionId>");
|
|
7800
7808
|
await restoreBudgetVersion(versionId);
|
|
@@ -7802,29 +7810,30 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7802
7810
|
const [id, status] = positional;
|
|
7803
7811
|
if (!id || !status) throw new Error("update-budget-status requires <id> <status>");
|
|
7804
7812
|
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 });
|
|
7813
|
+
await updateBudgetStatus(id, status, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectStatusOnCommercialRejection: parseCommercialRejectionProjectStatus(flags), projectInvoiceSettings: getFlag(flags, "invoiceSettings") !== void 0 ? parseJsonFlag(String(getFlag(flags, "invoiceSettings")), "--invoiceSettings") : void 0 });
|
|
7808
7814
|
}, "commandUpdateBudgetStatus"), commandCreateBudgetApproval = __name2(async ({ flags, positional }) => {
|
|
7809
7815
|
const id = positional[0];
|
|
7810
7816
|
if (!id) throw new Error("create-budget-approval requires <budgetId>");
|
|
7811
7817
|
const companyPayloadRaw = getFlag(flags, "companyPayload"), contactPayloadRaw = getFlag(flags, "contactPayload"), eventPayloadRaw = getFlag(flags, "eventPayload");
|
|
7812
7818
|
await createBudgetApproval(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 });
|
|
7813
|
-
}, "commandCreateBudgetApproval"), commandCreateEstimate = __name2(
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
+
}, "commandCreateBudgetApproval"), commandCreateEstimate = __name2(
|
|
7820
|
+
async ({ flags, positional }) => {
|
|
7821
|
+
const id = positional[0];
|
|
7822
|
+
if (!id) throw new Error("create-estimate requires <budgetId>");
|
|
7823
|
+
const companyPayloadRaw = getFlag(flags, "companyPayload"), contactPayloadRaw = getFlag(flags, "contactPayload"), eventPayloadRaw = getFlag(flags, "eventPayload");
|
|
7824
|
+
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 });
|
|
7825
|
+
},
|
|
7826
|
+
"commandCreateEstimate"
|
|
7827
|
+
), commandSendEstimateEmail = __name2(async ({ flags }) => {
|
|
7819
7828
|
const payloadRaw = getFlag(flags, "payload");
|
|
7820
7829
|
if (!payloadRaw) throw new Error("send-estimate-to-contact-person requires --payload '<json>'");
|
|
7821
7830
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
7822
7831
|
await sendEstimateToContactPersonFromPayload(raw);
|
|
7823
|
-
}, "commandSendEstimateEmail"), commandCreateBudget = __name2(async ({
|
|
7832
|
+
}, "commandSendEstimateEmail"), commandCreateBudget = __name2(async ({
|
|
7833
|
+
flags
|
|
7834
|
+
}) => {
|
|
7824
7835
|
const payloadRaw = getFlag(flags, "payload");
|
|
7825
|
-
if (!payloadRaw) throw new Error(
|
|
7826
|
-
"create-budget requires --payload '<json>'"
|
|
7827
|
-
);
|
|
7836
|
+
if (!payloadRaw) throw new Error("create-budget requires --payload '<json>'");
|
|
7828
7837
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
7829
7838
|
await createBudgetFromPayload(raw);
|
|
7830
7839
|
}, "commandCreateBudget"), commandUpdateBudget = __name2(async ({ flags }) => {
|
|
@@ -7850,7 +7859,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7850
7859
|
if (!id) throw new Error("remove-budget-item requires <budgetItemId>");
|
|
7851
7860
|
await removeBudgetItem(id);
|
|
7852
7861
|
}, "commandRemoveBudgetItem"), commandReplaceBudgetItem = __name2(async ({ flags }) => {
|
|
7853
|
-
const budgetItemId = getFlag(
|
|
7862
|
+
const budgetItemId = getFlag(
|
|
7863
|
+
flags,
|
|
7864
|
+
"budgetItemId"
|
|
7865
|
+
), replacementItemId = getFlag(flags, "replacementItemId");
|
|
7854
7866
|
if (!budgetItemId || !replacementItemId) throw new Error("replace-budget-item requires --budgetItemId and --replacementItemId");
|
|
7855
7867
|
await replaceBudgetItem({ budgetItemId: String(budgetItemId), replacementItemId: String(replacementItemId) });
|
|
7856
7868
|
}, "commandReplaceBudgetItem"), commandApproveUnavailableItemException = __name2(async ({ flags }) => {
|
|
@@ -7860,7 +7872,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7860
7872
|
}, "commandApproveUnavailableItemException"), commandReorderBudgetItems = __name2(async ({ flags, positional }) => {
|
|
7861
7873
|
const budgetId = positional[0], itemIdsRaw = getFlag(flags, "itemIds");
|
|
7862
7874
|
if (!budgetId || itemIdsRaw === void 0) throw new Error("reorder-budget-items requires <budgetId> --itemIds <csv>");
|
|
7863
|
-
const itemIds = parseCommaSeparatedIds(
|
|
7875
|
+
const itemIds = parseCommaSeparatedIds(
|
|
7876
|
+
String(itemIdsRaw)
|
|
7877
|
+
);
|
|
7864
7878
|
if (!itemIds?.length) throw new Error("reorder-budget-items requires non-empty --itemIds <csv>");
|
|
7865
7879
|
await reorderBudgetItemsCli({ budgetId, itemIds });
|
|
7866
7880
|
}, "commandReorderBudgetItems"), commandUpdateBudgetItemSupplier = __name2(async ({ flags }) => {
|
|
@@ -7924,9 +7938,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7924
7938
|
}, "commandCreateBillApproval"), commandCreateBill = __name2(async ({ flags }) => {
|
|
7925
7939
|
const payloadRaw = getFlag(flags, "payload");
|
|
7926
7940
|
if (!payloadRaw) throw new Error("create-bill requires --payload '<json>'");
|
|
7927
|
-
const raw = parseJsonFlag(String(
|
|
7928
|
-
payloadRaw
|
|
7929
|
-
), "--payload"), draftOnly = flags["draft-only"] === !0 ? !0 : parseOptionalBoolFlag(flags, "draft-only"), quotationExempt = flags["quotation-exempt"] === !0;
|
|
7941
|
+
const raw = parseJsonFlag(String(payloadRaw), "--payload"), draftOnly = flags["draft-only"] === !0 ? !0 : parseOptionalBoolFlag(flags, "draft-only"), quotationExempt = flags["quotation-exempt"] === !0;
|
|
7930
7942
|
if (flags["quotation-exempt"] !== void 0 && flags["quotation-exempt"] !== !0) throw new Error("--quotation-exempt does not take a value.");
|
|
7931
7943
|
await createBillFromPayload(raw, draftOnly, quotationExempt);
|
|
7932
7944
|
}, "commandCreateBill"), commandValidateBillSelection = __name2(async ({ flags }) => {
|
|
@@ -7935,19 +7947,20 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7935
7947
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
7936
7948
|
if (flags.quotationIds === !0 || flags.quotationId === !0) throw new Error("--quotationIds requires a CSV value and --quotationId requires an ID value.");
|
|
7937
7949
|
const quotationIds = parseCommaSeparatedIds(getFlag(flags, "quotationIds")), quotationId = getFlag(flags, "quotationId")?.trim() || void 0;
|
|
7938
|
-
if (quotationId && quotationIds && (quotationIds.length !== 1 || quotationIds[0] !== quotationId))
|
|
7950
|
+
if (quotationId && quotationIds && (quotationIds.length !== 1 || quotationIds[0] !== quotationId))
|
|
7951
|
+
throw new Error("--quotationId conflicts with --quotationIds.");
|
|
7939
7952
|
if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
|
|
7940
7953
|
await validateBillSelectionFromPayload(raw, { ...quotationId ? { quotationId } : {}, ...quotationIds ? { quotationIds } : {} });
|
|
7941
|
-
}, "commandValidateBillSelection"), commandLinkBillQuotations = __name2(
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
), commandUpdateBill = __name2(async ({ flags }) => {
|
|
7954
|
+
}, "commandValidateBillSelection"), commandLinkBillQuotations = __name2(async ({ flags, positional }) => {
|
|
7955
|
+
const billId = positional[0], payloadRaw = getFlag(flags, "payload"), quotationIds = parseCommaSeparatedIds(getFlag(flags, "quotationIds"));
|
|
7956
|
+
if (!billId || !payloadRaw && (!quotationIds || quotationIds.length === 0)) throw new Error("link-bill-quotations requires <billId> and either --payload '<json>' or --quotationIds <csv>");
|
|
7957
|
+
if (payloadRaw && quotationIds) throw new Error("--payload cannot be combined with --quotationIds.");
|
|
7958
|
+
if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
|
|
7959
|
+
await linkBillQuotations(billId, payloadRaw ? parseJsonFlag(
|
|
7960
|
+
String(payloadRaw),
|
|
7961
|
+
"--payload"
|
|
7962
|
+
) : { quotationIds });
|
|
7963
|
+
}, "commandLinkBillQuotations"), commandUpdateBill = __name2(async ({ flags }) => {
|
|
7951
7964
|
const payloadRaw = getFlag(flags, "payload");
|
|
7952
7965
|
if (!payloadRaw) throw new Error("update-bill requires --payload '<json>'");
|
|
7953
7966
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
@@ -7973,7 +7986,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7973
7986
|
}, "commandListExternalPaymentAccounts"), commandRefreshExternalPaymentAccounts = __name2(async () => {
|
|
7974
7987
|
await refreshExternalBillPaymentAccounts();
|
|
7975
7988
|
}, "commandRefreshExternalPaymentAccounts"), commandRecordExternalBillPayment = __name2(async ({ flags, positional }) => {
|
|
7976
|
-
const id = positional[0], paymentReference = getFlag(
|
|
7989
|
+
const id = positional[0], paymentReference = getFlag(
|
|
7990
|
+
flags,
|
|
7991
|
+
"paymentReference"
|
|
7992
|
+
), paymentDate = getFlag(flags, "paymentDate"), paymentAccount = getFlag(flags, "paymentAccount"), paymentProofPath = getFlag(flags, "paymentProof");
|
|
7977
7993
|
if (!id || !paymentReference || !paymentDate || !paymentAccount) throw new Error("record-external-bill-payment requires <billId> --paymentReference --paymentDate YYYY-MM-DD --paymentAccount <QBO account ID> [--paymentProof receipt.pdf]");
|
|
7978
7994
|
await recordExternalBillPayment({ id, paymentReference, paymentDate, paymentAccount, paymentProofPath });
|
|
7979
7995
|
}, "commandRecordExternalBillPayment"), commandPatchBillPayment = __name2(async ({ flags, positional }) => {
|
|
@@ -8187,20 +8203,18 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8187
8203
|
const [budgetId, qboInvoiceId] = positional;
|
|
8188
8204
|
if (!budgetId?.trim() || !qboInvoiceId || positional.length !== 2) throw new Error("".concat(cmd, " requires <budgetId> <qboInvoiceId>"));
|
|
8189
8205
|
if (!new __cliRegExp("^\\d+$", "").test(qboInvoiceId)) throw new Error("qboInvoiceId must be the numeric QuickBooks transaction ID, not the invoice number");
|
|
8190
|
-
|
|
8206
|
+
const confirmEstimateLineage = flags.confirmEstimateLineage === !0 ? !0 : parseOptionalBoolFlag(flags, "confirmEstimateLineage");
|
|
8207
|
+
if (cmd === "preview-qbo-customer-invoice") await previewQboCustomerInvoice({ budgetId, qboInvoiceId, confirmEstimateLineage });
|
|
8191
8208
|
else {
|
|
8192
8209
|
const token = getFlag(flags, "token");
|
|
8193
8210
|
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");
|
|
8194
|
-
await importQboCustomerInvoice({ budgetId, qboInvoiceId, token });
|
|
8211
|
+
await importQboCustomerInvoice({ budgetId, qboInvoiceId, token, confirmEstimateLineage });
|
|
8195
8212
|
}
|
|
8196
|
-
}, "commandPreviewQboCustomerInvoice"), commandCreateCustomerInvoice = __name2(
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
},
|
|
8202
|
-
"commandCreateCustomerInvoice"
|
|
8203
|
-
), commandResubmitCustomerInvoice = __name2(async ({ positional }) => {
|
|
8213
|
+
}, "commandPreviewQboCustomerInvoice"), commandCreateCustomerInvoice = __name2(async ({ flags }) => {
|
|
8214
|
+
const payloadRaw = getFlag(flags, "payload");
|
|
8215
|
+
if (!payloadRaw) throw new Error("create-customer-invoice requires --payload '<json>'");
|
|
8216
|
+
await createCustomerInvoice(parseJsonFlag(String(payloadRaw), "--payload"));
|
|
8217
|
+
}, "commandCreateCustomerInvoice"), commandResubmitCustomerInvoice = __name2(async ({ positional }) => {
|
|
8204
8218
|
const batchId = positional[0];
|
|
8205
8219
|
if (!batchId) throw new Error("resubmit-customer-invoice requires <batchId>");
|
|
8206
8220
|
await resubmitCustomerInvoice(batchId);
|
|
@@ -8212,9 +8226,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8212
8226
|
const batchId = positional[0];
|
|
8213
8227
|
if (!batchId) throw new Error("delete-customer-invoice requires <batchId>");
|
|
8214
8228
|
await deleteCustomerInvoice(batchId);
|
|
8215
|
-
}, "commandDeleteCustomerInvoice"), commandVoidCustomerInvoice = __name2(async ({
|
|
8216
|
-
positional
|
|
8217
|
-
}) => {
|
|
8229
|
+
}, "commandDeleteCustomerInvoice"), commandVoidCustomerInvoice = __name2(async ({ positional }) => {
|
|
8218
8230
|
const batchId = positional[0];
|
|
8219
8231
|
if (!batchId) throw new Error("void-customer-invoice requires <batchId>");
|
|
8220
8232
|
await voidCustomerInvoice(batchId);
|
|
@@ -8227,12 +8239,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8227
8239
|
if (!batchId || reason === void 0) throw new Error("reject-customer-invoice requires <batchId> --reason <text>");
|
|
8228
8240
|
await rejectCustomerInvoice(batchId, String(reason));
|
|
8229
8241
|
}, "commandRejectCustomerInvoice"), commandSendCustomerInvoiceToContactPerson = __name2(async ({ flags }) => {
|
|
8230
|
-
const payloadRaw = getFlag(
|
|
8242
|
+
const payloadRaw = getFlag(
|
|
8243
|
+
flags,
|
|
8244
|
+
"payload"
|
|
8245
|
+
);
|
|
8231
8246
|
if (!payloadRaw) throw new Error("send-customer-invoice-to-contact-person requires --payload '<json>'");
|
|
8232
|
-
await sendCustomerInvoiceToContactPersonFromPayload(parseJsonFlag(
|
|
8233
|
-
String(payloadRaw),
|
|
8234
|
-
"--payload"
|
|
8235
|
-
));
|
|
8247
|
+
await sendCustomerInvoiceToContactPersonFromPayload(parseJsonFlag(String(payloadRaw), "--payload"));
|
|
8236
8248
|
}, "commandSendCustomerInvoiceToContactPerson"), commandDownloadCustomerInvoicePdf = __name2(async ({ flags, positional }) => {
|
|
8237
8249
|
const invoiceId = positional[0];
|
|
8238
8250
|
if (!invoiceId) throw new Error("download-customer-invoice-pdf requires <invoiceId> [--output <path>]");
|
|
@@ -8241,12 +8253,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8241
8253
|
const invoiceId = positional[0], billingAddress = getFlag(flags, "billingAddress"), customerMemo = getFlag(flags, "customerMemo");
|
|
8242
8254
|
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.");
|
|
8243
8255
|
const requestId = getFlag(flags, "requestId");
|
|
8244
|
-
await updateCustomerInvoiceDetails({
|
|
8245
|
-
billingAddress: billingAddress.replaceAll("\\n", "\n"),
|
|
8246
|
-
customerMemo,
|
|
8247
|
-
invoiceId,
|
|
8248
|
-
...typeof requestId == "string" ? { requestId } : {}
|
|
8249
|
-
});
|
|
8256
|
+
await updateCustomerInvoiceDetails({ billingAddress: billingAddress.replaceAll("\\n", "\n"), customerMemo, invoiceId, ...typeof requestId == "string" ? { requestId } : {} });
|
|
8250
8257
|
}, "commandUpdateCustomerInvoiceDetails"), commandUpdateCustomerInvoiceQboDrift = __name2(async ({ flags, positional }) => {
|
|
8251
8258
|
const invoiceId = positional[0], resolution = getFlag(flags, "resolution");
|
|
8252
8259
|
if (!invoiceId || resolution !== "ACCEPT_QBO" && resolution !== "KEEP_BB") throw new Error("update-customer-invoice-qbo-drift requires <invoiceId> --resolution ACCEPT_QBO|KEEP_BB");
|
|
@@ -8254,13 +8261,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8254
8261
|
await updateCustomerInvoiceQboDrift({ invoiceId, resolution, ...typeof requestId == "string" ? { requestId } : {} });
|
|
8255
8262
|
}, "commandUpdateCustomerInvoiceQboDrift"), commandMarkCustomerInvoiceSentExternally = __name2(async ({ flags, positional }) => {
|
|
8256
8263
|
const invoiceId = positional[0], sentAt = getFlag(flags, "sentAt"), recipients = getFlag(flags, "recipients");
|
|
8257
|
-
if (!invoiceId || !sentAt || !recipients) throw new Error(
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
recipients: recipients.split(",").map((recipient) => recipient.trim()).filter(Boolean),
|
|
8262
|
-
note: getFlag(flags, "note")
|
|
8263
|
-
});
|
|
8264
|
+
if (!invoiceId || !sentAt || !recipients) throw new Error(
|
|
8265
|
+
"mark-customer-invoice-sent-externally requires <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>]"
|
|
8266
|
+
);
|
|
8267
|
+
await markCustomerInvoiceSentExternally({ invoiceId, sentAt, recipients: recipients.split(",").map((recipient) => recipient.trim()).filter(Boolean), note: getFlag(flags, "note") });
|
|
8264
8268
|
}, "commandMarkCustomerInvoiceSentExternally"), commandSyncCustomerInvoice = __name2(async ({ positional }) => {
|
|
8265
8269
|
const invoiceId = positional[0];
|
|
8266
8270
|
if (!invoiceId) throw new Error("sync-customer-invoice requires <invoiceId>");
|
|
@@ -8286,18 +8290,17 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8286
8290
|
const id = positional[0], reason = getFlag(flags, "reason");
|
|
8287
8291
|
if (!id || reason === void 0) throw new Error("reject-budget requires <budgetId> --reason <text>");
|
|
8288
8292
|
await rejectBudget(id, reason);
|
|
8289
|
-
}, "commandRejectBudget"), commandApproveSupplier = __name2(async ({
|
|
8293
|
+
}, "commandRejectBudget"), commandApproveSupplier = __name2(async ({
|
|
8294
|
+
positional
|
|
8295
|
+
}) => {
|
|
8290
8296
|
const id = positional[0];
|
|
8291
8297
|
if (!id) throw new Error("approve-supplier requires <supplierId>");
|
|
8292
8298
|
await approveSupplier(id);
|
|
8293
|
-
}, "commandApproveSupplier"), commandRejectSupplier = __name2(
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
},
|
|
8299
|
-
"commandRejectSupplier"
|
|
8300
|
-
), commandGetSupplierDetails = __name2(async ({ positional }) => {
|
|
8299
|
+
}, "commandApproveSupplier"), commandRejectSupplier = __name2(async ({ flags, positional }) => {
|
|
8300
|
+
const id = positional[0], reason = getFlag(flags, "reason");
|
|
8301
|
+
if (!id || reason === void 0) throw new Error("reject-supplier requires <supplierId> --reason <text>");
|
|
8302
|
+
await rejectSupplier(id, reason);
|
|
8303
|
+
}, "commandRejectSupplier"), commandGetSupplierDetails = __name2(async ({ positional }) => {
|
|
8301
8304
|
const id = positional[0];
|
|
8302
8305
|
if (!id) throw new Error("get-supplier-details requires <supplierId>");
|
|
8303
8306
|
await getSupplierDetails(id);
|
|
@@ -8308,13 +8311,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8308
8311
|
}, "commandGetSupplierOverview"), commandGetSupplierUsage = __name2(async ({ positional }) => {
|
|
8309
8312
|
const id = positional[0];
|
|
8310
8313
|
if (!id) throw new Error("get-supplier-usage requires <supplierId>");
|
|
8311
|
-
await getSupplierUsage(
|
|
8314
|
+
await getSupplierUsage(
|
|
8315
|
+
id
|
|
8316
|
+
);
|
|
8312
8317
|
}, "commandGetSupplierUsage"), commandGetSupplierItems = __name2(async ({ positional }) => {
|
|
8313
8318
|
const id = positional[0];
|
|
8314
8319
|
if (!id) throw new Error("get-supplier-items requires <supplierId>");
|
|
8315
|
-
await getSupplierItems(
|
|
8316
|
-
id
|
|
8317
|
-
);
|
|
8320
|
+
await getSupplierItems(id);
|
|
8318
8321
|
}, "commandGetSupplierItems"), commandListCompanies = __name2(async ({ flags }) => {
|
|
8319
8322
|
await listCompanies(parseCompanyListFlags(flags));
|
|
8320
8323
|
}, "commandListCompanies"), commandCountCompanies = __name2(async ({ flags }) => {
|
|
@@ -8339,11 +8342,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8339
8342
|
if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 50)) throw new Error("--limit must be an integer from 1 to 50.");
|
|
8340
8343
|
await searchExistingCompanies({ query, limit, cursor });
|
|
8341
8344
|
}, "commandSearchExistingCompanies"), commandUseExistingCompany = __name2(async ({ flags }) => {
|
|
8342
|
-
const companyId = getFlag(
|
|
8345
|
+
const companyId = getFlag(
|
|
8346
|
+
flags,
|
|
8347
|
+
"companyId"
|
|
8348
|
+
), quickbooksId = getFlag(flags, "quickbooksId");
|
|
8343
8349
|
if (!companyId && !quickbooksId) throw new Error("Supply --companyId and/or --quickbooksId");
|
|
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") });
|
|
8350
|
+
companyId ? await reuseExistingCompany({ source: "bb", companyId, quickbooksId, confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct") }) : quickbooksId && await reuseExistingCompany({ source: "qbo", quickbooksId, name: getFlag(flags, "name"), website: getFlag(flags, "website"), confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct") });
|
|
8347
8351
|
}, "commandUseExistingCompany"), commandUpdateCompany = __name2(async ({ flags }) => {
|
|
8348
8352
|
const payloadRaw = getFlag(flags, "payload");
|
|
8349
8353
|
if (!payloadRaw) throw new Error("update-company requires --payload '<json>'");
|
|
@@ -8352,13 +8356,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8352
8356
|
}, "commandUpdateCompany"), commandGetCompanyQuickbooksSyncStatus = __name2(async ({ positional }) => {
|
|
8353
8357
|
const id = positional[0];
|
|
8354
8358
|
if (!id) throw new Error("get-company-quickbooks-sync-status requires <companyId>");
|
|
8355
|
-
await getCompanyQuickBooksSyncStatus(
|
|
8359
|
+
await getCompanyQuickBooksSyncStatus(
|
|
8360
|
+
id
|
|
8361
|
+
);
|
|
8356
8362
|
}, "commandGetCompanyQuickbooksSyncStatus"), commandDeleteCompany = __name2(async ({ positional }) => {
|
|
8357
8363
|
const id = positional[0];
|
|
8358
8364
|
if (!id) throw new Error("delete-company requires <id>");
|
|
8359
|
-
await deleteCompanyById(
|
|
8360
|
-
id
|
|
8361
|
-
);
|
|
8365
|
+
await deleteCompanyById(id);
|
|
8362
8366
|
}, "commandDeleteCompany"), commandListProjects = __name2(async ({ flags }) => {
|
|
8363
8367
|
await listProjects(parseProjectListFlags(flags));
|
|
8364
8368
|
}, "commandListProjects"), commandCountProjects = __name2(async ({ flags }) => {
|
|
@@ -8374,9 +8378,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8374
8378
|
for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
8375
8379
|
const cursor = getFlag(flags, "cursor");
|
|
8376
8380
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
8377
|
-
const direction = parseProjectDirection(
|
|
8378
|
-
getFlag(flags, "direction")
|
|
8379
|
-
);
|
|
8381
|
+
const direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
8380
8382
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
8381
8383
|
await listProjectHubs({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseOptionalProjectHubSortBy(getFlag(flags, "sortBy")), sortDir: parseOptionalBillListSortDir(getFlag(flags, "sortDir")) });
|
|
8382
8384
|
}, "commandListProjectHubs"), commandGetProject = __name2(async ({ positional }) => {
|
|
@@ -8387,18 +8389,18 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8387
8389
|
const projectId = positional[0];
|
|
8388
8390
|
if (!projectId) throw new Error("get-project-hub-status requires <projectId>");
|
|
8389
8391
|
await getProjectHubStatus(projectId);
|
|
8390
|
-
}, "commandGetProjectHubStatus"), commandSetupProjectHub = __name2(
|
|
8391
|
-
const projectId = positional[0];
|
|
8392
|
-
if (!projectId) throw new Error("setup-project-hub requires <projectId>");
|
|
8393
|
-
await setupProjectHub(projectId);
|
|
8394
|
-
}, "commandSetupProjectHub"), commandSyncProjectHubCommercialDocuments = __name2(
|
|
8392
|
+
}, "commandGetProjectHubStatus"), commandSetupProjectHub = __name2(
|
|
8395
8393
|
async ({ positional }) => {
|
|
8396
8394
|
const projectId = positional[0];
|
|
8397
|
-
if (!projectId) throw new Error("
|
|
8398
|
-
await
|
|
8395
|
+
if (!projectId) throw new Error("setup-project-hub requires <projectId>");
|
|
8396
|
+
await setupProjectHub(projectId);
|
|
8399
8397
|
},
|
|
8400
|
-
"
|
|
8401
|
-
),
|
|
8398
|
+
"commandSetupProjectHub"
|
|
8399
|
+
), commandSyncProjectHubCommercialDocuments = __name2(async ({ positional }) => {
|
|
8400
|
+
const projectId = positional[0];
|
|
8401
|
+
if (!projectId) throw new Error("sync-project-hub-commercial-documents requires <projectId>");
|
|
8402
|
+
await syncProjectHubCommercialDocuments(projectId);
|
|
8403
|
+
}, "commandSyncProjectHubCommercialDocuments"), commandCreateProject = __name2(async ({ flags }) => {
|
|
8402
8404
|
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");
|
|
8403
8405
|
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.");
|
|
8404
8406
|
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");
|
|
@@ -8406,16 +8408,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8406
8408
|
}, "commandCreateProject"), commandUpdateProject = __name2(async ({ flags }) => {
|
|
8407
8409
|
const payloadRaw = getFlag(flags, "payload");
|
|
8408
8410
|
if (!payloadRaw) throw new Error("update-project requires --payload '<json>'");
|
|
8409
|
-
const raw = parseJsonFlag(
|
|
8411
|
+
const raw = parseJsonFlag(
|
|
8412
|
+
String(payloadRaw),
|
|
8413
|
+
"--payload"
|
|
8414
|
+
);
|
|
8410
8415
|
await updateProjectFromPayload(raw);
|
|
8411
|
-
}, "commandUpdateProject"), commandDeleteProject = __name2(
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
},
|
|
8417
|
-
"commandDeleteProject"
|
|
8418
|
-
), commandCheckProjectReconciliation = __name2(async ({ positional }) => {
|
|
8416
|
+
}, "commandUpdateProject"), commandDeleteProject = __name2(async ({ positional }) => {
|
|
8417
|
+
const id = positional[0];
|
|
8418
|
+
if (!id) throw new Error("delete-project requires <id>");
|
|
8419
|
+
await deleteProjectById(id);
|
|
8420
|
+
}, "commandDeleteProject"), commandCheckProjectReconciliation = __name2(async ({ positional }) => {
|
|
8419
8421
|
const id = positional[0];
|
|
8420
8422
|
if (!id) throw new Error("check-project-reconciliation requires <id>");
|
|
8421
8423
|
await checkProjectReconciliation(id);
|
|
@@ -8431,10 +8433,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8431
8433
|
const projectId = positional[0], projectUrl = getFlag(flags, "url");
|
|
8432
8434
|
if (!projectId || projectUrl === void 0) throw new Error("import-qbo-project requires <projectId> --url <quickBooksProjectUrl>");
|
|
8433
8435
|
await importQuickBooksProjectId(projectId, String(projectUrl));
|
|
8434
|
-
}, "commandImportQboProject"), commandUpdateProjectStatus = __name2(async ({
|
|
8435
|
-
flags,
|
|
8436
|
-
positional
|
|
8437
|
-
}) => {
|
|
8436
|
+
}, "commandImportQboProject"), commandUpdateProjectStatus = __name2(async ({ flags, positional }) => {
|
|
8438
8437
|
const [id, statusRaw] = positional;
|
|
8439
8438
|
if (!id || !statusRaw) throw new Error("update-project-status requires <id> <status>");
|
|
8440
8439
|
const pmIdFlag = getFlag(flags, "projectManagerId"), pmEmailFlag = getFlag(flags, "projectManagerEmail");
|
|
@@ -8449,10 +8448,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8449
8448
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8450
8449
|
await createContactPersonFromPayload(raw);
|
|
8451
8450
|
}, "commandCreateContactPerson"), commandUpdateContactPerson = __name2(async ({ flags }) => {
|
|
8452
|
-
const payloadRaw = getFlag(
|
|
8453
|
-
flags,
|
|
8454
|
-
"payload"
|
|
8455
|
-
);
|
|
8451
|
+
const payloadRaw = getFlag(flags, "payload");
|
|
8456
8452
|
if (!payloadRaw) throw new Error("update-contact-person requires --payload '<json>'");
|
|
8457
8453
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8458
8454
|
await updateContactPersonFromPayload(raw);
|
|
@@ -8465,14 +8461,15 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8465
8461
|
if (!payloadRaw) throw new Error("create-supplier requires --payload '<json>'");
|
|
8466
8462
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8467
8463
|
await createSupplierFromPayload(raw);
|
|
8468
|
-
}, "commandCreateSupplier"), commandUpdateSupplier = __name2(
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
raw
|
|
8474
|
-
|
|
8475
|
-
|
|
8464
|
+
}, "commandCreateSupplier"), commandUpdateSupplier = __name2(
|
|
8465
|
+
async ({ flags }) => {
|
|
8466
|
+
const payloadRaw = getFlag(flags, "payload");
|
|
8467
|
+
if (!payloadRaw) throw new Error("update-supplier requires --payload '<json>'");
|
|
8468
|
+
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8469
|
+
await updateSupplierFromPayload(raw);
|
|
8470
|
+
},
|
|
8471
|
+
"commandUpdateSupplier"
|
|
8472
|
+
), commandDeleteSuppliers = __name2(async ({ flags }) => {
|
|
8476
8473
|
const idsRaw = getFlag(flags, "ids");
|
|
8477
8474
|
if (idsRaw === void 0) throw new Error("delete-suppliers requires --ids <csv>");
|
|
8478
8475
|
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
@@ -8484,13 +8481,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8484
8481
|
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
8485
8482
|
if (!ids?.length) throw new Error("reactivate-suppliers requires non-empty --ids");
|
|
8486
8483
|
await reactivateSuppliersByIds(ids);
|
|
8487
|
-
}, "commandReactivateSuppliers"), commandCreateCertification = __name2(async ({
|
|
8484
|
+
}, "commandReactivateSuppliers"), commandCreateCertification = __name2(async ({
|
|
8485
|
+
flags
|
|
8486
|
+
}) => {
|
|
8488
8487
|
const name = getFlag(flags, "name");
|
|
8489
8488
|
if (!name) throw new Error("create-certification requires --name");
|
|
8490
8489
|
await createSupplierCertification(String(name));
|
|
8491
|
-
}, "commandCreateCertification"), commandCreatePaymentMethod = __name2(async ({
|
|
8492
|
-
flags
|
|
8493
|
-
}) => {
|
|
8490
|
+
}, "commandCreateCertification"), commandCreatePaymentMethod = __name2(async ({ flags }) => {
|
|
8494
8491
|
const name = getFlag(flags, "name");
|
|
8495
8492
|
if (!name) throw new Error("create-payment-method requires --name");
|
|
8496
8493
|
await createSupplierPaymentMethod(String(name));
|
|
@@ -8505,7 +8502,15 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8505
8502
|
}, "commandCreateSupplierTag"), supplierAnalyticsFiltersFromFlags = __name2((flags) => {
|
|
8506
8503
|
rejectRetiredPageFlags(flags);
|
|
8507
8504
|
const tfRaw = getFlag(flags, "timeFrame");
|
|
8508
|
-
for (const key of [
|
|
8505
|
+
for (const key of [
|
|
8506
|
+
"name",
|
|
8507
|
+
"status",
|
|
8508
|
+
"gstRegistered",
|
|
8509
|
+
"createdBy",
|
|
8510
|
+
"startDate",
|
|
8511
|
+
"endDate",
|
|
8512
|
+
"timeFrame"
|
|
8513
|
+
]) rejectBareFlag(flags, key);
|
|
8509
8514
|
const timeFrame = parseOptionalSupplierAnalyticsTimeFrame(tfRaw !== void 0 ? String(tfRaw) : void 0), startDate = getFlag(flags, "startDate"), endDate = getFlag(flags, "endDate");
|
|
8510
8515
|
if ((startDate || endDate) && timeFrame !== "CUSTOM") throw new Error("--startDate/--endDate need --timeFrame CUSTOM; other time frames ignore them.");
|
|
8511
8516
|
const status = getFlag(flags, "status")?.split(",").map((value) => value.trim()).filter(Boolean), badStatus = status?.find((value) => !Object.values(ApprovalStatus2).some((s) => s === value));
|
|
@@ -8541,13 +8546,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8541
8546
|
await getItem(id);
|
|
8542
8547
|
}, "commandGetItem"), commandGetItemQuickbooksSyncStatus = __name2(async ({ positional }) => {
|
|
8543
8548
|
const id = positional[0];
|
|
8544
|
-
if (!id)
|
|
8549
|
+
if (!id)
|
|
8550
|
+
throw new Error("get-item-quickbooks-sync-status requires <itemId>");
|
|
8545
8551
|
await getItemQuickBooksSyncStatus(id);
|
|
8546
8552
|
}, "commandGetItemQuickbooksSyncStatus"), commandCreateItem = __name2(async ({ flags }) => {
|
|
8547
|
-
const payloadRaw = getFlag(
|
|
8548
|
-
flags,
|
|
8549
|
-
"payload"
|
|
8550
|
-
);
|
|
8553
|
+
const payloadRaw = getFlag(flags, "payload");
|
|
8551
8554
|
if (!payloadRaw) throw new Error("create-item requires --payload '<json>'");
|
|
8552
8555
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8553
8556
|
await createItemFromPayload(raw);
|
|
@@ -8563,13 +8566,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8563
8566
|
}, "commandDeleteItem"), commandArchiveItems = __name2(async ({ flags }) => {
|
|
8564
8567
|
const idsRaw = getFlag(flags, "ids");
|
|
8565
8568
|
if (!idsRaw) throw new Error("archive-items requires --ids <csv>");
|
|
8566
|
-
const ids = parseCommaSeparatedIds(
|
|
8569
|
+
const ids = parseCommaSeparatedIds(
|
|
8570
|
+
String(idsRaw)
|
|
8571
|
+
);
|
|
8567
8572
|
if (!ids?.length) throw new Error("archive-items requires non-empty --ids");
|
|
8568
8573
|
await archiveItemsByIds(ids);
|
|
8569
|
-
}, "commandArchiveItems"), commandListItemCategories = __name2(async ({
|
|
8570
|
-
cmd,
|
|
8571
|
-
flags
|
|
8572
|
-
}) => {
|
|
8574
|
+
}, "commandArchiveItems"), commandListItemCategories = __name2(async ({ cmd, flags }) => {
|
|
8573
8575
|
rejectRetiredPageFlags(flags);
|
|
8574
8576
|
const filters = { name: getFlag(flags, "name") };
|
|
8575
8577
|
if (cmd === "count-item-categories") {
|
|
@@ -8583,13 +8585,11 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8583
8585
|
await listItemCategories({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy, sortDir });
|
|
8584
8586
|
}, "commandListItemCategories"), commandCreateItemCategory = __name2(async ({ flags }) => {
|
|
8585
8587
|
const name = getFlag(flags, "name");
|
|
8586
|
-
if (!name)
|
|
8588
|
+
if (!name)
|
|
8589
|
+
throw new Error("create-item-category requires --name");
|
|
8587
8590
|
await createItemCategory(String(name));
|
|
8588
8591
|
}, "commandCreateItemCategory"), commandUpdateItemCategory = __name2(async ({ flags }) => {
|
|
8589
|
-
const id = getFlag(
|
|
8590
|
-
flags,
|
|
8591
|
-
"id"
|
|
8592
|
-
), name = getFlag(flags, "name");
|
|
8592
|
+
const id = getFlag(flags, "id"), name = getFlag(flags, "name");
|
|
8593
8593
|
if (!id || !name) throw new Error("update-item-category requires --id and --name");
|
|
8594
8594
|
await updateItemCategory({ id: String(id), name: String(name) });
|
|
8595
8595
|
}, "commandUpdateItemCategory"), commandDeleteItemCategories = __name2(async ({ flags }) => {
|
|
@@ -8620,9 +8620,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8620
8620
|
}, "commandCreateUser"), commandCreateApiKey = __name2(async ({ flags }) => {
|
|
8621
8621
|
const userId = getFlag(flags, "userId"), name = getFlag(flags, "name");
|
|
8622
8622
|
if (!name) throw new Error("create-api-key requires --name <label> [--userId <userId>]");
|
|
8623
|
-
await createApiKeyForUser(
|
|
8624
|
-
{ userId, name }
|
|
8625
|
-
);
|
|
8623
|
+
await createApiKeyForUser({ userId, name });
|
|
8626
8624
|
}, "commandCreateApiKey"), commandListApiKeys = __name2(async ({ flags }) => {
|
|
8627
8625
|
rejectRetiredPageFlags(flags);
|
|
8628
8626
|
for (const key of ["limit", "cursor"]) rejectBareFlag(flags, key);
|
|
@@ -8647,14 +8645,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8647
8645
|
}, "commandGetSystemOverview"), commandGetEstimatePerformance = __name2(async ({ flags }) => {
|
|
8648
8646
|
await getEstimatePerformance(parseDashboardQueryFlags(flags));
|
|
8649
8647
|
}, "commandGetEstimatePerformance"), commandGetFinancialOverview = __name2(async ({ flags }) => {
|
|
8650
|
-
await getFinancialOverview(
|
|
8651
|
-
userId: getFlag(flags, "userId"),
|
|
8652
|
-
|
|
8653
|
-
deals: parseOptionalDeals(getFlag(flags, "deals")),
|
|
8654
|
-
timeFrame: parseOptionalTimeFrame(getFlag(flags, "timeFrame")),
|
|
8655
|
-
startDate: getFlag(flags, "startDate"),
|
|
8656
|
-
endDate: getFlag(flags, "endDate")
|
|
8657
|
-
});
|
|
8648
|
+
await getFinancialOverview(
|
|
8649
|
+
{ userId: getFlag(flags, "userId"), role: parseOptionalFinancialRole(getFlag(flags, "role")), deals: parseOptionalDeals(getFlag(flags, "deals")), timeFrame: parseOptionalTimeFrame(getFlag(flags, "timeFrame")), startDate: getFlag(flags, "startDate"), endDate: getFlag(flags, "endDate") }
|
|
8650
|
+
);
|
|
8658
8651
|
}, "commandGetFinancialOverview"), commandGetRecentErrors = __name2(async ({ cmd, flags }) => {
|
|
8659
8652
|
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.");
|
|
8660
8653
|
const rawTimeFrame = getFlag(flags, "timeFrame"), timeFrame = Object.values(ChartTimeFrame).find((value) => value === rawTimeFrame);
|
|
@@ -8662,12 +8655,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8662
8655
|
const filters = { severity: parseOptionalErrorSeverity(getFlag(flags, "severity")), status: parseOptionalErrorStatus(getFlag(flags, "status")), timeFrame };
|
|
8663
8656
|
if (cmd === "count-errors") await countErrors(filters);
|
|
8664
8657
|
else {
|
|
8665
|
-
const direction = getFlag(
|
|
8658
|
+
const direction = getFlag(
|
|
8659
|
+
flags,
|
|
8660
|
+
"direction"
|
|
8661
|
+
);
|
|
8666
8662
|
if (direction !== void 0 && direction !== "forward" && direction !== "backward") throw new Error("--direction must be forward or backward.");
|
|
8667
|
-
await getRecentErrors({ ...filters, cursor: getFlag(flags, "cursor"), limit: parsePositiveIntFlag(
|
|
8668
|
-
getFlag(flags, "limit"),
|
|
8669
|
-
"--limit"
|
|
8670
|
-
), direction });
|
|
8663
|
+
await getRecentErrors({ ...filters, cursor: getFlag(flags, "cursor"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit"), direction });
|
|
8671
8664
|
}
|
|
8672
8665
|
}, "commandGetRecentErrors"), commandGetError = __name2(async ({ positional }) => {
|
|
8673
8666
|
const id = positional[0];
|
|
@@ -8694,13 +8687,23 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8694
8687
|
const operationId = positional[0];
|
|
8695
8688
|
if (!operationId) throw new Error("get-integration-operation requires <operationId>");
|
|
8696
8689
|
await getIntegrationOperation(operationId);
|
|
8697
|
-
}, "commandGetIntegrationOperation"), commandRetryIntegrationOperation = __name2(
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8690
|
+
}, "commandGetIntegrationOperation"), commandRetryIntegrationOperation = __name2(
|
|
8691
|
+
async ({ flags, positional }) => {
|
|
8692
|
+
const operationId = positional[0];
|
|
8693
|
+
if (!operationId) throw new Error("retry-integration-operation requires <operationId>");
|
|
8694
|
+
const outboundEmailResolution = getFlag(flags, "outboundEmailResolution");
|
|
8695
|
+
if (outboundEmailResolution && outboundEmailResolution !== "ACCEPTED" && outboundEmailResolution !== "NOT_ACCEPTED_RETRY") throw new Error("--outboundEmailResolution must be ACCEPTED or NOT_ACCEPTED_RETRY");
|
|
8696
|
+
await retryIntegrationOperation(operationId, parseOptionalBoolFlag(flags, "confirmExternalStateReconciled") ?? !1, outboundEmailResolution, getFlag(flags, "providerMessageId"));
|
|
8697
|
+
},
|
|
8698
|
+
"commandRetryIntegrationOperation"
|
|
8699
|
+
), commandMobilePushStatus = __name2(async ({ positional }) => {
|
|
8700
|
+
if (positional.length !== 0) throw new CliRuntimeError("USAGE", "mobile-push status accepts no positional arguments.");
|
|
8701
|
+
await listMobilePushDevices();
|
|
8702
|
+
}, "commandMobilePushStatus"), commandMobilePushUnregister = __name2(async ({ positional }) => {
|
|
8703
|
+
const sessionId = positional[0];
|
|
8704
|
+
if (!sessionId || positional.length !== 1) throw new CliRuntimeError("USAGE", "mobile-push unregister requires one <sessionId>.");
|
|
8705
|
+
await unregisterMobilePushDevice(sessionId);
|
|
8706
|
+
}, "commandMobilePushUnregister"), commandListWebhookEventTypes = __name2(async () => {
|
|
8704
8707
|
await listWebhookEventTypes();
|
|
8705
8708
|
}, "commandListWebhookEventTypes"), commandListWebhookEndpoints = __name2(async () => {
|
|
8706
8709
|
await listWebhookEndpoints();
|
|
@@ -8710,26 +8713,24 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8710
8713
|
await getWebhookEndpoint(id);
|
|
8711
8714
|
}, "commandGetWebhookEndpoint"), commandCreateWebhookEndpoint = __name2(async ({ flags }) => {
|
|
8712
8715
|
const name = getFlag(flags, "name"), url = getFlag(flags, "url"), events = parseCommaSeparatedIds(getFlag(flags, "events"));
|
|
8713
|
-
if (!name || !url || !events?.length) throw new Error(
|
|
8714
|
-
"create-webhook-endpoint requires --name, --url and --events"
|
|
8715
|
-
);
|
|
8716
|
+
if (!name || !url || !events?.length) throw new Error("create-webhook-endpoint requires --name, --url and --events");
|
|
8716
8717
|
await createWebhookEndpoint({ name, url, eventPatterns: events, enabled: parseOptionalBoolFlag(flags, "enabled") ?? !0 });
|
|
8717
|
-
}, "commandCreateWebhookEndpoint"), commandUpdateWebhookEndpoint = __name2(
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8718
|
+
}, "commandCreateWebhookEndpoint"), commandUpdateWebhookEndpoint = __name2(
|
|
8719
|
+
async ({ flags, positional }) => {
|
|
8720
|
+
const id = positional[0];
|
|
8721
|
+
if (!id) throw new Error("update-webhook-endpoint requires <id>");
|
|
8722
|
+
const events = parseCommaSeparatedIds(getFlag(flags, "events"));
|
|
8723
|
+
await updateWebhookEndpoint({ id, name: getFlag(flags, "name"), url: getFlag(flags, "url"), eventPatterns: events?.length ? events : void 0, enabled: parseOptionalBoolFlag(flags, "enabled") });
|
|
8724
|
+
},
|
|
8725
|
+
"commandUpdateWebhookEndpoint"
|
|
8726
|
+
), commandDeleteWebhookEndpoint = __name2(async ({ positional }) => {
|
|
8723
8727
|
const id = positional[0];
|
|
8724
8728
|
if (!id) throw new Error("delete-webhook-endpoint requires <id>");
|
|
8725
8729
|
await deleteWebhookEndpoint(id);
|
|
8726
8730
|
}, "commandDeleteWebhookEndpoint"), commandRotateWebhookSecret = __name2(async ({ flags, positional }) => {
|
|
8727
8731
|
const id = positional[0];
|
|
8728
8732
|
if (!id) throw new Error("rotate-webhook-secret requires <id>");
|
|
8729
|
-
const ttl = getFlag(
|
|
8730
|
-
flags,
|
|
8731
|
-
"previousSecretTtlHours"
|
|
8732
|
-
);
|
|
8733
|
+
const ttl = getFlag(flags, "previousSecretTtlHours");
|
|
8733
8734
|
await rotateWebhookSecret({ id, previousSecretTtlHours: ttl === void 0 ? void 0 : Number.parseInt(ttl, 10) });
|
|
8734
8735
|
}, "commandRotateWebhookSecret"), commandSendWebhookTestEvent = __name2(async ({ positional }) => {
|
|
8735
8736
|
const id = positional[0];
|
|
@@ -8740,17 +8741,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8740
8741
|
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
8742
|
const cursor = getFlag(flags, "cursor"), direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
8742
8743
|
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
|
-
});
|
|
8744
|
+
await listWebhookDeliveries({ endpointId: getFlag(flags, "endpointId"), ...statuses.length ? { status: statuses } : {}, eventType: getFlag(flags, "eventType"), cursor, direction, limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8751
8745
|
}, "commandListWebhookDeliveries"), commandGetWebhookDelivery = __name2(async ({ positional }) => {
|
|
8752
8746
|
const id = positional[0];
|
|
8753
|
-
if (!id) throw new Error(
|
|
8747
|
+
if (!id) throw new Error(
|
|
8748
|
+
"get-webhook-delivery requires <id>"
|
|
8749
|
+
);
|
|
8754
8750
|
await getWebhookDelivery(id);
|
|
8755
8751
|
}, "commandGetWebhookDelivery"), commandReplayWebhookDelivery = __name2(async ({ positional }) => {
|
|
8756
8752
|
const id = positional[0];
|
|
@@ -8791,7 +8787,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8791
8787
|
await createInboundSource({ externalSourceId, name });
|
|
8792
8788
|
}, "commandCreateInboundSource"), commandGetInboundSource = __name2(async ({ positional }) => {
|
|
8793
8789
|
const sourceId = positional[0];
|
|
8794
|
-
if (!sourceId) throw new Error(
|
|
8790
|
+
if (!sourceId) throw new Error(
|
|
8791
|
+
"get-inbound-source requires <sourceId>"
|
|
8792
|
+
);
|
|
8795
8793
|
await getInboundSource(sourceId);
|
|
8796
8794
|
}, "commandGetInboundSource"), commandUpdateInboundSource = __name2(async ({ flags, positional }) => {
|
|
8797
8795
|
const sourceId = positional[0], name = getFlag(flags, "name");
|
|
@@ -8802,11 +8800,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8802
8800
|
await listInboundSubmissions({ cursor: getFlag(flags, "cursor"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") ?? 25, sourceId: getFlag(flags, "sourceId") });
|
|
8803
8801
|
}, "commandListInboundSubmissions"), commandCountInboundSubmissions = __name2(async ({ flags }) => {
|
|
8804
8802
|
await countInboundSubmissions({ sourceId: getFlag(flags, "sourceId") });
|
|
8805
|
-
}, "commandCountInboundSubmissions"), commandGetInboundSubmission = __name2(
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8803
|
+
}, "commandCountInboundSubmissions"), commandGetInboundSubmission = __name2(
|
|
8804
|
+
async ({ positional }) => {
|
|
8805
|
+
const submissionId = positional[0];
|
|
8806
|
+
if (!submissionId) throw new Error("get-inbound-submission requires <submissionId>");
|
|
8807
|
+
await getInboundSubmission(submissionId);
|
|
8808
|
+
},
|
|
8809
|
+
"commandGetInboundSubmission"
|
|
8810
|
+
), commandSaveInboundMapping = __name2(async ({ flags, positional }) => {
|
|
8810
8811
|
const sourceId = positional[0], payloadRaw = getFlag(flags, "payload");
|
|
8811
8812
|
if (!sourceId || payloadRaw === void 0) throw new Error("save-inbound-mapping requires <sourceId> --payload <JSON array>");
|
|
8812
8813
|
const mappings = parseJsonFlag(String(payloadRaw), "--payload");
|
|
@@ -8821,24 +8822,19 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8821
8822
|
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");
|
|
8822
8823
|
await updateInboundProcessing({ processingEnabled: enabled, processingMode: String(mode), sourceId });
|
|
8823
8824
|
}, "commandUpdateInboundProcessing"), commandGetApprovedBudgets = __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") });
|
|
8825
|
+
await getApprovedBudgets({ projectId: getFlag(flags, "projectId"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit"), minRevenue: parseOptionalNumber(getFlag(flags, "minRevenue"), "--minRevenue"), maxRevenue: parseOptionalNumber(getFlag(flags, "maxRevenue"), "--maxRevenue") });
|
|
8828
8826
|
}, "commandGetApprovedBudgets"), commandGetBudgetCategoryBenchmarks = __name2(async ({ flags, positional }) => {
|
|
8829
8827
|
const id = positional[0];
|
|
8830
|
-
if (!id) throw new Error(
|
|
8828
|
+
if (!id) throw new Error(
|
|
8829
|
+
"get-budget-category-benchmarks requires <categoryId> [--limit]"
|
|
8830
|
+
);
|
|
8831
8831
|
await getBudgetCategoryBenchmarks({ categoryId: id, limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8832
8832
|
}, "commandGetBudgetCategoryBenchmarks"), commandGetItemPricingHistory = __name2(async ({ flags }) => {
|
|
8833
8833
|
await getItemPricingHistory({ itemName: getFlag(flags, "itemName"), categoryId: getFlag(flags, "categoryId"), supplierId: getFlag(flags, "supplierId"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8834
8834
|
}, "commandGetItemPricingHistory"), commandGetSupplierPricingHistory = __name2(async ({ flags, positional }) => {
|
|
8835
8835
|
const id = positional[0];
|
|
8836
8836
|
if (!id) throw new Error("get-supplier-pricing-history requires <supplierId> [--itemCategoryId] [--limit]");
|
|
8837
|
-
await getSupplierPricingHistory({
|
|
8838
|
-
supplierId: id,
|
|
8839
|
-
itemCategoryId: getFlag(flags, "itemCategoryId"),
|
|
8840
|
-
limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit")
|
|
8841
|
-
});
|
|
8837
|
+
await getSupplierPricingHistory({ supplierId: id, itemCategoryId: getFlag(flags, "itemCategoryId"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8842
8838
|
}, "commandGetSupplierPricingHistory"), CLI_COMMAND_HANDLERS = /* @__PURE__ */ new Map([
|
|
8843
8839
|
["whoami", commandWhoami],
|
|
8844
8840
|
["list-budgets", commandListBudgets],
|
|
@@ -8948,9 +8944,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8948
8944
|
["update-customer-invoice-qbo-drift", commandUpdateCustomerInvoiceQboDrift],
|
|
8949
8945
|
["mark-customer-invoice-sent-externally", commandMarkCustomerInvoiceSentExternally],
|
|
8950
8946
|
["sync-customer-invoice", commandSyncCustomerInvoice],
|
|
8951
|
-
["get-pending-approval", async ({
|
|
8952
|
-
positional
|
|
8953
|
-
}) => {
|
|
8947
|
+
["get-pending-approval", async ({ positional }) => {
|
|
8954
8948
|
const id = positional[0];
|
|
8955
8949
|
if (!id) throw new Error("approval get requires <approvalId>");
|
|
8956
8950
|
await getPendingApproval(id);
|
|
@@ -9040,6 +9034,8 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9040
9034
|
["count-integration-operations", commandListIntegrationOperations],
|
|
9041
9035
|
["get-integration-operation", commandGetIntegrationOperation],
|
|
9042
9036
|
["retry-integration-operation", commandRetryIntegrationOperation],
|
|
9037
|
+
["mobile-push-status", commandMobilePushStatus],
|
|
9038
|
+
["mobile-push-unregister", commandMobilePushUnregister],
|
|
9043
9039
|
["list-webhook-event-types", commandListWebhookEventTypes],
|
|
9044
9040
|
["list-webhook-endpoints", commandListWebhookEndpoints],
|
|
9045
9041
|
["get-webhook-endpoint", commandGetWebhookEndpoint],
|
|
@@ -9071,14 +9067,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9071
9067
|
const handler = CLI_COMMAND_HANDLERS.get(context.cmd);
|
|
9072
9068
|
if (!handler) throw new Error("Unknown command: ".concat(context.cmd, ". Run 'bb help'."));
|
|
9073
9069
|
await handler(context);
|
|
9074
|
-
}, "dispatchCliCommand"), startCliSession = __name2(
|
|
9075
|
-
(context, command
|
|
9076
|
-
|
|
9077
|
-
},
|
|
9078
|
-
"startCliSession"
|
|
9079
|
-
), failCliSession = __name2((context, command, error2) => {
|
|
9070
|
+
}, "dispatchCliCommand"), startCliSession = __name2((context, command) => {
|
|
9071
|
+
setActiveCliSession({ runtime: context.runtime, invocation: { command, cliVersion: context.version, apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, quiet: context.quiet, debug: context.debug }, effects: [], permissions: {} });
|
|
9072
|
+
}, "startCliSession"), failCliSession = __name2((context, command, error2) => {
|
|
9080
9073
|
startCliSession(context, command);
|
|
9081
|
-
const exitCode = emitCommandError(
|
|
9074
|
+
const exitCode = emitCommandError(
|
|
9075
|
+
error2
|
|
9076
|
+
);
|
|
9082
9077
|
return clearActiveCliSession(), exitCode;
|
|
9083
9078
|
}, "failCliSession"), resolveRootArguments = __name2((rawArgv, runtime) => {
|
|
9084
9079
|
const rootArguments = parseRootArguments(rawArgv), apiBaseUrl = rootArguments.apiBaseUrl ?? runtime.env.BB_API_URL?.trim();
|
|
@@ -9090,19 +9085,19 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9090
9085
|
}
|
|
9091
9086
|
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
9087
|
runtime.stdout.write("".concat(createHumanHelp(helpCommand), "\n"));
|
|
9093
|
-
}, "printCliHelp"), runCompletionCommand = __name2(
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9088
|
+
}, "printCliHelp"), runCompletionCommand = __name2(
|
|
9089
|
+
(context, commandArgv) => {
|
|
9090
|
+
const shell = commandArgv[1];
|
|
9091
|
+
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);
|
|
9092
|
+
},
|
|
9093
|
+
"runCompletionCommand"
|
|
9094
|
+
), 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) => {
|
|
9097
9095
|
const apiKeyActive = !!runtime.env.BB_API_KEY?.trim(), credentials = apiKeyActive ? null : await store.get();
|
|
9098
9096
|
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" };
|
|
9099
9097
|
}, "authStatusResult"), runAuthAction = __name2(async (context, authAction, rawArgv, store) => {
|
|
9100
9098
|
const { runtime } = context;
|
|
9101
9099
|
if (authAction === "login") {
|
|
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 });
|
|
9100
|
+
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(rawArgv, "--no-browser") ? { openBrowser: __name2(async () => !1, "openBrowser") } : {}, store });
|
|
9106
9101
|
emitCommandResult({ authenticated: !0, method: "browser-session", session: credentials.session, storage: "Bun.secrets" });
|
|
9107
9102
|
} 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() });
|
|
9108
9103
|
}, "runAuthAction"), runAuthCommand = __name2(async (context, authAction, commandArgv, rawArgv, credentialStore) => {
|
|
@@ -9132,9 +9127,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9132
9127
|
}
|
|
9133
9128
|
configureAccessToken(accessToken);
|
|
9134
9129
|
}, "configureCliAuthentication"), CONFIRMATION_EXEMPT_COMMANDS = /* @__PURE__ */ new Set(["create-bill", "import-qbo-customer-invoice", "approve-supplier"]), confirmCanonicalMutation = __name2(async (resolvedCommand, cmd) => {
|
|
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
|
-
);
|
|
9130
|
+
resolvedCommand.isLegacyAlias || CONFIRMATION_EXEMPT_COMMANDS.has(cmd) || resolvedCommand.command.effects.length === 0 || await confirmCurrentCommand({ action: resolvedCommand.command.path.join(" "), target: commandConfirmationTarget(resolvedCommand), details: "Canonical v2 mutation. Supply every effect-specific --allow-* flag for non-interactive execution." });
|
|
9138
9131
|
}, "confirmCanonicalMutation"), runResolvedCommand = __name2(async (context, argv, rawArgv, resolvedCommand, credentialStore, configureAccessToken) => {
|
|
9139
9132
|
const { runtime, quiet, debug } = context, effectiveArgv = legacyArgvForCommand(argv, resolvedCommand), { command, positional, flags } = parseArgs(effectiveArgv);
|
|
9140
9133
|
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'));
|
|
@@ -9163,11 +9156,11 @@ async function runCli(argv = process.argv, runtime = createProcessRuntime(), cre
|
|
|
9163
9156
|
if (isHelpRequest(commandArgv)) return printCliHelp(commandArgv, runtime), 0;
|
|
9164
9157
|
if (commandArgv[0] === "completion") return runCompletionCommand(context, commandArgv);
|
|
9165
9158
|
if (isVersionRequest(commandArgv)) return runVersionCommand(context);
|
|
9166
|
-
const authAction = authActionFromArgv(
|
|
9159
|
+
const authAction = authActionFromArgv(commandArgv);
|
|
9160
|
+
if (authAction !== void 0) return await runAuthCommand(context, authAction, commandArgv, rawArgv, credentialStore);
|
|
9161
|
+
const resolvedCommand = resolveCommand(
|
|
9167
9162
|
commandArgv
|
|
9168
9163
|
);
|
|
9169
|
-
if (authAction !== void 0) return await runAuthCommand(context, authAction, commandArgv, rawArgv, credentialStore);
|
|
9170
|
-
const resolvedCommand = resolveCommand(commandArgv);
|
|
9171
9164
|
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);
|
|
9172
9165
|
}
|
|
9173
9166
|
__name(runCli, "runCli"), __name2(runCli, "runCli"), import.meta.main && (assertBunRuntime(), process.exitCode = await runCli());
|