odesli.js 1.3.9 → 2.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/README.md +97 -85
- package/lib/index.d.ts +114 -17
- package/lib/index.js +893 -201
- package/lib/index.mjs +6 -3
- package/package.json +8 -2
- package/.eslintrc.js +0 -33
- package/.gitattributes +0 -1
- package/.github/dependabot.yml +0 -56
- package/.github/workflows/ci.yml +0 -94
- package/.github/workflows/dependabot-auto-merge.yml +0 -137
- package/.github/workflows/publish-github-packages.yml +0 -46
- package/.github/workflows/publish-npm.yml +0 -133
- package/.prettierignore +0 -31
- package/.prettierrc +0 -11
- package/API_IMPROVEMENTS.md +0 -318
- package/CHANGELOG.md +0 -256
- package/CODE_OF_CONDUCT.md +0 -125
- package/CONTRIBUTING.md +0 -104
- package/RELEASE_NOTES_1.1.0.md +0 -84
- package/SECURITY.md +0 -112
- package/examples/README.md +0 -442
- package/examples/advanced-features-example.js +0 -205
- package/examples/advanced-usage.js +0 -247
- package/examples/basic-usage.js +0 -100
- package/examples/cache-test.js +0 -119
- package/examples/rate-limiter-strategies.js +0 -83
- package/examples/test-apple-music-extraction.js +0 -60
- package/examples/user-agent-example.js +0 -46
- package/jest.config.js +0 -14
- package/jsdoc.json +0 -24
- package/scripts/version-bump.js +0 -41
- package/tests/advanced-features.test.js +0 -423
- package/tests/odesli.test.js +0 -742
- package/tests/setup.js +0 -22
- package/tsconfig.json +0 -21
package/API_IMPROVEMENTS.md
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
# Odesli.js API Improvements
|
|
2
|
-
|
|
3
|
-
This document outlines the comprehensive improvements made to the Odesli API client to enhance functionality, reliability, and developer experience.
|
|
4
|
-
|
|
5
|
-
## 🚀 New Constructor Parameters
|
|
6
|
-
|
|
7
|
-
### Enhanced Configuration Options
|
|
8
|
-
|
|
9
|
-
The constructor now accepts a comprehensive options object with the following parameters:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
const odesli = new Odesli({
|
|
13
|
-
// Core options
|
|
14
|
-
apiKey: 'your-api-key', // Optional API key for higher rate limits
|
|
15
|
-
version: 'v1-alpha.1', // API version (defaults to 'v1-alpha.1')
|
|
16
|
-
|
|
17
|
-
// Caching and performance
|
|
18
|
-
cache: true, // Enable response caching (defaults to true)
|
|
19
|
-
timeout: 10000, // Request timeout in milliseconds (defaults to 10000)
|
|
20
|
-
|
|
21
|
-
// Retry logic
|
|
22
|
-
maxRetries: 3, // Maximum retry attempts (defaults to 3)
|
|
23
|
-
retryDelay: 1000, // Base delay between retries (defaults to 1000)
|
|
24
|
-
|
|
25
|
-
// Customization
|
|
26
|
-
headers: { 'User-Agent': 'MyApp/1.0' }, // Additional request headers
|
|
27
|
-
baseUrl: 'https://api.song.link', // Custom base URL
|
|
28
|
-
validateParams: true, // Enable parameter validation (defaults to true)
|
|
29
|
-
logger: (message, level) => console.log(`[${level}] ${message}`), // Custom logger
|
|
30
|
-
});
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## 🔧 Enhanced Method Parameters
|
|
34
|
-
|
|
35
|
-
### Options Object Support
|
|
36
|
-
|
|
37
|
-
All methods now support both backward-compatible string parameters and new options objects:
|
|
38
|
-
|
|
39
|
-
#### `fetch(url, options)`
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
// Backward compatible
|
|
43
|
-
const song = await odesli.fetch(url, 'GB');
|
|
44
|
-
|
|
45
|
-
// New options object
|
|
46
|
-
const song = await odesli.fetch(url, {
|
|
47
|
-
country: 'GB',
|
|
48
|
-
skipCache: true,
|
|
49
|
-
timeout: 5000,
|
|
50
|
-
});
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
#### `getByParams(platform, type, id, options)`
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
// Backward compatible
|
|
57
|
-
const song = await odesli.getByParams('spotify', 'song', '123', 'GB');
|
|
58
|
-
|
|
59
|
-
// New options object
|
|
60
|
-
const song = await odesli.getByParams('spotify', 'song', '123', {
|
|
61
|
-
country: 'GB',
|
|
62
|
-
skipCache: false,
|
|
63
|
-
timeout: 8000,
|
|
64
|
-
});
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### `getById(id, options)`
|
|
68
|
-
|
|
69
|
-
```js
|
|
70
|
-
// Backward compatible
|
|
71
|
-
const song = await odesli.getById('SPOTIFY_SONG::123', 'GB');
|
|
72
|
-
|
|
73
|
-
// New options object
|
|
74
|
-
const song = await odesli.getById('SPOTIFY_SONG::123', {
|
|
75
|
-
country: 'GB',
|
|
76
|
-
skipCache: true,
|
|
77
|
-
timeout: 6000,
|
|
78
|
-
});
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## 🆕 New Utility Methods
|
|
82
|
-
|
|
83
|
-
### Batch Operations
|
|
84
|
-
|
|
85
|
-
```js
|
|
86
|
-
// Fetch multiple songs with concurrency control
|
|
87
|
-
const urls = [
|
|
88
|
-
'https://open.spotify.com/track/123',
|
|
89
|
-
'https://open.spotify.com/track/456',
|
|
90
|
-
'https://open.spotify.com/track/789',
|
|
91
|
-
];
|
|
92
|
-
|
|
93
|
-
const results = await odesli.fetchBatch(urls, {
|
|
94
|
-
country: 'US',
|
|
95
|
-
concurrency: 3,
|
|
96
|
-
skipCache: false,
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Platform Detection
|
|
101
|
-
|
|
102
|
-
```js
|
|
103
|
-
// Detect platform from URL
|
|
104
|
-
const platform = odesli.detectPlatform('https://open.spotify.com/track/123');
|
|
105
|
-
console.log(platform); // 'spotify'
|
|
106
|
-
|
|
107
|
-
// Extract ID from platform URL
|
|
108
|
-
const id = odesli.extractId(
|
|
109
|
-
'https://open.spotify.com/track/4Km5HrUvYTaSUfiSGPJeQR'
|
|
110
|
-
);
|
|
111
|
-
console.log(id); // '4Km5HrUvYTaSUfiSGPJeQR'
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Platform Information
|
|
115
|
-
|
|
116
|
-
```js
|
|
117
|
-
// Get list of supported platforms
|
|
118
|
-
const platforms = odesli.getSupportedPlatforms();
|
|
119
|
-
console.log(platforms); // ['spotify', 'appleMusic', 'youtube', ...]
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Enhanced Cache Statistics
|
|
123
|
-
|
|
124
|
-
```js
|
|
125
|
-
// Get detailed cache statistics
|
|
126
|
-
const stats = odesli.getCacheStats();
|
|
127
|
-
console.log(`Cache size: ${stats.size}`);
|
|
128
|
-
console.log(`Hit rate: ${stats.hitRate}%`);
|
|
129
|
-
console.log(`Total requests: ${stats.totalRequests}`);
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## 🛡️ Improved Error Handling & Validation
|
|
133
|
-
|
|
134
|
-
### Parameter Validation
|
|
135
|
-
|
|
136
|
-
- **URL validation**: Ensures valid URL format
|
|
137
|
-
- **Country code validation**: Validates ISO 3166-1 Alpha-2 format
|
|
138
|
-
- **Platform validation**: Ensures platform is supported
|
|
139
|
-
- **Type validation**: Validates 'song' or 'album' types
|
|
140
|
-
|
|
141
|
-
### Retry Logic
|
|
142
|
-
|
|
143
|
-
- **Exponential backoff**: Intelligent retry delays
|
|
144
|
-
- **Non-retryable errors**: Skips retries for 4xx/5xx errors
|
|
145
|
-
- **Configurable retries**: Customizable retry attempts and delays
|
|
146
|
-
|
|
147
|
-
### Enhanced Error Messages
|
|
148
|
-
|
|
149
|
-
```js
|
|
150
|
-
// Clear, descriptive error messages
|
|
151
|
-
try {
|
|
152
|
-
await odesli.fetch('invalid-url');
|
|
153
|
-
} catch (error) {
|
|
154
|
-
console.log(error.message); // "Invalid URL format provided to odesli.fetch()"
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
try {
|
|
158
|
-
await odesli.getByParams('invalid-platform', 'song', '123');
|
|
159
|
-
} catch (error) {
|
|
160
|
-
console.log(error.message); // "Invalid platform 'invalid-platform'. Must be one of: spotify, itunes, ..."
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
## 🔄 Backward Compatibility
|
|
165
|
-
|
|
166
|
-
All existing code continues to work without modification:
|
|
167
|
-
|
|
168
|
-
```js
|
|
169
|
-
// These all still work exactly as before
|
|
170
|
-
const song1 = await odesli.fetch('https://open.spotify.com/track/123');
|
|
171
|
-
const song2 = await odesli.fetch('https://open.spotify.com/track/123', 'GB');
|
|
172
|
-
const song3 = await odesli.getByParams('spotify', 'song', '123');
|
|
173
|
-
const song4 = await odesli.getByParams('spotify', 'song', '123', 'GB');
|
|
174
|
-
const song5 = await odesli.getById('SPOTIFY_SONG::123');
|
|
175
|
-
const song6 = await odesli.getById('SPOTIFY_SONG::123', 'GB');
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## 📊 Performance Improvements
|
|
179
|
-
|
|
180
|
-
### Intelligent Caching
|
|
181
|
-
|
|
182
|
-
- **Configurable TTL**: 5-minute default cache duration
|
|
183
|
-
- **Per-request cache control**: Skip cache for specific requests
|
|
184
|
-
- **Cache statistics**: Monitor cache performance
|
|
185
|
-
|
|
186
|
-
### Request Optimization
|
|
187
|
-
|
|
188
|
-
- **Custom headers**: Add application-specific headers
|
|
189
|
-
- **Configurable timeouts**: Per-request timeout overrides
|
|
190
|
-
- **Base URL customization**: Support for different API endpoints
|
|
191
|
-
|
|
192
|
-
### Concurrency Control
|
|
193
|
-
|
|
194
|
-
- **Batch processing**: Efficient parallel requests
|
|
195
|
-
- **Configurable concurrency**: Control request rate
|
|
196
|
-
- **Error resilience**: Graceful handling of failed requests
|
|
197
|
-
|
|
198
|
-
## 🧪 Enhanced Testing & Debugging
|
|
199
|
-
|
|
200
|
-
### Logging Support
|
|
201
|
-
|
|
202
|
-
```js
|
|
203
|
-
const odesli = new Odesli({
|
|
204
|
-
logger: (message, level) => {
|
|
205
|
-
console.log(`[${level.toUpperCase()}] ${message}`);
|
|
206
|
-
},
|
|
207
|
-
});
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Validation Control
|
|
211
|
-
|
|
212
|
-
```js
|
|
213
|
-
// Disable validation for performance
|
|
214
|
-
const odesli = new Odesli({
|
|
215
|
-
validateParams: false,
|
|
216
|
-
});
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## 📈 TypeScript Improvements
|
|
220
|
-
|
|
221
|
-
### Enhanced Type Definitions
|
|
222
|
-
|
|
223
|
-
- **Comprehensive options types**: Full type safety for all parameters
|
|
224
|
-
- **Union types**: Support for both string and object parameters
|
|
225
|
-
- **Detailed return types**: Complete response object definitions
|
|
226
|
-
|
|
227
|
-
## 🎯 Use Cases
|
|
228
|
-
|
|
229
|
-
### Production Applications
|
|
230
|
-
|
|
231
|
-
```js
|
|
232
|
-
const odesli = new Odesli({
|
|
233
|
-
apiKey: process.env.ODESLI_API_KEY,
|
|
234
|
-
maxRetries: 3,
|
|
235
|
-
retryDelay: 1000,
|
|
236
|
-
timeout: 15000,
|
|
237
|
-
validateParams: true,
|
|
238
|
-
logger: (message, level) => {
|
|
239
|
-
if (level === 'error') {
|
|
240
|
-
console.error(`[ODESLI] ${message}`);
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Development & Testing
|
|
247
|
-
|
|
248
|
-
```js
|
|
249
|
-
const odesli = new Odesli({
|
|
250
|
-
cache: false,
|
|
251
|
-
validateParams: true,
|
|
252
|
-
timeout: 5000,
|
|
253
|
-
logger: console.log,
|
|
254
|
-
});
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### High-Volume Processing
|
|
258
|
-
|
|
259
|
-
```js
|
|
260
|
-
const odesli = new Odesli({
|
|
261
|
-
apiKey: process.env.ODESLI_API_KEY,
|
|
262
|
-
maxRetries: 5,
|
|
263
|
-
retryDelay: 500,
|
|
264
|
-
timeout: 10000,
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
// Process large batches efficiently
|
|
268
|
-
const results = await odesli.fetchBatch(largeUrlArray, {
|
|
269
|
-
concurrency: 10,
|
|
270
|
-
skipCache: true,
|
|
271
|
-
});
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
## 🔮 Future Considerations
|
|
275
|
-
|
|
276
|
-
These improvements provide a solid foundation for future enhancements:
|
|
277
|
-
|
|
278
|
-
- **Rate limiting**: Built-in rate limit handling
|
|
279
|
-
- **Webhook support**: Real-time updates
|
|
280
|
-
- **Advanced caching**: Redis/Memcached integration
|
|
281
|
-
- **Metrics collection**: Request/response analytics
|
|
282
|
-
- **Plugin system**: Extensible functionality
|
|
283
|
-
|
|
284
|
-
## 📝 Migration Guide
|
|
285
|
-
|
|
286
|
-
### For Existing Users
|
|
287
|
-
|
|
288
|
-
No migration required! All existing code continues to work unchanged.
|
|
289
|
-
|
|
290
|
-
### For New Features
|
|
291
|
-
|
|
292
|
-
Use the new options objects for enhanced functionality:
|
|
293
|
-
|
|
294
|
-
```js
|
|
295
|
-
// Old way (still works)
|
|
296
|
-
const song = await odesli.fetch(url, 'GB');
|
|
297
|
-
|
|
298
|
-
// New way (recommended)
|
|
299
|
-
const song = await odesli.fetch(url, {
|
|
300
|
-
country: 'GB',
|
|
301
|
-
skipCache: false,
|
|
302
|
-
timeout: 8000,
|
|
303
|
-
});
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## 🎉 Summary
|
|
307
|
-
|
|
308
|
-
The improved Odesli API client now provides:
|
|
309
|
-
|
|
310
|
-
- ✅ **Enhanced configuration** with comprehensive options
|
|
311
|
-
- ✅ **Better error handling** with validation and retry logic
|
|
312
|
-
- ✅ **New utility methods** for common operations
|
|
313
|
-
- ✅ **Improved performance** with intelligent caching
|
|
314
|
-
- ✅ **Full backward compatibility** with existing code
|
|
315
|
-
- ✅ **Enhanced TypeScript support** with complete type definitions
|
|
316
|
-
- ✅ **Production-ready features** for enterprise use cases
|
|
317
|
-
|
|
318
|
-
These improvements make the Odesli client more robust, flexible, and developer-friendly while maintaining full compatibility with existing implementations.
|
package/CHANGELOG.md
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
<!-- markdownlint-disable MD024 -->
|
|
2
|
-
|
|
3
|
-
# Changelog
|
|
4
|
-
|
|
5
|
-
All notable changes to this project will be documented in this file.
|
|
6
|
-
|
|
7
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
8
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
9
|
-
|
|
10
|
-
## [1.3.9] - 2025-12-20
|
|
11
|
-
|
|
12
|
-
### Security
|
|
13
|
-
|
|
14
|
-
- **Dependency Security**: Added npm overrides for js-yaml to fix CVE-2025-64718 (prototype pollution vulnerability)
|
|
15
|
-
|
|
16
|
-
### Changed
|
|
17
|
-
|
|
18
|
-
- Updated dependencies via npm update
|
|
19
|
-
|
|
20
|
-
## [1.3.8] - 2025-10-04
|
|
21
|
-
|
|
22
|
-
### Changed
|
|
23
|
-
|
|
24
|
-
- **Dependency Updates**: Updated multiple development dependencies to their latest compatible versions for improved security and performance
|
|
25
|
-
- Updated `@types/node` from 24.0.13 to 24.6.2
|
|
26
|
-
- Updated `@types/jest` from 30.0.0 (already on latest)
|
|
27
|
-
- Updated `eslint-config-prettier` from 10.1.5 to 10.1.8
|
|
28
|
-
- Updated `eslint-plugin-import` from 2.28.0 to 2.32.0
|
|
29
|
-
- Updated `eslint-plugin-prettier` from 5.5.1 to 5.5.4
|
|
30
|
-
- Updated `jest` from 29.5.0 to 30.2.0 (major version update)
|
|
31
|
-
- Updated `jsdoc` from 4.0.2 to 4.0.4
|
|
32
|
-
- Updated `snyk` from 1.1297.3 to 1.1299.1
|
|
33
|
-
- Updated `ts-jest` from 29.1.0 to 29.4.4
|
|
34
|
-
- Updated `typescript` from 5.0.0 to 5.9.3
|
|
35
|
-
|
|
36
|
-
### Notes
|
|
37
|
-
|
|
38
|
-
- Kept `eslint` at 8.57.1 (ESLint 9 requires configuration migration)
|
|
39
|
-
- Kept `node-fetch` at 2.7.0 (v3 is ESM-only, incompatible with current CommonJS setup)
|
|
40
|
-
- Kept `eslint-plugin-promise` at 6.6.0 (v7 has peer dependency conflicts with eslint-config-standard)
|
|
41
|
-
- All tests passing with 100% test suite coverage
|
|
42
|
-
- No security vulnerabilities detected
|
|
43
|
-
|
|
44
|
-
## [1.3.7] - 2025-07-13
|
|
45
|
-
|
|
46
|
-
### Fixed
|
|
47
|
-
|
|
48
|
-
- **Enhanced TypeScript Definitions**: Improved type definitions for better IntelliSense and type safety
|
|
49
|
-
- **Batch Operations Support**: Added proper types for batch URL fetching with error handling
|
|
50
|
-
- **Entity Data Completeness**: Added missing properties to EntityData interface (thumbnailWidth, thumbnailHeight, apiProvider, platforms)
|
|
51
|
-
- **Platform Link Enhancement**: Added entityUniqueId property to PlatformLink interface
|
|
52
|
-
- **Configuration Options**: Added metrics configuration option to OdesliOptions interface
|
|
53
|
-
|
|
54
|
-
### Added
|
|
55
|
-
|
|
56
|
-
- **BatchError Interface**: Proper error typing for batch operations with specific error categories
|
|
57
|
-
- **BatchResult Type**: Type-safe return type for batch fetch operations
|
|
58
|
-
- **Enhanced Error Types**: Added specific error types (BAD_REQUEST, UNAUTHORIZED, RATE_LIMITED, etc.)
|
|
59
|
-
|
|
60
|
-
## [1.3.6] - 2025-07-12
|
|
61
|
-
|
|
62
|
-
### Changed
|
|
63
|
-
|
|
64
|
-
- Version bump for dependency updates and workflow improvements
|
|
65
|
-
|
|
66
|
-
## [1.3.5] - 2025-07-12
|
|
67
|
-
|
|
68
|
-
### Added
|
|
69
|
-
|
|
70
|
-
- **Automated Workflows**: Enhanced Dependabot auto-merge workflow with version bumping and tagging
|
|
71
|
-
- **Dependency Updates**: Updated development dependencies for security and compatibility
|
|
72
|
-
|
|
73
|
-
### Changed
|
|
74
|
-
|
|
75
|
-
- Improved CI/CD pipeline automation
|
|
76
|
-
- Enhanced dependency management workflows
|
|
77
|
-
|
|
78
|
-
## [1.3.4] - 2025-06-23
|
|
79
|
-
|
|
80
|
-
### Changed
|
|
81
|
-
|
|
82
|
-
- **Code Refactoring**: Removed redundant `fetchBatch` method to improve code maintainability
|
|
83
|
-
- **Documentation Updates**: Updated README badges and documentation links
|
|
84
|
-
|
|
85
|
-
### Fixed
|
|
86
|
-
|
|
87
|
-
- **Build System**: Fixed build configuration for better cross-platform compatibility
|
|
88
|
-
- **Dependencies**: Updated development dependencies for improved security
|
|
89
|
-
|
|
90
|
-
## [1.3.3] - 2025-06-23
|
|
91
|
-
|
|
92
|
-
### Changed
|
|
93
|
-
|
|
94
|
-
- Version bump for registry publishing and workflow improvements
|
|
95
|
-
|
|
96
|
-
## [1.3.2] - 2025-06-23
|
|
97
|
-
|
|
98
|
-
### Fixed
|
|
99
|
-
|
|
100
|
-
- **Security Vulnerabilities**: Fixed security vulnerabilities in dependencies
|
|
101
|
-
- **Test Dependencies**: Added missing `jest-fetch-mock` dependency for proper testing
|
|
102
|
-
- **User-Agent Validation**: Relaxed user-agent check in tests for better compatibility
|
|
103
|
-
- **Publishing Workflows**: Streamlined publishing workflows for both npm and GitHub Packages
|
|
104
|
-
|
|
105
|
-
### Changed
|
|
106
|
-
|
|
107
|
-
- Updated package-lock.json and package.json for security improvements
|
|
108
|
-
- Enhanced build and deployment processes
|
|
109
|
-
|
|
110
|
-
## [1.3.1] - 2025-06-23
|
|
111
|
-
|
|
112
|
-
### Changed
|
|
113
|
-
|
|
114
|
-
- Version bump for GitHub Packages release and registry configuration
|
|
115
|
-
|
|
116
|
-
## [1.3.0] - 2025-06-23
|
|
117
|
-
|
|
118
|
-
### Fixed
|
|
119
|
-
|
|
120
|
-
- Fixed a critical bug where an un-referenced `setInterval` in the `MetricsCollector` would cause Node.js processes to hang and not exit gracefully.
|
|
121
|
-
|
|
122
|
-
### Added
|
|
123
|
-
|
|
124
|
-
- The `Odesli` constructor now accepts `{ metrics: false }` as an option to completely disable the metrics collection feature.
|
|
125
|
-
|
|
126
|
-
### Changed
|
|
127
|
-
|
|
128
|
-
- **Code Formatting**: Applied Prettier formatting for consistent code style
|
|
129
|
-
- **Linting**: Resolved linting and formatting errors for better code quality
|
|
130
|
-
- **Metrics Stability**: Improved metrics collector stability and performance
|
|
131
|
-
|
|
132
|
-
> **Note**: For a comprehensive overview of all recent API enhancements and features, please see the [API Improvements](./API_IMPROVEMENTS.md) documentation.
|
|
133
|
-
|
|
134
|
-
## [1.2.0] - 2025-06-22
|
|
135
|
-
|
|
136
|
-
### Added
|
|
137
|
-
|
|
138
|
-
- **Country Code Validation**: Added strict TypeScript validation for country codes using ISO 3166-1 alpha-2 standard
|
|
139
|
-
- **getCountryOptions() Method**: New static method that returns all valid country codes with full country names for UI dropdowns
|
|
140
|
-
- **Enhanced TypeScript Support**: Added `CountryCode` union type for strict country code validation
|
|
141
|
-
- **Improved Examples**: Updated all examples to demonstrate new country code features and comprehensive usage
|
|
142
|
-
- **Comprehensive Testing**: Added extensive tests for country code validation and getCountryOptions method
|
|
143
|
-
- **Better Documentation**: Updated README with TypeScript examples and country code usage patterns
|
|
144
|
-
|
|
145
|
-
### Features
|
|
146
|
-
|
|
147
|
-
- TypeScript autocomplete now shows only valid country codes
|
|
148
|
-
- Full country names available for UI dropdowns via `getCountryOptions()`
|
|
149
|
-
- 249 supported countries with ISO 3166-1 alpha-2 codes
|
|
150
|
-
- Enhanced error handling for invalid country codes
|
|
151
|
-
- Improved batch fetching with country-specific options
|
|
152
|
-
|
|
153
|
-
### Technical Improvements
|
|
154
|
-
|
|
155
|
-
- Added comprehensive test coverage for new country code features
|
|
156
|
-
- Updated TypeScript definitions with strict country code validation
|
|
157
|
-
- Enhanced examples demonstrating all new features
|
|
158
|
-
- Improved documentation with practical usage examples
|
|
159
|
-
|
|
160
|
-
## [1.1.2] - 2024-12-18
|
|
161
|
-
|
|
162
|
-
### Fixed
|
|
163
|
-
|
|
164
|
-
- Fixed User-Agent format to match expected pattern
|
|
165
|
-
- Improved error handling and propagation
|
|
166
|
-
- Fixed test failures related to response handling
|
|
167
|
-
- **ESLint Compatibility**: Resolved ESLint structuredClone compatibility issue
|
|
168
|
-
- **Formatting Issues**: Fixed formatting issues causing CI failure
|
|
169
|
-
- **Workflow Configuration**: Updated workflows to use master branch for CI badge
|
|
170
|
-
|
|
171
|
-
### Added
|
|
172
|
-
|
|
173
|
-
- **GitHub Packages Support**: Added automated GitHub Packages publishing workflows
|
|
174
|
-
- **Enhanced Documentation**: Updated documentation and policy files
|
|
175
|
-
- **CI/CD Improvements**: Added comprehensive CI/CD pipeline with automated testing and publishing
|
|
176
|
-
|
|
177
|
-
### Changed
|
|
178
|
-
|
|
179
|
-
- **Dependencies**: Updated and reverted dependencies for better compatibility
|
|
180
|
-
- **Line Endings**: Added .gitattributes for consistent line endings across platforms
|
|
181
|
-
- **Linting**: Fixed lint and formatting issues for CI compliance
|
|
182
|
-
|
|
183
|
-
## [1.1.1] - 2024-12-18
|
|
184
|
-
|
|
185
|
-
### Fixed
|
|
186
|
-
|
|
187
|
-
- Fixed linter errors caused by Windows line endings
|
|
188
|
-
- Improved code formatting and consistency
|
|
189
|
-
- **GitHub Packages Workflow**: Enhanced GitHub Packages workflow with debugging and GITHUB_TOKEN usage
|
|
190
|
-
- **Package Configuration**: Fixed package names configuration for different registries
|
|
191
|
-
- **Permissions**: Added proper permissions to npm publish job
|
|
192
|
-
|
|
193
|
-
### Added
|
|
194
|
-
|
|
195
|
-
- **Manual Trigger Support**: Added manual trigger support to publish workflows
|
|
196
|
-
- **Dedicated Tokens**: Implemented dedicated GH_PACKAGES_TOKEN for GitHub Packages publishing
|
|
197
|
-
|
|
198
|
-
### Changed
|
|
199
|
-
|
|
200
|
-
- **Workflow Splitting**: Split deployment workflows for npm and GitHub Packages
|
|
201
|
-
- **Documentation Links**: Updated API documentation links to correct Odesli API docs
|
|
202
|
-
|
|
203
|
-
## [1.1.0] - 2024-12-18
|
|
204
|
-
|
|
205
|
-
### Added
|
|
206
|
-
|
|
207
|
-
- **Unified Fetch API**: Single `fetch()` method that handles both single URLs and arrays of URLs
|
|
208
|
-
- **Enhanced Parameter Handling**: Better validation and processing of request parameters
|
|
209
|
-
- **Retry Logic**: Configurable retry mechanism with exponential backoff
|
|
210
|
-
- **Custom Headers**: Support for custom request headers including User-Agent customization
|
|
211
|
-
- **Base URL Customization**: Ability to override the default API base URL
|
|
212
|
-
- **Parameter Validation Toggle**: Option to enable/disable parameter validation
|
|
213
|
-
- **Logging Support**: Built-in logging with customizable log levels
|
|
214
|
-
- **Utility Methods**: Added `detectPlatform()`, `extractId()`, and `getSupportedPlatforms()`
|
|
215
|
-
- **Cache Statistics**: Enhanced cache with detailed statistics and hit rate tracking
|
|
216
|
-
- **Rate Limiter**: Advanced rate limiting with multiple strategies (token-bucket, leaky-bucket, sliding-window)
|
|
217
|
-
- **Metrics Collector**: Comprehensive metrics collection for monitoring and analytics
|
|
218
|
-
- **Plugin System**: Extensible plugin architecture with hooks, middleware, and transformers
|
|
219
|
-
- **Batch Processing**: Efficient batch fetching with concurrency control and error handling
|
|
220
|
-
|
|
221
|
-
### Changed
|
|
222
|
-
|
|
223
|
-
- **Breaking Change**: Replaced individual methods with unified `fetch()` API
|
|
224
|
-
- **Enhanced Error Handling**: More detailed error messages and better error propagation
|
|
225
|
-
- **Improved TypeScript Support**: Better type definitions and stricter validation
|
|
226
|
-
- **Better Documentation**: Comprehensive examples and API documentation
|
|
227
|
-
|
|
228
|
-
### Technical Improvements
|
|
229
|
-
|
|
230
|
-
- Added comprehensive test suite with 100% coverage
|
|
231
|
-
- Enhanced error handling and validation
|
|
232
|
-
- Improved performance with optimized batch processing
|
|
233
|
-
- Better memory management and resource cleanup
|
|
234
|
-
- Enhanced logging and debugging capabilities
|
|
235
|
-
|
|
236
|
-
## [1.0.0] - 2024-12-17
|
|
237
|
-
|
|
238
|
-
### Added
|
|
239
|
-
|
|
240
|
-
- Initial release of odesli.js
|
|
241
|
-
- Basic API client for Odesli.co (formerly song.link/album.link)
|
|
242
|
-
- Support for fetching song and album links across multiple platforms
|
|
243
|
-
- TypeScript definitions
|
|
244
|
-
- Basic caching mechanism
|
|
245
|
-
- Error handling and validation
|
|
246
|
-
- Support for API keys and rate limiting
|
|
247
|
-
- Documentation and examples
|
|
248
|
-
|
|
249
|
-
### Features
|
|
250
|
-
|
|
251
|
-
- Cross-platform music link fetching
|
|
252
|
-
- Support for Spotify, Apple Music, YouTube Music, and more
|
|
253
|
-
- Multi-country support
|
|
254
|
-
- Optional API key for higher rate limits
|
|
255
|
-
- Lightweight and fast performance
|
|
256
|
-
- Comprehensive error handling
|
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
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).
|