@rowbind/sdk 0.0.0-stage → 0.1.0-canary.104
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 +537 -2
- package/dist/generated/catalog.d.ts +22 -0
- package/dist/generated/catalog.js +7 -0
- package/dist/generated/http.d.ts +1740 -0
- package/dist/generated/http.js +843 -0
- package/dist/generated/raw.d.ts +39 -0
- package/dist/generated/raw.js +14 -0
- package/dist/generated/validators.d.ts +1411 -0
- package/dist/generated/validators.js +993 -0
- package/dist/http-error.d.ts +5 -0
- package/dist/http-error.js +2 -0
- package/dist/http-request.d.ts +17 -0
- package/dist/http-request.js +73 -0
- package/dist/index.d.ts +622 -0
- package/dist/index.js +256 -0
- package/dist/inputs.d.ts +145 -0
- package/dist/inputs.js +46 -0
- package/dist/ledger.d.ts +98 -0
- package/dist/ledger.js +218 -0
- package/dist/raw-invoice-query.d.ts +2 -0
- package/dist/raw-invoice-query.js +10 -0
- package/dist/transport.d.ts +344 -0
- package/dist/transport.js +276 -0
- package/dist/wire.d.ts +16 -0
- package/dist/wire.js +8 -0
- package/examples/catalog-invoice.mts +30 -0
- package/examples/connection-health.mts +21 -0
- package/examples/department-quickbooks/example.mts +12 -0
- package/examples/department-quickbooks/tsconfig.json +4 -0
- package/examples/facturar.mts +34 -0
- package/examples/first-customer.mts +72 -0
- package/examples/invoice-balances.mts +60 -0
- package/examples/invoice-settlement.mts +86 -0
- package/examples/invoice-sync.mts +46 -0
- package/examples/invoice-traces.mts +65 -0
- package/examples/invoice.mts +27 -0
- package/examples/mixed-providers/example.mts +12 -0
- package/examples/mixed-providers/tsconfig.json +4 -0
- package/examples/native-query.mts +28 -0
- package/examples/native-quickstart.mts +46 -0
- package/examples/observed-payments.mts +29 -0
- package/examples/quickstart.mts +11 -0
- package/examples/reimbursement-batch.mts +36 -0
- package/examples/resume-invoice.mts +52 -0
- package/examples/tsconfig.editor.json +11 -0
- package/examples/webhook-receiver.mts +142 -0
- package/package.json +61 -5
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
import type { CompanyRequest, ConnectSessionRequest, CreditApplicationRecord, CreditMemoRecord, ListObservedPaymentsParams, ListSyncedInvoicesParams, MatchObservedPaymentRequest, ReceivedPaymentRecord, RetrieveInvoiceRecoveryParams, SyncedInvoicePage, WebhookEndpointRequest } from "./generated/http.js";
|
|
2
|
+
import { catalogNamespace } from "./generated/catalog.js";
|
|
3
|
+
import { rawNamespaces } from "./generated/raw.js";
|
|
4
|
+
import { type InvoiceTraceLookup, type PilotOperation } from "./transport.js";
|
|
5
|
+
import type { ResponseMetadata, RowbindFetch } from "./http-request.js";
|
|
6
|
+
import { type SandboxRecord } from "./ledger.js";
|
|
7
|
+
import { buildSchema, fulfillmentSchema, orderSchema, sitesSchema, stockSchema, type BatchCreateParams, type ConnectionId, type CreditApplicationParams, type CreditMemoCreateParams, type InvoiceCreateParams, type NativeInput, type ReceivedPaymentCreateParams } from "./inputs.js";
|
|
8
|
+
export { LedgerError as RowbindError } from "./ledger.js";
|
|
9
|
+
export type { RowbindFetch } from "./http-request.js";
|
|
10
|
+
export type { BuildRecord, FulfillmentRecord, InvoiceRecord, SandboxRecord } from "./ledger.js";
|
|
11
|
+
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";
|
|
13
|
+
export { OperationWaitError, type InvoiceTraceLookup, type PilotOperation } from "./transport.js";
|
|
14
|
+
type QuickBooksId = ConnectionId<"quickbooksDesktop">;
|
|
15
|
+
type NetSuiteId = ConnectionId<"netsuite">;
|
|
16
|
+
export type Connection = {
|
|
17
|
+
provider: "quickbooksDesktop";
|
|
18
|
+
id: QuickBooksId;
|
|
19
|
+
invoiceTarget: {
|
|
20
|
+
connectionId: QuickBooksId;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
provider: "netsuite";
|
|
24
|
+
id: NetSuiteId;
|
|
25
|
+
invoiceTarget: {
|
|
26
|
+
connectionId: NetSuiteId;
|
|
27
|
+
providerOptions: {
|
|
28
|
+
netsuite: {
|
|
29
|
+
subsidiaryId: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type AccountingRecord = SandboxRecord | ReceivedPaymentRecord | CreditMemoRecord | CreditApplicationRecord;
|
|
35
|
+
type Kind = AccountingRecord["kind"];
|
|
36
|
+
declare const operationBrand: unique symbol;
|
|
37
|
+
export type OperationId<K extends Kind> = string & {
|
|
38
|
+
readonly [operationBrand]: K;
|
|
39
|
+
};
|
|
40
|
+
export type Operation<K extends Kind> = {
|
|
41
|
+
id: OperationId<K>;
|
|
42
|
+
};
|
|
43
|
+
export type RowbindOptions = {
|
|
44
|
+
environment?: "sandbox";
|
|
45
|
+
} & ({
|
|
46
|
+
apiKey?: string;
|
|
47
|
+
baseUrl?: string;
|
|
48
|
+
fetch?: RowbindFetch;
|
|
49
|
+
databasePath?: never;
|
|
50
|
+
} | {
|
|
51
|
+
databasePath?: string;
|
|
52
|
+
apiKey?: never;
|
|
53
|
+
baseUrl?: never;
|
|
54
|
+
fetch?: never;
|
|
55
|
+
});
|
|
56
|
+
export declare class Rowbind {
|
|
57
|
+
private readonly local?;
|
|
58
|
+
private readonly remote?;
|
|
59
|
+
private get ledger();
|
|
60
|
+
constructor(options?: RowbindOptions);
|
|
61
|
+
close(): void;
|
|
62
|
+
readonly sandbox: {
|
|
63
|
+
fixtures: {
|
|
64
|
+
retrieve: (name: "quickstart-v1") => Promise<{
|
|
65
|
+
quickbooksDesktop: {
|
|
66
|
+
connectionId: QuickBooksId;
|
|
67
|
+
invoiceTarget: {
|
|
68
|
+
connectionId: QuickBooksId;
|
|
69
|
+
};
|
|
70
|
+
kitBuild: {
|
|
71
|
+
readonly inventoryAssemblyItemId: "qbd-kit";
|
|
72
|
+
readonly inventorySiteId: "qbd-main";
|
|
73
|
+
readonly transactionDate: "2026-11-28";
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
netsuite: {
|
|
77
|
+
connectionId: NetSuiteId;
|
|
78
|
+
invoiceTarget: {
|
|
79
|
+
connectionId: NetSuiteId;
|
|
80
|
+
providerOptions: {
|
|
81
|
+
readonly netsuite: {
|
|
82
|
+
readonly subsidiaryId: "ns-sub-1";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
partialShipment: {
|
|
87
|
+
readonly orderId: "ns-so-1";
|
|
88
|
+
readonly orderLine: 10;
|
|
89
|
+
readonly locationId: "ns-main";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}>;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
private get workerTransport();
|
|
96
|
+
readonly companies: {
|
|
97
|
+
create: (input: CompanyRequest) => Promise<{
|
|
98
|
+
id: string;
|
|
99
|
+
externalId: string;
|
|
100
|
+
name: string;
|
|
101
|
+
}>;
|
|
102
|
+
};
|
|
103
|
+
readonly connect: {
|
|
104
|
+
sessions: {
|
|
105
|
+
create: (input: ConnectSessionRequest) => Promise<{
|
|
106
|
+
id: string;
|
|
107
|
+
companyId: string;
|
|
108
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
109
|
+
expiresAt: string;
|
|
110
|
+
status: "pending";
|
|
111
|
+
url: string;
|
|
112
|
+
}>;
|
|
113
|
+
retrieve: (id: string) => Promise<{
|
|
114
|
+
id: string;
|
|
115
|
+
companyId: string;
|
|
116
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
117
|
+
expiresAt: string;
|
|
118
|
+
status: "pending" | "connected" | "expired";
|
|
119
|
+
connectionId?: string;
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
readonly connections: {
|
|
124
|
+
health: (id: string) => Promise<{
|
|
125
|
+
connectionId: string;
|
|
126
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
127
|
+
authorization: "authorized" | "unrecorded";
|
|
128
|
+
authorizedAt: string | null;
|
|
129
|
+
status: "verified" | "wrong_book" | "book_diverged" | "unchecked" | "offline" | "permission_denied";
|
|
130
|
+
checkedAt: string | null;
|
|
131
|
+
lastVerifiedAt: string | null;
|
|
132
|
+
capability: "invoices:read";
|
|
133
|
+
nextAction: "restore_connection" | "open_authorized_book" | "reconcile_book" | "none" | "run_check" | "restore_permissions" | "authorize_connection";
|
|
134
|
+
divergence?: {
|
|
135
|
+
kind: "invoice_receipt";
|
|
136
|
+
operationId: string;
|
|
137
|
+
} | {
|
|
138
|
+
kind: "invoice_checkpoint" | "payment_checkpoint";
|
|
139
|
+
revision: number;
|
|
140
|
+
};
|
|
141
|
+
}>;
|
|
142
|
+
checkHealth: (id: string) => Promise<{
|
|
143
|
+
connectionId: string;
|
|
144
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
145
|
+
authorization: "authorized" | "unrecorded";
|
|
146
|
+
authorizedAt: string | null;
|
|
147
|
+
status: "verified" | "wrong_book" | "book_diverged" | "unchecked" | "offline" | "permission_denied";
|
|
148
|
+
checkedAt: string | null;
|
|
149
|
+
lastVerifiedAt: string | null;
|
|
150
|
+
capability: "invoices:read";
|
|
151
|
+
nextAction: "restore_connection" | "open_authorized_book" | "reconcile_book" | "none" | "run_check" | "restore_permissions" | "authorize_connection";
|
|
152
|
+
divergence?: {
|
|
153
|
+
kind: "invoice_receipt";
|
|
154
|
+
operationId: string;
|
|
155
|
+
} | {
|
|
156
|
+
kind: "invoice_checkpoint" | "payment_checkpoint";
|
|
157
|
+
revision: number;
|
|
158
|
+
};
|
|
159
|
+
}>;
|
|
160
|
+
list: () => Promise<Connection[]>;
|
|
161
|
+
retrieve: (id: string) => Promise<Connection>;
|
|
162
|
+
};
|
|
163
|
+
readonly [catalogNamespace]: {
|
|
164
|
+
search: (connectionId: Parameters<typeof import("./generated/http.js").searchCatalog>[0], { kind, ...input }: Parameters<typeof import("./generated/http.js").searchCatalog>[2] & {
|
|
165
|
+
kind: Parameters<typeof import("./generated/http.js").searchCatalog>[1];
|
|
166
|
+
}) => Promise<{
|
|
167
|
+
records: {
|
|
168
|
+
nativeId: string;
|
|
169
|
+
displayName: string;
|
|
170
|
+
sku?: string;
|
|
171
|
+
}[];
|
|
172
|
+
nextCursor: string | null;
|
|
173
|
+
}>;
|
|
174
|
+
link: (connectionId: Parameters<typeof import("./generated/http.js").linkCatalog>[0], { kind, ...input }: Parameters<typeof import("./generated/http.js").linkCatalog>[2] & {
|
|
175
|
+
kind: Parameters<typeof import("./generated/http.js").linkCatalog>[1];
|
|
176
|
+
}) => Promise<{
|
|
177
|
+
kind: "customer" | "item";
|
|
178
|
+
externalId: string;
|
|
179
|
+
nativeId: string;
|
|
180
|
+
}>;
|
|
181
|
+
};
|
|
182
|
+
readonly sync: {
|
|
183
|
+
invoices: {
|
|
184
|
+
enable: (connectionId: string) => Promise<{
|
|
185
|
+
connectionId: string;
|
|
186
|
+
resource: "invoices";
|
|
187
|
+
status: "initializing" | "syncing" | "current" | "unavailable";
|
|
188
|
+
coveredThrough: string | null;
|
|
189
|
+
lastAttemptAt: string | null;
|
|
190
|
+
lastFailure?: "source_offline" | "wrong_book" | "book_diverged" | "storage_error" | "permission_denied" | "source_history_gap" | null;
|
|
191
|
+
}>;
|
|
192
|
+
status: (connectionId: string) => Promise<{
|
|
193
|
+
connectionId: string;
|
|
194
|
+
resource: "invoices";
|
|
195
|
+
status: "initializing" | "syncing" | "current" | "unavailable";
|
|
196
|
+
coveredThrough: string | null;
|
|
197
|
+
lastAttemptAt: string | null;
|
|
198
|
+
lastFailure?: "source_offline" | "wrong_book" | "book_diverged" | "storage_error" | "permission_denied" | "source_history_gap" | null;
|
|
199
|
+
}>;
|
|
200
|
+
};
|
|
201
|
+
receivedPayments: {
|
|
202
|
+
enable: (connectionId: string) => Promise<{
|
|
203
|
+
connectionId: string;
|
|
204
|
+
resource: "received_payments";
|
|
205
|
+
status: "initializing" | "syncing" | "current" | "unavailable";
|
|
206
|
+
coveredThrough: string | null;
|
|
207
|
+
lastAttemptAt: string | null;
|
|
208
|
+
lastFailure: "source_offline" | "wrong_book" | "book_diverged" | "storage_error" | "page_lost" | null;
|
|
209
|
+
}>;
|
|
210
|
+
status: (connectionId: string) => Promise<{
|
|
211
|
+
connectionId: string;
|
|
212
|
+
resource: "received_payments";
|
|
213
|
+
status: "initializing" | "syncing" | "current" | "unavailable";
|
|
214
|
+
coveredThrough: string | null;
|
|
215
|
+
lastAttemptAt: string | null;
|
|
216
|
+
lastFailure: "source_offline" | "wrong_book" | "book_diverged" | "storage_error" | "page_lost" | null;
|
|
217
|
+
}>;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
readonly invoiceTraces: {
|
|
221
|
+
list: (lookup: InvoiceTraceLookup) => Promise<import("./generated/http.js").InvoiceTracePage>;
|
|
222
|
+
};
|
|
223
|
+
readonly observedPayments: {
|
|
224
|
+
list: (connectionId: string, params?: ListObservedPaymentsParams) => Promise<{
|
|
225
|
+
observations: {
|
|
226
|
+
id: string;
|
|
227
|
+
connectionId: string;
|
|
228
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
229
|
+
paymentId: string;
|
|
230
|
+
invoiceId: string;
|
|
231
|
+
amount: string;
|
|
232
|
+
currency: "USD";
|
|
233
|
+
balanceDue: string;
|
|
234
|
+
modifiedAt: string;
|
|
235
|
+
observedAt: string;
|
|
236
|
+
status: "pending_match" | "matched";
|
|
237
|
+
externalInvoiceId: string | null;
|
|
238
|
+
}[];
|
|
239
|
+
nextCursor: string | null;
|
|
240
|
+
}>;
|
|
241
|
+
match: (id: string, input: MatchObservedPaymentRequest) => Promise<{
|
|
242
|
+
id: string;
|
|
243
|
+
connectionId: string;
|
|
244
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
245
|
+
paymentId: string;
|
|
246
|
+
invoiceId: string;
|
|
247
|
+
amount: string;
|
|
248
|
+
currency: "USD";
|
|
249
|
+
balanceDue: string;
|
|
250
|
+
modifiedAt: string;
|
|
251
|
+
observedAt: string;
|
|
252
|
+
status: "pending_match" | "matched";
|
|
253
|
+
externalInvoiceId: string | null;
|
|
254
|
+
}>;
|
|
255
|
+
};
|
|
256
|
+
readonly batches: {
|
|
257
|
+
create: (input: BatchCreateParams) => Promise<{
|
|
258
|
+
id: string;
|
|
259
|
+
}>;
|
|
260
|
+
retrieve: (id: string) => Promise<{
|
|
261
|
+
id: string;
|
|
262
|
+
connectionId: string;
|
|
263
|
+
status: "pending" | "verified";
|
|
264
|
+
rows: {
|
|
265
|
+
key: string;
|
|
266
|
+
kind: "vendor_bill" | "bill_payment";
|
|
267
|
+
status: "pending" | "verified" | "blocked";
|
|
268
|
+
amount: string;
|
|
269
|
+
dependsOn: string[];
|
|
270
|
+
nativeId?: string;
|
|
271
|
+
balanceDue?: string;
|
|
272
|
+
diagnosis?: {
|
|
273
|
+
code: "queued" | "awaiting_bills" | "dispatch_claimed" | "source_offline" | "wrong_book" | "book_diverged" | "source_record_missing" | "source_record_mismatch" | "bills_changed" | "storage_error" | "internal_error" | "record_verified";
|
|
274
|
+
certainty: "unknown" | "verified" | "not_sent";
|
|
275
|
+
nextAction: "dispatch_once" | "wait_for_bills" | "verify_original_book" | "restore_connection" | "open_authorized_book" | "reconcile_book" | "review_mismatch" | "review_bills" | "resume_operation" | "none";
|
|
276
|
+
owner: "none" | "rowbind" | "erp_admin" | "saas";
|
|
277
|
+
requiredEvidence: "none" | "verified_dependencies" | "authorized_book" | "consistent_book" | "open_bills" | "native_bill" | "native_payment_and_applications";
|
|
278
|
+
blockingRowKeys: string[];
|
|
279
|
+
observedAt: string | null;
|
|
280
|
+
};
|
|
281
|
+
history?: {
|
|
282
|
+
code: "queued" | "awaiting_bills" | "dispatch_claimed" | "source_offline" | "wrong_book" | "book_diverged" | "source_record_missing" | "source_record_mismatch" | "bills_changed" | "storage_error" | "internal_error" | "record_verified";
|
|
283
|
+
certainty: "unknown" | "verified" | "not_sent";
|
|
284
|
+
nextAction: "dispatch_once" | "wait_for_bills" | "verify_original_book" | "restore_connection" | "open_authorized_book" | "reconcile_book" | "review_mismatch" | "review_bills" | "resume_operation" | "none";
|
|
285
|
+
owner: "none" | "rowbind" | "erp_admin" | "saas";
|
|
286
|
+
requiredEvidence: "none" | "verified_dependencies" | "authorized_book" | "consistent_book" | "open_bills" | "native_bill" | "native_payment_and_applications";
|
|
287
|
+
blockingRowKeys: string[];
|
|
288
|
+
observedAt: string | null;
|
|
289
|
+
}[];
|
|
290
|
+
}[];
|
|
291
|
+
}>;
|
|
292
|
+
};
|
|
293
|
+
readonly webhookEndpoints: {
|
|
294
|
+
create: (input: WebhookEndpointRequest) => Promise<{
|
|
295
|
+
id: string;
|
|
296
|
+
destination: string;
|
|
297
|
+
eventType: "operation.verified" | "invoice.created" | "invoice.updated" | "invoice.voided" | "invoice.deleted" | "payment.matched";
|
|
298
|
+
}>;
|
|
299
|
+
deliveries: {
|
|
300
|
+
list: (endpointId: string) => Promise<{
|
|
301
|
+
deliveries: ({
|
|
302
|
+
eventId: string;
|
|
303
|
+
operationId: string;
|
|
304
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
305
|
+
attempts: number;
|
|
306
|
+
lastHttpStatus: number | null;
|
|
307
|
+
} | {
|
|
308
|
+
eventId: string;
|
|
309
|
+
eventType: "invoice.created";
|
|
310
|
+
connectionId: string;
|
|
311
|
+
invoiceId: string;
|
|
312
|
+
revision: number;
|
|
313
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
314
|
+
attempts: number;
|
|
315
|
+
lastHttpStatus: number | null;
|
|
316
|
+
} | {
|
|
317
|
+
eventId: string;
|
|
318
|
+
eventType: "invoice.updated";
|
|
319
|
+
connectionId: string;
|
|
320
|
+
invoiceId: string;
|
|
321
|
+
revision: number;
|
|
322
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
323
|
+
attempts: number;
|
|
324
|
+
lastHttpStatus: number | null;
|
|
325
|
+
} | {
|
|
326
|
+
eventId: string;
|
|
327
|
+
eventType: "invoice.voided";
|
|
328
|
+
connectionId: string;
|
|
329
|
+
invoiceId: string;
|
|
330
|
+
revision: number;
|
|
331
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
332
|
+
attempts: number;
|
|
333
|
+
lastHttpStatus: number | null;
|
|
334
|
+
} | {
|
|
335
|
+
eventId: string;
|
|
336
|
+
eventType: "invoice.deleted";
|
|
337
|
+
connectionId: string;
|
|
338
|
+
invoiceId: string;
|
|
339
|
+
revision: number;
|
|
340
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
341
|
+
attempts: number;
|
|
342
|
+
lastHttpStatus: number | null;
|
|
343
|
+
} | {
|
|
344
|
+
eventId: string;
|
|
345
|
+
eventType: "payment.matched";
|
|
346
|
+
connectionId: string;
|
|
347
|
+
invoiceId: string;
|
|
348
|
+
paymentId: string;
|
|
349
|
+
observationId: string;
|
|
350
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
351
|
+
attempts: number;
|
|
352
|
+
lastHttpStatus: number | null;
|
|
353
|
+
})[];
|
|
354
|
+
}>;
|
|
355
|
+
replay: (endpointId: string, eventId: string) => Promise<{
|
|
356
|
+
eventId: string;
|
|
357
|
+
}>;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
readonly platform: {
|
|
361
|
+
companies: {
|
|
362
|
+
create: (input: CompanyRequest) => Promise<{
|
|
363
|
+
id: string;
|
|
364
|
+
externalId: string;
|
|
365
|
+
name: string;
|
|
366
|
+
}>;
|
|
367
|
+
};
|
|
368
|
+
connect: {
|
|
369
|
+
sessions: {
|
|
370
|
+
create: (input: ConnectSessionRequest) => Promise<{
|
|
371
|
+
id: string;
|
|
372
|
+
companyId: string;
|
|
373
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
374
|
+
expiresAt: string;
|
|
375
|
+
status: "pending";
|
|
376
|
+
url: string;
|
|
377
|
+
}>;
|
|
378
|
+
retrieve: (id: string) => Promise<{
|
|
379
|
+
id: string;
|
|
380
|
+
companyId: string;
|
|
381
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
382
|
+
expiresAt: string;
|
|
383
|
+
status: "pending" | "connected" | "expired";
|
|
384
|
+
connectionId?: string;
|
|
385
|
+
}>;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
connections: {
|
|
389
|
+
health: (id: string) => Promise<{
|
|
390
|
+
connectionId: string;
|
|
391
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
392
|
+
authorization: "authorized" | "unrecorded";
|
|
393
|
+
authorizedAt: string | null;
|
|
394
|
+
status: "verified" | "wrong_book" | "book_diverged" | "unchecked" | "offline" | "permission_denied";
|
|
395
|
+
checkedAt: string | null;
|
|
396
|
+
lastVerifiedAt: string | null;
|
|
397
|
+
capability: "invoices:read";
|
|
398
|
+
nextAction: "restore_connection" | "open_authorized_book" | "reconcile_book" | "none" | "run_check" | "restore_permissions" | "authorize_connection";
|
|
399
|
+
divergence?: {
|
|
400
|
+
kind: "invoice_receipt";
|
|
401
|
+
operationId: string;
|
|
402
|
+
} | {
|
|
403
|
+
kind: "invoice_checkpoint" | "payment_checkpoint";
|
|
404
|
+
revision: number;
|
|
405
|
+
};
|
|
406
|
+
}>;
|
|
407
|
+
checkHealth: (id: string) => Promise<{
|
|
408
|
+
connectionId: string;
|
|
409
|
+
provider: "quickbooksDesktop" | "netsuite";
|
|
410
|
+
authorization: "authorized" | "unrecorded";
|
|
411
|
+
authorizedAt: string | null;
|
|
412
|
+
status: "verified" | "wrong_book" | "book_diverged" | "unchecked" | "offline" | "permission_denied";
|
|
413
|
+
checkedAt: string | null;
|
|
414
|
+
lastVerifiedAt: string | null;
|
|
415
|
+
capability: "invoices:read";
|
|
416
|
+
nextAction: "restore_connection" | "open_authorized_book" | "reconcile_book" | "none" | "run_check" | "restore_permissions" | "authorize_connection";
|
|
417
|
+
divergence?: {
|
|
418
|
+
kind: "invoice_receipt";
|
|
419
|
+
operationId: string;
|
|
420
|
+
} | {
|
|
421
|
+
kind: "invoice_checkpoint" | "payment_checkpoint";
|
|
422
|
+
revision: number;
|
|
423
|
+
};
|
|
424
|
+
}>;
|
|
425
|
+
list: () => Promise<Connection[]>;
|
|
426
|
+
retrieve: (id: string) => Promise<Connection>;
|
|
427
|
+
};
|
|
428
|
+
webhookEndpoints: {
|
|
429
|
+
create: (input: WebhookEndpointRequest) => Promise<{
|
|
430
|
+
id: string;
|
|
431
|
+
destination: string;
|
|
432
|
+
eventType: "operation.verified" | "invoice.created" | "invoice.updated" | "invoice.voided" | "invoice.deleted" | "payment.matched";
|
|
433
|
+
}>;
|
|
434
|
+
deliveries: {
|
|
435
|
+
list: (endpointId: string) => Promise<{
|
|
436
|
+
deliveries: ({
|
|
437
|
+
eventId: string;
|
|
438
|
+
operationId: string;
|
|
439
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
440
|
+
attempts: number;
|
|
441
|
+
lastHttpStatus: number | null;
|
|
442
|
+
} | {
|
|
443
|
+
eventId: string;
|
|
444
|
+
eventType: "invoice.created";
|
|
445
|
+
connectionId: string;
|
|
446
|
+
invoiceId: string;
|
|
447
|
+
revision: number;
|
|
448
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
449
|
+
attempts: number;
|
|
450
|
+
lastHttpStatus: number | null;
|
|
451
|
+
} | {
|
|
452
|
+
eventId: string;
|
|
453
|
+
eventType: "invoice.updated";
|
|
454
|
+
connectionId: string;
|
|
455
|
+
invoiceId: string;
|
|
456
|
+
revision: number;
|
|
457
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
458
|
+
attempts: number;
|
|
459
|
+
lastHttpStatus: number | null;
|
|
460
|
+
} | {
|
|
461
|
+
eventId: string;
|
|
462
|
+
eventType: "invoice.voided";
|
|
463
|
+
connectionId: string;
|
|
464
|
+
invoiceId: string;
|
|
465
|
+
revision: number;
|
|
466
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
467
|
+
attempts: number;
|
|
468
|
+
lastHttpStatus: number | null;
|
|
469
|
+
} | {
|
|
470
|
+
eventId: string;
|
|
471
|
+
eventType: "invoice.deleted";
|
|
472
|
+
connectionId: string;
|
|
473
|
+
invoiceId: string;
|
|
474
|
+
revision: number;
|
|
475
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
476
|
+
attempts: number;
|
|
477
|
+
lastHttpStatus: number | null;
|
|
478
|
+
} | {
|
|
479
|
+
eventId: string;
|
|
480
|
+
eventType: "payment.matched";
|
|
481
|
+
connectionId: string;
|
|
482
|
+
invoiceId: string;
|
|
483
|
+
paymentId: string;
|
|
484
|
+
observationId: string;
|
|
485
|
+
status: "pending" | "delivered" | "dead_letter";
|
|
486
|
+
attempts: number;
|
|
487
|
+
lastHttpStatus: number | null;
|
|
488
|
+
})[];
|
|
489
|
+
}>;
|
|
490
|
+
replay: (endpointId: string, eventId: string) => Promise<{
|
|
491
|
+
eventId: string;
|
|
492
|
+
}>;
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
readonly receivedPayments: {
|
|
497
|
+
create: (input: ReceivedPaymentCreateParams) => Promise<Operation<"received_payment">>;
|
|
498
|
+
};
|
|
499
|
+
readonly creditMemos: {
|
|
500
|
+
create: (input: CreditMemoCreateParams) => Promise<Operation<"credit_memo">>;
|
|
501
|
+
apply: (creditMemoId: string, input: CreditApplicationParams) => Promise<Operation<"credit_application">>;
|
|
502
|
+
};
|
|
503
|
+
private createInvoice;
|
|
504
|
+
readonly invoices: {
|
|
505
|
+
create: {
|
|
506
|
+
(input: InvoiceCreateParams, options?: {
|
|
507
|
+
includeRequestId?: false;
|
|
508
|
+
}): Promise<Operation<"invoice">>;
|
|
509
|
+
(input: InvoiceCreateParams, options?: {
|
|
510
|
+
includeRequestId?: boolean;
|
|
511
|
+
}): Promise<Operation<"invoice"> & ResponseMetadata>;
|
|
512
|
+
};
|
|
513
|
+
list: (connectionId: string, params?: ListSyncedInvoicesParams) => Promise<{
|
|
514
|
+
connectionId: string;
|
|
515
|
+
snapshotRevision: number;
|
|
516
|
+
coveredThrough: string;
|
|
517
|
+
invoices: {
|
|
518
|
+
invoiceId: string;
|
|
519
|
+
revision: number;
|
|
520
|
+
currency: string;
|
|
521
|
+
balanceDue: string;
|
|
522
|
+
status?: "voided";
|
|
523
|
+
details?: {
|
|
524
|
+
customerId?: string;
|
|
525
|
+
externalReference?: string;
|
|
526
|
+
invoiceNumber?: string;
|
|
527
|
+
issueDate?: string;
|
|
528
|
+
dueDate?: string;
|
|
529
|
+
total?: string;
|
|
530
|
+
subsidiaryId?: string;
|
|
531
|
+
departmentId?: string;
|
|
532
|
+
lines?: {
|
|
533
|
+
itemId: string;
|
|
534
|
+
quantity: number;
|
|
535
|
+
unitPrice: string;
|
|
536
|
+
description?: string;
|
|
537
|
+
}[];
|
|
538
|
+
};
|
|
539
|
+
}[];
|
|
540
|
+
nextCursor: string | null;
|
|
541
|
+
}>;
|
|
542
|
+
iterPages: (connectionId: string, params?: ListSyncedInvoicesParams) => AsyncGenerator<SyncedInvoicePage, void>;
|
|
543
|
+
};
|
|
544
|
+
private iterInvoicePages;
|
|
545
|
+
private readRecord;
|
|
546
|
+
readonly operations: {
|
|
547
|
+
retrieve: (id: string) => Promise<PilotOperation | {
|
|
548
|
+
id: string;
|
|
549
|
+
status: "verified";
|
|
550
|
+
record: SandboxRecord;
|
|
551
|
+
}>;
|
|
552
|
+
recovery: (id: string, params?: RetrieveInvoiceRecoveryParams) => Promise<import("./generated/http.js").InvoiceRecoveryPage>;
|
|
553
|
+
waitForVerifiedRecord: {
|
|
554
|
+
<K extends Kind>(id: OperationId<K>, options?: {
|
|
555
|
+
timeoutMs?: number;
|
|
556
|
+
}): Promise<Extract<AccountingRecord, {
|
|
557
|
+
kind: K;
|
|
558
|
+
}>>;
|
|
559
|
+
(id: string, options?: {
|
|
560
|
+
timeoutMs?: number;
|
|
561
|
+
}): Promise<AccountingRecord>;
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
readonly [rawNamespaces.quickbooksDesktop]: {
|
|
565
|
+
raw: {
|
|
566
|
+
query: ({ connectionId, ...body }: import("./generated/raw.js").RawInput<Parameters<typeof import("./generated/http.js").queryRaw>[1], "quickbooksDesktop">) => Promise<{
|
|
567
|
+
provider: "quickbooksDesktop";
|
|
568
|
+
qbxml: string;
|
|
569
|
+
} & ResponseMetadata>;
|
|
570
|
+
read: ({ connectionId, ...body }: import("./generated/raw.js").RawInput<Parameters<typeof import("./generated/http.js").readRaw>[1], "quickbooksDesktop">) => Promise<{
|
|
571
|
+
provider: "quickbooksDesktop";
|
|
572
|
+
qbxml: string;
|
|
573
|
+
} & ResponseMetadata>;
|
|
574
|
+
};
|
|
575
|
+
buildAssemblies: {
|
|
576
|
+
create: (input: NativeInput<typeof buildSchema, "quickbooksDesktop">) => Promise<Operation<"build">>;
|
|
577
|
+
};
|
|
578
|
+
inventorySites: {
|
|
579
|
+
list: (input: NativeInput<typeof sitesSchema, "quickbooksDesktop">) => Promise<{
|
|
580
|
+
data: {
|
|
581
|
+
id: string;
|
|
582
|
+
name: string;
|
|
583
|
+
}[];
|
|
584
|
+
}>;
|
|
585
|
+
};
|
|
586
|
+
itemSites: {
|
|
587
|
+
list: (input: NativeInput<typeof stockSchema, "quickbooksDesktop">) => Promise<{
|
|
588
|
+
data: {
|
|
589
|
+
itemId: string;
|
|
590
|
+
quantityOnHand: number;
|
|
591
|
+
}[];
|
|
592
|
+
}>;
|
|
593
|
+
};
|
|
594
|
+
};
|
|
595
|
+
readonly [rawNamespaces.netsuite]: {
|
|
596
|
+
raw: {
|
|
597
|
+
suiteql: ({ connectionId, ...body }: import("./generated/raw.js").RawInput<Parameters<typeof import("./generated/http.js").queryRaw>[1], "netsuite">) => Promise<{
|
|
598
|
+
provider: "netsuite";
|
|
599
|
+
page: import("./generated/http.js").SuiteQLPage;
|
|
600
|
+
} & ResponseMetadata>;
|
|
601
|
+
read: ({ connectionId, ...body }: import("./generated/raw.js").RawInput<Parameters<typeof import("./generated/http.js").readRaw>[1], "netsuite">) => Promise<{
|
|
602
|
+
provider: "netsuite";
|
|
603
|
+
record: {
|
|
604
|
+
id: string;
|
|
605
|
+
[key: string]: unknown;
|
|
606
|
+
};
|
|
607
|
+
} & ResponseMetadata>;
|
|
608
|
+
};
|
|
609
|
+
salesOrders: {
|
|
610
|
+
fulfill: (input: NativeInput<typeof fulfillmentSchema, "netsuite">) => Promise<Operation<"fulfillment">>;
|
|
611
|
+
retrieve: (input: NativeInput<typeof orderSchema, "netsuite">) => Promise<{
|
|
612
|
+
id: string;
|
|
613
|
+
lines: {
|
|
614
|
+
orderLine: number;
|
|
615
|
+
locationId: string;
|
|
616
|
+
quantity: number;
|
|
617
|
+
quantityFulfilled: number;
|
|
618
|
+
}[];
|
|
619
|
+
}>;
|
|
620
|
+
};
|
|
621
|
+
};
|
|
622
|
+
}
|