pathchain 1.1.11 → 1.1.13

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 (3) hide show
  1. package/maker.js +3 -1
  2. package/package.json +1 -1
  3. package/updater.js +8 -4
package/maker.js CHANGED
@@ -229,9 +229,11 @@ function path(text, elements, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [
229
229
  if (text == "") { text = path_hash; }
230
230
 
231
231
  let prev_link = "";
232
+ let head_link = "";
232
233
  // Building target chain
233
234
  for (let i = 0; i < elements.length; i++) {
234
235
  const current_link = link(elements[i], "", "", author, "");
236
+ if(i==0) head_link = current_link;
235
237
  if (i > 0) {
236
238
  updater.setLinkNext(prev_link, current_link);
237
239
  updater.setLinkPrev(current_link, prev_link);
@@ -245,7 +247,7 @@ function path(text, elements, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [
245
247
  register: `moments/${register_moment_hash}`,
246
248
  author: author,
247
249
  text: text,
248
- head: `links/${prev_link}`,
250
+ head: `${head_link}`,
249
251
  ancestor: `${author_folder}paths/${ancestor}`,
250
252
  tag: `${author_folder}paths/${path_hash}`,
251
253
  });
package/package.json CHANGED
@@ -34,5 +34,5 @@
34
34
  "deprecated": false,
35
35
  "description": "![image](https://user-images.githubusercontent.com/104391124/282268780-cbbc1ee6-8d97-4d80-b896-66ae3eb723dd.png)",
36
36
  "name": "pathchain",
37
- "version": "1.1.11"
37
+ "version": "1.1.13"
38
38
  }
package/updater.js CHANGED
@@ -58,6 +58,8 @@ function useSecret(xsecret, xauthor = "") {
58
58
  * @return {string} xlink
59
59
  */
60
60
  function setLinkNext(xlink = "", xnextlink = "") {
61
+ console.log("Setting link: ", xnextlink);
62
+ console.log("As NEXT link for: ", xlink);
61
63
 
62
64
  // LOADING PB
63
65
  var link_pb = pb(fs.readFileSync('node_modules/pathchain/proto/link.proto'))
@@ -67,7 +69,7 @@ function setLinkNext(xlink = "", xnextlink = "") {
67
69
 
68
70
  // NOT FOUND EXCEPTION FOR 'xlink'
69
71
  try {
70
- fileContents = fs.readFileSync("files/links/" + xlink);
72
+ fileContents = fs.readFileSync("files/" + xlink);
71
73
  } catch (err) {
72
74
  if (err.code === 'ENOENT') {
73
75
  return "Link '" + xlink + "' not found";
@@ -78,7 +80,7 @@ function setLinkNext(xlink = "", xnextlink = "") {
78
80
 
79
81
  // NOT FOUND EXCEPTION FOR 'xnextlink'
80
82
  try {
81
- fileContents = fs.readFileSync("files/links/" + xnextlink);
83
+ fileContents = fs.readFileSync("files/" + xnextlink);
82
84
  } catch (err) {
83
85
  if (err.code === 'ENOENT') {
84
86
  return "Link '" + xnextlink + "' not found";
@@ -105,6 +107,8 @@ function setLinkNext(xlink = "", xnextlink = "") {
105
107
  * @return {string} xlink
106
108
  */
107
109
  function setLinkPrev(xlink = "", xprevlink = "") {
110
+ console.log("Setting link: ", xprevlink);
111
+ console.log("As PREV link for: ", xlink);
108
112
 
109
113
  // LOADING PB
110
114
  var link_pb = pb(fs.readFileSync('node_modules/pathchain/proto/link.proto'))
@@ -114,7 +118,7 @@ function setLinkPrev(xlink = "", xprevlink = "") {
114
118
 
115
119
  // NOT FOUND EXCEPTION FOR 'xlink'
116
120
  try {
117
- fileContents = fs.readFileSync("files/links/" + xlink);
121
+ fileContents = fs.readFileSync("files/" + xlink);
118
122
  } catch (err) {
119
123
  if (err.code === 'ENOENT') {
120
124
  return "Link '" + xlink + "' not found";
@@ -125,7 +129,7 @@ function setLinkPrev(xlink = "", xprevlink = "") {
125
129
 
126
130
  // NOT FOUND EXCEPTION FOR 'xprevlink'
127
131
  try {
128
- fileContents = fs.readFileSync("files/links/" + xprevlink);
132
+ fileContents = fs.readFileSync("files/" + xprevlink);
129
133
  } catch (err) {
130
134
  if (err.code === 'ENOENT') {
131
135
  return "Link '" + xprevlink + "' not found";