@ancha-labs/cli 0.4.38 → 0.4.40
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/lib/ancha.mjs +5634 -4337
- package/lib/assets/docs/cloud.md +7 -4
- package/lib/assets/docs/tools.md +1 -1
- package/lib/assets/harbor/companion.mjs +3532 -2656
- package/lib/assets/ui/app.js +1243 -1228
- package/lib/mcp-entry.mjs +59 -5
- package/lib/worker.mjs +4528 -3247
- package/lib/world-server.mjs +2230 -1592
- package/package.json +1 -1
package/lib/mcp-entry.mjs
CHANGED
|
@@ -67308,6 +67308,7 @@ var QBO_TYPES = {
|
|
|
67308
67308
|
"AdvancedInventoryPrefs": { "fields": [["MLIAvailable", "boolean", 0, 1], ["MLIEnabled", "boolean", 0, 1], ["EnhancedInventoryReceivingEnabled", "boolean", 0, 1], ["TrackingSerialOrLotNumber", "boolean", 0, 1], ["TrackingOnSalesTransactionsEnabled", "boolean", 0, 1], ["TrackingOnPurchaseTransactionsEnabled", "boolean", 0, 1], ["TrackingOnInventoryAdjustmentEnabled", "boolean", 0, 1], ["TrackingOnBuildAssemblyEnabled", "boolean", 0, 1], ["FIFOEnabled", "boolean", 0, 1], ["FIFOEffectiveDate", "date", 0, 1], ["RowShelfBinEnabled", "boolean", 0, 1], ["BarcodeEnabled", "boolean", 0, 1]] },
|
|
67309
67309
|
"Attachable": { "fields": [["FileName", "string", 0, 1], ["FileAccessUri", "string", 0, 1], ["TempDownloadUri", "string", 0, 1], ["Size", "long", 0, 1], ["ContentType", "string", 0, 1], ["Category", "string", 0, 1], ["Lat", "string", 0, 1], ["Long", "string", 0, 1], ["PlaceName", "string", 0, 1], ["Note", "string", 0, 1], ["Tag", "string", 0, 1], ["ThumbnailFileAccessUri", "string", 0, 1], ["ThumbnailTempDownloadUri", "string", 0, 1], ["AttachableEx", "IntuitAnyType", 0, 1], ["documentId", "string", 0, 1]], "base": "IntuitEntity" },
|
|
67310
67310
|
"AttachableRef": { "fields": [["EntityRef", "ReferenceType", 0, 1], ["LineInfo", "id", 0, 1], ["IncludeOnSend", "boolean", 0, 1], ["CustomField", "CustomField", 0, -1], ["AttachableRefEx", "IntuitAnyType", 0, 1]] },
|
|
67311
|
+
"AttachableResponse": { "fields": [["Attachable", "Attachable", 0, 1, "c1"], ["Fault", "Fault", 0, 1, "c1"]] },
|
|
67311
67312
|
"Attribute": { "fields": [["Type", "string", 1, 1], ["Value", "string", 1, 1]] },
|
|
67312
67313
|
"Attributes": { "fields": [["Attribute", "Attribute", 0, -1]] },
|
|
67313
67314
|
"BatchItemRequest": { "fields": [["IntuitObject", "IntuitEntity", 1, 1, "c1"], ["Query", "string", 0, 1, "c1"], ["ReportQuery", "string", 0, 1, "c1"], ["CDCQuery", "CDCQuery", 0, 1, "c1"], ["bId", "string", 0, 1, "a"], ["operation", "OperationEnum", 0, 1, "a"], ["optionsData", "string", 0, 1, "a"]] },
|
|
@@ -67352,6 +67353,7 @@ var QBO_TYPES = {
|
|
|
67352
67353
|
"EntityTypeRef": { "fields": [["Type", "EntityTypeEnum", 0, 1], ["EntityRef", "ReferenceType", 0, 1]] },
|
|
67353
67354
|
"Error": { "fields": [["Message", "string", 0, 1], ["Detail", "string", 0, 1], ["DetailLink", "string", 0, 1], ["code", "string", 1, 1, "a"], ["element", "string", 0, 1, "a"]] },
|
|
67354
67355
|
"Estimate": { "fields": [["ExpirationDate", "date", 0, 1], ["AcceptedBy", "string", 0, 1], ["AcceptedDate", "date", 0, 1], ["EstimateEx", "IntuitAnyType", 0, 1]], "base": "SalesTransaction" },
|
|
67356
|
+
"ExchangeRate": { "fields": [["SourceCurrencyCode", "string", 0, 1], ["TargetCurrencyCode", "string", 0, 1], ["Rate", "decimal", 0, 1], ["AsOfDate", "date", 0, 1], ["ExchangeRateEx", "IntuitAnyType", 0, 1]], "base": "IntuitEntity" },
|
|
67355
67357
|
"Fault": { "fields": [["Error", "Error", 0, -1], ["type", "string", 0, 1, "a"]] },
|
|
67356
67358
|
"FinanceChargePrefs": { "fields": [["AnnualInterestRate", "decimal", 0, 1], ["MinFinChrg", "decimal", 0, 1], ["GracePeriod", "positiveInteger", 0, 1], ["CalcFinChrgFromTxnDate", "boolean", 0, 1], ["AssessFinChrgForOverdueCharges", "boolean", 0, 1], ["FinChrgAccountRef", "ReferenceType", 0, 1]] },
|
|
67357
67359
|
"GenericContactType": { "fields": [["Id", "id", 0, 1], ["Name", "string", 0, 1], ["Value", "string", 0, 1], ["Type", "string", 0, 1], ["Default", "boolean", 0, 1], ["Tag", "string", 0, 1]] },
|
|
@@ -67414,14 +67416,18 @@ var QBO_TYPES = {
|
|
|
67414
67416
|
"SurchargePaymentMethodInfo": { "fields": [["Enabled", "boolean", 0, 1]] },
|
|
67415
67417
|
"TDSLineDetail": { "fields": [["TDSAccountRef", "ReferenceType", 0, 1], ["TDSSectionTypeId", "int", 0, 1], ["TDSLineDetailEx", "IntuitAnyType", 0, 1]] },
|
|
67416
67418
|
"Tag": { "fields": [["Name", "string", 0, 1]], "base": "IntuitEntity" },
|
|
67419
|
+
"TaxAgency": { "fields": [["SalesTaxCodeRef", "ReferenceType", 0, 1], ["SalesTaxCountry", "string", 0, 1], ["SalesTaxReturnRef", "ReferenceType", 0, 1], ["TaxRegistrationNumber", "string", 0, 1], ["ReportingPeriod", "string", 0, 1], ["TaxTrackedOnPurchases", "boolean", 0, 1], ["TaxOnPurchasesAccountRef", "ReferenceType", 0, 1], ["TaxTrackedOnSales", "boolean", 0, 1], ["TaxTrackedOnSalesAccountRef", "ReferenceType", 0, 1], ["TaxOnTax", "boolean", 0, 1], ["LastFileDate", "date", 0, 1], ["TaxAgencyExt", "IntuitAnyType", 0, 1], ["TaxAgencyConfig", "string", 0, 1]], "base": "Vendor" },
|
|
67417
67420
|
"TaxCode": { "fields": [["Name", "string", 0, 1], ["Description", "string", 0, 1], ["Active", "boolean", 0, 1], ["Hidden", "boolean", 0, 1], ["Taxable", "boolean", 0, 1], ["TaxGroup", "boolean", 0, 1], ["SalesTaxRateList", "TaxRateList", 0, 1], ["PurchaseTaxRateList", "TaxRateList", 0, 1], ["AdjustmentTaxRateList", "TaxRateList", 0, 1], ["TaxCodeEx", "IntuitAnyType", 0, 1], ["TaxCodeConfigType", "GTMConfigTypeEnum", 0, 1]], "base": "IntuitEntity" },
|
|
67418
67421
|
"TaxLineDetail": { "fields": [["TaxRateRef", "ReferenceType", 0, 1], ["PercentBased", "boolean", 0, 1], ["TaxPercent", "decimal", 0, 1], ["NetAmountTaxable", "decimal", 0, 1], ["TaxInclusiveAmount", "decimal", 0, 1], ["OverrideDeltaAmount", "decimal", 0, 1], ["ServiceDate", "date", 0, 1], ["TaxLineDetailEx", "IntuitAnyType", 0, 1]] },
|
|
67419
67422
|
"TaxPrefs": { "fields": [["UsingSalesTax", "boolean", 0, 1], ["PartnerTaxEnabled", "boolean", 0, 1], ["HideTaxManagement", "boolean", 0, 1], ["TaxGroupCodeRef", "ReferenceType", 0, 1, "c1"], ["TaxRateRef", "ReferenceType", 0, 1, "c1"], ["PaySalesTax", "PaySalesTaxEnum", 0, 1], ["NonTaxableSalesTaxCodeRef", "ReferenceType", 0, 1], ["TaxableSalesTaxCodeRef", "ReferenceType", 0, 1]] },
|
|
67420
67423
|
"TaxRate": { "fields": [["Name", "string", 0, 1], ["Description", "string", 0, 1], ["Active", "boolean", 0, 1], ["RateValue", "decimal", 0, 1], ["AgencyRef", "ReferenceType", 0, 1], ["TaxReturnLineRef", "ReferenceType", 0, 1], ["EffectiveTaxRate", "EffectiveTaxRate", 0, -1], ["SpecialTaxType", "SpecialTaxTypeEnum", 0, 1], ["DisplayType", "TaxRateDisplayTypeEnum", 0, 1], ["TaxRateEx", "IntuitAnyType", 0, 1], ["OriginalTaxRate", "ReferenceType", 0, 1]], "base": "IntuitEntity" },
|
|
67421
67424
|
"TaxRateDetail": { "fields": [["TaxRateRef", "ReferenceType", 0, 1], ["TaxTypeApplicable", "TaxTypeApplicablityEnum", 0, 1], ["TaxOrder", "int", 0, 1], ["TaxOnTaxOrder", "int", 0, 1]] },
|
|
67425
|
+
"TaxRateDetails": { "fields": [["TaxRateName", "string", 0, 1], ["TaxRateId", "string", 0, 1], ["RateValue", "decimal", 0, 1], ["TaxAgencyId", "string", 0, 1], ["TaxApplicableOn", "TaxRateApplicableOnEnum", 0, 1]] },
|
|
67422
67426
|
"TaxRateList": { "fields": [["TaxRateDetail", "TaxRateDetail", 0, -1], ["originatingGroupId", "string", 0, 1, "a"]] },
|
|
67427
|
+
"TaxService": { "fields": [["TaxCode", "string", 0, 1], ["TaxCodeId", "string", 0, 1], ["TaxRateDetails", "TaxRateDetails", 0, -1], ["Fault", "Fault", 0, 1]], "base": "IntuitEntity" },
|
|
67423
67428
|
"TelephoneNumber": { "fields": [["Id", "id", 0, 1], ["DeviceType", "string", 0, 1], ["CountryCode", "string", 0, 1], ["AreaCode", "string", 0, 1], ["ExchangeCode", "string", 0, 1], ["Extension", "string", 0, 1], ["FreeFormNumber", "string", 0, 1], ["Default", "boolean", 0, 1], ["Tag", "string", 0, 1]] },
|
|
67424
67429
|
"Term": { "fields": [["Name", "string", 0, 1], ["Active", "boolean", 0, 1], ["Type", "string", 0, 1], ["DiscountPercent", "decimal", 0, 1], ["DueDays", "int", 0, 1, "c1"], ["DiscountDays", "int", 0, 1, "c1"], ["DayOfMonthDue", "positiveInteger", 0, 1, "c1"], ["DueNextMonthDays", "positiveInteger", 0, 1, "c1"], ["DiscountDayOfMonth", "positiveInteger", 0, 1, "c1"], ["SalesTermEx", "IntuitAnyType", 0, 1]], "base": "IntuitEntity" },
|
|
67430
|
+
"TimeActivity": { "fields": [["TimeZone", "string", 0, 1], ["TxnDate", "date", 0, 1], ["NameOf", "TimeActivityTypeEnum", 0, 1], ["EmployeeRef", "ReferenceType", 0, 1, "c1"], ["VendorRef", "ReferenceType", 0, 1, "c1"], ["OtherNameRef", "ReferenceType", 0, 1, "c1"], ["CustomerRef", "ReferenceType", 0, 1], ["DepartmentRef", "ReferenceType", 0, 1], ["ItemRef", "ReferenceType", 0, 1], ["ClassRef", "ReferenceType", 0, 1], ["PayrollItemRef", "ReferenceType", 0, 1], ["ProjectRef", "ReferenceType", 0, 1], ["TimeChargeId", "int", 0, 1], ["BillableStatus", "BillableStatusEnum", 0, 1], ["Taxable", "boolean", 0, 1], ["HourlyRate", "decimal", 0, 1], ["CostRate", "decimal", 0, 1], ["Hours", "int", 0, 1], ["Minutes", "int", 0, 1], ["Seconds", "int", 0, 1], ["BreakHours", "int", 0, 1], ["BreakMinutes", "int", 0, 1], ["BreakSeconds", "int", 0, 1], ["StartTime", "dateTime", 0, 1], ["EndTime", "dateTime", 0, 1], ["Description", "string", 0, 1], ["TimeActivityEx", "IntuitAnyType", 0, 1], ["HoursInEmployeeTimeZone", "boolean", 0, 1]], "base": "IntuitEntity" },
|
|
67425
67431
|
"TimeTrackingPrefs": { "fields": [["UseServices", "boolean", 0, 1], ["DefaultTimeItem", "ReferenceType", 0, 1], ["BillCustomers", "boolean", 0, 1], ["ShowBillRateToAll", "boolean", 0, 1], ["WorkWeekStartDate", "WeekEnum", 0, 1], ["TimeTrackingEnabled", "boolean", 0, 1], ["MarkTimeEntriesBillable", "boolean", 0, 1], ["MarkExpensesAsBillable", "boolean", 0, 1]] },
|
|
67426
67432
|
"Transaction": { "fields": [["DocNumber", "string", 0, 1], ["TxnDate", "date", 0, 1], ["TxnSubType", "TxnSubTypeEnum", 0, 1], ["DepartmentRef", "ReferenceType", 0, 1], ["CurrencyRef", "ReferenceType", 0, 1], ["ExchangeRate", "decimal", 0, 1], ["PrivateNote", "string", 0, 1], ["TxnStatus", "string", 0, 1], ["LinkedTxn", "LinkedTxn", 0, -1], ["Line", "Line", 0, -1], ["TxnTaxDetail", "TxnTaxDetail", 0, 1], ["TxnSource", "string", 0, 1], ["TaxFormType", "string", 0, 1], ["TaxFormNum", "string", 0, 1], ["TransactionLocationType", "string", 0, 1], ["Tag", "Tag", 0, -1], ["TxnApprovalInfo", "TxnApprovalInfo", 0, 1], ["RecurDataRef", "ReferenceType", 0, 1], ["RecurringInfo", "RecurringInfo", 0, 1], ["ProjectRef", "ReferenceType", 0, 1], ["TotalCostAmount", "decimal", 0, 1], ["HomeTotalCostAmount", "decimal", 0, 1]], "base": "IntuitEntity" },
|
|
67427
67433
|
"TransactionDeliveryInfo": { "fields": [["DeliveryType", "DeliveryTypeEnum", 0, 1], ["DeliveryTime", "dateTime", 0, 1], ["DeliveryErrorType", "DeliveryErrorTypeEnum", 0, 1]] },
|
|
@@ -67478,9 +67484,11 @@ var QBO_ENUMS = {
|
|
|
67478
67484
|
"SpecialTaxTypeEnum": ["NONE", "ZERO_RATE", "FOREIGN_TAX", "REVERSE_CHARGE", "ADJUSTMENT_RATE"],
|
|
67479
67485
|
"SubscriptionPaymentsSettingEnum": ["SALE_TERM"],
|
|
67480
67486
|
"TaxApplicableOnEnum": ["Purchase", "Sales"],
|
|
67487
|
+
"TaxRateApplicableOnEnum": ["Sales", "Purchase", "Adjustment", "Other"],
|
|
67481
67488
|
"TaxRateDisplayTypeEnum": ["ReadOnly", "HideInTransactionForms", "HideInPrintedForms", "HideInAll"],
|
|
67482
67489
|
"TaxReviewStatusEnum": ["NON_AST_TAX", "AST_TAX_OVERRIDE"],
|
|
67483
67490
|
"TaxTypeApplicablityEnum": ["TaxOnAmount", "TaxOnAmountPlusTax", "TaxOnTax"],
|
|
67491
|
+
"TimeActivityTypeEnum": ["Employee", "Other", "Vendor"],
|
|
67484
67492
|
"TimeEntryUsedForPaychecksEnum": ["NotSet", "DoNotUseTimeEntry", "UseTimeEntry"],
|
|
67485
67493
|
"TxnSubTypeEnum": ["InvoiceTax", "InvoiceRetail", "JournalTaxAdjustment", "ProjectCostEstimate", "EmployeeReimbursableExpense", "EmployeeReimbursableExpensePayment", "RetainageRelease"],
|
|
67486
67494
|
"TxnTypeEnum": ["APCreditCard", "ARRefundCreditCard", "Bill", "BillPaymentCheck", "BuildAssembly", "CarryOver", "CashPurchase", "Charge", "Check", "CreditCardPayment", "CreditMemo", "Deposit", "EFPLiabilityCheck", "EFTBillPayment", "EFTRefund", "Estimate", "InventoryAdjustment", "InventoryTransfer", "Invoice", "ItemReceipt", "JournalEntry", "LiabilityAdjustment", "Paycheck", "PayrollLiabilityCheck", "PurchaseOrder", "PriorPayment", "ReceivePayment", "RefundCheck", "ReimburseCharge", "SalesOrder", "SalesReceipt", "SalesTaxPaymentCheck", "Transfer", "TimeActivity", "VendorCredit", "VendorPrepayment", "YTDAdjustment"],
|
|
@@ -67518,8 +67526,17 @@ var QUICKBOOKS_ENTITIES = [
|
|
|
67518
67526
|
"PurchaseOrder",
|
|
67519
67527
|
"Deposit",
|
|
67520
67528
|
"Transfer",
|
|
67521
|
-
"JournalEntry"
|
|
67529
|
+
"JournalEntry",
|
|
67530
|
+
"TimeActivity",
|
|
67531
|
+
"Attachable",
|
|
67532
|
+
"TaxAgency",
|
|
67533
|
+
"ExchangeRate"
|
|
67522
67534
|
];
|
|
67535
|
+
function quickbooksIdGroup(type) {
|
|
67536
|
+
if (["Customer", "Vendor", "Employee"].includes(type)) return "name";
|
|
67537
|
+
for (let base2 = type; base2; base2 = QBO_TYPES[base2]?.base) if (base2 === "Transaction") return "transaction";
|
|
67538
|
+
return type;
|
|
67539
|
+
}
|
|
67523
67540
|
function quickbooksFields(type) {
|
|
67524
67541
|
const t = QBO_TYPES[type];
|
|
67525
67542
|
return t ? [...t.base ? quickbooksFields(t.base) : [], ...t.fields] : [];
|
|
@@ -67597,13 +67614,40 @@ function quickbooksRequiredIssues(type, row) {
|
|
|
67597
67614
|
if (row.PayType === "Check") need("CheckPayment");
|
|
67598
67615
|
if (row.PayType === "CreditCard") need("CreditCardPayment");
|
|
67599
67616
|
}
|
|
67617
|
+
if (type === "ExchangeRate") need("SourceCurrencyCode", "Rate", "AsOfDate");
|
|
67618
|
+
if (type === "TaxAgency") need("DisplayName");
|
|
67619
|
+
if (type === "Attachable" && !row.FileName) need("Note");
|
|
67620
|
+
if (type === "TimeActivity") {
|
|
67621
|
+
need("NameOf");
|
|
67622
|
+
if (row.NameOf === "Employee") need("EmployeeRef");
|
|
67623
|
+
if (row.NameOf === "Vendor") need("VendorRef");
|
|
67624
|
+
if (row.BillableStatus === "Billable") need("CustomerRef");
|
|
67625
|
+
}
|
|
67600
67626
|
if (type === "Transfer") need("FromAccountRef", "ToAccountRef", "Amount");
|
|
67601
67627
|
const issues = missing.map((key2) => ({ code: 2020, path: [key2], detail: `${key2} is required.` }));
|
|
67628
|
+
if (type === "ExchangeRate" && (!/^[A-Z]{3}$/.test(row.SourceCurrencyCode ?? "") || row.TargetCurrencyCode !== void 0 && !/^[A-Z]{3}$/.test(row.TargetCurrencyCode) || !(row.Rate > 0))) issues.push({ code: 6e3, path: ["Rate"], detail: "Supply currency codes and a positive Rate." });
|
|
67629
|
+
if (type === "TimeActivity") issues.push(...quickbooksTimeIssues(row));
|
|
67602
67630
|
for (const [i, line2] of (Array.isArray(row.Line) ? row.Line : []).entries()) if (line2 && typeof line2 === "object") {
|
|
67603
67631
|
if (!["DescriptionLineDetail", "SubTotalLineDetail"].includes(line2.DetailType) && line2.Amount === void 0) issues.push({ code: 2020, path: ["Line", i, "Amount"], detail: "Amount is required on a detail line." });
|
|
67604
67632
|
}
|
|
67605
67633
|
return issues;
|
|
67606
67634
|
}
|
|
67635
|
+
var timeInstant = (value3) => Date.parse(/(?:Z|[+-]\d{2}:\d{2})$/i.test(value3) ? value3 : `${value3}Z`);
|
|
67636
|
+
function quickbooksTimeIssues(row) {
|
|
67637
|
+
const issues = [], bad = (key2, detail) => issues.push({ code: 6e3, path: [key2], detail });
|
|
67638
|
+
if (row.NameOf && !["Employee", "Vendor"].includes(row.NameOf)) bad("NameOf", "NameOf must be Employee or Vendor.");
|
|
67639
|
+
if (row.NameOf === "Employee" && row.VendorRef || row.NameOf === "Vendor" && row.EmployeeRef) bad("NameOf", "NameOf must match the person reference.");
|
|
67640
|
+
for (const key2 of ["Hours", "Minutes", "Seconds", "BreakHours", "BreakMinutes", "BreakSeconds"]) if (row[key2] !== void 0 && (!Number.isInteger(row[key2]) || row[key2] < 0 || !key2.endsWith("Hours") && row[key2] > 59)) bad(key2, `${key2} is outside its duration range.`);
|
|
67641
|
+
for (const key2 of ["HourlyRate", "CostRate"]) if (row[key2] !== void 0 && row[key2] < 0) bad(key2, `${key2} cannot be negative.`);
|
|
67642
|
+
const breaks = (row.BreakHours ?? 0) * 3600 + (row.BreakMinutes ?? 0) * 60 + (row.BreakSeconds ?? 0);
|
|
67643
|
+
if (row.StartTime !== void 0 || row.EndTime !== void 0) {
|
|
67644
|
+
if (!row.StartTime || !row.EndTime) bad("StartTime", "StartTime and EndTime must be supplied together.");
|
|
67645
|
+
else if (!Number.isFinite(timeInstant(row.EndTime) - timeInstant(row.StartTime)) || (timeInstant(row.EndTime) - timeInstant(row.StartTime)) / 1e3 < breaks) bad("EndTime", "EndTime must follow StartTime and include the break duration.");
|
|
67646
|
+
if (["Hours", "Minutes", "Seconds"].some((k) => row[k] !== void 0)) bad("Hours", "Supply either duration or StartTime and EndTime.");
|
|
67647
|
+
} else if (!["Hours", "Minutes", "Seconds"].some((k) => row[k] !== void 0)) bad("Hours", "Supply duration or StartTime and EndTime.");
|
|
67648
|
+
else if ((row.Hours ?? 0) * 3600 + (row.Minutes ?? 0) * 60 + (row.Seconds ?? 0) < breaks) bad("BreakHours", "Break exceeds duration.");
|
|
67649
|
+
return issues;
|
|
67650
|
+
}
|
|
67607
67651
|
var native2 = (type) => external_exports.record(external_exports.string(), external_exports.unknown()).superRefine((row, ctx) => {
|
|
67608
67652
|
for (const issue2 of quickbooksIssues(type, row, true)) ctx.addIssue({ code: "custom", path: issue2.path, message: issue2.detail });
|
|
67609
67653
|
});
|
|
@@ -67620,11 +67664,12 @@ var QuickbooksSeedSchema = external_exports.strictObject({
|
|
|
67620
67664
|
}, "Use an IANA time zone"),
|
|
67621
67665
|
companyInfo: native2("CompanyInfo").default({}),
|
|
67622
67666
|
preferences: native2("Preferences").default({}),
|
|
67623
|
-
entities: external_exports.strictObject(entityShape).default({})
|
|
67667
|
+
entities: external_exports.strictObject(entityShape).default({}),
|
|
67668
|
+
exchangeRates: external_exports.array(native2("ExchangeRate")).optional()
|
|
67624
67669
|
}).superRefine((seed2, ctx) => {
|
|
67625
67670
|
const sharedIds = /* @__PURE__ */ new Map(), sharedNames = /* @__PURE__ */ new Map();
|
|
67626
67671
|
for (const [type, rows] of Object.entries(seed2.entities)) {
|
|
67627
|
-
const group5 = ["Customer", "Vendor", "Employee"].includes(type) ? "names" :
|
|
67672
|
+
const group5 = ["Customer", "Vendor", "Employee"].includes(type) ? "names" : quickbooksIdGroup(type);
|
|
67628
67673
|
const ids = sharedIds.get(group5) ?? /* @__PURE__ */ new Set();
|
|
67629
67674
|
sharedIds.set(group5, ids);
|
|
67630
67675
|
rows?.forEach((r, i) => {
|
|
@@ -67643,7 +67688,15 @@ var QuickbooksSeedSchema = external_exports.strictObject({
|
|
|
67643
67688
|
}
|
|
67644
67689
|
});
|
|
67645
67690
|
}
|
|
67646
|
-
const
|
|
67691
|
+
const rateIds = sharedIds.get("ExchangeRate") ?? /* @__PURE__ */ new Set();
|
|
67692
|
+
for (const [i, rate] of (seed2.exchangeRates ?? []).entries()) {
|
|
67693
|
+
for (const issue2 of quickbooksRequiredIssues("ExchangeRate", rate)) ctx.addIssue({ code: "custom", path: ["exchangeRates", i, ...issue2.path], message: issue2.detail });
|
|
67694
|
+
if (rate.Id !== void 0) {
|
|
67695
|
+
if (typeof rate.Id !== "string" || !/^\d+$/.test(rate.Id) || rateIds.has(rate.Id)) ctx.addIssue({ code: "custom", path: ["exchangeRates", i, "Id"], message: "Id must be a unique decimal string in its sequence." });
|
|
67696
|
+
if (typeof rate.Id === "string") rateIds.add(rate.Id);
|
|
67697
|
+
}
|
|
67698
|
+
}
|
|
67699
|
+
const targets = { EmployeeRef: "Employee", CustomerRef: "Customer", VendorRef: "Vendor", PrefVendorRef: "Vendor", ItemRef: "Item", ClassRef: "Class", DepartmentRef: "Department", SalesTermRef: "Term", TermRef: "Term", PaymentMethodRef: "PaymentMethod", DefaultTaxCodeRef: "TaxCode", TaxCodeRef: "TaxCode", TxnTaxCodeRef: "TaxCode", TaxRateRef: "TaxRate", DefaultARAccount: "Account", DefaultAPAccount: "Account" };
|
|
67647
67700
|
const visit3 = (value3, owner, path2) => {
|
|
67648
67701
|
if (Array.isArray(value3)) {
|
|
67649
67702
|
value3.forEach((v, i) => visit3(v, owner, [...path2, i]));
|
|
@@ -67652,7 +67705,7 @@ var QuickbooksSeedSchema = external_exports.strictObject({
|
|
|
67652
67705
|
if (!value3 || typeof value3 !== "object") return;
|
|
67653
67706
|
const object4 = value3;
|
|
67654
67707
|
for (const [key2, v] of Object.entries(object4)) {
|
|
67655
|
-
const type = key2 === "ParentRef" ? owner : key2.includes("AccountRef") ? "Account" : targets[key2];
|
|
67708
|
+
const type = key2 === "EntityRef" && owner === "Attachable" ? QUICKBOOKS_ENTITIES.find((t) => t.toLowerCase() === String(v?.type ?? "").toLowerCase()) : key2 === "ParentRef" ? owner : key2.includes("AccountRef") ? "Account" : targets[key2];
|
|
67656
67709
|
if (type && v && typeof v === "object" && typeof v.value === "string" && !(key2 === "TaxCodeRef" && ["TAX", "NON"].includes(v.value))) {
|
|
67657
67710
|
const candidates = seed2.entities[type] ?? [];
|
|
67658
67711
|
if (candidates.every((r) => typeof r.Id === "string")) {
|
|
@@ -67660,6 +67713,7 @@ var QuickbooksSeedSchema = external_exports.strictObject({
|
|
|
67660
67713
|
if (!target || target.Active === false) ctx.addIssue({ code: "custom", path: [...path2, key2], message: `${type} ${v.value} ${target ? "is inactive" : "does not exist"}.` });
|
|
67661
67714
|
}
|
|
67662
67715
|
}
|
|
67716
|
+
if (key2 === "EntityRef" && owner === "Attachable" && !type) ctx.addIssue({ code: "custom", path: [...path2, key2, "type"], message: "Supply a recognized entity type." });
|
|
67663
67717
|
visit3(v, owner, [...path2, key2]);
|
|
67664
67718
|
}
|
|
67665
67719
|
};
|