@shad0wz7/nestjs-pdf 1.1.1 → 2.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/dist/index.js CHANGED
@@ -2574,9 +2574,11 @@ var require_config = __commonJS({
2574
2574
  // src/index.ts
2575
2575
  var index_exports = {};
2576
2576
  __export(index_exports, {
2577
+ EjsService: () => EjsService,
2578
+ MjmlService: () => MjmlService,
2577
2579
  NestjsPdfModule: () => NestjsPdfModule,
2578
2580
  NestjsPdfService: () => NestjsPdfService,
2579
- PuppeteerHandlebarsModule: () => PuppeteerHandlebarsModule,
2581
+ PugService: () => PugService,
2580
2582
  PuppeteerModule: () => PuppeteerModule,
2581
2583
  PuppeteerService: () => PuppeteerService,
2582
2584
  getRelativePathToValue: () => getRelativePathToValue
@@ -2584,13 +2586,13 @@ __export(index_exports, {
2584
2586
  module.exports = __toCommonJS(index_exports);
2585
2587
 
2586
2588
  // src/nestjs-pdf.module.ts
2587
- var import_common5 = require("@nestjs/common");
2589
+ var import_common8 = require("@nestjs/common");
2588
2590
 
2589
2591
  // src/nestjs-pdf.service.ts
2590
- var import_common3 = require("@nestjs/common");
2592
+ var import_common6 = require("@nestjs/common");
2591
2593
 
2592
2594
  // src/puppeteer/puppeteer.service.ts
2593
- var import_common2 = require("@nestjs/common");
2595
+ var import_common5 = require("@nestjs/common");
2594
2596
 
2595
2597
  // src/puppeteer/helpers/tokens.ts
2596
2598
  var PDF_PARAMETERS = "PDF_PARAMETERS";
@@ -2949,6 +2951,11 @@ __name(mergePuppeteerParameters, "mergePuppeteerParameters");
2949
2951
  // src/puppeteer/puppeteer.service.ts
2950
2952
  var import_p_limit = __toESM(require("p-limit"));
2951
2953
  var import_nestjs_hbs = require("@gboutte/nestjs-hbs");
2954
+
2955
+ // src/puppeteer/services/mjml.service.ts
2956
+ var import_common2 = require("@nestjs/common");
2957
+ var import_mjml = __toESM(require("mjml"));
2958
+ var import_node_fs = require("fs");
2952
2959
  function _ts_decorate2(decorators, target, key, desc) {
2953
2960
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2954
2961
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -2956,6 +2963,116 @@ function _ts_decorate2(decorators, target, key, desc) {
2956
2963
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2957
2964
  }
2958
2965
  __name(_ts_decorate2, "_ts_decorate");
2966
+ var MjmlService = class {
2967
+ static {
2968
+ __name(this, "MjmlService");
2969
+ }
2970
+ async render(template, options) {
2971
+ const { html } = await (0, import_mjml.default)(template, options);
2972
+ return html;
2973
+ }
2974
+ async renderFile(filePath, options) {
2975
+ const template = (0, import_node_fs.readFileSync)(filePath, "utf-8");
2976
+ return await this.render(template, options);
2977
+ }
2978
+ };
2979
+ MjmlService = _ts_decorate2([
2980
+ (0, import_common2.Injectable)()
2981
+ ], MjmlService);
2982
+
2983
+ // src/puppeteer/services/pug.service.ts
2984
+ var import_common3 = require("@nestjs/common");
2985
+ var import_pug = __toESM(require("pug"));
2986
+ var import_node_fs2 = require("fs");
2987
+ function _ts_decorate3(decorators, target, key, desc) {
2988
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2989
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2990
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2991
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2992
+ }
2993
+ __name(_ts_decorate3, "_ts_decorate");
2994
+ var PugService = class {
2995
+ static {
2996
+ __name(this, "PugService");
2997
+ }
2998
+ render(template, data = {}, options) {
2999
+ try {
3000
+ const compiledFn = import_pug.default.compile(template, {
3001
+ ...options
3002
+ });
3003
+ return compiledFn(data);
3004
+ } catch (error) {
3005
+ throw new Error(`Pug rendering failed: ${String(error)}`, {
3006
+ cause: error
3007
+ });
3008
+ }
3009
+ }
3010
+ renderFile(filePath, data = {}, options) {
3011
+ try {
3012
+ const template = (0, import_node_fs2.readFileSync)(filePath, "utf-8");
3013
+ return this.render(template, data, options);
3014
+ } catch (error) {
3015
+ throw new Error(`Pug file rendering failed: ${String(error)}`, {
3016
+ cause: error
3017
+ });
3018
+ }
3019
+ }
3020
+ };
3021
+ PugService = _ts_decorate3([
3022
+ (0, import_common3.Injectable)()
3023
+ ], PugService);
3024
+
3025
+ // src/puppeteer/services/ejs.service.ts
3026
+ var import_common4 = require("@nestjs/common");
3027
+ var import_ejs = require("ejs");
3028
+ function _ts_decorate4(decorators, target, key, desc) {
3029
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3030
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3031
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3032
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3033
+ }
3034
+ __name(_ts_decorate4, "_ts_decorate");
3035
+ var EjsService = class {
3036
+ static {
3037
+ __name(this, "EjsService");
3038
+ }
3039
+ async render(template, data = {}, options) {
3040
+ try {
3041
+ return await (0, import_ejs.render)(template, data, {
3042
+ async: true,
3043
+ ...options
3044
+ });
3045
+ } catch (error) {
3046
+ throw new Error(`EJS rendering failed: ${String(error)}`, {
3047
+ cause: error
3048
+ });
3049
+ }
3050
+ }
3051
+ async renderFile(filePath, data = {}, options) {
3052
+ try {
3053
+ return await (0, import_ejs.renderFile)(filePath, data, {
3054
+ async: true,
3055
+ ...options
3056
+ });
3057
+ } catch (error) {
3058
+ throw new Error(`EJS file rendering failed: ${String(error)}`, {
3059
+ cause: error
3060
+ });
3061
+ }
3062
+ }
3063
+ };
3064
+ EjsService = _ts_decorate4([
3065
+ (0, import_common4.Injectable)()
3066
+ ], EjsService);
3067
+
3068
+ // src/puppeteer/puppeteer.service.ts
3069
+ function _ts_decorate5(decorators, target, key, desc) {
3070
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3071
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3072
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3073
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3074
+ }
3075
+ __name(_ts_decorate5, "_ts_decorate");
2959
3076
  function _ts_metadata2(k, v) {
2960
3077
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2961
3078
  }
@@ -2973,17 +3090,23 @@ var PuppeteerService = class {
2973
3090
  hbsService;
2974
3091
  browserService;
2975
3092
  options;
2976
- constructor(hbsService, browserService, options) {
3093
+ mjmlService;
3094
+ pugService;
3095
+ ejsService;
3096
+ constructor(hbsService, browserService, options, mjmlService, pugService, ejsService) {
2977
3097
  this.hbsService = hbsService;
2978
3098
  this.browserService = browserService;
2979
3099
  this.options = options;
3100
+ this.mjmlService = mjmlService;
3101
+ this.pugService = pugService;
3102
+ this.ejsService = ejsService;
2980
3103
  }
2981
3104
  limit = (0, import_p_limit.default)(3);
2982
3105
  async generatePdfFromHtml(html, options) {
2983
3106
  return this.limit(async () => {
2984
3107
  const mergePuppeteerOptions = mergePuppeteerParameters(this.options, options);
2985
3108
  if (mergePuppeteerOptions.chromiumRevision !== void 0) {
2986
- import_common2.Logger.warn("Using `chromiumRevision` is no longer supported since the puppeteer update.");
3109
+ import_common5.Logger.warn("Using `chromiumRevision` is no longer supported since the puppeteer update.");
2987
3110
  }
2988
3111
  const headless = mergePuppeteerOptions.headless ?? true;
2989
3112
  const args = mergePuppeteerOptions.extraPuppeteerArgs || [
@@ -3043,37 +3166,85 @@ var PuppeteerService = class {
3043
3166
  await page.evaluate(() => document.fonts.ready);
3044
3167
  return await page.pdf(pdfOptions);
3045
3168
  } catch (e) {
3046
- import_common2.Logger.error(e);
3169
+ import_common5.Logger.error(e);
3047
3170
  throw e;
3048
3171
  } finally {
3049
3172
  if (context) {
3050
3173
  try {
3051
3174
  await context.close();
3052
3175
  } catch (error) {
3053
- import_common2.Logger.error(error);
3176
+ import_common5.Logger.error(error);
3054
3177
  }
3055
3178
  }
3056
3179
  await this.browserService.markJobFinished();
3057
3180
  }
3058
3181
  });
3059
3182
  }
3060
- async generatePdfFromTemplateString(template, parameters = {}, options) {
3183
+ async generatePdfFromTemplateHbsString(template, parameters = {}, options) {
3061
3184
  const html = this.hbsService.render(template, parameters);
3062
3185
  return this.generatePdfFromHtml(html, options);
3063
3186
  }
3064
- async generatePdfFromTemplateFile(file, parameters = {}, options) {
3187
+ async generatePdfFromTemplateHbsFile(file, parameters = {}, options) {
3065
3188
  const html = this.hbsService.renderFile(file, parameters);
3066
3189
  return this.generatePdfFromHtml(html, options);
3067
3190
  }
3191
+ async generatePdfFromMjmlString(template, options) {
3192
+ if (!this.mjmlService) {
3193
+ throw new Error("MJML service is not available. If the problem persists, open an issue in the repo.");
3194
+ }
3195
+ const html = await this.mjmlService.render(template, options?.mjmlOptions ?? this.options.mjmlOptions);
3196
+ return this.generatePdfFromHtml(html, options);
3197
+ }
3198
+ async generatePdfFromMjmlFile(file, options) {
3199
+ if (!this.mjmlService) {
3200
+ throw new Error("MJML service is not available. If the problem persists, open an issue in the repo.");
3201
+ }
3202
+ const html = await this.mjmlService.renderFile(file, options?.mjmlOptions ?? this.options.mjmlOptions);
3203
+ return this.generatePdfFromHtml(html, options);
3204
+ }
3205
+ async generatePdfFromPugString(template, data = {}, options) {
3206
+ if (!this.pugService) {
3207
+ throw new Error("Pug service is not available. If the problem persists, open an issue in the repo.");
3208
+ }
3209
+ const html = this.pugService.render(template, data, options?.pugOptions ?? this.options.pugOptions);
3210
+ return this.generatePdfFromHtml(html, options);
3211
+ }
3212
+ async generatePdfFromPugFile(file, data = {}, options) {
3213
+ if (!this.pugService) {
3214
+ throw new Error("Pug service is not available. If the problem persists, open an issue in the repo.");
3215
+ }
3216
+ const html = this.pugService.renderFile(file, data, options?.pugOptions ?? this.options.pugOptions);
3217
+ return this.generatePdfFromHtml(html, options);
3218
+ }
3219
+ async generatePdfFromEjsString(template, data = {}, options) {
3220
+ if (!this.ejsService) {
3221
+ throw new Error("EJS service is not available. If the problem persists, open an issue in the repo.");
3222
+ }
3223
+ const html = await this.ejsService.render(template, data, options?.ejsOptions ?? this.options.ejsOptions);
3224
+ return this.generatePdfFromHtml(html, options);
3225
+ }
3226
+ async generatePdfFromEjsFile(file, data = {}, options) {
3227
+ if (!this.ejsService) {
3228
+ throw new Error("EJS service is not available. If the problem persists, open an issue in the repo.");
3229
+ }
3230
+ const html = await this.ejsService.renderFile(file, data, options?.ejsOptions ?? this.options.ejsOptions);
3231
+ return this.generatePdfFromHtml(html, options);
3232
+ }
3068
3233
  };
3069
- PuppeteerService = _ts_decorate2([
3070
- (0, import_common2.Injectable)(),
3071
- _ts_param2(2, (0, import_common2.Inject)(PDF_PARAMETERS)),
3234
+ PuppeteerService = _ts_decorate5([
3235
+ (0, import_common5.Injectable)(),
3236
+ _ts_param2(2, (0, import_common5.Inject)(PDF_PARAMETERS)),
3237
+ _ts_param2(3, (0, import_common5.Optional)()),
3238
+ _ts_param2(4, (0, import_common5.Optional)()),
3239
+ _ts_param2(5, (0, import_common5.Optional)()),
3072
3240
  _ts_metadata2("design:type", Function),
3073
3241
  _ts_metadata2("design:paramtypes", [
3074
3242
  typeof import_nestjs_hbs.HandlebarsService === "undefined" ? Object : import_nestjs_hbs.HandlebarsService,
3075
3243
  typeof BrowserService === "undefined" ? Object : BrowserService,
3076
- typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters
3244
+ typeof PuppeteerParameters === "undefined" ? Object : PuppeteerParameters,
3245
+ typeof MjmlService === "undefined" ? Object : MjmlService,
3246
+ typeof PugService === "undefined" ? Object : PugService,
3247
+ typeof EjsService === "undefined" ? Object : EjsService
3077
3248
  ])
3078
3249
  ], PuppeteerService);
3079
3250
 
@@ -3231,13 +3402,13 @@ async function addSignatureFieldUsingAnchor(pdf, fieldName = "SignatureDebtor",
3231
3402
  __name(addSignatureFieldUsingAnchor, "addSignatureFieldUsingAnchor");
3232
3403
 
3233
3404
  // src/nestjs-pdf.service.ts
3234
- function _ts_decorate3(decorators, target, key, desc) {
3405
+ function _ts_decorate6(decorators, target, key, desc) {
3235
3406
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3236
3407
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3237
3408
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3238
3409
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3239
3410
  }
3240
- __name(_ts_decorate3, "_ts_decorate");
3411
+ __name(_ts_decorate6, "_ts_decorate");
3241
3412
  function _ts_metadata3(k, v) {
3242
3413
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3243
3414
  }
@@ -3260,6 +3431,7 @@ var NestjsPdfService = class {
3260
3431
  return this.puppeteerService.generatePdfFromHtml(html, options);
3261
3432
  }
3262
3433
  /**
3434
+ * @deprecated Use the new method generatePdfFromTemplateHbsString
3263
3435
  * @param template Handlebars template string
3264
3436
  * @param parameters Data parameters to inject into the template
3265
3437
  * @param options PDF generation options (optional)
@@ -3267,9 +3439,10 @@ var NestjsPdfService = class {
3267
3439
  * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3268
3440
  */
3269
3441
  generatePdfFromTemplateString(template, parameters = {}, options) {
3270
- return this.puppeteerService.generatePdfFromTemplateString(template, parameters, options);
3442
+ return this.generatePdfFromTemplateHbsString(template, parameters, options);
3271
3443
  }
3272
3444
  /**
3445
+ * @deprecated Use the new method generatePdfFromTemplateHbsFile
3273
3446
  * @param file Path to the Handlebars template file
3274
3447
  * @param parameters Data parameters to inject into the template
3275
3448
  * @param options PDF generation options (optional)
@@ -3277,7 +3450,85 @@ var NestjsPdfService = class {
3277
3450
  * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3278
3451
  */
3279
3452
  generatePdfFromTemplateFile(file, parameters = {}, options) {
3280
- return this.puppeteerService.generatePdfFromTemplateFile(file, parameters, options);
3453
+ return this.generatePdfFromTemplateHbsFile(file, parameters, options);
3454
+ }
3455
+ /**
3456
+ * @param template Handlebars template string
3457
+ * @param parameters Data parameters to inject into the template
3458
+ * @param options PDF generation options (optional)
3459
+ * @returns PDF generated from the provided Handlebars template with parameters applied
3460
+ * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3461
+ */
3462
+ generatePdfFromTemplateHbsString(template, parameters = {}, options) {
3463
+ return this.puppeteerService.generatePdfFromTemplateHbsString(template, parameters, options);
3464
+ }
3465
+ /**
3466
+ * @param file Path to the Handlebars template file
3467
+ * @param parameters Data parameters to inject into the template
3468
+ * @param options PDF generation options (optional)
3469
+ * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
3470
+ * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
3471
+ */
3472
+ generatePdfFromTemplateHbsFile(file, parameters = {}, options) {
3473
+ return this.puppeteerService.generatePdfFromTemplateHbsFile(file, parameters, options);
3474
+ }
3475
+ /**
3476
+ * @param template MJML template string
3477
+ * @param options PDF generation options (optional)
3478
+ * @returns PDF generated from the provided MJML template
3479
+ * @description This method generates a PDF from an MJML template provided as a string. MJML (MJML Markup Language) is a markup language designed to reduce the pain of coding a responsive email. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
3480
+ */
3481
+ generatePdfFromMjmlString(template, options) {
3482
+ return this.puppeteerService.generatePdfFromMjmlString(template, options);
3483
+ }
3484
+ /**
3485
+ * @param file Path to the MJML template file
3486
+ * @param options PDF generation options (optional)
3487
+ * @returns PDF generated from the MJML template at the provided file path
3488
+ * @description This method generates a PDF from an MJML template located at the specified file path. The file path is passed as a string in the `file` parameter. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
3489
+ */
3490
+ generatePdfFromMjmlFile(file, options) {
3491
+ return this.puppeteerService.generatePdfFromMjmlFile(file, options);
3492
+ }
3493
+ /**
3494
+ * @param template EJS template string
3495
+ * @param data Data to inject into the template
3496
+ * @param options PDF generation options (optional)
3497
+ * @returns PDF generated from the provided EJS template with data applied
3498
+ * @description This method generates a PDF from an EJS (Embedded JavaScript) template provided as a string. EJS is a templating language with a simple, straightforward syntax. 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.
3499
+ */
3500
+ generatePdfFromEjsString(template, data = {}, options) {
3501
+ return this.puppeteerService.generatePdfFromEjsString(template, data, options);
3502
+ }
3503
+ /**
3504
+ * @param file Path to the EJS template file
3505
+ * @param data Data to inject into the template
3506
+ * @param options PDF generation options (optional)
3507
+ * @returns PDF generated from the EJS template at the provided file path with data applied
3508
+ * @description This method generates a PDF from an EJS 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.
3509
+ */
3510
+ generatePdfFromEjsFile(file, data = {}, options) {
3511
+ return this.puppeteerService.generatePdfFromEjsFile(file, data, options);
3512
+ }
3513
+ /**
3514
+ * @param template Pug template string
3515
+ * @param data Data to inject into the template
3516
+ * @param options PDF generation options (optional)
3517
+ * @returns PDF generated from the provided Pug template with data applied
3518
+ * @description This method generates a PDF from a Pug template provided as a string. Pug is a clean, whitespace-sensitive syntax for writing HTML. 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.
3519
+ */
3520
+ generatePdfFromPugString(template, data = {}, options) {
3521
+ return this.puppeteerService.generatePdfFromPugString(template, data, options);
3522
+ }
3523
+ /**
3524
+ * @param file Path to the Pug template file
3525
+ * @param data Data to inject into the template
3526
+ * @param options PDF generation options (optional)
3527
+ * @returns PDF generated from the Pug template at the provided file path with data applied
3528
+ * @description This method generates a PDF from a Pug 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.
3529
+ */
3530
+ generatePdfFromPugFile(file, data = {}, options) {
3531
+ return this.puppeteerService.generatePdfFromPugFile(file, data, options);
3281
3532
  }
3282
3533
  /**
3283
3534
  * @param pdf The PDF bytes to modify
@@ -3305,8 +3556,8 @@ var NestjsPdfService = class {
3305
3556
  return await addSignatureFieldUsingAnchor(pdf, fieldName, anchorText);
3306
3557
  }
3307
3558
  };
3308
- NestjsPdfService = _ts_decorate3([
3309
- (0, import_common3.Injectable)(),
3559
+ NestjsPdfService = _ts_decorate6([
3560
+ (0, import_common6.Injectable)(),
3310
3561
  _ts_metadata3("design:type", Function),
3311
3562
  _ts_metadata3("design:paramtypes", [
3312
3563
  typeof PuppeteerService === "undefined" ? Object : PuppeteerService
@@ -3314,16 +3565,16 @@ NestjsPdfService = _ts_decorate3([
3314
3565
  ], NestjsPdfService);
3315
3566
 
3316
3567
  // src/puppeteer/puppeteer.module.ts
3317
- var import_common4 = require("@nestjs/common");
3568
+ var import_common7 = require("@nestjs/common");
3318
3569
  var import_config = __toESM(require_config());
3319
3570
  var import_nestjs_hbs2 = require("@gboutte/nestjs-hbs");
3320
- function _ts_decorate4(decorators, target, key, desc) {
3571
+ function _ts_decorate7(decorators, target, key, desc) {
3321
3572
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3322
3573
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3323
3574
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3324
3575
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3325
3576
  }
3326
- __name(_ts_decorate4, "_ts_decorate");
3577
+ __name(_ts_decorate7, "_ts_decorate");
3327
3578
  function _ts_metadata4(k, v) {
3328
3579
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3329
3580
  }
@@ -3357,7 +3608,10 @@ var PuppeteerModule = class _PuppeteerModule {
3357
3608
  provide: HANDLEBARS_PARAMETERS,
3358
3609
  useValue: pdfParameters.hbsOptions ?? {}
3359
3610
  },
3360
- import_nestjs_hbs2.HandlebarsService
3611
+ import_nestjs_hbs2.HandlebarsService,
3612
+ MjmlService,
3613
+ PugService,
3614
+ EjsService
3361
3615
  ];
3362
3616
  return {
3363
3617
  module: _PuppeteerModule,
@@ -3366,7 +3620,10 @@ var PuppeteerModule = class _PuppeteerModule {
3366
3620
  ],
3367
3621
  providers,
3368
3622
  exports: [
3369
- PuppeteerService
3623
+ PuppeteerService,
3624
+ MjmlService,
3625
+ PugService,
3626
+ EjsService
3370
3627
  ]
3371
3628
  };
3372
3629
  }
@@ -3394,25 +3651,37 @@ var PuppeteerModule = class _PuppeteerModule {
3394
3651
  hbsParamsProvider,
3395
3652
  PuppeteerService,
3396
3653
  BrowserService,
3397
- import_nestjs_hbs2.HandlebarsService
3654
+ import_nestjs_hbs2.HandlebarsService,
3655
+ MjmlService,
3656
+ PugService,
3657
+ EjsService
3398
3658
  ],
3399
3659
  exports: [
3400
- PuppeteerService
3660
+ PuppeteerService,
3661
+ MjmlService,
3662
+ PugService,
3663
+ EjsService
3401
3664
  ]
3402
3665
  };
3403
3666
  }
3404
3667
  };
3405
- PuppeteerModule = _ts_decorate4([
3406
- (0, import_common4.Module)({
3668
+ PuppeteerModule = _ts_decorate7([
3669
+ (0, import_common7.Module)({
3407
3670
  providers: [
3408
3671
  PuppeteerService,
3409
- BrowserService
3672
+ BrowserService,
3673
+ MjmlService,
3674
+ PugService,
3675
+ EjsService
3410
3676
  ],
3411
3677
  exports: [
3412
- PuppeteerService
3678
+ PuppeteerService,
3679
+ MjmlService,
3680
+ PugService,
3681
+ EjsService
3413
3682
  ]
3414
3683
  }),
3415
- _ts_param3(1, (0, import_common4.Inject)(PDF_PARAMETERS)),
3684
+ _ts_param3(1, (0, import_common7.Inject)(PDF_PARAMETERS)),
3416
3685
  _ts_metadata4("design:type", Function),
3417
3686
  _ts_metadata4("design:paramtypes", [
3418
3687
  typeof BrowserService === "undefined" ? Object : BrowserService,
@@ -3421,13 +3690,13 @@ PuppeteerModule = _ts_decorate4([
3421
3690
  ], PuppeteerModule);
3422
3691
 
3423
3692
  // src/nestjs-pdf.module.ts
3424
- function _ts_decorate5(decorators, target, key, desc) {
3693
+ function _ts_decorate8(decorators, target, key, desc) {
3425
3694
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3426
3695
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3427
3696
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3428
3697
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3429
3698
  }
3430
- __name(_ts_decorate5, "_ts_decorate");
3699
+ __name(_ts_decorate8, "_ts_decorate");
3431
3700
  var NestjsPdfModule = class _NestjsPdfModule {
3432
3701
  static {
3433
3702
  __name(this, "NestjsPdfModule");
@@ -3461,67 +3730,10 @@ var NestjsPdfModule = class _NestjsPdfModule {
3461
3730
  };
3462
3731
  }
3463
3732
  };
3464
- NestjsPdfModule = _ts_decorate5([
3465
- (0, import_common5.Module)({})
3733
+ NestjsPdfModule = _ts_decorate8([
3734
+ (0, import_common8.Module)({})
3466
3735
  ], NestjsPdfModule);
3467
3736
 
3468
- // src/puppeteer/external/puppeteer-handlebars.module.ts
3469
- var import_common6 = require("@nestjs/common");
3470
- var import_nestjs_hbs3 = require("@gboutte/nestjs-hbs");
3471
- function _ts_decorate6(decorators, target, key, desc) {
3472
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3473
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3474
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3475
- return c > 3 && r && Object.defineProperty(target, key, r), r;
3476
- }
3477
- __name(_ts_decorate6, "_ts_decorate");
3478
- var PuppeteerHandlebarsModule = class _PuppeteerHandlebarsModule {
3479
- static {
3480
- __name(this, "PuppeteerHandlebarsModule");
3481
- }
3482
- static forRoot(handlebarsOptions) {
3483
- return {
3484
- module: _PuppeteerHandlebarsModule,
3485
- providers: [
3486
- {
3487
- provide: "HANDLEBARS_PARAMETERS",
3488
- useValue: handlebarsOptions
3489
- }
3490
- ],
3491
- exports: [
3492
- import_nestjs_hbs3.HandlebarsService
3493
- ]
3494
- };
3495
- }
3496
- static forRootAsync(options) {
3497
- const provider = {
3498
- provide: "HANDLEBARS_PARAMETERS",
3499
- inject: options.inject ?? [],
3500
- useFactory: /* @__PURE__ */ __name(async (...args) => options.useFactory(...args), "useFactory")
3501
- };
3502
- return {
3503
- module: _PuppeteerHandlebarsModule,
3504
- imports: options.imports ?? [],
3505
- providers: [
3506
- provider
3507
- ],
3508
- exports: [
3509
- import_nestjs_hbs3.HandlebarsService
3510
- ]
3511
- };
3512
- }
3513
- };
3514
- PuppeteerHandlebarsModule = _ts_decorate6([
3515
- (0, import_common6.Module)({
3516
- providers: [
3517
- import_nestjs_hbs3.HandlebarsService
3518
- ],
3519
- exports: [
3520
- import_nestjs_hbs3.HandlebarsService
3521
- ]
3522
- })
3523
- ], PuppeteerHandlebarsModule);
3524
-
3525
3737
  // src/helpers/getRelativePath.helper.ts
3526
3738
  var import_node_path = require("path");
3527
3739
  function getRelativePathToValue(moduleDir, relativeToModule) {
@@ -3531,9 +3743,11 @@ function getRelativePathToValue(moduleDir, relativeToModule) {
3531
3743
  __name(getRelativePathToValue, "getRelativePathToValue");
3532
3744
  // Annotate the CommonJS export names for ESM import in node:
3533
3745
  0 && (module.exports = {
3746
+ EjsService,
3747
+ MjmlService,
3534
3748
  NestjsPdfModule,
3535
3749
  NestjsPdfService,
3536
- PuppeteerHandlebarsModule,
3750
+ PugService,
3537
3751
  PuppeteerModule,
3538
3752
  PuppeteerService,
3539
3753
  getRelativePathToValue