@rowbind/sdk 0.1.0-alpha.1 → 0.1.0-canary.130

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.
@@ -10,6 +10,12 @@ export const CatalogKind = {
10
10
  customer: 'customer',
11
11
  item: 'item',
12
12
  };
13
+ export const QuickBooksTrialBalanceRowKind = {
14
+ DataRow: 'DataRow',
15
+ TextRow: 'TextRow',
16
+ SubtotalRow: 'SubtotalRow',
17
+ TotalRow: 'TotalRow',
18
+ };
13
19
  export const ConnectSessionRequestProvider = {
14
20
  quickbooksDesktop: 'quickbooksDesktop',
15
21
  netsuite: 'netsuite',
@@ -156,6 +162,41 @@ export const InvoiceRequestTraceOutcome = {
156
162
  conflict: 'conflict',
157
163
  rejected: 'rejected',
158
164
  };
165
+ export const InvoiceCustomFieldSchemaProvider = {
166
+ quickbooksDesktop: 'quickbooksDesktop',
167
+ netsuite: 'netsuite',
168
+ };
169
+ export const InvoiceCustomFieldDefinitionType = {
170
+ text: 'text',
171
+ boolean: 'boolean',
172
+ decimal: 'decimal',
173
+ date: 'date',
174
+ select: 'select',
175
+ };
176
+ export const InvoiceCustomFieldValuesProvider = {
177
+ quickbooksDesktop: 'quickbooksDesktop',
178
+ netsuite: 'netsuite',
179
+ };
180
+ export const InventoryObservationProvider = {
181
+ quickbooksDesktop: 'quickbooksDesktop',
182
+ netsuite: 'netsuite',
183
+ };
184
+ export const InventoryObservationSource = {
185
+ sandbox: 'sandbox',
186
+ erp: 'erp',
187
+ };
188
+ export const InventoryBookLevelsGranularity = {
189
+ book: 'book',
190
+ };
191
+ export const InventorySiteLevelsGranularity = {
192
+ site: 'site',
193
+ };
194
+ export const RetrievedQuickBooksInvoiceProvider = {
195
+ quickbooksDesktop: 'quickbooksDesktop',
196
+ };
197
+ export const RetrievedNetSuiteInvoiceProvider = {
198
+ netsuite: 'netsuite',
199
+ };
159
200
  export const ReimbursementBillInputKind = {
160
201
  vendor_bill: 'vendor_bill',
161
202
  };
@@ -375,6 +416,10 @@ export const PaymentMatchedEventDataProvider = {
375
416
  export const PaymentMatchedEventDataCurrency = {
376
417
  USD: 'USD',
377
418
  };
419
+ export const GetQuickBooksTrialBalanceBasis = {
420
+ accrual: 'accrual',
421
+ cash: 'cash',
422
+ };
378
423
  const getHeaders = (...sources) => {
379
424
  const seen = new Set();
380
425
  const layers = [];
@@ -432,11 +477,31 @@ export const linkCatalog = async (id, kind, catalogLinkRequest, options) => {
432
477
  body: JSON.stringify(catalogLinkRequest)
433
478
  });
434
479
  };
480
+ export const getListInventoryLevelsUrl = (id, params) => {
481
+ const normalizedParams = new URLSearchParams();
482
+ Object.entries(params || {}).forEach(([key, value]) => {
483
+ if (value !== undefined) {
484
+ normalizedParams.append(key, value === null ? 'null' : String(value));
485
+ }
486
+ });
487
+ const stringifiedParams = normalizedParams.toString();
488
+ return stringifiedParams.length > 0 ? `/v1/connections/${encodeURIComponent(String(id))}/inventory/levels?${stringifiedParams}` : `/v1/connections/${encodeURIComponent(String(id))}/inventory/levels`;
489
+ };
490
+ /**
491
+ * Requires inventory:read and the book's native-read consent. Supply the native ID of an item in this book. Sandbox QuickBooks Desktop stock is grouped by site. Sandbox NetSuite exposes a book total. For a requested site, only a verified site-level observation can succeed. On-hand quantity is reported as an exact decimal string. This is not a reservation or available-to-promise amount. Enrolled connectors require a native inventory reader.
492
+ * @summary Read the observed stock levels for one native item
493
+ */
494
+ export const listInventoryLevels = async (id, params, options) => {
495
+ return sendToRowbind(getListInventoryLevelsUrl(id, params), {
496
+ ...options,
497
+ method: 'GET'
498
+ });
499
+ };
435
500
  export const getQueryRawUrl = (id) => {
436
501
  return `/v1/connections/${encodeURIComponent(String(id))}/raw/query`;
437
502
  };
438
503
  /**
439
- * Requires raw:query. Submit a read-only qbXML query fragment or SuiteQL query for the selected provider. Supported queries depend on the connector. Returns one native XML response or a page of SuiteQL rows. Request the next page explicitly using the same query and limit.
504
+ * Requires raw:query and the book's native-query consent. In QuickBooks Desktop submit JSON with provider quickbooksDesktop and qbxml containing one read-only XML fragment. The enrolled QuickBooks Web Connector pilot accepts a single read without iterator attributes within a bounded wait. Simulated books reproduce specific fixtures. For NetSuite send a SuiteQL SELECT with q and optional limit and offset. The response is native XML or a page of SuiteQL rows.
440
505
  * @summary Query an authorized book in its native language
441
506
  */
442
507
  export const queryRaw = async (id, rawQueryRequest, options) => {
@@ -451,7 +516,7 @@ export const getReadRawUrl = (id) => {
451
516
  return `/v1/connections/${encodeURIComponent(String(id))}/raw/read`;
452
517
  };
453
518
  /**
454
- * Requires raw:read. The sandbox accepts one qbXML InvoiceQueryRq fragment containing a single TxnID, or a SuiteTalk GET on /services/rest/record/v1/invoice/{nativeId}. It returns the simulated book's current native fields and a fresh X-Request-Id header. This operation cannot dispatch writes.
519
+ * Requires raw:read. Simulated books accept one qbXML InvoiceQueryRq fragment containing a single TxnID, or a SuiteTalk GET on /services/rest/record/v1/invoice/{nativeId}. A configured connector without a native snapshot reader returns 503. Successful calls include a fresh X-Request-Id header.
455
520
  * @summary Read a native invoice from a consenting sandbox book
456
521
  */
457
522
  export const readRaw = async (id, rawReadRequest, options) => {
@@ -462,6 +527,80 @@ export const readRaw = async (id, rawReadRequest, options) => {
462
527
  body: JSON.stringify(rawReadRequest)
463
528
  });
464
529
  };
530
+ export const getRetrieveQuickBooksVendorUrl = (id, listId) => {
531
+ return `/v1/connections/${encodeURIComponent(String(id))}/quickbooks-desktop/vendors/${encodeURIComponent(String(listId))}`;
532
+ };
533
+ /**
534
+ * Requires raw:query, native-query consent, and an enrolled QuickBooks Desktop pilot connector. Returns the current name, revision, and account number.
535
+ * @summary Read a native QuickBooks Desktop vendor by ListID
536
+ */
537
+ export const retrieveQuickBooksVendor = async (id, listId, options) => {
538
+ return sendToRowbind(getRetrieveQuickBooksVendorUrl(id, listId), {
539
+ ...options,
540
+ method: 'GET'
541
+ });
542
+ };
543
+ export const getRetrieveQuickBooksInvoiceUrl = (id, txnId) => {
544
+ return `/v1/connections/${encodeURIComponent(String(id))}/quickbooks-desktop/invoices/${encodeURIComponent(String(txnId))}`;
545
+ };
546
+ /**
547
+ * Requires raw:query, native-query consent, and an enrolled QuickBooks Desktop pilot connector. Returns the current revision, class, terms and an exact decimal balance when QuickBooks supplies it.
548
+ * @summary Read native QuickBooks Desktop invoice details by TxnID
549
+ */
550
+ export const retrieveQuickBooksInvoice = async (id, txnId, options) => {
551
+ return sendToRowbind(getRetrieveQuickBooksInvoiceUrl(id, txnId), {
552
+ ...options,
553
+ method: 'GET'
554
+ });
555
+ };
556
+ export const getGetQuickBooksTrialBalanceUrl = (id, params) => {
557
+ const normalizedParams = new URLSearchParams();
558
+ Object.entries(params || {}).forEach(([key, value]) => {
559
+ if (value !== undefined) {
560
+ normalizedParams.append(key, value === null ? 'null' : String(value));
561
+ }
562
+ });
563
+ const stringifiedParams = normalizedParams.toString();
564
+ return stringifiedParams.length > 0 ? `/v1/connections/${encodeURIComponent(String(id))}/quickbooks-desktop/reports/trial-balance?${stringifiedParams}` : `/v1/connections/${encodeURIComponent(String(id))}/quickbooks-desktop/reports/trial-balance`;
565
+ };
566
+ /**
567
+ * Requires raw:query, native-query consent, and an enrolled QuickBooks Desktop pilot connector. Pass both dates or omit both to use QuickBooks' default period. Cells preserve native text and missing values.
568
+ * @summary Read a native QuickBooks Desktop trial balance
569
+ */
570
+ export const getQuickBooksTrialBalance = async (id, params, options) => {
571
+ return sendToRowbind(getGetQuickBooksTrialBalanceUrl(id, params), {
572
+ ...options,
573
+ method: 'GET'
574
+ });
575
+ };
576
+ export const getAdmitRawWriteUrl = (id) => {
577
+ return `/v1/connections/${encodeURIComponent(String(id))}/raw/write`;
578
+ };
579
+ /**
580
+ * Sandbox pilot only. Requires raw:write and a book explicitly enrolled for a test vendor edit. Submit one VendorModRq containing ListID, the current EditSequence, and the new AccountNumber. Repeating the same key and XML returns the same operation. Retrieve its result before attempting further changes.
581
+ * @summary Admit a native QuickBooks Desktop test vendor edit
582
+ */
583
+ export const admitRawWrite = async (id, admitRawWriteBody, headers, options) => {
584
+ return sendToRowbind(getAdmitRawWriteUrl(id), {
585
+ ...options,
586
+ method: 'POST',
587
+ headers: getHeaders({ 'Content-Type': 'application/json' }, headers, options?.headers),
588
+ body: JSON.stringify(admitRawWriteBody)
589
+ });
590
+ };
591
+ export const getRetrieveRawWriteUrl = (id, operationId) => {
592
+ return `/v1/connections/${encodeURIComponent(String(id))}/raw/writes/${encodeURIComponent(String(operationId))}`;
593
+ };
594
+ /**
595
+ * Requires raw:write. Read the operation using its original QuickBooks connection. The bridge verifies by reading the same vendor in the original book. A lost acknowledgment can yield pending or a verified observation. Retrieving the operation never resends the write.
596
+ * @summary Retrieve a native vendor edit outcome
597
+ */
598
+ export const retrieveRawWrite = async (id, operationId, options) => {
599
+ return sendToRowbind(getRetrieveRawWriteUrl(id, operationId), {
600
+ ...options,
601
+ method: 'GET'
602
+ });
603
+ };
465
604
  export const getCreateReceivedPaymentUrl = () => {
466
605
  return `/v1/received-payments`;
467
606
  };
@@ -738,6 +877,60 @@ export const listSyncedInvoices = async (id, params, options) => {
738
877
  method: 'GET'
739
878
  });
