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.
Files changed (79) hide show
  1. package/.babelrc +3 -0
  2. package/.eslintrc +33 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
  5. package/.github/ISSUE_TEMPLATE/refactoring.md +15 -0
  6. package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
  7. package/.github/stale.yml +17 -0
  8. package/.github/workflows/cd.yml +75 -0
  9. package/.github/workflows/ci.yml +36 -0
  10. package/.husky/pre-commit +6 -0
  11. package/.husky/pre-push +4 -0
  12. package/.idea/codeStyles/Project.xml +58 -0
  13. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  14. package/.idea/encodings.xml +7 -0
  15. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  16. package/.idea/modules.xml +8 -0
  17. package/.idea/page2pdf-server.iml +12 -0
  18. package/.idea/tenstack-starter-main.iml +12 -0
  19. package/.idea/vcs.xml +6 -0
  20. package/.prettierrc +8 -0
  21. package/.vscode/settings.json +3 -0
  22. package/LICENSE +18 -0
  23. package/README.md +238 -0
  24. package/__tests__/UrltoPdf/generatePdf.test.ts +207 -0
  25. package/__tests__/UrltoPdf/pdfSplit.test.ts +69 -0
  26. package/__tests__/helpers/index.ts +21 -0
  27. package/__tests__/home.test.ts +77 -0
  28. package/config/default.json +10 -0
  29. package/config/development.json +3 -0
  30. package/config/production.json +3 -0
  31. package/config/test.json +3 -0
  32. package/ecosystem.config.js +41 -0
  33. package/eslintrc.json +14 -0
  34. package/jest.config.js +35 -0
  35. package/nodemon.json +6 -0
  36. package/package.json +105 -0
  37. package/src/CSS/345/205/274/345/256/271/346/200/247.txt +56 -0
  38. package/src/app.ts +41 -0
  39. package/src/components/home/controller.ts +27 -0
  40. package/src/components/home/index.ts +4 -0
  41. package/src/components/home/pdfController.ts +112 -0
  42. package/src/components/home/services.ts +31 -0
  43. package/src/components/home/splitController.ts +124 -0
  44. package/src/components/home/validators.ts +12 -0
  45. package/src/configEnv/index.ts +62 -0
  46. package/src/db/home.ts +14 -0
  47. package/src/helpers/apiResponse.ts +10 -0
  48. package/src/helpers/dataSanitizers.ts +31 -0
  49. package/src/helpers/error/ApiError.ts +25 -0
  50. package/src/helpers/error/ForbiddenError.ts +15 -0
  51. package/src/helpers/error/NotFoundException.ts +15 -0
  52. package/src/helpers/error/TimeOutError.ts +20 -0
  53. package/src/helpers/error/UnauthorizedError.ts +15 -0
  54. package/src/helpers/error/ValidationError.ts +20 -0
  55. package/src/helpers/error/index.ts +15 -0
  56. package/src/helpers/index.ts +2 -0
  57. package/src/helpers/loggers.ts +73 -0
  58. package/src/index.ts +13 -0
  59. package/src/middlewares/errorHandler.ts +52 -0
  60. package/src/new_tab1.mhtml +722 -0
  61. package/src/routes/index.ts +22 -0
  62. package/src/server.ts +30 -0
  63. package/src/testCSS.html +241 -0
  64. package/src/types/global.d.ts +13 -0
  65. package/src/types/request/home.ts +166 -0
  66. package/src/types/request/split.ts +18 -0
  67. package/src/types/response/AppInformation.ts +9 -0
  68. package/src/types/response/index.ts +5 -0
  69. package/src/utils/array.ts +19 -0
  70. package/src/utils/auth.ts +12 -0
  71. package/src/utils/crypt.ts +26 -0
  72. package/src/utils/filter.ts +59 -0
  73. package/src/utils/object.ts +58 -0
  74. package/src/utils/pdfgen.ts +998 -0
  75. package/src/utils/url.ts +54 -0
  76. package/src//346/265/213/350/257/225.txt +241 -0
  77. package/tsconfig.json +41 -0
  78. package/tslint.json +22 -0
  79. 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
