fix(core): update

This commit is contained in:
2023-10-16 18:28:12 +02:00
commit 20ffd067b2
37 changed files with 7618 additions and 0 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@design.estate/dees-document',
version: '1.0.91',
description: 'a catalog for creating documents like invoices'
}

51
ts/classes.pdfservice.ts Normal file
View File

@ -0,0 +1,51 @@
import * as plugins from './plugins.js';
import * as paths from './paths.js';
import * as helpers from './helpers.js';
export interface IPdfServiceConstructorOptions {
}
/**
* a pdf service for generating pdfs
*/
export class PdfService {
// INSTANCE
options: IPdfServiceConstructorOptions;
public smartpdfInstance: plugins.smartpdf.SmartPdf;
constructor(optionsArg: IPdfServiceConstructorOptions) {
this.options = optionsArg;
}
/**
* starts the PdfService
*/
public async start() {
this.smartpdfInstance = new plugins.smartpdf.SmartPdf();
await this.smartpdfInstance.start();
}
/**
* stops the PdfService
*/
public async stop() {
await this.smartpdfInstance.stop();
}
/**
* creates an letter
*/
public async createPdfFromLetterObject(letterDataArg: plugins.tsclass.business.ILetter) {
const html = `
<script type="module">
${await helpers.getBundleAsString()}
</script>
<dedocument-dedocument printMode letterData="${plugins.smartjson.stringifyBase64(letterDataArg)}"></dedocument-dedocument>
`;
// console.log(html);
const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(html);
return pdfResult;
}
}

6
ts/helpers.ts Normal file
View File

@ -0,0 +1,6 @@
import * as plugins from './plugins.js';
import * as paths from './paths.js';
export const getBundleAsString = async () => {
return plugins.smartfile.fs.toStringSync(paths.bundleFile);
}

2
ts/index.ts Normal file
View File

@ -0,0 +1,2 @@
export * from './helpers.js';
export * from './classes.pdfservice.js';

9
ts/paths.ts Normal file
View File

@ -0,0 +1,9 @@
import * as plugins from './plugins.js';
export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
export const nogitDir = plugins.path.join(packageDir, '.nogit/');
plugins.smartfile.fs.ensureDirSync(nogitDir);
export const bundleDir = plugins.path.join(packageDir, './dist_bundle');
export const bundleFile = plugins.path.join(bundleDir, './bundle.js');

26
ts/plugins.ts Normal file
View File

@ -0,0 +1,26 @@
// node native
import * as path from 'path';
export {
path
}
// @push.rocks/scope
import * as smartfile from '@push.rocks/smartfile';
import * as smartjson from '@push.rocks/smartjson';
import * as smartpath from '@push.rocks/smartpath';
import * as smartpdf from '@push.rocks/smartpdf';
export {
smartfile,
smartpath,
smartjson,
smartpdf,
}
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';
export {
tsclass,
}