@cyberskill/shared 1.208.0 → 1.209.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-CwzVfkkX.js +6 -0
- package/dist/index-BG1UznTl.js +628 -0
- package/dist/{magic-string.es-C6Zk6wMx.js → magic-string.es-BQ9KnLz-.js} +105 -117
- package/dist/src/config/config.type.d.ts +1 -1
- package/dist/src/config/config.util.d.ts +1 -1
- package/dist/src/config/config.util.js +48 -7
- package/dist/src/config/env/env.util.js +10 -10
- package/dist/src/config/eslint/index.js +4 -15
- package/dist/src/config/graphql-codegen/graphql-codegen.util.js +30 -39
- package/dist/src/config/index.js +1 -1
- package/dist/src/config/vitest/vitest.e2e.js +9 -19
- package/dist/src/config/vitest/vitest.unit.js +11 -22
- package/dist/src/config/vitest/vitest.unit.setup.js +9339 -9868
- package/dist/src/constant/common.js +1 -1
- package/dist/src/node/apollo-server/apollo-server.util.js +23 -54
- package/dist/src/node/cli/index.d.ts +2 -1
- package/dist/src/node/cli/index.js +108 -1
- package/dist/src/node/command/command.util.js +9 -10
- package/dist/src/node/command/index.js +1 -1
- package/dist/src/node/express/express.util.js +39 -77
- package/dist/src/node/express/index.js +9 -9
- package/dist/src/node/fs/fs.util.js +40 -59
- package/dist/src/node/log/index.js +6 -6
- package/dist/src/node/log/log.util.js +32 -33
- package/dist/src/node/mongo/mongo.util.js +381 -457
- package/dist/src/node/package/index.js +3 -3
- package/dist/src/node/package/package.util.js +2 -2
- package/dist/src/node/path/index.js +30 -30
- package/dist/src/node/path/path.constant.js +30 -30
- package/dist/src/node/storage/storage.util.js +40 -70
- package/dist/src/node/upload/index.js +1 -1
- package/dist/src/node/upload/upload.util.js +125 -6
- package/dist/src/react/apollo-client/apollo-client.component.js +15 -13
- package/dist/src/react/apollo-client/apollo-client.type.d.ts +1 -1
- package/dist/src/react/apollo-client/apollo-client.util.js +66 -81
- package/dist/src/react/apollo-client/index.js +25 -26
- package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.js +7 -8
- package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.util.js +11 -21
- package/dist/src/react/apollo-error/apollo-error.component.js +7 -7
- package/dist/src/react/apollo-error/apollo-error.util.js +7 -7
- package/dist/src/react/loading/loading.component.js +24 -45
- package/dist/src/react/loading/loading.provider.d.ts +1 -1
- package/dist/src/react/log/log.util.js +9 -9
- package/dist/src/react/next-intl/next-intl.hoc.d.ts +1 -1
- package/dist/src/react/next-intl/next-intl.hoc.js +17 -29
- package/dist/src/react/next-intl/next-intl.provider.js +18 -19
- package/dist/src/react/next-intl/next-intl.type.d.ts +1 -1
- package/dist/src/react/storage/storage.hook.js +37 -53
- package/dist/src/react/storage/storage.util.js +25 -50
- package/dist/src/react/userback/userback.component.js +16 -43
- package/dist/src/typescript/index.d.ts +2 -2
- package/dist/src/typescript/index.js +2 -2
- package/dist/src/typescript/style.d.js +1 -1
- package/dist/src/util/common/common.util.js +14 -25
- package/dist/src/util/object/object.util.d.ts +1 -1
- package/dist/src/util/object/object.util.js +39 -49
- package/dist/src/util/string/string.util.js +40 -53
- package/dist/style.css +1 -1
- package/package.json +43 -76
- package/dist/config-B7WSlzSh.js +0 -8
- package/dist/config-DDQ9k8fw.cjs +0 -1
- package/dist/config.util-Ci2CZDut.cjs +0 -1
- package/dist/config.util-DKBwEBKR.js +0 -61
- package/dist/favicon/android-icon-144x144.png +0 -0
- package/dist/favicon/android-icon-192x192.png +0 -0
- package/dist/favicon/android-icon-36x36.png +0 -0
- package/dist/favicon/android-icon-48x48.png +0 -0
- package/dist/favicon/android-icon-72x72.png +0 -0
- package/dist/favicon/android-icon-96x96.png +0 -0
- package/dist/favicon/apple-icon-114x114.png +0 -0
- package/dist/favicon/apple-icon-120x120.png +0 -0
- package/dist/favicon/apple-icon-144x144.png +0 -0
- package/dist/favicon/apple-icon-152x152.png +0 -0
- package/dist/favicon/apple-icon-180x180.png +0 -0
- package/dist/favicon/apple-icon-57x57.png +0 -0
- package/dist/favicon/apple-icon-60x60.png +0 -0
- package/dist/favicon/apple-icon-72x72.png +0 -0
- package/dist/favicon/apple-icon-76x76.png +0 -0
- package/dist/favicon/apple-icon-precomposed.png +0 -0
- package/dist/favicon/apple-icon.png +0 -0
- package/dist/favicon/browserconfig.xml +0 -2
- package/dist/favicon/favicon-16x16.png +0 -0
- package/dist/favicon/favicon-32x32.png +0 -0
- package/dist/favicon/favicon-96x96.png +0 -0
- package/dist/favicon/favicon.ico +0 -0
- package/dist/favicon/manifest.json +0 -41
- package/dist/favicon/ms-icon-144x144.png +0 -0
- package/dist/favicon/ms-icon-150x150.png +0 -0
- package/dist/favicon/ms-icon-310x310.png +0 -0
- package/dist/favicon/ms-icon-70x70.png +0 -0
- package/dist/log.type-CMvG6Box.cjs +0 -1
- package/dist/log.type-DTOvZHyz.js +0 -4
- package/dist/magic-string.es-CjWtD8Pa.cjs +0 -10
- package/dist/path.constant-CWtb99gS.cjs +0 -2
- package/dist/path.constant-CvSr0Rrx.js +0 -682
- package/dist/src/config/commitlint/index.cjs +0 -1
- package/dist/src/config/config.util.cjs +0 -1
- package/dist/src/config/env/env.constant.cjs +0 -1
- package/dist/src/config/env/env.d.cjs +0 -1
- package/dist/src/config/env/env.d.js +0 -1
- package/dist/src/config/env/env.util.cjs +0 -1
- package/dist/src/config/env/index.cjs +0 -1
- package/dist/src/config/eslint/index.cjs +0 -1
- package/dist/src/config/graphql-codegen/graphql-codegen.util.cjs +0 -1
- package/dist/src/config/graphql-codegen/index.cjs +0 -1
- package/dist/src/config/index.cjs +0 -1
- package/dist/src/config/lint-staged/index.cjs +0 -1
- package/dist/src/config/vitest/index.cjs +0 -1
- package/dist/src/config/vitest/vitest.e2e.cjs +0 -1
- package/dist/src/config/vitest/vitest.unit.cjs +0 -1
- package/dist/src/config/vitest/vitest.unit.setup.cjs +0 -508
- package/dist/src/constant/common.cjs +0 -1
- package/dist/src/constant/index.cjs +0 -1
- package/dist/src/constant/response-status.cjs +0 -1
- package/dist/src/node/apollo-server/apollo-server.util.cjs +0 -1
- package/dist/src/node/apollo-server/index.cjs +0 -1
- package/dist/src/node/cli/cli.util.cjs +0 -6
- package/dist/src/node/cli/cli.util.d.ts +0 -2
- package/dist/src/node/cli/cli.util.js +0 -171
- package/dist/src/node/cli/index.cjs +0 -1
- package/dist/src/node/command/command.util.cjs +0 -1
- package/dist/src/node/command/index.cjs +0 -1
- package/dist/src/node/express/express.util.cjs +0 -1
- package/dist/src/node/express/index.cjs +0 -1
- package/dist/src/node/fs/fs.util.cjs +0 -1
- package/dist/src/node/fs/index.cjs +0 -1
- package/dist/src/node/log/index.cjs +0 -1
- package/dist/src/node/log/log.util.cjs +0 -1
- package/dist/src/node/mongo/index.cjs +0 -1
- package/dist/src/node/mongo/mongo.constant.cjs +0 -1
- package/dist/src/node/mongo/mongo.util.cjs +0 -5
- package/dist/src/node/package/index.cjs +0 -1
- package/dist/src/node/package/package.util.cjs +0 -1
- package/dist/src/node/path/index.cjs +0 -1
- package/dist/src/node/path/path.constant.cjs +0 -1
- package/dist/src/node/path/path.util.cjs +0 -1
- package/dist/src/node/storage/index.cjs +0 -1
- package/dist/src/node/storage/storage.util.cjs +0 -1
- package/dist/src/node/upload/index.cjs +0 -1
- package/dist/src/node/upload/upload.util.cjs +0 -1
- package/dist/src/node/ws/index.cjs +0 -1
- package/dist/src/node/ws/ts.util.cjs +0 -1
- package/dist/src/react/apollo-client/apollo-client.component.cjs +0 -1
- package/dist/src/react/apollo-client/apollo-client.constant.cjs +0 -1
- package/dist/src/react/apollo-client/apollo-client.context.cjs +0 -1
- package/dist/src/react/apollo-client/apollo-client.hook.cjs +0 -1
- package/dist/src/react/apollo-client/apollo-client.util.cjs +0 -1
- package/dist/src/react/apollo-client/index.cjs +0 -1
- package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +0 -1
- package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +0 -1
- package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +0 -1
- package/dist/src/react/apollo-client-nextjs/index.cjs +0 -1
- package/dist/src/react/apollo-error/apollo-error.component.cjs +0 -1
- package/dist/src/react/apollo-error/apollo-error.context.cjs +0 -1
- package/dist/src/react/apollo-error/apollo-error.hook.cjs +0 -1
- package/dist/src/react/apollo-error/apollo-error.provider.cjs +0 -1
- package/dist/src/react/apollo-error/apollo-error.util.cjs +0 -1
- package/dist/src/react/apollo-error/index.cjs +0 -1
- package/dist/src/react/i18next/i18next.hook.cjs +0 -1
- package/dist/src/react/i18next/i18next.util.cjs +0 -1
- package/dist/src/react/i18next/index.cjs +0 -1
- package/dist/src/react/loading/index.cjs +0 -1
- package/dist/src/react/loading/loading.component.cjs +0 -6
- package/dist/src/react/loading/loading.context.cjs +0 -1
- package/dist/src/react/loading/loading.hook.cjs +0 -1
- package/dist/src/react/loading/loading.provider.cjs +0 -1
- package/dist/src/react/log/index.cjs +0 -1
- package/dist/src/react/log/log.util.cjs +0 -1
- package/dist/src/react/next-intl/index.cjs +0 -1
- package/dist/src/react/next-intl/next-intl.constant.cjs +0 -1
- package/dist/src/react/next-intl/next-intl.context.cjs +0 -1
- package/dist/src/react/next-intl/next-intl.hoc.cjs +0 -1
- package/dist/src/react/next-intl/next-intl.hook.cjs +0 -1
- package/dist/src/react/next-intl/next-intl.provider.cjs +0 -1
- package/dist/src/react/storage/index.cjs +0 -1
- package/dist/src/react/storage/storage.hook.cjs +0 -1
- package/dist/src/react/storage/storage.util.cjs +0 -1
- package/dist/src/react/toast/index.cjs +0 -1
- package/dist/src/react/userback/index.cjs +0 -1
- package/dist/src/react/userback/userback.component.cjs +0 -1
- package/dist/src/typescript/common.cjs +0 -1
- package/dist/src/typescript/common.js +0 -4
- package/dist/src/typescript/index.cjs +0 -1
- package/dist/src/typescript/react.cjs +0 -1
- package/dist/src/typescript/react.js +0 -1
- package/dist/src/typescript/style.d.cjs +0 -1
- package/dist/src/util/common/common.util.cjs +0 -1
- package/dist/src/util/common/index.cjs +0 -1
- package/dist/src/util/index.cjs +0 -1
- package/dist/src/util/object/index.cjs +0 -1
- package/dist/src/util/object/object.util.cjs +0 -1
- package/dist/src/util/serializer/index.cjs +0 -1
- package/dist/src/util/serializer/serializer.util.cjs +0 -1
- package/dist/src/util/string/index.cjs +0 -1
- package/dist/src/util/string/string.util.cjs +0 -1
- package/dist/src/util/validate/index.cjs +0 -1
- package/dist/src/util/validate/validate.util.cjs +0 -1
- package/dist/tsconfig.base.json +0 -37
- package/dist/upload.util-CE3MjBdh.cjs +0 -1
- package/dist/upload.util-D4aUdmPo.js +0 -160
- /package/dist/src/typescript/{common.d.ts → common.type.d.ts} +0 -0
- /package/dist/src/typescript/{react.d.ts → react.type.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as s, h as g, g as t, i as c, s as k, u as p } from "../../../index-BG1UznTl.js";
|
|
2
2
|
export {
|
|
3
3
|
s as E_PackageType,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
g as getLatestPackageVersion,
|
|
5
|
+
t as getPackage,
|
|
6
6
|
c as installDependencies,
|
|
7
7
|
k as setupPackages,
|
|
8
8
|
p as updatePackage
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "node-fetch";
|
|
2
|
-
import "
|
|
3
|
-
import { K as r, O as g, R as m, U as c, Q as k } from "../../../path.constant-CvSr0Rrx.js";
|
|
2
|
+
import { h as r, g, i as m, s as c, u as k } from "../../../index-BG1UznTl.js";
|
|
4
3
|
import "../fs/fs.util.js";
|
|
5
4
|
import "../log/log.util.js";
|
|
6
5
|
import "../path/path.util.js";
|
|
6
|
+
import "../../config/env/env.util.js";
|
|
7
7
|
export {
|
|
8
8
|
r as getLatestPackageVersion,
|
|
9
9
|
g as getPackage,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { B as E,
|
|
2
|
-
import { dirname as q, join as
|
|
1
|
+
import { B as E, F as C, D as a, A, C as s, w as N, v as T, b as L, y as O, Z as M, Y as G, x as S, O as P, t as K, q as R, G as D, H as o, L as Y, a1 as e, M as r, a0 as H, N as t, $ as B, _ as m, n, o as U, P as i, Q as J, R as f, p, m as F, U as V, X as v, S as x, T as W, J as X, I as c, K as d, z as g, V as h, W as k, a as l, f as b } from "../../../index-BG1UznTl.js";
|
|
2
|
+
import { dirname as q, join as w, path as y, resolve as z, resolveWorkingPath as Q } from "./path.util.js";
|
|
3
3
|
export {
|
|
4
4
|
E as BUILD_DIRECTORY,
|
|
5
5
|
C as COMMIT_LINT_CLI,
|
|
6
6
|
a as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
A as COMMIT_LINT_PACKAGE_NAME,
|
|
8
|
+
s as CYBERSKILL_CLI,
|
|
9
9
|
N as CYBERSKILL_CLI_PATH,
|
|
10
10
|
T as CYBERSKILL_DIRECTORY,
|
|
11
11
|
L as CYBERSKILL_PACKAGE_NAME,
|
|
@@ -18,35 +18,35 @@ export {
|
|
|
18
18
|
R as GIT_HOOK,
|
|
19
19
|
D as GIT_IGNORE,
|
|
20
20
|
o as LINT_STAGED_CLI,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
Y as LINT_STAGED_PACKAGE_NAME,
|
|
22
|
+
e as MIGRATE_MONGO_CLI,
|
|
23
|
+
r as MIGRATE_MONGO_CONFIG,
|
|
24
24
|
H as MIGRATE_MONGO_PACKAGE_NAME,
|
|
25
25
|
t as NODE_MODULES,
|
|
26
26
|
B as NODE_MODULES_INSPECT_CLI,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
m as NODE_MODULES_INSPECT_PACKAGE_NAME,
|
|
28
|
+
n as PACKAGE_JSON,
|
|
29
|
+
U as PACKAGE_LOCK_JSON,
|
|
30
|
+
i as PATH,
|
|
31
|
+
J as PNPM_CLI,
|
|
32
|
+
f as PNPM_EXEC_CLI,
|
|
33
|
+
p as PNPM_LOCK_YAML,
|
|
34
|
+
F as PUBLIC_DIRECTORY,
|
|
35
35
|
V as SIMPLE_GIT_HOOKS_PACKAGE_NAME,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
v as SIMPLE_GIT_HOOK_CLI,
|
|
37
|
+
x as SIMPLE_GIT_HOOK_JSON,
|
|
38
|
+
W as TSCONFIG_JSON,
|
|
39
|
+
X as TSC_CLI,
|
|
40
|
+
c as TSC_PACKAGE_NAME,
|
|
41
|
+
d as TSX_CLI,
|
|
42
|
+
g as VITEST_CLI,
|
|
43
|
+
h as VITEST_PACKAGE_NAME,
|
|
44
|
+
k as WORKING_DIRECTORY,
|
|
45
|
+
l as command,
|
|
46
|
+
b as createGitHooksConfig,
|
|
47
47
|
q as dirname,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
w as join,
|
|
49
|
+
y as path,
|
|
50
|
+
z as resolve,
|
|
51
|
+
Q as resolveWorkingPath
|
|
52
52
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "fs-extra";
|
|
2
|
-
import "../../config/env/env.util.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";
|
|
4
2
|
import "./path.util.js";
|
|
3
|
+
import { B as A, F as N, D as T, A as L, C as s, w as O, v as M, b as G, y as S, Z as P, Y as K, x as R, O as D, t as o, q as Y, G as H, H as m, L as t, a1 as B, M as r, a0 as U, N as i, $ as p, _ as J, n as F, o as V, P as e, Q as f, R as n, p as X, m as c, U as x, X as W, S as b, T as d, J as g, I as k, K as q, z as v, V as w, W as y, a as z, f as Q } from "../../../index-BG1UznTl.js";
|
|
4
|
+
import "../../config/env/env.util.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
A as BUILD_DIRECTORY,
|
|
7
7
|
N as COMMIT_LINT_CLI,
|
|
8
8
|
T as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
L as COMMIT_LINT_PACKAGE_NAME,
|
|
10
|
+
s as CYBERSKILL_CLI,
|
|
11
11
|
O as CYBERSKILL_CLI_PATH,
|
|
12
12
|
M as CYBERSKILL_DIRECTORY,
|
|
13
13
|
G as CYBERSKILL_PACKAGE_NAME,
|
|
@@ -20,30 +20,30 @@ export {
|
|
|
20
20
|
Y as GIT_HOOK,
|
|
21
21
|
H as GIT_IGNORE,
|
|
22
22
|
m as LINT_STAGED_CLI,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
t as LINT_STAGED_PACKAGE_NAME,
|
|
24
|
+
B as MIGRATE_MONGO_CLI,
|
|
25
|
+
r as MIGRATE_MONGO_CONFIG,
|
|
26
|
+
U as MIGRATE_MONGO_PACKAGE_NAME,
|
|
27
|
+
i as NODE_MODULES,
|
|
28
|
+
p as NODE_MODULES_INSPECT_CLI,
|
|
29
|
+
J as NODE_MODULES_INSPECT_PACKAGE_NAME,
|
|
30
30
|
F as PACKAGE_JSON,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
V as PACKAGE_LOCK_JSON,
|
|
32
|
+
e as PATH,
|
|
33
|
+
f as PNPM_CLI,
|
|
34
|
+
n as PNPM_EXEC_CLI,
|
|
35
|
+
X as PNPM_LOCK_YAML,
|
|
36
|
+
c as PUBLIC_DIRECTORY,
|
|
37
|
+
x as SIMPLE_GIT_HOOKS_PACKAGE_NAME,
|
|
38
|
+
W as SIMPLE_GIT_HOOK_CLI,
|
|
39
|
+
b as SIMPLE_GIT_HOOK_JSON,
|
|
40
|
+
d as TSCONFIG_JSON,
|
|
41
|
+
g as TSC_CLI,
|
|
42
|
+
k as TSC_PACKAGE_NAME,
|
|
43
|
+
q as TSX_CLI,
|
|
44
|
+
v as VITEST_CLI,
|
|
45
|
+
w as VITEST_PACKAGE_NAME,
|
|
46
|
+
y as WORKING_DIRECTORY,
|
|
47
|
+
z as command,
|
|
48
|
+
Q as createGitHooksConfig
|
|
49
49
|
};
|
|
@@ -1,81 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import e from "node-persist";
|
|
2
|
+
import { getEnv as c } from "../../config/env/env.util.js";
|
|
3
|
+
import { catchError as a, log as i } from "../log/log.util.js";
|
|
4
|
+
const s = c();
|
|
5
|
+
async function n() {
|
|
6
|
+
e.defaultInstance || await e.init({
|
|
7
|
+
dir: s.CYBERSKILL_STORAGE_DIRECTORY
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
const m = {
|
|
11
|
+
async get(r) {
|
|
3
12
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
13
|
+
return await n(), await e.getItem(r) ?? null;
|
|
14
|
+
} catch (t) {
|
|
15
|
+
return a(t, { returnValue: null });
|
|
7
16
|
}
|
|
8
|
-
},
|
|
17
|
+
},
|
|
18
|
+
async set(r, t) {
|
|
9
19
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
20
|
+
await n(), await e.setItem(r, t);
|
|
21
|
+
} catch (o) {
|
|
22
|
+
a(o);
|
|
13
23
|
}
|
|
14
|
-
}, i = (e) => e.done ? m(e.value) : Promise.resolve(e.value).then(g, w);
|
|
15
|
-
i((n = n.apply(r, t)).next());
|
|
16
|
-
});
|
|
17
|
-
import o from "node-persist";
|
|
18
|
-
import { getEnv as I } from "../../config/env/env.util.js";
|
|
19
|
-
import { catchError as s, log as h } from "../log/log.util.js";
|
|
20
|
-
const l = I();
|
|
21
|
-
function c() {
|
|
22
|
-
return a(this, null, function* () {
|
|
23
|
-
o.defaultInstance || (yield o.init({
|
|
24
|
-
dir: l.CYBERSKILL_STORAGE_DIRECTORY
|
|
25
|
-
}));
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
const L = {
|
|
29
|
-
get(r) {
|
|
30
|
-
return a(this, null, function* () {
|
|
31
|
-
try {
|
|
32
|
-
yield c();
|
|
33
|
-
const t = yield o.getItem(r);
|
|
34
|
-
return t != null ? t : null;
|
|
35
|
-
} catch (t) {
|
|
36
|
-
return s(t, { returnValue: null });
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
set(r, t) {
|
|
41
|
-
return a(this, null, function* () {
|
|
42
|
-
try {
|
|
43
|
-
yield c(), yield o.setItem(r, t);
|
|
44
|
-
} catch (n) {
|
|
45
|
-
s(n);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
24
|
},
|
|
49
|
-
remove(r) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
});
|
|
25
|
+
async remove(r) {
|
|
26
|
+
try {
|
|
27
|
+
await n(), await e.removeItem(r);
|
|
28
|
+
} catch (t) {
|
|
29
|
+
a(t);
|
|
30
|
+
}
|
|
57
31
|
},
|
|
58
|
-
keys() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
});
|
|
32
|
+
async keys() {
|
|
33
|
+
try {
|
|
34
|
+
await n();
|
|
35
|
+
const r = await e.keys();
|
|
36
|
+
return Array.isArray(r) ? r : (i.warn("[Storage:keys] Invalid keys response:", r), []);
|
|
37
|
+
} catch (r) {
|
|
38
|
+
return a(r, { returnValue: [] });
|
|
39
|
+
}
|
|
68
40
|
},
|
|
69
|
-
getLogLink(r) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
});
|
|
41
|
+
async getLogLink(r) {
|
|
42
|
+
try {
|
|
43
|
+
return `${s.CYBERSKILL_STORAGE_DIRECTORY} (key: ${r})`;
|
|
44
|
+
} catch (t) {
|
|
45
|
+
return a(t, { returnValue: null });
|
|
46
|
+
}
|
|
77
47
|
}
|
|
78
48
|
};
|
|
79
49
|
export {
|
|
80
|
-
|
|
50
|
+
m as storage
|
|
81
51
|
};
|
|
@@ -1,8 +1,127 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { dirname as w } from "../path/path.util.js";
|
|
2
|
+
import { pathExistsSync as E, mkdirSync as x, createWriteStream as p } from "../fs/fs.util.js";
|
|
3
|
+
var n = /* @__PURE__ */ ((e) => (e.IMAGE = "IMAGE", e.VIDEO = "VIDEO", e.DOCUMENT = "DOCUMENT", e.OTHER = "OTHER", e))(n || {});
|
|
4
|
+
async function v(e) {
|
|
5
|
+
return new Promise((s, t) => {
|
|
6
|
+
let i = 0;
|
|
7
|
+
e.on("data", (a) => {
|
|
8
|
+
i += a.length;
|
|
9
|
+
}), e.on("end", () => s(i)), e.on("error", t);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function z(e, s) {
|
|
13
|
+
const t = e.lastIndexOf(".");
|
|
14
|
+
if (t === -1)
|
|
15
|
+
return !1;
|
|
16
|
+
const i = e.substring(t + 1).toLowerCase();
|
|
17
|
+
return s.includes(i);
|
|
18
|
+
}
|
|
19
|
+
function I(e, s, t) {
|
|
20
|
+
const { filename: i, fileSize: a } = e, o = s[t], { allowedExtensions: r, sizeLimit: l } = o;
|
|
21
|
+
if (!z(i, r))
|
|
22
|
+
return {
|
|
23
|
+
isValid: !1,
|
|
24
|
+
error: `File extension not allowed for ${t.toLowerCase()} files. Allowed extensions: ${r.join(", ")}`
|
|
25
|
+
};
|
|
26
|
+
if (a !== void 0 && a > l) {
|
|
27
|
+
const f = Math.round(l / 1048576);
|
|
28
|
+
return {
|
|
29
|
+
isValid: !1,
|
|
30
|
+
error: `File size exceeds limit for ${t.toLowerCase()} files. Maximum size: ${f}MB`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return { isValid: !0 };
|
|
34
|
+
}
|
|
35
|
+
function L(e) {
|
|
36
|
+
return { ...{
|
|
37
|
+
[n.IMAGE]: {
|
|
38
|
+
allowedExtensions: ["jpg", "jpeg", "png", "gif", "webp", "svg"],
|
|
39
|
+
sizeLimit: 5242880
|
|
40
|
+
// 5MB
|
|
41
|
+
},
|
|
42
|
+
[n.VIDEO]: {
|
|
43
|
+
allowedExtensions: ["mp4", "avi", "mov", "wmv", "flv", "webm"],
|
|
44
|
+
sizeLimit: 524288e3
|
|
45
|
+
// 500MB
|
|
46
|
+
},
|
|
47
|
+
[n.DOCUMENT]: {
|
|
48
|
+
allowedExtensions: ["pdf", "doc", "docx", "txt", "rtf"],
|
|
49
|
+
sizeLimit: 10485760
|
|
50
|
+
// 10MB
|
|
51
|
+
},
|
|
52
|
+
[n.OTHER]: {
|
|
53
|
+
allowedExtensions: ["zip", "rar", "tar", "gz"],
|
|
54
|
+
sizeLimit: 5242880
|
|
55
|
+
// 5MB
|
|
56
|
+
}
|
|
57
|
+
}, ...e };
|
|
58
|
+
}
|
|
59
|
+
async function M(e) {
|
|
60
|
+
const { path: s, file: t, config: i, type: a } = e;
|
|
61
|
+
if (!s || typeof s != "string")
|
|
62
|
+
return {
|
|
63
|
+
success: !1,
|
|
64
|
+
message: "Invalid path provided",
|
|
65
|
+
result: ""
|
|
66
|
+
};
|
|
67
|
+
if (!t || typeof t != "object")
|
|
68
|
+
return {
|
|
69
|
+
success: !1,
|
|
70
|
+
message: "Invalid file provided",
|
|
71
|
+
result: ""
|
|
72
|
+
};
|
|
73
|
+
if (i) {
|
|
74
|
+
const o = [n.IMAGE, n.VIDEO, n.DOCUMENT, n.OTHER];
|
|
75
|
+
for (const r of o) {
|
|
76
|
+
if (!i[r] || !Array.isArray(i[r].allowedExtensions) || i[r].allowedExtensions.length === 0)
|
|
77
|
+
return {
|
|
78
|
+
success: !1,
|
|
79
|
+
message: `Invalid config for ${r.toLowerCase()} files`,
|
|
80
|
+
result: ""
|
|
81
|
+
};
|
|
82
|
+
if (typeof i[r].sizeLimit != "number" || i[r].sizeLimit <= 0)
|
|
83
|
+
return {
|
|
84
|
+
success: !1,
|
|
85
|
+
message: `Invalid size limit for ${r.toLowerCase()} files`,
|
|
86
|
+
result: ""
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const o = await (await t).file, { filename: r, createReadStream: l } = o;
|
|
92
|
+
if (i) {
|
|
93
|
+
const d = l(), c = await v(d), g = I(
|
|
94
|
+
{ filename: r, fileSize: c },
|
|
95
|
+
i,
|
|
96
|
+
a
|
|
97
|
+
);
|
|
98
|
+
if (!g.isValid)
|
|
99
|
+
return {
|
|
100
|
+
success: !1,
|
|
101
|
+
message: g.error || "File validation failed",
|
|
102
|
+
result: ""
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const f = w(s);
|
|
106
|
+
E(f) || x(f, { recursive: !0 });
|
|
107
|
+
const m = l(), u = p(s);
|
|
108
|
+
return m.pipe(u), await new Promise((d, c) => {
|
|
109
|
+
u.on("finish", () => d()), u.on("error", c), m.on("error", c);
|
|
110
|
+
}), {
|
|
111
|
+
success: !0,
|
|
112
|
+
message: "File uploaded successfully",
|
|
113
|
+
result: s
|
|
114
|
+
};
|
|
115
|
+
} catch (o) {
|
|
116
|
+
return {
|
|
117
|
+
success: !1,
|
|
118
|
+
message: o instanceof Error ? o.message : "File upload failed",
|
|
119
|
+
result: ""
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
5
123
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
124
|
+
n as E,
|
|
125
|
+
L as createUploadConfig,
|
|
126
|
+
M as upload
|
|
8
127
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { ApolloProvider as l } from "@apollo/client/react/react.cjs";
|
|
2
2
|
import r, { useMemo as m } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import { ApolloErrorProvider as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { ApolloClientProvider as i } from "./apollo-client.context.js";
|
|
4
|
+
import { getClient as n } from "./apollo-client.util.js";
|
|
5
|
+
import { ApolloErrorProvider as p } from "../apollo-error/apollo-error.provider.js";
|
|
6
|
+
import { ApolloErrorComponent as a } from "../apollo-error/apollo-error.component.js";
|
|
7
|
+
import { Toaster as c } from "react-hot-toast";
|
|
8
|
+
import "./apollo-client.constant.js";
|
|
9
|
+
import "@apollo/client/cache/cache.cjs";
|
|
10
|
+
import "@apollo/client/react/hooks/hooks.cjs";
|
|
11
|
+
function _({
|
|
12
|
+
options: o,
|
|
11
13
|
children: t
|
|
12
14
|
}) {
|
|
13
|
-
const
|
|
14
|
-
() =>
|
|
15
|
-
[
|
|
15
|
+
const e = m(
|
|
16
|
+
() => n(o || {}),
|
|
17
|
+
[o]
|
|
16
18
|
);
|
|
17
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
19
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(p, null, /* @__PURE__ */ r.createElement(i, { client: e }, /* @__PURE__ */ r.createElement(l, { client: e }, t)), /* @__PURE__ */ r.createElement(a, null)), /* @__PURE__ */ r.createElement(c, { position: "top-right" }));
|
|
18
20
|
}
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
_ as ApolloProvider
|
|
21
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloClientOptions, ApolloLink, NormalizedCacheObject, UriFunction } from '@apollo/client';
|
|
2
|
-
import { I_Children } from '../../typescript/
|
|
2
|
+
import { I_Children } from '../../typescript/index.js';
|
|
3
3
|
export interface I_ApolloOptions extends Omit<ApolloClientOptions<NormalizedCacheObject>, 'cache'> {
|
|
4
4
|
uri?: string | UriFunction;
|
|
5
5
|
wsUrl?: string;
|