@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.
@@ -1861,6 +1861,7 @@ function jr(e, t, n, r, o) {
1861
1861
  function Or(e, t, n, r) {
1862
1862
  if (e && !sr(e) && mn("GObj bad instanceof"), !Xn(t)) return mn("kw is not an object"), -1;
1863
1863
  if (!er(n)) return mn(`${e ? Ze(e) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(n)}`), -1;
1864
+ if ("" === n) return mn((e ? Ze(e) + ": " : "") + "kw_set_dict_value(): path empty"), -1;
1864
1865
  let o = n.split("`"), s = o.length;
1865
1866
  for (let l = 0; l < s; l++) {
1866
1867
  let i = o[l];
@@ -3184,14 +3185,9 @@ exports.GObj = O, exports.SDATA = v, exports.SDATAAUTHZ = (e, t, n, r, o, s) =>
3184
3185
  if (!er(n)) return mn(`jdb_delete: path must be a string: ${String(n)}`), null;
3185
3186
  let s, l = n.split("`"), i = o;
3186
3187
  for (; (s = l.shift()) && !lr(s) && i;) Xn(i) && (i = jr(null, i, e.hook, null, 0)), i = Kr(i, null, s, !1);
3187
- if (0 === l.length && i) if (Zn(i)) {
3188
- let e = Cr(i, r.id);
3189
- e >= 0 && i.splice(e, 1);
3190
- } else {
3191
- let t = jr(null, i, e.hook, null, 0), n = Cr(t, r.id);
3192
- n >= 0 && t.splice(n, 1);
3193
- }
3194
- return o;
3188
+ if (!i || 0 !== l.length) return mn(`jdb_delete: path not found in topic '${t}': '${n}'`), null;
3189
+ let _ = Zn(i) ? i : jr(null, i, e.hook, null, 0), a = Cr(_, r.id);
3190
+ return a < 0 ? (mn(`jdb_delete: record not found in topic '${t}': '${n}' '${r.id}'`), null) : (_.splice(a, 1), o);
3195
3191
  }, exports.jdb_get = function(e, t, n, r) {
3196
3192
  let o = jr(null, jr(null, e, "topics", null, 0), t, null, 0);
3197
3193
  return o ? (void 0 === r && (r = !0), Kr(o, e.hook, n, r)) : (mn("jdb_get: topic not found: " + t), null);
@@ -3208,7 +3204,7 @@ exports.GObj = O, exports.SDATA = v, exports.SDATAAUTHZ = (e, t, n, r, o, s) =>
3208
3204
  yr(null, e, "hook", "data", Xt.KW_CREATE);
3209
3205
  let o = jr(null, e, "schema", {}, Xt.KW_CREATE), s = jr(null, e, "topics", {}, Xt.KW_CREATE);
3210
3206
  return Wr(o, function(e, t, n, o) {
3211
- "__" !== t.substring(0, 2) && jr(null, s, o, Pn(r), Xt.KW_CREATE);
3207
+ "__" === t.substring(0, 2) || Xn(n) || jr(null, s, o, Pn(r), Xt.KW_CREATE);
3212
3208
  }, t), e;
3213
3209
  }, exports.jdb_update = function(e, t, n, r) {
3214
3210
  let o = jr(null, jr(null, e, "topics", null, 0), t, null, 0);
@@ -3217,6 +3213,7 @@ exports.GObj = O, exports.SDATA = v, exports.SDATAAUTHZ = (e, t, n, r, o, s) =>
3217
3213
  if (!er(n)) return mn(`jdb_update: path must be a string: ${String(n)}`), null;
3218
3214
  let s, l = n.split("`"), i = o;
3219
3215
  for (; (s = l.shift()) && !lr(s) && i;) Xn(i) && (i = jr(null, i, e.hook, [], Xt.KW_CREATE)), i = Kr(i, null, s, !1);
3216
+ if (!i || 0 !== l.length) return mn(`jdb_update: path not found in topic '${t}': '${n}'`), null;
3220
3217
  if (0 === l.length && i) if (Zn(i)) i.push(r);
3221
3218
  else if (i.id === r.id) Fn(i, r);
3222
3219
  else {