740
879
  };
880
+ export const getDiscoverInvoiceCustomFieldsUrl = (id) => {
881
+ return `/v1/connections/${encodeURIComponent(String(id))}/custom-fields/invoices`;
882
+ };
883
+ /**
884
+ * Requires custom-fields:read and the book's read consent. Returns current invoice header definitions visible in this sandbox book. A configured standalone pilot can expose supported native definitions as read-only. Field IDs and select values are native to this book. Store the schema revision when generating types.
885
+ * @summary Discover the authorized invoice fields in one book
886
+ */
887
+ export const discoverInvoiceCustomFields = async (id, options) => {
888
+ return sendToRowbind(getDiscoverInvoiceCustomFieldsUrl(id), {
889
+ ...options,
890
+ method: 'GET'
891
+ });
892
+ };
893
+ export const getReadInvoiceCustomFieldsUrl = (id, nativeId) => {
894
+ return `/v1/connections/${encodeURIComponent(String(id))}/invoices/${encodeURIComponent(String(nativeId))}/custom-fields`;
895
+ };
896
+ /**
897
+ * Requires custom-fields:read and the book's read consent. Reads current invoice header values from the authorized sandbox book. Omitted values have not been set or no longer fit the visible current schema. In the sandbox, null marks an explicitly cleared value. A configured standalone pilot can read supported values directly. Reuse the schema and value revisions in an update.
898
+ * @summary Read custom field values on one invoice
899
+ */
900
+ export const readInvoiceCustomFields = async (id, nativeId, options) => {
901
+ return sendToRowbind(getReadInvoiceCustomFieldsUrl(id, nativeId), {
902
+ ...options,
903
+ method: 'GET'
904
+ });
905
+ };
906
+ export const getUpdateInvoiceCustomFieldsUrl = (id, nativeId) => {
907
+ return `/v1/connections/${encodeURIComponent(String(id))}/invoices/${encodeURIComponent(String(nativeId))}/custom-fields`;
908
+ };
909
+ /**
910
+ * Requires custom-fields:read and custom-fields:write, plus the book's consent. The sandbox validates every included field and compares both revisions before applying the patch atomically. Send at most 50 fields and a body of at most 16 KiB. Omission preserves a value. Null clears a nullable field. Retrying with the same Idempotency-Key and identical intent returns the original result while its fields remain visible and valid under the current schema. A change to field access or compatibility can require discovery again. Reusing the key with a different intent conflicts. Use a fresh GET for current values.
911
+ * @summary Update selected custom fields on one invoice
912
+ */
913
+ export const updateInvoiceCustomFields = async (id, nativeId, invoiceCustomFieldUpdate, headers, options) => {
914
+ return sendToRowbind(getUpdateInvoiceCustomFieldsUrl(id, nativeId), {
915
+ ...options,
916
+ method: 'PATCH',
917
+ headers: getHeaders({ 'Content-Type': 'application/json' }, headers, options?.headers),
918
+ body: JSON.stringify(invoiceCustomFieldUpdate)
919
+ });
920
+ };
921
+ export const getRetrieveInvoiceUrl = (id, nativeId) => {
922
+ return `/v1/connections/${encodeURIComponent(String(id))}/invoices/${encodeURIComponent(String(nativeId))}`;
923
+ };
924
+ /**
925
+ * Requires invoices:read. Reads the invoice from the selected book without enabling Managed Sync or requiring an operation ID. The result contains the provider-specific fields actually returned by the book. Sandbox connections read the simulated book. The standalone pilot can read a configured ERP. The supported invoice profile currently includes item lines with usable amounts and quantity. An unavailable source produces an error instead of returning a historical receipt or synced copy.
926
+ * @summary Read an invoice by its native ID in a connected book
927
+ */
928
+ export const retrieveInvoice = async (id, nativeId, options) => {
929
+ return sendToRowbind(getRetrieveInvoiceUrl(id, nativeId), {
930
+ ...options,
931
+ method: 'GET'
932
+ });
933
+ };
741
934
  export const getListObservedPaymentsUrl = (id, params) => {
742
935
  const normalizedParams = new URLSearchParams();
743
936
  Object.entries(params || {}).forEach(([key, value]) => {