@cyberskill/shared 2.20.0 → 2.21.0
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/config/storybook/storybook.main.cjs +1 -1
- package/dist/config/storybook/storybook.main.js +1 -1
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.js +6 -6
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.js +5 -5
- package/dist/node/mongo/mongo-controller.test.unit.d.ts +1 -0
- package/dist/node/mongo/mongo.test.unit.d.ts +1 -0
- package/dist/node/mongo/mongo.util.cjs +2 -2
- package/dist/node/mongo/mongo.util.d.ts +9 -203
- package/dist/node/mongo/mongo.util.js +70 -68
- package/dist/node/path/path.constant.cjs +1 -1
- package/dist/node/path/path.constant.js +113 -109
- package/dist/node/path/path.test.unit.d.ts +1 -0
- package/dist/node/path/path.util.d.ts +2 -2
- package/dist/react/loading/loading.component.cjs +2 -2
- package/dist/react/loading/loading.component.js +32 -19
- package/dist/react/loading/loading.test.unit.d.ts +1 -0
- package/dist/react/loading/loading.type.d.ts +2 -1
- package/dist/util/common/common.test.unit.d.ts +1 -0
- package/dist/util/common/common.util.cjs +1 -1
- package/dist/util/common/common.util.js +14 -15
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.js +16 -15
- package/dist/util/object/index.cjs +1 -1
- package/dist/util/object/index.js +4 -3
- package/dist/util/object/object.test.unit.d.ts +1 -0
- package/dist/util/object/object.util.cjs +1 -1
- package/dist/util/object/object.util.d.ts +10 -30
- package/dist/util/object/object.util.js +102 -69
- package/dist/util/serializer/serializer.test.unit.d.ts +1 -0
- package/dist/util/serializer/serializer.util.cjs +1 -1
- package/dist/util/serializer/serializer.util.js +19 -16
- package/dist/util/string/string.test.unit.d.ts +1 -0
- package/dist/util/string/string.util.cjs +1 -1
- package/dist/util/string/string.util.d.ts +4 -3
- package/dist/util/string/string.util.js +32 -41
- package/dist/util/validate/validate.test.unit.d.ts +1 -0
- package/dist/util/validate/validate.util.cjs +1 -1
- package/dist/util/validate/validate.util.js +9 -9
- package/package.json +37 -45
- /package/dist/node_modules/.pnpm/{vitest@4.0.13_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.2_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@4.0.13_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.2_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +0 -0
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID as z } from "node:crypto";
|
|
2
2
|
import Y from "migrate-mongo";
|
|
3
3
|
import Z from "mongoose-aggregate-paginate-v2";
|
|
4
4
|
import tt from "mongoose-paginate-v2";
|
|
5
|
-
import { v4 as W } from "uuid";
|
|
6
5
|
import { MONGO_SLUG_MAX_ATTEMPTS as et } from "./mongo.constant.js";
|
|
7
|
-
import { getNestedValue as rt, setNestedValue as st, normalizeMongoFilter as F } from "../../util/object/object.util.js";
|
|
6
|
+
import { deepClone as J, getNestedValue as rt, setNestedValue as st, normalizeMongoFilter as F } from "../../util/object/object.util.js";
|
|
8
7
|
import { regexSearchMapper as nt } from "../../util/common/common.util.js";
|
|
9
|
-
import { writeFileSync as
|
|
10
|
-
import { PATH as I, MIGRATE_MONGO_CONFIG as
|
|
8
|
+
import { writeFileSync as W, pathExistsSync as it, readFileSync as ot, appendFileSync as lt } from "../fs/fs.util.js";
|
|
9
|
+
import { PATH as I, MIGRATE_MONGO_CONFIG as k } from "../path/path.constant.js";
|
|
11
10
|
import { validate as ct } from "../../util/validate/validate.util.js";
|
|
12
11
|
import { generateShortId as ut, generateSlug as G } from "../../util/string/string.util.js";
|
|
13
12
|
import { RESPONSE_STATUS as A } from "../../constant/response-status.js";
|
|
14
13
|
import { catchError as D } from "../log/log.util.js";
|
|
15
|
-
var at = Object.defineProperty, ft = Object.defineProperties, dt = Object.getOwnPropertyDescriptors,
|
|
14
|
+
var at = Object.defineProperty, ft = Object.defineProperties, dt = Object.getOwnPropertyDescriptors, B = Object.getOwnPropertySymbols, pt = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable, q = (n, e, t) => e in n ? at(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, N = (n, e) => {
|
|
16
15
|
for (var t in e || (e = {}))
|
|
17
|
-
pt.call(e, t) &&
|
|
18
|
-
if (
|
|
19
|
-
for (var t of
|
|
20
|
-
mt.call(e, t) &&
|
|
16
|
+
pt.call(e, t) && q(n, t, e[t]);
|
|
17
|
+
if (B)
|
|
18
|
+
for (var t of B(e))
|
|
19
|
+
mt.call(e, t) && q(n, t, e[t]);
|
|
21
20
|
return n;
|
|
22
|
-
}, $ = (n, e) => ft(n, dt(e)), ht = (n, e, t) =>
|
|
21
|
+
}, $ = (n, e) => ft(n, dt(e)), ht = (n, e, t) => q(n, typeof e != "symbol" ? e + "" : e, t), v = (n, e, t) => new Promise((r, s) => {
|
|
23
22
|
var i = (c) => {
|
|
24
23
|
try {
|
|
25
24
|
l(t.next(c));
|
|
@@ -35,6 +34,9 @@ var at = Object.defineProperty, ft = Object.defineProperties, dt = Object.getOwn
|
|
|
35
34
|
}, l = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(i, o);
|
|
36
35
|
l((t = t.apply(n, e)).next());
|
|
37
36
|
});
|
|
37
|
+
function K(n) {
|
|
38
|
+
return n != null && typeof n == "object";
|
|
39
|
+
}
|
|
38
40
|
function w(n) {
|
|
39
41
|
return n === n.toUpperCase() ? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase() : n;
|
|
40
42
|
}
|
|
@@ -48,7 +50,7 @@ const x = {
|
|
|
48
50
|
*/
|
|
49
51
|
createGenericFields() {
|
|
50
52
|
return {
|
|
51
|
-
id:
|
|
53
|
+
id: z(),
|
|
52
54
|
isDel: !1,
|
|
53
55
|
createdAt: /* @__PURE__ */ new Date(),
|
|
54
56
|
updatedAt: /* @__PURE__ */ new Date()
|
|
@@ -88,7 +90,7 @@ const x = {
|
|
|
88
90
|
createGenericSchema(n) {
|
|
89
91
|
return new n.Schema(
|
|
90
92
|
{
|
|
91
|
-
id: { type: String, default: () =>
|
|
93
|
+
id: { type: String, default: () => z(), unique: !0 },
|
|
92
94
|
isDel: { type: Boolean, default: !1 }
|
|
93
95
|
},
|
|
94
96
|
{ timestamps: !0 }
|
|
@@ -243,12 +245,12 @@ const x = {
|
|
|
243
245
|
setConfig: (n) => {
|
|
244
246
|
const e = `// This file is automatically generated by the Cyberskill CLI.
|
|
245
247
|
module.exports = ${JSON.stringify(n, null, 4)}`;
|
|
246
|
-
|
|
248
|
+
W(I.MIGRATE_MONGO_CONFIG, e);
|
|
247
249
|
const t = `
|
|
248
|
-
${
|
|
250
|
+
${k}
|
|
249
251
|
`;
|
|
250
252
|
it(I.GIT_IGNORE) ? ot(I.GIT_IGNORE, "utf-8").split(`
|
|
251
|
-
`).includes(
|
|
253
|
+
`).includes(k) || lt(I.GIT_IGNORE, t) : W(I.GIT_IGNORE, t);
|
|
252
254
|
}
|
|
253
255
|
}),
|
|
254
256
|
/**
|
|
@@ -322,7 +324,7 @@ ${B}
|
|
|
322
324
|
});
|
|
323
325
|
}
|
|
324
326
|
};
|
|
325
|
-
function
|
|
327
|
+
function M(n, e) {
|
|
326
328
|
if (!n || !e || e.length === 0)
|
|
327
329
|
return n;
|
|
328
330
|
const t = new Set(e.map((r) => r.name));
|
|
@@ -376,7 +378,7 @@ function yt(n, e, t) {
|
|
|
376
378
|
function gt(n) {
|
|
377
379
|
return n !== null && typeof n == "object" && "toObject" in n && typeof n.toObject == "function";
|
|
378
380
|
}
|
|
379
|
-
function
|
|
381
|
+
function L(n, e, t, r, s) {
|
|
380
382
|
return v(this, null, function* () {
|
|
381
383
|
if (!e.length || !t)
|
|
382
384
|
return e;
|
|
@@ -392,7 +394,7 @@ function X(n, e, t, r, s) {
|
|
|
392
394
|
const a = t.split(".");
|
|
393
395
|
if (a.length < 2) {
|
|
394
396
|
for (const h of e)
|
|
395
|
-
yield
|
|
397
|
+
yield U(n, h, t, r, void 0, s);
|
|
396
398
|
return;
|
|
397
399
|
}
|
|
398
400
|
const u = a[0];
|
|
@@ -419,8 +421,8 @@ function X(n, e, t, r, s) {
|
|
|
419
421
|
if (d && d.options && d.options.ref) {
|
|
420
422
|
let y;
|
|
421
423
|
if (typeof d.options.ref == "function" ? y = d.options.ref(_) : typeof d.options.ref == "string" && (y = d.options.ref), y) {
|
|
422
|
-
const
|
|
423
|
-
n.models[
|
|
424
|
+
const V = w(y);
|
|
425
|
+
n.models[V] && (g = n.models[V]);
|
|
424
426
|
}
|
|
425
427
|
}
|
|
426
428
|
}
|
|
@@ -429,15 +431,15 @@ function X(n, e, t, r, s) {
|
|
|
429
431
|
if (d && d.options && d.options.ref) {
|
|
430
432
|
let y;
|
|
431
433
|
if (typeof d.options.ref == "function" ? y = d.options.ref(_) : typeof d.options.ref == "string" && (y = d.options.ref), y) {
|
|
432
|
-
const
|
|
433
|
-
n.models[
|
|
434
|
+
const V = w(y);
|
|
435
|
+
n.models[V] && (g = n.models[V]);
|
|
434
436
|
}
|
|
435
437
|
}
|
|
436
438
|
}
|
|
437
439
|
if (Array.isArray(b))
|
|
438
440
|
for (const f of b)
|
|
439
|
-
f && typeof f == "object" && (yield
|
|
440
|
-
else b && typeof b == "object" && (yield
|
|
441
|
+
f && typeof f == "object" && (yield U(n, f, m, r, u, g));
|
|
442
|
+
else b && typeof b == "object" && (yield U(n, b, m, r, u, g));
|
|
441
443
|
}
|
|
442
444
|
}
|
|
443
445
|
});
|
|
@@ -472,8 +474,8 @@ function vt(n, e, t, r, s) {
|
|
|
472
474
|
if (u && typeof u == "object")
|
|
473
475
|
if (Array.isArray(u))
|
|
474
476
|
for (const h of u)
|
|
475
|
-
h && typeof h == "object" && (yield
|
|
476
|
-
else u && typeof u == "object" && (yield
|
|
477
|
+
h && typeof h == "object" && (yield L(n, [h], o, r, m));
|
|
478
|
+
else u && typeof u == "object" && (yield L(n, [u], o, r, m));
|
|
477
479
|
}
|
|
478
480
|
});
|
|
479
481
|
}
|
|
@@ -526,7 +528,7 @@ function _t(n, e) {
|
|
|
526
528
|
return s;
|
|
527
529
|
}
|
|
528
530
|
}
|
|
529
|
-
function
|
|
531
|
+
function U(n, e, t, r, s, i) {
|
|
530
532
|
return v(this, null, function* () {
|
|
531
533
|
var o, l;
|
|
532
534
|
let c = e.__t;
|
|
@@ -544,9 +546,9 @@ function q(n, e, t, r, s, i) {
|
|
|
544
546
|
else {
|
|
545
547
|
const y = (g.includes(".") ? g.split(".").pop() : g) || "";
|
|
546
548
|
if (y) {
|
|
547
|
-
const
|
|
548
|
-
if (
|
|
549
|
-
const R = T(n,
|
|
549
|
+
const V = Ot(n, y);
|
|
550
|
+
if (V) {
|
|
551
|
+
const R = T(n, V, g, e);
|
|
550
552
|
R && (c = R);
|
|
551
553
|
}
|
|
552
554
|
}
|
|
@@ -568,7 +570,7 @@ function q(n, e, t, r, s, i) {
|
|
|
568
570
|
if (c && n.models[c]) {
|
|
569
571
|
const g = n.models[c];
|
|
570
572
|
if (g && g.schema) {
|
|
571
|
-
const p = g.schema, f = t.split(".").pop() || "", O = (y,
|
|
573
|
+
const p = g.schema, f = t.split(".").pop() || "", O = (y, V = "root") => {
|
|
572
574
|
if (!y || !y.virtuals)
|
|
573
575
|
return;
|
|
574
576
|
const R = y.virtuals;
|
|
@@ -576,18 +578,18 @@ function q(n, e, t, r, s, i) {
|
|
|
576
578
|
if (S === f) {
|
|
577
579
|
const E = R[S];
|
|
578
580
|
if (E && E.options && E.options.ref) {
|
|
579
|
-
let
|
|
580
|
-
if (typeof E.options.ref == "function" ?
|
|
581
|
-
return
|
|
581
|
+
let j;
|
|
582
|
+
if (typeof E.options.ref == "function" ? j = E.options.ref(e) : typeof E.options.ref == "string" && (j = E.options.ref), j && typeof j == "string")
|
|
583
|
+
return j;
|
|
582
584
|
}
|
|
583
585
|
}
|
|
584
586
|
if (y.paths)
|
|
585
587
|
for (const S of Object.keys(y.paths)) {
|
|
586
588
|
const E = y.paths[S];
|
|
587
589
|
if (E && E.schema) {
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
590
|
-
return
|
|
590
|
+
const j = O(E.schema, `${V}.${S}`);
|
|
591
|
+
if (j)
|
|
592
|
+
return j;
|
|
591
593
|
}
|
|
592
594
|
}
|
|
593
595
|
}, d = O(p);
|
|
@@ -601,10 +603,10 @@ function q(n, e, t, r, s, i) {
|
|
|
601
603
|
const p = i.schema, f = (d, y = "root") => {
|
|
602
604
|
if (!d || !d.virtuals)
|
|
603
605
|
return;
|
|
604
|
-
const
|
|
605
|
-
for (const R of Object.keys(
|
|
606
|
+
const V = d.virtuals;
|
|
607
|
+
for (const R of Object.keys(V))
|
|
606
608
|
if (R === g) {
|
|
607
|
-
const S =
|
|
609
|
+
const S = V[R];
|
|
608
610
|
if (S && S.options && S.options.ref) {
|
|
609
611
|
let E;
|
|
610
612
|
if (typeof S.options.ref == "function" ? E = S.options.ref(e) : typeof S.options.ref == "string" && (E = S.options.ref), E && typeof E == "string")
|
|
@@ -700,9 +702,9 @@ function Q(n, e, t, r, s, i) {
|
|
|
700
702
|
g.add(O);
|
|
701
703
|
let d = -1;
|
|
702
704
|
const y = p;
|
|
703
|
-
y.id !== void 0 ? d = l.findIndex((
|
|
704
|
-
var R, S, E,
|
|
705
|
-
return ((S = (R =
|
|
705
|
+
y.id !== void 0 ? d = l.findIndex((V) => V.id === y.id) : y._id !== void 0 && (d = l.findIndex((V) => {
|
|
706
|
+
var R, S, E, j;
|
|
707
|
+
return ((S = (R = V._id) == null ? void 0 : R.toString) == null ? void 0 : S.call(R)) === ((j = (E = y._id) == null ? void 0 : E.toString) == null ? void 0 : j.call(E));
|
|
706
708
|
})), d !== -1 && (b.docsByLocalValue.has(O) || b.docsByLocalValue.set(O, []), b.docsByLocalValue.get(O).push(d));
|
|
707
709
|
}
|
|
708
710
|
});
|
|
@@ -722,33 +724,33 @@ function Q(n, e, t, r, s, i) {
|
|
|
722
724
|
b.length === 1 ? p = { [String(b[0])]: { $in: g } } : p = { $or: b.map((O) => ({ [O]: { $in: g } })) };
|
|
723
725
|
const f = yield h.find(p, s).lean();
|
|
724
726
|
for (const O of m.virtuals) {
|
|
725
|
-
const { name: d, options: y } = O,
|
|
727
|
+
const { name: d, options: y } = O, V = f.filter((R) => {
|
|
726
728
|
const S = R[y.foreignField];
|
|
727
729
|
return S != null && _.has(String(S));
|
|
728
730
|
});
|
|
729
731
|
if (y.count) {
|
|
730
732
|
const R = /* @__PURE__ */ new Map();
|
|
731
|
-
|
|
733
|
+
V.forEach((S) => {
|
|
732
734
|
var E;
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
+
const j = (E = S[y.foreignField]) == null ? void 0 : E.toString();
|
|
736
|
+
j && R.set(j, (R.get(j) || 0) + 1);
|
|
735
737
|
}), m.localValueSets.get(d).forEach((S) => {
|
|
736
|
-
const E = m.docsByLocalValue.get(S) || [],
|
|
738
|
+
const E = m.docsByLocalValue.get(S) || [], j = R.get(S) || 0;
|
|
737
739
|
E.forEach((P) => {
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
+
const C = l[P];
|
|
741
|
+
C[d] === void 0 && (C[d] = j);
|
|
740
742
|
});
|
|
741
743
|
});
|
|
742
744
|
} else {
|
|
743
745
|
const R = /* @__PURE__ */ new Map();
|
|
744
|
-
|
|
746
|
+
V.forEach((S) => {
|
|
745
747
|
var E;
|
|
746
|
-
const
|
|
747
|
-
|
|
748
|
+
const j = (E = S[y.foreignField]) == null ? void 0 : E.toString();
|
|
749
|
+
j && (R.has(j) || R.set(j, []), R.get(j).push(S));
|
|
748
750
|
}), m.localValueSets.get(d).forEach((S) => {
|
|
749
|
-
const E = m.docsByLocalValue.get(S) || [],
|
|
750
|
-
E.forEach((
|
|
751
|
-
const H = l[
|
|
751
|
+
const E = m.docsByLocalValue.get(S) || [], j = R.get(S) || [], P = y.justOne ? j[0] || null : j;
|
|
752
|
+
E.forEach((C) => {
|
|
753
|
+
const H = l[C];
|
|
752
754
|
H[d] = P;
|
|
753
755
|
});
|
|
754
756
|
});
|
|
@@ -780,12 +782,12 @@ function Q(n, e, t, r, s, i) {
|
|
|
780
782
|
O.length > 0 ? g.push({ path: f, populate: O }) : g.push(f);
|
|
781
783
|
}), g;
|
|
782
784
|
})(r);
|
|
783
|
-
yield
|
|
785
|
+
yield L(n, l, u, t, i);
|
|
784
786
|
}
|
|
785
787
|
return l;
|
|
786
788
|
});
|
|
787
789
|
}
|
|
788
|
-
class
|
|
790
|
+
class It {
|
|
789
791
|
/**
|
|
790
792
|
* Creates a new MongoDB controller instance.
|
|
791
793
|
*
|
|
@@ -1003,7 +1005,7 @@ class Pt {
|
|
|
1003
1005
|
});
|
|
1004
1006
|
}
|
|
1005
1007
|
}
|
|
1006
|
-
class
|
|
1008
|
+
class Pt {
|
|
1007
1009
|
/**
|
|
1008
1010
|
* Creates a new Mongoose controller instance.
|
|
1009
1011
|
*
|
|
@@ -1080,7 +1082,7 @@ class Mt {
|
|
|
1080
1082
|
return v(this, arguments, function* (e = {}, t = {}, r = {}, s) {
|
|
1081
1083
|
var i, o;
|
|
1082
1084
|
try {
|
|
1083
|
-
const l = F(e), c = this.model.findOne(l, t, r), a = this.getDynamicVirtuals(), u =
|
|
1085
|
+
const l = F(e), c = this.model.findOne(l, t, r), a = this.getDynamicVirtuals(), u = M(s, a);
|
|
1084
1086
|
u && c.populate(u);
|
|
1085
1087
|
const m = yield c.exec();
|
|
1086
1088
|
if (!m)
|
|
@@ -1109,7 +1111,7 @@ class Mt {
|
|
|
1109
1111
|
findAll() {
|
|
1110
1112
|
return v(this, arguments, function* (e = {}, t = {}, r = {}, s) {
|
|
1111
1113
|
try {
|
|
1112
|
-
const i = F(e), o = this.model.find(i, t, r), l = this.getDynamicVirtuals(), c =
|
|
1114
|
+
const i = F(e), o = this.model.find(i, t, r), l = this.getDynamicVirtuals(), c = M(s, l);
|
|
1113
1115
|
c && o.populate(c);
|
|
1114
1116
|
const a = yield o.exec();
|
|
1115
1117
|
return { success: !0, result: (yield this.populateDynamicVirtualsForDocuments(a, s)).map((m) => {
|
|
@@ -1133,7 +1135,7 @@ class Mt {
|
|
|
1133
1135
|
return v(this, arguments, function* (e = {}, t = {}) {
|
|
1134
1136
|
try {
|
|
1135
1137
|
const r = F(e), s = this.getDynamicVirtuals(), i = N({}, t);
|
|
1136
|
-
t.populate && (i.populate =
|
|
1138
|
+
t.populate && (i.populate = M(t.populate, s));
|
|
1137
1139
|
const o = yield this.model.paginate(r, i);
|
|
1138
1140
|
if (s && s.length > 0) {
|
|
1139
1141
|
const l = yield this.populateDynamicVirtualsForDocuments(o.docs, t.populate);
|
|
@@ -1162,7 +1164,7 @@ class Mt {
|
|
|
1162
1164
|
return v(this, arguments, function* (t, r = {}) {
|
|
1163
1165
|
try {
|
|
1164
1166
|
const s = this.getDynamicVirtuals(), i = N({}, r);
|
|
1165
|
-
r.populate && (i.populate =
|
|
1167
|
+
r.populate && (i.populate = M(r.populate, s));
|
|
1166
1168
|
const o = yield this.model.aggregatePaginate(
|
|
1167
1169
|
this.model.aggregate(t),
|
|
1168
1170
|
i
|
|
@@ -1416,7 +1418,7 @@ class Mt {
|
|
|
1416
1418
|
return v(this, arguments, function* ({ field: t, from: r, filter: s, haveHistory: i }) {
|
|
1417
1419
|
try {
|
|
1418
1420
|
const o = r[t];
|
|
1419
|
-
return
|
|
1421
|
+
return K(o) ? { success: !0, result: Object.fromEntries(
|
|
1420
1422
|
yield Promise.all(
|
|
1421
1423
|
Object.entries(o).map((u) => v(this, [u], function* ([m, h]) {
|
|
1422
1424
|
const _ = yield this.createUniqueSlug({
|
|
@@ -1457,7 +1459,7 @@ class Mt {
|
|
|
1457
1459
|
return v(this, arguments, function* ({ slug: t, field: r, from: s, filter: i, haveHistory: o }) {
|
|
1458
1460
|
try {
|
|
1459
1461
|
const l = s[r];
|
|
1460
|
-
if (
|
|
1462
|
+
if (K(l)) {
|
|
1461
1463
|
const h = Object.values(l).map((b) => G(b));
|
|
1462
1464
|
return (yield Promise.all(
|
|
1463
1465
|
h.map(
|
|
@@ -1517,7 +1519,7 @@ class Mt {
|
|
|
1517
1519
|
}
|
|
1518
1520
|
}
|
|
1519
1521
|
export {
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
+
It as MongoController,
|
|
1523
|
+
Pt as MongooseController,
|
|
1522
1524
|
x as mongo
|
|
1523
1525
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("fs-extra"),n=require("./path.util.cjs"),e=require("../command/command.type.cjs"),p=require("../command/command.util.cjs"),Ee=require("../package/package.util.cjs"),_=require("../package/package.type.cjs"),ae=require("../../config/env/env.util.cjs");var Ce=Object.defineProperty,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("fs-extra"),n=require("./path.util.cjs"),e=require("../command/command.type.cjs"),p=require("../command/command.util.cjs"),Ee=require("../package/package.util.cjs"),_=require("../package/package.type.cjs"),ae=require("../../config/env/env.util.cjs");var Ce=Object.defineProperty,v=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,Y=(E,a,t)=>a in E?Ce(E,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):E[a]=t,ce=(E,a)=>{for(var t in a||(a={}))Ie.call(a,t)&&Y(E,t,a[t]);if(v)for(var t of v(a))se.call(a,t)&&Y(E,t,a[t]);return E},me=(E,a,t)=>new Promise((T,r)=>{var i=s=>{try{y(t.next(s))}catch(L){r(L)}},G=s=>{try{y(t.throw(s))}catch(L){r(L)}},y=s=>s.done?T(s.value):Promise.resolve(s.value).then(i,G);y((t=t.apply(E,a)).next())});const re=ae.getEnv(),P=re.CWD,l="@cyberskill/shared",u="node_modules",g="dist",$="public",K="package.json",V="package-lock.json",F="tsconfig.json",W=".gitignore",b=".simple-git-hooks.json",B="pnpm-lock.yaml",H=".git/hooks/",w=".git/COMMIT_EDITMSG",U=".migrate-mongo.config.js",I=te.readJsonSync(n.resolveWorkingPath(K)).name===l?n.join(P,g):n.join(P,u,l,g),Te="cyberskill",pe="src/node/cli/index.ts",A="eslint",d="eslint",M="vitest",S="vitest",j="@commitlint/cli",J="@commitlint/config-conventional",R="commitlint",q="lint-staged",f="lint-staged",x="typescript",X="tsc",c="tsx",h="git",m="pnpm",z="pnpm exec",Z="simple-git-hooks",Q="simple-git-hooks",ee="@eslint/config-inspector",oe="eslint-config-inspector",ne="node-modules-inspector",_e="node-modules-inspector",N="migrate-mongo",O="./node_modules/migrate-mongo/bin/migrate-mongo",D="storybook",k="storybook",C={CYBERSKILL_DIRECTORY:I,WORKING_DIRECTORY:P,PUBLIC_DIRECTORY:n.resolveWorkingPath($),TS_CONFIG:n.resolveWorkingPath(F),GIT_IGNORE:n.resolveWorkingPath(W),GIT_HOOK:n.resolveWorkingPath(H),GIT_COMMIT_MSG:n.resolveWorkingPath(w),SIMPLE_GIT_HOOKS_JSON:n.resolveWorkingPath(b),PACKAGE_JSON:n.resolveWorkingPath(K),PACKAGE_LOCK_JSON:n.resolveWorkingPath(V),PNPM_LOCK_YAML:n.resolveWorkingPath(B),NODE_MODULES:n.resolveWorkingPath(u),MIGRATE_MONGO_CONFIG:n.resolveWorkingPath(U),LINT_STAGED_CONFIG:n.resolveWorkingPath(`${I}/config/lint-staged/index.js`),COMMITLINT_CONFIG:n.resolveWorkingPath(`${I}/config/commitlint/index.js`),VITEST_UNIT_CONFIG:n.resolveWorkingPath(`${I}/config/vitest/vitest.unit.js`),VITEST_E2E_CONFIG:n.resolveWorkingPath(`${I}/config/vitest/vitest.e2e.js`),STORYBOOK_MAIN_CONFIG:n.resolveWorkingPath(`${I}/config/storybook/storybook.main.js`),STORYBOOK_PREVIEW_CONFIG:n.resolveWorkingPath(`${I}/config/storybook/storybook.preview.js`)};function ie({isCurrentProject:E}){return ce({"pre-commit":f,"commit-msg":R},E&&{"pre-push":p.rawCommand(`${h} pull`)})}function o({type:E,packages:a,command:t}){const T=a==null?void 0:a.reduce((r,i)=>(r.some(G=>G.name===i.name)||r.push(i),r),[]);return()=>me(null,null,function*(){switch(E){case e.E_CommandType.CLI:return T!=null&&T.length&&(yield Ee.setupPackages(T,{install:!0})),p.formatCommand(p.rawCommand(`${z} ${t}`));case e.E_CommandType.STRING:return p.formatCommand(p.rawCommand(t));default:throw new Error("Unsupported command type")}})}const Ne={simpleGitHooks:o({type:e.E_CommandType.CLI,packages:[{name:Z,type:_.E_PackageType.DEV_DEPENDENCY}],command:Q}),eslintInspect:o({type:e.E_CommandType.CLI,packages:[{name:ee,type:_.E_PackageType.DEV_DEPENDENCY}],command:oe}),nodeModulesInspect:o({type:e.E_CommandType.CLI,packages:[{name:ne,type:_.E_PackageType.DEV_DEPENDENCY}],command:_e}),eslintCheck:o({type:e.E_CommandType.CLI,packages:[{name:A,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${d} ${C.WORKING_DIRECTORY} --no-cache`}),eslintFix:o({type:e.E_CommandType.CLI,packages:[{name:A,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${d} ${C.WORKING_DIRECTORY} --fix --no-cache`}),typescriptCheck:o({type:e.E_CommandType.CLI,packages:[{name:x,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${X} -p ${C.TS_CONFIG} --noEmit`}),testUnit:o({type:e.E_CommandType.CLI,packages:[{name:M,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${S} --config ${C.VITEST_UNIT_CONFIG}`}),testE2e:o({type:e.E_CommandType.CLI,packages:[{name:M,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${S} --config ${C.VITEST_E2E_CONFIG}`}),mongoMigrateCreate:E=>{if(!/^[a-zA-Z0-9_-]+$/.test(E))throw new Error("Migration name must only contain alphanumeric characters, underscores, and hyphens.");return o({type:e.E_CommandType.CLI,packages:[{name:c,type:_.E_PackageType.DEPENDENCY},{name:N,type:_.E_PackageType.DEPENDENCY}],command:`${c} ${O} create ${E} -f ${C.MIGRATE_MONGO_CONFIG}`})()},mongoMigrateUp:o({type:e.E_CommandType.CLI,packages:[{name:c,type:_.E_PackageType.DEPENDENCY},{name:N,type:_.E_PackageType.DEPENDENCY}],command:`${c} ${O} up -f ${C.MIGRATE_MONGO_CONFIG}`}),mongoMigrateDown:o({type:e.E_CommandType.CLI,packages:[{name:c,type:_.E_PackageType.DEPENDENCY},{name:N,type:_.E_PackageType.DEPENDENCY}],command:`${c} ${O} down -f ${C.MIGRATE_MONGO_CONFIG}`}),commitLint:o({type:e.E_CommandType.CLI,packages:[{name:j,type:_.E_PackageType.DEV_DEPENDENCY},{name:J,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${R} --edit ${C.GIT_COMMIT_MSG} --config ${C.COMMITLINT_CONFIG}`}),lintStaged:o({type:e.E_CommandType.CLI,packages:[{name:q,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${f} --config ${C.LINT_STAGED_CONFIG}`}),configureGitHook:o({type:e.E_CommandType.STRING,command:`${h} config core.hooksPath ${C.GIT_HOOK}`}),build:o({type:e.E_CommandType.STRING,command:`${m} run --if-present build`}),pnpmInstallStandard:o({type:e.E_CommandType.STRING,command:`${m} install --ignore-scripts`}),pnpmInstallLegacy:o({type:e.E_CommandType.STRING,command:`${m} install --ignore-scripts --legacy-peer-deps`}),pnpmInstallForce:o({type:e.E_CommandType.STRING,command:`${m} install --ignore-scripts --force`}),pnpmPruneStore:o({type:e.E_CommandType.STRING,command:`${m} store prune`}),pnpmCleanCache:o({type:e.E_CommandType.STRING,command:`${m} cache delete`}),storybookDev:o({type:e.E_CommandType.CLI,packages:[{name:D,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${k} dev`}),storybookBuild:o({type:e.E_CommandType.CLI,packages:[{name:D,type:_.E_PackageType.DEV_DEPENDENCY}],command:`${k} build`})};exports.BUILD_DIRECTORY=g;exports.COMMIT_LINT_CLI=R;exports.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME=J;exports.COMMIT_LINT_PACKAGE_NAME=j;exports.CYBERSKILL_CLI=Te;exports.CYBERSKILL_CLI_PATH=pe;exports.CYBERSKILL_DIRECTORY=I;exports.CYBERSKILL_PACKAGE_NAME=l;exports.ESLINT_CLI=d;exports.ESLINT_INSPECT_CLI=oe;exports.ESLINT_INSPECT_PACKAGE_NAME=ee;exports.ESLINT_PACKAGE_NAME=A;exports.GIT_CLI=h;exports.GIT_COMMIT_EDITMSG=w;exports.GIT_HOOK=H;exports.GIT_IGNORE=W;exports.LINT_STAGED_CLI=f;exports.LINT_STAGED_PACKAGE_NAME=q;exports.MIGRATE_MONGO_CLI=O;exports.MIGRATE_MONGO_CONFIG=U;exports.MIGRATE_MONGO_PACKAGE_NAME=N;exports.NODE_MODULES=u;exports.NODE_MODULES_INSPECT_CLI=_e;exports.NODE_MODULES_INSPECT_PACKAGE_NAME=ne;exports.PACKAGE_JSON=K;exports.PACKAGE_LOCK_JSON=V;exports.PATH=C;exports.PNPM_CLI=m;exports.PNPM_EXEC_CLI=z;exports.PNPM_LOCK_YAML=B;exports.PUBLIC_DIRECTORY=$;exports.SIMPLE_GIT_HOOKS_PACKAGE_NAME=Z;exports.SIMPLE_GIT_HOOK_CLI=Q;exports.SIMPLE_GIT_HOOK_JSON=b;exports.STORYBOOK_CLI=k;exports.STORYBOOK_PACKAGE_NAME=D;exports.TSCONFIG_JSON=F;exports.TSC_CLI=X;exports.TSC_PACKAGE_NAME=x;exports.TSX_CLI=c;exports.VITEST_CLI=S;exports.VITEST_PACKAGE_NAME=M;exports.WORKING_DIRECTORY=P;exports.command=Ne;exports.createGitHooksConfig=ie;
|