pinata 1.4.0 → 1.4.1
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/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -385,7 +385,7 @@ var deleteFile = async (config, files) => {
|
|
|
385
385
|
} else {
|
|
386
386
|
headers = {
|
|
387
387
|
Authorization: `Bearer ${config.pinataJwt}`,
|
|
388
|
-
Source: "sdk/
|
|
388
|
+
Source: "sdk/deleteFile"
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
391
|
let endpoint = "https://api.pinata.cloud/v3";
|
|
@@ -613,12 +613,19 @@ var getCid = async (config, cid, options) => {
|
|
|
613
613
|
if (config.endpointUrl) {
|
|
614
614
|
endpoint = config.endpointUrl;
|
|
615
615
|
}
|
|
616
|
+
let headers;
|
|
617
|
+
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
618
|
+
headers = { ...config.customHeaders };
|
|
619
|
+
} else {
|
|
620
|
+
headers = {
|
|
621
|
+
"Content-Type": "application/json",
|
|
622
|
+
Authorization: `Bearer ${config.pinataJwt}`,
|
|
623
|
+
Source: "sdk/getCid"
|
|
624
|
+
};
|
|
625
|
+
}
|
|
616
626
|
const signedUrlRequest = await fetch(`${endpoint}/files/sign`, {
|
|
617
627
|
method: "POST",
|
|
618
|
-
headers
|
|
619
|
-
"Content-Type": "application/json",
|
|
620
|
-
Authorization: `Bearer ${config?.pinataJwt}`
|
|
621
|
-
},
|
|
628
|
+
headers,
|
|
622
629
|
body: payload
|
|
623
630
|
});
|
|
624
631
|
const signedUrl = await signedUrlRequest.json();
|
|
@@ -1402,13 +1409,20 @@ var createSignedURL = async (config, options, imgOpts) => {
|
|
|
1402
1409
|
if (config.endpointUrl) {
|
|
1403
1410
|
endpoint = config.endpointUrl;
|
|
1404
1411
|
}
|
|
1412
|
+
let headers;
|
|
1413
|
+
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
1414
|
+
headers = { ...config.customHeaders };
|
|
1415
|
+
} else {
|
|
1416
|
+
headers = {
|
|
1417
|
+
"Content-Type": "application/json",
|
|
1418
|
+
Authorization: `Bearer ${config.pinataJwt}`,
|
|
1419
|
+
Source: "sdk/createSignURL"
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1405
1422
|
try {
|
|
1406
1423
|
const request = await fetch(`${endpoint}/files/sign`, {
|
|
1407
1424
|
method: "POST",
|
|
1408
|
-
headers
|
|
1409
|
-
"Content-Type": "application/json",
|
|
1410
|
-
Authorization: `Bearer ${config?.pinataJwt}`
|
|
1411
|
-
},
|
|
1425
|
+
headers,
|
|
1412
1426
|
body: payload
|
|
1413
1427
|
});
|
|
1414
1428
|
if (!request.ok) {
|