@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.
@@ -1862,6 +1862,7 @@ var gobjJs = function(e) {
1862
1862
  function Sr(e, t, n, r) {
1863
1863
  if (e && !sr(e) && hn("GObj bad instanceof"), !Zn(t)) return hn("kw is not an object"), -1;
1864
1864
  if (!tr(n)) return hn(`${e ? et(e) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(n)}`), -1;
1865
+ if ("" === n) return hn((e ? et(e) + ": " : "") + "kw_set_dict_value(): path empty"), -1;
1865
1866
  let l = n.split("`"), o = l.length;
1866
1867
  for (let s = 0; s < o; s++) {
1867
1868
  let i = l[s];
@@ -3185,14 +3186,9 @@ var gobjJs = function(e) {
3185
3186
  if (!tr(n)) return hn(`jdb_delete: path must be a string: ${String(n)}`), null;
3186
3187
  let o, s = n.split("`"), i = l;
3187
3188
  for (; (o = s.shift()) && !ir(o) && i;) Zn(i) && (i = Or(null, i, e.hook, null, 0)), i = Yr(i, null, o, !1);
3188
- if (0 === s.length && i) if (er(i)) {
3189
- let e = Pr(i, r.id);
3190
- e >= 0 && i.splice(e, 1);
3191
- } else {
3192
- let t = Or(null, i, e.hook, null, 0), n = Pr(t, r.id);
3193
- n >= 0 && t.splice(n, 1);
3194
- }
3195
- return l;
3189
+ if (!i || 0 !== s.length) return hn(`jdb_delete: path not found in topic '${t}': '${n}'`), null;
3190
+ let _ = er(i) ? i : Or(null, i, e.hook, null, 0), a = Pr(_, r.id);
3191
+ return a < 0 ? (hn(`jdb_delete: record not found in topic '${t}': '${n}' '${r.id}'`), null) : (_.splice(a, 1), l);
3196
3192
  }, e.jdb_get = function(e, t, n, r) {
3197
3193
  let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
3198
3194
  return l ? (void 0 === r && (r = !0), Yr(l, e.hook, n, r)) : (hn("jdb_get: topic not found: " + t), null);
@@ -3209,7 +3205,7 @@ var gobjJs = function(e) {
3209
3205
  Tr(null, e, "hook", "data", Zt.KW_CREATE);
3210
3206
  let l = Or(null, e, "schema", {}, Zt.KW_CREATE), o = Or(null, e, "topics", {}, Zt.KW_CREATE);
3211
3207
  return Kr(l, function(e, t, n, l) {
3212
- "__" !== t.substring(0, 2) && Or(null, o, l, Fn(r), Zt.KW_CREATE);
3208
+ "__" === t.substring(0, 2) || Zn(n) || Or(null, o, l, Fn(r), Zt.KW_CREATE);
3213
3209
  }, t), e;
3214
3210
  }, e.jdb_update = function(e, t, n, r) {
3215
3211
  let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
@@ -3218,6 +3214,7 @@ var gobjJs = function(e) {
3218
3214
  if (!tr(n)) return hn(`jdb_update: path must be a string: ${String(n)}`), null;
3219
3215
  let o, s = n.split("`"), i = l;
3220
3216
  for (; (o = s.shift()) && !ir(o) && i;) Zn(i) && (i = Or(null, i, e.hook, [], Zt.KW_CREATE)), i = Yr(i, null, o, !1);
3217
+ if (!i || 0 !== s.length) return hn(`jdb_update: path not found in topic '${t}': '${n}'`), null;
3221
3218
  if (0 === s.length && i) if (er(i)) i.push(r);
3222
3219
  else if (i.id === r.id) Gn(i, r);
3223
3220
  else {