nda improvements
This commit is contained in:
@@ -283,11 +283,23 @@ export interface InboxRow {
|
||||
|
||||
export type RefreshState = 'idle' | 'running' | string;
|
||||
|
||||
export interface RefreshResult {
|
||||
pages: number;
|
||||
seen: number;
|
||||
stored: number;
|
||||
}
|
||||
|
||||
export interface Inbox {
|
||||
requests: InboxRow[];
|
||||
/** ISO timestamp of the last completed background refresh, null if never. */
|
||||
last_refresh_at: string | null;
|
||||
refresh_state: RefreshState;
|
||||
/** What the last completed walk did, null before the first one. */
|
||||
last_refresh_result: RefreshResult | null;
|
||||
/** The sync runs in the background too, with the same state pattern. */
|
||||
last_sync_at: string | null;
|
||||
sync_state: RefreshState;
|
||||
last_sync_result: SyncResult | null;
|
||||
}
|
||||
|
||||
export interface ImportResult {
|
||||
@@ -314,7 +326,13 @@ export interface SyncResult {
|
||||
signed: number;
|
||||
declined: number;
|
||||
failed: number;
|
||||
/** Old pending mirror rows re-fetched one by one, and how many had moved on. */
|
||||
mirror_candidates: number;
|
||||
mirror_rechecked: number;
|
||||
mirror_changed: number;
|
||||
mirror_failed: number;
|
||||
warnings: string[];
|
||||
warnings_omitted: number;
|
||||
}
|
||||
|
||||
export class ApiError extends Error {
|
||||
@@ -422,8 +440,12 @@ export const api = {
|
||||
|
||||
/** Reads the mirrored requests out of the database — never calls Dropbox. */
|
||||
ndaInbox: (since: string) => request<Inbox>(`/api/nda-inbox?${qs({ since })}`),
|
||||
/** Starts the background walk; resolves as soon as it is queued. */
|
||||
refreshInbox: (since: string) =>
|
||||
/**
|
||||
* Starts the background walk; resolves as soon as it is queued. Passing
|
||||
* `since` makes the server re-read that whole window — leave it out for the
|
||||
* incremental catch-up, which is what a plain Refresh should do.
|
||||
*/
|
||||
refreshInbox: (since?: string) =>
|
||||
post<{ state: RefreshState }>(`/api/nda-inbox/refresh?${qs({ since })}`),
|
||||
importInbox: (signatureRequestId: string, buyerId?: string, businessId?: string) =>
|
||||
post<ImportResult>('/api/nda-inbox/import', {
|
||||
@@ -431,7 +453,7 @@ export const api = {
|
||||
buyer_id: buyerId,
|
||||
business_id: businessId,
|
||||
}),
|
||||
syncInbox: () => post<SyncResult>('/api/nda-inbox/sync'),
|
||||
syncInbox: () => post<{ state: RefreshState }>('/api/nda-inbox/sync'),
|
||||
backfillFields: () => post<BackfillResult>('/api/nda-inbox/backfill-fields'),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user