@superdurable/connector-intuit-quickbooks 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +91 -2
- package/dex-connector.json +559 -0
- package/dist/chunk-MBZ23PGI.js +514 -0
- package/dist/connection-yvzYeBut.d.ts +681 -0
- package/dist/index.d.ts +660 -0
- package/dist/index.js +1755 -0
- package/dist/mock.d.ts +190 -0
- package/dist/mock.js +455 -0
- package/package.json +63 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
2
|
+
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
3
|
+
import { Query, Call, QueryAttempt, Mutation, MutationAttempt, TriggerLogger, Failure, ReceiptDraft, MutationStepConfig, MutationResult, QueryStepConfig, QueryResult, MutationStep, QueryStep, MutationDefinition, QueryDefinition, ConnectorConfigurationUI, TriggerDefinition, TriggerBindingDefinition, TriggerEvent, ConnectionRef, TriggerContext, TriggerTarget, TriggerRunner } from '@superdurable/connectors-sdk';
|
|
4
|
+
import { F as FindCustomerInput, a as FindCustomerOutput, C as CreateCustomerInput, b as CreateCustomerOutput, c as CreateInvoiceInput, d as CreateInvoiceOutput, G as GetInvoiceInput, I as Invoice, L as ListInvoicesInput, e as InvoicePage, S as SendInvoiceInput, R as RecordPaymentInput, P as Payment, f as Config, g as CredentialSource, h as Connection, O as Operations } from './connection-yvzYeBut.js';
|
|
5
|
+
export { i as ConfigSchema, j as CreateCustomerInputSchema, k as CreateCustomerOutputSchema, l as CreateInvoiceInputSchema, m as CreateInvoiceOutputSchema, n as Credentials, o as Customer, p as CustomerSchema, q as FindCustomerInputSchema, r as FindCustomerOutputSchema, s as GetInvoiceInputSchema, t as InvoiceLine, u as InvoiceLineInput, v as InvoiceLineInputSchema, w as InvoiceLineSchema, x as InvoicePageSchema, y as InvoiceSchema, z as ListInvoicesInputSchema, A as PaymentApplication, B as PaymentApplicationSchema, D as PaymentSchema, E as RecordPaymentInputSchema, H as SendInvoiceInputSchema, J as decodeCredentials, K as decodeSharedCredentials, M as newConnection, N as newConnectionWithOperations, Q as newProjectCredentialProvider } from './connection-yvzYeBut.js';
|
|
6
|
+
import { StepTarget } from '@superdurable/dex';
|
|
7
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { ChangeFetcher, Cursor, ChangePage, CursorStore, Runner } from '@superdurable/connectors-sdk/pollingtrigger';
|
|
10
|
+
|
|
11
|
+
/** Resolve one customer by exact email or display name. */
|
|
12
|
+
declare class FindCustomerOperation implements Query<FindCustomerInput, FindCustomerOutput> {
|
|
13
|
+
private readonly client;
|
|
14
|
+
/** Bind one client. */ constructor(client: QuickBooksClient);
|
|
15
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
16
|
+
/** Execute one bounded QuickBooks customer query. */
|
|
17
|
+
invoke(call: Call, input: FindCustomerInput): Promise<QueryAttempt<FindCustomerOutput>>;
|
|
18
|
+
}
|
|
19
|
+
/** Read one invoice by its QuickBooks ID. */
|
|
20
|
+
declare class GetInvoiceOperation implements Query<GetInvoiceInput, Invoice> {
|
|
21
|
+
private readonly client;
|
|
22
|
+
/** Bind one client. */ constructor(client: QuickBooksClient);
|
|
23
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
24
|
+
/** Validate and read one invoice. */
|
|
25
|
+
invoke(call: Call, input: GetInvoiceInput): Promise<QueryAttempt<Invoice>>;
|
|
26
|
+
}
|
|
27
|
+
/** Read one bounded page of invoices. */
|
|
28
|
+
declare class ListInvoicesOperation implements Query<ListInvoicesInput, InvoicePage> {
|
|
29
|
+
private readonly client;
|
|
30
|
+
/** Bind one client. */ constructor(client: QuickBooksClient);
|
|
31
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
32
|
+
/** Build and execute the invoice page query. */
|
|
33
|
+
invoke(call: Call, input: ListInvoicesInput): Promise<QueryAttempt<InvoicePage>>;
|
|
34
|
+
}
|
|
35
|
+
/** Create one QuickBooks customer under a stable requestid. */
|
|
36
|
+
declare class CreateCustomerOperation implements Mutation<CreateCustomerInput, CreateCustomerOutput> {
|
|
37
|
+
private readonly client;
|
|
38
|
+
/** Bind one client. */ constructor(client: QuickBooksClient);
|
|
39
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
40
|
+
/** Use Dex Call ID as QuickBooks requestid. */ idempotencyKey(callID: string): string;
|
|
41
|
+
/** Validate, create, and confirm an accepted write if necessary. */
|
|
42
|
+
invoke(call: Call, input: CreateCustomerInput): Promise<MutationAttempt<CreateCustomerOutput>>;
|
|
43
|
+
}
|
|
44
|
+
/** Create one invoice with exact decimal line amounts. */
|
|
45
|
+
declare class CreateInvoiceOperation implements Mutation<CreateInvoiceInput, CreateInvoiceOutput> {
|
|
46
|
+
private readonly client;
|
|
47
|
+
/** Bind one client. */ constructor(client: QuickBooksClient);
|
|
48
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
49
|
+
/** Use Dex Call ID as QuickBooks requestid. */ idempotencyKey(callID: string): string;
|
|
50
|
+
/** Validate, create, and read back an accepted invoice if necessary. */
|
|
51
|
+
invoke(call: Call, input: CreateInvoiceInput): Promise<MutationAttempt<CreateInvoiceOutput>>;
|
|
52
|
+
}
|
|
53
|
+
/** Email one invoice under the Step requestid. */
|
|
54
|
+
declare class SendInvoiceOperation implements Mutation<SendInvoiceInput, Invoice> {
|
|
55
|
+
private readonly client;
|
|
56
|
+
/** Bind one client. */ constructor(client: QuickBooksClient);
|
|
57
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
58
|
+
/** Use Dex Call ID as QuickBooks requestid. */ idempotencyKey(callID: string): string;
|
|
59
|
+
/** Send and confirm one invoice delivery. */
|
|
60
|
+
invoke(call: Call, input: SendInvoiceInput): Promise<MutationAttempt<Invoice>>;
|
|
61
|
+
}
|
|
62
|
+
/** Record one invoice payment under the Step requestid. */
|
|
63
|
+
declare class RecordPaymentOperation implements Mutation<RecordPaymentInput, Payment> {
|
|
64
|
+
private readonly client;
|
|
65
|
+
/** Bind one client. */ constructor(client: QuickBooksClient);
|
|
66
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
67
|
+
/** Use Dex Call ID as QuickBooks requestid. */ idempotencyKey(callID: string): string;
|
|
68
|
+
/** Record and confirm one payment. */
|
|
69
|
+
invoke(call: Call, input: RecordPaymentInput): Promise<MutationAttempt<Payment>>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Injectable sender and clock for deterministic provider verification. */
|
|
73
|
+
interface QuickBooksClientOptions {
|
|
74
|
+
/** Caller-owned transport; production uses the SDK provider transport. */
|
|
75
|
+
send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
76
|
+
/** UTC receipt and Retry-After clock. */
|
|
77
|
+
now?: () => Date;
|
|
78
|
+
/** Loopback HTTP endpoint for the connector's runnable example. */
|
|
79
|
+
localProviderURL?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Receives the invoiceChanged runner's records: seeds, reseeds, failed polls, rate-limit pauses, and the durable
|
|
82
|
+
* inboxes newProjectInvoiceTriggerRunner opens. Records carry binding identity and never invoice payloads or
|
|
83
|
+
* credentials. Omitted uses defaultTriggerLogger. Operation Steps do not log.
|
|
84
|
+
*/
|
|
85
|
+
logger?: TriggerLogger;
|
|
86
|
+
}
|
|
87
|
+
/** One classified provider exchange. */
|
|
88
|
+
interface QuickBooksExchange {
|
|
89
|
+
/** Classified provider outcome. */
|
|
90
|
+
disposition: 'succeeded' | 'notFound' | 'retry' | 'interrupted' | 'rejected' | 'nameConflict' | 'invalid' | 'defect';
|
|
91
|
+
/** Successful body, when available. */
|
|
92
|
+
body?: Uint8Array;
|
|
93
|
+
/** Failure, when unsuccessful. */
|
|
94
|
+
failure?: Failure;
|
|
95
|
+
/** Delay for a retry in milliseconds. */
|
|
96
|
+
retryAfterMs: number;
|
|
97
|
+
/** Safe correlation receipt. */
|
|
98
|
+
receipt: ReceiptDraft;
|
|
99
|
+
/** HTTP status, when the provider answered. */
|
|
100
|
+
status: number;
|
|
101
|
+
}
|
|
102
|
+
/** One QuickBooks request below the connected company's API path. */
|
|
103
|
+
interface QuickBooksRequest {
|
|
104
|
+
/** HTTP method. */ method: 'GET' | 'POST';
|
|
105
|
+
/** Path below the company. */ path: string;
|
|
106
|
+
/** Additional query values. */ query?: Record<string, string>;
|
|
107
|
+
/** Encoded JSON payload supplied by an operation. */ body?: Uint8Array;
|
|
108
|
+
/** Whether the operation uses QuickBooks requestid. */ mutation?: boolean;
|
|
109
|
+
}
|
|
110
|
+
/** QuickBooks client with manifest-driven OAuth renewal and company identity validation. */
|
|
111
|
+
declare class QuickBooksClient {
|
|
112
|
+
private readonly credentials;
|
|
113
|
+
private readonly endpoint;
|
|
114
|
+
/** The connection's QuickBooks environment, which selects the API host. */
|
|
115
|
+
readonly environment: 'production' | 'sandbox';
|
|
116
|
+
/** Delay between invoiceChanged polls in milliseconds, at least 5 seconds; 30 seconds by default. */
|
|
117
|
+
readonly pollIntervalMs: number;
|
|
118
|
+
/** Receives the invoiceChanged runner's and durable inboxes' records. */
|
|
119
|
+
readonly triggerLogger: TriggerLogger;
|
|
120
|
+
private readonly configuredRealmID;
|
|
121
|
+
private readonly maxResponseBytes;
|
|
122
|
+
private readonly send;
|
|
123
|
+
private readonly now;
|
|
124
|
+
private readonly refreshDriver;
|
|
125
|
+
/** Validate immutable connection configuration without contacting Intuit. */
|
|
126
|
+
constructor(config: Config, credentials: CredentialSource, options?: QuickBooksClientOptions);
|
|
127
|
+
/** Bind the customer lookup. */ findCustomer(): FindCustomerOperation;
|
|
128
|
+
/** Bind customer creation. */ createCustomer(): CreateCustomerOperation;
|
|
129
|
+
/** Bind invoice creation. */ createInvoice(): CreateInvoiceOperation;
|
|
130
|
+
/** Bind invoice lookup. */ getInvoice(): GetInvoiceOperation;
|
|
131
|
+
/** Bind invoice paging. */ listInvoices(): ListInvoicesOperation;
|
|
132
|
+
/** Bind invoice delivery. */ sendInvoice(): SendInvoiceOperation;
|
|
133
|
+
/** Bind payment recording. */ recordPayment(): RecordPaymentOperation;
|
|
134
|
+
/** Return a secret-safe failure. */
|
|
135
|
+
failure(kind: Failure['kind'], operation: string, message: string): Failure;
|
|
136
|
+
/** Send and classify one request, preserving the original requestid after a credential refresh. */
|
|
137
|
+
exchange(call: Call, operation: string, request: QuickBooksRequest, objectID?: string): Promise<QuickBooksExchange>;
|
|
138
|
+
private localFailure;
|
|
139
|
+
/** Create a receipt after a provider attempt. */
|
|
140
|
+
receipt(call: Call, objectID: string): ReceiptDraft;
|
|
141
|
+
private sendRequest;
|
|
142
|
+
private classifyStatus;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Configuration for the findCustomer connector Step. */
|
|
146
|
+
interface FindCustomerStepConfig<StepInput, OperationInput = FindCustomerInput, OperationOutput = FindCustomerOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
147
|
+
/** Named connection supplying this operation. */
|
|
148
|
+
connection: Connection<{
|
|
149
|
+
findCustomer(): Query<OperationInput, OperationOutput>;
|
|
150
|
+
}>;
|
|
151
|
+
/** Name matching the bound connection. */
|
|
152
|
+
connectionName: string;
|
|
153
|
+
/** Exactly one customer matches. */
|
|
154
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
155
|
+
/** No customer matches; inactive customers count only when the input includes them. */
|
|
156
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
157
|
+
/** Several customers share the email address; the output lists them so the application can choose. */
|
|
158
|
+
ambiguous?: StepTarget<QueryResult<OperationOutput>>;
|
|
159
|
+
/** QuickBooks conclusively rejected the query, such as a revoked connection or a company the app can no longer reach. */
|
|
160
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
161
|
+
/** QuickBooks returned an invalid or oversized customer list. */
|
|
162
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
163
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
164
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
165
|
+
}
|
|
166
|
+
/** Build the findCustomer Step from a named connection. */
|
|
167
|
+
declare function newFindCustomerStep<StepInput, OperationInput = FindCustomerInput, OperationOutput = FindCustomerOutput>(configuration: FindCustomerStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
168
|
+
/** Configuration for the createCustomer connector Step. */
|
|
169
|
+
interface CreateCustomerStepConfig<StepInput, OperationInput = CreateCustomerInput, OperationOutput = CreateCustomerOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
170
|
+
/** Named connection supplying this operation. */
|
|
171
|
+
connection: Connection<{
|
|
172
|
+
createCustomer(): Mutation<OperationInput, OperationOutput>;
|
|
173
|
+
}>;
|
|
174
|
+
/** Name matching the bound connection. */
|
|
175
|
+
connectionName: string;
|
|
176
|
+
/** QuickBooks created the customer, or returned the customer this Step already created. */
|
|
177
|
+
created: StepTarget<MutationResult<OperationOutput>>;
|
|
178
|
+
/** A customer, vendor, or employee already uses the display name (QuickBooks error 6240); resolve it with findCustomer by display name, including a possible earlier attempt. */
|
|
179
|
+
nameConflict?: StepTarget<MutationResult<OperationOutput>>;
|
|
180
|
+
/** QuickBooks conclusively rejected the customer, such as an invalid field or a revoked connection; nothing was created. */
|
|
181
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
182
|
+
/** QuickBooks accepted the request but returned an unusable customer that read-back could not confirm; look it up with findCustomer before creating again. */
|
|
183
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
184
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
185
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
186
|
+
}
|
|
187
|
+
/** Build the createCustomer Step from a named connection. */
|
|
188
|
+
declare function newCreateCustomerStep<StepInput, OperationInput = CreateCustomerInput, OperationOutput = CreateCustomerOutput>(configuration: CreateCustomerStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
189
|
+
/** Configuration for the createInvoice connector Step. */
|
|
190
|
+
interface CreateInvoiceStepConfig<StepInput, OperationInput = CreateInvoiceInput, OperationOutput = CreateInvoiceOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
191
|
+
/** Named connection supplying this operation. */
|
|
192
|
+
connection: Connection<{
|
|
193
|
+
createInvoice(): Mutation<OperationInput, OperationOutput>;
|
|
194
|
+
}>;
|
|
195
|
+
/** Name matching the bound connection. */
|
|
196
|
+
connectionName: string;
|
|
197
|
+
/** QuickBooks created the invoice, or returned the invoice this Step already created, with its number, total, and balance. */
|
|
198
|
+
created: StepTarget<MutationResult<OperationOutput>>;
|
|
199
|
+
/** QuickBooks conclusively rejected the invoice, such as an unknown or inactive customer or item, a duplicate document number, a closed period, or a revoked connection; nothing was created. */
|
|
200
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
201
|
+
/** QuickBooks accepted the request but returned an unusable invoice that read-back could not confirm; look it up by document number before creating again. */
|
|
202
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
203
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
204
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
205
|
+
}
|
|
206
|
+
/** Build the createInvoice Step from a named connection. */
|
|
207
|
+
declare function newCreateInvoiceStep<StepInput, OperationInput = CreateInvoiceInput, OperationOutput = CreateInvoiceOutput>(configuration: CreateInvoiceStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
208
|
+
/** Configuration for the getInvoice connector Step. */
|
|
209
|
+
interface GetInvoiceStepConfig<StepInput, OperationInput = GetInvoiceInput, OperationOutput = Invoice> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
210
|
+
/** Named connection supplying this operation. */
|
|
211
|
+
connection: Connection<{
|
|
212
|
+
getInvoice(): Query<OperationInput, OperationOutput>;
|
|
213
|
+
}>;
|
|
214
|
+
/** Name matching the bound connection. */
|
|
215
|
+
connectionName: string;
|
|
216
|
+
/** The invoice was read. */
|
|
217
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
218
|
+
/** The invoice does not exist in the company or was deleted. */
|
|
219
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
220
|
+
/** QuickBooks conclusively rejected the read, such as a revoked connection. */
|
|
221
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
222
|
+
/** QuickBooks returned an invalid or oversized invoice. */
|
|
223
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
224
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
225
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
226
|
+
}
|
|
227
|
+
/** Build the getInvoice Step from a named connection. */
|
|
228
|
+
declare function newGetInvoiceStep<StepInput, OperationInput = GetInvoiceInput, OperationOutput = Invoice>(configuration: GetInvoiceStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
229
|
+
/** Configuration for the listInvoices connector Step. */
|
|
230
|
+
interface ListInvoicesStepConfig<StepInput, OperationInput = ListInvoicesInput, OperationOutput = InvoicePage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
231
|
+
/** Named connection supplying this operation. */
|
|
232
|
+
connection: Connection<{
|
|
233
|
+
listInvoices(): Query<OperationInput, OperationOutput>;
|
|
234
|
+
}>;
|
|
235
|
+
/** Name matching the bound connection. */
|
|
236
|
+
connectionName: string;
|
|
237
|
+
/** One page of matching invoices was read; it can be empty. */
|
|
238
|
+
listed: StepTarget<QueryResult<OperationOutput>>;
|
|
239
|
+
/** QuickBooks conclusively rejected the query, such as a revoked connection. */
|
|
240
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
241
|
+
/** QuickBooks returned an invalid or oversized page of invoices. */
|
|
242
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
243
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
244
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
245
|
+
}
|
|
246
|
+
/** Build the listInvoices Step from a named connection. */
|
|
247
|
+
declare function newListInvoicesStep<StepInput, OperationInput = ListInvoicesInput, OperationOutput = InvoicePage>(configuration: ListInvoicesStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
248
|
+
/** Configuration for the sendInvoice connector Step. */
|
|
249
|
+
interface SendInvoiceStepConfig<StepInput, OperationInput = SendInvoiceInput, OperationOutput = Invoice> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
250
|
+
/** Named connection supplying this operation. */
|
|
251
|
+
connection: Connection<{
|
|
252
|
+
sendInvoice(): Mutation<OperationInput, OperationOutput>;
|
|
253
|
+
}>;
|
|
254
|
+
/** Name matching the bound connection. */
|
|
255
|
+
connectionName: string;
|
|
256
|
+
/** QuickBooks emailed the invoice, or returned the delivery this Step already made, with EmailStatus EmailSent. */
|
|
257
|
+
sent: StepTarget<MutationResult<OperationOutput>>;
|
|
258
|
+
/** QuickBooks conclusively rejected the delivery, such as an invoice without an address, a deleted invoice, or a revoked connection; nothing was sent. */
|
|
259
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
260
|
+
/** QuickBooks accepted the request but returned an unusable invoice that read-back could not confirm; check its EmailStatus with getInvoice before sending again. */
|
|
261
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
262
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
263
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
264
|
+
}
|
|
265
|
+
/** Build the sendInvoice Step from a named connection. */
|
|
266
|
+
declare function newSendInvoiceStep<StepInput, OperationInput = SendInvoiceInput, OperationOutput = Invoice>(configuration: SendInvoiceStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
267
|
+
/** Configuration for the recordPayment connector Step. */
|
|
268
|
+
interface RecordPaymentStepConfig<StepInput, OperationInput = RecordPaymentInput, OperationOutput = Payment> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
269
|
+
/** Named connection supplying this operation. */
|
|
270
|
+
connection: Connection<{
|
|
271
|
+
recordPayment(): Mutation<OperationInput, OperationOutput>;
|
|
272
|
+
}>;
|
|
273
|
+
/** Name matching the bound connection. */
|
|
274
|
+
connectionName: string;
|
|
275
|
+
/** QuickBooks recorded the payment, or returned the payment this Step already recorded, with the invoices it applies to. */
|
|
276
|
+
recorded: StepTarget<MutationResult<OperationOutput>>;
|
|
277
|
+
/** QuickBooks conclusively rejected the payment, such as an invoice of another customer, an amount above the balance, an invalid deposit account, a closed period, or a revoked connection; nothing was recorded. */
|
|
278
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
279
|
+
/** QuickBooks accepted the request but returned an unusable payment that read-back could not confirm; inspect the invoice before paying again. */
|
|
280
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
281
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
282
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
283
|
+
}
|
|
284
|
+
/** Build the recordPayment Step from a named connection. */
|
|
285
|
+
declare function newRecordPaymentStep<StepInput, OperationInput = RecordPaymentInput, OperationOutput = Payment>(configuration: RecordPaymentStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
286
|
+
|
|
287
|
+
/** Stable connector identity. */
|
|
288
|
+
declare const ConnectorID = "quickbooks";
|
|
289
|
+
/** Provider identity for named connections. */
|
|
290
|
+
declare const ProviderID = "quickbooks";
|
|
291
|
+
/** Branch IDs for findCustomer. */
|
|
292
|
+
declare const FindCustomerBranch: {
|
|
293
|
+
readonly Found: "found";
|
|
294
|
+
readonly NotFound: "notFound";
|
|
295
|
+
readonly Ambiguous: "ambiguous";
|
|
296
|
+
readonly ProviderRejected: "providerRejected";
|
|
297
|
+
readonly InvalidResponse: "invalidResponse";
|
|
298
|
+
readonly Defect: "defect";
|
|
299
|
+
};
|
|
300
|
+
/** Exactly one customer matches. */
|
|
301
|
+
declare const FindCustomerBranchFound: "found";
|
|
302
|
+
/** No customer matches; inactive customers count only when the input includes them. */
|
|
303
|
+
declare const FindCustomerBranchNotFound: "notFound";
|
|
304
|
+
/** Several customers share the email address; the output lists them so the application can choose. */
|
|
305
|
+
declare const FindCustomerBranchAmbiguous: "ambiguous";
|
|
306
|
+
/** QuickBooks conclusively rejected the query, such as a revoked connection or a company the app can no longer reach. */
|
|
307
|
+
declare const FindCustomerBranchProviderRejected: "providerRejected";
|
|
308
|
+
/** QuickBooks returned an invalid or oversized customer list. */
|
|
309
|
+
declare const FindCustomerBranchInvalidResponse: "invalidResponse";
|
|
310
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
311
|
+
declare const FindCustomerBranchDefect: "defect";
|
|
312
|
+
/** Manifest definition for findCustomer. */
|
|
313
|
+
declare const FindCustomerDefinition: QueryDefinition;
|
|
314
|
+
/** Manifest metadata for findCustomer. */
|
|
315
|
+
declare const FindCustomerMetadata: {
|
|
316
|
+
readonly kind: "query";
|
|
317
|
+
readonly idempotency: "none";
|
|
318
|
+
readonly authorization: "required";
|
|
319
|
+
};
|
|
320
|
+
/** Branch IDs for createCustomer. */
|
|
321
|
+
declare const CreateCustomerBranch: {
|
|
322
|
+
readonly Created: "created";
|
|
323
|
+
readonly NameConflict: "nameConflict";
|
|
324
|
+
readonly ProviderRejected: "providerRejected";
|
|
325
|
+
readonly Uncertain: "uncertain";
|
|
326
|
+
readonly Defect: "defect";
|
|
327
|
+
};
|
|
328
|
+
/** QuickBooks created the customer, or returned the customer this Step already created. */
|
|
329
|
+
declare const CreateCustomerBranchCreated: "created";
|
|
330
|
+
/** A customer, vendor, or employee already uses the display name (QuickBooks error 6240); resolve it with findCustomer by display name, including a possible earlier attempt. */
|
|
331
|
+
declare const CreateCustomerBranchNameConflict: "nameConflict";
|
|
332
|
+
/** QuickBooks conclusively rejected the customer, such as an invalid field or a revoked connection; nothing was created. */
|
|
333
|
+
declare const CreateCustomerBranchProviderRejected: "providerRejected";
|
|
334
|
+
/** QuickBooks accepted the request but returned an unusable customer that read-back could not confirm; look it up with findCustomer before creating again. */
|
|
335
|
+
declare const CreateCustomerBranchUncertain: "uncertain";
|
|
336
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
337
|
+
declare const CreateCustomerBranchDefect: "defect";
|
|
338
|
+
/** Manifest definition for createCustomer. */
|
|
339
|
+
declare const CreateCustomerDefinition: MutationDefinition;
|
|
340
|
+
/** Manifest metadata for createCustomer. */
|
|
341
|
+
declare const CreateCustomerMetadata: {
|
|
342
|
+
readonly kind: "mutation";
|
|
343
|
+
readonly idempotency: "required";
|
|
344
|
+
readonly authorization: "required";
|
|
345
|
+
};
|
|
346
|
+
/** Branch IDs for createInvoice. */
|
|
347
|
+
declare const CreateInvoiceBranch: {
|
|
348
|
+
readonly Created: "created";
|
|
349
|
+
readonly ProviderRejected: "providerRejected";
|
|
350
|
+
readonly Uncertain: "uncertain";
|
|
351
|
+
readonly Defect: "defect";
|
|
352
|
+
};
|
|
353
|
+
/** QuickBooks created the invoice, or returned the invoice this Step already created, with its number, total, and balance. */
|
|
354
|
+
declare const CreateInvoiceBranchCreated: "created";
|
|
355
|
+
/** QuickBooks conclusively rejected the invoice, such as an unknown or inactive customer or item, a duplicate document number, a closed period, or a revoked connection; nothing was created. */
|
|
356
|
+
declare const CreateInvoiceBranchProviderRejected: "providerRejected";
|
|
357
|
+
/** QuickBooks accepted the request but returned an unusable invoice that read-back could not confirm; look it up by document number before creating again. */
|
|
358
|
+
declare const CreateInvoiceBranchUncertain: "uncertain";
|
|
359
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
360
|
+
declare const CreateInvoiceBranchDefect: "defect";
|
|
361
|
+
/** Manifest definition for createInvoice. */
|
|
362
|
+
declare const CreateInvoiceDefinition: MutationDefinition;
|
|
363
|
+
/** Manifest metadata for createInvoice. */
|
|
364
|
+
declare const CreateInvoiceMetadata: {
|
|
365
|
+
readonly kind: "mutation";
|
|
366
|
+
readonly idempotency: "required";
|
|
367
|
+
readonly authorization: "required";
|
|
368
|
+
};
|
|
369
|
+
/** Branch IDs for getInvoice. */
|
|
370
|
+
declare const GetInvoiceBranch: {
|
|
371
|
+
readonly Found: "found";
|
|
372
|
+
readonly NotFound: "notFound";
|
|
373
|
+
readonly ProviderRejected: "providerRejected";
|
|
374
|
+
readonly InvalidResponse: "invalidResponse";
|
|
375
|
+
readonly Defect: "defect";
|
|
376
|
+
};
|
|
377
|
+
/** The invoice was read. */
|
|
378
|
+
declare const GetInvoiceBranchFound: "found";
|
|
379
|
+
/** The invoice does not exist in the company or was deleted. */
|
|
380
|
+
declare const GetInvoiceBranchNotFound: "notFound";
|
|
381
|
+
/** QuickBooks conclusively rejected the read, such as a revoked connection. */
|
|
382
|
+
declare const GetInvoiceBranchProviderRejected: "providerRejected";
|
|
383
|
+
/** QuickBooks returned an invalid or oversized invoice. */
|
|
384
|
+
declare const GetInvoiceBranchInvalidResponse: "invalidResponse";
|
|
385
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
386
|
+
declare const GetInvoiceBranchDefect: "defect";
|
|
387
|
+
/** Manifest definition for getInvoice. */
|
|
388
|
+
declare const GetInvoiceDefinition: QueryDefinition;
|
|
389
|
+
/** Manifest metadata for getInvoice. */
|
|
390
|
+
declare const GetInvoiceMetadata: {
|
|
391
|
+
readonly kind: "query";
|
|
392
|
+
readonly idempotency: "none";
|
|
393
|
+
readonly authorization: "required";
|
|
394
|
+
};
|
|
395
|
+
/** Branch IDs for listInvoices. */
|
|
396
|
+
declare const ListInvoicesBranch: {
|
|
397
|
+
readonly Listed: "listed";
|
|
398
|
+
readonly ProviderRejected: "providerRejected";
|
|
399
|
+
readonly InvalidResponse: "invalidResponse";
|
|
400
|
+
readonly Defect: "defect";
|
|
401
|
+
};
|
|
402
|
+
/** One page of matching invoices was read; it can be empty. */
|
|
403
|
+
declare const ListInvoicesBranchListed: "listed";
|
|
404
|
+
/** QuickBooks conclusively rejected the query, such as a revoked connection. */
|
|
405
|
+
declare const ListInvoicesBranchProviderRejected: "providerRejected";
|
|
406
|
+
/** QuickBooks returned an invalid or oversized page of invoices. */
|
|
407
|
+
declare const ListInvoicesBranchInvalidResponse: "invalidResponse";
|
|
408
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
409
|
+
declare const ListInvoicesBranchDefect: "defect";
|
|
410
|
+
/** Manifest definition for listInvoices. */
|
|
411
|
+
declare const ListInvoicesDefinition: QueryDefinition;
|
|
412
|
+
/** Manifest metadata for listInvoices. */
|
|
413
|
+
declare const ListInvoicesMetadata: {
|
|
414
|
+
readonly kind: "query";
|
|
415
|
+
readonly idempotency: "none";
|
|
416
|
+
readonly authorization: "required";
|
|
417
|
+
};
|
|
418
|
+
/** Branch IDs for sendInvoice. */
|
|
419
|
+
declare const SendInvoiceBranch: {
|
|
420
|
+
readonly Sent: "sent";
|
|
421
|
+
readonly ProviderRejected: "providerRejected";
|
|
422
|
+
readonly Uncertain: "uncertain";
|
|
423
|
+
readonly Defect: "defect";
|
|
424
|
+
};
|
|
425
|
+
/** QuickBooks emailed the invoice, or returned the delivery this Step already made, with EmailStatus EmailSent. */
|
|
426
|
+
declare const SendInvoiceBranchSent: "sent";
|
|
427
|
+
/** QuickBooks conclusively rejected the delivery, such as an invoice without an address, a deleted invoice, or a revoked connection; nothing was sent. */
|
|
428
|
+
declare const SendInvoiceBranchProviderRejected: "providerRejected";
|
|
429
|
+
/** QuickBooks accepted the request but returned an unusable invoice that read-back could not confirm; check its EmailStatus with getInvoice before sending again. */
|
|
430
|
+
declare const SendInvoiceBranchUncertain: "uncertain";
|
|
431
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
432
|
+
declare const SendInvoiceBranchDefect: "defect";
|
|
433
|
+
/** Manifest definition for sendInvoice. */
|
|
434
|
+
declare const SendInvoiceDefinition: MutationDefinition;
|
|
435
|
+
/** Manifest metadata for sendInvoice. */
|
|
436
|
+
declare const SendInvoiceMetadata: {
|
|
437
|
+
readonly kind: "mutation";
|
|
438
|
+
readonly idempotency: "required";
|
|
439
|
+
readonly authorization: "required";
|
|
440
|
+
};
|
|
441
|
+
/** Branch IDs for recordPayment. */
|
|
442
|
+
declare const RecordPaymentBranch: {
|
|
443
|
+
readonly Recorded: "recorded";
|
|
444
|
+
readonly ProviderRejected: "providerRejected";
|
|
445
|
+
readonly Uncertain: "uncertain";
|
|
446
|
+
readonly Defect: "defect";
|
|
447
|
+
};
|
|
448
|
+
/** QuickBooks recorded the payment, or returned the payment this Step already recorded, with the invoices it applies to. */
|
|
449
|
+
declare const RecordPaymentBranchRecorded: "recorded";
|
|
450
|
+
/** QuickBooks conclusively rejected the payment, such as an invoice of another customer, an amount above the balance, an invalid deposit account, a closed period, or a revoked connection; nothing was recorded. */
|
|
451
|
+
declare const RecordPaymentBranchProviderRejected: "providerRejected";
|
|
452
|
+
/** QuickBooks accepted the request but returned an unusable payment that read-back could not confirm; inspect the invoice before paying again. */
|
|
453
|
+
declare const RecordPaymentBranchUncertain: "uncertain";
|
|
454
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
455
|
+
declare const RecordPaymentBranchDefect: "defect";
|
|
456
|
+
/** Manifest definition for recordPayment. */
|
|
457
|
+
declare const RecordPaymentDefinition: MutationDefinition;
|
|
458
|
+
/** Manifest metadata for recordPayment. */
|
|
459
|
+
declare const RecordPaymentMetadata: {
|
|
460
|
+
readonly kind: "mutation";
|
|
461
|
+
readonly idempotency: "required";
|
|
462
|
+
readonly authorization: "required";
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Open a named QuickBooks project connection with generated OAuth credential decoders. options, such as an
|
|
467
|
+
* invoiceChanged logger or a local provider URL for verification, apply to the connection's client.
|
|
468
|
+
*/
|
|
469
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: QuickBooksClientOptions): Connection<Operations>;
|
|
470
|
+
|
|
471
|
+
/** An invoice at its first version: QuickBooks reports SyncToken 0. */
|
|
472
|
+
declare const InvoiceChangeCreated = "created";
|
|
473
|
+
/**
|
|
474
|
+
* Any later version, including an edit, an applied payment that lowers Balance, an email that sets EmailStatus,
|
|
475
|
+
* and a void that zeroes the amounts. An invoice created and edited between two polls arrives once, as updated.
|
|
476
|
+
*/
|
|
477
|
+
declare const InvoiceChangeUpdated = "updated";
|
|
478
|
+
/** The derived kind of one invoiceChanged delivery. */
|
|
479
|
+
type InvoiceChangeKind = typeof InvoiceChangeCreated | typeof InvoiceChangeUpdated;
|
|
480
|
+
/**
|
|
481
|
+
* The invoiceChanged binding configuration. A binding watches every invoice of the connection's company, so it has
|
|
482
|
+
* no fields; an application narrows the changes it starts Flows for in its Trigger target's accept function.
|
|
483
|
+
*/
|
|
484
|
+
declare const InvoiceChangedTriggerConfigurationSchema: z.ZodObject<{}, z.core.$strict>;
|
|
485
|
+
/** The validated invoiceChanged binding configuration. */
|
|
486
|
+
type InvoiceChangedTriggerConfiguration = z.infer<typeof InvoiceChangedTriggerConfigurationSchema>;
|
|
487
|
+
/**
|
|
488
|
+
* One invoice version read by the invoiceChanged poll; field names match the Go connector. QuickBooks's invoice
|
|
489
|
+
* query does not return deleted invoices, so a deletion is never delivered.
|
|
490
|
+
*/
|
|
491
|
+
declare const InvoiceChangedEventSchema: z.ZodObject<{
|
|
492
|
+
realmId: z.ZodString;
|
|
493
|
+
environment: z.ZodString;
|
|
494
|
+
changeKind: z.ZodEnum<{
|
|
495
|
+
created: "created";
|
|
496
|
+
updated: "updated";
|
|
497
|
+
}>;
|
|
498
|
+
invoice: z.ZodObject<{
|
|
499
|
+
invoiceId: z.ZodString;
|
|
500
|
+
syncToken: z.ZodOptional<z.ZodString>;
|
|
501
|
+
docNumber: z.ZodOptional<z.ZodString>;
|
|
502
|
+
customerId: z.ZodString;
|
|
503
|
+
customerName: z.ZodOptional<z.ZodString>;
|
|
504
|
+
txnDate: z.ZodOptional<z.ZodString>;
|
|
505
|
+
dueDate: z.ZodOptional<z.ZodString>;
|
|
506
|
+
currencyCode: z.ZodOptional<z.ZodString>;
|
|
507
|
+
exchangeRate: z.ZodOptional<z.ZodString>;
|
|
508
|
+
lines: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
509
|
+
lineId: z.ZodOptional<z.ZodString>;
|
|
510
|
+
detailType: z.ZodString;
|
|
511
|
+
description: z.ZodOptional<z.ZodString>;
|
|
512
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
513
|
+
itemId: z.ZodOptional<z.ZodString>;
|
|
514
|
+
itemName: z.ZodOptional<z.ZodString>;
|
|
515
|
+
quantity: z.ZodOptional<z.ZodString>;
|
|
516
|
+
unitPrice: z.ZodOptional<z.ZodString>;
|
|
517
|
+
taxCodeId: z.ZodOptional<z.ZodString>;
|
|
518
|
+
serviceDate: z.ZodOptional<z.ZodString>;
|
|
519
|
+
}, z.core.$strict>>>;
|
|
520
|
+
totalAmount: z.ZodString;
|
|
521
|
+
totalTax: z.ZodOptional<z.ZodString>;
|
|
522
|
+
balance: z.ZodString;
|
|
523
|
+
emailStatus: z.ZodOptional<z.ZodString>;
|
|
524
|
+
billEmail: z.ZodOptional<z.ZodString>;
|
|
525
|
+
deliveredAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
526
|
+
customerMemo: z.ZodOptional<z.ZodString>;
|
|
527
|
+
privateNote: z.ZodOptional<z.ZodString>;
|
|
528
|
+
linkedPaymentIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
529
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
530
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
531
|
+
}, z.core.$strict>;
|
|
532
|
+
}, z.core.$strip>;
|
|
533
|
+
/** One created or changed QuickBooks invoice version. */
|
|
534
|
+
type InvoiceChangedEvent = z.infer<typeof InvoiceChangedEventSchema>;
|
|
535
|
+
/** Manifest definition of invoiceChanged. */
|
|
536
|
+
declare const InvoiceChangedTriggerDefinition: TriggerDefinition;
|
|
537
|
+
/** One static application binding of invoiceChanged. */
|
|
538
|
+
interface InvoiceChangedTriggerBindingConfig {
|
|
539
|
+
/** Static connection name. */ connectionName: string;
|
|
540
|
+
/** Static binding name. */ bindingName: string;
|
|
541
|
+
/** Connector Studio configuration units; invoiceChanged has none, so omit it. */ configurationUI?: ConnectorConfigurationUI;
|
|
542
|
+
}
|
|
543
|
+
/** Declare a static invoiceChanged binding for Flow Definition tooling and Dex Web. */
|
|
544
|
+
declare function defineInvoiceChangedTriggerBinding(config: InvoiceChangedTriggerBindingConfig): TriggerBindingDefinition;
|
|
545
|
+
|
|
546
|
+
/** How far before the newest delivered LastUpdatedTime each invoiceChanged poll rereads, in milliseconds. */
|
|
547
|
+
declare const InvoiceChangeLookbackMs = 30000;
|
|
548
|
+
/** The most invoice versions the invoiceChanged cursor remembers inside the lookback window. */
|
|
549
|
+
declare const MaximumSeenInvoiceVersions = 1000;
|
|
550
|
+
/** Thrown for an invoiceChanged cursor token that is not a valid Go cursor document. */
|
|
551
|
+
declare class InvoiceChangeCursorInvalidError extends Error {
|
|
552
|
+
/** Describe the rejected token without echoing it. */
|
|
553
|
+
constructor(message?: string);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/** The MAXRESULTS of each invoiceChanged query; QuickBooks itself accepts up to 1000. */
|
|
557
|
+
declare const InvoiceChangePageSize = 100;
|
|
558
|
+
/** Name one invoice version as "<Id>:<SyncToken>", as the cursor stores it. */
|
|
559
|
+
declare function invoiceVersionKey(invoice: Invoice): string;
|
|
560
|
+
/**
|
|
561
|
+
* Return the Trigger event ID, a hash of the environment, company, Id, SyncToken, and LastUpdatedTime second. It is
|
|
562
|
+
* a pure function of the invoice version, so a refetch after a crash yields the same ID.
|
|
563
|
+
*/
|
|
564
|
+
declare function invoiceChangeEventId(realmId: string, environment: string, invoice: Invoice): string;
|
|
565
|
+
/**
|
|
566
|
+
* Polls one company's invoices ordered by MetaData.LastUpdatedTime for the poll Trigger kit, at parity with the Go
|
|
567
|
+
* connector: the cursor is a LastUpdatedTime window rereading 30 seconds before the newest change and the
|
|
568
|
+
* "<Id>:<SyncToken>" versions delivered inside it, encoded as Go's cursor document byte for byte. A poller owns one
|
|
569
|
+
* fetcher and calls it one poll at a time.
|
|
570
|
+
*/
|
|
571
|
+
declare class InvoiceChangeFetcher implements ChangeFetcher<TriggerEvent<InvoiceChangedEvent>> {
|
|
572
|
+
private readonly client;
|
|
573
|
+
private readonly connection;
|
|
574
|
+
/** Bind the fetcher to one connection's client. */
|
|
575
|
+
constructor(client: QuickBooksClient, connection: ConnectionRef);
|
|
576
|
+
/**
|
|
577
|
+
* Record every version in the 30 seconds before the newest LastUpdatedTime as the baseline, so existing invoices
|
|
578
|
+
* are never delivered; an empty company delivers its first invoice.
|
|
579
|
+
*/
|
|
580
|
+
seedCursor(context: TriggerContext): Promise<Cursor>;
|
|
581
|
+
/**
|
|
582
|
+
* Read one page of invoices changed at or after the window's lower bound, oldest first, skipping versions already
|
|
583
|
+
* delivered or baselined. An undecodable cursor, one for another company or environment, or a QuickBooks
|
|
584
|
+
* validation Fault for the watermark query rejects with markCursorInvalid, so the kit records a new baseline; a
|
|
585
|
+
* 429 rejects with markRateLimited.
|
|
586
|
+
*/
|
|
587
|
+
fetchChanges(context: TriggerContext, cursor: Cursor): Promise<ChangePage<TriggerEvent<InvoiceChangedEvent>>>;
|
|
588
|
+
private queryInvoices;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/** Binds one invoiceChanged binding to its application target and cursor. */
|
|
592
|
+
interface InvoiceChangedTriggerRoute {
|
|
593
|
+
/** The stable application binding name, unique within the runner. */ bindingName: string;
|
|
594
|
+
/** The binding configuration; it has no fields today, so a binding watches every invoice. */ configuration?: InvoiceChangedTriggerConfiguration;
|
|
595
|
+
/**
|
|
596
|
+
* Routes each invoice change into the application. A durable target from newDurableTriggerTarget records each
|
|
597
|
+
* change before the cursor commits past it; any other target consumes it first.
|
|
598
|
+
*/
|
|
599
|
+
target: TriggerTarget<InvoiceChangedEvent>;
|
|
600
|
+
/**
|
|
601
|
+
* Stores the binding's watermark, such as LoadedProject.pollCursorStore. Omitted keeps it in memory, so every
|
|
602
|
+
* process start records a new baseline and changes made while stopped are lost.
|
|
603
|
+
*/
|
|
604
|
+
cursor?: CursorStore;
|
|
605
|
+
}
|
|
606
|
+
/** Configures every QuickBooks Trigger binding polled through one connection. */
|
|
607
|
+
interface InvoiceTriggerRunnerConfig {
|
|
608
|
+
/** A connection from newConnection with a QuickBooksClient or from newProjectConnection; a mock has no client. */ connection: Connection;
|
|
609
|
+
/** The invoiceChanged bindings; at least one is required. */ invoiceChangedRoutes: InvoiceChangedTriggerRoute[];
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Create one poll runner for the configured invoiceChanged bindings. run replays each durable target, records a
|
|
613
|
+
* baseline for a binding without a cursor, then polls every binding each pollInterval with jitter, one QuickBooks
|
|
614
|
+
* query of at most 100 invoices per request and at most ten pages per poll. Each poll rereads the 30 seconds before
|
|
615
|
+
* the newest change delivered, so a write QuickBooks made visible after an earlier poll still arrives. A 429 pauses
|
|
616
|
+
* every binding of the connection for Retry-After, or 60 seconds without it; other failures back off per binding. A
|
|
617
|
+
* cursor for another company or environment, or a QuickBooks validation Fault for the watermark query, records a
|
|
618
|
+
* new baseline and logs a WARN record; changes in that gap are not delivered. Delivery is at least once, and each
|
|
619
|
+
* invoice version keeps one Trigger event ID. Throws for a missing or mock connection, no routes, a blank binding
|
|
620
|
+
* name, a missing target, or an invalid configuration.
|
|
621
|
+
*/
|
|
622
|
+
declare function newInvoiceTriggerRunner(config: InvoiceTriggerRunnerConfig): Runner;
|
|
623
|
+
/** Validate an invoiceChanged configuration; throws for any field, since the binding has none. */
|
|
624
|
+
declare function parseInvoiceChangedTriggerConfiguration(configuration: unknown): InvoiceChangedTriggerConfiguration;
|
|
625
|
+
/** Decode a replayed Trigger inbox payload that the Go or TypeScript connector recorded. */
|
|
626
|
+
declare function decodeInvoiceChangedEventPayload(payloadJSON: string): InvoiceChangedEvent;
|
|
627
|
+
/** Selects one invoiceChanged binding of the project configuration. */
|
|
628
|
+
interface ProjectInvoiceChangedTriggerRoute {
|
|
629
|
+
/** The binding name. */ bindingName: string;
|
|
630
|
+
/** Routes each change into the application, usually newDexFlowTriggerTarget. */ target: TriggerTarget<InvoiceChangedEvent>;
|
|
631
|
+
}
|
|
632
|
+
/** Selects QuickBooks Trigger bindings of the project configuration. */
|
|
633
|
+
interface ProjectInvoiceTriggerRunnerConfig {
|
|
634
|
+
/** The invoiceChanged bindings; at least one is required. */ invoiceChangedRoutes: ProjectInvoiceChangedTriggerRoute[];
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Create a durable runner for invoiceChanged bindings of the loaded project. connection is the project connection
|
|
638
|
+
* from newProjectConnection(project, name); its client options, such as logger, also apply to the durable inboxes.
|
|
639
|
+
* Each route records changes in its binding's project Trigger inbox before its watermark commits in the binding's
|
|
640
|
+
* project poll cursor, so a restarted or replaced replica neither misses nor repeats a change. A binding without
|
|
641
|
+
* saved configuration is valid. Throws as newInvoiceTriggerRunner does and for an invalid saved configuration.
|
|
642
|
+
*/
|
|
643
|
+
declare function newProjectInvoiceTriggerRunner(project: LoadedProject, connection: Connection, config: ProjectInvoiceTriggerRunnerConfig): Runner;
|
|
644
|
+
/** Configuration of one in-memory invoiceChanged Trigger. */
|
|
645
|
+
interface InvoiceChangedTriggerConfig {
|
|
646
|
+
/** A connection with a QuickBooksClient. */ connection: Connection;
|
|
647
|
+
/** Static connection name; must equal the connection's name. */ connectionName: string;
|
|
648
|
+
/** Static binding name. */ bindingName: string;
|
|
649
|
+
/** The binding configuration; it has no fields today. */ configuration?: InvoiceChangedTriggerConfiguration;
|
|
650
|
+
/** Routes accepted changes into the application. */ target: TriggerTarget<InvoiceChangedEvent>;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Create one invoiceChanged Trigger with an in-memory cursor, as Go's generated NewInvoiceChangedTrigger. It has no
|
|
654
|
+
* project storage, so it records a new baseline on every start and changes made while it is stopped are lost; use
|
|
655
|
+
* newProjectInvoiceTriggerRunner for durable delivery. Throws when connectionName differs from the connection's
|
|
656
|
+
* name, for a mock connection, or for an invalid configuration.
|
|
657
|
+
*/
|
|
658
|
+
declare function newInvoiceChangedTrigger(config: InvoiceChangedTriggerConfig): TriggerRunner;
|
|
659
|
+
|
|
660
|
+
export { Config, Connection, ConnectorID, CreateCustomerBranch, CreateCustomerBranchCreated, CreateCustomerBranchDefect, CreateCustomerBranchNameConflict, CreateCustomerBranchProviderRejected, CreateCustomerBranchUncertain, CreateCustomerDefinition, CreateCustomerInput, CreateCustomerMetadata, CreateCustomerOutput, type CreateCustomerStepConfig, CreateInvoiceBranch, CreateInvoiceBranchCreated, CreateInvoiceBranchDefect, CreateInvoiceBranchProviderRejected, CreateInvoiceBranchUncertain, CreateInvoiceDefinition, CreateInvoiceInput, CreateInvoiceMetadata, CreateInvoiceOutput, type CreateInvoiceStepConfig, CredentialSource, FindCustomerBranch, FindCustomerBranchAmbiguous, FindCustomerBranchDefect, FindCustomerBranchFound, FindCustomerBranchInvalidResponse, FindCustomerBranchNotFound, FindCustomerBranchProviderRejected, FindCustomerDefinition, FindCustomerInput, FindCustomerMetadata, FindCustomerOutput, type FindCustomerStepConfig, GetInvoiceBranch, GetInvoiceBranchDefect, GetInvoiceBranchFound, GetInvoiceBranchInvalidResponse, GetInvoiceBranchNotFound, GetInvoiceBranchProviderRejected, GetInvoiceDefinition, GetInvoiceInput, GetInvoiceMetadata, type GetInvoiceStepConfig, Invoice, InvoiceChangeCreated, InvoiceChangeCursorInvalidError, InvoiceChangeFetcher, type InvoiceChangeKind, InvoiceChangeLookbackMs, InvoiceChangePageSize, InvoiceChangeUpdated, type InvoiceChangedEvent, InvoiceChangedEventSchema, type InvoiceChangedTriggerBindingConfig, type InvoiceChangedTriggerConfig, type InvoiceChangedTriggerConfiguration, InvoiceChangedTriggerConfigurationSchema, InvoiceChangedTriggerDefinition, type InvoiceChangedTriggerRoute, InvoicePage, type InvoiceTriggerRunnerConfig, ListInvoicesBranch, ListInvoicesBranchDefect, ListInvoicesBranchInvalidResponse, ListInvoicesBranchListed, ListInvoicesBranchProviderRejected, ListInvoicesDefinition, ListInvoicesInput, ListInvoicesMetadata, type ListInvoicesStepConfig, MaximumSeenInvoiceVersions, Payment, type ProjectInvoiceChangedTriggerRoute, type ProjectInvoiceTriggerRunnerConfig, ProviderID, QuickBooksClient, type QuickBooksClientOptions, RecordPaymentBranch, RecordPaymentBranchDefect, RecordPaymentBranchProviderRejected, RecordPaymentBranchRecorded, RecordPaymentBranchUncertain, RecordPaymentDefinition, RecordPaymentInput, RecordPaymentMetadata, type RecordPaymentStepConfig, SendInvoiceBranch, SendInvoiceBranchDefect, SendInvoiceBranchProviderRejected, SendInvoiceBranchSent, SendInvoiceBranchUncertain, SendInvoiceDefinition, SendInvoiceInput, SendInvoiceMetadata, type SendInvoiceStepConfig, decodeInvoiceChangedEventPayload, defineInvoiceChangedTriggerBinding, invoiceChangeEventId, invoiceVersionKey, newCreateCustomerStep, newCreateInvoiceStep, newFindCustomerStep, newGetInvoiceStep, newInvoiceChangedTrigger, newInvoiceTriggerRunner, newListInvoicesStep, newProjectConnection, newProjectInvoiceTriggerRunner, newRecordPaymentStep, newSendInvoiceStep, parseInvoiceChangedTriggerConfiguration };
|