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.mjs
CHANGED
|
@@ -359,7 +359,7 @@ var deleteFile = async (config, files) => {
|
|
|
359
359
|
} else {
|
|
360
360
|
headers = {
|
|
361
361
|
Authorization: `Bearer ${config.pinataJwt}`,
|
|
362
|
-
Source: "sdk/
|
|
362
|
+
Source: "sdk/deleteFile"
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
365
|
let endpoint = "https://api.pinata.cloud/v3";
|
|
@@ -587,12 +587,19 @@ var getCid = async (config, cid, options) => {
|
|
|
587
587
|
if (config.endpointUrl) {
|
|
588
588
|
endpoint = config.endpointUrl;
|
|
589
589
|
}
|
|
590
|
+
let headers;
|
|
591
|
+
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
592
|
+
headers = { ...config.customHeaders };
|
|
593
|
+
} else {
|
|
594
|
+
headers = {
|
|
595
|
+
"Content-Type": "application/json",
|
|
596
|
+
Authorization: `Bearer ${config.pinataJwt}`,
|
|
597
|
+
Source: "sdk/getCid"
|
|
598
|
+
};
|
|
599
|
+
}
|
|
590
600
|
const signedUrlRequest = await fetch(`${endpoint}/files/sign`, {
|
|
591
601
|
method: "POST",
|
|
592
|
-
headers
|
|
593
|
-
"Content-Type": "application/json",
|
|
594
|
-
Authorization: `Bearer ${config?.pinataJwt}`
|
|
595
|
-
},
|
|
602
|
+
headers,
|
|
596
603
|
body: payload
|
|
597
604
|
});
|
|
598
605
|
const signedUrl = await signedUrlRequest.json();
|
|
@@ -1376,13 +1383,20 @@ var createSignedURL = async (config, options, imgOpts) => {
|
|
|
1376
1383
|
if (config.endpointUrl) {
|
|
1377
1384
|
endpoint = config.endpointUrl;
|
|
1378
1385
|
}
|
|
1386
|
+
let headers;
|
|
1387
|
+
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
1388
|
+
headers = { ...config.customHeaders };
|
|
1389
|
+
} else {
|
|
1390
|
+
headers = {
|
|
1391
|
+
"Content-Type": "application/json",
|
|
1392
|
+
Authorization: `Bearer ${config.pinataJwt}`,
|
|
1393
|
+
Source: "sdk/createSignURL"
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1379
1396
|
try {
|
|
1380
1397
|
const request = await fetch(`${endpoint}/files/sign`, {
|
|
1381
1398
|
method: "POST",
|
|
1382
|
-
headers
|
|
1383
|
-
"Content-Type": "application/json",
|
|
1384
|
-
Authorization: `Bearer ${config?.pinataJwt}`
|
|
1385
|
-
},
|
|
1399
|
+
headers,
|
|
1386
1400
|
body: payload
|
|
1387
1401
|
});
|
|
1388
1402
|
if (!request.ok) {
|