@audius/sdk 1.0.6-beta.1 → 1.0.6-beta.2
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/dist/api/File.d.ts +1 -1
- package/dist/index.cjs.js +14 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/legacy.js +14 -11
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +14 -11
- package/dist/native-libs.js.map +1 -1
- package/package.json +1 -1
- package/src/api/File.ts +8 -5
package/package.json
CHANGED
package/src/api/File.ts
CHANGED
|
@@ -44,7 +44,8 @@ export class File extends Base {
|
|
|
44
44
|
creatorNodeGateways: string[],
|
|
45
45
|
callback: Nullable<(url: string) => void> = null,
|
|
46
46
|
responseType: ResponseType = 'blob',
|
|
47
|
-
trackId = null
|
|
47
|
+
trackId = null,
|
|
48
|
+
premiumContentHeaders = {}
|
|
48
49
|
) {
|
|
49
50
|
const urls: string[] = []
|
|
50
51
|
|
|
@@ -63,19 +64,20 @@ export class File extends Base {
|
|
|
63
64
|
callback!,
|
|
64
65
|
{
|
|
65
66
|
method: 'get',
|
|
66
|
-
responseType
|
|
67
|
+
responseType,
|
|
68
|
+
...premiumContentHeaders
|
|
67
69
|
},
|
|
68
70
|
/* timeout */ null
|
|
69
71
|
)
|
|
70
72
|
|
|
71
73
|
if (!response) {
|
|
72
|
-
const
|
|
74
|
+
const allForbidden = errored.every(
|
|
73
75
|
// @ts-expect-error not valid axios error
|
|
74
76
|
(error) => error.response.status === 403
|
|
75
77
|
)
|
|
76
|
-
if (
|
|
78
|
+
if (allForbidden) {
|
|
77
79
|
// In the case for a 403, do not retry fetching
|
|
78
|
-
bail(new Error('
|
|
80
|
+
bail(new Error('Forbidden'))
|
|
79
81
|
return
|
|
80
82
|
}
|
|
81
83
|
throw new Error(`Could not fetch ${cid}`)
|
|
@@ -99,6 +101,7 @@ export class File extends Base {
|
|
|
99
101
|
{
|
|
100
102
|
method: 'get',
|
|
101
103
|
responseType
|
|
104
|
+
// todo: Do we need to also set the premium content headers in this legacy flow?
|
|
102
105
|
},
|
|
103
106
|
/* timeout */ null
|
|
104
107
|
)
|