@mixedbread/sdk 0.1.0-alpha.8

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 (277) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/LICENSE +201 -0
  3. package/README.md +360 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +241 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +914 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +882 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +47 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +113 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +97 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +148 -0
  87. package/index.d.ts +148 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +151 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +108 -0
  92. package/index.mjs.map +1 -0
  93. package/lib/polling.d.ts +48 -0
  94. package/lib/polling.d.ts.map +1 -0
  95. package/lib/polling.js +75 -0
  96. package/lib/polling.js.map +1 -0
  97. package/lib/polling.mjs +71 -0
  98. package/lib/polling.mjs.map +1 -0
  99. package/package.json +124 -0
  100. package/pagination.d.ts +30 -0
  101. package/pagination.d.ts.map +1 -0
  102. package/pagination.js +45 -0
  103. package/pagination.js.map +1 -0
  104. package/pagination.mjs +41 -0
  105. package/pagination.mjs.map +1 -0
  106. package/resource.d.ts +6 -0
  107. package/resource.d.ts.map +1 -0
  108. package/resource.js +11 -0
  109. package/resource.js.map +1 -0
  110. package/resource.mjs +7 -0
  111. package/resource.mjs.map +1 -0
  112. package/resources/extractions/content.d.ts +35 -0
  113. package/resources/extractions/content.d.ts.map +1 -0
  114. package/resources/extractions/content.js +19 -0
  115. package/resources/extractions/content.js.map +1 -0
  116. package/resources/extractions/content.mjs +15 -0
  117. package/resources/extractions/content.mjs.map +1 -0
  118. package/resources/extractions/extractions.d.ts +18 -0
  119. package/resources/extractions/extractions.d.ts.map +1 -0
  120. package/resources/extractions/extractions.js +47 -0
  121. package/resources/extractions/extractions.js.map +1 -0
  122. package/resources/extractions/extractions.mjs +20 -0
  123. package/resources/extractions/extractions.mjs.map +1 -0
  124. package/resources/extractions/index.d.ts +5 -0
  125. package/resources/extractions/index.d.ts.map +1 -0
  126. package/resources/extractions/index.js +13 -0
  127. package/resources/extractions/index.js.map +1 -0
  128. package/resources/extractions/index.mjs +6 -0
  129. package/resources/extractions/index.mjs.map +1 -0
  130. package/resources/extractions/jobs.d.ts +44 -0
  131. package/resources/extractions/jobs.d.ts.map +1 -0
  132. package/resources/extractions/jobs.js +29 -0
  133. package/resources/extractions/jobs.js.map +1 -0
  134. package/resources/extractions/jobs.mjs +25 -0
  135. package/resources/extractions/jobs.mjs.map +1 -0
  136. package/resources/extractions/schema.d.ts +85 -0
  137. package/resources/extractions/schema.d.ts.map +1 -0
  138. package/resources/extractions/schema.js +39 -0
  139. package/resources/extractions/schema.js.map +1 -0
  140. package/resources/extractions/schema.mjs +35 -0
  141. package/resources/extractions/schema.mjs.map +1 -0
  142. package/resources/files.d.ts +125 -0
  143. package/resources/files.d.ts.map +1 -0
  144. package/resources/files.js +99 -0
  145. package/resources/files.js.map +1 -0
  146. package/resources/files.mjs +71 -0
  147. package/resources/files.mjs.map +1 -0
  148. package/resources/index.d.ts +7 -0
  149. package/resources/index.d.ts.map +1 -0
  150. package/resources/index.js +30 -0
  151. package/resources/index.js.map +1 -0
  152. package/resources/index.mjs +7 -0
  153. package/resources/index.mjs.map +1 -0
  154. package/resources/parsing/index.d.ts +3 -0
  155. package/resources/parsing/index.d.ts.map +1 -0
  156. package/resources/parsing/index.js +10 -0
  157. package/resources/parsing/index.js.map +1 -0
  158. package/resources/parsing/index.mjs +4 -0
  159. package/resources/parsing/index.mjs.map +1 -0
  160. package/resources/parsing/jobs.d.ts +278 -0
  161. package/resources/parsing/jobs.d.ts.map +1 -0
  162. package/resources/parsing/jobs.js +147 -0
  163. package/resources/parsing/jobs.js.map +1 -0
  164. package/resources/parsing/jobs.mjs +119 -0
  165. package/resources/parsing/jobs.mjs.map +1 -0
  166. package/resources/parsing/parsing.d.ts +10 -0
  167. package/resources/parsing/parsing.d.ts.map +1 -0
  168. package/resources/parsing/parsing.js +40 -0
  169. package/resources/parsing/parsing.js.map +1 -0
  170. package/resources/parsing/parsing.mjs +13 -0
  171. package/resources/parsing/parsing.mjs.map +1 -0
  172. package/resources/shared.d.ts +35 -0
  173. package/resources/shared.d.ts.map +1 -0
  174. package/resources/shared.js +4 -0
  175. package/resources/shared.js.map +1 -0
  176. package/resources/shared.mjs +3 -0
  177. package/resources/shared.mjs.map +1 -0
  178. package/resources/top-level.d.ts +11 -0
  179. package/resources/top-level.d.ts.map +1 -0
  180. package/resources/top-level.js +4 -0
  181. package/resources/top-level.js.map +1 -0
  182. package/resources/top-level.mjs +3 -0
  183. package/resources/top-level.mjs.map +1 -0
  184. package/resources/vector-stores/files.d.ts +280 -0
  185. package/resources/vector-stores/files.d.ts.map +1 -0
  186. package/resources/vector-stores/files.js +167 -0
  187. package/resources/vector-stores/files.js.map +1 -0
  188. package/resources/vector-stores/files.mjs +139 -0
  189. package/resources/vector-stores/files.mjs.map +1 -0
  190. package/resources/vector-stores/index.d.ts +3 -0
  191. package/resources/vector-stores/index.d.ts.map +1 -0
  192. package/resources/vector-stores/index.js +11 -0
  193. package/resources/vector-stores/index.js.map +1 -0
  194. package/resources/vector-stores/index.mjs +4 -0
  195. package/resources/vector-stores/index.mjs.map +1 -0
  196. package/resources/vector-stores/vector-stores.d.ts +400 -0
  197. package/resources/vector-stores/vector-stores.d.ts.map +1 -0
  198. package/resources/vector-stores/vector-stores.js +121 -0
  199. package/resources/vector-stores/vector-stores.js.map +1 -0
  200. package/resources/vector-stores/vector-stores.mjs +93 -0
  201. package/resources/vector-stores/vector-stores.mjs.map +1 -0
  202. package/shims/node.d.ts +30 -0
  203. package/shims/node.d.ts.map +1 -0
  204. package/shims/node.js +31 -0
  205. package/shims/node.js.map +1 -0
  206. package/shims/node.mjs +5 -0
  207. package/shims/node.mjs.map +1 -0
  208. package/shims/web.d.ts +26 -0
  209. package/shims/web.d.ts.map +1 -0
  210. package/shims/web.js +31 -0
  211. package/shims/web.js.map +1 -0
  212. package/shims/web.mjs +5 -0
  213. package/shims/web.mjs.map +1 -0
  214. package/src/_shims/MultipartBody.ts +9 -0
  215. package/src/_shims/README.md +46 -0
  216. package/src/_shims/auto/runtime-bun.ts +4 -0
  217. package/src/_shims/auto/runtime-node.ts +4 -0
  218. package/src/_shims/auto/runtime.ts +4 -0
  219. package/src/_shims/auto/types-node.ts +4 -0
  220. package/src/_shims/auto/types.d.ts +101 -0
  221. package/src/_shims/auto/types.js +3 -0
  222. package/src/_shims/auto/types.mjs +3 -0
  223. package/src/_shims/bun-runtime.ts +14 -0
  224. package/src/_shims/index.d.ts +81 -0
  225. package/src/_shims/index.js +13 -0
  226. package/src/_shims/index.mjs +7 -0
  227. package/src/_shims/manual-types.d.ts +12 -0
  228. package/src/_shims/manual-types.js +3 -0
  229. package/src/_shims/manual-types.mjs +3 -0
  230. package/src/_shims/node-runtime.ts +81 -0
  231. package/src/_shims/node-types.d.ts +42 -0
  232. package/src/_shims/node-types.js +3 -0
  233. package/src/_shims/node-types.mjs +3 -0
  234. package/src/_shims/registry.ts +67 -0
  235. package/src/_shims/web-runtime.ts +103 -0
  236. package/src/_shims/web-types.d.ts +83 -0
  237. package/src/_shims/web-types.js +3 -0
  238. package/src/_shims/web-types.mjs +3 -0
  239. package/src/core.ts +1208 -0
  240. package/src/error.ts +130 -0
  241. package/src/index.ts +294 -0
  242. package/src/lib/.keep +4 -0
  243. package/src/lib/polling.ts +115 -0
  244. package/src/pagination.ts +82 -0
  245. package/src/resource.ts +11 -0
  246. package/src/resources/extractions/content.ts +43 -0
  247. package/src/resources/extractions/extractions.ts +47 -0
  248. package/src/resources/extractions/index.ts +14 -0
  249. package/src/resources/extractions/jobs.ts +55 -0
  250. package/src/resources/extractions/schema.ts +111 -0
  251. package/src/resources/files.ts +181 -0
  252. package/src/resources/index.ts +32 -0
  253. package/src/resources/parsing/index.ts +12 -0
  254. package/src/resources/parsing/jobs.ts +438 -0
  255. package/src/resources/parsing/parsing.ts +32 -0
  256. package/src/resources/shared.ts +41 -0
  257. package/src/resources/top-level.ts +14 -0
  258. package/src/resources/vector-stores/files.ts +434 -0
  259. package/src/resources/vector-stores/index.ts +30 -0
  260. package/src/resources/vector-stores/vector-stores.ts +561 -0
  261. package/src/shims/node.ts +50 -0
  262. package/src/shims/web.ts +50 -0
  263. package/src/tsconfig.json +11 -0
  264. package/src/uploads.ts +255 -0
  265. package/src/version.ts +1 -0
  266. package/uploads.d.ts +75 -0
  267. package/uploads.d.ts.map +1 -0
  268. package/uploads.js +171 -0
  269. package/uploads.js.map +1 -0
  270. package/uploads.mjs +158 -0
  271. package/uploads.mjs.map +1 -0
  272. package/version.d.ts +2 -0
  273. package/version.d.ts.map +1 -0
  274. package/version.js +5 -0
  275. package/version.js.map +1 -0
  276. package/version.mjs +2 -0
  277. package/version.mjs.map +1 -0
