chromiumly 3.6.0 → 3.6.2

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/README.md CHANGED
@@ -305,6 +305,7 @@ type ScreenshotOptions = {
305
305
  failOnConsoleExceptions?: boolean; // Return a 409 Conflict response if there are exceptions in the Chromium console (default false)
306
306
  skipNetworkIdleEvent?: boolean; // Do not wait for Chromium network to be idle (default false)
307
307
  optimizeForSpeed?: boolean; // Define whether to optimize image encoding for speed, not for resulting size.
308
+ cookies?: Cookie[]; // Cookies to be written.
308
309
  };
309
310
  ```
310
311
 
@@ -1,7 +1,7 @@
1
1
  import { Metadata, PathLikeOrReadStream, PdfFormat } from '../../common';
2
- import { Cookie, PageProperties } from '../interfaces/converter.types';
2
+ import { PageProperties } from '../interfaces/converter.types';
3
3
  import { Converter } from './converter';
4
- import { EmulatedMediaType } from '../interfaces/common.types';
4
+ import { EmulatedMediaType, Cookie } from '../interfaces/common.types';
5
5
  /**
6
6
  * Class representing an HTML converter that extends the base Converter class.
7
7
  * This class is used to convert HTML content to PDF using Gotenberg service.
@@ -1,7 +1,7 @@
1
1
  import { PdfFormat, PathLikeOrReadStream, Metadata } from '../../common';
2
- import { Cookie, PageProperties } from '../interfaces/converter.types';
2
+ import { PageProperties } from '../interfaces/converter.types';
3
3
  import { Converter } from './converter';
4
- import { EmulatedMediaType } from '../interfaces/common.types';
4
+ import { EmulatedMediaType, Cookie } from '../interfaces/common.types';
5
5
  /**
6
6
  * Class representing a Markdown converter that extends the base Converter class.
7
7
  * This class is used to convert HTML with markdown content to PDF using Gotenberg service.
@@ -1,7 +1,7 @@
1
1
  import { PdfFormat, PathLikeOrReadStream, Metadata } from '../../common';
2
- import { Cookie, PageProperties } from '../interfaces/converter.types';
2
+ import { PageProperties } from '../interfaces/converter.types';
3
3
  import { Converter } from './converter';
4
- import { EmulatedMediaType } from '../interfaces/common.types';
4
+ import { EmulatedMediaType, Cookie } from '../interfaces/common.types';
5
5
  /**
6
6
  * Class representing a URL converter that extends the base Converter class.
7
7
  * This class is used to convert content from a URL to PDF using Gotenberg service.
@@ -1,5 +1,14 @@
1
1
  import { PathLikeOrReadStream } from '../../common';
2
2
  export type EmulatedMediaType = 'screen' | 'print';
3
+ export type Cookie = {
4
+ name: string;
5
+ value: string;
6
+ domain: string;
7
+ path?: string;
8
+ secure?: boolean;
9
+ httpOnly?: boolean;
10
+ sameSite?: 'Strict' | 'Lax' | 'None';
11
+ };
3
12
  export type ChromiumOptions = {
4
13
  header?: PathLikeOrReadStream;
5
14
  footer?: PathLikeOrReadStream;
@@ -10,4 +19,5 @@ export type ChromiumOptions = {
10
19
  failOnHttpStatusCodes?: number[];
11
20
  failOnConsoleExceptions?: boolean;
12
21
  skipNetworkIdleEvent?: boolean;
22
+ cookies?: Cookie[];
13
23
  };
@@ -1,5 +1,5 @@
1
1
  import { Metadata, PdfFormat } from '../../common';
2
- import { ChromiumOptions } from './common.types';
2
+ import { ChromiumOptions, Cookie } from './common.types';
3
3
  type PageSize = {
4
4
  width: number;
5
5
  height: number;
@@ -24,15 +24,6 @@ export type PageProperties = {
24
24
  to: number;
25
25
  };
26
26
  };
27
- export type Cookie = {
28
- name: string;
29
- value: string;
30
- domain: string;
31
- path?: string;
32
- secure?: boolean;
33
- httpOnly?: boolean;
34
- sameSite?: 'Strict' | 'Lax' | 'None';
35
- };
36
27
  export type ConversionOptions = ChromiumOptions & {
37
28
  properties?: PageProperties;
38
29
  pdfFormat?: PdfFormat;
@@ -7,7 +7,7 @@ export type ImageProperties = {
7
7
  height?: number;
8
8
  clip?: boolean;
9
9
  };
10
- export type ScreenshotOptions = ChromiumOptions & {
10
+ export type ScreenshotOptions = Omit<ChromiumOptions, 'assets' | 'header' | 'footer'> & {
11
11
  properties?: ImageProperties;
12
12
  optimizeForSpeed?: boolean;
13
13
  };
@@ -19,8 +19,6 @@ export declare class HtmlScreenshot extends Screenshot {
19
19
  *
20
20
  * @param {Object} options - Screenshot options.
21
21
  * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be screenshoted.
22
- * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
23
- * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
24
22
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
25
23
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
26
24
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
@@ -32,14 +30,8 @@ export declare class HtmlScreenshot extends Screenshot {
32
30
  * @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
33
31
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
34
32
  */
35
- capture({ html, assets, header, footer, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, skipNetworkIdleEvent, optimizeForSpeed }: {
33
+ capture({ html, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, skipNetworkIdleEvent, optimizeForSpeed }: {
36
34
  html: PathLikeOrReadStream;
37
- assets?: {
38
- file: PathLikeOrReadStream;
39
- name: string;
40
- }[];
41
- header?: PathLikeOrReadStream;
42
- footer?: PathLikeOrReadStream;
43
35
  properties?: ImageProperties;
44
36
  emulatedMediaType?: EmulatedMediaType;
45
37
  waitDelay?: string;
@@ -26,8 +26,6 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
26
26
  *
27
27
  * @param {Object} options - Screenshot options.
28
28
  * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be screenshoted.
29
- * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
30
- * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
31
29
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
32
30
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
33
31
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
@@ -40,15 +38,10 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
40
38
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
41
39
  */
42
40
  capture(_a) {
43
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ html, assets, header, footer, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, skipNetworkIdleEvent, optimizeForSpeed }) {
41
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ html, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, skipNetworkIdleEvent, optimizeForSpeed }) {
44
42
  const data = new form_data_1.default();
45
43
  yield common_1.GotenbergUtils.addFile(data, html, 'index.html');
46
- if (assets === null || assets === void 0 ? void 0 : assets.length) {
47
- yield Promise.all(assets.map(({ file, name }) => common_1.GotenbergUtils.addFile(data, file, name)));
48
- }
49
44
  yield screenshot_utils_1.ScreenshotUtils.customize(data, {
50
- header,
51
- footer,
52
45
  properties,
53
46
  emulatedMediaType,
54
47
  waitDelay,
@@ -1 +1 @@
1
- {"version":3,"file":"html.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/html.screenshot.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAEjC,yCAAoE;AACpE,mDAA8D;AAE9D,gEAA4D;AAC5D,6CAA0C;AAG1C;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,uBAAU;IAC1C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO;qEAAC,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAenB;YACG,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAEvD,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE,CAAC;gBACjB,MAAM,OAAO,CAAC,GAAG,CACb,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAC1B,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAC3C,CACJ,CAAC;YACN,CAAC;YAED,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;gBAClC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,gBAAgB;gBAChB,qBAAqB;gBACrB,uBAAuB;gBACvB,oBAAoB;gBACpB,gBAAgB;aACnB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,CAChD,CAAC;QACN,CAAC;KAAA;CACJ;AAzFD,wCAyFC"}
1
+ {"version":3,"file":"html.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/html.screenshot.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAEjC,yCAAoE;AACpE,mDAA8D;AAE9D,gEAA4D;AAC5D,6CAA0C;AAG1C;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,uBAAU;IAC1C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACG,OAAO;qEAAC,EACV,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAYnB;YACG,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAEvD,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;gBAClC,UAAU;gBACV,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,gBAAgB;gBAChB,qBAAqB;gBACrB,uBAAuB;gBACvB,oBAAoB;gBACpB,gBAAgB;aACnB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,CAChD,CAAC;QACN,CAAC;KAAA;CACJ;AAvED,wCAuEC"}
@@ -20,8 +20,6 @@ export declare class MarkdownScreenshot extends Screenshot {
20
20
  * @param {Object} options - Screenshot options.
21
21
  * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be screenshoted.
22
22
  * @param {PathLikeOrReadStream} options.markdown - PathLike or ReadStream of the Markdown content to be screenshoted.
23
- * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
24
- * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
25
23
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
26
24
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
27
25
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
@@ -33,7 +31,7 @@ export declare class MarkdownScreenshot extends Screenshot {
33
31
  * @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
34
32
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
35
33
  */
36
- capture({ html, markdown, header, footer, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed }: {
34
+ capture({ html, markdown, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed }: {
37
35
  html: PathLikeOrReadStream;
38
36
  markdown: PathLikeOrReadStream;
39
37
  header?: PathLikeOrReadStream;
@@ -27,8 +27,6 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
27
27
  * @param {Object} options - Screenshot options.
28
28
  * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be screenshoted.
29
29
  * @param {PathLikeOrReadStream} options.markdown - PathLike or ReadStream of the Markdown content to be screenshoted.
30
- * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
31
- * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
32
30
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
33
31
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
34
32
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
@@ -41,13 +39,11 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
41
39
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
42
40
  */
43
41
  capture(_a) {
44
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ html, markdown, header, footer, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed }) {
42
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ html, markdown, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed }) {
45
43
  const data = new form_data_1.default();
46
44
  yield common_1.GotenbergUtils.addFile(data, html, 'index.html');
47
45
  yield common_1.GotenbergUtils.addFile(data, markdown, 'file.md');
48
46
  yield screenshot_utils_1.ScreenshotUtils.customize(data, {
49
- header,
50
- footer,
51
47
  properties,
52
48
  emulatedMediaType,
53
49
  waitDelay,
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/markdown.screenshot.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAEjC,yCAAoE;AAEpE,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAG9D;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,uBAAU;IAC9C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,OAAO;qEAAC,EACV,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAenB;YACG,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAEvD,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAExD,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;gBAClC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,gBAAgB;gBAChB,qBAAqB;gBACrB,uBAAuB;gBACvB,oBAAoB;gBACpB,gBAAgB;aACnB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,CAChD,CAAC;QACN,CAAC;KAAA;CACJ;AApFD,gDAoFC"}
1
+ {"version":3,"file":"markdown.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/markdown.screenshot.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAEjC,yCAAoE;AAEpE,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAG9D;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,uBAAU;IAC9C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO;qEAAC,EACV,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAenB;YACG,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAEvD,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAExD,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;gBAClC,UAAU;gBACV,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,gBAAgB;gBAChB,qBAAqB;gBACrB,uBAAuB;gBACvB,oBAAoB;gBACpB,gBAAgB;aACnB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,CAChD,CAAC;QACN,CAAC;KAAA;CACJ;AA9ED,gDA8EC"}
@@ -1,7 +1,6 @@
1
- import { PathLikeOrReadStream } from '../../common';
2
1
  import { ImageProperties } from '../interfaces/screenshot.types';
3
2
  import { Screenshot } from './screenshot';
4
- import { EmulatedMediaType } from '../interfaces/common.types';
3
+ import { Cookie, EmulatedMediaType } from '../interfaces/common.types';
5
4
  /**
6
5
  * Class representing a URL screenshot that extends the base screenshot class.
7
6
  * This class is used to screenshot a URL using Gotenberg service.
@@ -19,8 +18,6 @@ export declare class UrlScreenshot extends Screenshot {
19
18
  *
20
19
  * @param {Object} options - Screenshot options.
21
20
  * @param {string} options.url - The URL of the content to be screenshoted
22
- * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
23
- * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
24
21
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
25
22
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
26
23
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
@@ -30,12 +27,11 @@ export declare class UrlScreenshot extends Screenshot {
30
27
  * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during screenshot.
31
28
  * @param {boolean} [options.skipNetworkIdleEvent] - Whether to skip network idle event.
32
29
  * @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
30
+ * @param {Cookie[]} options.cookies - Cookies to be written.
33
31
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
34
32
  */
35
- capture({ url, header, footer, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed }: {
33
+ capture({ url, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed, cookies }: {
36
34
  url: string;
37
- header?: PathLikeOrReadStream;
38
- footer?: PathLikeOrReadStream;
39
35
  properties?: ImageProperties;
40
36
  emulatedMediaType?: EmulatedMediaType;
41
37
  waitDelay?: string;
@@ -45,5 +41,6 @@ export declare class UrlScreenshot extends Screenshot {
45
41
  failOnConsoleExceptions?: boolean;
46
42
  skipNetworkIdleEvent?: boolean;
47
43
  optimizeForSpeed?: boolean;
44
+ cookies?: Cookie[];
48
45
  }): Promise<Buffer>;
49
46
  }
@@ -27,8 +27,6 @@ class UrlScreenshot extends screenshot_1.Screenshot {
27
27
  *
28
28
  * @param {Object} options - Screenshot options.
29
29
  * @param {string} options.url - The URL of the content to be screenshoted
30
- * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
31
- * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
32
30
  * @param {ImageProperties} [options.properties] - Image properties for the screenshot.
33
31
  * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the screenshot.
34
32
  * @param {string} [options.waitDelay] - Delay before the screenshot process starts.
@@ -38,16 +36,15 @@ class UrlScreenshot extends screenshot_1.Screenshot {
38
36
  * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during screenshot.
39
37
  * @param {boolean} [options.skipNetworkIdleEvent] - Whether to skip network idle event.
40
38
  * @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
39
+ * @param {Cookie[]} options.cookies - Cookies to be written.
41
40
  * @returns {Promise<Buffer>} A Promise resolving to the image buffer.
42
41
  */
43
42
  capture(_a) {
44
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ url, header, footer, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed }) {
43
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ url, properties, emulatedMediaType, waitDelay, waitForExpression, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, optimizeForSpeed, cookies }) {
45
44
  const _url = new url_1.URL(url);
46
45
  const data = new form_data_1.default();
47
46
  data.append('url', _url.href);
48
47
  yield screenshot_utils_1.ScreenshotUtils.customize(data, {
49
- header,
50
- footer,
51
48
  properties,
52
49
  emulatedMediaType,
53
50
  waitDelay,
@@ -56,7 +53,8 @@ class UrlScreenshot extends screenshot_1.Screenshot {
56
53
  failOnHttpStatusCodes,
57
54
  failOnConsoleExceptions,
58
55
  skipNetworkIdleEvent,
59
- optimizeForSpeed
56
+ optimizeForSpeed,
57
+ cookies
60
58
  });
61
59
  return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword());
62
60
  });
@@ -1 +1 @@
1
- {"version":3,"file":"url.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/url.screenshot.ts"],"names":[],"mappings":";;;;AAAA,6BAA0B;AAC1B,kEAAiC;AACjC,yCAAoE;AAEpE,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAG9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,uBAAU;IACzC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO;qEAAC,EACV,GAAG,EACH,MAAM,EACN,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAcnB;YACG,MAAM,IAAI,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAE9B,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;gBAClC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,gBAAgB;gBAChB,qBAAqB;gBACrB,uBAAuB;gBACvB,oBAAoB;gBACpB,gBAAgB;aACnB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,CAChD,CAAC;QACN,CAAC;KAAA;CACJ;AAhFD,sCAgFC"}
1
+ {"version":3,"file":"url.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/url.screenshot.ts"],"names":[],"mappings":";;;;AAAA,6BAA0B;AAC1B,kEAAiC;AACjC,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAG9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,uBAAU;IACzC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO;qEAAC,EACV,GAAG,EACH,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,OAAO,EAaV;YACG,MAAM,IAAI,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAE9B,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;gBAClC,UAAU;gBACV,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,gBAAgB;gBAChB,qBAAqB;gBACrB,uBAAuB;gBACvB,oBAAoB;gBACpB,gBAAgB;gBAChB,OAAO;aACV,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,CAChD,CAAC;QACN,CAAC;KAAA;CACJ;AA5ED,sCA4EC"}
@@ -42,14 +42,6 @@ class ScreenshotUtils {
42
42
  */
43
43
  static customize(data, options) {
44
44
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
- if (options.header) {
46
- const { header } = options;
47
- yield common_1.GotenbergUtils.addFile(data, header, 'header.html');
48
- }
49
- if (options.footer) {
50
- const { footer } = options;
51
- yield common_1.GotenbergUtils.addFile(data, footer, 'footer.html');
52
- }
53
45
  if (options.emulatedMediaType) {
54
46
  data.append('emulatedMediaType', options.emulatedMediaType);
55
47
  }
@@ -77,6 +69,9 @@ class ScreenshotUtils {
77
69
  if (options.optimizeForSpeed) {
78
70
  data.append('optimizeForSpeed', String(options.optimizeForSpeed));
79
71
  }
72
+ if (options.cookies) {
73
+ data.append('cookies', JSON.stringify(options.cookies));
74
+ }
80
75
  });
81
76
  }
82
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/screenshot.utils.ts"],"names":[],"mappings":";;;;AAMA,yCAA8C;AAE9C;;GAEG;AACH,MAAa,eAAe;IACxB;;;;;OAKG;IACI,MAAM,CAAC,kBAAkB,CAC5B,IAAc,EACd,eAAgC;QAEhC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAE9C,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;YAC1B,uBAAc,CAAC,MAAM,CACjB,eAAe,CAAC,MAAM,KAAK,MAAM,EACjC,+DAA+D,CAClE,CAAC;YACF,uBAAc,CAAC,MAAM,CACjB,eAAe,CAAC,OAAO,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,IAAI,GAAG,EAC9D,wEAAwE,CAC3E,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,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CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;YACjE,CAAC;YAED,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACpB,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YAChD,CAAC;YAED,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;gBAC5B,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAChE,CAAC;YAED,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,CACP,kBAAkB,EAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAC3C,CAAC;YACN,CAAC;YAED,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;gBAChC,IAAI,CAAC,MAAM,CACP,uBAAuB,EACvB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAChD,CAAC;YACN,CAAC;YAED,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;gBAClC,IAAI,CAAC,MAAM,CACP,yBAAyB,EACzB,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAC1C,CAAC;YACN,CAAC;YAED,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBAC/B,IAAI,CAAC,MAAM,CACP,sBAAsB,EACtB,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACvC,CAAC;YACN,CAAC;YAED,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;YACtE,CAAC;QACL,CAAC;KAAA;CACJ;AAnHD,0CAmHC"}
1
+ {"version":3,"file":"screenshot.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/screenshot.utils.ts"],"names":[],"mappings":";;;;A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CAAC,OAAO,EAAE,CAAC;gBAClB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;KAAA;CACJ;AA7GD,0CA6GC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chromiumly",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "A lightweight Typescript library that interacts with Gotenberg's different modules to convert a variety of document formats to PDF files.",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -49,14 +49,14 @@
49
49
  "@commitlint/config-conventional": "^19.0.3",
50
50
  "@commitlint/cz-commitlint": "^19.0.3",
51
51
  "@release-it/conventional-changelog": "8.0.1",
52
- "@types/config": "3.3.4",
52
+ "@types/config": "3.3.5",
53
53
  "@types/dotenv": "8.2.0",
54
54
  "@types/form-data": "2.5.0",
55
55
  "@types/jest": "29.5.12",
56
- "@types/node": "20.14.10",
56
+ "@types/node": "20.16.5",
57
57
  "@types/node-fetch": "2.6.11",
58
- "@typescript-eslint/eslint-plugin": "7.16.0",
59
- "@typescript-eslint/parser": "7.16.0",
58
+ "@typescript-eslint/eslint-plugin": "7.18.0",
59
+ "@typescript-eslint/parser": "7.18.0",
60
60
  "commitizen": "4.3.0",
61
61
  "eslint": "8.57.0",
62
62
  "eslint-config-prettier": "^9.1.0",
@@ -65,12 +65,12 @@
65
65
  "jest": "29.7.0",
66
66
  "jest-junit": "16.0.0",
67
67
  "lint-staged": "^15.2.2",
68
- "prettier": "3.3.2",
69
- "release-it": "17.5.0",
70
- "ts-jest": "29.2.0",
68
+ "prettier": "3.3.3",
69
+ "release-it": "17.6.0",
70
+ "ts-jest": "29.2.5",
71
71
  "ts-node": "10.9.2",
72
- "tslib": "2.6.3",
73
- "typescript": "5.5.3"
72
+ "tslib": "2.7.0",
73
+ "typescript": "5.5.4"
74
74
  },
75
75
  "dependencies": {
76
76
  "form-data": "4.0.0",