Compare commits

..

10 Commits

Author SHA1 Message Date
57851d90a5 3.0.11 2022-09-15 20:52:22 +02:00
1e4b16b734 fix(core): update 2022-09-15 20:52:22 +02:00
876466b18d 3.0.10 2022-09-13 18:39:38 +02:00
82b1c187ee fix(core): update 2022-09-13 18:39:38 +02:00
4f93d258b8 3.0.9 2022-09-13 18:26:15 +02:00
60993fc005 fix(core): update 2022-09-13 18:26:14 +02:00
db4965c8f5 3.0.8 2022-09-05 01:02:05 +02:00
36a964d931 fix(core): update 2022-09-05 01:02:05 +02:00
6d90f4c9b4 3.0.7 2022-06-29 00:24:44 +02:00
839eafd73f fix(core): update 2022-06-29 00:24:43 +02:00
5 changed files with 4341 additions and 1911 deletions

6222
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartpdf", "name": "@pushrocks/smartpdf",
"version": "3.0.6", "version": "3.0.11",
"private": false, "private": false,
"description": "create pdfs on the fly", "description": "create pdfs on the fly",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -13,21 +13,22 @@
"build": "(tsbuild --web --allowimplicitany)" "build": "(tsbuild --web --allowimplicitany)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.63", "@gitzone/tsbuild": "^2.1.65",
"@gitzone/tsrun": "^1.2.35", "@gitzone/tsrun": "^1.2.35",
"@gitzone/tstest": "^1.0.71", "@gitzone/tstest": "^1.0.73",
"@pushrocks/tapbundle": "^5.0.3", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^17.0.42" "@types/node": "^18.7.18"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^10.0.2", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartfile": "^10.0.5",
"@pushrocks/smartnetwork": "^3.0.0", "@pushrocks/smartnetwork": "^3.0.0",
"@pushrocks/smartpath": "^5.0.5", "@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartpromise": "^3.1.7", "@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartpuppeteer": "^2.0.0", "@pushrocks/smartpuppeteer": "^2.0.2",
"@pushrocks/smartunique": "^3.0.3", "@pushrocks/smartunique": "^3.0.3",
"@tsclass/tsclass": "^4.0.15", "@tsclass/tsclass": "^4.0.21",
"@types/express": "^4.17.13", "@types/express": "^4.17.14",
"express": "^4.18.1", "express": "^4.18.1",
"pdf-merger-js": "^3.4.0", "pdf-merger-js": "^3.4.0",
"pdf2json": "^2.0.0" "pdf2json": "^2.0.0"

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartpdf', name: '@pushrocks/smartpdf',
version: '3.0.6', version: '3.0.11',
description: 'create pdfs on the fly' description: 'create pdfs on the fly'
} }

View File

@ -26,6 +26,7 @@ export class SmartPdf {
} }
async start(headlessBrowserArg?: plugins.smartpuppeteer.puppeteer.Browser) { async start(headlessBrowserArg?: plugins.smartpuppeteer.puppeteer.Browser) {
const done = plugins.smartpromise.defer();
// lets set the external browser in case one is provided // lets set the external browser in case one is provided
this.headlessBrowser = headlessBrowserArg; this.headlessBrowser = headlessBrowserArg;
// setup puppeteer // setup puppeteer
@ -49,7 +50,9 @@ export class SmartPdf {
this.htmlServerInstance.listen(3210, 'localhost'); this.htmlServerInstance.listen(3210, 'localhost');
this.htmlServerInstance.on('listening', () => { this.htmlServerInstance.on('listening', () => {
this._readyDeferred.resolve(); this._readyDeferred.resolve();
done.resolve();
}); });
await done.promise;
} }
// stop // stop
@ -81,6 +84,7 @@ export class SmartPdf {
const response = await page.goto(`http://localhost:3210/${pdfCandidate.pdfId}`, { const response = await page.goto(`http://localhost:3210/${pdfCandidate.pdfId}`, {
waitUntil: 'networkidle2', waitUntil: 'networkidle2',
}); });
// await plugins.smartdelay.delayFor(1000);
const headers = response.headers(); const headers = response.headers();
if (headers['pdf-id'] !== pdfCandidate.pdfId) { if (headers['pdf-id'] !== pdfCandidate.pdfId) {
console.log('Error! Headers do not match. For security reasons no pdf is being emitted!'); console.log('Error! Headers do not match. For security reasons no pdf is being emitted!');
@ -182,7 +186,7 @@ export class SmartPdf {
public async mergePdfs(pdfArrayArg: plugins.tsclass.business.IPdf[]): Promise<IPdf> { public async mergePdfs(pdfArrayArg: plugins.tsclass.business.IPdf[]): Promise<IPdf> {
const merger = new plugins.pdfMerger(); const merger = new plugins.pdfMerger();
for (const pdf of pdfArrayArg) { for (const pdf of pdfArrayArg) {
merger.add(pdf.buffer as Buffer); merger.add(Buffer.from(pdf.buffer));
} }
const resultBuffer = await merger.saveAsBuffer(); const resultBuffer = await merger.saveAsBuffer();
return { return {

View File

@ -6,13 +6,14 @@ export { http, path };
// @pushrocks // @pushrocks
import * as smartfile from '@pushrocks/smartfile'; import * as smartfile from '@pushrocks/smartfile';
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartpath from '@pushrocks/smartpath'; import * as smartpath from '@pushrocks/smartpath';
import * as smartpuppeteer from '@pushrocks/smartpuppeteer'; import * as smartpuppeteer from '@pushrocks/smartpuppeteer';
import * as smartnetwork from '@pushrocks/smartnetwork'; import * as smartnetwork from '@pushrocks/smartnetwork';
import * as smartunique from '@pushrocks/smartunique'; import * as smartunique from '@pushrocks/smartunique';
export { smartfile, smartpromise, smartpath, smartpuppeteer, smartunique, smartnetwork }; export { smartfile, smartdelay, smartpromise, smartpath, smartpuppeteer, smartunique, smartnetwork };
// tsclass scope // tsclass scope
import * as tsclass from '@tsclass/tsclass'; import * as tsclass from '@tsclass/tsclass';