@mixedbread/sdk 0.15.0 → 0.17.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +31 -0
  3. package/bin/migration-config.json +4 -0
  4. package/client.d.mts +8 -6
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +8 -6
  7. package/client.d.ts.map +1 -1
  8. package/client.js.map +1 -1
  9. package/client.mjs.map +1 -1
  10. package/core/pagination.d.mts +10 -16
  11. package/core/pagination.d.mts.map +1 -1
  12. package/core/pagination.d.ts +10 -16
  13. package/core/pagination.d.ts.map +1 -1
  14. package/core/pagination.js.map +1 -1
  15. package/core/pagination.mjs.map +1 -1
  16. package/internal/request-options.d.mts +42 -0
  17. package/internal/request-options.d.mts.map +1 -1
  18. package/internal/request-options.d.ts +42 -0
  19. package/internal/request-options.d.ts.map +1 -1
  20. package/internal/request-options.js.map +1 -1
  21. package/internal/request-options.mjs.map +1 -1
  22. package/package.json +1 -1
  23. package/resources/data-sources/connectors.d.mts +5 -106
  24. package/resources/data-sources/connectors.d.mts.map +1 -1
  25. package/resources/data-sources/connectors.d.ts +5 -106
  26. package/resources/data-sources/connectors.d.ts.map +1 -1
  27. package/resources/data-sources/connectors.js +2 -1
  28. package/resources/data-sources/connectors.js.map +1 -1
  29. package/resources/data-sources/connectors.mjs +2 -1
  30. package/resources/data-sources/connectors.mjs.map +1 -1
  31. package/resources/data-sources/data-sources.d.mts +7 -108
  32. package/resources/data-sources/data-sources.d.mts.map +1 -1
  33. package/resources/data-sources/data-sources.d.ts +7 -108
  34. package/resources/data-sources/data-sources.d.ts.map +1 -1
  35. package/resources/data-sources/data-sources.js +2 -1
  36. package/resources/data-sources/data-sources.js.map +1 -1
  37. package/resources/data-sources/data-sources.mjs +2 -1
  38. package/resources/data-sources/data-sources.mjs.map +1 -1
  39. package/resources/data-sources/index.d.mts +2 -2
  40. package/resources/data-sources/index.d.mts.map +1 -1
  41. package/resources/data-sources/index.d.ts +2 -2
  42. package/resources/data-sources/index.d.ts.map +1 -1
  43. package/resources/embeddings.d.mts +1 -1
  44. package/resources/embeddings.d.mts.map +1 -1
  45. package/resources/embeddings.d.ts +1 -1
  46. package/resources/embeddings.d.ts.map +1 -1
  47. package/resources/files.d.mts +5 -103
  48. package/resources/files.d.mts.map +1 -1
  49. package/resources/files.d.ts +5 -103
  50. package/resources/files.d.ts.map +1 -1
  51. package/resources/files.js +2 -1
  52. package/resources/files.js.map +1 -1
  53. package/resources/files.mjs +2 -1
  54. package/resources/files.mjs.map +1 -1
  55. package/resources/index.d.mts +3 -3
  56. package/resources/index.d.mts.map +1 -1
  57. package/resources/index.d.ts +3 -3
  58. package/resources/index.d.ts.map +1 -1
  59. package/resources/parsing/index.d.mts +1 -1
  60. package/resources/parsing/index.d.mts.map +1 -1
  61. package/resources/parsing/index.d.ts +1 -1
  62. package/resources/parsing/index.d.ts.map +1 -1
  63. package/resources/parsing/index.js.map +1 -1
  64. package/resources/parsing/index.mjs.map +1 -1
  65. package/resources/parsing/jobs.d.mts +33 -134
  66. package/resources/parsing/jobs.d.mts.map +1 -1
  67. package/resources/parsing/jobs.d.ts +33 -134
  68. package/resources/parsing/jobs.d.ts.map +1 -1
  69. package/resources/parsing/jobs.js +2 -1
  70. package/resources/parsing/jobs.js.map +1 -1
  71. package/resources/parsing/jobs.mjs +2 -1
  72. package/resources/parsing/jobs.mjs.map +1 -1
  73. package/resources/parsing/parsing.d.mts +2 -2
  74. package/resources/parsing/parsing.d.mts.map +1 -1
  75. package/resources/parsing/parsing.d.ts +2 -2
  76. package/resources/parsing/parsing.d.ts.map +1 -1
  77. package/resources/parsing/parsing.js.map +1 -1
  78. package/resources/parsing/parsing.mjs.map +1 -1
  79. package/resources/vector-stores/files.d.mts +135 -95
  80. package/resources/vector-stores/files.d.mts.map +1 -1
  81. package/resources/vector-stores/files.d.ts +135 -95
  82. package/resources/vector-stores/files.d.ts.map +1 -1
  83. package/resources/vector-stores/files.js +7 -3
  84. package/resources/vector-stores/files.js.map +1 -1
  85. package/resources/vector-stores/files.mjs +7 -3
  86. package/resources/vector-stores/files.mjs.map +1 -1
  87. package/resources/vector-stores/index.d.mts +2 -2
  88. package/resources/vector-stores/index.d.mts.map +1 -1
  89. package/resources/vector-stores/index.d.ts +2 -2
  90. package/resources/vector-stores/index.d.ts.map +1 -1
  91. package/resources/vector-stores/vector-stores.d.mts +23 -117
  92. package/resources/vector-stores/vector-stores.d.mts.map +1 -1
  93. package/resources/vector-stores/vector-stores.d.ts +23 -117
  94. package/resources/vector-stores/vector-stores.d.ts.map +1 -1
  95. package/resources/vector-stores/vector-stores.js +2 -1
  96. package/resources/vector-stores/vector-stores.js.map +1 -1
  97. package/resources/vector-stores/vector-stores.mjs +2 -1
  98. package/resources/vector-stores/vector-stores.mjs.map +1 -1
  99. package/src/client.ts +8 -6
  100. package/src/core/pagination.ts +10 -18
  101. package/src/internal/request-options.ts +53 -0
  102. package/src/resources/data-sources/connectors.ts +11 -118
  103. package/src/resources/data-sources/data-sources.ts +9 -120
  104. package/src/resources/data-sources/index.ts +2 -2
  105. package/src/resources/embeddings.ts +2 -1
  106. package/src/resources/files.ts +7 -115
  107. package/src/resources/index.ts +3 -3
  108. package/src/resources/parsing/index.ts +1 -0
  109. package/src/resources/parsing/jobs.ts +38 -145
  110. package/src/resources/parsing/parsing.ts +2 -0
  111. package/src/resources/vector-stores/files.ts +167 -103
  112. package/src/resources/vector-stores/index.ts +2 -2
  113. package/src/resources/vector-stores/vector-stores.ts +29 -132
  114. package/src/version.ts +1 -1
  115. package/version.d.mts +1 -1
  116. package/version.d.ts +1 -1
  117. package/version.js +1 -1
  118. package/version.mjs +1 -1
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
5
6
  import { type Uploadable } from '../core/uploads';
