dreamteamer 0.6.2 → 0.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dreamteamer",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "A workspace compiler for coding agents — schema-validated records as plain files over git, compiled into every harness",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Gilad Khen <giladkhen@gmail.com>",
@@ -295,15 +295,32 @@ function parseViewValue(raw) {
295
295
  return raw;
296
296
  }
297
297
 
298
- /** Assign `a.b.c` into a nested object, creating plain objects on the way down. */
298
+ /**
299
+ * Assign `a.b.c` into a nested object, creating plain objects on the way down.
300
+ *
301
+ * An empty or null value REMOVES the key rather than writing `''` — the same convention
302
+ * `store.set` has always used for top-level fields (`if (v === null || v === '') delete next[k]`),
303
+ * extended to the nested paths the meta verbs address. Without it there was no way to take a key
304
+ * back out of a `ui-view`'s `options`, so a superseded option lingered as `provider: ''` and the
305
+ * only cure was `rm` + `add`.
306
+ *
307
+ * Intermediate objects are not created on the way to a delete: unsetting `a.b` on a record with no
308
+ * `a` should leave the record alone, not grow an empty `a: {}`.
309
+ */
299
310
  function assignPath(target, dotted, value) {
300
311
  const keys = dotted.split('.');
312
+ const leaf = keys[keys.length - 1];
313
+ const unset = value === null || value === '';
301
314
  let node = target;
302
315
  for (const k of keys.slice(0, -1)) {
303
- if (node[k] == null || typeof node[k] !== 'object' || Array.isArray(node[k])) node[k] = {};
316
+ if (node[k] == null || typeof node[k] !== 'object' || Array.isArray(node[k])) {
317
+ if (unset) return;
318
+ node[k] = {};
319
+ }
304
320
  node = node[k];
305
321
  }
306
- node[keys[keys.length - 1]] = value;
322
+ if (unset) delete node[leaf];
323
+ else node[leaf] = value;
307
324
  }
308
325
 
309
326
  const VIEW_META_FLAGS = new Set(['id', 'json', 'force']);