pathchain 1.0.44 → 1.0.46
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/README.md +385 -24
- package/maker.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,36 +7,43 @@ Pathchain is a tool to build path-shaped data structures that are chained one to
|
|
|
7
7
|
---
|
|
8
8
|
# Pathchain documentation
|
|
9
9
|
|
|
10
|
-
## Makers
|
|
11
|
-
Maker functions recieve new data to encode into the chain.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 |
|
|
11
|
+
---
|
|
12
|
+
# Makers
|
|
13
|
+
Maker functions recieve new data to encode into the chain.
|
|
21
14
|
|
|
15
|
+
| Function | Parameters |
|
|
16
|
+
| ----------------------------- | --------------------------------------- |
|
|
17
|
+
| [`makeMoment()`](#Moment) | datetime, lat, lon, x, y, z, format |
|
|
18
|
+
| [`makePioneer()`](#Pioneer) | format |
|
|
19
|
+
| [`makeSecret()`](#Secret) | author, format |
|
|
20
|
+
| [`makeEntity()`](#Entity) | xsecret, format |
|
|
21
|
+
| [`makeNode()`](#Node) | text, xauthor, format |
|
|
22
|
+
| [`makeNodelink()`](#Nodelink) | first, second, author, ancestor, format |
|
|
23
|
+
| [`makePath()`](#Path) | xauthor, text, head, ancestor, format |
|
|
24
|
+
| [`makePathlink()`](#Pathlink) | first, second, author, ancestor, format |
|
|
25
|
+
| [`makeTree()`](#Tree) | xauthor, text, head, ancestor, format |
|
|
22
26
|
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
---
|
|
29
|
+
# Getters
|
|
25
30
|
Getter functions retrieve objects given a hashname and author information
|
|
26
31
|
|
|
27
|
-
| Function
|
|
28
|
-
|
|
|
29
|
-
| [`getMoment()`](#Moment)
|
|
30
|
-
| [`getPioneer()`](#Pioneer)
|
|
31
|
-
| [`getSecret()`](#Secret)
|
|
32
|
-
| [`getEntity()`](#Entity)
|
|
33
|
-
| [`getNode()`](#Node)
|
|
34
|
-
| [`
|
|
32
|
+
| Function | Parameters |
|
|
33
|
+
| ---------------------------- | ---------------------------------------- |
|
|
34
|
+
| [`getMoment()`](#Moment) | xmoment |
|
|
35
|
+
| [`getPioneer()`](#Pioneer) | (none) |
|
|
36
|
+
| [`getSecret()`](#Secret) | xsecret, xauthor |
|
|
37
|
+
| [`getEntity()`](#Entity) | xentity, xauthor |
|
|
38
|
+
| [`getNode()`](#Node) | xnode, xauthor |
|
|
39
|
+
| [`getNodelink()`](#Nodelink) | xnodelink, xauthor |
|
|
40
|
+
| [`getPath()`](#Path) | xpath, xauthor |
|
|
41
|
+
| [`getPathlink()`](#Pathlink) | xpathlink, xauthor |
|
|
42
|
+
| [`getTree()`](#Tree) | xtree, xauthor |
|
|
43
|
+
| [`getTreelink()`](#Treelink) | xtreelink, xauthor |
|
|
35
44
|
|
|
36
45
|
|
|
37
46
|
---
|
|
38
|
-
|
|
39
|
-
|
|
40
47
|
## Moment
|
|
41
48
|
|
|
42
49
|
A moment is the mimimum representation of the pathchain data structures. Moments are the trunk of every path . They're represented by default with a `MM DD YYYY HH:mm:SSS [GMT]Z` datetime format for `time` and a planet earth representation (0, 0, 0) in general as `space`.
|
|
@@ -96,6 +103,7 @@ Parameter rules:
|
|
|
96
103
|
|{string} format |(optional)|
|
|
97
104
|
|
|
98
105
|
|
|
106
|
+
---
|
|
99
107
|
Summoning `makeMoment(datetime, lat, lon, x, y, z, format)`:
|
|
100
108
|
```javascript
|
|
101
109
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -118,6 +126,7 @@ Parameter rules:
|
|
|
118
126
|
|{string} xmoment |(required)|
|
|
119
127
|
|
|
120
128
|
|
|
129
|
+
---
|
|
121
130
|
Summoning `getMomentObj(xauthor, xmoment)`
|
|
122
131
|
```
|
|
123
132
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -175,7 +184,7 @@ Parameter rules:
|
|
|
175
184
|
|{string} author |(required)|
|
|
176
185
|
|{string} format |(optional)|
|
|
177
186
|
|
|
178
|
-
|
|
187
|
+
---
|
|
179
188
|
Summoning `makeMoment(author, format)`:
|
|
180
189
|
```javascript
|
|
181
190
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -197,6 +206,7 @@ Parameter rules:
|
|
|
197
206
|
|{string} xsecret |(required)|
|
|
198
207
|
|
|
199
208
|
|
|
209
|
+
---
|
|
200
210
|
Summoning `useSecret(xsecret)` & `isSecretUsed(xsecret)`:
|
|
201
211
|
```javascript
|
|
202
212
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -238,6 +248,7 @@ Parameter rules:
|
|
|
238
248
|
|{string} xsecret |(required)|
|
|
239
249
|
|
|
240
250
|
|
|
251
|
+
---
|
|
241
252
|
Summoning `getSecretObj(xsecret)`:
|
|
242
253
|
```javascript
|
|
243
254
|
|
|
@@ -276,6 +287,7 @@ Parameter rules:
|
|
|
276
287
|
| |(nothing) |
|
|
277
288
|
|
|
278
289
|
|
|
290
|
+
---
|
|
279
291
|
Summoning `makePioneer()`:
|
|
280
292
|
```javascript
|
|
281
293
|
|
|
@@ -301,6 +313,7 @@ Parameter rules:
|
|
|
301
313
|
| |(nothing) |
|
|
302
314
|
|
|
303
315
|
|
|
316
|
+
---
|
|
304
317
|
Summoning `getPioneerObj()`:
|
|
305
318
|
```javascript
|
|
306
319
|
|
|
@@ -332,6 +345,7 @@ Entities are the actors/users that create/author and organize information on the
|
|
|
332
345
|
|
|
333
346
|
`<entity>` :: entity ::= { `<“entities/”>` + sha256(`<moment>` + `<entity>`) }
|
|
334
347
|
|
|
348
|
+
|
|
335
349
|
#### Protocol Buffer file:
|
|
336
350
|
|
|
337
351
|
``` proto
|
|
@@ -344,6 +358,7 @@ message entity {
|
|
|
344
358
|
}
|
|
345
359
|
```
|
|
346
360
|
|
|
361
|
+
|
|
347
362
|
#### Entity maker
|
|
348
363
|
|
|
349
364
|
Parameter rules:
|
|
@@ -352,6 +367,8 @@ Parameter rules:
|
|
|
352
367
|
|{string} author |(required)|
|
|
353
368
|
|{string} format |(optional)|
|
|
354
369
|
|
|
370
|
+
|
|
371
|
+
---
|
|
355
372
|
Summoning `makeEntity(secret, format)`:
|
|
356
373
|
```javascript
|
|
357
374
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -367,6 +384,7 @@ Console:
|
|
|
367
384
|
Entity buffer: c0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
|
|
368
385
|
```
|
|
369
386
|
|
|
387
|
+
|
|
370
388
|
#### Entity getter
|
|
371
389
|
|
|
372
390
|
Parameter rules:
|
|
@@ -375,6 +393,7 @@ Parameter rules:
|
|
|
375
393
|
|{string} xentity |(required)|
|
|
376
394
|
|
|
377
395
|
|
|
396
|
+
---
|
|
378
397
|
Summoning `getEntityObj(xentity)`:
|
|
379
398
|
```javascript
|
|
380
399
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -404,7 +423,8 @@ Entity object: {
|
|
|
404
423
|
|
|
405
424
|
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
425
|
|
|
407
|
-
`<node>` :: node ::= { `<“nodes/”>` + sha256(`<moment>` + `<author>`) }
|
|
426
|
+
`<node>` :: node ::= { `<“nodes/”>` + sha256(`<moment>` + `<author>` + `<content>`) }
|
|
427
|
+
|
|
408
428
|
|
|
409
429
|
#### Protocol Buffer file:
|
|
410
430
|
|
|
@@ -431,6 +451,8 @@ Parameter rules:
|
|
|
431
451
|
|{string} text |(optional)|
|
|
432
452
|
|{string} format |(optional)|
|
|
433
453
|
|
|
454
|
+
|
|
455
|
+
---
|
|
434
456
|
Summoning `makeNode(secret, text, format)`:
|
|
435
457
|
```javascript
|
|
436
458
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -456,6 +478,7 @@ Parameter rules:
|
|
|
456
478
|
|{string} xauthor |(optional)|
|
|
457
479
|
|
|
458
480
|
|
|
481
|
+
---
|
|
459
482
|
Summoning `getNodeObj(xnode)`:
|
|
460
483
|
```javascript
|
|
461
484
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -482,15 +505,116 @@ Node object: {
|
|
|
482
505
|
```
|
|
483
506
|
|
|
484
507
|
|
|
508
|
+
## Nodelink
|
|
509
|
+
|
|
510
|
+
Nodelinks are the joints of the paths. They __link__ one node with another.
|
|
511
|
+
|
|
512
|
+
`<nodelink>` :: nodelink ::= { `<“nodelinks/”>` + sha256(`<moment>` + `<author>` + `<first>` + `<second>`) }
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
#### Protocol Buffer file:
|
|
516
|
+
|
|
517
|
+
``` proto
|
|
518
|
+
syntax = "proto3";
|
|
519
|
+
|
|
520
|
+
message nodelink {
|
|
521
|
+
required string register = 1;
|
|
522
|
+
required string author = 2;
|
|
523
|
+
required string ancestor = 3;
|
|
524
|
+
required string first = 4;
|
|
525
|
+
required string second = 5;
|
|
526
|
+
required string tag = 6;
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
#### Nodelink maker
|
|
532
|
+
|
|
533
|
+
Parameter rules:
|
|
534
|
+
|Parameter |Required |
|
|
535
|
+
|-------------------------|----------|
|
|
536
|
+
|{string} first |(required)|
|
|
537
|
+
|{string} second |(required)|
|
|
538
|
+
|{string} author |(required)|
|
|
539
|
+
|{string} ancestor |(optional)|
|
|
540
|
+
|{string} format |(optional)|
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
Summoning `makeNodelink(first, second, author, ancestor, format)`:
|
|
545
|
+
```javascript
|
|
546
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
547
|
+
|
|
548
|
+
// Nodelink creation
|
|
549
|
+
var nodelink_buff = pathchain.makeNodelink(node_buff);
|
|
550
|
+
|
|
551
|
+
console.log("Nodelink buffer: ", nodelink_buff);
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
Console:
|
|
555
|
+
``` bash
|
|
556
|
+
Nodelink buffer: e0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
#### Nodelink getter
|
|
561
|
+
|
|
562
|
+
Parameter rules:
|
|
563
|
+
|Parameter |Required |
|
|
564
|
+
|-------------------------|----------|
|
|
565
|
+
|{string} xnodelink |(required)|
|
|
566
|
+
|{string} xauthor |(optional)|
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
Summoning `getNodlinkeObj(xnodelink)`:
|
|
571
|
+
```javascript
|
|
572
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
573
|
+
|
|
574
|
+
// Nodelink creation
|
|
575
|
+
var nodelink_buff = pathchain.makeNodelink(node_buff, "ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7");
|
|
576
|
+
|
|
577
|
+
// Getting node obj
|
|
578
|
+
var nodelink_obj = pathchain.getNodeObj(nodelink_buff);
|
|
579
|
+
|
|
580
|
+
console.log("Nodelink buffer: ", nodelink_buff);
|
|
581
|
+
console.log("Nodelink object: ", nodelink_obj);
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
Console:
|
|
585
|
+
``` bash
|
|
586
|
+
Nodelink buffer: 2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5
|
|
587
|
+
Nodelink object: {
|
|
588
|
+
register: 'moments/61f89718cfe72b5aab21cef45d3c01c807e760939e437b48357403e2971c3cd8',
|
|
589
|
+
author: 'etities/ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
|
|
590
|
+
ancestor: 'nodelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5',
|
|
591
|
+
first: 'nodes/1baf64c528e787ade5f6b98d7cb0c2c8c0e295ac0ff5ee3939653cddea6ab58f',
|
|
592
|
+
second: 'nodes/ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7',
|
|
593
|
+
tag: 'nodelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5'
|
|
594
|
+
}
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
|
|
485
598
|
## Path
|
|
486
599
|
|
|
487
600
|
Paths are the skeleton of the data trees built on pathchain. They are a linear way to connect data.
|
|
488
601
|
|
|
489
|
-
`<path>` :: path ::= { `<“paths/”>` + sha256(`<moment>` + `<author>`) }
|
|
602
|
+
`<path>` :: path ::= { `<“paths/”>` + sha256(`<moment>` + `<author>` + `<head>`) }
|
|
490
603
|
|
|
491
604
|
#### Protocol Buffer file:
|
|
492
605
|
|
|
493
606
|
``` proto
|
|
607
|
+
syntax = "proto3";
|
|
608
|
+
|
|
609
|
+
message path {
|
|
610
|
+
required string register = 1;
|
|
611
|
+
required string author = 2;
|
|
612
|
+
required string text = 3;
|
|
613
|
+
required string head = 4;
|
|
614
|
+
required string ancestor = 5;
|
|
615
|
+
optional string chain = 6;
|
|
616
|
+
required string tag = 7;
|
|
617
|
+
}
|
|
494
618
|
```
|
|
495
619
|
|
|
496
620
|
|
|
@@ -504,6 +628,8 @@ Parameter rules:
|
|
|
504
628
|
|{string} head |(required)|
|
|
505
629
|
|{string} format |(optional)|
|
|
506
630
|
|
|
631
|
+
|
|
632
|
+
---
|
|
507
633
|
Summoning `makePath(secret, text, format)`:
|
|
508
634
|
```javascript
|
|
509
635
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -529,6 +655,7 @@ Parameter rules:
|
|
|
529
655
|
|{string} xauthor |(optional)|
|
|
530
656
|
|
|
531
657
|
|
|
658
|
+
---
|
|
532
659
|
Summoning `getPathObj(xpath)`:
|
|
533
660
|
```javascript
|
|
534
661
|
const pathchain = require("pathchain"); // Summoning pathchain
|
|
@@ -545,6 +672,240 @@ console.log("Path object: ", path_obj);
|
|
|
545
672
|
|
|
546
673
|
Console:
|
|
547
674
|
``` bash
|
|
675
|
+
Path buffer: 426cc58ad2576d48429e2bc32a58b39572fba3e8a1465ae9ecb7826a105d5b31
|
|
676
|
+
Path object: {
|
|
677
|
+
register: 'moments/0fede6ab5d5078f7cb535cfdf50f7339c02e343fd9793bd7d68bd544e984ab5b',
|
|
678
|
+
author: 'ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
|
|
679
|
+
text: 'pathlink',
|
|
680
|
+
head: 'nodelinks/1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac',
|
|
681
|
+
ancestor: 'paths/426cc58ad2576d48429e2bc32a58b39572fba3e8a1465ae9ecb7826a105d5b31',
|
|
682
|
+
chain: '',
|
|
683
|
+
tag: 'paths/426cc58ad2576d48429e2bc32a58b39572fba3e8a1465ae9ecb7826a105d5b31'
|
|
684
|
+
}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
#### Pathlink maker
|
|
689
|
+
|
|
690
|
+
Parameter rules:
|
|
691
|
+
|Parameter |Required |
|
|
692
|
+
|-------------------------|----------|
|
|
693
|
+
|{string} first |(required)|
|
|
694
|
+
|{string} second |(required)|
|
|
695
|
+
|{string} author |(required)|
|
|
696
|
+
|{string} ancestor |(optional)|
|
|
697
|
+
|{string} format |(optional)|
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
Summoning `makePathlink(first, second, author, ancestor, format)`:
|
|
702
|
+
```javascript
|
|
703
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
704
|
+
|
|
705
|
+
// Pathlink creation
|
|
706
|
+
var pathlink_buff = pathchain.makePathlink(node_buff);
|
|
707
|
+
|
|
708
|
+
console.log("Pathlink buffer: ", pathlink_buff);
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
Console:
|
|
712
|
+
``` bash
|
|
713
|
+
Pathlink buffer: e0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
#### Pathlink getter
|
|
718
|
+
|
|
719
|
+
Parameter rules:
|
|
720
|
+
|Parameter |Required |
|
|
721
|
+
|-------------------------|----------|
|
|
722
|
+
|{string} xpathlink |(required)|
|
|
723
|
+
|{string} xauthor |(optional)|
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
---
|
|
727
|
+
Summoning `getNodlinkeObj(xpathlink)`:
|
|
728
|
+
```javascript
|
|
729
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
730
|
+
|
|
731
|
+
// Pathlink creation
|
|
732
|
+
var pathlink_buff = pathchain.makePathlink(path_buff, "ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7");
|
|
733
|
+
|
|
734
|
+
// Getting node obj
|
|
735
|
+
var pathlink_obj = pathchain.getNodeObj(pathlink_buff);
|
|
736
|
+
|
|
737
|
+
console.log("Pathlink buffer: ", pathlink_buff);
|
|
738
|
+
console.log("Pathlink object: ", pathlink_obj);
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
Console:
|
|
742
|
+
``` bash
|
|
743
|
+
Pathlink buffer: 2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5
|
|
744
|
+
Pathlink object: {
|
|
745
|
+
register: 'moments/61f89718cfe72b5aab21cef45d3c01c807e760939e437b48357403e2971c3cd8',
|
|
746
|
+
author: 'etities/ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
|
|
747
|
+
ancestor: 'pathlinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5',
|
|
748
|
+
first: 'nodes/1baf64c528e787ade5f6b98d7cb0c2c8c0e295ac0ff5ee3939653cddea6ab58f',
|
|
749
|
+
second: 'nodes/ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7',
|
|
750
|
+
tag: 'pathlinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5'
|
|
751
|
+
}
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
## Tree
|
|
756
|
+
|
|
757
|
+
Trees are the biggest data representation elements of the pathchain. They are ordered representations of the aglomeration of paths.
|
|
758
|
+
|
|
759
|
+
`<tree>` :: tree ::= { `<“trees/”>` + sha256(`<moment>` + `<author>` + `<head>`) }
|
|
760
|
+
|
|
761
|
+
#### Protocol Buffer file:
|
|
762
|
+
|
|
763
|
+
``` proto
|
|
764
|
+
syntax = "proto3";
|
|
765
|
+
|
|
766
|
+
message tree {
|
|
767
|
+
required string register = 1;
|
|
768
|
+
required string author = 2;
|
|
769
|
+
required string text = 3;
|
|
770
|
+
required string head = 4;
|
|
771
|
+
required string ancestor = 5;
|
|
772
|
+
optional string chain = 6;
|
|
773
|
+
required string tag = 7;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
#### Tree maker
|
|
780
|
+
|
|
781
|
+
Parameter rules:
|
|
782
|
+
|Parameter |Required |
|
|
783
|
+
|-------------------------|----------|
|
|
784
|
+
|{string} xauthor |(required)|
|
|
785
|
+
|{string} text |(required)|
|
|
786
|
+
|{string} head |(required)|
|
|
787
|
+
|{string} format |(optional)|
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
Summoning `makeTree(secret, text, format)`:
|
|
792
|
+
```javascript
|
|
793
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
794
|
+
|
|
795
|
+
// Tree creation
|
|
796
|
+
var tree_buff = pathchain.makeTree("tree", "1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac");
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
console.log("Tree buffer: ", tree_buff);
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
Console:
|
|
803
|
+
``` bash
|
|
804
|
+
Tree buffer: a0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
#### Tree getter
|
|
809
|
+
|
|
810
|
+
Parameter rules:
|
|
811
|
+
|Parameter |Required |
|
|
812
|
+
|-------------------------|----------|
|
|
813
|
+
|{string} xtree |(required)|
|
|
814
|
+
|{string} xauthor |(optional)|
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
---
|
|
818
|
+
Summoning `getTreeObj(xtree)`:
|
|
819
|
+
```javascript
|
|
820
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
821
|
+
|
|
822
|
+
// Tree creation
|
|
823
|
+
var tree_buff = pathchain.makeTree("tree", "1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac");
|
|
824
|
+
|
|
825
|
+
// Getting tree obj
|
|
826
|
+
var tree_obj = pathchain.getTreeObj(tree_buff);
|
|
827
|
+
|
|
828
|
+
console.log("Tree buffer: ", tree_buff);
|
|
829
|
+
console.log("Tree object: ", tree_obj);
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
Console:
|
|
833
|
+
``` bash
|
|
834
|
+
Tree buffer: 8d9abf006f5ba6dc1b415baf6d9e37b5d18d6b43451e01d9fa27b10b393a8d89
|
|
835
|
+
Tree object: {
|
|
836
|
+
register: 'moments/8a6601db7ae0f1dc69b7d5e63c510bbae44d0d58ea2683e289a4a23f0ca2a08c',
|
|
837
|
+
author: 'ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
|
|
838
|
+
text: 'tree',
|
|
839
|
+
head: 'nodelinks/1d3fbcff97b1b995eb83b6c70b23ea95b385add1b9bcef5d5adcd7db21591aac',
|
|
840
|
+
ancestor: 'trees/8d9abf006f5ba6dc1b415baf6d9e37b5d18d6b43451e01d9fa27b10b393a8d89',
|
|
841
|
+
chain: '',
|
|
842
|
+
tag: 'trees/8d9abf006f5ba6dc1b415baf6d9e37b5d18d6b43451e01d9fa27b10b393a8d89'
|
|
843
|
+
}
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
#### Treelink maker
|
|
848
|
+
|
|
849
|
+
Parameter rules:
|
|
850
|
+
|Parameter |Required |
|
|
851
|
+
|-------------------------|----------|
|
|
852
|
+
|{string} first |(required)|
|
|
853
|
+
|{string} second |(required)|
|
|
854
|
+
|{string} author |(required)|
|
|
855
|
+
|{string} ancestor |(optional)|
|
|
856
|
+
|{string} format |(optional)|
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
Summoning `makeTreelink(first, second, author, ancestor, format)`:
|
|
861
|
+
```javascript
|
|
862
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
863
|
+
|
|
864
|
+
// Treelink creation
|
|
865
|
+
var treelink_buff = pathchain.makeTreelink(node_buff);
|
|
866
|
+
|
|
867
|
+
console.log("Treelink buffer: ", treelink_buff);
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
Console:
|
|
871
|
+
``` bash
|
|
872
|
+
Treelink buffer: e0f9d300e1b28253455e1835f13ca18d000333152a6a9a9b106d0407612980a8
|
|
548
873
|
```
|
|
549
874
|
|
|
550
875
|
|
|
876
|
+
#### Treelink getter
|
|
877
|
+
|
|
878
|
+
Parameter rules:
|
|
879
|
+
|Parameter |Required |
|
|
880
|
+
|-------------------------|----------|
|
|
881
|
+
|{string} xtreelink |(required)|
|
|
882
|
+
|{string} xauthor |(optional)|
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
---
|
|
886
|
+
Summoning `getNodlinkeObj(xtreelink)`:
|
|
887
|
+
```javascript
|
|
888
|
+
const pathchain = require("pathchain"); // Summoning pathchain
|
|
889
|
+
|
|
890
|
+
// Treelink creation
|
|
891
|
+
var treelink_buff = pathchain.makeTreelink(path_buff, "ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7");
|
|
892
|
+
|
|
893
|
+
// Getting node obj
|
|
894
|
+
var treelink_obj = pathchain.getNodeObj(treelink_buff);
|
|
895
|
+
|
|
896
|
+
console.log("Treelink buffer: ", treelink_buff);
|
|
897
|
+
console.log("Treelink object: ", treelink_obj);
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
Console:
|
|
901
|
+
``` bash
|
|
902
|
+
Treelink buffer: 2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5
|
|
903
|
+
Treelink object: {
|
|
904
|
+
register: 'moments/61f89718cfe72b5aab21cef45d3c01c807e760939e437b48357403e2971c3cd8',
|
|
905
|
+
author: 'etities/ad7f31ed77042ed1681119a65b00bbd909b72ecdfb8db5c5f8af596c5a8518bc',
|
|
906
|
+
ancestor: 'treelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5',
|
|
907
|
+
first: 'nodes/1baf64c528e787ade5f6b98d7cb0c2c8c0e295ac0ff5ee3939653cddea6ab58f',
|
|
908
|
+
second: 'nodes/ec59b50c235b66b4e5d78311a1c3313c9ac43a57d763fb530d5e6c67a64d0ee7',
|
|
909
|
+
tag: 'treelinks/2aea1c448756e1b8e7163483d8d8ce17798c0d272adfaeed6907c5f87432e0a5'
|
|
910
|
+
}
|
|
911
|
+
```
|
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;
|