6
7
  import { buildHeaders } from '../internal/headers';
7
8
  import { RequestOptions } from '../internal/request-options';
@@ -55,8 +56,8 @@ export class Files extends APIResource {
55
56
  list(
56
57
  query: FileListParams | null | undefined = {},
57
58
  options?: RequestOptions,
58
- ): APIPromise<FileListResponse> {
59
- return this._client.get('/v1/files', { query, ...options });
59
+ ): PagePromise<FileObjectsCursor, FileObject> {
60
+ return this._client.getAPIList('/v1/files', Cursor<FileObject>, { query, ...options });
60
61
  }
61
62
 
62
63
  /**
@@ -86,6 +87,8 @@ export class Files extends APIResource {
86
87
  }
87
88
  }
88
89
 
90
+ export type FileObjectsCursor = Cursor<FileObject>;
91
+
89
92
  /**
90
93
  * A model representing a file object in the system.
91
94
  *
@@ -149,95 +152,6 @@ export interface PaginationWithTotal {
149
152
  total?: number;
150
153
  }
151
154
 
152
- export interface FileListResponse {
153
- /**
154
- * Response model for cursor-based pagination.
155
- *
156
- * Examples: Forward pagination response: { "has_more": true, "first_cursor":
157
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor":
158
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null }
159
- *
160
- * Final page response:
161
- * {
162
- * "has_more": false,
163
- * "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9",
164
- * "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==",
165
- * "total": 42
166
- * }
167
- *
168
- * Empty results:
169
- * {
170
- * "has_more": false,
171
- * "first_cursor": null,
172
- * "last_cursor": null,
173
- * "total": 0
174
- * }
175
- */
176
- pagination: FileListResponse.Pagination;
177
-
178
- /**
179
- * The object type of the response
180
- */
181
- object?: 'list';
182
-
183
- /**
184
- * The list of files
185
- */
186
- data: Array<FileObject>;
187
- }
188
-
189
- export namespace FileListResponse {
190
- /**
191
- * Response model for cursor-based pagination.
192
- *
193
- * Examples: Forward pagination response: { "has_more": true, "first_cursor":
194
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor":
195
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null }
196
- *
197
- * Final page response:
198
- * {
199
- * "has_more": false,
200
- * "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9",
201
- * "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==",
202
- * "total": 42
203
- * }
204
- *
205
- * Empty results:
206
- * {
207
- * "has_more": false,
208
- * "first_cursor": null,
209
- * "last_cursor": null,
210
- * "total": 0
211
- * }
212
- */
213
- export interface Pagination {
214
- /**
215
- * Contextual direction-aware flag: True if more items exist in the requested
216
- * pagination direction. For 'after': more items after this page. For 'before':
217
- * more items before this page.
218
- */
219
- has_more: boolean;
220
-
221
- /**
222
- * Cursor of the first item in this page. Use for backward pagination. None if page
223
- * is empty.
224
- */
225
- first_cursor: string | null;
226
-
227
- /**
228
- * Cursor of the last item in this page. Use for forward pagination. None if page
229
- * is empty.
230
- */
231
- last_cursor: string | null;
232
-
233
- /**
234
- * Total number of items available across all pages. Only included when
235
- * include_total=true was requested. Expensive operation - use sparingly.
236
- */
237
- total?: number | null;
238
- }
239
- }
240
-
241
155
  export interface FileDeleteResponse {
242
156
  /**
243
157
  * The ID of the deleted file
@@ -269,29 +183,7 @@ export interface FileUpdateParams {
269
183
  file: Uploadable;
270
184
  }
271
185
 
272
- export interface FileListParams {
273
- /**
274
- * Maximum number of items to return per page (1-100)
275
- */
276
- limit?: number;
277
-
278
- /**
279
- * Cursor for forward pagination - get items after this position. Use last_cursor
280
- * from previous response.
281
- */
282
- after?: string | null;
283
-
284
- /**
285
- * Cursor for backward pagination - get items before this position. Use
286
- * first_cursor from previous response.
287
- */
288
- before?: string | null;
289
-
290
- /**
291
- * Whether to include total count in response (expensive operation)
292
- */
293
- include_total?: boolean;
294
-
186
+ export interface FileListParams extends CursorParams {
295
187
  /**
296
188
  * Search query for fuzzy matching over name and description fields
297
189
  */
@@ -302,8 +194,8 @@ export declare namespace Files {
302
194
  export {
303
195
  type FileObject as FileObject,
304
196
  type PaginationWithTotal as PaginationWithTotal,
305
- type FileListResponse as FileListResponse,
306
197
  type FileDeleteResponse as FileDeleteResponse,
198
+ type FileObjectsCursor as FileObjectsCursor,
307
199
  type FileCreateParams as FileCreateParams,
308
200
  type FileUpdateParams as FileUpdateParams,
309
201
  type FileListParams as FileListParams,
@@ -19,11 +19,11 @@ export {
19
19
  type LinearDataSource,
20
20
  type NotionDataSource,
21
21
  type Oauth2Params,
22
- type DataSourceListResponse,
23
22
  type DataSourceDeleteResponse,
24
23
  type DataSourceCreateParams,
25
24
  type DataSourceUpdateParams,
26
25
  type DataSourceListParams,
26
+ type DataSourcesCursor,
27
27
  } from './data-sources/data-sources';
28
28
  export { Embeddings, type EncodingFormat, type ObjectType, type EmbeddingCreateParams } from './embeddings';
29
29
  export { Extractions } from './extractions/extractions';
@@ -31,11 +31,11 @@ export {
31
31
  Files,
32
32
  type FileObject,
33
33
  type PaginationWithTotal,
34
- type FileListResponse,
35
34
  type FileDeleteResponse,
36
35
  type FileCreateParams,
37
36
  type FileUpdateParams,
38
37
  type FileListParams,
38
+ type FileObjectsCursor,
39
39
  } from './files';
40
40
  export { Parsing } from './parsing/parsing';
41
41
  export {
@@ -47,7 +47,6 @@ export {
47
47
  type ScoredVideoURLInputChunk,
48
48
  type VectorStore,
49
49
  type VectorStoreChunkSearchOptions,
50
- type VectorStoreListResponse,
51
50
  type VectorStoreDeleteResponse,
52
51
  type VectorStoreQuestionAnsweringResponse,
53
52
  type VectorStoreSearchResponse,
@@ -56,6 +55,7 @@ export {
56
55
  type VectorStoreListParams,
57
56
  type VectorStoreQuestionAnsweringParams,
58
57
  type VectorStoreSearchParams,
58
+ type VectorStoresCursor,
59
59
  } from './vector-stores/vector-stores';
60
60
  export {
61
61
  type Embedding,
@@ -11,5 +11,6 @@ export {
11
11
  type JobDeleteResponse,
12
12
  type JobCreateParams,
13
13
  type JobListParams,
14
+ type JobListResponsesCursor,
14
15
  } from './jobs';
15
16
  export { Parsing } from './parsing';
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as JobsAPI from './jobs';
5
5
  import { APIPromise } from '../../core/api-promise';
6
+ import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
6
7
  import { RequestOptions } from '../../internal/request-options';
7
8
  import { path } from '../../internal/utils/path';
8
9
  import * as polling from '../../lib/polling';
@@ -38,8 +39,11 @@ export class Jobs extends APIResource {
38
39
  *
39
40
  * Returns: List of parsing jobs with pagination.
40
41
  */
41
- list(query: JobListParams | null | undefined = {}, options?: RequestOptions): APIPromise<JobListResponse> {
42
- return this._client.get('/v1/parsing/jobs', { query, ...options });
42
+ list(
43
+ query: JobListParams | null | undefined = {},
44
+ options?: RequestOptions,
45
+ ): PagePromise<JobListResponsesCursor, JobListResponse> {
46
+ return this._client.getAPIList('/v1/parsing/jobs', Cursor<JobListResponse>, { query, ...options });
43
47
  }
44
48
 
45
49
  /**
@@ -157,6 +161,8 @@ export class Jobs extends APIResource {
157
161
  }
158
162
  }
159
163
 
164
+ export type JobListResponsesCursor = Cursor<JobListResponse>;
165
+
160
166
  /**
161
167
  * Strategy used for chunking document content.
162
168
  */
@@ -337,145 +343,53 @@ export namespace ParsingJob {
337
343
  export type ReturnFormat = 'html' | 'markdown' | 'plain';
338
344
 
339
345
  /**
340
- * A list of parsing jobs with pagination.
346
+ * A parsing job item for list responses, omitting result and error fields.
341
347
  */
342
348
  export interface JobListResponse {
343
349
  /**
344
- * Response model for cursor-based pagination.
345
- *
346
- * Examples: Forward pagination response: { "has_more": true, "first_cursor":
347
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor":
348
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null }
349
- *
350
- * Final page response:
351
- * {
352
- * "has_more": false,
353
- * "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9",
354
- * "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==",
355
- * "total": 42
356
- * }
357
- *
358
- * Empty results:
359
- * {
360
- * "has_more": false,
361
- * "first_cursor": null,
362
- * "last_cursor": null,
363
- * "total": 0
364
- * }
350
+ * The ID of the job
365
351
  */
366
- pagination: JobListResponse.Pagination;
352
+ id: string;
367
353
 
368
354
  /**
369
- * The list of parsing jobs
355
+ * The ID of the file to parse
370
356
  */
371
- data: Array<JobListResponse.Data>;
357
+ file_id: string;
372
358
 
373
359
  /**
374
- * The object type of the response
360
+ * The name of the file
375
361
  */
376
- object?: 'list';
377
- }
362
+ filename?: string | null;
378
363
 
379
- export namespace JobListResponse {
380
364
  /**
381
- * Response model for cursor-based pagination.
382
- *
383
- * Examples: Forward pagination response: { "has_more": true, "first_cursor":
384
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMSIsImlkIjoiYWJjMTIzIn0=", "last_cursor":
385
- * "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMCIsImlkIjoieHl6Nzg5In0=", "total": null }
386
- *
387
- * Final page response:
388
- * {
389
- * "has_more": false,
390
- * "first_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOSIsImlkIjoibGFzdDEyMyJ9",
391
- * "last_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0yOCIsImlkIjoiZmluYWw0NTYifQ==",
392
- * "total": 42
393
- * }
394
- *
395
- * Empty results:
396
- * {
397
- * "has_more": false,
398
- * "first_cursor": null,
399
- * "last_cursor": null,
400
- * "total": 0
401
- * }
402
- */
403
- export interface Pagination {
404
- /**
405
- * Contextual direction-aware flag: True if more items exist in the requested
406
- * pagination direction. For 'after': more items after this page. For 'before':
407
- * more items before this page.
408
- */
409
- has_more: boolean;
410
-
411
- /**
412
- * Cursor of the first item in this page. Use for backward pagination. None if page
413
- * is empty.
414
- */
415
- first_cursor: string | null;
416
-
417
- /**
418
- * Cursor of the last item in this page. Use for forward pagination. None if page
419
- * is empty.
420
- */
421
- last_cursor: string | null;
422
-
423
- /**
424
- * Total number of items available across all pages. Only included when
425
- * include_total=true was requested. Expensive operation - use sparingly.
426
- */
427
- total?: number | null;
428
- }
365
+ * The status of the job
366
+ */
367
+ status: ParsingJobStatus;
429
368
 
430
369
  /**
431
- * A parsing job item for list responses, omitting result and error fields.
370
+ * The started time of the job
432
371
  */
433
- export interface Data {
434
- /**
435
- * The ID of the job
436
- */
437
- id: string;
438
-
439
- /**
440
- * The ID of the file to parse
441
- */
442
- file_id: string;
443
-
444
- /**
445
- * The name of the file
446
- */
447
- filename?: string | null;
448
-
449
- /**
450
- * The status of the job
451
- */
452
- status: JobsAPI.ParsingJobStatus;
453
-
454
- /**
455
- * The started time of the job
456
- */
457
- started_at?: string | null;
372
+ started_at?: string | null;
458
373
 
459
- /**
460
- * The finished time of the job
461
- */
462
- finished_at?: string | null;
374
+ /**
375
+ * The finished time of the job
376
+ */
377
+ finished_at?: string | null;
463
378
 
464
- /**
465
- * The creation time of the job
466
- */
467
- created_at?: string;
379
+ /**
380
+ * The creation time of the job
381
+ */
382
+ created_at?: string;
468
383
 
469
- /**
470
- * The updated time of the job
471
- */
472
- updated_at?: string | null;
384
+ /**
385
+ * The updated time of the job
386
+ */
387
+ updated_at?: string | null;
473
388
 
474
- /**
475
- * The type of the object
476
- */
477
- object?: 'parsing_job';
478
- }
389
+ /**
390
+ * The type of the object
391
+ */
392
+ object?: 'parsing_job';
479
393
  }
480
394
 
481
395
  /**
@@ -525,29 +439,7 @@ export interface JobCreateParams {
525
439
  mode?: 'fast' | 'high_quality';
526
440
  }
527
441
 
528
- export interface JobListParams {
529
- /**
530
- * Maximum number of items to return per page (1-100)
531
- */
532
- limit?: number;
533
-
534
- /**
535
- * Cursor for forward pagination - get items after this position. Use last_cursor
536
- * from previous response.
537
- */
538
- after?: string | null;
539
-
540
- /**
541
- * Cursor for backward pagination - get items before this position. Use
542
- * first_cursor from previous response.
543
- */
544
- before?: string | null;
545
-
546
- /**
547
- * Whether to include total count in response (expensive operation)
548
- */
549
- include_total?: boolean;
550
-
442
+ export interface JobListParams extends CursorParams {
551
443
  /**
552
444
  * Status to filter by
553
445
  */
@@ -568,6 +460,7 @@ export declare namespace Jobs {
568
460
  type ReturnFormat as ReturnFormat,
569
461
  type JobListResponse as JobListResponse,
570
462
  type JobDeleteResponse as JobDeleteResponse,
463
+ type JobListResponsesCursor as JobListResponsesCursor,
571
464
  type JobCreateParams as JobCreateParams,
572
465
  type JobListParams as JobListParams,
573
466
  };
@@ -9,6 +9,7 @@ import {
9
9
  JobDeleteResponse,
10
10
  JobListParams,
11
11
  JobListResponse,
12
+ JobListResponsesCursor,
12
13
  Jobs,
13
14
  ParsingJob,
14
15
  ParsingJobStatus,
@@ -31,6 +32,7 @@ export declare namespace Parsing {
31
32
  type ReturnFormat as ReturnFormat,
32
33
  type JobListResponse as JobListResponse,
33
34
  type JobDeleteResponse as JobDeleteResponse,
35
+ type JobListResponsesCursor as JobListResponsesCursor,
34
36
  type JobCreateParams as JobCreateParams,
35
37
  type JobListParams as JobListParams,
36
38
  };