node-csfd-api-racintom 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 (67) hide show
  1. package/.editorconfig +13 -0
  2. package/.eslintrc.json +33 -0
  3. package/.gitattributes +2 -0
  4. package/.github/FUNDING.yml +8 -0
  5. package/.github/pull_request_template.md +19 -0
  6. package/.github/workflows/main.yml +40 -0
  7. package/.github/workflows/publish.yml +73 -0
  8. package/.github/workflows/test.yml +43 -0
  9. package/.husky/pre-commit +1 -0
  10. package/.idea/codeStyles/Project.xml +72 -0
  11. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  12. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  13. package/.idea/misc.xml +6 -0
  14. package/.idea/modules.xml +8 -0
  15. package/.idea/node-csfd-api.iml +9 -0
  16. package/.idea/prettier.xml +6 -0
  17. package/.idea/vcs.xml +7 -0
  18. package/.nvmrc +1 -0
  19. package/.prettierignore +8 -0
  20. package/.prettierrc +10 -0
  21. package/.vscode/settings.json +16 -0
  22. package/Dockerfile +19 -0
  23. package/README.md +510 -0
  24. package/demo.ts +35 -0
  25. package/eslint.config.mjs +55 -0
  26. package/package.json +86 -0
  27. package/server.ts +66 -0
  28. package/src/fetchers/fetch.polyfill.ts +7 -0
  29. package/src/fetchers/index.ts +25 -0
  30. package/src/helpers/creator.helper.ts +95 -0
  31. package/src/helpers/global.helper.ts +70 -0
  32. package/src/helpers/movie.helper.ts +276 -0
  33. package/src/helpers/search-user.helper.ts +19 -0
  34. package/src/helpers/search.helper.ts +66 -0
  35. package/src/helpers/user-ratings.helper.ts +62 -0
  36. package/src/index.ts +42 -0
  37. package/src/interfaces/creator.interface.ts +14 -0
  38. package/src/interfaces/global.ts +36 -0
  39. package/src/interfaces/movie.interface.ts +157 -0
  40. package/src/interfaces/search.interface.ts +32 -0
  41. package/src/interfaces/user-ratings.interface.ts +21 -0
  42. package/src/services/creator.service.ts +34 -0
  43. package/src/services/movie.service.ts +89 -0
  44. package/src/services/search.service.ts +101 -0
  45. package/src/services/user-ratings.service.ts +106 -0
  46. package/src/vars.ts +13 -0
  47. package/tests/creator.test.ts +182 -0
  48. package/tests/fetchers.test.ts +109 -0
  49. package/tests/global.test.ts +35 -0
  50. package/tests/helpers.test.ts +59 -0
  51. package/tests/mocks/creator-actor.html.ts +2244 -0
  52. package/tests/mocks/creator-composer-empty.html.ts +683 -0
  53. package/tests/mocks/creator-director.html.ts +3407 -0
  54. package/tests/mocks/movie1.html.ts +1430 -0
  55. package/tests/mocks/movie2.html.ts +740 -0
  56. package/tests/mocks/movie3.html.ts +1843 -0
  57. package/tests/mocks/movie4.html.ts +1568 -0
  58. package/tests/mocks/search.html.ts +838 -0
  59. package/tests/mocks/series1.html.ts +1540 -0
  60. package/tests/mocks/userRatings.html.ts +1354 -0
  61. package/tests/movie.test.ts +606 -0
  62. package/tests/search.test.ts +379 -0
  63. package/tests/services.test.ts +106 -0
  64. package/tests/user-ratings.test.ts +142 -0
  65. package/tests/vars.test.ts +34 -0
  66. package/tsconfig.json +23 -0
  67. package/vitest.config.mts +10 -0
