typizer 0.1.0 → 0.2.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 +60 -0
- package/README.md +273 -134
- package/dist/client.d.ts +323 -0
- package/dist/client.js +629 -0
- package/dist/core.d.ts +109 -0
- package/dist/core.js +339 -0
- package/dist/errors.d.ts +146 -0
- package/dist/errors.js +281 -0
- package/dist/files.d.ts +42 -0
- package/dist/files.js +159 -0
- package/dist/gen/index.d.ts +2 -2
- package/dist/gen/index.js +1 -1
- package/dist/gen/sdk.gen.d.ts +329 -5
- package/dist/gen/sdk.gen.js +588 -4
- package/dist/gen/types.gen.d.ts +2490 -245
- package/dist/index.d.ts +26 -3
- package/dist/index.js +33 -4
- package/dist/pagination.d.ts +30 -0
- package/dist/pagination.js +49 -0
- package/dist/run.d.ts +48 -0
- package/dist/run.js +45 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/dist/webhooks.d.ts +40 -0
- package/dist/webhooks.js +208 -0
- package/package.json +9 -7
package/dist/errors.js
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/** Everything the `Typizer` client throws. */
|
|
2
|
+
export class TypizerError extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
this.name = new.target.name;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** The client is misconfigured (no API key, a proxy without `undici`, …). */
|
|
9
|
+
export class ConfigurationError extends TypizerError {
|
|
10
|
+
}
|
|
11
|
+
/** No response: DNS, TCP, TLS or a dropped connection. Retried automatically. */
|
|
12
|
+
export class APIConnectionError extends TypizerError {
|
|
13
|
+
retryable = true;
|
|
14
|
+
method;
|
|
15
|
+
path;
|
|
16
|
+
constructor(message, method, path, options) {
|
|
17
|
+
super(message, options);
|
|
18
|
+
this.method = method;
|
|
19
|
+
this.path = path;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** One HTTP attempt took longer than `timeout`. Retried automatically. */
|
|
23
|
+
export class APITimeoutError extends APIConnectionError {
|
|
24
|
+
}
|
|
25
|
+
const PROBLEM_FIELDS = new Set([
|
|
26
|
+
'type',
|
|
27
|
+
'title',
|
|
28
|
+
'status',
|
|
29
|
+
'detail',
|
|
30
|
+
'code',
|
|
31
|
+
'param',
|
|
32
|
+
'request_id',
|
|
33
|
+
'doc_url',
|
|
34
|
+
]);
|
|
35
|
+
/** An HTTP error response (4xx/5xx), with or without a problem+json body. */
|
|
36
|
+
export class APIError extends TypizerError {
|
|
37
|
+
/** HTTP status. */
|
|
38
|
+
status;
|
|
39
|
+
/** `Problem.code` (`rate_limited`, `invalid_schema`, …), or derived from the status. */
|
|
40
|
+
code;
|
|
41
|
+
title;
|
|
42
|
+
detail;
|
|
43
|
+
type;
|
|
44
|
+
docUrl;
|
|
45
|
+
/** The request field at fault, if any. */
|
|
46
|
+
param;
|
|
47
|
+
/** `Problem.request_id`, else the `X-Request-Id` header: quote it to support. */
|
|
48
|
+
requestId;
|
|
49
|
+
/** Whether repeating the same request can succeed (SPEC §7.1). */
|
|
50
|
+
retryable;
|
|
51
|
+
/** `Retry-After` in seconds (429/503), if the response had it. */
|
|
52
|
+
retryAfter;
|
|
53
|
+
rateLimit;
|
|
54
|
+
/** All response headers (lower-case names). */
|
|
55
|
+
headers;
|
|
56
|
+
/** The parsed problem object, or the raw text of a non-JSON body. */
|
|
57
|
+
body;
|
|
58
|
+
/** Other problem fields (`batch_id`, `created`, `expected`, `findings`, …). */
|
|
59
|
+
extra;
|
|
60
|
+
constructor(init) {
|
|
61
|
+
const where = [`HTTP ${init.status}`];
|
|
62
|
+
if (init.requestId)
|
|
63
|
+
where.push(`request_id=${init.requestId}`);
|
|
64
|
+
if (init.docUrl)
|
|
65
|
+
where.push(init.docUrl);
|
|
66
|
+
super(`[${init.code}] ${init.detail || init.title || 'Request failed'} (${where.join(', ')})`);
|
|
67
|
+
this.status = init.status;
|
|
68
|
+
this.code = init.code;
|
|
69
|
+
this.title = init.title;
|
|
70
|
+
this.detail = init.detail;
|
|
71
|
+
this.type = init.type;
|
|
72
|
+
this.docUrl = init.docUrl;
|
|
73
|
+
this.param = init.param;
|
|
74
|
+
this.requestId = init.requestId;
|
|
75
|
+
this.retryable = isRetryableStatus(init.status) && init.code !== 'idempotency_conflict';
|
|
76
|
+
this.retryAfter = init.retryAfter;
|
|
77
|
+
this.rateLimit = init.rateLimit;
|
|
78
|
+
this.headers = init.headers ?? {};
|
|
79
|
+
this.body = init.body;
|
|
80
|
+
this.extra = init.extra ?? {};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** 400: `invalid_request`, `invalid_id`, `invalid_schema`, `unsupported_schema_feature`, `too_many_pages`. */
|
|
84
|
+
export class BadRequestError extends APIError {
|
|
85
|
+
}
|
|
86
|
+
/** 401 `unauthorized`: the API key is missing, wrong or revoked. */
|
|
87
|
+
export class AuthenticationError extends APIError {
|
|
88
|
+
}
|
|
89
|
+
/** 402 `insufficient_balance`: not enough pages on the balance. */
|
|
90
|
+
export class InsufficientBalanceError extends APIError {
|
|
91
|
+
}
|
|
92
|
+
/** 403 `forbidden`, `insufficient_scope`. */
|
|
93
|
+
export class PermissionDeniedError extends APIError {
|
|
94
|
+
}
|
|
95
|
+
/** 404 `not_found`. */
|
|
96
|
+
export class NotFoundError extends APIError {
|
|
97
|
+
}
|
|
98
|
+
/** 409 `conflict`. */
|
|
99
|
+
export class ConflictError extends APIError {
|
|
100
|
+
}
|
|
101
|
+
/** 409 `idempotency_conflict`: the Idempotency-Key was used with another request (or is still in flight). */
|
|
102
|
+
export class IdempotencyConflictError extends ConflictError {
|
|
103
|
+
}
|
|
104
|
+
/** 413 `file_too_large`: more than 50 MiB. */
|
|
105
|
+
export class FileTooLargeError extends APIError {
|
|
106
|
+
}
|
|
107
|
+
/** 415 `unsupported_file_type`. */
|
|
108
|
+
export class UnsupportedFileTypeError extends APIError {
|
|
109
|
+
}
|
|
110
|
+
/** 422 `document_unreadable`, `extraction_failed`. */
|
|
111
|
+
export class UnprocessableDocumentError extends APIError {
|
|
112
|
+
}
|
|
113
|
+
/** 429 `rate_limited`. Retried automatically after `Retry-After`. */
|
|
114
|
+
export class RateLimitError extends APIError {
|
|
115
|
+
}
|
|
116
|
+
/** 500 `internal_error` (and other 5xx except 502–504). Retried automatically. */
|
|
117
|
+
export class InternalServerError extends APIError {
|
|
118
|
+
}
|
|
119
|
+
/** 503 `upstream_unavailable` (and 502, 504). Retried automatically. */
|
|
120
|
+
export class ServiceUnavailableError extends APIError {
|
|
121
|
+
}
|
|
122
|
+
/** `client.extract()`: the run finished `failed`. */
|
|
123
|
+
export class RunFailedError extends TypizerError {
|
|
124
|
+
/** `run.error.code`: `document_unreadable`, `too_many_pages`, `timeout`, … */
|
|
125
|
+
code;
|
|
126
|
+
/** `run.error.message`. */
|
|
127
|
+
detail;
|
|
128
|
+
run;
|
|
129
|
+
/** True for `timeout`, `upstream_unavailable`, `internal_error`: repeat with `client.runs.retry(id)`. */
|
|
130
|
+
retryable;
|
|
131
|
+
constructor(run) {
|
|
132
|
+
const code = run.error?.code ?? 'failed';
|
|
133
|
+
const detail = run.error?.message ?? 'The run failed';
|
|
134
|
+
super(`[${code}] ${detail} (run ${run.id})`);
|
|
135
|
+
this.code = code;
|
|
136
|
+
this.detail = detail;
|
|
137
|
+
this.run = run;
|
|
138
|
+
this.retryable = ['timeout', 'upstream_unavailable', 'internal_error'].includes(code);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** `client.extract()` / `client.runs.wait()`: the wait ran out; the run goes on and will be billed. */
|
|
142
|
+
export class WaitTimeoutError extends TypizerError {
|
|
143
|
+
runId;
|
|
144
|
+
/** The last known state of the run. */
|
|
145
|
+
run;
|
|
146
|
+
/** How long it waited, in milliseconds. */
|
|
147
|
+
waited;
|
|
148
|
+
constructor(run, waited) {
|
|
149
|
+
super(`Run ${run.id} is still ${run.status} after ${(waited / 1000).toFixed(1)}s of waiting. ` +
|
|
150
|
+
'It is not cancelled: it goes on and will be billed. Wait for it with ' +
|
|
151
|
+
`client.runs.wait('${run.id}') or get the result by webhook (webhookUrl).`);
|
|
152
|
+
this.runId = run.id;
|
|
153
|
+
this.run = run;
|
|
154
|
+
this.waited = waited;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** `verifyWebhook()`: the signature or the timestamp did not pass. */
|
|
158
|
+
export class WebhookVerificationError extends TypizerError {
|
|
159
|
+
reason;
|
|
160
|
+
constructor(reason, message) {
|
|
161
|
+
super(message);
|
|
162
|
+
this.reason = reason;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export function isRetryableStatus(status) {
|
|
166
|
+
return status === 408 || status === 429 || status >= 500;
|
|
167
|
+
}
|
|
168
|
+
const BY_CODE = {
|
|
169
|
+
invalid_request: BadRequestError,
|
|
170
|
+
invalid_id: BadRequestError,
|
|
171
|
+
invalid_schema: BadRequestError,
|
|
172
|
+
unsupported_schema_feature: BadRequestError,
|
|
173
|
+
too_many_pages: BadRequestError,
|
|
174
|
+
unauthorized: AuthenticationError,
|
|
175
|
+
insufficient_balance: InsufficientBalanceError,
|
|
176
|
+
forbidden: PermissionDeniedError,
|
|
177
|
+
insufficient_scope: PermissionDeniedError,
|
|
178
|
+
not_found: NotFoundError,
|
|
179
|
+
conflict: ConflictError,
|
|
180
|
+
idempotency_conflict: IdempotencyConflictError,
|
|
181
|
+
file_too_large: FileTooLargeError,
|
|
182
|
+
unsupported_file_type: UnsupportedFileTypeError,
|
|
183
|
+
document_unreadable: UnprocessableDocumentError,
|
|
184
|
+
extraction_failed: UnprocessableDocumentError,
|
|
185
|
+
rate_limited: RateLimitError,
|
|
186
|
+
internal_error: InternalServerError,
|
|
187
|
+
upstream_unavailable: ServiceUnavailableError,
|
|
188
|
+
};
|
|
189
|
+
const BY_STATUS = {
|
|
190
|
+
400: [BadRequestError, 'invalid_request'],
|
|
191
|
+
401: [AuthenticationError, 'unauthorized'],
|
|
192
|
+
402: [InsufficientBalanceError, 'insufficient_balance'],
|
|
193
|
+
403: [PermissionDeniedError, 'forbidden'],
|
|
194
|
+
404: [NotFoundError, 'not_found'],
|
|
195
|
+
408: [APIError, 'invalid_request'],
|
|
196
|
+
409: [ConflictError, 'conflict'],
|
|
197
|
+
413: [FileTooLargeError, 'file_too_large'],
|
|
198
|
+
415: [UnsupportedFileTypeError, 'unsupported_file_type'],
|
|
199
|
+
422: [UnprocessableDocumentError, 'extraction_failed'],
|
|
200
|
+
429: [RateLimitError, 'rate_limited'],
|
|
201
|
+
500: [InternalServerError, 'internal_error'],
|
|
202
|
+
502: [ServiceUnavailableError, 'upstream_unavailable'],
|
|
203
|
+
503: [ServiceUnavailableError, 'upstream_unavailable'],
|
|
204
|
+
504: [ServiceUnavailableError, 'upstream_unavailable'],
|
|
205
|
+
};
|
|
206
|
+
function byStatus(status) {
|
|
207
|
+
return (BY_STATUS[status] ??
|
|
208
|
+
(status >= 500 ? [InternalServerError, 'internal_error'] : [APIError, `http_${status}`]));
|
|
209
|
+
}
|
|
210
|
+
/** `Retry-After`: delta seconds or an HTTP date, in seconds from `now`. */
|
|
211
|
+
export function parseRetryAfter(value, now = Date.now()) {
|
|
212
|
+
if (!value)
|
|
213
|
+
return undefined;
|
|
214
|
+
const v = value.trim();
|
|
215
|
+
if (/^\d+(\.\d+)?$/.test(v))
|
|
216
|
+
return Number(v);
|
|
217
|
+
const at = Date.parse(v);
|
|
218
|
+
if (Number.isNaN(at))
|
|
219
|
+
return undefined;
|
|
220
|
+
return Math.max(0, Math.ceil((at - now) / 1000));
|
|
221
|
+
}
|
|
222
|
+
function num(value) {
|
|
223
|
+
if (value === null || value.trim() === '')
|
|
224
|
+
return undefined;
|
|
225
|
+
const n = Number(value);
|
|
226
|
+
return Number.isFinite(n) ? n : undefined;
|
|
227
|
+
}
|
|
228
|
+
/** Classifies an error response (SPEC §6.2): never fails on a body that is not JSON. */
|
|
229
|
+
export function errorFromResponse(status, headers, text) {
|
|
230
|
+
const headerObj = {};
|
|
231
|
+
headers.forEach((v, k) => {
|
|
232
|
+
headerObj[k] = v;
|
|
233
|
+
});
|
|
234
|
+
let problem;
|
|
235
|
+
if (text.trim().startsWith('{')) {
|
|
236
|
+
try {
|
|
237
|
+
const parsed = JSON.parse(text);
|
|
238
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
239
|
+
problem = parsed;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
problem = undefined;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const str = (v) => (typeof v === 'string' && v !== '' ? v : undefined);
|
|
247
|
+
const [statusClass, statusCode] = byStatus(status);
|
|
248
|
+
const code = str(problem?.code) ?? statusCode;
|
|
249
|
+
const cls = status === 408 ? APIError : (BY_CODE[code] ?? statusClass);
|
|
250
|
+
const extra = {};
|
|
251
|
+
if (problem) {
|
|
252
|
+
for (const [k, v] of Object.entries(problem))
|
|
253
|
+
if (!PROBLEM_FIELDS.has(k))
|
|
254
|
+
extra[k] = v;
|
|
255
|
+
}
|
|
256
|
+
const rateLimit = {};
|
|
257
|
+
const limit = num(headers.get('ratelimit-limit'));
|
|
258
|
+
const remaining = num(headers.get('ratelimit-remaining'));
|
|
259
|
+
const reset = num(headers.get('ratelimit-reset'));
|
|
260
|
+
if (limit !== undefined)
|
|
261
|
+
rateLimit.limit = limit;
|
|
262
|
+
if (remaining !== undefined)
|
|
263
|
+
rateLimit.remaining = remaining;
|
|
264
|
+
if (reset !== undefined)
|
|
265
|
+
rateLimit.reset = reset;
|
|
266
|
+
return new cls({
|
|
267
|
+
status,
|
|
268
|
+
code,
|
|
269
|
+
title: str(problem?.title),
|
|
270
|
+
detail: problem ? str(problem.detail) : text.trim().slice(0, 200) || undefined,
|
|
271
|
+
type: str(problem?.type),
|
|
272
|
+
docUrl: str(problem?.doc_url),
|
|
273
|
+
param: str(problem?.param),
|
|
274
|
+
requestId: str(problem?.request_id) ?? str(headers.get('x-request-id')),
|
|
275
|
+
retryAfter: parseRetryAfter(headers.get('retry-after')),
|
|
276
|
+
rateLimit: Object.keys(rateLimit).length ? rateLimit : undefined,
|
|
277
|
+
headers: headerObj,
|
|
278
|
+
body: problem ?? text,
|
|
279
|
+
extra,
|
|
280
|
+
});
|
|
281
|
+
}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** The API's limit for one file: 50 MiB. */
|
|
2
|
+
export declare const MAX_FILE_BYTES = 52428800;
|
|
3
|
+
/** A local document: a path, a `Blob`/`File`, bytes or a stream of bytes. */
|
|
4
|
+
export type Uploadable = string | Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
5
|
+
/** Any document: a local one, `{ url }`, `{ fileId }` or an uploaded `File` object. */
|
|
6
|
+
export type FileInput = Uploadable | {
|
|
7
|
+
url: string;
|
|
8
|
+
} | {
|
|
9
|
+
fileId: string;
|
|
10
|
+
} | {
|
|
11
|
+
object: 'file';
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
/** The part's `Content-Type` by extension, else `application/octet-stream`. */
|
|
15
|
+
export declare function mimeOf(filename: string): string;
|
|
16
|
+
/** A document resolved to what goes on the wire. */
|
|
17
|
+
export type ResolvedDocument = {
|
|
18
|
+
kind: 'local';
|
|
19
|
+
blob: Blob;
|
|
20
|
+
filename: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'url';
|
|
23
|
+
url: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'id';
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Reads a local document into memory (a stream that cannot be rewound is read whole, at most
|
|
30
|
+
* 50 MiB, so a retry can send it again).
|
|
31
|
+
*/
|
|
32
|
+
export declare function toBlob(file: Uploadable, filename?: string): Promise<{
|
|
33
|
+
blob: Blob;
|
|
34
|
+
filename: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Resolves exactly one of `file` / `url` / `fileId` (an argument error otherwise). */
|
|
37
|
+
export declare function resolveDocument(method: string, input: {
|
|
38
|
+
file?: FileInput;
|
|
39
|
+
url?: string;
|
|
40
|
+
fileId?: string;
|
|
41
|
+
filename?: string;
|
|
42
|
+
}): Promise<ResolvedDocument>;
|
package/dist/files.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documents for `extract`, `runs.create`, `files.upload` and `batches.create` (SPEC §4.1): a path,
|
|
3
|
+
* a `Blob`/`File`, bytes, a stream — uploaded in the same multipart request — or a public URL or
|
|
4
|
+
* an uploaded file's id.
|
|
5
|
+
*/
|
|
6
|
+
import { FileTooLargeError } from './errors.js';
|
|
7
|
+
/** The API's limit for one file: 50 MiB. */
|
|
8
|
+
export const MAX_FILE_BYTES = 52_428_800;
|
|
9
|
+
const MIME = {
|
|
10
|
+
pdf: 'application/pdf',
|
|
11
|
+
png: 'image/png',
|
|
12
|
+
jpg: 'image/jpeg',
|
|
13
|
+
jpeg: 'image/jpeg',
|
|
14
|
+
tif: 'image/tiff',
|
|
15
|
+
tiff: 'image/tiff',
|
|
16
|
+
webp: 'image/webp',
|
|
17
|
+
heic: 'image/heic',
|
|
18
|
+
doc: 'application/msword',
|
|
19
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
20
|
+
xls: 'application/vnd.ms-excel',
|
|
21
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
22
|
+
odt: 'application/vnd.oasis.opendocument.text',
|
|
23
|
+
ods: 'application/vnd.oasis.opendocument.spreadsheet',
|
|
24
|
+
rtf: 'application/rtf',
|
|
25
|
+
txt: 'text/plain',
|
|
26
|
+
zip: 'application/zip',
|
|
27
|
+
};
|
|
28
|
+
/** The part's `Content-Type` by extension, else `application/octet-stream`. */
|
|
29
|
+
export function mimeOf(filename) {
|
|
30
|
+
const ext = /\.([A-Za-z0-9]+)$/.exec(filename)?.[1]?.toLowerCase() ?? '';
|
|
31
|
+
return MIME[ext] ?? 'application/octet-stream';
|
|
32
|
+
}
|
|
33
|
+
function basename(path) {
|
|
34
|
+
return path.split(/[\\/]/).pop() || 'document';
|
|
35
|
+
}
|
|
36
|
+
function tooLarge(size) {
|
|
37
|
+
return new FileTooLargeError({
|
|
38
|
+
status: 413,
|
|
39
|
+
code: 'file_too_large',
|
|
40
|
+
title: 'Payload Too Large',
|
|
41
|
+
detail: `The file is ${size} bytes, more than the ${MAX_FILE_BYTES} bytes (50 MiB) the API accepts`,
|
|
42
|
+
docUrl: 'https://docs.typizer.ru/errors/file_too_large',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async function readAll(source) {
|
|
46
|
+
const chunks = [];
|
|
47
|
+
let size = 0;
|
|
48
|
+
const push = (chunk) => {
|
|
49
|
+
size += chunk.byteLength;
|
|
50
|
+
if (size > MAX_FILE_BYTES)
|
|
51
|
+
throw tooLarge(size);
|
|
52
|
+
chunks.push(chunk);
|
|
53
|
+
};
|
|
54
|
+
if (typeof source.getReader === 'function') {
|
|
55
|
+
const reader = source.getReader();
|
|
56
|
+
try {
|
|
57
|
+
for (;;) {
|
|
58
|
+
const { done, value } = await reader.read();
|
|
59
|
+
if (done)
|
|
60
|
+
break;
|
|
61
|
+
push(value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
reader.releaseLock();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
for await (const chunk of source)
|
|
70
|
+
push(chunk);
|
|
71
|
+
}
|
|
72
|
+
const out = new Uint8Array(size);
|
|
73
|
+
let at = 0;
|
|
74
|
+
for (const c of chunks) {
|
|
75
|
+
out.set(c, at);
|
|
76
|
+
at += c.byteLength;
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
function isUploadable(v) {
|
|
81
|
+
return (typeof v === 'string' ||
|
|
82
|
+
v instanceof Blob ||
|
|
83
|
+
v instanceof Uint8Array ||
|
|
84
|
+
v instanceof ArrayBuffer ||
|
|
85
|
+
(typeof v === 'object' &&
|
|
86
|
+
v !== null &&
|
|
87
|
+
(typeof v.getReader === 'function' || Symbol.asyncIterator in v)));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Reads a local document into memory (a stream that cannot be rewound is read whole, at most
|
|
91
|
+
* 50 MiB, so a retry can send it again).
|
|
92
|
+
*/
|
|
93
|
+
export async function toBlob(file, filename) {
|
|
94
|
+
let bytes;
|
|
95
|
+
let name = filename;
|
|
96
|
+
if (typeof file === 'string') {
|
|
97
|
+
const { readFile } = await import('node:fs/promises');
|
|
98
|
+
bytes = new Uint8Array(await readFile(file));
|
|
99
|
+
name ??= basename(file);
|
|
100
|
+
}
|
|
101
|
+
else if (file instanceof Blob) {
|
|
102
|
+
bytes = file;
|
|
103
|
+
name ??= file.name || undefined;
|
|
104
|
+
}
|
|
105
|
+
else if (file instanceof Uint8Array) {
|
|
106
|
+
bytes = file;
|
|
107
|
+
}
|
|
108
|
+
else if (file instanceof ArrayBuffer) {
|
|
109
|
+
bytes = new Uint8Array(file);
|
|
110
|
+
}
|
|
111
|
+
else if (isUploadable(file)) {
|
|
112
|
+
bytes = await readAll(file);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
throw new TypeError('typizer: file must be a path, a Blob, bytes or a stream');
|
|
116
|
+
}
|
|
117
|
+
const finalName = name || 'document';
|
|
118
|
+
const size = bytes instanceof Blob ? bytes.size : bytes.byteLength;
|
|
119
|
+
if (size > MAX_FILE_BYTES)
|
|
120
|
+
throw tooLarge(size);
|
|
121
|
+
const type = bytes instanceof Blob && bytes.type ? bytes.type : mimeOf(finalName);
|
|
122
|
+
const blob = bytes instanceof Blob && bytes.type === type ? bytes : new Blob([bytes], { type });
|
|
123
|
+
return { blob, filename: finalName };
|
|
124
|
+
}
|
|
125
|
+
/** Resolves exactly one of `file` / `url` / `fileId` (an argument error otherwise). */
|
|
126
|
+
export async function resolveDocument(method, input) {
|
|
127
|
+
const sources = [];
|
|
128
|
+
const pending = [];
|
|
129
|
+
const { file } = input;
|
|
130
|
+
if (file !== undefined && file !== null) {
|
|
131
|
+
if (isUploadable(file)) {
|
|
132
|
+
pending.push(toBlob(file, input.filename).then((b) => ({ kind: 'local', ...b })));
|
|
133
|
+
}
|
|
134
|
+
else if (typeof file === 'object' && 'url' in file && typeof file.url === 'string') {
|
|
135
|
+
sources.push({ kind: 'url', url: file.url });
|
|
136
|
+
}
|
|
137
|
+
else if (typeof file === 'object' && 'fileId' in file && typeof file.fileId === 'string') {
|
|
138
|
+
sources.push({ kind: 'id', id: file.fileId });
|
|
139
|
+
}
|
|
140
|
+
else if (typeof file === 'object' &&
|
|
141
|
+
'id' in file &&
|
|
142
|
+
file.object === 'file') {
|
|
143
|
+
sources.push({ kind: 'id', id: file.id });
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
throw new TypeError(`typizer: ${method}: file must be a path, Blob, bytes, stream, { url } or { fileId }`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (input.url)
|
|
150
|
+
sources.push({ kind: 'url', url: input.url });
|
|
151
|
+
if (input.fileId)
|
|
152
|
+
sources.push({ kind: 'id', id: input.fileId });
|
|
153
|
+
if (sources.length + pending.length !== 1) {
|
|
154
|
+
throw new TypeError(`typizer: ${method}: pass exactly one document: file (a path, Blob, bytes or stream), url or fileId`);
|
|
155
|
+
}
|
|
156
|
+
return pending.length
|
|
157
|
+
? pending[0]
|
|
158
|
+
: sources[0];
|
|
159
|
+
}
|
package/dist/gen/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createAgentMessage, createAgentSampleRun, createAgentThread, createApiKey, createBatch, createCheckout, createConsent, createContractRequest, createDemoRun, createFile, createInvoice, createRun, createTypizer, createWebhookEndpoint, deleteApiKey, deleteFile, deleteMe, deleteOrganization, deleteTypizer, deleteWebhookEndpoint, exportBatch, extract, generateTypizer, getActPdf, getAgentThread, getBalance, getBatch, getBillingProfile, getCompany, getContractRequestPdf, getDemoRun, getFile, getFileContent, getMe, getMyConsents, getOpenApiDocument, getOrganization, getPayment, getRun, getRunOutput, getStatus, getTypizer, getTypizerVersion, getTypizerXsd, getUsage, getWebhookEndpoint, listAgentThreads, listApiKeys, listBatches, listContractRequests, listDemoSamples, listPayments, listRuns, listSignIns, listTypizers, listTypizerVersions, listWebhookDeliveries, listWebhookEndpoints, type Options, retryRun, retryWebhookDelivery, saveAgentThread, startLogin, suggestCompanies, testWebhookEndpoint, updateAgentThread, updateAutotopup, updateBillingProfile, updateOrganization, updateTypizer, updateWebhookEndpoint } from './sdk.gen.js';
|
|
2
|
-
export type { AgentMessage, AgentThread, ApiKey, Balance, BalanceLot, Batch, BillingProfile, Checkout, CheckoutRequest, ClientOptions, Company, CompanyList, ConsentRequest, ContractRequest, ContractRequestList, CreateAgentMessageData, CreateAgentMessageError, CreateAgentMessageErrors, CreateAgentMessageRequest, CreateAgentMessageResponse, CreateAgentMessageResponses, CreateAgentSampleRunData, CreateAgentSampleRunError, CreateAgentSampleRunErrors, CreateAgentSampleRunResponse, CreateAgentSampleRunResponses, CreateAgentThreadData, CreateAgentThreadError, CreateAgentThreadErrors, CreateAgentThreadRequest, CreateAgentThreadResponse, CreateAgentThreadResponses, CreateApiKeyData, CreateApiKeyError, CreateApiKeyErrors, CreateApiKeyRequest, CreateApiKeyResponse, CreateApiKeyResponses, CreateBatchData, CreateBatchError, CreateBatchErrors, CreateBatchRequest, CreateBatchResponse, CreateBatchResponses, CreateCheckoutData, CreateCheckoutError, CreateCheckoutErrors, CreateCheckoutResponse, CreateCheckoutResponses, CreateConsentData, CreateConsentError, CreateConsentErrors, CreateConsentResponse, CreateConsentResponses, CreateContractRequestData, CreateContractRequestError, CreateContractRequestErrors, CreateContractRequestResponse, CreateContractRequestResponses, CreatedApiKey, CreateDemoRunData, CreateDemoRunError, CreateDemoRunErrors, CreateDemoRunResponse, CreateDemoRunResponses, CreateFileData, CreateFileError, CreateFileErrors, CreateFileResponse, CreateFileResponses, CreateInvoiceData, CreateInvoiceError, CreateInvoiceErrors, CreateInvoiceRequest, CreateInvoiceResponse, CreateInvoiceResponses, CreateRunData, CreateRunError, CreateRunErrors, CreateRunRequest, CreateRunResponse, CreateRunResponses, CreateTypizerData, CreateTypizerError, CreateTypizerErrors, CreateTypizerRequest, CreateTypizerResponse, CreateTypizerResponses, CreateWebhookEndpointData, CreateWebhookEndpointError, CreateWebhookEndpointErrors, CreateWebhookEndpointRequest, CreateWebhookEndpointResponse, CreateWebhookEndpointResponses, DeleteApiKeyData, DeleteApiKeyError, DeleteApiKeyErrors, DeleteApiKeyResponse, DeleteApiKeyResponses, DeletedApiKey, DeletedFile, DeletedTypizer, DeletedWebhookEndpoint, DeleteFileData, DeleteFileError, DeleteFileErrors, DeleteFileResponse, DeleteFileResponses, DeleteMeData, DeleteMeError, DeleteMeErrors, DeleteMeResponse, DeleteMeResponses, DeleteOrganizationData, DeleteOrganizationError, DeleteOrganizationErrors, DeleteOrganizationResponse, DeleteOrganizationResponses, DeleteTypizerData, DeleteTypizerError, DeleteTypizerErrors, DeleteTypizerResponse, DeleteTypizerResponses, DeleteWebhookEndpointData, DeleteWebhookEndpointError, DeleteWebhookEndpointErrors, DeleteWebhookEndpointResponse, DeleteWebhookEndpointResponses, DemoRun, DemoRunRequest, DemoSample, DemoSampleList, ExportBatchData, ExportBatchError, ExportBatchErrors, ExportBatchResponse, ExportBatchResponses, ExtractData, ExtractError, ExtractErrors, ExtractRequest, ExtractResponse, ExtractResponses, File, GenerateTypizerData, GenerateTypizerError, GenerateTypizerErrors, GenerateTypizerRequest, GenerateTypizerResponse, GenerateTypizerResponses, GetActPdfData, GetActPdfError, GetActPdfErrors, GetActPdfResponse, GetActPdfResponses, GetAgentThreadData, GetAgentThreadError, GetAgentThreadErrors, GetAgentThreadResponse, GetAgentThreadResponses, GetBalanceData, GetBalanceError, GetBalanceErrors, GetBalanceResponse, GetBalanceResponses, GetBatchData, GetBatchError, GetBatchErrors, GetBatchResponse, GetBatchResponses, GetBillingProfileData, GetBillingProfileError, GetBillingProfileErrors, GetBillingProfileResponse, GetBillingProfileResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContractRequestPdfData, GetContractRequestPdfError, GetContractRequestPdfErrors, GetContractRequestPdfResponse, GetContractRequestPdfResponses, GetDemoRunData, GetDemoRunError, GetDemoRunErrors, GetDemoRunResponse, GetDemoRunResponses, GetFileContentData, GetFileContentError, GetFileContentErrors, GetFileContentResponse, GetFileContentResponses, GetFileData, GetFileError, GetFileErrors, GetFileResponse, GetFileResponses, GetMeData, GetMeError, GetMeErrors, GetMeResponse, GetMeResponses, GetMyConsentsData, GetMyConsentsError, GetMyConsentsErrors, GetMyConsentsResponse, GetMyConsentsResponses, GetOpenApiDocumentData, GetOpenApiDocumentError, GetOpenApiDocumentErrors, GetOpenApiDocumentResponse, GetOpenApiDocumentResponses, GetOrganizationData, GetOrganizationError, GetOrganizationErrors, GetOrganizationResponse, GetOrganizationResponses, GetPaymentData, GetPaymentError, GetPaymentErrors, GetPaymentResponse, GetPaymentResponses, GetRunData, GetRunError, GetRunErrors, GetRunOutputData, GetRunOutputError, GetRunOutputErrors, GetRunOutputResponses, GetRunResponse, GetRunResponses, GetStatusData, GetStatusError, GetStatusErrors, GetStatusResponse, GetStatusResponses, GetTypizerData, GetTypizerError, GetTypizerErrors, GetTypizerResponse, GetTypizerResponses, GetTypizerVersionData, GetTypizerVersionError, GetTypizerVersionErrors, GetTypizerVersionResponse, GetTypizerVersionResponses, GetTypizerXsdData, GetTypizerXsdError, GetTypizerXsdErrors, GetTypizerXsdResponse, GetTypizerXsdResponses, GetUsageData, GetUsageError, GetUsageErrors, GetUsageResponse, GetUsageResponses, GetWebhookEndpointData, GetWebhookEndpointError, GetWebhookEndpointErrors, GetWebhookEndpointResponse, GetWebhookEndpointResponses, IdempotencyKey, IdempotencyKeyIgnored, ListAgentThreadsData, ListAgentThreadsError, ListAgentThreadsErrors, ListAgentThreadsResponse, ListAgentThreadsResponses, ListApiKeysData, ListApiKeysError, ListApiKeysErrors, ListApiKeysResponse, ListApiKeysResponses, ListBatchesData, ListBatchesError, ListBatchesErrors, ListBatchesResponse, ListBatchesResponses, ListContractRequestsData, ListContractRequestsError, ListContractRequestsErrors, ListContractRequestsResponse, ListContractRequestsResponses, ListDemoSamplesData, ListDemoSamplesError, ListDemoSamplesErrors, ListDemoSamplesResponse, ListDemoSamplesResponses, ListPaymentsData, ListPaymentsError, ListPaymentsErrors, ListPaymentsResponse, ListPaymentsResponses, ListRunsData, ListRunsError, ListRunsErrors, ListRunsResponse, ListRunsResponses, ListSignInsData, ListSignInsError, ListSignInsErrors, ListSignInsResponse, ListSignInsResponses, ListTypizersData, ListTypizersError, ListTypizersErrors, ListTypizersResponse, ListTypizersResponses, ListTypizerVersionsData, ListTypizerVersionsError, ListTypizerVersionsErrors, ListTypizerVersionsResponse, ListTypizerVersionsResponses, ListWebhookDeliveriesData, ListWebhookDeliveriesError, ListWebhookDeliveriesErrors, ListWebhookDeliveriesResponse, ListWebhookDeliveriesResponses, ListWebhookEndpointsData, ListWebhookEndpointsError, ListWebhookEndpointsErrors, ListWebhookEndpointsResponse, ListWebhookEndpointsResponses, LoginChallenge, LoginStartRequest, MaintenanceEvent, MarketingConsentState, Me, MyConsents, Organization, Payment, PaymentList, Problem, RetryRunData, RetryRunError, RetryRunErrors, RetryRunResponse, RetryRunResponses, RetryWebhookDeliveryData, RetryWebhookDeliveryError, RetryWebhookDeliveryErrors, RetryWebhookDeliveryResponse, RetryWebhookDeliveryResponses, Run, SaveAgentThreadData, SaveAgentThreadError, SaveAgentThreadErrors, SaveAgentThreadRequest, SaveAgentThreadResponse, SaveAgentThreadResponses, Scope, SignIn, SignInList, StartLoginData, StartLoginError, StartLoginErrors, StartLoginResponse, StartLoginResponses, Status, SuggestCompaniesData, SuggestCompaniesError, SuggestCompaniesErrors, SuggestCompaniesResponse, SuggestCompaniesResponses, TestWebhookEndpointData, TestWebhookEndpointError, TestWebhookEndpointErrors, TestWebhookEndpointResponse, TestWebhookEndpointResponses, Typizer, TypizerDraft, TypizerOrganization, TypizerVersion, UpdateAgentThreadData, UpdateAgentThreadError, UpdateAgentThreadErrors, UpdateAgentThreadRequest, UpdateAgentThreadResponse, UpdateAgentThreadResponses, UpdateAutotopupData, UpdateAutotopupError, UpdateAutotopupErrors, UpdateAutotopupRequest, UpdateAutotopupResponse, UpdateAutotopupResponses, UpdateBillingProfileData, UpdateBillingProfileError, UpdateBillingProfileErrors, UpdateBillingProfileRequest, UpdateBillingProfileResponse, UpdateBillingProfileResponses, UpdateOrganizationData, UpdateOrganizationError, UpdateOrganizationErrors, UpdateOrganizationRequest, UpdateOrganizationResponse, UpdateOrganizationResponses, UpdateTypizerData, UpdateTypizerError, UpdateTypizerErrors, UpdateTypizerRequest, UpdateTypizerResponse, UpdateTypizerResponses, UpdateWebhookEndpointData, UpdateWebhookEndpointError, UpdateWebhookEndpointErrors, UpdateWebhookEndpointRequest, UpdateWebhookEndpointResponse, UpdateWebhookEndpointResponses, Usage, UsageRow, WebhookDelivery, WebhookEndpoint, WebhookEventType } from './types.gen.js';
|
|
1
|
+
export { applyTypizerCatalogUpdate, approveConnectorLinkRequest, createAgentMessage, createAgentSampleRun, createAgentThread, createApiKey, createBatch, createCheckout, createConnectorLink, createConsent, createContractRequest, createDemoRun, createFile, createInboundMailbox, createInvoice, createRun, createToolOcr, createTypizer, createWebhookEndpoint, deleteApiKey, deleteFile, deleteInboundMailbox, deleteMe, deleteOrganization, deleteTypizer, deleteWebhookEndpoint, exportBatch, extract, favoriteCatalogEntry, forkCatalogEntry, generateTypizer, getActPdf, getAgentThread, getBalance, getBatch, getBillingProfile, getCatalogEntry, getCatalogPublisher, getCommunityCatalogEntry, getCompany, getConnectorLinkRequest, getContractRequestPdf, getDemoQuota, getDemoRun, getFile, getFileContent, getMe, getMyConsents, getOpenApiDocument, getOrganization, getOwnCatalogPublisher, getPayment, getRun, getRunOutput, getStatus, getToolOcrQuota, getTypizer, getTypizerCatalogUpdate, getTypizerVersion, getTypizerXsd, getUsage, getWebhookEndpoint, installCatalogEntry, listAgentThreads, listApiKeys, listBatches, listCatalog, listCatalogVersions, listContractRequests, listDemoSamples, listInboundMailboxes, listInboundMessages, listOwnCatalogEntries, listPayments, listRuns, listSignIns, listTypizers, listTypizerVersions, listWebhookDeliveries, listWebhookEndpoints, type Options, publishTypizer, rejectConnectorLinkRequest, reportCatalogEntry, retryRun, retryWebhookDelivery, rotateInboundMailbox, saveAgentThread, startLogin, suggestCompanies, testWebhookEndpoint, unfavoriteCatalogEntry, unpublishCatalogEntry, updateAgentThread, updateAutotopup, updateBillingProfile, updateInboundMailbox, updateOrganization, updateTypizer, updateWebhookEndpoint, upsertOwnCatalogPublisher } from './sdk.gen.js';
|
|
2
|
+
export type { AgentMessage, AgentThread, ApiKey, ApplyTypizerCatalogUpdateData, ApplyTypizerCatalogUpdateError, ApplyTypizerCatalogUpdateErrors, ApplyTypizerCatalogUpdateResponse, ApplyTypizerCatalogUpdateResponses, ApproveConnectorLinkRequestData, ApproveConnectorLinkRequestError, ApproveConnectorLinkRequestErrors, ApproveConnectorLinkRequestResponse, ApproveConnectorLinkRequestResponses, Balance, BalanceLot, Batch, BillingProfile, CatalogEntry, CatalogEntryBrief, CatalogFavorite, CatalogInstallRequest, CatalogList, CatalogOwnEntry, CatalogPublisher, CatalogPublisherBrief, CatalogPublisherRequest, CatalogReport, CatalogReportRequest, CatalogUpdate, CatalogUpdateRequest, CatalogVersion, CatalogVersionBrief, Checkout, CheckoutRequest, ClientOptions, Company, CompanyList, ConnectorLink, ConnectorLinkAuthorization, ConnectorLinkRequest, ConnectorLinkRequestRejected, ConsentRequest, ContractRequest, ContractRequestList, CreateAgentMessageData, CreateAgentMessageError, CreateAgentMessageErrors, CreateAgentMessageRequest, CreateAgentMessageResponse, CreateAgentMessageResponses, CreateAgentSampleRunData, CreateAgentSampleRunError, CreateAgentSampleRunErrors, CreateAgentSampleRunResponse, CreateAgentSampleRunResponses, CreateAgentThreadData, CreateAgentThreadError, CreateAgentThreadErrors, CreateAgentThreadRequest, CreateAgentThreadResponse, CreateAgentThreadResponses, CreateApiKeyData, CreateApiKeyError, CreateApiKeyErrors, CreateApiKeyRequest, CreateApiKeyResponse, CreateApiKeyResponses, CreateBatchData, CreateBatchError, CreateBatchErrors, CreateBatchRequest, CreateBatchResponse, CreateBatchResponses, CreateCheckoutData, CreateCheckoutError, CreateCheckoutErrors, CreateCheckoutResponse, CreateCheckoutResponses, CreateConnectorLinkData, CreateConnectorLinkError, CreateConnectorLinkErrors, CreateConnectorLinkRequest, CreateConnectorLinkResponse, CreateConnectorLinkResponses, CreateConsentData, CreateConsentError, CreateConsentErrors, CreateConsentResponse, CreateConsentResponses, CreateContractRequestData, CreateContractRequestError, CreateContractRequestErrors, CreateContractRequestResponse, CreateContractRequestResponses, CreatedApiKey, CreateDemoRunData, CreateDemoRunError, CreateDemoRunErrors, CreateDemoRunResponse, CreateDemoRunResponses, CreateFileData, CreateFileError, CreateFileErrors, CreateFileResponse, CreateFileResponses, CreateInboundMailboxData, CreateInboundMailboxError, CreateInboundMailboxErrors, CreateInboundMailboxRequest, CreateInboundMailboxResponse, CreateInboundMailboxResponses, CreateInvoiceData, CreateInvoiceError, CreateInvoiceErrors, CreateInvoiceRequest, CreateInvoiceResponse, CreateInvoiceResponses, CreateRunData, CreateRunError, CreateRunErrors, CreateRunRequest, CreateRunResponse, CreateRunResponses, CreateToolOcrData, CreateToolOcrError, CreateToolOcrErrors, CreateToolOcrResponse, CreateToolOcrResponses, CreateTypizerData, CreateTypizerError, CreateTypizerErrors, CreateTypizerRequest, CreateTypizerResponse, CreateTypizerResponses, CreateWebhookEndpointData, CreateWebhookEndpointError, CreateWebhookEndpointErrors, CreateWebhookEndpointRequest, CreateWebhookEndpointResponse, CreateWebhookEndpointResponses, DeleteApiKeyData, DeleteApiKeyError, DeleteApiKeyErrors, DeleteApiKeyResponse, DeleteApiKeyResponses, DeletedApiKey, DeletedFile, DeletedInboundMailbox, DeletedTypizer, DeletedWebhookEndpoint, DeleteFileData, DeleteFileError, DeleteFileErrors, DeleteFileResponse, DeleteFileResponses, DeleteInboundMailboxData, DeleteInboundMailboxError, DeleteInboundMailboxErrors, DeleteInboundMailboxResponse, DeleteInboundMailboxResponses, DeleteMeData, DeleteMeError, DeleteMeErrors, DeleteMeResponse, DeleteMeResponses, DeleteOrganizationData, DeleteOrganizationError, DeleteOrganizationErrors, DeleteOrganizationResponse, DeleteOrganizationResponses, DeleteTypizerData, DeleteTypizerError, DeleteTypizerErrors, DeleteTypizerResponse, DeleteTypizerResponses, DeleteWebhookEndpointData, DeleteWebhookEndpointError, DeleteWebhookEndpointErrors, DeleteWebhookEndpointResponse, DeleteWebhookEndpointResponses, DemoQuota, DemoRun, DemoRunRequest, DemoSample, DemoSampleList, ExportBatchData, ExportBatchError, ExportBatchErrors, ExportBatchResponse, ExportBatchResponses, ExtractData, ExtractError, ExtractErrors, ExtractRequest, ExtractResponse, ExtractResponses, FavoriteCatalogEntryData, FavoriteCatalogEntryError, FavoriteCatalogEntryErrors, FavoriteCatalogEntryResponse, FavoriteCatalogEntryResponses, File, ForkCatalogEntryData, ForkCatalogEntryError, ForkCatalogEntryErrors, ForkCatalogEntryResponse, ForkCatalogEntryResponses, GenerateTypizerData, GenerateTypizerError, GenerateTypizerErrors, GenerateTypizerRequest, GenerateTypizerResponse, GenerateTypizerResponses, GetActPdfData, GetActPdfError, GetActPdfErrors, GetActPdfResponse, GetActPdfResponses, GetAgentThreadData, GetAgentThreadError, GetAgentThreadErrors, GetAgentThreadResponse, GetAgentThreadResponses, GetBalanceData, GetBalanceError, GetBalanceErrors, GetBalanceResponse, GetBalanceResponses, GetBatchData, GetBatchError, GetBatchErrors, GetBatchResponse, GetBatchResponses, GetBillingProfileData, GetBillingProfileError, GetBillingProfileErrors, GetBillingProfileResponse, GetBillingProfileResponses, GetCatalogEntryData, GetCatalogEntryError, GetCatalogEntryErrors, GetCatalogEntryResponse, GetCatalogEntryResponses, GetCatalogPublisherData, GetCatalogPublisherError, GetCatalogPublisherErrors, GetCatalogPublisherResponse, GetCatalogPublisherResponses, GetCommunityCatalogEntryData, GetCommunityCatalogEntryError, GetCommunityCatalogEntryErrors, GetCommunityCatalogEntryResponse, GetCommunityCatalogEntryResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetConnectorLinkRequestData, GetConnectorLinkRequestError, GetConnectorLinkRequestErrors, GetConnectorLinkRequestResponse, GetConnectorLinkRequestResponses, GetContractRequestPdfData, GetContractRequestPdfError, GetContractRequestPdfErrors, GetContractRequestPdfResponse, GetContractRequestPdfResponses, GetDemoQuotaData, GetDemoQuotaError, GetDemoQuotaErrors, GetDemoQuotaResponse, GetDemoQuotaResponses, GetDemoRunData, GetDemoRunError, GetDemoRunErrors, GetDemoRunResponse, GetDemoRunResponses, GetFileContentData, GetFileContentError, GetFileContentErrors, GetFileContentResponse, GetFileContentResponses, GetFileData, GetFileError, GetFileErrors, GetFileResponse, GetFileResponses, GetMeData, GetMeError, GetMeErrors, GetMeResponse, GetMeResponses, GetMyConsentsData, GetMyConsentsError, GetMyConsentsErrors, GetMyConsentsResponse, GetMyConsentsResponses, GetOpenApiDocumentData, GetOpenApiDocumentError, GetOpenApiDocumentErrors, GetOpenApiDocumentResponse, GetOpenApiDocumentResponses, GetOrganizationData, GetOrganizationError, GetOrganizationErrors, GetOrganizationResponse, GetOrganizationResponses, GetOwnCatalogPublisherData, GetOwnCatalogPublisherError, GetOwnCatalogPublisherErrors, GetOwnCatalogPublisherResponse, GetOwnCatalogPublisherResponses, GetPaymentData, GetPaymentError, GetPaymentErrors, GetPaymentResponse, GetPaymentResponses, GetRunData, GetRunError, GetRunErrors, GetRunOutputData, GetRunOutputError, GetRunOutputErrors, GetRunOutputResponses, GetRunResponse, GetRunResponses, GetStatusData, GetStatusError, GetStatusErrors, GetStatusResponse, GetStatusResponses, GetToolOcrQuotaData, GetToolOcrQuotaError, GetToolOcrQuotaErrors, GetToolOcrQuotaResponse, GetToolOcrQuotaResponses, GetTypizerCatalogUpdateData, GetTypizerCatalogUpdateError, GetTypizerCatalogUpdateErrors, GetTypizerCatalogUpdateResponse, GetTypizerCatalogUpdateResponses, GetTypizerData, GetTypizerError, GetTypizerErrors, GetTypizerResponse, GetTypizerResponses, GetTypizerVersionData, GetTypizerVersionError, GetTypizerVersionErrors, GetTypizerVersionResponse, GetTypizerVersionResponses, GetTypizerXsdData, GetTypizerXsdError, GetTypizerXsdErrors, GetTypizerXsdResponse, GetTypizerXsdResponses, GetUsageData, GetUsageError, GetUsageErrors, GetUsageResponse, GetUsageResponses, GetWebhookEndpointData, GetWebhookEndpointError, GetWebhookEndpointErrors, GetWebhookEndpointResponse, GetWebhookEndpointResponses, IdempotencyKey, IdempotencyKeyIgnored, InboundMailbox, InboundMailboxList, InboundMessage, InstallCatalogEntryData, InstallCatalogEntryError, InstallCatalogEntryErrors, InstallCatalogEntryResponse, InstallCatalogEntryResponses, ListAgentThreadsData, ListAgentThreadsError, ListAgentThreadsErrors, ListAgentThreadsResponse, ListAgentThreadsResponses, ListApiKeysData, ListApiKeysError, ListApiKeysErrors, ListApiKeysResponse, ListApiKeysResponses, ListBatchesData, ListBatchesError, ListBatchesErrors, ListBatchesResponse, ListBatchesResponses, ListCatalogData, ListCatalogError, ListCatalogErrors, ListCatalogResponse, ListCatalogResponses, ListCatalogVersionsData, ListCatalogVersionsError, ListCatalogVersionsErrors, ListCatalogVersionsResponse, ListCatalogVersionsResponses, ListContractRequestsData, ListContractRequestsError, ListContractRequestsErrors, ListContractRequestsResponse, ListContractRequestsResponses, ListDemoSamplesData, ListDemoSamplesError, ListDemoSamplesErrors, ListDemoSamplesResponse, ListDemoSamplesResponses, ListInboundMailboxesData, ListInboundMailboxesError, ListInboundMailboxesErrors, ListInboundMailboxesResponse, ListInboundMailboxesResponses, ListInboundMessagesData, ListInboundMessagesError, ListInboundMessagesErrors, ListInboundMessagesResponse, ListInboundMessagesResponses, ListOwnCatalogEntriesData, ListOwnCatalogEntriesError, ListOwnCatalogEntriesErrors, ListOwnCatalogEntriesResponse, ListOwnCatalogEntriesResponses, ListPaymentsData, ListPaymentsError, ListPaymentsErrors, ListPaymentsResponse, ListPaymentsResponses, ListRunsData, ListRunsError, ListRunsErrors, ListRunsResponse, ListRunsResponses, ListSignInsData, ListSignInsError, ListSignInsErrors, ListSignInsResponse, ListSignInsResponses, ListTypizersData, ListTypizersError, ListTypizersErrors, ListTypizersResponse, ListTypizersResponses, ListTypizerVersionsData, ListTypizerVersionsError, ListTypizerVersionsErrors, ListTypizerVersionsResponse, ListTypizerVersionsResponses, ListWebhookDeliveriesData, ListWebhookDeliveriesError, ListWebhookDeliveriesErrors, ListWebhookDeliveriesResponse, ListWebhookDeliveriesResponses, ListWebhookEndpointsData, ListWebhookEndpointsError, ListWebhookEndpointsErrors, ListWebhookEndpointsResponse, ListWebhookEndpointsResponses, LoginChallenge, LoginStartRequest, MaintenanceEvent, MarketingConsentState, Me, MyConsents, OcrPage, OcrQuota, OcrResult, OcrTable, Organization, Payment, PaymentList, Problem, PublishTypizerData, PublishTypizerError, PublishTypizerErrors, PublishTypizerRequest, PublishTypizerResponse, PublishTypizerResponses, RejectConnectorLinkRequestData, RejectConnectorLinkRequestError, RejectConnectorLinkRequestErrors, RejectConnectorLinkRequestResponse, RejectConnectorLinkRequestResponses, ReportCatalogEntryData, ReportCatalogEntryError, ReportCatalogEntryErrors, ReportCatalogEntryResponse, ReportCatalogEntryResponses, RetryRunData, RetryRunError, RetryRunErrors, RetryRunResponse, RetryRunResponses, RetryWebhookDeliveryData, RetryWebhookDeliveryError, RetryWebhookDeliveryErrors, RetryWebhookDeliveryResponse, RetryWebhookDeliveryResponses, RotateInboundMailboxData, RotateInboundMailboxError, RotateInboundMailboxErrors, RotateInboundMailboxResponse, RotateInboundMailboxResponses, Run, SaveAgentThreadData, SaveAgentThreadError, SaveAgentThreadErrors, SaveAgentThreadRequest, SaveAgentThreadResponse, SaveAgentThreadResponses, SchemaChange, Scope, SignIn, SignInList, StartLoginData, StartLoginError, StartLoginErrors, StartLoginResponse, StartLoginResponses, Status, SuggestCompaniesData, SuggestCompaniesError, SuggestCompaniesErrors, SuggestCompaniesResponse, SuggestCompaniesResponses, TestWebhookEndpointData, TestWebhookEndpointError, TestWebhookEndpointErrors, TestWebhookEndpointResponse, TestWebhookEndpointResponses, Typizer, TypizerDraft, TypizerOrganization, TypizerVersion, UnfavoriteCatalogEntryData, UnfavoriteCatalogEntryError, UnfavoriteCatalogEntryErrors, UnfavoriteCatalogEntryResponse, UnfavoriteCatalogEntryResponses, UnpublishCatalogEntryData, UnpublishCatalogEntryError, UnpublishCatalogEntryErrors, UnpublishCatalogEntryResponse, UnpublishCatalogEntryResponses, UpdateAgentThreadData, UpdateAgentThreadError, UpdateAgentThreadErrors, UpdateAgentThreadRequest, UpdateAgentThreadResponse, UpdateAgentThreadResponses, UpdateAutotopupData, UpdateAutotopupError, UpdateAutotopupErrors, UpdateAutotopupRequest, UpdateAutotopupResponse, UpdateAutotopupResponses, UpdateBillingProfileData, UpdateBillingProfileError, UpdateBillingProfileErrors, UpdateBillingProfileRequest, UpdateBillingProfileResponse, UpdateBillingProfileResponses, UpdateInboundMailboxData, UpdateInboundMailboxError, UpdateInboundMailboxErrors, UpdateInboundMailboxRequest, UpdateInboundMailboxResponse, UpdateInboundMailboxResponses, UpdateOrganizationData, UpdateOrganizationError, UpdateOrganizationErrors, UpdateOrganizationRequest, UpdateOrganizationResponse, UpdateOrganizationResponses, UpdateTypizerData, UpdateTypizerError, UpdateTypizerErrors, UpdateTypizerRequest, UpdateTypizerResponse, UpdateTypizerResponses, UpdateWebhookEndpointData, UpdateWebhookEndpointError, UpdateWebhookEndpointErrors, UpdateWebhookEndpointRequest, UpdateWebhookEndpointResponse, UpdateWebhookEndpointResponses, UpsertOwnCatalogPublisherData, UpsertOwnCatalogPublisherError, UpsertOwnCatalogPublisherErrors, UpsertOwnCatalogPublisherResponse, UpsertOwnCatalogPublisherResponses, Usage, UsageRow, WebhookDelivery, WebhookEndpoint, WebhookEventType } from './types.gen.js';
|
package/dist/gen/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export { createAgentMessage, createAgentSampleRun, createAgentThread, createApiKey, createBatch, createCheckout, createConsent, createContractRequest, createDemoRun, createFile, createInvoice, createRun, createTypizer, createWebhookEndpoint, deleteApiKey, deleteFile, deleteMe, deleteOrganization, deleteTypizer, deleteWebhookEndpoint, exportBatch, extract, generateTypizer, getActPdf, getAgentThread, getBalance, getBatch, getBillingProfile, getCompany, getContractRequestPdf, getDemoRun, getFile, getFileContent, getMe, getMyConsents, getOpenApiDocument, getOrganization, getPayment, getRun, getRunOutput, getStatus, getTypizer, getTypizerVersion, getTypizerXsd, getUsage, getWebhookEndpoint, listAgentThreads, listApiKeys, listBatches, listContractRequests, listDemoSamples, listPayments, listRuns, listSignIns, listTypizers, listTypizerVersions, listWebhookDeliveries, listWebhookEndpoints, retryRun, retryWebhookDelivery, saveAgentThread, startLogin, suggestCompanies, testWebhookEndpoint, updateAgentThread, updateAutotopup, updateBillingProfile, updateOrganization, updateTypizer, updateWebhookEndpoint } from './sdk.gen.js';
|
|
2
|
+
export { applyTypizerCatalogUpdate, approveConnectorLinkRequest, createAgentMessage, createAgentSampleRun, createAgentThread, createApiKey, createBatch, createCheckout, createConnectorLink, createConsent, createContractRequest, createDemoRun, createFile, createInboundMailbox, createInvoice, createRun, createToolOcr, createTypizer, createWebhookEndpoint, deleteApiKey, deleteFile, deleteInboundMailbox, deleteMe, deleteOrganization, deleteTypizer, deleteWebhookEndpoint, exportBatch, extract, favoriteCatalogEntry, forkCatalogEntry, generateTypizer, getActPdf, getAgentThread, getBalance, getBatch, getBillingProfile, getCatalogEntry, getCatalogPublisher, getCommunityCatalogEntry, getCompany, getConnectorLinkRequest, getContractRequestPdf, getDemoQuota, getDemoRun, getFile, getFileContent, getMe, getMyConsents, getOpenApiDocument, getOrganization, getOwnCatalogPublisher, getPayment, getRun, getRunOutput, getStatus, getToolOcrQuota, getTypizer, getTypizerCatalogUpdate, getTypizerVersion, getTypizerXsd, getUsage, getWebhookEndpoint, installCatalogEntry, listAgentThreads, listApiKeys, listBatches, listCatalog, listCatalogVersions, listContractRequests, listDemoSamples, listInboundMailboxes, listInboundMessages, listOwnCatalogEntries, listPayments, listRuns, listSignIns, listTypizers, listTypizerVersions, listWebhookDeliveries, listWebhookEndpoints, publishTypizer, rejectConnectorLinkRequest, reportCatalogEntry, retryRun, retryWebhookDelivery, rotateInboundMailbox, saveAgentThread, startLogin, suggestCompanies, testWebhookEndpoint, unfavoriteCatalogEntry, unpublishCatalogEntry, updateAgentThread, updateAutotopup, updateBillingProfile, updateInboundMailbox, updateOrganization, updateTypizer, updateWebhookEndpoint, upsertOwnCatalogPublisher } from './sdk.gen.js';
|