odesli.js 1.3.4 → 1.3.6
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/.github/dependabot.yml +56 -0
- package/.github/workflows/dependabot-auto-merge.yml +137 -0
- package/API_IMPROVEMENTS.md +16 -16
- package/README.md +468 -85
- 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/rate-limiter.js +16 -15
- package/package.json +17 -5
- package/scripts/version-bump.js +41 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Enable version updates for npm
|
|
4
|
+
- package-ecosystem: 'npm'
|
|
5
|
+
directory: '/'
|
|
6
|
+
schedule:
|
|
7
|
+
interval: 'weekly'
|
|
8
|
+
day: 'monday'
|
|
9
|
+
time: '09:00'
|
|
10
|
+
timezone: 'America/New_York'
|
|
11
|
+
|
|
12
|
+
# Group minor and patch updates together
|
|
13
|
+
groups:
|
|
14
|
+
minor-and-patch:
|
|
15
|
+
patterns:
|
|
16
|
+
- '*'
|
|
17
|
+
update-types:
|
|
18
|
+
- 'minor'
|
|
19
|
+
- 'patch'
|
|
20
|
+
|
|
21
|
+
# Commit message format
|
|
22
|
+
commit-message:
|
|
23
|
+
prefix: 'chore'
|
|
24
|
+
prefix-development: 'chore'
|
|
25
|
+
include: 'scope'
|
|
26
|
+
|
|
27
|
+
# PR settings
|
|
28
|
+
open-pull-requests-limit: 10
|
|
29
|
+
reviewers:
|
|
30
|
+
- 'MattrAus'
|
|
31
|
+
assignees:
|
|
32
|
+
- 'MattrAus'
|
|
33
|
+
labels:
|
|
34
|
+
- 'dependencies'
|
|
35
|
+
- 'automated'
|
|
36
|
+
|
|
37
|
+
# Ignore certain updates
|
|
38
|
+
ignore:
|
|
39
|
+
# Ignore major version updates for critical dependencies
|
|
40
|
+
- dependency-name: 'typescript'
|
|
41
|
+
update-types: ['version-update:semver-major']
|
|
42
|
+
- dependency-name: 'jest'
|
|
43
|
+
update-types: ['version-update:semver-major']
|
|
44
|
+
- dependency-name: 'eslint'
|
|
45
|
+
update-types: ['version-update:semver-major']
|
|
46
|
+
# Ignore major updates that break compatibility
|
|
47
|
+
- dependency-name: 'eslint-plugin-promise'
|
|
48
|
+
update-types: ['version-update:semver-major']
|
|
49
|
+
- dependency-name: 'node-fetch'
|
|
50
|
+
update-types: ['version-update:semver-major']
|
|
51
|
+
|
|
52
|
+
# Rebase strategy
|
|
53
|
+
rebase-strategy: 'auto'
|
|
54
|
+
|
|
55
|
+
# Versioning strategy
|
|
56
|
+
versioning-strategy: 'auto'
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
name: Dependabot Auto Merge
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
6
|
+
branches: [master]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
packages: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
dependabot-auto-merge:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
if: github.actor == 'dependabot[bot]'
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
ref: ${{ github.head_ref }}
|
|
23
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
24
|
+
|
|
25
|
+
- name: Use Node.js
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: '20.x'
|
|
29
|
+
cache: 'npm'
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: npm ci
|
|
33
|
+
|
|
34
|
+
- name: Run linting
|
|
35
|
+
run: npm run lint
|
|
36
|
+
|
|
37
|
+
- name: Check formatting
|
|
38
|
+
run: npm run format:check
|
|
39
|
+
|
|
40
|
+
- name: Run tests
|
|
41
|
+
run: npm test
|
|
42
|
+
|
|
43
|
+
- name: Run security audit
|
|
44
|
+
run: npm audit --audit-level=moderate
|
|
45
|
+
|
|
46
|
+
- name: Build project
|
|
47
|
+
run: npm run build
|
|
48
|
+
|
|
49
|
+
- name: Auto-approve PR
|
|
50
|
+
uses: actions/github-script@v7
|
|
51
|
+
with:
|
|
52
|
+
script: |
|
|
53
|
+
github.rest.pulls.createReview({
|
|
54
|
+
owner: context.repo.owner,
|
|
55
|
+
repo: context.repo.repo,
|
|
56
|
+
pull_number: context.issue.number,
|
|
57
|
+
event: 'APPROVE',
|
|
58
|
+
body: '✅ Automated approval: All tests passed successfully!'
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
- name: Comment on PR
|
|
62
|
+
uses: actions/github-script@v7
|
|
63
|
+
with:
|
|
64
|
+
script: |
|
|
65
|
+
github.rest.issues.createComment({
|
|
66
|
+
owner: context.repo.owner,
|
|
67
|
+
repo: context.repo.repo,
|
|
68
|
+
issue_number: context.issue.number,
|
|
69
|
+
body: '✅ All tests passed! This PR is ready for merge.'
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
# Auto-release after Dependabot PR is merged
|
|
73
|
+
auto-release:
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
needs: dependabot-auto-merge
|
|
76
|
+
if: github.actor == 'dependabot[bot]' && github.event.pull_request.merged == true
|
|
77
|
+
|
|
78
|
+
steps:
|
|
79
|
+
- name: Checkout code
|
|
80
|
+
uses: actions/checkout@v4
|
|
81
|
+
with:
|
|
82
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
83
|
+
|
|
84
|
+
- name: Use Node.js
|
|
85
|
+
uses: actions/setup-node@v4
|
|
86
|
+
with:
|
|
87
|
+
node-version: '20.x'
|
|
88
|
+
cache: 'npm'
|
|
89
|
+
|
|
90
|
+
- name: Install dependencies
|
|
91
|
+
run: npm ci
|
|
92
|
+
|
|
93
|
+
- name: Bump version
|
|
94
|
+
id: version
|
|
95
|
+
run: |
|
|
96
|
+
npm run version:patch
|
|
97
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
98
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
99
|
+
|
|
100
|
+
- name: Create git tag
|
|
101
|
+
run: |
|
|
102
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
103
|
+
git config --local user.email "action@github.com"
|
|
104
|
+
git config --local user.name "GitHub Action"
|
|
105
|
+
git add package.json
|
|
106
|
+
git commit -m "chore: bump version to $VERSION"
|
|
107
|
+
git tag "v$VERSION"
|
|
108
|
+
git push origin HEAD:master --tags
|
|
109
|
+
|
|
110
|
+
- name: Create Release
|
|
111
|
+
uses: actions/create-release@v1
|
|
112
|
+
env:
|
|
113
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
114
|
+
with:
|
|
115
|
+
tag_name: v${{ steps.version.outputs.version }}
|
|
116
|
+
release_name: Release v${{ steps.version.outputs.version }}
|
|
117
|
+
body: |
|
|
118
|
+
## 🔄 Dependabot Update
|
|
119
|
+
|
|
120
|
+
This release includes dependency updates from Dependabot.
|
|
121
|
+
|
|
122
|
+
### Changes
|
|
123
|
+
- Updated dependencies to latest versions
|
|
124
|
+
- All tests passing ✅
|
|
125
|
+
- Security audit passed ✅
|
|
126
|
+
|
|
127
|
+
### Updated Dependencies
|
|
128
|
+
${{ github.event.pull_request.body }}
|
|
129
|
+
draft: false
|
|
130
|
+
prerelease: false
|
|
131
|
+
|
|
132
|
+
- name: Publish to NPM
|
|
133
|
+
run: |
|
|
134
|
+
npm pkg set name="odesli.js"
|
|
135
|
+
npm publish --access public
|
|
136
|
+
env:
|
|
137
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
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
|
|