page2pdf_server 1.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/.babelrc +3 -0
- package/.eslintrc +33 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
- package/.github/ISSUE_TEMPLATE/refactoring.md +15 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- package/.github/stale.yml +17 -0
- package/.github/workflows/cd.yml +75 -0
- package/.github/workflows/ci.yml +36 -0
- package/.husky/pre-commit +6 -0
- package/.husky/pre-push +4 -0
- package/.idea/codeStyles/Project.xml +58 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/encodings.xml +7 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/page2pdf-server.iml +12 -0
- package/.idea/tenstack-starter-main.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/.prettierrc +8 -0
- package/.vscode/settings.json +3 -0
- package/LICENSE +18 -0
- package/README.md +238 -0
- package/__tests__/UrltoPdf/generatePdf.test.ts +207 -0
- package/__tests__/UrltoPdf/pdfSplit.test.ts +69 -0
- package/__tests__/helpers/index.ts +21 -0
- package/__tests__/home.test.ts +77 -0
- package/config/default.json +10 -0
- package/config/development.json +3 -0
- package/config/production.json +3 -0
- package/config/test.json +3 -0
- package/ecosystem.config.js +41 -0
- package/eslintrc.json +14 -0
- package/jest.config.js +35 -0
- package/nodemon.json +6 -0
- package/package.json +105 -0
- package/src/CSS/345/205/274/345/256/271/346/200/247.txt +56 -0
- package/src/app.ts +41 -0
- package/src/components/home/controller.ts +27 -0
- package/src/components/home/index.ts +4 -0
- package/src/components/home/pdfController.ts +112 -0
- package/src/components/home/services.ts +31 -0
- package/src/components/home/splitController.ts +124 -0
- package/src/components/home/validators.ts +12 -0
- package/src/configEnv/index.ts +62 -0
- package/src/db/home.ts +14 -0
- package/src/helpers/apiResponse.ts +10 -0
- package/src/helpers/dataSanitizers.ts +31 -0
- package/src/helpers/error/ApiError.ts +25 -0
- package/src/helpers/error/ForbiddenError.ts +15 -0
- package/src/helpers/error/NotFoundException.ts +15 -0
- package/src/helpers/error/TimeOutError.ts +20 -0
- package/src/helpers/error/UnauthorizedError.ts +15 -0
- package/src/helpers/error/ValidationError.ts +20 -0
- package/src/helpers/error/index.ts +15 -0
- package/src/helpers/index.ts +2 -0
- package/src/helpers/loggers.ts +73 -0
- package/src/index.ts +13 -0
- package/src/middlewares/errorHandler.ts +52 -0
- package/src/new_tab1.mhtml +722 -0
- package/src/routes/index.ts +22 -0
- package/src/server.ts +30 -0
- package/src/testCSS.html +241 -0
- package/src/types/global.d.ts +13 -0
- package/src/types/request/home.ts +166 -0
- package/src/types/request/split.ts +18 -0
- package/src/types/response/AppInformation.ts +9 -0
- package/src/types/response/index.ts +5 -0
- package/src/utils/array.ts +19 -0
- package/src/utils/auth.ts +12 -0
- package/src/utils/crypt.ts +26 -0
- package/src/utils/filter.ts +59 -0
- package/src/utils/object.ts +58 -0
- package/src/utils/pdfgen.ts +998 -0
- package/src/utils/url.ts +54 -0
- package/src//346/265/213/350/257/225.txt +241 -0
- package/tsconfig.json +41 -0
- package/tslint.json +22 -0
- package//346/226/207/344/271/246/346/211/223/345/215/260/350/275/254/346/215/242/345/231/250.bat +2 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { differenceBy, intersectionBy } from "lodash-es";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the copy of object without attributes.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} obj
|
|
7
|
+
* @param {Array} attrsToExclude
|
|
8
|
+
* @return {Object}
|
|
9
|
+
*/
|
|
10
|
+
export const withoutAttrs = (obj: any, attrsToExclude: any[]) => {
|
|
11
|
+
const result: any = {};
|
|
12
|
+
|
|
13
|
+
Object.keys(obj).forEach((key: string) => {
|
|
14
|
+
if (!attrsToExclude.includes(key)) {
|
|
15
|
+
result[key] = obj[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get the copy of object with only specified attributes.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} obj
|
|
26
|
+
* @param {Array} attrs
|
|
27
|
+
* @return {Object}
|
|
28
|
+
*/
|
|
29
|
+
export const withOnlyAttrs = (obj: any, attrs: any[]) => {
|
|
30
|
+
const result: any = {};
|
|
31
|
+
|
|
32
|
+
Object.keys(obj).forEach((key) => {
|
|
33
|
+
if (attrs.includes(key)) {
|
|
34
|
+
result[key] = obj[key];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Compare array of two objects and find data that needs to be create, update
|
|
43
|
+
* and delete.
|
|
44
|
+
*
|
|
45
|
+
* @param {Array} list1
|
|
46
|
+
* @param {Array} list2
|
|
47
|
+
* @param {String} key
|
|
48
|
+
* @returns {Object}
|
|
49
|
+
*/
|
|
50
|
+
export const difference = (list1: any[], list2: any[], key = "id") => {
|
|
51
|
+
return {
|
|
52
|
+
create: list2
|
|
53
|
+
.filter((obj) => obj.hasOwnProperty(key) && obj[key] === null)
|
|
54
|
+
.map((obj) => withoutAttrs(obj, [key])),
|
|
55
|
+
update: intersectionBy(list2, list1, key),
|
|
56
|
+
destroy: differenceBy(list1, list2, key).map((obj: any) => obj[key]),
|
|
57
|
+
};
|
|
58
|
+
};
|