@xyo-network/huri 2.75.15 → 2.75.16

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/docs.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "fileName": "huri/src/Huri.ts",
24
24
  "line": 41,
25
25
  "character": 2,
26
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L41"
26
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L41"
27
27
  }
28
28
  ],
29
29
  "signatures": [
@@ -38,7 +38,7 @@
38
38
  "fileName": "huri/src/Huri.ts",
39
39
  "line": 41,
40
40
  "character": 2,
41
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L41"
41
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L41"
42
42
  }
43
43
  ],
44
44
  "typeParameter": [
@@ -302,7 +302,7 @@
302
302
  "fileName": "huri/src/Huri.ts",
303
303
  "line": 32,
304
304
  "character": 2,
305
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L32"
305
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L32"
306
306
  }
307
307
  ],
308
308
  "type": {
@@ -323,7 +323,7 @@
323
323
  "fileName": "huri/src/Huri.ts",
324
324
  "line": 33,
325
325
  "character": 2,
326
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L33"
326
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L33"
327
327
  }
328
328
  ],
329
329
  "type": {
@@ -342,7 +342,7 @@
342
342
  "fileName": "huri/src/Huri.ts",
343
343
  "line": 34,
344
344
  "character": 2,
345
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L34"
345
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L34"
346
346
  }
347
347
  ],
348
348
  "type": {
@@ -363,7 +363,7 @@
363
363
  "fileName": "huri/src/Huri.ts",
364
364
  "line": 39,
365
365
  "character": 10,
366
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L39"
366
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L39"
367
367
  }
368
368
  ],
369
369
  "type": {
@@ -383,7 +383,7 @@
383
383
  "fileName": "huri/src/Huri.ts",
384
384
  "line": 35,
385
385
  "character": 2,
386
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L35"
386
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L35"
387
387
  }
388
388
  ],
389
389
  "type": {
@@ -404,7 +404,7 @@
404
404
  "fileName": "huri/src/Huri.ts",
405
405
  "line": 36,
406
406
  "character": 2,
407
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L36"
407
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L36"
408
408
  }
409
409
  ],
410
410
  "type": {
@@ -425,7 +425,7 @@
425
425
  "fileName": "huri/src/Huri.ts",
426
426
  "line": 37,
427
427
  "character": 2,
428
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L37"
428
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L37"
429
429
  }
430
430
  ],
431
431
  "type": {
@@ -444,7 +444,7 @@
444
444
  "fileName": "huri/src/Huri.ts",
445
445
  "line": 66,
446
446
  "character": 6,
447
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L66"
447
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L66"
448
448
  }
449
449
  ],
450
450
  "getSignature": {
@@ -458,7 +458,7 @@
458
458
  "fileName": "huri/src/Huri.ts",
459
459
  "line": 66,
460
460
  "character": 6,
461
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L66"
461
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L66"
462
462
  }
463
463
  ],
464
464
  "type": {
@@ -478,7 +478,7 @@
478
478
  "fileName": "huri/src/Huri.ts",
479
479
  "line": 116,
480
480
  "character": 8,
481
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L116"
481
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L116"
482
482
  }
483
483
  ],
484
484
  "signatures": [
@@ -493,7 +493,7 @@
493
493
  "fileName": "huri/src/Huri.ts",
494
494
  "line": 116,
495
495
  "character": 8,
496
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L116"
496
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L116"
497
497
  }
498
498
  ],
499
499
  "type": {
@@ -538,7 +538,7 @@
538
538
  "fileName": "huri/src/Huri.ts",
539
539
  "line": 124,
540
540
  "character": 10,
541
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L124"
541
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L124"
542
542
  }
543
543
  ],
544
544
  "signatures": [
@@ -553,7 +553,7 @@
553
553
  "fileName": "huri/src/Huri.ts",
554
554
  "line": 124,
555
555
  "character": 10,
556
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L124"
556
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L124"
557
557
  }
558
558
  ],
559
559
  "parameters": [
@@ -598,7 +598,7 @@
598
598
  "fileName": "huri/src/Huri.ts",
599
599
  "line": 120,
600
600
  "character": 2,
601
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L120"
601
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L120"
602
602
  }
603
603
  ],
604
604
  "signatures": [
@@ -613,7 +613,7 @@
613
613
  "fileName": "huri/src/Huri.ts",
614
614
  "line": 120,
615
615
  "character": 2,
616
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L120"
616
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L120"
617
617
  }
618
618
  ],
619
619
  "type": {
@@ -636,7 +636,7 @@
636
636
  "fileName": "huri/src/Huri.ts",
637
637
  "line": 148,
638
638
  "character": 10,
639
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L148"
639
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L148"
640
640
  }
641
641
  ],
642
642
  "signatures": [
@@ -651,7 +651,7 @@
651
651
  "fileName": "huri/src/Huri.ts",
652
652
  "line": 148,
653
653
  "character": 10,
654
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L148"
654
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L148"
655
655
  }
656
656
  ],
657
657
  "type": {
@@ -674,7 +674,7 @@
674
674
  "fileName": "huri/src/Huri.ts",
675
675
  "line": 81,
676
676
  "character": 15,
677
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L81"
677
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L81"
678
678
  }
679
679
  ],
680
680
  "signatures": [
@@ -689,7 +689,7 @@
689
689
  "fileName": "huri/src/Huri.ts",
690
690
  "line": 81,
691
691
  "character": 15,
692
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L81"
692
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L81"
693
693
  }
694
694
  ],
695
695
  "typeParameter": [
@@ -937,7 +937,7 @@
937
937
  "fileName": "huri/src/Huri.ts",
938
938
  "line": 86,
939
939
  "character": 9,
940
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L86"
940
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L86"
941
941
  }
942
942
  ],
943
943
  "signatures": [
@@ -952,7 +952,7 @@
952
952
  "fileName": "huri/src/Huri.ts",
953
953
  "line": 86,
954
954
  "character": 9,
955
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L86"
955
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L86"
956
956
  }
957
957
  ],
958
958
  "parameters": [
@@ -1061,7 +1061,7 @@
1061
1061
  "fileName": "huri/src/Huri.ts",
1062
1062
  "line": 93,
1063
1063
  "character": 17,
1064
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L93"
1064
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L93"
1065
1065
  }
1066
1066
  ],
1067
1067
  "signatures": [
@@ -1076,7 +1076,7 @@
1076
1076
  "fileName": "huri/src/Huri.ts",
1077
1077
  "line": 93,
1078
1078
  "character": 17,
1079
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L93"
1079
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L93"
1080
1080
  }
