@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/dist/api/File.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class File extends Base {
|
|
|
13
13
|
* [String, Bool](gateway, succeeded)
|
|
14
14
|
* Can be used for tracking metrics on which gateways were used.
|
|
15
15
|
*/
|
|
16
|
-
fetchCID(cid: string, creatorNodeGateways: string[], callback?: Nullable<(url: string) => void>, responseType?: ResponseType, trackId?: null): Promise<import("axios").AxiosResponse<any> | undefined>;
|
|
16
|
+
fetchCID(cid: string, creatorNodeGateways: string[], callback?: Nullable<(url: string) => void>, responseType?: ResponseType, trackId?: null, premiumContentHeaders?: {}): Promise<import("axios").AxiosResponse<any> | undefined>;
|
|
17
17
|
/**
|
|
18
18
|
* Fetches a file from Content Node with a given CID. Follows the same pattern
|
|
19
19
|
* as fetchCID, but resolves with a download of the file rather than
|
package/dist/index.cjs.js
CHANGED
|
@@ -33643,7 +33643,7 @@ var formatProviders = function formatProviders(providers) {
|
|
|
33643
33643
|
};
|
|
33644
33644
|
|
|
33645
33645
|
var name = "@audius/sdk";
|
|
33646
|
-
var version = "1.0.6-beta.
|
|
33646
|
+
var version = "1.0.6-beta.2";
|
|
33647
33647
|
var audius = {
|
|
33648
33648
|
releaseSHA: "e85874b984816113090067e11a5524462622f3cf"
|
|
33649
33649
|
};
|
|
@@ -57101,6 +57101,7 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
57101
57101
|
var callback,
|
|
57102
57102
|
responseType,
|
|
57103
57103
|
trackId,
|
|
57104
|
+
premiumContentHeaders,
|
|
57104
57105
|
urls,
|
|
57105
57106
|
_args2 = arguments;
|
|
57106
57107
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -57110,6 +57111,7 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
57110
57111
|
callback = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : null;
|
|
57111
57112
|
responseType = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : 'blob';
|
|
57112
57113
|
trackId = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : null;
|
|
57114
|
+
premiumContentHeaders = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : {};
|
|
57113
57115
|
urls = [];
|
|
57114
57116
|
creatorNodeGateways.forEach(function (gateway) {
|
|
57115
57117
|
var gatewayWithCid = urlJoin__default["default"](gateway, cid);
|
|
@@ -57120,10 +57122,10 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
57120
57122
|
});
|
|
57121
57123
|
urls.push(gatewayWithCid);
|
|
57122
57124
|
});
|
|
57123
|
-
_context2.next =
|
|
57125
|
+
_context2.next = 8;
|
|
57124
57126
|
return retry__default["default"]( /*#__PURE__*/function () {
|
|
57125
57127
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(bail) {
|
|
57126
|
-
var _yield$raceRequests, response, errored,
|
|
57128
|
+
var _yield$raceRequests, response, errored, allForbidden, legacyUrls, _yield$raceRequests2, _response;
|
|
57127
57129
|
|
|
57128
57130
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57129
57131
|
while (1) {
|
|
@@ -57131,10 +57133,10 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
57131
57133
|
case 0:
|
|
57132
57134
|
_context.prev = 0;
|
|
57133
57135
|
_context.next = 3;
|
|
57134
|
-
return raceRequests(urls, callback, {
|
|
57136
|
+
return raceRequests(urls, callback, _objectSpread2({
|
|
57135
57137
|
method: 'get',
|
|
57136
57138
|
responseType: responseType
|
|
57137
|
-
},
|
|
57139
|
+
}, premiumContentHeaders),
|
|
57138
57140
|
/* timeout */
|
|
57139
57141
|
null);
|
|
57140
57142
|
|
|
@@ -57148,18 +57150,18 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
57148
57150
|
break;
|
|
57149
57151
|
}
|
|
57150
57152
|
|
|
57151
|
-
|
|
57153
|
+
allForbidden = errored.every( // @ts-expect-error not valid axios error
|
|
57152
57154
|
function (error) {
|
|
57153
57155
|
return error.response.status === 403;
|
|
57154
57156
|
});
|
|
57155
57157
|
|
|
57156
|
-
if (!
|
|
57158
|
+
if (!allForbidden) {
|
|
57157
57159
|
_context.next = 11;
|
|
57158
57160
|
break;
|
|
57159
57161
|
}
|
|
57160
57162
|
|
|
57161
57163
|
// In the case for a 403, do not retry fetching
|
|
57162
|
-
bail(new Error('
|
|
57164
|
+
bail(new Error('Forbidden'));
|
|
57163
57165
|
return _context.abrupt("return");
|
|
57164
57166
|
|
|
57165
57167
|
case 11:
|
|
@@ -57190,7 +57192,8 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
57190
57192
|
_context.next = 23;
|
|
57191
57193
|
return raceRequests(legacyUrls, callback, {
|
|
57192
57194
|
method: 'get',
|
|
57193
|
-
responseType: responseType
|
|
57195
|
+
responseType: responseType // todo: Do we need to also set the premium content headers in this legacy flow?
|
|
57196
|
+
|
|
57194
57197
|
},
|
|
57195
57198
|
/* timeout */
|
|
57196
57199
|
null);
|
|
@@ -57239,10 +57242,10 @@ var File = /*#__PURE__*/function (_Base) {
|
|
|
57239
57242
|
}
|
|
57240
57243
|
});
|
|
57241
57244
|
|
|
57242
|
-
case
|
|
57245
|
+
case 8:
|
|
57243
57246
|
return _context2.abrupt("return", _context2.sent);
|
|
57244
57247
|
|
|
57245
|
-
case
|
|
57248
|
+
case 9:
|
|
57246
57249
|
case "end":
|
|
57247
57250
|
return _context2.stop();
|
|
57248
57251
|
}
|