@shad0wz7/nestjs-pdf 3.2.0 → 4.0.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/README.md +34 -26
- package/dist/index.cjs +213 -76
- package/dist/index.d.cts +183 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +183 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +203 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +83 -43
package/dist/index.d.cts
CHANGED
|
@@ -2,10 +2,10 @@ import { Browser, BrowserContext, PDFOptions } from "puppeteer";
|
|
|
2
2
|
import { StandardFonts } from "pdf-lib";
|
|
3
3
|
import { DynamicModule, InjectionToken, ModuleMetadata, OnModuleDestroy, OnModuleInit, OptionalFactoryDependency } from "@nestjs/common";
|
|
4
4
|
import { Browser as Browser$1 } from "@puppeteer/browsers";
|
|
5
|
-
import { MJMLParsingOptions } from "mjml-core";
|
|
6
5
|
import { Data, Options } from "ejs";
|
|
7
6
|
import { EtaConfig } from "eta";
|
|
8
7
|
import Handlebars from "handlebars";
|
|
8
|
+
import { LiquidOptions as LiquidOptions$1 } from "liquidjs";
|
|
9
9
|
import { EscapeFunction } from "mustache";
|
|
10
10
|
import { ConfigureOptions } from "nunjucks";
|
|
11
11
|
import { LocalsObject, Options as Options$1 } from "pug";
|
|
@@ -41,7 +41,9 @@ export declare class BrowserUnavailableException extends NestjsPdfException {
|
|
|
41
41
|
//#region src/exceptions/engine-not-available.exception.d.ts
|
|
42
42
|
export declare class EngineNotAvailableException extends NestjsPdfException {
|
|
43
43
|
readonly code = NestjsPdfErrorCode.ENGINE_NOT_AVAILABLE;
|
|
44
|
-
constructor(engineName: string
|
|
44
|
+
constructor(engineName: string, packageName?: string, options?: {
|
|
45
|
+
cause?: unknown;
|
|
46
|
+
});
|
|
45
47
|
}
|
|
46
48
|
//#endregion
|
|
47
49
|
//#region src/exceptions/pdf-generation.exception.d.ts
|
|
@@ -141,6 +143,130 @@ interface WatermarkOptions {
|
|
|
141
143
|
pages?: Array<number>;
|
|
142
144
|
}
|
|
143
145
|
//#endregion
|
|
146
|
+
//#region node_modules/.pnpm/@types+mjml-core@5.1.0/node_modules/@types/mjml-core/index.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* Options passed as an object to the mjml2html function
|
|
149
|
+
*
|
|
150
|
+
* https://documentation.mjml.io/#inside-node-js
|
|
151
|
+
*/
|
|
152
|
+
interface MJMLParsingOptions {
|
|
153
|
+
/**
|
|
154
|
+
* Default fonts imported in the HTML rendered by HTML
|
|
155
|
+
* ie. { 'Open Sans': 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700' }
|
|
156
|
+
*
|
|
157
|
+
* default: @see https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/index.js
|
|
158
|
+
*/
|
|
159
|
+
fonts?: {
|
|
160
|
+
[key: string]: string;
|
|
161
|
+
} | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Option to keep comments in the HTML output
|
|
164
|
+
* default: true
|
|
165
|
+
*/
|
|
166
|
+
keepComments?: boolean | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Beautify the HTML output using prettier (parser: 'html', printWidth: 240).
|
|
169
|
+
* Mutually exclusive with minify — if minify is true, beautify is skipped.
|
|
170
|
+
* Note: the CLI defaults this to true; the programmatic API defaults to false.
|
|
171
|
+
* default: false
|
|
172
|
+
*/
|
|
173
|
+
beautify?: boolean | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Minify the HTML output using htmlnano (with cssnano-preset-lite for CSS).
|
|
176
|
+
* Takes priority over beautify when both are true.
|
|
177
|
+
* default: false
|
|
178
|
+
*/
|
|
179
|
+
minify?: boolean | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Options passed to htmlnano when minify is true.
|
|
182
|
+
* The minifyCss field accepts false, true, 'lite', or a cssnano options object.
|
|
183
|
+
* All htmlnano v3 options are accepted.
|
|
184
|
+
*/
|
|
185
|
+
minifyOptions?: MJMLMinifyOptions | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* How to validate your MJML
|
|
188
|
+
*
|
|
189
|
+
* skip: your document is rendered without going through validation
|
|
190
|
+
* soft: your document is going through validation and is rendered, even if it has errors
|
|
191
|
+
* strict: your document is going through validation and is not rendered if it has any error
|
|
192
|
+
*
|
|
193
|
+
* default: soft
|
|
194
|
+
*/
|
|
195
|
+
validationLevel?: "strict" | "soft" | "skip" | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Full path of the specified file to use when resolving paths from mj-include components
|
|
198
|
+
* default: '.'
|
|
199
|
+
*/
|
|
200
|
+
filePath?: string | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Directory (or directories) outside the template's own folder from which mj-include
|
|
203
|
+
* partials may be loaded. Added in mjml 5.1 as part of the include path-traversal hardening;
|
|
204
|
+
* includes resolving outside these allowed roots are denied.
|
|
205
|
+
*/
|
|
206
|
+
includePath?: string | string[] | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* The path or directory of the .mjmlconfig file
|
|
209
|
+
* default: process.cwd()
|
|
210
|
+
*/
|
|
211
|
+
mjmlConfigPath?: string | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Use the config attribute defined in the .mjmlconfig file.
|
|
214
|
+
* The config passed into mjml2html overrides the .mjmlconfig.
|
|
215
|
+
* default: false
|
|
216
|
+
*/
|
|
217
|
+
useMjmlConfigOptions?: boolean | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* optional setting when inlining css, see mjml-cli documentation for more info
|
|
220
|
+
*/
|
|
221
|
+
juicePreserveTags?: {
|
|
222
|
+
[index: string]: {
|
|
223
|
+
start: string;
|
|
224
|
+
end: string;
|
|
225
|
+
};
|
|
226
|
+
} | undefined;
|
|
227
|
+
juiceOptions?: any;
|
|
228
|
+
/**
|
|
229
|
+
* undocumented
|
|
230
|
+
* a function returning html skeleton
|
|
231
|
+
* default: see mjml-core/src/helpers/skeleton.js
|
|
232
|
+
*/
|
|
233
|
+
skeleton?: string | (() => string) | undefined;
|
|
234
|
+
actualPath?: string | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* undocumented
|
|
237
|
+
* ignore mj-include elements
|
|
238
|
+
* default: false
|
|
239
|
+
*/
|
|
240
|
+
ignoreIncludes?: any;
|
|
241
|
+
/**
|
|
242
|
+
* see mjml-parser-xml
|
|
243
|
+
*/
|
|
244
|
+
preprocessors?: Array<((xml: string) => string)> | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Add media queries specific to printer when converting mjml into html. When enabling this option,
|
|
247
|
+
* the html might not be compatible with all email clients anymore.
|
|
248
|
+
*/
|
|
249
|
+
printerSupport?: boolean | undefined;
|
|
250
|
+
}
|
|
251
|
+
interface MJMLMinifyOptions {
|
|
252
|
+
collapseWhitespace?: boolean | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* CSS minification options passed to cssnano-preset-lite.
|
|
255
|
+
* Accepts false (disable), true/'lite' (use lite preset), or a cssnano options object.
|
|
256
|
+
* @see https://cssnano.co/docs/presets
|
|
257
|
+
*/
|
|
258
|
+
minifyCss?: boolean | "lite" | {
|
|
259
|
+
preset?: any;
|
|
260
|
+
plugins?: any[];
|
|
261
|
+
configFile?: string;
|
|
262
|
+
} | undefined;
|
|
263
|
+
/** @deprecated use minifyCss instead */
|
|
264
|
+
minifyCSS?: boolean | undefined;
|
|
265
|
+
removeEmptyAttributes?: boolean | undefined;
|
|
266
|
+
minifyJs?: boolean | undefined;
|
|
267
|
+
removeComments?: false | "safe" | "all" | undefined;
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
144
270
|
//#region src/puppeteer/browser/browser.service.d.ts
|
|
145
271
|
declare enum BrowserTag {
|
|
146
272
|
LATEST = "latest",
|
|
@@ -178,6 +304,7 @@ export interface EjsOptions extends Omit<Options, 'async'> {
|
|
|
178
304
|
async?: boolean;
|
|
179
305
|
}
|
|
180
306
|
export declare class EjsService {
|
|
307
|
+
#private;
|
|
181
308
|
render(template: string, data?: Data, options?: EjsOptions): Promise<string>;
|
|
182
309
|
renderFile(filePath: string, data?: Data, options?: EjsOptions): Promise<string>;
|
|
183
310
|
}
|
|
@@ -193,7 +320,6 @@ export interface EtaOptions extends Partial<EtaConfig> {
|
|
|
193
320
|
}
|
|
194
321
|
export declare class EtaService {
|
|
195
322
|
#private;
|
|
196
|
-
constructor();
|
|
197
323
|
/**
|
|
198
324
|
* Render an Eta template from a string
|
|
199
325
|
* @param template The template string to render
|
|
@@ -248,6 +374,37 @@ export declare class HandlebarsService {
|
|
|
248
374
|
renderFile(file: string, parameters?: unknown, options?: HandlebarsOptions): string;
|
|
249
375
|
}
|
|
250
376
|
//#endregion
|
|
377
|
+
//#region src/puppeteer/engines/liquid/liquid.service.d.ts
|
|
378
|
+
export type LiquidOptions = LiquidOptions$1;
|
|
379
|
+
export declare class LiquidService {
|
|
380
|
+
#private;
|
|
381
|
+
/**
|
|
382
|
+
* Render a Liquid template from a string
|
|
383
|
+
* @param template The template string to render
|
|
384
|
+
* @param data The data object to use for rendering
|
|
385
|
+
* @param options Optional Liquid engine options
|
|
386
|
+
* @returns The rendered HTML string
|
|
387
|
+
*/
|
|
388
|
+
render(template: string, data?: Record<string, unknown>, options?: LiquidOptions): string;
|
|
389
|
+
/**
|
|
390
|
+
* Render a Liquid template from a file
|
|
391
|
+
* @param filePath The path to the template file
|
|
392
|
+
* @param data The data object to use for rendering
|
|
393
|
+
* @param options Optional Liquid engine options
|
|
394
|
+
* @returns The rendered HTML string
|
|
395
|
+
*/
|
|
396
|
+
renderFile(filePath: string, data?: Record<string, unknown>, options?: LiquidOptions): string;
|
|
397
|
+
/**
|
|
398
|
+
* Clear the template cache
|
|
399
|
+
*/
|
|
400
|
+
clearCache(): void;
|
|
401
|
+
/**
|
|
402
|
+
* Get the current cache size
|
|
403
|
+
* @returns The number of cached templates
|
|
404
|
+
*/
|
|
405
|
+
getCacheSize(): number;
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
251
408
|
//#region src/puppeteer/engines/mustache/mustache.service.d.ts
|
|
252
409
|
export interface MustacheOptions {
|
|
253
410
|
tags?: [string, string];
|
|
@@ -291,7 +448,7 @@ export interface NunjucksOptions extends Partial<ConfigureOptions> {
|
|
|
291
448
|
lstripBlocks?: boolean;
|
|
292
449
|
}
|
|
293
450
|
export declare class NunjucksService {
|
|
294
|
-
|
|
451
|
+
#private;
|
|
295
452
|
render(template: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
|
|
296
453
|
renderFile(filePath: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
|
|
297
454
|
}
|
|
@@ -299,6 +456,7 @@ export declare class NunjucksService {
|
|
|
299
456
|
//#region src/puppeteer/engines/pug/pug.service.d.ts
|
|
300
457
|
export type PugOptions = Options$1;
|
|
301
458
|
export declare class PugService {
|
|
459
|
+
#private;
|
|
302
460
|
render(template: string, data?: LocalsObject, options?: PugOptions): string;
|
|
303
461
|
renderFile(filePath: string, data?: LocalsObject, options?: PugOptions): string;
|
|
304
462
|
}
|
|
@@ -321,6 +479,7 @@ export interface PuppeteerParameters {
|
|
|
321
479
|
nunjucksOptions?: NunjucksOptions;
|
|
322
480
|
etaOptions?: EtaOptions;
|
|
323
481
|
mustacheOptions?: MustacheOptions;
|
|
482
|
+
liquidOptions?: LiquidOptions;
|
|
324
483
|
chromiumRevision?: string;
|
|
325
484
|
buildId?: string;
|
|
326
485
|
headless?: boolean | 'shell';
|
|
@@ -345,6 +504,7 @@ export declare class NestjsPdfModule {
|
|
|
345
504
|
//#endregion
|
|
346
505
|
//#region src/puppeteer/engines/mjml/mjml.service.d.ts
|
|
347
506
|
export declare class MjmlService {
|
|
507
|
+
#private;
|
|
348
508
|
render(template: string, options?: MJMLParsingOptions): Promise<string>;
|
|
349
509
|
renderFile(filePath: string, options?: MJMLParsingOptions): Promise<string>;
|
|
350
510
|
}
|
|
@@ -352,7 +512,7 @@ export declare class MjmlService {
|
|
|
352
512
|
//#region src/puppeteer/puppeteer.service.d.ts
|
|
353
513
|
export declare class PuppeteerService {
|
|
354
514
|
#private;
|
|
355
|
-
constructor(browserService: BrowserService, options: PuppeteerParameters, hbsService?: HandlebarsService, mjmlService?: MjmlService, pugService?: PugService, ejsService?: EjsService, nunjucksService?: NunjucksService, etaService?: EtaService, mustacheService?: MustacheService);
|
|
515
|
+
constructor(browserService: BrowserService, options: PuppeteerParameters, hbsService?: HandlebarsService, mjmlService?: MjmlService, pugService?: PugService, ejsService?: EjsService, nunjucksService?: NunjucksService, etaService?: EtaService, mustacheService?: MustacheService, liquidService?: LiquidService);
|
|
356
516
|
generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array>;
|
|
357
517
|
generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
358
518
|
generatePdfFromTemplateHbsFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
@@ -368,6 +528,8 @@ export declare class PuppeteerService {
|
|
|
368
528
|
generatePdfFromEtaFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
369
529
|
generatePdfFromMustacheString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
370
530
|
generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
531
|
+
generatePdfFromLiquidString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
532
|
+
generatePdfFromLiquidFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
371
533
|
}
|
|
372
534
|
//#endregion
|
|
373
535
|
//#region src/nestjs-pdf.service.d.ts
|
|
@@ -491,6 +653,22 @@ export declare class NestjsPdfService {
|
|
|
491
653
|
* @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
492
654
|
*/
|
|
493
655
|
generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
656
|
+
/**
|
|
657
|
+
* @param template Liquid template string
|
|
658
|
+
* @param data Data to inject into the template
|
|
659
|
+
* @param options PDF generation options (optional)
|
|
660
|
+
* @returns PDF generated from the provided Liquid template with data applied
|
|
661
|
+
* @description This method generates a PDF from a Liquid template provided as a string. Liquid is a safe, Shopify-compatible template language with filters, tags, partials and layouts. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
662
|
+
*/
|
|
663
|
+
generatePdfFromLiquidString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
664
|
+
/**
|
|
665
|
+
* @param file Path to the Liquid template file
|
|
666
|
+
* @param data Data to inject into the template
|
|
667
|
+
* @param options PDF generation options (optional)
|
|
668
|
+
* @returns PDF generated from the Liquid template at the provided file path with data applied
|
|
669
|
+
* @description This method generates a PDF from a Liquid template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
670
|
+
*/
|
|
671
|
+
generatePdfFromLiquidFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
494
672
|
/**
|
|
495
673
|
* @param pdf The PDF bytes to modify
|
|
496
674
|
* @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/exceptions/nestjs-pdf.exception.ts","../src/exceptions/browser-installation.exception.ts","../src/exceptions/browser-unavailable.exception.ts","../src/exceptions/engine-not-available.exception.ts","../src/exceptions/pdf-generation.exception.ts","../src/exceptions/signature-dependency.exception.ts","../src/exceptions/signature-placement.exception.ts","../src/exceptions/template-configuration.exception.ts","../src/exceptions/template-render.exception.ts","../src/exceptions/watermark.exception.ts","../src/helpers/getRelativePath.helper.ts","../src/helpers/request-guard.helper.ts","../src/helpers/watermark.helper.ts","../src/puppeteer/browser/browser.service.ts","../src/puppeteer/engines/ejs/ejs.service.ts","../src/puppeteer/engines/eta/eta.service.ts","../src/puppeteer/engines/handlebars/handlebars.service.ts","../src/puppeteer/engines/mustache/mustache.service.ts","../src/puppeteer/engines/nunjucks/nunjucks.service.ts","../src/puppeteer/engines/pug/pug.service.ts","../src/puppeteer/puppeteer-parameters.interface.ts","../src/nestjs-pdf.module.ts","../src/puppeteer/engines/mjml/mjml.service.ts","../src/puppeteer/puppeteer.service.ts","../src/nestjs-pdf.service.ts","../src/puppeteer/puppeteer.module.ts"],"mappings":";;;;;;;;;;;;oBAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;8BAGoB,2BAA2B;oBAC7B,MAAM;EAEZ,YAAA,iBAAiB;IAAY;;;;;qBCb9B,qCAAqC;WACvC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["BrowserType","LiquidJsOptions","Options","Browser"],"sources":["../src/exceptions/nestjs-pdf.exception.ts","../src/exceptions/browser-installation.exception.ts","../src/exceptions/browser-unavailable.exception.ts","../src/exceptions/engine-not-available.exception.ts","../src/exceptions/pdf-generation.exception.ts","../src/exceptions/signature-dependency.exception.ts","../src/exceptions/signature-placement.exception.ts","../src/exceptions/template-configuration.exception.ts","../src/exceptions/template-render.exception.ts","../src/exceptions/watermark.exception.ts","../src/helpers/getRelativePath.helper.ts","../src/helpers/request-guard.helper.ts","../src/helpers/watermark.helper.ts","../node_modules/.pnpm/@types+mjml-core@5.1.0/node_modules/@types/mjml-core/index.d.ts","../src/puppeteer/browser/browser.service.ts","../src/puppeteer/engines/ejs/ejs.service.ts","../src/puppeteer/engines/eta/eta.service.ts","../src/puppeteer/engines/handlebars/handlebars.service.ts","../src/puppeteer/engines/liquid/liquid.service.ts","../src/puppeteer/engines/mustache/mustache.service.ts","../src/puppeteer/engines/nunjucks/nunjucks.service.ts","../src/puppeteer/engines/pug/pug.service.ts","../src/puppeteer/puppeteer-parameters.interface.ts","../src/nestjs-pdf.module.ts","../src/puppeteer/engines/mjml/mjml.service.ts","../src/puppeteer/puppeteer.service.ts","../src/nestjs-pdf.service.ts","../src/puppeteer/puppeteer.module.ts"],"ignoreList":[13],"mappings":";;;;;;;;;;;;oBAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;8BAGoB,2BAA2B;oBAC7B,MAAM;EAEZ,YAAA,iBAAiB;IAAY;;;;;qBCb9B,qCAAqC;WACvC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;EAGX,YAAA,oBACA,sBACA;IAAY;;;;;qBCNH,+BAA+B;WACjC,OAAI,mBAAA;;;;qBCDF,qCAAqC;WACvC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;;;;qBCDF,uCAAuC;WACzC,OAAI,mBAAA;;;;qBCDF,gCAAgC;WAIzB;WAHT,OAAI,mBAAA;EAGK,YAAA,gBAChB,iBACA;IAAY;;;;;qBCNH,2BAA2B;WAC7B,OAAI,mBAAA;;;;;;;;;;;;;wBCQC,uBACd,mBACA;;;;;;;UCYe;;;;;EAKf;;;;;EAKA,eAAe;;;;;EAKf,mBAAmB;;EAEnB;;;;UC/Be;;EAEf;;EAEA,QAAQ,aAAa;;EAErB;;EAEA;;EAEA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
|
|
|
5
5
|
import { Data, Options } from "ejs";
|
|
6
6
|
import { EtaConfig } from "eta";
|
|
7
7
|
import Handlebars from "handlebars";
|
|
8
|
+
import { LiquidOptions as LiquidOptions$1 } from "liquidjs";
|
|
8
9
|
import { EscapeFunction } from "mustache";
|
|
9
10
|
import { ConfigureOptions } from "nunjucks";
|
|
10
11
|
import { LocalsObject, Options as Options$1 } from "pug";
|
|
11
|
-
import { MJMLParsingOptions } from "mjml-core";
|
|
12
12
|
//#region src/exceptions/nestjs-pdf.exception.d.ts
|
|
13
13
|
export declare enum NestjsPdfErrorCode {
|
|
14
14
|
ENGINE_NOT_AVAILABLE = "ENGINE_NOT_AVAILABLE",
|
|
@@ -41,7 +41,9 @@ export declare class BrowserUnavailableException extends NestjsPdfException {
|
|
|
41
41
|
//#region src/exceptions/engine-not-available.exception.d.ts
|
|
42
42
|
export declare class EngineNotAvailableException extends NestjsPdfException {
|
|
43
43
|
readonly code = NestjsPdfErrorCode.ENGINE_NOT_AVAILABLE;
|
|
44
|
-
constructor(engineName: string
|
|
44
|
+
constructor(engineName: string, packageName?: string, options?: {
|
|
45
|
+
cause?: unknown;
|
|
46
|
+
});
|
|
45
47
|
}
|
|
46
48
|
//#endregion
|
|
47
49
|
//#region src/exceptions/pdf-generation.exception.d.ts
|
|
@@ -141,6 +143,130 @@ interface WatermarkOptions {
|
|
|
141
143
|
pages?: Array<number>;
|
|
142
144
|
}
|
|
143
145
|
//#endregion
|
|
146
|
+
//#region node_modules/.pnpm/@types+mjml-core@5.1.0/node_modules/@types/mjml-core/index.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* Options passed as an object to the mjml2html function
|
|
149
|
+
*
|
|
150
|
+
* https://documentation.mjml.io/#inside-node-js
|
|
151
|
+
*/
|
|
152
|
+
interface MJMLParsingOptions {
|
|
153
|
+
/**
|
|
154
|
+
* Default fonts imported in the HTML rendered by HTML
|
|
155
|
+
* ie. { 'Open Sans': 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700' }
|
|
156
|
+
*
|
|
157
|
+
* default: @see https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/index.js
|
|
158
|
+
*/
|
|
159
|
+
fonts?: {
|
|
160
|
+
[key: string]: string;
|
|
161
|
+
} | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Option to keep comments in the HTML output
|
|
164
|
+
* default: true
|
|
165
|
+
*/
|
|
166
|
+
keepComments?: boolean | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Beautify the HTML output using prettier (parser: 'html', printWidth: 240).
|
|
169
|
+
* Mutually exclusive with minify — if minify is true, beautify is skipped.
|
|
170
|
+
* Note: the CLI defaults this to true; the programmatic API defaults to false.
|
|
171
|
+
* default: false
|
|
172
|
+
*/
|
|
173
|
+
beautify?: boolean | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Minify the HTML output using htmlnano (with cssnano-preset-lite for CSS).
|
|
176
|
+
* Takes priority over beautify when both are true.
|
|
177
|
+
* default: false
|
|
178
|
+
*/
|
|
179
|
+
minify?: boolean | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Options passed to htmlnano when minify is true.
|
|
182
|
+
* The minifyCss field accepts false, true, 'lite', or a cssnano options object.
|
|
183
|
+
* All htmlnano v3 options are accepted.
|
|
184
|
+
*/
|
|
185
|
+
minifyOptions?: MJMLMinifyOptions | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* How to validate your MJML
|
|
188
|
+
*
|
|
189
|
+
* skip: your document is rendered without going through validation
|
|
190
|
+
* soft: your document is going through validation and is rendered, even if it has errors
|
|
191
|
+
* strict: your document is going through validation and is not rendered if it has any error
|
|
192
|
+
*
|
|
193
|
+
* default: soft
|
|
194
|
+
*/
|
|
195
|
+
validationLevel?: "strict" | "soft" | "skip" | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Full path of the specified file to use when resolving paths from mj-include components
|
|
198
|
+
* default: '.'
|
|
199
|
+
*/
|
|
200
|
+
filePath?: string | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Directory (or directories) outside the template's own folder from which mj-include
|
|
203
|
+
* partials may be loaded. Added in mjml 5.1 as part of the include path-traversal hardening;
|
|
204
|
+
* includes resolving outside these allowed roots are denied.
|
|
205
|
+
*/
|
|
206
|
+
includePath?: string | string[] | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* The path or directory of the .mjmlconfig file
|
|
209
|
+
* default: process.cwd()
|
|
210
|
+
*/
|
|
211
|
+
mjmlConfigPath?: string | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Use the config attribute defined in the .mjmlconfig file.
|
|
214
|
+
* The config passed into mjml2html overrides the .mjmlconfig.
|
|
215
|
+
* default: false
|
|
216
|
+
*/
|
|
217
|
+
useMjmlConfigOptions?: boolean | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* optional setting when inlining css, see mjml-cli documentation for more info
|
|
220
|
+
*/
|
|
221
|
+
juicePreserveTags?: {
|
|
222
|
+
[index: string]: {
|
|
223
|
+
start: string;
|
|
224
|
+
end: string;
|
|
225
|
+
};
|
|
226
|
+
} | undefined;
|
|
227
|
+
juiceOptions?: any;
|
|
228
|
+
/**
|
|
229
|
+
* undocumented
|
|
230
|
+
* a function returning html skeleton
|
|
231
|
+
* default: see mjml-core/src/helpers/skeleton.js
|
|
232
|
+
*/
|
|
233
|
+
skeleton?: string | (() => string) | undefined;
|
|
234
|
+
actualPath?: string | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* undocumented
|
|
237
|
+
* ignore mj-include elements
|
|
238
|
+
* default: false
|
|
239
|
+
*/
|
|
240
|
+
ignoreIncludes?: any;
|
|
241
|
+
/**
|
|
242
|
+
* see mjml-parser-xml
|
|
243
|
+
*/
|
|
244
|
+
preprocessors?: Array<((xml: string) => string)> | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Add media queries specific to printer when converting mjml into html. When enabling this option,
|
|
247
|
+
* the html might not be compatible with all email clients anymore.
|
|
248
|
+
*/
|
|
249
|
+
printerSupport?: boolean | undefined;
|
|
250
|
+
}
|
|
251
|
+
interface MJMLMinifyOptions {
|
|
252
|
+
collapseWhitespace?: boolean | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* CSS minification options passed to cssnano-preset-lite.
|
|
255
|
+
* Accepts false (disable), true/'lite' (use lite preset), or a cssnano options object.
|
|
256
|
+
* @see https://cssnano.co/docs/presets
|
|
257
|
+
*/
|
|
258
|
+
minifyCss?: boolean | "lite" | {
|
|
259
|
+
preset?: any;
|
|
260
|
+
plugins?: any[];
|
|
261
|
+
configFile?: string;
|
|
262
|
+
} | undefined;
|
|
263
|
+
/** @deprecated use minifyCss instead */
|
|
264
|
+
minifyCSS?: boolean | undefined;
|
|
265
|
+
removeEmptyAttributes?: boolean | undefined;
|
|
266
|
+
minifyJs?: boolean | undefined;
|
|
267
|
+
removeComments?: false | "safe" | "all" | undefined;
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
144
270
|
//#region src/puppeteer/browser/browser.service.d.ts
|
|
145
271
|
declare enum BrowserTag {
|
|
146
272
|
LATEST = "latest",
|
|
@@ -178,6 +304,7 @@ export interface EjsOptions extends Omit<Options, 'async'> {
|
|
|
178
304
|
async?: boolean;
|
|
179
305
|
}
|
|
180
306
|
export declare class EjsService {
|
|
307
|
+
#private;
|
|
181
308
|
render(template: string, data?: Data, options?: EjsOptions): Promise<string>;
|
|
182
309
|
renderFile(filePath: string, data?: Data, options?: EjsOptions): Promise<string>;
|
|
183
310
|
}
|
|
@@ -193,7 +320,6 @@ export interface EtaOptions extends Partial<EtaConfig> {
|
|
|
193
320
|
}
|
|
194
321
|
export declare class EtaService {
|
|
195
322
|
#private;
|
|
196
|
-
constructor();
|
|
197
323
|
/**
|
|
198
324
|
* Render an Eta template from a string
|
|
199
325
|
* @param template The template string to render
|
|
@@ -248,6 +374,37 @@ export declare class HandlebarsService {
|
|
|
248
374
|
renderFile(file: string, parameters?: unknown, options?: HandlebarsOptions): string;
|
|
249
375
|
}
|
|
250
376
|
//#endregion
|
|
377
|
+
//#region src/puppeteer/engines/liquid/liquid.service.d.ts
|
|
378
|
+
export type LiquidOptions = LiquidOptions$1;
|
|
379
|
+
export declare class LiquidService {
|
|
380
|
+
#private;
|
|
381
|
+
/**
|
|
382
|
+
* Render a Liquid template from a string
|
|
383
|
+
* @param template The template string to render
|
|
384
|
+
* @param data The data object to use for rendering
|
|
385
|
+
* @param options Optional Liquid engine options
|
|
386
|
+
* @returns The rendered HTML string
|
|
387
|
+
*/
|
|
388
|
+
render(template: string, data?: Record<string, unknown>, options?: LiquidOptions): string;
|
|
389
|
+
/**
|
|
390
|
+
* Render a Liquid template from a file
|
|
391
|
+
* @param filePath The path to the template file
|
|
392
|
+
* @param data The data object to use for rendering
|
|
393
|
+
* @param options Optional Liquid engine options
|
|
394
|
+
* @returns The rendered HTML string
|
|
395
|
+
*/
|
|
396
|
+
renderFile(filePath: string, data?: Record<string, unknown>, options?: LiquidOptions): string;
|
|
397
|
+
/**
|
|
398
|
+
* Clear the template cache
|
|
399
|
+
*/
|
|
400
|
+
clearCache(): void;
|
|
401
|
+
/**
|
|
402
|
+
* Get the current cache size
|
|
403
|
+
* @returns The number of cached templates
|
|
404
|
+
*/
|
|
405
|
+
getCacheSize(): number;
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
251
408
|
//#region src/puppeteer/engines/mustache/mustache.service.d.ts
|
|
252
409
|
export interface MustacheOptions {
|
|
253
410
|
tags?: [string, string];
|
|
@@ -291,7 +448,7 @@ export interface NunjucksOptions extends Partial<ConfigureOptions> {
|
|
|
291
448
|
lstripBlocks?: boolean;
|
|
292
449
|
}
|
|
293
450
|
export declare class NunjucksService {
|
|
294
|
-
|
|
451
|
+
#private;
|
|
295
452
|
render(template: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
|
|
296
453
|
renderFile(filePath: string, data?: Record<string, unknown>, options?: NunjucksOptions): string;
|
|
297
454
|
}
|
|
@@ -299,6 +456,7 @@ export declare class NunjucksService {
|
|
|
299
456
|
//#region src/puppeteer/engines/pug/pug.service.d.ts
|
|
300
457
|
export type PugOptions = Options$1;
|
|
301
458
|
export declare class PugService {
|
|
459
|
+
#private;
|
|
302
460
|
render(template: string, data?: LocalsObject, options?: PugOptions): string;
|
|
303
461
|
renderFile(filePath: string, data?: LocalsObject, options?: PugOptions): string;
|
|
304
462
|
}
|
|
@@ -321,6 +479,7 @@ export interface PuppeteerParameters {
|
|
|
321
479
|
nunjucksOptions?: NunjucksOptions;
|
|
322
480
|
etaOptions?: EtaOptions;
|
|
323
481
|
mustacheOptions?: MustacheOptions;
|
|
482
|
+
liquidOptions?: LiquidOptions;
|
|
324
483
|
chromiumRevision?: string;
|
|
325
484
|
buildId?: string;
|
|
326
485
|
headless?: boolean | 'shell';
|
|
@@ -345,6 +504,7 @@ export declare class NestjsPdfModule {
|
|
|
345
504
|
//#endregion
|
|
346
505
|
//#region src/puppeteer/engines/mjml/mjml.service.d.ts
|
|
347
506
|
export declare class MjmlService {
|
|
507
|
+
#private;
|
|
348
508
|
render(template: string, options?: MJMLParsingOptions): Promise<string>;
|
|
349
509
|
renderFile(filePath: string, options?: MJMLParsingOptions): Promise<string>;
|
|
350
510
|
}
|
|
@@ -352,7 +512,7 @@ export declare class MjmlService {
|
|
|
352
512
|
//#region src/puppeteer/puppeteer.service.d.ts
|
|
353
513
|
export declare class PuppeteerService {
|
|
354
514
|
#private;
|
|
355
|
-
constructor(browserService: BrowserService, options: PuppeteerParameters, hbsService?: HandlebarsService, mjmlService?: MjmlService, pugService?: PugService, ejsService?: EjsService, nunjucksService?: NunjucksService, etaService?: EtaService, mustacheService?: MustacheService);
|
|
515
|
+
constructor(browserService: BrowserService, options: PuppeteerParameters, hbsService?: HandlebarsService, mjmlService?: MjmlService, pugService?: PugService, ejsService?: EjsService, nunjucksService?: NunjucksService, etaService?: EtaService, mustacheService?: MustacheService, liquidService?: LiquidService);
|
|
356
516
|
generatePdfFromHtml(html: string, options?: PuppeteerParameters): Promise<Uint8Array>;
|
|
357
517
|
generatePdfFromTemplateHbsString(template: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
358
518
|
generatePdfFromTemplateHbsFile(file: string, parameters?: any, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
@@ -368,6 +528,8 @@ export declare class PuppeteerService {
|
|
|
368
528
|
generatePdfFromEtaFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
369
529
|
generatePdfFromMustacheString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
370
530
|
generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
531
|
+
generatePdfFromLiquidString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
532
|
+
generatePdfFromLiquidFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
371
533
|
}
|
|
372
534
|
//#endregion
|
|
373
535
|
//#region src/nestjs-pdf.service.d.ts
|
|
@@ -491,6 +653,22 @@ export declare class NestjsPdfService {
|
|
|
491
653
|
* @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
492
654
|
*/
|
|
493
655
|
generatePdfFromMustacheFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
656
|
+
/**
|
|
657
|
+
* @param template Liquid template string
|
|
658
|
+
* @param data Data to inject into the template
|
|
659
|
+
* @param options PDF generation options (optional)
|
|
660
|
+
* @returns PDF generated from the provided Liquid template with data applied
|
|
661
|
+
* @description This method generates a PDF from a Liquid template provided as a string. Liquid is a safe, Shopify-compatible template language with filters, tags, partials and layouts. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
662
|
+
*/
|
|
663
|
+
generatePdfFromLiquidString(template: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
664
|
+
/**
|
|
665
|
+
* @param file Path to the Liquid template file
|
|
666
|
+
* @param data Data to inject into the template
|
|
667
|
+
* @param options PDF generation options (optional)
|
|
668
|
+
* @returns PDF generated from the Liquid template at the provided file path with data applied
|
|
669
|
+
* @description This method generates a PDF from a Liquid template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
|
|
670
|
+
*/
|
|
671
|
+
generatePdfFromLiquidFile(file: string, data?: Record<string, unknown>, options?: PuppeteerParameters): Promise<Uint8Array<ArrayBufferLike>>;
|
|
494
672
|
/**
|
|
495
673
|
* @param pdf The PDF bytes to modify
|
|
496
674
|
* @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/exceptions/nestjs-pdf.exception.ts","../src/exceptions/browser-installation.exception.ts","../src/exceptions/browser-unavailable.exception.ts","../src/exceptions/engine-not-available.exception.ts","../src/exceptions/pdf-generation.exception.ts","../src/exceptions/signature-dependency.exception.ts","../src/exceptions/signature-placement.exception.ts","../src/exceptions/template-configuration.exception.ts","../src/exceptions/template-render.exception.ts","../src/exceptions/watermark.exception.ts","../src/helpers/getRelativePath.helper.ts","../src/helpers/request-guard.helper.ts","../src/helpers/watermark.helper.ts","../src/puppeteer/browser/browser.service.ts","../src/puppeteer/engines/ejs/ejs.service.ts","../src/puppeteer/engines/eta/eta.service.ts","../src/puppeteer/engines/handlebars/handlebars.service.ts","../src/puppeteer/engines/mustache/mustache.service.ts","../src/puppeteer/engines/nunjucks/nunjucks.service.ts","../src/puppeteer/engines/pug/pug.service.ts","../src/puppeteer/puppeteer-parameters.interface.ts","../src/nestjs-pdf.module.ts","../src/puppeteer/engines/mjml/mjml.service.ts","../src/puppeteer/puppeteer.service.ts","../src/nestjs-pdf.service.ts","../src/puppeteer/puppeteer.module.ts"],"mappings":";;;;;;;;;;;;oBAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;8BAGoB,2BAA2B;oBAC7B,MAAM;EAEZ,YAAA,iBAAiB;IAAY;;;;;qBCb9B,qCAAqC;WACvC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["BrowserType","LiquidJsOptions","Options","Browser"],"sources":["../src/exceptions/nestjs-pdf.exception.ts","../src/exceptions/browser-installation.exception.ts","../src/exceptions/browser-unavailable.exception.ts","../src/exceptions/engine-not-available.exception.ts","../src/exceptions/pdf-generation.exception.ts","../src/exceptions/signature-dependency.exception.ts","../src/exceptions/signature-placement.exception.ts","../src/exceptions/template-configuration.exception.ts","../src/exceptions/template-render.exception.ts","../src/exceptions/watermark.exception.ts","../src/helpers/getRelativePath.helper.ts","../src/helpers/request-guard.helper.ts","../src/helpers/watermark.helper.ts","../node_modules/.pnpm/@types+mjml-core@5.1.0/node_modules/@types/mjml-core/index.d.ts","../src/puppeteer/browser/browser.service.ts","../src/puppeteer/engines/ejs/ejs.service.ts","../src/puppeteer/engines/eta/eta.service.ts","../src/puppeteer/engines/handlebars/handlebars.service.ts","../src/puppeteer/engines/liquid/liquid.service.ts","../src/puppeteer/engines/mustache/mustache.service.ts","../src/puppeteer/engines/nunjucks/nunjucks.service.ts","../src/puppeteer/engines/pug/pug.service.ts","../src/puppeteer/puppeteer-parameters.interface.ts","../src/nestjs-pdf.module.ts","../src/puppeteer/engines/mjml/mjml.service.ts","../src/puppeteer/puppeteer.service.ts","../src/nestjs-pdf.service.ts","../src/puppeteer/puppeteer.module.ts"],"ignoreList":[13],"mappings":";;;;;;;;;;;;oBAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;8BAGoB,2BAA2B;oBAC7B,MAAM;EAEZ,YAAA,iBAAiB;IAAY;;;;;qBCb9B,qCAAqC;WACvC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;EAGX,YAAA,oBACA,sBACA;IAAY;;;;;qBCNH,+BAA+B;WACjC,OAAI,mBAAA;;;;qBCDF,qCAAqC;WACvC,OAAI,mBAAA;;;;qBCDF,oCAAoC;WACtC,OAAI,mBAAA;;;;qBCDF,uCAAuC;WACzC,OAAI,mBAAA;;;;qBCDF,gCAAgC;WAIzB;WAHT,OAAI,mBAAA;EAGK,YAAA,gBAChB,iBACA;IAAY;;;;;qBCNH,2BAA2B;WAC7B,OAAI,mBAAA;;;;;;;;;;;;;wBCQC,uBACd,mBACA;;;;;;;UCYe;;;;;EAKf;;;;;EAKA,eAAe;;;;;EAKf,mBAAmB;;EAEnB;;;;UC/Be;;EAEf;;EAEA,QAAQ,aAAa;;EAErB;;EAEA;;EAEA;;EAEA,oBAAoB;;EAEpB;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;;;;;;;;UCnBO;;;;;;;EAOb;KAAW;;;;;;EAMX;;;;;;;EAQA;;;;;;EAOA;;;;;;EAOA,gBAAgB;;;;;;;;;;EAWhB;;;;;EAMA;;;;;;EAMA;;;;;EAKA;;;;;;EAOA;;;;EAKA;KAAuB;MAAkB;MAAe;;;EACxD;;;;;;EAOA;EAEA;;;;;;EAMA;;;;EAIA,gBAAgB,QAAQ;;;;;EAMxB;;UAGa;EACb;;;;;;EAMA;IAAiC;IAAc;IAAiB;;;EAEhE;EACA;EACA;EACA;;;;aC5GQ;EACV;EACA;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