1081
1081
  ],
1082
1082
  "parameters": [
@@ -1122,7 +1122,7 @@
1122
1122
  "fileName": "huri/src/Huri.ts",
1123
1123
  "line": 104,
1124
1124
  "character": 17,
1125
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L104"
1125
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L104"
1126
1126
  }
1127
1127
  ],
1128
1128
  "signatures": [
@@ -1137,7 +1137,7 @@
1137
1137
  "fileName": "huri/src/Huri.ts",
1138
1138
  "line": 104,
1139
1139
  "character": 17,
1140
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L104"
1140
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L104"
1141
1141
  }
1142
1142
  ],
1143
1143
  "parameters": [
@@ -1214,7 +1214,7 @@
1214
1214
  "fileName": "huri/src/Huri.ts",
1215
1215
  "line": 31,
1216
1216
  "character": 13,
1217
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L31"
1217
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L31"
1218
1218
  }
1219
1219
  ],
1220
1220
  "typeParameters": [
@@ -1265,7 +1265,7 @@
1265
1265
  "fileName": "huri/src/Huri.ts",
1266
1266
  "line": 27,
1267
1267
  "character": 2,
1268
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L27"
1268
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L27"
1269
1269
  }
1270
1270
  ],
1271
1271
  "type": {
@@ -1347,7 +1347,7 @@
1347
1347
  "fileName": "huri/src/Huri.ts",
1348
1348
  "line": 28,
1349
1349
  "character": 2,
1350
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L28"
1350
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L28"
1351
1351
  }
1352
1352
  ],
1353
1353
  "type": {
@@ -1372,7 +1372,7 @@
1372
1372
  "fileName": "huri/src/Huri.ts",
1373
1373
  "line": 26,
1374
1374
  "character": 17,
1375
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L26"
1375
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L26"
1376
1376
  }
1377
1377
  ],
1378
1378
  "typeParameters": [
@@ -1423,7 +1423,7 @@
1423
1423
  "fileName": "huri/src/Huri.ts",
1424
1424
  "line": 22,
1425
1425
  "character": 2,
1426
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L22"
1426
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L22"
1427
1427
  }
1428
1428
  ],
1429
1429
  "type": {
@@ -1444,7 +1444,7 @@
1444
1444
  "fileName": "huri/src/Huri.ts",
1445
1445
  "line": 23,
1446
1446
  "character": 2,
1447
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L23"
1447
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L23"
1448
1448
  }
1449
1449
  ],
1450
1450
  "type": {
@@ -1467,7 +1467,7 @@
1467
1467
  "fileName": "huri/src/Huri.ts",
1468
1468
  "line": 21,
1469
1469
  "character": 17,
1470
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L21"
1470
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L21"
1471
1471
  }
1472
1472
  ]
1473
1473
  },
@@ -1482,7 +1482,7 @@
1482
1482
  "fileName": "huri/src/Huri.ts",
1483
1483
  "line": 9,
1484
1484
  "character": 12,
1485
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L9"
1485
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L9"
1486
1486
  }
1487
1487
  ],
1488
1488
  "type": {
@@ -1498,7 +1498,7 @@
1498
1498
  "fileName": "huri/src/Huri.ts",
1499
1499
  "line": 9,
1500
1500
  "character": 32,
1501
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L9"
1501
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L9"
1502
1502
  }
1503
1503
  ],
1504
1504
  "signatures": [
@@ -1568,7 +1568,7 @@
1568
1568
  "fileName": "huri/src/Huri.ts",
1569
1569
  "line": 7,
1570
1570
  "character": 12,
1571
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/329e1cefafe53/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L7"
1571
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/blob/b1d6f519bacda/packages/protocol/packages/payload/packages/huri/src/Huri.ts#L7"
1572
1572
  }
1573
1573
  ],
1574
1574
  "type": {
package/package.json CHANGED
@@ -10,16 +10,16 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^2.12.22",
14
- "@xyo-network/account": "~2.75.15",
15
- "@xyo-network/axios": "~2.75.15",
16
- "@xyo-network/core": "~2.75.15",
17
- "@xyo-network/payload-model": "~2.75.15"
13
+ "@xylabs/assert": "^2.12.23",
14
+ "@xyo-network/account": "~2.75.16",
15
+ "@xyo-network/axios": "~2.75.16",
16
+ "@xyo-network/core": "~2.75.16",
17
+ "@xyo-network/payload-model": "~2.75.16"
18
18
  },
19
19
  "devDependencies": {
20
- "@xylabs/delay": "^2.12.22",
21
- "@xylabs/ts-scripts-yarn3": "^3.0.88",
22
- "@xylabs/tsconfig": "^3.0.88",
20
+ "@xylabs/delay": "^2.12.23",
21
+ "@xylabs/ts-scripts-yarn3": "^3.1.3",
22
+ "@xylabs/tsconfig": "^3.1.3",
23
23
  "typescript": "^5.2.2"
24
24
  },
25
25
  "description": "Primary SDK for using XYO Protocol 2.0",
@@ -65,5 +65,5 @@
65
65
  },
66
66
  "sideEffects": false,
67
67
  "types": "dist/node/index.d.ts",
68
- "version": "2.75.15"
68
+ "version": "2.75.16"
69
69
  }
