@substrat-run/connector-fortnox 0.5.8 → 0.7.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/README.md +3 -2
- package/dist/api.d.ts +61 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +117 -5
- package/dist/api.js.map +1 -1
- package/dist/index.d.ts +250 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +745 -30
- package/dist/index.js.map +1 -1
- package/dist/mock.d.ts +23 -0
- package/dist/mock.d.ts.map +1 -1
- package/dist/mock.js +70 -3
- package/dist/mock.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type ConnectionActivity, type ConnectionCredential, type ConnectionProbe, type ConnectionId } from '@substrat-run/contracts';
|
|
3
3
|
import type { FetchLike, ScopeHost } from '@substrat-run/kernel';
|
|
4
|
-
export { FortnoxApi, FortnoxApiError, FORTNOX_API_BASE, FORTNOX_OAUTH_BASE, fortnoxConsentUrl, fortnoxSecret, type FortnoxCompany, type FortnoxFinancialYear, type FortnoxSecret, type FortnoxApiOptions, type FortnoxSupplierInvoice, } from './api.js';
|
|
4
|
+
export { FortnoxApi, FortnoxApiError, FORTNOX_API_BASE, FORTNOX_OAUTH_BASE, fortnoxConsentUrl, fortnoxSecret, type FortnoxCompany, type FortnoxFinancialYear, type FortnoxSecret, type FortnoxApiOptions, type FortnoxSupplierInvoice, type FortnoxSupplierInvoiceFile, } from './api.js';
|
|
5
5
|
export { parseSie4, splitSieLine, sieAmount, sieDate, type SieAccount, type SieDimension, type SieLedger, type SieObject, type SieTransaction, type SieVoucher, } from './sie4.js';
|
|
6
6
|
export { COST_CENTRE_DIMENSION, financialYearFor, summarizeLedger, type LedgerBalance, type LedgerSummary, } from './aggregate.js';
|
|
7
7
|
export { FortnoxMock, type FortnoxMockOptions, type FortnoxMockSupplierInvoice } from './mock.js';
|
|
@@ -84,6 +84,27 @@ export interface FortnoxBinding {
|
|
|
84
84
|
permission: string;
|
|
85
85
|
/** Absent on pre-kind bindings, which are ledger bindings. */
|
|
86
86
|
kind?: 'ledger' | 'supplier-invoice';
|
|
87
|
+
/**
|
|
88
|
+
* What a ledger binding lands. Absent is `'summary'`: the monthly sums of {@link fortnoxLedgerPage}.
|
|
89
|
+
* `'sie'` is the year's whole SIE4 file, {@link fortnoxSieFile}, for a vertical that keeps what the
|
|
90
|
+
* sums leave out: opening and closing balances, and the vouchers themselves.
|
|
91
|
+
*/
|
|
92
|
+
form?: FortnoxLedgerForm;
|
|
93
|
+
/**
|
|
94
|
+
* How many financial years before the current one a `form: 'sie'` binding keeps, or `'all'`.
|
|
95
|
+
* Absent is none: the current year alone, as a summary binding has.
|
|
96
|
+
*/
|
|
97
|
+
years?: FortnoxLedgerYears;
|
|
98
|
+
/**
|
|
99
|
+
* How far back an invoice binding's first pass reads: a number of days, or `'all'` for every
|
|
100
|
+
* invoice the company has. Absent means {@link INVOICE_FIRST_LOOKBACK_DAYS}.
|
|
101
|
+
*/
|
|
102
|
+
firstPass?: FortnoxInvoiceFirstPass;
|
|
103
|
+
/**
|
|
104
|
+
* The operations an invoice binding writes back through. Absent, the binding writes nothing to
|
|
105
|
+
* Fortnox. See {@link fortnoxInvoiceWriteback}.
|
|
106
|
+
*/
|
|
107
|
+
writeback?: FortnoxInvoiceWritebackOperations;
|
|
87
108
|
/**
|
|
88
109
|
* WHICH company's connection reads the books (#2316): the connection's `externalAccountRef`.
|
|
89
110
|
*
|
|
@@ -108,10 +129,27 @@ export interface FortnoxBinding {
|
|
|
108
129
|
contentHash: string;
|
|
109
130
|
balances: number;
|
|
110
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* What a `form: 'sie'` binding has landed, per financial year id. `syncedAt` moves when the year
|
|
134
|
+
* was last read, changed or not, which is how an older year knows it is due.
|
|
135
|
+
*/
|
|
136
|
+
yearSync?: Record<string, {
|
|
137
|
+
syncedAt: string;
|
|
138
|
+
contentHash: string;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* When a `form: 'sie'` binding last failed to land a year, per financial year id, cleared once it
|
|
142
|
+
* lands. An older year waits as long after a failure as after a read, so one the landing keeps
|
|
143
|
+
* refusing does not hold back the years behind it.
|
|
144
|
+
*/
|
|
145
|
+
yearFailedAt?: Record<string, string>;
|
|
111
146
|
/** An invoice binding's cursor (#2422), written only after a landing succeeded. */
|
|
112
147
|
invoiceSync?: {
|
|
113
|
-
/**
|
|
114
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Invoices changed at or after this instant, less {@link INVOICE_OVERLAP_MS}, are read next
|
|
150
|
+
* pass. `null` while a `firstPass: 'all'` run drains: the list then has no filter.
|
|
151
|
+
*/
|
|
152
|
+
since: string | null;
|
|
115
153
|
syncedAt: string;
|
|
116
154
|
/** How many invoices the last landing carried. */
|
|
117
155
|
landed: number;
|
|
@@ -125,6 +163,38 @@ export interface FortnoxBinding {
|
|
|
125
163
|
through: string;
|
|
126
164
|
};
|
|
127
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* An invoice binding's files still to be read, oldest first. Held because an invoice that does
|
|
168
|
+
* not change is never landed again, so nothing else would ask for its file a second time.
|
|
169
|
+
* Bounded: a pass reads what is queued before it lands more. Beside the cursor rather than in it,
|
|
170
|
+
* so a re-bind, which starts the cursor over, keeps what was asked.
|
|
171
|
+
*/
|
|
172
|
+
files?: FortnoxInvoiceFileEntry[];
|
|
173
|
+
}
|
|
174
|
+
/** What a ledger binding lands. See {@link FortnoxBinding.form}. */
|
|
175
|
+
export type FortnoxLedgerForm = 'summary' | 'sie';
|
|
176
|
+
/** How many older years a `form: 'sie'` binding keeps. See {@link FortnoxBinding.years}. */
|
|
177
|
+
export type FortnoxLedgerYears = 'all' | number;
|
|
178
|
+
/** How far back an invoice binding's first pass reads. See {@link FortnoxBinding.firstPass}. */
|
|
179
|
+
export type FortnoxInvoiceFirstPass = 'all' | number;
|
|
180
|
+
/**
|
|
181
|
+
* The vertical's two operations behind an invoice write-back. `read` answers what is waiting and
|
|
182
|
+
* `record` takes the receipt. Both run as the connection, so both check the landing's permission.
|
|
183
|
+
*/
|
|
184
|
+
export interface FortnoxInvoiceWritebackOperations {
|
|
185
|
+
read: string;
|
|
186
|
+
record: string;
|
|
187
|
+
}
|
|
188
|
+
/** One invoice whose file the landing asked for. */
|
|
189
|
+
export interface FortnoxInvoiceFileEntry {
|
|
190
|
+
givenNumber: string;
|
|
191
|
+
/** The entity the file lands on, as the landing named it. */
|
|
192
|
+
entity: {
|
|
193
|
+
entityType: string;
|
|
194
|
+
entityId: string;
|
|
195
|
+
};
|
|
196
|
+
/** Passes that failed to read it. At {@link INVOICE_FILE_ATTEMPTS} it is skipped by name. */
|
|
197
|
+
attempts?: number;
|
|
128
198
|
}
|
|
129
199
|
/**
|
|
130
200
|
* One page of parsed bookkeeping, as it crosses into a scope.
|
|
@@ -170,6 +240,31 @@ export declare const fortnoxLedgerPage: z.ZodObject<{
|
|
|
170
240
|
}, z.core.$strip>>;
|
|
171
241
|
}, z.core.$strip>;
|
|
172
242
|
export type FortnoxLedgerPage = z.infer<typeof fortnoxLedgerPage>;
|
|
243
|
+
/**
|
|
244
|
+
* One financial year's whole SIE4 file, as a `form: 'sie'` binding lands it, in one `invoke`.
|
|
245
|
+
*
|
|
246
|
+
* The file itself, because it already is the neutral statement of the books, and everything a
|
|
247
|
+
* reader could want is in it: the opening and closing balances the sums skip, every voucher, every
|
|
248
|
+
* account name. A vertical that takes uploaded SIE files has a reader for it already, and this way
|
|
249
|
+
* a file from Fortnox and a file from a person go through the same door.
|
|
250
|
+
*
|
|
251
|
+
* Decoded from PC8, so `sie` is text. Parsed on the way out like {@link fortnoxLedgerPage}.
|
|
252
|
+
*/
|
|
253
|
+
export declare const fortnoxSieFile: z.ZodObject<{
|
|
254
|
+
syncId: z.ZodString;
|
|
255
|
+
connectionId: z.ZodString;
|
|
256
|
+
company: z.ZodObject<{
|
|
257
|
+
name: z.ZodString;
|
|
258
|
+
organizationNumber: z.ZodString;
|
|
259
|
+
}, z.core.$strip>;
|
|
260
|
+
financialYear: z.ZodObject<{
|
|
261
|
+
id: z.ZodNumber;
|
|
262
|
+
from: z.ZodString;
|
|
263
|
+
to: z.ZodString;
|
|
264
|
+
}, z.core.$strip>;
|
|
265
|
+
sie: z.ZodString;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
export type FortnoxSieFile = z.infer<typeof fortnoxSieFile>;
|
|
173
268
|
/**
|
|
174
269
|
* The supplier invoices an invoice binding lands (#2422) — one page per pass that found changes.
|
|
175
270
|
*
|
|
@@ -193,11 +288,38 @@ export declare const fortnoxSupplierInvoicePage: z.ZodObject<{
|
|
|
193
288
|
amount: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
194
289
|
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
195
290
|
}, z.core.$strip>;
|
|
291
|
+
balance: z.ZodOptional<z.ZodObject<{
|
|
292
|
+
amount: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
293
|
+
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
294
|
+
}, z.core.$strip>>;
|
|
295
|
+
vat: z.ZodOptional<z.ZodObject<{
|
|
296
|
+
amount: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
297
|
+
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
298
|
+
}, z.core.$strip>>;
|
|
299
|
+
ocr: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
196
300
|
booked: z.ZodBoolean;
|
|
197
301
|
cancelled: z.ZodBoolean;
|
|
302
|
+
credit: z.ZodOptional<z.ZodBoolean>;
|
|
303
|
+
paymentPending: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
+
comments: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
305
|
+
commentLog: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
306
|
+
comment: z.ZodString;
|
|
307
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
308
|
+
userName: z.ZodNullable<z.ZodString>;
|
|
309
|
+
}, z.core.$strip>>>;
|
|
310
|
+
voucher: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
311
|
+
series: z.ZodNullable<z.ZodString>;
|
|
312
|
+
number: z.ZodNumber;
|
|
313
|
+
year: z.ZodNullable<z.ZodNumber>;
|
|
314
|
+
}, z.core.$strip>>>;
|
|
315
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
316
|
+
costCentre: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
198
317
|
rows: z.ZodArray<z.ZodObject<{
|
|
199
318
|
account: z.ZodString;
|
|
319
|
+
accountDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
320
|
costCentre: z.ZodNullable<z.ZodString>;
|
|
321
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
322
|
+
transactionInformation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
201
323
|
amount: z.ZodObject<{
|
|
202
324
|
amount: z.core.$ZodBranded<z.ZodString, "MoneyAmount", "out">;
|
|
203
325
|
currency: z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">;
|
|
@@ -206,6 +328,57 @@ export declare const fortnoxSupplierInvoicePage: z.ZodObject<{
|
|
|
206
328
|
}, z.core.$strip>>;
|
|
207
329
|
}, z.core.$strip>;
|
|
208
330
|
export type FortnoxSupplierInvoicePage = z.infer<typeof fortnoxSupplierInvoicePage>;
|
|
331
|
+
/**
|
|
332
|
+
* What a landing operation may answer. `files` names the invoices whose file the vertical wants
|
|
333
|
+
* and the entity each one lands on, which must be a declared attachment target the connection
|
|
334
|
+
* can write. An answer without it, or that does not parse, asks for no file.
|
|
335
|
+
*/
|
|
336
|
+
export declare const fortnoxSupplierInvoiceLandingAnswer: z.ZodObject<{
|
|
337
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
338
|
+
givenNumber: z.ZodString;
|
|
339
|
+
entity: z.ZodObject<{
|
|
340
|
+
entityType: z.ZodString;
|
|
341
|
+
entityId: z.ZodString;
|
|
342
|
+
}, z.core.$strip>;
|
|
343
|
+
}, z.core.$strip>>>;
|
|
344
|
+
}, z.core.$loose>;
|
|
345
|
+
export type FortnoxSupplierInvoiceLandingAnswer = z.infer<typeof fortnoxSupplierInvoiceLandingAnswer>;
|
|
346
|
+
/**
|
|
347
|
+
* What a binding's `writeback.read` answers when the sweep asks what to write for one company.
|
|
348
|
+
*
|
|
349
|
+
* The sweep asks rather than listens. Asking is what makes a lost pass harmless: what the vertical
|
|
350
|
+
* still answers is what is still to do, and nothing about a decision has to ride an event or sit
|
|
351
|
+
* in a ledger of its own. It reads `{ connectionId, company }`, and a vertical holding several
|
|
352
|
+
* companies answers for that company alone, because `GivenNumber` repeats between companies.
|
|
353
|
+
*
|
|
354
|
+
* The answer is instructions, not vocabulary: what a decision means is the vertical's, and all the
|
|
355
|
+
* connector knows is what to do in Fortnox.
|
|
356
|
+
*/
|
|
357
|
+
export declare const fortnoxInvoiceWriteback: z.ZodObject<{
|
|
358
|
+
hold: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
359
|
+
givenNumber: z.ZodString;
|
|
360
|
+
}, z.core.$strip>>>;
|
|
361
|
+
decisions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
362
|
+
key: z.ZodString;
|
|
363
|
+
givenNumber: z.ZodString;
|
|
364
|
+
book: z.ZodBoolean;
|
|
365
|
+
release: z.ZodBoolean;
|
|
366
|
+
comment: z.ZodNullable<z.ZodString>;
|
|
367
|
+
}, z.core.$strip>>>;
|
|
368
|
+
}, z.core.$strip>;
|
|
369
|
+
export type FortnoxInvoiceWriteback = z.infer<typeof fortnoxInvoiceWriteback>;
|
|
370
|
+
/** What a binding's `writeback.record` receives, once for each decision that is settled. */
|
|
371
|
+
export declare const fortnoxInvoiceWritebackReceipt: z.ZodObject<{
|
|
372
|
+
key: z.ZodString;
|
|
373
|
+
status: z.ZodEnum<{
|
|
374
|
+
done: "done";
|
|
375
|
+
failed: "failed";
|
|
376
|
+
}>;
|
|
377
|
+
error: z.ZodNullable<z.ZodString>;
|
|
378
|
+
}, z.core.$strip>;
|
|
379
|
+
export type FortnoxInvoiceWritebackReceipt = z.infer<typeof fortnoxInvoiceWritebackReceipt>;
|
|
380
|
+
/** How far back a binding's first pass reads when its declaration does not say. */
|
|
381
|
+
export declare const INVOICE_FIRST_LOOKBACK_DAYS = 90;
|
|
209
382
|
export interface FortnoxConnectorOptions {
|
|
210
383
|
fetch: FetchLike;
|
|
211
384
|
apiBase?: string;
|
|
@@ -237,6 +410,14 @@ export declare function bindFortnoxScope(host: ScopeHost, input: {
|
|
|
237
410
|
operation: string;
|
|
238
411
|
permission: string;
|
|
239
412
|
kind?: 'ledger' | 'supplier-invoice';
|
|
413
|
+
/** What a ledger binding lands. See {@link FortnoxBinding.form}. */
|
|
414
|
+
form?: FortnoxLedgerForm;
|
|
415
|
+
/** How many older years it keeps. See {@link FortnoxBinding.years}. */
|
|
416
|
+
years?: FortnoxLedgerYears;
|
|
417
|
+
/** An invoice binding's first pass. See {@link FortnoxBinding.firstPass}. */
|
|
418
|
+
firstPass?: FortnoxInvoiceFirstPass;
|
|
419
|
+
/** An invoice binding's write-back. See {@link FortnoxBinding.writeback}. */
|
|
420
|
+
writeback?: FortnoxInvoiceWritebackOperations;
|
|
240
421
|
/** Internal automatic-pass path: the declaration was checked and its grant follows this write. */
|
|
241
422
|
grantPreflighted?: boolean;
|
|
242
423
|
/** The connection's `externalAccountRef` — the company. See {@link FortnoxBinding.externalAccountRef}. */
|
|
@@ -278,21 +459,62 @@ export declare function syncFortnoxScope(host: ScopeHost, connectionId: Connecti
|
|
|
278
459
|
to: string;
|
|
279
460
|
};
|
|
280
461
|
}): Promise<FortnoxSyncResult>;
|
|
462
|
+
/**
|
|
463
|
+
* Sync ONE `form: 'sie'` binding: land the current year's SIE4 file if it changed, and bring one
|
|
464
|
+
* older year up to date.
|
|
465
|
+
*
|
|
466
|
+
* One older year per pass, because a year is one large download and a pass runs on a timer. A
|
|
467
|
+
* company's history therefore lands newest year first, a year a quarter of an hour, and after that
|
|
468
|
+
* each older year is read once a day: a closed year rarely moves, but nothing stops it moving. A
|
|
469
|
+
* year whose file has not changed lands nothing.
|
|
470
|
+
*
|
|
471
|
+
* Each year is written to the binding right after it lands, so a failure on one costs only that one,
|
|
472
|
+
* and the years that did land are answered beside the ones that failed.
|
|
473
|
+
*/
|
|
474
|
+
export declare function syncFortnoxSieFiles(host: ScopeHost, connectionId: ConnectionId, binding: FortnoxBinding, options: FortnoxConnectorOptions & {
|
|
475
|
+
period?: {
|
|
476
|
+
from: string;
|
|
477
|
+
to: string;
|
|
478
|
+
};
|
|
479
|
+
}): Promise<{
|
|
480
|
+
synced: FortnoxSyncResult[];
|
|
481
|
+
failed: {
|
|
482
|
+
financialYearId: number;
|
|
483
|
+
error: unknown;
|
|
484
|
+
}[];
|
|
485
|
+
}>;
|
|
281
486
|
/** What one invoice binding's pass did. */
|
|
282
487
|
export interface FortnoxInvoiceSyncResult {
|
|
283
488
|
scopeId: string;
|
|
284
489
|
/** Invoices landed this pass; 0 when nothing changed or the pass's budget was spent. */
|
|
285
490
|
landed: number;
|
|
286
|
-
/**
|
|
491
|
+
/** Invoice files landed this pass. */
|
|
492
|
+
files: number;
|
|
493
|
+
/** Files stepped over, and why. Their invoice is asked about again when it next lands. */
|
|
494
|
+
skipped?: {
|
|
495
|
+
givenNumber: string;
|
|
496
|
+
reason: string;
|
|
497
|
+
}[];
|
|
498
|
+
/** Invoices newly held from payment this pass. */
|
|
499
|
+
held: number;
|
|
500
|
+
/** Decisions settled in Fortnox this pass. */
|
|
501
|
+
written: number;
|
|
502
|
+
/** True when changed invoices, queued files or waiting writes are left for a later pass. */
|
|
287
503
|
pending: boolean;
|
|
288
504
|
}
|
|
289
505
|
/**
|
|
290
|
-
* Sync ONE invoice binding (#2422):
|
|
291
|
-
* each one's rows,
|
|
506
|
+
* Sync ONE invoice binding (#2422): read the files earlier passes left, list the supplier invoices
|
|
507
|
+
* changed since its cursor, read each one's rows, land them in one page through the binding's
|
|
508
|
+
* operation as the connection, read the files the landing asked for, then write back what the
|
|
509
|
+
* vertical says is waiting.
|
|
510
|
+
*
|
|
511
|
+
* Read-only toward Fortnox unless the binding declares `writeback`. Reads at most
|
|
512
|
+
* `budget.details` times for invoices and files, oldest number first, and spends from the budget so
|
|
513
|
+
* bindings sharing a pass share Fortnox's rate limit. The cursor is written only after the landing
|
|
514
|
+
* succeeded, so a refused page is read again next pass.
|
|
292
515
|
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
* written only after the landing succeeded, so a refused page is read again next pass.
|
|
516
|
+
* Files come after the cursor, because a file that cannot be read says nothing about the invoice:
|
|
517
|
+
* the invoices keep landing, and the file stays queued and fails the scope's row by its number.
|
|
296
518
|
*/
|
|
297
519
|
export declare function syncFortnoxSupplierInvoices(host: ScopeHost, connectionId: ConnectionId, binding: FortnoxBinding, options: FortnoxConnectorOptions & {
|
|
298
520
|
budget?: {
|
|
@@ -304,13 +526,15 @@ export interface FortnoxSweepResult {
|
|
|
304
526
|
found: number;
|
|
305
527
|
/** Ledger bindings whose books changed and landed. */
|
|
306
528
|
synced: FortnoxSyncResult[];
|
|
307
|
-
/** Invoice bindings that landed invoices. */
|
|
529
|
+
/** Invoice bindings that landed invoices or files, wrote back, or left work for a later pass. */
|
|
308
530
|
invoices: FortnoxInvoiceSyncResult[];
|
|
309
531
|
unchanged: number;
|
|
310
532
|
failed: {
|
|
311
533
|
scopeId: string;
|
|
312
534
|
error: string;
|
|
313
535
|
}[];
|
|
536
|
+
/** Bindings another poll was polling (#2672): skipped this pass, never failed; the next pass polls them. */
|
|
537
|
+
busy: string[];
|
|
314
538
|
}
|
|
315
539
|
/**
|
|
316
540
|
* Poll Fortnox for every scope this connection is bound to — the {@link ConnectorSweeper}
|
|
@@ -331,7 +555,23 @@ export declare function sweepFortnoxLedger(host: ScopeHost, connectionId: Connec
|
|
|
331
555
|
from: string;
|
|
332
556
|
to: string;
|
|
333
557
|
};
|
|
558
|
+
/** Poll only this scope's bindings (#2672): the same pass, budget and deadline, for one scope. */
|
|
559
|
+
scopeId?: string;
|
|
334
560
|
}): Promise<FortnoxSweepResult>;
|
|
561
|
+
/** What polling one scope's bindings on request did (#2672): the sync relay's answer for it. */
|
|
562
|
+
export interface FortnoxScopePoll {
|
|
563
|
+
/** `not-bound` when the scope has no binding on this connection; `in-progress` when another poll holds it. */
|
|
564
|
+
outcome: 'landed' | 'unchanged' | 'failed' | 'not-bound' | 'in-progress';
|
|
565
|
+
/** True when the pass's budget or deadline left work for a later pass. */
|
|
566
|
+
pending: boolean;
|
|
567
|
+
/** On `failed`, each binding's own error: staff's to read, never the tenant's. */
|
|
568
|
+
errors: string[];
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Poll ONE scope's bindings now — {@link sweepFortnoxLedger} narrowed to the scope, so the same
|
|
572
|
+
* budget, deadline and rate window bound it as bound a pass.
|
|
573
|
+
*/
|
|
574
|
+
export declare function pollFortnoxScope(host: ScopeHost, connectionId: ConnectionId, scopeId: string, options: FortnoxConnectorOptions): Promise<FortnoxScopePoll>;
|
|
335
575
|
/**
|
|
336
576
|
* Probe a credential that is not stored yet — the connect-time check (#605).
|
|
337
577
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAWL,KAAK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