From 8083fe688a8f38971ede830b37a3004aab0312a5 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Fri, 17 Apr 2026 21:55:35 +0545 Subject: [PATCH 1/2] fix(OUT-3607): return empty array when QB has no service items QuickBooks omits the Item key from QueryResponse when the Item SQL query matches zero rows, causing QBItemsResponseSchema.parse to throw a ZodError (expected array, received undefined). Default to [] so the /api/quickbooks/product/qb/item route and the product backfill gracefully handle companies with no service items. Fixes ACCOUNTING-SYNC-2X Co-Authored-By: Claude Opus 4.7 (1M context) --- src/utils/intuitAPI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/intuitAPI.ts b/src/utils/intuitAPI.ts index a5b74ccc..54bbea4b 100644 --- a/src/utils/intuitAPI.ts +++ b/src/utils/intuitAPI.ts @@ -412,7 +412,7 @@ export default class IntuitAPI { ) } - return QBItemsResponseSchema.parse(qbItems.Item) + return QBItemsResponseSchema.parse(qbItems.Item ?? []) } async _invoiceSparseUpdate(payload: QBInvoiceSparseUpdatePayloadType) { From 8816c01a080912ac96d598614668c34ef15a6300 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Mon, 20 Apr 2026 09:38:14 +0545 Subject: [PATCH 2/2] refactor(OUT-3607): replace nullish coalescing operator with logical OR operator --- src/utils/intuitAPI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/intuitAPI.ts b/src/utils/intuitAPI.ts index 54bbea4b..1bfdc850 100644 --- a/src/utils/intuitAPI.ts +++ b/src/utils/intuitAPI.ts @@ -412,7 +412,7 @@ export default class IntuitAPI { ) } - return QBItemsResponseSchema.parse(qbItems.Item ?? []) + return QBItemsResponseSchema.parse(qbItems.Item || []) } async _invoiceSparseUpdate(payload: QBInvoiceSparseUpdatePayloadType) {