graphor 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +113 -354
  3. package/api-promise.d.mts +1 -0
  4. package/api-promise.d.mts.map +1 -1
  5. package/api-promise.d.ts +1 -0
  6. package/api-promise.d.ts.map +1 -1
  7. package/api-promise.mjs +1 -0
  8. package/api-promise.mjs.map +1 -1
  9. package/client.d.mts +2 -2
  10. package/client.d.mts.map +1 -1
  11. package/client.d.ts +2 -2
  12. package/client.d.ts.map +1 -1
  13. package/client.js +11 -0
  14. package/client.js.map +1 -1
  15. package/client.mjs +11 -0
  16. package/client.mjs.map +1 -1
  17. package/core/api-promise.d.mts.map +1 -1
  18. package/core/api-promise.d.ts.map +1 -1
  19. package/core/api-promise.mjs.map +1 -1
  20. package/core/error.mjs.map +1 -1
  21. package/core/resource.d.mts.map +1 -1
  22. package/core/resource.d.ts.map +1 -1
  23. package/core/uploads.d.mts.map +1 -1
  24. package/core/uploads.d.ts.map +1 -1
  25. package/core/uploads.mjs.map +1 -1
  26. package/error.d.mts +1 -0
  27. package/error.d.mts.map +1 -1
  28. package/error.d.ts +1 -0
  29. package/error.d.ts.map +1 -1
  30. package/error.mjs +1 -0
  31. package/error.mjs.map +1 -1
  32. package/index.d.mts.map +1 -1
  33. package/index.d.ts.map +1 -1
  34. package/index.mjs.map +1 -1
  35. package/internal/detect-platform.mjs.map +1 -1
  36. package/internal/headers.mjs.map +1 -1
  37. package/internal/parse.d.mts.map +1 -1
  38. package/internal/parse.d.ts.map +1 -1
  39. package/internal/parse.mjs.map +1 -1
  40. package/internal/qs/formats.d.mts.map +1 -1
  41. package/internal/qs/formats.d.ts.map +1 -1
  42. package/internal/qs/index.d.mts +2 -2
  43. package/internal/qs/index.d.mts.map +1 -1
  44. package/internal/qs/index.d.ts +2 -2
  45. package/internal/qs/index.d.ts.map +1 -1
  46. package/internal/qs/index.mjs.map +1 -1
  47. package/internal/qs/stringify.d.mts.map +1 -1
  48. package/internal/qs/stringify.d.ts.map +1 -1
  49. package/internal/qs/stringify.mjs.map +1 -1
  50. package/internal/qs/utils.d.mts.map +1 -1
  51. package/internal/qs/utils.d.ts.map +1 -1
  52. package/internal/qs/utils.mjs.map +1 -1
  53. package/internal/request-options.d.mts.map +1 -1
  54. package/internal/request-options.d.ts.map +1 -1
  55. package/internal/shims.d.mts +6 -0
  56. package/internal/shims.d.mts.map +1 -1
  57. package/internal/shims.d.ts +6 -0
  58. package/internal/shims.d.ts.map +1 -1
  59. package/internal/to-file.d.mts.map +1 -1
  60. package/internal/to-file.d.ts.map +1 -1
  61. package/internal/to-file.mjs.map +1 -1
  62. package/internal/types.d.mts +10 -10
  63. package/internal/types.d.mts.map +1 -1
  64. package/internal/types.d.ts +10 -10
  65. package/internal/types.d.ts.map +1 -1
  66. package/internal/uploads.d.mts.map +1 -1
  67. package/internal/uploads.d.ts.map +1 -1
  68. package/internal/uploads.mjs.map +1 -1
  69. package/internal/utils/base64.mjs.map +1 -1
  70. package/internal/utils/env.js +2 -2
  71. package/internal/utils/env.js.map +1 -1
  72. package/internal/utils/env.mjs +2 -2
  73. package/internal/utils/env.mjs.map +1 -1
  74. package/internal/utils/log.d.mts.map +1 -1
  75. package/internal/utils/log.d.ts.map +1 -1
  76. package/internal/utils/log.js +2 -0
  77. package/internal/utils/log.js.map +1 -1
  78. package/internal/utils/log.mjs +2 -0
  79. package/internal/utils/log.mjs.map +1 -1
  80. package/internal/utils/path.mjs.map +1 -1
  81. package/internal/utils/query.mjs.map +1 -1
  82. package/internal/utils/values.mjs.map +1 -1
  83. package/internal/utils.d.mts.map +1 -1
  84. package/internal/utils.d.ts.map +1 -1
  85. package/internal/utils.mjs.map +1 -1
  86. package/package.json +1 -1
  87. package/resource.d.mts +1 -0
  88. package/resource.d.mts.map +1 -1
  89. package/resource.d.ts +1 -0
  90. package/resource.d.ts.map +1 -1
  91. package/resource.mjs +1 -0
  92. package/resource.mjs.map +1 -1
  93. package/resources/index.d.mts +1 -1
  94. package/resources/index.d.mts.map +1 -1
  95. package/resources/index.d.ts +1 -1
  96. package/resources/index.d.ts.map +1 -1
  97. package/resources/index.js.map +1 -1
  98. package/resources/index.mjs.map +1 -1
  99. package/resources/sources.d.mts +176 -27
  100. package/resources/sources.d.mts.map +1 -1
  101. package/resources/sources.d.ts +176 -27
  102. package/resources/sources.d.ts.map +1 -1
  103. package/resources/sources.js +54 -12
  104. package/resources/sources.js.map +1 -1
  105. package/resources/sources.mjs +54 -12
  106. package/resources/sources.mjs.map +1 -1
  107. package/resources.d.mts.map +1 -1
  108. package/resources.d.ts.map +1 -1
  109. package/resources.mjs.map +1 -1
  110. package/src/client.ts +16 -0
  111. package/src/internal/types.ts +6 -8
  112. package/src/internal/utils/env.ts +2 -2
  113. package/src/internal/utils/log.ts +2 -0
  114. package/src/resources/index.ts +2 -0
  115. package/src/resources/sources.ts +205 -26
  116. package/src/version.ts +1 -1
  117. package/uploads.d.mts +1 -0
  118. package/uploads.d.mts.map +1 -1
  119. package/uploads.d.ts +1 -0
  120. package/uploads.d.ts.map +1 -1
  121. package/uploads.mjs +1 -0
  122. package/uploads.mjs.map +1 -1
  123. package/version.d.mts +1 -1
  124. package/version.d.ts +1 -1
  125. package/version.js +1 -1
  126. package/version.mjs +1 -1
