pathchain 1.0.39 → 1.0.41

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/getter.js +123 -14
  2. package/index.js +109 -26
  3. package/maker.js +180 -31
  4. package/package.json +1 -1
package/getter.js CHANGED
@@ -188,6 +188,42 @@ function getNodeObj(xnode, xauthor) {
188
188
  }
189
189
 
190
190
 
191
+ /** getNodelinkObj
192
+ * [Function that recieves a nodelink hash and returns the nodelink object]
193
+ *
194
+ * @param {string} xnodelink (required)
195
+ *
196
+ * @return void
197
+ */
198
+ function getNodelinkObj(xnodelink, xauthor) {
199
+
200
+ if(xauthor != ""){
201
+ xauthor = xauthor + '/';
202
+ }
203
+
204
+ // LOADING PB
205
+ var nodelink_pb = pb(fs.readFileSync('node_modules/pathchain/proto/nodelink.proto'))
206
+
207
+ // NOT FOUND EXCEPTION
208
+ var fileContents;
209
+ try {
210
+ fileContents = fs.readFileSync("files/" + xauthor + "nodelinks/" + xnodelink);
211
+ } catch (err) {
212
+ if (err.code === 'ENOENT') {
213
+ return "Nodelink not found";
214
+ } else {
215
+ throw err;
216
+ }
217
+ }
218
+
219
+ // DECODING NODE
220
+ var nodelink_enc = fileContents
221
+ var nodelink_obj = nodelink_pb.nodelink.decode(nodelink_enc)
222
+
223
+ return nodelink_obj;
224
+ }
225
+
226
+
191
227
  /** getPathObj
192
228
  * [Function that recieves a path hash and returns the path object]
193
229
  *
@@ -224,50 +260,86 @@ function getPathObj(xpath, xauthor) {
224
260
  }
225
261
 
226
262
 
227
- /** getLabelObj
228
- * [Function that recieves a label hash and returns the label object]
263
+ /** getPathlinkObj
264
+ * [Function that recieves a pathlink hash and returns the pathlink object]
229
265
  *
230
- * @param {string} xlabel (required)
266
+ * @param {string} xpathlink (required)
231
267
  *
232
268
  * @return void
233
269
  */