@@ -1,122 +0,0 @@
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);
19
-
20
- // src/Huri.ts
21
- var Huri_exports = {};
22
- __export(Huri_exports, {
23
- Huri: () => Huri
24
- });
25
- module.exports = __toCommonJS(Huri_exports);
26
- var import_assert = require("@xylabs/assert");
27
- var import_account = require("@xyo-network/account");
28
- var import_axios = require("@xyo-network/axios");
29
- var Huri = class _Huri {
30
- archive;
31
- archivist;
32
- hash;
33
- originalHref;
34
- protocol;
35
- token;
36
- isHuri = true;
37
- constructor(huri, { archivistUri, token } = {}) {
38
- const huriString = _Huri.isHuri(huri)?.href ?? typeof huri === "string" ? huri : new import_account.AddressValue(huri).hex;
39
- this.originalHref = huriString;
40
- const protocol = _Huri.parseProtocol(huriString);
41
- this.protocol = protocol ?? "https";
42
- const path = (0, import_assert.assertEx)(_Huri.parsePath(huriString), "Missing path");
43
- this.hash = this.parsePath(path, protocol !== void 0);
44
- if (archivistUri) {
45
- const archivistUriParts = archivistUri.split("://");
46
- this.protocol = archivistUriParts[0];
47
- this.archivist = archivistUriParts[1];
48
- }
49
- this.token = token;
50
- this.validateParse();
51
- }
52
- /*
53
- The full href or the hash
54
- */
55
- get href() {
56
- const parts = [];
57
- if (this.protocol) {
58
- parts.push(`${this.protocol}:/`);
59
- }
60
- if (this.archive) {
61
- parts.push(`${this.archive}`);
62
- }
63
- if (this.archivist) {
64
- parts.push(`${this.archivist}`);
65
- }
66
- parts.push(this.hash);
67
- return parts.join("/");
68
- }
69
- static async fetch(huri) {
70
- const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : void 0;
71
- return (await import_axios.axios.get(huri.href, { headers: AuthHeader })).data;
72
- }
73
- static isHuri(value) {
74
- if (typeof value === "object") {
75
- return value.isHuri ? value : void 0;
76
- }
77
- return void 0;
78
- }
79
- static parsePath(huri) {
80
- const protocolSplit = huri.split("//");
81
- (0, import_assert.assertEx)(protocolSplit.length <= 2, `Invalid format [${huri}]`);
82
- if (protocolSplit.length === 1) {
83
- return huri;
84
- }
85
- if (protocolSplit.length === 2) {
86
- return protocolSplit[1];
87
- }
88
- }
89
- static parseProtocol(huri) {
90
- const protocolSplit = huri.split("//");
91
- (0, import_assert.assertEx)(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`);
92
- const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : void 0;
93
- if (rawProtocol) {
94
- const protocolParts = rawProtocol?.split(":");
95
- (0, import_assert.assertEx)(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`);
96
- (0, import_assert.assertEx)(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`);
97
- return protocolParts.shift();
98
- }
99
- }
100
- async fetch() {
101
- return await _Huri.fetch(this);
102
- }
103
- toString() {
104
- return this.href;
105
- }
106
- parsePath(path, hasProtocol) {
107
- const pathParts = path.split("/");
108
- (0, import_assert.assertEx)(!(hasProtocol && pathParts[0].length === 0), "Invalid protocol separator");
109
- pathParts[0].length === 0 ? pathParts.shift() : null;
110
- const hash = (0, import_assert.assertEx)(pathParts.pop(), "No hash specified");
111
- this.archivist = pathParts.shift() ?? "api.archivist.xyo.network";
112
- this.archive = pathParts.pop();
113
- (0, import_assert.assertEx)(pathParts.length === 0, "Too many path parts");
114
- return hash;
115
- }
116
- validateParse() {
117
- (0, import_assert.assertEx)(this.archivist?.length !== 0, "Invalid archivist length");
118
- (0, import_assert.assertEx)(this.archive?.length !== 0, "Invalid archive length");
119
- (0, import_assert.assertEx)(!(this.archive && !this.archivist), "If specifying archive, archivist is also required");
120
- }
121
- };
122
- //# sourceMappingURL=Huri.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Huri.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AddressValue } from '@xyo-network/account'\nimport { axios } from '@xyo-network/axios'\nimport { DataLike } from '@xyo-network/core'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type ObjectCategory = 'block' | 'payload'\n\nexport type HuriFetchFunction = (huri: Huri) => Promise<Payload | undefined>\n\n/* \n Valid Huri:\n\n [<protocol>://][<archivist>/[<archive>/]]<hash>\n\n defaults:\n protocol: https\n archivist: api.archivist.xyo.network\n*/\n\nexport interface HuriOptions {\n archivistUri?: string\n token?: string\n}\n\nexport interface FetchedPayload<T extends Payload = Payload> {\n huri?: Huri\n payload: T\n}\n\nexport class Huri<T extends Payload = Payload> {\n archive?: string\n archivist?: string\n hash: string\n originalHref: string\n protocol?: string\n token?: string\n\n private isHuri = true\n\n constructor(huri: DataLike | Huri, { archivistUri, token }: HuriOptions = {}) {\n const huriString = Huri.isHuri(huri)?.href ?? typeof huri === 'string' ? (huri as string) : new AddressValue(huri as DataLike).hex\n this.originalHref = huriString\n\n const protocol = Huri.parseProtocol(huriString)\n this.protocol = protocol ?? 'https'\n\n const path = assertEx(Huri.parsePath(huriString), 'Missing path')\n this.hash = this.parsePath(path, protocol !== undefined)\n\n //if archivistUri sent, overwrite protocol and archivist\n if (archivistUri) {\n const archivistUriParts = archivistUri.split('://')\n this.protocol = archivistUriParts[0]\n this.archivist = archivistUriParts[1]\n }\n\n this.token = token\n\n this.validateParse()\n }\n\n /*\n The full href or the hash\n */\n get href() {\n const parts: string[] = []\n if (this.protocol) {\n parts.push(`${this.protocol}:/`)\n }\n if (this.archive) {\n parts.push(`${this.archive}`)\n }\n if (this.archivist) {\n parts.push(`${this.archivist}`)\n }\n parts.push(this.hash)\n return parts.join('/')\n }\n\n static async fetch<T extends Payload = Payload>(huri: Huri): Promise<T | undefined> {\n const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : undefined\n return (await axios.get<T>(huri.href, { headers: AuthHeader })).data\n }\n\n static isHuri(value: unknown) {\n if (typeof value === 'object') {\n return (value as Huri).isHuri ? (value as Huri) : undefined\n }\n return undefined\n }\n\n private static parsePath(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid format [${huri}]`)\n if (protocolSplit.length === 1) {\n return huri\n }\n if (protocolSplit.length === 2) {\n return protocolSplit[1]\n }\n }\n\n private static parseProtocol(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`)\n const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : undefined\n if (rawProtocol) {\n const protocolParts = rawProtocol?.split(':')\n assertEx(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`)\n assertEx(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`)\n return protocolParts.shift()\n }\n }\n\n async fetch(): Promise<T | undefined> {\n return await Huri.fetch<T>(this)\n }\n\n toString() {\n return this.href\n }\n\n private parsePath(path: string, hasProtocol: boolean) {\n const pathParts = path.split('/')\n\n //if the protocol was found, then there is not allowed to be a leading /\n assertEx(!(hasProtocol && pathParts[0].length === 0), 'Invalid protocol separator')\n\n //remove leading '/' if needed\n pathParts[0].length === 0 ? pathParts.shift() : null\n\n //hash is assumed to be the last part\n const hash = assertEx(pathParts.pop(), 'No hash specified')\n\n //archivist is assumed to be the first part\n this.archivist = pathParts.shift() ?? 'api.archivist.xyo.network'\n\n //the archive is whatever is left\n this.archive = pathParts.pop()\n\n //after we pull off all the path parts, there should be nothing left\n assertEx(pathParts.length === 0, 'Too many path parts')\n\n return hash\n }\n\n private validateParse() {\n //the archivist should not be zero length\n assertEx(this.archivist?.length !== 0, 'Invalid archivist length')\n\n //the archivist should not be zero length (can be undefined)\n assertEx(this.archive?.length !== 0, 'Invalid archive length')\n\n //the archive should not be set if the archivist is not set\n assertEx(!(this.archive && !this.archivist), 'If specifying archive, archivist is also required')\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,qBAA6B;AAC7B,mBAAsB;AA4Bf,IAAM,OAAN,MAAM,MAAkC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEQ,SAAS;AAAA,EAEjB,YAAY,MAAuB,EAAE,cAAc,MAAM,IAAiB,CAAC,GAAG;AAC5E,UAAM,aAAa,MAAK,OAAO,IAAI,GAAG,QAAQ,OAAO,SAAS,WAAY,OAAkB,IAAI,4BAAa,IAAgB,EAAE;AAC/H,SAAK,eAAe;AAEpB,UAAM,WAAW,MAAK,cAAc,UAAU;AAC9C,SAAK,WAAW,YAAY;AAE5B,UAAM,WAAO,wBAAS,MAAK,UAAU,UAAU,GAAG,cAAc;AAChE,SAAK,OAAO,KAAK,UAAU,MAAM,aAAa,MAAS;AAGvD,QAAI,cAAc;AAChB,YAAM,oBAAoB,aAAa,MAAM,KAAK;AAClD,WAAK,WAAW,kBAAkB,CAAC;AACnC,WAAK,YAAY,kBAAkB,CAAC;AAAA,IACtC;AAEA,SAAK,QAAQ;AAEb,SAAK,cAAc;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,OAAO;AACT,UAAM,QAAkB,CAAC;AACzB,QAAI,KAAK,UAAU;AACjB,YAAM,KAAK,GAAG,KAAK,QAAQ,IAAI;AAAA,IACjC;AACA,QAAI,KAAK,SAAS;AAChB,YAAM,KAAK,GAAG,KAAK,OAAO,EAAE;AAAA,IAC9B;AACA,QAAI,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AAA,EACd;AAAA,EAEQ,UAAU,MAAc,aAAsB;AACpD,UAAM,YAAY,KAAK,MAAM,GAAG;AAGhC,gCAAS,EAAE,eAAe,UAAU,CAAC,EAAE,WAAW,IAAI,4BAA4B;AAGlF,cAAU,CAAC,EAAE,WAAW,IAAI,UAAU,MAAM,IAAI;AAGhD,UAAM,WAAO,wBAAS,UAAU,IAAI,GAAG,mBAAmB;AAG1D,SAAK,YAAY,UAAU,MAAM,KAAK;AAGtC,SAAK,UAAU,UAAU,IAAI;AAG7B,gCAAS,UAAU,WAAW,GAAG,qBAAqB;AAEtD,WAAO;AAAA,EACT;AAAA,EAEQ,gBAAgB;AAEtB,gCAAS,KAAK,WAAW,WAAW,GAAG,0BAA0B;AAGjE,gCAAS,KAAK,SAAS,WAAW,GAAG,wBAAwB;AAG7D,gCAAS,EAAE,KAAK,WAAW,CAAC,KAAK,YAAY,mDAAmD;AAAA,EAClG;AACF;","names":[]}
@@ -1,101 +0,0 @@
1
- // src/Huri.ts
2
- import { assertEx } from "@xylabs/assert";
3
- import { AddressValue } from "@xyo-network/account";
4
- import { axios } from "@xyo-network/axios";
5
- var Huri = class _Huri {
6
- archive;
7
- archivist;
8
- hash;
9
- originalHref;
10
- protocol;
11
- token;
12
- isHuri = true;
13
- constructor(huri, { archivistUri, token } = {}) {
14
- const huriString = _Huri.isHuri(huri)?.href ?? typeof huri === "string" ? huri : new AddressValue(huri).hex;
15
- this.originalHref = huriString;
16
- const protocol = _Huri.parseProtocol(huriString);
17
- this.protocol = protocol ?? "https";
18
- const path = assertEx(_Huri.parsePath(huriString), "Missing path");
19
- this.hash = this.parsePath(path, protocol !== void 0);
20
- if (archivistUri) {
21
- const archivistUriParts = archivistUri.split("://");
22
- this.protocol = archivistUriParts[0];
23
- this.archivist = archivistUriParts[1];
24
- }
25
- this.token = token;
26
- this.validateParse();
27
- }
28
- /*
29
- The full href or the hash
30
- */
31
- get href() {
32
- const parts = [];
33
- if (this.protocol) {
34
- parts.push(`${this.protocol}:/`);
35
- }
36
- if (this.archive) {
37
- parts.push(`${this.archive}`);
38
- }
39
- if (this.archivist) {
40
- parts.push(`${this.archivist}`);
41
- }
42
- parts.push(this.hash);
43
- return parts.join("/");
44
- }
45
- static async fetch(huri) {
46
- const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : void 0;
47
- return (await axios.get(huri.href, { headers: AuthHeader })).data;
48
- }
49
- static isHuri(value) {
50
- if (typeof value === "object") {
51
- return value.isHuri ? value : void 0;
52
- }
53
- return void 0;
54
- }
55
- static parsePath(huri) {
56
- const protocolSplit = huri.split("//");
57
- assertEx(protocolSplit.length <= 2, `Invalid format [${huri}]`);
58
- if (protocolSplit.length === 1) {
59
- return huri;
60
- }
61
- if (protocolSplit.length === 2) {
62
- return protocolSplit[1];
63
- }
64
- }
65
- static parseProtocol(huri) {
66
- const protocolSplit = huri.split("//");
67
- assertEx(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`);
68
- const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : void 0;
69
- if (rawProtocol) {
70
- const protocolParts = rawProtocol?.split(":");
71
- assertEx(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`);
72
- assertEx(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`);
73
- return protocolParts.shift();
74
- }
75
- }
76
- async fetch() {
77
- return await _Huri.fetch(this);
78
- }
79
- toString() {
80
- return this.href;
81
- }
82
- parsePath(path, hasProtocol) {
83
- const pathParts = path.split("/");
84
- assertEx(!(hasProtocol && pathParts[0].length === 0), "Invalid protocol separator");
85
- pathParts[0].length === 0 ? pathParts.shift() : null;
86
- const hash = assertEx(pathParts.pop(), "No hash specified");
87
- this.archivist = pathParts.shift() ?? "api.archivist.xyo.network";
88
- this.archive = pathParts.pop();
89
- assertEx(pathParts.length === 0, "Too many path parts");
90
- return hash;
91
- }
92
- validateParse() {
93
- assertEx(this.archivist?.length !== 0, "Invalid archivist length");
94
- assertEx(this.archive?.length !== 0, "Invalid archive length");
95
- assertEx(!(this.archive && !this.archivist), "If specifying archive, archivist is also required");
96
- }
97
- };
98
- export {
99
- Huri
100
- };
101
- //# sourceMappingURL=Huri.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Huri.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AddressValue } from '@xyo-network/account'\nimport { axios } from '@xyo-network/axios'\nimport { DataLike } from '@xyo-network/core'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type ObjectCategory = 'block' | 'payload'\n\nexport type HuriFetchFunction = (huri: Huri) => Promise<Payload | undefined>\n\n/* \n Valid Huri:\n\n [<protocol>://][<archivist>/[<archive>/]]<hash>\n\n defaults:\n protocol: https\n archivist: api.archivist.xyo.network\n*/\n\nexport interface HuriOptions {\n archivistUri?: string\n token?: string\n}\n\nexport interface FetchedPayload<T extends Payload = Payload> {\n huri?: Huri\n payload: T\n}\n\nexport class Huri<T extends Payload = Payload> {\n archive?: string\n archivist?: string\n hash: string\n originalHref: string\n protocol?: string\n token?: string\n\n private isHuri = true\n\n constructor(huri: DataLike | Huri, { archivistUri, token }: HuriOptions = {}) {\n const huriString = Huri.isHuri(huri)?.href ?? typeof huri === 'string' ? (huri as string) : new AddressValue(huri as DataLike).hex\n this.originalHref = huriString\n\n const protocol = Huri.parseProtocol(huriString)\n this.protocol = protocol ?? 'https'\n\n const path = assertEx(Huri.parsePath(huriString), 'Missing path')\n this.hash = this.parsePath(path, protocol !== undefined)\n\n //if archivistUri sent, overwrite protocol and archivist\n if (archivistUri) {\n const archivistUriParts = archivistUri.split('://')\n this.protocol = archivistUriParts[0]\n this.archivist = archivistUriParts[1]\n }\n\n this.token = token\n\n this.validateParse()\n }\n\n /*\n The full href or the hash\n */\n get href() {\n const parts: string[] = []\n if (this.protocol) {\n parts.push(`${this.protocol}:/`)\n }\n if (this.archive) {\n parts.push(`${this.archive}`)\n }\n if (this.archivist) {\n parts.push(`${this.archivist}`)\n }\n parts.push(this.hash)\n return parts.join('/')\n }\n\n static async fetch<T extends Payload = Payload>(huri: Huri): Promise<T | undefined> {\n const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : undefined\n return (await axios.get<T>(huri.href, { headers: AuthHeader })).data\n }\n\n static isHuri(value: unknown) {\n if (typeof value === 'object') {\n return (value as Huri).isHuri ? (value as Huri) : undefined\n }\n return undefined\n }\n\n private static parsePath(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid format [${huri}]`)\n if (protocolSplit.length === 1) {\n return huri\n }\n if (protocolSplit.length === 2) {\n return protocolSplit[1]\n }\n }\n\n private static parseProtocol(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`)\n const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : undefined\n if (rawProtocol) {\n const protocolParts = rawProtocol?.split(':')\n assertEx(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`)\n assertEx(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`)\n return protocolParts.shift()\n }\n }\n\n async fetch(): Promise<T | undefined> {\n return await Huri.fetch<T>(this)\n }\n\n toString() {\n return this.href\n }\n\n private parsePath(path: string, hasProtocol: boolean) {\n const pathParts = path.split('/')\n\n //if the protocol was found, then there is not allowed to be a leading /\n assertEx(!(hasProtocol && pathParts[0].length === 0), 'Invalid protocol separator')\n\n //remove leading '/' if needed\n pathParts[0].length === 0 ? pathParts.shift() : null\n\n //hash is assumed to be the last part\n const hash = assertEx(pathParts.pop(), 'No hash specified')\n\n //archivist is assumed to be the first part\n this.archivist = pathParts.shift() ?? 'api.archivist.xyo.network'\n\n //the archive is whatever is left\n this.archive = pathParts.pop()\n\n //after we pull off all the path parts, there should be nothing left\n assertEx(pathParts.length === 0, 'Too many path parts')\n\n return hash\n }\n\n private validateParse() {\n //the archivist should not be zero length\n assertEx(this.archivist?.length !== 0, 'Invalid archivist length')\n\n //the archivist should not be zero length (can be undefined)\n assertEx(this.archive?.length !== 0, 'Invalid archive length')\n\n //the archive should not be set if the archivist is not set\n assertEx(!(this.archive && !this.archivist), 'If specifying archive, archivist is also required')\n }\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AA4Bf,IAAM,OAAN,MAAM,MAAkC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEQ,SAAS;AAAA,EAEjB,YAAY,MAAuB,EAAE,cAAc,MAAM,IAAiB,CAAC,GAAG;AAC5E,UAAM,aAAa,MAAK,OAAO,IAAI,GAAG,QAAQ,OAAO,SAAS,WAAY,OAAkB,IAAI,aAAa,IAAgB,EAAE;AAC/H,SAAK,eAAe;AAEpB,UAAM,WAAW,MAAK,cAAc,UAAU;AAC9C,SAAK,WAAW,YAAY;AAE5B,UAAM,OAAO,SAAS,MAAK,UAAU,UAAU,GAAG,cAAc;AAChE,SAAK,OAAO,KAAK,UAAU,MAAM,aAAa,MAAS;AAGvD,QAAI,cAAc;AAChB,YAAM,oBAAoB,aAAa,MAAM,KAAK;AAClD,WAAK,WAAW,kBAAkB,CAAC;AACnC,WAAK,YAAY,kBAAkB,CAAC;AAAA,IACtC;AAEA,SAAK,QAAQ;AAEb,SAAK,cAAc;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,OAAO;AACT,UAAM,QAAkB,CAAC;AACzB,QAAI,KAAK,UAAU;AACjB,YAAM,KAAK,GAAG,KAAK,QAAQ,IAAI;AAAA,IACjC;AACA,QAAI,KAAK,SAAS;AAChB,YAAM,KAAK,GAAG,KAAK,OAAO,EAAE;AAAA,IAC9B;AACA,QAAI,KAAK,WAAW;AAClB,YAAM,KAAK,GAAG,KAAK,SAAS,EAAE;AAAA,IAChC;AACA,UAAM,KAAK,KAAK,IAAI;AACpB,WAAO,MAAM,KAAK,GAAG;AAAA,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A4B;AAGlF,cAAU,CAAC,EAAE,WAAW,IAAI,UAAU,MAAM,IAAI;AAGhD,UAAM,OAAO,SAAS,UAAU,IAAI,GAAG,mBAAmB;AAG1D,SAAK,YAAY,UAAU,MAAM,KAAK;AAGtC,SAAK,UAAU,UAAU,IAAI;AAG7B,aAAS,UAAU,WAAW,GAAG,qBAAqB;AAEtD,WAAO;AAAA,EACT;AAAA,EAEQ,gBAAgB;AAEtB,aAAS,KAAK,WAAW,WAAW,GAAG,0BAA0B;AAGjE,aAAS,KAAK,SAAS,WAAW,GAAG,wBAAwB;AAG7D,aAAS,EAAE,KAAK,WAAW,CAAC,KAAK,YAAY,mDAAmD;AAAA,EAClG;AACF;","names":[]}
package/dist/node/Huri.js DELETED
@@ -1,128 +0,0 @@
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);
19
-
20
- // src/Huri.ts
21
- var Huri_exports = {};
22
- __export(Huri_exports, {
23
- Huri: () => Huri
24
- });
25
- module.exports = __toCommonJS(Huri_exports);
26
- var import_assert = require("@xylabs/assert");
27
- var import_account = require("@xyo-network/account");
28
- var import_axios = require("@xyo-network/axios");
29
- var Huri = class _Huri {
30
- archive;
31
- archivist;
32
- hash;
33
- originalHref;
34
- protocol;
35
- token;
36
- isHuri = true;
37
- constructor(huri, { archivistUri, token } = {}) {
38
- var _a;
39
- const huriString = ((_a = _Huri.isHuri(huri)) == null ? void 0 : _a.href) ?? typeof huri === "string" ? huri : new import_account.AddressValue(huri).hex;
40
- this.originalHref = huriString;
41
- const protocol = _Huri.parseProtocol(huriString);
42
- this.protocol = protocol ?? "https";
43
- const path = (0, import_assert.assertEx)(_Huri.parsePath(huriString), "Missing path");
44
- this.hash = this.parsePath(path, protocol !== void 0);
45
- if (archivistUri) {
46
- const archivistUriParts = archivistUri.split("://");
47
- this.protocol = archivistUriParts[0];
48
- this.archivist = archivistUriParts[1];
49
- }
50
- this.token = token;
51
- this.validateParse();
52
- }
53
- /*
54
- The full href or the hash
55
- */
56
- get href() {
57
- const parts = [];
58
- if (this.protocol) {
59
- parts.push(`${this.protocol}:/`);
60
- }
61
- if (this.archive) {
62
- parts.push(`${this.archive}`);
63
- }
64
- if (this.archivist) {
65
- parts.push(`${this.archivist}`);
66
- }
67
- parts.push(this.hash);
68
- return parts.join("/");
69
- }
70
- static async fetch(huri) {
71
- const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : void 0;
72
- return (await import_axios.axios.get(huri.href, { headers: AuthHeader })).data;
73
- }
74
- static isHuri(value) {
75
- if (typeof value === "object") {
76
- return value.isHuri ? value : void 0;
77
- }
78
- return void 0;
79
- }
80
- static parsePath(huri) {
81
- const protocolSplit = huri.split("//");
82
- (0, import_assert.assertEx)(protocolSplit.length <= 2, `Invalid format [${huri}]`);
83
- if (protocolSplit.length === 1) {
84
- return huri;
85
- }
86
- if (protocolSplit.length === 2) {
87
- return protocolSplit[1];
88
- }
89
- }
90
- static parseProtocol(huri) {
91
- const protocolSplit = huri.split("//");
92
- (0, import_assert.assertEx)(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`);
93
- const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : void 0;
94
- if (rawProtocol) {
95
- const protocolParts = rawProtocol == null ? void 0 : rawProtocol.split(":");
96
- (0, import_assert.assertEx)(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`);
97
- (0, import_assert.assertEx)(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`);
98
- return protocolParts.shift();
99
- }
100
- }
101
- async fetch() {
102
- return await _Huri.fetch(this);
103
- }
104
- toString() {
105
- return this.href;
106
- }
107
- parsePath(path, hasProtocol) {
108
- const pathParts = path.split("/");
109
- (0, import_assert.assertEx)(!(hasProtocol && pathParts[0].length === 0), "Invalid protocol separator");
110
- pathParts[0].length === 0 ? pathParts.shift() : null;
111
- const hash = (0, import_assert.assertEx)(pathParts.pop(), "No hash specified");
112
- this.archivist = pathParts.shift() ?? "api.archivist.xyo.network";
113
- this.archive = pathParts.pop();
114
- (0, import_assert.assertEx)(pathParts.length === 0, "Too many path parts");
115
- return hash;
116
- }
117
- validateParse() {
118
- var _a, _b;
119
- (0, import_assert.assertEx)(((_a = this.archivist) == null ? void 0 : _a.length) !== 0, "Invalid archivist length");
120
- (0, import_assert.assertEx)(((_b = this.archive) == null ? void 0 : _b.length) !== 0, "Invalid archive length");
121
- (0, import_assert.assertEx)(!(this.archive && !this.archivist), "If specifying archive, archivist is also required");
122
- }
123
- };
124
- // Annotate the CommonJS export names for ESM import in node:
125
- 0 && (module.exports = {
126
- Huri
127
- });
128
- //# sourceMappingURL=Huri.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Huri.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AddressValue } from '@xyo-network/account'\nimport { axios } from '@xyo-network/axios'\nimport { DataLike } from '@xyo-network/core'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type ObjectCategory = 'block' | 'payload'\n\nexport type HuriFetchFunction = (huri: Huri) => Promise<Payload | undefined>\n\n/* \n Valid Huri:\n\n [<protocol>://][<archivist>/[<archive>/]]<hash>\n\n defaults:\n protocol: https\n archivist: api.archivist.xyo.network\n*/\n\nexport interface HuriOptions {\n archivistUri?: string\n token?: string\n}\n\nexport interface FetchedPayload<T extends Payload = Payload> {\n huri?: Huri\n payload: T\n}\n\nexport class Huri<T extends Payload = Payload> {\n archive?: string\n archivist?: string\n hash: string\n originalHref: string\n protocol?: string\n token?: string\n\n private isHuri = true\n\n constructor(huri: DataLike | Huri, { archivistUri, token }: HuriOptions = {}) {\n const huriString = Huri.isHuri(huri)?.href ?? typeof huri === 'string' ? (huri as string) : new AddressValue(huri as DataLike).hex\n this.originalHref = huriString\n\n const protocol = Huri.parseProtocol(huriString)\n this.protocol = protocol ?? 'https'\n\n const path = assertEx(Huri.parsePath(huriString), 'Missing path')\n this.hash = this.parsePath(path, protocol !== undefined)\n\n //if archivistUri sent, overwrite protocol and archivist\n if (archivistUri) {\n const archivistUriParts = archivistUri.split('://')\n this.protocol = archivistUriParts[0]\n this.archivist = archivistUriParts[1]\n }\n\n this.token = token\n\n this.validateParse()\n }\n\n /*\n The full href or the hash\n */\n get href() {\n const parts: string[] = []\n if (this.protocol) {\n parts.push(`${this.protocol}:/`)\n }\n if (this.archive) {\n parts.push(`${this.archive}`)\n }\n if (this.archivist) {\n parts.push(`${this.archivist}`)\n }\n parts.push(this.hash)\n return parts.join('/')\n }\n\n static async fetch<T extends Payload = Payload>(huri: Huri): Promise<T | undefined> {\n const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : undefined\n return (await axios.get<T>(huri.href, { headers: AuthHeader })).data\n }\n\n static isHuri(value: unknown) {\n if (typeof value === 'object') {\n return (value as Huri).isHuri ? (value as Huri) : undefined\n }\n return undefined\n }\n\n private static parsePath(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid format [${huri}]`)\n if (protocolSplit.length === 1) {\n return huri\n }\n if (protocolSplit.length === 2) {\n return protocolSplit[1]\n }\n }\n\n private static parseProtocol(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`)\n const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : undefined\n if (rawProtocol) {\n const protocolParts = rawProtocol?.split(':')\n assertEx(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`)\n assertEx(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`)\n return protocolParts.shift()\n }\n }\n\n async fetch(): Promise<T | undefined> {\n return await Huri.fetch<T>(this)\n }\n\n toString() {\n return this.href\n }\n\n private parsePath(path: string, hasProtocol: boolean) {\n const pathParts = path.split('/')\n\n //if the protocol was found, then there is not allowed to be a leading /\n assertEx(!(hasProtocol && pathParts[0].length === 0), 'Invalid protocol separator')\n\n //remove leading '/' if needed\n pathParts[0].length === 0 ? pathParts.shift() : null\n\n //hash is assumed to be the last part\n const hash = assertEx(pathParts.pop(), 'No hash specified')\n\n //archivist is assumed to be the first part\n this.archivist = pathParts.shift() ?? 'api.archivist.xyo.network'\n\n //the archive is whatever is left\n this.archive = pathParts.pop()\n\n //after we pull off all the path parts, there should be nothing left\n assertEx(pathParts.length === 0, 'Too many path parts')\n\n return hash\n }\n\n private validateParse() {\n //the archivist should not be zero length\n assertEx(this.archivist?.length !== 0, 'Invalid archivist length')\n\n //the archivist should not be zero length (can be undefined)\n assertEx(this.archive?.length !== 0, 'Invalid archive length')\n\n //the archive should not be set if the archivist is not set\n assertEx(!(this.archive && !this.archivist), 'If specifying archive, archivist is also required')\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,qBAA6B;AAC7B,mBAAsB;AA4Bf,IAAM,OAAN,MAAM,MAAkC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEQ,SAAS;AAAA,EAEjB,YAAY,MAAuB,EAAE,cAAc,MAAM,IAAiB,CAAC,GAAG;AAxChF;AAyCI,UAAM,eAAa,WAAK,OAAO,IAAI,MAAhB,mBAAmB,SAAQ,OAAO,SAAS,WAAY,OAAk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":[]}
@@ -1,103 +0,0 @@
1
- // src/Huri.ts
2
- import { assertEx } from "@xylabs/assert";
3
- import { AddressValue } from "@xyo-network/account";
4
- import { axios } from "@xyo-network/axios";
5
- var Huri = class _Huri {
6
- archive;
7
- archivist;
8
- hash;
9
- originalHref;
10
- protocol;
11
- token;
12
- isHuri = true;
13
- constructor(huri, { archivistUri, token } = {}) {
14
- var _a;
15
- const huriString = ((_a = _Huri.isHuri(huri)) == null ? void 0 : _a.href) ?? typeof huri === "string" ? huri : new AddressValue(huri).hex;
16
- this.originalHref = huriString;
17
- const protocol = _Huri.parseProtocol(huriString);
18
- this.protocol = protocol ?? "https";
19
- const path = assertEx(_Huri.parsePath(huriString), "Missing path");
20
- this.hash = this.parsePath(path, protocol !== void 0);
21
- if (archivistUri) {
22
- const archivistUriParts = archivistUri.split("://");
23
- this.protocol = archivistUriParts[0];
24
- this.archivist = archivistUriParts[1];
25
- }
26
- this.token = token;
27
- this.validateParse();
28
- }
29
- /*
30
- The full href or the hash
31
- */
32
- get href() {
33
- const parts = [];
34
- if (this.protocol) {
35
- parts.push(`${this.protocol}:/`);
36
- }
37
- if (this.archive) {
38
- parts.push(`${this.archive}`);
39
- }
40
- if (this.archivist) {
41
- parts.push(`${this.archivist}`);
42
- }
43
- parts.push(this.hash);
44
- return parts.join("/");
45
- }
46
- static async fetch(huri) {
47
- const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : void 0;
48
- return (await axios.get(huri.href, { headers: AuthHeader })).data;
49
- }
50
- static isHuri(value) {
51
- if (typeof value === "object") {
52
- return value.isHuri ? value : void 0;
53
- }
54
- return void 0;
55
- }
56
- static parsePath(huri) {
57
- const protocolSplit = huri.split("//");
58
- assertEx(protocolSplit.length <= 2, `Invalid format [${huri}]`);
59
- if (protocolSplit.length === 1) {
60
- return huri;
61
- }
62
- if (protocolSplit.length === 2) {
63
- return protocolSplit[1];
64
- }
65
- }
66
- static parseProtocol(huri) {
67
- const protocolSplit = huri.split("//");
68
- assertEx(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`);
69
- const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : void 0;
70
- if (rawProtocol) {
71
- const protocolParts = rawProtocol == null ? void 0 : rawProtocol.split(":");
72
- assertEx(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`);
73
- assertEx(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`);
74
- return protocolParts.shift();
75
- }
76
- }
77
- async fetch() {
78
- return await _Huri.fetch(this);
79
- }
80
- toString() {
81
- return this.href;
82
- }
83
- parsePath(path, hasProtocol) {
84
- const pathParts = path.split("/");
85
- assertEx(!(hasProtocol && pathParts[0].length === 0), "Invalid protocol separator");
86
- pathParts[0].length === 0 ? pathParts.shift() : null;
87
- const hash = assertEx(pathParts.pop(), "No hash specified");
88
- this.archivist = pathParts.shift() ?? "api.archivist.xyo.network";
89
- this.archive = pathParts.pop();
90
- assertEx(pathParts.length === 0, "Too many path parts");
91
- return hash;
92
- }
93
- validateParse() {
94
- var _a, _b;
95
- assertEx(((_a = this.archivist) == null ? void 0 : _a.length) !== 0, "Invalid archivist length");
96
- assertEx(((_b = this.archive) == null ? void 0 : _b.length) !== 0, "Invalid archive length");
97
- assertEx(!(this.archive && !this.archivist), "If specifying archive, archivist is also required");
98
- }
99
- };
100
- export {
101
- Huri
102
- };
103
- //# sourceMappingURL=Huri.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Huri.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { AddressValue } from '@xyo-network/account'\nimport { axios } from '@xyo-network/axios'\nimport { DataLike } from '@xyo-network/core'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport type ObjectCategory = 'block' | 'payload'\n\nexport type HuriFetchFunction = (huri: Huri) => Promise<Payload | undefined>\n\n/* \n Valid Huri:\n\n [<protocol>://][<archivist>/[<archive>/]]<hash>\n\n defaults:\n protocol: https\n archivist: api.archivist.xyo.network\n*/\n\nexport interface HuriOptions {\n archivistUri?: string\n token?: string\n}\n\nexport interface FetchedPayload<T extends Payload = Payload> {\n huri?: Huri\n payload: T\n}\n\nexport class Huri<T extends Payload = Payload> {\n archive?: string\n archivist?: string\n hash: string\n originalHref: string\n protocol?: string\n token?: string\n\n private isHuri = true\n\n constructor(huri: DataLike | Huri, { archivistUri, token }: HuriOptions = {}) {\n const huriString = Huri.isHuri(huri)?.href ?? typeof huri === 'string' ? (huri as string) : new AddressValue(huri as DataLike).hex\n this.originalHref = huriString\n\n const protocol = Huri.parseProtocol(huriString)\n this.protocol = protocol ?? 'https'\n\n const path = assertEx(Huri.parsePath(huriString), 'Missing path')\n this.hash = this.parsePath(path, protocol !== undefined)\n\n //if archivistUri sent, overwrite protocol and archivist\n if (archivistUri) {\n const archivistUriParts = archivistUri.split('://')\n this.protocol = archivistUriParts[0]\n this.archivist = archivistUriParts[1]\n }\n\n this.token = token\n\n this.validateParse()\n }\n\n /*\n The full href or the hash\n */\n get href() {\n const parts: string[] = []\n if (this.protocol) {\n parts.push(`${this.protocol}:/`)\n }\n if (this.archive) {\n parts.push(`${this.archive}`)\n }\n if (this.archivist) {\n parts.push(`${this.archivist}`)\n }\n parts.push(this.hash)\n return parts.join('/')\n }\n\n static async fetch<T extends Payload = Payload>(huri: Huri): Promise<T | undefined> {\n const AuthHeader = huri.token ? { Authorization: `Bearer ${huri.token}` } : undefined\n return (await axios.get<T>(huri.href, { headers: AuthHeader })).data\n }\n\n static isHuri(value: unknown) {\n if (typeof value === 'object') {\n return (value as Huri).isHuri ? (value as Huri) : undefined\n }\n return undefined\n }\n\n private static parsePath(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid format [${huri}]`)\n if (protocolSplit.length === 1) {\n return huri\n }\n if (protocolSplit.length === 2) {\n return protocolSplit[1]\n }\n }\n\n private static parseProtocol(huri: string) {\n const protocolSplit = huri.split('//')\n assertEx(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`)\n const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : undefined\n if (rawProtocol) {\n const protocolParts = rawProtocol?.split(':')\n assertEx(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`)\n assertEx(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`)\n return protocolParts.shift()\n }\n }\n\n async fetch(): Promise<T | undefined> {\n return await Huri.fetch<T>(this)\n }\n\n toString() {\n return this.href\n }\n\n private parsePath(path: string, hasProtocol: boolean) {\n const pathParts = path.split('/')\n\n //if the protocol was found, then there is not allowed to be a leading /\n assertEx(!(hasProtocol && pathParts[0].length === 0), 'Invalid protocol separator')\n\n //remove leading '/' if needed\n pathParts[0].length === 0 ? pathParts.shift() : null\n\n //hash is assumed to be the last part\n const hash = assertEx(pathParts.pop(), 'No hash specified')\n\n //archivist is assumed to be the first part\n this.archivist = pathParts.shift() ?? 'api.archivist.xyo.network'\n\n //the archive is whatever is left\n this.archive = pathParts.pop()\n\n //after we pull off all the path parts, there should be nothing left\n assertEx(pathParts.length === 0, 'Too many path parts')\n\n return hash\n }\n\n private validateParse() {\n //the archivist should not be zero length\n assertEx(this.archivist?.length !== 0, 'Invalid archivist length')\n\n //the archivist should not be zero length (can be undefined)\n assertEx(this.archive?.length !== 0, 'Invalid archive length')\n\n //the archive should not be set if the archivist is not set\n assertEx(!(this.archive && !this.archivist), 'If specifying archive, archivist is also required')\n }\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AA4Bf,IAAM,OAAN,MAAM,MAAkC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEQ,SAAS;AAAA,EAEjB,YAAY,MAAuB,EAAE,cAAc,MAAM,IAAiB,CAAC,GAAG;AAxChF;AAyCI,UAAM,eAAa,WAAK,OAAO,IAAI,MAAhB,mBAAmB,SAAQ,OAAO,SAAS,WA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