@@ -115,7 +115,7 @@ export class Sources extends APIResource {
115
115
  * @example
116
116
  * ```ts
117
117
  * const response = await client.sources.ask({
118
- * question: 'question',
118
+ * question: "What was the company's revenue in 2025?",
119
119
  * });
120
120
  * ```
121
121
  */
@@ -158,8 +158,9 @@ export class Sources extends APIResource {
158
158
  * @example
159
159
  * ```ts
160
160
  * const response = await client.sources.extract({
161
- * output_schema: { foo: 'bar' },
162
- * user_instruction: 'user_instruction',
161
+ * output_schema: { properties: 'bar', type: 'bar' },
162
+ * user_instruction:
163
+ * 'Extract all invoice line items including product name, quantity, unit price, and total.',
163
164
  * });
164
165
  * ```
165
166
  */
@@ -275,6 +276,47 @@ export class Sources extends APIResource {
275
276
  getElements(query, options) {
276
277
  return this._client.get('/sources/get-elements', { query, ...options });
277
278
  }
279
+ /**
280
+ * Render a single page of a source file as a base64-encoded PNG screenshot.
281
+ *
282
+ * Use this endpoint to lazily fetch the visual preview of a citation returned by
283
+ * `/ask-sources` without paying the payload cost of inlining base64 in the answer.
284
+ * Supports PDFs, image files (`page_number` must be 1), and Office documents
285
+ * (doc/docx/ppt/pptx/odt — rendered from the converted PDF).
286
+ *
287
+ * **Path parameters:**
288
+ *
289
+ * - **file_id** (str): UUID of the source file.
290
+ * - **page_number** (int): 1-based page number.
291
+ *
292
+ * **Query parameters:**
293
+ *
294
+ * - **max_width** (int, optional, default `900`): Pixel width cap. Clamped to the
295
+ * 300-1600 range.
296
+ *
297
+ * **Returns** a `PublicPageScreenshotResponse` containing:
298
+ *
299
+ * - `file_id`, `file_name`, `page_number` — identifying metadata.
300
+ * - `mime_type` — always `"image/png"`.
301
+ * - `width`, `height` — rendered image dimensions in pixels.
302
+ * - `image_base64` — the base64-encoded PNG bytes.
303
+ *
304
+ * **Error responses:**
305
+ *
306
+ * - `404` — File not found, unsupported file type, or invalid page number.
307
+ * - `500` — Unexpected internal error while rendering.
308
+ *
309
+ * @example
310
+ * ```ts
311
+ * const response = await client.sources.getPageScreenshot(0, {
312
+ * file_id: 'file_id',
313
+ * });
314
+ * ```
315
+ */
316
+ getPageScreenshot(pageNumber, params, options) {
317
+ const { file_id, ...query } = params;
318
+ return this._client.get(path `/sources/${file_id}/pages/${pageNumber}/screenshot`, { query, ...options });
319
+ }
278
320
  /**
279
321
  * Upload a local file and schedule ingestion in the background.
280
322
  *
@@ -288,7 +330,7 @@ export class Sources extends APIResource {
288
330
  * `Content-Length` and have a supported extension (pdf, doc, docx, csv, txt, md,
289
331
  * etc.).
290
332
  * - **method** (`form`, optional): Partitioning strategy. One of: `fast`,
291
- * `balanced`, `accurate`, `vlm`, `agentic`. Default when omitted.
333
+ * `balanced`, `accurate`, `vlm`, `agentic`, `auto`. Default when omitted.
292
334
  *
293
335
  * **Returns** `AsyncIngestResponse` with `build_id`. Use it to check processing
294
336
  * status.
@@ -319,7 +361,7 @@ export class Sources extends APIResource {
319
361
  * @example
320
362
  * ```ts
321
363
  * const response = await client.sources.ingestGitHub({
322
- * url: 'url',
364
+ * url: 'https://github.com/langchain-ai/langchain',
323
365
  * });
324
366
  * ```
325
367
  */
@@ -346,8 +388,8 @@ export class Sources extends APIResource {
346
388
  * also follow and ingest links found on the page. Ignored when the URL resolves
347
389
  * to a file.
348
390
  * - **method** (str, optional): The partitioning strategy to use. One of: `fast`,
349
- * `balanced`, `accurate`, `vlm`, `agentic`. When omitted the system default is
350
- * applied.
391
+ * `balanced`, `accurate`, `vlm`, `agentic`, `auto`. When omitted the system
392
+ * default is applied.
351
393
  *
352
394
  * **Returns** a `PublicSourceResponse` with `status: "processing"` immediately.
353
395
  * Poll the source status endpoint using the returned `file_id` to track
@@ -361,7 +403,7 @@ export class Sources extends APIResource {
361
403
  * @example
362
404
  * ```ts
363
405
  * const response = await client.sources.ingestURL({
364
- * url: 'url',
406
+ * url: 'https://example.com/blog/ai-trends-2025',
365
407
  * });
366
408
  * ```
367
409
  */
@@ -385,7 +427,7 @@ export class Sources extends APIResource {
385
427
  * @example
386
428
  * ```ts
387
429
  * const response = await client.sources.ingestYoutube({
388
- * url: 'url',
430
+ * url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
389
431
  * });
390
432
  * ```
391
433
  */
@@ -403,14 +445,14 @@ export class Sources extends APIResource {
403
445
  *
404
446
  * - **file_id** (str, required): Unique identifier of the source to re-process.
405
447
  * - **method** (str, default `"fast"`): Partitioning strategy. One of: `fast`,
406
- * `balanced`, `accurate`, `vlm`, `agentic`.
448
+ * `balanced`, `accurate`, `vlm`, `agentic`, `auto`.
407
449
  *
408
450
  * **Returns** `AsyncIngestResponse` with `build_id`.
409
451
  *
410
452
  * @example
411
453
  * ```ts
412
454
  * const response = await client.sources.reprocess({
413
- * file_id: 'file_id',
455
+ * file_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
414
456
  * });
415
457
  * ```
416
458
  */
@@ -449,7 +491,7 @@ export class Sources extends APIResource {
449
491
  * @example
450
492
  * ```ts
451
493
  * const response = await client.sources.retrieveChunks({
452
- * query: 'query',
494
+ * query: "What was the company's net income in 2025?",
453
495
  * });
454
496
  * ```
455
497
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sources.mjs","sourceRoot":"","sources":["../src/resources/sources.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,IAAI,CACF,QAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,GAAG,CAAC,IAAqB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,OAAO,CAAC,IAAyB,EAAE,OAAwB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;;;;;;;;;;;;;;;;;OAmCG;IACH,cAAc,CACZ,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"resources.d.mts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"resources.d.mts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,qCAAkC"}
package/resources.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"resources.mjs","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"AAAA,sCAAkC"}
package/src/client.ts CHANGED
@@ -31,6 +31,8 @@ import {
31
31
  SourceGetBuildStatusResponse,
32
32
  SourceGetElementsParams,
33
33
  SourceGetElementsResponse,
34
+ SourceGetPageScreenshotParams,
35
+ SourceGetPageScreenshotResponse,
34
36
  SourceIngestFileParams,
35
37
  SourceIngestFileResponse,
36
38
  SourceIngestGitHubParams,
@@ -199,6 +201,18 @@ export class Graphor {
199
201
  this.#undiciDispatcher = null;
200
202
  this.#encoder = Opts.FallbackEncoder;
201
203
 
204
+ const customHeadersEnv = readEnv('GRAPHOR_CUSTOM_HEADERS');
205
+ if (customHeadersEnv) {
206
+ const parsed: Record<string, string> = {};
207
+ for (const line of customHeadersEnv.split('\n')) {
208
+ const colon = line.indexOf(':');
209
+ if (colon >= 0) {
210
+ parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
211
+ }
212
+ }
213
+ options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
214
+ }
215
+
202
216
  this._options = options;
203
217
 
204
218
  this.apiKey = apiKey;
@@ -786,6 +800,7 @@ export declare namespace Graphor {
786
800
  type SourceExtractResponse as SourceExtractResponse,
787
801
  type SourceGetBuildStatusResponse as SourceGetBuildStatusResponse,
788
802
  type SourceGetElementsResponse as SourceGetElementsResponse,
803
+ type SourceGetPageScreenshotResponse as SourceGetPageScreenshotResponse,
789
804
  type SourceIngestFileResponse as SourceIngestFileResponse,
790
805
  type SourceIngestGitHubResponse as SourceIngestGitHubResponse,
791
806
  type SourceIngestURLResponse as SourceIngestURLResponse,
@@ -798,6 +813,7 @@ export declare namespace Graphor {
798
813
  type SourceExtractParams as SourceExtractParams,
799
814
  type SourceGetBuildStatusParams as SourceGetBuildStatusParams,
800
815
  type SourceGetElementsParams as SourceGetElementsParams,
816
+ type SourceGetPageScreenshotParams as SourceGetPageScreenshotParams,
801
817
  type SourceIngestFileParams as SourceIngestFileParams,
802
818
  type SourceIngestGitHubParams as SourceIngestGitHubParams,
803
819
  type SourceIngestURLParams as SourceIngestURLParams,
@@ -40,7 +40,6 @@ type OverloadedParameters<T> =
40
40
  : T extends (...args: infer A) => unknown ? A
41
41
  : never;
42
42
 
43
- /* eslint-disable */
44
43
  /**
45
44
  * These imports attempt to get types from a parent package's dependencies.
46
45
  * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
@@ -63,19 +62,18 @@ type OverloadedParameters<T> =
63
62
  *
64
63
  * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
65
64
  */
66
- /** @ts-ignore For users with \@types/node */
65
+ /** @ts-ignore For users with \@types/node */ /* prettier-ignore */
67
66
  type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
68
- /** @ts-ignore For users with undici */
67
+ /** @ts-ignore For users with undici */ /* prettier-ignore */
69
68
  type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
70
- /** @ts-ignore For users with \@types/bun */
69
+ /** @ts-ignore For users with \@types/bun */ /* prettier-ignore */
71
70
  type BunRequestInit = globalThis.FetchRequestInit;
72
- /** @ts-ignore For users with node-fetch@2 */
71
+ /** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */
73
72
  type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
74
- /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
73
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */
75
74
  type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
76
- /** @ts-ignore For users who use Deno */
75
+ /** @ts-ignore For users who use Deno */ /* prettier-ignore */
77
76
  type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
78
- /* eslint-enable */
79
77
 
80
78
  type RequestInits =
81
79
  | NotAny<UndiciTypesRequestInit>
@@ -9,10 +9,10 @@
9
9
  */
10
10
  export const readEnv = (env: string): string | undefined => {
11
11
  if (typeof (globalThis as any).process !== 'undefined') {
12
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
12
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
13
13
  }
14
14
  if (typeof (globalThis as any).Deno !== 'undefined') {
15
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
15
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
16
16
  }
17
17
  return undefined;
18
18
  };
@@ -107,6 +107,8 @@ export const formatRequestDetails = (details: {
107
107
  name,
108
108
  (
109
109
  name.toLowerCase() === 'authorization' ||
110
+ name.toLowerCase() === 'api-key' ||
111
+ name.toLowerCase() === 'x-api-key' ||
110
112
  name.toLowerCase() === 'cookie' ||
111
113
  name.toLowerCase() === 'set-cookie'
112
114
  ) ?
@@ -11,6 +11,7 @@ export {
11
11
  type SourceExtractResponse,
12
12
  type SourceGetBuildStatusResponse,
13
13
  type SourceGetElementsResponse,
14
+ type SourceGetPageScreenshotResponse,
14
15
  type SourceIngestFileResponse,
15
16
  type SourceIngestGitHubResponse,
16
17
  type SourceIngestURLResponse,
@@ -23,6 +24,7 @@ export {
23
24
  type SourceExtractParams,
24
25
  type SourceGetBuildStatusParams,
25
26
  type SourceGetElementsParams,
27
+ type SourceGetPageScreenshotParams,
26
28
  type SourceIngestFileParams,
27
29
  type SourceIngestGitHubParams,
28
30
  type SourceIngestURLParams,