234
- function getLabelObj(xlabel, xauthor) {
270
+ function getPathlinkObj(xpathlink, xauthor) {
235
271
 
236
272
  if(xauthor != ""){
237
273
  xauthor = xauthor + '/';
238
274
  }
239
275
 
240
276
  // LOADING PB
241
- var label_pb = pb(fs.readFileSync('node_modules/pathchain/proto/label.proto'))
277
+ var pathlink_pb = pb(fs.readFileSync('node_modules/pathchain/proto/pathlink.proto'))
242
278
 
243
279
  // NOT FOUND EXCEPTION
244
280
  var fileContents;
245
281
  try {
246
- fileContents = fs.readFileSync("files/" + xauthor + "labels/" + xlabel);
282
+ fileContents = fs.readFileSync("files/" + xauthor + "pathlinks/" + xpathlink);
247
283
  } catch (err) {
248
284
  if (err.code === 'ENOENT') {
249
- return "Label not found";
285
+ return "Pathlink not found";
250
286
  } else {
251
287
  throw err;
252
288
  }
253
289
  }
254
290
 
255
291
  // DECODING NODE
256
- var label_enc = fileContents
257
- var label_obj = label_pb.label.decode(label_enc)
292
+ var pathlink_enc = fileContents
293
+ var pathlink_obj = pathlink_pb.pathlink.decode(pathlink_enc)
258
294
 
259
- return label_obj;
295
+ return pathlink_obj;
260
296
  }
261
297
 
262
298
 
263
- /** getNodelinkObj
299
+ /** getTreeObj
300
+ * [Function that recieves a tree hash and returns the tree object]
301
+ *
302
+ * @param {string} xtree (required)
303
+ *
304
+ * @return void
305
+ */
306
+ function getTreeObj(xtree, xauthor) {
307
+
308
+ if(xauthor != ""){
309
+ xauthor = xauthor + '/';
310
+ }
311
+
312
+ // LOADING PB
313
+ var tree_pb = pb(fs.readFileSync('node_modules/pathchain/proto/tree.proto'))
314
+
315
+ // NOT FOUND EXCEPTION
316
+ var fileContents;
317
+ try {
318
+ fileContents = fs.readFileSync("files/" + xauthor + "trees/" + xtree);
319
+ } catch (err) {
320
+ if (err.code === 'ENOENT') {
321
+ return "Tree not found";
322
+ } else {
323
+ throw err;
324
+ }
325
+ }
326
+
327
+ // DECODING NODE
328
+ var tree_enc = fileContents
329
+ var tree_obj = tree_pb.tree.decode(tree_enc)
330
+
331
+ return tree_obj;
332
+ }
333
+
334
+
335
+ /** getTreelinkObj
264
336
  * [Function that recieves a nodelink hash and returns the nodelink object]
265
337
  *
266
338
  * @param {string} xnodelink (required)
267
339
  *
268
340
  * @return void
269
341
  */
270
- function getNodelinkObj(xnodelink, xauthor) {
342
+ function getTreelinkObj(xnodelink, xauthor) {
271
343
 
272
344
  if(xauthor != ""){
273
345
  xauthor = xauthor + '/';
@@ -282,7 +354,7 @@ function getNodelinkObj(xnodelink, xauthor) {
282
354
  fileContents = fs.readFileSync("files/" + xauthor + "nodelinks/" + xnodelink);
283
355
  } catch (err) {
284
356
  if (err.code === 'ENOENT') {
285
- return "Nodelink not found";
357
+ return "Treelink not found";
286
358
  } else {
287
359
  throw err;
288
360
  }
@@ -295,4 +367,41 @@ function getNodelinkObj(xnodelink, xauthor) {
295
367
  return nodelink_obj;
296
368
  }
297
369
 
298
- module.exports = { getCurrentDate, getMomentObj, getPioneerObj, getSecretObj, getEntityObj, getNodeObj, getPathObj, getLabelObj, getNodelinkObj }
370
+
371
+ /** getLabelObj
372
+ * [Function that recieves a label hash and returns the label object]
373
+ *
374
+ * @param {string} xlabel (required)
375
+ *
376
+ * @return void
377
+ */
378
+ function getLabelObj(xlabel, xauthor) {
379
+
380
+ if(xauthor != ""){
381
+ xauthor = xauthor + '/';
382
+ }
383
+
384
+ // LOADING PB
385
+ var label_pb = pb(fs.readFileSync('node_modules/pathchain/proto/label.proto'))
386
+
387
+ // NOT FOUND EXCEPTION
388
+ var fileContents;
389
+ try {
390
+ fileContents = fs.readFileSync("files/" + xauthor + "labels/" + xlabel);
391
+ } catch (err) {
392
+ if (err.code === 'ENOENT') {
393
+ return "Label not found";
394
+ } else {
395
+ throw err;
396
+ }
397
+ }
398
+
399
+ // DECODING NODE
400
+ var label_enc = fileContents
401
+ var label_obj = label_pb.label.decode(label_enc)
402
+
403
+ return label_obj;
404
+ }
405
+
406
+
407
+ module.exports = { getCurrentDate, getMomentObj, getPioneerObj, getSecretObj, getEntityObj, getNodeObj, getNodelinkObj, getPathObj, getPathlinkObj, getTreeObj, getTreelinkObj, getLabelObj }
package/index.js CHANGED
@@ -107,6 +107,7 @@ exports.getEntityObj = (xentity, xauthor="") => {
107
107
  return entity_object;
108
108
  }
109
109
 
110
+
110
111
  ////////////////
111
112
  /// SECRET ///
112
113
  ////////////////
@@ -182,6 +183,33 @@ exports.getNodeObj = (xnode, xauthor="") => {
182
183
  }
183
184
 
184
185
 
186
+ ///////////////////////
187
+ /// NODELINK ///
188
+ ///////////////////////
189
+
190
+ /** makeNodelink
191
+ * [Nodelink maker]
192
+ *
193
+ * @return {string} nodelink_buffer
194
+ */
195
+ exports.makeNodelink = (first="", second="", xauthor = "", ancestor = "", format = 'MM DD YYYY HH:mm:SSS [GMT]Z') => {
196
+ const nodelink_buffer = maker.nodelink(first, second, xauthor, ancestor, format);
197
+ return nodelink_buffer;
198
+ }
199
+
200
+ /** getNodelinkObj
201
+ * [Function that recieves a nodelink hash and returns the nodelink object]
202
+ *
203
+ * @param {string} xnodelink (required)
204
+ *
205
+ * @return {obj} nodelink_object (nodelink object)
206
+ */
207
+ exports.getNodelinkObj = (xnodelink, xauthor="") => {
208
+ const nodelink_object = getter.getNodelinkObj(xnodelink, xauthor);
209
+ return nodelink_object;
210
+ }
211
+
212
+
185
213
  //////////////////
186
214
  /// PATH ///
187
215
  //////////////////
@@ -209,6 +237,87 @@ exports.getPathObj = (xpath, xauthor="") => {
209
237
  }
210
238
 
211
239
 
240
+ ///////////////////////
241
+ /// PATHLINK ///
242
+ ///////////////////////
243
+
244
+ /** makePathlink
245
+ * [Pathlink maker]
246
+ *
247
+ * @return {string} pathlink_buffer
248
+ */
249
+ exports.makePathlink = (first="", second="", xauthor = "", ancestor = "", format = 'MM DD YYYY HH:mm:SSS [GMT]Z') => {
250
+ const pathlink_buffer = maker.pathlink(first, second, xauthor, ancestor, format);
251
+ return pathlink_buffer;
252
+ }
253
+
254
+ /** getPathlinkObj
255
+ * [Function that recieves a pathlink hash and returns the pathlink object]
256
+ *
257
+ * @param {string} xpathlink (required)
258
+ *
259
+ * @return {obj} pathlink_object (pathlink object)
260
+ */
261
+ exports.getPathlinkObj = (xpathlink, xauthor="") => {
262
+ const pathlink_object = getter.getPathlinkObj(xpathlink, xauthor);
263
+ return pathlink_object;
264
+ }
265
+
266
+
267
+ //////////////////
268
+ /// TREE ///
269
+ //////////////////
270
+
271
+ /** makeTree
272
+ * [Tree maker]
273
+ *
274
+ * @return {string} tree_buffer
275
+ */
276
+ exports.makeTree = (text ="", head="", xauthor = "", ancestor="", format = 'MM DD YYYY HH:mm:SSS [GMT]Z') => {
277
+ const tree_buffer = maker.tree(text, head, xauthor, ancestor, format);
278
+ return tree_buffer;
279
+ }
280
+
281
+ /** getTreeObj
282
+ * [Function that recieves a tree hash and returns the tree object]
283
+ *
284
+ * @param {string} xtree (required)
285
+ *
286
+ * @return {obj} tree_object (tree object)
287
+ */
288
+ exports.getTreeObj = (xtree, xauthor="") => {
289
+ const tree_object = getter.getTreeObj(xtree, xauthor);
290
+ return tree_object;
291
+ }
292
+
293
+
294
+ ///////////////////////
295
+ /// TREELINK ///
296
+ ///////////////////////
297
+
298
+ /** makeTreelink
299
+ * [Treelink maker]
300
+ *
301
+ * @return {string} treelink_buffer
302
+ */
303
+ exports.makeTreelink = (first="", second="", xauthor = "", ancestor = "", format = 'MM DD YYYY HH:mm:SSS [GMT]Z') => {
304
+ const treelink_buffer = maker.treelink(first, second, xauthor, ancestor, format);
305
+ return treelink_buffer;
306
+ }
307
+
308
+ /** getTreelinkObj
309
+ * [Function that recieves a treelink hash and returns the treelink object]
310
+ *
311
+ * @param {string} xtreelink (required)
312
+ *
313
+ * @return {obj} treelink_object (treelink object)
314
+ */
315
+ exports.getTreelinkObj = (xtreelink, xauthor="") => {
316
+ const treelink_object = getter.getTreelinkObj(xtreelink, xauthor);
317
+ return treelink_object;
318
+ }
319
+
320
+
212
321
  ////////////////////
213
322
  /// LABEL ///
214
323
  ////////////////////
@@ -235,29 +344,3 @@ exports.getLabelObj = (xlabel, xauthor="") => {
235
344
  return label_object;
236
345
  }
237
346
 
238
- ///////////////////////
239
- /// NODELINK ///
240
- ///////////////////////
241
-
242
- /** makeNodelink
243
- * [Nodelink maker]
244
- *
245
- * @return {string} nodelink_buffer
246
- */
247
- exports.makeNodelink = (first="", second="", xauthor = "", ancestor = "", format = 'MM DD YYYY HH:mm:SSS [GMT]Z') => {
248
- const nodelink_buffer = maker.nodelink(first, second, xauthor, ancestor, format);
249
- return nodelink_buffer;
250
- }
251
-
252
- /** getNodelinkObj
253
- * [Function that recieves a nodelink hash and returns the nodelink object]
254
- *
255
- * @param {string} xnodelink (required)
256
- *
257
- * @return {obj} nodelink_object (nodelink object)
258
- */
259
- exports.getNodelinkObj = (xnodelink, xauthor="") => {
260
- const nodelink_object = getter.getNodelinkObj(xnodelink, xauthor);
261
- return nodelink_object;
262
- }
263
-
package/maker.js CHANGED
@@ -248,8 +248,57 @@ function node(text, author, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
248
248
  }
249
249
 
250
250
 
251
+ /** nodelink
252
+ * [Label Protocol Buffer Creation]
253
+ *
254
+ * @param {string} author (optional, default=pioneer_hash)
255
+ * @param {string} file (optional)
256
+ * @param {string} str (optional)
257
+ * @param {string} format (required)
258
+ *
259
+ * @return {string} nodelink_hash
260
+ */
261
+ function nodelink(first, second, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
262
+ var nodelink_pb = pb(fs.readFileSync('node_modules/pathchain/proto/nodelink.proto'))
263
+
264
+ if(first == "" || second == "") return "Two nodes are required to create a nodelink";
265
+
266
+ var author_folder = author;
267
+ if(author == ""){
268
+ author = pioneer();
269
+ author_folder = "";
270
+ }else{
271
+ author_folder = author_folder + '/';
272
+ }
273
+
274
+ var register = new Date()
275
+ register = dt.format(register, dt.compile(format, true));
276
+
277
+ var register_moment_hash = moment(register, 0, 0, 0, 0, 0, format)
278
+
279
+ var nodelink_hash = sha256(register_moment_hash + "_" + author);
280
+
281
+ if(ancestor == ""){
282
+ ancestor = nodelink_hash;
283
+ }
284
+
285
+ var buffer = nodelink_pb.nodelink.encode({
286
+ register: "moments/" + register_moment_hash,
287
+ author: "etities/" + author,
288
+ first: "nodes/" + first,
289
+ second: "nodes/" + second,
290
+ ancestor: author_folder + "nodelinks/" + ancestor,
291
+ tag: author_folder + "nodelinks/" + nodelink_hash
292
+ })
251
293
 
252
- /**
294
+ checker.checkDir("files/" + author_folder + "nodelinks/") // checking
295
+ fs.writeFileSync("files/" + author_folder + "nodelinks/" + nodelink_hash, buffer);
296
+
297
+ return nodelink_hash;
298
+ }
299
+
300
+
301
+ /** path
253
302
  * [Pioneer Protocol Buffer Creation]
254
303
  *
255
304
  * @param {string} author (optional, default=pioneer_hash)
@@ -294,11 +343,11 @@ function path(text, head, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]
294
343
  checker.checkDir("files/" + author_folder + "paths/") // checking
295
344
  fs.writeFileSync("files/" + author_folder + "paths/" + path_hash, buffer);
296
345
 
297
- return author_folder + "/paths/" + path_hash;
346
+ return path_hash;
298
347
  }
299
348
 
300
349
 
301
- /** label
350
+ /** pathlink
302
351
  * [Label Protocol Buffer Creation]
303
352
  *
304
353
  * @param {string} author (optional, default=pioneer_hash)
@@ -306,10 +355,12 @@ function path(text, head, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]
306
355
  * @param {string} str (optional)
307
356
  * @param {string} format (required)
308
357
  *
309
- * @return {string} label_hash
358
+ * @return {string} pathlink_hash
310
359
  */
311
- function label(text, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
312
- var label_pb = pb(fs.readFileSync('node_modules/pathchain/proto/label.proto'))
360
+ function pathlink(first, second, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
361
+ var pathlink_pb = pb(fs.readFileSync('node_modules/pathchain/proto/pathlink.proto'))
362
+
363
+ if(first == "" || second == "") return "Two paths are required to create a pathlink";
313
364
 
314
365
  var author_folder = author;
315
366
  if(author == ""){
@@ -324,27 +375,78 @@ function label(text, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
324
375
 
325
376
  var register_moment_hash = moment(register, 0, 0, 0, 0, 0, format)
326
377
 
327
- var label_hash = sha256(register_moment_hash + "_" + author);
378
+ var pathlink_hash = sha256(register_moment_hash + "_" + author);
328
379
 
329
380
  if(ancestor == ""){
330
- ancestor = label_hash;
381
+ ancestor = pathlink_hash;
331
382
  }
332
383
 
333
- var buffer = label_pb.label.encode({
384
+ var buffer = pathlink_pb.pathlink.encode({
334
385
  register: "moments/" + register_moment_hash,
335
386
  author: "etities/" + author,
336
- text: text,
337
- ancestor: author_folder + "labels/" + ancestor,
338
- tag: author_folder + "labels/" + label_hash
387
+ first: "paths/" + first,
388
+ second: "paths/" + second,
389
+ ancestor: author_folder + "pathlinks/" + ancestor,
390
+ tag: author_folder + "pathlinks/" + pathlink_hash
339
391
  })
340
392
 
341
- checker.checkDir("files/" + author_folder + "labels/") // checking
342
- fs.writeFileSync("files/" + author_folder + "labels/" + label_hash, buffer);
393
+ checker.checkDir("files/" + author_folder + "pathlinks/") // checking
394
+ fs.writeFileSync("files/" + author_folder + "pathlinks/" + pathlink_hash, buffer);
343
395
 
344
- return label_hash;
396
+ return pathlink_hash;
345
397
  }
346
398
 
347
- /** nodelink
399
+
400
+ /** tree
401
+ * [Pioneer Protocol Buffer Creation]
402
+ *
403
+ * @param {string} author (optional, default=pioneer_hash)
404
+ * @param {string} text (optional, default=tree_hash)
405
+ * @param {string} head (required)
406
+ * @param {string} ancestor (optional, default=tree_hash)
407
+ * @param {string} format (required)
408
+ *
409
+ * @return {string} tree_hash
410
+ */
411
+ function tree(text, head, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
412
+ var tree_pb = pb(fs.readFileSync('node_modules/pathchain/proto/tree.proto'))
413
+
414
+ var author_folder = author;
415
+ if(author == ""){
416
+ author = pioneer();
417
+ author_folder = "";
418
+ }else{
419
+ author_folder = author_folder + '/';
420
+ }
421
+
422
+ var register = new Date()
423
+ register = dt.format(register, dt.compile(format, true));
424
+
425
+ var register_moment_hash = moment(register, 0, 0, 0, 0, 0, format)
426
+
427
+ var tree_hash = sha256(register_moment_hash + "_" + author);
428
+
429
+ if(text == ""){ text = tree_hash; }
430
+ if(head == ""){ return "Head node_link is required to create a tree!" }
431
+ if(ancestor == ""){ ancestor = tree_hash; }
432
+
433
+ var buffer = tree_pb.tree.encode({
434
+ register: "moments/"+register_moment_hash,
435
+ author: author,
436
+ text: text,
437
+ head: "nodelinks/" + head,
438
+ ancestor: author_folder + "trees/" + ancestor,
439
+ tag: author_folder + "trees/" + tree_hash,
440
+ })
441
+
442
+ checker.checkDir("files/" + author_folder + "trees/") // checking
443
+ fs.writeFileSync("files/" + author_folder + "trees/" + tree_hash, buffer);
444
+
445
+ return tree_hash;
446
+ }
447
+
448
+
449
+ /** treelink
348
450
  * [Label Protocol Buffer Creation]
349
451
  *
350
452
  * @param {string} author (optional, default=pioneer_hash)
@@ -352,12 +454,12 @@ function label(text, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
352
454
  * @param {string} str (optional)
353
455
  * @param {string} format (required)
354
456
  *
355
- * @return {string} nodelink_hash
457
+ * @return {string} treelink_hash
356
458
  */
357
- function nodelink(first, second, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
358
- var nodelink_pb = pb(fs.readFileSync('node_modules/pathchain/proto/nodelink.proto'))
459
+ function treelink(first, second, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
460
+ var treelink_pb = pb(fs.readFileSync('node_modules/pathchain/proto/treelink.proto'))
359
461
 
360
- if(first == "" || second == "") return "Two nodes are required to create a nodelink";
462
+ if(first == "" || second == "") return "Two trees are required to create a treelink";
361
463
 
362
464
  var author_folder = author;
363
465
  if(author == ""){
@@ -372,26 +474,73 @@ function nodelink(first, second, author, ancestor, format = 'MM DD YYYY HH:mm:SS
372
474
 
373
475
  var register_moment_hash = moment(register, 0, 0, 0, 0, 0, format)
374
476
 
375
- var nodelink_hash = sha256(register_moment_hash + "_" + author);
477
+ var treelink_hash = sha256(register_moment_hash + "_" + author);
376
478
 
377
479
  if(ancestor == ""){
378
- ancestor = nodelink_hash;
480
+ ancestor = treelink_hash;
379
481
  }
380
482
 
381
- var buffer = nodelink_pb.nodelink.encode({
483
+ var buffer = treelink_pb.treelink.encode({
382
484
  register: "moments/" + register_moment_hash,
383
485
  author: "etities/" + author,
384
- first: "nodes/" + first,
385
- second: "nodes/" + second,
386
- ancestor: author_folder + "nodelinks/" + ancestor,
387
- tag: author_folder + "nodelinks/" + nodelink_hash
486
+ first: "trees/" + first,
487
+ second: "trees/" + second,
488
+ ancestor: author_folder + "treelinks/" + ancestor,
489
+ tag: author_folder + "treelinks/" + treelink_hash
388
490
  })
389
491
 
390
- checker.checkDir("files/" + author_folder + "nodelinks/") // checking
391
- fs.writeFileSync("files/" + author_folder + "nodelinks/" + nodelink_hash, buffer);
492
+ checker.checkDir("files/" + author_folder + "treelinks/") // checking
493
+ fs.writeFileSync("files/" + author_folder + "treelinks/" + treelink_hash, buffer);
392
494
 
393
- return nodelink_hash;
495
+ return treelink_hash;
496
+ }
497
+
498
+
499
+ /** label
500
+ * [Label Protocol Buffer Creation]
501
+ *
502
+ * @param {string} author (optional, default=pioneer_hash)
503
+ * @param {string} file (optional)
504
+ * @param {string} str (optional)
505
+ * @param {string} format (required)
506
+ *
507
+ * @return {string} label_hash
508
+ */
509
+ function label(text, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [GMT]Z') {
510
+ var label_pb = pb(fs.readFileSync('node_modules/pathchain/proto/label.proto'))
511
+
512
+ var author_folder = author;
513
+ if(author == ""){
514
+ author = pioneer();
515
+ author_folder = "";
516
+ }else{
517
+ author_folder = author_folder + '/';
518
+ }
519
+
520
+ var register = new Date()
521
+ register = dt.format(register, dt.compile(format, true));
522
+
523
+ var register_moment_hash = moment(register, 0, 0, 0, 0, 0, format)
524
+
525
+ var label_hash = sha256(register_moment_hash + "_" + author);
526
+
527
+ if(ancestor == ""){
528
+ ancestor = label_hash;
529
+ }
530
+
531
+ var buffer = label_pb.label.encode({
532
+ register: "moments/" + register_moment_hash,
533
+ author: "etities/" + author,
534
+ text: text,
535
+ ancestor: author_folder + "labels/" + ancestor,
536
+ tag: author_folder + "labels/" + label_hash
537
+ })
538
+
539
+ checker.checkDir("files/" + author_folder + "labels/") // checking
540
+ fs.writeFileSync("files/" + author_folder + "labels/" + label_hash, buffer);
541
+
542
+ return label_hash;
394
543
  }
395
544
 
396
545
 
397
- module.exports = { moment, pioneer, secret, entity, node, path, label, nodelink }
546
+ module.exports = { moment, pioneer, secret, entity, node, nodelink, path, pathlink, tree, treelink, label }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pathchain",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "dependencies": {
5
5
  "date-and-time": "^3.0.2",
6
6
  "empty-dir": "^3.0.0",