idea-html2pdf
Advanced tools
Comparing version 1.2.1 to 1.3.0
/// <reference types="node" /> | ||
import { Lambda } from 'aws-sdk'; | ||
import { S3, Lambda } from 'aws-sdk'; | ||
import { SafeString, HelperDelegate } from 'handlebars'; | ||
import { S3 } from 'idea-aws'; | ||
import { Languages, SignedURL } from 'idea-toolbox'; | ||
@@ -59,6 +58,5 @@ /** | ||
* @param alternativeLambda an alternative lambda function to use to generate the PDF | ||
* @param downloadOptions the parameters create the download link | ||
* @return the URL to download the PDF | ||
*/ | ||
createLink(params: HTML2PDFParameters, alternativeLambda?: string, downloadOptions?: any): Promise<SignedURL>; | ||
createLink(params: HTML2PDFParameters, alternativeLambda?: string): Promise<SignedURL>; | ||
/** | ||
@@ -65,0 +63,0 @@ * Helper function to prepare Handlebar's helper for the `PDFTemplateSection` standard. |
@@ -6,3 +6,2 @@ "use strict"; | ||
const handlebars_1 = require("handlebars"); | ||
const idea_aws_1 = require("idea-aws"); | ||
const idea_toolbox_1 = require("idea-toolbox"); | ||
@@ -26,3 +25,3 @@ // declare libs as global vars to be reused in warm starts by the Lambda function | ||
if (!ideaWarmStart_s3) | ||
ideaWarmStart_s3 = new idea_aws_1.S3(); | ||
ideaWarmStart_s3 = new aws_sdk_1.S3({ apiVersion: '2006-03-01', signatureVersion: 'v4' }); | ||
this.s3 = ideaWarmStart_s3; | ||
@@ -91,3 +90,3 @@ if (!ideaWarmStart_lambda) | ||
const s3params = JSON.parse(result.Payload); | ||
const s3Obj = await this.s3.getObject(s3params); | ||
const s3Obj = await this.s3.getObject(s3params).promise(); | ||
return s3Obj.Body; | ||
@@ -104,8 +103,11 @@ } | ||
* @param alternativeLambda an alternative lambda function to use to generate the PDF | ||
* @param downloadOptions the parameters create the download link | ||
* @return the URL to download the PDF | ||
*/ | ||
async createLink(params, alternativeLambda, downloadOptions) { | ||
async createLink(params, alternativeLambda) { | ||
const pdfData = await this.create(params, alternativeLambda); | ||
return this.s3.createDownloadURLFromData(pdfData, downloadOptions); | ||
const Key = 'html2pdf'.concat(new Date().getTime().toString().concat(Math.random().toString(36).slice(2)), '.pdf'); | ||
const Bucket = 'idea-downloads'; | ||
const Expires = 60; | ||
await this.s3.upload({ Bucket, Key, Body: pdfData }).promise(); | ||
return new idea_toolbox_1.SignedURL({ url: this.s3.getSignedUrl('getObject', { Bucket, Key, Expires }) }); | ||
} | ||
@@ -112,0 +114,0 @@ /** |
{ | ||
"name": "idea-html2pdf", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "IDEA helper for generating a PDF from HTML contents", | ||
@@ -35,3 +35,2 @@ "engines": { | ||
"handlebars": "^4.7.7", | ||
"idea-aws": "3.6.3", | ||
"idea-toolbox": "6.3.2" | ||
@@ -38,0 +37,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25092
2
- Removedidea-aws@3.6.3
- Removedidea-aws@3.6.3(transitive)
- Removednanoid@2.1.113.3.7(transitive)
- Removednodemailer@6.9.16(transitive)
- Removedshortid@2.2.16(transitive)
- Removeduuid@3.4.0(transitive)