odesli.js 1.0.4 → 1.1.1

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/.eslintrc.js ADDED
@@ -0,0 +1,34 @@
1
+ module.exports = {
2
+ env: {
3
+ node: true,
4
+ es2021: true,
5
+ jest: true,
6
+ },
7
+ extends: ['standard', 'plugin:jest/recommended', 'prettier'],
8
+ parserOptions: {
9
+ ecmaVersion: 'latest',
10
+ sourceType: 'module',
11
+ },
12
+ plugins: ['jest', 'prettier'],
13
+ rules: {
14
+ 'jest/no-disabled-tests': 'warn',
15
+ 'jest/no-focused-tests': 'error',
16
+ 'jest/no-identical-title': 'error',
17
+ 'jest/prefer-to-have-length': 'warn',
18
+ 'jest/valid-expect': 'error',
19
+ 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
20
+ 'prefer-const': 'error',
21
+ 'no-var': 'error',
22
+ 'prettier/prettier': 'error',
23
+ 'comma-dangle': 'off',
24
+ semi: 'off',
25
+ },
26
+ overrides: [
27
+ {
28
+ files: ['tests/**/*.js'],
29
+ env: {
30
+ jest: true,
31
+ },
32
+ },
33
+ ],
34
+ };
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,99 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ node-version: [16.x, 18.x, 20.x, 22.x]
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Use Node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: ${{ matrix.node-version }}
25
+ cache: 'npm'
26
+
27
+ - name: Install dependencies
28
+ run: npm ci
29
+
30
+ - name: Run linting
31
+ run: npm run lint
32
+
33
+ - name: Check formatting
34
+ run: npm run format:check
35
+
36
+ - name: Run tests
37
+ run: npm test
38
+
39
+ - name: Run tests with coverage
40
+ run: npm run test:coverage
41
+
42
+ - name: Upload coverage to Codecov
43
+ uses: codecov/codecov-action@v3
44
+ with:
45
+ file: ./coverage/lcov.info
46
+ flags: unittests
47
+ name: codecov-umbrella
48
+ fail_ci_if_error: false
49
+
50
+ security:
51
+ runs-on: ubuntu-latest
52
+ needs: test
53
+
54
+ steps:
55
+ - name: Checkout code
56
+ uses: actions/checkout@v4
57
+
58
+ - name: Use Node.js
59
+ uses: actions/setup-node@v4
60
+ with:
61
+ node-version: '20.x'
62
+ cache: 'npm'
63
+
64
+ - name: Install dependencies
65
+ run: npm ci
66
+
67
+ - name: Run security audit
68
+ run: npm audit --audit-level=moderate
69
+
70
+ - name: Run Snyk security scan
71
+ uses: snyk/actions/node@master
72
+ env:
73
+ SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
74
+ with:
75
+ args: --severity-threshold=high
76
+ continue-on-error: true
77
+
78
+ build:
79
+ runs-on: ubuntu-latest
80
+ needs: test
81
+
82
+ steps:
83
+ - name: Checkout code
84
+ uses: actions/checkout@v4
85
+
86
+ - name: Use Node.js
87
+ uses: actions/setup-node@v4
88
+ with:
89
+ node-version: '20.x'
90
+ cache: 'npm'
91
+
92
+ - name: Install dependencies
93
+ run: npm ci
94
+
95
+ - name: Build project
96
+ run: npm run build
97
+
98
+ - name: Verify TypeScript compilation
99
+ run: npx tsc --noEmit
@@ -0,0 +1,40 @@
1
+ name: Publish to NPM
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v4
14
+
15
+ - name: Use Node.js
16
+ uses: actions/setup-node@v4
17
+ with:
18
+ node-version: '20.x'
19
+ cache: 'npm'
20
+ registry-url: 'https://registry.npmjs.org'
21
+
22
+ - name: Install dependencies
23
+ run: npm ci
24
+
25
+ - name: Run tests
26
+ run: npm test
27
+
28
+ - name: Run linting
29
+ run: npm run lint
30
+
31
+ - name: Check formatting
32
+ run: npm run format:check
33
+
34
+ - name: Build project
35
+ run: npm run build
36
+
37
+ - name: Publish to NPM
38
+ run: npm publish
39
+ env:
40
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,31 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Build outputs
5
+ lib/
6
+ dist/
7
+ build/
8
+
9
+ # Coverage reports
10
+ coverage/
11
+
12
+ # Logs
13
+ *.log
14
+
15
+ # Environment files
16
+ .env*
17
+
18
+ # Package files
19
+ package-lock.json
20
+ yarn.lock
21
+
22
+ # Git
23
+ .git/
24
+
25
+ # IDE
26
+ .vscode/
27
+ .idea/
28
+
29
+ # OS
30
+ .DS_Store
31
+ Thumbs.db
package/.prettierrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": true,
5
+ "printWidth": 80,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "bracketSpacing": true,
9
+ "arrowParens": "avoid",
10
+ "endOfLine": "lf"
11
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.1.0] - 2025-06-22
9
+
10
+ ### Added
11
+
12
+ - Comprehensive test suite with Jest (40 tests, 100% coverage)
13
+ - ESLint configuration for code quality
14
+ - Prettier configuration for code formatting
15
+ - GitHub Actions CI/CD workflows
16
+ - Example code in `examples/` directory
17
+ - Improved TypeScript configuration
18
+ - Better error handling and validation
19
+ - Professional documentation with badges
20
+ - Security scanning with Snyk
21
+ - Development tools and scripts
22
+
23
+ ### Fixed
24
+
25
+ - API parameter mismatch (`api` → `apiKey`)
26
+ - Simplified async logic in all methods
27
+ - Removed unnecessary Promise.all wrappers
28
+ - Improved error handling in `_request` method
29
+ - Enhanced TypeScript type definitions
30
+
31
+ ### Changed
32
+
33
+ - Updated package.json with better metadata and exports
34
+ - Enhanced README with comprehensive documentation
35
+ - Added proper TypeScript declarations
36
+ - Improved code structure and maintainability
37
+ - Modern ES modules support
38
+ - Professional project structure
39
+
40
+ ## [1.0.3] - 2024-01-XX
41
+
42
+ ### Features
43
+
44
+ - Initial release
45
+ - Basic Odesli API client functionality
46
+ - Support for fetch, getByParams, and getById methods
47
+ - TypeScript definitions
48
+ - Basic documentation
49
+ - Fetch songs by URL from any streaming platform
50
+ - Get song information by platform, type, and ID
51
+ - Get song information by entity ID
52
+ - Support for multiple countries
53
+ - Optional API key support for higher rate limits
@@ -0,0 +1,125 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+
56
+ ## Enforcement
57
+
58
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
59
+ reported to the community leaders responsible for enforcement at
60
+ [INSERT CONTACT METHOD].
61
+ All complaints will be reviewed and investigated promptly and fairly.
62
+
63
+ All community leaders are obligated to respect the privacy and security of the
64
+ reporter of any incident.
65
+
66
+ ## Enforcement Guidelines
67
+
68
+ Community leaders will follow these Community Impact Guidelines in determining
69
+ the consequences for any action they deem in violation of this Code of Conduct:
70
+
71
+ ### 1. Correction
72
+
73
+ **Community Impact**: Use of inappropriate language or other behavior deemed
74
+ unprofessional or unwelcome in the community.
75
+
76
+ **Consequence**: A private, written warning from community leaders, providing
77
+ clarity around the nature of the violation and an explanation of why the
78
+ behavior was inappropriate. A public apology may be requested.
79
+
80
+ ### 2. Warning
81
+
82
+ **Community Impact**: A violation through a single incident or series
83
+ of actions.
84
+
85
+ **Consequence**: A warning with consequences for continued behavior. No
86
+ interaction with the people involved, including unsolicited interaction with
87
+ those enforcing the Code of Conduct, for a specified period of time. This
88
+ includes avoiding interactions in community spaces as well as external channels
89
+ like social media. Violating these terms may lead to a temporary or
90
+ permanent ban.
91
+
92
+ ### 3. Temporary Ban
93
+
94
+ **Community Impact**: A serious violation of community standards, including
95
+ sustained inappropriate behavior.
96
+
97
+ **Consequence**: A temporary ban from any sort of interaction or public
98
+ communication with the community for a specified period of time. No public or
99
+ private interaction with the people involved, including unsolicited interaction
100
+ with those enforcing the Code of Conduct, is allowed during this period.
101
+ Violating these terms may lead to a permanent ban.
102
+
103
+ ### 4. Permanent Ban
104
+
105
+ **Community Impact**: Demonstrating a pattern of violation of community
106
+ standards, including sustained inappropriate behavior, harassment of an
107
+ individual, or aggression toward or disparagement of classes of individuals.
108
+
109
+ **Consequence**: A permanent ban from any sort of public interaction within
110
+ the community.
111
+
112
+ ## Attribution
113
+
114
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
115
+ version 2.0, available at
116
+ [contributor-covenant.org/version/2/0/code_of_conduct.html](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).
117
+
118
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
119
+ enforcement ladder](https://github.com/mozilla/diversity).
120
+
121
+ [homepage]: https://www.contributor-covenant.org
122
+
123
+ For answers to common questions about this code of conduct, see the FAQ at
124
+ [contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at
125
+ [contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
@@ -0,0 +1,104 @@
1
+ # Contributing to odesli.js
2
+
3
+ Thank you for your interest in contributing to odesli.js! This document provides guidelines and information for contributors.
4
+
5
+ ## Code of Conduct
6
+
7
+ This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
8
+
9
+ ## How Can I Contribute?
10
+
11
+ ### Reporting Bugs
12
+
13
+ - Use the GitHub issue tracker
14
+ - Include a clear and descriptive title
15
+ - Provide steps to reproduce the issue
16
+ - Include error messages and stack traces
17
+ - Specify your environment (Node.js version, OS, etc.)
18
+
19
+ ### Suggesting Enhancements
20
+
21
+ - Use the GitHub issue tracker
22
+ - Describe the enhancement clearly
23
+ - Explain why this enhancement would be useful
24
+ - Include examples if applicable
25
+
26
+ ### Pull Requests
27
+
28
+ 1. Fork the repository
29
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
30
+ 3. Make your changes
31
+ 4. Run the tests (`npm test`)
32
+ 5. Run the linter (`npm run lint`)
33
+ 6. Run the formatter (`npm run format`)
34
+ 7. Commit your changes (`git commit -m 'Add some amazing feature'`)
35
+ 8. Push to the branch (`git push origin feature/amazing-feature`)
36
+ 9. Open a Pull Request
37
+
38
+ ## Development Setup
39
+
40
+ 1. Clone the repository:
41
+
42
+ ```bash
43
+ git clone https://github.com/MattrAus/odesli.js.git
44
+ cd odesli.js
45
+ ```
46
+
47
+ 2. Install dependencies:
48
+
49
+ ```bash
50
+ npm install
51
+ ```
52
+
53
+ 3. Run tests:
54
+
55
+ ```bash
56
+ npm test
57
+ ```
58
+
59
+ 4. Run linting:
60
+
61
+ ```bash
62
+ npm run lint
63
+ ```
64
+
65
+ 5. Format code:
66
+
67
+ ```bash
68
+ npm run format
69
+ ```
70
+
71
+ ## Code Style
72
+
73
+ - Follow the existing code style
74
+ - Use ESLint and Prettier configurations
75
+ - Write meaningful commit messages
76
+ - Add tests for new features
77
+ - Update documentation as needed
78
+
79
+ ## Testing
80
+
81
+ - Write tests for new features
82
+ - Ensure all tests pass before submitting PR
83
+ - Use descriptive test names
84
+ - Mock external dependencies
85
+
86
+ ## Documentation
87
+
88
+ - Update README.md if adding new features
89
+ - Add JSDoc comments for new functions
90
+ - Update TypeScript definitions if needed
91
+ - Add examples for new functionality
92
+
93
+ ## Release Process
94
+
95
+ 1. Update version in `package.json`
96
+ 2. Update `CHANGELOG.md`
97
+ 3. Create a GitHub release
98
+ 4. The CI/CD pipeline will automatically publish to npm
99
+
100
+ ## Questions?
101
+
102
+ If you have questions about contributing, please open an issue or contact the maintainers.
103
+
104
+ Thank you for contributing to odesli.js! 🎵
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2024, Mattr
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.