pathchain 1.0.43 → 1.0.45

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.
Files changed (4) hide show
  1. package/README.md +360 -18
  2. package/getter.js +1 -1
  3. package/maker.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -10,28 +10,35 @@ Pathchain is a tool to build path-shaped data structures that are chained one to
10
10
  ## Makers
11
11
  Maker functions recieve new data to encode into the chain.
12
12
 
13
- | Function | Parameters |
14
- | ---------------------------- | --------------------------------------- |
15
- | [`makeMoment()`](#Moment) | datetime, lat, lon, x, y, z, format |
16
- | [`makePioneer()`](#Pioneer) | format |
17
- | [`makeSecret()`](#Secret) | author, format |
18
- | [`makeEntity()`](#Entity) | xsecret, format |
19
- | [`makeNode()`](#Node) | text, xauthor, format |
20
- | [`makePath()`](#Path) | xauthor, text, head, ancestor, format |
13
+ | Function | Parameters |
14
+ | ----------------------------- | --------------------------------------- |
15
+ | [`makeMoment()`](#Moment) | datetime, lat, lon, x, y, z, format |
16
+ | [`makePioneer()`](#Pioneer) | format |
17
+ | [`makeSecret()`](#Secret) | author, format |
18
+ | [`makeEntity()`](#Entity) | xsecret, format |
19
+ | [`makeNode()`](#Node) | text, xauthor, format |
20
+ | [`makeNodelink()`](#Nodelink) | first, second, author, ancestor, format |
21
+ | [`makePath()`](#Path) | xauthor, text, head, ancestor, format |
22
+ | [`makePathlink()`](#Pathlink) | first, second, author, ancestor, format |
23
+ | [`makeTree()`](#Tree) | xauthor, text, head, ancestor, format |
21
24
 
22
25
 
23
26
 
24
27
  ## Getters
25
28
  Getter functions retrieve objects given a hashname and author information
26
29
 
27
- | Function | Parameters |
28
- | --------------------------- | ---------------------------------------- |
29
- | [`getMoment()`](#Moment) | xmoment |
30
- | [`getPioneer()`](#Pioneer) | (none) |
31
- | [`getSecret()`](#Secret) | xsecret |
32
- | [`getEntity()`](#Entity) | xentity |
33
- | [`getNode()`](#Node) | xnode |
34
- | [`getPath()`](#Path) | xpath |
30
+ | Function | Parameters |
31
+ | ---------------------------- | ---------------------------------------- |
32
+ | [`getMoment()`](#Moment) | xmoment |
33
+ | [`getPioneer()`](#Pioneer) | (none) |
34
+ | [`getSecret()`](#Secret) | xsecret, xauthor |
35
+ | [`getEntity()`](#Entity) | xentity, xauthor |
36
+ | [`getNode()`](#Node) | xnode, xauthor |
37
+ | [`getNodelink()`](#Nodelink) | xnodelink, xauthor |
38
+ | [`getPath()`](#Path) | xpath, xauthor |
39
+ | [`getPathlink()`](#Pathlink) | xpathlink, xauthor |
40
+ | [`getTree()`](#Tree) | xtree, xauthor |
41
+ | [`getTreelink()`](#Treelink) | xtreelink, xauthor |
35
42
 
36
43
 
37
44
  ---
@@ -332,6 +339,7 @@ Entities are the actors/users that create/author and organize information on the
332
339
 
333
340
  `<entity>` :: entity ::= { `<“entities/”>` + sha256(`<moment>` + `<entity>`) }
334
341
 
342
+
335
343
  #### Protocol Buffer file:
336
344
 
337
345
  ``` proto
@@ -344,6 +352,7 @@ message entity {
344
352
  }
345
353
  ```
346
354
 
355
+
347
356
  #### Entity maker
348
357
 
349
358
  Parameter rules:
@@ -352,6 +361,7 @@ Parameter rules:
352
361
  |{string} author |(required)|
353
362
  |{string} format |(optional)|
354
363
 
364
+
355
365
  Summoning `makeEntity(secret, format)`:
356
366
  ```javascript
357
367
  const pathchain = require("pathchain"); // Summoning pathchain
@@ -367,6 +377,7 @@ Console:
367
377
  Entity buffer: c0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
368
378
  ```
369
379
 
380
+
370
381
  #### Entity getter
371
382
 
372
383
  Parameter rules:
@@ -404,7 +415,8 @@ Entity object: {
404
415
 
405
416
  Nodes are the primary data storage elements of the pathchain. They can be the representation of plain `text`, the direction of a `file`, or an internet `url`.
406
417
 
407
- `<node>` :: node ::= { `<“nodes/”>` + sha256(`<moment>` + `<author>`) }
418
+ `<node>` :: node ::= { `<“nodes/”>` + sha256(`<moment>` + `<author>` + `<content>`) }
419
+
408
420
 
409
421
  #### Protocol Buffer file:
410
422
 
@@ -431,6 +443,7 @@ Parameter rules:
431
443
  |{string} text |(optional)|
432
444
  |{string} format |(optional)|
433
445
 
446
+
434
447
  Summoning `makeNode(secret, text, format)`:
435
448
  ```javascript
436
449
  const pathchain = require("pathchain"); // Summoning pathchain
@@ -482,15 +495,115 @@ Node object: {
482
495
  ```
483
496
 
484
497
 
498
+ ## Nodelink
499
+
500
+ Nodelinks are the joints of the paths. They __link__ one node with another.
501
+
502
+ `<nodelink>` :: nodelink ::= { `<“nodelinks/”>` + sha256(`<moment>` + `<author>` + `<first>` + `<second>`) }
503
+
504
+
505
+ #### Protocol Buffer file:
506
+
507
+ ``` proto
508
+ syntax = "proto3";
509
+
510
+ message nodelink {
511
+ required string register = 1;
512
+ required string author = 2;
513
+ required string ancestor = 3;
514
+ required string first = 4;
515
+ required string second = 5;
516
+ required string tag = 6;
517
+ }
518
+ ```
519
+
520
+
521
+ #### Nodelink maker
522
+
523
+ Parameter rules:
524
+ |Parameter |Required |
525
+ |-------------------------|----------|
526
+ |{string} first |(required)|
527
+ |{string} second |(required)|
528
+ |{string} author |(required)|
529
+ |{string} ancestor |(optional)|
530
+ |{string} format |(optional)|
531
+
532
+
533
+ Summoning `makeNodelink(first, second, author, ancestor, format)`:
534
+ ```javascript
535
+ const pathchain = require("pathchain"); // Summoning pathchain
536
+
537
+ // Nodelink creation
538
+ var nodelink_buff = pathchain.makeNodelink(node_buff);
539
+
540
+ console.log("Nodelink buffer: ", nodelink_buff);
541
+ ```
542
+
543
+ Console:
544
+ ``` bash
545
+ Nodelink buffer: e0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
546
+ ```
547
+
548
+
549
+ #### Nodelink getter
550
+
551
+ Parameter rules:
552
+ |Parameter |Required |
553
+ |-------------------------|----------|
554
+ |{string} xnodelink |(required)|
555
+ |{string} xauthor |(optional)|
556
+
557
+
558
+ Summoning `getNodlinkeObj(xnodelink)`:
559
+ ```javascript
560
+ const pathchain = require("pathchain"); // Summoning pathchain
561
+
562
+ // Nodelink creation
563
+ var nodelink_buff = pathchain.makeNodelink(node_buff, "ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7");
564
+
565
+ // Getting node obj
566
+ var nodelink_obj = pathchain.getNodeObj(nodelink_buff);
567
+
568
+ console.log("Nodelink buffer: ", nodelink_buff);
569
+ console.log("Nodelink object: ", nodelink_obj);
570
+ ```
571
+
572
+ Console:
573
+ ``` bash
574
+ Nodelink buffer: 2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5
575
+ Nodelink object: {
576
+ register: 'moments/61f89718cfe72b5aab21cef45d3c01c807e760939e437b48357403e2971c3cd8',
577
+ author: 'etities/ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
578
+ ancestor: 'nodelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5',
579
+ first: 'nodes/1baf64c528e787ade5f6b98d7cb0c2c8c0e295ac0ff5ee3939653cddea6ab58f',
580
+ second: 'nodes/ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7',
581
+ tag: 'nodelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5'
582
+ }
583
+ ```
584
+
585
+
485
586
  ## Path
486
587
 
487
588
  Paths are the skeleton of the data trees built on pathchain. They are a linear way to connect data.
488
589
 
489
- `<path>` :: path ::= { `<“paths/”>` + sha256(`<moment>` + `<author>`) }
590
+ `<path>` :: path ::= { `<“paths/”>` + sha256(`<moment>` + `<author>` + `<head>`) }
490
591
 
491
592
  #### Protocol Buffer file:
492
593
 
594
+ [path.proto](proto/path.proto)
493
595
  ``` proto
596
+ syntax = "proto3";
597
+
598
+ message path {
599
+ required string register = 1;
600
+ required string author = 2;
601
+ required string text = 3;
602
+ required string head = 4;
603
+ required string ancestor = 5;
604
+ optional string chain = 6;
605
+ required string tag = 7;
606
+ }
494
607
  ```
495
608
 
496
609
 
@@ -504,6 +617,7 @@ Parameter rules:
504
617
  |{string} head |(required)|
505
618
  |{string} format |(optional)|
506
619
 
620
+
507
621
  Summoning `makePath(secret, text, format)`:
508
622
  ```javascript
509
623
  const pathchain = require("pathchain"); // Summoning pathchain
@@ -545,6 +659,234 @@ console.log("Path object: ", path_obj);
545
659
 
546
660
  Console:
547
661
  ``` bash
662
+ Path buffer: 426cc58ad2576d48429e2bc32a58b39572fba3e8a1465ae9ecb7826a105d5b31
663
+ Path object: {
664
+ register: 'moments/0fede6ab5d5078f7cb535cfdf50f7339c02e343fd9793bd7d68bd544e984ab5b',
665
+ author: 'ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
666
+ text: 'pathlink',
667
+ head: 'nodelinks/1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac',
668
+ ancestor: 'paths/426cc58ad2576d48429e2bc32a58b39572fba3e8a1465ae9ecb7826a105d5b31',
669
+ chain: '',
670
+ tag: 'paths/426cc58ad2576d48429e2bc32a58b39572fba3e8a1465ae9ecb7826a105d5b31'
671
+ }
672
+ ```
673
+
674
+
675
+ #### Pathlink maker
676
+
677
+ Parameter rules:
678
+ |Parameter |Required |
679
+ |-------------------------|----------|
680
+ |{string} first |(required)|
681
+ |{string} second |(required)|
682
+ |{string} author |(required)|
683
+ |{string} ancestor |(optional)|
684
+ |{string} format |(optional)|
685
+
686
+
687
+ Summoning `makePathlink(first, second, author, ancestor, format)`:
688
+ ```javascript
689
+ const pathchain = require("pathchain"); // Summoning pathchain
690
+
691
+ // Pathlink creation
692
+ var pathlink_buff = pathchain.makePathlink(node_buff);
693
+
694
+ console.log("Pathlink buffer: ", pathlink_buff);
695
+ ```
696
+
697
+ Console:
698
+ ``` bash
699
+ Pathlink buffer: e0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
700
+ ```
701
+
702
+
703
+ #### Pathlink getter
704
+
705
+ Parameter rules:
706
+ |Parameter |Required |
707
+ |-------------------------|----------|
708
+ |{string} xpathlink |(required)|
709
+ |{string} xauthor |(optional)|
710
+
711
+
712
+ Summoning `getNodlinkeObj(xpathlink)`:
713
+ ```javascript
714
+ const pathchain = require("pathchain"); // Summoning pathchain
715
+
716
+ // Pathlink creation
717
+ var pathlink_buff = pathchain.makePathlink(path_buff, "ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7");
718
+
719
+ // Getting node obj
720
+ var pathlink_obj = pathchain.getNodeObj(pathlink_buff);
721
+
722
+ console.log("Pathlink buffer: ", pathlink_buff);
723
+ console.log("Pathlink object: ", pathlink_obj);
724
+ ```
725
+
726
+ Console:
727
+ ``` bash
728
+ Pathlink buffer: 2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5
729
+ Pathlink object: {
730
+ register: 'moments/61f89718cfe72b5aab21cef45d3c01c807e760939e437b48357403e2971c3cd8',
731
+ author: 'etities/ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
732
+ ancestor: 'pathlinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5',
733
+ first: 'nodes/1baf64c528e787ade5f6b98d7cb0c2c8c0e295ac0ff5ee3939653cddea6ab58f',
734
+ second: 'nodes/ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7',
735
+ tag: 'pathlinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5'
736
+ }
737
+ ```
738
+
739
+
740
+ ## Tree
741
+
742
+ Trees are the biggest data representation elements of the pathchain. They are ordered representations of the aglomeration of paths.
743
+
744
+ `<tree>` :: tree ::= { `<“trees/”>` + sha256(`<moment>` + `<author>` + `<head>`) }
745
+
746
+ #### Protocol Buffer file:
747
+
748
+ ``` proto
749
+ syntax = "proto3";
750
+
751
+ message tree {
752
+ required string register = 1;
753
+ required string author = 2;
754
+ required string text = 3;
755
+ required string head = 4;
756
+ required string ancestor = 5;
757
+ optional string chain = 6;
758
+ required string tag = 7;
759
+ }
760
+
761
+ ```
762
+
763
+
764
+ #### Tree maker
765
+
766
+ Parameter rules:
767
+ |Parameter |Required |
768
+ |-------------------------|----------|
769
+ |{string} xauthor |(required)|
770
+ |{string} text |(required)|
771
+ |{string} head |(required)|
772
+ |{string} format |(optional)|
773
+
774
+
775
+ Summoning `makeTree(secret, text, format)`:
776
+ ```javascript
777
+ const pathchain = require("pathchain"); // Summoning pathchain
778
+
779
+ // Tree creation
780
+ var tree_buff = pathchain.makeTree("tree", "1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac");
781
+
782
+
783
+ console.log("Tree buffer: ", tree_buff);
784
+ ```
785
+
786
+ Console:
787
+ ``` bash
788
+ Tree buffer: a0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
789
+ ```
790
+
791
+
792
+ #### Tree getter
793
+
794
+ Parameter rules:
795
+ |Parameter |Required |
796
+ |-------------------------|----------|
797
+ |{string} xtree |(required)|
798
+ |{string} xauthor |(optional)|
799
+
800
+
801
+ Summoning `getTreeObj(xtree)`:
802
+ ```javascript
803
+ const pathchain = require("pathchain"); // Summoning pathchain
804
+
805
+ // Tree creation
806
+ var tree_buff = pathchain.makeTree("tree", "1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac");
807
+
808
+ // Getting tree obj
809
+ var tree_obj = pathchain.getTreeObj(tree_buff);
810
+
811
+ console.log("Tree buffer: ", tree_buff);
812
+ console.log("Tree object: ", tree_obj);
813
+ ```
814
+
815
+ Console:
816
+ ``` bash
817
+ Tree buffer: 8d9abf006f5ba6dc1b415baf6d9e37b5d18d6b43451e01d9fa27b10b393a8d89
818
+ Tree object: {
819
+ register: 'moments/8a6601db7ae0f1dc69b7d5e63c510bbae44d0d58ea2683e289a4a23f0ca2a08c',
820
+ author: 'ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
821
+ text: 'tree',
822
+ head: 'nodelinks/1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac',
823
+ ancestor: 'trees/8d9abf006f5ba6dc1b415baf6d9e37b5d18d6b43451e01d9fa27b10b393a8d89',
824
+ chain: '',
825
+ tag: 'trees/8d9abf006f5ba6dc1b415baf6d9e37b5d18d6b43451e01d9fa27b10b393a8d89'
826
+ }
548
827
  ```
549
828
 
550
829
 
830
+ #### Treelink maker
831
+
832
+ Parameter rules:
833
+ |Parameter |Required |
834
+ |-------------------------|----------|
835
+ |{string} first |(required)|
836
+ |{string} second |(required)|
837
+ |{string} author |(required)|
838
+ |{string} ancestor |(optional)|
839
+ |{string} format |(optional)|
840
+
841
+
842
+ Summoning `makeTreelink(first, second, author, ancestor, format)`:
843
+ ```javascript
844
+ const pathchain = require("pathchain"); // Summoning pathchain
845
+
846
+ // Treelink creation
847
+ var treelink_buff = pathchain.makeTreelink(node_buff);
848
+
849
+ console.log("Treelink buffer: ", treelink_buff);
850
+ ```
851
+
852
+ Console:
853
+ ``` bash
854
+ Treelink buffer: e0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
855
+ ```
856
+
857
+
858
+ #### Treelink getter
859
+
860
+ Parameter rules:
861
+ |Parameter |Required |
862
+ |-------------------------|----------|
863
+ |{string} xtreelink |(required)|
864
+ |{string} xauthor |(optional)|
865
+
866
+
867
+ Summoning `getNodlinkeObj(xtreelink)`:
868
+ ```javascript
869
+ const pathchain = require("pathchain"); // Summoning pathchain
870
+
871
+ // Treelink creation
872
+ var treelink_buff = pathchain.makeTreelink(path_buff, "ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7");
873
+
874
+ // Getting node obj
875
+ var treelink_obj = pathchain.getNodeObj(treelink_buff);
876
+
877
+ console.log("Treelink buffer: ", treelink_buff);
878
+ console.log("Treelink object: ", treelink_obj);
879
+ ```
880
+
881
+ Console:
882
+ ``` bash
883
+ Treelink buffer: 2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5
884
+ Treelink object: {
885
+ register: 'moments/61f89718cfe72b5aab21cef45d3c01c807e760939e437b48357403e2971c3cd8',
886
+ author: 'etities/ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
887
+ ancestor: 'treelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5',
888
+ first: 'nodes/1baf64c528e787ade5f6b98d7cb0c2c8c0e295ac0ff5ee3939653cddea6ab58f',
889
+ second: 'nodes/ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7',
890
+ tag: 'treelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5'
891
+ }
892
+ ```
package/getter.js CHANGED
@@ -339,7 +339,7 @@ function getTreeObj(xtree, xauthor) {
339
339
  *
340
340
  * @return void
341
341
  */
342
- function getTreelinkObj(treelink, xauthor) {
342
+ function getTreelinkObj(xtreelink, xauthor) {
343
343
 
344
344
  if(xauthor != ""){
345
345
  xauthor = xauthor + '/';
package/maker.js CHANGED
@@ -276,7 +276,7 @@ function nodelink(first, second, author, ancestor, format = 'MM DD YYYY HH:mm:SS
276
276
 
277
277
  var register_moment_hash = moment(register, 0, 0, 0, 0, 0, format)
278
278
 
279
- var nodelink_hash = sha256(register_moment_hash + "_" + author);
279
+ var nodelink_hash = sha256(register_moment_hash + "_" + author + "_" + first + "_" + second);
280
280
 
281
281
  if(ancestor == ""){
282
282
  ancestor = nodelink_hash;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pathchain",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "dependencies": {
5
5
  "date-and-time": "^3.0.2",
6
6
  "empty-dir": "^3.0.0",