use-abcd 0.2.0 → 0.2.1
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/dist/useCrud.js +48 -48
- package/package.json +13 -13
package/dist/useCrud.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef as pn, useMemo as K, useSyncExternalStore as dn, useCallback as C, useEffect as hn } from "react";
|
|
2
|
-
var
|
|
2
|
+
var Rt = typeof global == "object" && global && global.Object === Object && global, yn = typeof self == "object" && self && self.Object === Object && self, F = Rt || yn || Function("return this")(), G = F.Symbol, $t = Object.prototype, bn = $t.hasOwnProperty, gn = $t.toString, te = G ? G.toStringTag : void 0;
|
|
3
3
|
function mn(e) {
|
|
4
4
|
var t = bn.call(e, te), n = e[te];
|
|
5
5
|
try {
|
|
@@ -62,11 +62,11 @@ var Se = F["__core-js_shared__"], ot = (function() {
|
|
|
62
62
|
function Cn(e) {
|
|
63
63
|
return !!ot && ot in e;
|
|
64
64
|
}
|
|
65
|
-
var
|
|
65
|
+
var xn = Function.prototype, Rn = xn.toString;
|
|
66
66
|
function X(e) {
|
|
67
67
|
if (e != null) {
|
|
68
68
|
try {
|
|
69
|
-
return
|
|
69
|
+
return Rn.call(e);
|
|
70
70
|
} catch {
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
@@ -159,17 +159,17 @@ function Pr(e) {
|
|
|
159
159
|
return e(t);
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
var Nt = typeof exports == "object" && exports && !exports.nodeType && exports, oe = Nt && typeof module == "object" && module && !module.nodeType && module, Cr = oe && oe.exports === Nt, Ae = Cr &&
|
|
162
|
+
var Nt = typeof exports == "object" && exports && !exports.nodeType && exports, oe = Nt && typeof module == "object" && module && !module.nodeType && module, Cr = oe && oe.exports === Nt, Ae = Cr && Rt.process, ut = (function() {
|
|
163
163
|
try {
|
|
164
164
|
var e = oe && oe.require && oe.require("util").types;
|
|
165
165
|
return e || Ae && Ae.binding && Ae.binding("util");
|
|
166
166
|
} catch {
|
|
167
167
|
}
|
|
168
|
-
})(), lt = ut && ut.isTypedArray, Ut = lt ? Pr(lt) : Tr,
|
|
168
|
+
})(), lt = ut && ut.isTypedArray, Ut = lt ? Pr(lt) : Tr, xr = Object.prototype, Rr = xr.hasOwnProperty;
|
|
169
169
|
function $r(e, t) {
|
|
170
170
|
var n = T(e), r = !n && Ft(e), i = !n && !r && Pe(e), o = !n && !r && !i && Ut(e), s = n || r || i || o, c = s ? Xn(e.length, String) : [], a = c.length;
|
|
171
171
|
for (var f in e)
|
|
172
|
-
|
|
172
|
+
Rr.call(e, f) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
173
173
|
(f == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
174
174
|
i && (f == "offset" || f == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
175
175
|
o && (f == "buffer" || f == "byteLength" || f == "byteOffset") || // Skip index properties.
|
|
@@ -389,15 +389,15 @@ function Pi(e) {
|
|
|
389
389
|
function Ci(e) {
|
|
390
390
|
return this.__data__.get(e);
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function xi(e) {
|
|
393
393
|
return this.__data__.has(e);
|
|
394
394
|
}
|
|
395
|
-
var
|
|
395
|
+
var Ri = 200;
|
|
396
396
|
function $i(e, t) {
|
|
397
397
|
var n = this.__data__;
|
|
398
398
|
if (n instanceof L) {
|
|
399
399
|
var r = n.__data__;
|
|
400
|
-
if (!fe || r.length <
|
|
400
|
+
if (!fe || r.length < Ri - 1)
|
|
401
401
|
return r.push([e, t]), this.size = ++n.size, this;
|
|
402
402
|
n = this.__data__ = new N(r);
|
|
403
403
|
}
|
|
@@ -410,7 +410,7 @@ function I(e) {
|
|
|
410
410
|
I.prototype.clear = Ti;
|
|
411
411
|
I.prototype.delete = Pi;
|
|
412
412
|
I.prototype.get = Ci;
|
|
413
|
-
I.prototype.has =
|
|
413
|
+
I.prototype.has = xi;
|
|
414
414
|
I.prototype.set = $i;
|
|
415
415
|
function ji(e, t) {
|
|
416
416
|
for (var n = -1, r = e == null ? 0 : e.length, i = 0, o = []; ++n < r; ) {
|
|
@@ -434,8 +434,8 @@ function Li(e, t, n) {
|
|
|
434
434
|
function dt(e) {
|
|
435
435
|
return Li(e, We, Fi);
|
|
436
436
|
}
|
|
437
|
-
var Ce = Z(F, "DataView"),
|
|
438
|
-
(Ce && j(new Ce(new ArrayBuffer(1))) != mt || fe && j(new fe()) != ht ||
|
|
437
|
+
var Ce = Z(F, "DataView"), xe = Z(F, "Promise"), Re = Z(F, "Set"), ht = "[object Map]", Ni = "[object Object]", yt = "[object Promise]", bt = "[object Set]", gt = "[object WeakMap]", mt = "[object DataView]", Ui = X(Ce), Ki = X(fe), Bi = X(xe), Gi = X(Re), Hi = X(Te), j = J;
|
|
438
|
+
(Ce && j(new Ce(new ArrayBuffer(1))) != mt || fe && j(new fe()) != ht || xe && j(xe.resolve()) != yt || Re && j(new Re()) != bt || Te && j(new Te()) != gt) && (j = function(e) {
|
|
439
439
|
var t = J(e), n = t == Ni ? e.constructor : void 0, r = n ? X(n) : "";
|
|
440
440
|
if (r)
|
|
441
441
|
switch (r) {
|
|
@@ -682,11 +682,11 @@ function To(e, t, n) {
|
|
|
682
682
|
function Po(e, t) {
|
|
683
683
|
return e != null && To(e, t, Mo);
|
|
684
684
|
}
|
|
685
|
-
var Co = 1,
|
|
686
|
-
function
|
|
685
|
+
var Co = 1, xo = 2;
|
|
686
|
+
function Ro(e, t) {
|
|
687
687
|
return Ve(e) && Wt(t) ? Vt(le(e), t) : function(n) {
|
|
688
688
|
var r = bi(n, e);
|
|
689
|
-
return r === void 0 && r === t ? Po(n, e) : Oe(t, r, Co |
|
|
689
|
+
return r === void 0 && r === t ? Po(n, e) : Oe(t, r, Co | xo);
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
692
|
function qt(e) {
|
|
@@ -703,7 +703,7 @@ function jo(e) {
|
|
|
703
703
|
return Ve(e) ? qt(le(e)) : $o(e);
|
|
704
704
|
}
|
|
705
705
|
function Yt(e) {
|
|
706
|
-
return typeof e == "function" ? e : e == null ? Ke : typeof e == "object" ? T(e) ?
|
|
706
|
+
return typeof e == "function" ? e : e == null ? Ke : typeof e == "object" ? T(e) ? Ro(e[0], e[1]) : Eo(e) : jo(e);
|
|
707
707
|
}
|
|
708
708
|
function Io(e) {
|
|
709
709
|
return function(t, n, r) {
|
|
@@ -842,7 +842,7 @@ function Qe(e) {
|
|
|
842
842
|
const n = h(e);
|
|
843
843
|
return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function x(e, t) {
|
|
846
846
|
if (!e || typeof e != "object")
|
|
847
847
|
return !1;
|
|
848
848
|
let n;
|
|
@@ -959,7 +959,7 @@ function S(e) {
|
|
|
959
959
|
e.copy || (e.copy = on(e.original, e.options));
|
|
960
960
|
}
|
|
961
961
|
function re(e) {
|
|
962
|
-
if (!
|
|
962
|
+
if (!x(e))
|
|
963
963
|
return Qe(e);
|
|
964
964
|
if (Array.isArray(e))
|
|
965
965
|
return e.map(re);
|
|
@@ -990,9 +990,9 @@ function re(e) {
|
|
|
990
990
|
function ye(e) {
|
|
991
991
|
return Y(e) ? re(e) : e;
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function R(e) {
|
|
994
994
|
var t;
|
|
995
|
-
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent &&
|
|
995
|
+
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && R(e.parent));
|
|
996
996
|
}
|
|
997
997
|
function Pt() {
|
|
998
998
|
throw new Error("Cannot modify frozen object");
|
|
@@ -1057,7 +1057,7 @@ function ke(e, t) {
|
|
|
1057
1057
|
e.forEach((r, i) => t(i, r, e));
|
|
1058
1058
|
}
|
|
1059
1059
|
function sn(e, t, n) {
|
|
1060
|
-
if (Y(e) || !
|
|
1060
|
+
if (Y(e) || !x(e, n) || t.has(e) || Object.isFrozen(e))
|
|
1061
1061
|
return;
|
|
1062
1062
|
const r = e instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
1063
1063
|
if (t.add(e), ke(e, (o, s) => {
|
|
@@ -1103,7 +1103,7 @@ function et(e, t, n, r) {
|
|
|
1103
1103
|
let f = i.original;
|
|
1104
1104
|
i.copy && (f = i.copy), De(e), Fe(e, r, o, s), e.options.enableAutoFreeze && (e.options.updatedValues = (c = e.options.updatedValues) !== null && c !== void 0 ? c : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(f, i.original)), pe(a, t, f);
|
|
1105
1105
|
}
|
|
1106
|
-
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)),
|
|
1106
|
+
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), x(n, e.options) && e.finalities.draft.push(() => {
|
|
1107
1107
|
const o = e.type === 3 ? e.setMap : e.copy;
|
|
1108
1108
|
z(D(o, t), n) && ys(e, t);
|
|
1109
1109
|
});
|
|
@@ -1208,7 +1208,7 @@ function ue(e, t, n, r) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
1210
|
const ge = (e, t, n = !1) => {
|
|
1211
|
-
if (typeof e == "object" && e !== null && (!
|
|
1211
|
+
if (typeof e == "object" && e !== null && (!x(e, t) || n))
|
|
1212
1212
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1213
1213
|
}, Le = {
|
|
1214
1214
|
get size() {
|
|
@@ -1219,18 +1219,18 @@ const ge = (e, t, n = !1) => {
|
|
|
1219
1219
|
},
|
|
1220
1220
|
set(e, t) {
|
|
1221
1221
|
const n = h(this), r = E(n);
|
|
1222
|
-
return (!r.has(e) || !z(r.get(e), t)) && (S(n),
|
|
1222
|
+
return (!r.has(e) || !z(r.get(e), t)) && (S(n), R(n), n.assignedMap.set(e, !0), n.copy.set(e, t), et(n, e, t, ue)), this;
|
|
1223
1223
|
},
|
|
1224
1224
|
delete(e) {
|
|
1225
1225
|
if (!this.has(e))
|
|
1226
1226
|
return !1;
|
|
1227
1227
|
const t = h(this);
|
|
1228
|
-
return S(t),
|
|
1228
|
+
return S(t), R(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
|
|
1229
1229
|
},
|
|
1230
1230
|
clear() {
|
|
1231
1231
|
const e = h(this);
|
|
1232
1232
|
if (this.size) {
|
|
1233
|
-
S(e),
|
|
1233
|
+
S(e), R(e), e.assignedMap = /* @__PURE__ */ new Map();
|
|
1234
1234
|
for (const [t] of e.original)
|
|
1235
1235
|
e.assignedMap.set(t, !1);
|
|
1236
1236
|
e.copy.clear();
|
|
@@ -1245,7 +1245,7 @@ const ge = (e, t, n = !1) => {
|
|
|
1245
1245
|
get(e) {
|
|
1246
1246
|
var t, n;
|
|
1247
1247
|
const r = h(this), i = E(r).get(e), o = ((n = (t = r.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, M)) === M.mutable;
|
|
1248
|
-
if (r.options.strict && ge(i, r.options, o), o || r.finalized || !
|
|
1248
|
+
if (r.options.strict && ge(i, r.options, o), o || r.finalized || !x(i, r.options) || i !== r.original.get(e))
|
|
1249
1249
|
return i;
|
|
1250
1250
|
const s = Je.createDraft({
|
|
1251
1251
|
original: i,
|
|
@@ -1299,7 +1299,7 @@ const ge = (e, t, n = !1) => {
|
|
|
1299
1299
|
const s = o.value;
|
|
1300
1300
|
let c = e.setMap.get(s);
|
|
1301
1301
|
const a = h(c), f = ((i = (r = e.options).mark) === null || i === void 0 ? void 0 : i.call(r, c, M)) === M.mutable;
|
|
1302
|
-
if (e.options.strict && ge(s, e.options, f), !f && !a &&
|
|
1302
|
+
if (e.options.strict && ge(s, e.options, f), !f && !a && x(s, e.options) && !e.finalized && e.original.has(s)) {
|
|
1303
1303
|
const u = Je.createDraft({
|
|
1304
1304
|
original: s,
|
|
1305
1305
|
parentDraft: e,
|
|
@@ -1327,13 +1327,13 @@ const ge = (e, t, n = !1) => {
|
|
|
1327
1327
|
},
|
|
1328
1328
|
add(e) {
|
|
1329
1329
|
const t = h(this);
|
|
1330
|
-
return this.has(e) || (S(t),
|
|
1330
|
+
return this.has(e) || (S(t), R(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), et(t, e, e, ue)), this;
|
|
1331
1331
|
},
|
|
1332
1332
|
delete(e) {
|
|
1333
1333
|
if (!this.has(e))
|
|
1334
1334
|
return !1;
|
|
1335
1335
|
const t = h(this);
|
|
1336
|
-
S(t),
|
|
1336
|
+
S(t), R(t);
|
|
1337
1337
|
const n = h(e);
|
|
1338
1338
|
return n && t.setMap.has(n.original) ? (t.assignedMap.set(n.original, !1), t.setMap.delete(n.original)) : (!n && t.setMap.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.setMap.delete(e));
|
|
1339
1339
|
},
|
|
@@ -1341,7 +1341,7 @@ const ge = (e, t, n = !1) => {
|
|
|
1341
1341
|
if (!this.size)
|
|
1342
1342
|
return;
|
|
1343
1343
|
const e = h(this);
|
|
1344
|
-
S(e),
|
|
1344
|
+
S(e), R(e);
|
|
1345
1345
|
for (const t of e.original)
|
|
1346
1346
|
e.assignedMap.set(t, !1);
|
|
1347
1347
|
e.setMap.clear();
|
|
@@ -1439,7 +1439,7 @@ const ws = Reflect.ownKeys(me), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
|
1439
1439
|
) : void 0;
|
|
1440
1440
|
}
|
|
1441
1441
|
const a = c[t];
|
|
1442
|
-
if (e.options.strict && ge(a, e.options), e.finalized || !
|
|
1442
|
+
if (e.options.strict && ge(a, e.options), e.finalized || !x(a, e.options))
|
|
1443
1443
|
return a;
|
|
1444
1444
|
if (a === Me(e.original, t)) {
|
|
1445
1445
|
if (S(e), e.copy[t] = tt({
|
|
@@ -1450,7 +1450,7 @@ const ws = Reflect.ownKeys(me), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
|
1450
1450
|
options: e.options
|
|
1451
1451
|
}), typeof s == "function") {
|
|
1452
1452
|
const f = h(e.copy[t]);
|
|
1453
|
-
return S(f),
|
|
1453
|
+
return S(f), R(f), f.copy;
|
|
1454
1454
|
}
|
|
1455
1455
|
return e.copy[t];
|
|
1456
1456
|
}
|
|
@@ -1467,7 +1467,7 @@ const ws = Reflect.ownKeys(me), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
|
1467
1467
|
if (o?.set)
|
|
1468
1468
|
return o.set.call(e.proxy, n), !0;
|
|
1469
1469
|
const s = Me(E(e), t), c = h(s);
|
|
1470
|
-
return c && z(c.original, n) ? (e.copy[t] = n, e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (z(n, s) && (n !== void 0 || se(e.original, t)) || (S(e),
|
|
1470
|
+
return c && z(c.original, n) ? (e.copy[t] = n, e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (z(n, s) && (n !== void 0 || se(e.original, t)) || (S(e), R(e), se(e.original, t) && z(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, et(e, t, n, ue)), !0);
|
|
1471
1471
|
},
|
|
1472
1472
|
has(e, t) {
|
|
1473
1473
|
return t in E(e);
|
|
@@ -1495,7 +1495,7 @@ const ws = Reflect.ownKeys(me), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
|
1495
1495
|
},
|
|
1496
1496
|
deleteProperty(e, t) {
|
|
1497
1497
|
var n;
|
|
1498
|
-
return e.type === 1 ? cn.set.call(this, e, t, void 0, e.proxy) : (Me(e.original, t) !== void 0 || t in e.original ? (S(e),
|
|
1498
|
+
return e.type === 1 ? cn.set.call(this, e, t, void 0, e.proxy) : (Me(e.original, t) !== void 0 || t in e.original ? (S(e), R(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
|
|
1499
1499
|
}
|
|
1500
1500
|
};
|
|
1501
1501
|
function tt(e) {
|
|
@@ -1559,7 +1559,7 @@ function Os(e, t) {
|
|
|
1559
1559
|
};
|
|
1560
1560
|
let i, o;
|
|
1561
1561
|
t.enablePatches && (i = [], o = []);
|
|
1562
|
-
const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, M)) === M.mutable || !
|
|
1562
|
+
const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, M)) === M.mutable || !x(e, t) ? e : tt({
|
|
1563
1563
|
original: e,
|
|
1564
1564
|
parentDraft: null,
|
|
1565
1565
|
finalities: r,
|
|
@@ -1591,7 +1591,7 @@ function Ne(e) {
|
|
|
1591
1591
|
function fn(e) {
|
|
1592
1592
|
var t;
|
|
1593
1593
|
const n = h(e);
|
|
1594
|
-
if (!
|
|
1594
|
+
if (!x(e, n?.options))
|
|
1595
1595
|
return e;
|
|
1596
1596
|
const r = Q(e);
|
|
1597
1597
|
if (n && !n.operated)
|
|
@@ -1620,7 +1620,7 @@ function fn(e) {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
return i;
|
|
1622
1622
|
}
|
|
1623
|
-
function
|
|
1623
|
+
function xt(e) {
|
|
1624
1624
|
if (!Y(e))
|
|
1625
1625
|
throw new Error(`current() is only used for Draft, parameter: ${e}`);
|
|
1626
1626
|
return fn(e);
|
|
@@ -1636,7 +1636,7 @@ const Ss = (e) => function t(n, r, i) {
|
|
|
1636
1636
|
if (typeof r != "function" && (u = r), u !== void 0 && Object.prototype.toString.call(u) !== "[object Object]")
|
|
1637
1637
|
throw new Error(`Invalid options: ${u}, 'options' should be an object.`);
|
|
1638
1638
|
u = Object.assign(Object.assign({}, e), u);
|
|
1639
|
-
const l = Y(a) ?
|
|
1639
|
+
const l = Y(a) ? xt(a) : a, p = Array.isArray(u.mark) ? ((y, $) => {
|
|
1640
1640
|
for (const U of u.mark) {
|
|
1641
1641
|
if (typeof U != "function")
|
|
1642
1642
|
throw new Error(`Invalid mark: ${U}, 'mark' should be a function.`);
|
|
@@ -1650,11 +1650,11 @@ const Ss = (e) => function t(n, r, i) {
|
|
|
1650
1650
|
strict: b,
|
|
1651
1651
|
enablePatches: d
|
|
1652
1652
|
};
|
|
1653
|
-
if (!
|
|
1653
|
+
if (!x(l, _) && typeof l == "object" && l !== null)
|
|
1654
1654
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1655
1655
|
const [O, m] = Os(l, _);
|
|
1656
1656
|
if (typeof r != "function") {
|
|
1657
|
-
if (!
|
|
1657
|
+
if (!x(l, _))
|
|
1658
1658
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1659
1659
|
return [O, m];
|
|
1660
1660
|
}
|
|
@@ -1687,7 +1687,7 @@ const Ss = (e) => function t(n, r, i) {
|
|
|
1687
1687
|
if (_ === U.options) {
|
|
1688
1688
|
if (U.operated)
|
|
1689
1689
|
throw new Error("Cannot return a modified child draft.");
|
|
1690
|
-
return m([
|
|
1690
|
+
return m([xt(y)]);
|
|
1691
1691
|
}
|
|
1692
1692
|
return m([y]);
|
|
1693
1693
|
};
|
|
@@ -1790,11 +1790,11 @@ class B {
|
|
|
1790
1790
|
});
|
|
1791
1791
|
} catch (i) {
|
|
1792
1792
|
if (i.name === "AbortError" || i === ie) {
|
|
1793
|
-
this.customLog("fetch exception", "Fetch operation was cancelled by client")
|
|
1793
|
+
this.customLog("fetch exception", "Fetch operation was cancelled by client");
|
|
1794
1794
|
return;
|
|
1795
1795
|
}
|
|
1796
1796
|
if (i === ne) {
|
|
1797
|
-
this.endFetch();
|
|
1797
|
+
this.customLog("fetch exception", "Fetch operation was cancelled by user"), this.endFetch();
|
|
1798
1798
|
return;
|
|
1799
1799
|
}
|
|
1800
1800
|
this.batch(() => {
|
|
@@ -2024,7 +2024,7 @@ class B {
|
|
|
2024
2024
|
return B.instances.has(n) || B.instances.set(n, new B(n, t)), B.instances.get(n);
|
|
2025
2025
|
}
|
|
2026
2026
|
}
|
|
2027
|
-
function
|
|
2027
|
+
function xs(e) {
|
|
2028
2028
|
const t = B.createStore(e), n = dn(
|
|
2029
2029
|
t.subscribe,
|
|
2030
2030
|
t.getSnapshot,
|
|
@@ -2085,7 +2085,7 @@ function Rs(e) {
|
|
|
2085
2085
|
);
|
|
2086
2086
|
return t.customLog("snapshot", p), p;
|
|
2087
2087
|
}
|
|
2088
|
-
function
|
|
2088
|
+
function Rs(e, t) {
|
|
2089
2089
|
const n = B.instances.get(e), r = K(() => t.data, [t.data]), i = K(() => t.transitions, [t.transitions]), o = C(
|
|
2090
2090
|
(d, { tag: b, isOptimistic: w = !1 } = {}) => {
|
|
2091
2091
|
n.executeUpdate({ item: r, updater: d, tag: b, isOptimistic: w });
|
|
@@ -2130,6 +2130,6 @@ function xs(e, t) {
|
|
|
2130
2130
|
];
|
|
2131
2131
|
}
|
|
2132
2132
|
export {
|
|
2133
|
-
|
|
2134
|
-
|
|
2133
|
+
xs as useCrud,
|
|
2134
|
+
Rs as useItemState
|
|
2135
2135
|
};
|
package/package.json
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-abcd",
|
|
3
|
+
"version": "0.2.1",
|
|
3
4
|
"description": "Simple react hook for CRUD type apps",
|
|
4
5
|
"repository": {
|
|
5
6
|
"url": "https://github.com/smtrd3/use-abcd"
|
|
6
7
|
},
|
|
7
|
-
"version": "0.2.0",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
12
|
-
"main": "./dist/useCrud.js",
|
|
13
|
-
"module": "./dist/useCrud.js",
|
|
14
|
-
"types": "./dist/useCrud.d.ts",
|
|
15
9
|
"exports": {
|
|
16
10
|
".": {
|
|
17
11
|
"types": "./dist/useCrud.d.ts",
|
|
18
12
|
"import": "./dist/useCrud.js"
|
|
19
13
|
}
|
|
20
14
|
},
|
|
15
|
+
"main": "./dist/useCrud.js",
|
|
16
|
+
"module": "./dist/useCrud.js",
|
|
17
|
+
"types": "./dist/useCrud.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "vite build -c vite.lib.ts",
|
|
23
23
|
"dev": "vite",
|
|
24
24
|
"lint": "eslint .",
|
|
25
25
|
"preview": "vite preview",
|
|
26
|
+
"release": "bun run lint && bun run test && bun run build && npm publish",
|
|
26
27
|
"test": "vitest --run",
|
|
27
|
-
"test:cov": "vitest run --coverage"
|
|
28
|
-
"release": "bun run lint && bun run test && bun run build && npm publish"
|
|
28
|
+
"test:cov": "vitest run --coverage"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"lodash-es": "^4.17.21",
|
|
32
32
|
"mutative": "^1.2.0",
|
|
33
|
-
"nanoid": "^5.1.5"
|
|
34
|
-
"react": "^19.1.1",
|
|
35
|
-
"react-dom": "^19.1.1",
|
|
36
|
-
"use-mutative": "^1.3.0"
|
|
33
|
+
"nanoid": "^5.1.5"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
36
|
"@eslint/js": "^9.33.0",
|
|
@@ -53,9 +50,12 @@
|
|
|
53
50
|
"globals": "^16.3.0",
|
|
54
51
|
"jsdom": "^26.1.0",
|
|
55
52
|
"msw": "^2.11.1",
|
|
53
|
+
"react": "^19.1.1",
|
|
54
|
+
"react-dom": "^19.1.1",
|
|
56
55
|
"tailwindcss": "^4.1.13",
|
|
57
56
|
"typescript": "~5.8.3",
|
|
58
57
|
"typescript-eslint": "^8.39.1",
|
|
58
|
+
"use-mutative": "^1.3.0",
|
|
59
59
|
"vite": "^7.1.2",
|
|
60
60
|
"vite-plugin-dts": "^4.5.4",
|
|
61
61
|
"vitest": "^3.2.4",
|