pinata 0.3.2 → 0.3.3
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +64 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -28,8 +28,8 @@ var ValidationError = class extends PinataError {
|
|
|
28
28
|
|
|
29
29
|
// src/core/authentication/testAuthentication.ts
|
|
30
30
|
var testAuthentication = async (config) => {
|
|
31
|
-
if (!config
|
|
32
|
-
throw new ValidationError("Pinata configuration
|
|
31
|
+
if (!config) {
|
|
32
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
33
33
|
}
|
|
34
34
|
let headers;
|
|
35
35
|
let endpoint = "https://api.pinata.cloud";
|
|
@@ -83,8 +83,8 @@ var testAuthentication = async (config) => {
|
|
|
83
83
|
|
|
84
84
|
// src/core/pinning/file.ts
|
|
85
85
|
var uploadFile = async (config, file, options) => {
|
|
86
|
-
if (!config
|
|
87
|
-
throw new ValidationError("Pinata configuration
|
|
86
|
+
if (!config) {
|
|
87
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
88
88
|
}
|
|
89
89
|
const jwt = options?.keys || config.pinataJwt;
|
|
90
90
|
const data = new FormData();
|
|
@@ -152,8 +152,8 @@ var uploadFile = async (config, file, options) => {
|
|
|
152
152
|
|
|
153
153
|
// src/core/pinning/fileArray.ts
|
|
154
154
|
var uploadFileArray = async (config, files, options) => {
|
|
155
|
-
if (!config
|
|
156
|
-
throw new ValidationError("Pinata configuration
|
|
155
|
+
if (!config) {
|
|
156
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
157
157
|
}
|
|
158
158
|
const jwt = options?.keys || config?.pinataJwt;
|
|
159
159
|
const folder = options?.metadata?.name || "folder_from_sdk";
|
|
@@ -226,8 +226,8 @@ var uploadFileArray = async (config, files, options) => {
|
|
|
226
226
|
|
|
227
227
|
// src/core/pinning/base64.ts
|
|
228
228
|
var uploadBase64 = async (config, base64String, options) => {
|
|
229
|
-
if (!config
|
|
230
|
-
throw new ValidationError("Pinata configuration
|
|
229
|
+
if (!config) {
|
|
230
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
231
231
|
}
|
|
232
232
|
const jwt = options?.keys || config?.pinataJwt;
|
|
233
233
|
const name = options?.metadata?.name ? options?.metadata?.name : "base64 string";
|
|
@@ -300,8 +300,8 @@ var uploadBase64 = async (config, base64String, options) => {
|
|
|
300
300
|
|
|
301
301
|
// src/core/pinning/url.ts
|
|
302
302
|
var uploadUrl = async (config, url, options) => {
|
|
303
|
-
if (!config
|
|
304
|
-
throw new ValidationError("Pinata configuration
|
|
303
|
+
if (!config) {
|
|
304
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
305
305
|
}
|
|
306
306
|
const jwt = options?.keys || config?.pinataJwt;
|
|
307
307
|
const data = new FormData();
|
|
@@ -382,8 +382,8 @@ var uploadUrl = async (config, url, options) => {
|
|
|
382
382
|
|
|
383
383
|
// src/core/pinning/json.ts
|
|
384
384
|
var uploadJson = async (config, jsonData, options) => {
|
|
385
|
-
if (!config
|
|
386
|
-
throw new ValidationError("Pinata configuration
|
|
385
|
+
if (!config) {
|
|
386
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
387
387
|
}
|
|
388
388
|
const jwt = options?.keys || config?.pinataJwt;
|
|
389
389
|
const data = JSON.stringify({
|
|
@@ -447,8 +447,8 @@ var uploadJson = async (config, jsonData, options) => {
|
|
|
447
447
|
|
|
448
448
|
// src/core/pinning/cid.ts
|
|
449
449
|
var uploadCid = async (config, cid, options) => {
|
|
450
|
-
if (!config
|
|
451
|
-
throw new ValidationError("Pinata configuration
|
|
450
|
+
if (!config) {
|
|
451
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
452
452
|
}
|
|
453
453
|
const jwt = options?.keys || config?.pinataJwt;
|
|
454
454
|
let headers;
|
|
@@ -517,8 +517,8 @@ var wait = (milliseconds) => {
|
|
|
517
517
|
});
|
|
518
518
|
};
|
|
519
519
|
var unpinFile = async (config, files) => {
|
|
520
|
-
if (!config
|
|
521
|
-
throw new ValidationError("Pinata configuration
|
|
520
|
+
if (!config) {
|
|
521
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
522
522
|
}
|
|
523
523
|
const responses = [];
|
|
524
524
|
let headers;
|
|
@@ -581,8 +581,8 @@ var unpinFile = async (config, files) => {
|
|
|
581
581
|
|
|
582
582
|
// src/core/data/listFiles.ts
|
|
583
583
|
var listFiles = async (config, options) => {
|
|
584
|
-
if (!config
|
|
585
|
-
throw new ValidationError("Pinata configuration
|
|
584
|
+
if (!config) {
|
|
585
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
586
586
|
}
|
|
587
587
|
const params = new URLSearchParams({
|
|
588
588
|
includesCount: "false"
|
|
@@ -676,8 +676,8 @@ var listFiles = async (config, options) => {
|
|
|
676
676
|
|
|
677
677
|
// src/core/data/updateMetadata.ts
|
|
678
678
|
var updateMetadata = async (config, options) => {
|
|
679
|
-
if (!config
|
|
680
|
-
throw new ValidationError("Pinata configuration
|
|
679
|
+
if (!config) {
|
|
680
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
681
681
|
}
|
|
682
682
|
const data = {
|
|
683
683
|
ipfsPinHash: options.cid,
|
|
@@ -830,8 +830,8 @@ async function convertToDesiredGateway(sourceUrl, desiredGatewayPrefix) {
|
|
|
830
830
|
|
|
831
831
|
// src/core/gateway/getCid.ts
|
|
832
832
|
var getCid = async (config, cid) => {
|
|
833
|
-
if (!config
|
|
834
|
-
throw new ValidationError("Pinata configuration
|
|
833
|
+
if (!config) {
|
|
834
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
835
835
|
}
|
|
836
836
|
let data;
|
|
837
837
|
let newUrl;
|
|
@@ -894,8 +894,8 @@ var convertIPFSUrl = async (config, url) => {
|
|
|
894
894
|
|
|
895
895
|
// src/core/data/pinJobs.ts
|
|
896
896
|
var pinJobs = async (config, options) => {
|
|
897
|
-
if (!config
|
|
898
|
-
throw new ValidationError("Pinata configuration
|
|
897
|
+
if (!config) {
|
|
898
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
899
899
|
}
|
|
900
900
|
const params = new URLSearchParams({
|
|
901
901
|
includesCount: "false"
|
|
@@ -962,8 +962,8 @@ var pinJobs = async (config, options) => {
|
|
|
962
962
|
|
|
963
963
|
// src/core/data/pinnedFileUsage.ts
|
|
964
964
|
var pinnedFileCount = async (config) => {
|
|
965
|
-
if (!config
|
|
966
|
-
throw new ValidationError("Pinata configuration
|
|
965
|
+
if (!config) {
|
|
966
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
967
967
|
}
|
|
968
968
|
let endpoint = "https://api.pinata.cloud";
|
|
969
969
|
if (config.endpointUrl) {
|
|
@@ -1017,8 +1017,8 @@ var pinnedFileCount = async (config) => {
|
|
|
1017
1017
|
|
|
1018
1018
|
// src/core/data/totalStorageUsage.ts
|
|
1019
1019
|
var totalStorageUsage = async (config) => {
|
|
1020
|
-
if (!config
|
|
1021
|
-
throw new ValidationError("Pinata configuration
|
|
1020
|
+
if (!config) {
|
|
1021
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1022
1022
|
}
|
|
1023
1023
|
let endpoint = "https://api.pinata.cloud";
|
|
1024
1024
|
if (config.endpointUrl) {
|
|
@@ -1072,8 +1072,8 @@ var totalStorageUsage = async (config) => {
|
|
|
1072
1072
|
|
|
1073
1073
|
// src/core/keys/createKey.ts
|
|
1074
1074
|
var createKey = async (config, options) => {
|
|
1075
|
-
if (!config
|
|
1076
|
-
throw new ValidationError("Pinata configuration
|
|
1075
|
+
if (!config) {
|
|
1076
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1077
1077
|
}
|
|
1078
1078
|
let headers;
|
|
1079
1079
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1126,8 +1126,8 @@ var createKey = async (config, options) => {
|
|
|
1126
1126
|
|
|
1127
1127
|
// src/core/keys/listKeys.ts
|
|
1128
1128
|
var listKeys = async (config, options) => {
|
|
1129
|
-
if (!config
|
|
1130
|
-
throw new ValidationError("Pinata configuration
|
|
1129
|
+
if (!config) {
|
|
1130
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1131
1131
|
}
|
|
1132
1132
|
let headers;
|
|
1133
1133
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1200,8 +1200,8 @@ var wait2 = (milliseconds) => {
|
|
|
1200
1200
|
});
|
|
1201
1201
|
};
|
|
1202
1202
|
var revokeKeys = async (config, keys) => {
|
|
1203
|
-
if (!config
|
|
1204
|
-
throw new ValidationError("Pinata configuration
|
|
1203
|
+
if (!config) {
|
|
1204
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1205
1205
|
}
|
|
1206
1206
|
let headers;
|
|
1207
1207
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1265,8 +1265,8 @@ var revokeKeys = async (config, keys) => {
|
|
|
1265
1265
|
|
|
1266
1266
|
// src/core/groups/createGroup.ts
|
|
1267
1267
|
var createGroup = async (config, options) => {
|
|
1268
|
-
if (!config
|
|
1269
|
-
throw new ValidationError("Pinata configuration
|
|
1268
|
+
if (!config) {
|
|
1269
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1270
1270
|
}
|
|
1271
1271
|
const data = JSON.stringify(options);
|
|
1272
1272
|
let headers;
|
|
@@ -1319,8 +1319,8 @@ var createGroup = async (config, options) => {
|
|
|
1319
1319
|
|
|
1320
1320
|
// src/core/groups/listGroups.ts
|
|
1321
1321
|
var listGroups = async (config, options) => {
|
|
1322
|
-
if (!config
|
|
1323
|
-
throw new ValidationError("Pinata configuration
|
|
1322
|
+
if (!config) {
|
|
1323
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1324
1324
|
}
|
|
1325
1325
|
let headers;
|
|
1326
1326
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1381,8 +1381,8 @@ var listGroups = async (config, options) => {
|
|
|
1381
1381
|
|
|
1382
1382
|
// src/core/groups/getGroup.ts
|
|
1383
1383
|
var getGroup = async (config, options) => {
|
|
1384
|
-
if (!config
|
|
1385
|
-
throw new ValidationError("Pinata configuration
|
|
1384
|
+
if (!config) {
|
|
1385
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1386
1386
|
}
|
|
1387
1387
|
let headers;
|
|
1388
1388
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1435,8 +1435,8 @@ var getGroup = async (config, options) => {
|
|
|
1435
1435
|
|
|
1436
1436
|
// src/core/groups/addToGroup.ts
|
|
1437
1437
|
var addToGroup = async (config, options) => {
|
|
1438
|
-
if (!config
|
|
1439
|
-
throw new ValidationError("Pinata configuration
|
|
1438
|
+
if (!config) {
|
|
1439
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1440
1440
|
}
|
|
1441
1441
|
const data = JSON.stringify({
|
|
1442
1442
|
cids: options.cids
|
|
@@ -1493,8 +1493,8 @@ var addToGroup = async (config, options) => {
|
|
|
1493
1493
|
|
|
1494
1494
|
// src/core/groups/updateGroup.ts
|
|
1495
1495
|
var updateGroup = async (config, options) => {
|
|
1496
|
-
if (!config
|
|
1497
|
-
throw new ValidationError("Pinata configuration
|
|
1496
|
+
if (!config) {
|
|
1497
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1498
1498
|
}
|
|
1499
1499
|
const data = JSON.stringify({
|
|
1500
1500
|
name: options.name
|
|
@@ -1549,8 +1549,8 @@ var updateGroup = async (config, options) => {
|
|
|
1549
1549
|
|
|
1550
1550
|
// src/core/groups/removeFromGroup.ts
|
|
1551
1551
|
var removeFromGroup = async (config, options) => {
|
|
1552
|
-
if (!config
|
|
1553
|
-
throw new ValidationError("Pinata configuration
|
|
1552
|
+
if (!config) {
|
|
1553
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1554
1554
|
}
|
|
1555
1555
|
let headers;
|
|
1556
1556
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1609,8 +1609,8 @@ var removeFromGroup = async (config, options) => {
|
|
|
1609
1609
|
|
|
1610
1610
|
// src/core/groups/deleteGroup.ts
|
|
1611
1611
|
var deleteGroup = async (config, options) => {
|
|
1612
|
-
if (!config
|
|
1613
|
-
throw new ValidationError("Pinata configuration
|
|
1612
|
+
if (!config) {
|
|
1613
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1614
1614
|
}
|
|
1615
1615
|
let headers;
|
|
1616
1616
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1661,8 +1661,8 @@ var deleteGroup = async (config, options) => {
|
|
|
1661
1661
|
|
|
1662
1662
|
// src/core/signatures/addSignature.ts
|
|
1663
1663
|
var addSignature = async (config, options) => {
|
|
1664
|
-
if (!config
|
|
1665
|
-
throw new ValidationError("Pinata configuration
|
|
1664
|
+
if (!config) {
|
|
1665
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1666
1666
|
}
|
|
1667
1667
|
const data = JSON.stringify({
|
|
1668
1668
|
signature: options.signature
|
|
@@ -1729,8 +1729,8 @@ var addSignature = async (config, options) => {
|
|
|
1729
1729
|
|
|
1730
1730
|
// src/core/signatures/getSignature.ts
|
|
1731
1731
|
var getSignature = async (config, cid) => {
|
|
1732
|
-
if (!config
|
|
1733
|
-
throw new ValidationError("Pinata configuration
|
|
1732
|
+
if (!config) {
|
|
1733
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1734
1734
|
}
|
|
1735
1735
|
let headers;
|
|
1736
1736
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1783,8 +1783,8 @@ var getSignature = async (config, cid) => {
|
|
|
1783
1783
|
|
|
1784
1784
|
// src/core/signatures/removeSignature.ts
|
|
1785
1785
|
var removeSignature = async (config, cid) => {
|
|
1786
|
-
if (!config
|
|
1787
|
-
throw new ValidationError("Pinata configuration
|
|
1786
|
+
if (!config) {
|
|
1787
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1788
1788
|
}
|
|
1789
1789
|
let headers;
|
|
1790
1790
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1836,8 +1836,8 @@ var removeSignature = async (config, cid) => {
|
|
|
1836
1836
|
|
|
1837
1837
|
// src/core/gateway/analyticsTopUsage.ts
|
|
1838
1838
|
var analyticsTopUsage = async (config, options) => {
|
|
1839
|
-
if (!config
|
|
1840
|
-
throw new ValidationError("Pinata configuration
|
|
1839
|
+
if (!config) {
|
|
1840
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1841
1841
|
}
|
|
1842
1842
|
const params = new URLSearchParams({
|
|
1843
1843
|
includesCount: "false"
|
|
@@ -1939,8 +1939,8 @@ var analyticsTopUsage = async (config, options) => {
|
|
|
1939
1939
|
|
|
1940
1940
|
// src/core/gateway/analyticsDateInterval.ts
|
|
1941
1941
|
var analyticsDateInterval = async (config, options) => {
|
|
1942
|
-
if (!config
|
|
1943
|
-
throw new ValidationError("Pinata configuration
|
|
1942
|
+
if (!config) {
|
|
1943
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1944
1944
|
}
|
|
1945
1945
|
const params = new URLSearchParams();
|
|
1946
1946
|
if (options) {
|
|
@@ -2040,8 +2040,8 @@ var analyticsDateInterval = async (config, options) => {
|
|
|
2040
2040
|
|
|
2041
2041
|
// src/core/gateway/swapCid.ts
|
|
2042
2042
|
var swapCid = async (config, options) => {
|
|
2043
|
-
if (!config
|
|
2044
|
-
throw new ValidationError("Pinata configuration
|
|
2043
|
+
if (!config) {
|
|
2044
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
2045
2045
|
}
|
|
2046
2046
|
const data = JSON.stringify({
|
|
2047
2047
|
swapCid: options.swapCid
|
|
@@ -2111,8 +2111,8 @@ var swapCid = async (config, options) => {
|
|
|
2111
2111
|
|
|
2112
2112
|
// src/core/gateway/swapHistory.ts
|
|
2113
2113
|
var swapHistory = async (config, options) => {
|
|
2114
|
-
if (!config
|
|
2115
|
-
throw new ValidationError("Pinata configuration
|
|
2114
|
+
if (!config) {
|
|
2115
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
2116
2116
|
}
|
|
2117
2117
|
let headers;
|
|
2118
2118
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -2176,8 +2176,8 @@ var swapHistory = async (config, options) => {
|
|
|
2176
2176
|
|
|
2177
2177
|
// src/core/gateway/deleteSwap.ts
|
|
2178
2178
|
var deleteSwap = async (config, cid) => {
|
|
2179
|
-
if (!config
|
|
2180
|
-
throw new ValidationError("Pinata configuration
|
|
2179
|
+
if (!config) {
|
|
2180
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
2181
2181
|
}
|
|
2182
2182
|
let headers;
|
|
2183
2183
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|