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.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -64,8 +64,8 @@ var ValidationError = class extends PinataError {
|
|
|
64
64
|
|
|
65
65
|
// src/core/authentication/testAuthentication.ts
|
|
66
66
|
var testAuthentication = async (config) => {
|
|
67
|
-
if (!config
|
|
68
|
-
throw new ValidationError("Pinata configuration
|
|
67
|
+
if (!config) {
|
|
68
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
69
69
|
}
|
|
70
70
|
let headers;
|
|
71
71
|
let endpoint = "https://api.pinata.cloud";
|
|
@@ -119,8 +119,8 @@ var testAuthentication = async (config) => {
|
|
|
119
119
|
|
|
120
120
|
// src/core/pinning/file.ts
|
|
121
121
|
var uploadFile = async (config, file, options) => {
|
|
122
|
-
if (!config
|
|
123
|
-
throw new ValidationError("Pinata configuration
|
|
122
|
+
if (!config) {
|
|
123
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
124
124
|
}
|
|
125
125
|
const jwt = options?.keys || config.pinataJwt;
|
|
126
126
|
const data = new FormData();
|
|
@@ -188,8 +188,8 @@ var uploadFile = async (config, file, options) => {
|
|
|
188
188
|
|
|
189
189
|
// src/core/pinning/fileArray.ts
|
|
190
190
|
var uploadFileArray = async (config, files, options) => {
|
|
191
|
-
if (!config
|
|
192
|
-
throw new ValidationError("Pinata configuration
|
|
191
|
+
if (!config) {
|
|
192
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
193
193
|
}
|
|
194
194
|
const jwt = options?.keys || config?.pinataJwt;
|
|
195
195
|
const folder = options?.metadata?.name || "folder_from_sdk";
|
|
@@ -262,8 +262,8 @@ var uploadFileArray = async (config, files, options) => {
|
|
|
262
262
|
|
|
263
263
|
// src/core/pinning/base64.ts
|
|
264
264
|
var uploadBase64 = async (config, base64String, options) => {
|
|
265
|
-
if (!config
|
|
266
|
-
throw new ValidationError("Pinata configuration
|
|
265
|
+
if (!config) {
|
|
266
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
267
267
|
}
|
|
268
268
|
const jwt = options?.keys || config?.pinataJwt;
|
|
269
269
|
const name = options?.metadata?.name ? options?.metadata?.name : "base64 string";
|
|
@@ -336,8 +336,8 @@ var uploadBase64 = async (config, base64String, options) => {
|
|
|
336
336
|
|
|
337
337
|
// src/core/pinning/url.ts
|
|
338
338
|
var uploadUrl = async (config, url, options) => {
|
|
339
|
-
if (!config
|
|
340
|
-
throw new ValidationError("Pinata configuration
|
|
339
|
+
if (!config) {
|
|
340
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
341
341
|
}
|
|
342
342
|
const jwt = options?.keys || config?.pinataJwt;
|
|
343
343
|
const data = new FormData();
|
|
@@ -418,8 +418,8 @@ var uploadUrl = async (config, url, options) => {
|
|
|
418
418
|
|
|
419
419
|
// src/core/pinning/json.ts
|
|
420
420
|
var uploadJson = async (config, jsonData, options) => {
|
|
421
|
-
if (!config
|
|
422
|
-
throw new ValidationError("Pinata configuration
|
|
421
|
+
if (!config) {
|
|
422
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
423
423
|
}
|
|
424
424
|
const jwt = options?.keys || config?.pinataJwt;
|
|
425
425
|
const data = JSON.stringify({
|
|
@@ -483,8 +483,8 @@ var uploadJson = async (config, jsonData, options) => {
|
|
|
483
483
|
|
|
484
484
|
// src/core/pinning/cid.ts
|
|
485
485
|
var uploadCid = async (config, cid, options) => {
|
|
486
|
-
if (!config
|
|
487
|
-
throw new ValidationError("Pinata configuration
|
|
486
|
+
if (!config) {
|
|
487
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
488
488
|
}
|
|
489
489
|
const jwt = options?.keys || config?.pinataJwt;
|
|
490
490
|
let headers;
|
|
@@ -553,8 +553,8 @@ var wait = (milliseconds) => {
|
|
|
553
553
|
});
|
|
554
554
|
};
|
|
555
555
|
var unpinFile = async (config, files) => {
|
|
556
|
-
if (!config
|
|
557
|
-
throw new ValidationError("Pinata configuration
|
|
556
|
+
if (!config) {
|
|
557
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
558
558
|
}
|
|
559
559
|
const responses = [];
|
|
560
560
|
let headers;
|
|
@@ -617,8 +617,8 @@ var unpinFile = async (config, files) => {
|
|
|
617
617
|
|
|
618
618
|
// src/core/data/listFiles.ts
|
|
619
619
|
var listFiles = async (config, options) => {
|
|
620
|
-
if (!config
|
|
621
|
-
throw new ValidationError("Pinata configuration
|
|
620
|
+
if (!config) {
|
|
621
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
622
622
|
}
|
|
623
623
|
const params = new URLSearchParams({
|
|
624
624
|
includesCount: "false"
|
|
@@ -712,8 +712,8 @@ var listFiles = async (config, options) => {
|
|
|
712
712
|
|
|
713
713
|
// src/core/data/updateMetadata.ts
|
|
714
714
|
var updateMetadata = async (config, options) => {
|
|
715
|
-
if (!config
|
|
716
|
-
throw new ValidationError("Pinata configuration
|
|
715
|
+
if (!config) {
|
|
716
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
717
717
|
}
|
|
718
718
|
const data = {
|
|
719
719
|
ipfsPinHash: options.cid,
|
|
@@ -866,8 +866,8 @@ async function convertToDesiredGateway(sourceUrl, desiredGatewayPrefix) {
|
|
|
866
866
|
|
|
867
867
|
// src/core/gateway/getCid.ts
|
|
868
868
|
var getCid = async (config, cid) => {
|
|
869
|
-
if (!config
|
|
870
|
-
throw new ValidationError("Pinata configuration
|
|
869
|
+
if (!config) {
|
|
870
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
871
871
|
}
|
|
872
872
|
let data;
|
|
873
873
|
let newUrl;
|
|
@@ -930,8 +930,8 @@ var convertIPFSUrl = async (config, url) => {
|
|
|
930
930
|
|
|
931
931
|
// src/core/data/pinJobs.ts
|
|
932
932
|
var pinJobs = async (config, options) => {
|
|
933
|
-
if (!config
|
|
934
|
-
throw new ValidationError("Pinata configuration
|
|
933
|
+
if (!config) {
|
|
934
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
935
935
|
}
|
|
936
936
|
const params = new URLSearchParams({
|
|
937
937
|
includesCount: "false"
|
|
@@ -998,8 +998,8 @@ var pinJobs = async (config, options) => {
|
|
|
998
998
|
|
|
999
999
|
// src/core/data/pinnedFileUsage.ts
|
|
1000
1000
|
var pinnedFileCount = async (config) => {
|
|
1001
|
-
if (!config
|
|
1002
|
-
throw new ValidationError("Pinata configuration
|
|
1001
|
+
if (!config) {
|
|
1002
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1003
1003
|
}
|
|
1004
1004
|
let endpoint = "https://api.pinata.cloud";
|
|
1005
1005
|
if (config.endpointUrl) {
|
|
@@ -1053,8 +1053,8 @@ var pinnedFileCount = async (config) => {
|
|
|
1053
1053
|
|
|
1054
1054
|
// src/core/data/totalStorageUsage.ts
|
|
1055
1055
|
var totalStorageUsage = async (config) => {
|
|
1056
|
-
if (!config
|
|
1057
|
-
throw new ValidationError("Pinata configuration
|
|
1056
|
+
if (!config) {
|
|
1057
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1058
1058
|
}
|
|
1059
1059
|
let endpoint = "https://api.pinata.cloud";
|
|
1060
1060
|
if (config.endpointUrl) {
|
|
@@ -1108,8 +1108,8 @@ var totalStorageUsage = async (config) => {
|
|
|
1108
1108
|
|
|
1109
1109
|
// src/core/keys/createKey.ts
|
|
1110
1110
|
var createKey = async (config, options) => {
|
|
1111
|
-
if (!config
|
|
1112
|
-
throw new ValidationError("Pinata configuration
|
|
1111
|
+
if (!config) {
|
|
1112
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1113
1113
|
}
|
|
1114
1114
|
let headers;
|
|
1115
1115
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1162,8 +1162,8 @@ var createKey = async (config, options) => {
|
|
|
1162
1162
|
|
|
1163
1163
|
// src/core/keys/listKeys.ts
|
|
1164
1164
|
var listKeys = async (config, options) => {
|
|
1165
|
-
if (!config
|
|
1166
|
-
throw new ValidationError("Pinata configuration
|
|
1165
|
+
if (!config) {
|
|
1166
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1167
1167
|
}
|
|
1168
1168
|
let headers;
|
|
1169
1169
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1236,8 +1236,8 @@ var wait2 = (milliseconds) => {
|
|
|
1236
1236
|
});
|
|
1237
1237
|
};
|
|
1238
1238
|
var revokeKeys = async (config, keys) => {
|
|
1239
|
-
if (!config
|
|
1240
|
-
throw new ValidationError("Pinata configuration
|
|
1239
|
+
if (!config) {
|
|
1240
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1241
1241
|
}
|
|
1242
1242
|
let headers;
|
|
1243
1243
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1301,8 +1301,8 @@ var revokeKeys = async (config, keys) => {
|
|
|
1301
1301
|
|
|
1302
1302
|
// src/core/groups/createGroup.ts
|
|
1303
1303
|
var createGroup = async (config, options) => {
|
|
1304
|
-
if (!config
|
|
1305
|
-
throw new ValidationError("Pinata configuration
|
|
1304
|
+
if (!config) {
|
|
1305
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1306
1306
|
}
|
|
1307
1307
|
const data = JSON.stringify(options);
|
|
1308
1308
|
let headers;
|
|
@@ -1355,8 +1355,8 @@ var createGroup = async (config, options) => {
|
|
|
1355
1355
|
|
|
1356
1356
|
// src/core/groups/listGroups.ts
|
|
1357
1357
|
var listGroups = async (config, options) => {
|
|
1358
|
-
if (!config
|
|
1359
|
-
throw new ValidationError("Pinata configuration
|
|
1358
|
+
if (!config) {
|
|
1359
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1360
1360
|
}
|
|
1361
1361
|
let headers;
|
|
1362
1362
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1417,8 +1417,8 @@ var listGroups = async (config, options) => {
|
|
|
1417
1417
|
|
|
1418
1418
|
// src/core/groups/getGroup.ts
|
|
1419
1419
|
var getGroup = async (config, options) => {
|
|
1420
|
-
if (!config
|
|
1421
|
-
throw new ValidationError("Pinata configuration
|
|
1420
|
+
if (!config) {
|
|
1421
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1422
1422
|
}
|
|
1423
1423
|
let headers;
|
|
1424
1424
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1471,8 +1471,8 @@ var getGroup = async (config, options) => {
|
|
|
1471
1471
|
|
|
1472
1472
|
// src/core/groups/addToGroup.ts
|
|
1473
1473
|
var addToGroup = async (config, options) => {
|
|
1474
|
-
if (!config
|
|
1475
|
-
throw new ValidationError("Pinata configuration
|
|
1474
|
+
if (!config) {
|
|
1475
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1476
1476
|
}
|
|
1477
1477
|
const data = JSON.stringify({
|
|
1478
1478
|
cids: options.cids
|
|
@@ -1529,8 +1529,8 @@ var addToGroup = async (config, options) => {
|
|
|
1529
1529
|
|
|
1530
1530
|
// src/core/groups/updateGroup.ts
|
|
1531
1531
|
var updateGroup = async (config, options) => {
|
|
1532
|
-
if (!config
|
|
1533
|
-
throw new ValidationError("Pinata configuration
|
|
1532
|
+
if (!config) {
|
|
1533
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1534
1534
|
}
|
|
1535
1535
|
const data = JSON.stringify({
|
|
1536
1536
|
name: options.name
|
|
@@ -1585,8 +1585,8 @@ var updateGroup = async (config, options) => {
|
|
|
1585
1585
|
|
|
1586
1586
|
// src/core/groups/removeFromGroup.ts
|
|
1587
1587
|
var removeFromGroup = async (config, options) => {
|
|
1588
|
-
if (!config
|
|
1589
|
-
throw new ValidationError("Pinata configuration
|
|
1588
|
+
if (!config) {
|
|
1589
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1590
1590
|
}
|
|
1591
1591
|
let headers;
|
|
1592
1592
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1645,8 +1645,8 @@ var removeFromGroup = async (config, options) => {
|
|
|
1645
1645
|
|
|
1646
1646
|
// src/core/groups/deleteGroup.ts
|
|
1647
1647
|
var deleteGroup = async (config, options) => {
|
|
1648
|
-
if (!config
|
|
1649
|
-
throw new ValidationError("Pinata configuration
|
|
1648
|
+
if (!config) {
|
|
1649
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1650
1650
|
}
|
|
1651
1651
|
let headers;
|
|
1652
1652
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1697,8 +1697,8 @@ var deleteGroup = async (config, options) => {
|
|
|
1697
1697
|
|
|
1698
1698
|
// src/core/signatures/addSignature.ts
|
|
1699
1699
|
var addSignature = async (config, options) => {
|
|
1700
|
-
if (!config
|
|
1701
|
-
throw new ValidationError("Pinata configuration
|
|
1700
|
+
if (!config) {
|
|
1701
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1702
1702
|
}
|
|
1703
1703
|
const data = JSON.stringify({
|
|
1704
1704
|
signature: options.signature
|
|
@@ -1765,8 +1765,8 @@ var addSignature = async (config, options) => {
|
|
|
1765
1765
|
|
|
1766
1766
|
// src/core/signatures/getSignature.ts
|
|
1767
1767
|
var getSignature = async (config, cid) => {
|
|
1768
|
-
if (!config
|
|
1769
|
-
throw new ValidationError("Pinata configuration
|
|
1768
|
+
if (!config) {
|
|
1769
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1770
1770
|
}
|
|
1771
1771
|
let headers;
|
|
1772
1772
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1819,8 +1819,8 @@ var getSignature = async (config, cid) => {
|
|
|
1819
1819
|
|
|
1820
1820
|
// src/core/signatures/removeSignature.ts
|
|
1821
1821
|
var removeSignature = async (config, cid) => {
|
|
1822
|
-
if (!config
|
|
1823
|
-
throw new ValidationError("Pinata configuration
|
|
1822
|
+
if (!config) {
|
|
1823
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1824
1824
|
}
|
|
1825
1825
|
let headers;
|
|
1826
1826
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1872,8 +1872,8 @@ var removeSignature = async (config, cid) => {
|
|
|
1872
1872
|
|
|
1873
1873
|
// src/core/gateway/analyticsTopUsage.ts
|
|
1874
1874
|
var analyticsTopUsage = async (config, options) => {
|
|
1875
|
-
if (!config
|
|
1876
|
-
throw new ValidationError("Pinata configuration
|
|
1875
|
+
if (!config) {
|
|
1876
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1877
1877
|
}
|
|
1878
1878
|
const params = new URLSearchParams({
|
|
1879
1879
|
includesCount: "false"
|
|
@@ -1975,8 +1975,8 @@ var analyticsTopUsage = async (config, options) => {
|
|
|
1975
1975
|
|
|
1976
1976
|
// src/core/gateway/analyticsDateInterval.ts
|
|
1977
1977
|
var analyticsDateInterval = async (config, options) => {
|
|
1978
|
-
if (!config
|
|
1979
|
-
throw new ValidationError("Pinata configuration
|
|
1978
|
+
if (!config) {
|
|
1979
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
1980
1980
|
}
|
|
1981
1981
|
const params = new URLSearchParams();
|
|
1982
1982
|
if (options) {
|
|
@@ -2076,8 +2076,8 @@ var analyticsDateInterval = async (config, options) => {
|
|
|
2076
2076
|
|
|
2077
2077
|
// src/core/gateway/swapCid.ts
|
|
2078
2078
|
var swapCid = async (config, options) => {
|
|
2079
|
-
if (!config
|
|
2080
|
-
throw new ValidationError("Pinata configuration
|
|
2079
|
+
if (!config) {
|
|
2080
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
2081
2081
|
}
|
|
2082
2082
|
const data = JSON.stringify({
|
|
2083
2083
|
swapCid: options.swapCid
|
|
@@ -2147,8 +2147,8 @@ var swapCid = async (config, options) => {
|
|
|
2147
2147
|
|
|
2148
2148
|
// src/core/gateway/swapHistory.ts
|
|
2149
2149
|
var swapHistory = async (config, options) => {
|
|
2150
|
-
if (!config
|
|
2151
|
-
throw new ValidationError("Pinata configuration
|
|
2150
|
+
if (!config) {
|
|
2151
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
2152
2152
|
}
|
|
2153
2153
|
let headers;
|
|
2154
2154
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -2212,8 +2212,8 @@ var swapHistory = async (config, options) => {
|
|
|
2212
2212
|
|
|
2213
2213
|
// src/core/gateway/deleteSwap.ts
|
|
2214
2214
|
var deleteSwap = async (config, cid) => {
|
|
2215
|
-
if (!config
|
|
2216
|
-
throw new ValidationError("Pinata configuration
|
|
2215
|
+
if (!config) {
|
|
2216
|
+
throw new ValidationError("Pinata configuration is missing");
|
|
2217
2217
|
}
|
|
2218
2218
|
let headers;
|
|
2219
2219
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|