@@ -14,6 +14,11 @@ const SALES_READ_OPERATION = 'quickbooks_read_sales_transactions'
1414const CUSTOMER_OPERATIONS = [ 'quickbooks_create_customer' , 'quickbooks_update_customer' ] as const
1515const VENDOR_OPERATIONS = [ 'quickbooks_create_vendor' , 'quickbooks_update_vendor' ] as const
1616const ITEM_OPERATIONS = [ 'quickbooks_create_item' , 'quickbooks_update_item' ] as const
17+ const MASTER_DATA_CREATE_OPERATIONS = [
18+ 'quickbooks_create_customer' ,
19+ 'quickbooks_create_item' ,
20+ 'quickbooks_create_vendor' ,
21+ ] as const
1722const SALES_DOCUMENT_CREATE_OPERATIONS = [
1823 'quickbooks_create_estimate' ,
1924 'quickbooks_create_invoice' ,
@@ -40,6 +45,7 @@ const SALES_CREATE_OPERATIONS = [
4045 ...SALES_DOCUMENT_CREATE_OPERATIONS ,
4146 'quickbooks_create_customer_payment' ,
4247] as const
48+ const CREATE_OPERATIONS = [ ...MASTER_DATA_CREATE_OPERATIONS , ...SALES_CREATE_OPERATIONS ] as const
4349const SALES_UPDATE_OPERATIONS = [
4450 ...SALES_DOCUMENT_UPDATE_OPERATIONS ,
4551 'quickbooks_update_customer_payment' ,
@@ -710,7 +716,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
710716 title : 'Request ID' ,
711717 type : 'short-input' ,
712718 placeholder : 'Optional idempotency key (max 50 characters)' ,
713- condition : { field : 'operation' , value : [ ...SALES_CREATE_OPERATIONS ] } ,
719+ condition : { field : 'operation' , value : [ ...CREATE_OPERATIONS ] } ,
714720 mode : 'advanced' ,
715721 } ,
716722 {
@@ -876,6 +882,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
876882 operation === 'quickbooks_create_customer' ||
877883 operation === 'quickbooks_update_customer'
878884 ) {
885+ const isCreate = operation === 'quickbooks_create_customer'
879886 return {
880887 credential : oauthCredentialValue ,
881888 customerId : optionalValue ( params . customerId ) ,
@@ -890,9 +897,11 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
890897 shippingAddress : parseQuickBooksAddress ( params . shippingAddress , 'shippingAddress' ) ,
891898 taxable : parseTriStateBoolean ( params . taxable , 'taxable' ) ,
892899 activeStatus : params . activeStatus ?? 'unchanged' ,
900+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
893901 }
894902 }
895903 if ( operation === 'quickbooks_create_vendor' || operation === 'quickbooks_update_vendor' ) {
904+ const isCreate = operation === 'quickbooks_create_vendor'
896905 return {
897906 credential : oauthCredentialValue ,
898907 vendorId : optionalValue ( params . vendorId ) ,
@@ -908,9 +917,11 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
908917 accountNumber : optionalValue ( params . accountNumber ) ,
909918 vendor1099 : parseTriStateBoolean ( params . vendor1099 , 'vendor1099' ) ,
910919 activeStatus : params . activeStatus ?? 'unchanged' ,
920+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
911921 }
912922 }
913923 if ( operation === 'quickbooks_create_item' || operation === 'quickbooks_update_item' ) {
924+ const isCreate = operation === 'quickbooks_create_item'
914925 return {
915926 credential : oauthCredentialValue ,
916927 itemId : optionalValue ( params . itemId ) ,
@@ -926,6 +937,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
926937 expenseAccountId : optionalValue ( params . expenseAccountId ) ,
927938 taxable : parseTriStateBoolean ( params . taxable , 'taxable' ) ,
928939 activeStatus : params . activeStatus ?? 'unchanged' ,
940+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
929941 }
930942 }
931943 return { credential : oauthCredentialValue }
0 commit comments