package/.babelrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-typescript"]
3
+ }
package/.eslintrc ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "parserOptions": {
5
+ "ecmaVersion": "latest",
6
+ "sourceType": "module",
7
+ "project": "./tsconfig.json"
8
+ },
9
+ "plugins": ["import", "prettier"],
10
+ "ignorePatterns": ["node_modules/*", "dist/*", ".*", "jest*", "ecosystem*" ],
11
+ "extends": [
12
+ "plugin:@typescript-eslint/recommended",
13
+ "prettier"
14
+ ],
15
+ "rules": {
16
+ "@typescript-eslint/explicit-module-boundary-types": "off",
17
+ "@typescript-eslint/no-empty-interface": "off",
18
+ "@typescript-eslint/ban-types": "off",
19
+ "@typescript-eslint/ban-ts-comment": "off",
20
+ "@typescript-eslint/no-non-null-assertion": "off",
21
+ "@typescript-eslint/no-explicit-any": "off",
22
+ "@typescript-eslint/no-unused-vars": ["error", {
23
+ "argsIgnorePattern": "^_"
24
+ }],
25
+ "import/order": ["error"],
26
+ "prettier/prettier": [
27
+ "error",
28
+ {
29
+ "endOfLine": "auto"
30
+ }
31
+ ]
32
+ }
33
+ }
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ""
5
+ labels: "bug"
6
+ assignees: ""
7
+ ---
8
+
9
+ # Description
10
+
11
+ _A clear and concise description of what the bug is._
12
+
13
+ # Reproduction
14
+
15
+ _Steps to reproduce the behavior:_
16
+
17
+ _1. Go to '...'_
18
+ _2. Click on '....'_
19
+ _3. Scroll down to '....'_
20
+ _4. See error_
21
+
22
+ # Expected
23
+
24
+ _A clear and concise description of what you expected to happen._
25
+
26
+ # Screenshots
27
+
28
+ _If applicable, add screenshots to help explain your problem._
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ""
5
+ labels: "implementation"
6
+ assignees: ""
7
+ ---
8
+
9
+ # Request
10
+
11
+ _A clear and concise description of what the problem is._
12
+
13
+ # Suggestion
14
+
15
+ _A clear and concise description of what you want to happen._
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: Refactoring
3
+ about: Add content to be refactored
4
+ title: ""
5
+ labels: "refactoring"
6
+ assignees: ""
7
+ ---
8
+
9
+ # Refactor description
10
+
11
+ _A clear and concise description of the related Content._
12
+
13
+ # Refactor suggestion
14
+
15
+ _A clear and concise description of any alternative solutions or features you've considered._
@@ -0,0 +1,18 @@
1
+ # Description
2
+
3
+ _Explain briefly about the purpose & context of this PR_
4
+
5
+ # Screenshots
6
+
7
+ _If possible add a screenshot and/or gif_
8
+
9
+ # Example | Usage
10
+
11
+ _Please share examples and how to reproduce_
12
+
13
+ ---
14
+
15
+ # Related Issues | Pr
16
+
17
+ _`close`|`resolve` <ISSUE> (ex. `resolve #20`)_
18
+ _link issues to close automatically_
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 100
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
@@ -0,0 +1,75 @@
1
+ name: CD
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout repository
12
+ uses: actions/checkout@v2.3.4
13
+
14
+ - name: Set up Node.js
15
+ uses: actions/setup-node@v2.4.1
16
+ with:
17
+ node-version: 16
18
+
19
+ - name: Install Dependencies
20
+ run: yarn
21
+
22
+ - name: Run Lint
23
+ run: yarn lint
24
+
25
+ - name: Build module
26
+ run: yarn build
27
+
28
+ - name: Run Test code
29
+ run: yarn test
30
+
31
+ # ↓↓↓↓ Please edit below according your environment ↓↓↓↓
32
+ # deploy:
33
+ # runs-on: ubuntu-latest
34
+ # needs: test
35
+ # steps:
36
+ # - name: Checkout repository
37
+ # uses: actions/checkout@v2.3.4
38
+
39
+ # - name: Deploy DEVELOPMENT
40
+ # uses: appleboy/ssh-action@v0.1.4
41
+ # if: github.ref == 'refs/heads/develop'
42
+ # with:
43
+ # key: ${{ secrets.DEV_PEM_KEY }}
44
+ # host: ${{ secrets.DEV_HOST }}
45
+ # username: ubuntu
46
+ # script: |
47
+ # cd /home/ubuntu/source
48
+ # git checkout develop
49
+ # git fetch --all
50
+ # git reset --hard origin/develop
51
+ # git pull origin develop
52
+ # yarn
53
+ # yarn build
54
+ # export NODE_ENV=development && pm2 startOrReload ecosystem.config.js
55
+ # pm2 set pm2:autodump true
56
+ # pm2 save
57
+
58
+ # - name: Deploy PRODUCTION
59
+ # uses: appleboy/ssh-action@v0.1.4
60
+ # if: github.ref == 'refs/heads/main'
61
+ # with:
62
+ # key: ${{ secrets.PROD_PEM_KEY }}
63
+ # host: ${{ secrets.PROD_HOST }}
64
+ # username: ubuntu
65
+ # script: |
66
+ # cd /home/ubuntu/source
67
+ # git checkout main
68
+ # git fetch --all
69
+ # git reset --hard origin/main
70
+ # git pull origin main
71
+ # yarn
72
+ # yarn build
73
+ # export NODE_ENV=production && pm2 startOrReload ecosystem.config.js
74
+ # pm2 set pm2:autodump true
75
+ # pm2 save
@@ -0,0 +1,36 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ types: [ opened, synchronize, reopened ]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+
11
+ strategy:
12
+ matrix:
13
+ node-version: [ '16' ]
14
+
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v2.3.4
18
+
19
+ - name: Set up Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v2.4.1
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+
24
+ - name: Install Dependencies
25
+ run: yarn
26
+
27
+ - name: Run Lint
28
+ run: yarn lint
29
+
30
+ - name: Run Test code
31
+ run: yarn test
32
+
33
+ - name: Build module
34
+ run: yarn build
35
+
36
+
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn prettify
5
+ yarn lint:fix
6
+ git add
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn build
@@ -0,0 +1,58 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <HTMLCodeStyleSettings>
4
+ <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
+ <option name="HTML_ENFORCE_QUOTES" value="true" />
6
+ </HTMLCodeStyleSettings>
7
+ <JSCodeStyleSettings version="0">
8
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
9
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
10
+ <option name="FORCE_QUOTE_STYlE" value="true" />
11
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
12
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
+ </JSCodeStyleSettings>
15
+ <TypeScriptCodeStyleSettings version="0">
16
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
+ <option name="FORCE_QUOTE_STYlE" value="true" />
19
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
20
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
21
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
22
+ </TypeScriptCodeStyleSettings>
23
+ <VueCodeStyleSettings>
24
+ <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
25
+ <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
26
+ </VueCodeStyleSettings>
27
+ <codeStyleSettings language="HTML">
28
+ <option name="SOFT_MARGINS" value="80" />
29
+ <indentOptions>
30
+ <option name="INDENT_SIZE" value="2" />
31
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
32
+ <option name="TAB_SIZE" value="2" />
33
+ </indentOptions>
34
+ </codeStyleSettings>
35
+ <codeStyleSettings language="JavaScript">
36
+ <option name="SOFT_MARGINS" value="80" />
37
+ <indentOptions>
38
+ <option name="INDENT_SIZE" value="2" />
39
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
40
+ <option name="TAB_SIZE" value="2" />
41
+ </indentOptions>
42
+ </codeStyleSettings>
43
+ <codeStyleSettings language="TypeScript">
44
+ <option name="SOFT_MARGINS" value="80" />
45
+ <indentOptions>
46
+ <option name="INDENT_SIZE" value="2" />
47
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
48
+ <option name="TAB_SIZE" value="2" />
49
+ </indentOptions>
50
+ </codeStyleSettings>
51
+ <codeStyleSettings language="Vue">
52
+ <option name="SOFT_MARGINS" value="80" />
53
+ <indentOptions>
54
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
55
+ </indentOptions>
56
+ </codeStyleSettings>
57
+ </code_scheme>
58
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding">
4
+ <file url="file://$PROJECT_DIR$/eslintrc.json" charset="GBK" />
5
+ <file url="file://$PROJECT_DIR$/src/testCSS.html" charset="GBK" />
6
+ </component>
7
+ </project>
@@ -0,0 +1,7 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ <inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
6
+ </profile>
7
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/tenstack-starter-main.iml" filepath="$PROJECT_DIR$/.idea/tenstack-starter-main.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "parser": "typescript",
3
+ "semi": true,
4
+ "singleQuote": false,
5
+ "tabWidth": 2,
6
+ "trailingComma": "all",
7
+ "printWidth": 80
8
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "editor.stickyScroll.enabled": true
3
+ }
package/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2021, Filoscoder
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.