@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.
- package/README.md +101 -1
- package/dist/generated/http.d.ts +380 -2
- package/dist/generated/http.js +195 -2
- package/dist/generated/validators.d.ts +413 -3
- package/dist/generated/validators.js +355 -2
- package/dist/http-request.js +2 -1
- package/dist/index.d.ts +58 -2
- package/dist/index.js +35 -1
- package/dist/invoice-custom-fields.d.ts +42 -0
- package/dist/invoice-custom-fields.js +105 -0
- package/dist/transport.d.ts +11 -1
- package/dist/transport.js +132 -1
- package/dist/wire.d.ts +1 -1
- package/dist/wire.js +1 -1
- package/package.json +60 -78
|
@@ -63,7 +63,71 @@ export const LinkCatalogResponse = zod.object({
|
|
|
63
63
|
"nativeId": zod.string().min(linkCatalogResponseNativeIdMin).describe('Confirmed ERP customer or item ID for this book. Repeating the same link returns this ID.')
|
|
64
64
|
});
|
|
65
65
|
/**
|
|
66
|
-
* Requires
|
|
66
|
+
* 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.
|
|
67
|
+
* @summary Read the observed stock levels for one native item
|
|
68
|
+
*/
|
|
69
|
+
export const listInventoryLevelsPathIdMin = 1;
|
|
70
|
+
export const listInventoryLevelsPathIdMax = 255;
|
|
71
|
+
export const listInventoryLevelsPathIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
72
|
+
export const ListInventoryLevelsParams = zod.object({
|
|
73
|
+
"id": zod.string().min(listInventoryLevelsPathIdMin).max(listInventoryLevelsPathIdMax).regex(listInventoryLevelsPathIdRegExp).describe('Rowbind connection that identifies this book.')
|
|
74
|
+
});
|
|
75
|
+
export const listInventoryLevelsQueryItemIdMin = 1;
|
|
76
|
+
export const listInventoryLevelsQueryItemIdMax = 255;
|
|
77
|
+
export const listInventoryLevelsQueryItemIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
78
|
+
export const listInventoryLevelsQuerySiteIdMin = 1;
|
|
79
|
+
export const listInventoryLevelsQuerySiteIdMax = 255;
|
|
80
|
+
export const listInventoryLevelsQuerySiteIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
81
|
+
export const ListInventoryLevelsQueryParams = zod.strictObject({
|
|
82
|
+
"itemId": zod.string().min(listInventoryLevelsQueryItemIdMin).max(listInventoryLevelsQueryItemIdMax).regex(listInventoryLevelsQueryItemIdRegExp),
|
|
83
|
+
"siteId": zod.string().min(listInventoryLevelsQuerySiteIdMin).max(listInventoryLevelsQuerySiteIdMax).regex(listInventoryLevelsQuerySiteIdRegExp).exactOptional().describe('Require an observation for this site in the same book.')
|
|
84
|
+
});
|
|
85
|
+
export const listInventoryLevelsResponseOneOneConnectionIdMin = 1;
|
|
86
|
+
export const listInventoryLevelsResponseOneOneConnectionIdMax = 255;
|
|
87
|
+
export const listInventoryLevelsResponseOneOneConnectionIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
88
|
+
export const listInventoryLevelsResponseOneOneItemIdMin = 1;
|
|
89
|
+
export const listInventoryLevelsResponseOneOneItemIdMax = 255;
|
|
90
|
+
export const listInventoryLevelsResponseOneOneItemIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
91
|
+
export const listInventoryLevelsResponseOneOneUnitMin = 1;
|
|
92
|
+
export const listInventoryLevelsResponseOneTwoOnHandRegExp = new RegExp('^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$');
|
|
93
|
+
export const listInventoryLevelsResponseTwoOneConnectionIdMin = 1;
|
|
94
|
+
export const listInventoryLevelsResponseTwoOneConnectionIdMax = 255;
|
|
95
|
+
export const listInventoryLevelsResponseTwoOneConnectionIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
96
|
+
export const listInventoryLevelsResponseTwoOneItemIdMin = 1;
|
|
97
|
+
export const listInventoryLevelsResponseTwoOneItemIdMax = 255;
|
|
98
|
+
export const listInventoryLevelsResponseTwoOneItemIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
99
|
+
export const listInventoryLevelsResponseTwoOneUnitMin = 1;
|
|
100
|
+
export const listInventoryLevelsResponseTwoTwoLevelsItemSiteIdMin = 1;
|
|
101
|
+
export const listInventoryLevelsResponseTwoTwoLevelsItemSiteIdMax = 255;
|
|
102
|
+
export const listInventoryLevelsResponseTwoTwoLevelsItemSiteIdRegExp = new RegExp('^(?!\\.{1,2}$)(?!\\s)(?!.*\\s$)[^\\u0000-\\u001f\\u007f]+$');
|
|
103
|
+
export const listInventoryLevelsResponseTwoTwoLevelsItemOnHandRegExp = new RegExp('^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$');
|
|
104
|
+
export const listInventoryLevelsResponseTwoTwoLevelsMin = 1;
|
|
105
|
+
export const ListInventoryLevelsResponse = zod.union([zod.object({
|
|
106
|
+
"connectionId": zod.string().min(listInventoryLevelsResponseOneOneConnectionIdMin).max(listInventoryLevelsResponseOneOneConnectionIdMax).regex(listInventoryLevelsResponseOneOneConnectionIdRegExp),
|
|
107
|
+
"provider": zod.enum(['quickbooksDesktop', 'netsuite']),
|
|
108
|
+
"itemId": zod.string().min(listInventoryLevelsResponseOneOneItemIdMin).max(listInventoryLevelsResponseOneOneItemIdMax).regex(listInventoryLevelsResponseOneOneItemIdRegExp),
|
|
109
|
+
"source": zod.enum(['sandbox', 'erp']),
|
|
110
|
+
"unit": zod.string().min(listInventoryLevelsResponseOneOneUnitMin).describe('Native stocking unit reported for this item. Do not compare quantities in different units without conversion evidence.'),
|
|
111
|
+
"observedAt": zod.iso.datetime({ "offset": true })
|
|
112
|
+
}).and(zod.object({
|
|
113
|
+
"granularity": zod.enum(['book']),
|
|
114
|
+
"onHand": zod.string().regex(listInventoryLevelsResponseOneTwoOnHandRegExp).describe('Physical on-hand quantity as a decimal string in the source unit. Negative stock is permitted where the source reports it.')
|
|
115
|
+
})), zod.object({
|
|
116
|
+
"connectionId": zod.string().min(listInventoryLevelsResponseTwoOneConnectionIdMin).max(listInventoryLevelsResponseTwoOneConnectionIdMax).regex(listInventoryLevelsResponseTwoOneConnectionIdRegExp),
|
|
117
|
+
"provider": zod.enum(['quickbooksDesktop', 'netsuite']),
|
|
118
|
+
"itemId": zod.string().min(listInventoryLevelsResponseTwoOneItemIdMin).max(listInventoryLevelsResponseTwoOneItemIdMax).regex(listInventoryLevelsResponseTwoOneItemIdRegExp),
|
|
119
|
+
"source": zod.enum(['sandbox', 'erp']),
|
|
120
|
+
"unit": zod.string().min(listInventoryLevelsResponseTwoOneUnitMin).describe('Native stocking unit reported for this item. Do not compare quantities in different units without conversion evidence.'),
|
|
121
|
+
"observedAt": zod.iso.datetime({ "offset": true })
|
|
122
|
+
}).and(zod.object({
|
|
123
|
+
"granularity": zod.enum(['site']),
|
|
124
|
+
"levels": zod.array(zod.object({
|
|
125
|
+
"siteId": zod.string().min(listInventoryLevelsResponseTwoTwoLevelsItemSiteIdMin).max(listInventoryLevelsResponseTwoTwoLevelsItemSiteIdMax).regex(listInventoryLevelsResponseTwoTwoLevelsItemSiteIdRegExp),
|
|
126
|
+
"onHand": zod.string().regex(listInventoryLevelsResponseTwoTwoLevelsItemOnHandRegExp).describe('Physical on-hand quantity as a decimal string in the source unit. Negative stock is permitted where the source reports it.')
|
|
127
|
+
})).min(listInventoryLevelsResponseTwoTwoLevelsMin)
|
|
128
|
+
}))]);
|
|
129
|
+
/**
|
|
130
|
+
* 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.
|
|
67
131
|
* @summary Query an authorized book in its native language
|
|
68
132
|
*/
|
|
69
133
|
export const queryRawPathIdMin = 1;
|
|
@@ -107,7 +171,7 @@ export const QueryRawResponse = zod.union([zod.object({
|
|
|
107
171
|
})
|
|
108
172
|
})]);
|
|
109
173
|
/**
|
|
110
|
-
* Requires raw:read.
|
|
174
|
+
* 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.
|
|
111
175
|
* @summary Read a native invoice from a consenting sandbox book
|
|
112
176
|
*/
|
|
113
177
|
export const readRawPathIdMin = 1;
|
|
@@ -135,6 +199,135 @@ export const ReadRawResponse = zod.union([zod.object({
|
|
|
135
199
|
"id": zod.string()
|
|
136
200
|
})
|
|
137
201
|
})]);
|
|
202
|
+
/**
|
|
203
|
+
* Requires raw:query, native-query consent, and an enrolled QuickBooks Desktop pilot connector. Returns the current name, revision, and account number.
|
|
204
|
+
* @summary Read a native QuickBooks Desktop vendor by ListID
|
|
205
|
+
*/
|
|
206
|
+
export const retrieveQuickBooksVendorPathIdMin = 1;
|
|
207
|
+
export const retrieveQuickBooksVendorPathListIdMin = 1;
|
|
208
|
+
export const retrieveQuickBooksVendorPathListIdMax = 36;
|
|
209
|
+
export const RetrieveQuickBooksVendorParams = zod.object({
|
|
210
|
+
"id": zod.string().min(retrieveQuickBooksVendorPathIdMin).describe('Opaque configured connection ID'),
|
|
211
|
+
"listId": zod.string().min(retrieveQuickBooksVendorPathListIdMin).max(retrieveQuickBooksVendorPathListIdMax)
|
|
212
|
+
});
|
|
213
|
+
export const RetrieveQuickBooksVendorResponse = zod.object({
|
|
214
|
+
"listId": zod.string(),
|
|
215
|
+
"name": zod.string(),
|
|
216
|
+
"editSequence": zod.string(),
|
|
217
|
+
"accountNumber": zod.string().nullable()
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* 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.
|
|
221
|
+
* @summary Read native QuickBooks Desktop invoice details by TxnID
|
|
222
|
+
*/
|
|
223
|
+
export const retrieveQuickBooksInvoicePathIdMin = 1;
|
|
224
|
+
export const retrieveQuickBooksInvoicePathTxnIdMin = 1;
|
|
225
|
+
export const retrieveQuickBooksInvoicePathTxnIdMax = 36;
|
|
226
|
+
export const RetrieveQuickBooksInvoiceParams = zod.object({
|
|
227
|
+
"id": zod.string().min(retrieveQuickBooksInvoicePathIdMin).describe('Opaque configured connection ID'),
|
|
228
|
+
"txnId": zod.string().min(retrieveQuickBooksInvoicePathTxnIdMin).max(retrieveQuickBooksInvoicePathTxnIdMax)
|
|
229
|
+
});
|
|
230
|
+
export const RetrieveQuickBooksInvoiceResponse = zod.object({
|
|
231
|
+
"txnId": zod.string(),
|
|
232
|
+
"editSequence": zod.string(),
|
|
233
|
+
"reference": zod.string().nullable(),
|
|
234
|
+
"transactionDate": zod.iso.date(),
|
|
235
|
+
"classId": zod.string().nullable(),
|
|
236
|
+
"termsId": zod.string().nullable(),
|
|
237
|
+
"balanceDue": zod.string().nullable()
|
|
238
|
+
});
|
|
239
|
+
/**
|
|
240
|
+
* 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.
|
|
241
|
+
* @summary Read a native QuickBooks Desktop trial balance
|
|
242
|
+
*/
|
|
243
|
+
export const getQuickBooksTrialBalancePathIdMin = 1;
|
|
244
|
+
export const GetQuickBooksTrialBalanceParams = zod.object({
|
|
245
|
+
"id": zod.string().min(getQuickBooksTrialBalancePathIdMin).describe('Opaque configured connection ID')
|
|
246
|
+
});
|
|
247
|
+
export const GetQuickBooksTrialBalanceQueryParams = zod.strictObject({
|
|
248
|
+
"from": zod.iso.date().exactOptional(),
|
|
249
|
+
"to": zod.iso.date().exactOptional(),
|
|
250
|
+
"basis": zod.enum(['accrual', 'cash']).exactOptional()
|
|
251
|
+
});
|
|
252
|
+
export const getQuickBooksTrialBalanceResponseRowsItemNumberMin = 1;
|
|
253
|
+
export const GetQuickBooksTrialBalanceResponse = zod.object({
|
|
254
|
+
"title": zod.string(),
|
|
255
|
+
"basis": zod.string().nullable(),
|
|
256
|
+
"columns": zod.array(zod.object({
|
|
257
|
+
"id": zod.string(),
|
|
258
|
+
"type": zod.string(),
|
|
259
|
+
"titles": zod.array(zod.string())
|
|
260
|
+
})),
|
|
261
|
+
"rows": zod.array(zod.object({
|
|
262
|
+
"number": zod.int().min(getQuickBooksTrialBalanceResponseRowsItemNumberMin),
|
|
263
|
+
"kind": zod.enum(['DataRow', 'TextRow', 'SubtotalRow', 'TotalRow']),
|
|
264
|
+
"label": zod.string().nullable(),
|
|
265
|
+
"cells": zod.array(zod.object({
|
|
266
|
+
"columnId": zod.string(),
|
|
267
|
+
"value": zod.string().nullable()
|
|
268
|
+
}))
|
|
269
|
+
}))
|
|
270
|
+
});
|
|
271
|
+
/**
|
|
272
|
+
* 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.
|
|
273
|
+
* @summary Admit a native QuickBooks Desktop test vendor edit
|
|
274
|
+
*/
|
|
275
|
+
export const admitRawWritePathIdMin = 1;
|
|
276
|
+
export const AdmitRawWriteParams = zod.object({
|
|
277
|
+
"id": zod.string().min(admitRawWritePathIdMin).describe('Opaque configured connection ID')
|
|
278
|
+
});
|
|
279
|
+
export const admitRawWriteBodyQbxmlMin = 1;
|
|
280
|
+
export const admitRawWriteBodyQbxmlMax = 4096;
|
|
281
|
+
export const AdmitRawWriteBody = zod.strictObject({
|
|
282
|
+
"qbxml": zod.string().min(admitRawWriteBodyQbxmlMin).max(admitRawWriteBodyQbxmlMax)
|
|
283
|
+
});
|
|
284
|
+
export const admitRawWriteResponseIdRegExp = new RegExp('^rawop_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$');
|
|
285
|
+
export const AdmitRawWriteResponse = zod.object({
|
|
286
|
+
"id": zod.string().regex(admitRawWriteResponseIdRegExp)
|
|
287
|
+
});
|
|
288
|
+
/**
|
|
289
|
+
* 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.
|
|
290
|
+
* @summary Retrieve a native vendor edit outcome
|
|
291
|
+
*/
|
|
292
|
+
export const retrieveRawWritePathIdMin = 1;
|
|
293
|
+
export const retrieveRawWritePathOperationIdRegExp = new RegExp('^rawop_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$');
|
|
294
|
+
export const RetrieveRawWriteParams = zod.object({
|
|
295
|
+
"id": zod.string().min(retrieveRawWritePathIdMin).describe('Opaque configured connection ID'),
|
|
296
|
+
"operationId": zod.string().regex(retrieveRawWritePathOperationIdRegExp)
|
|
297
|
+
});
|
|
298
|
+
export const retrieveRawWriteResponseOneIdRegExp = new RegExp('^rawop_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$');
|
|
299
|
+
export const retrieveRawWriteResponseOneNativeStatusCodeRegExp = new RegExp('^[0-9]+$');
|
|
300
|
+
export const retrieveRawWriteResponseTwoIdRegExp = new RegExp('^rawop_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$');
|
|
301
|
+
export const retrieveRawWriteResponseTwoNativeStatusCodeRegExp = new RegExp('^[0-9]+$');
|
|
302
|
+
export const retrieveRawWriteResponseThreeIdRegExp = new RegExp('^rawop_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$');
|
|
303
|
+
export const retrieveRawWriteResponseThreeRecordListIdMin = 1;
|
|
304
|
+
export const retrieveRawWriteResponseThreeRecordEditSequenceMin = 1;
|
|
305
|
+
export const retrieveRawWriteResponseThreeRecordAccountNumberMin = 1;
|
|
306
|
+
export const retrieveRawWriteResponseThreeRecordQbxmlMin = 1;
|
|
307
|
+
export const retrieveRawWriteResponseThreeRecordQbxmlMax = 1048576;
|
|
308
|
+
export const retrieveRawWriteResponseThreeNativeStatusCodeRegExp = new RegExp('^[0-9]+$');
|
|
309
|
+
export const RetrieveRawWriteResponse = zod.union([zod.object({
|
|
310
|
+
"id": zod.string().regex(retrieveRawWriteResponseOneIdRegExp),
|
|
311
|
+
"status": zod.enum(['pending']),
|
|
312
|
+
"diagnosis": zod.enum(['awaiting_preflight', 'awaiting_verification', 'effect_unconfirmed']),
|
|
313
|
+
"nativeStatusCode": zod.string().regex(retrieveRawWriteResponseOneNativeStatusCodeRegExp).exactOptional()
|
|
314
|
+
}), zod.object({
|
|
315
|
+
"id": zod.string().regex(retrieveRawWriteResponseTwoIdRegExp),
|
|
316
|
+
"status": zod.enum(['rejected']),
|
|
317
|
+
"diagnosis": zod.enum(['edit_sequence_mismatch', 'value_already_set', 'native_rejected']),
|
|
318
|
+
"nativeStatusCode": zod.string().regex(retrieveRawWriteResponseTwoNativeStatusCodeRegExp).exactOptional()
|
|
319
|
+
}), zod.object({
|
|
320
|
+
"id": zod.string().regex(retrieveRawWriteResponseThreeIdRegExp),
|
|
321
|
+
"status": zod.enum(['verified']),
|
|
322
|
+
"diagnosis": zod.literal(null).nullable(),
|
|
323
|
+
"record": zod.object({
|
|
324
|
+
"listId": zod.string().min(retrieveRawWriteResponseThreeRecordListIdMin),
|
|
325
|
+
"editSequence": zod.string().min(retrieveRawWriteResponseThreeRecordEditSequenceMin),
|
|
326
|
+
"accountNumber": zod.string().min(retrieveRawWriteResponseThreeRecordAccountNumberMin),
|
|
327
|
+
"qbxml": zod.string().min(retrieveRawWriteResponseThreeRecordQbxmlMin).max(retrieveRawWriteResponseThreeRecordQbxmlMax)
|
|
328
|
+
}),
|
|
329
|
+
"nativeStatusCode": zod.string().regex(retrieveRawWriteResponseThreeNativeStatusCodeRegExp).exactOptional()
|
|
330
|
+
})]);
|
|
138
331
|
/**
|
|
139
332
|
* Requires receivables:write. Record money already received from the mapped customer and apply it to their invoice in the selected sandbox book. Read the operation for the verified invoice balance.
|
|
140
333
|
* @summary Record a received payment applied to an invoice
|
|
@@ -700,6 +893,166 @@ export const ListSyncedInvoicesResponse = zod.object({
|
|
|
700
893
|
})),
|
|
701
894
|
"nextCursor": zod.string().min(listSyncedInvoicesResponseNextCursorMin).nullable()
|
|
702
895
|
});
|
|
896
|
+
/**
|
|
897
|
+
* 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.
|
|
898
|
+
* @summary Discover the authorized invoice fields in one book
|
|
899
|
+
*/
|
|
900
|
+
export const discoverInvoiceCustomFieldsPathIdMin = 1;
|
|
901
|
+
export const DiscoverInvoiceCustomFieldsParams = zod.object({
|
|
902
|
+
"id": zod.string().min(discoverInvoiceCustomFieldsPathIdMin).describe('Opaque configured connection ID')
|
|
903
|
+
});
|
|
904
|
+
export const discoverInvoiceCustomFieldsResponseConnectionIdMin = 1;
|
|
905
|
+
export const discoverInvoiceCustomFieldsResponseRevisionMin = 1;
|
|
906
|
+
export const discoverInvoiceCustomFieldsResponseFieldsItemIdMin = 1;
|
|
907
|
+
export const discoverInvoiceCustomFieldsResponseFieldsItemLabelMin = 1;
|
|
908
|
+
export const discoverInvoiceCustomFieldsResponseFieldsItemOptionsItemIdMin = 1;
|
|
909
|
+
export const discoverInvoiceCustomFieldsResponseFieldsItemOptionsItemLabelMin = 1;
|
|
910
|
+
export const discoverInvoiceCustomFieldsResponseFieldsItemMaxLengthMin = 1;
|
|
911
|
+
export const DiscoverInvoiceCustomFieldsResponse = zod.object({
|
|
912
|
+
"connectionId": zod.string().min(discoverInvoiceCustomFieldsResponseConnectionIdMin),
|
|
913
|
+
"provider": zod.enum(['quickbooksDesktop', 'netsuite']),
|
|
914
|
+
"revision": zod.string().min(discoverInvoiceCustomFieldsResponseRevisionMin),
|
|
915
|
+
"fields": zod.array(zod.object({
|
|
916
|
+
"id": zod.string().min(discoverInvoiceCustomFieldsResponseFieldsItemIdMin),
|
|
917
|
+
"label": zod.string().min(discoverInvoiceCustomFieldsResponseFieldsItemLabelMin),
|
|
918
|
+
"type": zod.enum(['text', 'boolean', 'decimal', 'date', 'select']),
|
|
919
|
+
"writable": zod.boolean(),
|
|
920
|
+
"nullable": zod.boolean(),
|
|
921
|
+
"options": zod.array(zod.object({
|
|
922
|
+
"id": zod.string().min(discoverInvoiceCustomFieldsResponseFieldsItemOptionsItemIdMin),
|
|
923
|
+
"label": zod.string().min(discoverInvoiceCustomFieldsResponseFieldsItemOptionsItemLabelMin)
|
|
924
|
+
})).exactOptional(),
|
|
925
|
+
"maxLength": zod.int().min(discoverInvoiceCustomFieldsResponseFieldsItemMaxLengthMin).exactOptional()
|
|
926
|
+
}))
|
|
927
|
+
});
|
|
928
|
+
/**
|
|
929
|
+
* 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.
|
|
930
|
+
* @summary Read custom field values on one invoice
|
|
931
|
+
*/
|
|
932
|
+
export const readInvoiceCustomFieldsPathIdMin = 1;
|
|
933
|
+
export const readInvoiceCustomFieldsPathNativeIdMin = 1;
|
|
934
|
+
export const readInvoiceCustomFieldsPathNativeIdRegExp = new RegExp('^(?!\\.{1,2}$).+$');
|
|
935
|
+
export const ReadInvoiceCustomFieldsParams = zod.object({
|
|
936
|
+
"id": zod.string().min(readInvoiceCustomFieldsPathIdMin).describe('Opaque configured connection ID'),
|
|
937
|
+
"nativeId": zod.string().min(readInvoiceCustomFieldsPathNativeIdMin).regex(readInvoiceCustomFieldsPathNativeIdRegExp).describe('Unescaped provider invoice ID.')
|
|
938
|
+
});
|
|
939
|
+
export const readInvoiceCustomFieldsResponseConnectionIdMin = 1;
|
|
940
|
+
export const readInvoiceCustomFieldsResponseInvoiceIdMin = 1;
|
|
941
|
+
export const readInvoiceCustomFieldsResponseSchemaRevisionMin = 1;
|
|
942
|
+
export const readInvoiceCustomFieldsResponseRevisionMin = 1;
|
|
943
|
+
export const ReadInvoiceCustomFieldsResponse = zod.object({
|
|
944
|
+
"connectionId": zod.string().min(readInvoiceCustomFieldsResponseConnectionIdMin),
|
|
945
|
+
"provider": zod.enum(['quickbooksDesktop', 'netsuite']),
|
|
946
|
+
"invoiceId": zod.string().min(readInvoiceCustomFieldsResponseInvoiceIdMin),
|
|
947
|
+
"schemaRevision": zod.string().min(readInvoiceCustomFieldsResponseSchemaRevisionMin),
|
|
948
|
+
"revision": zod.string().min(readInvoiceCustomFieldsResponseRevisionMin),
|
|
949
|
+
"values": zod.record(zod.string(), zod.union([zod.string().nullable(), zod.boolean()]).describe('Values use native field IDs. Text, dates, exact decimals and select IDs are strings. Null clears a nullable field.'))
|
|
950
|
+
});
|
|
951
|
+
/**
|
|
952
|
+
* 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.
|
|
953
|
+
* @summary Update selected custom fields on one invoice
|
|
954
|
+
*/
|
|
955
|
+
export const updateInvoiceCustomFieldsPathIdMin = 1;
|
|
956
|
+
export const updateInvoiceCustomFieldsPathNativeIdMin = 1;
|
|
957
|
+
export const updateInvoiceCustomFieldsPathNativeIdRegExp = new RegExp('^(?!\\.{1,2}$).+$');
|
|
958
|
+
export const UpdateInvoiceCustomFieldsParams = zod.object({
|
|
959
|
+
"id": zod.string().min(updateInvoiceCustomFieldsPathIdMin).describe('Opaque configured connection ID'),
|
|
960
|
+
"nativeId": zod.string().min(updateInvoiceCustomFieldsPathNativeIdMin).regex(updateInvoiceCustomFieldsPathNativeIdRegExp).describe('Unescaped provider invoice ID.')
|
|
961
|
+
});
|
|
962
|
+
export const updateInvoiceCustomFieldsBodySchemaRevisionMin = 1;
|
|
963
|
+
export const updateInvoiceCustomFieldsBodyRevisionMin = 1;
|
|
964
|
+
export const UpdateInvoiceCustomFieldsBody = zod.strictObject({
|
|
965
|
+
"schemaRevision": zod.string().min(updateInvoiceCustomFieldsBodySchemaRevisionMin),
|
|
966
|
+
"revision": zod.string().min(updateInvoiceCustomFieldsBodyRevisionMin),
|
|
967
|
+
"values": zod.record(zod.string(), zod.union([zod.string().nullable(), zod.boolean()]).describe('Values use native field IDs. Text, dates, exact decimals and select IDs are strings. Null clears a nullable field.'))
|
|
968
|
+
});
|
|
969
|
+
export const updateInvoiceCustomFieldsResponseConnectionIdMin = 1;
|
|
970
|
+
export const updateInvoiceCustomFieldsResponseInvoiceIdMin = 1;
|
|
971
|
+
export const updateInvoiceCustomFieldsResponseSchemaRevisionMin = 1;
|
|
972
|
+
export const updateInvoiceCustomFieldsResponseRevisionMin = 1;
|
|
973
|
+
export const UpdateInvoiceCustomFieldsResponse = zod.object({
|
|
974
|
+
"connectionId": zod.string().min(updateInvoiceCustomFieldsResponseConnectionIdMin),
|
|
975
|
+
"provider": zod.enum(['quickbooksDesktop', 'netsuite']),
|
|
976
|
+
"invoiceId": zod.string().min(updateInvoiceCustomFieldsResponseInvoiceIdMin),
|
|
977
|
+
"schemaRevision": zod.string().min(updateInvoiceCustomFieldsResponseSchemaRevisionMin),
|
|
978
|
+
"revision": zod.string().min(updateInvoiceCustomFieldsResponseRevisionMin),
|
|
979
|
+
"values": zod.record(zod.string(), zod.union([zod.string().nullable(), zod.boolean()]).describe('Values use native field IDs. Text, dates, exact decimals and select IDs are strings. Null clears a nullable field.'))
|
|
980
|
+
});
|
|
981
|
+
/**
|
|
982
|
+
* 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.
|
|
983
|
+
* @summary Read an invoice by its native ID in a connected book
|
|
984
|
+
*/
|
|
985
|
+
export const retrieveInvoicePathIdMin = 1;
|
|
986
|
+
export const retrieveInvoicePathIdRegExp = new RegExp('^(?!\\.{1,2}$).+$');
|
|
987
|
+
export const retrieveInvoicePathNativeIdMin = 1;
|
|
988
|
+
export const retrieveInvoicePathNativeIdRegExp = new RegExp('^(?!\\.{1,2}$).+$');
|
|
989
|
+
export const RetrieveInvoiceParams = zod.object({
|
|
990
|
+
"id": zod.string().min(retrieveInvoicePathIdMin).regex(retrieveInvoicePathIdRegExp).describe('Rowbind connection that identifies the book.'),
|
|
991
|
+
"nativeId": zod.string().min(retrieveInvoicePathNativeIdMin).regex(retrieveInvoicePathNativeIdRegExp).describe('Native invoice identifier, such as a QuickBooks Desktop TxnID or a NetSuite internal ID. Supply the unescaped identifier.')
|
|
992
|
+
});
|
|
993
|
+
export const retrieveInvoiceResponseOneOneIdMin = 1;
|
|
994
|
+
export const retrieveInvoiceResponseOneOneConnectionIdMin = 1;
|
|
995
|
+
export const retrieveInvoiceResponseOneOneCustomerIdMin = 1;
|
|
996
|
+
export const retrieveInvoiceResponseOneOneExternalReferenceMin = 1;
|
|
997
|
+
export const retrieveInvoiceResponseOneOneCurrencyRegExp = new RegExp('^[A-Z]{3}$');
|
|
998
|
+
export const retrieveInvoiceResponseOneOneLinesItemItemIdMin = 1;
|
|
999
|
+
export const retrieveInvoiceResponseOneOneLinesItemUnitPriceMin = 1;
|
|
1000
|
+
export const retrieveInvoiceResponseOneOneTotalRegExp = new RegExp('^-?(0|[1-9][0-9]*)\\.[0-9]{2}$');
|
|
1001
|
+
export const retrieveInvoiceResponseOneOneBalanceDueRegExp = new RegExp('^-?(0|[1-9][0-9]*)\\.[0-9]{2}$');
|
|
1002
|
+
export const retrieveInvoiceResponseOneTwoClassIdMin = 1;
|
|
1003
|
+
export const retrieveInvoiceResponseOneTwoTermsIdMin = 1;
|
|
1004
|
+
export const retrieveInvoiceResponseTwoOneIdMin = 1;
|
|
1005
|
+
export const retrieveInvoiceResponseTwoOneConnectionIdMin = 1;
|
|
1006
|
+
export const retrieveInvoiceResponseTwoOneCustomerIdMin = 1;
|
|
1007
|
+
export const retrieveInvoiceResponseTwoOneExternalReferenceMin = 1;
|
|
1008
|
+
export const retrieveInvoiceResponseTwoOneCurrencyRegExp = new RegExp('^[A-Z]{3}$');
|
|
1009
|
+
export const retrieveInvoiceResponseTwoOneLinesItemItemIdMin = 1;
|
|
1010
|
+
export const retrieveInvoiceResponseTwoOneLinesItemUnitPriceMin = 1;
|
|
1011
|
+
export const retrieveInvoiceResponseTwoOneTotalRegExp = new RegExp('^-?(0|[1-9][0-9]*)\\.[0-9]{2}$');
|
|
1012
|
+
export const retrieveInvoiceResponseTwoOneBalanceDueRegExp = new RegExp('^-?(0|[1-9][0-9]*)\\.[0-9]{2}$');
|
|
1013
|
+
export const retrieveInvoiceResponseTwoTwoSubsidiaryIdMin = 1;
|
|
1014
|
+
export const retrieveInvoiceResponseTwoTwoDepartmentIdRegExp = new RegExp('^[1-9][0-9]*$');
|
|
1015
|
+
export const RetrieveInvoiceResponse = zod.union([zod.object({
|
|
1016
|
+
"id": zod.string().min(retrieveInvoiceResponseOneOneIdMin),
|
|
1017
|
+
"connectionId": zod.string().min(retrieveInvoiceResponseOneOneConnectionIdMin),
|
|
1018
|
+
"customerId": zod.string().min(retrieveInvoiceResponseOneOneCustomerIdMin),
|
|
1019
|
+
"externalReference": zod.string().min(retrieveInvoiceResponseOneOneExternalReferenceMin).exactOptional().describe('Business reference when present in the source.'),
|
|
1020
|
+
"transactionDate": zod.iso.date().exactOptional(),
|
|
1021
|
+
"currency": zod.string().regex(retrieveInvoiceResponseOneOneCurrencyRegExp),
|
|
1022
|
+
"lines": zod.array(zod.object({
|
|
1023
|
+
"itemId": zod.string().min(retrieveInvoiceResponseOneOneLinesItemItemIdMin),
|
|
1024
|
+
"quantity": zod.number(),
|
|
1025
|
+
"unitPrice": zod.string().min(retrieveInvoiceResponseOneOneLinesItemUnitPriceMin),
|
|
1026
|
+
"description": zod.string().exactOptional()
|
|
1027
|
+
})),
|
|
1028
|
+
"total": zod.string().regex(retrieveInvoiceResponseOneOneTotalRegExp),
|
|
1029
|
+
"balanceDue": zod.string().regex(retrieveInvoiceResponseOneOneBalanceDueRegExp),
|
|
1030
|
+
"observedAt": zod.iso.datetime({ "offset": true }).describe('When Rowbind observed this read from the book.')
|
|
1031
|
+
}).and(zod.object({
|
|
1032
|
+
"provider": zod.enum(['quickbooksDesktop']),
|
|
1033
|
+
"classId": zod.string().min(retrieveInvoiceResponseOneTwoClassIdMin).exactOptional().describe('ListID of the QuickBooks invoice header class when returned.'),
|
|
1034
|
+
"termsId": zod.string().min(retrieveInvoiceResponseOneTwoTermsIdMin).exactOptional().describe('ListID of the QuickBooks invoice terms when returned.')
|
|
1035
|
+
})), zod.object({
|
|
1036
|
+
"id": zod.string().min(retrieveInvoiceResponseTwoOneIdMin),
|
|
1037
|
+
"connectionId": zod.string().min(retrieveInvoiceResponseTwoOneConnectionIdMin),
|
|
1038
|
+
"customerId": zod.string().min(retrieveInvoiceResponseTwoOneCustomerIdMin),
|
|
1039
|
+
"externalReference": zod.string().min(retrieveInvoiceResponseTwoOneExternalReferenceMin).exactOptional().describe('Business reference when present in the source.'),
|
|
1040
|
+
"transactionDate": zod.iso.date().exactOptional(),
|
|
1041
|
+
"currency": zod.string().regex(retrieveInvoiceResponseTwoOneCurrencyRegExp),
|
|
1042
|
+
"lines": zod.array(zod.object({
|
|
1043
|
+
"itemId": zod.string().min(retrieveInvoiceResponseTwoOneLinesItemItemIdMin),
|
|
1044
|
+
"quantity": zod.number(),
|
|
1045
|
+
"unitPrice": zod.string().min(retrieveInvoiceResponseTwoOneLinesItemUnitPriceMin),
|
|
1046
|
+
"description": zod.string().exactOptional()
|
|
1047
|
+
})),
|
|
1048
|
+
"total": zod.string().regex(retrieveInvoiceResponseTwoOneTotalRegExp),
|
|
1049
|
+
"balanceDue": zod.string().regex(retrieveInvoiceResponseTwoOneBalanceDueRegExp),
|
|
1050
|
+
"observedAt": zod.iso.datetime({ "offset": true }).describe('When Rowbind observed this read from the book.')
|
|
1051
|
+
}).and(zod.object({
|
|
1052
|
+
"provider": zod.enum(['netsuite']),
|
|
1053
|
+
"subsidiaryId": zod.string().min(retrieveInvoiceResponseTwoTwoSubsidiaryIdMin),
|
|
1054
|
+
"departmentId": zod.string().regex(retrieveInvoiceResponseTwoTwoDepartmentIdRegExp).exactOptional().describe('NetSuite internal ID of the invoice header department in the selected account.')
|
|
1055
|
+
}))]);
|
|
703
1056
|
/**
|
|
704
1057
|
* Requires sync:read. Use nextCursor as after for the next page. Each cursor is an observation ID from this connection.
|
|
705
1058
|
* @summary List received payments observed in a sandbox book
|
package/dist/http-request.js
CHANGED
|
@@ -20,7 +20,8 @@ export async function sendToRowbind(path, options) {
|
|
|
20
20
|
const headers = new Headers(request.headers);
|
|
21
21
|
const execute = rowbind.fetch ?? fetch;
|
|
22
22
|
headers.set("Authorization", `Bearer ${rowbind.key}`);
|
|
23
|
-
const
|
|
23
|
+
const keyedWrite = (request.method === "POST" || request.method === "PATCH") && headers.has("Idempotency-Key");
|
|
24
|
+
const idempotent = request.method === "GET" || request.method === "PUT" || keyedWrite;
|
|
24
25
|
const attempts = idempotent ? 3 : 1;
|
|
25
26
|
let serviceError;
|
|
26
27
|
let requestId;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import type { CompanyRequest, ConnectSessionRequest, CreditApplicationRecord, CreditMemoRecord, ListObservedPaymentsParams, ListSyncedInvoicesParams, MatchObservedPaymentRequest, ReceivedPaymentRecord, RetrieveInvoiceRecoveryParams, SyncedInvoicePage, WebhookEndpointRequest } from "./generated/http.js";
|
|
1
|
+
import type { CompanyRequest, ConnectSessionRequest, CreditApplicationRecord, CreditMemoRecord, ListInventoryLevelsParams, ListObservedPaymentsParams, ListSyncedInvoicesParams, MatchObservedPaymentRequest, ReceivedPaymentRecord, RetrieveInvoiceRecoveryParams, SyncedInvoicePage, WebhookEndpointRequest, InvoiceCustomFieldUpdate, InvoiceCustomFieldValues, GetQuickBooksTrialBalanceParams } from "./generated/http.js";
|
|
2
2
|
import { catalogNamespace } from "./generated/catalog.js";
|
|
3
3
|
import { rawNamespaces } from "./generated/raw.js";
|
|
4
4
|
import { type InvoiceTraceLookup, type PilotOperation } from "./transport.js";
|
|
5
5
|
import type { ResponseMetadata, RowbindFetch } from "./http-request.js";
|
|
6
|
+
import { type InvoiceCustomFieldAssignment } from "./invoice-custom-fields.js";
|
|
6
7
|
import { type SandboxRecord } from "./ledger.js";
|
|
7
8
|
import { buildSchema, fulfillmentSchema, orderSchema, sitesSchema, stockSchema, type BatchCreateParams, type ConnectionId, type CreditApplicationParams, type CreditMemoCreateParams, type InvoiceCreateParams, type NativeInput, type ReceivedPaymentCreateParams } from "./inputs.js";
|
|
8
9
|
export { LedgerError as RowbindError } from "./ledger.js";
|
|
9
10
|
export type { RowbindFetch } from "./http-request.js";
|
|
11
|
+
export { generateInvoiceCustomFields, invoiceCustomField } from "./invoice-custom-fields.js";
|
|
12
|
+
export type { InvoiceCustomField, InvoiceCustomFieldAssignment, InvoiceCustomFieldKind, InvoiceCustomFieldValue } from "./invoice-custom-fields.js";
|
|
10
13
|
export type { BuildRecord, FulfillmentRecord, InvoiceRecord, SandboxRecord } from "./ledger.js";
|
|
11
14
|
export type { BatchCreateParams, ConnectionId, CreditApplicationParams, CreditMemoCreateParams, InvoiceCreateParams, InvoiceInput, InvoiceTarget, Provider, ReceivedPaymentCreateParams, } from "./inputs.js";
|
|
12
|
-
export type { CatalogKind, CatalogLink, CatalogLinkRequest, CatalogPage, CatalogRecord, BatchRow, BatchRowDiagnosis, ConnectionHealth, CreditApplicationRecord, CreditMemoRecord, ReceivedPaymentRecord, ReimbursementBatch, WebhookDelivery, WebhookEndpoint, ListObservedPaymentsParams, MatchObservedPaymentRequest, MatchedPaymentDelivery, ObservedPayment, ObservedPaymentPage, ObservedPaymentStatus, InvoiceCreatedEvent, InvoiceDeletedEvent, InvoiceUpdatedEvent, InvoiceVoidedEvent, ListSyncedInvoicesParams, SyncedInvoice, SyncedInvoiceDetails, SyncedInvoicePage, InvoiceRecoveryEntry, InvoiceRecoveryPage, InvoiceRequestTrace, InvoiceTracePage, RetrieveInvoiceRecoveryParams, PaymentMatchedEvent, PaymentSyncStatus, SuiteQLPage, } from "./generated/http.js";
|
|
15
|
+
export type { CatalogKind, CatalogLink, CatalogLinkRequest, CatalogPage, CatalogRecord, InventoryBookLevels, InventoryLevels, InventorySiteLevel, InventorySiteLevels, ListInventoryLevelsParams, BatchRow, BatchRowDiagnosis, ConnectionHealth, CreditApplicationRecord, CreditMemoRecord, ReceivedPaymentRecord, ReimbursementBatch, WebhookDelivery, WebhookEndpoint, ListObservedPaymentsParams, MatchObservedPaymentRequest, MatchedPaymentDelivery, ObservedPayment, ObservedPaymentPage, ObservedPaymentStatus, InvoiceCreatedEvent, InvoiceDeletedEvent, InvoiceUpdatedEvent, InvoiceVoidedEvent, ListSyncedInvoicesParams, SyncedInvoice, SyncedInvoiceDetails, SyncedInvoicePage, InvoiceRecoveryEntry, InvoiceRecoveryPage, InvoiceRequestTrace, InvoiceTracePage, RetrieveInvoiceRecoveryParams, RetrievedInvoice, RetrievedNetSuiteInvoice, RetrievedQuickBooksInvoice, PaymentMatchedEvent, PaymentSyncStatus, SuiteQLPage, InvoiceCustomFieldDefinition, InvoiceCustomFieldOption, InvoiceCustomFieldSchema, InvoiceCustomFieldUpdate, InvoiceCustomFieldValues, RawWriteAdmission, RawWriteOperation, RawWriteRecord, QuickBooksVendor, QuickBooksInvoiceDetails, QuickBooksTrialBalance, QuickBooksTrialBalanceCell, QuickBooksTrialBalanceColumn, QuickBooksTrialBalanceRow, } from "./generated/http.js";
|
|
13
16
|
export { OperationWaitError, type InvoiceTraceLookup, type PilotOperation } from "./transport.js";
|
|
14
17
|
type QuickBooksId = ConnectionId<"quickbooksDesktop">;
|
|
15
18
|
type NetSuiteId = ConnectionId<"netsuite">;
|
|
19
|
+
type TrialBalanceOptions = Pick<GetQuickBooksTrialBalanceParams, "basis"> & ({
|
|
20
|
+
from: string;
|
|
21
|
+
to: string;
|
|
22
|
+
} | {
|
|
23
|
+
from?: never;
|
|
24
|
+
to?: never;
|
|
25
|
+
});
|
|
16
26
|
export type Connection = {
|
|
17
27
|
provider: "quickbooksDesktop";
|
|
18
28
|
id: QuickBooksId;
|
|
@@ -179,6 +189,11 @@ export declare class Rowbind {
|
|
|
179
189
|
nativeId: string;
|
|
180
190
|
}>;
|
|
181
191
|
};
|
|
192
|
+
readonly inventory: {
|
|
193
|
+
levels: {
|
|
194
|
+
list: (connectionId: string, filters: ListInventoryLevelsParams) => Promise<import("./generated/http.js").InventoryLevels>;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
182
197
|
readonly sync: {
|
|
183
198
|
invoices: {
|
|
184
199
|
enable: (connectionId: string) => Promise<{
|
|
@@ -501,6 +516,7 @@ export declare class Rowbind {
|
|
|
501
516
|
apply: (creditMemoId: string, input: CreditApplicationParams) => Promise<Operation<"credit_application">>;
|
|
502
517
|
};
|
|
503
518
|
private createInvoice;
|
|
519
|
+
private updateTypedInvoiceCustomFields;
|
|
504
520
|
readonly invoices: {
|
|
505
521
|
create: {
|
|
506
522
|
(input: InvoiceCreateParams, options?: {
|
|
@@ -510,6 +526,8 @@ export declare class Rowbind {
|
|
|
510
526
|
includeRequestId?: boolean;
|
|
511
527
|
}): Promise<Operation<"invoice"> & ResponseMetadata>;
|
|
512
528
|
};
|
|
529
|
+
/** Read the current ERP invoice by its native ID and connection. */
|
|
530
|
+
retrieve: (connectionId: string, nativeId: string) => Promise<import("./generated/http.js").RetrievedInvoice>;
|
|
513
531
|
list: (connectionId: string, params?: ListSyncedInvoicesParams) => Promise<{
|
|
514
532
|
connectionId: string;
|
|
515
533
|
snapshotRevision: number;
|
|
@@ -540,6 +558,18 @@ export declare class Rowbind {
|
|
|
540
558
|
nextCursor: string | null;
|
|
541
559
|
}>;
|
|
542
560
|
iterPages: (connectionId: string, params?: ListSyncedInvoicesParams) => AsyncGenerator<SyncedInvoicePage, void>;
|
|
561
|
+
customFields: {
|
|
562
|
+
discover: (connectionId: string) => Promise<import("./generated/http.js").InvoiceCustomFieldSchema>;
|
|
563
|
+
read: (connectionId: string, nativeId: string) => Promise<InvoiceCustomFieldValues>;
|
|
564
|
+
update: (connectionId: string, nativeId: string, options: {
|
|
565
|
+
current: InvoiceCustomFieldValues;
|
|
566
|
+
assignments: readonly InvoiceCustomFieldAssignment[];
|
|
567
|
+
idempotencyKey: string;
|
|
568
|
+
}) => Promise<InvoiceCustomFieldValues>;
|
|
569
|
+
updateValues: (connectionId: string, nativeId: string, input: InvoiceCustomFieldUpdate & {
|
|
570
|
+
idempotencyKey: string;
|
|
571
|
+
}) => Promise<InvoiceCustomFieldValues>;
|
|
572
|
+
};
|
|
543
573
|
};
|
|
544
574
|
private iterInvoicePages;
|
|
545
575
|
private readRecord;
|
|
@@ -562,7 +592,33 @@ export declare class Rowbind {
|
|
|
562
592
|
};
|
|
563
593
|
};
|
|
564
594
|
readonly [rawNamespaces.quickbooksDesktop]: {
|
|
595
|
+
vendors: {
|
|
596
|
+
retrieve: ({ connectionId, listId }: {
|
|
597
|
+
connectionId: QuickBooksId;
|
|
598
|
+
listId: string;
|
|
599
|
+
}) => Promise<import("./generated/http.js").QuickBooksVendor>;
|
|
600
|
+
};
|
|
601
|
+
invoices: {
|
|
602
|
+
retrieve: ({ connectionId, txnId }: {
|
|
603
|
+
connectionId: QuickBooksId;
|
|
604
|
+
txnId: string;
|
|
605
|
+
}) => Promise<import("./generated/http.js").QuickBooksInvoiceDetails>;
|
|
606
|
+
};
|
|
607
|
+
reports: {
|
|
608
|
+
trialBalance: ({ connectionId, ...options }: TrialBalanceOptions & {
|
|
609
|
+
connectionId: QuickBooksId;
|
|
610
|
+
}) => Promise<import("./generated/http.js").QuickBooksTrialBalance>;
|
|
611
|
+
};
|
|
565
612
|
raw: {
|
|
613
|
+
write: ({ connectionId, qbxml, idempotencyKey }: {
|
|
614
|
+
connectionId: QuickBooksId;
|
|
615
|
+
qbxml: string;
|
|
616
|
+
idempotencyKey: string;
|
|
617
|
+
}) => Promise<import("./generated/http.js").RawWriteAdmission>;
|
|
618
|
+
writeResult: ({ connectionId, operationId }: {
|
|
619
|
+
connectionId: QuickBooksId;
|
|
620
|
+
operationId: string;
|
|
621
|
+
}) => Promise<import("./generated/http.js").RawWriteOperation>;
|
|
566
622
|
query: ({ connectionId, ...body }: import("./generated/raw.js").RawInput<Parameters<typeof import("./generated/http.js").queryRaw>[1], "quickbooksDesktop">) => Promise<{
|
|
567
623
|
provider: "quickbooksDesktop";
|
|
568
624
|
qbxml: string;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { catalogNamespace, createCatalog } from "./generated/catalog.js";
|
|
2
2
|
import { raw, rawNamespaces } from "./generated/raw.js";
|
|
3
3
|
import { PilotTransport } from "./transport.js";
|
|
4
|
+
import { stageInvoiceCustomFields } from "./invoice-custom-fields.js";
|
|
4
5
|
import { SandboxLedger, LedgerError, fixture } from "./ledger.js";
|
|
5
6
|
import { batchSchema, buildSchema, creditApplicationSchema, creditMemoSchema, fulfillmentSchema, invoiceSchema, orderSchema, parseInput, paymentSchema, sitesSchema, stockSchema, } from "./inputs.js";
|
|
6
7
|
export { LedgerError as RowbindError } from "./ledger.js";
|
|
8
|
+
export { generateInvoiceCustomFields, invoiceCustomField } from "./invoice-custom-fields.js";
|
|
7
9
|
export { OperationWaitError } from "./transport.js";
|
|
8
10
|
function destination(connection) {
|
|
9
11
|
if (connection.provider === "quickbooksDesktop") {
|
|
@@ -114,6 +116,9 @@ export class Rowbind {
|
|
|
114
116
|
retrieve: async (id) => this.remote ? destination(await this.remote.connection(id)) : lookupConnection(id),
|
|
115
117
|
};
|
|
116
118
|
[catalogNamespace] = createCatalog(() => this.workerTransport);
|
|
119
|
+
inventory = { levels: {
|
|
120
|
+
list: (connectionId, filters) => this.workerTransport.listInventoryLevels(connectionId, filters),
|
|
121
|
+
} };
|
|
117
122
|
sync = {
|
|
118
123
|
invoices: {
|
|
119
124
|
enable: (connectionId) => this.workerTransport.enableInvoiceSync(connectionId),
|
|
@@ -181,10 +186,26 @@ export class Rowbind {
|
|
|
181
186
|
}
|
|
182
187
|
return receipt(this.ledger.createInvoice(connectionId, idempotencyKey, invoice));
|
|
183
188
|
}
|
|
189
|
+
async updateTypedInvoiceCustomFields(connectionId, nativeId, options) {
|
|
190
|
+
const { current, assignments, idempotencyKey } = options;
|
|
191
|
+
const body = stageInvoiceCustomFields(connectionId, nativeId, current, assignments);
|
|
192
|
+
return this.workerTransport.updateInvoiceCustomFields(connectionId, nativeId, body, idempotencyKey, current.provider);
|
|
193
|
+
}
|
|
184
194
|
invoices = {
|
|
185
195
|
create: this.createInvoice.bind(this),
|
|
196
|
+
/** Read the current ERP invoice by its native ID and connection. */
|
|
197
|
+
retrieve: (connectionId, nativeId) => this.workerTransport.retrieveInvoice(connectionId, nativeId),
|
|
186
198
|
list: (connectionId, params) => this.workerTransport.listSyncedInvoices(connectionId, params),
|
|
187
199
|
iterPages: this.iterInvoicePages.bind(this),
|
|
200
|
+
customFields: {
|
|
201
|
+
discover: (connectionId) => this.workerTransport.discoverInvoiceCustomFields(connectionId),
|
|
202
|
+
read: (connectionId, nativeId) => this.workerTransport.readInvoiceCustomFields(connectionId, nativeId),
|
|
203
|
+
update: this.updateTypedInvoiceCustomFields.bind(this),
|
|
204
|
+
updateValues: (connectionId, nativeId, input) => {
|
|
205
|
+
const { idempotencyKey, ...body } = input;
|
|
206
|
+
return this.workerTransport.updateInvoiceCustomFields(connectionId, nativeId, body, idempotencyKey);
|
|
207
|
+
},
|
|
208
|
+
},
|
|
188
209
|
};
|
|
189
210
|
async *iterInvoicePages(connectionId, params) {
|
|
190
211
|
const query = { ...params };
|
|
@@ -217,7 +238,20 @@ export class Rowbind {
|
|
|
217
238
|
waitForVerifiedRecord: this.readRecord.bind(this),
|
|
218
239
|
};
|
|
219
240
|
[rawNamespaces.quickbooksDesktop] = {
|
|
220
|
-
|
|
241
|
+
vendors: {
|
|
242
|
+
retrieve: ({ connectionId, listId }) => this.workerTransport.retrieveQuickBooksVendor(connectionId, listId),
|
|
243
|
+
},
|
|
244
|
+
invoices: {
|
|
245
|
+
retrieve: ({ connectionId, txnId }) => this.workerTransport.retrieveQuickBooksInvoice(connectionId, txnId),
|
|
246
|
+
},
|
|
247
|
+
reports: {
|
|
248
|
+
trialBalance: ({ connectionId, ...options }) => this.workerTransport.getQuickBooksTrialBalance(connectionId, options),
|
|
249
|
+
},
|
|
250
|
+
raw: {
|
|
251
|
+
...raw.quickbooksDesktop(() => this.workerTransport),
|
|
252
|
+
write: ({ connectionId, qbxml, idempotencyKey }) => this.workerTransport.admitRawWrite(connectionId, { qbxml }, idempotencyKey),
|
|
253
|
+
writeResult: ({ connectionId, operationId }) => this.workerTransport.retrieveRawWrite(connectionId, operationId),
|
|
254
|
+
},
|
|
221
255
|
buildAssemblies: {
|
|
222
256
|
create: async (input) => {
|
|
223
257
|
const { connectionId, idempotencyKey, ...build } = parseInput(buildSchema, input);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { InvoiceCustomFieldSchema, InvoiceCustomFieldValues } from "./generated/http.js";
|
|
2
|
+
export type InvoiceCustomFieldKind = InvoiceCustomFieldSchema["fields"][number]["type"];
|
|
3
|
+
export type InvoiceCustomFieldValue = string | boolean | null;
|
|
4
|
+
export interface InvoiceCustomFieldAssignment {
|
|
5
|
+
readonly connectionId: string;
|
|
6
|
+
readonly provider: InvoiceCustomFieldSchema["provider"];
|
|
7
|
+
readonly schemaRevision: string;
|
|
8
|
+
readonly fieldId: string;
|
|
9
|
+
readonly value: InvoiceCustomFieldValue;
|
|
10
|
+
}
|
|
11
|
+
export interface InvoiceCustomField<T extends string | boolean> {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
get(snapshot: InvoiceCustomFieldValues): T | null | undefined;
|
|
14
|
+
set(value: T): InvoiceCustomFieldAssignment;
|
|
15
|
+
clear(): InvoiceCustomFieldAssignment;
|
|
16
|
+
}
|
|
17
|
+
/** Construct typed handles from a discovered schema, without using unvalidated field names. */
|
|
18
|
+
export declare const invoiceCustomField: {
|
|
19
|
+
readOnly<T extends string | boolean>({ id, get }: InvoiceCustomField<T>): {
|
|
20
|
+
id: string;
|
|
21
|
+
get: (snapshot: InvoiceCustomFieldValues) => T | null | undefined;
|
|
22
|
+
};
|
|
23
|
+
withoutClear<T extends string | boolean>({ id, get, set }: InvoiceCustomField<T>): {
|
|
24
|
+
id: string;
|
|
25
|
+
get: (snapshot: InvoiceCustomFieldValues) => T | null | undefined;
|
|
26
|
+
set: (value: T) => InvoiceCustomFieldAssignment;
|
|
27
|
+
};
|
|
28
|
+
text: (schema: InvoiceCustomFieldSchema, id: string) => InvoiceCustomField<string>;
|
|
29
|
+
boolean: (schema: InvoiceCustomFieldSchema, id: string) => InvoiceCustomField<boolean>;
|
|
30
|
+
decimal: (schema: InvoiceCustomFieldSchema, id: string) => InvoiceCustomField<string>;
|
|
31
|
+
date: (schema: InvoiceCustomFieldSchema, id: string) => InvoiceCustomField<string>;
|
|
32
|
+
select<const T extends string>(schema: InvoiceCustomFieldSchema, id: string, options: readonly T[]): InvoiceCustomField<T>;
|
|
33
|
+
};
|
|
34
|
+
/** Render a TypeScript module. Review and save the result in your application, then import its fields. */
|
|
35
|
+
export declare function generateInvoiceCustomFields(schema: InvoiceCustomFieldSchema): string;
|
|
36
|
+
export declare function stageInvoiceCustomFields(connectionId: string, invoiceId: string, current: InvoiceCustomFieldValues, assignments: readonly InvoiceCustomFieldAssignment[]): {
|
|
37
|
+
schemaRevision: string;
|
|
38
|
+
revision: string;
|
|
39
|
+
values: {
|
|
40
|
+
[k: string]: InvoiceCustomFieldValue;
|
|
41
|
+
};
|
|
42
|
+
};
|