@mixedbread/sdk 0.9.3 → 0.10.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/CHANGELOG.md +29 -0
- package/README.md +21 -0
- package/client.d.mts +9 -10
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -10
- package/client.d.ts.map +1 -1
- package/client.js +3 -15
- package/client.js.map +1 -1
- package/client.mjs +3 -15
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +29 -0
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +29 -0
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +31 -1
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +29 -0
- package/core/pagination.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/package.json +5 -2
- package/resources/data-sources/connectors.d.mts +11 -7
- package/resources/data-sources/connectors.d.mts.map +1 -1
- package/resources/data-sources/connectors.d.ts +11 -7
- package/resources/data-sources/connectors.d.ts.map +1 -1
- package/resources/data-sources/connectors.js +1 -1
- package/resources/data-sources/connectors.js.map +1 -1
- package/resources/data-sources/connectors.mjs +2 -2
- package/resources/data-sources/connectors.mjs.map +1 -1
- package/resources/data-sources/data-sources.d.mts +10 -8
- package/resources/data-sources/data-sources.d.mts.map +1 -1
- package/resources/data-sources/data-sources.d.ts +10 -8
- package/resources/data-sources/data-sources.d.ts.map +1 -1
- package/resources/data-sources/data-sources.js +1 -1
- package/resources/data-sources/data-sources.js.map +1 -1
- package/resources/data-sources/data-sources.mjs +2 -2
- package/resources/data-sources/data-sources.mjs.map +1 -1
- package/resources/data-sources/index.d.mts +2 -2
- package/resources/data-sources/index.d.mts.map +1 -1
- package/resources/data-sources/index.d.ts +2 -2
- package/resources/data-sources/index.d.ts.map +1 -1
- package/resources/extractions/content.d.mts +6 -2
- package/resources/extractions/content.d.mts.map +1 -1
- package/resources/extractions/content.d.ts +6 -2
- package/resources/extractions/content.d.ts.map +1 -1
- package/resources/extractions/jobs.d.mts +9 -3
- package/resources/extractions/jobs.d.mts.map +1 -1
- package/resources/extractions/jobs.d.ts +9 -3
- package/resources/extractions/jobs.d.ts.map +1 -1
- package/resources/extractions/schema.d.mts +15 -5
- package/resources/extractions/schema.d.mts.map +1 -1
- package/resources/extractions/schema.d.ts +15 -5
- package/resources/extractions/schema.d.ts.map +1 -1
- package/resources/files.d.mts +5 -5
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +5 -5
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +1 -1
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +2 -2
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/parsing/index.d.mts +1 -1
- package/resources/parsing/index.d.mts.map +1 -1
- package/resources/parsing/index.d.ts +1 -1
- package/resources/parsing/index.d.ts.map +1 -1
- package/resources/parsing/jobs.d.mts +5 -5
- package/resources/parsing/jobs.d.mts.map +1 -1
- package/resources/parsing/jobs.d.ts +5 -5
- package/resources/parsing/jobs.d.ts.map +1 -1
- package/resources/parsing/jobs.js +1 -1
- package/resources/parsing/jobs.js.map +1 -1
- package/resources/parsing/jobs.mjs +2 -2
- package/resources/parsing/jobs.mjs.map +1 -1
- package/resources/parsing/parsing.d.mts +2 -2
- package/resources/parsing/parsing.d.mts.map +1 -1
- package/resources/parsing/parsing.d.ts +2 -2
- package/resources/parsing/parsing.d.ts.map +1 -1
- package/resources/vector-stores/files.d.mts +9 -5
- package/resources/vector-stores/files.d.mts.map +1 -1
- package/resources/vector-stores/files.d.ts +9 -5
- package/resources/vector-stores/files.d.ts.map +1 -1
- package/resources/vector-stores/files.js +1 -1
- package/resources/vector-stores/files.js.map +1 -1
- package/resources/vector-stores/files.mjs +2 -2
- package/resources/vector-stores/files.mjs.map +1 -1
- package/resources/vector-stores/index.d.mts +2 -2
- package/resources/vector-stores/index.d.mts.map +1 -1
- package/resources/vector-stores/index.d.ts +2 -2
- package/resources/vector-stores/index.d.ts.map +1 -1
- package/resources/vector-stores/vector-stores.d.mts +31 -7
- package/resources/vector-stores/vector-stores.d.mts.map +1 -1
- package/resources/vector-stores/vector-stores.d.ts +31 -7
- package/resources/vector-stores/vector-stores.d.ts.map +1 -1
- package/resources/vector-stores/vector-stores.js +1 -1
- package/resources/vector-stores/vector-stores.js.map +1 -1
- package/resources/vector-stores/vector-stores.mjs +2 -2
- package/resources/vector-stores/vector-stores.mjs.map +1 -1
- package/src/client.ts +19 -24
- package/src/core/pagination.ts +76 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/resources/data-sources/connectors.ts +8 -8
- package/src/resources/data-sources/data-sources.ts +9 -9
- package/src/resources/data-sources/index.ts +2 -2
- package/src/resources/extractions/content.ts +2 -2
- package/src/resources/extractions/jobs.ts +3 -3
- package/src/resources/extractions/schema.ts +5 -5
- package/src/resources/files.ts +6 -6
- package/src/resources/index.ts +3 -3
- package/src/resources/parsing/index.ts +1 -1
- package/src/resources/parsing/jobs.ts +6 -6
- package/src/resources/parsing/parsing.ts +2 -2
- package/src/resources/vector-stores/files.ts +11 -6
- package/src/resources/vector-stores/index.ts +2 -2
- package/src/resources/vector-stores/vector-stores.ts +28 -8
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
@@ -0,0 +1,265 @@
|
|
1
|
+
import { RFC1738 } from './formats';
|
2
|
+
import type { DefaultEncoder, Format } from './types';
|
3
|
+
import { isArray } from '../utils/values';
|
4
|
+
|
5
|
+
export let has = (obj: object, key: PropertyKey): boolean => (
|
6
|
+
(has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)),
|
7
|
+
has(obj, key)
|
8
|
+
);
|
9
|
+
|
10
|
+
const hex_table = /* @__PURE__ */ (() => {
|
11
|
+
const array = [];
|
12
|
+
for (let i = 0; i < 256; ++i) {
|
13
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
14
|
+
}
|
15
|
+
|
16
|
+
return array;
|
17
|
+
})();
|
18
|
+
|
19
|
+
function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
|
20
|
+
while (queue.length > 1) {
|
21
|
+
const item = queue.pop();
|
22
|
+
if (!item) continue;
|
23
|
+
|
24
|
+
const obj = item.obj[item.prop];
|
25
|
+
|
26
|
+
if (isArray(obj)) {
|
27
|
+
const compacted: unknown[] = [];
|
28
|
+
|
29
|
+
for (let j = 0; j < obj.length; ++j) {
|
30
|
+
if (typeof obj[j] !== 'undefined') {
|
31
|
+
compacted.push(obj[j]);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
// @ts-ignore
|
36
|
+
item.obj[item.prop] = compacted;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
function array_to_object(source: any[], options: { plainObjects: boolean }) {
|
42
|
+
const obj = options && options.plainObjects ? Object.create(null) : {};
|
43
|
+
for (let i = 0; i < source.length; ++i) {
|
44
|
+
if (typeof source[i] !== 'undefined') {
|
45
|
+
obj[i] = source[i];
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
return obj;
|
50
|
+
}
|
51
|
+
|
52
|
+
export function merge(
|
53
|
+
target: any,
|
54
|
+
source: any,
|
55
|
+
options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
|
56
|
+
) {
|
57
|
+
if (!source) {
|
58
|
+
return target;
|
59
|
+
}
|
60
|
+
|
61
|
+
if (typeof source !== 'object') {
|
62
|
+
if (isArray(target)) {
|
63
|
+
target.push(source);
|
64
|
+
} else if (target && typeof target === 'object') {
|
65
|
+
if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
|
66
|
+
target[source] = true;
|
67
|
+
}
|
68
|
+
} else {
|
69
|
+
return [target, source];
|
70
|
+
}
|
71
|
+
|
72
|
+
return target;
|
73
|
+
}
|
74
|
+
|
75
|
+
if (!target || typeof target !== 'object') {
|
76
|
+
return [target].concat(source);
|
77
|
+
}
|
78
|
+
|
79
|
+
let mergeTarget = target;
|
80
|
+
if (isArray(target) && !isArray(source)) {
|
81
|
+
// @ts-ignore
|
82
|
+
mergeTarget = array_to_object(target, options);
|
83
|
+
}
|
84
|
+
|
85
|
+
if (isArray(target) && isArray(source)) {
|
86
|
+
source.forEach(function (item, i) {
|
87
|
+
if (has(target, i)) {
|
88
|
+
const targetItem = target[i];
|
89
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
90
|
+
target[i] = merge(targetItem, item, options);
|
91
|
+
} else {
|
92
|
+
target.push(item);
|
93
|
+
}
|
94
|
+
} else {
|
95
|
+
target[i] = item;
|
96
|
+
}
|
97
|
+
});
|
98
|
+
return target;
|
99
|
+
}
|
100
|
+
|
101
|
+
return Object.keys(source).reduce(function (acc, key) {
|
102
|
+
const value = source[key];
|
103
|
+
|
104
|
+
if (has(acc, key)) {
|
105
|
+
acc[key] = merge(acc[key], value, options);
|
106
|
+
} else {
|
107
|
+
acc[key] = value;
|
108
|
+
}
|
109
|
+
return acc;
|
110
|
+
}, mergeTarget);
|
111
|
+
}
|
112
|
+
|
113
|
+
export function assign_single_source(target: any, source: any) {
|
114
|
+
return Object.keys(source).reduce(function (acc, key) {
|
115
|
+
acc[key] = source[key];
|
116
|
+
return acc;
|
117
|
+
}, target);
|
118
|
+
}
|
119
|
+
|
120
|
+
export function decode(str: string, _: any, charset: string) {
|
121
|
+
const strWithoutPlus = str.replace(/\+/g, ' ');
|
122
|
+
if (charset === 'iso-8859-1') {
|
123
|
+
// unescape never throws, no try...catch needed:
|
124
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
125
|
+
}
|
126
|
+
// utf-8
|
127
|
+
try {
|
128
|
+
return decodeURIComponent(strWithoutPlus);
|
129
|
+
} catch (e) {
|
130
|
+
return strWithoutPlus;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
const limit = 1024;
|
135
|
+
|
136
|
+
export const encode: (
|
137
|
+
str: any,
|
138
|
+
defaultEncoder: DefaultEncoder,
|
139
|
+
charset: string,
|
140
|
+
type: 'key' | 'value',
|
141
|
+
format: Format,
|
142
|
+
) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
|
143
|
+
// This code was originally written by Brian White for the io.js core querystring library.
|
144
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
145
|
+
if (str.length === 0) {
|
146
|
+
return str;
|
147
|
+
}
|
148
|
+
|
149
|
+
let string = str;
|
150
|
+
if (typeof str === 'symbol') {
|
151
|
+
string = Symbol.prototype.toString.call(str);
|
152
|
+
} else if (typeof str !== 'string') {
|
153
|
+
string = String(str);
|
154
|
+
}
|
155
|
+
|
156
|
+
if (charset === 'iso-8859-1') {
|
157
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
158
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
159
|
+
});
|
160
|
+
}
|
161
|
+
|
162
|
+
let out = '';
|
163
|
+
for (let j = 0; j < string.length; j += limit) {
|
164
|
+
const segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
165
|
+
const arr = [];
|
166
|
+
|
167
|
+
for (let i = 0; i < segment.length; ++i) {
|
168
|
+
let c = segment.charCodeAt(i);
|
169
|
+
if (
|
170
|
+
c === 0x2d || // -
|
171
|
+
c === 0x2e || // .
|
172
|
+
c === 0x5f || // _
|
173
|
+
c === 0x7e || // ~
|
174
|
+
(c >= 0x30 && c <= 0x39) || // 0-9
|
175
|
+
(c >= 0x41 && c <= 0x5a) || // a-z
|
176
|
+
(c >= 0x61 && c <= 0x7a) || // A-Z
|
177
|
+
(format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
178
|
+
) {
|
179
|
+
arr[arr.length] = segment.charAt(i);
|
180
|
+
continue;
|
181
|
+
}
|
182
|
+
|
183
|
+
if (c < 0x80) {
|
184
|
+
arr[arr.length] = hex_table[c];
|
185
|
+
continue;
|
186
|
+
}
|
187
|
+
|
188
|
+
if (c < 0x800) {
|
189
|
+
arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
|
190
|
+
continue;
|
191
|
+
}
|
192
|
+
|
193
|
+
if (c < 0xd800 || c >= 0xe000) {
|
194
|
+
arr[arr.length] =
|
195
|
+
hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
|
196
|
+
continue;
|
197
|
+
}
|
198
|
+
|
199
|
+
i += 1;
|
200
|
+
c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
|
201
|
+
|
202
|
+
arr[arr.length] =
|
203
|
+
hex_table[0xf0 | (c >> 18)]! +
|
204
|
+
hex_table[0x80 | ((c >> 12) & 0x3f)] +
|
205
|
+
hex_table[0x80 | ((c >> 6) & 0x3f)] +
|
206
|
+
hex_table[0x80 | (c & 0x3f)];
|
207
|
+
}
|
208
|
+
|
209
|
+
out += arr.join('');
|
210
|
+
}
|
211
|
+
|
212
|
+
return out;
|
213
|
+
};
|
214
|
+
|
215
|
+
export function compact(value: any) {
|
216
|
+
const queue = [{ obj: { o: value }, prop: 'o' }];
|
217
|
+
const refs = [];
|
218
|
+
|
219
|
+
for (let i = 0; i < queue.length; ++i) {
|
220
|
+
const item = queue[i];
|
221
|
+
// @ts-ignore
|
222
|
+
const obj = item.obj[item.prop];
|
223
|
+
|
224
|
+
const keys = Object.keys(obj);
|
225
|
+
for (let j = 0; j < keys.length; ++j) {
|
226
|
+
const key = keys[j]!;
|
227
|
+
const val = obj[key];
|
228
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
229
|
+
queue.push({ obj: obj, prop: key });
|
230
|
+
refs.push(val);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
compact_queue(queue);
|
236
|
+
|
237
|
+
return value;
|
238
|
+
}
|
239
|
+
|
240
|
+
export function is_regexp(obj: any) {
|
241
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
242
|
+
}
|
243
|
+
|
244
|
+
export function is_buffer(obj: any) {
|
245
|
+
if (!obj || typeof obj !== 'object') {
|
246
|
+
return false;
|
247
|
+
}
|
248
|
+
|
249
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
250
|
+
}
|
251
|
+
|
252
|
+
export function combine(a: any, b: any) {
|
253
|
+
return [].concat(a, b);
|
254
|
+
}
|
255
|
+
|
256
|
+
export function maybe_map<T>(val: T[], fn: (v: T) => T) {
|
257
|
+
if (isArray(val)) {
|
258
|
+
const mapped = [];
|
259
|
+
for (let i = 0; i < val.length; i += 1) {
|
260
|
+
mapped.push(fn(val[i]!));
|
261
|
+
}
|
262
|
+
return mapped;
|
263
|
+
}
|
264
|
+
return fn(val);
|
265
|
+
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
4
4
|
import { APIPromise } from '../../core/api-promise';
|
5
|
-
import {
|
5
|
+
import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
7
7
|
import { path } from '../../internal/utils/path';
|
8
8
|
|
@@ -73,10 +73,10 @@ export class Connectors extends APIResource {
|
|
73
73
|
dataSourceID: string,
|
74
74
|
query: ConnectorListParams | null | undefined = {},
|
75
75
|
options?: RequestOptions,
|
76
|
-
): PagePromise<
|
76
|
+
): PagePromise<DataSourceConnectorsCursor, DataSourceConnector> {
|
77
77
|
return this._client.getAPIList(
|
78
78
|
path`/v1/data_sources/${dataSourceID}/connectors`,
|
79
|
-
|
79
|
+
Cursor<DataSourceConnector>,
|
80
80
|
{ query, ...options },
|
81
81
|
);
|
82
82
|
}
|
@@ -99,7 +99,7 @@ export class Connectors extends APIResource {
|
|
99
99
|
}
|
100
100
|
}
|
101
101
|
|
102
|
-
export type
|
102
|
+
export type DataSourceConnectorsCursor = Cursor<DataSourceConnector>;
|
103
103
|
|
104
104
|
/**
|
105
105
|
* Service-level representation of a connector.
|
@@ -168,7 +168,7 @@ export interface DataSourceConnector {
|
|
168
168
|
/**
|
169
169
|
* The sync error of the connector
|
170
170
|
*/
|
171
|
-
error: string | null;
|
171
|
+
error: { [key: string]: unknown } | null;
|
172
172
|
|
173
173
|
/**
|
174
174
|
* The type of the object
|
@@ -249,7 +249,7 @@ export interface ConnectorUpdateParams {
|
|
249
249
|
/**
|
250
250
|
* Body param: The metadata of the connector
|
251
251
|
*/
|
252
|
-
metadata?:
|
252
|
+
metadata?: { [key: string]: unknown } | null;
|
253
253
|
|
254
254
|
/**
|
255
255
|
* Body param: Whether the connector should be synced after update
|
@@ -267,7 +267,7 @@ export interface ConnectorUpdateParams {
|
|
267
267
|
polling_interval?: number | string | null;
|
268
268
|
}
|
269
269
|
|
270
|
-
export interface ConnectorListParams extends
|
270
|
+
export interface ConnectorListParams extends CursorParams {}
|
271
271
|
|
272
272
|
export interface ConnectorDeleteParams {
|
273
273
|
/**
|
@@ -280,7 +280,7 @@ export declare namespace Connectors {
|
|
280
280
|
export {
|
281
281
|
type DataSourceConnector as DataSourceConnector,
|
282
282
|
type ConnectorDeleteResponse as ConnectorDeleteResponse,
|
283
|
-
type
|
283
|
+
type DataSourceConnectorsCursor as DataSourceConnectorsCursor,
|
284
284
|
type ConnectorCreateParams as ConnectorCreateParams,
|
285
285
|
type ConnectorRetrieveParams as ConnectorRetrieveParams,
|
286
286
|
type ConnectorUpdateParams as ConnectorUpdateParams,
|
@@ -11,10 +11,10 @@ import {
|
|
11
11
|
ConnectorUpdateParams,
|
12
12
|
Connectors,
|
13
13
|
DataSourceConnector,
|
14
|
-
|
14
|
+
DataSourceConnectorsCursor,
|
15
15
|
} from './connectors';
|
16
16
|
import { APIPromise } from '../../core/api-promise';
|
17
|
-
import {
|
17
|
+
import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
|
18
18
|
import { RequestOptions } from '../../internal/request-options';
|
19
19
|
import { path } from '../../internal/utils/path';
|
20
20
|
|
@@ -67,8 +67,8 @@ export class DataSources extends APIResource {
|
|
67
67
|
list(
|
68
68
|
query: DataSourceListParams | null | undefined = {},
|
69
69
|
options?: RequestOptions,
|
70
|
-
): PagePromise<
|
71
|
-
return this._client.getAPIList('/v1/data_sources/',
|
70
|
+
): PagePromise<DataSourcesCursor, DataSource> {
|
71
|
+
return this._client.getAPIList('/v1/data_sources/', Cursor<DataSource>, { query, ...options });
|
72
72
|
}
|
73
73
|
|
74
74
|
/**
|
@@ -81,7 +81,7 @@ export class DataSources extends APIResource {
|
|
81
81
|
}
|
82
82
|
}
|
83
83
|
|
84
|
-
export type
|
84
|
+
export type DataSourcesCursor = Cursor<DataSource>;
|
85
85
|
|
86
86
|
/**
|
87
87
|
* Service-level representation of a data source.
|
@@ -181,7 +181,7 @@ export interface DataSourceOauth2Params {
|
|
181
181
|
/**
|
182
182
|
* Additional parameters for the OAuth2 flow
|
183
183
|
*/
|
184
|
-
additional_params?:
|
184
|
+
additional_params?: { [key: string]: unknown } | null;
|
185
185
|
}
|
186
186
|
|
187
187
|
export type DataSourceType = 'notion' | 'linear';
|
@@ -408,7 +408,7 @@ export declare namespace DataSourceUpdateParams {
|
|
408
408
|
}
|
409
409
|
}
|
410
410
|
|
411
|
-
export interface DataSourceListParams extends
|
411
|
+
export interface DataSourceListParams extends CursorParams {}
|
412
412
|
|
413
413
|
DataSources.Connectors = Connectors;
|
414
414
|
|
@@ -421,7 +421,7 @@ export declare namespace DataSources {
|
|
421
421
|
type NotionDataSource as NotionDataSource,
|
422
422
|
type Oauth2Params as Oauth2Params,
|
423
423
|
type DataSourceDeleteResponse as DataSourceDeleteResponse,
|
424
|
-
type
|
424
|
+
type DataSourcesCursor as DataSourcesCursor,
|
425
425
|
type DataSourceCreateParams as DataSourceCreateParams,
|
426
426
|
type DataSourceUpdateParams as DataSourceUpdateParams,
|
427
427
|
type DataSourceListParams as DataSourceListParams,
|
@@ -431,7 +431,7 @@ export declare namespace DataSources {
|
|
431
431
|
Connectors as Connectors,
|
432
432
|
type DataSourceConnector as DataSourceConnector,
|
433
433
|
type ConnectorDeleteResponse as ConnectorDeleteResponse,
|
434
|
-
type
|
434
|
+
type DataSourceConnectorsCursor as DataSourceConnectorsCursor,
|
435
435
|
type ConnectorCreateParams as ConnectorCreateParams,
|
436
436
|
type ConnectorRetrieveParams as ConnectorRetrieveParams,
|
437
437
|
type ConnectorUpdateParams as ConnectorUpdateParams,
|
@@ -9,7 +9,7 @@ export {
|
|
9
9
|
type ConnectorUpdateParams,
|
10
10
|
type ConnectorListParams,
|
11
11
|
type ConnectorDeleteParams,
|
12
|
-
type
|
12
|
+
type DataSourceConnectorsCursor,
|
13
13
|
} from './connectors';
|
14
14
|
export {
|
15
15
|
DataSources,
|
@@ -23,5 +23,5 @@ export {
|
|
23
23
|
type DataSourceCreateParams,
|
24
24
|
type DataSourceUpdateParams,
|
25
25
|
type DataSourceListParams,
|
26
|
-
type
|
26
|
+
type DataSourcesCursor,
|
27
27
|
} from './data-sources';
|
@@ -21,7 +21,7 @@ export class Content extends APIResource {
|
|
21
21
|
* The result of an extraction job.
|
22
22
|
*/
|
23
23
|
export interface ExtractionResult {
|
24
|
-
data:
|
24
|
+
data: { [key: string]: unknown };
|
25
25
|
|
26
26
|
warnings: Array<string>;
|
27
27
|
}
|
@@ -85,7 +85,7 @@ export interface ContentCreateParams {
|
|
85
85
|
/**
|
86
86
|
* The JSON schema to use for extraction
|
87
87
|
*/
|
88
|
-
json_schema:
|
88
|
+
json_schema: { [key: string]: unknown };
|
89
89
|
|
90
90
|
/**
|
91
91
|
* Additional instructions for the extraction
|
@@ -83,12 +83,12 @@ export interface ExtractionJob {
|
|
83
83
|
/**
|
84
84
|
* Error information if failed
|
85
85
|
*/
|
86
|
-
error:
|
86
|
+
error: { [key: string]: unknown } | null;
|
87
87
|
|
88
88
|
/**
|
89
89
|
* The JSON schema used for extraction
|
90
90
|
*/
|
91
|
-
json_schema:
|
91
|
+
json_schema: { [key: string]: unknown };
|
92
92
|
}
|
93
93
|
|
94
94
|
export interface JobCreateParams {
|
@@ -100,7 +100,7 @@ export interface JobCreateParams {
|
|
100
100
|
/**
|
101
101
|
* The JSON schema to use for extraction
|
102
102
|
*/
|
103
|
-
json_schema:
|
103
|
+
json_schema: { [key: string]: unknown };
|
104
104
|
}
|
105
105
|
|
106
106
|
export declare namespace Jobs {
|
@@ -46,7 +46,7 @@ export interface CreatedJsonSchema {
|
|
46
46
|
/**
|
47
47
|
* The created JSON schema
|
48
48
|
*/
|
49
|
-
json_schema:
|
49
|
+
json_schema: { [key: string]: unknown };
|
50
50
|
}
|
51
51
|
|
52
52
|
/**
|
@@ -56,7 +56,7 @@ export interface EnhancedJsonSchema {
|
|
56
56
|
/**
|
57
57
|
* The enhanced JSON schema
|
58
58
|
*/
|
59
|
-
json_schema:
|
59
|
+
json_schema: { [key: string]: unknown };
|
60
60
|
}
|
61
61
|
|
62
62
|
/**
|
@@ -76,7 +76,7 @@ export interface ValidatedJsonSchema {
|
|
76
76
|
/**
|
77
77
|
* The validated JSON schema
|
78
78
|
*/
|
79
|
-
json_schema:
|
79
|
+
json_schema: { [key: string]: unknown };
|
80
80
|
}
|
81
81
|
|
82
82
|
export interface SchemaCreateParams {
|
@@ -90,14 +90,14 @@ export interface SchemaEnhanceParams {
|
|
90
90
|
/**
|
91
91
|
* The JSON schema to enhance
|
92
92
|
*/
|
93
|
-
json_schema:
|
93
|
+
json_schema: { [key: string]: unknown };
|
94
94
|
}
|
95
95
|
|
96
96
|
export interface SchemaValidateParams {
|
97
97
|
/**
|
98
98
|
* The JSON schema to validate
|
99
99
|
*/
|
100
|
-
json_schema:
|
100
|
+
json_schema: { [key: string]: unknown };
|
101
101
|
}
|
102
102
|
|
103
103
|
export declare namespace Schema {
|
package/src/resources/files.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
import { APIResource } from '../core/resource';
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
5
|
-
import {
|
5
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
6
6
|
import { type Uploadable } from '../core/uploads';
|
7
7
|
import { buildHeaders } from '../internal/headers';
|
8
8
|
import { RequestOptions } from '../internal/request-options';
|
@@ -56,8 +56,8 @@ export class Files extends APIResource {
|
|
56
56
|
list(
|
57
57
|
query: FileListParams | null | undefined = {},
|
58
58
|
options?: RequestOptions,
|
59
|
-
): PagePromise<
|
60
|
-
return this._client.getAPIList('/v1/files',
|
59
|
+
): PagePromise<FileObjectsCursor, FileObject> {
|
60
|
+
return this._client.getAPIList('/v1/files', Cursor<FileObject>, { query, ...options });
|
61
61
|
}
|
62
62
|
|
63
63
|
/**
|
@@ -87,7 +87,7 @@ export class Files extends APIResource {
|
|
87
87
|
}
|
88
88
|
}
|
89
89
|
|
90
|
-
export type
|
90
|
+
export type FileObjectsCursor = Cursor<FileObject>;
|
91
91
|
|
92
92
|
/**
|
93
93
|
* A model representing a file object in the system.
|
@@ -183,14 +183,14 @@ export interface FileUpdateParams {
|
|
183
183
|
file: Uploadable;
|
184
184
|
}
|
185
185
|
|
186
|
-
export interface FileListParams extends
|
186
|
+
export interface FileListParams extends CursorParams {}
|
187
187
|
|
188
188
|
export declare namespace Files {
|
189
189
|
export {
|
190
190
|
type FileObject as FileObject,
|
191
191
|
type PaginationWithTotal as PaginationWithTotal,
|
192
192
|
type FileDeleteResponse as FileDeleteResponse,
|
193
|
-
type
|
193
|
+
type FileObjectsCursor as FileObjectsCursor,
|
194
194
|
type FileCreateParams as FileCreateParams,
|
195
195
|
type FileUpdateParams as FileUpdateParams,
|
196
196
|
type FileListParams as FileListParams,
|
package/src/resources/index.ts
CHANGED
@@ -23,7 +23,7 @@ export {
|
|
23
23
|
type DataSourceCreateParams,
|
24
24
|
type DataSourceUpdateParams,
|
25
25
|
type DataSourceListParams,
|
26
|
-
type
|
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';
|
@@ -35,7 +35,7 @@ export {
|
|
35
35
|
type FileCreateParams,
|
36
36
|
type FileUpdateParams,
|
37
37
|
type FileListParams,
|
38
|
-
type
|
38
|
+
type FileObjectsCursor,
|
39
39
|
} from './files';
|
40
40
|
export { Parsing } from './parsing/parsing';
|
41
41
|
export {
|
@@ -55,7 +55,7 @@ export {
|
|
55
55
|
type VectorStoreListParams,
|
56
56
|
type VectorStoreQuestionAnsweringParams,
|
57
57
|
type VectorStoreSearchParams,
|
58
|
-
type
|
58
|
+
type VectorStoresCursor,
|
59
59
|
} from './vector-stores/vector-stores';
|
60
60
|
export {
|
61
61
|
type Embedding,
|
@@ -3,7 +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 {
|
6
|
+
import { Cursor, type CursorParams, PagePromise } from '../../core/pagination';
|
7
7
|
import { RequestOptions } from '../../internal/request-options';
|
8
8
|
import { path } from '../../internal/utils/path';
|
9
9
|
import * as polling from '../../lib/polling';
|
@@ -42,8 +42,8 @@ export class Jobs extends APIResource {
|
|
42
42
|
list(
|
43
43
|
query: JobListParams | null | undefined = {},
|
44
44
|
options?: RequestOptions,
|
45
|
-
): PagePromise<
|
46
|
-
return this._client.getAPIList('/v1/parsing/jobs',
|
45
|
+
): PagePromise<JobListResponsesCursor, JobListResponse> {
|
46
|
+
return this._client.getAPIList('/v1/parsing/jobs', Cursor<JobListResponse>, { query, ...options });
|
47
47
|
}
|
48
48
|
|
49
49
|
/**
|
@@ -161,7 +161,7 @@ export class Jobs extends APIResource {
|
|
161
161
|
}
|
162
162
|
}
|
163
163
|
|
164
|
-
export type
|
164
|
+
export type JobListResponsesCursor = Cursor<JobListResponse>;
|
165
165
|
|
166
166
|
/**
|
167
167
|
* Strategy used for chunking document content.
|
@@ -429,7 +429,7 @@ export interface JobCreateParams {
|
|
429
429
|
mode?: 'fast' | 'high_quality';
|
430
430
|
}
|
431
431
|
|
432
|
-
export interface JobListParams extends
|
432
|
+
export interface JobListParams extends CursorParams {}
|
433
433
|
|
434
434
|
export declare namespace Jobs {
|
435
435
|
export {
|
@@ -440,7 +440,7 @@ export declare namespace Jobs {
|
|
440
440
|
type ReturnFormat as ReturnFormat,
|
441
441
|
type JobListResponse as JobListResponse,
|
442
442
|
type JobDeleteResponse as JobDeleteResponse,
|
443
|
-
type
|
443
|
+
type JobListResponsesCursor as JobListResponsesCursor,
|
444
444
|
type JobCreateParams as JobCreateParams,
|
445
445
|
type JobListParams as JobListParams,
|
446
446
|
};
|
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
JobDeleteResponse,
|
10
10
|
JobListParams,
|
11
11
|
JobListResponse,
|
12
|
-
|
12
|
+
JobListResponsesCursor,
|
13
13
|
Jobs,
|
14
14
|
ParsingJob,
|
15
15
|
ParsingJobStatus,
|
@@ -32,7 +32,7 @@ export declare namespace Parsing {
|
|
32
32
|
type ReturnFormat as ReturnFormat,
|
33
33
|
type JobListResponse as JobListResponse,
|
34
34
|
type JobDeleteResponse as JobDeleteResponse,
|
35
|
-
type
|
35
|
+
type JobListResponsesCursor as JobListResponsesCursor,
|
36
36
|
type JobCreateParams as JobCreateParams,
|
37
37
|
type JobListParams as JobListParams,
|
38
38
|
};
|