@cyberskill/shared 2.27.0 → 3.0.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/config.util.cjs +1 -1
- package/dist/config/config.util.js +24 -33
- package/dist/config/eslint/index.cjs +1 -1
- package/dist/config/eslint/index.d.ts +6 -0
- package/dist/config/eslint/index.js +4 -12
- package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -1
- package/dist/config/graphql-codegen/graphql-codegen.util.js +28 -33
- package/dist/config/storybook/storybook.preview.cjs +1 -1
- package/dist/config/storybook/storybook.preview.js +10 -13
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.js +1 -1
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.js +19 -8
- package/dist/constant/common.cjs +1 -1
- package/dist/constant/common.js +1 -1
- package/dist/node/apollo-server/apollo-server.util.cjs +1 -1
- package/dist/node/apollo-server/apollo-server.util.js +21 -48
- package/dist/node/cli/index.cjs +2 -5
- package/dist/node/cli/index.js +109 -170
- package/dist/node/command/command.util.cjs +2 -2
- package/dist/node/command/command.util.js +135 -170
- package/dist/node/express/express.util.cjs +1 -1
- package/dist/node/express/express.util.js +39 -72
- package/dist/node/fs/fs.util.cjs +4 -1
- package/dist/node/fs/fs.util.d.ts +8 -0
- package/dist/node/fs/fs.util.js +46 -53
- package/dist/node/fs/index.cjs +1 -1
- package/dist/node/fs/index.js +13 -12
- package/dist/node/log/log.util.cjs +1 -1
- package/dist/node/log/log.util.js +29 -30
- package/dist/node/mongo/mongo.controller.cjs +1 -1
- package/dist/node/mongo/mongo.controller.js +531 -629
- package/dist/node/mongo/mongo.type.js +3 -3
- package/dist/node/mongo/mongo.util.cjs +2 -5
- package/dist/node/mongo/mongo.util.js +308 -354
- package/dist/node/package/package.util.cjs +1 -1
- package/dist/node/package/package.util.js +197 -226
- package/dist/node/path/index.cjs +1 -1
- package/dist/node/path/index.js +26 -25
- package/dist/node/path/path.constant.cjs +1 -1
- package/dist/node/path/path.constant.d.ts +2 -0
- package/dist/node/path/path.constant.js +130 -150
- package/dist/node/storage/storage.util.cjs +1 -1
- package/dist/node/storage/storage.util.js +110 -158
- package/dist/node/upload/upload.util.cjs +1 -1
- package/dist/node/upload/upload.util.js +119 -150
- package/dist/node/ws/ts.util.cjs +1 -1
- package/dist/node/ws/ts.util.js +31 -54
- package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.component.js +4 -4
- package/dist/react/apollo-client/apollo-client.util.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.util.js +51 -58
- package/dist/react/apollo-client/links/upload.cjs +1 -1
- package/dist/react/apollo-client/links/upload.js +71 -74
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +11 -18
- package/dist/react/apollo-error/apollo-error.component.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.component.js +61 -23
- package/dist/react/apollo-error/apollo-error.module.scss.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.module.scss.js +6 -6
- package/dist/react/apollo-error/apollo-error.test.unit.d.ts +1 -0
- package/dist/react/apollo-error/apollo-error.util.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.util.js +6 -6
- package/dist/react/loading/loading.component.cjs +2 -2
- package/dist/react/loading/loading.component.js +30 -46
- package/dist/react/log/log.util.cjs +1 -1
- package/dist/react/log/log.util.js +4 -4
- package/dist/react/next-intl/next-intl.hoc.cjs +1 -1
- package/dist/react/next-intl/next-intl.hoc.js +13 -22
- package/dist/react/next-intl/next-intl.provider.cjs +1 -1
- package/dist/react/next-intl/next-intl.provider.js +7 -7
- package/dist/react/storage/storage.hook.cjs +1 -1
- package/dist/react/storage/storage.hook.js +43 -59
- package/dist/react/storage/storage.util.cjs +1 -1
- package/dist/react/storage/storage.util.js +28 -53
- package/dist/react/userback/userback.component.cjs +1 -1
- package/dist/react/userback/userback.component.js +18 -42
- package/dist/style.css +1 -1
- package/dist/util/common/common.util.cjs +1 -1
- package/dist/util/common/common.util.d.ts +11 -0
- package/dist/util/common/common.util.js +33 -37
- package/dist/util/common/index.cjs +1 -1
- package/dist/util/common/index.js +6 -5
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.js +22 -20
- package/dist/util/object/object.util.cjs +1 -1
- package/dist/util/object/object.util.js +70 -70
- package/dist/util/string/index.cjs +1 -1
- package/dist/util/string/index.js +4 -3
- package/dist/util/string/string.util.cjs +1 -1
- package/dist/util/string/string.util.d.ts +12 -0
- package/dist/util/string/string.util.js +63 -44
- package/package.json +53 -44
- package/public/tsconfig.base.json +7 -3
- package/README.md +0 -470
- package/dist/node/mongo/mongo.util.d.ts +0 -1040
- /package/dist/node_modules/.pnpm/{vitest@4.0.17_@types_node@25.0.9_jiti@2.6.1_jsdom@27.4.0_@noble_hashes@1.8.0__sass@1.97.2_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.18_@types_node@25.3.3_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@4.0.17_@types_node@25.0.9_jiti@2.6.1_jsdom@27.4.0_@noble_hashes@1.8.0__sass@1.97.2_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.18_@types_node@25.3.3_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +0 -0
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
for (var n in r || (r = {}))
|
|
3
|
-
m.call(r, n) && y(e, n, r[n]);
|
|
4
|
-
if (f)
|
|
5
|
-
for (var n of f(r))
|
|
6
|
-
h.call(r, n) && y(e, n, r[n]);
|
|
7
|
-
return e;
|
|
8
|
-
}, p = (e, r) => d(e, g(r));
|
|
9
|
-
function P(e) {
|
|
1
|
+
function p(e) {
|
|
10
2
|
try {
|
|
11
3
|
return JSON.parse(e), !0;
|
|
12
|
-
} catch
|
|
4
|
+
} catch {
|
|
13
5
|
return !1;
|
|
14
6
|
}
|
|
15
7
|
}
|
|
16
|
-
function
|
|
8
|
+
function A(e, t) {
|
|
17
9
|
let n = e;
|
|
18
|
-
const o =
|
|
19
|
-
for (let
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
const o = t.length;
|
|
11
|
+
for (let r = 0; r < o; r++) {
|
|
12
|
+
if (n == null || typeof n != "object")
|
|
13
|
+
return;
|
|
14
|
+
const s = t[r];
|
|
15
|
+
if (s !== void 0 && s in n)
|
|
22
16
|
n = n[s];
|
|
23
17
|
else
|
|
24
18
|
return;
|
|
25
19
|
}
|
|
26
20
|
return n;
|
|
27
21
|
}
|
|
28
|
-
function
|
|
29
|
-
if (
|
|
22
|
+
function f(e, t, n, o) {
|
|
23
|
+
if (o >= t.length)
|
|
30
24
|
return e;
|
|
31
|
-
const [o
|
|
32
|
-
if (t.length
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
const r = t[o];
|
|
26
|
+
if (o === t.length - 1)
|
|
27
|
+
return {
|
|
28
|
+
...e,
|
|
29
|
+
[r]: n
|
|
30
|
+
};
|
|
31
|
+
const s = e[r];
|
|
32
|
+
return {
|
|
33
|
+
...e,
|
|
34
|
+
[r]: f(
|
|
39
35
|
typeof s == "object" && s !== null ? s : {},
|
|
40
36
|
t,
|
|
41
|
-
n
|
|
37
|
+
n,
|
|
38
|
+
o + 1
|
|
42
39
|
)
|
|
43
|
-
}
|
|
40
|
+
};
|
|
44
41
|
}
|
|
45
|
-
function
|
|
42
|
+
function g(e, t, n) {
|
|
43
|
+
return t.length === 0 ? e : f(e, t, n, 0);
|
|
44
|
+
}
|
|
45
|
+
function u(e) {
|
|
46
46
|
if (e === null || typeof e != "object")
|
|
47
47
|
return e;
|
|
48
48
|
if (Array.isArray(e))
|
|
49
|
-
return e.map((o) =>
|
|
49
|
+
return e.map((o) => u(o));
|
|
50
50
|
if (e instanceof Date)
|
|
51
51
|
return new Date(e.getTime());
|
|
52
52
|
if (e instanceof RegExp)
|
|
53
53
|
return new RegExp(e.source, e.flags);
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
54
|
+
const t = Object.getPrototypeOf(e);
|
|
55
|
+
if (t !== Object.prototype && t !== null)
|
|
56
56
|
return e;
|
|
57
57
|
const n = {};
|
|
58
58
|
for (const o in e)
|
|
59
|
-
Object.prototype.hasOwnProperty.call(e, o) && (n[o] =
|
|
59
|
+
Object.prototype.hasOwnProperty.call(e, o) && (n[o] = u(e[o]));
|
|
60
60
|
return n;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function y(...e) {
|
|
63
63
|
if (e.length === 0)
|
|
64
64
|
return {};
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
65
|
+
const t = e.filter((r) => r != null);
|
|
66
|
+
if (t.length === 0)
|
|
67
67
|
return {};
|
|
68
|
-
if (
|
|
69
|
-
return
|
|
70
|
-
if (
|
|
71
|
-
return [].concat(...
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
for (const s of
|
|
68
|
+
if (t.length === 1)
|
|
69
|
+
return t[0];
|
|
70
|
+
if (t.every(Array.isArray))
|
|
71
|
+
return [].concat(...t);
|
|
72
|
+
if (t.every((r) => typeof r == "object" && r !== null && !Array.isArray(r))) {
|
|
73
|
+
const r = {};
|
|
74
|
+
for (const s of t) {
|
|
75
75
|
const i = s;
|
|
76
|
-
for (const
|
|
77
|
-
if (Object.prototype.hasOwnProperty.call(i,
|
|
78
|
-
const
|
|
79
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
80
|
-
const c =
|
|
81
|
-
typeof
|
|
76
|
+
for (const l in i)
|
|
77
|
+
if (Object.prototype.hasOwnProperty.call(i, l)) {
|
|
78
|
+
const a = i[l];
|
|
79
|
+
if (Object.prototype.hasOwnProperty.call(r, l)) {
|
|
80
|
+
const c = r[l];
|
|
81
|
+
typeof a == "object" && a !== null && typeof c == "object" && c !== null ? Array.isArray(a) && Array.isArray(c) ? r[l] = c.concat(a) : !Array.isArray(a) && !Array.isArray(c) ? r[l] = y(
|
|
82
82
|
c,
|
|
83
|
-
|
|
84
|
-
) :
|
|
83
|
+
a
|
|
84
|
+
) : r[l] = a : r[l] = a;
|
|
85
85
|
} else
|
|
86
|
-
|
|
86
|
+
r[l] = a;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return r;
|
|
90
90
|
}
|
|
91
|
-
if (
|
|
91
|
+
if (t.every((r) => typeof r != "object" || r === null))
|
|
92
92
|
throw new Error(
|
|
93
93
|
"deepMerge: Cannot merge primitive values. All arguments must be objects or arrays."
|
|
94
94
|
);
|
|
95
|
-
const n =
|
|
96
|
-
(
|
|
95
|
+
const n = t.some(Array.isArray), o = t.some(
|
|
96
|
+
(r) => typeof r == "object" && r !== null && !Array.isArray(r)
|
|
97
97
|
);
|
|
98
98
|
throw n && o ? new Error(
|
|
99
99
|
"deepMerge: Cannot mix arrays and objects. All arguments must be either arrays or objects."
|
|
@@ -101,34 +101,34 @@ function w(...e) {
|
|
|
101
101
|
"deepMerge: Invalid arguments provided. All arguments must be objects or arrays of the same type."
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function h(e) {
|
|
105
105
|
if (!e || typeof e != "object")
|
|
106
106
|
return e;
|
|
107
|
-
const
|
|
108
|
-
function n(o,
|
|
107
|
+
const t = {};
|
|
108
|
+
function n(o, r) {
|
|
109
109
|
for (const s in o) {
|
|
110
110
|
if (!Object.prototype.hasOwnProperty.call(o, s))
|
|
111
111
|
continue;
|
|
112
|
-
const i = o[s],
|
|
112
|
+
const i = o[s], l = r ? `${r}.${s}` : s;
|
|
113
113
|
if (i && typeof i == "object" && !Array.isArray(i)) {
|
|
114
|
-
let
|
|
114
|
+
let a = !1;
|
|
115
115
|
for (const c in i)
|
|
116
116
|
if (Object.prototype.hasOwnProperty.call(i, c) && c.startsWith("$")) {
|
|
117
|
-
|
|
117
|
+
a = !0;
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
a ? t[l] = i : n(i, l);
|
|
121
121
|
} else
|
|
122
|
-
|
|
122
|
+
t[l] = i;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
return n(e, ""),
|
|
125
|
+
return n(e, ""), t;
|
|
126
126
|
}
|
|
127
127
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
u as deepClone,
|
|
129
|
+
y as deepMerge,
|
|
130
|
+
A as getNestedValue,
|
|
131
|
+
p as isJSON,
|
|
132
|
+
h as normalizeMongoFilter,
|
|
133
|
+
g as setNestedValue
|
|
134
134
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./string.util.cjs");exports.generateRandomPassword=e.generateRandomPassword;exports.generateShortId=e.generateShortId;exports.generateSlug=e.generateSlug;exports.getFileName=e.getFileName;exports.substringBetween=e.substringBetween;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./string.util.cjs");exports.generateRandomPassword=e.generateRandomPassword;exports.generateRandomString=e.generateRandomString;exports.generateShortId=e.generateShortId;exports.generateSlug=e.generateSlug;exports.getFileName=e.getFileName;exports.substringBetween=e.substringBetween;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { generateRandomPassword as t, generateShortId as a, generateSlug as g, getFileName as
|
|
1
|
+
import { generateRandomPassword as t, generateRandomString as n, generateShortId as a, generateSlug as g, getFileName as o, substringBetween as d } from "./string.util.js";
|
|
2
2
|
export {
|
|
3
3
|
t as generateRandomPassword,
|
|
4
|
+
n as generateRandomString,
|
|
4
5
|
a as generateShortId,
|
|
5
6
|
g as generateSlug,
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
o as getFileName,
|
|
8
|
+
d as substringBetween
|
|
8
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../common/common.util.cjs");function c(e,n){let t=e.trim();return t=u.removeAccent(t),n?.lower!==!1&&(t=t.toLowerCase()),t=t.replace(/[^a-z0-9\s-]/gi," "),t=t.replace(/[\s-]+/g,"-"),t=t.replace(/^-+|-+$/g,""),t}function f(e,n){const t=r=>c(r??"",n);if(typeof e=="object"&&e!==null){const r={};for(const[o,i]of Object.entries(e))r[o]=t(i);return r}return t(e)}function m(e,n=4){let t=2166136261;for(let o=0;o<e.length;o++)t^=e.charCodeAt(o),t=Math.imul(t,16777619);const r=(t>>>0).toString(16).padStart(8,"0");return n>8?e.replace(/-/g,"").slice(0,n):r.slice(0,n)}function l(e,n){const t=Math.floor(4294967296/n.length)*n.length,r=[],o=16384;for(;r.length<e;){const i=e-r.length,g=i>o?o:i,s=new Uint32Array(g);crypto.getRandomValues(s);for(const a of s){if(r.length>=e)break;a<t&&r.push(n[a%n.length])}}return r.join("")}function d(e=8){if(!Number.isSafeInteger(e)||e<0)throw new RangeError("length must be a non-negative safe integer");return l(e,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}|;:,.<>?")}function h(e=8,n="abcdefghijklmnopqrstuvwxyz0123456789"){if(!Number.isSafeInteger(e)||e<0)throw new RangeError("length must be a non-negative safe integer");if(n.length===0||n.length>2**32)throw new RangeError("charset.length must be between 1 and 2^32");return l(e,n)}function w(e="",n=!1){const t=e.split(/[?#]/)[0]||"",r=t.substring(t.lastIndexOf("/")+1);if(n)return r;const o=r.lastIndexOf(".");return o>0?r.slice(0,o):r}function b(e,n,t){const r=e.indexOf(n);if(r===-1)return"";const o=r+n.length,i=e.indexOf(t,o);return i===-1?"":e.slice(o,i)}exports.generateRandomPassword=d;exports.generateRandomString=h;exports.generateShortId=m;exports.generateSlug=f;exports.getFileName=w;exports.substringBetween=b;
|
|
@@ -28,8 +28,20 @@ export declare function generateShortId(uuid: string, length?: number): string;
|
|
|
28
28
|
*
|
|
29
29
|
* @param length - The desired length of the password (default: 8 characters).
|
|
30
30
|
* @returns A randomly generated password string with the specified length.
|
|
31
|
+
* @throws {RangeError} If `length` is not a non-negative safe integer.
|
|
31
32
|
*/
|
|
32
33
|
export declare function generateRandomPassword(length?: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* Generates a random string of a given length using a secure random number generator.
|
|
36
|
+
* This function is a cryptographically secure alternative to Math.random().toString(36).
|
|
37
|
+
*
|
|
38
|
+
* @param length - The desired length of the string (default: 8 characters).
|
|
39
|
+
* @param charset - The characters to use (default: lowercase alphanumeric).
|
|
40
|
+
* @returns A randomly generated string.
|
|
41
|
+
* @throws {RangeError} If `length` is not a non-negative safe integer.
|
|
42
|
+
* @throws {RangeError} If `charset` is empty or exceeds 2^32 characters.
|
|
43
|
+
*/
|
|
44
|
+
export declare function generateRandomString(length?: number, charset?: string): string;
|
|
33
45
|
/**
|
|
34
46
|
* Get the file name from a URL.
|
|
35
47
|
* This function extracts the file name from a URL, optionally including or excluding
|
|
@@ -1,50 +1,69 @@
|
|
|
1
1
|
import { removeAccent as c } from "../common/common.util.js";
|
|
2
|
-
function
|
|
3
|
-
let
|
|
4
|
-
return
|
|
5
|
-
}
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
if (typeof
|
|
9
|
-
const
|
|
10
|
-
for (const [o,
|
|
11
|
-
|
|
12
|
-
return
|
|
2
|
+
function u(e, n) {
|
|
3
|
+
let t = e.trim();
|
|
4
|
+
return t = c(t), n?.lower !== !1 && (t = t.toLowerCase()), t = t.replace(/[^a-z0-9\s-]/gi, " "), t = t.replace(/[\s-]+/g, "-"), t = t.replace(/^-+|-+$/g, ""), t;
|
|
5
|
+
}
|
|
6
|
+
function m(e, n) {
|
|
7
|
+
const t = (r) => u(r ?? "", n);
|
|
8
|
+
if (typeof e == "object" && e !== null) {
|
|
9
|
+
const r = {};
|
|
10
|
+
for (const [o, i] of Object.entries(e))
|
|
11
|
+
r[o] = t(i);
|
|
12
|
+
return r;
|
|
13
|
+
}
|
|
14
|
+
return t(e);
|
|
15
|
+
}
|
|
16
|
+
function h(e, n = 4) {
|
|
17
|
+
let t = 2166136261;
|
|
18
|
+
for (let o = 0; o < e.length; o++)
|
|
19
|
+
t ^= e.charCodeAt(o), t = Math.imul(t, 16777619);
|
|
20
|
+
const r = (t >>> 0).toString(16).padStart(8, "0");
|
|
21
|
+
return n > 8 ? e.replace(/-/g, "").slice(0, n) : r.slice(0, n);
|
|
22
|
+
}
|
|
23
|
+
function f(e, n) {
|
|
24
|
+
const t = Math.floor(4294967296 / n.length) * n.length, r = [], o = 16384;
|
|
25
|
+
for (; r.length < e; ) {
|
|
26
|
+
const i = e - r.length, l = i > o ? o : i, s = new Uint32Array(l);
|
|
27
|
+
crypto.getRandomValues(s);
|
|
28
|
+
for (const a of s) {
|
|
29
|
+
if (r.length >= e)
|
|
30
|
+
break;
|
|
31
|
+
a < t && r.push(n[a % n.length]);
|
|
32
|
+
}
|
|
13
33
|
}
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const n = t.indexOf(r);
|
|
39
|
-
if (n === -1)
|
|
34
|
+
return r.join("");
|
|
35
|
+
}
|
|
36
|
+
function d(e = 8) {
|
|
37
|
+
if (!Number.isSafeInteger(e) || e < 0)
|
|
38
|
+
throw new RangeError("length must be a non-negative safe integer");
|
|
39
|
+
return f(e, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}|;:,.<>?");
|
|
40
|
+
}
|
|
41
|
+
function w(e = 8, n = "abcdefghijklmnopqrstuvwxyz0123456789") {
|
|
42
|
+
if (!Number.isSafeInteger(e) || e < 0)
|
|
43
|
+
throw new RangeError("length must be a non-negative safe integer");
|
|
44
|
+
if (n.length === 0 || n.length > 2 ** 32)
|
|
45
|
+
throw new RangeError("charset.length must be between 1 and 2^32");
|
|
46
|
+
return f(e, n);
|
|
47
|
+
}
|
|
48
|
+
function b(e = "", n = !1) {
|
|
49
|
+
const t = e.split(/[?#]/)[0] || "", r = t.substring(t.lastIndexOf("/") + 1);
|
|
50
|
+
if (n)
|
|
51
|
+
return r;
|
|
52
|
+
const o = r.lastIndexOf(".");
|
|
53
|
+
return o > 0 ? r.slice(0, o) : r;
|
|
54
|
+
}
|
|
55
|
+
function p(e, n, t) {
|
|
56
|
+
const r = e.indexOf(n);
|
|
57
|
+
if (r === -1)
|
|
40
58
|
return "";
|
|
41
|
-
const o =
|
|
42
|
-
return
|
|
59
|
+
const o = r + n.length, i = e.indexOf(t, o);
|
|
60
|
+
return i === -1 ? "" : e.slice(o, i);
|
|
43
61
|
}
|
|
44
62
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
d as generateRandomPassword,
|
|
64
|
+
w as generateRandomString,
|
|
65
|
+
h as generateShortId,
|
|
66
|
+
m as generateSlug,
|
|
67
|
+
b as getFileName,
|
|
68
|
+
p as substringBetween
|
|
50
69
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberskill/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -197,6 +197,9 @@
|
|
|
197
197
|
"dist",
|
|
198
198
|
"public"
|
|
199
199
|
],
|
|
200
|
+
"engines": {
|
|
201
|
+
"node": ">=24.0.0"
|
|
202
|
+
},
|
|
200
203
|
"scripts": {
|
|
201
204
|
"ai:setup": "tsx src/node/cli/index.ts ai:setup",
|
|
202
205
|
"build": "vite build",
|
|
@@ -213,69 +216,69 @@
|
|
|
213
216
|
"test:unit": "tsx src/node/cli/index.ts test:unit"
|
|
214
217
|
},
|
|
215
218
|
"dependencies": {
|
|
216
|
-
"@antfu/eslint-config": "7.1
|
|
217
|
-
"@apollo/client": "4.1.
|
|
219
|
+
"@antfu/eslint-config": "7.6.1",
|
|
220
|
+
"@apollo/client": "4.1.6",
|
|
218
221
|
"@apollo/client-integration-nextjs": "0.14.4",
|
|
219
|
-
"@apollo/server": "5.
|
|
222
|
+
"@apollo/server": "5.4.0",
|
|
220
223
|
"@as-integrations/express5": "1.1.2",
|
|
221
|
-
"@dotenvx/dotenvx": "1.
|
|
224
|
+
"@dotenvx/dotenvx": "1.52.0",
|
|
222
225
|
"@eddeee888/gcg-typescript-resolver-files": "0.15.0",
|
|
223
|
-
"@eslint-react/eslint-plugin": "2.
|
|
224
|
-
"@graphql-codegen/cli": "6.1.
|
|
225
|
-
"@graphql-codegen/client-preset": "5.2.
|
|
226
|
-
"@nestjs/common": "11.1.
|
|
227
|
-
"@nestjs/core": "11.1.
|
|
226
|
+
"@eslint-react/eslint-plugin": "2.13.0",
|
|
227
|
+
"@graphql-codegen/cli": "6.1.2",
|
|
228
|
+
"@graphql-codegen/client-preset": "5.2.3",
|
|
229
|
+
"@nestjs/common": "11.1.14",
|
|
230
|
+
"@nestjs/core": "11.1.14",
|
|
228
231
|
"@userback/widget": "0.3.12",
|
|
229
|
-
"@vitejs/plugin-react-swc": "4.2.
|
|
232
|
+
"@vitejs/plugin-react-swc": "4.2.3",
|
|
230
233
|
"body-parser": "2.2.2",
|
|
231
234
|
"chalk": "5.6.2",
|
|
232
235
|
"clsx": "2.1.1",
|
|
233
236
|
"compression": "1.8.1",
|
|
234
237
|
"consola": "3.4.2",
|
|
235
238
|
"cookie-parser": "1.4.7",
|
|
236
|
-
"cors": "2.8.
|
|
239
|
+
"cors": "2.8.6",
|
|
237
240
|
"date-fns": "4.1.0",
|
|
238
241
|
"envalid": "8.1.1",
|
|
239
|
-
"eslint-plugin-format": "
|
|
242
|
+
"eslint-plugin-format": "2.0.1",
|
|
240
243
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
241
|
-
"eslint-plugin-react-refresh": "0.
|
|
244
|
+
"eslint-plugin-react-refresh": "0.5.2",
|
|
242
245
|
"express": "5.2.1",
|
|
243
|
-
"express-session": "1.
|
|
244
|
-
"express-useragent": "2.0
|
|
246
|
+
"express-session": "1.19.0",
|
|
247
|
+
"express-useragent": "2.1.0",
|
|
245
248
|
"extract-files": "13.0.0",
|
|
246
249
|
"fs-extra": "11.3.3",
|
|
247
|
-
"globals": "17.
|
|
248
|
-
"graphql": "16.
|
|
250
|
+
"globals": "17.4.0",
|
|
251
|
+
"graphql": "16.13.0",
|
|
249
252
|
"graphql-upload": "17.0.0",
|
|
250
|
-
"graphql-ws": "6.0.
|
|
253
|
+
"graphql-ws": "6.0.7",
|
|
251
254
|
"helmet": "8.1.0",
|
|
252
|
-
"i18next": "25.8.
|
|
253
|
-
"jsdom": "
|
|
255
|
+
"i18next": "25.8.13",
|
|
256
|
+
"jsdom": "28.1.0",
|
|
254
257
|
"localforage": "1.10.0",
|
|
255
258
|
"migrate-mongo": "14.0.7",
|
|
256
|
-
"mongodb": "7.
|
|
257
|
-
"mongoose": "9.
|
|
259
|
+
"mongodb": "7.1.0",
|
|
260
|
+
"mongoose": "9.2.3",
|
|
258
261
|
"mongoose-aggregate-paginate-v2": "1.1.4",
|
|
259
262
|
"mongoose-paginate-v2": "1.9.1",
|
|
260
|
-
"next-intl": "4.
|
|
263
|
+
"next-intl": "4.8.3",
|
|
261
264
|
"node-fetch": "3.3.2",
|
|
262
|
-
"qs": "6.
|
|
263
|
-
"react": "19.2.
|
|
264
|
-
"react-dom": "19.2.
|
|
265
|
+
"qs": "6.15.0",
|
|
266
|
+
"react": "19.2.4",
|
|
267
|
+
"react-dom": "19.2.4",
|
|
265
268
|
"react-hot-toast": "2.6.0",
|
|
266
|
-
"react-i18next": "16.5.
|
|
269
|
+
"react-i18next": "16.5.4",
|
|
267
270
|
"rxjs": "7.8.2",
|
|
268
271
|
"vite": "7.3.1",
|
|
269
272
|
"ws": "8.19.0",
|
|
270
273
|
"yargs": "18.0.0"
|
|
271
274
|
},
|
|
272
275
|
"devDependencies": {
|
|
273
|
-
"@commitlint/cli": "20.
|
|
274
|
-
"@commitlint/config-conventional": "20.
|
|
276
|
+
"@commitlint/cli": "20.4.2",
|
|
277
|
+
"@commitlint/config-conventional": "20.4.2",
|
|
275
278
|
"@eslint/config-inspector": "1.4.2",
|
|
276
|
-
"@next/eslint-plugin-next": "16.1.
|
|
277
|
-
"@storybook/react": "10.
|
|
278
|
-
"@storybook/react-vite": "10.
|
|
279
|
+
"@next/eslint-plugin-next": "16.1.6",
|
|
280
|
+
"@storybook/react": "10.2.14",
|
|
281
|
+
"@storybook/react-vite": "10.2.14",
|
|
279
282
|
"@testing-library/jest-dom": "6.9.1",
|
|
280
283
|
"@testing-library/react": "16.3.2",
|
|
281
284
|
"@types/body-parser": "1.19.6",
|
|
@@ -289,28 +292,34 @@
|
|
|
289
292
|
"@types/fs-extra": "11.0.4",
|
|
290
293
|
"@types/graphql-upload": "17.0.0",
|
|
291
294
|
"@types/migrate-mongo": "10.0.6",
|
|
292
|
-
"@types/node": "25.
|
|
293
|
-
"@types/react": "19.2.
|
|
295
|
+
"@types/node": "25.3.3",
|
|
296
|
+
"@types/react": "19.2.14",
|
|
294
297
|
"@types/react-dom": "19.2.3",
|
|
295
298
|
"@types/ws": "8.18.1",
|
|
296
299
|
"@types/yargs": "17.0.35",
|
|
297
|
-
"@vitest/browser": "4.0.
|
|
298
|
-
"eslint": "
|
|
299
|
-
"eslint-config-next": "16.1.
|
|
300
|
-
"glob": "13.0.
|
|
301
|
-
"lint-staged": "16.
|
|
302
|
-
"node-modules-inspector": "1.2
|
|
300
|
+
"@vitest/browser": "4.0.18",
|
|
301
|
+
"eslint": "10.0.2",
|
|
302
|
+
"eslint-config-next": "16.1.6",
|
|
303
|
+
"glob": "13.0.6",
|
|
304
|
+
"lint-staged": "16.3.1",
|
|
305
|
+
"node-modules-inspector": "1.3.2",
|
|
303
306
|
"npm-run-all2": "8.0.4",
|
|
304
|
-
"sass": "1.97.
|
|
307
|
+
"sass": "1.97.3",
|
|
305
308
|
"simple-git-hooks": "2.13.1",
|
|
306
309
|
"tsx": "4.21.0",
|
|
307
310
|
"typescript": "5.9.3",
|
|
308
311
|
"vite": "7.3.1",
|
|
309
312
|
"vite-plugin-dts": "4.5.4",
|
|
310
|
-
"vitest": "4.0.
|
|
313
|
+
"vitest": "4.0.18"
|
|
311
314
|
},
|
|
312
315
|
"publishConfig": {
|
|
313
316
|
"access": "public",
|
|
314
|
-
"registry": "https://registry.npmjs.org/"
|
|
317
|
+
"registry": "https://registry.npmjs.org/",
|
|
318
|
+
"provenance": true
|
|
319
|
+
},
|
|
320
|
+
"pnpm": {
|
|
321
|
+
"overrides": {
|
|
322
|
+
"minimatch": ">=10.2.3"
|
|
323
|
+
}
|
|
315
324
|
}
|
|
316
325
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
3
|
+
"target": "ES2022",
|
|
4
4
|
"jsx": "react",
|
|
5
|
-
"lib": [
|
|
5
|
+
"lib": [
|
|
6
|
+
"ESNext",
|
|
7
|
+
"DOM",
|
|
8
|
+
"DOM.Iterable"
|
|
9
|
+
],
|
|
6
10
|
"useDefineForClassFields": true,
|
|
7
11
|
"emitDecoratorMetadata": true,
|
|
8
12
|
"experimentalDecorators": true,
|
|
@@ -34,4 +38,4 @@
|
|
|
34
38
|
"noUncheckedSideEffectImports": true,
|
|
35
39
|
"skipLibCheck": true
|
|
36
40
|
}
|
|
37
|
-
}
|
|
41
|
+
}
|