@yuneta/gobj-js 7.26.9 → 7.26.10

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.
@@ -2135,6 +2135,7 @@ function Sl(e, t, n, r, l) {
2135
2135
  function Nl(e, t, n, r) {
2136
2136
  if (e && !el(e) && ir("GObj bad instanceof"), !Yr(t)) return ir("kw is not an object"), -1;
2137
2137
  if (!Jr(n)) return ir(`${e ? $t(e) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(n)}`), -1;
2138
+ if ("" === n) return ir((e ? $t(e) + ": " : "") + "kw_set_dict_value(): path empty"), -1;
2138
2139
  let l = n.split("`"), o = l.length;
2139
2140
  for (let i = 0; i < o; i++) {
2140
2141
  let s = l[i];
@@ -2508,7 +2509,7 @@ function ro(e, t, n) {
2508
2509
  yl(null, e, "hook", "data", Vn.KW_CREATE);
2509
2510
  let l = Ol(null, e, "schema", {}, Vn.KW_CREATE), o = Ol(null, e, "topics", {}, Vn.KW_CREATE);
2510
2511
  return no(l, function(e, t, n, l) {
2511
- "__" !== t.substring(0, 2) && Ol(null, o, l, jr(r), Vn.KW_CREATE);
2512
+ "__" === t.substring(0, 2) || Yr(n) || Ol(null, o, l, jr(r), Vn.KW_CREATE);
2512
2513
  }, t), e;
2513
2514
  }
2514
2515
  function lo(e, t, n, r) {
@@ -2518,6 +2519,7 @@ function lo(e, t, n, r) {
2518
2519
  if (!Jr(n)) return ir(`jdb_update: path must be a string: ${String(n)}`), null;
2519
2520
  let o, i = n.split("`"), s = l;
2520
2521
  for (; (o = i.shift()) && !tl(o) && s;) Yr(s) && (s = Ol(null, s, e.hook, [], Vn.KW_CREATE)), s = uo(s, null, o, !1);
2522
+ if (!s || 0 !== i.length) return ir(`jdb_update: path not found in topic '${t}': '${n}'`), null;
2521
2523
  if (0 === i.length && s) if (Br(s)) s.push(r);
2522
2524
  else if (s.id === r.id) Dr(s, r);
2523
2525
  else {
@@ -2533,14 +2535,9 @@ function oo(e, t, n, r) {
2533
2535
  if (!Jr(n)) return ir(`jdb_delete: path must be a string: ${String(n)}`), null;
2534
2536
  let o, i = n.split("`"), s = l;
2535
2537
  for (; (o = i.shift()) && !tl(o) && s;) Yr(s) && (s = Ol(null, s, e.hook, null, 0)), s = uo(s, null, o, !1);
2536
- if (0 === i.length && s) if (Br(s)) {
2537
- let e = Kl(s, r.id);
2538
- e >= 0 && s.splice(e, 1);
2539
- } else {
2540
- let t = Ol(null, s, e.hook, null, 0), n = Kl(t, r.id);
2541
- n >= 0 && t.splice(n, 1);
2542
- }
2543
- return l;
2538
+ if (!s || 0 !== i.length) return ir(`jdb_delete: path not found in topic '${t}': '${n}'`), null;
2539
+ let a = Br(s) ? s : Ol(null, s, e.hook, null, 0), u = Kl(a, r.id);
2540
+ return u < 0 ? (ir(`jdb_delete: record not found in topic '${t}': '${n}' '${r.id}'`), null) : (a.splice(u, 1), l);
2544
2541
  }
2545
2542
  function io(e, t) {
2546
2543
  let n = Ol(null, e, "topics", null, 0);