gitsheets 0.21.6 → 0.22.2

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.
@@ -142,7 +142,7 @@ exports.handler = async function upsert({
142
142
 
143
143
  if (existingBlob) {
144
144
  const existingRecord = await inputSheet.readRecord(existingBlob);
145
- inputRecord = deepmerge(inputRecord, existingRecord);
145
+ inputRecord = deepmerge(existingRecord, inputRecord);
146
146
  }
147
147
  }
148
148
  }
package/lib/Sheet.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const path = require('path');
2
- const v8 = require('v8');
2
+ // const v8 = require('v8');
3
3
  const vm = require('vm');
4
4
  const sortKeys = require('sort-keys');
5
5
  const TOML = require('@iarna/toml');
@@ -40,7 +40,7 @@ class Sheet extends Configurable
40
40
  }
41
41
  }
42
42
 
43
- #recordCache;
43
+ // #recordCache;
44
44
 
45
45
  constructor ({ workspace, name, dataTree = null, configPath = null }) {
46
46
  if (!workspace) {
@@ -57,7 +57,7 @@ class Sheet extends Configurable
57
57
  this.configPath = configPath || `.gitsheets/${name}.toml`;
58
58
  this.dataTree = dataTree || workspace.root;
59
59
 
60
- this.#recordCache = new Map();
60
+ // this.#recordCache = new Map();
61
61
 
62
62
  Object.freeze(this);
63
63
  }
@@ -116,22 +116,28 @@ class Sheet extends Configurable
116
116
  }
117
117
 
118
118
  async readRecord (blob, path = null) {
119
- const cache = this.#recordCache.get(blob.hash);
119
+ /**
120
+ * caching is disabled for now, because v8.serialize doesn't
121
+ * preserve the custom Date classes that iarna/toml uses to
122
+ * preserve extended date types
123
+ */
124
+
125
+ // const cache = this.#recordCache.get(blob.hash);
120
126
 
121
127
  let record;
122
128
 
123
- if (cache) {
124
- record = v8.deserialize(cache);
125
- } else {
126
- const toml = await blob.read();
129
+ // if (cache) {
130
+ // record = v8.deserialize(cache);
131
+ // } else {
132
+ const toml = await blob.read();
127
133
 
128
- try {
129
- record = TOML.parse(toml);
130
- } catch (err) {
131
- err.file = path;
132
- throw err;
133
- }
134
+ try {
135
+ record = TOML.parse(toml);
136
+ } catch (err) {
137
+ err.file = path;
138
+ throw err;
134
139
  }
140
+ // }
135
141
 
136
142
  // annotate with gitsheets keys
137
143
  record[RECORD_SHEET_KEY] = this.name;
@@ -140,9 +146,9 @@ class Sheet extends Configurable
140
146
  }
141
147
 
142
148
  // fill cache
143
- if (!cache) {
144
- this.#recordCache.set(blob.hash, v8.serialize(record));
145
- }
149
+ // if (!cache) {
150
+ // this.#recordCache.set(blob.hash, toml);
151
+ // }
146
152
 
147
153
  return record;
148
154
  }
@@ -112,6 +112,7 @@ class Template
112
112
 
113
113
  if (nextTree) {
114
114
  currentTree = nextTree;
115
+ pathPrefix = path.join(pathPrefix, nextName);
115
116
  } else {
116
117
  return;
117
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitsheets",
3
- "version": "0.21.6",
3
+ "version": "0.22.2",
4
4
  "description": "A toolkit for using a git repository to store low-volume, high-touch, human-scale data",
5
5
  "main": "lib/GitSheets.js",
6
6
  "scripts": {