@cyberskill/shared 1.203.0 → 1.204.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.util-Ci2CZDut.cjs +1 -0
- package/dist/config.util-DKBwEBKR.js +61 -0
- package/dist/log.type-CMvG6Box.cjs +1 -0
- package/dist/{src/node/log/log.type.js → log.type-DTOvZHyz.js} +1 -1
- package/dist/path.constant-CWtb99gS.cjs +2 -0
- package/dist/{path.constant-DJq0jtD0.js → path.constant-CvSr0Rrx.js} +186 -185
- package/dist/src/config/config.util.cjs +1 -1
- package/dist/src/config/config.util.js +7 -58
- package/dist/src/config/index.cjs +1 -1
- package/dist/src/config/index.js +2 -3
- package/dist/src/config/vitest/vitest.unit.cjs +1 -1
- package/dist/src/config/vitest/vitest.unit.js +1 -1
- package/dist/src/node/cli/cli.util.cjs +1 -1
- package/dist/src/node/cli/cli.util.js +15 -15
- package/dist/src/node/command/command.util.cjs +1 -1
- package/dist/src/node/command/command.util.js +2 -2
- package/dist/src/node/command/index.cjs +1 -1
- package/dist/src/node/command/index.js +6 -7
- package/dist/src/node/log/index.cjs +1 -1
- package/dist/src/node/log/index.js +5 -5
- package/dist/src/node/mongo/index.cjs +1 -1
- package/dist/src/node/mongo/index.js +24 -15
- package/dist/src/node/mongo/mongo.util.cjs +1 -1
- package/dist/src/node/mongo/mongo.util.js +1 -1
- package/dist/src/node/package/index.cjs +1 -1
- package/dist/src/node/package/index.js +5 -6
- package/dist/src/node/package/package.util.cjs +1 -1
- package/dist/src/node/package/package.util.js +5 -6
- package/dist/src/node/path/index.cjs +1 -1
- package/dist/src/node/path/index.js +1 -1
- package/dist/src/node/path/path.constant.cjs +1 -1
- package/dist/src/node/path/path.constant.js +43 -45
- package/dist/src/node/upload/index.cjs +1 -1
- package/dist/src/node/upload/index.js +3 -4
- package/dist/src/node/upload/upload.util.cjs +1 -1
- package/dist/src/node/upload/upload.util.js +6 -157
- package/dist/upload.util-CE3MjBdh.cjs +1 -0
- package/dist/upload.util-D4aUdmPo.js +160 -0
- package/package.json +6 -6
- package/dist/path.constant-CPGOAxEp.cjs +0 -2
- package/dist/src/config/config.type.cjs +0 -1
- package/dist/src/config/config.type.js +0 -4
- package/dist/src/config/env/env.type.cjs +0 -1
- package/dist/src/config/env/env.type.js +0 -1
- package/dist/src/config/graphql-codegen/graphql-codegen.type.cjs +0 -1
- package/dist/src/config/graphql-codegen/graphql-codegen.type.js +0 -1
- package/dist/src/node/apollo-server/apollo-server.type.cjs +0 -1
- package/dist/src/node/apollo-server/apollo-server.type.js +0 -1
- package/dist/src/node/command/command.type.cjs +0 -1
- package/dist/src/node/command/command.type.js +0 -4
- package/dist/src/node/express/express.type.cjs +0 -1
- package/dist/src/node/express/express.type.js +0 -4
- package/dist/src/node/fs/fs.type.cjs +0 -1
- package/dist/src/node/fs/fs.type.js +0 -1
- package/dist/src/node/log/log.type.cjs +0 -1
- package/dist/src/node/mongo/mongo.type.cjs +0 -1
- package/dist/src/node/mongo/mongo.type.js +0 -16
- package/dist/src/node/package/package.type.cjs +0 -1
- package/dist/src/node/package/package.type.js +0 -4
- package/dist/src/node/upload/upload.type.cjs +0 -1
- package/dist/src/node/upload/upload.type.js +0 -4
- package/dist/src/node/ws/ws.type.cjs +0 -1
- package/dist/src/node/ws/ws.type.js +0 -1
- package/dist/src/react/apollo-client/apollo-client.type.cjs +0 -1
- package/dist/src/react/apollo-client/apollo-client.type.js +0 -1
- package/dist/src/react/apollo-error/apollo-error.type.cjs +0 -1
- package/dist/src/react/apollo-error/apollo-error.type.js +0 -1
- package/dist/src/react/loading/loading.type.cjs +0 -1
- package/dist/src/react/loading/loading.type.js +0 -1
- package/dist/src/react/log/log.type.cjs +0 -1
- package/dist/src/react/log/log.type.js +0 -1
- package/dist/src/react/next-intl/next-intl.type.cjs +0 -1
- package/dist/src/react/next-intl/next-intl.type.js +0 -1
- package/dist/src/react/userback/userback.type.cjs +0 -1
- package/dist/src/react/userback/userback.type.js +0 -1
- package/dist/src/util/common/common.type.cjs +0 -1
- package/dist/src/util/common/common.type.js +0 -1
- package/dist/src/util/serializer/serializer.type.cjs +0 -1
- package/dist/src/util/serializer/serializer.type.js +0 -1
- package/dist/src/util/string/string.type.cjs +0 -1
- package/dist/src/util/string/string.type.js +0 -1
|
@@ -1,51 +1,49 @@
|
|
|
1
1
|
import "fs-extra";
|
|
2
2
|
import "../../config/env/env.util.js";
|
|
3
|
-
import "
|
|
4
|
-
import { B as T, m as s, l as L, k as O, g as M, h as G, f as S, C as P, i as K, x as R, w as D, E as o, r as m, e as r, d as t, G as Y, n as i, L as H, D as p, M as B, A as U, N as e, z as F, y as J, a as V, b as c, F as f, s as n, t as d, c as g, P as k, u as x, v as W, S as X, T as b, p as h, o as j, q as l, j as q, V as u, W as v, I as w, H as y } from "../../../path.constant-DJq0jtD0.js";
|
|
5
|
-
import "../package/package.type.js";
|
|
3
|
+
import { B as a, m as N, l as T, k as s, g as L, h as O, f as M, C as G, i as S, x as P, w as K, E as R, r as D, e as o, d as Y, G as H, n as m, L as r, D as t, M as B, A as i, N as p, z as U, y as e, a as F, b as J, F as V, s as c, t as f, c as n, P as d, u as g, v as k, S as x, T as W, p as X, o as b, q as h, j, V as l, W as q, I as u, H as v } from "../../../path.constant-CvSr0Rrx.js";
|
|
6
4
|
import "./path.util.js";
|
|
7
5
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
a as BUILD_DIRECTORY,
|
|
7
|
+
N as COMMIT_LINT_CLI,
|
|
8
|
+
T as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,
|
|
9
|
+
s as COMMIT_LINT_PACKAGE_NAME,
|
|
10
|
+
L as CYBERSKILL_CLI,
|
|
11
|
+
O as CYBERSKILL_CLI_PATH,
|
|
12
|
+
M as CYBERSKILL_DIRECTORY,
|
|
13
|
+
G as CYBERSKILL_PACKAGE_NAME,
|
|
14
|
+
S as ESLINT_CLI,
|
|
15
|
+
P as ESLINT_INSPECT_CLI,
|
|
16
|
+
K as ESLINT_INSPECT_PACKAGE_NAME,
|
|
17
|
+
R as ESLINT_PACKAGE_NAME,
|
|
18
|
+
D as GIT_CLI,
|
|
19
|
+
o as GIT_COMMIT_EDITMSG,
|
|
20
|
+
Y as GIT_HOOK,
|
|
21
|
+
H as GIT_IGNORE,
|
|
22
|
+
m as LINT_STAGED_CLI,
|
|
23
|
+
r as LINT_STAGED_PACKAGE_NAME,
|
|
24
|
+
t as MIGRATE_MONGO_CLI,
|
|
27
25
|
B as MIGRATE_MONGO_CONFIG,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
26
|
+
i as MIGRATE_MONGO_PACKAGE_NAME,
|
|
27
|
+
p as NODE_MODULES,
|
|
28
|
+
U as NODE_MODULES_INSPECT_CLI,
|
|
29
|
+
e as NODE_MODULES_INSPECT_PACKAGE_NAME,
|
|
30
|
+
F as PACKAGE_JSON,
|
|
31
|
+
J as PACKAGE_LOCK_JSON,
|
|
32
|
+
V as PATH,
|
|
33
|
+
c as PNPM_CLI,
|
|
34
|
+
f as PNPM_EXEC_CLI,
|
|
35
|
+
n as PNPM_LOCK_YAML,
|
|
36
|
+
d as PUBLIC_DIRECTORY,
|
|
37
|
+
g as SIMPLE_GIT_HOOKS_PACKAGE_NAME,
|
|
38
|
+
k as SIMPLE_GIT_HOOK_CLI,
|
|
39
|
+
x as SIMPLE_GIT_HOOK_JSON,
|
|
40
|
+
W as TSCONFIG_JSON,
|
|
41
|
+
X as TSC_CLI,
|
|
42
|
+
b as TSC_PACKAGE_NAME,
|
|
43
|
+
h as TSX_CLI,
|
|
44
|
+
j as VITEST_CLI,
|
|
45
|
+
l as VITEST_PACKAGE_NAME,
|
|
46
|
+
q as WORKING_DIRECTORY,
|
|
47
|
+
u as command,
|
|
48
|
+
v as createGitHooksConfig
|
|
51
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../upload.util-CE3MjBdh.cjs");exports.E_UploadType=e.E_UploadType;exports.createUploadConfig=e.createUploadConfig;exports.upload=e.upload;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createUploadConfig as a, upload as d } from "./upload.util.js";
|
|
1
|
+
import { E as p, c as e, u as d } from "../../../upload.util-D4aUdmPo.js";
|
|
3
2
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
p as E_UploadType,
|
|
4
|
+
e as createUploadConfig,
|
|
6
5
|
d as upload
|
|
7
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../fs/fs.util.cjs");require("../../../path.constant-CWtb99gS.cjs");require("../path/path.util.cjs");const e=require("../../../upload.util-CE3MjBdh.cjs");exports.createUploadConfig=e.createUploadConfig;exports.upload=e.upload;
|
|
@@ -1,159 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for (var e in i || (i = {}))
|
|
6
|
-
z.call(i, e) && E(s, e, i[e]);
|
|
7
|
-
if (x)
|
|
8
|
-
for (var e of x(i))
|
|
9
|
-
y.call(i, e) && E(s, e, i[e]);
|
|
10
|
-
return s;
|
|
11
|
-
};
|
|
12
|
-
var g = (s, i, e) => new Promise((t, a) => {
|
|
13
|
-
var n = (o) => {
|
|
14
|
-
try {
|
|
15
|
-
l(e.next(o));
|
|
16
|
-
} catch (c) {
|
|
17
|
-
a(c);
|
|
18
|
-
}
|
|
19
|
-
}, r = (o) => {
|
|
20
|
-
try {
|
|
21
|
-
l(e.throw(o));
|
|
22
|
-
} catch (c) {
|
|
23
|
-
a(c);
|
|
24
|
-
}
|
|
25
|
-
}, l = (o) => o.done ? t(o.value) : Promise.resolve(o.value).then(n, r);
|
|
26
|
-
l((e = e.apply(s, i)).next());
|
|
27
|
-
});
|
|
28
|
-
import { pathExistsSync as L, mkdirSync as C, createWriteStream as I } from "../fs/fs.util.js";
|
|
29
|
-
import "../../../path.constant-DJq0jtD0.js";
|
|
30
|
-
import { dirname as S } from "../path/path.util.js";
|
|
31
|
-
import { E_UploadType as f } from "./upload.type.js";
|
|
32
|
-
function h(s) {
|
|
33
|
-
return g(this, null, function* () {
|
|
34
|
-
return new Promise((i, e) => {
|
|
35
|
-
let t = 0;
|
|
36
|
-
s.on("data", (a) => {
|
|
37
|
-
t += a.length;
|
|
38
|
-
}), s.on("end", () => i(t)), s.on("error", e);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function F(s, i) {
|
|
43
|
-
const e = s.lastIndexOf(".");
|
|
44
|
-
if (e === -1)
|
|
45
|
-
return !1;
|
|
46
|
-
const t = s.substring(e + 1).toLowerCase();
|
|
47
|
-
return i.includes(t);
|
|
48
|
-
}
|
|
49
|
-
function M(s, i, e) {
|
|
50
|
-
const { filename: t, fileSize: a } = s, n = i[e], { allowedExtensions: r, sizeLimit: l } = n;
|
|
51
|
-
if (!F(t, r))
|
|
52
|
-
return {
|
|
53
|
-
isValid: !1,
|
|
54
|
-
error: `File extension not allowed for ${e.toLowerCase()} files. Allowed extensions: ${r.join(", ")}`
|
|
55
|
-
};
|
|
56
|
-
if (a !== void 0 && a > l) {
|
|
57
|
-
const o = Math.round(l / 1048576);
|
|
58
|
-
return {
|
|
59
|
-
isValid: !1,
|
|
60
|
-
error: `File size exceeds limit for ${e.toLowerCase()} files. Maximum size: ${o}MB`
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return { isValid: !0 };
|
|
64
|
-
}
|
|
65
|
-
function A(s) {
|
|
66
|
-
const i = {
|
|
67
|
-
[f.IMAGE]: {
|
|
68
|
-
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "svg"],
|
|
69
|
-
sizeLimit: 5242880
|
|
70
|
-
// 5MB
|
|
71
|
-
},
|
|
72
|
-
[f.VIDEO]: {
|
|
73
|
-
allowedExtensions: ["mp4", "avi", "mov", "wmv", "flv", "webm"],
|
|
74
|
-
sizeLimit: 524288e3
|
|
75
|
-
// 500MB
|
|
76
|
-
},
|
|
77
|
-
[f.DOCUMENT]: {
|
|
78
|
-
allowedExtensions: ["pdf", "doc", "docx", "txt", "rtf"],
|
|
79
|
-
sizeLimit: 10485760
|
|
80
|
-
// 10MB
|
|
81
|
-
},
|
|
82
|
-
[f.OTHER]: {
|
|
83
|
-
allowedExtensions: ["zip", "rar", "tar", "gz"],
|
|
84
|
-
sizeLimit: 5242880
|
|
85
|
-
// 5MB
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
return p(p({}, i), s);
|
|
89
|
-
}
|
|
90
|
-
function T(s) {
|
|
91
|
-
return g(this, null, function* () {
|
|
92
|
-
const { path: i, file: e, config: t, type: a } = s;
|
|
93
|
-
if (!i || typeof i != "string")
|
|
94
|
-
return {
|
|
95
|
-
success: !1,
|
|
96
|
-
message: "Invalid path provided",
|
|
97
|
-
result: ""
|
|
98
|
-
};
|
|
99
|
-
if (!e || typeof e != "object")
|
|
100
|
-
return {
|
|
101
|
-
success: !1,
|
|
102
|
-
message: "Invalid file provided",
|
|
103
|
-
result: ""
|
|
104
|
-
};
|
|
105
|
-
if (t) {
|
|
106
|
-
const n = [f.IMAGE, f.VIDEO, f.DOCUMENT, f.OTHER];
|
|
107
|
-
for (const r of n) {
|
|
108
|
-
if (!t[r] || !Array.isArray(t[r].allowedExtensions) || t[r].allowedExtensions.length === 0)
|
|
109
|
-
return {
|
|
110
|
-
success: !1,
|
|
111
|
-
message: `Invalid config for ${r.toLowerCase()} files`,
|
|
112
|
-
result: ""
|
|
113
|
-
};
|
|
114
|
-
if (typeof t[r].sizeLimit != "number" || t[r].sizeLimit <= 0)
|
|
115
|
-
return {
|
|
116
|
-
success: !1,
|
|
117
|
-
message: `Invalid size limit for ${r.toLowerCase()} files`,
|
|
118
|
-
result: ""
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const n = yield (yield e).file, { filename: r, createReadStream: l } = n;
|
|
124
|
-
if (t) {
|
|
125
|
-
const m = l(), d = yield h(m), w = M(
|
|
126
|
-
{ filename: r, fileSize: d },
|
|
127
|
-
t,
|
|
128
|
-
a
|
|
129
|
-
);
|
|
130
|
-
if (!w.isValid)
|
|
131
|
-
return {
|
|
132
|
-
success: !1,
|
|
133
|
-
message: w.error || "File validation failed",
|
|
134
|
-
result: ""
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
const o = S(i);
|
|
138
|
-
L(o) || C(o, { recursive: !0 });
|
|
139
|
-
const c = l(), u = I(i);
|
|
140
|
-
return c.pipe(u), yield new Promise((m, d) => {
|
|
141
|
-
u.on("finish", () => m()), u.on("error", d), c.on("error", d);
|
|
142
|
-
}), {
|
|
143
|
-
success: !0,
|
|
144
|
-
message: "File uploaded successfully",
|
|
145
|
-
result: i
|
|
146
|
-
};
|
|
147
|
-
} catch (n) {
|
|
148
|
-
return {
|
|
149
|
-
success: !1,
|
|
150
|
-
message: n instanceof Error ? n.message : "File upload failed",
|
|
151
|
-
result: ""
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
1
|
+
import "../fs/fs.util.js";
|
|
2
|
+
import "../../../path.constant-CvSr0Rrx.js";
|
|
3
|
+
import "../path/path.util.js";
|
|
4
|
+
import { c as i, u as m } from "../../../upload.util-D4aUdmPo.js";
|
|
156
5
|
export {
|
|
157
|
-
|
|
158
|
-
|
|
6
|
+
i as createUploadConfig,
|
|
7
|
+
m as upload
|
|
159
8
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var z=Object.defineProperty;var x=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var v=(e,i,s)=>i in e?z(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s,g=(e,i)=>{for(var s in i||(i={}))I.call(i,s)&&v(e,s,i[s]);if(x)for(var s of x(i))C.call(i,s)&&v(e,s,i[s]);return e};var w=(e,i,s)=>new Promise((t,l)=>{var o=n=>{try{f(s.next(n))}catch(c){l(c)}},r=n=>{try{f(s.throw(n))}catch(c){l(c)}},f=n=>n.done?t(n.value):Promise.resolve(n.value).then(o,r);f((s=s.apply(e,i)).next())});const E=require("./src/node/fs/fs.util.cjs");require("./path.constant-CWtb99gS.cjs");const O=require("./src/node/path/path.util.cjs");var a=(e=>(e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.DOCUMENT="DOCUMENT",e.OTHER="OTHER",e))(a||{});function L(e){return w(this,null,function*(){return new Promise((i,s)=>{let t=0;e.on("data",l=>{t+=l.length}),e.on("end",()=>i(t)),e.on("error",s)})})}function M(e,i){const s=e.lastIndexOf(".");if(s===-1)return!1;const t=e.substring(s+1).toLowerCase();return i.includes(t)}function y(e,i,s){const{filename:t,fileSize:l}=e,o=i[s],{allowedExtensions:r,sizeLimit:f}=o;if(!M(t,r))return{isValid:!1,error:`File extension not allowed for ${s.toLowerCase()} files. Allowed extensions: ${r.join(", ")}`};if(l!==void 0&&l>f){const n=Math.round(f/1048576);return{isValid:!1,error:`File size exceeds limit for ${s.toLowerCase()} files. Maximum size: ${n}MB`}}return{isValid:!0}}function h(e){const i={[a.IMAGE]:{allowedExtensions:["jpg","jpeg","png","gif","webp","svg"],sizeLimit:5242880},[a.VIDEO]:{allowedExtensions:["mp4","avi","mov","wmv","flv","webm"],sizeLimit:524288e3},[a.DOCUMENT]:{allowedExtensions:["pdf","doc","docx","txt","rtf"],sizeLimit:10485760},[a.OTHER]:{allowedExtensions:["zip","rar","tar","gz"],sizeLimit:5242880}};return g(g({},i),e)}function D(e){return w(this,null,function*(){const{path:i,file:s,config:t,type:l}=e;if(!i||typeof i!="string")return{success:!1,message:"Invalid path provided",result:""};if(!s||typeof s!="object")return{success:!1,message:"Invalid file provided",result:""};if(t){const o=[a.IMAGE,a.VIDEO,a.DOCUMENT,a.OTHER];for(const r of o){if(!t[r]||!Array.isArray(t[r].allowedExtensions)||t[r].allowedExtensions.length===0)return{success:!1,message:`Invalid config for ${r.toLowerCase()} files`,result:""};if(typeof t[r].sizeLimit!="number"||t[r].sizeLimit<=0)return{success:!1,message:`Invalid size limit for ${r.toLowerCase()} files`,result:""}}}try{const o=yield(yield s).file,{filename:r,createReadStream:f}=o;if(t){const m=f(),u=yield L(m),p=y({filename:r,fileSize:u},t,l);if(!p.isValid)return{success:!1,message:p.error||"File validation failed",result:""}}const n=O.dirname(i);E.pathExistsSync(n)||E.mkdirSync(n,{recursive:!0});const c=f(),d=E.createWriteStream(i);return c.pipe(d),yield new Promise((m,u)=>{d.on("finish",()=>m()),d.on("error",u),c.on("error",u)}),{success:!0,message:"File uploaded successfully",result:i}}catch(o){return{success:!1,message:o instanceof Error?o.message:"File upload failed",result:""}}})}exports.E_UploadType=a;exports.createUploadConfig=h;exports.upload=D;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var p = Object.getOwnPropertySymbols;
|
|
3
|
+
var z = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var x = (e, i, s) => i in e ? v(e, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[i] = s, g = (e, i) => {
|
|
5
|
+
for (var s in i || (i = {}))
|
|
6
|
+
z.call(i, s) && x(e, s, i[s]);
|
|
7
|
+
if (p)
|
|
8
|
+
for (var s of p(i))
|
|
9
|
+
I.call(i, s) && x(e, s, i[s]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
var w = (e, i, s) => new Promise((t, a) => {
|
|
13
|
+
var o = (n) => {
|
|
14
|
+
try {
|
|
15
|
+
l(s.next(n));
|
|
16
|
+
} catch (c) {
|
|
17
|
+
a(c);
|
|
18
|
+
}
|
|
19
|
+
}, r = (n) => {
|
|
20
|
+
try {
|
|
21
|
+
l(s.throw(n));
|
|
22
|
+
} catch (c) {
|
|
23
|
+
a(c);
|
|
24
|
+
}
|
|
25
|
+
}, l = (n) => n.done ? t(n.value) : Promise.resolve(n.value).then(o, r);
|
|
26
|
+
l((s = s.apply(e, i)).next());
|
|
27
|
+
});
|
|
28
|
+
import { pathExistsSync as O, mkdirSync as C, createWriteStream as L } from "./src/node/fs/fs.util.js";
|
|
29
|
+
import "./path.constant-CvSr0Rrx.js";
|
|
30
|
+
import { dirname as M } from "./src/node/path/path.util.js";
|
|
31
|
+
var f = /* @__PURE__ */ ((e) => (e.IMAGE = "IMAGE", e.VIDEO = "VIDEO", e.DOCUMENT = "DOCUMENT", e.OTHER = "OTHER", e))(f || {});
|
|
32
|
+
function y(e) {
|
|
33
|
+
return w(this, null, function* () {
|
|
34
|
+
return new Promise((i, s) => {
|
|
35
|
+
let t = 0;
|
|
36
|
+
e.on("data", (a) => {
|
|
37
|
+
t += a.length;
|
|
38
|
+
}), e.on("end", () => i(t)), e.on("error", s);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function D(e, i) {
|
|
43
|
+
const s = e.lastIndexOf(".");
|
|
44
|
+
if (s === -1)
|
|
45
|
+
return !1;
|
|
46
|
+
const t = e.substring(s + 1).toLowerCase();
|
|
47
|
+
return i.includes(t);
|
|
48
|
+
}
|
|
49
|
+
function S(e, i, s) {
|
|
50
|
+
const { filename: t, fileSize: a } = e, o = i[s], { allowedExtensions: r, sizeLimit: l } = o;
|
|
51
|
+
if (!D(t, r))
|
|
52
|
+
return {
|
|
53
|
+
isValid: !1,
|
|
54
|
+
error: `File extension not allowed for ${s.toLowerCase()} files. Allowed extensions: ${r.join(", ")}`
|
|
55
|
+
};
|
|
56
|
+
if (a !== void 0 && a > l) {
|
|
57
|
+
const n = Math.round(l / 1048576);
|
|
58
|
+
return {
|
|
59
|
+
isValid: !1,
|
|
60
|
+
error: `File size exceeds limit for ${s.toLowerCase()} files. Maximum size: ${n}MB`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return { isValid: !0 };
|
|
64
|
+
}
|
|
65
|
+
function R(e) {
|
|
66
|
+
const i = {
|
|
67
|
+
[f.IMAGE]: {
|
|
68
|
+
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "svg"],
|
|
69
|
+
sizeLimit: 5242880
|
|
70
|
+
// 5MB
|
|
71
|
+
},
|
|
72
|
+
[f.VIDEO]: {
|
|
73
|
+
allowedExtensions: ["mp4", "avi", "mov", "wmv", "flv", "webm"],
|
|
74
|
+
sizeLimit: 524288e3
|
|
75
|
+
// 500MB
|
|
76
|
+
},
|
|
77
|
+
[f.DOCUMENT]: {
|
|
78
|
+
allowedExtensions: ["pdf", "doc", "docx", "txt", "rtf"],
|
|
79
|
+
sizeLimit: 10485760
|
|
80
|
+
// 10MB
|
|
81
|
+
},
|
|
82
|
+
[f.OTHER]: {
|
|
83
|
+
allowedExtensions: ["zip", "rar", "tar", "gz"],
|
|
84
|
+
sizeLimit: 5242880
|
|
85
|
+
// 5MB
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return g(g({}, i), e);
|
|
89
|
+
}
|
|
90
|
+
function $(e) {
|
|
91
|
+
return w(this, null, function* () {
|
|
92
|
+
const { path: i, file: s, config: t, type: a } = e;
|
|
93
|
+
if (!i || typeof i != "string")
|
|
94
|
+
return {
|
|
95
|
+
success: !1,
|
|
96
|
+
message: "Invalid path provided",
|
|
97
|
+
result: ""
|
|
98
|
+
};
|
|
99
|
+
if (!s || typeof s != "object")
|
|
100
|
+
return {
|
|
101
|
+
success: !1,
|
|
102
|
+
message: "Invalid file provided",
|
|
103
|
+
result: ""
|
|
104
|
+
};
|
|
105
|
+
if (t) {
|
|
106
|
+
const o = [f.IMAGE, f.VIDEO, f.DOCUMENT, f.OTHER];
|
|
107
|
+
for (const r of o) {
|
|
108
|
+
if (!t[r] || !Array.isArray(t[r].allowedExtensions) || t[r].allowedExtensions.length === 0)
|
|
109
|
+
return {
|
|
110
|
+
success: !1,
|
|
111
|
+
message: `Invalid config for ${r.toLowerCase()} files`,
|
|
112
|
+
result: ""
|
|
113
|
+
};
|
|
114
|
+
if (typeof t[r].sizeLimit != "number" || t[r].sizeLimit <= 0)
|
|
115
|
+
return {
|
|
116
|
+
success: !1,
|
|
117
|
+
message: `Invalid size limit for ${r.toLowerCase()} files`,
|
|
118
|
+
result: ""
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const o = yield (yield s).file, { filename: r, createReadStream: l } = o;
|
|
124
|
+
if (t) {
|
|
125
|
+
const m = l(), u = yield y(m), E = S(
|
|
126
|
+
{ filename: r, fileSize: u },
|
|
127
|
+
t,
|
|
128
|
+
a
|
|
129
|
+
);
|
|
130
|
+
if (!E.isValid)
|
|
131
|
+
return {
|
|
132
|
+
success: !1,
|
|
133
|
+
message: E.error || "File validation failed",
|
|
134
|
+
result: ""
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const n = M(i);
|
|
138
|
+
O(n) || C(n, { recursive: !0 });
|
|
139
|
+
const c = l(), d = L(i);
|
|
140
|
+
return c.pipe(d), yield new Promise((m, u) => {
|
|
141
|
+
d.on("finish", () => m()), d.on("error", u), c.on("error", u);
|
|
142
|
+
}), {
|
|
143
|
+
success: !0,
|
|
144
|
+
message: "File uploaded successfully",
|
|
145
|
+
result: i
|
|
146
|
+
};
|
|
147
|
+
} catch (o) {
|
|
148
|
+
return {
|
|
149
|
+
success: !1,
|
|
150
|
+
message: o instanceof Error ? o.message : "File upload failed",
|
|
151
|
+
result: ""
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
f as E,
|
|
158
|
+
R as c,
|
|
159
|
+
$ as u
|
|
160
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberskill/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.204.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -211,6 +211,7 @@
|
|
|
211
211
|
"@apollo/server": "4.12.2",
|
|
212
212
|
"@dotenvx/dotenvx": "1.45.1",
|
|
213
213
|
"@eddeee888/gcg-typescript-resolver-files": "0.12.1",
|
|
214
|
+
"@eslint-react/eslint-plugin": "1.52.2",
|
|
214
215
|
"@graphql-codegen/cli": "5.0.7",
|
|
215
216
|
"@graphql-codegen/client-preset": "4.8.3",
|
|
216
217
|
"@nestjs/common": "11.1.3",
|
|
@@ -227,6 +228,9 @@
|
|
|
227
228
|
"crypto-js": "4.2.0",
|
|
228
229
|
"date-fns": "4.1.0",
|
|
229
230
|
"envalid": "8.0.0",
|
|
231
|
+
"eslint-plugin-format": "1.0.1",
|
|
232
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
233
|
+
"eslint-plugin-react-refresh": "0.4.20",
|
|
230
234
|
"express": "4.21.2",
|
|
231
235
|
"express-session": "1.18.1",
|
|
232
236
|
"express-useragent": "1.0.15",
|
|
@@ -261,7 +265,6 @@
|
|
|
261
265
|
"devDependencies": {
|
|
262
266
|
"@commitlint/cli": "19.8.1",
|
|
263
267
|
"@commitlint/config-conventional": "19.8.1",
|
|
264
|
-
"@eslint-react/eslint-plugin": "1.52.2",
|
|
265
268
|
"@eslint/config-inspector": "1.1.0",
|
|
266
269
|
"@microsoft/api-extractor": "7.52.8",
|
|
267
270
|
"@next/eslint-plugin-next": "15.3.4",
|
|
@@ -278,7 +281,7 @@
|
|
|
278
281
|
"@types/fs-extra": "11.0.4",
|
|
279
282
|
"@types/graphql-upload": "17.0.0",
|
|
280
283
|
"@types/migrate-mongo": "10.0.5",
|
|
281
|
-
"@types/node": "24.0.
|
|
284
|
+
"@types/node": "24.0.8",
|
|
282
285
|
"@types/node-persist": "3.1.8",
|
|
283
286
|
"@types/react": "19.1.8",
|
|
284
287
|
"@types/react-dom": "19.1.6",
|
|
@@ -289,9 +292,6 @@
|
|
|
289
292
|
"@vitest/browser": "3.2.4",
|
|
290
293
|
"eslint": "9.30.0",
|
|
291
294
|
"eslint-config-next": "15.3.4",
|
|
292
|
-
"eslint-plugin-format": "1.0.1",
|
|
293
|
-
"eslint-plugin-react-hooks": "5.2.0",
|
|
294
|
-
"eslint-plugin-react-refresh": "0.4.20",
|
|
295
295
|
"glob": "11.0.3",
|
|
296
296
|
"lint-staged": "16.1.2",
|
|
297
297
|
"node-modules-inspector": "1.0.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var ve=Object.defineProperty;var se=Object.getOwnPropertySymbols;var Ve=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var re=(e,t,n)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ae=(e,t)=>{for(var n in t||(t={}))Ve.call(t,n)&&re(e,n,t[n]);if(se)for(var n of se(t))we.call(t,n)&&re(e,n,t[n]);return e};var I=(e,t,n)=>new Promise((s,a)=>{var c=r=>{try{o(n.next(r))}catch(T){a(T)}},p=r=>{try{o(n.throw(r))}catch(T){a(T)}},o=r=>r.done?s(r.value):Promise.resolve(r.value).then(c,p);o((n=n.apply(e,t)).next())});const Ye=require("fs-extra"),X=require("./src/config/env/env.util.cjs"),E=require("./src/node/command/command.type.cjs"),je=require("node:child_process"),oe=require("node:process"),Je=require("node:util"),g=require("./src/node/log/log.type.cjs"),C=require("./src/node/log/log.util.cjs"),Ue=require("node-fetch"),y=require("./src/node/fs/fs.util.cjs"),i=require("./src/node/package/package.type.cjs"),m=require("./src/node/path/path.util.cjs"),v=require("./src/node/storage/storage.util.cjs");function Fe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const We=Fe(Je),xe=X.getEnv();function ie(e){return I(this,null,function*(){try{const t=yield Ue(`https://registry.npmjs.org/${e}/latest`);if(!t.ok)throw new Error(`Failed to fetch latest version: ${t.status} ${t.statusText}`);const{version:n}=yield t.json();return{success:!0,result:n}}catch(t){return C.catchError(t)}})}function U(e){return I(this,null,function*(){var t,n;try{if(!e){if(y.pathExistsSync(_.PACKAGE_JSON)){const h=y.readJsonSync(_.PACKAGE_JSON),{name:$="",version:M=""}=h;return{success:!0,result:{name:$,currentVersion:M,latestVersion:M,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:_.PACKAGE_JSON,file:h}}}return{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}}if(!y.pathExistsSync(_.PACKAGE_JSON))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===i.E_PackageType.DEPENDENCY,isDevDependency:e.type===i.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const s=y.readJsonSync(_.PACKAGE_JSON),{name:a,version:c="",dependencies:p={},devDependencies:o={}}=s;if(e.name===a)return{success:!0,result:{name:a,currentVersion:c,latestVersion:c,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===i.E_PackageType.DEPENDENCY,isDevDependency:e.type===i.E_PackageType.DEV_DEPENDENCY,installedPath:_.PACKAGE_JSON,file:s}};const r=e.name in p,T=e.name in o,d=yield ie(e.name);if(!d.success)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:r,isDevDependency:T,installedPath:"",file:{}}};if(!r&&!T)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:d.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===i.E_PackageType.DEPENDENCY,isDevDependency:e.type===i.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const f=(n=(t=p[e.name])!=null?t:o[e.name])!=null?n:"",O=m.join(xe.CWD,F,e.name,W);if(!y.pathExistsSync(O))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:d.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:r,isDevDependency:T,installedPath:"",file:{}}};const S=y.readJsonSync(O),{version:A=""}=S;return f!==A?{success:!0,result:{name:e.name,currentVersion:A||f,latestVersion:d.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:r,isDevDependency:T,installedPath:O,file:S}}:{success:!0,result:{name:e.name,currentVersion:f,latestVersion:d.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:f===d.result,isDependency:r,isDevDependency:T,installedPath:O,file:S}}}catch(s){return C.catchError(s)}})}function x(e){return I(this,null,function*(){var t,n;try{const s=y.readJsonSync(_.PACKAGE_JSON),a=(t=s.dependencies)!=null?t:{},c=(n=s.devDependencies)!=null?n:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(c[e.name]=e.latestVersion),y.writeFileSync(_.PACKAGE_JSON,JSON.stringify(s,null,4)),C.log.info(`Updated "${e.name}" to version ${e.latestVersion}`)}catch(s){C.catchError(s)}})}function Ee(){return I(this,null,function*(){try{const e=[{command:()=>k.pnpmInstallStandard(),message:"Installing dependencies (standard)"},{command:()=>k.pnpmInstallLegacy(),message:"Retrying with legacy peer dependencies"},{command:()=>k.pnpmInstallForce(),message:"Retrying with force install"}];for(const{command:t,message:n}of e)try{const s=yield t();yield Q(`${n} using: ${s}`,s);return}catch(s){C.catchError(s)}}catch(e){C.catchError(e)}})}function _e(e,t){return I(this,null,function*(){var n;try{if(!y.pathExistsSync(_.PACKAGE_JSON)){C.log.error("package.json not found. Aborting setup.");return}const a=(yield Promise.all(e.map(U))).filter(r=>r.success&&!!r.result&&!r.result.isCurrentProject).map(r=>r.result),c=a.filter(r=>!r.isInstalled),p=a.filter(r=>!r.isUpToDate),o=[];t!=null&&t.install&&c.length>0&&o.push(...c.map(x)),t!=null&&t.update&&p.length>0&&o.push(...p.map(x)),o.length>0&&(yield Promise.all(o),yield Ee(),yield Q("Running ESLint with auto-fix",yield k.eslintFix()));for(const r of(n=t==null?void 0:t.callbacks)!=null?n:[])yield r()}catch(s){C.catchError(s)}})}const le=X.getEnv(),be=We.promisify(je.exec);function z(){return I(this,null,function*(){const e=yield U();return e.success?e.result.name:Date.now().toString()})}function me(e){return I(this,null,function*(){if(e.length===0)return;const t=yield z();try{yield v.storage.set(t,e),setTimeout(()=>I(null,null,function*(){const n=yield v.storage.getLogLink(t);n&&C.log.info(`📂 Open the error list manually: ${n}`)}),0)}catch(n){C.catchError(n)}})}function He(){return I(this,null,function*(){try{const e=yield z(),t=yield v.storage.get(e);return t!=null?t:[]}catch(e){return C.catchError(e,{returnValue:[]})}})}function Be(){return I(this,null,function*(){try{const e=yield z();yield v.storage.remove(e)}catch(e){C.catchError(e)}})}function qe(e){const t=[],n=[];let s="";const a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,c=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,p=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split(`
|
|
2
|
-
`).forEach(o=>{var r,T,d,f,O,S,A,h,$,M,ne;if(o.startsWith("/"))s=o.trim();else{const u=a.exec(o)||[],N=c.exec(o)||[],D=p.exec(o)||[];u.length&&s?t.push({file:s,position:`${u[1]}:${u[2]}`,type:u[3]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(T=(r=u==null?void 0:u[4])==null?void 0:r.trim())!=null?T:"",rule:(f=(d=u==null?void 0:u[5])==null?void 0:d.trim())!=null?f:""}):N.length?t.push({file:(O=N==null?void 0:N[1])!=null?O:"",position:`${N[2]}:${N[3]}`,type:N[4]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(A=(S=N==null?void 0:N[5])==null?void 0:S.trim())!=null?A:""}):D.length?t.push({file:"commitlint",type:g.E_IssueType.Error,message:($=(h=D==null?void 0:D[1])==null?void 0:h.trim())!=null?$:"",rule:(ne=(M=D==null?void 0:D[2])==null?void 0:M.trim())!=null?ne:""}):n.push(o.trim())}}),t.length&&me(t),le.DEBUG&&n.length&&(C.log.warn("Unmatched lines:"),n.forEach(o=>C.log.info(` ${o}`)))}function Xe(e){try{const t=JSON.parse(e),n=[];t.forEach(({filePath:s,messages:a})=>{a.forEach(({severity:c,line:p,column:o,ruleId:r,message:T})=>{n.push({type:c===2?g.E_IssueType.Error:g.E_IssueType.Warning,file:s,position:`${p}:${o}`,rule:r,message:T})})}),n.length&&me(n)}catch(t){qe(e)}}function ze(n){return I(this,arguments,function*(e,t=Xe){const s=new AbortController;oe.on("SIGINT",()=>{C.log.warn("Process interrupted. Terminating..."),s.abort(),oe.exit()});try{if(typeof e=="string"){const{stdout:a,stderr:c}=yield be(e,{maxBuffer:104857600,signal:s.signal});[a,c].forEach(p=>p&&t(p))}}catch(a){const{stdout:c,stderr:p,message:o}=a;[c,p].forEach(r=>r&&t(r)),!p&&!c&&C.log.error(`Command failed: ${o}`)}})}function V(e){return{raw:!0,cmd:e}}function ce(e,t){return t!=null&&t.isCurrentProject?`${J} ${P} ${Oe} ${e}`:`${J} ${fe} ${e}`}function w(e,t){return typeof e=="function"?ce(e(t),t):typeof e=="object"&&(e==null?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ce(e,t):e}function Qe(e){return I(this,null,function*(){const t=yield U({name:j});if(t.success){const n={isCurrentProject:t.result.isCurrentProject},s=typeof e=="function"?e(n):e;return Object.fromEntries(Object.entries(s).map(([a,c])=>[a,w(c,n)]))}})}function Q(e,t){return I(this,null,function*(){try{C.log.start(`${e}`),le.DEBUG&&C.log.info(`→ ${t}`),yield ze(t),C.log.success(`${e} done.`)}catch(n){C.catchError(n)}})}const Ze=X.getEnv(),Y=Ze.CWD,j="@cyberskill/shared",F="node_modules",Ce="dist",pe="public",W="package.json",Ie="package-lock.json",Te="tsconfig.json",ue=".gitignore",Ne=".simple-git-hooks.json",de="pnpm-lock.yaml",ge=".git/hooks/",ye=".git/COMMIT_EDITMSG",Pe=".migrate-mongo.config.js",G=(()=>{const t=Ye.readJsonSync(m.resolveWorkingPath(W)).name===j?Y:m.join(Y,F,j);return m.join(t,Ce)})(),fe="cyberskill",Oe="src/node/cli/index.ts",b="eslint",H="eslint",B="vitest",q="vitest",De="@commitlint/cli",Ge="@commitlint/config-conventional",Z="commitlint",Le="lint-staged",ee="lint-staged",Se="typescript",Ae="tsc",P="tsx",te="git",L="pnpm",J="pnpm exec",he="simple-git-hooks",Me="simple-git-hooks",ke="@eslint/config-inspector",$e="eslint-config-inspector",Ke="node-modules-inspector",Re="node-modules-inspector",K="migrate-mongo",R="./node_modules/migrate-mongo/bin/migrate-mongo",_={CYBERSKILL_DIRECTORY:G,WORKING_DIRECTORY:Y,PUBLIC_DIRECTORY:m.resolveWorkingPath(pe),TS_CONFIG:m.resolveWorkingPath(Te),GIT_IGNORE:m.resolveWorkingPath(ue),GIT_HOOK:m.resolveWorkingPath(ge),GIT_COMMIT_MSG:m.resolveWorkingPath(ye),SIMPLE_GIT_HOOKS_JSON:m.resolveWorkingPath(Ne),PACKAGE_JSON:m.resolveWorkingPath(W),PACKAGE_LOCK_JSON:m.resolveWorkingPath(Ie),PNPM_LOCK_YAML:m.resolveWorkingPath(de),NODE_MODULES:m.resolveWorkingPath(F),MIGRATE_MONGO_CONFIG:m.resolveWorkingPath(Pe),LINT_STAGED_CONFIG:m.resolveWorkingPath(`${G}/src/config/lint-staged/index.js`),COMMITLINT_CONFIG:m.resolveWorkingPath(`${G}/src/config/commitlint/index.js`),VITEST_UNIT_CONFIG:m.resolveWorkingPath(`${G}/src/config/vitest/vitest.unit.js`),VITEST_UNIT_SETUP_CONFIG:m.resolveWorkingPath(`${G}/src/config/vitest/vitest.unit.setup.js`),VITEST_E2E_CONFIG:m.resolveWorkingPath(`${G}/src/config/vitest/vitest.e2e.js`)};function et({isCurrentProject:e}){return ae({"pre-commit":ee,"commit-msg":Z},e&&{"pre-push":V(`${te} pull`)})}function l({type:e,packages:t,command:n}){const s=t==null?void 0:t.reduce((a,c)=>(a.some(p=>p.name===c.name)||a.push(c),a),[]);return()=>I(null,null,function*(){switch(e){case E.E_CommandType.CLI:return s!=null&&s.length&&(yield _e(s,{install:!0})),w(V(`${J} ${n}`));case E.E_CommandType.STRING:return w(V(n));default:throw new Error("Unsupported command type")}})}const k={simpleGitHooks:l({type:E.E_CommandType.CLI,packages:[{name:he,type:i.E_PackageType.DEV_DEPENDENCY}],command:Me}),eslintInspect:l({type:E.E_CommandType.CLI,packages:[{name:ke,type:i.E_PackageType.DEV_DEPENDENCY}],command:$e}),nodeModulesInspect:l({type:E.E_CommandType.CLI,packages:[{name:Ke,type:i.E_PackageType.DEV_DEPENDENCY}],command:Re}),eslintCheck:l({type:E.E_CommandType.CLI,packages:[{name:b,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${H} ${_.WORKING_DIRECTORY} --no-cache`}),eslintFix:l({type:E.E_CommandType.CLI,packages:[{name:b,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${H} ${_.WORKING_DIRECTORY} --fix --no-cache`}),typescriptCheck:l({type:E.E_CommandType.CLI,packages:[{name:Se,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${Ae} -p ${_.TS_CONFIG} --noEmit`}),testUnit:l({type:E.E_CommandType.CLI,packages:[{name:B,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${q} --config ${_.VITEST_UNIT_CONFIG}`}),testE2e:l({type:E.E_CommandType.CLI,packages:[{name:B,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${q} --config ${_.VITEST_E2E_CONFIG}`}),mongoMigrateCreate:e=>l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} create ${e} -f ${_.MIGRATE_MONGO_CONFIG}`})(),mongoMigrateUp:l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} up -f ${_.MIGRATE_MONGO_CONFIG}`}),mongoMigrateDown:l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} down -f ${_.MIGRATE_MONGO_CONFIG}`}),commitLint:l({type:E.E_CommandType.CLI,packages:[{name:De,type:i.E_PackageType.DEV_DEPENDENCY},{name:Ge,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${Z} --edit ${_.GIT_COMMIT_MSG} --config ${_.COMMITLINT_CONFIG}`}),lintStaged:l({type:E.E_CommandType.CLI,packages:[{name:Le,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${ee} --config ${_.LINT_STAGED_CONFIG}`}),configureGitHook:l({type:E.E_CommandType.STRING,command:`${te} config core.hooksPath ${_.GIT_HOOK}`}),build:l({type:E.E_CommandType.STRING,command:`${L} run --if-present build`}),pnpmInstallStandard:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts`}),pnpmInstallLegacy:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts --legacy-peer-deps`}),pnpmInstallForce:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts --force`}),pnpmPruneStore:l({type:E.E_CommandType.STRING,command:`${L} store prune`}),pnpmCleanCache:l({type:E.E_CommandType.STRING,command:`${L} cache delete`})};exports.BUILD_DIRECTORY=Ce;exports.COMMIT_LINT_CLI=Z;exports.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME=Ge;exports.COMMIT_LINT_PACKAGE_NAME=De;exports.CYBERSKILL_CLI=fe;exports.CYBERSKILL_CLI_PATH=Oe;exports.CYBERSKILL_DIRECTORY=G;exports.CYBERSKILL_PACKAGE_NAME=j;exports.ESLINT_CLI=H;exports.ESLINT_INSPECT_CLI=$e;exports.ESLINT_INSPECT_PACKAGE_NAME=ke;exports.ESLINT_PACKAGE_NAME=b;exports.GIT_CLI=te;exports.GIT_COMMIT_EDITMSG=ye;exports.GIT_HOOK=ge;exports.GIT_IGNORE=ue;exports.LINT_STAGED_CLI=ee;exports.LINT_STAGED_PACKAGE_NAME=Le;exports.MIGRATE_MONGO_CLI=R;exports.MIGRATE_MONGO_CONFIG=Pe;exports.MIGRATE_MONGO_PACKAGE_NAME=K;exports.NODE_MODULES=F;exports.NODE_MODULES_INSPECT_CLI=Re;exports.NODE_MODULES_INSPECT_PACKAGE_NAME=Ke;exports.PACKAGE_JSON=W;exports.PACKAGE_LOCK_JSON=Ie;exports.PATH=_;exports.PNPM_CLI=L;exports.PNPM_EXEC_CLI=J;exports.PNPM_LOCK_YAML=de;exports.PUBLIC_DIRECTORY=pe;exports.SIMPLE_GIT_HOOKS_PACKAGE_NAME=he;exports.SIMPLE_GIT_HOOK_CLI=Me;exports.SIMPLE_GIT_HOOK_JSON=Ne;exports.TSCONFIG_JSON=Te;exports.TSC_CLI=Ae;exports.TSC_PACKAGE_NAME=Se;exports.TSX_CLI=P;exports.VITEST_CLI=q;exports.VITEST_PACKAGE_NAME=B;exports.WORKING_DIRECTORY=Y;exports.clearAllErrorLists=Be;exports.command=k;exports.createGitHooksConfig=et;exports.formatCommand=w;exports.getLatestPackageVersion=ie;exports.getPackage=U;exports.getStoredErrorLists=He;exports.installDependencies=Ee;exports.rawCommand=V;exports.resolveCommands=Qe;exports.runCommand=Q;exports.setupPackages=_e;exports.updatePackage=x;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(t=>(t.ESLINT="eslint",t.COMMITLINT="commitlint",t.LINT_STAGED="lint-staged",t.VITEST_REACT_E2E="vitest-react-e2e",t.VITEST_REACT_UNIT="vitest-react-unit",t))(e||{});exports.E_ConfigType=e;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r=(e=>(e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e))(r||{});exports.E_CommandType=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("express");Object.defineProperty(exports,"Router",{enumerable:!0,get:()=>e.Router});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(r=>(r.Error="error",r.Warning="warning",r))(e||{});exports.E_IssueType=e;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("mongodb"),t=require("mongoose");class s extends o.Db{}class l extends t.Document{}class n extends t.Model{}class c extends o.Collection{}exports.C_Collection=c;exports.C_Db=s;exports.C_Document=l;exports.C_Model=n;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Db as o, Collection as s } from "mongodb";
|
|
2
|
-
import { Document as t, Model as l } from "mongoose";
|
|
3
|
-
class d extends o {
|
|
4
|
-
}
|
|
5
|
-
class m extends t {
|
|
6
|
-
}
|
|
7
|
-
class C extends l {
|
|
8
|
-
}
|
|
9
|
-
class r extends s {
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
r as C_Collection,
|
|
13
|
-
d as C_Db,
|
|
14
|
-
m as C_Document,
|
|
15
|
-
C as C_Model
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var D=(e=>(e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e))(D||{});exports.E_PackageType=D;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var D = /* @__PURE__ */ ((e) => (e.DEPENDENCY = "dependencies", e.DEV_DEPENDENCY = "devDependencies", e.PEER_DEPENDENCY = "peerDependencies", e.BUNDLE_DEPENDENCY = "bundleDependencies", e.OPTIONAL_DEPENDENCY = "optionalDependencies", e))(D || {});
|
|
2
|
-
export {
|
|
3
|
-
D as E_PackageType
|
|
4
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t=(r=>(r.IMAGE="IMAGE",r.VIDEO="VIDEO",r.DOCUMENT="DOCUMENT",r.OTHER="OTHER",r))(t||{});exports.E_UploadType=t;
|