@@ -0,0 +1,278 @@
1
+ import { APIResource } from "../../resource.js";
2
+ import * as Core from "../../core.js";
3
+ import { LimitOffset, type LimitOffsetParams } from "../../pagination.js";
4
+ import { Uploadable } from "../../uploads.js";
5
+ export declare class Jobs extends APIResource {
6
+ /**
7
+ * Start a parse job for the provided file.
8
+ *
9
+ * Args: params: The parameters for creating a parse job.
10
+ *
11
+ * Returns: The created parsing job.
12
+ */
13
+ create(body: JobCreateParams, options?: Core.RequestOptions): Core.APIPromise<ParsingJob>;
14
+ /**
15
+ * Get detailed information about a specific parse job.
16
+ *
17
+ * Args: job_id: The ID of the parse job.
18
+ *
19
+ * Returns: Detailed information about the parse job.
20
+ */
21
+ retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise<ParsingJob>;
22
+ /**
23
+ * List parsing jobs with pagination.
24
+ *
25
+ * Args: limit: The number of items to return. offset: The number of items to skip.
26
+ *
27
+ * Returns: List of parsing jobs with pagination.
28
+ */
29
+ list(query?: JobListParams, options?: Core.RequestOptions): Core.PagePromise<JobListResponsesLimitOffset, JobListResponse>;
30
+ list(options?: Core.RequestOptions): Core.PagePromise<JobListResponsesLimitOffset, JobListResponse>;
31
+ /**
32
+ * Delete a specific parse job.
33
+ *
34
+ * Args: job_id: The ID of the parse job to delete.
35
+ *
36
+ * Returns: The deleted parsing job.
37
+ */
38
+ delete(jobId: string, options?: Core.RequestOptions): Core.APIPromise<JobDeleteResponse>;
39
+ /**
40
+ * Cancel a specific parse job.
41
+ *
42
+ * Args: job_id: The ID of the parse job to cancel.
43
+ *
44
+ * Returns: The cancelled parsing job.
45
+ */
46
+ cancel(jobId: string, options?: Core.RequestOptions): Core.APIPromise<ParsingJob>;
47
+ /**
48
+ * Poll for a job's status until it reaches a terminal state.
49
+ *
50
+ * @param jobId - The ID of the job to poll
51
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
52
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
53
+ * @param options - Additional request options
54
+ * @returns The job object once it reaches a terminal state
55
+ */
56
+ poll(jobId: string, pollIntervalMs?: number, pollTimeoutMs?: number, options?: Core.RequestOptions): Promise<ParsingJob>;
57
+ /**
58
+ * Create a parsing job and wait for it to complete.
59
+ *
60
+ * @param body - Parameters for creating a parse job
61
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
62
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
63
+ * @param options - Additional request options
64
+ * @returns The job object once it reaches a terminal state
65
+ */
66
+ createAndPoll(body: JobCreateParams, pollIntervalMs?: number, pollTimeoutMs?: number, options?: Core.RequestOptions): Promise<ParsingJob>;
67
+ /**
68
+ * Upload a file to the files API and then create a parsing job for it.
69
+ * Note the job will be asynchronously processed.
70
+ *
71
+ * @param file - The file to upload
72
+ * @param body - Additional parameters for creating a parse job
73
+ * @param options - Additional request options
74
+ * @returns The created parsing job
75
+ */
76
+ upload(file: Uploadable, body?: Omit<JobCreateParams, 'file_id'>, options?: Core.RequestOptions): Promise<ParsingJob>;
77
+ /**
78
+ * Upload a file and create a parsing job, then poll until processing is complete.
79
+ *
80
+ * @param file - The file to upload
81
+ * @param body - Additional parameters for creating a parse job
82
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
83
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
84
+ * @param options - Additional request options
85
+ * @returns The job object once it reaches a terminal state
86
+ */
87
+ uploadAndPoll(file: Uploadable, body?: Omit<JobCreateParams, 'file_id'>, pollIntervalMs?: number, pollTimeoutMs?: number, options?: Core.RequestOptions): Promise<ParsingJob>;
88
+ }
89
+ export declare class JobListResponsesLimitOffset extends LimitOffset<JobListResponse> {
90
+ }
91
+ /**
92
+ * A job for parsing documents with its current state and result.
93
+ */
94
+ export interface ParsingJob {
95
+ /**
96
+ * The ID of the job
97
+ */
98
+ id: string;
99
+ /**
100
+ * The status of the job
101
+ */
102
+ status: 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
103
+ /**
104
+ * The error of the job
105
+ */
106
+ error?: unknown;
107
+ /**
108
+ * Result of document parsing operation.
109
+ */
110
+ result?: ParsingJob.Result | null;
111
+ /**
112
+ * The started time of the job
113
+ */
114
+ started_at?: string | null;
115
+ /**
116
+ * The finished time of the job
117
+ */
118
+ finished_at?: string | null;
119
+ /**
120
+ * The creation time of the job
121
+ */
122
+ created_at?: string;
123
+ /**
124
+ * The updated time of the job
125
+ */
126
+ updated_at?: string | null;
127
+ /**
128
+ * The type of the object
129
+ */
130
+ object?: 'parsing_job';
131
+ }
132
+ export declare namespace ParsingJob {
133
+ /**
134
+ * Result of document parsing operation.
135
+ */
136
+ interface Result {
137
+ /**
138
+ * The strategy used for chunking the document
139
+ */
140
+ chunking_strategy: 'page';
141
+ /**
142
+ * The format of the returned content
143
+ */
144
+ return_format: 'html' | 'markdown' | 'plain';
145
+ /**
146
+ * The types of elements extracted
147
+ */
148
+ element_types: Array<'caption' | 'footnote' | 'formula' | 'list-item' | 'page-footer' | 'page-header' | 'picture' | 'section-header' | 'table' | 'text' | 'title'>;
149
+ /**
150
+ * List of extracted chunks from the document
151
+ */
152
+ chunks: Array<Result.Chunk>;
153
+ }
154
+ namespace Result {
155
+ /**
156
+ * A chunk of text extracted from a document page.
157
+ */
158
+ interface Chunk {
159
+ /**
160
+ * The full content of the chunk
161
+ */
162
+ content: string;
163
+ /**
164
+ * The content to be used for embedding
165
+ */
166
+ content_to_embed: string;
167
+ /**
168
+ * List of elements contained in this chunk
169
+ */
170
+ elements: Array<Chunk.Element>;
171
+ }
172
+ namespace Chunk {
173
+ /**
174
+ * Represents an extracted element from a document with its content and metadata.
175
+ */
176
+ interface Element {
177
+ /**
178
+ * The type of the extracted element
179
+ */
180
+ type: 'caption' | 'footnote' | 'formula' | 'list-item' | 'page-footer' | 'page-header' | 'picture' | 'section-header' | 'table' | 'text' | 'title';
181
+ /**
182
+ * The confidence score of the extraction
183
+ */
184
+ confidence: number;
185
+ /**
186
+ * The bounding box coordinates [x1, y1, x2, y2]
187
+ */
188
+ bbox: Array<unknown>;
189
+ /**
190
+ * The page number where the element was found
191
+ */
192
+ page: number;
193
+ /**
194
+ * The full content of the extracted element
195
+ */
196
+ content: string;
197
+ /**
198
+ * A brief summary of the element's content
199
+ */
200
+ summary?: string | null;
201
+ }
202
+ }
203
+ }
204
+ }
205
+ /**
206
+ * A parsing job item for list responses, omitting result and error fields.
207
+ */
208
+ export interface JobListResponse {
209
+ /**
210
+ * The ID of the job
211
+ */
212
+ id: string;
213
+ /**
214
+ * The status of the job
215
+ */
216
+ status: 'pending' | 'in_progress' | 'cancelled' | 'completed' | 'failed';
217
+ /**
218
+ * The started time of the job
219
+ */
220
+ started_at?: string | null;
221
+ /**
222
+ * The finished time of the job
223
+ */
224
+ finished_at?: string | null;
225
+ /**
226
+ * The creation time of the job
227
+ */
228
+ created_at?: string;
229
+ /**
230
+ * The updated time of the job
231
+ */
232
+ updated_at?: string | null;
233
+ /**
234
+ * The type of the object
235
+ */
236
+ object?: 'parsing_job';
237
+ }
238
+ /**
239
+ * A deleted parsing job.
240
+ */
241
+ export interface JobDeleteResponse {
242
+ /**
243
+ * The ID of the deleted job
244
+ */
245
+ id: string;
246
+ /**
247
+ * Whether the job was deleted
248
+ */
249
+ deleted?: boolean;
250
+ /**
251
+ * The type of the object
252
+ */
253
+ object?: 'parsing_job';
254
+ }
255
+ export interface JobCreateParams {
256
+ /**
257
+ * The ID of the file to parse
258
+ */
259
+ file_id: string;
260
+ /**
261
+ * The elements to extract from the document
262
+ */
263
+ element_types?: Array<'caption' | 'footnote' | 'formula' | 'list-item' | 'page-footer' | 'page-header' | 'picture' | 'section-header' | 'table' | 'text' | 'title'> | null;
264
+ /**
265
+ * The strategy to use for chunking the content
266
+ */
267
+ chunking_strategy?: 'page';
268
+ /**
269
+ * The format of the returned content
270
+ */
271
+ return_format?: 'html' | 'markdown' | 'plain';
272
+ }
273
+ export interface JobListParams extends LimitOffsetParams {
274
+ }
275
+ export declare namespace Jobs {
276
+ export { type ParsingJob as ParsingJob, type JobListResponse as JobListResponse, type JobDeleteResponse as JobDeleteResponse, JobListResponsesLimitOffset as JobListResponsesLimitOffset, type JobCreateParams as JobCreateParams, type JobListParams as JobListParams, };
277
+ }
278
+ //# sourceMappingURL=jobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../src/resources/parsing/jobs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;IAIzF;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;IAInF;;;;;;OAMG;IACH,IAAI,CACF,KAAK,CAAC,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,WAAW,CAAC,2BAA2B,EAAE,eAAe,CAAC;IACjE,IAA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EhB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CACjB,SAAS,GACT,UAAU,GACV,SAAS,GACT,WAAW,GACX,aAAa,GACb,aAAa,GACb,SAAS,GACT,gBAAgB,GAChB,OAAO,GACP,MAAM,GACN,OAAO,CACV,GAAG,IAAI,CAAC;IAET;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;CAC/C;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;CAAG;AAI3D,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,2BAA2B,IAAI,2BAA2B,EAC1D,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,aAAa,IAAI,aAAa,GACpC,CAAC;CACH"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.JobListResponsesLimitOffset = exports.Jobs = void 0;
28
+ const resource_1 = require("../../resource.js");
29
+ const core_1 = require("../../core.js");
30
+ const pagination_1 = require("../../pagination.js");
31
+ const polling = __importStar(require("../../lib/polling.js"));
32
+ class Jobs extends resource_1.APIResource {
33
+ /**
34
+ * Start a parse job for the provided file.
35
+ *
36
+ * Args: params: The parameters for creating a parse job.
37
+ *
38
+ * Returns: The created parsing job.
39
+ */
40
+ create(body, options) {
41
+ return this._client.post('/v1/parsing/jobs', { body, ...options });
42
+ }
43
+ /**
44
+ * Get detailed information about a specific parse job.
45
+ *
46
+ * Args: job_id: The ID of the parse job.
47
+ *
48
+ * Returns: Detailed information about the parse job.
49
+ */
50
+ retrieve(jobId, options) {
51
+ return this._client.get(`/v1/parsing/jobs/${jobId}`, options);
52
+ }
53
+ list(query = {}, options) {
54
+ if ((0, core_1.isRequestOptions)(query)) {
55
+ return this.list({}, query);
56
+ }
57
+ return this._client.getAPIList('/v1/parsing/jobs', JobListResponsesLimitOffset, { query, ...options });
58
+ }
59
+ /**
60
+ * Delete a specific parse job.
61
+ *
62
+ * Args: job_id: The ID of the parse job to delete.
63
+ *
64
+ * Returns: The deleted parsing job.
65
+ */
66
+ delete(jobId, options) {
67
+ return this._client.delete(`/v1/parsing/jobs/${jobId}`, options);
68
+ }
69
+ /**
70
+ * Cancel a specific parse job.
71
+ *
72
+ * Args: job_id: The ID of the parse job to cancel.
73
+ *
74
+ * Returns: The cancelled parsing job.
75
+ */
76
+ cancel(jobId, options) {
77
+ return this._client.patch(`/v1/parsing/jobs/${jobId}`, options);
78
+ }
79
+ /**
80
+ * Poll for a job's status until it reaches a terminal state.
81
+ *
82
+ * @param jobId - The ID of the job to poll
83
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
84
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
85
+ * @param options - Additional request options
86
+ * @returns The job object once it reaches a terminal state
87
+ */
88
+ async poll(jobId, pollIntervalMs, pollTimeoutMs, options) {
89
+ const pollingIntervalMs = pollIntervalMs || 500;
90
+ const pollingTimeoutMs = pollTimeoutMs;
91
+ return polling.poll({
92
+ fn: () => this.retrieve(jobId, options),
93
+ condition: (result) => result.status === 'completed' || result.status === 'failed' || result.status === 'cancelled',
94
+ intervalSeconds: pollingIntervalMs / 1000,
95
+ ...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
96
+ });
97
+ }
98
+ /**
99
+ * Create a parsing job and wait for it to complete.
100
+ *
101
+ * @param body - Parameters for creating a parse job
102
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
103
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
104
+ * @param options - Additional request options
105
+ * @returns The job object once it reaches a terminal state
106
+ */
107
+ async createAndPoll(body, pollIntervalMs, pollTimeoutMs, options) {
108
+ const job = await this.create(body, options);
109
+ return this.poll(job.id, pollIntervalMs, pollTimeoutMs, options);
110
+ }
111
+ /**
112
+ * Upload a file to the files API and then create a parsing job for it.
113
+ * Note the job will be asynchronously processed.
114
+ *
115
+ * @param file - The file to upload
116
+ * @param body - Additional parameters for creating a parse job
117
+ * @param options - Additional request options
118
+ * @returns The created parsing job
119
+ */
120
+ async upload(file, body, options) {
121
+ const fileUploadResponse = await this._client.files.create({ file }, options);
122
+ return this.create({
123
+ file_id: fileUploadResponse.id,
124
+ ...body,
125
+ }, options);
126
+ }
127
+ /**
128
+ * Upload a file and create a parsing job, then poll until processing is complete.
129
+ *
130
+ * @param file - The file to upload
131
+ * @param body - Additional parameters for creating a parse job
132
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
133
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
134
+ * @param options - Additional request options
135
+ * @returns The job object once it reaches a terminal state
136
+ */
137
+ async uploadAndPoll(file, body, pollIntervalMs, pollTimeoutMs, options) {
138
+ const job = await this.upload(file, body, options);
139
+ return this.poll(job.id, pollIntervalMs, pollTimeoutMs, options);
140
+ }
141
+ }
142
+ exports.Jobs = Jobs;
143
+ class JobListResponsesLimitOffset extends pagination_1.LimitOffset {
144
+ }
145
+ exports.JobListResponsesLimitOffset = JobListResponsesLimitOffset;
146
+ Jobs.JobListResponsesLimitOffset = JobListResponsesLimitOffset;
147
+ //# sourceMappingURL=jobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../src/resources/parsing/jobs.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAE9C,oDAAuE;AACvE,8DAA6C;AAG7C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;OAMG;IACH,MAAM,CAAC,IAAqB,EAAE,OAA6B;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAa,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAcD,IAAI,CACF,QAA6C,EAAE,EAC/C,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB,EAAE,2BAA2B,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzG,CAAC;IAED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G;IACH,KAAK,CAAC,MAAM,CACV,IAAgB,EAChB,IAAuC,EACvC,OAA6B;QAE7B,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QAE9E,OAAO,IAAI,CAAC,MAAM,CAChB;YACE,OAAO,EAAE,kBAAkB,CAAC,EAAE;YAC9B,GAAG,IAAI;SACR,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,aAAa,CACjB,IAAgB,EAChB,IAAuC,EACvC,cAAuB,EACvB,aAAsB,EACtB,OAA6B;QAE7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;CACF;AA9JD,oBA8JC;AAED,MAAa,2BAA4B,SAAQ,wBAA4B;CAAG;AAAhF,kEAAgF;AAiQhF,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAC"}
@@ -0,0 +1,119 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../resource.mjs";
3
+ import { isRequestOptions } from "../../core.mjs";
4
+ import { LimitOffset } from "../../pagination.mjs";
5
+ import * as polling from "../../lib/polling.mjs";
6
+ export class Jobs extends APIResource {
7
+ /**
8
+ * Start a parse job for the provided file.
9
+ *
10
+ * Args: params: The parameters for creating a parse job.
11
+ *
12
+ * Returns: The created parsing job.
13
+ */
14
+ create(body, options) {
15
+ return this._client.post('/v1/parsing/jobs', { body, ...options });
16
+ }
17
+ /**
18
+ * Get detailed information about a specific parse job.
19
+ *
20
+ * Args: job_id: The ID of the parse job.
21
+ *
22
+ * Returns: Detailed information about the parse job.
23
+ */
24
+ retrieve(jobId, options) {
25
+ return this._client.get(`/v1/parsing/jobs/${jobId}`, options);
26
+ }
27
+ list(query = {}, options) {
28
+ if (isRequestOptions(query)) {
29
+ return this.list({}, query);
30
+ }
31
+ return this._client.getAPIList('/v1/parsing/jobs', JobListResponsesLimitOffset, { query, ...options });
32
+ }
33
+ /**
34
+ * Delete a specific parse job.
35
+ *
36
+ * Args: job_id: The ID of the parse job to delete.
37
+ *
38
+ * Returns: The deleted parsing job.
39
+ */
40
+ delete(jobId, options) {
41
+ return this._client.delete(`/v1/parsing/jobs/${jobId}`, options);
42
+ }
43
+ /**
44
+ * Cancel a specific parse job.
45
+ *
46
+ * Args: job_id: The ID of the parse job to cancel.
47
+ *
48
+ * Returns: The cancelled parsing job.
49
+ */
50
+ cancel(jobId, options) {
51
+ return this._client.patch(`/v1/parsing/jobs/${jobId}`, options);
52
+ }
53
+ /**
54
+ * Poll for a job's status until it reaches a terminal state.
55
+ *
56
+ * @param jobId - The ID of the job to poll
57
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
58
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
59
+ * @param options - Additional request options
60
+ * @returns The job object once it reaches a terminal state
61
+ */
62
+ async poll(jobId, pollIntervalMs, pollTimeoutMs, options) {
63
+ const pollingIntervalMs = pollIntervalMs || 500;
64
+ const pollingTimeoutMs = pollTimeoutMs;
65
+ return polling.poll({
66
+ fn: () => this.retrieve(jobId, options),
67
+ condition: (result) => result.status === 'completed' || result.status === 'failed' || result.status === 'cancelled',
68
+ intervalSeconds: pollingIntervalMs / 1000,
69
+ ...(pollingTimeoutMs && { timeoutSeconds: pollingTimeoutMs / 1000 }),
70
+ });
71
+ }
72
+ /**
73
+ * Create a parsing job and wait for it to complete.
74
+ *
75
+ * @param body - Parameters for creating a parse job
76
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
77
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
78
+ * @param options - Additional request options
79
+ * @returns The job object once it reaches a terminal state
80
+ */
81
+ async createAndPoll(body, pollIntervalMs, pollTimeoutMs, options) {
82
+ const job = await this.create(body, options);
83
+ return this.poll(job.id, pollIntervalMs, pollTimeoutMs, options);
84
+ }
85
+ /**
86
+ * Upload a file to the files API and then create a parsing job for it.
87
+ * Note the job will be asynchronously processed.
88
+ *
89
+ * @param file - The file to upload
90
+ * @param body - Additional parameters for creating a parse job
91
+ * @param options - Additional request options
92
+ * @returns The created parsing job
93
+ */
94
+ async upload(file, body, options) {
95
+ const fileUploadResponse = await this._client.files.create({ file }, options);
96
+ return this.create({
97
+ file_id: fileUploadResponse.id,
98
+ ...body,
99
+ }, options);
100
+ }
101
+ /**
102
+ * Upload a file and create a parsing job, then poll until processing is complete.
103
+ *
104
+ * @param file - The file to upload
105
+ * @param body - Additional parameters for creating a parse job
106
+ * @param pollIntervalMs - The interval between polls in milliseconds (default: 500)
107
+ * @param pollTimeoutMs - The maximum time to poll for in milliseconds (default: no timeout)
108
+ * @param options - Additional request options
109
+ * @returns The job object once it reaches a terminal state
110
+ */
111
+ async uploadAndPoll(file, body, pollIntervalMs, pollTimeoutMs, options) {
112
+ const job = await this.upload(file, body, options);
113
+ return this.poll(job.id, pollIntervalMs, pollTimeoutMs, options);
114
+ }
115
+ }
116
+ export class JobListResponsesLimitOffset extends LimitOffset {
117
+ }
118
+ Jobs.JobListResponsesLimitOffset = JobListResponsesLimitOffset;
119
+ //# sourceMappingURL=jobs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobs.mjs","sourceRoot":"","sources":["../../src/resources/parsing/jobs.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,EAAE,WAAW,EAA0B;OACvC,KAAK,OAAO;AAGnB,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;OAMG;IACH,MAAM,CAAC,IAAqB,EAAE,OAA6B;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AED,MAAM,OAAO,2BAA4B,SAAQ,WAA4B;CAAG;AAiQhF,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { APIResource } from "../../resource.js";
2
+ import * as JobsAPI from "./jobs.js";
3
+ import { JobCreateParams, JobDeleteResponse, JobListParams, JobListResponse, JobListResponsesLimitOffset, Jobs, ParsingJob } from "./jobs.js";
4
+ export declare class Parsing extends APIResource {
5
+ jobs: JobsAPI.Jobs;
6
+ }
7
+ export declare namespace Parsing {
8
+ export { Jobs as Jobs, type ParsingJob as ParsingJob, type JobListResponse as JobListResponse, type JobDeleteResponse as JobDeleteResponse, JobListResponsesLimitOffset as JobListResponsesLimitOffset, type JobCreateParams as JobCreateParams, type JobListParams as JobListParams, };
9
+ }
10
+ //# sourceMappingURL=parsing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsing.d.ts","sourceRoot":"","sources":["../../src/resources/parsing/parsing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,QAAQ,CAAC;AAClC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B,IAAI,EACJ,UAAU,EACX,MAAM,QAAQ,CAAC;AAEhB,qBAAa,OAAQ,SAAQ,WAAW;IACtC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAkC;CACrD;AAKD,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,IAAI,IAAI,IAAI,EACZ,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,2BAA2B,IAAI,2BAA2B,EAC1D,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,aAAa,IAAI,aAAa,GACpC,CAAC;CACH"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.Parsing = void 0;
28
+ const resource_1 = require("../../resource.js");
29
+ const JobsAPI = __importStar(require("./jobs.js"));
30
+ const jobs_1 = require("./jobs.js");
31
+ class Parsing extends resource_1.APIResource {
32
+ constructor() {
33
+ super(...arguments);
34
+ this.jobs = new JobsAPI.Jobs(this._client);
35
+ }
36
+ }
37
+ exports.Parsing = Parsing;
38
+ Parsing.Jobs = jobs_1.Jobs;
39
+ Parsing.JobListResponsesLimitOffset = jobs_1.JobListResponsesLimitOffset;
40
+ //# sourceMappingURL=parsing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsing.js","sourceRoot":"","sources":["../../src/resources/parsing/parsing.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,mDAAkC;AAClC,oCAQgB;AAEhB,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AAFD,0BAEC;AAED,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC;AACpB,OAAO,CAAC,2BAA2B,GAAG,kCAA2B,CAAC"}
@@ -0,0 +1,13 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../resource.mjs";
3
+ import * as JobsAPI from "./jobs.mjs";
4
+ import { JobListResponsesLimitOffset, Jobs, } from "./jobs.mjs";
5
+ export class Parsing extends APIResource {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.jobs = new JobsAPI.Jobs(this._client);
9
+ }
10
+ }
11
+ Parsing.Jobs = Jobs;
12
+ Parsing.JobListResponsesLimitOffset = JobListResponsesLimitOffset;
13
+ //# sourceMappingURL=parsing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsing.mjs","sourceRoot":"","sources":["../../src/resources/parsing/parsing.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAKL,2BAA2B,EAC3B,IAAI,GAEL;AAED,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAAxC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AAED,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpB,OAAO,CAAC,2BAA2B,GAAG,2BAA2B,CAAC"}