@functional-systems/lambdadb 0.3.0-dev.2 → 0.3.0-dev.4
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 +129 -13
- package/dist/commonjs/client.d.ts +108 -18
- package/dist/commonjs/client.d.ts.map +1 -1
- package/dist/commonjs/client.js +220 -2
- package/dist/commonjs/client.js.map +1 -1
- package/dist/commonjs/index.d.ts +16 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +10 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/queryInput.d.ts +30 -0
- package/dist/commonjs/lib/queryInput.d.ts.map +1 -0
- package/dist/commonjs/lib/queryInput.js +18 -0
- package/dist/commonjs/lib/queryInput.js.map +1 -0
- package/dist/commonjs/types/errors.d.ts +34 -0
- package/dist/commonjs/types/errors.d.ts.map +1 -0
- package/dist/commonjs/types/errors.js +27 -0
- package/dist/commonjs/types/errors.js.map +1 -0
- package/dist/commonjs/types/public.d.ts +26 -0
- package/dist/commonjs/types/public.d.ts.map +1 -0
- package/dist/commonjs/types/public.js +7 -0
- package/dist/commonjs/types/public.js.map +1 -0
- package/dist/esm/client.d.ts +108 -18
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +221 -3
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/index.d.ts +16 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/queryInput.d.ts +30 -0
- package/dist/esm/lib/queryInput.d.ts.map +1 -0
- package/dist/esm/lib/queryInput.js +15 -0
- package/dist/esm/lib/queryInput.js.map +1 -0
- package/dist/esm/types/errors.d.ts +34 -0
- package/dist/esm/types/errors.d.ts.map +1 -0
- package/dist/esm/types/errors.js +8 -0
- package/dist/esm/types/errors.js.map +1 -0
- package/dist/esm/types/public.d.ts +26 -0
- package/dist/esm/types/public.d.ts.map +1 -0
- package/dist/esm/types/public.js +6 -0
- package/dist/esm/types/public.js.map +1 -0
- package/examples/collectionScoped.example.ts +9 -3
- package/examples/collectionsList.example.ts +5 -2
- package/package.json +2 -1
- package/src/client.ts +410 -19
- package/src/index.ts +25 -1
- package/src/lib/queryInput.ts +33 -0
- package/src/types/errors.ts +97 -0
- package/src/types/public.ts +45 -0
package/README.md
CHANGED
|
@@ -103,10 +103,78 @@ async function run() {
|
|
|
103
103
|
await collection.get();
|
|
104
104
|
await collection.docs.list({ size: 20 });
|
|
105
105
|
await collection.docs.upsert({ docs: [{ id: "1", text: "hello" }] });
|
|
106
|
+
// For large document sets (up to 200MB), use bulkUpsertDocs for a single-call flow
|
|
107
|
+
// await collection.docs.bulkUpsertDocs({ docs: largeDocArray });
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
run();
|
|
109
111
|
```
|
|
112
|
+
|
|
113
|
+
### TypeScript types
|
|
114
|
+
|
|
115
|
+
Import request and response types from the package for type-safe usage. Use the **input** types for method arguments and the **response** types for return values.
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import {
|
|
119
|
+
LambdaDBClient,
|
|
120
|
+
type CreateCollectionInput,
|
|
121
|
+
type QueryCollectionInput,
|
|
122
|
+
type QueryCollectionResponse,
|
|
123
|
+
type ListDocsInput,
|
|
124
|
+
type ListDocsResponse,
|
|
125
|
+
} from "@functional-systems/lambdadb";
|
|
126
|
+
|
|
127
|
+
const client = new LambdaDBClient({ projectApiKey: "..." });
|
|
128
|
+
const collection = client.collection("my-collection");
|
|
129
|
+
|
|
130
|
+
// Typed list params
|
|
131
|
+
const params: ListDocsInput = { size: 20, pageToken: undefined };
|
|
132
|
+
const listResult: ListDocsResponse = await collection.docs.list(params);
|
|
133
|
+
|
|
134
|
+
// Typed query body and response (or use createQueryInput helper)
|
|
135
|
+
const queryBody: QueryCollectionInput = {
|
|
136
|
+
query: { text: "hello" },
|
|
137
|
+
size: 10,
|
|
138
|
+
};
|
|
139
|
+
const queryResult: QueryCollectionResponse = await collection.query(queryBody);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Common types: `CreateCollectionInput`, `UpdateCollectionInput`, `QueryCollectionInput`, `ListDocsInput`, `UpsertDocsInput`, `DeleteDocsInput`, `FetchDocsInput`, `BulkUpsertInput`; response types such as `QueryCollectionResponse`, `ListDocsResponse`, `FetchDocsResponse`, `MessageResponse`; and model types like `IndexConfigsUnion`, `PartitionConfig`, `FieldsSelectorUnion`. All are exported from the main package.
|
|
143
|
+
|
|
144
|
+
### Pagination
|
|
145
|
+
|
|
146
|
+
Use `listPages()` to iterate over all pages without loading everything into memory, or `listAll()` to fetch all docs into a single list. Each page is one API response; the API limits response size by **payload**, not by document count, so the number of docs per page may be less than the requested `size` and can vary from page to page.
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { LambdaDBClient } from "@functional-systems/lambdadb";
|
|
150
|
+
|
|
151
|
+
const client = new LambdaDBClient({ projectApiKey: "..." });
|
|
152
|
+
const collection = client.collection("my-collection");
|
|
153
|
+
|
|
154
|
+
// Page-by-page (memory efficient)
|
|
155
|
+
for await (const page of collection.docs.listPages({ size: 50 })) {
|
|
156
|
+
console.log(page.docs.length, page.nextPageToken ?? "last page");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Or load all docs (for small/medium collections)
|
|
160
|
+
const { docs, total } = await collection.docs.listAll({ size: 100 });
|
|
161
|
+
console.log(docs.length, total);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Query helper
|
|
165
|
+
|
|
166
|
+
Use `createQueryInput()` to build query parameters for `collection.query()` or `collection.querySafe()`:
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { LambdaDBClient, createQueryInput } from "@functional-systems/lambdadb";
|
|
170
|
+
|
|
171
|
+
const client = new LambdaDBClient({ projectApiKey: "..." });
|
|
172
|
+
const collection = client.collection("my-collection");
|
|
173
|
+
|
|
174
|
+
const input = createQueryInput({ text: "hello" }, { size: 10 });
|
|
175
|
+
const result = await collection.query(input);
|
|
176
|
+
```
|
|
177
|
+
|
|
110
178
|
<!-- End SDK Example Usage [usage] -->
|
|
111
179
|
|
|
112
180
|
<!-- Start Authentication [security] -->
|
|
@@ -156,6 +224,7 @@ run();
|
|
|
156
224
|
|
|
157
225
|
* [listDocs](docs/sdks/docs/README.md#listdocs) - List documents in a collection.
|
|
158
226
|
* [upsert](docs/sdks/docs/README.md#upsert) - Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
|
|
227
|
+
* [bulkUpsertDocs](docs/sdks/docs/README.md#bulkupsertdocs) - Bulk upsert documents in one call (up to 200MB); use this for best DX when you have a document list.
|
|
159
228
|
* [getBulkUpsert](docs/sdks/docs/README.md#getbulkupsert) - Request required info to upload documents.
|
|
160
229
|
* [bulkUpsert](docs/sdks/docs/README.md#bulkupsert) - Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
|
|
161
230
|
* [update](docs/sdks/docs/README.md#update) - Update documents in a collection. Note that the maximum supported payload size is 6MB.
|
|
@@ -269,6 +338,22 @@ async function run() {
|
|
|
269
338
|
run();
|
|
270
339
|
|
|
271
340
|
```
|
|
341
|
+
|
|
342
|
+
**Timeout and request-level options:** You can set a request timeout (ms) and retry behavior when creating the client or per call. If not set, there is no request timeout. The `RetryConfig` type is exported from the package for typing your options.
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
import { LambdaDBClient, type RetryConfig } from "@functional-systems/lambdadb";
|
|
346
|
+
|
|
347
|
+
const client = new LambdaDBClient({
|
|
348
|
+
projectApiKey: "...",
|
|
349
|
+
timeoutMs: 30_000, // 30s timeout for all requests
|
|
350
|
+
retryConfig: { strategy: "backoff", retryConnectionErrors: true },
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// Override per request
|
|
354
|
+
await client.listCollections({ timeoutMs: 10_000, retries: { strategy: "none" } });
|
|
355
|
+
```
|
|
356
|
+
|
|
272
357
|
<!-- End Retries [retries] -->
|
|
273
358
|
|
|
274
359
|
<!-- Start Error Handling [errors] -->
|
|
@@ -285,10 +370,17 @@ run();
|
|
|
285
370
|
| `error.rawResponse` | `Response` | Raw HTTP response |
|
|
286
371
|
| `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
|
|
287
372
|
|
|
288
|
-
###
|
|
373
|
+
### Default methods (throw on error)
|
|
374
|
+
|
|
375
|
+
Regular methods throw on failure. Catch errors and use `instanceof` to narrow types. Error classes are exported from the main package:
|
|
376
|
+
|
|
289
377
|
```typescript
|
|
290
|
-
import {
|
|
291
|
-
|
|
378
|
+
import {
|
|
379
|
+
LambdaDBClient,
|
|
380
|
+
LambdaDBError,
|
|
381
|
+
UnauthenticatedError,
|
|
382
|
+
ResourceNotFoundError,
|
|
383
|
+
} from "@functional-systems/lambdadb";
|
|
292
384
|
|
|
293
385
|
const client = new LambdaDBClient({
|
|
294
386
|
projectApiKey: "<YOUR_PROJECT_API_KEY>",
|
|
@@ -299,25 +391,49 @@ async function run() {
|
|
|
299
391
|
const result = await client.listCollections();
|
|
300
392
|
console.log(result);
|
|
301
393
|
} catch (error) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
// Depending on the method different errors may be thrown
|
|
310
|
-
if (error instanceof errors.UnauthenticatedError) {
|
|
311
|
-
console.log(error.data$.message); // string
|
|
394
|
+
if (error instanceof LambdaDBError) {
|
|
395
|
+
console.log(error.message, error.statusCode, error.body);
|
|
396
|
+
if (error instanceof UnauthenticatedError) {
|
|
397
|
+
console.log(error.data$.message);
|
|
398
|
+
}
|
|
399
|
+
if (error instanceof ResourceNotFoundError) {
|
|
400
|
+
console.log("Not found:", error.data$);
|
|
312
401
|
}
|
|
313
402
|
}
|
|
314
403
|
}
|
|
315
404
|
}
|
|
316
405
|
|
|
317
406
|
run();
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Safe methods (return Result)
|
|
318
410
|
|
|
411
|
+
Use `*Safe` methods to get a `Result<T, E>` instead of throwing. You can handle errors without try/catch and narrow with type guards:
|
|
412
|
+
|
|
413
|
+
```typescript
|
|
414
|
+
import {
|
|
415
|
+
LambdaDBClient,
|
|
416
|
+
Result,
|
|
417
|
+
ResourceNotFoundError,
|
|
418
|
+
} from "@functional-systems/lambdadb";
|
|
419
|
+
|
|
420
|
+
const client = new LambdaDBClient({ projectApiKey: "..." });
|
|
421
|
+
|
|
422
|
+
const result = await client.listCollectionsSafe();
|
|
423
|
+
if (result.ok) {
|
|
424
|
+
console.log(result.value.collections);
|
|
425
|
+
} else {
|
|
426
|
+
const err = result.error;
|
|
427
|
+
if (err instanceof ResourceNotFoundError) {
|
|
428
|
+
console.log("Not found:", err.data$);
|
|
429
|
+
} else {
|
|
430
|
+
console.error(err);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
319
433
|
```
|
|
320
434
|
|
|
435
|
+
Available Safe methods: `listCollectionsSafe`, `createCollectionSafe`, `collection.getSafe`, `collection.updateSafe`, `collection.deleteSafe`, `collection.querySafe`, `collection.docs.listSafe`, `collection.docs.upsertSafe`, `collection.docs.updateSafe`, `collection.docs.deleteSafe`, `collection.docs.fetchSafe`, `collection.docs.getBulkUpsertSafe`, `collection.docs.bulkUpsertSafe`, `collection.docs.bulkUpsertDocsSafe`. The `Result` type and `OK` / `ERR` helpers are exported from the package.
|
|
436
|
+
|
|
321
437
|
### Error Classes
|
|
322
438
|
**Primary errors:**
|
|
323
439
|
* [`LambdaDBError`](./src/models/errors/lambdadberror.ts): The base class for HTTP error responses.
|
|
@@ -12,9 +12,16 @@
|
|
|
12
12
|
import { LambdaDBCore } from "./core.js";
|
|
13
13
|
import type { SDKOptions } from "./lib/config.js";
|
|
14
14
|
import type { RequestOptions } from "./lib/sdks.js";
|
|
15
|
+
import type { Result } from "./types/fp.js";
|
|
15
16
|
import type * as operations from "./models/operations/index.js";
|
|
16
17
|
import type * as models from "./models/index.js";
|
|
18
|
+
import type { CreateCollectionInput, UpdateCollectionInput, QueryCollectionInput, QueryCollectionResponse, ListDocsInput, ListDocsResponse, UpsertDocsInput, UpdateDocsInput, DeleteDocsInput, FetchDocsInput, FetchDocsResponse, BulkUpsertInput, MessageResponse, ListCollectionsResponse, CreateCollectionResponse, GetCollectionResponse, UpdateCollectionResponse, GetBulkUpsertDocsResponse } from "./types/public.js";
|
|
19
|
+
import type { ListCollectionsError, CreateCollectionError, GetCollectionError, UpdateCollectionError, DeleteCollectionError, QueryCollectionError, ListDocsError, UpsertDocsError, UpdateDocsError, DeleteDocsError, FetchDocsError, GetBulkUpsertDocsError, BulkUpsertDocsError } from "./types/errors.js";
|
|
17
20
|
export type { RequestOptions };
|
|
21
|
+
export type * from "./types/public.js";
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use types from the package root (e.g. CreateCollectionInput, QueryCollectionResponse, ListDocsInput). Will be removed in the next major version.
|
|
24
|
+
*/
|
|
18
25
|
export type { operations, models };
|
|
19
26
|
/** Default base URL for the LambdaDB API. */
|
|
20
27
|
export declare const DEFAULT_BASE_URL = "https://api.lambdadb.ai";
|
|
@@ -50,10 +57,18 @@ export declare class LambdaDBClient extends LambdaDBCore {
|
|
|
50
57
|
* List all collections in the project.
|
|
51
58
|
*/
|
|
52
59
|
listCollections(options?: RequestOptions): Promise<operations.ListCollectionsResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* List all collections (Safe: returns Result instead of throwing).
|
|
62
|
+
*/
|
|
63
|
+
listCollectionsSafe(options?: RequestOptions): Promise<Result<ListCollectionsResponse, ListCollectionsError>>;
|
|
53
64
|
/**
|
|
54
65
|
* Create a new collection.
|
|
55
66
|
*/
|
|
56
|
-
createCollection(request:
|
|
67
|
+
createCollection(request: CreateCollectionInput, options?: RequestOptions): Promise<operations.CreateCollectionResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a new collection (Safe: returns Result instead of throwing).
|
|
70
|
+
*/
|
|
71
|
+
createCollectionSafe(request: CreateCollectionInput, options?: RequestOptions): Promise<Result<CreateCollectionResponse, CreateCollectionError>>;
|
|
57
72
|
}
|
|
58
73
|
/**
|
|
59
74
|
* Handle for a single collection. All methods operate on this collection.
|
|
@@ -66,18 +81,37 @@ export declare class CollectionHandle {
|
|
|
66
81
|
* Get metadata of this collection.
|
|
67
82
|
*/
|
|
68
83
|
get(options?: RequestOptions): Promise<operations.GetCollectionResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Get metadata of this collection (Safe: returns Result instead of throwing).
|
|
86
|
+
*/
|
|
87
|
+
getSafe(options?: RequestOptions): Promise<Result<GetCollectionResponse, GetCollectionError>>;
|
|
69
88
|
/**
|
|
70
89
|
* Configure (update) this collection.
|
|
71
90
|
*/
|
|
72
|
-
update(requestBody:
|
|
91
|
+
update(requestBody: UpdateCollectionInput, options?: RequestOptions): Promise<operations.UpdateCollectionResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Configure (update) this collection (Safe: returns Result instead of throwing).
|
|
94
|
+
*/
|
|
95
|
+
updateSafe(requestBody: UpdateCollectionInput, options?: RequestOptions): Promise<Result<UpdateCollectionResponse, UpdateCollectionError>>;
|
|
73
96
|
/**
|
|
74
97
|
* Delete this collection.
|
|
75
98
|
*/
|
|
76
99
|
delete(options?: RequestOptions): Promise<models.MessageResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* Delete this collection (Safe: returns Result instead of throwing).
|
|
102
|
+
*/
|
|
103
|
+
deleteSafe(options?: RequestOptions): Promise<Result<MessageResponse, DeleteCollectionError>>;
|
|
77
104
|
/**
|
|
78
105
|
* Search this collection with a query.
|
|
106
|
+
* When the API returns docs via docsUrl (isDocsInline false), documents are
|
|
107
|
+
* fetched from the presigned URL automatically so the response always has docs.
|
|
79
108
|
*/
|
|
80
|
-
query(requestBody:
|
|
109
|
+
query(requestBody: QueryCollectionInput, options?: RequestOptions): Promise<QueryCollectionResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Search this collection with a query (Safe: returns Result instead of throwing).
|
|
112
|
+
* When the API returns docs via docsUrl, documents are fetched from the presigned URL automatically.
|
|
113
|
+
*/
|
|
114
|
+
querySafe(requestBody: QueryCollectionInput, options?: RequestOptions): Promise<Result<QueryCollectionResponse, QueryCollectionError>>;
|
|
81
115
|
readonly docs: CollectionDocs;
|
|
82
116
|
}
|
|
83
117
|
/**
|
|
@@ -90,39 +124,95 @@ declare class CollectionDocs {
|
|
|
90
124
|
/**
|
|
91
125
|
* List documents in the collection.
|
|
92
126
|
*/
|
|
93
|
-
list(params?:
|
|
94
|
-
size?: number;
|
|
95
|
-
pageToken?: string;
|
|
96
|
-
}, options?: RequestOptions): Promise<operations.ListDocsResponse>;
|
|
127
|
+
list(params?: ListDocsInput, options?: RequestOptions): Promise<operations.ListDocsResponse>;
|
|
97
128
|
/**
|
|
98
|
-
*
|
|
129
|
+
* List documents in the collection (Safe: returns Result instead of throwing).
|
|
99
130
|
*/
|
|
100
|
-
|
|
131
|
+
listSafe(params?: ListDocsInput, options?: RequestOptions): Promise<Result<ListDocsResponse, ListDocsError>>;
|
|
132
|
+
/**
|
|
133
|
+
* Iterate over all pages of documents. Yields one page per API response (with docs and nextPageToken).
|
|
134
|
+
* Use this to process large result sets without loading everything into memory.
|
|
135
|
+
*
|
|
136
|
+
* Note: The API limits response size by payload, not by document count. The number of docs per page
|
|
137
|
+
* may be less than the requested `size` and can vary from page to page.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* for await (const page of collection.docs.listPages({ size: 50 })) {
|
|
141
|
+
* console.log(page.docs.length, page.nextPageToken ?? "last page");
|
|
142
|
+
* }
|
|
143
|
+
*/
|
|
144
|
+
listPages(params?: ListDocsInput, options?: RequestOptions): AsyncGenerator<ListDocsResponse>;
|
|
145
|
+
/**
|
|
146
|
+
* Fetch all documents across pages and return a single list. Uses listPages internally.
|
|
147
|
+
* For large collections, prefer listPages() to avoid high memory use.
|
|
148
|
+
*
|
|
149
|
+
* Note: Page size is constrained by API payload limits, so the number of docs per page may vary.
|
|
150
|
+
*/
|
|
151
|
+
listAll(params?: ListDocsInput, options?: RequestOptions): Promise<{
|
|
101
152
|
docs: Array<Record<string, unknown>>;
|
|
102
|
-
|
|
153
|
+
total: number;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Upsert documents. Max payload 6MB.
|
|
157
|
+
*/
|
|
158
|
+
upsert(body: UpsertDocsInput, options?: RequestOptions): Promise<MessageResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* Upsert documents (Safe: returns Result instead of throwing). Max payload 6MB.
|
|
161
|
+
*/
|
|
162
|
+
upsertSafe(body: UpsertDocsInput, options?: RequestOptions): Promise<Result<MessageResponse, UpsertDocsError>>;
|
|
103
163
|
/**
|
|
104
164
|
* Update documents (each doc must have id). Max payload 6MB.
|
|
105
165
|
*/
|
|
106
|
-
update(body:
|
|
107
|
-
|
|
108
|
-
|
|
166
|
+
update(body: UpdateDocsInput, options?: RequestOptions): Promise<MessageResponse>;
|
|
167
|
+
/**
|
|
168
|
+
* Update documents (Safe: returns Result instead of throwing). Max payload 6MB.
|
|
169
|
+
*/
|
|
170
|
+
updateSafe(body: UpdateDocsInput, options?: RequestOptions): Promise<Result<MessageResponse, UpdateDocsError>>;
|
|
109
171
|
/**
|
|
110
172
|
* Delete documents by ids and/or filter.
|
|
111
173
|
*/
|
|
112
|
-
delete(body:
|
|
174
|
+
delete(body: DeleteDocsInput, options?: RequestOptions): Promise<MessageResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Delete documents by ids and/or filter (Safe: returns Result instead of throwing).
|
|
177
|
+
*/
|
|
178
|
+
deleteSafe(body: DeleteDocsInput, options?: RequestOptions): Promise<Result<MessageResponse, DeleteDocsError>>;
|
|
113
179
|
/**
|
|
114
180
|
* Fetch documents by IDs (max 100).
|
|
181
|
+
* When the API returns docs via docsUrl (isDocsInline false), documents are
|
|
182
|
+
* fetched from the presigned URL automatically so the response always has docs.
|
|
115
183
|
*/
|
|
116
|
-
fetch(body:
|
|
184
|
+
fetch(body: FetchDocsInput, options?: RequestOptions): Promise<FetchDocsResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* Fetch documents by IDs (Safe: returns Result instead of throwing).
|
|
187
|
+
* When the API returns docs via docsUrl, documents are fetched from the presigned URL automatically.
|
|
188
|
+
*/
|
|
189
|
+
fetchSafe(body: FetchDocsInput, options?: RequestOptions): Promise<Result<FetchDocsResponse, FetchDocsError>>;
|
|
117
190
|
/**
|
|
118
191
|
* Get presigned URL and metadata for bulk upload (up to 200MB).
|
|
119
192
|
*/
|
|
120
193
|
getBulkUpsert(options?: RequestOptions): Promise<operations.GetBulkUpsertDocsResponse>;
|
|
194
|
+
/**
|
|
195
|
+
* Get presigned URL and metadata for bulk upload (Safe: returns Result instead of throwing).
|
|
196
|
+
*/
|
|
197
|
+
getBulkUpsertSafe(options?: RequestOptions): Promise<Result<GetBulkUpsertDocsResponse, GetBulkUpsertDocsError>>;
|
|
121
198
|
/**
|
|
122
199
|
* Trigger bulk upsert with an object key from getBulkUpsert().
|
|
123
200
|
*/
|
|
124
|
-
bulkUpsert(body:
|
|
125
|
-
|
|
126
|
-
|
|
201
|
+
bulkUpsert(body: BulkUpsertInput, options?: RequestOptions): Promise<MessageResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* Trigger bulk upsert (Safe: returns Result instead of throwing).
|
|
204
|
+
*/
|
|
205
|
+
bulkUpsertSafe(body: BulkUpsertInput, options?: RequestOptions): Promise<Result<MessageResponse, BulkUpsertDocsError>>;
|
|
206
|
+
/**
|
|
207
|
+
* Bulk upsert documents in one call (up to 200MB). Abstracts getBulkUpsert,
|
|
208
|
+
* S3 upload via presigned URL, and bulkUpsert. Use this for better DX when
|
|
209
|
+
* you have a document list; use getBulkUpsert + bulkUpsert for low-level control.
|
|
210
|
+
*/
|
|
211
|
+
bulkUpsertDocs(body: UpsertDocsInput, options?: RequestOptions): Promise<MessageResponse>;
|
|
212
|
+
/**
|
|
213
|
+
* Bulk upsert documents in one call (Safe: returns Result instead of throwing).
|
|
214
|
+
* May return Error for local failures (payload size, upload). API errors use GetBulkUpsertDocsError or BulkUpsertDocsError.
|
|
215
|
+
*/
|
|
216
|
+
bulkUpsertDocsSafe(body: UpsertDocsInput, options?: RequestOptions): Promise<Result<MessageResponse, GetBulkUpsertDocsError | BulkUpsertDocsError | Error>>;
|
|
127
217
|
}
|
|
128
218
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAclD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAclD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EAEvB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EAEjB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,mBAAmB,CAA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