pinata 2.3.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,105 +1,11 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
19
2
 
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- AuthenticationError: () => AuthenticationError,
24
- NetworkError: () => NetworkError,
25
- PinataError: () => PinataError,
26
- PinataSDK: () => PinataSDK,
27
- ValidationError: () => ValidationError,
28
- addToGroup: () => addToGroup,
29
- analyticsDateInterval: () => analyticsDateInterval,
30
- analyticsTopUsage: () => analyticsTopUsage,
31
- containsCID: () => containsCID,
32
- convertIPFSUrl: () => convertIPFSUrl,
33
- convertToDesiredGateway: () => convertToDesiredGateway,
34
- createAccessLink: () => createAccessLink,
35
- createGroup: () => createGroup,
36
- createKey: () => createKey,
37
- createSignedUploadURL: () => createSignedUploadURL,
38
- deleteFile: () => deleteFile,
39
- deleteFileVectors: () => deleteFileVectors,
40
- deleteGroup: () => deleteGroup,
41
- deletePinRequest: () => deletePinRequest,
42
- deleteSwap: () => deleteSwap,
43
- formatConfig: () => formatConfig,
44
- getCid: () => getCid,
45
- getFileIdFromUrl: () => getFileIdFromUrl,
46
- getGroup: () => getGroup,
47
- listFiles: () => listFiles,
48
- listGroups: () => listGroups,
49
- listKeys: () => listKeys,
50
- pinnedFileCount: () => pinnedFileCount,
51
- queue: () => queue,
52
- removeFromGroup: () => removeFromGroup,
53
- revokeKeys: () => revokeKeys,
54
- swapCid: () => swapCid,
55
- swapHistory: () => swapHistory,
56
- testAuthentication: () => testAuthentication,
57
- totalStorageUsage: () => totalStorageUsage,
58
- updateFile: () => updateFile,
59
- updateGroup: () => updateGroup,
60
- uploadBase64: () => uploadBase64,
61
- uploadCid: () => uploadCid,
62
- uploadFile: () => uploadFile,
63
- uploadFileArray: () => uploadFileArray,
64
- uploadJson: () => uploadJson,
65
- uploadUrl: () => uploadUrl,
66
- vectorizeFile: () => vectorizeFile,
67
- vectorizeQuery: () => vectorizeQuery
68
- });
69
- module.exports = __toCommonJS(index_exports);
70
-
71
- // src/utils/custom-errors.ts
72
- var PinataError = class extends Error {
73
- constructor(message, statusCode, details) {
74
- super(message);
75
- this.statusCode = statusCode;
76
- this.details = details;
77
- this.name = "PinataError";
78
- }
79
- };
80
- var NetworkError = class extends PinataError {
81
- constructor(message, statusCode, details) {
82
- super(message, statusCode, details);
83
- this.name = "NetworkError";
84
- }
85
- };
86
- var AuthenticationError = class extends PinataError {
87
- constructor(message, statusCode, details) {
88
- super(message, statusCode, details);
89
- this.name = "AuthenticationError";
90
- }
91
- };
92
- var ValidationError = class extends PinataError {
93
- constructor(message, details) {
94
- super(message, void 0, details);
95
- this.name = "ValidationError";
96
- }
97
- };
3
+ var chunkP556VRQU_js = require('./chunk-P556VRQU.js');
98
4
 
99
5
  // src/core/functions/analytics/analyticsDateInterval.ts