package/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ # editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
package/.eslintrc.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es6": true,
5
+ "node": true
6
+ },
7
+ "extends": ["google", "plugin:prettier/recommended"],
8
+ "globals": {
9
+ "Atomics": "readonly",
10
+ "SharedArrayBuffer": "readonly"
11
+ },
12
+ "parser": "@typescript-eslint/parser",
13
+ "parserOptions": {
14
+ "ecmaVersion": 2018,
15
+ "sourceType": "module"
16
+ },
17
+ "plugins": ["@typescript-eslint", "prettier"],
18
+ "rules": {
19
+ // disable googles JSDoc
20
+ "require-jsdoc": "off",
21
+ // no-unused vars for typescript config
22
+ "no-unused-vars": "off",
23
+ "@typescript-eslint/no-unused-vars": [
24
+ "error",
25
+ {
26
+ "vars": "all",
27
+ "args": "after-used",
28
+ "ignoreRestSiblings": false
29
+ }
30
+ ],
31
+ "prettier/prettier": "error"
32
+ }
33
+ }
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ yarn.lock -diff
2
+ package-lock.json -diff
@@ -0,0 +1,8 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [bartholomej] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: bartholomej
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ custom: ['https://www.paypal.me/bartholomej']
@@ -0,0 +1,19 @@
1
+ ## What's new and why I made this pull request?
2
+
3
+ -
4
+
5
+ ## Pull request type
6
+
7
+ What kind of change does this PR introduce?
8
+
9
+ ```
10
+ [ ] Bugfix
11
+ [ ] Feature
12
+ [ ] Code style update (formatting, local variables)
13
+ [ ] Refactoring (no functional changes, no api changes)
14
+ [ ] Build related changes
15
+ [ ] CI related changes
16
+ [ ] Documentation content changes
17
+ [ ] Tests
18
+ [ ] Other
19
+ ```
@@ -0,0 +1,40 @@
1
+ name: Build
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - name: Use Node.js
12
+ uses: actions/setup-node@v4
13
+ with:
14
+ node-version: 24
15
+
16
+ - name: Cache node modules
17
+ uses: actions/cache@v4
18
+ with:
19
+ path: node_modules
20
+ key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
21
+ restore-keys: |
22
+ ${{ runner.OS }}-build-${{ env.cache-name }}-
23
+ ${{ runner.OS }}-build-
24
+ ${{ runner.OS }}-
25
+
26
+ - name: Install dependencies
27
+ run: yarn
28
+
29
+ - name: Build app
30
+ run: yarn build
31
+
32
+ - name: Run tests
33
+ run: yarn test:coverage
34
+
35
+ - name: Upload coverage to Codecov
36
+ uses: codecov/codecov-action@v5
37
+ with:
38
+ fail_ci_if_error: true
39
+ env:
40
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,73 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Use Node.js
15
+ uses: actions/setup-node@v4
16
+ with:
17
+ node-version: 24
18
+ registry-url: 'https://registry.npmjs.org'
19
+
20
+ - name: Cache node modules
21
+ uses: actions/cache@v4
22
+ with:
23
+ path: node_modules
24
+ key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
25
+ restore-keys: |
26
+ ${{ runner.OS }}-build-${{ env.cache-name }}-
27
+ ${{ runner.OS }}-build-
28
+ ${{ runner.OS }}-
29
+
30
+ - name: Install dependencies
31
+ run: yarn
32
+
33
+ - name: Build app
34
+ run: yarn build
35
+
36
+ - name: Run tests
37
+ run: yarn test:coverage
38
+
39
+ - name: Upload coverage to Codecov
40
+ uses: codecov/codecov-action@v5
41
+ with:
42
+ fail_ci_if_error: true
43
+ env:
44
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
45
+
46
+ - name: Publish NPM
47
+ if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false
48
+ run: cd dist && npm publish --access public
49
+ env:
50
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
51
+
52
+ - name: Publish NPM BETA
53
+ if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == true
54
+ run: cd dist && npm publish --access public --tag beta
55
+ env:
56
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
57
+
58
+ # - name: Set up package for GPR
59
+ # run: yarn gpr:setup
60
+
61
+ # - name: Use GPR
62
+ # uses: actions/setup-node@master
63
+ # with:
64
+ # node-version: 13
65
+ # registry-url: https://npm.pkg.github.com/
66
+ # scope: 'bartholomej'
67
+
68
+ # - name: Publish to GitHub Package Registry
69
+ # run: |
70
+ # cd dist
71
+ # npm publish
72
+ # env:
73
+ # NODE_AUTH_TOKEN: ${{github.token}}
@@ -0,0 +1,43 @@
1
+ name: Build && Test
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 9 * * TUE'
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Use Node.js
14
+ uses: actions/setup-node@v4
15
+ with:
16
+ node-version: 24
17
+
18
+ - name: Cache node modules
19
+ uses: actions/cache@v4
20
+ with:
21
+ path: node_modules
22
+ key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
23
+ restore-keys: |
24
+ ${{ runner.OS }}-build-${{ env.cache-name }}-
25
+ ${{ runner.OS }}-build-
26
+ ${{ runner.OS }}-
27
+
28
+ - name: Install dependencies
29
+ run: yarn
30
+
31
+ - name: Build app
32
+ run: yarn build
33
+
34
+ - name: Build app
35
+ run: yarn test:coverage
36
+
37
+ - name: Upload coverage to Codecov
38
+ uses: codecov/codecov-action@v5
39
+ with:
40
+ fail_ci_if_error: true
41
+ verbose: true
42
+ env:
43
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1 @@
1
+ npx lint-staged
@@ -0,0 +1,72 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <HTMLCodeStyleSettings>
4
+ <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
+ </HTMLCodeStyleSettings>
6
+ <JSCodeStyleSettings version="0">
7
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
8
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
9
+ <option name="USE_DOUBLE_QUOTES" 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
+ <JavaCodeStyleSettings>
16
+ <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
17
+ <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
18
+ </JavaCodeStyleSettings>
19
+ <TypeScriptCodeStyleSettings version="0">
20
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
21
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
22
+ <option name="USE_DOUBLE_QUOTES" value="false" />
23
+ <option name="FORCE_QUOTE_STYlE" value="true" />
24
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
25
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
26
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
27
+ </TypeScriptCodeStyleSettings>
28
+ <VueCodeStyleSettings>
29
+ <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
30
+ <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
31
+ </VueCodeStyleSettings>
32
+ <codeStyleSettings language="CoffeeScript">
33
+ <indentOptions>
34
+ <option name="TAB_SIZE" value="4" />
35
+ </indentOptions>
36
+ </codeStyleSettings>
37
+ <codeStyleSettings language="HTML">
38
+ <option name="SOFT_MARGINS" value="100" />
39
+ <indentOptions>
40
+ <option name="INDENT_SIZE" value="2" />
41
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
42
+ <option name="TAB_SIZE" value="2" />
43
+ </indentOptions>
44
+ </codeStyleSettings>
45
+ <codeStyleSettings language="JavaScript">
46
+ <option name="SOFT_MARGINS" value="100" />
47
+ <indentOptions>
48
+ <option name="INDENT_SIZE" value="2" />
49
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
50
+ <option name="TAB_SIZE" value="2" />
51
+ </indentOptions>
52
+ </codeStyleSettings>
53
+ <codeStyleSettings language="PHP">
54
+ <option name="CLASS_BRACE_STYLE" value="1" />
55
+ <option name="METHOD_BRACE_STYLE" value="1" />
56
+ </codeStyleSettings>
57
+ <codeStyleSettings language="TypeScript">
58
+ <option name="SOFT_MARGINS" value="100" />
59
+ <indentOptions>
60
+ <option name="INDENT_SIZE" value="2" />
61
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
62
+ <option name="TAB_SIZE" value="2" />
63
+ </indentOptions>
64
+ </codeStyleSettings>
65
+ <codeStyleSettings language="Vue">
66
+ <option name="SOFT_MARGINS" value="100" />
67
+ <indentOptions>
68
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
69
+ </indentOptions>
70
+ </codeStyleSettings>
71
+ </code_scheme>
72
+ </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,6 @@
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
+ </profile>
6
+ </component>
package/.idea/misc.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
4
+ <output url="file://$PROJECT_DIR$/out" />
5
+ </component>
6
+ </project>
@@ -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/node-csfd-api.iml" filepath="$PROJECT_DIR$/.idea/node-csfd-api.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="JAVA_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="inheritedJdk" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ </component>
9
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myConfigurationMode" value="AUTOMATIC" />
5
+ </component>
6
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
6
+ </component>
7
+ </project>
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 24
@@ -0,0 +1,8 @@
1
+ package.json
2
+ package-lock.json
3
+ yarn.lock
4
+ prettier.config.js
5
+ .eslintrc.js
6
+ dist
7
+ .vscode/*
8
+ tests/mocks/*.html
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "printWidth": 100,
3
+ "singleQuote": true,
4
+ "useTabs": false,
5
+ "tabWidth": 2,
6
+ "semi": true,
7
+ "arrowParens": "always",
8
+ "bracketSpacing": true,
9
+ "trailingComma": "none"
10
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "workbench.colorCustomizations": {
3
+ "statusBar.background": "#000"
4
+ },
5
+ "editor.codeActionsOnSave": {
6
+ "source.organizeImports": "explicit",
7
+ "source.fixAll.eslint": "explicit"
8
+ },
9
+ "[html]": {
10
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
11
+ "editor.formatOnSave": false
12
+ },
13
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
14
+ "editor.formatOnSave": true,
15
+ "typescript.tsdk": "node_modules/typescript/lib"
16
+ }
package/Dockerfile ADDED
@@ -0,0 +1,19 @@
1
+ FROM node:24-alpine
2
+
3
+ # Create app directory
4
+ WORKDIR /usr/src/app
5
+
6
+ # Copy package.json and yarn.lock
7
+ COPY package.json yarn.lock ./
8
+
9
+ # Install dependencies
10
+ RUN yarn install
11
+
12
+ # Copy the application code
13
+ COPY . .
14
+
15
+ # Expose the app's port
16
+ EXPOSE 3000
17
+
18
+ # Start the application
19
+ CMD ["yarn", "tsx", "server.ts"]