@rowbind/sdk 0.1.0-canary.104 → 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 +1 -1
package/README.md
CHANGED
|
@@ -108,6 +108,52 @@ console.log(factura.id, factura.customerId, factura.lines[0].itemId, factura.tot
|
|
|
108
108
|
|
|
109
109
|
Al crear el primer vínculo, un ID inexistente para ese tipo de registro y libro devuelve `404 catalog_record_not_found`. Repetir el vínculo con el mismo ID es seguro. Si ya apuntaba a otro registro, recibes `409 catalog_link_conflict`. Una factura con una referencia sin vincular devuelve `422 mapping_not_found`. En el sandbox simulado hay candidatos para las dos búsquedas anteriores. En un libro inscrito el conector descubre automáticamente los clientes y artículos. Para localizar un alta del contable, usa su SKU como `query` y muestra `displayName`, `sku` y `nativeId` para confirmar la elección. La búsqueda devuelve el último barrido completo. Hasta que termina el primero, responde con `409 catalog_unavailable`. [Ejemplo Bun con los comandos search, link e invoice](examples/catalog-invoice.mts) · [Catálogo del piloto](../../apps/api/pilot/README.md#catálogo-para-facturar-con-referencias-del-saas)
|
|
110
110
|
|
|
111
|
+
## Recuperar una factura por su ID nativo
|
|
112
|
+
|
|
113
|
+
Usa una clave con `invoices:read` y el `connectionId` del libro. Pasa el ID nativo de la factura, como el `id` del recibo verificado. La lectura consulta el estado actual del libro y funciona sin activar Managed Sync.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const current = await rb.invoices.retrieve(connectionId, factura.id)
|
|
117
|
+
console.log(current.id, current.balanceDue, current.observedAt)
|
|
118
|
+
if (current.provider === "quickbooksDesktop") {
|
|
119
|
+
console.log(current.classId, current.termsId)
|
|
120
|
+
} else {
|
|
121
|
+
console.log(current.subsidiaryId, current.departmentId)
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
La clase, los términos y el departamento se incluyen cuando el ERP los devuelve. El sandbox lee su libro simulado. El piloto aislado puede leer el ERP configurado. [Configurar el piloto](pilot/README.md)
|
|
126
|
+
|
|
127
|
+
## Usar los campos personalizados de una factura
|
|
128
|
+
|
|
129
|
+
Descubre las definiciones visibles en el libro con `custom-fields:read`. Guarda el módulo TypeScript en tu backend cuando conectes el libro o cambie su esquema. Conserva los IDs nativos y el tipo de cada campo, sin incluir credenciales ni valores de facturas.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
import { writeFile } from "node:fs/promises"
|
|
133
|
+
import { generateInvoiceCustomFields } from "@rowbind/sdk"
|
|
134
|
+
|
|
135
|
+
const schema = await rb.invoices.customFields.discover(connectionId)
|
|
136
|
+
await writeFile("rowbind-fields.ts", generateInvoiceCustomFields(schema))
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Con una factura ya emitida en el libro QuickBooks de ensayo y una clave que además tenga `custom-fields:write`, lee su revisión y actualiza el campo `DispatchRoute` que aparece en ese libro.
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import { fields } from "./rowbind-fields.js"
|
|
143
|
+
|
|
144
|
+
const custom = rb.invoices.customFields
|
|
145
|
+
const current = await custom.read(connectionId, factura.id)
|
|
146
|
+
console.log(fields.DispatchRoute.get(current))
|
|
147
|
+
const updated = await custom.update(connectionId, factura.id, {
|
|
148
|
+
current,
|
|
149
|
+
assignments: [fields.DispatchRoute.set("North")],
|
|
150
|
+
idempotencyKey: updateId,
|
|
151
|
+
})
|
|
152
|
+
console.log(fields.DispatchRoute.get(updated))
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
El módulo generado permite escribir cada campo con su tipo. Un `select` usa los IDs literales elegibles en ese libro. Los campos de solo lectura ofrecen `get` y `clear` aparece únicamente cuando el campo se puede editar y admite nulos. Las fechas se escriben como `YYYY-MM-DD` y los decimales como texto exacto. Las definiciones se crean y administran en el ERP. Si cambia el esquema, redescubre, regenera y revisa la actualización. Si construyes un formulario a partir del schema en ejecución, `updateValues` acepta el mapa por ID nativo con sus dos revisiones y la clave de idempotencia. El servidor valida todos los cambios. Reutiliza la misma clave y solicitud cuando se pierda la respuesta. [Piloto ERP](pilot/README.md)
|
|
156
|
+
|
|
111
157
|
## Leer la factura en el formato nativo
|
|
112
158
|
|
|
113
159
|
Con una clave que tenga `raw:read`, usa el libro y el ID nativo de la factura del ejemplo anterior. El sandbox admite una consulta qbXML `InvoiceQueryRq` por `TxnID` y un `GET` de SuiteTalk REST Record por ID de factura. El servidor comprueba el proyecto, el entorno y el proveedor de la conexión. El resultado conserva el XML de QuickBooks o el registro JSON de NetSuite y el SDK añade el `requestId` de la respuesta HTTP cuando está disponible.
|
|
@@ -134,6 +180,8 @@ En TypeScript, pasar el `book.id` de la rama NetSuite a `quickbooksDesktop.raw.r
|
|
|
134
180
|
|
|
135
181
|
## Consultar datos que no tienen método en el SDK
|
|
136
182
|
|
|
183
|
+
En QuickBooks Desktop, `raw.query` recibe **XML como texto**, en la propiedad `qbxml`. Si llamas por REST, el JSON de `POST /v1/connections/{id}/raw/query` es, por ejemplo, `{"provider":"quickbooksDesktop","qbxml":"<VendorQueryRq><ListID>V-01</ListID></VendorQueryRq>"}`. La respuesta devuelve `qbxml` como texto y el SDK recoge el `requestId` HTTP. `raw.read` tiene su propio contrato de lectura por `TxnID`. En NetSuite, `raw.suiteql` recibe un `SELECT` en `q` con `limit` y `offset` opcionales y devuelve una página JSON.
|
|
184
|
+
|
|
137
185
|
Un SaaS de reparto quiere importar los clientes con su ruta de entrega. En el libro NetSuite de ejemplo, la ruta está en un campo personalizado de cliente. El developer escribe los nombres que publica el Records Catalog de esa cuenta y rol.
|
|
138
186
|
|
|
139
187
|
```ts
|
|
@@ -179,7 +227,44 @@ bun node_modules/@rowbind/sdk/examples/native-query.mts "$CONNECTION_ID"
|
|
|
179
227
|
bun node_modules/@rowbind/sdk/examples/native-query.mts "$QUICKBOOKS_CONNECTION_ID" "North Supply"
|
|
180
228
|
```
|
|
181
229
|
|
|
182
|
-
|
|
230
|
+
Los libros simulados de QuickBooks reproducen `VendorQueryRq` con `FullName` y `DataExtDefQueryRq` con `OwnerID=0`. Las demás lecturas pueden devolver `sandbox_query_not_simulated`. En el piloto QBWC, un libro inscrito con permiso de consultas admite un solo fragmento `*QueryRq` de hasta 4.096 caracteres sin atributos de iterador, incluido `VendorQueryRq` por `ListID` y `GeneralSummaryReportQueryRq` para un informe. La respuesta conserva el XML de QuickBooks y su estado por mensaje. La espera del piloto es de hasta diez segundos y, si vence, la API devuelve `upstream_unavailable`. El ensayo del piloto QBWC usa respuestas sintéticas. [Piloto QBWC y prueba](../../apps/api/pilot/README.md#consultas-raw-en-el-piloto-qbwc)
|
|
231
|
+
|
|
232
|
+
## Editar un proveedor de prueba y recuperar el resultado
|
|
233
|
+
|
|
234
|
+
El piloto de escritura QBWC admite un `VendorModRq` que cambia `AccountNumber`. Necesitas una clave `raw:write` y un libro de sandbox inscrito para ese proveedor ficticio. Sustituye `V-01` y `10` por su `ListID` y `EditSequence` actuales.
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
if (book.provider === "quickbooksDesktop") {
|
|
238
|
+
const raw = rowbind.quickbooksDesktop.raw
|
|
239
|
+
const { id } = await raw.write({
|
|
240
|
+
connectionId: book.id,
|
|
241
|
+
idempotencyKey: "vendor-account-change-001",
|
|
242
|
+
qbxml: "<VendorModRq><VendorMod><ListID>V-01</ListID><EditSequence>10</EditSequence><AccountNumber>EJEMPLO-02</AccountNumber></VendorMod></VendorModRq>",
|
|
243
|
+
})
|
|
244
|
+
const result = await raw.writeResult({ connectionId: book.id, operationId: id })
|
|
245
|
+
if (result.status === "verified") console.log(result.record.accountNumber, result.record.qbxml)
|
|
246
|
+
else console.log(id, result.status, result.diagnosis)
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Guarda el ID y el `connectionId` juntos. `writeResult` recupera el estado mediante `GET`, incluso desde otro proceso. `effect_unconfirmed` indica que el efecto sigue pendiente de comprobación. Si perdiste la respuesta del POST, repite la admisión con la misma clave y el mismo XML para recuperar el mismo ID.
|
|
251
|
+
|
|
252
|
+
En el simulador de NetSuite, puedes elegir columnas, filtrar y paginar la tabla `customer` de ejemplo. Para continuar con SuiteQL, usa un orden estable y aumenta `offset` en `limit` mientras `page.hasMore` sea verdadero. El piloto independiente envía el `SELECT` a SuiteTalk. [Configurar el piloto y sus permisos](pilot/README.md) · [SuiteQL sobre REST](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157909186990.html)
|
|
253
|
+
|
|
254
|
+
## Leer un proveedor, una factura y un informe de QuickBooks Desktop
|
|
255
|
+
|
|
256
|
+
Usa el `connectionId` autorizado para consultas nativas e inscrito en el piloto QBWC. Las lecturas de proveedor y factura devuelven sus revisiones actuales. El balance de comprobación devuelve columnas, filas y celdas con los valores nativos en texto.
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
const qbd = rowbind.quickbooksDesktop
|
|
260
|
+
const vendor = await qbd.vendors.retrieve({ connectionId, listId: "V-01" })
|
|
261
|
+
const invoice = await qbd.invoices.retrieve({ connectionId, txnId: "T-01" })
|
|
262
|
+
const report = await qbd.reports.trialBalance({
|
|
263
|
+
connectionId, from: "2026-11-01", to: "2026-11-30", basis: "cash",
|
|
264
|
+
})
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Para el informe, pasa ambas fechas u omite ambas para usar el periodo de QuickBooks. Las cantidades de las celdas y el saldo de la factura se conservan como texto decimal cuando QuickBooks los devuelve. [Acceso y prueba del piloto](../../apps/api/pilot/README.md#lecturas-tipadas-de-quickbooks-desktop)
|
|
183
268
|
|
|
184
269
|
## Comprobar la salud de la conexión
|
|
185
270
|
|
|
@@ -536,3 +621,18 @@ Orval genera las operaciones HTTP, sus modelos TypeScript y sus validadores Zod
|
|
|
536
621
|
El SDK tipa los destinos y las respuestas por operación. Al recibir los inputs comprueba campos y formatos con esquemas estrictos, incluso si llegan de JavaScript. En la demo embebida, el libro SQLite valida mappings, stock y cantidades y guarda efectos y recibo en una misma transacción. Las claves de idempotencia se conservan mientras exista ese fichero. En el quickstart HTTP, el Worker guarda el documento simulado en D1 y `waitForVerifiedRecord` recupera el registro verificado por su ID de operación.
|
|
537
622
|
|
|
538
623
|
En el piloto de acceso a ERP, el servidor Node guarda la intención y el resultado en SQLite y el conector relee la factura del ERP antes de devolver `verified`. El piloto incluye SuiteTalk REST para NetSuite y un banco Windows para QuickBooks. La aceptación con cuentas y libros reales y el transporte alojado de Web Connector están pendientes. [Accesos y criterios de aceptación](pilot/README.md) · [Diseño de REST y SDK](../../docs/strategy/rest-y-sdk.md)
|
|
624
|
+
|
|
625
|
+
## Consultar stock por conexión
|
|
626
|
+
|
|
627
|
+
Crea la conexión de sandbox con `allowNativeQueries: true` y usa una clave con `inventory:read`. Obtén `itemId` del catálogo de ese libro. El stock está en la unidad `unit` y `onHand` conserva un decimal exacto como texto.
|
|
628
|
+
|
|
629
|
+
```typescript
|
|
630
|
+
const stock = await rowbind.inventory.levels.list(connectionId, { itemId })
|
|
631
|
+
if (stock.granularity === "site") {
|
|
632
|
+
console.log(stock.levels.map(({ siteId, onHand }) => ({ siteId, onHand })))
|
|
633
|
+
} else {
|
|
634
|
+
console.log(stock.onHand)
|
|
635
|
+
}
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
La muestra de QuickBooks Desktop separa el stock de Material entre dos almacenes. La muestra NetSuite devuelve el total de Material para el libro. Para exigir un almacén concreto, pasa `siteId`. Un libro que solo observa el total devuelve `capability_unavailable`. El resultado indica `source: "sandbox"` y `observedAt`. `onHand` expresa existencia física y la respuesta solo incluye cantidades verificadas para esa granularidad.
|
package/dist/generated/http.d.ts
CHANGED
|
@@ -126,6 +126,104 @@ export type RawQueryResult = {
|
|
|
126
126
|
provider: 'netsuite';
|
|
127
127
|
page: SuiteQLPage;
|
|
128
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* @minLength 1
|
|
131
|
+
* @maxLength 36
|
|
132
|
+
*/
|
|
133
|
+
export type QuickBooksNativeId = string;
|
|
134
|
+
export interface QuickBooksVendor {
|
|
135
|
+
listId: string;
|
|
136
|
+
name: string;
|
|
137
|
+
editSequence: string;
|
|
138
|
+
/** @nullable */
|
|
139
|
+
accountNumber: string | null;
|
|
140
|
+
}
|
|
141
|
+
export interface QuickBooksInvoiceDetails {
|
|
142
|
+
txnId: string;
|
|
143
|
+
editSequence: string;
|
|
144
|
+
/** @nullable */
|
|
145
|
+
reference: string | null;
|
|
146
|
+
transactionDate: string;
|
|
147
|
+
/** @nullable */
|
|
148
|
+
classId: string | null;
|
|
149
|
+
/** @nullable */
|
|
150
|
+
termsId: string | null;
|
|
151
|
+
/** @nullable */
|
|
152
|
+
balanceDue: string | null;
|
|
153
|
+
}
|
|
154
|
+
export interface QuickBooksTrialBalanceColumn {
|
|
155
|
+
id: string;
|
|
156
|
+
type: string;
|
|
157
|
+
titles: string[];
|
|
158
|
+
}
|
|
159
|
+
export interface QuickBooksTrialBalanceCell {
|
|
160
|
+
columnId: string;
|
|
161
|
+
/** @nullable */
|
|
162
|
+
value: string | null;
|
|
163
|
+
}
|
|
164
|
+
export type QuickBooksTrialBalanceRowKind = typeof QuickBooksTrialBalanceRowKind[keyof typeof QuickBooksTrialBalanceRowKind];
|
|
165
|
+
export declare const QuickBooksTrialBalanceRowKind: {
|
|
166
|
+
readonly DataRow: "DataRow";
|
|
167
|
+
readonly TextRow: "TextRow";
|
|
168
|
+
readonly SubtotalRow: "SubtotalRow";
|
|
169
|
+
readonly TotalRow: "TotalRow";
|
|
170
|
+
};
|
|
171
|
+
export interface QuickBooksTrialBalanceRow {
|
|
172
|
+
/** @minimum 1 */
|
|
173
|
+
number: number;
|
|
174
|
+
kind: QuickBooksTrialBalanceRowKind;
|
|
175
|
+
/** @nullable */
|
|
176
|
+
label: string | null;
|
|
177
|
+
cells: QuickBooksTrialBalanceCell[];
|
|
178
|
+
}
|
|
179
|
+
export interface QuickBooksTrialBalance {
|
|
180
|
+
title: string;
|
|
181
|
+
/** @nullable */
|
|
182
|
+
basis: string | null;
|
|
183
|
+
columns: QuickBooksTrialBalanceColumn[];
|
|
184
|
+
rows: QuickBooksTrialBalanceRow[];
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @pattern ^rawop_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
|
|
188
|
+
*/
|
|
189
|
+
export type RawWriteOperationId = string;
|
|
190
|
+
export interface RawWriteAdmission {
|
|
191
|
+
id: RawWriteOperationId;
|
|
192
|
+
}
|
|
193
|
+
export interface RawWriteRecord {
|
|
194
|
+
/** @minLength 1 */
|
|
195
|
+
listId: string;
|
|
196
|
+
/** @minLength 1 */
|
|
197
|
+
editSequence: string;
|
|
198
|
+
/** @minLength 1 */
|
|
199
|
+
accountNumber: string;
|
|
200
|
+
/**
|
|
201
|
+
* @minLength 1
|
|
202
|
+
* @maxLength 1048576
|
|
203
|
+
*/
|
|
204
|
+
qbxml: string;
|
|
205
|
+
}
|
|
206
|
+
export type RawWriteOperation = {
|
|
207
|
+
id: RawWriteOperationId;
|
|
208
|
+
status: 'pending';
|
|
209
|
+
diagnosis: 'awaiting_preflight' | 'awaiting_verification' | 'effect_unconfirmed';
|
|
210
|
+
/** @pattern ^[0-9]+$ */
|
|
211
|
+
nativeStatusCode?: string;
|
|
212
|
+
} | {
|
|
213
|
+
id: RawWriteOperationId;
|
|
214
|
+
status: 'rejected';
|
|
215
|
+
diagnosis: 'edit_sequence_mismatch' | 'value_already_set' | 'native_rejected';
|
|
216
|
+
/** @pattern ^[0-9]+$ */
|
|
217
|
+
nativeStatusCode?: string;
|
|
218
|
+
} | {
|
|
219
|
+
id: RawWriteOperationId;
|
|
220
|
+
status: 'verified';
|
|
221
|
+
/** @nullable */
|
|
222
|
+
diagnosis: null;
|
|
223
|
+
record: RawWriteRecord;
|
|
224
|
+
/** @pattern ^[0-9]+$ */
|
|
225
|
+
nativeStatusCode?: string;
|
|
226
|
+
};
|
|
129
227
|
export type RawReadRequest = {
|
|
130
228
|
provider: 'quickbooksDesktop';
|
|
131
229
|
/**
|
|
@@ -673,6 +771,185 @@ export interface InvoiceRecoveryPage {
|
|
|
673
771
|
*/
|
|
674
772
|
nextCursor: number | null;
|
|
675
773
|
}
|
|
774
|
+
export type InvoiceCustomFieldSchemaProvider = typeof InvoiceCustomFieldSchemaProvider[keyof typeof InvoiceCustomFieldSchemaProvider];
|
|
775
|
+
export declare const InvoiceCustomFieldSchemaProvider: {
|
|
776
|
+
readonly quickbooksDesktop: "quickbooksDesktop";
|
|
777
|
+
readonly netsuite: "netsuite";
|
|
778
|
+
};
|
|
779
|
+
export type InvoiceCustomFieldDefinitionType = typeof InvoiceCustomFieldDefinitionType[keyof typeof InvoiceCustomFieldDefinitionType];
|
|
780
|
+
export declare const InvoiceCustomFieldDefinitionType: {
|
|
781
|
+
readonly text: "text";
|
|
782
|
+
readonly boolean: "boolean";
|
|
783
|
+
readonly decimal: "decimal";
|
|
784
|
+
readonly date: "date";
|
|
785
|
+
readonly select: "select";
|
|
786
|
+
};
|
|
787
|
+
export interface InvoiceCustomFieldOption {
|
|
788
|
+
/** @minLength 1 */
|
|
789
|
+
id: string;
|
|
790
|
+
/** @minLength 1 */
|
|
791
|
+
label: string;
|
|
792
|
+
}
|
|
793
|
+
export interface InvoiceCustomFieldDefinition {
|
|
794
|
+
/** @minLength 1 */
|
|
795
|
+
id: string;
|
|
796
|
+
/** @minLength 1 */
|
|
797
|
+
label: string;
|
|
798
|
+
type: InvoiceCustomFieldDefinitionType;
|
|
799
|
+
writable: boolean;
|
|
800
|
+
nullable: boolean;
|
|
801
|
+
options?: InvoiceCustomFieldOption[];
|
|
802
|
+
/** @minimum 1 */
|
|
803
|
+
maxLength?: number;
|
|
804
|
+
}
|
|
805
|
+
export interface InvoiceCustomFieldSchema {
|
|
806
|
+
/** @minLength 1 */
|
|
807
|
+
connectionId: string;
|
|
808
|
+
provider: InvoiceCustomFieldSchemaProvider;
|
|
809
|
+
/** @minLength 1 */
|
|
810
|
+
revision: string;
|
|
811
|
+
fields: InvoiceCustomFieldDefinition[];
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Values use native field IDs. Text, dates, exact decimals and select IDs are strings. Null clears a nullable field.
|
|
815
|
+
*/
|
|
816
|
+
export type InvoiceCustomFieldValue = string | null | boolean;
|
|
817
|
+
export type InvoiceCustomFieldValuesProvider = typeof InvoiceCustomFieldValuesProvider[keyof typeof InvoiceCustomFieldValuesProvider];
|
|
818
|
+
export declare const InvoiceCustomFieldValuesProvider: {
|
|
819
|
+
readonly quickbooksDesktop: "quickbooksDesktop";
|
|
820
|
+
readonly netsuite: "netsuite";
|
|
821
|
+
};
|
|
822
|
+
export type InvoiceCustomFieldValuesValues = {
|
|
823
|
+
[key: string]: InvoiceCustomFieldValue | null;
|
|
824
|
+
};
|
|
825
|
+
export interface InvoiceCustomFieldValues {
|
|
826
|
+
/** @minLength 1 */
|
|
827
|
+
connectionId: string;
|
|
828
|
+
provider: InvoiceCustomFieldValuesProvider;
|
|
829
|
+
/** @minLength 1 */
|
|
830
|
+
invoiceId: string;
|
|
831
|
+
/** @minLength 1 */
|
|
832
|
+
schemaRevision: string;
|
|
833
|
+
/** @minLength 1 */
|
|
834
|
+
revision: string;
|
|
835
|
+
values: InvoiceCustomFieldValuesValues;
|
|
836
|
+
}
|
|
837
|
+
export type InvoiceCustomFieldUpdateValues = {
|
|
838
|
+
[key: string]: InvoiceCustomFieldValue | null;
|
|
839
|
+
};
|
|
840
|
+
export interface InvoiceCustomFieldUpdate {
|
|
841
|
+
/** @minLength 1 */
|
|
842
|
+
schemaRevision: string;
|
|
843
|
+
/** @minLength 1 */
|
|
844
|
+
revision: string;
|
|
845
|
+
values: InvoiceCustomFieldUpdateValues;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* @minLength 1
|
|
849
|
+
* @maxLength 255
|
|
850
|
+
* @pattern ^(?!\.{1,2}$)(?!\s)(?!.*\s$)[^\u0000-\u001f\u007f]+$
|
|
851
|
+
*/
|
|
852
|
+
export type InventoryNativeId = string;
|
|
853
|
+
/**
|
|
854
|
+
* Physical on-hand quantity as a decimal string in the source unit. Negative stock is permitted where the source reports it.
|
|
855
|
+
* @pattern ^-?(0|[1-9][0-9]*)(\.[0-9]+)?$
|
|
856
|
+
*/
|
|
857
|
+
export type InventoryOnHand = string;
|
|
858
|
+
export type InventoryObservationProvider = typeof InventoryObservationProvider[keyof typeof InventoryObservationProvider];
|
|
859
|
+
export declare const InventoryObservationProvider: {
|
|
860
|
+
readonly quickbooksDesktop: "quickbooksDesktop";
|
|
861
|
+
readonly netsuite: "netsuite";
|
|
862
|
+
};
|
|
863
|
+
export type InventoryObservationSource = typeof InventoryObservationSource[keyof typeof InventoryObservationSource];
|
|
864
|
+
export declare const InventoryObservationSource: {
|
|
865
|
+
readonly sandbox: "sandbox";
|
|
866
|
+
readonly erp: "erp";
|
|
867
|
+
};
|
|
868
|
+
export interface InventoryObservation {
|
|
869
|
+
connectionId: InventoryNativeId;
|
|
870
|
+
provider: InventoryObservationProvider;
|
|
871
|
+
itemId: InventoryNativeId;
|
|
872
|
+
source: InventoryObservationSource;
|
|
873
|
+
/**
|
|
874
|
+
* Native stocking unit reported for this item. Do not compare quantities in different units without conversion evidence.
|
|
875
|
+
* @minLength 1
|
|
876
|
+
*/
|
|
877
|
+
unit: string;
|
|
878
|
+
observedAt: string;
|
|
879
|
+
}
|
|
880
|
+
export type InventoryBookLevelsGranularity = typeof InventoryBookLevelsGranularity[keyof typeof InventoryBookLevelsGranularity];
|
|
881
|
+
export declare const InventoryBookLevelsGranularity: {
|
|
882
|
+
readonly book: "book";
|
|
883
|
+
};
|
|
884
|
+
export type InventoryBookLevels = InventoryObservation & {
|
|
885
|
+
granularity: InventoryBookLevelsGranularity;
|
|
886
|
+
onHand: InventoryOnHand;
|
|
887
|
+
};
|
|
888
|
+
export interface InventorySiteLevel {
|
|
889
|
+
siteId: InventoryNativeId;
|
|
890
|
+
onHand: InventoryOnHand;
|
|
891
|
+
}
|
|
892
|
+
export type InventorySiteLevelsGranularity = typeof InventorySiteLevelsGranularity[keyof typeof InventorySiteLevelsGranularity];
|
|
893
|
+
export declare const InventorySiteLevelsGranularity: {
|
|
894
|
+
readonly site: "site";
|
|
895
|
+
};
|
|
896
|
+
export type InventorySiteLevels = InventoryObservation & {
|
|
897
|
+
granularity: InventorySiteLevelsGranularity;
|
|
898
|
+
/** @minItems 1 */
|
|
899
|
+
levels: InventorySiteLevel[];
|
|
900
|
+
};
|
|
901
|
+
export type InventoryLevels = InventoryBookLevels | InventorySiteLevels;
|
|
902
|
+
export interface RetrievedInvoiceFields {
|
|
903
|
+
/** @minLength 1 */
|
|
904
|
+
id: string;
|
|
905
|
+
/** @minLength 1 */
|
|
906
|
+
connectionId: string;
|
|
907
|
+
/** @minLength 1 */
|
|
908
|
+
customerId: string;
|
|
909
|
+
/**
|
|
910
|
+
* Business reference when present in the source.
|
|
911
|
+
* @minLength 1
|
|
912
|
+
*/
|
|
913
|
+
externalReference?: string;
|
|
914
|
+
transactionDate?: string;
|
|
915
|
+
/** @pattern ^[A-Z]{3}$ */
|
|
916
|
+
currency: string;
|
|
917
|
+
lines: InvoiceLineRecord[];
|
|
918
|
+
/** @pattern ^-?(0|[1-9][0-9]*)\.[0-9]{2}$ */
|
|
919
|
+
total: string;
|
|
920
|
+
/** @pattern ^-?(0|[1-9][0-9]*)\.[0-9]{2}$ */
|
|
921
|
+
balanceDue: string;
|
|
922
|
+
/** When Rowbind observed this read from the book. */
|
|
923
|
+
observedAt: string;
|
|
924
|
+
}
|
|
925
|
+
export type RetrievedQuickBooksInvoiceProvider = typeof RetrievedQuickBooksInvoiceProvider[keyof typeof RetrievedQuickBooksInvoiceProvider];
|
|
926
|
+
export declare const RetrievedQuickBooksInvoiceProvider: {
|
|
927
|
+
readonly quickbooksDesktop: "quickbooksDesktop";
|
|
928
|
+
};
|
|
929
|
+
export type RetrievedQuickBooksInvoice = RetrievedInvoiceFields & {
|
|
930
|
+
provider: RetrievedQuickBooksInvoiceProvider;
|
|
931
|
+
/**
|
|
932
|
+
* ListID of the QuickBooks invoice header class when returned.
|
|
933
|
+
* @minLength 1
|
|
934
|
+
*/
|
|
935
|
+
classId?: string;
|
|
936
|
+
/**
|
|
937
|
+
* ListID of the QuickBooks invoice terms when returned.
|
|
938
|
+
* @minLength 1
|
|
939
|
+
*/
|
|
940
|
+
termsId?: string;
|
|
941
|
+
};
|
|
942
|
+
export type RetrievedNetSuiteInvoiceProvider = typeof RetrievedNetSuiteInvoiceProvider[keyof typeof RetrievedNetSuiteInvoiceProvider];
|
|
943
|
+
export declare const RetrievedNetSuiteInvoiceProvider: {
|
|
944
|
+
readonly netsuite: "netsuite";
|
|
945
|
+
};
|
|
946
|
+
export type RetrievedNetSuiteInvoice = RetrievedInvoiceFields & {
|
|
947
|
+
provider: RetrievedNetSuiteInvoiceProvider;
|
|
948
|
+
/** @minLength 1 */
|
|
949
|
+
subsidiaryId: string;
|
|
950
|
+
departmentId?: NetSuiteDepartmentId;
|
|
951
|
+
};
|
|
952
|
+
export type RetrievedInvoice = RetrievedQuickBooksInvoice | RetrievedNetSuiteInvoice;
|
|
676
953
|
export type ReimbursementBillInputKind = typeof ReimbursementBillInputKind[keyof typeof ReimbursementBillInputKind];
|
|
677
954
|
export declare const ReimbursementBillInputKind: {
|
|
678
955
|
readonly vendor_bill: "vendor_bill";
|
|
@@ -1444,6 +1721,10 @@ export type InsufficientScopeResponse = PilotError;
|
|
|
1444
1721
|
* connection_not_found — book is not provisioned for this project
|
|
1445
1722
|
*/
|
|
1446
1723
|
export type ConnectionNotFoundResponse = PilotError;
|
|
1724
|
+
/**
|
|
1725
|
+
* Invalid, inaccessible, unconfirmed, or unavailable native QuickBooks Desktop data.
|
|
1726
|
+
*/
|
|
1727
|
+
export type QuickBooksDataErrorResponse = PilotError;
|
|
1447
1728
|
/**
|
|
1448
1729
|
* core_storage_unavailable — Rowbind could not confirm the result. Preserve the original operation ID or idempotency key.
|
|
1449
1730
|
*/
|
|
@@ -1465,6 +1746,35 @@ export type SearchCatalogParams = {
|
|
|
1465
1746
|
*/
|
|
1466
1747
|
after?: string;
|
|
1467
1748
|
};
|
|
1749
|
+
export type ListInventoryLevelsParams = {
|
|
1750
|
+
itemId: InventoryNativeId;
|
|
1751
|
+
/** Require an observation for this site in the same book. */
|
|
1752
|
+
siteId?: InventoryNativeId;
|
|
1753
|
+
};
|
|
1754
|
+
export type GetQuickBooksTrialBalanceParams = {
|
|
1755
|
+
from?: string;
|
|
1756
|
+
to?: string;
|
|
1757
|
+
basis?: GetQuickBooksTrialBalanceBasis;
|
|
1758
|
+
};
|
|
1759
|
+
export type GetQuickBooksTrialBalanceBasis = typeof GetQuickBooksTrialBalanceBasis[keyof typeof GetQuickBooksTrialBalanceBasis];
|
|
1760
|
+
export declare const GetQuickBooksTrialBalanceBasis: {
|
|
1761
|
+
readonly accrual: "accrual";
|
|
1762
|
+
readonly cash: "cash";
|
|
1763
|
+
};
|
|
1764
|
+
export type AdmitRawWriteHeaders = {
|
|
1765
|
+
/**
|
|
1766
|
+
* @minLength 1
|
|
1767
|
+
* @maxLength 255
|
|
1768
|
+
*/
|
|
1769
|
+
'Idempotency-Key': string;
|
|
1770
|
+
};
|
|
1771
|
+
export type AdmitRawWriteBody = {
|
|
1772
|
+
/**
|
|
1773
|
+
* @minLength 1
|
|
1774
|
+
* @maxLength 4096
|
|
1775
|
+
*/
|
|
1776
|
+
qbxml: string;
|
|
1777
|
+
};
|
|
1468
1778
|
export type CreateReceivedPaymentHeaders = {
|
|
1469
1779
|
/**
|
|
1470
1780
|
* @minLength 1
|
|
@@ -1511,6 +1821,14 @@ export type ListSyncedInvoicesParams = {
|
|
|
1511
1821
|
*/
|
|
1512
1822
|
limit?: number;
|
|
1513
1823
|
};
|
|
1824
|
+
export type UpdateInvoiceCustomFieldsHeaders = {
|
|
1825
|
+
/**
|
|
1826
|
+
* @minLength 1
|
|
1827
|
+
* @maxLength 255
|
|
1828
|
+
* @pattern \S
|
|
1829
|
+
*/
|
|
1830
|
+
'Idempotency-Key': string;
|
|
1831
|
+
};
|
|
1514
1832
|
export type ListObservedPaymentsParams = {
|
|
1515
1833
|
status?: ObservedPaymentStatus;
|
|
1516
1834
|
/**
|
|
@@ -1575,18 +1893,54 @@ export declare const getLinkCatalogUrl: (id: string, kind: "customer" | "item")
|
|
|
1575
1893
|
* @summary Link a SaaS reference to a native customer or item
|
|
1576
1894
|
*/
|
|
1577
1895
|
export declare const linkCatalog: (id: string, kind: "customer" | "item", catalogLinkRequest: CatalogLinkRequest, options?: Parameters<typeof sendToRowbind>[1]) => Promise<CatalogLink>;
|
|
1896
|
+
export declare const getListInventoryLevelsUrl: (id: InventoryNativeId, params: ListInventoryLevelsParams) => string;
|
|
1897
|
+
/**
|
|
1898
|
+
* 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.
|
|
1899
|
+
* @summary Read the observed stock levels for one native item
|
|
1900
|
+
*/
|
|
1901
|
+
export declare const listInventoryLevels: (id: InventoryNativeId, params: ListInventoryLevelsParams, options?: Parameters<typeof sendToRowbind>[1]) => Promise<InventoryLevels>;
|
|
1578
1902
|
export declare const getQueryRawUrl: (id: string) => string;
|
|
1579
1903
|
/**
|
|
1580
|
-
* Requires raw:query.
|
|
1904
|
+
* 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.
|
|
1581
1905
|
* @summary Query an authorized book in its native language
|
|
1582
1906
|
*/
|
|
1583
1907
|
export declare const queryRaw: (id: string, rawQueryRequest: RawQueryRequest, options?: Parameters<typeof sendToRowbind>[1]) => Promise<RawQueryResult>;
|
|
1584
1908
|
export declare const getReadRawUrl: (id: string) => string;
|
|
1585
1909
|
/**
|
|
1586
|
-
* Requires raw:read.
|
|
1910
|
+
* 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.
|
|
1587
1911
|
* @summary Read a native invoice from a consenting sandbox book
|
|
1588
1912
|
*/
|
|
1589
1913
|
export declare const readRaw: (id: string, rawReadRequest: RawReadRequest, options?: Parameters<typeof sendToRowbind>[1]) => Promise<RawReadResult>;
|
|
1914
|
+
export declare const getRetrieveQuickBooksVendorUrl: (id: string, listId: QuickBooksNativeId) => string;
|
|
1915
|
+
/**
|
|
1916
|
+
* Requires raw:query, native-query consent, and an enrolled QuickBooks Desktop pilot connector. Returns the current name, revision, and account number.
|
|
1917
|
+
* @summary Read a native QuickBooks Desktop vendor by ListID
|
|
1918
|
+
*/
|
|
1919
|
+
export declare const retrieveQuickBooksVendor: (id: string, listId: QuickBooksNativeId, options?: Parameters<typeof sendToRowbind>[1]) => Promise<QuickBooksVendor>;
|
|
1920
|
+
export declare const getRetrieveQuickBooksInvoiceUrl: (id: string, txnId: QuickBooksNativeId) => string;
|
|
1921
|
+
/**
|
|
1922
|
+
* 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.
|
|
1923
|
+
* @summary Read native QuickBooks Desktop invoice details by TxnID
|
|
1924
|
+
*/
|
|
1925
|
+
export declare const retrieveQuickBooksInvoice: (id: string, txnId: QuickBooksNativeId, options?: Parameters<typeof sendToRowbind>[1]) => Promise<QuickBooksInvoiceDetails>;
|
|
1926
|
+
export declare const getGetQuickBooksTrialBalanceUrl: (id: string, params?: GetQuickBooksTrialBalanceParams) => string;
|
|
1927
|
+
/**
|
|
1928
|
+
* 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.
|
|
1929
|
+
* @summary Read a native QuickBooks Desktop trial balance
|
|
1930
|
+
*/
|
|
1931
|
+
export declare const getQuickBooksTrialBalance: (id: string, params?: GetQuickBooksTrialBalanceParams, options?: Parameters<typeof sendToRowbind>[1]) => Promise<QuickBooksTrialBalance>;
|
|
1932
|
+
export declare const getAdmitRawWriteUrl: (id: string) => string;
|
|
1933
|
+
/**
|
|
1934
|
+
* 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.
|
|
1935
|
+
* @summary Admit a native QuickBooks Desktop test vendor edit
|
|
1936
|
+
*/
|
|
1937
|
+
export declare const admitRawWrite: (id: string, admitRawWriteBody: AdmitRawWriteBody, headers: AdmitRawWriteHeaders, options?: Parameters<typeof sendToRowbind>[1]) => Promise<RawWriteAdmission>;
|
|
1938
|
+
export declare const getRetrieveRawWriteUrl: (id: string, operationId: RawWriteOperationId) => string;
|
|
1939
|
+
/**
|
|
1940
|
+
* 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.
|
|
1941
|
+
* @summary Retrieve a native vendor edit outcome
|
|
1942
|
+
*/
|
|
1943
|
+
export declare const retrieveRawWrite: (id: string, operationId: RawWriteOperationId, options?: Parameters<typeof sendToRowbind>[1]) => Promise<RawWriteOperation>;
|
|
1590
1944
|
export declare const getCreateReceivedPaymentUrl: () => string;
|
|
1591
1945
|
/**
|
|
1592
1946
|
* 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.
|
|
@@ -1702,6 +2056,30 @@ export declare const getListSyncedInvoicesUrl: (id: string, params?: ListSyncedI
|
|
|
1702
2056
|
* @summary Page through invoices at a completed sync cutoff
|
|
1703
2057
|
*/
|
|
1704
2058
|
export declare const listSyncedInvoices: (id: string, params?: ListSyncedInvoicesParams, options?: Parameters<typeof sendToRowbind>[1]) => Promise<SyncedInvoicePage>;
|
|
2059
|
+
export declare const getDiscoverInvoiceCustomFieldsUrl: (id: string) => string;
|
|
2060
|
+
/**
|
|
2061
|
+
* 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.
|
|
2062
|
+
* @summary Discover the authorized invoice fields in one book
|
|
2063
|
+
*/
|
|
2064
|
+
export declare const discoverInvoiceCustomFields: (id: string, options?: Parameters<typeof sendToRowbind>[1]) => Promise<InvoiceCustomFieldSchema>;
|
|
2065
|
+
export declare const getReadInvoiceCustomFieldsUrl: (id: string, nativeId: string) => string;
|
|
2066
|
+
/**
|
|
2067
|
+
* 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.
|
|
2068
|
+
* @summary Read custom field values on one invoice
|
|
2069
|
+
*/
|
|
2070
|
+
export declare const readInvoiceCustomFields: (id: string, nativeId: string, options?: Parameters<typeof sendToRowbind>[1]) => Promise<InvoiceCustomFieldValues>;
|
|
2071
|
+
export declare const getUpdateInvoiceCustomFieldsUrl: (id: string, nativeId: string) => string;
|
|
2072
|
+
/**
|
|
2073
|
+
* 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.
|
|
2074
|
+
* @summary Update selected custom fields on one invoice
|
|
2075
|
+
*/
|
|
2076
|
+
export declare const updateInvoiceCustomFields: (id: string, nativeId: string, invoiceCustomFieldUpdate: InvoiceCustomFieldUpdate, headers: UpdateInvoiceCustomFieldsHeaders, options?: Parameters<typeof sendToRowbind>[1]) => Promise<InvoiceCustomFieldValues>;
|
|
2077
|
+
export declare const getRetrieveInvoiceUrl: (id: string, nativeId: string) => string;
|
|
2078
|
+
/**
|
|
2079
|
+
* 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.
|
|
2080
|
+
* @summary Read an invoice by its native ID in a connected book
|
|
2081
|
+
*/
|
|
2082
|
+
export declare const retrieveInvoice: (id: string, nativeId: string, options?: Parameters<typeof sendToRowbind>[1]) => Promise<RetrievedInvoice>;
|
|
1705
2083
|
export declare const getListObservedPaymentsUrl: (id: string, params?: ListObservedPaymentsParams) => string;
|
|
1706
2084
|
/**
|
|
1707
2085
|
* Requires sync:read. Use nextCursor as after for the next page. Each cursor is an observation ID from this connection.
|