pinata 2.4.6 → 2.4.7
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/chunk-BK3CLF3Z.js +163 -0
- package/dist/chunk-BK3CLF3Z.js.map +1 -0
- package/dist/chunk-ME652TQB.mjs +154 -0
- package/dist/chunk-ME652TQB.mjs.map +1 -0
- package/dist/{index-CQFQEo3K.d.mts → gateway-tools-l9hk7kz4.d.mts} +1 -18
- package/dist/{index-CQFQEo3K.d.ts → gateway-tools-l9hk7kz4.d.ts} +1 -18
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +289 -297
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +21 -1
- package/dist/react/index.d.ts +21 -1
- package/dist/react/index.js +271 -11
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +269 -1
- package/dist/react/index.mjs.map +1 -1
- package/package.json +9 -3
- package/dist/chunk-7UIMBFJ5.mjs +0 -423
- package/dist/chunk-7UIMBFJ5.mjs.map +0 -1
- package/dist/chunk-P556VRQU.js +0 -433
- package/dist/chunk-P556VRQU.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkBK3CLF3Z_js = require('./chunk-BK3CLF3Z.js');
|
|
4
4
|
|
|
5
5
|
// src/core/functions/analytics/analyticsDateInterval.ts
|
|
6
6
|
var analyticsDateInterval = async (config, options) => {
|
|
7
7
|
if (!config) {
|
|
8
|
-
throw new
|
|
8
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
9
9
|
}
|
|
10
10
|
const params = new URLSearchParams();
|
|
11
11
|
if (options) {
|
|
@@ -60,7 +60,7 @@ var analyticsDateInterval = async (config, options) => {
|
|
|
60
60
|
if (!request.ok) {
|
|
61
61
|
const errorData = await request.text();
|
|
62
62
|
if (request.status === 401 || request.status === 403) {
|
|
63
|
-
throw new
|
|
63
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
64
64
|
`Authentication failed: ${errorData}`,
|
|
65
65
|
request.status,
|
|
66
66
|
{
|
|
@@ -72,7 +72,7 @@ var analyticsDateInterval = async (config, options) => {
|
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
|
-
throw new
|
|
75
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
76
76
|
error: errorData,
|
|
77
77
|
code: "HTTP_ERROR",
|
|
78
78
|
metadata: {
|
|
@@ -84,15 +84,15 @@ var analyticsDateInterval = async (config, options) => {
|
|
|
84
84
|
const resData = res.data;
|
|
85
85
|
return resData;
|
|
86
86
|
} catch (error) {
|
|
87
|
-
if (error instanceof
|
|
87
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
88
88
|
throw error;
|
|
89
89
|
}
|
|
90
90
|
if (error instanceof Error) {
|
|
91
|
-
throw new
|
|
91
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
92
92
|
`Error processing anaytics usage: ${error.message}`
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
|
-
throw new
|
|
95
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
96
96
|
"An unknown error occurred while fetching gateway usage"
|
|
97
97
|
);
|
|
98
98
|
}
|
|
@@ -101,7 +101,7 @@ var analyticsDateInterval = async (config, options) => {
|
|
|
101
101
|
// src/core/functions/analytics/analyticsTopUsage.ts
|
|
102
102
|
var analyticsTopUsage = async (config, options) => {
|
|
103
103
|
if (!config) {
|
|
104
|
-
throw new
|
|
104
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
105
105
|
}
|
|
106
106
|
const params = new URLSearchParams();
|
|
107
107
|
if (options) {
|
|
@@ -162,7 +162,7 @@ var analyticsTopUsage = async (config, options) => {
|
|
|
162
162
|
if (!request.ok) {
|
|
163
163
|
const errorData = await request.text();
|
|
164
164
|
if (request.status === 401 || request.status === 403) {
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
166
166
|
`Authentication failed: ${errorData}`,
|
|
167
167
|
request.status,
|
|
168
168
|
{
|
|
@@ -174,7 +174,7 @@ var analyticsTopUsage = async (config, options) => {
|
|
|
174
174
|
}
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
|
-
throw new
|
|
177
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
178
178
|
error: errorData,
|
|
179
179
|
code: "HTTP_ERROR",
|
|
180
180
|
metadata: {
|
|
@@ -185,15 +185,15 @@ var analyticsTopUsage = async (config, options) => {
|
|
|
185
185
|
const res = await request.json();
|
|
186
186
|
return res;
|
|
187
187
|
} catch (error) {
|
|
188
|
-
if (error instanceof
|
|
188
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
189
189
|
throw error;
|
|
190
190
|
}
|
|
191
191
|
if (error instanceof Error) {
|
|
192
|
-
throw new
|
|
192
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
193
193
|
`Error processing anaytics usage: ${error.message}`
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
|
-
throw new
|
|
196
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
197
197
|
"An unknown error occurred while fetching gateway usage"
|
|
198
198
|
);
|
|
199
199
|
}
|
|
@@ -202,7 +202,7 @@ var analyticsTopUsage = async (config, options) => {
|
|
|
202
202
|
// src/core/functions/authentication/testAuthentication.ts
|
|
203
203
|
var testAuthentication = async (config) => {
|
|
204
204
|
if (!config) {
|
|
205
|
-
throw new
|
|
205
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
206
206
|
}
|
|
207
207
|
let headers;
|
|
208
208
|
let endpoint = "https://api.pinata.cloud";
|
|
@@ -228,7 +228,7 @@ var testAuthentication = async (config) => {
|
|
|
228
228
|
if (!request.ok) {
|
|
229
229
|
const errorData = await request.text();
|
|
230
230
|
if (request.status === 401 || request.status === 403) {
|
|
231
|
-
throw new
|
|
231
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
232
232
|
`Authentication failed: ${errorData}`,
|
|
233
233
|
request.status,
|
|
234
234
|
{
|
|
@@ -240,7 +240,7 @@ var testAuthentication = async (config) => {
|
|
|
240
240
|
}
|
|
241
241
|
);
|
|
242
242
|
}
|
|
243
|
-
throw new
|
|
243
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
244
244
|
error: errorData,
|
|
245
245
|
code: "HTTP_ERROR",
|
|
246
246
|
metadata: {
|
|
@@ -251,15 +251,15 @@ var testAuthentication = async (config) => {
|
|
|
251
251
|
const res = await request.json();
|
|
252
252
|
return res;
|
|
253
253
|
} catch (error) {
|
|
254
|
-
if (error instanceof
|
|
254
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
255
255
|
throw error;
|
|
256
256
|
}
|
|
257
257
|
if (error instanceof Error) {
|
|
258
|
-
throw new
|
|
258
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
259
259
|
`Error processing authentication: ${error.message}`
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
|
-
throw new
|
|
262
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
263
263
|
"An unknown error occurred while testing authentication"
|
|
264
264
|
);
|
|
265
265
|
}
|
|
@@ -273,7 +273,7 @@ var wait = (milliseconds) => {
|
|
|
273
273
|
};
|
|
274
274
|
var deleteFile = async (config, files, privacy) => {
|
|
275
275
|
if (!config) {
|
|
276
|
-
throw new
|
|
276
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
277
277
|
}
|
|
278
278
|
const responses = [];
|
|
279
279
|
let headers;
|
|
@@ -302,7 +302,7 @@ var deleteFile = async (config, files, privacy) => {
|
|
|
302
302
|
if (!response.ok) {
|
|
303
303
|
const errorData = await response.text();
|
|
304
304
|
if (response.status === 401) {
|
|
305
|
-
throw new
|
|
305
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
306
306
|
`Authentication failed: ${errorData}`,
|
|
307
307
|
response.status,
|
|
308
308
|
{
|
|
@@ -314,7 +314,7 @@ var deleteFile = async (config, files, privacy) => {
|
|
|
314
314
|
}
|
|
315
315
|
);
|
|
316
316
|
}
|
|
317
|
-
throw new
|
|
317
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error`, response.status, {
|
|
318
318
|
error: errorData,
|
|
319
319
|
code: "HTTP_ERROR",
|
|
320
320
|
metadata: {
|
|
@@ -328,7 +328,7 @@ var deleteFile = async (config, files, privacy) => {
|
|
|
328
328
|
});
|
|
329
329
|
} catch (error) {
|
|
330
330
|
let errorMessage;
|
|
331
|
-
if (error instanceof
|
|
331
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
332
332
|
errorMessage = error.message;
|
|
333
333
|
} else if (error instanceof Error) {
|
|
334
334
|
errorMessage = `Error deleting file ${id}: ${error.message}`;
|
|
@@ -347,7 +347,7 @@ var deleteFile = async (config, files, privacy) => {
|
|
|
347
347
|
// src/core/functions/files/deleteFileVectors.ts
|
|
348
348
|
var deleteFileVectors = async (config, fileId) => {
|
|
349
349
|
if (!config) {
|
|
350
|
-
throw new
|
|
350
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
351
351
|
}
|
|
352
352
|
let headers;
|
|
353
353
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -373,7 +373,7 @@ var deleteFileVectors = async (config, fileId) => {
|
|
|
373
373
|
if (!request.ok) {
|
|
374
374
|
const errorData = await request.text();
|
|
375
375
|
if (request.status === 401 || request.status === 403) {
|
|
376
|
-
throw new
|
|
376
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
377
377
|
`Authentication failed: ${errorData}`,
|
|
378
378
|
request.status,
|
|
379
379
|
{
|
|
@@ -385,7 +385,7 @@ var deleteFileVectors = async (config, fileId) => {
|
|
|
385
385
|
}
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
|
-
throw new
|
|
388
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
389
389
|
error: errorData,
|
|
390
390
|
code: "HTTP_ERROR",
|
|
391
391
|
metadata: {
|
|
@@ -396,22 +396,22 @@ var deleteFileVectors = async (config, fileId) => {
|
|
|
396
396
|
const res = await request.json();
|
|
397
397
|
return res;
|
|
398
398
|
} catch (error) {
|
|
399
|
-
if (error instanceof
|
|
399
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
400
400
|
throw error;
|
|
401
401
|
}
|
|
402
402
|
if (error instanceof Error) {
|
|
403
|
-
throw new
|
|
403
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
404
404
|
`Error processing vectorize file: ${error.message}`
|
|
405
405
|
);
|
|
406
406
|
}
|
|
407
|
-
throw new
|
|
407
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while vectorizing file");
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
410
|
|
|
411
411
|
// src/core/functions/files/deleteSwap.ts
|
|
412
412
|
var deleteSwap = async (config, cid, network) => {
|
|
413
413
|
if (!config) {
|
|
414
|
-
throw new
|
|
414
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
415
415
|
}
|
|
416
416
|
let headers;
|
|
417
417
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -439,13 +439,13 @@ var deleteSwap = async (config, cid, network) => {
|
|
|
439
439
|
if (!request.ok) {
|
|
440
440
|
const errorData = await request.text();
|
|
441
441
|
if (request.status === 401 || request.status === 403) {
|
|
442
|
-
throw new
|
|
442
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(`Authentication failed`, request.status, {
|
|
443
443
|
error: errorData,
|
|
444
444
|
code: "AUTH_ERROR"
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
447
|
if (request.status === 403) {
|
|
448
|
-
throw new
|
|
448
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
449
449
|
"Unauthorized CID Swap Deletion",
|
|
450
450
|
request.status,
|
|
451
451
|
{
|
|
@@ -455,23 +455,23 @@ var deleteSwap = async (config, cid, network) => {
|
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
457
|
if (request.status === 404) {
|
|
458
|
-
throw new
|
|
458
|
+
throw new chunkBK3CLF3Z_js.PinataError("CID not pinned to account", request.status, {
|
|
459
459
|
error: errorData,
|
|
460
460
|
code: "NOT_FOUND"
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
-
throw new
|
|
463
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error occurred`, request.status, {
|
|
464
464
|
error: errorData,
|
|
465
465
|
code: "NETWORK_ERROR"
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
468
|
return request.statusText;
|
|
469
469
|
} catch (error) {
|
|
470
|
-
if (error instanceof
|
|
470
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
471
471
|
throw error;
|
|
472
472
|
}
|
|
473
473
|
if (error instanceof Error) {
|
|
474
|
-
throw new
|
|
474
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
475
475
|
`Error processing deleteSwap: ${error.message}`,
|
|
476
476
|
void 0,
|
|
477
477
|
{
|
|
@@ -479,7 +479,7 @@ var deleteSwap = async (config, cid, network) => {
|
|
|
479
479
|
}
|
|
480
480
|
);
|
|
481
481
|
}
|
|
482
|
-
throw new
|
|
482
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
483
483
|
"An unknown error occurred while deleting swap",
|
|
484
484
|
void 0,
|
|
485
485
|
{
|
|
@@ -492,7 +492,7 @@ var deleteSwap = async (config, cid, network) => {
|
|
|
492
492
|
// src/core/functions/files/list.ts
|
|
493
493
|
var listFiles = async (config, privacy, options) => {
|
|
494
494
|
if (!config) {
|
|
495
|
-
throw new
|
|
495
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
496
496
|
}
|
|
497
497
|
const params = new URLSearchParams();
|
|
498
498
|
if (options) {
|
|
@@ -548,7 +548,7 @@ var listFiles = async (config, privacy, options) => {
|
|
|
548
548
|
if (!request.ok) {
|
|
549
549
|
const errorData = await request.text();
|
|
550
550
|
if (request.status === 401 || request.status === 403) {
|
|
551
|
-
throw new
|
|
551
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
552
552
|
`Authentication failed: ${errorData}`,
|
|
553
553
|
request.status,
|
|
554
554
|
{
|
|
@@ -560,7 +560,7 @@ var listFiles = async (config, privacy, options) => {
|
|
|
560
560
|
}
|
|
561
561
|
);
|
|
562
562
|
}
|
|
563
|
-
throw new
|
|
563
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
564
564
|
error: errorData,
|
|
565
565
|
code: "HTTP_ERROR",
|
|
566
566
|
metadata: {
|
|
@@ -572,20 +572,20 @@ var listFiles = async (config, privacy, options) => {
|
|
|
572
572
|
const resData = res.data;
|
|
573
573
|
return resData;
|
|
574
574
|
} catch (error) {
|
|
575
|
-
if (error instanceof
|
|
575
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
576
576
|
throw error;
|
|
577
577
|
}
|
|
578
578
|
if (error instanceof Error) {
|
|
579
|
-
throw new
|
|
579
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing list files: ${error.message}`);
|
|
580
580
|
}
|
|
581
|
-
throw new
|
|
581
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while listing files");
|
|
582
582
|
}
|
|
583
583
|
};
|
|
584
584
|
|
|
585
585
|
// src/core/functions/files/pinnedFileUsage.ts
|
|
586
586
|
var pinnedFileCount = async (config) => {
|
|
587
587
|
if (!config) {
|
|
588
|
-
throw new
|
|
588
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
589
589
|
}
|
|
590
590
|
let endpoint = "https://api.pinata.cloud";
|
|
591
591
|
if (config.endpointUrl) {
|
|
@@ -611,7 +611,7 @@ var pinnedFileCount = async (config) => {
|
|
|
611
611
|
if (!request.ok) {
|
|
612
612
|
const errorData = await request.text();
|
|
613
613
|
if (request.status === 401 || request.status === 403) {
|
|
614
|
-
throw new
|
|
614
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
615
615
|
`Authentication failed: ${errorData}`,
|
|
616
616
|
request.status,
|
|
617
617
|
{
|
|
@@ -623,7 +623,7 @@ var pinnedFileCount = async (config) => {
|
|
|
623
623
|
}
|
|
624
624
|
);
|
|
625
625
|
}
|
|
626
|
-
throw new
|
|
626
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
627
627
|
error: errorData,
|
|
628
628
|
code: "HTTP_ERROR",
|
|
629
629
|
metadata: {
|
|
@@ -634,15 +634,15 @@ var pinnedFileCount = async (config) => {
|
|
|
634
634
|
const res = await request.json();
|
|
635
635
|
return res.pin_count;
|
|
636
636
|
} catch (error) {
|
|
637
|
-
if (error instanceof
|
|
637
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
638
638
|
throw error;
|
|
639
639
|
}
|
|
640
640
|
if (error instanceof Error) {
|
|
641
|
-
throw new
|
|
641
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
642
642
|
`Error processing pinnedFileUsage: ${error.message}`
|
|
643
643
|
);
|
|
644
644
|
}
|
|
645
|
-
throw new
|
|
645
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
646
646
|
"An unknown error occurred while getting pinned file usage"
|
|
647
647
|
);
|
|
648
648
|
}
|
|
@@ -651,7 +651,7 @@ var pinnedFileCount = async (config) => {
|
|
|
651
651
|
// src/core/functions/files/swapCid.ts
|
|
652
652
|
var swapCid = async (config, options, network) => {
|
|
653
653
|
if (!config) {
|
|
654
|
-
throw new
|
|
654
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
655
655
|
}
|
|
656
656
|
const data = JSON.stringify({
|
|
657
657
|
swap_cid: options.swapCid
|
|
@@ -686,7 +686,7 @@ var swapCid = async (config, options, network) => {
|
|
|
686
686
|
if (!request.ok) {
|
|
687
687
|
const errorData = await request.text();
|
|
688
688
|
if (request.status === 401 || request.status === 403) {
|
|
689
|
-
throw new
|
|
689
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
690
690
|
`Authentication failed: ${errorData}`,
|
|
691
691
|
request.status,
|
|
692
692
|
{
|
|
@@ -699,7 +699,7 @@ var swapCid = async (config, options, network) => {
|
|
|
699
699
|
);
|
|
700
700
|
}
|
|
701
701
|
if (request.status === 403) {
|
|
702
|
-
throw new
|
|
702
|
+
throw new chunkBK3CLF3Z_js.PinataError("Unauthorized CID Swap", request.status, {
|
|
703
703
|
error: errorData,
|
|
704
704
|
code: "AUTH_ERROR",
|
|
705
705
|
metadata: {
|
|
@@ -708,7 +708,7 @@ var swapCid = async (config, options, network) => {
|
|
|
708
708
|
});
|
|
709
709
|
}
|
|
710
710
|
if (request.status === 404) {
|
|
711
|
-
throw new
|
|
711
|
+
throw new chunkBK3CLF3Z_js.PinataError("CID not pinned to account", request.status, {
|
|
712
712
|
error: errorData,
|
|
713
713
|
code: "HTTP_ERROR",
|
|
714
714
|
metadata: {
|
|
@@ -716,7 +716,7 @@ var swapCid = async (config, options, network) => {
|
|
|
716
716
|
}
|
|
717
717
|
});
|
|
718
718
|
}
|
|
719
|
-
throw new
|
|
719
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
720
720
|
error: errorData,
|
|
721
721
|
code: "HTTP_ERROR",
|
|
722
722
|
metadata: {
|
|
@@ -728,20 +728,20 @@ var swapCid = async (config, options, network) => {
|
|
|
728
728
|
const resData = res.data;
|
|
729
729
|
return resData;
|
|
730
730
|
} catch (error) {
|
|
731
|
-
if (error instanceof
|
|
731
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
732
732
|
throw error;
|
|
733
733
|
}
|
|
734
734
|
if (error instanceof Error) {
|
|
735
|
-
throw new
|
|
735
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing CID Swap: ${error.message}`);
|
|
736
736
|
}
|
|
737
|
-
throw new
|
|
737
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while swapping CID");
|
|
738
738
|
}
|
|
739
739
|
};
|
|
740
740
|
|
|
741
741
|
// src/core/functions/files/swapHistory.ts
|
|
742
742
|
var swapHistory = async (config, options, network) => {
|
|
743
743
|
if (!config) {
|
|
744
|
-
throw new
|
|
744
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
745
745
|
}
|
|
746
746
|
let headers;
|
|
747
747
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -772,7 +772,7 @@ var swapHistory = async (config, options, network) => {
|
|
|
772
772
|
if (!request.ok) {
|
|
773
773
|
const errorData = await request.text();
|
|
774
774
|
if (request.status === 401 || request.status === 403) {
|
|
775
|
-
throw new
|
|
775
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
776
776
|
`Authentication failed: ${errorData}`,
|
|
777
777
|
request.status,
|
|
778
778
|
{
|
|
@@ -785,7 +785,7 @@ var swapHistory = async (config, options, network) => {
|
|
|
785
785
|
);
|
|
786
786
|
}
|
|
787
787
|
if (request.status === 404) {
|
|
788
|
-
throw new
|
|
788
|
+
throw new chunkBK3CLF3Z_js.PinataError("CID does not have history", request.status, {
|
|
789
789
|
error: errorData,
|
|
790
790
|
code: "HTTP_ERROR",
|
|
791
791
|
metadata: {
|
|
@@ -793,7 +793,7 @@ var swapHistory = async (config, options, network) => {
|
|
|
793
793
|
}
|
|
794
794
|
});
|
|
795
795
|
}
|
|
796
|
-
throw new
|
|
796
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
797
797
|
error: errorData,
|
|
798
798
|
code: "HTTP_ERROR",
|
|
799
799
|
metadata: {
|
|
@@ -805,13 +805,13 @@ var swapHistory = async (config, options, network) => {
|
|
|
805
805
|
const resData = res.data;
|
|
806
806
|
return resData;
|
|
807
807
|
} catch (error) {
|
|
808
|
-
if (error instanceof
|
|
808
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
809
809
|
throw error;
|
|
810
810
|
}
|
|
811
811
|
if (error instanceof Error) {
|
|
812
|
-
throw new
|
|
812
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error fetching swap history: ${error.message}`);
|
|
813
813
|
}
|
|
814
|
-
throw new
|
|
814
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
815
815
|
"An unknown error occurred while fetching swap history"
|
|
816
816
|
);
|
|
817
817
|
}
|
|
@@ -820,7 +820,7 @@ var swapHistory = async (config, options, network) => {
|
|
|
820
820
|
// src/core/functions/files/totalStorageUsage.ts
|
|
821
821
|
var totalStorageUsage = async (config) => {
|
|
822
822
|
if (!config) {
|
|
823
|
-
throw new
|
|
823
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
824
824
|
}
|
|
825
825
|
let endpoint = "https://api.pinata.cloud";
|
|
826
826
|
if (config.endpointUrl) {
|
|
@@ -843,7 +843,7 @@ var totalStorageUsage = async (config) => {
|
|
|
843
843
|
if (!request.ok) {
|
|
844
844
|
const errorData = await request.text();
|
|
845
845
|
if (request.status === 401 || request.status === 403) {
|
|
846
|
-
throw new
|
|
846
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
847
847
|
`Authentication failed: ${errorData}`,
|
|
848
848
|
request.status,
|
|
849
849
|
{
|
|
@@ -855,7 +855,7 @@ var totalStorageUsage = async (config) => {
|
|
|
855
855
|
}
|
|
856
856
|
);
|
|
857
857
|
}
|
|
858
|
-
throw new
|
|
858
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
859
859
|
error: errorData,
|
|
860
860
|
code: "HTTP_ERROR",
|
|
861
861
|
metadata: {
|
|
@@ -866,15 +866,15 @@ var totalStorageUsage = async (config) => {
|
|
|
866
866
|
const res = await request.json();
|
|
867
867
|
return res.pin_size_total;
|
|
868
868
|
} catch (error) {
|
|
869
|
-
if (error instanceof
|
|
869
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
870
870
|
throw error;
|
|
871
871
|
}
|
|
872
872
|
if (error instanceof Error) {
|
|
873
|
-
throw new
|
|
873
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
874
874
|
`Error processing totalStorageUsage: ${error.message}`
|
|
875
875
|
);
|
|
876
876
|
}
|
|
877
|
-
throw new
|
|
877
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
878
878
|
"An unknown error occurred while getting total storage usage"
|
|
879
879
|
);
|
|
880
880
|
}
|
|
@@ -883,10 +883,10 @@ var totalStorageUsage = async (config) => {
|
|
|
883
883
|
// src/core/functions/files/updateFile.ts
|
|
884
884
|
var updateFile = async (config, options, privacy) => {
|
|
885
885
|
if (!config) {
|
|
886
|
-
throw new
|
|
886
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
887
887
|
}
|
|
888
888
|
if (!options.name && (!options.keyvalues || Object.keys(options.keyvalues).length === 0)) {
|
|
889
|
-
throw new
|
|
889
|
+
throw new chunkBK3CLF3Z_js.ValidationError(
|
|
890
890
|
"At least one of 'name' or 'keyvalues' must be provided"
|
|
891
891
|
);
|
|
892
892
|
}
|
|
@@ -925,7 +925,7 @@ var updateFile = async (config, options, privacy) => {
|
|
|
925
925
|
if (!request.ok) {
|
|
926
926
|
const errorData = await request.text();
|
|
927
927
|
if (request.status === 401 || request.status === 403) {
|
|
928
|
-
throw new
|
|
928
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
929
929
|
`Authentication failed: ${errorData}`,
|
|
930
930
|
request.status,
|
|
931
931
|
{
|
|
@@ -937,7 +937,7 @@ var updateFile = async (config, options, privacy) => {
|
|
|
937
937
|
}
|
|
938
938
|
);
|
|
939
939
|
}
|
|
940
|
-
throw new
|
|
940
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
941
941
|
error: errorData,
|
|
942
942
|
code: "HTTP_ERROR",
|
|
943
943
|
metadata: {
|
|
@@ -949,20 +949,20 @@ var updateFile = async (config, options, privacy) => {
|
|
|
949
949
|
const resData = res.data;
|
|
950
950
|
return resData;
|
|
951
951
|
} catch (error) {
|
|
952
|
-
if (error instanceof
|
|
952
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
953
953
|
throw error;
|
|
954
954
|
}
|
|
955
955
|
if (error instanceof Error) {
|
|
956
|
-
throw new
|
|
956
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing updateFile: ${error.message}`);
|
|
957
957
|
}
|
|
958
|
-
throw new
|
|
958
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while updating file");
|
|
959
959
|
}
|
|
960
960
|
};
|
|
961
961
|
|
|
962
962
|
// src/core/functions/files/vectorizeFile.ts
|
|
963
963
|
var vectorizeFile = async (config, fileId) => {
|
|
964
964
|
if (!config) {
|
|
965
|
-
throw new
|
|
965
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
966
966
|
}
|
|
967
967
|
let headers;
|
|
968
968
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -988,7 +988,7 @@ var vectorizeFile = async (config, fileId) => {
|
|
|
988
988
|
if (!request.ok) {
|
|
989
989
|
const errorData = await request.text();
|
|
990
990
|
if (request.status === 401 || request.status === 403) {
|
|
991
|
-
throw new
|
|
991
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
992
992
|
`Authentication failed: ${errorData}`,
|
|
993
993
|
request.status,
|
|
994
994
|
{
|
|
@@ -1000,7 +1000,7 @@ var vectorizeFile = async (config, fileId) => {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
);
|
|
1002
1002
|
}
|
|
1003
|
-
throw new
|
|
1003
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1004
1004
|
error: errorData,
|
|
1005
1005
|
code: "HTTP_ERROR",
|
|
1006
1006
|
metadata: {
|
|
@@ -1011,22 +1011,22 @@ var vectorizeFile = async (config, fileId) => {
|
|
|
1011
1011
|
const res = await request.json();
|
|
1012
1012
|
return res;
|
|
1013
1013
|
} catch (error) {
|
|
1014
|
-
if (error instanceof
|
|
1014
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1015
1015
|
throw error;
|
|
1016
1016
|
}
|
|
1017
1017
|
if (error instanceof Error) {
|
|
1018
|
-
throw new
|
|
1018
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
1019
1019
|
`Error processing vectorize file: ${error.message}`
|
|
1020
1020
|
);
|
|
1021
1021
|
}
|
|
1022
|
-
throw new
|
|
1022
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while vectorizing file");
|
|
1023
1023
|
}
|
|
1024
1024
|
};
|
|
1025
1025
|
|
|
1026
1026
|
// src/core/functions/files/vectorizeQuery.ts
|
|
1027
1027
|
var vectorizeQuery = async (config, options) => {
|
|
1028
1028
|
if (!config) {
|
|
1029
|
-
throw new
|
|
1029
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1030
1030
|
}
|
|
1031
1031
|
let headers;
|
|
1032
1032
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1059,7 +1059,7 @@ var vectorizeQuery = async (config, options) => {
|
|
|
1059
1059
|
if (!request.ok) {
|
|
1060
1060
|
const errorData = await request.text();
|
|
1061
1061
|
if (request.status === 401 || request.status === 403) {
|
|
1062
|
-
throw new
|
|
1062
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1063
1063
|
`Authentication failed: ${errorData}`,
|
|
1064
1064
|
request.status,
|
|
1065
1065
|
{
|
|
@@ -1071,7 +1071,7 @@ var vectorizeQuery = async (config, options) => {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
);
|
|
1073
1073
|
}
|
|
1074
|
-
throw new
|
|
1074
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1075
1075
|
error: errorData,
|
|
1076
1076
|
code: "HTTP_ERROR",
|
|
1077
1077
|
metadata: {
|
|
@@ -1083,7 +1083,7 @@ var vectorizeQuery = async (config, options) => {
|
|
|
1083
1083
|
const resData = res.data;
|
|
1084
1084
|
if (options.returnFile) {
|
|
1085
1085
|
if (resData.matches.length === 0) {
|
|
1086
|
-
throw new
|
|
1086
|
+
throw new chunkBK3CLF3Z_js.PinataError(`No files returned in query to fetch`);
|
|
1087
1087
|
}
|
|
1088
1088
|
const cid = resData.matches[0].cid;
|
|
1089
1089
|
const fileRes = await getCid(config, cid, "files");
|
|
@@ -1091,22 +1091,22 @@ var vectorizeQuery = async (config, options) => {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
return resData;
|
|
1093
1093
|
} catch (error) {
|
|
1094
|
-
if (error instanceof
|
|
1094
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1095
1095
|
throw error;
|
|
1096
1096
|
}
|
|
1097
1097
|
if (error instanceof Error) {
|
|
1098
|
-
throw new
|
|
1098
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
1099
1099
|
`Error processing vectorize file: ${error.message}`
|
|
1100
1100
|
);
|
|
1101
1101
|
}
|
|
1102
|
-
throw new
|
|
1102
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while vectorizing file");
|
|
1103
1103
|
}
|
|
1104
1104
|
};
|
|
1105
1105
|
|
|
1106
1106
|
// src/core/functions/files/queue.ts
|
|
1107
1107
|
var queue = async (config, options) => {
|
|
1108
1108
|
if (!config) {
|
|
1109
|
-
throw new
|
|
1109
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1110
1110
|
}
|
|
1111
1111
|
const params = new URLSearchParams({
|
|
1112
1112
|
includesCount: "false"
|
|
@@ -1144,7 +1144,7 @@ var queue = async (config, options) => {
|
|
|
1144
1144
|
if (!request.ok) {
|
|
1145
1145
|
const errorData = await request.text();
|
|
1146
1146
|
if (request.status === 401 || request.status === 403) {
|
|
1147
|
-
throw new
|
|
1147
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1148
1148
|
`Authentication failed: ${errorData}`,
|
|
1149
1149
|
request.status,
|
|
1150
1150
|
{
|
|
@@ -1156,7 +1156,7 @@ var queue = async (config, options) => {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
);
|
|
1158
1158
|
}
|
|
1159
|
-
throw new
|
|
1159
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1160
1160
|
error: errorData,
|
|
1161
1161
|
code: "HTTP_ERROR",
|
|
1162
1162
|
metadata: {
|
|
@@ -1168,20 +1168,20 @@ var queue = async (config, options) => {
|
|
|
1168
1168
|
const resData = res.data;
|
|
1169
1169
|
return resData;
|
|
1170
1170
|
} catch (error) {
|
|
1171
|
-
if (error instanceof
|
|
1171
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1172
1172
|
throw error;
|
|
1173
1173
|
}
|
|
1174
1174
|
if (error instanceof Error) {
|
|
1175
|
-
throw new
|
|
1175
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing pinJobs: ${error.message}`);
|
|
1176
1176
|
}
|
|
1177
|
-
throw new
|
|
1177
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while listing pin jobs");
|
|
1178
1178
|
}
|
|
1179
1179
|
};
|
|
1180
1180
|
|
|
1181
1181
|
// src/core/functions/files/deletePinRequest.ts
|
|
1182
1182
|
var deletePinRequest = async (config, id) => {
|
|
1183
1183
|
if (!config) {
|
|
1184
|
-
throw new
|
|
1184
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1185
1185
|
}
|
|
1186
1186
|
let headers;
|
|
1187
1187
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1207,7 +1207,7 @@ var deletePinRequest = async (config, id) => {
|
|
|
1207
1207
|
if (!response.ok) {
|
|
1208
1208
|
const errorData = await response.text();
|
|
1209
1209
|
if (response.status === 401) {
|
|
1210
|
-
throw new
|
|
1210
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1211
1211
|
`Authentication failed: ${errorData}`,
|
|
1212
1212
|
response.status,
|
|
1213
1213
|
{
|
|
@@ -1219,7 +1219,7 @@ var deletePinRequest = async (config, id) => {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
);
|
|
1221
1221
|
}
|
|
1222
|
-
throw new
|
|
1222
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error`, response.status, {
|
|
1223
1223
|
error: errorData,
|
|
1224
1224
|
code: "HTTP_ERROR",
|
|
1225
1225
|
metadata: {
|
|
@@ -1229,13 +1229,13 @@ var deletePinRequest = async (config, id) => {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
return "OK";
|
|
1231
1231
|
} catch (error) {
|
|
1232
|
-
if (error instanceof
|
|
1232
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1233
1233
|
throw error;
|
|
1234
1234
|
}
|
|
1235
1235
|
if (error instanceof Error) {
|
|
1236
|
-
throw new
|
|
1236
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error deleting pin by request: ${error.message}`);
|
|
1237
1237
|
}
|
|
1238
|
-
throw new
|
|
1238
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
1239
1239
|
"An unknown error occurred while deleting pin by CID request"
|
|
1240
1240
|
);
|
|
1241
1241
|
}
|
|
@@ -1244,7 +1244,7 @@ var deletePinRequest = async (config, id) => {
|
|
|
1244
1244
|
// src/core/functions/gateway/getCid.ts
|
|
1245
1245
|
var getCid = async (config, cid, gatewayType, options) => {
|
|
1246
1246
|
if (!config) {
|
|
1247
|
-
throw new
|
|
1247
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1248
1248
|
}
|
|
1249
1249
|
let data;
|
|
1250
1250
|
let newUrl = `${config?.pinataGateway}/${gatewayType}/${cid}`;
|
|
@@ -1277,7 +1277,7 @@ var getCid = async (config, cid, gatewayType, options) => {
|
|
|
1277
1277
|
if (!request.ok) {
|
|
1278
1278
|
const errorData = await request.text();
|
|
1279
1279
|
if (request.status === 401 || request.status === 403) {
|
|
1280
|
-
throw new
|
|
1280
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1281
1281
|
`Authentication Failed: ${errorData}`,
|
|
1282
1282
|
request.status,
|
|
1283
1283
|
{
|
|
@@ -1289,7 +1289,7 @@ var getCid = async (config, cid, gatewayType, options) => {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
);
|
|
1291
1291
|
}
|
|
1292
|
-
throw new
|
|
1292
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1293
1293
|
error: errorData,
|
|
1294
1294
|
code: "HTTP_ERROR",
|
|
1295
1295
|
metadata: {
|
|
@@ -1347,7 +1347,7 @@ var getCid = async (config, cid, gatewayType, options) => {
|
|
|
1347
1347
|
if (!request.ok) {
|
|
1348
1348
|
const errorData = await request.text();
|
|
1349
1349
|
if (request.status === 401 || request.status === 403) {
|
|
1350
|
-
throw new
|
|
1350
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1351
1351
|
`Authentication Failed: ${errorData}`,
|
|
1352
1352
|
request.status,
|
|
1353
1353
|
{
|
|
@@ -1359,7 +1359,7 @@ var getCid = async (config, cid, gatewayType, options) => {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
);
|
|
1361
1361
|
}
|
|
1362
|
-
throw new
|
|
1362
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1363
1363
|
error: errorData,
|
|
1364
1364
|
code: "HTTP_ERROR",
|
|
1365
1365
|
metadata: {
|
|
@@ -1381,13 +1381,13 @@ var getCid = async (config, cid, gatewayType, options) => {
|
|
|
1381
1381
|
};
|
|
1382
1382
|
return res;
|
|
1383
1383
|
} catch (error) {
|
|
1384
|
-
if (error instanceof
|
|
1384
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1385
1385
|
throw error;
|
|
1386
1386
|
}
|
|
1387
1387
|
if (error instanceof Error) {
|
|
1388
|
-
throw new
|
|
1388
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing getCid: ${error.message}`);
|
|
1389
1389
|
}
|
|
1390
|
-
throw new
|
|
1390
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
1391
1391
|
"An unknown error occurred while getting CID contents"
|
|
1392
1392
|
);
|
|
1393
1393
|
}
|
|
@@ -1397,7 +1397,7 @@ var getCid = async (config, cid, gatewayType, options) => {
|
|
|
1397
1397
|
var convertIPFSUrl = async (config, url, gatewayPrefix) => {
|
|
1398
1398
|
let newUrl;
|
|
1399
1399
|
let prefix = gatewayPrefix || config?.pinataGateway || "https://gateway.pinata.cloud";
|
|
1400
|
-
newUrl = await
|
|
1400
|
+
newUrl = await chunkBK3CLF3Z_js.convertToDesiredGateway(url, prefix);
|
|
1401
1401
|
if (config?.pinataGatewayKey) {
|
|
1402
1402
|
`${newUrl}?pinataGatewayToken=${config?.pinataGatewayKey}`;
|
|
1403
1403
|
}
|
|
@@ -1407,7 +1407,7 @@ var convertIPFSUrl = async (config, url, gatewayPrefix) => {
|
|
|
1407
1407
|
// src/core/functions/gateway/createAccessLink.ts
|
|
1408
1408
|
var createAccessLink = async (config, options, imgOpts) => {
|
|
1409
1409
|
if (!config) {
|
|
1410
|
-
throw new
|
|
1410
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1411
1411
|
}
|
|
1412
1412
|
let baseUrl;
|
|
1413
1413
|
if (options?.gateway) {
|
|
@@ -1471,7 +1471,7 @@ var createAccessLink = async (config, options, imgOpts) => {
|
|
|
1471
1471
|
if (!request.ok) {
|
|
1472
1472
|
const errorData = await request.text();
|
|
1473
1473
|
if (request.status === 401 || request.status === 403) {
|
|
1474
|
-
throw new
|
|
1474
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1475
1475
|
`Authentication Failed: ${errorData}`,
|
|
1476
1476
|
request.status,
|
|
1477
1477
|
{
|
|
@@ -1483,7 +1483,7 @@ var createAccessLink = async (config, options, imgOpts) => {
|
|
|
1483
1483
|
}
|
|
1484
1484
|
);
|
|
1485
1485
|
}
|
|
1486
|
-
throw new
|
|
1486
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1487
1487
|
error: errorData,
|
|
1488
1488
|
code: "HTTP_ERROR",
|
|
1489
1489
|
metadata: {
|
|
@@ -1494,22 +1494,22 @@ var createAccessLink = async (config, options, imgOpts) => {
|
|
|
1494
1494
|
const res = await request.json();
|
|
1495
1495
|
return res.data;
|
|
1496
1496
|
} catch (error) {
|
|
1497
|
-
if (error instanceof
|
|
1497
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1498
1498
|
throw error;
|
|
1499
1499
|
}
|
|
1500
1500
|
if (error instanceof Error) {
|
|
1501
|
-
throw new
|
|
1501
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
1502
1502
|
`Error processing createSignedURL: ${error.message}`
|
|
1503
1503
|
);
|
|
1504
1504
|
}
|
|
1505
|
-
throw new
|
|
1505
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while getting signed url");
|
|
1506
1506
|
}
|
|
1507
1507
|
};
|
|
1508
1508
|
|
|
1509
1509
|
// src/core/functions/groups/addToGroup.ts
|
|
1510
1510
|
var addToGroup = async (config, options, privacy) => {
|
|
1511
1511
|
if (!config) {
|
|
1512
|
-
throw new
|
|
1512
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1513
1513
|
}
|
|
1514
1514
|
const wait3 = (milliseconds) => {
|
|
1515
1515
|
return new Promise((resolve) => {
|
|
@@ -1548,7 +1548,7 @@ var addToGroup = async (config, options, privacy) => {
|
|
|
1548
1548
|
if (!response.ok) {
|
|
1549
1549
|
const errorData = await response.text();
|
|
1550
1550
|
if (response.status === 401) {
|
|
1551
|
-
throw new
|
|
1551
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1552
1552
|
`Authentication failed: ${errorData}`,
|
|
1553
1553
|
response.status,
|
|
1554
1554
|
{
|
|
@@ -1560,7 +1560,7 @@ var addToGroup = async (config, options, privacy) => {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
);
|
|
1562
1562
|
}
|
|
1563
|
-
throw new
|
|
1563
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, response.status, {
|
|
1564
1564
|
error: errorData,
|
|
1565
1565
|
code: "HTTP_ERROR",
|
|
1566
1566
|
metadata: {
|
|
@@ -1574,7 +1574,7 @@ var addToGroup = async (config, options, privacy) => {
|
|
|
1574
1574
|
});
|
|
1575
1575
|
} catch (error) {
|
|
1576
1576
|
let errorMessage;
|
|
1577
|
-
if (error instanceof
|
|
1577
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1578
1578
|
errorMessage = error.message;
|
|
1579
1579
|
} else if (error instanceof Error) {
|
|
1580
1580
|
errorMessage = `Error adding file ${id} to group: ${error.message}`;
|
|
@@ -1593,7 +1593,7 @@ var addToGroup = async (config, options, privacy) => {
|
|
|
1593
1593
|
// src/core/functions/groups/createGroup.ts
|
|
1594
1594
|
var createGroup = async (config, options, privacy) => {
|
|
1595
1595
|
if (!config) {
|
|
1596
|
-
throw new
|
|
1596
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1597
1597
|
}
|
|
1598
1598
|
const data = JSON.stringify({
|
|
1599
1599
|
name: options.name,
|
|
@@ -1626,7 +1626,7 @@ var createGroup = async (config, options, privacy) => {
|
|
|
1626
1626
|
if (!request.ok) {
|
|
1627
1627
|
const errorData = await request.text();
|
|
1628
1628
|
if (request.status === 401 || request.status === 403) {
|
|
1629
|
-
throw new
|
|
1629
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1630
1630
|
`Authentication failed: ${errorData}`,
|
|
1631
1631
|
request.status,
|
|
1632
1632
|
{
|
|
@@ -1638,7 +1638,7 @@ var createGroup = async (config, options, privacy) => {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
);
|
|
1640
1640
|
}
|
|
1641
|
-
throw new
|
|
1641
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1642
1642
|
error: errorData,
|
|
1643
1643
|
code: "HTTP_ERROR",
|
|
1644
1644
|
metadata: {
|
|
@@ -1650,20 +1650,20 @@ var createGroup = async (config, options, privacy) => {
|
|
|
1650
1650
|
const resData = res.data;
|
|
1651
1651
|
return resData;
|
|
1652
1652
|
} catch (error) {
|
|
1653
|
-
if (error instanceof
|
|
1653
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1654
1654
|
throw error;
|
|
1655
1655
|
}
|
|
1656
1656
|
if (error instanceof Error) {
|
|
1657
|
-
throw new
|
|
1657
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing createGroup: ${error.message}`);
|
|
1658
1658
|
}
|
|
1659
|
-
throw new
|
|
1659
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while creating a group");
|
|
1660
1660
|
}
|
|
1661
1661
|
};
|
|
1662
1662
|
|
|
1663
1663
|
// src/core/functions/groups/deleteGroup.ts
|
|
1664
1664
|
var deleteGroup = async (config, options, privacy) => {
|
|
1665
1665
|
if (!config) {
|
|
1666
|
-
throw new
|
|
1666
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1667
1667
|
}
|
|
1668
1668
|
let headers;
|
|
1669
1669
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1694,7 +1694,7 @@ var deleteGroup = async (config, options, privacy) => {
|
|
|
1694
1694
|
if (!request.ok) {
|
|
1695
1695
|
const errorData = await request.text();
|
|
1696
1696
|
if (request.status === 401 || request.status === 403) {
|
|
1697
|
-
throw new
|
|
1697
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1698
1698
|
`Authentication failed: ${errorData}`,
|
|
1699
1699
|
request.status,
|
|
1700
1700
|
{
|
|
@@ -1706,7 +1706,7 @@ var deleteGroup = async (config, options, privacy) => {
|
|
|
1706
1706
|
}
|
|
1707
1707
|
);
|
|
1708
1708
|
}
|
|
1709
|
-
throw new
|
|
1709
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1710
1710
|
error: errorData,
|
|
1711
1711
|
code: "HTTP_ERROR",
|
|
1712
1712
|
metadata: {
|
|
@@ -1717,20 +1717,20 @@ var deleteGroup = async (config, options, privacy) => {
|
|
|
1717
1717
|
const res = request.statusText;
|
|
1718
1718
|
return res;
|
|
1719
1719
|
} catch (error) {
|
|
1720
|
-
if (error instanceof
|
|
1720
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1721
1721
|
throw error;
|
|
1722
1722
|
}
|
|
1723
1723
|
if (error instanceof Error) {
|
|
1724
|
-
throw new
|
|
1724
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing deleteGroup: ${error.message}`);
|
|
1725
1725
|
}
|
|
1726
|
-
throw new
|
|
1726
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while deleting a group");
|
|
1727
1727
|
}
|
|
1728
1728
|
};
|
|
1729
1729
|
|
|
1730
1730
|
// src/core/functions/groups/getGroup.ts
|
|
1731
1731
|
var getGroup = async (config, options, privacy) => {
|
|
1732
1732
|
if (!config) {
|
|
1733
|
-
throw new
|
|
1733
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1734
1734
|
}
|
|
1735
1735
|
let headers;
|
|
1736
1736
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1761,7 +1761,7 @@ var getGroup = async (config, options, privacy) => {
|
|
|
1761
1761
|
if (!request.ok) {
|
|
1762
1762
|
const errorData = await request.text();
|
|
1763
1763
|
if (request.status === 401 || request.status === 403) {
|
|
1764
|
-
throw new
|
|
1764
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1765
1765
|
`Authentication failed: ${errorData}`,
|
|
1766
1766
|
request.status,
|
|
1767
1767
|
{
|
|
@@ -1773,7 +1773,7 @@ var getGroup = async (config, options, privacy) => {
|
|
|
1773
1773
|
}
|
|
1774
1774
|
);
|
|
1775
1775
|
}
|
|
1776
|
-
throw new
|
|
1776
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1777
1777
|
error: errorData,
|
|
1778
1778
|
code: "HTTP_ERROR",
|
|
1779
1779
|
metadata: {
|
|
@@ -1785,13 +1785,13 @@ var getGroup = async (config, options, privacy) => {
|
|
|
1785
1785
|
const resData = res.data;
|
|
1786
1786
|
return resData;
|
|
1787
1787
|
} catch (error) {
|
|
1788
|
-
if (error instanceof
|
|
1788
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1789
1789
|
throw error;
|
|
1790
1790
|
}
|
|
1791
1791
|
if (error instanceof Error) {
|
|
1792
|
-
throw new
|
|
1792
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing getGroup: ${error.message}`);
|
|
1793
1793
|
}
|
|
1794
|
-
throw new
|
|
1794
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
1795
1795
|
"An unknown error occurred while getting info for a group"
|
|
1796
1796
|
);
|
|
1797
1797
|
}
|
|
@@ -1800,7 +1800,7 @@ var getGroup = async (config, options, privacy) => {
|
|
|
1800
1800
|
// src/core/functions/groups/listGroups.ts
|
|
1801
1801
|
var listGroups = async (config, privacy, options) => {
|
|
1802
1802
|
if (!config) {
|
|
1803
|
-
throw new
|
|
1803
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1804
1804
|
}
|
|
1805
1805
|
let headers;
|
|
1806
1806
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -1839,7 +1839,7 @@ var listGroups = async (config, privacy, options) => {
|
|
|
1839
1839
|
if (!request.ok) {
|
|
1840
1840
|
const errorData = await request.text();
|
|
1841
1841
|
if (request.status === 401 || request.status === 403) {
|
|
1842
|
-
throw new
|
|
1842
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1843
1843
|
`Authentication failed: ${errorData}`,
|
|
1844
1844
|
request.status,
|
|
1845
1845
|
{
|
|
@@ -1851,7 +1851,7 @@ var listGroups = async (config, privacy, options) => {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
);
|
|
1853
1853
|
}
|
|
1854
|
-
throw new
|
|
1854
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
1855
1855
|
error: errorData,
|
|
1856
1856
|
code: "HTTP_ERROR",
|
|
1857
1857
|
metadata: {
|
|
@@ -1863,20 +1863,20 @@ var listGroups = async (config, privacy, options) => {
|
|
|
1863
1863
|
const resData = res.data;
|
|
1864
1864
|
return resData;
|
|
1865
1865
|
} catch (error) {
|
|
1866
|
-
if (error instanceof
|
|
1866
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1867
1867
|
throw error;
|
|
1868
1868
|
}
|
|
1869
1869
|
if (error instanceof Error) {
|
|
1870
|
-
throw new
|
|
1870
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing listGroups: ${error.message}`);
|
|
1871
1871
|
}
|
|
1872
|
-
throw new
|
|
1872
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while listing groups");
|
|
1873
1873
|
}
|
|
1874
1874
|
};
|
|
1875
1875
|
|
|
1876
1876
|
// src/core/functions/groups/removeFromGroup.ts
|
|
1877
1877
|
var removeFromGroup = async (config, options, privacy) => {
|
|
1878
1878
|
if (!config) {
|
|
1879
|
-
throw new
|
|
1879
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1880
1880
|
}
|
|
1881
1881
|
const wait3 = (milliseconds) => {
|
|
1882
1882
|
return new Promise((resolve) => {
|
|
@@ -1915,7 +1915,7 @@ var removeFromGroup = async (config, options, privacy) => {
|
|
|
1915
1915
|
if (!response.ok) {
|
|
1916
1916
|
const errorData = await response.text();
|
|
1917
1917
|
if (response.status === 401) {
|
|
1918
|
-
throw new
|
|
1918
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
1919
1919
|
`Authentication failed: ${errorData}`,
|
|
1920
1920
|
response.status,
|
|
1921
1921
|
{
|
|
@@ -1927,7 +1927,7 @@ var removeFromGroup = async (config, options, privacy) => {
|
|
|
1927
1927
|
}
|
|
1928
1928
|
);
|
|
1929
1929
|
}
|
|
1930
|
-
throw new
|
|
1930
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, response.status, {
|
|
1931
1931
|
error: errorData,
|
|
1932
1932
|
code: "HTTP_ERROR",
|
|
1933
1933
|
metadata: {
|
|
@@ -1941,7 +1941,7 @@ var removeFromGroup = async (config, options, privacy) => {
|
|
|
1941
1941
|
});
|
|
1942
1942
|
} catch (error) {
|
|
1943
1943
|
let errorMessage;
|
|
1944
|
-
if (error instanceof
|
|
1944
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
1945
1945
|
errorMessage = error.message;
|
|
1946
1946
|
} else if (error instanceof Error) {
|
|
1947
1947
|
errorMessage = `Error adding file ${id} to group: ${error.message}`;
|
|
@@ -1960,7 +1960,7 @@ var removeFromGroup = async (config, options, privacy) => {
|
|
|
1960
1960
|
// src/core/functions/groups/updateGroup.ts
|
|
1961
1961
|
var updateGroup = async (config, options, privacy) => {
|
|
1962
1962
|
if (!config) {
|
|
1963
|
-
throw new
|
|
1963
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
1964
1964
|
}
|
|
1965
1965
|
const data = JSON.stringify({
|
|
1966
1966
|
name: options.name,
|
|
@@ -1996,7 +1996,7 @@ var updateGroup = async (config, options, privacy) => {
|
|
|
1996
1996
|
if (!request.ok) {
|
|
1997
1997
|
const errorData = await request.text();
|
|
1998
1998
|
if (request.status === 401 || request.status === 403) {
|
|
1999
|
-
throw new
|
|
1999
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2000
2000
|
`Authentication failed: ${errorData}`,
|
|
2001
2001
|
request.status,
|
|
2002
2002
|
{
|
|
@@ -2008,7 +2008,7 @@ var updateGroup = async (config, options, privacy) => {
|
|
|
2008
2008
|
}
|
|
2009
2009
|
);
|
|
2010
2010
|
}
|
|
2011
|
-
throw new
|
|
2011
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2012
2012
|
error: errorData,
|
|
2013
2013
|
code: "HTTP_ERROR",
|
|
2014
2014
|
metadata: {
|
|
@@ -2020,20 +2020,20 @@ var updateGroup = async (config, options, privacy) => {
|
|
|
2020
2020
|
const resData = res.data;
|
|
2021
2021
|
return resData;
|
|
2022
2022
|
} catch (error) {
|
|
2023
|
-
if (error instanceof
|
|
2023
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2024
2024
|
throw error;
|
|
2025
2025
|
}
|
|
2026
2026
|
if (error instanceof Error) {
|
|
2027
|
-
throw new
|
|
2027
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing updateGroup: ${error.message}`);
|
|
2028
2028
|
}
|
|
2029
|
-
throw new
|
|
2029
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while updating group");
|
|
2030
2030
|
}
|
|
2031
2031
|
};
|
|
2032
2032
|
|
|
2033
2033
|
// src/core/functions/keys/createKey.ts
|
|
2034
2034
|
var createKey = async (config, options) => {
|
|
2035
2035
|
if (!config) {
|
|
2036
|
-
throw new
|
|
2036
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2037
2037
|
}
|
|
2038
2038
|
let headers;
|
|
2039
2039
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -2063,7 +2063,7 @@ var createKey = async (config, options) => {
|
|
|
2063
2063
|
if (!request.ok) {
|
|
2064
2064
|
const errorData = await request.text();
|
|
2065
2065
|
if (request.status === 401 || request.status === 403) {
|
|
2066
|
-
throw new
|
|
2066
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2067
2067
|
`Authentication failed: ${errorData}`,
|
|
2068
2068
|
request.status,
|
|
2069
2069
|
{
|
|
@@ -2075,7 +2075,7 @@ var createKey = async (config, options) => {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
);
|
|
2077
2077
|
}
|
|
2078
|
-
throw new
|
|
2078
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2079
2079
|
error: errorData,
|
|
2080
2080
|
code: "HTTP_ERROR",
|
|
2081
2081
|
metadata: {
|
|
@@ -2086,20 +2086,20 @@ var createKey = async (config, options) => {
|
|
|
2086
2086
|
const res = await request.json();
|
|
2087
2087
|
return res;
|
|
2088
2088
|
} catch (error) {
|
|
2089
|
-
if (error instanceof
|
|
2089
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2090
2090
|
throw error;
|
|
2091
2091
|
}
|
|
2092
2092
|
if (error instanceof Error) {
|
|
2093
|
-
throw new
|
|
2093
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing createKey: ${error.message}`);
|
|
2094
2094
|
}
|
|
2095
|
-
throw new
|
|
2095
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while creating API key");
|
|
2096
2096
|
}
|
|
2097
2097
|
};
|
|
2098
2098
|
|
|
2099
2099
|
// src/core/functions/keys/listKeys.ts
|
|
2100
2100
|
var listKeys = async (config, options) => {
|
|
2101
2101
|
if (!config) {
|
|
2102
|
-
throw new
|
|
2102
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2103
2103
|
}
|
|
2104
2104
|
let headers;
|
|
2105
2105
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -2141,7 +2141,7 @@ var listKeys = async (config, options) => {
|
|
|
2141
2141
|
if (!request.ok) {
|
|
2142
2142
|
const errorData = await request.text();
|
|
2143
2143
|
if (request.status === 401 || request.status === 403) {
|
|
2144
|
-
throw new
|
|
2144
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2145
2145
|
`Authentication failed: ${errorData}`,
|
|
2146
2146
|
request.status,
|
|
2147
2147
|
{
|
|
@@ -2153,7 +2153,7 @@ var listKeys = async (config, options) => {
|
|
|
2153
2153
|
}
|
|
2154
2154
|
);
|
|
2155
2155
|
}
|
|
2156
|
-
throw new
|
|
2156
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2157
2157
|
error: errorData,
|
|
2158
2158
|
code: "HTTP_ERROR",
|
|
2159
2159
|
metadata: {
|
|
@@ -2164,13 +2164,13 @@ var listKeys = async (config, options) => {
|
|
|
2164
2164
|
const res = await request.json();
|
|
2165
2165
|
return res.keys;
|
|
2166
2166
|
} catch (error) {
|
|
2167
|
-
if (error instanceof
|
|
2167
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2168
2168
|
throw error;
|
|
2169
2169
|
}
|
|
2170
2170
|
if (error instanceof Error) {
|
|
2171
|
-
throw new
|
|
2171
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing listKeys: ${error.message}`);
|
|
2172
2172
|
}
|
|
2173
|
-
throw new
|
|
2173
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while listing API keys");
|
|
2174
2174
|
}
|
|
2175
2175
|
};
|
|
2176
2176
|
|
|
@@ -2182,7 +2182,7 @@ var wait2 = (milliseconds) => {
|
|
|
2182
2182
|
};
|
|
2183
2183
|
var revokeKeys = async (config, keys) => {
|
|
2184
2184
|
if (!config) {
|
|
2185
|
-
throw new
|
|
2185
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2186
2186
|
}
|
|
2187
2187
|
let headers;
|
|
2188
2188
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -2214,7 +2214,7 @@ var revokeKeys = async (config, keys) => {
|
|
|
2214
2214
|
if (!request.ok) {
|
|
2215
2215
|
const errorData = await request.text();
|
|
2216
2216
|
if (request.status === 401 || request.status === 403) {
|
|
2217
|
-
throw new
|
|
2217
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2218
2218
|
`Authentication failed: ${errorData}`,
|
|
2219
2219
|
request.status,
|
|
2220
2220
|
{
|
|
@@ -2226,7 +2226,7 @@ var revokeKeys = async (config, keys) => {
|
|
|
2226
2226
|
}
|
|
2227
2227
|
);
|
|
2228
2228
|
}
|
|
2229
|
-
throw new
|
|
2229
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2230
2230
|
error: errorData,
|
|
2231
2231
|
code: "HTTP_ERROR",
|
|
2232
2232
|
metadata: {
|
|
@@ -2241,7 +2241,7 @@ var revokeKeys = async (config, keys) => {
|
|
|
2241
2241
|
});
|
|
2242
2242
|
} catch (error) {
|
|
2243
2243
|
let errorMessage;
|
|
2244
|
-
if (error instanceof
|
|
2244
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2245
2245
|
errorMessage = error.message;
|
|
2246
2246
|
} else if (error instanceof Error) {
|
|
2247
2247
|
errorMessage = `Error revoking key ${key}: ${error.message}`;
|
|
@@ -2260,7 +2260,7 @@ var revokeKeys = async (config, keys) => {
|
|
|
2260
2260
|
// src/core/functions/uploads/base64.ts
|
|
2261
2261
|
var uploadBase64 = async (config, base64String, network, options) => {
|
|
2262
2262
|
if (!config) {
|
|
2263
|
-
throw new
|
|
2263
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2264
2264
|
}
|
|
2265
2265
|
const jwt = options?.keys || config?.pinataJwt;
|
|
2266
2266
|
const name = options?.metadata?.name ? options?.metadata?.name : "base64 string";
|
|
@@ -2301,7 +2301,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2301
2301
|
if (!request.ok) {
|
|
2302
2302
|
const errorData = await request.text();
|
|
2303
2303
|
if (request.status === 401 || request.status === 403) {
|
|
2304
|
-
throw new
|
|
2304
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2305
2305
|
`Authentication failed: ${errorData}`,
|
|
2306
2306
|
request.status,
|
|
2307
2307
|
{
|
|
@@ -2313,7 +2313,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2313
2313
|
}
|
|
2314
2314
|
);
|
|
2315
2315
|
}
|
|
2316
|
-
throw new
|
|
2316
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2317
2317
|
error: errorData,
|
|
2318
2318
|
code: "HTTP_ERROR",
|
|
2319
2319
|
metadata: {
|
|
@@ -2325,13 +2325,13 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2325
2325
|
const resData = res.data;
|
|
2326
2326
|
return resData;
|
|
2327
2327
|
} catch (error) {
|
|
2328
|
-
if (error instanceof
|
|
2328
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2329
2329
|
throw error;
|
|
2330
2330
|
}
|
|
2331
2331
|
if (error instanceof Error) {
|
|
2332
|
-
throw new
|
|
2332
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing base64: ${error.message}`);
|
|
2333
2333
|
}
|
|
2334
|
-
throw new
|
|
2334
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2335
2335
|
"An unknown error occurred while trying to upload base64"
|
|
2336
2336
|
);
|
|
2337
2337
|
}
|
|
@@ -2345,7 +2345,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2345
2345
|
if (!request.ok) {
|
|
2346
2346
|
const errorData = await request.text();
|
|
2347
2347
|
if (request.status === 401 || request.status === 403) {
|
|
2348
|
-
throw new
|
|
2348
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2349
2349
|
`Authentication failed: ${errorData}`,
|
|
2350
2350
|
request.status,
|
|
2351
2351
|
{
|
|
@@ -2357,7 +2357,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2357
2357
|
}
|
|
2358
2358
|
);
|
|
2359
2359
|
}
|
|
2360
|
-
throw new
|
|
2360
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2361
2361
|
error: errorData,
|
|
2362
2362
|
code: "HTTP_ERROR",
|
|
2363
2363
|
metadata: {
|
|
@@ -2382,7 +2382,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2382
2382
|
return resData;
|
|
2383
2383
|
} else {
|
|
2384
2384
|
const errorData = await vectorReq.text();
|
|
2385
|
-
throw new
|
|
2385
|
+
throw new chunkBK3CLF3Z_js.NetworkError(
|
|
2386
2386
|
`HTTP error during vectorization: ${errorData}`,
|
|
2387
2387
|
vectorReq.status,
|
|
2388
2388
|
{
|
|
@@ -2397,13 +2397,13 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2397
2397
|
}
|
|
2398
2398
|
return resData;
|
|
2399
2399
|
} catch (error) {
|
|
2400
|
-
if (error instanceof
|
|
2400
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2401
2401
|
throw error;
|
|
2402
2402
|
}
|
|
2403
2403
|
if (error instanceof Error) {
|
|
2404
|
-
throw new
|
|
2404
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing base64: ${error.message}`);
|
|
2405
2405
|
}
|
|
2406
|
-
throw new
|
|
2406
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2407
2407
|
"An unknown error occurred while trying to upload base64"
|
|
2408
2408
|
);
|
|
2409
2409
|
}
|
|
@@ -2412,7 +2412,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
|
|
|
2412
2412
|
// src/core/functions/uploads/createSignedUploadURL.ts
|
|
2413
2413
|
var createSignedUploadURL = async (config, options, network) => {
|
|
2414
2414
|
if (!config) {
|
|
2415
|
-
throw new
|
|
2415
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2416
2416
|
}
|
|
2417
2417
|
const date = options?.date || Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
2418
2418
|
const payload = {
|
|
@@ -2468,7 +2468,7 @@ var createSignedUploadURL = async (config, options, network) => {
|
|
|
2468
2468
|
if (!request.ok) {
|
|
2469
2469
|
const errorData = await request.text();
|
|
2470
2470
|
if (request.status === 401 || request.status === 403) {
|
|
2471
|
-
throw new
|
|
2471
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2472
2472
|
`Authentication Failed: ${errorData}`,
|
|
2473
2473
|
request.status,
|
|
2474
2474
|
{
|
|
@@ -2480,7 +2480,7 @@ var createSignedUploadURL = async (config, options, network) => {
|
|
|
2480
2480
|
}
|
|
2481
2481
|
);
|
|
2482
2482
|
}
|
|
2483
|
-
throw new
|
|
2483
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2484
2484
|
error: errorData,
|
|
2485
2485
|
code: "HTTP_ERROR",
|
|
2486
2486
|
metadata: {
|
|
@@ -2491,22 +2491,22 @@ var createSignedUploadURL = async (config, options, network) => {
|
|
|
2491
2491
|
const res = await request.json();
|
|
2492
2492
|
return res.data;
|
|
2493
2493
|
} catch (error) {
|
|
2494
|
-
if (error instanceof
|
|
2494
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2495
2495
|
throw error;
|
|
2496
2496
|
}
|
|
2497
2497
|
if (error instanceof Error) {
|
|
2498
|
-
throw new
|
|
2498
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2499
2499
|
`Error processing createSignedURL: ${error.message}`
|
|
2500
2500
|
);
|
|
2501
2501
|
}
|
|
2502
|
-
throw new
|
|
2502
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while getting signed url");
|
|
2503
2503
|
}
|
|
2504
2504
|
};
|
|
2505
2505
|
|
|
2506
2506
|
// src/core/functions/uploads/file.ts
|
|
2507
2507
|
var uploadFile = async (config, file, network, options) => {
|
|
2508
2508
|
if (!config) {
|
|
2509
|
-
throw new
|
|
2509
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2510
2510
|
}
|
|
2511
2511
|
const jwt = options?.keys || config.pinataJwt;
|
|
2512
2512
|
let endpoint = "https://uploads.pinata.cloud/v3";
|
|
@@ -2552,7 +2552,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2552
2552
|
const url = urlReq.headers.get("Location");
|
|
2553
2553
|
if (!url) {
|
|
2554
2554
|
const errorData = await urlReq.text();
|
|
2555
|
-
throw new
|
|
2555
|
+
throw new chunkBK3CLF3Z_js.NetworkError("Upload URL not provided", urlReq.status, {
|
|
2556
2556
|
error: errorData,
|
|
2557
2557
|
code: "HTTP_ERROR",
|
|
2558
2558
|
metadata: {
|
|
@@ -2590,7 +2590,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2590
2590
|
retryCount++;
|
|
2591
2591
|
if (retryCount > maxRetries) {
|
|
2592
2592
|
const errorData = uploadReq ? await uploadReq.text().catch(() => "Unknown error") : error instanceof Error ? error.message : String(error);
|
|
2593
|
-
throw new
|
|
2593
|
+
throw new chunkBK3CLF3Z_js.NetworkError(
|
|
2594
2594
|
`HTTP error during chunk upload after ${maxRetries} retries: ${errorData}`,
|
|
2595
2595
|
uploadReq?.status || 0,
|
|
2596
2596
|
{
|
|
@@ -2643,7 +2643,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2643
2643
|
return data2;
|
|
2644
2644
|
} else {
|
|
2645
2645
|
const errorData = await vectorReq.text();
|
|
2646
|
-
throw new
|
|
2646
|
+
throw new chunkBK3CLF3Z_js.NetworkError(
|
|
2647
2647
|
`HTTP error during vectorization: ${errorData}`,
|
|
2648
2648
|
vectorReq.status,
|
|
2649
2649
|
{
|
|
@@ -2694,7 +2694,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2694
2694
|
if (!request.ok) {
|
|
2695
2695
|
const errorData = await request.text();
|
|
2696
2696
|
if (request.status === 401 || request.status === 403) {
|
|
2697
|
-
throw new
|
|
2697
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2698
2698
|
`Authentication failed: ${errorData}`,
|
|
2699
2699
|
request.status,
|
|
2700
2700
|
{
|
|
@@ -2706,7 +2706,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2706
2706
|
}
|
|
2707
2707
|
);
|
|
2708
2708
|
}
|
|
2709
|
-
throw new
|
|
2709
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2710
2710
|
error: errorData,
|
|
2711
2711
|
code: "HTTP_ERROR",
|
|
2712
2712
|
metadata: {
|
|
@@ -2718,11 +2718,11 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2718
2718
|
const resData = res.data;
|
|
2719
2719
|
return resData;
|
|
2720
2720
|
} catch (error) {
|
|
2721
|
-
if (error instanceof
|
|
2721
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2722
2722
|
throw error;
|
|
2723
2723
|
}
|
|
2724
2724
|
if (error instanceof Error) {
|
|
2725
|
-
throw new
|
|
2725
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2726
2726
|
`Error uploading file: ${error.message}`,
|
|
2727
2727
|
void 0,
|
|
2728
2728
|
{
|
|
@@ -2730,7 +2730,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2730
2730
|
}
|
|
2731
2731
|
);
|
|
2732
2732
|
}
|
|
2733
|
-
throw new
|
|
2733
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2734
2734
|
"An unknown error occurred while trying to upload file"
|
|
2735
2735
|
);
|
|
2736
2736
|
}
|
|
@@ -2744,7 +2744,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2744
2744
|
if (!request.ok) {
|
|
2745
2745
|
const errorData = await request.text();
|
|
2746
2746
|
if (request.status === 401 || request.status === 403) {
|
|
2747
|
-
throw new
|
|
2747
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2748
2748
|
`Authentication failed: ${errorData}`,
|
|
2749
2749
|
request.status,
|
|
2750
2750
|
{
|
|
@@ -2756,7 +2756,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2756
2756
|
}
|
|
2757
2757
|
);
|
|
2758
2758
|
}
|
|
2759
|
-
throw new
|
|
2759
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2760
2760
|
error: errorData,
|
|
2761
2761
|
code: "HTTP_ERROR",
|
|
2762
2762
|
metadata: {
|
|
@@ -2781,7 +2781,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2781
2781
|
return resData;
|
|
2782
2782
|
} else {
|
|
2783
2783
|
const errorData = await vectorReq.text();
|
|
2784
|
-
throw new
|
|
2784
|
+
throw new chunkBK3CLF3Z_js.NetworkError(
|
|
2785
2785
|
`HTTP error during vectorization: ${errorData}`,
|
|
2786
2786
|
vectorReq.status,
|
|
2787
2787
|
{
|
|
@@ -2796,11 +2796,11 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2796
2796
|
}
|
|
2797
2797
|
return resData;
|
|
2798
2798
|
} catch (error) {
|
|
2799
|
-
if (error instanceof
|
|
2799
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2800
2800
|
throw error;
|
|
2801
2801
|
}
|
|
2802
2802
|
if (error instanceof Error) {
|
|
2803
|
-
throw new
|
|
2803
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2804
2804
|
`Error uploading file: ${error.message}`,
|
|
2805
2805
|
void 0,
|
|
2806
2806
|
{
|
|
@@ -2808,7 +2808,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2808
2808
|
}
|
|
2809
2809
|
);
|
|
2810
2810
|
}
|
|
2811
|
-
throw new
|
|
2811
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2812
2812
|
"An unknown error occurred while trying to upload file"
|
|
2813
2813
|
);
|
|
2814
2814
|
}
|
|
@@ -2817,7 +2817,7 @@ var uploadFile = async (config, file, network, options) => {
|
|
|
2817
2817
|
// src/core/functions/uploads/fileArray.ts
|
|
2818
2818
|
var uploadFileArray = async (config, files, network, options) => {
|
|
2819
2819
|
if (!config) {
|
|
2820
|
-
throw new
|
|
2820
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2821
2821
|
}
|
|
2822
2822
|
const jwt = options?.keys || config?.pinataJwt;
|
|
2823
2823
|
const folder = options?.metadata?.name || "folder_from_sdk";
|
|
@@ -2865,7 +2865,7 @@ var uploadFileArray = async (config, files, network, options) => {
|
|
|
2865
2865
|
if (!request.ok) {
|
|
2866
2866
|
const errorData = await request.text();
|
|
2867
2867
|
if (request.status === 401 || request.status === 403) {
|
|
2868
|
-
throw new
|
|
2868
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2869
2869
|
`Authentication failed: ${errorData}`,
|
|
2870
2870
|
request.status,
|
|
2871
2871
|
{
|
|
@@ -2877,7 +2877,7 @@ var uploadFileArray = async (config, files, network, options) => {
|
|
|
2877
2877
|
}
|
|
2878
2878
|
);
|
|
2879
2879
|
}
|
|
2880
|
-
throw new
|
|
2880
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2881
2881
|
error: errorData,
|
|
2882
2882
|
code: "HTTP_ERROR",
|
|
2883
2883
|
metadata: {
|
|
@@ -2901,13 +2901,13 @@ var uploadFileArray = async (config, files, network, options) => {
|
|
|
2901
2901
|
};
|
|
2902
2902
|
return resData;
|
|
2903
2903
|
} catch (error) {
|
|
2904
|
-
if (error instanceof
|
|
2904
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2905
2905
|
throw error;
|
|
2906
2906
|
}
|
|
2907
2907
|
if (error instanceof Error) {
|
|
2908
|
-
throw new
|
|
2908
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing fileArray: ${error.message}`);
|
|
2909
2909
|
}
|
|
2910
|
-
throw new
|
|
2910
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2911
2911
|
"An unknown error occurred while uploading an array of files"
|
|
2912
2912
|
);
|
|
2913
2913
|
}
|
|
@@ -2916,7 +2916,7 @@ var uploadFileArray = async (config, files, network, options) => {
|
|
|
2916
2916
|
// src/core/functions/uploads/json.ts
|
|
2917
2917
|
var uploadJson = async (config, jsonData, network, options) => {
|
|
2918
2918
|
if (!config) {
|
|
2919
|
-
throw new
|
|
2919
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
2920
2920
|
}
|
|
2921
2921
|
const jwt = options?.keys || config?.pinataJwt;
|
|
2922
2922
|
const json = JSON.stringify(jsonData);
|
|
@@ -2957,7 +2957,7 @@ var uploadJson = async (config, jsonData, network, options) => {
|
|
|
2957
2957
|
if (!request.ok) {
|
|
2958
2958
|
const errorData = await request.text();
|
|
2959
2959
|
if (request.status === 401 || request.status === 403) {
|
|
2960
|
-
throw new
|
|
2960
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
2961
2961
|
`Authentication failed: ${errorData}`,
|
|
2962
2962
|
request.status,
|
|
2963
2963
|
{
|
|
@@ -2969,7 +2969,7 @@ var uploadJson = async (config, jsonData, network, options) => {
|
|
|
2969
2969
|
}
|
|
2970
2970
|
);
|
|
2971
2971
|
}
|
|
2972
|
-
throw new
|
|
2972
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
2973
2973
|
error: errorData,
|
|
2974
2974
|
code: "HTTP_ERROR",
|
|
2975
2975
|
metadata: {
|
|
@@ -2981,13 +2981,13 @@ var uploadJson = async (config, jsonData, network, options) => {
|
|
|
2981
2981
|
const resData = res.data;
|
|
2982
2982
|
return resData;
|
|
2983
2983
|
} catch (error) {
|
|
2984
|
-
if (error instanceof
|
|
2984
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
2985
2985
|
throw error;
|
|
2986
2986
|
}
|
|
2987
2987
|
if (error instanceof Error) {
|
|
2988
|
-
throw new
|
|
2988
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing base64: ${error.message}`);
|
|
2989
2989
|
}
|
|
2990
|
-
throw new
|
|
2990
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
2991
2991
|
"An unknown error occurred while trying to upload base64"
|
|
2992
2992
|
);
|
|
2993
2993
|
}
|
|
@@ -3001,7 +3001,7 @@ var uploadJson = async (config, jsonData, network, options) => {
|
|
|
3001
3001
|
if (!request.ok) {
|
|
3002
3002
|
const errorData = await request.text();
|
|
3003
3003
|
if (request.status === 401 || request.status === 403) {
|
|
3004
|
-
throw new
|
|
3004
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
3005
3005
|
`Authentication failed: ${errorData}`,
|
|
3006
3006
|
request.status,
|
|
3007
3007
|
{
|
|
@@ -3013,7 +3013,7 @@ var uploadJson = async (config, jsonData, network, options) => {
|
|
|
3013
3013
|
}
|
|
3014
3014
|
);
|
|
3015
3015
|
}
|
|
3016
|
-
throw new
|
|
3016
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
3017
3017
|
error: errorData,
|
|
3018
3018
|
code: "HTTP_ERROR",
|
|
3019
3019
|
metadata: {
|
|
@@ -3038,7 +3038,7 @@ var uploadJson = async (config, jsonData, network, options) => {
|
|
|
3038
3038
|
return resData;
|
|
3039
3039
|
} else {
|
|
3040
3040
|
const errorData = await vectorReq.text();
|
|
3041
|
-
throw new
|
|
3041
|
+
throw new chunkBK3CLF3Z_js.NetworkError(
|
|
3042
3042
|
`HTTP error during vectorization: ${errorData}`,
|
|
3043
3043
|
vectorReq.status,
|
|
3044
3044
|
{
|
|
@@ -3053,27 +3053,27 @@ var uploadJson = async (config, jsonData, network, options) => {
|
|
|
3053
3053
|
}
|
|
3054
3054
|
return resData;
|
|
3055
3055
|
} catch (error) {
|
|
3056
|
-
if (error instanceof
|
|
3056
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
3057
3057
|
throw error;
|
|
3058
3058
|
}
|
|
3059
3059
|
if (error instanceof Error) {
|
|
3060
|
-
throw new
|
|
3060
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing json: ${error.message}`);
|
|
3061
3061
|
}
|
|
3062
|
-
throw new
|
|
3062
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while uploading json");
|
|
3063
3063
|
}
|
|
3064
3064
|
};
|
|
3065
3065
|
|
|
3066
3066
|
// src/core/functions/uploads/url.ts
|
|
3067
3067
|
var uploadUrl = async (config, url, network, options) => {
|
|
3068
3068
|
if (!config) {
|
|
3069
|
-
throw new
|
|
3069
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
3070
3070
|
}
|
|
3071
3071
|
const jwt = options?.keys || config?.pinataJwt;
|
|
3072
3072
|
const data = new FormData();
|
|
3073
3073
|
const stream = await fetch(url);
|
|
3074
3074
|
if (!stream.ok) {
|
|
3075
3075
|
const errorData = await stream.text();
|
|
3076
|
-
throw new
|
|
3076
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, stream.status, {
|
|
3077
3077
|
error: errorData,
|
|
3078
3078
|
code: "HTTP_ERROR",
|
|
3079
3079
|
metadata: {
|
|
@@ -3119,7 +3119,7 @@ var uploadUrl = async (config, url, network, options) => {
|
|
|
3119
3119
|
if (!request.ok) {
|
|
3120
3120
|
const errorData = await request.text();
|
|
3121
3121
|
if (request.status === 401 || request.status === 403) {
|
|
3122
|
-
throw new
|
|
3122
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
3123
3123
|
`Authentication failed: ${errorData}`,
|
|
3124
3124
|
request.status,
|
|
3125
3125
|
{
|
|
@@ -3131,7 +3131,7 @@ var uploadUrl = async (config, url, network, options) => {
|
|
|
3131
3131
|
}
|
|
3132
3132
|
);
|
|
3133
3133
|
}
|
|
3134
|
-
throw new
|
|
3134
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
3135
3135
|
error: errorData,
|
|
3136
3136
|
code: "HTTP_ERROR",
|
|
3137
3137
|
metadata: {
|
|
@@ -3143,13 +3143,13 @@ var uploadUrl = async (config, url, network, options) => {
|
|
|
3143
3143
|
const resData = res.data;
|
|
3144
3144
|
return resData;
|
|
3145
3145
|
} catch (error) {
|
|
3146
|
-
if (error instanceof
|
|
3146
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
3147
3147
|
throw error;
|
|
3148
3148
|
}
|
|
3149
3149
|
if (error instanceof Error) {
|
|
3150
|
-
throw new
|
|
3150
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing base64: ${error.message}`);
|
|
3151
3151
|
}
|
|
3152
|
-
throw new
|
|
3152
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
3153
3153
|
"An unknown error occurred while trying to upload base64"
|
|
3154
3154
|
);
|
|
3155
3155
|
}
|
|
@@ -3163,7 +3163,7 @@ var uploadUrl = async (config, url, network, options) => {
|
|
|
3163
3163
|
if (!request.ok) {
|
|
3164
3164
|
const errorData = await request.text();
|
|
3165
3165
|
if (request.status === 401 || request.status === 403) {
|
|
3166
|
-
throw new
|
|
3166
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
3167
3167
|
`Authentication failed: ${errorData}`,
|
|
3168
3168
|
request.status,
|
|
3169
3169
|
{
|
|
@@ -3175,7 +3175,7 @@ var uploadUrl = async (config, url, network, options) => {
|
|
|
3175
3175
|
}
|
|
3176
3176
|
);
|
|
3177
3177
|
}
|
|
3178
|
-
throw new
|
|
3178
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
3179
3179
|
error: errorData,
|
|
3180
3180
|
code: "HTTP_ERROR",
|
|
3181
3181
|
metadata: {
|
|
@@ -3200,7 +3200,7 @@ var uploadUrl = async (config, url, network, options) => {
|
|
|
3200
3200
|
return resData;
|
|
3201
3201
|
} else {
|
|
3202
3202
|
const errorData = await vectorReq.text();
|
|
3203
|
-
throw new
|
|
3203
|
+
throw new chunkBK3CLF3Z_js.NetworkError(
|
|
3204
3204
|
`HTTP error during vectorization: ${errorData}`,
|
|
3205
3205
|
vectorReq.status,
|
|
3206
3206
|
{
|
|
@@ -3215,20 +3215,20 @@ var uploadUrl = async (config, url, network, options) => {
|
|
|
3215
3215
|
}
|
|
3216
3216
|
return resData;
|
|
3217
3217
|
} catch (error) {
|
|
3218
|
-
if (error instanceof
|
|
3218
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
3219
3219
|
throw error;
|
|
3220
3220
|
}
|
|
3221
3221
|
if (error instanceof Error) {
|
|
3222
|
-
throw new
|
|
3222
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing url: ${error.message}`);
|
|
3223
3223
|
}
|
|
3224
|
-
throw new
|
|
3224
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while uploading by url");
|
|
3225
3225
|
}
|
|
3226
3226
|
};
|
|
3227
3227
|
|
|
3228
3228
|
// src/core/functions/uploads/cid.ts
|
|
3229
3229
|
var uploadCid = async (config, cid, options) => {
|
|
3230
3230
|
if (!config) {
|
|
3231
|
-
throw new
|
|
3231
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
3232
3232
|
}
|
|
3233
3233
|
const jwt = options?.keys || config?.pinataJwt;
|
|
3234
3234
|
let headers;
|
|
@@ -3266,7 +3266,7 @@ var uploadCid = async (config, cid, options) => {
|
|
|
3266
3266
|
if (!request.ok) {
|
|
3267
3267
|
const errorData = await request.text();
|
|
3268
3268
|
if (request.status === 401 || request.status === 403) {
|
|
3269
|
-
throw new
|
|
3269
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
3270
3270
|
`Authentication failed: ${errorData}`,
|
|
3271
3271
|
request.status,
|
|
3272
3272
|
{
|
|
@@ -3278,7 +3278,7 @@ var uploadCid = async (config, cid, options) => {
|
|
|
3278
3278
|
}
|
|
3279
3279
|
);
|
|
3280
3280
|
}
|
|
3281
|
-
throw new
|
|
3281
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
3282
3282
|
error: errorData,
|
|
3283
3283
|
code: "HTTP_ERROR",
|
|
3284
3284
|
metadata: {
|
|
@@ -3290,20 +3290,20 @@ var uploadCid = async (config, cid, options) => {
|
|
|
3290
3290
|
const resData = res.data;
|
|
3291
3291
|
return resData;
|
|
3292
3292
|
} catch (error) {
|
|
3293
|
-
if (error instanceof
|
|
3293
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
3294
3294
|
throw error;
|
|
3295
3295
|
}
|
|
3296
3296
|
if (error instanceof Error) {
|
|
3297
|
-
throw new
|
|
3297
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing cid: ${error.message}`);
|
|
3298
3298
|
}
|
|
3299
|
-
throw new
|
|
3299
|
+
throw new chunkBK3CLF3Z_js.PinataError("An unknown error occurred while pinning by CID");
|
|
3300
3300
|
}
|
|
3301
3301
|
};
|
|
3302
3302
|
|
|
3303
3303
|
// src/core/classes/analytics/Analytics.ts
|
|
3304
3304
|
var Analytics = class {
|
|
3305
3305
|
constructor(config) {
|
|
3306
|
-
this.config =
|
|
3306
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
3307
3307
|
this.requests = new AnalyticsRequests(this.config);
|
|
3308
3308
|
this.bandwidth = new AnalyticsBandwidth(this.config);
|
|
3309
3309
|
}
|
|
@@ -3606,7 +3606,7 @@ var FilterGroups = class {
|
|
|
3606
3606
|
// src/core/classes/groups/PublicGroups.ts
|
|
3607
3607
|
var PublicGroups = class {
|
|
3608
3608
|
constructor(config) {
|
|
3609
|
-
this.config =
|
|
3609
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
3610
3610
|
}
|
|
3611
3611
|
updateConfig(newConfig) {
|
|
3612
3612
|
this.config = newConfig;
|
|
@@ -3637,7 +3637,7 @@ var PublicGroups = class {
|
|
|
3637
3637
|
// src/core/classes/groups/PrivateGroups.ts
|
|
3638
3638
|
var PrivateGroups = class {
|
|
3639
3639
|
constructor(config) {
|
|
3640
|
-
this.config =
|
|
3640
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
3641
3641
|
}
|
|
3642
3642
|
updateConfig(newConfig) {
|
|
3643
3643
|
this.config = newConfig;
|
|
@@ -3668,7 +3668,7 @@ var PrivateGroups = class {
|
|
|
3668
3668
|
// src/core/classes/groups/Groups.ts
|
|
3669
3669
|
var Groups = class {
|
|
3670
3670
|
constructor(config) {
|
|
3671
|
-
this.config =
|
|
3671
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
3672
3672
|
this.public = new PublicGroups(config);
|
|
3673
3673
|
this.private = new PrivateGroups(config);
|
|
3674
3674
|
}
|
|
@@ -3680,7 +3680,7 @@ var Groups = class {
|
|
|
3680
3680
|
// src/core/classes/keys/Keys.ts
|
|
3681
3681
|
var Keys = class {
|
|
3682
3682
|
constructor(config) {
|
|
3683
|
-
this.config =
|
|
3683
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
3684
3684
|
}
|
|
3685
3685
|
updateConfig(newConfig) {
|
|
3686
3686
|
this.config = newConfig;
|
|
@@ -3771,7 +3771,7 @@ var FilterKeys = class {
|
|
|
3771
3771
|
// src/core/classes/gateways/Gateways.ts
|
|
3772
3772
|
var Gateways = class {
|
|
3773
3773
|
constructor(config) {
|
|
3774
|
-
this.config =
|
|
3774
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
3775
3775
|
this.public = new PublicGateways(config);
|
|
3776
3776
|
this.private = new PrivateGateways(config);
|
|
3777
3777
|
}
|
|
@@ -3846,7 +3846,7 @@ var PublicGateways = class {
|
|
|
3846
3846
|
// src/core/functions/files/getFile.ts
|
|
3847
3847
|
var getFile = async (config, id, privacy) => {
|
|
3848
3848
|
if (!config) {
|
|
3849
|
-
throw new
|
|
3849
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
3850
3850
|
}
|
|
3851
3851
|
let headers;
|
|
3852
3852
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -3874,7 +3874,7 @@ var getFile = async (config, id, privacy) => {
|
|
|
3874
3874
|
if (!request.ok) {
|
|
3875
3875
|
const errorData = await request.text();
|
|
3876
3876
|
if (request.status === 401 || request.status === 403) {
|
|
3877
|
-
throw new
|
|
3877
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
3878
3878
|
`Authentication failed: ${errorData}`,
|
|
3879
3879
|
request.status,
|
|
3880
3880
|
{
|
|
@@ -3886,7 +3886,7 @@ var getFile = async (config, id, privacy) => {
|
|
|
3886
3886
|
}
|
|
3887
3887
|
);
|
|
3888
3888
|
}
|
|
3889
|
-
throw new
|
|
3889
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
3890
3890
|
error: errorData,
|
|
3891
3891
|
code: "HTTP_ERROR",
|
|
3892
3892
|
metadata: {
|
|
@@ -3898,13 +3898,13 @@ var getFile = async (config, id, privacy) => {
|
|
|
3898
3898
|
const resData = res.data;
|
|
3899
3899
|
return resData;
|
|
3900
3900
|
} catch (error) {
|
|
3901
|
-
if (error instanceof
|
|
3901
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
3902
3902
|
throw error;
|
|
3903
3903
|
}
|
|
3904
3904
|
if (error instanceof Error) {
|
|
3905
|
-
throw new
|
|
3905
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing getGroup: ${error.message}`);
|
|
3906
3906
|
}
|
|
3907
|
-
throw new
|
|
3907
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
3908
3908
|
"An unknown error occurred while getting info for a group"
|
|
3909
3909
|
);
|
|
3910
3910
|
}
|
|
@@ -4086,7 +4086,7 @@ var FilterQueue = class {
|
|
|
4086
4086
|
// src/core/classes/files/PublicFiles.ts
|
|
4087
4087
|
var PublicFiles = class {
|
|
4088
4088
|
constructor(config) {
|
|
4089
|
-
this.config =
|
|
4089
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4090
4090
|
}
|
|
4091
4091
|
list() {
|
|
4092
4092
|
return new FilterFiles(this.config, "public");
|
|
@@ -4120,7 +4120,7 @@ var PublicFiles = class {
|
|
|
4120
4120
|
// src/core/classes/files/PrivateFiles.ts
|
|
4121
4121
|
var PrivateFiles = class {
|
|
4122
4122
|
constructor(config) {
|
|
4123
|
-
this.config =
|
|
4123
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4124
4124
|
}
|
|
4125
4125
|
list() {
|
|
4126
4126
|
return new FilterFiles(this.config, "private");
|
|
@@ -4157,7 +4157,7 @@ var PrivateFiles = class {
|
|
|
4157
4157
|
// src/core/classes/files/Files.ts
|
|
4158
4158
|
var Files = class {
|
|
4159
4159
|
constructor(config) {
|
|
4160
|
-
this.config =
|
|
4160
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4161
4161
|
this.public = new PublicFiles(config);
|
|
4162
4162
|
this.private = new PrivateFiles(config);
|
|
4163
4163
|
}
|
|
@@ -4251,7 +4251,7 @@ var UploadBuilder = class {
|
|
|
4251
4251
|
// src/core/classes/uploads/PublicUpload.ts
|
|
4252
4252
|
var PublicUpload = class {
|
|
4253
4253
|
constructor(config) {
|
|
4254
|
-
this.config =
|
|
4254
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4255
4255
|
}
|
|
4256
4256
|
updateConfig(newConfig) {
|
|
4257
4257
|
this.config = newConfig;
|
|
@@ -4312,7 +4312,7 @@ var PublicUpload = class {
|
|
|
4312
4312
|
// src/core/classes/uploads/PrivateUpload.ts
|
|
4313
4313
|
var PrivateUpload = class {
|
|
4314
4314
|
constructor(config) {
|
|
4315
|
-
this.config =
|
|
4315
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4316
4316
|
}
|
|
4317
4317
|
updateConfig(newConfig) {
|
|
4318
4318
|
this.config = newConfig;
|
|
@@ -4370,7 +4370,7 @@ var PrivateUpload = class {
|
|
|
4370
4370
|
// src/core/classes/uploads/Upload.ts
|
|
4371
4371
|
var Upload = class {
|
|
4372
4372
|
constructor(config) {
|
|
4373
|
-
this.config =
|
|
4373
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4374
4374
|
this.public = new PublicUpload(config);
|
|
4375
4375
|
this.private = new PrivateUpload(config);
|
|
4376
4376
|
}
|
|
@@ -4382,7 +4382,7 @@ var Upload = class {
|
|
|
4382
4382
|
// src/core/functions/signatures/addSignature.ts
|
|
4383
4383
|
var addSignature = async (config, options, network) => {
|
|
4384
4384
|
if (!config) {
|
|
4385
|
-
throw new
|
|
4385
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
4386
4386
|
}
|
|
4387
4387
|
const data = JSON.stringify({
|
|
4388
4388
|
signature: options.signature,
|
|
@@ -4414,7 +4414,7 @@ var addSignature = async (config, options, network) => {
|
|
|
4414
4414
|
if (!request.ok) {
|
|
4415
4415
|
const errorData = await request.text();
|
|
4416
4416
|
if (request.status === 401 || request.status === 403) {
|
|
4417
|
-
throw new
|
|
4417
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
4418
4418
|
`Authentication failed: ${errorData}`,
|
|
4419
4419
|
request.status,
|
|
4420
4420
|
{
|
|
@@ -4427,7 +4427,7 @@ var addSignature = async (config, options, network) => {
|
|
|
4427
4427
|
);
|
|
4428
4428
|
}
|
|
4429
4429
|
if (request.status === 403) {
|
|
4430
|
-
throw new
|
|
4430
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
4431
4431
|
"Unauthorized signing, you must be the original owner of the file and it must not have a signature",
|
|
4432
4432
|
request.status,
|
|
4433
4433
|
{
|
|
@@ -4439,7 +4439,7 @@ var addSignature = async (config, options, network) => {
|
|
|
4439
4439
|
}
|
|
4440
4440
|
);
|
|
4441
4441
|
}
|
|
4442
|
-
throw new
|
|
4442
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
4443
4443
|
error: errorData,
|
|
4444
4444
|
code: "HTTP_ERROR",
|
|
4445
4445
|
metadata: {
|
|
@@ -4450,13 +4450,13 @@ var addSignature = async (config, options, network) => {
|
|
|
4450
4450
|
const res = await request.json();
|
|
4451
4451
|
return res.data;
|
|
4452
4452
|
} catch (error) {
|
|
4453
|
-
if (error instanceof
|
|
4453
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
4454
4454
|
throw error;
|
|
4455
4455
|
}
|
|
4456
4456
|
if (error instanceof Error) {
|
|
4457
|
-
throw new
|
|
4457
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing addSignature: ${error.message}`);
|
|
4458
4458
|
}
|
|
4459
|
-
throw new
|
|
4459
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
4460
4460
|
"An unknown error occurred while adding signature to CID"
|
|
4461
4461
|
);
|
|
4462
4462
|
}
|
|
@@ -4465,7 +4465,7 @@ var addSignature = async (config, options, network) => {
|
|
|
4465
4465
|
// src/core/functions/signatures/getSignature.ts
|
|
4466
4466
|
var getSignature = async (config, cid, network) => {
|
|
4467
4467
|
if (!config) {
|
|
4468
|
-
throw new
|
|
4468
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
4469
4469
|
}
|
|
4470
4470
|
let headers;
|
|
4471
4471
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -4492,7 +4492,7 @@ var getSignature = async (config, cid, network) => {
|
|
|
4492
4492
|
if (!request.ok) {
|
|
4493
4493
|
const errorData = await request.text();
|
|
4494
4494
|
if (request.status === 401 || request.status === 403) {
|
|
4495
|
-
throw new
|
|
4495
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
4496
4496
|
`Authentication failed: ${errorData}`,
|
|
4497
4497
|
request.status,
|
|
4498
4498
|
{
|
|
@@ -4504,7 +4504,7 @@ var getSignature = async (config, cid, network) => {
|
|
|
4504
4504
|
}
|
|
4505
4505
|
);
|
|
4506
4506
|
}
|
|
4507
|
-
throw new
|
|
4507
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
4508
4508
|
error: errorData,
|
|
4509
4509
|
code: "HTTP_ERROR",
|
|
4510
4510
|
metadata: {
|
|
@@ -4515,13 +4515,13 @@ var getSignature = async (config, cid, network) => {
|
|
|
4515
4515
|
const res = await request.json();
|
|
4516
4516
|
return res.data;
|
|
4517
4517
|
} catch (error) {
|
|
4518
|
-
if (error instanceof
|
|
4518
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
4519
4519
|
throw error;
|
|
4520
4520
|
}
|
|
4521
4521
|
if (error instanceof Error) {
|
|
4522
|
-
throw new
|
|
4522
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing getSignature: ${error.message}`);
|
|
4523
4523
|
}
|
|
4524
|
-
throw new
|
|
4524
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
4525
4525
|
"An unknown error occurred while fetching signature for CID"
|
|
4526
4526
|
);
|
|
4527
4527
|
}
|
|
@@ -4530,7 +4530,7 @@ var getSignature = async (config, cid, network) => {
|
|
|
4530
4530
|
// src/core/functions/signatures/removeSignature.ts
|
|
4531
4531
|
var removeSignature = async (config, cid, network) => {
|
|
4532
4532
|
if (!config) {
|
|
4533
|
-
throw new
|
|
4533
|
+
throw new chunkBK3CLF3Z_js.ValidationError("Pinata configuration is missing");
|
|
4534
4534
|
}
|
|
4535
4535
|
let headers;
|
|
4536
4536
|
if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
|
|
@@ -4557,7 +4557,7 @@ var removeSignature = async (config, cid, network) => {
|
|
|
4557
4557
|
if (!request.ok) {
|
|
4558
4558
|
const errorData = await request.text();
|
|
4559
4559
|
if (request.status === 401 || request.status === 403) {
|
|
4560
|
-
throw new
|
|
4560
|
+
throw new chunkBK3CLF3Z_js.AuthenticationError(
|
|
4561
4561
|
`Authentication failed: ${errorData}`,
|
|
4562
4562
|
request.status,
|
|
4563
4563
|
{
|
|
@@ -4569,7 +4569,7 @@ var removeSignature = async (config, cid, network) => {
|
|
|
4569
4569
|
}
|
|
4570
4570
|
);
|
|
4571
4571
|
}
|
|
4572
|
-
throw new
|
|
4572
|
+
throw new chunkBK3CLF3Z_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
|
|
4573
4573
|
error: errorData,
|
|
4574
4574
|
code: "HTTP_ERROR",
|
|
4575
4575
|
metadata: {
|
|
@@ -4579,13 +4579,13 @@ var removeSignature = async (config, cid, network) => {
|
|
|
4579
4579
|
}
|
|
4580
4580
|
return "OK";
|
|
4581
4581
|
} catch (error) {
|
|
4582
|
-
if (error instanceof
|
|
4582
|
+
if (error instanceof chunkBK3CLF3Z_js.PinataError) {
|
|
4583
4583
|
throw error;
|
|
4584
4584
|
}
|
|
4585
4585
|
if (error instanceof Error) {
|
|
4586
|
-
throw new
|
|
4586
|
+
throw new chunkBK3CLF3Z_js.PinataError(`Error processing addSignature: ${error.message}`);
|
|
4587
4587
|
}
|
|
4588
|
-
throw new
|
|
4588
|
+
throw new chunkBK3CLF3Z_js.PinataError(
|
|
4589
4589
|
"An unknown error occurred while adding signature to CID"
|
|
4590
4590
|
);
|
|
4591
4591
|
}
|
|
@@ -4594,7 +4594,7 @@ var removeSignature = async (config, cid, network) => {
|
|
|
4594
4594
|
// src/core/classes/signatures/PublicSignatures.ts
|
|
4595
4595
|
var PublicSignatures = class {
|
|
4596
4596
|
constructor(config) {
|
|
4597
|
-
this.config =
|
|
4597
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4598
4598
|
}
|
|
4599
4599
|
updateConfig(newConfig) {
|
|
4600
4600
|
this.config = newConfig;
|
|
@@ -4614,7 +4614,7 @@ var PublicSignatures = class {
|
|
|
4614
4614
|
var Signatures = class {
|
|
4615
4615
|
//private: PrivateSignatures
|
|
4616
4616
|
constructor(config) {
|
|
4617
|
-
this.config =
|
|
4617
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4618
4618
|
this.public = new PublicSignatures(config);
|
|
4619
4619
|
}
|
|
4620
4620
|
updateConfig(newConfig) {
|
|
@@ -4625,7 +4625,7 @@ var Signatures = class {
|
|
|
4625
4625
|
// src/core/pinataSDK.ts
|
|
4626
4626
|
var PinataSDK = class {
|
|
4627
4627
|
constructor(config) {
|
|
4628
|
-
this.config =
|
|
4628
|
+
this.config = chunkBK3CLF3Z_js.formatConfig(config);
|
|
4629
4629
|
this.files = new Files(this.config);
|
|
4630
4630
|
this.upload = new Upload(this.config);
|
|
4631
4631
|
this.gateways = new Gateways(this.config);
|
|
@@ -4667,43 +4667,35 @@ var PinataSDK = class {
|
|
|
4667
4667
|
|
|
4668
4668
|
Object.defineProperty(exports, "AuthenticationError", {
|
|
4669
4669
|
enumerable: true,
|
|
4670
|
-
get: function () { return
|
|
4670
|
+
get: function () { return chunkBK3CLF3Z_js.AuthenticationError; }
|
|
4671
4671
|
});
|
|
4672
4672
|
Object.defineProperty(exports, "NetworkError", {
|
|
4673
4673
|
enumerable: true,
|
|
4674
|
-
get: function () { return
|
|
4674
|
+
get: function () { return chunkBK3CLF3Z_js.NetworkError; }
|
|
4675
4675
|
});
|
|
4676
4676
|
Object.defineProperty(exports, "PinataError", {
|
|
4677
4677
|
enumerable: true,
|
|
4678
|
-
get: function () { return
|
|
4678
|
+
get: function () { return chunkBK3CLF3Z_js.PinataError; }
|
|
4679
4679
|
});
|
|
4680
4680
|
Object.defineProperty(exports, "ValidationError", {
|
|
4681
4681
|
enumerable: true,
|
|
4682
|
-
get: function () { return
|
|
4682
|
+
get: function () { return chunkBK3CLF3Z_js.ValidationError; }
|
|
4683
4683
|
});
|
|
4684
4684
|
Object.defineProperty(exports, "containsCID", {
|
|
4685
4685
|
enumerable: true,
|
|
4686
|
-
get: function () { return
|
|
4687
|
-
});
|
|
4688
|
-
Object.defineProperty(exports, "convert", {
|
|
4689
|
-
enumerable: true,
|
|
4690
|
-
get: function () { return chunkP556VRQU_js.convertToDesiredGateway; }
|
|
4686
|
+
get: function () { return chunkBK3CLF3Z_js.containsCID; }
|
|
4691
4687
|
});
|
|
4692
4688
|
Object.defineProperty(exports, "convertToDesiredGateway", {
|
|
4693
4689
|
enumerable: true,
|
|
4694
|
-
get: function () { return
|
|
4690
|
+
get: function () { return chunkBK3CLF3Z_js.convertToDesiredGateway; }
|
|
4695
4691
|
});
|
|
4696
4692
|
Object.defineProperty(exports, "formatConfig", {
|
|
4697
4693
|
enumerable: true,
|
|
4698
|
-
get: function () { return
|
|
4694
|
+
get: function () { return chunkBK3CLF3Z_js.formatConfig; }
|
|
4699
4695
|
});
|
|
4700
4696
|
Object.defineProperty(exports, "getFileIdFromUrl", {
|
|
4701
4697
|
enumerable: true,
|
|
4702
|
-
get: function () { return
|
|
4703
|
-
});
|
|
4704
|
-
Object.defineProperty(exports, "useUpload", {
|
|
4705
|
-
enumerable: true,
|
|
4706
|
-
get: function () { return chunkP556VRQU_js.useUpload; }
|
|
4698
|
+
get: function () { return chunkBK3CLF3Z_js.getFileIdFromUrl; }
|
|
4707
4699
|
});
|
|
4708
4700
|
exports.PinataSDK = PinataSDK;
|
|
4709
4701
|
exports.addToGroup = addToGroup;
|