@cyberskill/shared 1.210.0 → 1.211.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.
Files changed (133) hide show
  1. package/dist/config/commitlint/index.cjs +1 -0
  2. package/dist/config/config.type.cjs +1 -0
  3. package/dist/config/config.util.cjs +1 -0
  4. package/dist/config/config.util.js +35 -26
  5. package/dist/config/env/env.constant.cjs +1 -0
  6. package/dist/config/env/env.util.cjs +1 -0
  7. package/dist/config/env/index.cjs +1 -0
  8. package/dist/config/eslint/index.cjs +1 -0
  9. package/dist/config/eslint/index.js +12 -4
  10. package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -0
  11. package/dist/config/graphql-codegen/graphql-codegen.util.js +33 -28
  12. package/dist/config/graphql-codegen/index.cjs +1 -0
  13. package/dist/config/index.cjs +1 -0
  14. package/dist/config/lint-staged/index.cjs +1 -0
  15. package/dist/config/vitest/index.cjs +1 -0
  16. package/dist/config/vitest/vitest.e2e.cjs +1 -0
  17. package/dist/config/vitest/vitest.e2e.js +16 -9
  18. package/dist/config/vitest/vitest.unit.cjs +1 -0
  19. package/dist/config/vitest/vitest.unit.js +18 -11
  20. package/dist/constant/common.cjs +1 -0
  21. package/dist/constant/common.js +1 -1
  22. package/dist/constant/index.cjs +1 -0
  23. package/dist/constant/response-status.cjs +1 -0
  24. package/dist/node/apollo-server/apollo-server.util.cjs +1 -0
  25. package/dist/node/apollo-server/apollo-server.util.js +48 -21
  26. package/dist/node/apollo-server/index.cjs +1 -0
  27. package/dist/node/cli/index.cjs +6 -0
  28. package/dist/node/cli/index.js +140 -90
  29. package/dist/node/command/command.type.cjs +1 -0
  30. package/dist/node/command/command.util.cjs +2 -0
  31. package/dist/node/command/command.util.js +148 -117
  32. package/dist/node/command/index.cjs +1 -0
  33. package/dist/node/express/express.util.cjs +1 -0
  34. package/dist/node/express/express.util.js +70 -37
  35. package/dist/node/express/index.cjs +1 -0
  36. package/dist/node/fs/fs.util.cjs +1 -0
  37. package/dist/node/fs/fs.util.js +55 -40
  38. package/dist/node/fs/index.cjs +1 -0
  39. package/dist/node/log/index.cjs +1 -0
  40. package/dist/node/log/log.type.cjs +1 -0
  41. package/dist/node/log/log.util.cjs +1 -0
  42. package/dist/node/log/log.util.js +31 -30
  43. package/dist/node/mongo/index.cjs +1 -0
  44. package/dist/node/mongo/mongo.constant.cjs +1 -0
  45. package/dist/node/mongo/mongo.type.cjs +1 -0
  46. package/dist/node/mongo/mongo.util.cjs +5 -0
  47. package/dist/node/mongo/mongo.util.js +433 -365
  48. package/dist/node/package/index.cjs +1 -0
  49. package/dist/node/package/package.type.cjs +1 -0
  50. package/dist/node/package/package.util.cjs +1 -0
  51. package/dist/node/package/package.util.js +224 -195
  52. package/dist/node/path/index.cjs +1 -0
  53. package/dist/node/path/path.constant.cjs +1 -0
  54. package/dist/node/path/path.constant.js +205 -183
  55. package/dist/node/path/path.util.cjs +1 -0
  56. package/dist/node/storage/index.cjs +1 -0
  57. package/dist/node/storage/storage.util.cjs +1 -0
  58. package/dist/node/storage/storage.util.js +70 -40
  59. package/dist/node/upload/index.cjs +1 -0
  60. package/dist/node/upload/upload.type.cjs +1 -0
  61. package/dist/node/upload/upload.util.cjs +1 -0
  62. package/dist/node/upload/upload.util.js +119 -91
  63. package/dist/node/ws/index.cjs +1 -0
  64. package/dist/node/ws/ts.util.cjs +1 -0
  65. package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db/node_modules/vitest/dist/config.cjs +1 -0
  66. package/dist/react/apollo-client/apollo-client.component.cjs +1 -0
  67. package/dist/react/apollo-client/apollo-client.constant.cjs +1 -0
  68. package/dist/react/apollo-client/apollo-client.context.cjs +1 -0
  69. package/dist/react/apollo-client/apollo-client.util.cjs +1 -0
  70. package/dist/react/apollo-client/apollo-client.util.js +74 -64
  71. package/dist/react/apollo-client/index.cjs +1 -0
  72. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -0
  73. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +1 -0
  74. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -0
  75. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +18 -11
  76. package/dist/react/apollo-client-nextjs/index.cjs +1 -0
  77. package/dist/react/apollo-error/apollo-error.component.cjs +1 -0
  78. package/dist/react/apollo-error/apollo-error.component.js +6 -6
  79. package/dist/react/apollo-error/apollo-error.context.cjs +1 -0
  80. package/dist/react/apollo-error/apollo-error.hook.cjs +1 -0
  81. package/dist/react/apollo-error/apollo-error.module.scss.cjs +1 -0
  82. package/dist/react/apollo-error/apollo-error.provider.cjs +1 -0
  83. package/dist/react/apollo-error/apollo-error.util.cjs +1 -0
  84. package/dist/react/apollo-error/apollo-error.util.js +1 -1
  85. package/dist/react/apollo-error/index.cjs +1 -0
  86. package/dist/react/i18next/i18next.hook.cjs +1 -0
  87. package/dist/react/i18next/i18next.util.cjs +1 -0
  88. package/dist/react/i18next/index.cjs +1 -0
  89. package/dist/react/loading/index.cjs +1 -0
  90. package/dist/react/loading/loading.component.cjs +6 -0
  91. package/dist/react/loading/loading.component.js +36 -19
  92. package/dist/react/loading/loading.context.cjs +1 -0
  93. package/dist/react/loading/loading.hook.cjs +1 -0
  94. package/dist/react/loading/loading.module.scss.cjs +1 -0
  95. package/dist/react/loading/loading.provider.cjs +1 -0
  96. package/dist/react/log/index.cjs +1 -0
  97. package/dist/react/log/log.util.cjs +1 -0
  98. package/dist/react/log/log.util.js +4 -4
  99. package/dist/react/next-intl/index.cjs +1 -0
  100. package/dist/react/next-intl/next-intl.constant.cjs +1 -0
  101. package/dist/react/next-intl/next-intl.context.cjs +1 -0
  102. package/dist/react/next-intl/next-intl.hoc.cjs +1 -0
  103. package/dist/react/next-intl/next-intl.hoc.js +23 -14
  104. package/dist/react/next-intl/next-intl.hook.cjs +1 -0
  105. package/dist/react/next-intl/next-intl.provider.cjs +1 -0
  106. package/dist/react/next-intl/next-intl.provider.js +7 -7
  107. package/dist/react/storage/index.cjs +1 -0
  108. package/dist/react/storage/storage.hook.cjs +1 -0
  109. package/dist/react/storage/storage.hook.js +57 -41
  110. package/dist/react/storage/storage.util.cjs +1 -0
  111. package/dist/react/storage/storage.util.js +50 -25
  112. package/dist/react/toast/index.cjs +1 -0
  113. package/dist/react/userback/index.cjs +1 -0
  114. package/dist/react/userback/userback.component.cjs +1 -0
  115. package/dist/react/userback/userback.component.js +42 -18
  116. package/dist/style.css +1 -1
  117. package/dist/typescript/common.type.cjs +1 -0
  118. package/dist/typescript/index.cjs +1 -0
  119. package/dist/util/common/common.util.cjs +1 -0
  120. package/dist/util/common/common.util.js +37 -29
  121. package/dist/util/common/index.cjs +1 -0
  122. package/dist/util/index.cjs +1 -0
  123. package/dist/util/object/index.cjs +1 -0
  124. package/dist/util/object/object.util.cjs +1 -0
  125. package/dist/util/object/object.util.js +55 -49
  126. package/dist/util/serializer/index.cjs +1 -0
  127. package/dist/util/serializer/serializer.util.cjs +1 -0
  128. package/dist/util/string/index.cjs +1 -0
  129. package/dist/util/string/string.util.cjs +1 -0
  130. package/dist/util/string/string.util.js +46 -36
  131. package/dist/util/validate/index.cjs +1 -0
  132. package/dist/util/validate/validate.util.cjs +1 -0
  133. package/package.json +69 -35