100
6
  var analyticsDateInterval = async (config, options) => {
101
7
  if (!config) {
102
- throw new ValidationError("Pinata configuration is missing");
8
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
103
9
  }
104
10
  const params = new URLSearchParams();
105
11
  if (options) {
@@ -154,7 +60,7 @@ var analyticsDateInterval = async (config, options) => {
154
60
  if (!request.ok) {
155
61
  const errorData = await request.text();
156
62
  if (request.status === 401 || request.status === 403) {
157
- throw new AuthenticationError(
63
+ throw new chunkP556VRQU_js.AuthenticationError(
158
64
  `Authentication failed: ${errorData}`,
159
65
  request.status,
160
66
  {
@@ -166,7 +72,7 @@ var analyticsDateInterval = async (config, options) => {
166
72
  }
167
73
  );
168
74
  }
169
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
75
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
170
76
  error: errorData,
171
77
  code: "HTTP_ERROR",
172
78
  metadata: {
@@ -178,15 +84,15 @@ var analyticsDateInterval = async (config, options) => {
178
84
  const resData = res.data;
179
85
  return resData;
180
86
  } catch (error) {
181
- if (error instanceof PinataError) {
87
+ if (error instanceof chunkP556VRQU_js.PinataError) {
182
88
  throw error;
183
89
  }
184
90
  if (error instanceof Error) {
185
- throw new PinataError(
91
+ throw new chunkP556VRQU_js.PinataError(
186
92
  `Error processing anaytics usage: ${error.message}`
187
93
  );
188
94
  }
189
- throw new PinataError(
95
+ throw new chunkP556VRQU_js.PinataError(
190
96
  "An unknown error occurred while fetching gateway usage"
191
97
  );
192
98
  }
@@ -195,7 +101,7 @@ var analyticsDateInterval = async (config, options) => {
195
101
  // src/core/functions/analytics/analyticsTopUsage.ts
196
102
  var analyticsTopUsage = async (config, options) => {
197
103
  if (!config) {
198
- throw new ValidationError("Pinata configuration is missing");
104
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
199
105
  }
200
106
  const params = new URLSearchParams();
201
107
  if (options) {
@@ -256,7 +162,7 @@ var analyticsTopUsage = async (config, options) => {
256
162
  if (!request.ok) {
257
163
  const errorData = await request.text();
258
164
  if (request.status === 401 || request.status === 403) {
259
- throw new AuthenticationError(
165
+ throw new chunkP556VRQU_js.AuthenticationError(
260
166
  `Authentication failed: ${errorData}`,
261
167
  request.status,
262
168
  {
@@ -268,7 +174,7 @@ var analyticsTopUsage = async (config, options) => {
268
174
  }
269
175
  );
270
176
  }
271
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
177
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
272
178
  error: errorData,
273
179
  code: "HTTP_ERROR",
274
180
  metadata: {
@@ -279,15 +185,15 @@ var analyticsTopUsage = async (config, options) => {
279
185
  const res = await request.json();
280
186
  return res;
281
187
  } catch (error) {
282
- if (error instanceof PinataError) {
188
+ if (error instanceof chunkP556VRQU_js.PinataError) {
283
189
  throw error;
284
190
  }
285
191
  if (error instanceof Error) {
286
- throw new PinataError(
192
+ throw new chunkP556VRQU_js.PinataError(
287
193
  `Error processing anaytics usage: ${error.message}`
288
194
  );
289
195
  }
290
- throw new PinataError(
196
+ throw new chunkP556VRQU_js.PinataError(
291
197
  "An unknown error occurred while fetching gateway usage"
292
198
  );
293
199
  }
@@ -296,7 +202,7 @@ var analyticsTopUsage = async (config, options) => {
296
202
  // src/core/functions/authentication/testAuthentication.ts
297
203
  var testAuthentication = async (config) => {
298
204
  if (!config) {
299
- throw new ValidationError("Pinata configuration is missing");
205
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
300
206
  }
301
207
  let headers;
302
208
  let endpoint = "https://api.pinata.cloud";
@@ -322,7 +228,7 @@ var testAuthentication = async (config) => {
322
228
  if (!request.ok) {
323
229
  const errorData = await request.text();
324
230
  if (request.status === 401 || request.status === 403) {
325
- throw new AuthenticationError(
231
+ throw new chunkP556VRQU_js.AuthenticationError(
326
232
  `Authentication failed: ${errorData}`,
327
233
  request.status,
328
234
  {
@@ -334,7 +240,7 @@ var testAuthentication = async (config) => {
334
240
  }
335
241
  );
336
242
  }
337
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
243
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
338
244
  error: errorData,
339
245
  code: "HTTP_ERROR",
340
246
  metadata: {
@@ -345,15 +251,15 @@ var testAuthentication = async (config) => {
345
251
  const res = await request.json();
346
252
  return res;
347
253
  } catch (error) {
348
- if (error instanceof PinataError) {
254
+ if (error instanceof chunkP556VRQU_js.PinataError) {
349
255
  throw error;
350
256
  }
351
257
  if (error instanceof Error) {
352
- throw new PinataError(
258
+ throw new chunkP556VRQU_js.PinataError(
353
259
  `Error processing authentication: ${error.message}`
354
260
  );
355
261
  }
356
- throw new PinataError(
262
+ throw new chunkP556VRQU_js.PinataError(
357
263
  "An unknown error occurred while testing authentication"
358
264
  );
359
265
  }
@@ -367,7 +273,7 @@ var wait = (milliseconds) => {
367
273
  };
368
274
  var deleteFile = async (config, files, privacy) => {
369
275
  if (!config) {
370
- throw new ValidationError("Pinata configuration is missing");
276
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
371
277
  }
372
278
  const responses = [];
373
279
  let headers;
@@ -396,7 +302,7 @@ var deleteFile = async (config, files, privacy) => {
396
302
  if (!response.ok) {
397
303
  const errorData = await response.text();
398
304
  if (response.status === 401) {
399
- throw new AuthenticationError(
305
+ throw new chunkP556VRQU_js.AuthenticationError(
400
306
  `Authentication failed: ${errorData}`,
401
307
  response.status,
402
308
  {
@@ -408,7 +314,7 @@ var deleteFile = async (config, files, privacy) => {
408
314
  }
409
315
  );
410
316
  }
411
- throw new NetworkError(`HTTP error`, response.status, {
317
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error`, response.status, {
412
318
  error: errorData,
413
319
  code: "HTTP_ERROR",
414
320
  metadata: {
@@ -422,7 +328,7 @@ var deleteFile = async (config, files, privacy) => {
422
328
  });
423
329
  } catch (error) {
424
330
  let errorMessage;
425
- if (error instanceof PinataError) {
331
+ if (error instanceof chunkP556VRQU_js.PinataError) {
426
332
  errorMessage = error.message;
427
333
  } else if (error instanceof Error) {
428
334
  errorMessage = `Error deleting file ${id}: ${error.message}`;
@@ -441,7 +347,7 @@ var deleteFile = async (config, files, privacy) => {
441
347
  // src/core/functions/files/deleteFileVectors.ts
442
348
  var deleteFileVectors = async (config, fileId) => {
443
349
  if (!config) {
444
- throw new ValidationError("Pinata configuration is missing");
350
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
445
351
  }
446
352
  let headers;
447
353
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -467,7 +373,7 @@ var deleteFileVectors = async (config, fileId) => {
467
373
  if (!request.ok) {
468
374
  const errorData = await request.text();
469
375
  if (request.status === 401 || request.status === 403) {
470
- throw new AuthenticationError(
376
+ throw new chunkP556VRQU_js.AuthenticationError(
471
377
  `Authentication failed: ${errorData}`,
472
378
  request.status,
473
379
  {
@@ -479,7 +385,7 @@ var deleteFileVectors = async (config, fileId) => {
479
385
  }
480
386
  );
481
387
  }
482
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
388
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
483
389
  error: errorData,
484
390
  code: "HTTP_ERROR",
485
391
  metadata: {
@@ -490,22 +396,22 @@ var deleteFileVectors = async (config, fileId) => {
490
396
  const res = await request.json();
491
397
  return res;
492
398
  } catch (error) {
493
- if (error instanceof PinataError) {
399
+ if (error instanceof chunkP556VRQU_js.PinataError) {
494
400
  throw error;
495
401
  }
496
402
  if (error instanceof Error) {
497
- throw new PinataError(
403
+ throw new chunkP556VRQU_js.PinataError(
498
404
  `Error processing vectorize file: ${error.message}`
499
405
  );
500
406
  }
501
- throw new PinataError("An unknown error occurred while vectorizing file");
407
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while vectorizing file");
502
408
  }
503
409
  };
504
410
 
505
411
  // src/core/functions/files/deleteSwap.ts
506
412
  var deleteSwap = async (config, cid, network) => {
507
413
  if (!config) {
508
- throw new ValidationError("Pinata configuration is missing");
414
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
509
415
  }
510
416
  let headers;
511
417
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -533,13 +439,13 @@ var deleteSwap = async (config, cid, network) => {
533
439
  if (!request.ok) {
534
440
  const errorData = await request.text();
535
441
  if (request.status === 401 || request.status === 403) {
536
- throw new AuthenticationError(`Authentication failed`, request.status, {
442
+ throw new chunkP556VRQU_js.AuthenticationError(`Authentication failed`, request.status, {
537
443
  error: errorData,
538
444
  code: "AUTH_ERROR"
539
445
  });
540
446
  }
541
447
  if (request.status === 403) {
542
- throw new PinataError(
448
+ throw new chunkP556VRQU_js.PinataError(
543
449
  "Unauthorized CID Swap Deletion",
544
450
  request.status,
545
451
  {
@@ -549,23 +455,23 @@ var deleteSwap = async (config, cid, network) => {
549
455
  );
550
456
  }
551
457
  if (request.status === 404) {
552
- throw new PinataError("CID not pinned to account", request.status, {
458
+ throw new chunkP556VRQU_js.PinataError("CID not pinned to account", request.status, {
553
459
  error: errorData,
554
460
  code: "NOT_FOUND"
555
461
  });
556
462
  }
557
- throw new NetworkError(`HTTP error occurred`, request.status, {
463
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error occurred`, request.status, {
558
464
  error: errorData,
559
465
  code: "NETWORK_ERROR"
560
466
  });
561
467
  }
562
468
  return request.statusText;
563
469
  } catch (error) {
564
- if (error instanceof PinataError) {
470
+ if (error instanceof chunkP556VRQU_js.PinataError) {
565
471
  throw error;
566
472
  }
567
473
  if (error instanceof Error) {
568
- throw new PinataError(
474
+ throw new chunkP556VRQU_js.PinataError(
569
475
  `Error processing deleteSwap: ${error.message}`,
570
476
  void 0,
571
477
  {
@@ -573,7 +479,7 @@ var deleteSwap = async (config, cid, network) => {
573
479
  }
574
480
  );
575
481
  }
576
- throw new PinataError(
482
+ throw new chunkP556VRQU_js.PinataError(
577
483
  "An unknown error occurred while deleting swap",
578
484
  void 0,
579
485
  {
@@ -586,7 +492,7 @@ var deleteSwap = async (config, cid, network) => {
586
492
  // src/core/functions/files/list.ts
587
493
  var listFiles = async (config, privacy, options) => {
588
494
  if (!config) {
589
- throw new ValidationError("Pinata configuration is missing");
495
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
590
496
  }
591
497
  const params = new URLSearchParams();
592
498
  if (options) {
@@ -642,7 +548,7 @@ var listFiles = async (config, privacy, options) => {
642
548
  if (!request.ok) {
643
549
  const errorData = await request.text();
644
550
  if (request.status === 401 || request.status === 403) {
645
- throw new AuthenticationError(
551
+ throw new chunkP556VRQU_js.AuthenticationError(
646
552
  `Authentication failed: ${errorData}`,
647
553
  request.status,
648
554
  {
@@ -654,7 +560,7 @@ var listFiles = async (config, privacy, options) => {
654
560
  }
655
561
  );
656
562
  }
657
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
563
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
658
564
  error: errorData,
659
565
  code: "HTTP_ERROR",
660
566
  metadata: {
@@ -666,20 +572,20 @@ var listFiles = async (config, privacy, options) => {
666
572
  const resData = res.data;
667
573
  return resData;
668
574
  } catch (error) {
669
- if (error instanceof PinataError) {
575
+ if (error instanceof chunkP556VRQU_js.PinataError) {
670
576
  throw error;
671
577
  }
672
578
  if (error instanceof Error) {
673
- throw new PinataError(`Error processing list files: ${error.message}`);
579
+ throw new chunkP556VRQU_js.PinataError(`Error processing list files: ${error.message}`);
674
580
  }
675
- throw new PinataError("An unknown error occurred while listing files");
581
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while listing files");
676
582
  }
677
583
  };
678
584
 
679
585
  // src/core/functions/files/pinnedFileUsage.ts
680
586
  var pinnedFileCount = async (config) => {
681
587
  if (!config) {
682
- throw new ValidationError("Pinata configuration is missing");
588
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
683
589
  }
684
590
  let endpoint = "https://api.pinata.cloud";
685
591
  if (config.endpointUrl) {
@@ -705,7 +611,7 @@ var pinnedFileCount = async (config) => {
705
611
  if (!request.ok) {
706
612
  const errorData = await request.text();
707
613
  if (request.status === 401 || request.status === 403) {
708
- throw new AuthenticationError(
614
+ throw new chunkP556VRQU_js.AuthenticationError(
709
615
  `Authentication failed: ${errorData}`,
710
616
  request.status,
711
617
  {
@@ -717,7 +623,7 @@ var pinnedFileCount = async (config) => {
717
623
  }
718
624
  );
719
625
  }
720
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
626
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
721
627
  error: errorData,
722
628
  code: "HTTP_ERROR",
723
629
  metadata: {
@@ -728,15 +634,15 @@ var pinnedFileCount = async (config) => {
728
634
  const res = await request.json();
729
635
  return res.pin_count;
730
636
  } catch (error) {
731
- if (error instanceof PinataError) {
637
+ if (error instanceof chunkP556VRQU_js.PinataError) {
732
638
  throw error;
733
639
  }
734
640
  if (error instanceof Error) {
735
- throw new PinataError(
641
+ throw new chunkP556VRQU_js.PinataError(
736
642
  `Error processing pinnedFileUsage: ${error.message}`
737
643
  );
738
644
  }
739
- throw new PinataError(
645
+ throw new chunkP556VRQU_js.PinataError(
740
646
  "An unknown error occurred while getting pinned file usage"
741
647
  );
742
648
  }
@@ -745,7 +651,7 @@ var pinnedFileCount = async (config) => {
745
651
  // src/core/functions/files/swapCid.ts
746
652
  var swapCid = async (config, options, network) => {
747
653
  if (!config) {
748
- throw new ValidationError("Pinata configuration is missing");
654
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
749
655
  }
750
656
  const data = JSON.stringify({
751
657
  swap_cid: options.swapCid
@@ -780,7 +686,7 @@ var swapCid = async (config, options, network) => {
780
686
  if (!request.ok) {
781
687
  const errorData = await request.text();
782
688
  if (request.status === 401 || request.status === 403) {
783
- throw new AuthenticationError(
689
+ throw new chunkP556VRQU_js.AuthenticationError(
784
690
  `Authentication failed: ${errorData}`,
785
691
  request.status,
786
692
  {
@@ -793,7 +699,7 @@ var swapCid = async (config, options, network) => {
793
699
  );
794
700
  }
795
701
  if (request.status === 403) {
796
- throw new PinataError("Unauthorized CID Swap", request.status, {
702
+ throw new chunkP556VRQU_js.PinataError("Unauthorized CID Swap", request.status, {
797
703
  error: errorData,
798
704
  code: "AUTH_ERROR",
799
705
  metadata: {
@@ -802,7 +708,7 @@ var swapCid = async (config, options, network) => {
802
708
  });
803
709
  }
804
710
  if (request.status === 404) {
805
- throw new PinataError("CID not pinned to account", request.status, {
711
+ throw new chunkP556VRQU_js.PinataError("CID not pinned to account", request.status, {
806
712
  error: errorData,
807
713
  code: "HTTP_ERROR",
808
714
  metadata: {
@@ -810,7 +716,7 @@ var swapCid = async (config, options, network) => {
810
716
  }
811
717
  });
812
718
  }
813
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
719
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
814
720
  error: errorData,
815
721
  code: "HTTP_ERROR",
816
722
  metadata: {
@@ -822,20 +728,20 @@ var swapCid = async (config, options, network) => {
822
728
  const resData = res.data;
823
729
  return resData;
824
730
  } catch (error) {
825
- if (error instanceof PinataError) {
731
+ if (error instanceof chunkP556VRQU_js.PinataError) {
826
732
  throw error;
827
733
  }
828
734
  if (error instanceof Error) {
829
- throw new PinataError(`Error processing CID Swap: ${error.message}`);
735
+ throw new chunkP556VRQU_js.PinataError(`Error processing CID Swap: ${error.message}`);
830
736
  }
831
- throw new PinataError("An unknown error occurred while swapping CID");
737
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while swapping CID");
832
738
  }
833
739
  };
834
740
 
835
741
  // src/core/functions/files/swapHistory.ts
836
742
  var swapHistory = async (config, options, network) => {
837
743
  if (!config) {
838
- throw new ValidationError("Pinata configuration is missing");
744
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
839
745
  }
840
746
  let headers;
841
747
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -866,7 +772,7 @@ var swapHistory = async (config, options, network) => {
866
772
  if (!request.ok) {
867
773
  const errorData = await request.text();
868
774
  if (request.status === 401 || request.status === 403) {
869
- throw new AuthenticationError(
775
+ throw new chunkP556VRQU_js.AuthenticationError(
870
776
  `Authentication failed: ${errorData}`,
871
777
  request.status,
872
778
  {
@@ -879,7 +785,7 @@ var swapHistory = async (config, options, network) => {
879
785
  );
880
786
  }
881
787
  if (request.status === 404) {
882
- throw new PinataError("CID does not have history", request.status, {
788
+ throw new chunkP556VRQU_js.PinataError("CID does not have history", request.status, {
883
789
  error: errorData,
884
790
  code: "HTTP_ERROR",
885
791
  metadata: {
@@ -887,7 +793,7 @@ var swapHistory = async (config, options, network) => {
887
793
  }
888
794
  });
889
795
  }
890
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
796
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
891
797
  error: errorData,
892
798
  code: "HTTP_ERROR",
893
799
  metadata: {
@@ -899,13 +805,13 @@ var swapHistory = async (config, options, network) => {
899
805
  const resData = res.data;
900
806
  return resData;
901
807
  } catch (error) {
902
- if (error instanceof PinataError) {
808
+ if (error instanceof chunkP556VRQU_js.PinataError) {
903
809
  throw error;
904
810
  }
905
811
  if (error instanceof Error) {
906
- throw new PinataError(`Error fetching swap history: ${error.message}`);
812
+ throw new chunkP556VRQU_js.PinataError(`Error fetching swap history: ${error.message}`);
907
813
  }
908
- throw new PinataError(
814
+ throw new chunkP556VRQU_js.PinataError(
909
815
  "An unknown error occurred while fetching swap history"
910
816
  );
911
817
  }
@@ -914,7 +820,7 @@ var swapHistory = async (config, options, network) => {
914
820
  // src/core/functions/files/totalStorageUsage.ts
915
821
  var totalStorageUsage = async (config) => {
916
822
  if (!config) {
917
- throw new ValidationError("Pinata configuration is missing");
823
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
918
824
  }
919
825
  let endpoint = "https://api.pinata.cloud";
920
826
  if (config.endpointUrl) {
@@ -937,7 +843,7 @@ var totalStorageUsage = async (config) => {
937
843
  if (!request.ok) {
938
844
  const errorData = await request.text();
939
845
  if (request.status === 401 || request.status === 403) {
940
- throw new AuthenticationError(
846
+ throw new chunkP556VRQU_js.AuthenticationError(
941
847
  `Authentication failed: ${errorData}`,
942
848
  request.status,
943
849
  {
@@ -949,7 +855,7 @@ var totalStorageUsage = async (config) => {
949
855
  }
950
856
  );
951
857
  }
952
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
858
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
953
859
  error: errorData,
954
860
  code: "HTTP_ERROR",
955
861
  metadata: {
@@ -960,15 +866,15 @@ var totalStorageUsage = async (config) => {
960
866
  const res = await request.json();
961
867
  return res.pin_size_total;
962
868
  } catch (error) {
963
- if (error instanceof PinataError) {
869
+ if (error instanceof chunkP556VRQU_js.PinataError) {
964
870
  throw error;
965
871
  }
966
872
  if (error instanceof Error) {
967
- throw new PinataError(
873
+ throw new chunkP556VRQU_js.PinataError(
968
874
  `Error processing totalStorageUsage: ${error.message}`
969
875
  );
970
876
  }
971
- throw new PinataError(
877
+ throw new chunkP556VRQU_js.PinataError(
972
878
  "An unknown error occurred while getting total storage usage"
973
879
  );
974
880
  }
@@ -977,10 +883,10 @@ var totalStorageUsage = async (config) => {
977
883
  // src/core/functions/files/updateFile.ts
978
884
  var updateFile = async (config, options, privacy) => {
979
885
  if (!config) {
980
- throw new ValidationError("Pinata configuration is missing");
886
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
981
887
  }
982
888
  if (!options.name && (!options.keyvalues || Object.keys(options.keyvalues).length === 0)) {
983
- throw new ValidationError(
889
+ throw new chunkP556VRQU_js.ValidationError(
984
890
  "At least one of 'name' or 'keyvalues' must be provided"
985
891
  );
986
892
  }
@@ -1019,7 +925,7 @@ var updateFile = async (config, options, privacy) => {
1019
925
  if (!request.ok) {
1020
926
  const errorData = await request.text();
1021
927
  if (request.status === 401 || request.status === 403) {
1022
- throw new AuthenticationError(
928
+ throw new chunkP556VRQU_js.AuthenticationError(
1023
929
  `Authentication failed: ${errorData}`,
1024
930
  request.status,
1025
931
  {
@@ -1031,7 +937,7 @@ var updateFile = async (config, options, privacy) => {
1031
937
  }
1032
938
  );
1033
939
  }
1034
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
940
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1035
941
  error: errorData,
1036
942
  code: "HTTP_ERROR",
1037
943
  metadata: {
@@ -1043,20 +949,20 @@ var updateFile = async (config, options, privacy) => {
1043
949
  const resData = res.data;
1044
950
  return resData;
1045
951
  } catch (error) {
1046
- if (error instanceof PinataError) {
952
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1047
953
  throw error;
1048
954
  }
1049
955
  if (error instanceof Error) {
1050
- throw new PinataError(`Error processing updateFile: ${error.message}`);
956
+ throw new chunkP556VRQU_js.PinataError(`Error processing updateFile: ${error.message}`);
1051
957
  }
1052
- throw new PinataError("An unknown error occurred while updating file");
958
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while updating file");
1053
959
  }
1054
960
  };
1055
961
 
1056
962
  // src/core/functions/files/vectorizeFile.ts
1057
963
  var vectorizeFile = async (config, fileId) => {
1058
964
  if (!config) {
1059
- throw new ValidationError("Pinata configuration is missing");
965
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1060
966
  }
1061
967
  let headers;
1062
968
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -1082,7 +988,7 @@ var vectorizeFile = async (config, fileId) => {
1082
988
  if (!request.ok) {
1083
989
  const errorData = await request.text();
1084
990
  if (request.status === 401 || request.status === 403) {
1085
- throw new AuthenticationError(
991
+ throw new chunkP556VRQU_js.AuthenticationError(
1086
992
  `Authentication failed: ${errorData}`,
1087
993
  request.status,
1088
994
  {
@@ -1094,7 +1000,7 @@ var vectorizeFile = async (config, fileId) => {
1094
1000
  }
1095
1001
  );
1096
1002
  }
1097
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1003
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1098
1004
  error: errorData,
1099
1005
  code: "HTTP_ERROR",
1100
1006
  metadata: {
@@ -1105,22 +1011,22 @@ var vectorizeFile = async (config, fileId) => {
1105
1011
  const res = await request.json();
1106
1012
  return res;
1107
1013
  } catch (error) {
1108
- if (error instanceof PinataError) {
1014
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1109
1015
  throw error;
1110
1016
  }
1111
1017
  if (error instanceof Error) {
1112
- throw new PinataError(
1018
+ throw new chunkP556VRQU_js.PinataError(
1113
1019
  `Error processing vectorize file: ${error.message}`
1114
1020
  );
1115
1021
  }
1116
- throw new PinataError("An unknown error occurred while vectorizing file");
1022
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while vectorizing file");
1117
1023
  }
1118
1024
  };
1119
1025
 
1120
1026
  // src/core/functions/files/vectorizeQuery.ts
1121
1027
  var vectorizeQuery = async (config, options) => {
1122
1028
  if (!config) {
1123
- throw new ValidationError("Pinata configuration is missing");
1029
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1124
1030
  }
1125
1031
  let headers;
1126
1032
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -1153,7 +1059,7 @@ var vectorizeQuery = async (config, options) => {
1153
1059
  if (!request.ok) {
1154
1060
  const errorData = await request.text();
1155
1061
  if (request.status === 401 || request.status === 403) {
1156
- throw new AuthenticationError(
1062
+ throw new chunkP556VRQU_js.AuthenticationError(
1157
1063
  `Authentication failed: ${errorData}`,
1158
1064
  request.status,
1159
1065
  {
@@ -1165,7 +1071,7 @@ var vectorizeQuery = async (config, options) => {
1165
1071
  }
1166
1072
  );
1167
1073
  }
1168
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1074
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1169
1075
  error: errorData,
1170
1076
  code: "HTTP_ERROR",
1171
1077
  metadata: {
@@ -1177,7 +1083,7 @@ var vectorizeQuery = async (config, options) => {
1177
1083
  const resData = res.data;
1178
1084
  if (options.returnFile) {
1179
1085
  if (resData.matches.length === 0) {
1180
- throw new PinataError(`No files returned in query to fetch`);
1086
+ throw new chunkP556VRQU_js.PinataError(`No files returned in query to fetch`);
1181
1087
  }
1182
1088
  const cid = resData.matches[0].cid;
1183
1089
  const fileRes = await getCid(config, cid, "files");
@@ -1185,22 +1091,22 @@ var vectorizeQuery = async (config, options) => {
1185
1091
  }
1186
1092
  return resData;
1187
1093
  } catch (error) {
1188
- if (error instanceof PinataError) {
1094
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1189
1095
  throw error;
1190
1096
  }
1191
1097
  if (error instanceof Error) {
1192
- throw new PinataError(
1098
+ throw new chunkP556VRQU_js.PinataError(
1193
1099
  `Error processing vectorize file: ${error.message}`
1194
1100
  );
1195
1101
  }
1196
- throw new PinataError("An unknown error occurred while vectorizing file");
1102
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while vectorizing file");
1197
1103
  }
1198
1104
  };
1199
1105
 
1200
1106
  // src/core/functions/files/queue.ts
1201
1107
  var queue = async (config, options) => {
1202
1108
  if (!config) {
1203
- throw new ValidationError("Pinata configuration is missing");
1109
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1204
1110
  }
1205
1111
  const params = new URLSearchParams({
1206
1112
  includesCount: "false"
@@ -1238,7 +1144,7 @@ var queue = async (config, options) => {
1238
1144
  if (!request.ok) {
1239
1145
  const errorData = await request.text();
1240
1146
  if (request.status === 401 || request.status === 403) {
1241
- throw new AuthenticationError(
1147
+ throw new chunkP556VRQU_js.AuthenticationError(
1242
1148
  `Authentication failed: ${errorData}`,
1243
1149
  request.status,
1244
1150
  {
@@ -1250,7 +1156,7 @@ var queue = async (config, options) => {
1250
1156
  }
1251
1157
  );
1252
1158
  }
1253
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1159
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1254
1160
  error: errorData,
1255
1161
  code: "HTTP_ERROR",
1256
1162
  metadata: {
@@ -1262,20 +1168,20 @@ var queue = async (config, options) => {
1262
1168
  const resData = res.data;
1263
1169
  return resData;
1264
1170
  } catch (error) {
1265
- if (error instanceof PinataError) {
1171
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1266
1172
  throw error;
1267
1173
  }
1268
1174
  if (error instanceof Error) {
1269
- throw new PinataError(`Error processing pinJobs: ${error.message}`);
1175
+ throw new chunkP556VRQU_js.PinataError(`Error processing pinJobs: ${error.message}`);
1270
1176
  }
1271
- throw new PinataError("An unknown error occurred while listing pin jobs");
1177
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while listing pin jobs");
1272
1178
  }
1273
1179
  };
1274
1180
 
1275
1181
  // src/core/functions/files/deletePinRequest.ts
1276
1182
  var deletePinRequest = async (config, id) => {
1277
1183
  if (!config) {
1278
- throw new ValidationError("Pinata configuration is missing");
1184
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1279
1185
  }
1280
1186
  let headers;
1281
1187
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -1301,7 +1207,7 @@ var deletePinRequest = async (config, id) => {
1301
1207
  if (!response.ok) {
1302
1208
  const errorData = await response.text();
1303
1209
  if (response.status === 401) {
1304
- throw new AuthenticationError(
1210
+ throw new chunkP556VRQU_js.AuthenticationError(
1305
1211
  `Authentication failed: ${errorData}`,
1306
1212
  response.status,
1307
1213
  {
@@ -1313,7 +1219,7 @@ var deletePinRequest = async (config, id) => {
1313
1219
  }
1314
1220
  );
1315
1221
  }
1316
- throw new NetworkError(`HTTP error`, response.status, {
1222
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error`, response.status, {
1317
1223
  error: errorData,
1318
1224
  code: "HTTP_ERROR",
1319
1225
  metadata: {
@@ -1323,13 +1229,13 @@ var deletePinRequest = async (config, id) => {
1323
1229
  }
1324
1230
  return "OK";
1325
1231
  } catch (error) {
1326
- if (error instanceof PinataError) {
1232
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1327
1233
  throw error;
1328
1234
  }
1329
1235
  if (error instanceof Error) {
1330
- throw new PinataError(`Error deleting pin by request: ${error.message}`);
1236
+ throw new chunkP556VRQU_js.PinataError(`Error deleting pin by request: ${error.message}`);
1331
1237
  }
1332
- throw new PinataError(
1238
+ throw new chunkP556VRQU_js.PinataError(
1333
1239
  "An unknown error occurred while deleting pin by CID request"
1334
1240
  );
1335
1241
  }
@@ -1338,7 +1244,7 @@ var deletePinRequest = async (config, id) => {
1338
1244
  // src/core/functions/gateway/getCid.ts
1339
1245
  var getCid = async (config, cid, gatewayType, options) => {
1340
1246
  if (!config) {
1341
- throw new ValidationError("Pinata configuration is missing");
1247
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1342
1248
  }
1343
1249
  let data;
1344
1250
  let newUrl = `${config?.pinataGateway}/${gatewayType}/${cid}`;
@@ -1371,7 +1277,7 @@ var getCid = async (config, cid, gatewayType, options) => {
1371
1277
  if (!request.ok) {
1372
1278
  const errorData = await request.text();
1373
1279
  if (request.status === 401 || request.status === 403) {
1374
- throw new AuthenticationError(
1280
+ throw new chunkP556VRQU_js.AuthenticationError(
1375
1281
  `Authentication Failed: ${errorData}`,
1376
1282
  request.status,
1377
1283
  {
@@ -1383,7 +1289,7 @@ var getCid = async (config, cid, gatewayType, options) => {
1383
1289
  }
1384
1290
  );
1385
1291
  }
1386
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1292
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1387
1293
  error: errorData,
1388
1294
  code: "HTTP_ERROR",
1389
1295
  metadata: {
@@ -1441,7 +1347,7 @@ var getCid = async (config, cid, gatewayType, options) => {
1441
1347
  if (!request.ok) {
1442
1348
  const errorData = await request.text();
1443
1349
  if (request.status === 401 || request.status === 403) {
1444
- throw new AuthenticationError(
1350
+ throw new chunkP556VRQU_js.AuthenticationError(
1445
1351
  `Authentication Failed: ${errorData}`,
1446
1352
  request.status,
1447
1353
  {
@@ -1453,7 +1359,7 @@ var getCid = async (config, cid, gatewayType, options) => {
1453
1359
  }
1454
1360
  );
1455
1361
  }
1456
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1362
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1457
1363
  error: errorData,
1458
1364
  code: "HTTP_ERROR",
1459
1365
  metadata: {
@@ -1475,119 +1381,23 @@ var getCid = async (config, cid, gatewayType, options) => {
1475
1381
  };
1476
1382
  return res;
1477
1383
  } catch (error) {
1478
- if (error instanceof PinataError) {
1384
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1479
1385
  throw error;
1480
1386
  }
1481
1387
  if (error instanceof Error) {
1482
- throw new PinataError(`Error processing getCid: ${error.message}`);
1388
+ throw new chunkP556VRQU_js.PinataError(`Error processing getCid: ${error.message}`);
1483
1389
  }
1484
- throw new PinataError(
1390
+ throw new chunkP556VRQU_js.PinataError(
1485
1391
  "An unknown error occurred while getting CID contents"
1486
1392
  );
1487
1393
  }
1488
1394
  };
1489
1395
 
1490
- // src/utils/gateway-tools.ts
1491
- function isValidCIDv0(cid) {
1492
- return /^Qm[1-9A-HJ-NP-Za-km-z]{44}$/.test(cid);
1493
- }
1494
- function isValidCIDv1(cid) {
1495
- return /^b[a-z2-7]{58,}$/.test(cid);
1496
- }
1497
- function isCID(str) {
1498
- str = str.trim();
1499
- return isValidCIDv0(str) || isValidCIDv1(str);
1500
- }
1501
- async function containsCID(input) {
1502
- if (typeof input !== "string") {
1503
- throw new Error("Input is not a string");
1504
- }
1505
- const startsWithCID = (str) => {
1506
- const parts = str.split("/");
1507
- return isCID(parts[0]) ? parts[0] : null;
1508
- };
1509
- const directCID = startsWithCID(input);
1510
- if (directCID) {
1511
- return {
1512
- containsCid: true,
1513
- cid: directCID
1514
- };
1515
- }
1516
- let url;
1517
- try {
1518
- url = new URL(input);
1519
- } catch (error) {
1520
- const parts = input.split(/\/|\?/);
1521
- for (const part of parts) {
1522
- const cid = startsWithCID(part);
1523
- if (cid) {
1524
- return {
1525
- containsCid: true,
1526
- cid
1527
- };
1528
- }
1529
- }
1530
- return {
1531
- containsCid: false,
1532
- cid: null
1533
- };
1534
- }
1535
- const subdomains = url.hostname.split(".");
1536
- for (const subdomain of subdomains) {
1537
- if (isCID(subdomain)) {
1538
- return {
1539
- containsCid: true,
1540
- cid: subdomain
1541
- };
1542
- }
1543
- }
1544
- const pathParts = url.pathname.split("/");
1545
- for (const part of pathParts) {
1546
- const cid = startsWithCID(part);
1547
- if (cid) {
1548
- return {
1549
- containsCid: true,
1550
- cid
1551
- };
1552
- }
1553
- }
1554
- return {
1555
- containsCid: false,
1556
- cid: null
1557
- };
1558
- }
1559
- async function convertToDesiredGateway(sourceUrl, desiredGatewayPrefix) {
1560
- const results = await containsCID(sourceUrl);
1561
- if (results.containsCid !== true) {
1562
- throw new Error("url does not contain CID");
1563
- }
1564
- if (!sourceUrl.startsWith("https") && !sourceUrl.startsWith("ipfs://")) {
1565
- return `${desiredGatewayPrefix}/ipfs/${sourceUrl}`;
1566
- }
1567
- const urlObj = new URL(sourceUrl);
1568
- const path = urlObj.pathname + urlObj.search + urlObj.hash;
1569
- if (sourceUrl.startsWith(`ipfs://${results.cid}`)) {
1570
- return `${desiredGatewayPrefix}/ipfs/${results.cid}${path}`;
1571
- }
1572
- if (sourceUrl.includes(`/ipfs/${results.cid}`)) {
1573
- return `${desiredGatewayPrefix}${path}`;
1574
- }
1575
- if (sourceUrl.includes(`/ipns/${results.cid}`)) {
1576
- return `${desiredGatewayPrefix}${path}`;
1577
- }
1578
- if (urlObj.hostname.includes(results.cid)) {
1579
- return `${desiredGatewayPrefix}/ipfs/${results.cid}${path}`;
1580
- }
1581
- throw new Error(
1582
- "unsupported URL pattern, please submit a github issue with the URL utilized"
1583
- );
1584
- }
1585
-
1586
1396
  // src/core/functions/gateway/convertIPFSUrl.ts
1587
1397
  var convertIPFSUrl = async (config, url, gatewayPrefix) => {
1588
1398
  let newUrl;
1589
1399
  let prefix = gatewayPrefix || config?.pinataGateway || "https://gateway.pinata.cloud";
1590
- newUrl = await convertToDesiredGateway(url, prefix);
1400
+ newUrl = await chunkP556VRQU_js.convertToDesiredGateway(url, prefix);
1591
1401
  if (config?.pinataGatewayKey) {
1592
1402
  `${newUrl}?pinataGatewayToken=${config?.pinataGatewayKey}`;
1593
1403
  }
@@ -1597,7 +1407,7 @@ var convertIPFSUrl = async (config, url, gatewayPrefix) => {
1597
1407
  // src/core/functions/gateway/createAccessLink.ts
1598
1408
  var createAccessLink = async (config, options, imgOpts) => {
1599
1409
  if (!config) {
1600
- throw new ValidationError("Pinata configuration is missing");
1410
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1601
1411
  }
1602
1412
  let baseUrl;
1603
1413
  if (options?.gateway) {
@@ -1661,7 +1471,7 @@ var createAccessLink = async (config, options, imgOpts) => {
1661
1471
  if (!request.ok) {
1662
1472
  const errorData = await request.text();
1663
1473
  if (request.status === 401 || request.status === 403) {
1664
- throw new AuthenticationError(
1474
+ throw new chunkP556VRQU_js.AuthenticationError(
1665
1475
  `Authentication Failed: ${errorData}`,
1666
1476
  request.status,
1667
1477
  {
@@ -1673,7 +1483,7 @@ var createAccessLink = async (config, options, imgOpts) => {
1673
1483
  }
1674
1484
  );
1675
1485
  }
1676
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1486
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1677
1487
  error: errorData,
1678
1488
  code: "HTTP_ERROR",
1679
1489
  metadata: {
@@ -1684,22 +1494,22 @@ var createAccessLink = async (config, options, imgOpts) => {
1684
1494
  const res = await request.json();
1685
1495
  return res.data;
1686
1496
  } catch (error) {
1687
- if (error instanceof PinataError) {
1497
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1688
1498
  throw error;
1689
1499
  }
1690
1500
  if (error instanceof Error) {
1691
- throw new PinataError(
1501
+ throw new chunkP556VRQU_js.PinataError(
1692
1502
  `Error processing createSignedURL: ${error.message}`
1693
1503
  );
1694
1504
  }
1695
- throw new PinataError("An unknown error occurred while getting signed url");
1505
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while getting signed url");
1696
1506
  }
1697
1507
  };
1698
1508
 
1699
1509
  // src/core/functions/groups/addToGroup.ts
1700
1510
  var addToGroup = async (config, options, privacy) => {
1701
1511
  if (!config) {
1702
- throw new ValidationError("Pinata configuration is missing");
1512
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1703
1513
  }
1704
1514
  const wait3 = (milliseconds) => {
1705
1515
  return new Promise((resolve) => {
@@ -1738,7 +1548,7 @@ var addToGroup = async (config, options, privacy) => {
1738
1548
  if (!response.ok) {
1739
1549
  const errorData = await response.text();
1740
1550
  if (response.status === 401) {
1741
- throw new AuthenticationError(
1551
+ throw new chunkP556VRQU_js.AuthenticationError(
1742
1552
  `Authentication failed: ${errorData}`,
1743
1553
  response.status,
1744
1554
  {
@@ -1750,7 +1560,7 @@ var addToGroup = async (config, options, privacy) => {
1750
1560
  }
1751
1561
  );
1752
1562
  }
1753
- throw new NetworkError(`HTTP error: ${errorData}`, response.status, {
1563
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, response.status, {
1754
1564
  error: errorData,
1755
1565
  code: "HTTP_ERROR",
1756
1566
  metadata: {
@@ -1764,7 +1574,7 @@ var addToGroup = async (config, options, privacy) => {
1764
1574
  });
1765
1575
  } catch (error) {
1766
1576
  let errorMessage;
1767
- if (error instanceof PinataError) {
1577
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1768
1578
  errorMessage = error.message;
1769
1579
  } else if (error instanceof Error) {
1770
1580
  errorMessage = `Error adding file ${id} to group: ${error.message}`;
@@ -1783,7 +1593,7 @@ var addToGroup = async (config, options, privacy) => {
1783
1593
  // src/core/functions/groups/createGroup.ts
1784
1594
  var createGroup = async (config, options, privacy) => {
1785
1595
  if (!config) {
1786
- throw new ValidationError("Pinata configuration is missing");
1596
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1787
1597
  }
1788
1598
  const data = JSON.stringify({
1789
1599
  name: options.name,
@@ -1816,7 +1626,7 @@ var createGroup = async (config, options, privacy) => {
1816
1626
  if (!request.ok) {
1817
1627
  const errorData = await request.text();
1818
1628
  if (request.status === 401 || request.status === 403) {
1819
- throw new AuthenticationError(
1629
+ throw new chunkP556VRQU_js.AuthenticationError(
1820
1630
  `Authentication failed: ${errorData}`,
1821
1631
  request.status,
1822
1632
  {
@@ -1828,7 +1638,7 @@ var createGroup = async (config, options, privacy) => {
1828
1638
  }
1829
1639
  );
1830
1640
  }
1831
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1641
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1832
1642
  error: errorData,
1833
1643
  code: "HTTP_ERROR",
1834
1644
  metadata: {
@@ -1840,20 +1650,20 @@ var createGroup = async (config, options, privacy) => {
1840
1650
  const resData = res.data;
1841
1651
  return resData;
1842
1652
  } catch (error) {
1843
- if (error instanceof PinataError) {
1653
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1844
1654
  throw error;
1845
1655
  }
1846
1656
  if (error instanceof Error) {
1847
- throw new PinataError(`Error processing createGroup: ${error.message}`);
1657
+ throw new chunkP556VRQU_js.PinataError(`Error processing createGroup: ${error.message}`);
1848
1658
  }
1849
- throw new PinataError("An unknown error occurred while creating a group");
1659
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while creating a group");
1850
1660
  }
1851
1661
  };
1852
1662
 
1853
1663
  // src/core/functions/groups/deleteGroup.ts
1854
1664
  var deleteGroup = async (config, options, privacy) => {
1855
1665
  if (!config) {
1856
- throw new ValidationError("Pinata configuration is missing");
1666
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1857
1667
  }
1858
1668
  let headers;
1859
1669
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -1884,7 +1694,7 @@ var deleteGroup = async (config, options, privacy) => {
1884
1694
  if (!request.ok) {
1885
1695
  const errorData = await request.text();
1886
1696
  if (request.status === 401 || request.status === 403) {
1887
- throw new AuthenticationError(
1697
+ throw new chunkP556VRQU_js.AuthenticationError(
1888
1698
  `Authentication failed: ${errorData}`,
1889
1699
  request.status,
1890
1700
  {
@@ -1896,7 +1706,7 @@ var deleteGroup = async (config, options, privacy) => {
1896
1706
  }
1897
1707
  );
1898
1708
  }
1899
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1709
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1900
1710
  error: errorData,
1901
1711
  code: "HTTP_ERROR",
1902
1712
  metadata: {
@@ -1907,20 +1717,20 @@ var deleteGroup = async (config, options, privacy) => {
1907
1717
  const res = request.statusText;
1908
1718
  return res;
1909
1719
  } catch (error) {
1910
- if (error instanceof PinataError) {
1720
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1911
1721
  throw error;
1912
1722
  }
1913
1723
  if (error instanceof Error) {
1914
- throw new PinataError(`Error processing deleteGroup: ${error.message}`);
1724
+ throw new chunkP556VRQU_js.PinataError(`Error processing deleteGroup: ${error.message}`);
1915
1725
  }
1916
- throw new PinataError("An unknown error occurred while deleting a group");
1726
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while deleting a group");
1917
1727
  }
1918
1728
  };
1919
1729
 
1920
1730
  // src/core/functions/groups/getGroup.ts
1921
1731
  var getGroup = async (config, options, privacy) => {
1922
1732
  if (!config) {
1923
- throw new ValidationError("Pinata configuration is missing");
1733
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1924
1734
  }
1925
1735
  let headers;
1926
1736
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -1951,7 +1761,7 @@ var getGroup = async (config, options, privacy) => {
1951
1761
  if (!request.ok) {
1952
1762
  const errorData = await request.text();
1953
1763
  if (request.status === 401 || request.status === 403) {
1954
- throw new AuthenticationError(
1764
+ throw new chunkP556VRQU_js.AuthenticationError(
1955
1765
  `Authentication failed: ${errorData}`,
1956
1766
  request.status,
1957
1767
  {
@@ -1963,7 +1773,7 @@ var getGroup = async (config, options, privacy) => {
1963
1773
  }
1964
1774
  );
1965
1775
  }
1966
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1776
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
1967
1777
  error: errorData,
1968
1778
  code: "HTTP_ERROR",
1969
1779
  metadata: {
@@ -1975,13 +1785,13 @@ var getGroup = async (config, options, privacy) => {
1975
1785
  const resData = res.data;
1976
1786
  return resData;
1977
1787
  } catch (error) {
1978
- if (error instanceof PinataError) {
1788
+ if (error instanceof chunkP556VRQU_js.PinataError) {
1979
1789
  throw error;
1980
1790
  }
1981
1791
  if (error instanceof Error) {
1982
- throw new PinataError(`Error processing getGroup: ${error.message}`);
1792
+ throw new chunkP556VRQU_js.PinataError(`Error processing getGroup: ${error.message}`);
1983
1793
  }
1984
- throw new PinataError(
1794
+ throw new chunkP556VRQU_js.PinataError(
1985
1795
  "An unknown error occurred while getting info for a group"
1986
1796
  );
1987
1797
  }
@@ -1990,7 +1800,7 @@ var getGroup = async (config, options, privacy) => {
1990
1800
  // src/core/functions/groups/listGroups.ts
1991
1801
  var listGroups = async (config, privacy, options) => {
1992
1802
  if (!config) {
1993
- throw new ValidationError("Pinata configuration is missing");
1803
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
1994
1804
  }
1995
1805
  let headers;
1996
1806
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -2029,7 +1839,7 @@ var listGroups = async (config, privacy, options) => {
2029
1839
  if (!request.ok) {
2030
1840
  const errorData = await request.text();
2031
1841
  if (request.status === 401 || request.status === 403) {
2032
- throw new AuthenticationError(
1842
+ throw new chunkP556VRQU_js.AuthenticationError(
2033
1843
  `Authentication failed: ${errorData}`,
2034
1844
  request.status,
2035
1845
  {
@@ -2041,7 +1851,7 @@ var listGroups = async (config, privacy, options) => {
2041
1851
  }
2042
1852
  );
2043
1853
  }
2044
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
1854
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2045
1855
  error: errorData,
2046
1856
  code: "HTTP_ERROR",
2047
1857
  metadata: {
@@ -2053,20 +1863,20 @@ var listGroups = async (config, privacy, options) => {
2053
1863
  const resData = res.data;
2054
1864
  return resData;
2055
1865
  } catch (error) {
2056
- if (error instanceof PinataError) {
1866
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2057
1867
  throw error;
2058
1868
  }
2059
1869
  if (error instanceof Error) {
2060
- throw new PinataError(`Error processing listGroups: ${error.message}`);
1870
+ throw new chunkP556VRQU_js.PinataError(`Error processing listGroups: ${error.message}`);
2061
1871
  }
2062
- throw new PinataError("An unknown error occurred while listing groups");
1872
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while listing groups");
2063
1873
  }
2064
1874
  };
2065
1875
 
2066
1876
  // src/core/functions/groups/removeFromGroup.ts
2067
1877
  var removeFromGroup = async (config, options, privacy) => {
2068
1878
  if (!config) {
2069
- throw new ValidationError("Pinata configuration is missing");
1879
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2070
1880
  }
2071
1881
  const wait3 = (milliseconds) => {
2072
1882
  return new Promise((resolve) => {
@@ -2105,7 +1915,7 @@ var removeFromGroup = async (config, options, privacy) => {
2105
1915
  if (!response.ok) {
2106
1916
  const errorData = await response.text();
2107
1917
  if (response.status === 401) {
2108
- throw new AuthenticationError(
1918
+ throw new chunkP556VRQU_js.AuthenticationError(
2109
1919
  `Authentication failed: ${errorData}`,
2110
1920
  response.status,
2111
1921
  {
@@ -2117,7 +1927,7 @@ var removeFromGroup = async (config, options, privacy) => {
2117
1927
  }
2118
1928
  );
2119
1929
  }
2120
- throw new NetworkError(`HTTP error: ${errorData}`, response.status, {
1930
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, response.status, {
2121
1931
  error: errorData,
2122
1932
  code: "HTTP_ERROR",
2123
1933
  metadata: {
@@ -2131,7 +1941,7 @@ var removeFromGroup = async (config, options, privacy) => {
2131
1941
  });
2132
1942
  } catch (error) {
2133
1943
  let errorMessage;
2134
- if (error instanceof PinataError) {
1944
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2135
1945
  errorMessage = error.message;
2136
1946
  } else if (error instanceof Error) {
2137
1947
  errorMessage = `Error adding file ${id} to group: ${error.message}`;
@@ -2150,7 +1960,7 @@ var removeFromGroup = async (config, options, privacy) => {
2150
1960
  // src/core/functions/groups/updateGroup.ts
2151
1961
  var updateGroup = async (config, options, privacy) => {
2152
1962
  if (!config) {
2153
- throw new ValidationError("Pinata configuration is missing");
1963
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2154
1964
  }
2155
1965
  const data = JSON.stringify({
2156
1966
  name: options.name,
@@ -2186,7 +1996,7 @@ var updateGroup = async (config, options, privacy) => {
2186
1996
  if (!request.ok) {
2187
1997
  const errorData = await request.text();
2188
1998
  if (request.status === 401 || request.status === 403) {
2189
- throw new AuthenticationError(
1999
+ throw new chunkP556VRQU_js.AuthenticationError(
2190
2000
  `Authentication failed: ${errorData}`,
2191
2001
  request.status,
2192
2002
  {
@@ -2198,7 +2008,7 @@ var updateGroup = async (config, options, privacy) => {
2198
2008
  }
2199
2009
  );
2200
2010
  }
2201
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2011
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2202
2012
  error: errorData,
2203
2013
  code: "HTTP_ERROR",
2204
2014
  metadata: {
@@ -2210,20 +2020,20 @@ var updateGroup = async (config, options, privacy) => {
2210
2020
  const resData = res.data;
2211
2021
  return resData;
2212
2022
  } catch (error) {
2213
- if (error instanceof PinataError) {
2023
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2214
2024
  throw error;
2215
2025
  }
2216
2026
  if (error instanceof Error) {
2217
- throw new PinataError(`Error processing updateGroup: ${error.message}`);
2027
+ throw new chunkP556VRQU_js.PinataError(`Error processing updateGroup: ${error.message}`);
2218
2028
  }
2219
- throw new PinataError("An unknown error occurred while updating group");
2029
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while updating group");
2220
2030
  }
2221
2031
  };
2222
2032
 
2223
2033
  // src/core/functions/keys/createKey.ts
2224
2034
  var createKey = async (config, options) => {
2225
2035
  if (!config) {
2226
- throw new ValidationError("Pinata configuration is missing");
2036
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2227
2037
  }
2228
2038
  let headers;
2229
2039
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -2253,7 +2063,7 @@ var createKey = async (config, options) => {
2253
2063
  if (!request.ok) {
2254
2064
  const errorData = await request.text();
2255
2065
  if (request.status === 401 || request.status === 403) {
2256
- throw new AuthenticationError(
2066
+ throw new chunkP556VRQU_js.AuthenticationError(
2257
2067
  `Authentication failed: ${errorData}`,
2258
2068
  request.status,
2259
2069
  {
@@ -2265,7 +2075,7 @@ var createKey = async (config, options) => {
2265
2075
  }
2266
2076
  );
2267
2077
  }
2268
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2078
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2269
2079
  error: errorData,
2270
2080
  code: "HTTP_ERROR",
2271
2081
  metadata: {
@@ -2276,20 +2086,20 @@ var createKey = async (config, options) => {
2276
2086
  const res = await request.json();
2277
2087
  return res;
2278
2088
  } catch (error) {
2279
- if (error instanceof PinataError) {
2089
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2280
2090
  throw error;
2281
2091
  }
2282
2092
  if (error instanceof Error) {
2283
- throw new PinataError(`Error processing createKey: ${error.message}`);
2093
+ throw new chunkP556VRQU_js.PinataError(`Error processing createKey: ${error.message}`);
2284
2094
  }
2285
- throw new PinataError("An unknown error occurred while creating API key");
2095
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while creating API key");
2286
2096
  }
2287
2097
  };
2288
2098
 
2289
2099
  // src/core/functions/keys/listKeys.ts
2290
2100
  var listKeys = async (config, options) => {
2291
2101
  if (!config) {
2292
- throw new ValidationError("Pinata configuration is missing");
2102
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2293
2103
  }
2294
2104
  let headers;
2295
2105
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -2331,7 +2141,7 @@ var listKeys = async (config, options) => {
2331
2141
  if (!request.ok) {
2332
2142
  const errorData = await request.text();
2333
2143
  if (request.status === 401 || request.status === 403) {
2334
- throw new AuthenticationError(
2144
+ throw new chunkP556VRQU_js.AuthenticationError(
2335
2145
  `Authentication failed: ${errorData}`,
2336
2146
  request.status,
2337
2147
  {
@@ -2343,7 +2153,7 @@ var listKeys = async (config, options) => {
2343
2153
  }
2344
2154
  );
2345
2155
  }
2346
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2156
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2347
2157
  error: errorData,
2348
2158
  code: "HTTP_ERROR",
2349
2159
  metadata: {
@@ -2354,13 +2164,13 @@ var listKeys = async (config, options) => {
2354
2164
  const res = await request.json();
2355
2165
  return res.keys;
2356
2166
  } catch (error) {
2357
- if (error instanceof PinataError) {
2167
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2358
2168
  throw error;
2359
2169
  }
2360
2170
  if (error instanceof Error) {
2361
- throw new PinataError(`Error processing listKeys: ${error.message}`);
2171
+ throw new chunkP556VRQU_js.PinataError(`Error processing listKeys: ${error.message}`);
2362
2172
  }
2363
- throw new PinataError("An unknown error occurred while listing API keys");
2173
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while listing API keys");
2364
2174
  }
2365
2175
  };
2366
2176
 
@@ -2372,7 +2182,7 @@ var wait2 = (milliseconds) => {
2372
2182
  };
2373
2183
  var revokeKeys = async (config, keys) => {
2374
2184
  if (!config) {
2375
- throw new ValidationError("Pinata configuration is missing");
2185
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2376
2186
  }
2377
2187
  let headers;
2378
2188
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -2404,7 +2214,7 @@ var revokeKeys = async (config, keys) => {
2404
2214
  if (!request.ok) {
2405
2215
  const errorData = await request.text();
2406
2216
  if (request.status === 401 || request.status === 403) {
2407
- throw new AuthenticationError(
2217
+ throw new chunkP556VRQU_js.AuthenticationError(
2408
2218
  `Authentication failed: ${errorData}`,
2409
2219
  request.status,
2410
2220
  {
@@ -2416,7 +2226,7 @@ var revokeKeys = async (config, keys) => {
2416
2226
  }
2417
2227
  );
2418
2228
  }
2419
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2229
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2420
2230
  error: errorData,
2421
2231
  code: "HTTP_ERROR",
2422
2232
  metadata: {
@@ -2431,7 +2241,7 @@ var revokeKeys = async (config, keys) => {
2431
2241
  });
2432
2242
  } catch (error) {
2433
2243
  let errorMessage;
2434
- if (error instanceof PinataError) {
2244
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2435
2245
  errorMessage = error.message;
2436
2246
  } else if (error instanceof Error) {
2437
2247
  errorMessage = `Error revoking key ${key}: ${error.message}`;
@@ -2450,7 +2260,7 @@ var revokeKeys = async (config, keys) => {
2450
2260
  // src/core/functions/uploads/base64.ts
2451
2261
  var uploadBase64 = async (config, base64String, network, options) => {
2452
2262
  if (!config) {
2453
- throw new ValidationError("Pinata configuration is missing");
2263
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2454
2264
  }
2455
2265
  const jwt = options?.keys || config?.pinataJwt;
2456
2266
  const name = options?.metadata?.name ? options?.metadata?.name : "base64 string";
@@ -2491,7 +2301,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
2491
2301
  if (!request.ok) {
2492
2302
  const errorData = await request.text();
2493
2303
  if (request.status === 401 || request.status === 403) {
2494
- throw new AuthenticationError(
2304
+ throw new chunkP556VRQU_js.AuthenticationError(
2495
2305
  `Authentication failed: ${errorData}`,
2496
2306
  request.status,
2497
2307
  {
@@ -2503,7 +2313,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
2503
2313
  }
2504
2314
  );
2505
2315
  }
2506
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2316
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2507
2317
  error: errorData,
2508
2318
  code: "HTTP_ERROR",
2509
2319
  metadata: {
@@ -2515,13 +2325,13 @@ var uploadBase64 = async (config, base64String, network, options) => {
2515
2325
  const resData = res.data;
2516
2326
  return resData;
2517
2327
  } catch (error) {
2518
- if (error instanceof PinataError) {
2328
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2519
2329
  throw error;
2520
2330
  }
2521
2331
  if (error instanceof Error) {
2522
- throw new PinataError(`Error processing base64: ${error.message}`);
2332
+ throw new chunkP556VRQU_js.PinataError(`Error processing base64: ${error.message}`);
2523
2333
  }
2524
- throw new PinataError(
2334
+ throw new chunkP556VRQU_js.PinataError(
2525
2335
  "An unknown error occurred while trying to upload base64"
2526
2336
  );
2527
2337
  }
@@ -2535,7 +2345,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
2535
2345
  if (!request.ok) {
2536
2346
  const errorData = await request.text();
2537
2347
  if (request.status === 401 || request.status === 403) {
2538
- throw new AuthenticationError(
2348
+ throw new chunkP556VRQU_js.AuthenticationError(
2539
2349
  `Authentication failed: ${errorData}`,
2540
2350
  request.status,
2541
2351
  {
@@ -2547,7 +2357,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
2547
2357
  }
2548
2358
  );
2549
2359
  }
2550
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2360
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2551
2361
  error: errorData,
2552
2362
  code: "HTTP_ERROR",
2553
2363
  metadata: {
@@ -2572,7 +2382,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
2572
2382
  return resData;
2573
2383
  } else {
2574
2384
  const errorData = await vectorReq.text();
2575
- throw new NetworkError(
2385
+ throw new chunkP556VRQU_js.NetworkError(
2576
2386
  `HTTP error during vectorization: ${errorData}`,
2577
2387
  vectorReq.status,
2578
2388
  {
@@ -2587,13 +2397,13 @@ var uploadBase64 = async (config, base64String, network, options) => {
2587
2397
  }
2588
2398
  return resData;
2589
2399
  } catch (error) {
2590
- if (error instanceof PinataError) {
2400
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2591
2401
  throw error;
2592
2402
  }
2593
2403
  if (error instanceof Error) {
2594
- throw new PinataError(`Error processing base64: ${error.message}`);
2404
+ throw new chunkP556VRQU_js.PinataError(`Error processing base64: ${error.message}`);
2595
2405
  }
2596
- throw new PinataError(
2406
+ throw new chunkP556VRQU_js.PinataError(
2597
2407
  "An unknown error occurred while trying to upload base64"
2598
2408
  );
2599
2409
  }
@@ -2602,7 +2412,7 @@ var uploadBase64 = async (config, base64String, network, options) => {
2602
2412
  // src/core/functions/uploads/createSignedUploadURL.ts
2603
2413
  var createSignedUploadURL = async (config, options, network) => {
2604
2414
  if (!config) {
2605
- throw new ValidationError("Pinata configuration is missing");
2415
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2606
2416
  }
2607
2417
  const date = options?.date || Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
2608
2418
  const payload = {
@@ -2657,7 +2467,7 @@ var createSignedUploadURL = async (config, options, network) => {
2657
2467
  if (!request.ok) {
2658
2468
  const errorData = await request.text();
2659
2469
  if (request.status === 401 || request.status === 403) {
2660
- throw new AuthenticationError(
2470
+ throw new chunkP556VRQU_js.AuthenticationError(
2661
2471
  `Authentication Failed: ${errorData}`,
2662
2472
  request.status,
2663
2473
  {
@@ -2669,7 +2479,7 @@ var createSignedUploadURL = async (config, options, network) => {
2669
2479
  }
2670
2480
  );
2671
2481
  }
2672
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2482
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2673
2483
  error: errorData,
2674
2484
  code: "HTTP_ERROR",
2675
2485
  metadata: {
@@ -2680,37 +2490,22 @@ var createSignedUploadURL = async (config, options, network) => {
2680
2490
  const res = await request.json();
2681
2491
  return res.data;
2682
2492
  } catch (error) {
2683
- if (error instanceof PinataError) {
2493
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2684
2494
  throw error;
2685
2495
  }
2686
2496
  if (error instanceof Error) {
2687
- throw new PinataError(
2497
+ throw new chunkP556VRQU_js.PinataError(
2688
2498
  `Error processing createSignedURL: ${error.message}`
2689
2499
  );
2690
2500
  }
2691
- throw new PinataError("An unknown error occurred while getting signed url");
2501
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while getting signed url");
2692
2502
  }
2693
2503
  };
2694
2504
 
2695
- // src/utils/resumable.ts
2696
- function getFileIdFromUrl(url) {
2697
- const match = url.match(/\/files\/([^\/]+)/);
2698
- if (match && match[1]) {
2699
- return match[1];
2700
- }
2701
- throw new NetworkError("File ID not found in URL", 400, {
2702
- error: "File ID not found in URL",
2703
- code: "HTTP_ERROR",
2704
- metadata: {
2705
- requestUrl: url
2706
- }
2707
- });
2708
- }
2709
-
2710
2505
  // src/core/functions/uploads/file.ts
2711
2506
  var uploadFile = async (config, file, network, options) => {
2712
2507
  if (!config) {
2713
- throw new ValidationError("Pinata configuration is missing");
2508
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2714
2509
  }
2715
2510
  const jwt = options?.keys || config.pinataJwt;
2716
2511
  let endpoint = "https://uploads.pinata.cloud/v3";
@@ -2756,7 +2551,7 @@ var uploadFile = async (config, file, network, options) => {
2756
2551
  const url = urlReq.headers.get("Location");
2757
2552
  if (!url) {
2758
2553
  const errorData = await urlReq.text();
2759
- throw new NetworkError("Upload URL not provided", urlReq.status, {
2554
+ throw new chunkP556VRQU_js.NetworkError("Upload URL not provided", urlReq.status, {
2760
2555
  error: errorData,
2761
2556
  code: "HTTP_ERROR",
2762
2557
  metadata: {
@@ -2782,7 +2577,7 @@ var uploadFile = async (config, file, network, options) => {
2782
2577
  });
2783
2578
  if (!uploadReq.ok) {
2784
2579
  const errorData = await uploadReq.text();
2785
- throw new NetworkError(
2580
+ throw new chunkP556VRQU_js.NetworkError(
2786
2581
  `HTTP error during chunk upload: ${errorData}`,
2787
2582
  uploadReq.status,
2788
2583
  {
@@ -2797,7 +2592,7 @@ var uploadFile = async (config, file, network, options) => {
2797
2592
  offset += chunk.size;
2798
2593
  }
2799
2594
  if (uploadReq.status === 204) {
2800
- const fileId = getFileIdFromUrl(url);
2595
+ const fileId = chunkP556VRQU_js.getFileIdFromUrl(url);
2801
2596
  let dataEndpoint;
2802
2597
  if (config.endpointUrl) {
2803
2598
  dataEndpoint = config.endpointUrl;
@@ -2830,7 +2625,7 @@ var uploadFile = async (config, file, network, options) => {
2830
2625
  return data2;
2831
2626
  } else {
2832
2627
  const errorData = await vectorReq.text();
2833
- throw new NetworkError(
2628
+ throw new chunkP556VRQU_js.NetworkError(
2834
2629
  `HTTP error during vectorization: ${errorData}`,
2835
2630
  vectorReq.status,
2836
2631
  {
@@ -2881,7 +2676,7 @@ var uploadFile = async (config, file, network, options) => {
2881
2676
  if (!request.ok) {
2882
2677
  const errorData = await request.text();
2883
2678
  if (request.status === 401 || request.status === 403) {
2884
- throw new AuthenticationError(
2679
+ throw new chunkP556VRQU_js.AuthenticationError(
2885
2680
  `Authentication failed: ${errorData}`,
2886
2681
  request.status,
2887
2682
  {
@@ -2893,7 +2688,7 @@ var uploadFile = async (config, file, network, options) => {
2893
2688
  }
2894
2689
  );
2895
2690
  }
2896
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2691
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2897
2692
  error: errorData,
2898
2693
  code: "HTTP_ERROR",
2899
2694
  metadata: {
@@ -2905,13 +2700,13 @@ var uploadFile = async (config, file, network, options) => {
2905
2700
  const resData = res.data;
2906
2701
  return resData;
2907
2702
  } catch (error) {
2908
- if (error instanceof PinataError) {
2703
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2909
2704
  throw error;
2910
2705
  }
2911
2706
  if (error instanceof Error) {
2912
- throw new PinataError(`Error processing base64: ${error.message}`);
2707
+ throw new chunkP556VRQU_js.PinataError(`Error processing base64: ${error.message}`);
2913
2708
  }
2914
- throw new PinataError(
2709
+ throw new chunkP556VRQU_js.PinataError(
2915
2710
  "An unknown error occurred while trying to upload base64"
2916
2711
  );
2917
2712
  }
@@ -2925,7 +2720,7 @@ var uploadFile = async (config, file, network, options) => {
2925
2720
  if (!request.ok) {
2926
2721
  const errorData = await request.text();
2927
2722
  if (request.status === 401 || request.status === 403) {
2928
- throw new AuthenticationError(
2723
+ throw new chunkP556VRQU_js.AuthenticationError(
2929
2724
  `Authentication failed: ${errorData}`,
2930
2725
  request.status,
2931
2726
  {
@@ -2937,7 +2732,7 @@ var uploadFile = async (config, file, network, options) => {
2937
2732
  }
2938
2733
  );
2939
2734
  }
2940
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2735
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
2941
2736
  error: errorData,
2942
2737
  code: "HTTP_ERROR",
2943
2738
  metadata: {
@@ -2962,7 +2757,7 @@ var uploadFile = async (config, file, network, options) => {
2962
2757
  return resData;
2963
2758
  } else {
2964
2759
  const errorData = await vectorReq.text();
2965
- throw new NetworkError(
2760
+ throw new chunkP556VRQU_js.NetworkError(
2966
2761
  `HTTP error during vectorization: ${errorData}`,
2967
2762
  vectorReq.status,
2968
2763
  {
@@ -2977,20 +2772,20 @@ var uploadFile = async (config, file, network, options) => {
2977
2772
  }
2978
2773
  return resData;
2979
2774
  } catch (error) {
2980
- if (error instanceof PinataError) {
2775
+ if (error instanceof chunkP556VRQU_js.PinataError) {
2981
2776
  throw error;
2982
2777
  }
2983
2778
  if (error instanceof Error) {
2984
- throw new PinataError(`Error uploading file: ${error.message}`);
2779
+ throw new chunkP556VRQU_js.PinataError(`Error uploading file: ${error.message}`);
2985
2780
  }
2986
- throw new PinataError("An unknown error occurred while uploading the file");
2781
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while uploading the file");
2987
2782
  }
2988
2783
  };
2989
2784
 
2990
2785
  // src/core/functions/uploads/fileArray.ts
2991
2786
  var uploadFileArray = async (config, files, network, options) => {
2992
2787
  if (!config) {
2993
- throw new ValidationError("Pinata configuration is missing");
2788
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
2994
2789
  }
2995
2790
  const jwt = options?.keys || config?.pinataJwt;
2996
2791
  const folder = options?.metadata?.name || "folder_from_sdk";
@@ -3038,7 +2833,7 @@ var uploadFileArray = async (config, files, network, options) => {
3038
2833
  if (!request.ok) {
3039
2834
  const errorData = await request.text();
3040
2835
  if (request.status === 401 || request.status === 403) {
3041
- throw new AuthenticationError(
2836
+ throw new chunkP556VRQU_js.AuthenticationError(
3042
2837
  `Authentication failed: ${errorData}`,
3043
2838
  request.status,
3044
2839
  {
@@ -3050,7 +2845,7 @@ var uploadFileArray = async (config, files, network, options) => {
3050
2845
  }
3051
2846
  );
3052
2847
  }
3053
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2848
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
3054
2849
  error: errorData,
3055
2850
  code: "HTTP_ERROR",
3056
2851
  metadata: {
@@ -3074,13 +2869,13 @@ var uploadFileArray = async (config, files, network, options) => {
3074
2869
  };
3075
2870
  return resData;
3076
2871
  } catch (error) {
3077
- if (error instanceof PinataError) {
2872
+ if (error instanceof chunkP556VRQU_js.PinataError) {
3078
2873
  throw error;
3079
2874
  }
3080
2875
  if (error instanceof Error) {
3081
- throw new PinataError(`Error processing fileArray: ${error.message}`);
2876
+ throw new chunkP556VRQU_js.PinataError(`Error processing fileArray: ${error.message}`);
3082
2877
  }
3083
- throw new PinataError(
2878
+ throw new chunkP556VRQU_js.PinataError(
3084
2879
  "An unknown error occurred while uploading an array of files"
3085
2880
  );
3086
2881
  }
@@ -3089,7 +2884,7 @@ var uploadFileArray = async (config, files, network, options) => {
3089
2884
  // src/core/functions/uploads/json.ts
3090
2885
  var uploadJson = async (config, jsonData, network, options) => {
3091
2886
  if (!config) {
3092
- throw new ValidationError("Pinata configuration is missing");
2887
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
3093
2888
  }
3094
2889
  const jwt = options?.keys || config?.pinataJwt;
3095
2890
  const json = JSON.stringify(jsonData);
@@ -3130,7 +2925,7 @@ var uploadJson = async (config, jsonData, network, options) => {
3130
2925
  if (!request.ok) {
3131
2926
  const errorData = await request.text();
3132
2927
  if (request.status === 401 || request.status === 403) {
3133
- throw new AuthenticationError(
2928
+ throw new chunkP556VRQU_js.AuthenticationError(
3134
2929
  `Authentication failed: ${errorData}`,
3135
2930
  request.status,
3136
2931
  {
@@ -3142,7 +2937,7 @@ var uploadJson = async (config, jsonData, network, options) => {
3142
2937
  }
3143
2938
  );
3144
2939
  }
3145
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2940
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
3146
2941
  error: errorData,
3147
2942
  code: "HTTP_ERROR",
3148
2943
  metadata: {
@@ -3154,13 +2949,13 @@ var uploadJson = async (config, jsonData, network, options) => {
3154
2949
  const resData = res.data;
3155
2950
  return resData;
3156
2951
  } catch (error) {
3157
- if (error instanceof PinataError) {
2952
+ if (error instanceof chunkP556VRQU_js.PinataError) {
3158
2953
  throw error;
3159
2954
  }
3160
2955
  if (error instanceof Error) {
3161
- throw new PinataError(`Error processing base64: ${error.message}`);
2956
+ throw new chunkP556VRQU_js.PinataError(`Error processing base64: ${error.message}`);
3162
2957
  }
3163
- throw new PinataError(
2958
+ throw new chunkP556VRQU_js.PinataError(
3164
2959
  "An unknown error occurred while trying to upload base64"
3165
2960
  );
3166
2961
  }
@@ -3174,7 +2969,7 @@ var uploadJson = async (config, jsonData, network, options) => {
3174
2969
  if (!request.ok) {
3175
2970
  const errorData = await request.text();
3176
2971
  if (request.status === 401 || request.status === 403) {
3177
- throw new AuthenticationError(
2972
+ throw new chunkP556VRQU_js.AuthenticationError(
3178
2973
  `Authentication failed: ${errorData}`,
3179
2974
  request.status,
3180
2975
  {
@@ -3186,7 +2981,7 @@ var uploadJson = async (config, jsonData, network, options) => {
3186
2981
  }
3187
2982
  );
3188
2983
  }
3189
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
2984
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
3190
2985
  error: errorData,
3191
2986
  code: "HTTP_ERROR",
3192
2987
  metadata: {
@@ -3211,7 +3006,7 @@ var uploadJson = async (config, jsonData, network, options) => {
3211
3006
  return resData;
3212
3007
  } else {
3213
3008
  const errorData = await vectorReq.text();
3214
- throw new NetworkError(
3009
+ throw new chunkP556VRQU_js.NetworkError(
3215
3010
  `HTTP error during vectorization: ${errorData}`,
3216
3011
  vectorReq.status,
3217
3012
  {
@@ -3226,27 +3021,27 @@ var uploadJson = async (config, jsonData, network, options) => {
3226
3021
  }
3227
3022
  return resData;
3228
3023
  } catch (error) {
3229
- if (error instanceof PinataError) {
3024
+ if (error instanceof chunkP556VRQU_js.PinataError) {
3230
3025
  throw error;
3231
3026
  }
3232
3027
  if (error instanceof Error) {
3233
- throw new PinataError(`Error processing json: ${error.message}`);
3028
+ throw new chunkP556VRQU_js.PinataError(`Error processing json: ${error.message}`);
3234
3029
  }
3235
- throw new PinataError("An unknown error occurred while uploading json");
3030
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while uploading json");
3236
3031
  }
3237
3032
  };
3238
3033
 
3239
3034
  // src/core/functions/uploads/url.ts
3240
3035
  var uploadUrl = async (config, url, network, options) => {
3241
3036
  if (!config) {
3242
- throw new ValidationError("Pinata configuration is missing");
3037
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
3243
3038
  }
3244
3039
  const jwt = options?.keys || config?.pinataJwt;
3245
3040
  const data = new FormData();
3246
3041
  const stream = await fetch(url);
3247
3042
  if (!stream.ok) {
3248
3043
  const errorData = await stream.text();
3249
- throw new NetworkError(`HTTP error: ${errorData}`, stream.status, {
3044
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, stream.status, {
3250
3045
  error: errorData,
3251
3046
  code: "HTTP_ERROR",
3252
3047
  metadata: {
@@ -3292,7 +3087,7 @@ var uploadUrl = async (config, url, network, options) => {
3292
3087
  if (!request.ok) {
3293
3088
  const errorData = await request.text();
3294
3089
  if (request.status === 401 || request.status === 403) {
3295
- throw new AuthenticationError(
3090
+ throw new chunkP556VRQU_js.AuthenticationError(
3296
3091
  `Authentication failed: ${errorData}`,
3297
3092
  request.status,
3298
3093
  {
@@ -3304,7 +3099,7 @@ var uploadUrl = async (config, url, network, options) => {
3304
3099
  }
3305
3100
  );
3306
3101
  }
3307
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
3102
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
3308
3103
  error: errorData,
3309
3104
  code: "HTTP_ERROR",
3310
3105
  metadata: {
@@ -3316,13 +3111,13 @@ var uploadUrl = async (config, url, network, options) => {
3316
3111
  const resData = res.data;
3317
3112
  return resData;
3318
3113
  } catch (error) {
3319
- if (error instanceof PinataError) {
3114
+ if (error instanceof chunkP556VRQU_js.PinataError) {
3320
3115
  throw error;
3321
3116
  }
3322
3117
  if (error instanceof Error) {
3323
- throw new PinataError(`Error processing base64: ${error.message}`);
3118
+ throw new chunkP556VRQU_js.PinataError(`Error processing base64: ${error.message}`);
3324
3119
  }
3325
- throw new PinataError(
3120
+ throw new chunkP556VRQU_js.PinataError(
3326
3121
  "An unknown error occurred while trying to upload base64"
3327
3122
  );
3328
3123
  }
@@ -3336,7 +3131,7 @@ var uploadUrl = async (config, url, network, options) => {
3336
3131
  if (!request.ok) {
3337
3132
  const errorData = await request.text();
3338
3133
  if (request.status === 401 || request.status === 403) {
3339
- throw new AuthenticationError(
3134
+ throw new chunkP556VRQU_js.AuthenticationError(
3340
3135
  `Authentication failed: ${errorData}`,
3341
3136
  request.status,
3342
3137
  {
@@ -3348,7 +3143,7 @@ var uploadUrl = async (config, url, network, options) => {
3348
3143
  }
3349
3144
  );
3350
3145
  }
3351
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
3146
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
3352
3147
  error: errorData,
3353
3148
  code: "HTTP_ERROR",
3354
3149
  metadata: {
@@ -3373,7 +3168,7 @@ var uploadUrl = async (config, url, network, options) => {
3373
3168
  return resData;
3374
3169
  } else {
3375
3170
  const errorData = await vectorReq.text();
3376
- throw new NetworkError(
3171
+ throw new chunkP556VRQU_js.NetworkError(
3377
3172
  `HTTP error during vectorization: ${errorData}`,
3378
3173
  vectorReq.status,
3379
3174
  {
@@ -3388,20 +3183,20 @@ var uploadUrl = async (config, url, network, options) => {
3388
3183
  }
3389
3184
  return resData;
3390
3185
  } catch (error) {
3391
- if (error instanceof PinataError) {
3186
+ if (error instanceof chunkP556VRQU_js.PinataError) {
3392
3187
  throw error;
3393
3188
  }
3394
3189
  if (error instanceof Error) {
3395
- throw new PinataError(`Error processing url: ${error.message}`);
3190
+ throw new chunkP556VRQU_js.PinataError(`Error processing url: ${error.message}`);
3396
3191
  }
3397
- throw new PinataError("An unknown error occurred while uploading by url");
3192
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while uploading by url");
3398
3193
  }
3399
3194
  };
3400
3195
 
3401
3196
  // src/core/functions/uploads/cid.ts
3402
3197
  var uploadCid = async (config, cid, options) => {
3403
3198
  if (!config) {
3404
- throw new ValidationError("Pinata configuration is missing");
3199
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
3405
3200
  }
3406
3201
  const jwt = options?.keys || config?.pinataJwt;
3407
3202
  let headers;
@@ -3439,7 +3234,7 @@ var uploadCid = async (config, cid, options) => {
3439
3234
  if (!request.ok) {
3440
3235
  const errorData = await request.text();
3441
3236
  if (request.status === 401 || request.status === 403) {
3442
- throw new AuthenticationError(
3237
+ throw new chunkP556VRQU_js.AuthenticationError(
3443
3238
  `Authentication failed: ${errorData}`,
3444
3239
  request.status,
3445
3240
  {
@@ -3451,7 +3246,7 @@ var uploadCid = async (config, cid, options) => {
3451
3246
  }
3452
3247
  );
3453
3248
  }
3454
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
3249
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
3455
3250
  error: errorData,
3456
3251
  code: "HTTP_ERROR",
3457
3252
  metadata: {
@@ -3463,32 +3258,20 @@ var uploadCid = async (config, cid, options) => {
3463
3258
  const resData = res.data;
3464
3259
  return resData;
3465
3260
  } catch (error) {
3466
- if (error instanceof PinataError) {
3261
+ if (error instanceof chunkP556VRQU_js.PinataError) {
3467
3262
  throw error;
3468
3263
  }
3469
3264
  if (error instanceof Error) {
3470
- throw new PinataError(`Error processing cid: ${error.message}`);
3265
+ throw new chunkP556VRQU_js.PinataError(`Error processing cid: ${error.message}`);
3471
3266
  }
3472
- throw new PinataError("An unknown error occurred while pinning by CID");
3267
+ throw new chunkP556VRQU_js.PinataError("An unknown error occurred while pinning by CID");
3473
3268
  }
3474
3269
  };
3475
3270
 
3476
- // src/utils/format-config.ts
3477
- var formatConfig = (config) => {
3478
- let gateway = config?.pinataGateway;
3479
- if (config && gateway) {
3480
- if (gateway && !gateway.startsWith("https://")) {
3481
- gateway = `https://${gateway}`;
3482
- }
3483
- config.pinataGateway = gateway;
3484
- }
3485
- return config;
3486
- };
3487
-
3488
3271
  // src/core/classes/analytics/Analytics.ts
3489
3272
  var Analytics = class {
3490
3273
  constructor(config) {
3491
- this.config = formatConfig(config);
3274
+ this.config = chunkP556VRQU_js.formatConfig(config);
3492
3275
  this.requests = new AnalyticsRequests(this.config);
3493
3276
  this.bandwidth = new AnalyticsBandwidth(this.config);
3494
3277
  }
@@ -3791,7 +3574,7 @@ var FilterGroups = class {
3791
3574
  // src/core/classes/groups/PublicGroups.ts
3792
3575
  var PublicGroups = class {
3793
3576
  constructor(config) {
3794
- this.config = formatConfig(config);
3577
+ this.config = chunkP556VRQU_js.formatConfig(config);
3795
3578
  }
3796
3579
  updateConfig(newConfig) {
3797
3580
  this.config = newConfig;
@@ -3822,7 +3605,7 @@ var PublicGroups = class {
3822
3605
  // src/core/classes/groups/PrivateGroups.ts
3823
3606
  var PrivateGroups = class {
3824
3607
  constructor(config) {
3825
- this.config = formatConfig(config);
3608
+ this.config = chunkP556VRQU_js.formatConfig(config);
3826
3609
  }
3827
3610
  updateConfig(newConfig) {
3828
3611
  this.config = newConfig;
@@ -3853,7 +3636,7 @@ var PrivateGroups = class {
3853
3636
  // src/core/classes/groups/Groups.ts
3854
3637
  var Groups = class {
3855
3638
  constructor(config) {
3856
- this.config = formatConfig(config);
3639
+ this.config = chunkP556VRQU_js.formatConfig(config);
3857
3640
  this.public = new PublicGroups(config);
3858
3641
  this.private = new PrivateGroups(config);
3859
3642
  }
@@ -3865,7 +3648,7 @@ var Groups = class {
3865
3648
  // src/core/classes/keys/Keys.ts
3866
3649
  var Keys = class {
3867
3650
  constructor(config) {
3868
- this.config = formatConfig(config);
3651
+ this.config = chunkP556VRQU_js.formatConfig(config);
3869
3652
  }
3870
3653
  updateConfig(newConfig) {
3871
3654
  this.config = newConfig;
@@ -3956,7 +3739,7 @@ var FilterKeys = class {
3956
3739
  // src/core/classes/gateways/Gateways.ts
3957
3740
  var Gateways = class {
3958
3741
  constructor(config) {
3959
- this.config = formatConfig(config);
3742
+ this.config = chunkP556VRQU_js.formatConfig(config);
3960
3743
  this.public = new PublicGateways(config);
3961
3744
  this.private = new PrivateGateways(config);
3962
3745
  }
@@ -4031,7 +3814,7 @@ var PublicGateways = class {
4031
3814
  // src/core/functions/files/getFile.ts
4032
3815
  var getFile = async (config, id, privacy) => {
4033
3816
  if (!config) {
4034
- throw new ValidationError("Pinata configuration is missing");
3817
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
4035
3818
  }
4036
3819
  let headers;
4037
3820
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -4059,7 +3842,7 @@ var getFile = async (config, id, privacy) => {
4059
3842
  if (!request.ok) {
4060
3843
  const errorData = await request.text();
4061
3844
  if (request.status === 401 || request.status === 403) {
4062
- throw new AuthenticationError(
3845
+ throw new chunkP556VRQU_js.AuthenticationError(
4063
3846
  `Authentication failed: ${errorData}`,
4064
3847
  request.status,
4065
3848
  {
@@ -4071,7 +3854,7 @@ var getFile = async (config, id, privacy) => {
4071
3854
  }
4072
3855
  );
4073
3856
  }
4074
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
3857
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
4075
3858
  error: errorData,
4076
3859
  code: "HTTP_ERROR",
4077
3860
  metadata: {
@@ -4083,13 +3866,13 @@ var getFile = async (config, id, privacy) => {
4083
3866
  const resData = res.data;
4084
3867
  return resData;
4085
3868
  } catch (error) {
4086
- if (error instanceof PinataError) {
3869
+ if (error instanceof chunkP556VRQU_js.PinataError) {
4087
3870
  throw error;
4088
3871
  }
4089
3872
  if (error instanceof Error) {
4090
- throw new PinataError(`Error processing getGroup: ${error.message}`);
3873
+ throw new chunkP556VRQU_js.PinataError(`Error processing getGroup: ${error.message}`);
4091
3874
  }
4092
- throw new PinataError(
3875
+ throw new chunkP556VRQU_js.PinataError(
4093
3876
  "An unknown error occurred while getting info for a group"
4094
3877
  );
4095
3878
  }
@@ -4271,7 +4054,7 @@ var FilterQueue = class {
4271
4054
  // src/core/classes/files/PublicFiles.ts
4272
4055
  var PublicFiles = class {
4273
4056
  constructor(config) {
4274
- this.config = formatConfig(config);
4057
+ this.config = chunkP556VRQU_js.formatConfig(config);
4275
4058
  }
4276
4059
  list() {
4277
4060
  return new FilterFiles(this.config, "public");
@@ -4305,7 +4088,7 @@ var PublicFiles = class {
4305
4088
  // src/core/classes/files/PrivateFiles.ts
4306
4089
  var PrivateFiles = class {
4307
4090
  constructor(config) {
4308
- this.config = formatConfig(config);
4091
+ this.config = chunkP556VRQU_js.formatConfig(config);
4309
4092
  }
4310
4093
  list() {
4311
4094
  return new FilterFiles(this.config, "private");
@@ -4342,7 +4125,7 @@ var PrivateFiles = class {
4342
4125
  // src/core/classes/files/Files.ts
4343
4126
  var Files = class {
4344
4127
  constructor(config) {
4345
- this.config = formatConfig(config);
4128
+ this.config = chunkP556VRQU_js.formatConfig(config);
4346
4129
  this.public = new PublicFiles(config);
4347
4130
  this.private = new PrivateFiles(config);
4348
4131
  }
@@ -4436,7 +4219,7 @@ var UploadBuilder = class {
4436
4219
  // src/core/classes/uploads/PublicUpload.ts
4437
4220
  var PublicUpload = class {
4438
4221
  constructor(config) {
4439
- this.config = formatConfig(config);
4222
+ this.config = chunkP556VRQU_js.formatConfig(config);
4440
4223
  }
4441
4224
  updateConfig(newConfig) {
4442
4225
  this.config = newConfig;
@@ -4497,7 +4280,7 @@ var PublicUpload = class {
4497
4280
  // src/core/classes/uploads/PrivateUpload.ts
4498
4281
  var PrivateUpload = class {
4499
4282
  constructor(config) {
4500
- this.config = formatConfig(config);
4283
+ this.config = chunkP556VRQU_js.formatConfig(config);
4501
4284
  }
4502
4285
  updateConfig(newConfig) {
4503
4286
  this.config = newConfig;
@@ -4555,7 +4338,7 @@ var PrivateUpload = class {
4555
4338
  // src/core/classes/uploads/Upload.ts
4556
4339
  var Upload = class {
4557
4340
  constructor(config) {
4558
- this.config = formatConfig(config);
4341
+ this.config = chunkP556VRQU_js.formatConfig(config);
4559
4342
  this.public = new PublicUpload(config);
4560
4343
  this.private = new PrivateUpload(config);
4561
4344
  }
@@ -4567,7 +4350,7 @@ var Upload = class {
4567
4350
  // src/core/functions/signatures/addSignature.ts
4568
4351
  var addSignature = async (config, options, network) => {
4569
4352
  if (!config) {
4570
- throw new ValidationError("Pinata configuration is missing");
4353
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
4571
4354
  }
4572
4355
  const data = JSON.stringify({
4573
4356
  signature: options.signature,
@@ -4599,7 +4382,7 @@ var addSignature = async (config, options, network) => {
4599
4382
  if (!request.ok) {
4600
4383
  const errorData = await request.text();
4601
4384
  if (request.status === 401 || request.status === 403) {
4602
- throw new AuthenticationError(
4385
+ throw new chunkP556VRQU_js.AuthenticationError(
4603
4386
  `Authentication failed: ${errorData}`,
4604
4387
  request.status,
4605
4388
  {
@@ -4612,7 +4395,7 @@ var addSignature = async (config, options, network) => {
4612
4395
  );
4613
4396
  }
4614
4397
  if (request.status === 403) {
4615
- throw new PinataError(
4398
+ throw new chunkP556VRQU_js.PinataError(
4616
4399
  "Unauthorized signing, you must be the original owner of the file and it must not have a signature",
4617
4400
  request.status,
4618
4401
  {
@@ -4624,7 +4407,7 @@ var addSignature = async (config, options, network) => {
4624
4407
  }
4625
4408
  );
4626
4409
  }
4627
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
4410
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
4628
4411
  error: errorData,
4629
4412
  code: "HTTP_ERROR",
4630
4413
  metadata: {
@@ -4635,13 +4418,13 @@ var addSignature = async (config, options, network) => {
4635
4418
  const res = await request.json();
4636
4419
  return res.data;
4637
4420
  } catch (error) {
4638
- if (error instanceof PinataError) {
4421
+ if (error instanceof chunkP556VRQU_js.PinataError) {
4639
4422
  throw error;
4640
4423
  }
4641
4424
  if (error instanceof Error) {
4642
- throw new PinataError(`Error processing addSignature: ${error.message}`);
4425
+ throw new chunkP556VRQU_js.PinataError(`Error processing addSignature: ${error.message}`);
4643
4426
  }
4644
- throw new PinataError(
4427
+ throw new chunkP556VRQU_js.PinataError(
4645
4428
  "An unknown error occurred while adding signature to CID"
4646
4429
  );
4647
4430
  }
@@ -4650,7 +4433,7 @@ var addSignature = async (config, options, network) => {
4650
4433
  // src/core/functions/signatures/getSignature.ts
4651
4434
  var getSignature = async (config, cid, network) => {
4652
4435
  if (!config) {
4653
- throw new ValidationError("Pinata configuration is missing");
4436
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
4654
4437
  }
4655
4438
  let headers;
4656
4439
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -4677,7 +4460,7 @@ var getSignature = async (config, cid, network) => {
4677
4460
  if (!request.ok) {
4678
4461
  const errorData = await request.text();
4679
4462
  if (request.status === 401 || request.status === 403) {
4680
- throw new AuthenticationError(
4463
+ throw new chunkP556VRQU_js.AuthenticationError(
4681
4464
  `Authentication failed: ${errorData}`,
4682
4465
  request.status,
4683
4466
  {
@@ -4689,7 +4472,7 @@ var getSignature = async (config, cid, network) => {
4689
4472
  }
4690
4473
  );
4691
4474
  }
4692
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
4475
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
4693
4476
  error: errorData,
4694
4477
  code: "HTTP_ERROR",
4695
4478
  metadata: {
@@ -4700,13 +4483,13 @@ var getSignature = async (config, cid, network) => {
4700
4483
  const res = await request.json();
4701
4484
  return res.data;
4702
4485
  } catch (error) {
4703
- if (error instanceof PinataError) {
4486
+ if (error instanceof chunkP556VRQU_js.PinataError) {
4704
4487
  throw error;
4705
4488
  }
4706
4489
  if (error instanceof Error) {
4707
- throw new PinataError(`Error processing getSignature: ${error.message}`);
4490
+ throw new chunkP556VRQU_js.PinataError(`Error processing getSignature: ${error.message}`);
4708
4491
  }
4709
- throw new PinataError(
4492
+ throw new chunkP556VRQU_js.PinataError(
4710
4493
  "An unknown error occurred while fetching signature for CID"
4711
4494
  );
4712
4495
  }
@@ -4715,7 +4498,7 @@ var getSignature = async (config, cid, network) => {
4715
4498
  // src/core/functions/signatures/removeSignature.ts
4716
4499
  var removeSignature = async (config, cid, network) => {
4717
4500
  if (!config) {
4718
- throw new ValidationError("Pinata configuration is missing");
4501
+ throw new chunkP556VRQU_js.ValidationError("Pinata configuration is missing");
4719
4502
  }
4720
4503
  let headers;
4721
4504
  if (config.customHeaders && Object.keys(config.customHeaders).length > 0) {
@@ -4742,7 +4525,7 @@ var removeSignature = async (config, cid, network) => {
4742
4525
  if (!request.ok) {
4743
4526
  const errorData = await request.text();
4744
4527
  if (request.status === 401 || request.status === 403) {
4745
- throw new AuthenticationError(
4528
+ throw new chunkP556VRQU_js.AuthenticationError(
4746
4529
  `Authentication failed: ${errorData}`,
4747
4530
  request.status,
4748
4531
  {
@@ -4754,7 +4537,7 @@ var removeSignature = async (config, cid, network) => {
4754
4537
  }
4755
4538
  );
4756
4539
  }
4757
- throw new NetworkError(`HTTP error: ${errorData}`, request.status, {
4540
+ throw new chunkP556VRQU_js.NetworkError(`HTTP error: ${errorData}`, request.status, {
4758
4541
  error: errorData,
4759
4542
  code: "HTTP_ERROR",
4760
4543
  metadata: {
@@ -4764,13 +4547,13 @@ var removeSignature = async (config, cid, network) => {
4764
4547
  }
4765
4548
  return "OK";
4766
4549
  } catch (error) {
4767
- if (error instanceof PinataError) {
4550
+ if (error instanceof chunkP556VRQU_js.PinataError) {
4768
4551
  throw error;
4769
4552
  }
4770
4553
  if (error instanceof Error) {
4771
- throw new PinataError(`Error processing addSignature: ${error.message}`);
4554
+ throw new chunkP556VRQU_js.PinataError(`Error processing addSignature: ${error.message}`);
4772
4555
  }
4773
- throw new PinataError(
4556
+ throw new chunkP556VRQU_js.PinataError(
4774
4557
  "An unknown error occurred while adding signature to CID"
4775
4558
  );
4776
4559
  }
@@ -4779,7 +4562,7 @@ var removeSignature = async (config, cid, network) => {
4779
4562
  // src/core/classes/signatures/PublicSignatures.ts
4780
4563
  var PublicSignatures = class {
4781
4564
  constructor(config) {
4782
- this.config = formatConfig(config);
4565
+ this.config = chunkP556VRQU_js.formatConfig(config);
4783
4566
  }
4784
4567
  updateConfig(newConfig) {
4785
4568
  this.config = newConfig;
@@ -4799,7 +4582,7 @@ var PublicSignatures = class {
4799
4582
  var Signatures = class {
4800
4583
  //private: PrivateSignatures
4801
4584
  constructor(config) {
4802
- this.config = formatConfig(config);
4585
+ this.config = chunkP556VRQU_js.formatConfig(config);
4803
4586
  this.public = new PublicSignatures(config);
4804
4587
  }
4805
4588
  updateConfig(newConfig) {
@@ -4810,7 +4593,7 @@ var Signatures = class {
4810
4593
  // src/core/pinataSDK.ts
4811
4594
  var PinataSDK = class {
4812
4595
  constructor(config) {
4813
- this.config = formatConfig(config);
4596
+ this.config = chunkP556VRQU_js.formatConfig(config);
4814
4597
  this.files = new Files(this.config);
4815
4598
  this.upload = new Upload(this.config);
4816
4599
  this.gateways = new Gateways(this.config);
@@ -4849,52 +4632,83 @@ var PinataSDK = class {
4849
4632
  return testAuthentication(this.config);
4850
4633
  }
4851
4634
  };
4852
- // Annotate the CommonJS export names for ESM import in node:
4853
- 0 && (module.exports = {
4854
- AuthenticationError,
4855
- NetworkError,
4856
- PinataError,
4857
- PinataSDK,
4858
- ValidationError,
4859
- addToGroup,
4860
- analyticsDateInterval,
4861
- analyticsTopUsage,
4862
- containsCID,
4863
- convertIPFSUrl,
4864
- convertToDesiredGateway,
4865
- createAccessLink,
4866
- createGroup,
4867
- createKey,
4868
- createSignedUploadURL,
4869
- deleteFile,
4870
- deleteFileVectors,
4871
- deleteGroup,
4872
- deletePinRequest,
4873
- deleteSwap,
4874
- formatConfig,
4875
- getCid,
4876
- getFileIdFromUrl,
4877
- getGroup,
4878
- listFiles,
4879
- listGroups,
4880
- listKeys,
4881
- pinnedFileCount,
4882
- queue,
4883
- removeFromGroup,
4884
- revokeKeys,
4885
- swapCid,
4886
- swapHistory,
4887
- testAuthentication,
4888
- totalStorageUsage,
4889
- updateFile,
4890
- updateGroup,
4891
- uploadBase64,
4892
- uploadCid,
4893
- uploadFile,
4894
- uploadFileArray,
4895
- uploadJson,
4896
- uploadUrl,
4897
- vectorizeFile,
4898
- vectorizeQuery
4635
+
4636
+ Object.defineProperty(exports, "AuthenticationError", {
4637
+ enumerable: true,
4638
+ get: function () { return chunkP556VRQU_js.AuthenticationError; }
4639
+ });
4640
+ Object.defineProperty(exports, "NetworkError", {
4641
+ enumerable: true,
4642
+ get: function () { return chunkP556VRQU_js.NetworkError; }
4643
+ });
4644
+ Object.defineProperty(exports, "PinataError", {
4645
+ enumerable: true,
4646
+ get: function () { return chunkP556VRQU_js.PinataError; }
4647
+ });
4648
+ Object.defineProperty(exports, "ValidationError", {
4649
+ enumerable: true,
4650
+ get: function () { return chunkP556VRQU_js.ValidationError; }
4651
+ });
4652
+ Object.defineProperty(exports, "containsCID", {
4653
+ enumerable: true,
4654
+ get: function () { return chunkP556VRQU_js.containsCID; }
4655
+ });
4656
+ Object.defineProperty(exports, "convert", {
4657
+ enumerable: true,
4658
+ get: function () { return chunkP556VRQU_js.convertToDesiredGateway; }
4659
+ });
4660
+ Object.defineProperty(exports, "convertToDesiredGateway", {
4661
+ enumerable: true,
4662
+ get: function () { return chunkP556VRQU_js.convertToDesiredGateway; }
4663
+ });
4664
+ Object.defineProperty(exports, "formatConfig", {
4665
+ enumerable: true,
4666
+ get: function () { return chunkP556VRQU_js.formatConfig; }
4667
+ });
4668
+ Object.defineProperty(exports, "getFileIdFromUrl", {
4669
+ enumerable: true,
4670
+ get: function () { return chunkP556VRQU_js.getFileIdFromUrl; }
4671
+ });
4672
+ Object.defineProperty(exports, "useUpload", {
4673
+ enumerable: true,
4674
+ get: function () { return chunkP556VRQU_js.useUpload; }
4899
4675
  });
4676
+ exports.PinataSDK = PinataSDK;
4677
+ exports.addToGroup = addToGroup;
4678
+ exports.analyticsDateInterval = analyticsDateInterval;
4679
+ exports.analyticsTopUsage = analyticsTopUsage;
4680
+ exports.convertIPFSUrl = convertIPFSUrl;
4681
+ exports.createAccessLink = createAccessLink;
4682
+ exports.createGroup = createGroup;
4683
+ exports.createKey = createKey;
4684
+ exports.createSignedUploadURL = createSignedUploadURL;
4685
+ exports.deleteFile = deleteFile;
4686
+ exports.deleteFileVectors = deleteFileVectors;
4687
+ exports.deleteGroup = deleteGroup;
4688
+ exports.deletePinRequest = deletePinRequest;
4689
+ exports.deleteSwap = deleteSwap;
4690
+ exports.getCid = getCid;
4691
+ exports.getGroup = getGroup;
4692
+ exports.listFiles = listFiles;
4693
+ exports.listGroups = listGroups;
4694
+ exports.listKeys = listKeys;
4695
+ exports.pinnedFileCount = pinnedFileCount;
4696
+ exports.queue = queue;
4697
+ exports.removeFromGroup = removeFromGroup;
4698
+ exports.revokeKeys = revokeKeys;
4699
+ exports.swapCid = swapCid;
4700
+ exports.swapHistory = swapHistory;
4701
+ exports.testAuthentication = testAuthentication;
4702
+ exports.totalStorageUsage = totalStorageUsage;
4703
+ exports.updateFile = updateFile;
4704
+ exports.updateGroup = updateGroup;
4705
+ exports.uploadBase64 = uploadBase64;
4706
+ exports.uploadCid = uploadCid;
4707
+ exports.uploadFile = uploadFile;
4708
+ exports.uploadFileArray = uploadFileArray;
4709
+ exports.uploadJson = uploadJson;
4710
+ exports.uploadUrl = uploadUrl;
4711
+ exports.vectorizeFile = vectorizeFile;
4712
+ exports.vectorizeQuery = vectorizeQuery;
4713
+ //# sourceMappingURL=index.js.map
4900
4714
  //# sourceMappingURL=index.js.map