odesli.js 1.3.5 → 1.3.7
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/.prettierignore +30 -30
- package/API_IMPROVEMENTS.md +16 -16
- package/CHANGELOG.md +106 -0
- package/LICENSE +14 -14
- package/README.md +467 -91
- package/RELEASE_NOTES_1.1.0.md +1 -1
- package/examples/README.md +281 -60
- package/examples/advanced-features-example.js +4 -4
- package/examples/advanced-usage.js +3 -3
- package/examples/basic-usage.js +4 -9
- package/examples/cache-test.js +1 -1
- package/examples/rate-limiter-strategies.js +83 -0
- package/examples/test-apple-music-extraction.js +1 -1
- package/examples/user-agent-example.js +1 -1
- package/lib/index.d.ts +391 -363
- package/lib/rate-limiter.js +16 -15
- package/package.json +13 -1
package/.prettierignore
CHANGED
|
@@ -1,31 +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
|
|
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
31
|
Thumbs.db
|
package/API_IMPROVEMENTS.md
CHANGED
|
@@ -8,7 +8,7 @@ This document outlines the comprehensive improvements made to the Odesli API cli
|
|
|
8
8
|
|
|
9
9
|
The constructor now accepts a comprehensive options object with the following parameters:
|
|
10
10
|
|
|
11
|
-
```
|
|
11
|
+
```js
|
|
12
12
|
const odesli = new Odesli({
|
|
13
13
|
// Core options
|
|
14
14
|
apiKey: 'your-api-key', // Optional API key for higher rate limits
|
|
@@ -38,7 +38,7 @@ All methods now support both backward-compatible string parameters and new optio
|
|
|
38
38
|
|
|
39
39
|
#### `fetch(url, options)`
|
|
40
40
|
|
|
41
|
-
```
|
|
41
|
+
```js
|
|
42
42
|
// Backward compatible
|
|
43
43
|
const song = await odesli.fetch(url, 'GB');
|
|
44
44
|
|
|
@@ -52,7 +52,7 @@ const song = await odesli.fetch(url, {
|
|
|
52
52
|
|
|
53
53
|
#### `getByParams(platform, type, id, options)`
|
|
54
54
|
|
|
55
|
-
```
|
|
55
|
+
```js
|
|
56
56
|
// Backward compatible
|
|
57
57
|
const song = await odesli.getByParams('spotify', 'song', '123', 'GB');
|
|
58
58
|
|
|
@@ -66,7 +66,7 @@ const song = await odesli.getByParams('spotify', 'song', '123', {
|
|
|
66
66
|
|
|
67
67
|
#### `getById(id, options)`
|
|
68
68
|
|
|
69
|
-
```
|
|
69
|
+
```js
|
|
70
70
|
// Backward compatible
|
|
71
71
|
const song = await odesli.getById('SPOTIFY_SONG::123', 'GB');
|
|
72
72
|
|
|
@@ -82,7 +82,7 @@ const song = await odesli.getById('SPOTIFY_SONG::123', {
|
|
|
82
82
|
|
|
83
83
|
### Batch Operations
|
|
84
84
|
|
|
85
|
-
```
|
|
85
|
+
```js
|
|
86
86
|
// Fetch multiple songs with concurrency control
|
|
87
87
|
const urls = [
|
|
88
88
|
'https://open.spotify.com/track/123',
|
|
@@ -99,7 +99,7 @@ const results = await odesli.fetchBatch(urls, {
|
|
|
99
99
|
|
|
100
100
|
### Platform Detection
|
|
101
101
|
|
|
102
|
-
```
|
|
102
|
+
```js
|
|
103
103
|
// Detect platform from URL
|
|
104
104
|
const platform = odesli.detectPlatform('https://open.spotify.com/track/123');
|
|
105
105
|
console.log(platform); // 'spotify'
|
|
@@ -113,7 +113,7 @@ console.log(id); // '4Km5HrUvYTaSUfiSGPJeQR'
|
|
|
113
113
|
|
|
114
114
|
### Platform Information
|
|
115
115
|
|
|
116
|
-
```
|
|
116
|
+
```js
|
|
117
117
|
// Get list of supported platforms
|
|
118
118
|
const platforms = odesli.getSupportedPlatforms();
|
|
119
119
|
console.log(platforms); // ['spotify', 'appleMusic', 'youtube', ...]
|
|
@@ -121,7 +121,7 @@ console.log(platforms); // ['spotify', 'appleMusic', 'youtube', ...]
|
|
|
121
121
|
|
|
122
122
|
### Enhanced Cache Statistics
|
|
123
123
|
|
|
124
|
-
```
|
|
124
|
+
```js
|
|
125
125
|
// Get detailed cache statistics
|
|
126
126
|
const stats = odesli.getCacheStats();
|
|
127
127
|
console.log(`Cache size: ${stats.size}`);
|
|
@@ -146,7 +146,7 @@ console.log(`Total requests: ${stats.totalRequests}`);
|
|
|
146
146
|
|
|
147
147
|
### Enhanced Error Messages
|
|
148
148
|
|
|
149
|
-
```
|
|
149
|
+
```js
|
|
150
150
|
// Clear, descriptive error messages
|
|
151
151
|
try {
|
|
152
152
|
await odesli.fetch('invalid-url');
|
|
@@ -165,7 +165,7 @@ try {
|
|
|
165
165
|
|
|
166
166
|
All existing code continues to work without modification:
|
|
167
167
|
|
|
168
|
-
```
|
|
168
|
+
```js
|
|
169
169
|
// These all still work exactly as before
|
|
170
170
|
const song1 = await odesli.fetch('https://open.spotify.com/track/123');
|
|
171
171
|
const song2 = await odesli.fetch('https://open.spotify.com/track/123', 'GB');
|
|
@@ -199,7 +199,7 @@ const song6 = await odesli.getById('SPOTIFY_SONG::123', 'GB');
|
|
|
199
199
|
|
|
200
200
|
### Logging Support
|
|
201
201
|
|
|
202
|
-
```
|
|
202
|
+
```js
|
|
203
203
|
const odesli = new Odesli({
|
|
204
204
|
logger: (message, level) => {
|
|
205
205
|
console.log(`[${level.toUpperCase()}] ${message}`);
|
|
@@ -209,7 +209,7 @@ const odesli = new Odesli({
|
|
|
209
209
|
|
|
210
210
|
### Validation Control
|
|
211
211
|
|
|
212
|
-
```
|
|
212
|
+
```js
|
|
213
213
|
// Disable validation for performance
|
|
214
214
|
const odesli = new Odesli({
|
|
215
215
|
validateParams: false,
|
|
@@ -228,7 +228,7 @@ const odesli = new Odesli({
|
|
|
228
228
|
|
|
229
229
|
### Production Applications
|
|
230
230
|
|
|
231
|
-
```
|
|
231
|
+
```js
|
|
232
232
|
const odesli = new Odesli({
|
|
233
233
|
apiKey: process.env.ODESLI_API_KEY,
|
|
234
234
|
maxRetries: 3,
|
|
@@ -245,7 +245,7 @@ const odesli = new Odesli({
|
|
|
245
245
|
|
|
246
246
|
### Development & Testing
|
|
247
247
|
|
|
248
|
-
```
|
|
248
|
+
```js
|
|
249
249
|
const odesli = new Odesli({
|
|
250
250
|
cache: false,
|
|
251
251
|
validateParams: true,
|
|
@@ -256,7 +256,7 @@ const odesli = new Odesli({
|
|
|
256
256
|
|
|
257
257
|
### High-Volume Processing
|
|
258
258
|
|
|
259
|
-
```
|
|
259
|
+
```js
|
|
260
260
|
const odesli = new Odesli({
|
|
261
261
|
apiKey: process.env.ODESLI_API_KEY,
|
|
262
262
|
maxRetries: 5,
|
|
@@ -291,7 +291,7 @@ No migration required! All existing code continues to work unchanged.
|
|
|
291
291
|
|
|
292
292
|
Use the new options objects for enhanced functionality:
|
|
293
293
|
|
|
294
|
-
```
|
|
294
|
+
```js
|
|
295
295
|
// Old way (still works)
|
|
296
296
|
const song = await odesli.fetch(url, 'GB');
|
|
297
297
|
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,78 @@ All notable changes to this project will be documented in this file.
|
|
|
7
7
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
8
8
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
9
9
|
|
|
10
|
+
## [1.3.7] - 2025-01-27
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Enhanced TypeScript Definitions**: Improved type definitions for better IntelliSense and type safety
|
|
15
|
+
- **Batch Operations Support**: Added proper types for batch URL fetching with error handling
|
|
16
|
+
- **Entity Data Completeness**: Added missing properties to EntityData interface (thumbnailWidth, thumbnailHeight, apiProvider, platforms)
|
|
17
|
+
- **Platform Link Enhancement**: Added entityUniqueId property to PlatformLink interface
|
|
18
|
+
- **Configuration Options**: Added metrics configuration option to OdesliOptions interface
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **BatchError Interface**: Proper error typing for batch operations with specific error categories
|
|
23
|
+
- **BatchResult Type**: Type-safe return type for batch fetch operations
|
|
24
|
+
- **Enhanced Error Types**: Added specific error types (BAD_REQUEST, UNAUTHORIZED, RATE_LIMITED, etc.)
|
|
25
|
+
|
|
26
|
+
## [1.3.6] - 2025-07-12
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Version bump for dependency updates and workflow improvements
|
|
31
|
+
|
|
32
|
+
## [1.3.5] - 2025-07-12
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- **Automated Workflows**: Enhanced Dependabot auto-merge workflow with version bumping and tagging
|
|
37
|
+
- **Dependency Updates**: Updated development dependencies for security and compatibility
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Improved CI/CD pipeline automation
|
|
42
|
+
- Enhanced dependency management workflows
|
|
43
|
+
|
|
44
|
+
## [1.3.4] - 2025-06-23
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- **Code Refactoring**: Removed redundant `fetchBatch` method to improve code maintainability
|
|
49
|
+
- **Documentation Updates**: Updated README badges and documentation links
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- **Build System**: Fixed build configuration for better cross-platform compatibility
|
|
54
|
+
- **Dependencies**: Updated development dependencies for improved security
|
|
55
|
+
|
|
56
|
+
## [1.3.3] - 2025-06-23
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- Version bump for registry publishing and workflow improvements
|
|
61
|
+
|
|
62
|
+
## [1.3.2] - 2025-06-23
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- **Security Vulnerabilities**: Fixed security vulnerabilities in dependencies
|
|
67
|
+
- **Test Dependencies**: Added missing `jest-fetch-mock` dependency for proper testing
|
|
68
|
+
- **User-Agent Validation**: Relaxed user-agent check in tests for better compatibility
|
|
69
|
+
- **Publishing Workflows**: Streamlined publishing workflows for both npm and GitHub Packages
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
- Updated package-lock.json and package.json for security improvements
|
|
74
|
+
- Enhanced build and deployment processes
|
|
75
|
+
|
|
76
|
+
## [1.3.1] - 2025-06-23
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- Version bump for GitHub Packages release and registry configuration
|
|
81
|
+
|
|
10
82
|
## [1.3.0] - 2025-06-23
|
|
11
83
|
|
|
12
84
|
### Fixed
|
|
@@ -17,6 +89,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
89
|
|
|
18
90
|
- The `Odesli` constructor now accepts `{ metrics: false }` as an option to completely disable the metrics collection feature.
|
|
19
91
|
|
|
92
|
+
### Changed
|
|
93
|
+
|
|
94
|
+
- **Code Formatting**: Applied Prettier formatting for consistent code style
|
|
95
|
+
- **Linting**: Resolved linting and formatting errors for better code quality
|
|
96
|
+
- **Metrics Stability**: Improved metrics collector stability and performance
|
|
97
|
+
|
|
20
98
|
> **Note**: For a comprehensive overview of all recent API enhancements and features, please see the [API Improvements](./API_IMPROVEMENTS.md) documentation.
|
|
21
99
|
|
|
22
100
|
## [1.2.0] - 2025-06-22
|
|
@@ -52,6 +130,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
52
130
|
- Fixed User-Agent format to match expected pattern
|
|
53
131
|
- Improved error handling and propagation
|
|
54
132
|
- Fixed test failures related to response handling
|
|
133
|
+
- **ESLint Compatibility**: Resolved ESLint structuredClone compatibility issue
|
|
134
|
+
- **Formatting Issues**: Fixed formatting issues causing CI failure
|
|
135
|
+
- **Workflow Configuration**: Updated workflows to use master branch for CI badge
|
|
136
|
+
|
|
137
|
+
### Added
|
|
138
|
+
|
|
139
|
+
- **GitHub Packages Support**: Added automated GitHub Packages publishing workflows
|
|
140
|
+
- **Enhanced Documentation**: Updated documentation and policy files
|
|
141
|
+
- **CI/CD Improvements**: Added comprehensive CI/CD pipeline with automated testing and publishing
|
|
142
|
+
|
|
143
|
+
### Changed
|
|
144
|
+
|
|
145
|
+
- **Dependencies**: Updated and reverted dependencies for better compatibility
|
|
146
|
+
- **Line Endings**: Added .gitattributes for consistent line endings across platforms
|
|
147
|
+
- **Linting**: Fixed lint and formatting issues for CI compliance
|
|
55
148
|
|
|
56
149
|
## [1.1.1] - 2024-12-18
|
|
57
150
|
|
|
@@ -59,6 +152,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
59
152
|
|
|
60
153
|
- Fixed linter errors caused by Windows line endings
|
|
61
154
|
- Improved code formatting and consistency
|
|
155
|
+
- **GitHub Packages Workflow**: Enhanced GitHub Packages workflow with debugging and GITHUB_TOKEN usage
|
|
156
|
+
- **Package Configuration**: Fixed package names configuration for different registries
|
|
157
|
+
- **Permissions**: Added proper permissions to npm publish job
|
|
158
|
+
|
|
159
|
+
### Added
|
|
160
|
+
|
|
161
|
+
- **Manual Trigger Support**: Added manual trigger support to publish workflows
|
|
162
|
+
- **Dedicated Tokens**: Implemented dedicated GH_PACKAGES_TOKEN for GitHub Packages publishing
|
|
163
|
+
|
|
164
|
+
### Changed
|
|
165
|
+
|
|
166
|
+
- **Workflow Splitting**: Split deployment workflows for npm and GitHub Packages
|
|
167
|
+
- **Documentation Links**: Updated API documentation links to correct Odesli API docs
|
|
62
168
|
|
|
63
169
|
## [1.1.0] - 2024-12-18
|
|
64
170
|
|
package/LICENSE
CHANGED
|
@@ -1,15 +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
|
|
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
15
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|