@@ -1,273 +1,295 @@
1
- import f from "fs-extra";
2
- import { resolveWorkingPath as o, join as G } from "./path.util.js";
3
- import { E_CommandType as t } from "../command/command.type.js";
4
- import { formatCommand as g, rawCommand as N } from "../command/command.util.js";
5
- import { setupPackages as u } from "../package/package.util.js";
6
- import { E_PackageType as e } from "../package/package.type.js";
7
- import { getEnv as k } from "../../config/env/env.util.js";
8
- const K = k(), p = K.CWD, D = "@cyberskill/shared", d = "node_modules", Y = "dist", F = "public", P = "package.json", h = "package-lock.json", V = "tsconfig.json", U = ".gitignore", v = ".simple-git-hooks.json", H = "pnpm-lock.yaml", j = ".git/hooks/", J = ".git/COMMIT_EDITMSG", x = ".migrate-mongo.config.js", E = (() => {
9
- const m = f.readJsonSync(o(P)).name === D ? p : G(p, d, D);
10
- return G(m, Y);
11
- })(), at = "cyberskill", it = "src/node/cli/index.ts", L = "eslint", M = "eslint", S = "vitest", l = "vitest", b = "@commitlint/cli", w = "@commitlint/config-conventional", A = "commitlint", B = "lint-staged", y = "lint-staged", W = "typescript", X = "tsc", I = "tsx", $ = "git", _ = "pnpm", q = "pnpm exec", z = "simple-git-hooks", Q = "simple-git-hooks", Z = "@eslint/config-inspector", tt = "eslint-config-inspector", nt = "node-modules-inspector", et = "node-modules-inspector", i = "migrate-mongo", C = "./node_modules/migrate-mongo/bin/migrate-mongo", s = {
12
- CYBERSKILL_DIRECTORY: E,
13
- WORKING_DIRECTORY: p,
14
- PUBLIC_DIRECTORY: o(F),
15
- TS_CONFIG: o(V),
16
- GIT_IGNORE: o(U),
17
- GIT_HOOK: o(j),
18
- GIT_COMMIT_MSG: o(J),
19
- SIMPLE_GIT_HOOKS_JSON: o(v),
20
- PACKAGE_JSON: o(P),
21
- PACKAGE_LOCK_JSON: o(h),
22
- PNPM_LOCK_YAML: o(H),
23
- NODE_MODULES: o(d),
24
- MIGRATE_MONGO_CONFIG: o(x),
25
- LINT_STAGED_CONFIG: o(`${E}/src/config/lint-staged/index.js`),
26
- COMMITLINT_CONFIG: o(`${E}/src/config/commitlint/index.js`),
27
- VITEST_UNIT_CONFIG: o(`${E}/src/config/vitest/vitest.unit.js`),
28
- VITEST_UNIT_SETUP_CONFIG: o(`${E}/src/config/vitest/vitest.unit.setup.js`),
29
- VITEST_E2E_CONFIG: o(`${E}/src/config/vitest/vitest.e2e.js`)
1
+ import v from "fs-extra";
2
+ import { resolveWorkingPath as c, join as L } from "./path.util.js";
3
+ import { E_CommandType as e } from "../command/command.type.js";
4
+ import { formatCommand as d, rawCommand as g } from "../command/command.util.js";
5
+ import { setupPackages as h } from "../package/package.util.js";
6
+ import { E_PackageType as s } from "../package/package.type.js";
7
+ import { getEnv as F } from "../../config/env/env.util.js";
8
+ var V = Object.defineProperty, P = Object.getOwnPropertySymbols, U = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable, M = (E, n, o) => n in E ? V(E, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : E[n] = o, w = (E, n) => {
9
+ for (var o in n || (n = {}))
10
+ U.call(n, o) && M(E, o, n[o]);
11
+ if (P)
12
+ for (var o of P(n))
13
+ j.call(n, o) && M(E, o, n[o]);
14
+ return E;
15
+ }, H = (E, n, o) => new Promise((r, I) => {
16
+ var C = (a) => {
17
+ try {
18
+ O(o.next(a));
19
+ } catch (T) {
20
+ I(T);
21
+ }
22
+ }, N = (a) => {
23
+ try {
24
+ O(o.throw(a));
25
+ } catch (T) {
26
+ I(T);
27
+ }
28
+ }, O = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(C, N);
29
+ O((o = o.apply(E, n)).next());
30
+ });
31
+ const b = F(), D = b.CWD, S = "@cyberskill/shared", $ = "node_modules", J = "dist", x = "public", R = "package.json", B = "package-lock.json", W = "tsconfig.json", X = ".gitignore", q = ".simple-git-hooks.json", z = "pnpm-lock.yaml", Q = ".git/hooks/", Z = ".git/COMMIT_EDITMSG", ee = ".migrate-mongo.config.js", m = (() => {
32
+ const n = v.readJsonSync(c(R)).name === S ? D : L(D, $, S);
33
+ return L(n, J);
34
+ })(), ge = "cyberskill", De = "src/node/cli/index.ts", y = "eslint", A = "eslint", u = "vitest", f = "vitest", te = "@commitlint/cli", ne = "@commitlint/config-conventional", K = "commitlint", oe = "lint-staged", k = "lint-staged", se = "typescript", ce = "tsc", i = "tsx", Y = "git", p = "pnpm", Ee = "pnpm exec", _e = "simple-git-hooks", ae = "simple-git-hooks", Ie = "@eslint/config-inspector", me = "eslint-config-inspector", ie = "node-modules-inspector", pe = "node-modules-inspector", l = "migrate-mongo", G = "./node_modules/migrate-mongo/bin/migrate-mongo", _ = {
35
+ CYBERSKILL_DIRECTORY: m,
36
+ WORKING_DIRECTORY: D,
37
+ PUBLIC_DIRECTORY: c(x),
38
+ TS_CONFIG: c(W),
39
+ GIT_IGNORE: c(X),
40
+ GIT_HOOK: c(Q),
41
+ GIT_COMMIT_MSG: c(Z),
42
+ SIMPLE_GIT_HOOKS_JSON: c(q),
43
+ PACKAGE_JSON: c(R),
44
+ PACKAGE_LOCK_JSON: c(B),
45
+ PNPM_LOCK_YAML: c(z),
46
+ NODE_MODULES: c($),
47
+ MIGRATE_MONGO_CONFIG: c(ee),
48
+ LINT_STAGED_CONFIG: c(`${m}/src/config/lint-staged/index.js`),
49
+ COMMITLINT_CONFIG: c(`${m}/src/config/commitlint/index.js`),
50
+ VITEST_UNIT_CONFIG: c(`${m}/src/config/vitest/vitest.unit.js`),
51
+ VITEST_UNIT_SETUP_CONFIG: c(`${m}/src/config/vitest/vitest.unit.setup.js`),
52
+ VITEST_E2E_CONFIG: c(`${m}/src/config/vitest/vitest.e2e.js`)
30
53
  };
31
- function Ct({ isCurrentProject: c }) {
32
- return {
33
- "pre-commit": y,
34
- "commit-msg": A,
35
- ...c && { "pre-push": N(`${$} pull`) }
36
- };
54
+ function Le({ isCurrentProject: E }) {
55
+ return w({
56
+ "pre-commit": k,
57
+ "commit-msg": K
58
+ }, E && { "pre-push": g(`${Y} pull`) });
37
59
  }
38
- function n({ type: c, packages: m, command: T }) {
39
- const r = m?.reduce((a, O) => (a.some((R) => R.name === O.name) || a.push(O), a), []);
40
- return async () => {
41
- switch (c) {
42
- case t.CLI:
43
- return r?.length && await u(r, {
60
+ function t({ type: E, packages: n, command: o }) {
61
+ const r = n == null ? void 0 : n.reduce((I, C) => (I.some((N) => N.name === C.name) || I.push(C), I), []);
62
+ return () => H(null, null, function* () {
63
+ switch (E) {
64
+ case e.CLI:
65
+ return r != null && r.length && (yield h(r, {
44
66
  install: !0
45
- }), g(N(`${q} ${T}`));
46
- case t.STRING:
47
- return g(N(T));
67
+ })), d(g(`${Ee} ${o}`));
68
+ case e.STRING:
69
+ return d(g(o));
48
70
  default:
49
71
  throw new Error("Unsupported command type");
50
72
  }
51
- };
73
+ });
52
74
  }
53
- const Nt = {
54
- simpleGitHooks: n({
55
- type: t.CLI,
75
+ const de = {
76
+ simpleGitHooks: t({
77
+ type: e.CLI,
56
78
  packages: [
57
79
  {
58
- name: z,
59
- type: e.DEV_DEPENDENCY
80
+ name: _e,
81
+ type: s.DEV_DEPENDENCY
60
82
  }
61
83
  ],
62
- command: Q
84
+ command: ae
63
85
  }),
64
- eslintInspect: n({
65
- type: t.CLI,
86
+ eslintInspect: t({
87
+ type: e.CLI,
66
88
  packages: [
67
89
  {
68
- name: Z,
69
- type: e.DEV_DEPENDENCY
90
+ name: Ie,
91
+ type: s.DEV_DEPENDENCY
70
92
  }
71
93
  ],
72
- command: tt
94
+ command: me
73
95
  }),
74
- nodeModulesInspect: n({
75
- type: t.CLI,
96
+ nodeModulesInspect: t({
97
+ type: e.CLI,
76
98
  packages: [
77
99
  {
78
- name: nt,
79
- type: e.DEV_DEPENDENCY
100
+ name: ie,
101
+ type: s.DEV_DEPENDENCY
80
102
  }
81
103
  ],
82
- command: et
104
+ command: pe
83
105
  }),
84
- eslintCheck: n({
85
- type: t.CLI,
106
+ eslintCheck: t({
107
+ type: e.CLI,
86
108
  packages: [
87
109
  {
88
- name: L,
89
- type: e.DEV_DEPENDENCY
110
+ name: y,
111
+ type: s.DEV_DEPENDENCY
90
112
  }
91
113
  ],
92
- command: `${M} ${s.WORKING_DIRECTORY} --no-cache`
114
+ command: `${A} ${_.WORKING_DIRECTORY} --no-cache`
93
115
  }),
94
- eslintFix: n({
95
- type: t.CLI,
116
+ eslintFix: t({
117
+ type: e.CLI,
96
118
  packages: [
97
119
  {
98
- name: L,
99
- type: e.DEV_DEPENDENCY
120
+ name: y,
121
+ type: s.DEV_DEPENDENCY
100
122
  }
101
123
  ],
102
- command: `${M} ${s.WORKING_DIRECTORY} --fix --no-cache`
124
+ command: `${A} ${_.WORKING_DIRECTORY} --fix --no-cache`
103
125
  }),
104
- typescriptCheck: n({
105
- type: t.CLI,
126
+ typescriptCheck: t({
127
+ type: e.CLI,
106
128
  packages: [
107
129
  {
108
- name: W,
109
- type: e.DEV_DEPENDENCY
130
+ name: se,
131
+ type: s.DEV_DEPENDENCY
110
132
  }
111
133
  ],
112
- command: `${X} -p ${s.TS_CONFIG} --noEmit`
134
+ command: `${ce} -p ${_.TS_CONFIG} --noEmit`
113
135
  }),
114
- testUnit: n({
115
- type: t.CLI,
136
+ testUnit: t({
137
+ type: e.CLI,
116
138
  packages: [
117
139
  {
118
- name: S,
119
- type: e.DEV_DEPENDENCY
140
+ name: u,
141
+ type: s.DEV_DEPENDENCY
120
142
  }
121
143
  ],
122
- command: `${l} --config ${s.VITEST_UNIT_CONFIG}`
144
+ command: `${f} --config ${_.VITEST_UNIT_CONFIG}`
123
145
  }),
124
- testE2e: n({
125
- type: t.CLI,
146
+ testE2e: t({
147
+ type: e.CLI,
126
148
  packages: [
127
149
  {
128
- name: S,
129
- type: e.DEV_DEPENDENCY
150
+ name: u,
151
+ type: s.DEV_DEPENDENCY
130
152
  }
131
153
  ],
132
- command: `${l} --config ${s.VITEST_E2E_CONFIG}`
154
+ command: `${f} --config ${_.VITEST_E2E_CONFIG}`
133
155
  }),
134
- mongoMigrateCreate: (c) => n({
135
- type: t.CLI,
156
+ mongoMigrateCreate: (E) => t({
157
+ type: e.CLI,
136
158
  packages: [
137
159
  {
138
- name: I,
139
- type: e.DEPENDENCY
160
+ name: i,
161
+ type: s.DEPENDENCY
140
162
  },
141
163
  {
142
- name: i,
143
- type: e.DEPENDENCY
164
+ name: l,
165
+ type: s.DEPENDENCY
144
166
  }
145
167
  ],
146
- command: `${I} ${C} create ${c} -f ${s.MIGRATE_MONGO_CONFIG}`
168
+ command: `${i} ${G} create ${E} -f ${_.MIGRATE_MONGO_CONFIG}`
147
169
  })(),
148
- mongoMigrateUp: n({
149
- type: t.CLI,
170
+ mongoMigrateUp: t({
171
+ type: e.CLI,
150
172
  packages: [
151
173
  {
152
- name: I,
153
- type: e.DEPENDENCY
174
+ name: i,
175
+ type: s.DEPENDENCY
154
176
  },
155
177
  {
156
- name: i,
157
- type: e.DEPENDENCY
178
+ name: l,
179
+ type: s.DEPENDENCY
158
180
  }
159
181
  ],
160
- command: `${I} ${C} up -f ${s.MIGRATE_MONGO_CONFIG}`
182
+ command: `${i} ${G} up -f ${_.MIGRATE_MONGO_CONFIG}`
161
183
  }),
162
- mongoMigrateDown: n({
163
- type: t.CLI,
184
+ mongoMigrateDown: t({
185
+ type: e.CLI,
164
186
  packages: [
165
187
  {
166
- name: I,
167
- type: e.DEPENDENCY
188
+ name: i,
189
+ type: s.DEPENDENCY
168
190
  },
169
191
  {
170
- name: i,
171
- type: e.DEPENDENCY
192
+ name: l,
193
+ type: s.DEPENDENCY
172
194
  }
173
195
  ],
174
- command: `${I} ${C} down -f ${s.MIGRATE_MONGO_CONFIG}`
196
+ command: `${i} ${G} down -f ${_.MIGRATE_MONGO_CONFIG}`
175
197
  }),
176
- commitLint: n({
177
- type: t.CLI,
198
+ commitLint: t({
199
+ type: e.CLI,
178
200
  packages: [
179
201
  {
180
- name: b,
181
- type: e.DEV_DEPENDENCY
202
+ name: te,
203
+ type: s.DEV_DEPENDENCY
182
204
  },
183
205
  {
184
- name: w,
185
- type: e.DEV_DEPENDENCY
206
+ name: ne,
207
+ type: s.DEV_DEPENDENCY
186
208
  }
187
209
  ],
188
- command: `${A} --edit ${s.GIT_COMMIT_MSG} --config ${s.COMMITLINT_CONFIG}`
210
+ command: `${K} --edit ${_.GIT_COMMIT_MSG} --config ${_.COMMITLINT_CONFIG}`
189
211
  }),
190
- lintStaged: n({
191
- type: t.CLI,
212
+ lintStaged: t({
213
+ type: e.CLI,
192
214
  packages: [
193
215
  {
194
- name: B,
195
- type: e.DEV_DEPENDENCY
216
+ name: oe,
217
+ type: s.DEV_DEPENDENCY
196
218
  }
197
219
  ],
198
- command: `${y} --config ${s.LINT_STAGED_CONFIG}`
220
+ command: `${k} --config ${_.LINT_STAGED_CONFIG}`
199
221
  }),
200
- configureGitHook: n({
201
- type: t.STRING,
202
- command: `${$} config core.hooksPath ${s.GIT_HOOK}`
222
+ configureGitHook: t({
223
+ type: e.STRING,
224
+ command: `${Y} config core.hooksPath ${_.GIT_HOOK}`
203
225
  }),
204
- build: n({
205
- type: t.STRING,
206
- command: `${_} run --if-present build`
226
+ build: t({
227
+ type: e.STRING,
228
+ command: `${p} run --if-present build`
207
229
  }),
208
- pnpmInstallStandard: n({
209
- type: t.STRING,
210
- command: `${_} install --ignore-scripts`
230
+ pnpmInstallStandard: t({
231
+ type: e.STRING,
232
+ command: `${p} install --ignore-scripts`
211
233
  }),
212
- pnpmInstallLegacy: n({
213
- type: t.STRING,
214
- command: `${_} install --ignore-scripts --legacy-peer-deps`
234
+ pnpmInstallLegacy: t({
235
+ type: e.STRING,
236
+ command: `${p} install --ignore-scripts --legacy-peer-deps`
215
237
  }),
216
- pnpmInstallForce: n({
217
- type: t.STRING,
218
- command: `${_} install --ignore-scripts --force`
238
+ pnpmInstallForce: t({
239
+ type: e.STRING,
240
+ command: `${p} install --ignore-scripts --force`
219
241
  }),
220
- pnpmPruneStore: n({
221
- type: t.STRING,
222
- command: `${_} store prune`
242
+ pnpmPruneStore: t({
243
+ type: e.STRING,
244
+ command: `${p} store prune`
223
245
  }),
224
- pnpmCleanCache: n({
225
- type: t.STRING,
226
- command: `${_} cache delete`
246
+ pnpmCleanCache: t({
247
+ type: e.STRING,
248
+ command: `${p} cache delete`
227
249
  })
228
250
  };
229
251
  export {
230
- Y as BUILD_DIRECTORY,
231
- A as COMMIT_LINT_CLI,
232
- w as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,
233
- b as COMMIT_LINT_PACKAGE_NAME,
234
- at as CYBERSKILL_CLI,
235
- it as CYBERSKILL_CLI_PATH,
236
- E as CYBERSKILL_DIRECTORY,
237
- D as CYBERSKILL_PACKAGE_NAME,
238
- M as ESLINT_CLI,
239
- tt as ESLINT_INSPECT_CLI,
240
- Z as ESLINT_INSPECT_PACKAGE_NAME,
241
- L as ESLINT_PACKAGE_NAME,
242
- $ as GIT_CLI,
243
- J as GIT_COMMIT_EDITMSG,
244
- j as GIT_HOOK,
245
- U as GIT_IGNORE,
246
- y as LINT_STAGED_CLI,
247
- B as LINT_STAGED_PACKAGE_NAME,
248
- C as MIGRATE_MONGO_CLI,
249
- x as MIGRATE_MONGO_CONFIG,
250
- i as MIGRATE_MONGO_PACKAGE_NAME,
251
- d as NODE_MODULES,
252
- et as NODE_MODULES_INSPECT_CLI,
253
- nt as NODE_MODULES_INSPECT_PACKAGE_NAME,
254
- P as PACKAGE_JSON,
255
- h as PACKAGE_LOCK_JSON,
256
- s as PATH,
257
- _ as PNPM_CLI,
258
- q as PNPM_EXEC_CLI,
259
- H as PNPM_LOCK_YAML,
260
- F as PUBLIC_DIRECTORY,
261
- z as SIMPLE_GIT_HOOKS_PACKAGE_NAME,
262
- Q as SIMPLE_GIT_HOOK_CLI,
263
- v as SIMPLE_GIT_HOOK_JSON,
264
- V as TSCONFIG_JSON,
265
- X as TSC_CLI,
266
- W as TSC_PACKAGE_NAME,
267
- I as TSX_CLI,
268
- l as VITEST_CLI,
269
- S as VITEST_PACKAGE_NAME,
270
- p as WORKING_DIRECTORY,
271
- Nt as command,
272
- Ct as createGitHooksConfig
252
+ J as BUILD_DIRECTORY,
253
+ K as COMMIT_LINT_CLI,
254
+ ne as COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME,
255
+ te as COMMIT_LINT_PACKAGE_NAME,
256
+ ge as CYBERSKILL_CLI,
257
+ De as CYBERSKILL_CLI_PATH,
258
+ m as CYBERSKILL_DIRECTORY,
259
+ S as CYBERSKILL_PACKAGE_NAME,
260
+ A as ESLINT_CLI,
261
+ me as ESLINT_INSPECT_CLI,
262
+ Ie as ESLINT_INSPECT_PACKAGE_NAME,
263
+ y as ESLINT_PACKAGE_NAME,
264
+ Y as GIT_CLI,
265
+ Z as GIT_COMMIT_EDITMSG,
266
+ Q as GIT_HOOK,
267
+ X as GIT_IGNORE,
268
+ k as LINT_STAGED_CLI,
269
+ oe as LINT_STAGED_PACKAGE_NAME,
270
+ G as MIGRATE_MONGO_CLI,
271
+ ee as MIGRATE_MONGO_CONFIG,
272
+ l as MIGRATE_MONGO_PACKAGE_NAME,
273
+ $ as NODE_MODULES,
274
+ pe as NODE_MODULES_INSPECT_CLI,
275
+ ie as NODE_MODULES_INSPECT_PACKAGE_NAME,
276
+ R as PACKAGE_JSON,
277
+ B as PACKAGE_LOCK_JSON,
278
+ _ as PATH,
279
+ p as PNPM_CLI,
280
+ Ee as PNPM_EXEC_CLI,
281
+ z as PNPM_LOCK_YAML,
282
+ x as PUBLIC_DIRECTORY,
283
+ _e as SIMPLE_GIT_HOOKS_PACKAGE_NAME,
284
+ ae as SIMPLE_GIT_HOOK_CLI,
285
+ q as SIMPLE_GIT_HOOK_JSON,
286
+ W as TSCONFIG_JSON,
287
+ ce as TSC_CLI,
288
+ se as TSC_PACKAGE_NAME,
289
+ i as TSX_CLI,
290
+ f as VITEST_CLI,
291
+ u as VITEST_PACKAGE_NAME,
292
+ D as WORKING_DIRECTORY,
293
+ de as command,
294
+ Le as createGitHooksConfig
273
295
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:path"),t=require("../../config/env/env.util.cjs"),o=t.getEnv(),n=r,i=n.dirname;function s(...e){return n.resolve(o.CWD,...e)}function u(...e){return n.resolve(...e)}function a(...e){return n.join(...e)}exports.dirname=i;exports.join=a;exports.path=n;exports.resolve=u;exports.resolveWorkingPath=s;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./storage.util.cjs");exports.storage=e.storage;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("node-persist"),f=require("../../config/env/env.util.cjs"),u=require("../log/log.util.cjs");var l=(r,e,n)=>new Promise((h,a)=>{var d=t=>{try{c(n.next(t))}catch(s){a(s)}},v=t=>{try{c(n.throw(t))}catch(s){a(s)}},c=t=>t.done?h(t.value):Promise.resolve(t.value).then(d,v);c((n=n.apply(r,e)).next())});const y=f.getEnv();function o(){return l(this,null,function*(){i.defaultInstance||(yield i.init({dir:y.CYBERSKILL_STORAGE_DIRECTORY}))})}const E={get(r){return l(this,null,function*(){try{yield o();const e=yield i.getItem(r);return e!=null?e:null}catch(e){return u.catchError(e,{returnValue:null})}})},set(r,e){return l(this,null,function*(){try{yield o(),yield i.setItem(r,e)}catch(n){u.catchError(n)}})},remove(r){return l(this,null,function*(){try{yield o(),yield i.removeItem(r)}catch(e){u.catchError(e)}})},keys(){return l(this,null,function*(){try{yield o();const r=yield i.keys();return Array.isArray(r)?r:(u.log.warn("[Storage:keys] Invalid keys response:",r),[])}catch(r){return u.catchError(r,{returnValue:[]})}})},getLogLink(r){return l(this,null,function*(){try{return`${y.CYBERSKILL_STORAGE_DIRECTORY} (key: ${r})`}catch(e){return u.catchError(e,{returnValue:null})}})}};exports.storage=E;
@@ -1,51 +1,81 @@
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) {
1
+ import u from "node-persist";
2
+ import { getEnv as m } from "../../config/env/env.util.js";
3
+ import { catchError as i, log as v } from "../log/log.util.js";
4
+ var l = (r, e, n) => new Promise((h, a) => {
5
+ var d = (t) => {
12
6
  try {
13
- return await n(), await e.getItem(r) ?? null;
14
- } catch (t) {
15
- return a(t, { returnValue: null });
7
+ s(n.next(t));
8
+ } catch (c) {
9
+ a(c);
16
10
  }
17
- },
18
- async set(r, t) {
11
+ }, f = (t) => {
19
12
  try {
20
- await n(), await e.setItem(r, t);
21
- } catch (o) {
22
- a(o);
13
+ s(n.throw(t));
14
+ } catch (c) {
15
+ a(c);
23
16
  }
17
+ }, s = (t) => t.done ? h(t.value) : Promise.resolve(t.value).then(d, f);
18
+ s((n = n.apply(r, e)).next());
19
+ });
20
+ const y = m();
21
+ function o() {
22
+ return l(this, null, function* () {
23
+ u.defaultInstance || (yield u.init({
24
+ dir: y.CYBERSKILL_STORAGE_DIRECTORY
25
+ }));
26
+ });
27
+ }
28
+ const R = {
29
+ get(r) {
30
+ return l(this, null, function* () {
31
+ try {
32
+ yield o();
33
+ const e = yield u.getItem(r);
34
+ return e != null ? e : null;
35
+ } catch (e) {
36
+ return i(e, { returnValue: null });
37
+ }
38
+ });
24
39
  },
25
- async remove(r) {
26
- try {
27
- await n(), await e.removeItem(r);
28
- } catch (t) {
29
- a(t);
30
- }
40
+ set(r, e) {
41
+ return l(this, null, function* () {
42
+ try {
43
+ yield o(), yield u.setItem(r, e);
44
+ } catch (n) {
45
+ i(n);
46
+ }
47
+ });
31
48
  },
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
- }
49
+ remove(r) {
50
+ return l(this, null, function* () {
51
+ try {
52
+ yield o(), yield u.removeItem(r);
53
+ } catch (e) {
54
+ i(e);
55
+ }
56
+ });
40
57
  },
41
- async getLogLink(r) {
42
- try {
43
- return `${s.CYBERSKILL_STORAGE_DIRECTORY} (key: ${r})`;
44
- } catch (t) {
45
- return a(t, { returnValue: null });
46
- }
58
+ keys() {
59
+ return l(this, null, function* () {
60
+ try {
61
+ yield o();
62
+ const r = yield u.keys();
63
+ return Array.isArray(r) ? r : (v.warn("[Storage:keys] Invalid keys response:", r), []);
64
+ } catch (r) {
65
+ return i(r, { returnValue: [] });
66
+ }
67
+ });
68
+ },
69
+ getLogLink(r) {
70
+ return l(this, null, function* () {
71
+ try {
72
+ return `${y.CYBERSKILL_STORAGE_DIRECTORY} (key: ${r})`;
73
+ } catch (e) {
74
+ return i(e, { returnValue: null });
75
+ }
76
+ });
47
77
  }
48
78
  };
49
79
  export {
50
- m as storage
80
+ R as storage
51
81
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./upload.type.cjs"),e=require("./upload.util.cjs");Object.defineProperty(exports,"E_UploadType",{enumerable:!0,get:()=>o.E_UploadType});exports.createUploadConfig=e.createUploadConfig;exports.upload=e.upload;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.E_UploadType=(t=>(t.IMAGE="IMAGE",t.VIDEO="VIDEO",t.DOCUMENT="DOCUMENT",t.OTHER="OTHER",t))(exports.E_UploadType||{});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./upload.type.cjs"),_=require("../path/path.util.cjs"),m=require("../fs/fs.util.cjs");var x=Object.defineProperty,v=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,E=(t,r,e)=>r in t?x(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,g=(t,r)=>{for(var e in r||(r={}))h.call(r,e)&&E(t,e,r[e]);if(v)for(var e of v(r))z.call(r,e)&&E(t,e,r[e]);return t},w=(t,r,e)=>new Promise((i,l)=>{var n=o=>{try{a(e.next(o))}catch(u){l(u)}},s=o=>{try{a(e.throw(o))}catch(u){l(u)}},a=o=>o.done?i(o.value):Promise.resolve(o.value).then(n,s);a((e=e.apply(t,r)).next())});function O(t){return w(this,null,function*(){return new Promise((r,e)=>{let i=0;t.on("data",l=>{i+=l.length}),t.on("end",()=>r(i)),t.on("error",e)})})}function S(t,r){const e=t.lastIndexOf(".");if(e===-1)return!1;const i=t.substring(e+1).toLowerCase();return r.includes(i)}function T(t,r,e){const{filename:i,fileSize:l}=t,n=r[e],{allowedExtensions:s,sizeLimit:a}=n;if(!S(i,s))return{isValid:!1,error:`File extension not allowed for ${e.toLowerCase()} files. Allowed extensions: ${s.join(", ")}`};if(l!==void 0&&l>a){const o=Math.round(a/1048576);return{isValid:!1,error:`File size exceeds limit for ${e.toLowerCase()} files. Maximum size: ${o}MB`}}return{isValid:!0}}function U(t){const r={[f.E_UploadType.IMAGE]:{allowedExtensions:["jpg","jpeg","png","gif","webp","svg"],sizeLimit:5242880},[f.E_UploadType.VIDEO]:{allowedExtensions:["mp4","avi","mov","wmv","flv","webm"],sizeLimit:524288e3},[f.E_UploadType.DOCUMENT]:{allowedExtensions:["pdf","doc","docx","txt","rtf"],sizeLimit:10485760},[f.E_UploadType.OTHER]:{allowedExtensions:["zip","rar","tar","gz"],sizeLimit:5242880}};return g(g({},r),t)}function I(t){return w(this,null,function*(){const{path:r,file:e,config:i,type:l}=t;if(!r||typeof r!="string")return{success:!1,message:"Invalid path provided",result:""};if(!e||typeof e!="object")return{success:!1,message:"Invalid file provided",result:""};if(i){const n=[f.E_UploadType.IMAGE,f.E_UploadType.VIDEO,f.E_UploadType.DOCUMENT,f.E_UploadType.OTHER];for(const s of n){if(!i[s]||!Array.isArray(i[s].allowedExtensions)||i[s].allowedExtensions.length===0)return{success:!1,message:`Invalid config for ${s.toLowerCase()} files`,result:""};if(typeof i[s].sizeLimit!="number"||i[s].sizeLimit<=0)return{success:!1,message:`Invalid size limit for ${s.toLowerCase()} files`,result:""}}}try{const n=yield(yield e).file,{filename:s,createReadStream:a}=n;if(i){const p=a(),d=yield O(p),y=T({filename:s,fileSize:d},i,l);if(!y.isValid)return{success:!1,message:y.error||"File validation failed",result:""}}const o=_.dirname(r);m.pathExistsSync(o)||m.mkdirSync(o,{recursive:!0});const u=a(),c=m.createWriteStream(r);return u.pipe(c),yield new Promise((p,d)=>{c.on("finish",()=>p()),c.on("error",d),u.on("error",d)}),{success:!0,message:"File uploaded successfully",result:r}}catch(n){return{success:!1,message:n instanceof Error?n.message:"File upload failed",result:""}}})}exports.createUploadConfig=U;exports.upload=I;