conare 0.30.0 → 0.33.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 +140 -4
- package/dist/index.d.ts +412 -22
- package/dist/index.js +262 -37
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.33.0";
|
|
2
2
|
/** A metadata value: string, number, boolean or an array of strings. */
|
|
3
3
|
export type MetadataValue = string | number | boolean | string[];
|
|
4
4
|
export type Metadata = Record<string, MetadataValue>;
|
|
@@ -83,6 +83,34 @@ export interface DocumentInput {
|
|
|
83
83
|
*/
|
|
84
84
|
image?: string;
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* What a billable call counted toward your bill, in the units of `GET /usage`: multiply each by its price in
|
|
88
|
+
* `GET /billing`'s `prices` for the cost. A server older than these answers none (`usage` is then undefined).
|
|
89
|
+
*/
|
|
90
|
+
export interface SearchUsage {
|
|
91
|
+
/** 1 a search; 0 a later page of `queryPages`, which costs nothing. */
|
|
92
|
+
queries: number;
|
|
93
|
+
}
|
|
94
|
+
/** What a write counted: the documents created or updated, and the tokens embedded to index them (an `unchanged` document counts in neither). */
|
|
95
|
+
export interface WriteUsage {
|
|
96
|
+
documentsWritten: number;
|
|
97
|
+
indexTokens: number;
|
|
98
|
+
}
|
|
99
|
+
/** What `parse` counted: the PDF pages, image frames and slides it read, blank ones included (0 for a file without pages). */
|
|
100
|
+
export interface ParseUsage {
|
|
101
|
+
pages: number;
|
|
102
|
+
/** The index tokens those pages count as: each page or image is a fixed number of tokens, OCR included. */
|
|
103
|
+
indexTokens?: number;
|
|
104
|
+
}
|
|
105
|
+
/** What `embed` counted: the tokens embedded (a repeat of an `idempotencyKey` answers the same and counts nothing again). */
|
|
106
|
+
export interface EmbedUsage {
|
|
107
|
+
embedTokens: number;
|
|
108
|
+
}
|
|
109
|
+
/** What `rerank` counted: the tokens of the query and documents read, and the rerank calls billed. */
|
|
110
|
+
export interface RerankUsage {
|
|
111
|
+
rerankTokens: number;
|
|
112
|
+
rerankCalls: number;
|
|
113
|
+
}
|
|
86
114
|
/** What a write did with one document. */
|
|
87
115
|
export type WriteOutcome = "created" | "updated" | "unchanged" | "stale";
|
|
88
116
|
export interface WriteResult {
|
|
@@ -103,6 +131,10 @@ export interface WriteResult {
|
|
|
103
131
|
/** The document's `image` was embedded with its text (absent without one, or where its namespace reads none). */
|
|
104
132
|
imageEmbedded?: boolean;
|
|
105
133
|
}
|
|
134
|
+
/** `write`'s results, in order, and what the write counted (summed over its batches; undefined from an older server). */
|
|
135
|
+
export type WriteResults = WriteResult[] & {
|
|
136
|
+
usage?: WriteUsage;
|
|
137
|
+
};
|
|
106
138
|
/** A file type `uploadFile` can declare: the file is read as that type (`jpg` and `tif` are accepted too). */
|
|
107
139
|
export type FileType = "pdf" | "xlsx" | "docx" | "pptx" | "csv" | "tsv" | "txt" | "md" | "html" | "png" | "jpeg" | "webp" | "tiff" | "gif" | "bmp" | "heic";
|
|
108
140
|
/**
|
|
@@ -127,7 +159,7 @@ export interface PictureWithoutText {
|
|
|
127
159
|
*/
|
|
128
160
|
reason: "too_small" | "not_raster" | "unreadable" | "not_read" | "no_text";
|
|
129
161
|
}
|
|
130
|
-
/** Options of `parse` and `uploadFile`: which pages, a password, the page layout and how long to wait. */
|
|
162
|
+
/** Options of `parse` and `uploadFile`: which pages, a password, the page layout, a workbook's sheets, cells and formulas, figure descriptions, and how long to wait. */
|
|
131
163
|
export interface ParseOptions {
|
|
132
164
|
/** The file's type: it is read as that type. Unset: the bytes say, then the name. */
|
|
133
165
|
type?: FileType;
|
|
@@ -137,6 +169,27 @@ export interface ParseOptions {
|
|
|
137
169
|
password?: string;
|
|
138
170
|
/** Each part OCR read carries `blocks`, its page's regions. */
|
|
139
171
|
layout?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* A workbook's sheets to read (.xlsx, .xlsm, .xls, .ods), by name, whatever their case; the others, their charts
|
|
174
|
+
* included, are not read. A name the workbook does not have throws 400 naming its sheets.
|
|
175
|
+
*/
|
|
176
|
+
sheets?: string[];
|
|
177
|
+
/** The cells to read of each sheet read, an A1 range: `"A1:F40"`, `"A:F"` or `"3:40"`. Rows and columns keep their numbers and letters. */
|
|
178
|
+
range?: string;
|
|
179
|
+
/**
|
|
180
|
+
* On an .xlsx or .xlsm: each sheet as its grid (a header of column letters, every row under its number), a cell with
|
|
181
|
+
* a formula as its saved value then the formula as inline code, e.g. ``110 `=B2*1.1` ``. Other files throw 400.
|
|
182
|
+
*/
|
|
183
|
+
formulas?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Each chart, diagram and picture OCR reads is described in one line `> **Figure description:** ...` at its place, and
|
|
186
|
+
* every part says whether it holds one (`vision`); a picture with no text but a description is a part, not 422
|
|
187
|
+
* `no_text`. A description is written by a model: it describes what the chart, diagram or picture shows and is not
|
|
188
|
+
* text from the page; it can be wrong, and two reads of the same file may word it differently; numbers a chart prints
|
|
189
|
+
* are in the page's text as before. Up to six figures a page are described, the largest; a figure the model does not
|
|
190
|
+
* describe has no line. A deployment that does not offer it answers 400 `invalid_request`.
|
|
191
|
+
*/
|
|
192
|
+
vision?: boolean;
|
|
140
193
|
/**
|
|
141
194
|
* Seconds to wait for OCR before the answer is pending (0-300, default 60; the answer comes within 105 s
|
|
142
195
|
* whatever it says). `true` is 60. On `uploadFile`, `false` answers once the text layers are stored.
|
|
@@ -153,6 +206,8 @@ export interface ParseBlock {
|
|
|
153
206
|
content: string;
|
|
154
207
|
/** The mean probability of its tokens; null when none was given. */
|
|
155
208
|
conf: number | null;
|
|
209
|
+
/** With `vision: true`, on an `image` or `chart` region: its description, written by a model ("" when none). */
|
|
210
|
+
description?: string;
|
|
156
211
|
}
|
|
157
212
|
/** One part of a parsed file: a page, slide, picture, sheet or Word part. */
|
|
158
213
|
export interface ParsePart {
|
|
@@ -161,6 +216,8 @@ export interface ParsePart {
|
|
|
161
216
|
markdown: string;
|
|
162
217
|
/** Read by OCR from the page's image, not its text layer. */
|
|
163
218
|
ocr: boolean;
|
|
219
|
+
/** With `vision: true` only: its `markdown` holds a figure description, written by a model and not text from the page. */
|
|
220
|
+
vision?: boolean;
|
|
164
221
|
/** The mean probability (0-1) of the tokens OCR wrote for it; null when OCR did not read it or gave no probabilities. */
|
|
165
222
|
confidence: number | null;
|
|
166
223
|
/** With `layout: true`, on a part OCR read with its layout. */
|
|
@@ -179,8 +236,14 @@ export interface ParseResult {
|
|
|
179
236
|
state: "done";
|
|
180
237
|
type: FileUpload["type"];
|
|
181
238
|
name: string;
|
|
239
|
+
/** A page parsed by its URL: its title (HTML) or first heading (Markdown); absent when it has none. */
|
|
240
|
+
title?: string;
|
|
241
|
+
/** A file parsed by its URL: the address the fetch landed on after its redirects. */
|
|
242
|
+
sourceUrl?: string;
|
|
182
243
|
/** A PDF's pages, an image's frames, a deck's slides or a workbook's sheets (null for other files). */
|
|
183
244
|
pages: number | null;
|
|
245
|
+
/** A workbook's: the names of all its sheets in order, hidden ones included, whatever `sheets` selected. */
|
|
246
|
+
sheets?: string[];
|
|
184
247
|
/** The whole document: `<!-- page 3 -->`, `<!-- slide 4 -->` and `<!-- sheet "Q3" -->` start each page, slide and sheet. */
|
|
185
248
|
markdown: string;
|
|
186
249
|
parts: ParsePart[];
|
|
@@ -190,11 +253,18 @@ export interface ParseResult {
|
|
|
190
253
|
* parsing the file again can read them. Empty when OCR read them all.
|
|
191
254
|
*/
|
|
192
255
|
ocrFailed: number[];
|
|
256
|
+
/**
|
|
257
|
+
* What the parse counted, OCR's pages included. Absent for a file the parse worker read (over 20 MiB or 2,000
|
|
258
|
+
* pages, or over 100 pages for OCR) and from `uploadFile`, whose pages are counted as the worker reads them.
|
|
259
|
+
*/
|
|
260
|
+
usage?: ParseUsage;
|
|
193
261
|
}
|
|
194
262
|
/** A parse OCR was still reading after `wait`: `getParse(id)` answers the result (kept 24 hours). */
|
|
195
263
|
export interface ParsePending {
|
|
196
264
|
id: string;
|
|
197
265
|
state: "parsing";
|
|
266
|
+
/** What the parse counted, as on `ParseResult`. */
|
|
267
|
+
usage?: ParseUsage;
|
|
198
268
|
}
|
|
199
269
|
/** A parse `getParse` found failed: `error` is what it would have thrown. */
|
|
200
270
|
export interface ParseFailed {
|
|
@@ -203,6 +273,7 @@ export interface ParseFailed {
|
|
|
203
273
|
error: {
|
|
204
274
|
code: string;
|
|
205
275
|
message: string;
|
|
276
|
+
details?: ErrorDetails;
|
|
206
277
|
};
|
|
207
278
|
}
|
|
208
279
|
/** What `uploadFile` stored. */
|
|
@@ -289,6 +360,58 @@ export interface DocumentSummary {
|
|
|
289
360
|
user?: string;
|
|
290
361
|
seq?: number;
|
|
291
362
|
}
|
|
363
|
+
/** A row of `Namespace.changes`: a document created, changed or deleted, with its address and fields as they were then. */
|
|
364
|
+
export interface DocumentChange {
|
|
365
|
+
/** The document: a page's or file's, `<sourceId>:<fileId>`. */
|
|
366
|
+
id: string;
|
|
367
|
+
/** `changed`: its text or parts changed. A page or file read again unchanged adds no row. */
|
|
368
|
+
change: "created" | "changed" | "deleted";
|
|
369
|
+
/** When it was recorded. */
|
|
370
|
+
at: Date;
|
|
371
|
+
/** The document's `url` field, else the address it was read from (a web page, a `gs://` object); absent on a delete. */
|
|
372
|
+
url?: string;
|
|
373
|
+
/** The document's fields then, with `file`, `file_id` and `file_type`; absent on a delete. */
|
|
374
|
+
metadata?: Metadata;
|
|
375
|
+
/** On a web page's `changed` row, how it changed; absent on a file's, and when its earlier version could not be compared. */
|
|
376
|
+
diff?: DocumentDiff;
|
|
377
|
+
}
|
|
378
|
+
/** How a web page changed against the version the row before recorded. */
|
|
379
|
+
export interface DocumentDiff {
|
|
380
|
+
/**
|
|
381
|
+
* `content`: its text changed, as `hunks` say. `reader`: it reads as it did; only how Conare reads web pages
|
|
382
|
+
* changed. `fields`: it reads as it did; only its fields changed.
|
|
383
|
+
*/
|
|
384
|
+
cause: "content" | "reader" | "fields";
|
|
385
|
+
/** Where its text changed, in the page's order (at most 24): the lines removed where the lines added are now. The title is the line `Title: ...`. */
|
|
386
|
+
hunks?: Array<{
|
|
387
|
+
removed?: string[];
|
|
388
|
+
added?: string[];
|
|
389
|
+
}>;
|
|
390
|
+
/** Lines or hunks were left out to keep it in bounds. */
|
|
391
|
+
truncated?: boolean;
|
|
392
|
+
}
|
|
393
|
+
/** What `Namespace.changes` lists: from a cursor, of one source, in a time window. */
|
|
394
|
+
export interface ChangesOptions extends RequestOptions {
|
|
395
|
+
/** A previous page's `nextCursor`; omit it to list from the start. Pass the same filters with it. */
|
|
396
|
+
cursor?: string;
|
|
397
|
+
/** Rows per page, 1-1000 (default 100). */
|
|
398
|
+
limit?: number;
|
|
399
|
+
/** Only the documents of this source (its id). */
|
|
400
|
+
source?: string;
|
|
401
|
+
/** Only rows recorded at or after this time. */
|
|
402
|
+
since?: Date | string;
|
|
403
|
+
/** Only rows recorded before this time. */
|
|
404
|
+
until?: Date | string;
|
|
405
|
+
}
|
|
406
|
+
/** One page of `Namespace.changes`. */
|
|
407
|
+
export interface ChangesPage {
|
|
408
|
+
/** Oldest first. */
|
|
409
|
+
changes: DocumentChange[];
|
|
410
|
+
/** Where the next call starts, also when this page is empty: keep it and pass it as `cursor`. */
|
|
411
|
+
nextCursor: string;
|
|
412
|
+
/** More rows follow this page: call again at once. */
|
|
413
|
+
hasMore: boolean;
|
|
414
|
+
}
|
|
292
415
|
export interface QueryResult {
|
|
293
416
|
id: string;
|
|
294
417
|
/**
|
|
@@ -325,6 +448,12 @@ export interface QueryOptions extends RequestOptions {
|
|
|
325
448
|
/** 2 searches again from the best results, for answers that span documents (not with `queryPages`). */
|
|
326
449
|
hops?: 1 | 2;
|
|
327
450
|
}
|
|
451
|
+
/** The options of `Namespace.count`: a query's filter and user scoping (no `$ne`, `$nin` or `$text`). */
|
|
452
|
+
export interface CountOptions extends RequestOptions {
|
|
453
|
+
filter?: Filter;
|
|
454
|
+
user?: string;
|
|
455
|
+
userPrefix?: string;
|
|
456
|
+
}
|
|
328
457
|
export interface GrepOptions extends RequestOptions {
|
|
329
458
|
filter?: Filter;
|
|
330
459
|
user?: string;
|
|
@@ -346,6 +475,8 @@ export interface GrepPage {
|
|
|
346
475
|
matches: GrepMatch[];
|
|
347
476
|
/** Where the next page starts; null on the last page. A page can stop short of `limit`. */
|
|
348
477
|
nextCursor: string | null;
|
|
478
|
+
/** What the call counted (undefined from an older server). */
|
|
479
|
+
usage?: SearchUsage;
|
|
349
480
|
}
|
|
350
481
|
/**
|
|
351
482
|
* A search's results, best first, and what the search lost on the way (the values of the `Conare-Degraded`
|
|
@@ -354,6 +485,7 @@ export interface GrepPage {
|
|
|
354
485
|
*/
|
|
355
486
|
export type QueryResults = QueryResult[] & {
|
|
356
487
|
degraded: string[];
|
|
488
|
+
usage?: SearchUsage;
|
|
357
489
|
};
|
|
358
490
|
/** One page of `Namespace.queryPages`. */
|
|
359
491
|
export interface QueryPage {
|
|
@@ -362,6 +494,92 @@ export interface QueryPage {
|
|
|
362
494
|
degraded: string[];
|
|
363
495
|
/** Where the next page starts (`queryPages`'s `cursor`); null on the last page. */
|
|
364
496
|
nextCursor: string | null;
|
|
497
|
+
/** What this page counted: the first page 1 query, later ones 0 (undefined from an older server). */
|
|
498
|
+
usage?: SearchUsage;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* A field of a record's schema (`Namespace.queryRecord`). Say in `description` what it holds and in what form
|
|
502
|
+
* (up to 1,000 characters): the model reads it. A string may list its values in `enum` (1-50, each up to 100
|
|
503
|
+
* characters); an array is a list of strings.
|
|
504
|
+
*/
|
|
505
|
+
export type RecordField = {
|
|
506
|
+
type: "string";
|
|
507
|
+
description?: string;
|
|
508
|
+
enum?: readonly string[];
|
|
509
|
+
title?: string;
|
|
510
|
+
} | {
|
|
511
|
+
type: "number" | "integer" | "boolean";
|
|
512
|
+
description?: string;
|
|
513
|
+
title?: string;
|
|
514
|
+
} | {
|
|
515
|
+
type: "array";
|
|
516
|
+
items: {
|
|
517
|
+
type: "string";
|
|
518
|
+
enum?: readonly string[];
|
|
519
|
+
description?: string;
|
|
520
|
+
title?: string;
|
|
521
|
+
};
|
|
522
|
+
description?: string;
|
|
523
|
+
title?: string;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* A record's schema, a JSON Schema: an object of 1-32 fields, each name 1-64 characters of `[A-Za-z0-9_]`, not
|
|
527
|
+
* starting with a digit. `title`, `description`, `required`, `additionalProperties` and `$schema` change nothing.
|
|
528
|
+
*/
|
|
529
|
+
export interface RecordSchema {
|
|
530
|
+
type: "object";
|
|
531
|
+
properties: {
|
|
532
|
+
readonly [name: string]: RecordField;
|
|
533
|
+
};
|
|
534
|
+
title?: string;
|
|
535
|
+
description?: string;
|
|
536
|
+
required?: readonly string[];
|
|
537
|
+
additionalProperties?: boolean;
|
|
538
|
+
$schema?: string;
|
|
539
|
+
}
|
|
540
|
+
/** The value a field of a record holds: an `enum` field one of its values. */
|
|
541
|
+
export type RecordFieldValue<F extends RecordField> = F extends {
|
|
542
|
+
type: "string";
|
|
543
|
+
enum: readonly (infer E extends string)[];
|
|
544
|
+
} ? E : F extends {
|
|
545
|
+
type: "string";
|
|
546
|
+
} ? string : F extends {
|
|
547
|
+
type: "number" | "integer";
|
|
548
|
+
} ? number : F extends {
|
|
549
|
+
type: "boolean";
|
|
550
|
+
} ? boolean : F extends {
|
|
551
|
+
type: "array";
|
|
552
|
+
items: {
|
|
553
|
+
enum: readonly (infer E extends string)[];
|
|
554
|
+
};
|
|
555
|
+
} ? E[] : F extends {
|
|
556
|
+
type: "array";
|
|
557
|
+
} ? string[] : never;
|
|
558
|
+
/** A filled record: every field of the schema, its value, or null when no passage the search read states it. */
|
|
559
|
+
export type RecordOf<S extends RecordSchema> = {
|
|
560
|
+
-readonly [K in keyof S["properties"]]: RecordFieldValue<S["properties"][K]> | null;
|
|
561
|
+
};
|
|
562
|
+
/** Where a record's value is from. */
|
|
563
|
+
export interface RecordSource {
|
|
564
|
+
/** The document that states the value. */
|
|
565
|
+
id: string;
|
|
566
|
+
/** The address the document was read from, when it has one (a web page, a synced record's link). */
|
|
567
|
+
url?: string;
|
|
568
|
+
/** The words of the document that state the value. */
|
|
569
|
+
quote: string;
|
|
570
|
+
}
|
|
571
|
+
/** What `Namespace.queryRecord` answers. */
|
|
572
|
+
export interface QueryRecord<S extends RecordSchema> {
|
|
573
|
+
/** Every field of the schema, its value or null; null itself when the answer model was unavailable (the results alone). */
|
|
574
|
+
record: RecordOf<S> | null;
|
|
575
|
+
/** For each field with a value, the document, address and words it is from. */
|
|
576
|
+
sources: {
|
|
577
|
+
[K in keyof S["properties"]]?: RecordSource;
|
|
578
|
+
};
|
|
579
|
+
/** The search's results, best first (`topK`), and what it lost (`degraded`). */
|
|
580
|
+
results: QueryResults;
|
|
581
|
+
/** Each passage a source is that `results` does not hold (the record reads past `topK`); empty when they hold them all. */
|
|
582
|
+
sourcePassages: QueryResult[];
|
|
365
583
|
}
|
|
366
584
|
export interface NamespaceInfo {
|
|
367
585
|
name: string;
|
|
@@ -387,6 +605,11 @@ export interface RerankResult {
|
|
|
387
605
|
/** Rerank results, best first, and the indexes of the documents no window read (the budget ended, or their window failed); those are not in the results. */
|
|
388
606
|
export type RerankResults = RerankResult[] & {
|
|
389
607
|
unscored: number[];
|
|
608
|
+
usage?: RerankUsage;
|
|
609
|
+
};
|
|
610
|
+
/** Float embeddings, one per text, and what the call counted (undefined from an older server). */
|
|
611
|
+
export type Embeddings = number[][] & {
|
|
612
|
+
usage?: EmbedUsage;
|
|
390
613
|
};
|
|
391
614
|
export interface EmbedOptions {
|
|
392
615
|
type?: "document" | "query";
|
|
@@ -399,6 +622,7 @@ export interface EmbedOptions {
|
|
|
399
622
|
export interface Int8Embeddings {
|
|
400
623
|
values: Int8Array[];
|
|
401
624
|
scales: number[];
|
|
625
|
+
usage?: EmbedUsage;
|
|
402
626
|
}
|
|
403
627
|
/**
|
|
404
628
|
* Both parts of the embedding model (`embed(..., { tokenEmbeddings: true })`): each text's vector and, beside
|
|
@@ -413,6 +637,7 @@ export interface HybridEmbeddings {
|
|
|
413
637
|
tokenDimensions: number;
|
|
414
638
|
/** The share of the `embeddings` score in the blended score, between 0 and 1. */
|
|
415
639
|
denseWeight: number;
|
|
640
|
+
usage?: EmbedUsage;
|
|
416
641
|
}
|
|
417
642
|
/**
|
|
418
643
|
* Text `d` of `documents` scored for text `q` of `query` (one embedded with type "query", the other with
|
|
@@ -507,6 +732,8 @@ export interface CustomSource {
|
|
|
507
732
|
};
|
|
508
733
|
documents: number | null;
|
|
509
734
|
documentsVerifiedAt: Date | null;
|
|
735
|
+
/** A Google Cloud Storage, web or files source deleted with a grace: when its documents go (`sources.restore` until then). */
|
|
736
|
+
deletesAt?: Date;
|
|
510
737
|
createdAt: Date;
|
|
511
738
|
updatedAt: Date;
|
|
512
739
|
}
|
|
@@ -538,7 +765,8 @@ export interface GCSSource extends Omit<CustomSource, "kind" | "type" | "app" |
|
|
|
538
765
|
/**
|
|
539
766
|
* Pages of public websites Conare keeps in step with their sites: each is read again every
|
|
540
767
|
* `config.syncIntervalSeconds`, and parsed again only when it changed. `failures` counts the pages it could not
|
|
541
|
-
* read (the site refuses crawlers, wants a sign-in,
|
|
768
|
+
* read (the site refuses crawlers, wants a sign-in, the page needs a browser to show its text or holds none): every
|
|
769
|
+
* page it lists is stored or one of them.
|
|
542
770
|
*/
|
|
543
771
|
/** A page of a web source: its address, or its address with your fields, which every document of the page carries. */
|
|
544
772
|
export type WebPage = string | {
|
|
@@ -551,10 +779,12 @@ export interface WebSource extends Omit<CustomSource, "kind" | "type" | "app" |
|
|
|
551
779
|
app: null;
|
|
552
780
|
user: null;
|
|
553
781
|
/**
|
|
554
|
-
* `urls`: the source's pages
|
|
782
|
+
* `urls`: the source's pages, from `get()` (`list()` leaves them out: a site holds thousands). For a source of a
|
|
783
|
+
* `site`, the pages its last sync found there, of at most `maxPages`. `pages`: how many it has, from both.
|
|
555
784
|
*/
|
|
556
785
|
config: {
|
|
557
|
-
urls
|
|
786
|
+
urls?: string[];
|
|
787
|
+
pages: number;
|
|
558
788
|
syncIntervalSeconds: number;
|
|
559
789
|
site?: string;
|
|
560
790
|
maxPages?: number;
|
|
@@ -562,6 +792,22 @@ export interface WebSource extends Omit<CustomSource, "kind" | "type" | "app" |
|
|
|
562
792
|
/** Pages it could not read or holds no current document for. */
|
|
563
793
|
failures: number;
|
|
564
794
|
}
|
|
795
|
+
/** How many sources (`sources.summary()`), how many of them fail and sync now, and their newest successful sync. */
|
|
796
|
+
export interface SourceCounts {
|
|
797
|
+
sources: number;
|
|
798
|
+
failing: number;
|
|
799
|
+
syncing: number;
|
|
800
|
+
lastSuccessAt: string | null;
|
|
801
|
+
}
|
|
802
|
+
/** `sources.summary()`: every namespace a source writes into, by name, with its sources by type; and all of them. */
|
|
803
|
+
export interface SourceSummary extends SourceCounts {
|
|
804
|
+
namespaces: Array<SourceCounts & {
|
|
805
|
+
namespace: string;
|
|
806
|
+
types: Array<SourceCounts & {
|
|
807
|
+
type: string;
|
|
808
|
+
}>;
|
|
809
|
+
}>;
|
|
810
|
+
}
|
|
565
811
|
/** One object of a Google Cloud Storage source, or one page of a web source, it could not keep, whole or in part. */
|
|
566
812
|
export interface SourceFailure {
|
|
567
813
|
/** The object (`gs://...`) or the page's address. */
|
|
@@ -638,6 +884,12 @@ export interface Run {
|
|
|
638
884
|
sweep: "none" | "applied" | "held" | "blocked";
|
|
639
885
|
sweepReason: string | null;
|
|
640
886
|
expected: number | null;
|
|
887
|
+
/**
|
|
888
|
+
* What the run did: `seen`, `deleted`; an import's `created`, `updated`, `rejected`; a web source's sync's `created`
|
|
889
|
+
* (pages stored the first time) and `updated` (stored again). Of a source of a `site`: `named` (every page the site
|
|
890
|
+
* named) = `found` (kept) + `skipped_robots` + `skipped_translation` + `skipped_max_pages`; `listed` = `found` +
|
|
891
|
+
* `carried`.
|
|
892
|
+
*/
|
|
641
893
|
counts: Record<string, number>;
|
|
642
894
|
error: {
|
|
643
895
|
code: string;
|
|
@@ -700,17 +952,21 @@ export interface OrganizationSpend {
|
|
|
700
952
|
/** Every organization of your customer, and how many cost anything. */
|
|
701
953
|
count: number;
|
|
702
954
|
active: number;
|
|
955
|
+
/** How many organizations have a spend cap of their own. */
|
|
956
|
+
capped: number;
|
|
703
957
|
/** Every organization's charges, whatever the search. */
|
|
704
958
|
total: OrganizationCharges;
|
|
705
959
|
/** The ten most expensive organizations' part of the total, 0 to 1. */
|
|
706
960
|
top10Share: number;
|
|
707
961
|
/** How many organizations `q` kept. */
|
|
708
962
|
matched: number;
|
|
963
|
+
/** `spendCapMicros`: the organization's own monthly spend cap (`setOrganizationSpendCap()`), null for none. */
|
|
709
964
|
rows: Array<{
|
|
710
965
|
id: string;
|
|
711
966
|
name: string;
|
|
712
967
|
externalId?: string;
|
|
713
968
|
charges: OrganizationCharges;
|
|
969
|
+
spendCapMicros: number | null;
|
|
714
970
|
}>;
|
|
715
971
|
/** The matches after this page, as one sum. */
|
|
716
972
|
rest: {
|
|
@@ -731,6 +987,8 @@ export interface Organization {
|
|
|
731
987
|
default?: boolean;
|
|
732
988
|
/** When it was made (a customer key's `organizations()`). */
|
|
733
989
|
createdAt?: string;
|
|
990
|
+
/** Its own monthly spend cap in whole dollars (a customer key; `setOrganizationSpendCap()`); absent: none. */
|
|
991
|
+
spendCapUsd?: number;
|
|
734
992
|
}
|
|
735
993
|
/** An API key (`createKey()`, `keys()`). Its secret is shown once, by `createKey()`. */
|
|
736
994
|
export interface ApiKey {
|
|
@@ -741,6 +999,10 @@ export interface ApiKey {
|
|
|
741
999
|
/** The key's scope; null reaches every namespace. */
|
|
742
1000
|
namespaces: string[] | null;
|
|
743
1001
|
modelsOnly: boolean;
|
|
1002
|
+
/** A read-only key: every call that changes something stored answers 403 `read_only_key`. */
|
|
1003
|
+
readOnly: boolean;
|
|
1004
|
+
/** The key's cap, a percent (1-100) of each of its organization's rate limits; null: the organization's limits alone. */
|
|
1005
|
+
rateLimitPercent: number | null;
|
|
744
1006
|
/** The organizations it acts for, its own first. */
|
|
745
1007
|
organizations: string[];
|
|
746
1008
|
createdAt: string;
|
|
@@ -766,12 +1028,32 @@ export interface RequestOptions {
|
|
|
766
1028
|
*/
|
|
767
1029
|
idempotencyKey?: string;
|
|
768
1030
|
}
|
|
769
|
-
/**
|
|
1031
|
+
/** Facts some errors carry beside their message. */
|
|
1032
|
+
export interface ErrorDetails {
|
|
1033
|
+
/** A URL's fetch (`parse({ url })`, `uploadFile({ url })`): the HTTP status the URL's site answered. */
|
|
1034
|
+
status?: number;
|
|
1035
|
+
/** A site that answered `slow_down`: the seconds it asked to wait. */
|
|
1036
|
+
retryAfterSeconds?: number;
|
|
1037
|
+
/**
|
|
1038
|
+
* `source_deleting` (a connect of a source in its grace, an upload to a namespace whose files source is
|
|
1039
|
+
* deleted): the source. `sources.restore(sourceId)` brings it back while `deletesAt` is set, or
|
|
1040
|
+
* `sources.delete(sourceId, { graceSeconds: 0 })` deletes it now.
|
|
1041
|
+
*/
|
|
1042
|
+
sourceId?: string;
|
|
1043
|
+
/** `source_deleting` of a source in its grace: when its documents go. Absent once its delete has started. */
|
|
1044
|
+
deletesAt?: Date;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Every failure the SDK throws. `status` is 0 when no response arrived. `details` is what the error
|
|
1048
|
+
* carries beside its message, when it does: for a URL the API fetched, the status its site answered; for
|
|
1049
|
+
* `source_deleting`, the source and when it is deleted.
|
|
1050
|
+
*/
|
|
770
1051
|
export declare class ConareError extends Error {
|
|
771
1052
|
readonly status: number;
|
|
772
1053
|
readonly code: string;
|
|
773
1054
|
readonly requestId: string | null;
|
|
774
|
-
|
|
1055
|
+
readonly details: ErrorDetails | null;
|
|
1056
|
+
constructor(status: number, code: string, message: string, requestId?: string | null, details?: ErrorDetails | null);
|
|
775
1057
|
}
|
|
776
1058
|
/**
|
|
777
1059
|
* The Conare client.
|
|
@@ -820,17 +1102,26 @@ export declare class Conare {
|
|
|
820
1102
|
/**
|
|
821
1103
|
* A new organization of your customer, with a customer key: one per company you serve, with its own
|
|
822
1104
|
* namespaces, keys, sources, usage and limits. `externalId` is your own id for it, unique within your
|
|
823
|
-
* customer: a create with one already used answers that organization and makes none
|
|
824
|
-
*
|
|
1105
|
+
* customer: a create with one already used answers that organization and makes none (its spend cap as it
|
|
1106
|
+
* is). `spendCapUsd` is its own monthly spend cap (`setOrganizationSpendCap()`). Mint the key its traffic
|
|
1107
|
+
* runs on with `createKey()` on a client whose `organization` is its `id`.
|
|
825
1108
|
*/
|
|
826
1109
|
createOrganization(input: {
|
|
827
1110
|
name: string;
|
|
828
1111
|
externalId?: string;
|
|
1112
|
+
spendCapUsd?: number;
|
|
829
1113
|
}, options?: RequestOptions): Promise<Organization>;
|
|
830
1114
|
/** One organization of your customer, with a customer key. */
|
|
831
1115
|
getOrganization(id: string, options?: RequestOptions): Promise<Organization>;
|
|
832
1116
|
/** Renames one organization of your customer, with a customer key. */
|
|
833
1117
|
renameOrganization(id: string, name: string, options?: RequestOptions): Promise<Organization>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Sets one organization's own monthly spend cap in whole dollars (1-10,000,000), or removes it with null,
|
|
1120
|
+
* with a customer key; your customer's default organization takes one too. Once the organization's
|
|
1121
|
+
* charges this month reach it, its billed calls fail with a ConareError 402 `spend_cap_reached` and your
|
|
1122
|
+
* other organizations are still served.
|
|
1123
|
+
*/
|
|
1124
|
+
setOrganizationSpendCap(id: string, usd: number | null, options?: RequestOptions): Promise<Organization>;
|
|
834
1125
|
/**
|
|
835
1126
|
* Deletes one organization of your customer for good, with a customer key. Delete its namespaces and
|
|
836
1127
|
* sources first (a client whose `organization` is its `id`): until then it answers 409 `conflict`.
|
|
@@ -851,12 +1142,17 @@ export declare class Conare {
|
|
|
851
1142
|
/**
|
|
852
1143
|
* A key of this client's `organization`, with a customer key: the key a company's traffic runs on,
|
|
853
1144
|
* reaching that organization alone. `namespaces` scopes it (exact names, or prefixes ending in `*`),
|
|
854
|
-
* `modelsOnly` keeps it to the model routes, `
|
|
1145
|
+
* `modelsOnly` keeps it to the model routes, `readOnly` to the calls that change nothing stored
|
|
1146
|
+
* (every write answers 403 `read_only_key`), `rateLimitPercent` (1-100) caps it at that percent of each of the
|
|
1147
|
+
* organization's rate limits (past it, 429 `rate_limited` for this key alone), `expiresAt` ends it. The secret is in
|
|
1148
|
+
* this answer only.
|
|
855
1149
|
*/
|
|
856
1150
|
createKey(input: {
|
|
857
1151
|
name: string;
|
|
858
1152
|
namespaces?: string[];
|
|
859
1153
|
modelsOnly?: boolean;
|
|
1154
|
+
readOnly?: boolean;
|
|
1155
|
+
rateLimitPercent?: number;
|
|
860
1156
|
expiresAt?: Date | string;
|
|
861
1157
|
}, options?: RequestOptions): Promise<{
|
|
862
1158
|
key: ApiKey;
|
|
@@ -875,7 +1171,7 @@ export declare class Conare {
|
|
|
875
1171
|
embed(input: string | string[], options?: RequestOptions & EmbedOptions & {
|
|
876
1172
|
outputDtype?: "float";
|
|
877
1173
|
tokenEmbeddings?: false;
|
|
878
|
-
}): Promise<
|
|
1174
|
+
}): Promise<Embeddings>;
|
|
879
1175
|
embed(input: string | string[], options: RequestOptions & EmbedOptions & {
|
|
880
1176
|
outputDtype: "int8";
|
|
881
1177
|
tokenEmbeddings?: false;
|
|
@@ -894,7 +1190,13 @@ export declare class Conare {
|
|
|
894
1190
|
}): Promise<RerankResults>;
|
|
895
1191
|
/**
|
|
896
1192
|
* Parses a file to Markdown and stores nothing: the same parser, options and result as `uploadFile`.
|
|
897
|
-
* `file` is its bytes, or `{ url }` (an https URL on a public address, fetched by the API
|
|
1193
|
+
* `file` is its bytes, or `{ url }` (an http or https URL on a public address, fetched by the API, which
|
|
1194
|
+
* reads the one page named and does not consult robots.txt; the result then carries `sourceUrl` and a page's
|
|
1195
|
+
* `title`). A URL that does not answer its file throws what its site did (`gone`, `refused`, `slow_down`,
|
|
1196
|
+
* `unreachable`, ...) with `details.status`; a page that holds no text until a browser runs its scripts
|
|
1197
|
+
* throws 422 `needs_javascript`, which `render: true` asks to have read through a browser. `links: true`
|
|
1198
|
+
* writes a web page's links as Markdown links (its menus' and footer's too); `mainContent: true` reads its
|
|
1199
|
+
* main content alone. A file OCR
|
|
898
1200
|
* reads answers once OCR is done within `wait` seconds (default 60), else `{ id, state: "parsing" }`:
|
|
899
1201
|
* `getParse(id)` answers the result (kept 24 hours). Any API key can parse, a models-only key too.
|
|
900
1202
|
*/
|
|
@@ -902,6 +1204,9 @@ export declare class Conare {
|
|
|
902
1204
|
url: string;
|
|
903
1205
|
}, options?: RequestOptions & ParseOptions & {
|
|
904
1206
|
name?: string;
|
|
1207
|
+
render?: boolean;
|
|
1208
|
+
links?: boolean;
|
|
1209
|
+
mainContent?: boolean;
|
|
905
1210
|
}): Promise<ParseResult | ParsePending>;
|
|
906
1211
|
/** A parse that answered `state: "parsing"`: still parsing, done with its result, or failed. 404 `parse_not_found` after 24 hours. */
|
|
907
1212
|
getParse(id: string, options?: RequestOptions): Promise<ParseResult | ParsePending | ParseFailed>;
|
|
@@ -945,7 +1250,7 @@ export declare class Namespace {
|
|
|
945
1250
|
* from its own first attempt. `version` is null when the server did not answer one (a server older than versions): never
|
|
946
1251
|
* pass it as `ifVersion`.
|
|
947
1252
|
*/
|
|
948
|
-
write(documents: DocumentInput | DocumentInput[], options?: RequestOptions): Promise<
|
|
1253
|
+
write(documents: DocumentInput | DocumentInput[], options?: RequestOptions): Promise<WriteResults>;
|
|
949
1254
|
/**
|
|
950
1255
|
* Store a file, up to 512 MiB, in one call: a PDF, a Word document (.docx), a PowerPoint deck (.pptx),
|
|
951
1256
|
* an Excel workbook (.xlsx), a CSV or TSV, a text or Markdown file, or an image (PNG, JPEG, WebP,
|
|
@@ -982,6 +1287,25 @@ export declare class Namespace {
|
|
|
982
1287
|
* `userPrefix` is a 400, never "every user". `excludeIds` keeps those documents out.
|
|
983
1288
|
*/
|
|
984
1289
|
query(query: string, options?: QueryOptions): Promise<QueryResults>;
|
|
1290
|
+
/**
|
|
1291
|
+
* A search answered as a record: the fields `schema` names, each filled from the passages the search read (`topK`
|
|
1292
|
+
* of them, at least 20 and at most 50) with the document, address and words that state it, or null when no passage states
|
|
1293
|
+
* it (every field null when nothing matched). `record` is null when the answer model was unavailable; `results`
|
|
1294
|
+
* are the search's. Pass the schema inline, or declared `as const`, to type each value: an `enum` field is one of
|
|
1295
|
+
* its values.
|
|
1296
|
+
*/
|
|
1297
|
+
queryRecord<const S extends RecordSchema>(query: string, schema: S, options?: QueryOptions): Promise<QueryRecord<S>>;
|
|
1298
|
+
/**
|
|
1299
|
+
* A page of the namespace's changes after `cursor`, oldest first: the documents created, changed and deleted as
|
|
1300
|
+
* its website, Cloud Storage and file sources read them (and deleted their documents). Without `cursor`, from the
|
|
1301
|
+
* start: every document it holds. Keep `nextCursor` and pass it as `cursor` next time; while `hasMore`, call
|
|
1302
|
+
* again at once. `limit` is 1-1000 rows, default 100. Rows are kept 90 days, a live document's latest whatever
|
|
1303
|
+
* its age; a cursor whose unread rows were dropped throws 410 `cursor_expired`: list again without it. Documents
|
|
1304
|
+
* written with `add` or `write` are not listed. `source` keeps the rows to one source's documents, `since` and
|
|
1305
|
+
* `until` to a time window: one re-read of a website is `{ source, since: <its sync's start> }`. A web page's
|
|
1306
|
+
* `changed` row says how it changed (`diff`).
|
|
1307
|
+
*/
|
|
1308
|
+
changes(options?: ChangesOptions): Promise<ChangesPage>;
|
|
985
1309
|
/**
|
|
986
1310
|
* The documents whose text matches a regular expression, or a near spelling (`{ query, max_distance }`),
|
|
987
1311
|
* with the lines that match, in id order. A match lies inside one passage. Pass `nextCursor` as `cursor`
|
|
@@ -1011,6 +1335,12 @@ export declare class Namespace {
|
|
|
1011
1335
|
limit?: number;
|
|
1012
1336
|
order?: "id" | "newest";
|
|
1013
1337
|
}): AsyncGenerator<DocumentSummary>;
|
|
1338
|
+
/**
|
|
1339
|
+
* How many documents match `filter`, `user` and `userPrefix` (a query's), exactly; with none, the namespace's.
|
|
1340
|
+
* A document counts once, however long. `$ne`, `$nin` and `$text` throw 400 `invalid_filter`; a filter too many
|
|
1341
|
+
* documents match to count exactly throws 400 `invalid_request`: narrow it.
|
|
1342
|
+
*/
|
|
1343
|
+
count(options?: CountOptions): Promise<number>;
|
|
1014
1344
|
/** Delete one document. Throws a ConareError with status 404 (`document_not_found`) if it does not exist. */
|
|
1015
1345
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
1016
1346
|
/**
|
|
@@ -1048,8 +1378,10 @@ export declare class Sources {
|
|
|
1048
1378
|
* A page is never followed: the source is the pages you name.
|
|
1049
1379
|
*
|
|
1050
1380
|
* With `site` in place of `urls`, the source is a whole website: every sync finds the site's pages itself (its
|
|
1051
|
-
* sitemaps, feeds and links, on the site
|
|
1052
|
-
*
|
|
1381
|
+
* sitemaps, feeds and links, on the site, its `docs.`, `blog.` and like hosts and the other hosts of its domain
|
|
1382
|
+
* its first page links to, but sign-ins, accounts, status pages, forums and shops; an address with a path keeps
|
|
1383
|
+
* to the section it answers at once redirects are followed, or, when that section holds no other page, to the
|
|
1384
|
+
* pages of its host it links to, with what lies under those beside it), new ones included, and keeps at most `maxPages` (2,000 by default, 5,000 at most).
|
|
1053
1385
|
* Each page's documents carry `page_type` (`pricing`, `blog`, `changelog`, `docs` ...) and, when the page states
|
|
1054
1386
|
* one, a `published` date, so `filter` can keep a search to them.
|
|
1055
1387
|
*/
|
|
@@ -1100,21 +1432,68 @@ export declare class Sources {
|
|
|
1100
1432
|
* automatic. A web source (`update<WebSource>`): 3600 to 604800, or null for a day; each website is its own
|
|
1101
1433
|
* source with its own interval. A Google Cloud Storage source (`update<GCSSource>`): 900 to 604800, or null for
|
|
1102
1434
|
* an hour.
|
|
1435
|
+
*
|
|
1436
|
+
* A web source of `urls` takes new pages: `urls` is the whole list afterwards (as `connect` takes it), or
|
|
1437
|
+
* `addUrls` and `removeUrls` change the list it has. Its next sync starts now: a new page is read, a page it keeps
|
|
1438
|
+
* keeps its documents and is read again only when it changed, and a page taken off loses its documents.
|
|
1439
|
+
*
|
|
1440
|
+
* A web source of a `site` takes a new `maxPages` (1 to 5,000): its next sync starts now and keeps at most that
|
|
1441
|
+
* many pages; with a smaller number, the documents of the pages it no longer keeps are removed.
|
|
1103
1442
|
*/
|
|
1104
1443
|
update<T extends Source | GCSSource | WebSource = Source>(id: string, params: {
|
|
1105
|
-
syncIntervalSeconds
|
|
1444
|
+
syncIntervalSeconds?: number | null;
|
|
1445
|
+
urls?: WebPage[];
|
|
1446
|
+
addUrls?: WebPage[];
|
|
1447
|
+
removeUrls?: string[];
|
|
1448
|
+
maxPages?: number;
|
|
1106
1449
|
}, options?: RequestOptions): Promise<T>;
|
|
1107
1450
|
/**
|
|
1108
|
-
*
|
|
1109
|
-
* their `kind` (`custom`, `files`, `gcs`); a
|
|
1451
|
+
* One page of sources, not every source: on the first page the connected apps, then the custom, files, Google
|
|
1452
|
+
* Cloud Storage and web sources, newest first, which carry their `kind` (`custom`, `files`, `gcs`, `web`); a
|
|
1453
|
+
* connected app has none. `limit` (1-200, default 100) counts the sources with a `kind`; the connected apps all
|
|
1454
|
+
* come on the first page. `namespace`, `user` and `type` keep the sources whose field equals the value;
|
|
1455
|
+
* `health: "failing"` keeps the sources that need you (a failing source, an app whose status is `error`).
|
|
1456
|
+
* `nextCursor` is the next page's `cursor` (pass the same filters with it), null on the last. `total`, on the
|
|
1457
|
+
* first page, is how many sources every page holds: `list({ limit: 1 })` reads how many there are. A web source
|
|
1458
|
+
* comes with how many pages it has (`config.pages`), not its `urls`: `get()` answers them. For every source,
|
|
1459
|
+
* iterate `all()`, which follows `nextCursor` page by page.
|
|
1460
|
+
*/
|
|
1461
|
+
list(params?: {
|
|
1462
|
+
namespace?: string;
|
|
1463
|
+
user?: string;
|
|
1464
|
+
type?: string;
|
|
1465
|
+
health?: "failing";
|
|
1466
|
+
limit?: number;
|
|
1467
|
+
cursor?: string;
|
|
1468
|
+
}, options?: RequestOptions): Promise<{
|
|
1469
|
+
data: Array<Source | CustomSource | FilesSource | GCSSource | WebSource>;
|
|
1470
|
+
nextCursor: string | null;
|
|
1471
|
+
total?: number;
|
|
1472
|
+
}>;
|
|
1473
|
+
/** Every source `list()` pages through, fetched page by page as you iterate, with its filters and page size. */
|
|
1474
|
+
all(params?: {
|
|
1475
|
+
namespace?: string;
|
|
1476
|
+
user?: string;
|
|
1477
|
+
type?: string;
|
|
1478
|
+
health?: "failing";
|
|
1479
|
+
limit?: number;
|
|
1480
|
+
}, options?: RequestOptions): AsyncGenerator<Source | CustomSource | FilesSource | GCSSource | WebSource>;
|
|
1481
|
+
/**
|
|
1482
|
+
* How many sources write into each namespace, by type, and how many of them fail or sync now: the sources
|
|
1483
|
+
* `list()` pages through, counted, without the sources themselves (one read, however many there are). A source
|
|
1484
|
+
* fails as `list({ health: "failing" })` lists it; one syncs while a sync of it runs, or while a connected app is
|
|
1485
|
+
* `syncing` or `connecting`. `namespace` counts that namespace's alone. Namespaces come by name, each one's types
|
|
1486
|
+
* the most sources first.
|
|
1110
1487
|
*/
|
|
1111
|
-
|
|
1488
|
+
summary(params?: {
|
|
1489
|
+
namespace?: string;
|
|
1490
|
+
}, options?: RequestOptions): Promise<SourceSummary>;
|
|
1112
1491
|
/** One source by id. */
|
|
1113
1492
|
get(id: string, options?: RequestOptions): Promise<Source | CustomSource | FilesSource | GCSSource | WebSource>;
|
|
1114
1493
|
/**
|
|
1115
1494
|
* Start a sync now. `full: true` re-reads everything the app holds instead of what changed: documents
|
|
1116
1495
|
* that changed are rewritten and ones Conare no longer keeps are deleted. It is for Gmail and the apps
|
|
1117
|
-
* Conare reads itself (other apps answer 400), and
|
|
1496
|
+
* Conare reads itself (other apps answer 400), and only documents that changed are indexed again (rows cost what `cost.usdPerMillionRows` says: nothing where connectors are free).
|
|
1118
1497
|
*
|
|
1119
1498
|
* A connected app answers the `Source`, due to sync now. A Google Cloud Storage or web source answers the sync
|
|
1120
1499
|
* `Run` it queued (409 `run_active` while one is queued or running). A custom or files source has nothing
|
|
@@ -1138,12 +1517,23 @@ export declare class Sources {
|
|
|
1138
1517
|
/**
|
|
1139
1518
|
* Disconnect a source. Pass `deleteDocuments: true` to also delete what it synced; without it a
|
|
1140
1519
|
* connected app's and a custom source's documents stay. A Google Cloud Storage, web or files
|
|
1141
|
-
* source's documents always go with it
|
|
1142
|
-
*
|
|
1520
|
+
* source's documents always go with it, at the end of its grace: an hour, or `graceSeconds` (0 to
|
|
1521
|
+
* 86,400; 0 deletes them now). Until its `deletesAt` they stay searchable and `restore` brings it
|
|
1522
|
+
* back. Deleted again in its grace, `graceSeconds: 0` deletes it now (it can no longer be restored); another
|
|
1523
|
+
* value brings `deletesAt` nearer, never later. A custom source's delete is a run, which `runs.get` follows
|
|
1524
|
+
* until the source is `deleted`. It needs a key that writes (in the console, an organization admin).
|
|
1143
1525
|
*/
|
|
1144
1526
|
delete(id: string, options?: RequestOptions & {
|
|
1145
1527
|
deleteDocuments?: boolean;
|
|
1528
|
+
graceSeconds?: number;
|
|
1146
1529
|
}): Promise<void>;
|
|
1530
|
+
/**
|
|
1531
|
+
* Bring back a Google Cloud Storage, web or files source deleted with a grace, before its
|
|
1532
|
+
* `deletesAt`: active again with every document it held, its next sync due now. An active source
|
|
1533
|
+
* is answered as it is; once its delete has started it answers 409 `delete_started`. It takes what
|
|
1534
|
+
* `delete` takes: a key that writes (in the console, an organization admin).
|
|
1535
|
+
*/
|
|
1536
|
+
restore(id: string, options?: RequestOptions): Promise<CustomSource | FilesSource | GCSSource | WebSource>;
|
|
1147
1537
|
/** The apps you can connect. */
|
|
1148
1538
|
types(options?: RequestOptions): Promise<SourceType[]>;
|
|
1149
1539
|
}
|