@go-labs-sg/bb 2.40.0 → 2.41.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/dist/index.js +139 -92
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6577,6 +6577,87 @@ var api2 = new Proxy({}, {
|
|
|
6577
6577
|
get: (_target, property, receiver) => Reflect.get(activeClient, property, receiver)
|
|
6578
6578
|
});
|
|
6579
6579
|
|
|
6580
|
+
// src/prisma-enums.ts
|
|
6581
|
+
var ProjectStatus = {
|
|
6582
|
+
PITCH: "PITCH",
|
|
6583
|
+
WON: "WON",
|
|
6584
|
+
COMPLETED: "COMPLETED",
|
|
6585
|
+
RECONCILED: "RECONCILED",
|
|
6586
|
+
LOST: "LOST"
|
|
6587
|
+
};
|
|
6588
|
+
var SupplierQuotationStatus = {
|
|
6589
|
+
DRAFT: "DRAFT",
|
|
6590
|
+
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6591
|
+
APPROVED: "APPROVED",
|
|
6592
|
+
REJECTED: "REJECTED",
|
|
6593
|
+
SUPERSEDED: "SUPERSEDED"
|
|
6594
|
+
};
|
|
6595
|
+
var BudgetStatus = {
|
|
6596
|
+
DRAFT: "DRAFT",
|
|
6597
|
+
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6598
|
+
APPROVED: "APPROVED",
|
|
6599
|
+
REJECTED: "REJECTED",
|
|
6600
|
+
ESTIMATE_CREATED: "ESTIMATE_CREATED",
|
|
6601
|
+
ESTIMATE_SENT: "ESTIMATE_SENT",
|
|
6602
|
+
ESTIMATE_ACCEPTED: "ESTIMATE_ACCEPTED",
|
|
6603
|
+
ESTIMATE_REJECTED: "ESTIMATE_REJECTED",
|
|
6604
|
+
ESTIMATE_CLOSED: "ESTIMATE_CLOSED"
|
|
6605
|
+
};
|
|
6606
|
+
var ApprovalStatus = {
|
|
6607
|
+
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6608
|
+
APPROVED: "APPROVED",
|
|
6609
|
+
REJECTED: "REJECTED",
|
|
6610
|
+
SUPERSEDED: "SUPERSEDED"
|
|
6611
|
+
};
|
|
6612
|
+
var ApprovalType = {
|
|
6613
|
+
BUDGET: "BUDGET",
|
|
6614
|
+
SUPPLIER: "SUPPLIER",
|
|
6615
|
+
BILL: "BILL",
|
|
6616
|
+
CUSTOMER_INVOICE: "CUSTOMER_INVOICE",
|
|
6617
|
+
QUOTATION: "QUOTATION"
|
|
6618
|
+
};
|
|
6619
|
+
var UserRole = {
|
|
6620
|
+
USER: "USER",
|
|
6621
|
+
LEAD: "LEAD",
|
|
6622
|
+
ADMIN: "ADMIN",
|
|
6623
|
+
INSIDE_SALES: "INSIDE_SALES",
|
|
6624
|
+
ACCOUNTING_TEAM: "ACCOUNTING_TEAM"
|
|
6625
|
+
};
|
|
6626
|
+
var BillStatus = {
|
|
6627
|
+
DRAFT: "DRAFT",
|
|
6628
|
+
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6629
|
+
CHECKED: "CHECKED",
|
|
6630
|
+
APPROVED: "APPROVED",
|
|
6631
|
+
PAID: "PAID",
|
|
6632
|
+
REJECTED: "REJECTED"
|
|
6633
|
+
};
|
|
6634
|
+
var BillVerificationStatus = {
|
|
6635
|
+
PENDING: "PENDING",
|
|
6636
|
+
PASS: "PASS",
|
|
6637
|
+
FAIL: "FAIL",
|
|
6638
|
+
MANUAL_REVIEW: "MANUAL_REVIEW"
|
|
6639
|
+
};
|
|
6640
|
+
var SupplierQuotationFileRole = {
|
|
6641
|
+
ORIGINAL: "ORIGINAL",
|
|
6642
|
+
STAFF_SIGNED: "STAFF_SIGNED",
|
|
6643
|
+
FINAL_SIGNED: "FINAL_SIGNED"
|
|
6644
|
+
};
|
|
6645
|
+
var InboundProcessingMode = {
|
|
6646
|
+
COLLECT_ONLY: "COLLECT_ONLY",
|
|
6647
|
+
SHADOW: "SHADOW",
|
|
6648
|
+
ACTIVE: "ACTIVE"
|
|
6649
|
+
};
|
|
6650
|
+
var AttachmentType = {
|
|
6651
|
+
GLOBAL_ATTACHMENT: "GLOBAL_ATTACHMENT",
|
|
6652
|
+
BUDGET: "BUDGET",
|
|
6653
|
+
BUDGET_WIN_PROOF: "BUDGET_WIN_PROOF",
|
|
6654
|
+
ITEM: "ITEM",
|
|
6655
|
+
SUPPLIER: "SUPPLIER",
|
|
6656
|
+
BILL: "BILL",
|
|
6657
|
+
BILL_PAYMENT_PROOF: "BILL_PAYMENT_PROOF",
|
|
6658
|
+
QUOTATION: "QUOTATION"
|
|
6659
|
+
};
|
|
6660
|
+
|
|
6580
6661
|
// src/commands/index.ts
|
|
6581
6662
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
6582
6663
|
import { readFile as readFile2, writeFile } from "fs/promises";
|
|
@@ -6588,14 +6669,14 @@ var EstimationMode = {
|
|
|
6588
6669
|
MICRO: "MICRO",
|
|
6589
6670
|
MANPOWER_SPECIFIED: "MANPOWER_SPECIFIED"
|
|
6590
6671
|
};
|
|
6591
|
-
var
|
|
6672
|
+
var ProjectStatus2 = {
|
|
6592
6673
|
PITCH: "PITCH",
|
|
6593
6674
|
WON: "WON",
|
|
6594
6675
|
COMPLETED: "COMPLETED",
|
|
6595
6676
|
RECONCILED: "RECONCILED",
|
|
6596
6677
|
LOST: "LOST"
|
|
6597
6678
|
};
|
|
6598
|
-
var
|
|
6679
|
+
var BudgetStatus2 = {
|
|
6599
6680
|
DRAFT: "DRAFT",
|
|
6600
6681
|
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6601
6682
|
APPROVED: "APPROVED",
|
|
@@ -6606,13 +6687,13 @@ var BudgetStatus = {
|
|
|
6606
6687
|
ESTIMATE_REJECTED: "ESTIMATE_REJECTED",
|
|
6607
6688
|
ESTIMATE_CLOSED: "ESTIMATE_CLOSED"
|
|
6608
6689
|
};
|
|
6609
|
-
var
|
|
6690
|
+
var ApprovalStatus2 = {
|
|
6610
6691
|
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6611
6692
|
APPROVED: "APPROVED",
|
|
6612
6693
|
REJECTED: "REJECTED",
|
|
6613
6694
|
SUPERSEDED: "SUPERSEDED"
|
|
6614
6695
|
};
|
|
6615
|
-
var
|
|
6696
|
+
var ApprovalType2 = {
|
|
6616
6697
|
BUDGET: "BUDGET",
|
|
6617
6698
|
SUPPLIER: "SUPPLIER",
|
|
6618
6699
|
BILL: "BILL",
|
|
@@ -6639,7 +6720,15 @@ var CustomerInvoiceBatchStatus = {
|
|
|
6639
6720
|
EXPIRED_VOIDED: "EXPIRED_VOIDED",
|
|
6640
6721
|
PARTIAL_QBO_FAILURE: "PARTIAL_QBO_FAILURE"
|
|
6641
6722
|
};
|
|
6642
|
-
var
|
|
6723
|
+
var CustomerInvoiceStatus = {
|
|
6724
|
+
CREATED_IN_QBO: "CREATED_IN_QBO",
|
|
6725
|
+
APPROVED: "APPROVED",
|
|
6726
|
+
SENT: "SENT",
|
|
6727
|
+
PAID: "PAID",
|
|
6728
|
+
VOIDED: "VOIDED",
|
|
6729
|
+
QBO_SYNC_ERROR: "QBO_SYNC_ERROR"
|
|
6730
|
+
};
|
|
6731
|
+
var BillStatus2 = {
|
|
6643
6732
|
DRAFT: "DRAFT",
|
|
6644
6733
|
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6645
6734
|
CHECKED: "CHECKED",
|
|
@@ -6650,23 +6739,23 @@ var BillStatus = {
|
|
|
6650
6739
|
|
|
6651
6740
|
// ../utils/src/filter-enums.ts
|
|
6652
6741
|
var ExtendedApprovalStatus = {
|
|
6653
|
-
...
|
|
6742
|
+
...ApprovalStatus2,
|
|
6654
6743
|
ALL: "ALL"
|
|
6655
6744
|
};
|
|
6656
6745
|
var ExtendedApprovalType = {
|
|
6657
|
-
...
|
|
6746
|
+
...ApprovalType2,
|
|
6658
6747
|
ALL: "ALL"
|
|
6659
6748
|
};
|
|
6660
6749
|
var ExtendedProjectStatus = {
|
|
6661
|
-
...
|
|
6750
|
+
...ProjectStatus2,
|
|
6662
6751
|
ALL: "ALL"
|
|
6663
6752
|
};
|
|
6664
6753
|
var ExtendedBudgetStatus = {
|
|
6665
|
-
...
|
|
6754
|
+
...BudgetStatus2,
|
|
6666
6755
|
ALL: "ALL"
|
|
6667
6756
|
};
|
|
6668
6757
|
var ExtendedBillStatus = {
|
|
6669
|
-
...
|
|
6758
|
+
...BillStatus2,
|
|
6670
6759
|
ALL: "ALL"
|
|
6671
6760
|
};
|
|
6672
6761
|
var ExtendedEstimationMode = {
|
|
@@ -6712,58 +6801,16 @@ var invoiceSplitSetupNextAction = (budgetId) => ({
|
|
|
6712
6801
|
var customerInvoiceLifecycleStatuses = [
|
|
6713
6802
|
...Object.values(CustomerInvoiceBatchStatus),
|
|
6714
6803
|
"PARTIALLY_SENT",
|
|
6715
|
-
|
|
6804
|
+
CustomerInvoiceStatus.SENT,
|
|
6716
6805
|
"PARTIALLY_PAID",
|
|
6717
|
-
|
|
6718
|
-
|
|
6806
|
+
CustomerInvoiceStatus.PAID,
|
|
6807
|
+
CustomerInvoiceStatus.VOIDED
|
|
6719
6808
|
];
|
|
6720
6809
|
|
|
6721
|
-
// src/prisma-enums.ts
|
|
6722
|
-
var ProjectStatus2 = {
|
|
6723
|
-
PITCH: "PITCH",
|
|
6724
|
-
WON: "WON",
|
|
6725
|
-
COMPLETED: "COMPLETED",
|
|
6726
|
-
RECONCILED: "RECONCILED",
|
|
6727
|
-
LOST: "LOST"
|
|
6728
|
-
};
|
|
6729
|
-
var SupplierQuotationStatus = {
|
|
6730
|
-
DRAFT: "DRAFT",
|
|
6731
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6732
|
-
APPROVED: "APPROVED",
|
|
6733
|
-
REJECTED: "REJECTED",
|
|
6734
|
-
SUPERSEDED: "SUPERSEDED"
|
|
6735
|
-
};
|
|
6736
|
-
var BudgetStatus2 = {
|
|
6737
|
-
DRAFT: "DRAFT",
|
|
6738
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6739
|
-
APPROVED: "APPROVED",
|
|
6740
|
-
REJECTED: "REJECTED",
|
|
6741
|
-
ESTIMATE_CREATED: "ESTIMATE_CREATED",
|
|
6742
|
-
ESTIMATE_SENT: "ESTIMATE_SENT",
|
|
6743
|
-
ESTIMATE_ACCEPTED: "ESTIMATE_ACCEPTED",
|
|
6744
|
-
ESTIMATE_REJECTED: "ESTIMATE_REJECTED",
|
|
6745
|
-
ESTIMATE_CLOSED: "ESTIMATE_CLOSED"
|
|
6746
|
-
};
|
|
6747
|
-
var UserRole = {
|
|
6748
|
-
USER: "USER",
|
|
6749
|
-
LEAD: "LEAD",
|
|
6750
|
-
ADMIN: "ADMIN",
|
|
6751
|
-
INSIDE_SALES: "INSIDE_SALES",
|
|
6752
|
-
ACCOUNTING_TEAM: "ACCOUNTING_TEAM"
|
|
6753
|
-
};
|
|
6754
|
-
var BillStatus2 = {
|
|
6755
|
-
DRAFT: "DRAFT",
|
|
6756
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
6757
|
-
CHECKED: "CHECKED",
|
|
6758
|
-
APPROVED: "APPROVED",
|
|
6759
|
-
PAID: "PAID",
|
|
6760
|
-
REJECTED: "REJECTED"
|
|
6761
|
-
};
|
|
6762
|
-
|
|
6763
6810
|
// src/parse-cli-enums.ts
|
|
6764
|
-
var BUDGET_STATUS_VALUES = new Set(Object.values(
|
|
6765
|
-
var BILL_STATUS_VALUES = new Set(Object.values(
|
|
6766
|
-
var PROJECT_STATUS_VALUES = new Set(Object.values(
|
|
6811
|
+
var BUDGET_STATUS_VALUES = new Set(Object.values(BudgetStatus));
|
|
6812
|
+
var BILL_STATUS_VALUES = new Set(Object.values(BillStatus));
|
|
6813
|
+
var PROJECT_STATUS_VALUES = new Set(Object.values(ProjectStatus));
|
|
6767
6814
|
var SUPPLIER_QUOTATION_STATUS_VALUES = new Set(Object.values(SupplierQuotationStatus));
|
|
6768
6815
|
var CUSTOMER_INVOICE_LIFECYCLE_STATUS_VALUES = new Set(customerInvoiceLifecycleStatuses);
|
|
6769
6816
|
var USER_ROLE_VALUES = new Set(Object.values(UserRole));
|
|
@@ -6810,7 +6857,7 @@ function parseBillStatusForUpdate(raw) {
|
|
|
6810
6857
|
if (!BILL_STATUS_VALUES.has(raw)) {
|
|
6811
6858
|
throw new Error(`Invalid bill status "${raw}". Use one of: ${[...BILL_STATUS_VALUES].join(", ")}.`);
|
|
6812
6859
|
}
|
|
6813
|
-
if (raw ===
|
|
6860
|
+
if (raw === BillStatus.PENDING_APPROVAL) {
|
|
6814
6861
|
throw new Error("Cannot set PENDING_APPROVAL via update-bill-status. Use create-bill-approval <billId> instead.");
|
|
6815
6862
|
}
|
|
6816
6863
|
return raw;
|
|
@@ -7049,10 +7096,10 @@ function parseApprovalTypeFlag(raw) {
|
|
|
7049
7096
|
}
|
|
7050
7097
|
return u;
|
|
7051
7098
|
}
|
|
7052
|
-
var budgetStatusesForHelp = Object.values(
|
|
7053
|
-
var billStatusesForHelp = Object.values(
|
|
7054
|
-
var billStatusesForUpdateHelp = Object.values(
|
|
7055
|
-
var projectStatusesForHelp = Object.values(
|
|
7099
|
+
var budgetStatusesForHelp = Object.values(BudgetStatus);
|
|
7100
|
+
var billStatusesForHelp = Object.values(BillStatus);
|
|
7101
|
+
var billStatusesForUpdateHelp = Object.values(BillStatus).filter((s) => s !== BillStatus.PENDING_APPROVAL);
|
|
7102
|
+
var projectStatusesForHelp = Object.values(ProjectStatus);
|
|
7056
7103
|
var userRolesForHelp = Object.values(UserRole);
|
|
7057
7104
|
|
|
7058
7105
|
// ../utils/src/rich-text.ts
|
|
@@ -7500,7 +7547,7 @@ function parseCreateBillPayload(raw, draftOnlyFlag, quotationExempt = false, req
|
|
|
7500
7547
|
if (vr !== undefined && vr !== null) {
|
|
7501
7548
|
const v = requireObject(vr, "verificationResults");
|
|
7502
7549
|
const verificationResultStatus = v.status;
|
|
7503
|
-
if (verificationResultStatus !==
|
|
7550
|
+
if (verificationResultStatus !== BillVerificationStatus.PENDING && verificationResultStatus !== BillVerificationStatus.PASS && verificationResultStatus !== BillVerificationStatus.FAIL && verificationResultStatus !== BillVerificationStatus.MANUAL_REVIEW) {
|
|
7504
7551
|
throw new Error("create-bill payload.verificationResults.status must be PENDING | PASS | FAIL | MANUAL_REVIEW.");
|
|
7505
7552
|
}
|
|
7506
7553
|
verificationResults = {
|
|
@@ -7513,7 +7560,7 @@ function parseCreateBillPayload(raw, draftOnlyFlag, quotationExempt = false, req
|
|
|
7513
7560
|
}
|
|
7514
7561
|
const verificationStatus = o.verificationStatus;
|
|
7515
7562
|
let vs;
|
|
7516
|
-
if (verificationStatus ===
|
|
7563
|
+
if (verificationStatus === BillVerificationStatus.PENDING || verificationStatus === BillVerificationStatus.PASS || verificationStatus === BillVerificationStatus.FAIL || verificationStatus === BillVerificationStatus.MANUAL_REVIEW) {
|
|
7517
7564
|
vs = verificationStatus;
|
|
7518
7565
|
} else if (verificationStatus !== undefined && verificationStatus !== null) {
|
|
7519
7566
|
throw new Error("create-bill payload.verificationStatus must be PENDING | PASS | FAIL | MANUAL_REVIEW.");
|
|
@@ -8004,11 +8051,11 @@ var confirmCurrentCommand = async (input) => {
|
|
|
8004
8051
|
};
|
|
8005
8052
|
// src/commands/index.ts
|
|
8006
8053
|
import { contentType } from "mime-types";
|
|
8007
|
-
var BUDGET =
|
|
8008
|
-
var BILL =
|
|
8009
|
-
var SUPPLIER =
|
|
8010
|
-
var QUOTATION =
|
|
8011
|
-
var CUSTOMER_INVOICE =
|
|
8054
|
+
var BUDGET = ApprovalType.BUDGET;
|
|
8055
|
+
var BILL = ApprovalType.BILL;
|
|
8056
|
+
var SUPPLIER = ApprovalType.SUPPLIER;
|
|
8057
|
+
var QUOTATION = ApprovalType.QUOTATION;
|
|
8058
|
+
var CUSTOMER_INVOICE = ApprovalType.CUSTOMER_INVOICE;
|
|
8012
8059
|
var ASANA_WON_LOST_SECTION_GIDS = new Set([
|
|
8013
8060
|
"1211678338364908",
|
|
8014
8061
|
"1211678338364907"
|
|
@@ -8063,7 +8110,7 @@ var createApprovalEmailDeliveryFailure = (error) => ({
|
|
|
8063
8110
|
error
|
|
8064
8111
|
});
|
|
8065
8112
|
function isPendingRequest(n) {
|
|
8066
|
-
return n.notificationType === "request" && n.status ===
|
|
8113
|
+
return n.notificationType === "request" && n.status === ApprovalStatus.PENDING_APPROVAL;
|
|
8067
8114
|
}
|
|
8068
8115
|
var out = (data) => {
|
|
8069
8116
|
emitCommandResult(data);
|
|
@@ -8270,11 +8317,11 @@ var quotationAttachmentContentTypeForFileName = (fileName) => {
|
|
|
8270
8317
|
throw new Error(`Unsupported quotation attachment type: ${fileName}. Use PDF, JPEG, or PNG.`);
|
|
8271
8318
|
};
|
|
8272
8319
|
var LOCKED_BUDGET_STATUSES_REQUIRING_CONFIRMATION = new Set([
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8320
|
+
BudgetStatus.ESTIMATE_CREATED,
|
|
8321
|
+
BudgetStatus.ESTIMATE_SENT,
|
|
8322
|
+
BudgetStatus.ESTIMATE_ACCEPTED,
|
|
8323
|
+
BudgetStatus.ESTIMATE_REJECTED,
|
|
8324
|
+
BudgetStatus.ESTIMATE_CLOSED
|
|
8278
8325
|
]);
|
|
8279
8326
|
var lockedBudgetStatusLabels = {
|
|
8280
8327
|
ESTIMATE_CREATED: "Estimate Created",
|
|
@@ -8444,7 +8491,7 @@ async function updateBudgetStatus(budgetId, status, opts) {
|
|
|
8444
8491
|
});
|
|
8445
8492
|
out({
|
|
8446
8493
|
...result,
|
|
8447
|
-
invoiceSetup: result.newStatus ===
|
|
8494
|
+
invoiceSetup: result.newStatus === BudgetStatus.ESTIMATE_ACCEPTED && result.hasQuickbooksEstimate ? invoiceSplitSetupNextAction(budgetId) : null
|
|
8448
8495
|
});
|
|
8449
8496
|
}
|
|
8450
8497
|
var assertBudgetActionReadiness = async ({
|
|
@@ -8541,7 +8588,7 @@ async function approveBill(billId, overBudgetOverrideReason) {
|
|
|
8541
8588
|
}
|
|
8542
8589
|
const result = await api2.bill.updateApproval.mutate({
|
|
8543
8590
|
billApprovalId: approval.id,
|
|
8544
|
-
status:
|
|
8591
|
+
status: ApprovalStatus.APPROVED,
|
|
8545
8592
|
overBudgetOverrideReason
|
|
8546
8593
|
});
|
|
8547
8594
|
if (result.processing) {
|
|
@@ -8637,10 +8684,10 @@ async function createBillApproval(billId) {
|
|
|
8637
8684
|
});
|
|
8638
8685
|
}
|
|
8639
8686
|
var validateBillStatusUpdateOptions = (opts) => {
|
|
8640
|
-
if (opts.status ===
|
|
8687
|
+
if (opts.status === BillStatus.PAID && !opts.paymentReference?.trim()) {
|
|
8641
8688
|
throw new Error("update-bill-status requires --paymentReference when status is PAID.");
|
|
8642
8689
|
}
|
|
8643
|
-
if (opts.status !==
|
|
8690
|
+
if (opts.status !== BillStatus.PAID && opts.paymentProofPath !== undefined) {
|
|
8644
8691
|
throw new Error("--paymentProof can only be used when status is PAID.");
|
|
8645
8692
|
}
|
|
8646
8693
|
if (opts.paymentProofPath !== undefined && !opts.paymentProofPath.trim()) {
|
|
@@ -8793,11 +8840,11 @@ var cleanupStagedBillAttachments = async (projectId, keys) => {
|
|
|
8793
8840
|
});
|
|
8794
8841
|
out(result);
|
|
8795
8842
|
};
|
|
8796
|
-
async function uploadBillAttachmentFromPath(billId, filePath, type =
|
|
8843
|
+
async function uploadBillAttachmentFromPath(billId, filePath, type = AttachmentType.BILL) {
|
|
8797
8844
|
const confirmed = await uploadSingleBillAttachmentFromPath(billId, filePath, type);
|
|
8798
8845
|
out(confirmed);
|
|
8799
8846
|
}
|
|
8800
|
-
var uploadSingleBillAttachmentFromPath = async (billId, filePath, type =
|
|
8847
|
+
var uploadSingleBillAttachmentFromPath = async (billId, filePath, type = AttachmentType.BILL) => {
|
|
8801
8848
|
const buf = await readFile2(filePath);
|
|
8802
8849
|
const fileName = basename(filePath);
|
|
8803
8850
|
const size = buf.byteLength;
|
|
@@ -8824,7 +8871,7 @@ var uploadSingleBillAttachmentFromPath = async (billId, filePath, type = "BILL")
|
|
|
8824
8871
|
type
|
|
8825
8872
|
});
|
|
8826
8873
|
};
|
|
8827
|
-
async function uploadBillAttachmentsFromPaths(billId, filePaths, type =
|
|
8874
|
+
async function uploadBillAttachmentsFromPaths(billId, filePaths, type = AttachmentType.BILL) {
|
|
8828
8875
|
if (filePaths.length === 0) {
|
|
8829
8876
|
throw new Error("At least one bill attachment file path is required");
|
|
8830
8877
|
}
|
|
@@ -8851,11 +8898,11 @@ async function uploadBillDocumentsFromPaths({
|
|
|
8851
8898
|
}
|
|
8852
8899
|
const invoiceResults = [];
|
|
8853
8900
|
for (const filePath of invoicePaths) {
|
|
8854
|
-
invoiceResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath,
|
|
8901
|
+
invoiceResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL));
|
|
8855
8902
|
}
|
|
8856
8903
|
const paymentProofResults = [];
|
|
8857
8904
|
for (const filePath of paymentProofPaths) {
|
|
8858
|
-
paymentProofResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath,
|
|
8905
|
+
paymentProofResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL_PAYMENT_PROOF));
|
|
8859
8906
|
}
|
|
8860
8907
|
out({
|
|
8861
8908
|
success: true,
|
|
@@ -8963,7 +9010,7 @@ async function uploadBudgetWinProofFromPath(budgetId, filePath, opts) {
|
|
|
8963
9010
|
});
|
|
8964
9011
|
const result = await api2.budget.updateBudgetStatus.mutate({
|
|
8965
9012
|
id: budgetId,
|
|
8966
|
-
status:
|
|
9013
|
+
status: BudgetStatus.ESTIMATE_ACCEPTED,
|
|
8967
9014
|
...opts?.projectManagerId !== undefined && {
|
|
8968
9015
|
projectManagerId: opts.projectManagerId
|
|
8969
9016
|
},
|
|
@@ -9498,7 +9545,7 @@ async function createSupplierFromPayload(raw) {
|
|
|
9498
9545
|
const input = parseSupplierCreatePayload(raw);
|
|
9499
9546
|
const created = await api2.supplier.createSupplier.mutate(input);
|
|
9500
9547
|
const supplier = created.result;
|
|
9501
|
-
if (supplier.status !==
|
|
9548
|
+
if (supplier.status !== ApprovalStatus.PENDING_APPROVAL) {
|
|
9502
9549
|
out(created);
|
|
9503
9550
|
return;
|
|
9504
9551
|
}
|
|
@@ -9944,7 +9991,7 @@ var reconcileProject = async (projectId) => {
|
|
|
9944
9991
|
out(result);
|
|
9945
9992
|
};
|
|
9946
9993
|
var completeProject = async (projectId) => {
|
|
9947
|
-
await updateProjectStatus(projectId,
|
|
9994
|
+
await updateProjectStatus(projectId, ProjectStatus.COMPLETED);
|
|
9948
9995
|
};
|
|
9949
9996
|
var importQuickBooksProjectId = async (projectId, projectUrl) => {
|
|
9950
9997
|
const result = await api2.project.importQboProjectId.mutate({
|
|
@@ -11114,7 +11161,7 @@ function parseCommercialRejectionProjectStatus(flags) {
|
|
|
11114
11161
|
throw new Error("--projectStatusOnCommercialRejection requires PITCH or LOST.");
|
|
11115
11162
|
}
|
|
11116
11163
|
const status = String(raw).toUpperCase();
|
|
11117
|
-
if (status ===
|
|
11164
|
+
if (status === ProjectStatus.PITCH || status === ProjectStatus.LOST) {
|
|
11118
11165
|
return status;
|
|
11119
11166
|
}
|
|
11120
11167
|
throw new Error("--projectStatusOnCommercialRejection must be PITCH or LOST.");
|
|
@@ -12336,7 +12383,7 @@ Waiting for approval\u2026
|
|
|
12336
12383
|
if (!billId || filePaths.length === 0) {
|
|
12337
12384
|
throw new Error(`${cmd} requires <billId> <filePath...> or --file/--files`);
|
|
12338
12385
|
}
|
|
12339
|
-
const attachmentType = cmd === "attach-bill-payment-receipt" ?
|
|
12386
|
+
const attachmentType = cmd === "attach-bill-payment-receipt" ? AttachmentType.BILL_PAYMENT_PROOF : AttachmentType.BILL;
|
|
12340
12387
|
const [firstFilePath] = filePaths;
|
|
12341
12388
|
if (filePaths.length === 1 && firstFilePath !== undefined) {
|
|
12342
12389
|
await uploadBillAttachmentFromPath(billId, firstFilePath, attachmentType);
|
|
@@ -12481,7 +12528,7 @@ Waiting for approval\u2026
|
|
|
12481
12528
|
throw new Error("download-quotation-pdf requires <quotationId> [original|staff|final]");
|
|
12482
12529
|
}
|
|
12483
12530
|
const roleRaw = (positional[1] ?? "final").toLowerCase();
|
|
12484
|
-
const fileRole = roleRaw === "original" ?
|
|
12531
|
+
const fileRole = roleRaw === "original" ? SupplierQuotationFileRole.ORIGINAL : roleRaw === "staff" ? SupplierQuotationFileRole.STAFF_SIGNED : roleRaw === "final" ? SupplierQuotationFileRole.FINAL_SIGNED : null;
|
|
12485
12532
|
if (!fileRole) {
|
|
12486
12533
|
throw new Error("download-quotation-pdf role must be original, staff, or final");
|
|
12487
12534
|
}
|
|
@@ -13331,7 +13378,7 @@ Waiting for approval\u2026
|
|
|
13331
13378
|
const sourceId = positional[0];
|
|
13332
13379
|
const mode = getFlag(flags, "mode");
|
|
13333
13380
|
const enabled = parseOptionalBoolFlag(flags, "enabled");
|
|
13334
|
-
if (!sourceId || !mode || enabled === undefined || !
|
|
13381
|
+
if (!sourceId || !mode || enabled === undefined || !Object.values(InboundProcessingMode).includes(String(mode))) {
|
|
13335
13382
|
throw new Error("update-inbound-processing requires <sourceId> --mode COLLECT_ONLY|SHADOW|ACTIVE --enabled true|false");
|
|
13336
13383
|
}
|
|
13337
13384
|
await updateInboundProcessing({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@go-labs-sg/bb",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.41.0",
|
|
4
4
|
"description": "Budget Builder CLI for AI agents — manage budgets, bills, claims, quotations, and customer invoices with explicit workflow previews for sensitive changes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|